From nobody Fri May 3 15:40:39 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=1617975696; cv=none; d=zohomail.com; s=zohoarc; b=L7KYAcsFeiRMx3WpvDKYRCiNAjguRJZfE/NRT1x9Ts23pxWcftzOdIS4BY4H1BH2zcKhhzcISa2GfNdj0unXAA2PmV8ZXmSnr/YRH+swZC4ZOUo++7YZtSeIIow53/5PdgimDSXQ6fvyY8gDLPzThE5ECqKu3RbMyx3NGKL/yJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617975696; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=jQPpt4S1DnHQg4JIjtFQd2KErsuDw2nOfdoc6PnnXc8=; b=RgB8KCjD4tF8sJQqyi7DeT6MEZoolktgpRwKec28T1cHBjht9098CG7ghAMoY3Le/kGdhklL2UQMVTlYnhO9ziSgtAj1IwMEl6ShCxp5eN4I3lAiJ0tZPF5B4llFns+jZDtL6dljfLPKIJypT3vQRNkCqg25JwZ3HUV63a4eMAk= 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 1617975696984188.6044032983591; Fri, 9 Apr 2021 06:41:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233820AbhDINls (ORCPT ); Fri, 9 Apr 2021 09:41:48 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:52384 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbhDINlk (ORCPT ); Fri, 9 Apr 2021 09:41:40 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 139DfCA1029236; Fri, 9 Apr 2021 08:41:12 -0500 Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 139DfCZj026514 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Apr 2021 08:41:12 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) 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; Fri, 9 Apr 2021 08:41:12 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com (10.64.6.23) 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; Fri, 9 Apr 2021 08:41:11 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 139Dewma029277; Fri, 9 Apr 2021 08:41:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617975672; bh=jQPpt4S1DnHQg4JIjtFQd2KErsuDw2nOfdoc6PnnXc8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Yg475CoGQxDp/kXNslzuaQ1aNSWpqJ0UnjBUsVmnHK/7IMm/95VjXH7p9lLu/BXry WiWM4+repTN59FD97RZB1Oj1rE67mEVKDO3TVbFFhOcGGgjdJ9y9VAXfhaFZTd4omq 8+y61jFu8N6F+4HJJjnzbWHZvO0F1oRMsoquVrWk= From: Aswath Govindraju CC: Vignesh Raghavendra , Kishon Vijay Abraham I , Lokesh Vutla , Grygorii Strashko , Aswath Govindraju , Chandrasekar Ramakrishnan , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Rob Herring , Vinod Koul , Sriram Dash , , , , , Subject: [PATCH 1/4] dt-bindings: phy: Add binding for TI TCAN104x CAN transceivers Date: Fri, 9 Apr 2021 19:10:51 +0530 Message-ID: <20210409134056.18740-2-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210409134056.18740-1-a-govindraju@ti.com> References: <20210409134056.18740-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" Add binding documentation for TI TCAN104x CAN transceivers. Signed-off-by: Aswath Govindraju --- .../bindings/phy/ti,tcan104x-can.yaml | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/ti,tcan104x-can.y= aml diff --git a/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml b/D= ocumentation/devicetree/bindings/phy/ti,tcan104x-can.yaml new file mode 100644 index 000000000000..4abfc30a97d0 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/ti,tcan104x-can.yaml @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/phy/ti,tcan104x-can.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TCAN104x CAN TRANSCEIVER PHY + +maintainers: + - Aswath Govindraju + +properties: + $nodename: + pattern: "^tcan104x-phy" + + compatible: + enum: + - ti,tcan1042 + - ti,tcan1043 + + '#phy-cells': + const: 0 + + standby-gpios: + description: + gpio node to toggle standby signal on transceiver + maxItems: 1 + + enable-gpios: + description: + gpio node to toggle enable signal on transceiver + maxItems: 1 + + max-bitrate: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + max bit rate supported in bps + minimum: 1 + +required: + - compatible + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include + + transceiver1: tcan104x-phy { + compatible =3D "ti,tcan1043"; + #phy-cells =3D <0>; + max-bitrate =3D <5000000>; + standby-gpios =3D <&wakeup_gpio1 16 GPIO_ACTIVE_LOW>; + enable-gpios =3D <&main_gpio1 67 GPIO_ACTIVE_LOW>; + }; --=20 2.17.1 From nobody Fri May 3 15:40:39 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=1617975699; cv=none; d=zohomail.com; s=zohoarc; b=SAQ//FdRQREg/rxx+8HZUsmRxRd9YZKvacvrTJ0eeCWyzUAXljezS0KBk5SP0dbEpEYacUwAW42eZhIGHDc3jVn+gc8vFlorpa2ZgGDdDJ2OwI2XUPA2ZrkyXdfyEHAxe0cv7oOuBY5X9iWNsPPDAqVrniI7ss3zxzTznElrB3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617975699; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=37q0yMF4ApHnmzKxFdPrCY3SCyejOTZ5nty4L0ZBAOY=; b=HO2dzqjhtXKMzON5uqlYLlBmLGAG1yyyzBmRSjoIF/dA4XBNMhFJCPYH82spGnfWzRXt2gST2q3IoiBDeVgI1CTeKG1i/595auk9f0vzpwq784KqZtJeEd4TAX5nPT3O6tq0FqE6CODB3wphchLenaQ3YS7dV1ELSNHDB39l0p0= 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 1617975699507197.11568147347134; Fri, 9 Apr 2021 06:41:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233854AbhDINlv (ORCPT ); Fri, 9 Apr 2021 09:41:51 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:52406 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233794AbhDINlp (ORCPT ); Fri, 9 Apr 2021 09:41:45 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 139DfKvO029263; Fri, 9 Apr 2021 08:41:20 -0500 Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 139DfKwF116414 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Apr 2021 08:41:20 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 9 Apr 2021 08:41:20 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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 via Frontend Transport; Fri, 9 Apr 2021 08:41:20 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 139Dewmb029277; Fri, 9 Apr 2021 08:41:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617975680; bh=37q0yMF4ApHnmzKxFdPrCY3SCyejOTZ5nty4L0ZBAOY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EpM6zh4mHCMuAMdL7KpNeTeuVitHeVvMHA4lHR79cYXUvrHzdTZdkCeOYpvnpQN/e xX/ykbHYra9AFD5DIfRMEh+/14lSS14Fn4OtP8ibtWyjmWwXUPCTAMoyPoK3RqFP/y vqHb3Mzy0sW9dyo32iulxi/xmtBuYSNMHYO/i0xY= From: Aswath Govindraju CC: Vignesh Raghavendra , Kishon Vijay Abraham I , Lokesh Vutla , Grygorii Strashko , Aswath Govindraju , Chandrasekar Ramakrishnan , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Rob Herring , Vinod Koul , Sriram Dash , , , , , Subject: [PATCH 2/4] phy: phy-can-transceiver: Add support for generic CAN transceiver driver Date: Fri, 9 Apr 2021 19:10:52 +0530 Message-ID: <20210409134056.18740-3-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210409134056.18740-1-a-govindraju@ti.com> References: <20210409134056.18740-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" The driver adds support for generic CAN transceivers. Currently the modes supported by this driver are standby and normal modes for TI TCAN1042 and TCAN1043 CAN transceivers. The transceiver is modelled as a phy with pins controlled by gpios, to put the transceiver in various device functional modes. It also gets the phy attribute max_link_rate for the usage of m_can drivers. Signed-off-by: Aswath Govindraju --- drivers/phy/Kconfig | 9 ++ drivers/phy/Makefile | 1 + drivers/phy/phy-can-transceiver.c | 140 ++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 drivers/phy/phy-can-transceiver.c diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 54c1f2f0985f..51902b629fc6 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -61,6 +61,15 @@ config USB_LGM_PHY interface to interact with USB GEN-II and USB 3.x PHY that is part of the Intel network SOC. =20 +config PHY_CAN_TRANSCEIVER + tristate "CAN transceiver PHY" + select GENERIC_PHY + help + This option enables support for CAN transceivers as a PHY. This + driver provides function for putting the transceivers in various + functional modes using gpios and sets the attribute max link + rate, for mcan drivers. + source "drivers/phy/allwinner/Kconfig" source "drivers/phy/amlogic/Kconfig" source "drivers/phy/broadcom/Kconfig" diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile index adac1b1a39d1..9c66101c9605 100644 --- a/drivers/phy/Makefile +++ b/drivers/phy/Makefile @@ -9,6 +9,7 @@ obj-$(CONFIG_PHY_LPC18XX_USB_OTG) +=3D phy-lpc18xx-usb-otg.o obj-$(CONFIG_PHY_XGENE) +=3D phy-xgene.o obj-$(CONFIG_PHY_PISTACHIO_USB) +=3D phy-pistachio-usb.o obj-$(CONFIG_USB_LGM_PHY) +=3D phy-lgm-usb.o +obj-$(CONFIG_PHY_CAN_TRANSCEIVER) +=3D phy-can-transceiver.o obj-y +=3D allwinner/ \ amlogic/ \ broadcom/ \ diff --git a/drivers/phy/phy-can-transceiver.c b/drivers/phy/phy-can-transc= eiver.c new file mode 100644 index 000000000000..14496f6e1666 --- /dev/null +++ b/drivers/phy/phy-can-transceiver.c @@ -0,0 +1,140 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * phy-can-transceiver.c - phy driver for CAN transceivers + * + * Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com + * + */ +#include +#include +#include +#include +#include + +struct can_transceiver_data { + u32 flags; +#define STB_PRESENT BIT(0) +#define EN_PRESENT BIT(1) +}; + +struct can_transceiver_phy { + struct phy *generic_phy; + struct gpio_desc *standby_gpio; + struct gpio_desc *enable_gpio; +}; + +/* Power on function */ +static int can_transceiver_phy_power_on(struct phy *phy) +{ + struct can_transceiver_phy *can_transceiver_phy =3D phy_get_drvdata(phy); + + if (can_transceiver_phy->standby_gpio) + gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 0); + if (can_transceiver_phy->enable_gpio) + gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 1); + return 0; +} + +/* Power off function */ +static int can_transceiver_phy_power_off(struct phy *phy) +{ + struct can_transceiver_phy *can_transceiver_phy =3D phy_get_drvdata(phy); + + if (can_transceiver_phy->standby_gpio) + gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 1); + if (can_transceiver_phy->enable_gpio) + gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 0); + return 0; +} + +static const struct phy_ops can_transceiver_phy_ops =3D { + .power_on =3D can_transceiver_phy_power_on, + .power_off =3D can_transceiver_phy_power_off, + .owner =3D THIS_MODULE, +}; + +static const struct can_transceiver_data tcan1042_drvdata =3D { + .flags =3D STB_PRESENT, +}; + +static const struct can_transceiver_data tcan1043_drvdata =3D { + .flags =3D STB_PRESENT | EN_PRESENT, +}; + +static const struct of_device_id can_transceiver_phy_ids[] =3D { + { + .compatible =3D "ti,tcan1042", + .data =3D &tcan1042_drvdata + }, + { + .compatible =3D "ti,tcan1043", + .data =3D &tcan1043_drvdata + }, + { } +}; +MODULE_DEVICE_TABLE(of, can_transceiver_phy_ids); + +int can_transceiver_phy_probe(struct platform_device *pdev) +{ + struct phy_provider *phy_provider; + struct device *dev =3D &pdev->dev; + struct can_transceiver_phy *can_transceiver_phy; + const struct can_transceiver_data *drvdata; + const struct of_device_id *match; + struct phy *phy; + struct gpio_desc *standby_gpio; + struct gpio_desc *enable_gpio; + u32 max_bitrate =3D 0; + + can_transceiver_phy =3D devm_kzalloc(dev, sizeof(struct can_transceiver_p= hy), GFP_KERNEL); + + match =3D of_match_node(can_transceiver_phy_ids, pdev->dev.of_node); + drvdata =3D match->data; + + phy =3D devm_phy_create(dev, dev->of_node, + &can_transceiver_phy_ops); + if (IS_ERR(phy)) { + dev_err(dev, "failed to create can transceiver phy\n"); + return PTR_ERR(phy); + } + + device_property_read_u32(dev, "max-bitrate", &max_bitrate); + phy->attrs.max_link_rate =3D max_bitrate / 1000000; + + can_transceiver_phy->generic_phy =3D phy; + + if (drvdata->flags & STB_PRESENT) { + standby_gpio =3D devm_gpiod_get(dev, "standby", GPIOD_OUT_LOW); + if (IS_ERR(standby_gpio)) + return PTR_ERR(standby_gpio); + can_transceiver_phy->standby_gpio =3D standby_gpio; + } + + if (drvdata->flags & EN_PRESENT) { + enable_gpio =3D devm_gpiod_get(dev, "enable", GPIOD_OUT_LOW); + if (IS_ERR(enable_gpio)) + return PTR_ERR(enable_gpio); + can_transceiver_phy->enable_gpio =3D enable_gpio; + } + + phy_set_drvdata(can_transceiver_phy->generic_phy, can_transceiver_phy); + + phy_provider =3D devm_of_phy_provider_register(dev, of_phy_simple_xlate); + + return PTR_ERR_OR_ZERO(phy_provider); +} + +static struct platform_driver can_transceiver_phy_driver =3D { + .probe =3D can_transceiver_phy_probe, + .driver =3D { + .name =3D "can-transceiver-phy", + .of_match_table =3D can_transceiver_phy_ids, + }, +}; + +module_platform_driver(can_transceiver_phy_driver); + +MODULE_AUTHOR("Faiz Abbas "); +MODULE_AUTHOR("Aswath Govindraju "); +MODULE_DESCRIPTION("CAN TRANSCEIVER PHY driver"); +MODULE_LICENSE("GPL v2"); --=20 2.17.1 From nobody Fri May 3 15:40:39 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=1617975713; cv=none; d=zohomail.com; s=zohoarc; b=XFYZiHzQe/qCAd5jvkhWr38UHAwNwBpwwGaxQ04W4Z4b+4G7DXOsr7jhVGPnC6VnEfjcq2BuHd892aGzN+BMrxA9yPFkOxkIy2NHtpbdodzTMrzUIBTpy44yf1I5m+0k5/n1e8rzi7DDWoVr/bNgYQUkZKnzJTuZ5qQRJs55j6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617975713; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=le3waud/oZsy0bjjrzIzV4QRjPugTzWXU91AXlpRyds=; b=FR6m3tT6KXsHIWkZbUfHAllN4lGcIn315a4MZXZMwBTulq3bV6w6QnUJ37G6MjBMe7ZhKtUdJFcBgHYxTBh4LniIs/RbwucsNr+M+UKrLbupQ51YhLvhkJKBLEJ4SB+NdmjH9bTcUuGY1jYLpF5+h5OT2P5+r0wtQ2NWXqWRrUw= 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 1617975713115870.781128992925; Fri, 9 Apr 2021 06:41:53 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233888AbhDINmE (ORCPT ); Fri, 9 Apr 2021 09:42:04 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:58138 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbhDINlx (ORCPT ); Fri, 9 Apr 2021 09:41:53 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 139DfSeE113175; Fri, 9 Apr 2021 08:41:28 -0500 Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 139DfSaO027195 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Apr 2021 08:41:28 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 9 Apr 2021 08:41:27 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) 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; Fri, 9 Apr 2021 08:41:28 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 139Dewmc029277; Fri, 9 Apr 2021 08:41:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617975688; bh=le3waud/oZsy0bjjrzIzV4QRjPugTzWXU91AXlpRyds=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rSd99R4nn3kCE8k1U++DzS7SlBRbPMoam5A2SNqiV4p/+FWH1i7PUj1KFu4bnxbrW cCRP4ZvmwZy4Lg4tjb5d3sVXEDgpdEJ/1SI4UO5Cu85ifVYX+ZT68/VwgLVugoulZ5 TOZ8rSc7iAVPii7RF34sq/3QxyImOR3Q0R9VT64Y= From: Aswath Govindraju CC: Vignesh Raghavendra , Kishon Vijay Abraham I , Lokesh Vutla , Grygorii Strashko , Aswath Govindraju , Faiz Abbas , Chandrasekar Ramakrishnan , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Rob Herring , Vinod Koul , Sriram Dash , , , , , Subject: [PATCH 3/4] dt-bindings: net: can: Document transceiver implementation as phy Date: Fri, 9 Apr 2021 19:10:53 +0530 Message-ID: <20210409134056.18740-4-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210409134056.18740-1-a-govindraju@ti.com> References: <20210409134056.18740-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 | 6 ++++++ 1 file changed, 6 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..2c01899b1a3e 100644 --- a/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml +++ b/Documentation/devicetree/bindings/net/can/bosch,m_can.yaml @@ -109,6 +109,12 @@ properties: can-transceiver: $ref: can-transceiver.yaml# =20 + phys: + minItems: 1 + + phy-names: + const: can_transceiver + required: - compatible - reg --=20 2.17.1 From nobody Fri May 3 15:40:39 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=1617975723; cv=none; d=zohomail.com; s=zohoarc; b=InCJHUH1jxpgyOlRHezwJ6reZOnhReo6VtAAYoO/0Mg/aJjASawizaEdmB7pkBjeeAwu0Nt2YhoaLQdy33wawUqzroITwWR02iTSDMoRutjYi9oRBCEl4WLs6J6xNFVieC1BclUmynYMj/R08CZHIIybuX7i++iBK2lplsGpWHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617975723; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=yzQFMlEvLc1NJ8+6qQzAMS/IJa1/2LrIrpQLN6vAeQU=; b=aXMyysEaIKAbIkITPPvOVp/oxQvWpnJNA/rKu4SprdLg9VEuFe7Z5L2YYV+ZPGcbtIGG19WY8+d9Endgn5aRUFMsMd3PC/Z4LabeiNHIJK6jbUhxECGJ83QCCd/tX/P2dmuqH7c7qJWj12MsPhCus/jKVBtkwUxpWCHbi3SWQG4= 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 1617975723764953.31942367051; Fri, 9 Apr 2021 06:42:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233883AbhDINmP (ORCPT ); Fri, 9 Apr 2021 09:42:15 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:52444 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233856AbhDINmD (ORCPT ); Fri, 9 Apr 2021 09:42:03 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 139Dfbol029329; Fri, 9 Apr 2021 08:41:37 -0500 Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 139DfbJF116872 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 9 Apr 2021 08:41:37 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 9 Apr 2021 08:41:37 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) 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; Fri, 9 Apr 2021 08:41:36 -0500 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 139Dewmd029277; Fri, 9 Apr 2021 08:41:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1617975697; bh=yzQFMlEvLc1NJ8+6qQzAMS/IJa1/2LrIrpQLN6vAeQU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UNQR6TKCVjkHc2LapYnv+gSYZDa9D7jgM4msj9gaN4CbCbyhk70VjclQuaPZ27NTK dO4M2i4au2NgZaIC+aksBNFvCZq2NCDdC13YvOL8Lh0I5CSU8dyfplbQVb11I3YiKZ ZVVVF9vzfQ55HLYEixq0dNtSgTG3w9PjhNOwd+Ho= From: Aswath Govindraju CC: Vignesh Raghavendra , Kishon Vijay Abraham I , Lokesh Vutla , Grygorii Strashko , Aswath Govindraju , Faiz Abbas , Chandrasekar Ramakrishnan , Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski , Rob Herring , Vinod Koul , Sriram Dash , , , , , Subject: [PATCH 4/4] can: m_can_platform: Add support for transceiver as phy Date: Fri, 9 Apr 2021 19:10:54 +0530 Message-ID: <20210409134056.18740-5-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210409134056.18740-1-a-govindraju@ti.com> References: <20210409134056.18740-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_platform.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/net/can/m_can/m_can_platform.c b/drivers/net/can/m_can= /m_can_platform.c index 599de0e08cd7..4a762b5a21d8 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,7 +68,9 @@ 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; + u32 bitrate_max; =20 mcan_class =3D m_can_class_allocate_dev(&pdev->dev, sizeof(struct m_can_plat_priv)); @@ -101,6 +104,28 @@ static int m_can_plat_probe(struct platform_device *pd= ev) goto probe_fail; } =20 + transceiver =3D devm_phy_optional_get(&pdev->dev, "can_transceiver"); + 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) { + dev_warn(&pdev->dev, "No transceiver phy found\n"); + } else { + ret =3D phy_power_on(transceiver); + if (ret) { + dev_err(&pdev->dev, "error powering on phy, err=3D%d\n", ret); + return ret; + } + /* converting from Mbps to bps */ + bitrate_max =3D (transceiver->attrs.max_link_rate) * 1000000; + if (!bitrate_max) + dev_warn(&pdev->dev, "Invalid value for transceiver max bitrate. Ignori= ng bitrate limit\n"); + priv->cdev.can.bitrate_max =3D bitrate_max; + } + priv->base =3D addr; priv->mram_base =3D mram_addr; =20 --=20 2.17.1