can: mcan: Add MCAN support for FSD SoC
Subsystems (7)
A message that is not in the archive (sent off-list or not yet received): CGME20221207100642epcas5p26c8f3f898ad8ac434092c702a788c0ff@epcas5p2.samsung.com
v4 cover can: mcan: Add MCAN support for FSD SoC
Add support for MCAN instances present on the FSD platform.
Vivek Yadav (2):
can: m_can: Call the RAM init directly from m_can_chip_config
arm64: dts: fsd: Add MCAN device node
changes since v3:
[PATCH v3 1/2] can: m_can: Move mram init to mcan device setup
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Marc Kleine-Budde
a) Call the RAM init directly from m_can_chip_config.
b) If we call m_can_init_ram() from m_can_chip_config(), then remove it from the tcan's tcan4x5x_init() functions, and from m_can_class_resume(). It should only be called once for open and once for resume.
changes since v2:
[PATCH v2 1/6] dt-bindings: Document the SYSREG specific compatibles found on FSD SoC
link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) As per suggestion separated this patch and posted separately.
ref: https://www.spinics.net/lists/kernel/msg4597970.html
[PATCH v2 2/6] dt-bindings: can: mcan: Add ECC functionality to message ram link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) For now I am dropping this. I will reconsider the implementation and will resend as separate patch.
[PATCH v2 3/6] arm64: dts: fsd: add sysreg device node
link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) Dropped Cc from commit message.
b) As per suggestion separated this and corresponding DT-bindin patch and posted separately.
ref: https://www.spinics.net/lists/kernel/msg4597921.html
[PATCH v2 4/6] arm64: dts: fsd: Add MCAN device node link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) Aligned the lines.
[PATCH v2 5/6] can: m_can: Add ECC functionality for message RAM link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) We are dropping this for now and will reconsider it's implementation and resend as separate patch.
[PATCH v2 6/6] arm64: dts: fsd: Add support for error correction code for message RAM
link:
https://lore.kernel.org/lkml/[email protected]/
1: Addressed review comment given by Krzysztof Kozlowski
a) Subject is updated and patch go via ARM SOC tree, we will resend this as separate patch along with ECC patch.
changes since v1:
[PATCH 0/7] can: mcan: Add MCAN support for FSD SoC
1: Addressed review comment given by Marc Kleine-Budde
a) Added my signed off.
[PATCH 2/7] dt-bindings: can: mcan: Add ECC functionality to message ram link:
https://lore.kernel.org/netdev/[email protected]/
1: Addressed review comment given by Marc Kleine-Budde
a) Added an example to the yaml that makes use of the mram-ecc-cfg property.
b) Added prefix to "mram-ecc-cfg" property and "$ref: /schemas/types.yaml#/definitions/phandle".
[PATCH 4/7] can: mcan: enable peripheral clk to access mram link:
https://lore.kernel.org/netdev/[email protected]/
1: Addressed review comment given by Marc Kleine-Budde
a) Moved mram init into m_can_dev_setup function by then clocks are enabled and prevent probe failure.
b) Added the platform init ops in m_can_plat_ops and moved mram init into it.
[PATCH 5/7] arm64: dts: fsd: Add MCAN device node link:
https://lore.kernel.org/netdev/[email protected]/
1: Addressed review comment given by Marc Kleine-Budde
a) Added the DT people on Cc.
[PATCH 6/7] can: m_can: Add ECC functionality for message RAM link:
https://lore.kernel.org/netdev/[email protected]/
1: Addressed review comment given by kernel test robot.
a) Addressed missing prototypes warnings.
2: Addressed review comment given by Marc Kleine-Budde
a) Sorted the declaration of local variable by reverse Christmas tree.
b) Used syscon_regmap_lookup_by_phandle_args to get the syscon Base Address and offset.
c) Used FIELD_PREP instead of logical operation.
d) Used regmap_read_poll_timeout API to give timeout condition for ECC cfg done status instead of using while loop counter.
e) Moved all the ECC mcaros in m_can.c file and changed the name with a common prefix M_CAN.
f) Moved ECC init into platform init function called during m_can device setup.
arch/arm64/boot/dts/tesla/fsd-evb.dts | 16 +++++ arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 28 +++++++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 68 ++++++++++++++++++++++ drivers/net/can/m_can/m_can.c | 32 ++++++++-- drivers/net/can/m_can/m_can_platform.c | 4 -- drivers/net/can/m_can/tcan4x5x-core.c | 5 -- 6 files changed, 138 insertions(+), 15 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/2 can: m_can: Call the RAM init directly from m_can_chip_config
When we try to access the mcan message ram addresses during the probe, hclk is gated by any other drivers or disabled, because of that probe gets failed.
Move the mram init functionality to mcan chip config called by m_can_start from mcan open function, by that time clocks are enabled.
--- drivers/net/can/m_can/m_can.c | 32 +++++++++++++++++++++----- drivers/net/can/m_can/m_can_platform.c | 4 ---- drivers/net/can/m_can/tcan4x5x-core.c | 5 ---- 3 files changed, 26 insertions(+), 15 deletions(-)
drivers/net/can/m_can/m_can.c +26 -6
@@ -1233,10 +1233,17 @@ static int m_can_set_bittiming(struct net_device *dev)* - setup bittiming * - configure timestamp generation */ -static void m_can_chip_config (struct net_device *dev) +static int m_can_chip_config (struct net_device *dev) {struct m_can_classdev *cdev =netdev_priv (dev);u32 cccr, test; +int err; + + err =m_can_init_ram (cdev); +if (err) { +dev_err (cdev->dev,"Message RAM configuration failed\n" ); +return err; + }m_can_config_endisable (cdev, true);
@@ -1360,18 +1367,25 @@ static void m_can_chip_config(struct net_device *dev)if (cdev->ops->init) cdev->ops->init (cdev); + +return 0 ; } -static void m_can_start (struct net_device *dev) +static int m_can_start (struct net_device *dev) {struct m_can_classdev *cdev =netdev_priv (dev); +int ret;/* basic m_can configuration */ -m_can_chip_config (dev); + ret =m_can_chip_config (dev); +if (ret) +return ret; cdev->can.state =CAN_STATE_ERROR_ACTIVE ;m_can_enable_all_interrupts (cdev); + +return 0 ; }static int m_can_set_mode (struct net_device *dev,enum can_mode mode)
@@ -1799,7 +1813,9 @@ static int m_can_open(struct net_device *dev) }/* start the m_can controller */ -m_can_start (dev); + err =m_can_start (dev); +if (err) + goto exit_irq_fail;if (!cdev->is_peripheral)napi_enable (&cdev->napi);
@@ -2058,9 +2074,13 @@ int m_can_class_resume(struct device *dev) ret =m_can_clk_start (cdev);if (ret)return ret; + ret =m_can_start (ndev); +if (ret) { +m_can_clk_stop (cdev); + +return ret; + } -m_can_init_ram (cdev); -m_can_start (ndev);netif_device_attach (ndev);netif_start_queue (ndev); }
drivers/net/can/m_can/m_can_platform.c +0 -4
@@ -140,10 +140,6 @@ static int m_can_plat_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mcan_class); - ret =m_can_init_ram (mcan_class); -if (ret) - goto probe_fail; -pm_runtime_enable (mcan_class->dev); ret =m_can_class_register (mcan_class);if (ret)
drivers/net/can/m_can/tcan4x5x-core.c +0 -5
@@ -234,11 +234,6 @@ static int tcan4x5x_init(struct m_can_classdev *cdev)if (ret)return ret; -/* Zero out the MCAN buffers */ - ret =m_can_init_ram (cdev); -if (ret) -return ret; - ret =regmap_update_bits (tcan4x5x->regmap,TCAN4X5X_CONFIG ,TCAN4X5X_MODE_SEL_MASK ,TCAN4X5X_MODE_NORMAL );if (ret)
Signature · 1 line
2.17.1
Re: [Patch v4 1/2] can: m_can: Call the RAM init directly from m_can_chip_config
Quoted 10 lines · Vivek Yadav
When we try to access the mcan message ram addresses during the probe, hclk is gated by any other drivers or disabled, because of that probe gets failed.
Move the mram init functionality to mcan chip config called by
m_can_startfrom mcan open function, by that time clocks are enabled.Suggested-by Marc Kleine-Budde <[email protected]>Signed-off-by Vivek Yadav <[email protected]>
Applied to linux-can-next.
Thanks,
Marc
Signature · 4 lines
Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH v4 2/2 arm64: dts: fsd: Add MCAN device node
In reply to Vivek YadavAdd MCAN device node and enable the same for FSD platform. This also adds the required pin configuration for the same.
--- arch/arm64/boot/dts/tesla/fsd-evb.dts | 16 +++++ arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi | 28 +++++++++ arch/arm64/boot/dts/tesla/fsd.dtsi | 68 ++++++++++++++++++++++ 3 files changed, 112 insertions(+)
arch/arm64/boot/dts/tesla/fsd-evb.dts +16 -0
@@ -34,6 +34,22 @@ clock-frequency = <24000000>; }; +&m_can0 { + status = "okay"; +}; + +&m_can1 { + status = "okay"; +}; + +&m_can2 { + status = "okay"; +}; + +&m_can3 { + status = "okay"; +}; + &serial_0 { status = "okay"; };
arch/arm64/boot/dts/tesla/fsd-pinctrl.dtsi +28 -0
@@ -339,6 +339,34 @@ samsung,pin-pud = <FSD_PIN_PULL_UP>; samsung,pin-drv = <FSD_PIN_DRV_LV1>; }; + + m_can0_bus: m-can0-bus-pins { + samsung,pins = "gpd0-0", "gpd0-1"; + samsung,pin-function = <FSD_PIN_FUNC_2>; + samsung,pin-pud = <FSD_PIN_PULL_UP>; + samsung,pin-drv = <FSD_PIN_DRV_LV4>; + }; + + m_can1_bus: m-can1-bus-pins { + samsung,pins = "gpd0-2", "gpd0-3"; + samsung,pin-function = <FSD_PIN_FUNC_2>; + samsung,pin-pud = <FSD_PIN_PULL_UP>; + samsung,pin-drv = <FSD_PIN_DRV_LV4>; + }; + + m_can2_bus: m-can2-bus-pins { + samsung,pins = "gpd0-4", "gpd0-5"; + samsung,pin-function = <FSD_PIN_FUNC_2>; + samsung,pin-pud = <FSD_PIN_PULL_UP>; + samsung,pin-drv = <FSD_PIN_DRV_LV4>; + }; + + m_can3_bus: m-can3-bus-pins { + samsung,pins = "gpd0-6", "gpd0-7"; + samsung,pin-function = <FSD_PIN_FUNC_2>; + samsung,pin-pud = <FSD_PIN_PULL_UP>; + samsung,pin-drv = <FSD_PIN_DRV_LV4>; + }; }; &pinctrl_pmu {
arch/arm64/boot/dts/tesla/fsd.dtsi +68 -0
74 lines not on this page · raw message
Signature · 1 line
2.17.1
Re: [Patch v4 2/2] arm64: dts: fsd: Add MCAN device node
Quoted 5 lines · Vivek Yadav
Add MCAN device node and enable the same for FSD platform. This also adds the required pin configuration for the same.
Signed-off-by Sriranjani P <[email protected]>Signed-off-by Vivek Yadav <[email protected]>
This is a friendly reminder during the review process.
It looks like you received a tag and forgot to add it.
If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.
https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
If a tag was not added on purpose, please state why and what changed.
Applied for v6.3.
Best regards,
Krzysztof
Krzysztof Kozlowski
AppliedRe: (subset) [Patch v4 2/2] arm64: dts: fsd: Add MCAN device node
In reply to Vivek YadavQuoted 4 lines · Vivek Yadav
Add MCAN device node and enable the same for FSD platform. This also adds the required pin configuration for the same.
Applied, thanks!
[2/2] arm64: dts: fsd: Add MCAN device node
https://git.kernel.org/krzk/linux/c/142c693e6bd63d8dfaf7f808b015fc46180af731
Best regards,
Signature · 1 line
Krzysztof Kozlowski <[email protected]>