From nobody Fri May 3 14:13:16 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=quarantine dis=quarantine) header.from=ti.com ARC-Seal: i=1; a=rsa-sha256; t=1618499810; cv=none; d=zohomail.com; s=zohoarc; b=iPjx7jmOHZ+tx+1Dvf1DnXgVFRg5AKNJwj6V2YNSDCe3I9G78rdfJPEZ3HrW7h/u/2Dqwxo1GrRjiXLhztScG0Nn9dHA6oygeUNiAmQIZRIWBaivuC3UtpDVP5/i3Kv6rKG7gKE1645YjEzhnPi1rkzl20nIZ06zFcWecYoU7zs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618499810; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=BC7NZaFwou0Qy/69BHgGrbZVOjCGaSW7Bk5Vk/gujgA=; b=V1BbXZqPv4Q5gl5q5HC4cfvJcGFmsD4grAW+0aQ8QUe+4j6Ap9k4M7ypJBkcoQF5xpgyYMwKQ1GheH+wZ/ogNDbLdkE/P09j5a2EClC74l5WT4Aqm5xqbhBV/+xg8UgO88/PR97oTbY5vqut/9ylMr8ETB21dvTE0O0MDwg4kgA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1618499810730557.1970488516728; Thu, 15 Apr 2021 08:16:50 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232913AbhDOPQh (ORCPT ); Thu, 15 Apr 2021 11:16:37 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:39968 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233744AbhDOPHL (ORCPT ); Thu, 15 Apr 2021 11:07:11 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 13FF6dsx105271; Thu, 15 Apr 2021 10:06:39 -0500 Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 13FF6d5U018302 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Apr 2021 10:06:39 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 15 Apr 2021 10:06:38 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 15 Apr 2021 10:06:38 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 13FF6TGI129989; Thu, 15 Apr 2021 10:06:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1618499199; bh=BC7NZaFwou0Qy/69BHgGrbZVOjCGaSW7Bk5Vk/gujgA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QbLcGhZR2wJhGIwnDutDkFJIStspfT7QXW+o1+cvBojtDLyjTL4PgFfquwLbIKIwh nGxRBfx2j/pCu6rt0WYb9Z5nZoYBpLdx7SIv5flt36EziYlR+/1uc7sgxVUtB5eICu DoegcwJiLBUrXakLKayg+2TpQpLab3FTeJG3+nIA= From: Aswath Govindraju CC: , , , , Marc Kleine-Budde , Wolfgang Grandegger , Rob Herring , "David S . Miller" , Jakub Kicinski , Chandrasekar Ramakrishnan , Kishon Vijay Abraham I , Lokesh Vutla , Vignesh Raghavendra , Grygorii Strashko , Aswath Govindraju Subject: [PATCH 1/2] dt-bindings: net: can: Document transceiver implementation as phy Date: Thu, 15 Apr 2021 20:36:28 +0530 Message-ID: <20210415150629.5417-2-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210415150629.5417-1-a-govindraju@ti.com> References: <20210415150629.5417-1-a-govindraju@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Faiz Abbas Some transceivers need a configuration step (for example, pulling the standby or enable lines) for them to start sending messages. The transceiver can be implemented as a phy with the configuration done in the phy driver. The bit rate limitation can the be obtained by the driver using the phy node. Document the above implementation in the bosch mcan bindings Signed-off-by: Faiz Abbas Signed-off-by: Aswath Govindraju --- Documentation/devicetree/bindings/net/can/bosch,m_can.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml b/D= ocumentation/devicetree/bindings/net/can/bosch,m_can.yaml index 798fa5fb7bb2..25f74db46bae 100644 --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml @@ -109,6 +109,9 @@ properties: can-transceiver: $ref: can-transceiver.yaml# =20 + phys: + maxItems: 1 + required: - compatible - reg --=20 2.17.1 From nobody Fri May 3 14:13:16 2024 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=quarantine dis=quarantine) header.from=ti.com ARC-Seal: i=1; a=rsa-sha256; t=1618499812; cv=none; d=zohomail.com; s=zohoarc; b=Z+zoZP5Gvviev9SkYrBHWAB5vgLyLVLj4VMNSvBftI0aDnwXpi6L2ZUD//v22ygid+P7yY2ot8osPtPRSDuc6fHjo/GnzW1BQkNL1wxegDhZXcVqv5P2q4nPW2G+6324Zw6btMmoq3mqlhSGfWH7uWklccyWzXaaZYOCJbfISr8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618499812; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=ZUQ7eGe9TC2rG+9jEiaBnwOBWIoWkbZdY2OQh2g7HDs=; b=J6nTJB95p141gwINNS1cTAscC0JRhvTXyxeESuXGNgu8TvR57A20LVLvo9W5a41aNZ/uaY6zMRID6DVL3LFfIUmasma5WpFKHgOw8rC5Cyu0i9lz+gkiIiTB77TPsF+j2c3/dPtCPXe4vUQi/Oa+ktSiYcMtcMwu+ko/loc5+j4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1618499812370196.7936007810506; Thu, 15 Apr 2021 08:16:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234809AbhDOPQy (ORCPT ); Thu, 15 Apr 2021 11:16:54 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:39996 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233969AbhDOPHP (ORCPT ); Thu, 15 Apr 2021 11:07:15 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 13FF6h3G105295; Thu, 15 Apr 2021 10:06:43 -0500 Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 13FF6hXv018345 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 15 Apr 2021 10:06:43 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 15 Apr 2021 10:06:43 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Thu, 15 Apr 2021 10:06:43 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 13FF6TGJ129989; Thu, 15 Apr 2021 10:06:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1618499203; bh=ZUQ7eGe9TC2rG+9jEiaBnwOBWIoWkbZdY2OQh2g7HDs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Ut1TFhKZWYZSN92LaS+mGFbd4oytZy9Rijl+b0tqiVLfI68dcZH/YgA6ZsQWrNf4H Rea1DGrtD97vOH7aMMbB54pXuVRT6q0FR8adto4+OIFwGR8xUNz5vCYwoBD/0dEAaZ AhDnRtaeh1jfy83LTrBPD/FD3BwTC/oUNoNqq0Ek= From: Aswath Govindraju CC: , , , , Marc Kleine-Budde , Wolfgang Grandegger , Rob Herring , "David S . Miller" , Jakub Kicinski , Chandrasekar Ramakrishnan , Kishon Vijay Abraham I , Lokesh Vutla , Vignesh Raghavendra , Grygorii Strashko , Aswath Govindraju Subject: [PATCH 2/2] can: m_can: Add support for transceiver as phy Date: Thu, 15 Apr 2021 20:36:29 +0530 Message-ID: <20210415150629.5417-3-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210415150629.5417-1-a-govindraju@ti.com> References: <20210415150629.5417-1-a-govindraju@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Faiz Abbas Add support for implementing transceiver node as phy. The max_bitrate is obtained by getting a phy attribute. Signed-off-by: Faiz Abbas Signed-off-by: Aswath Govindraju --- drivers/net/can/m_can/m_can.c | 10 ++++++++++ drivers/net/can/m_can/m_can.h | 2 ++ drivers/net/can/m_can/m_can_platform.c | 13 +++++++++++++ 3 files changed, 25 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index 34073cd077e4..7d31250446c2 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -21,6 +21,7 @@ #include #include #include +#include =20 #include "m_can.h" =20 @@ -1514,6 +1515,7 @@ static void m_can_stop(struct net_device *dev) static int m_can_close(struct net_device *dev) { struct m_can_classdev *cdev =3D netdev_priv(dev); + int err; =20 netif_stop_queue(dev); =20 @@ -1536,6 +1538,10 @@ static int m_can_close(struct net_device *dev) close_candev(dev); can_led_event(dev, CAN_LED_EVENT_STOP); =20 + err =3D phy_power_off(cdev->transceiver); + if (err) + return err; + return 0; } =20 @@ -1720,6 +1726,10 @@ static int m_can_open(struct net_device *dev) struct m_can_classdev *cdev =3D netdev_priv(dev); int err; =20 + err =3D phy_power_on(cdev->transceiver); + if (err) + return err; + err =3D m_can_clk_start(cdev); if (err) return err; diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h index ace071c3e58c..38cad068abad 100644 --- a/drivers/net/can/m_can/m_can.h +++ b/drivers/net/can/m_can/m_can.h @@ -28,6 +28,7 @@ #include #include #include +#include =20 /* m_can lec values */ enum m_can_lec_type { @@ -82,6 +83,7 @@ struct m_can_classdev { struct workqueue_struct *tx_wq; struct work_struct tx_work; struct sk_buff *tx_skb; + struct phy *transceiver; =20 struct can_bittiming_const *bit_timing; struct can_bittiming_const *data_timing; diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can= /m_can_platform.c index 599de0e08cd7..006e13ee7cd7 100644 --- a/drivers/net/can/m_can/m_can_platform.c +++ b/drivers/net/can/m_can/m_can_platform.c @@ -6,6 +6,7 @@ // Copyright (C) 2018-19 Texas Instruments Incorporated - http://www.ti.co= m/ =20 #include +#include =20 #include "m_can.h" =20 @@ -67,6 +68,7 @@ static int m_can_plat_probe(struct platform_device *pdev) struct resource *res; void __iomem *addr; void __iomem *mram_addr; + struct phy *transceiver; int irq, ret =3D 0; =20 mcan_class =3D m_can_class_allocate_dev(&pdev->dev, @@ -101,6 +103,16 @@ static int m_can_plat_probe(struct platform_device *pd= ev) goto probe_fail; } =20 + transceiver =3D devm_of_phy_optional_get_by_index(&pdev->dev, pdev->dev.o= f_node, 0); + if (IS_ERR(transceiver)) { + ret =3D PTR_ERR(transceiver); + dev_err(&pdev->dev, "error while getting phy, err=3D%d\n", ret); + return ret; + } + + if (transceiver) + priv->cdev.can.bitrate_max =3D transceiver->attrs.max_link_rate; + priv->base =3D addr; priv->mram_base =3D mram_addr; =20 @@ -108,6 +120,7 @@ static int m_can_plat_probe(struct platform_device *pde= v) mcan_class->pm_clock_support =3D 1; mcan_class->can.clock.freq =3D clk_get_rate(mcan_class->cclk); mcan_class->dev =3D &pdev->dev; + mcan_class->transceiver =3D transceiver; =20 mcan_class->ops =3D &m_can_plat_ops; =20 --=20 2.17.1