From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:03
Hello Jakub, hello David,
this is a pull request of 8 patches for net-next/master.
The first patch is by Vincent Mailhol and replaces the custom CAN
units with generic one form linux/units.h.
The next 3 patches are by Evgeny Boger and add Allwinner R40 support
to the sun4i CAN driver.
Andy Shevchenko contributes 4 patches to the hi311x CAN driver,
consisting of cleanups and converting the driver to the device
property API.
regards,
Marc
---
The following changes since commit 1fe5b01262844be03de98afdd56d1d393df04d7e:
Merge branch 's390-net-updates-2021-12-06' (2021-12-07 22:01:08 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-5.17-20211208
for you to fetch changes up to 6a93ea38217706ef8318efba672b960bcd5d0642:
can: hi311x: hi3110_can_probe(): convert to use dev_err_probe() (2021-12-08 10:20:33 +0100)
----------------------------------------------------------------
linux-can-next-for-5.17-20211208
----------------------------------------------------------------
Andy Shevchenko (4):
can: hi311x: hi3110_can_probe(): use devm_clk_get_optional() to get the input clock
can: hi311x: hi3110_can_probe(): try to get crystal clock rate from property
can: hi311x: hi3110_can_probe(): make use of device property API
can: hi311x: hi3110_can_probe(): convert to use dev_err_probe()
Evgeny Boger (3):
dt-bindings: net: can: add support for Allwinner R40 CAN controller
can: sun4i_can: add support for R40 CAN controller
ARM: dts: sun8i: r40: add node for CAN controller
Vincent Mailhol (1):
can: bittiming: replace CAN units with the generic ones from linux/units.h
.../bindings/net/can/allwinner,sun4i-a10-can.yaml | 24 +++++++++
arch/arm/boot/dts/sun8i-r40.dtsi | 19 +++++++
drivers/net/can/dev/bittiming.c | 5 +-
drivers/net/can/spi/hi311x.c | 52 +++++++++---------
drivers/net/can/sun4i_can.c | 62 +++++++++++++++++++++-
drivers/net/can/usb/etas_es58x/es581_4.c | 5 +-
drivers/net/can/usb/etas_es58x/es58x_fd.c | 5 +-
include/linux/can/bittiming.h | 7 ---
8 files changed, 138 insertions(+), 41 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:05
From: Vincent Mailhol <redacted>
In [1], we introduced a set of units in linux/can/bittiming.h. Since
then, generic SI prefixes were added to linux/units.h in [2]. Those
new prefixes can perfectly replace CAN specific ones.
This patch replaces all occurrences of the CAN units with their
corresponding prefix (from linux/units) and the unit (as a comment)
according to below table.
CAN units SI metric prefix (from linux/units) + unit (as a comment)
------------------------------------------------------------------------
CAN_KBPS KILO /* BPS */
CAN_MBPS MEGA /* BPS */
CAM_MHZ MEGA /* Hz */
The definition are then removed from linux/can/bittiming.h
[1] commit 1d7750760b70 ("can: bittiming: add CAN_KBPS, CAN_MBPS and
CAN_MHZ macros")
[2] commit 26471d4a6cf8 ("units: Add SI metric prefix definitions")
Link: https://lore.kernel.org/all/20211124014536.782550-1-mailhol.vincent@wanadoo.fr
Suggested-by: Jimmy Assarsson <redacted>
Suggested-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Vincent Mailhol <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/dev/bittiming.c | 5 +++--
drivers/net/can/usb/etas_es58x/es581_4.c | 5 +++--
drivers/net/can/usb/etas_es58x/es58x_fd.c | 5 +++--
include/linux/can/bittiming.h | 7 -------
4 files changed, 9 insertions(+), 13 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:07
From: Evgeny Boger <redacted>
Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The
controller is the same as in earlier A10 and A20 SoCs, but needs reset
line to be deasserted before use.
This patch Introduces new compatible for R40 CAN controller with
required resets property.
Link: https://lore.kernel.org/all/20211122104616.537156-2-boger@wirenboard.com
Signed-off-by: Evgeny Boger <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
.../net/can/allwinner,sun4i-a10-can.yaml | 24 +++++++++++++++++++
1 file changed, 24 insertions(+)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:07
From: Evgeny Boger <redacted>
Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The
controller is the same as in earlier A10 and A20 SoCs, but needs reset
line to be deasserted before use.
This patch adds a new compatible for R40 CAN controller. Depending
on the compatible, reset line can be requested from DT.
Link: https://lore.kernel.org/all/20211122104616.537156-3-boger@wirenboard.com
Signed-off-by: Evgeny Boger <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/sun4i_can.c | 62 +++++++++++++++++++++++++++++++++++--
1 file changed, 60 insertions(+), 2 deletions(-)
@@ -702,6 +713,13 @@ static int sun4ican_open(struct net_device *dev)gotoexit_irq;}+/* software reset deassert */+err=reset_control_deassert(priv->reset);+if(err){+netdev_err(dev,"could not deassert CAN reset\n");+gotoexit_soft_reset;+}+/* turn on clocking for CAN peripheral block */err=clk_prepare_enable(priv->clk);if(err){
@@ -723,6 +741,8 @@ static int sun4ican_open(struct net_device *dev)exit_can_start:clk_disable_unprepare(priv->clk);exit_clock:+reset_control_assert(priv->reset);+exit_soft_reset:free_irq(dev->irq,dev);exit_irq:close_candev(dev);
@@ -736,6 +756,7 @@ static int sun4ican_close(struct net_device *dev)netif_stop_queue(dev);sun4i_can_stop(dev);clk_disable_unprepare(priv->clk);+reset_control_assert(priv->reset);free_irq(dev->irq,dev);close_candev(dev);
@@ -771,10 +810,28 @@ static int sun4ican_probe(struct platform_device *pdev){structdevice_node*np=pdev->dev.of_node;structclk*clk;+structreset_control*reset=NULL;void__iomem*addr;interr,irq;structnet_device*dev;structsun4ican_priv*priv;+conststructsun4ican_quirks*quirks;++quirks=of_device_get_match_data(&pdev->dev);+if(!quirks){+dev_err(&pdev->dev,"failed to determine the quirks to use\n");+err=-ENODEV;+gotoexit;+}++if(quirks->has_reset){+reset=devm_reset_control_get_exclusive(&pdev->dev,NULL);+if(IS_ERR(reset)){+dev_err(&pdev->dev,"unable to request reset\n");+err=PTR_ERR(reset);+gotoexit;+}+}clk=of_clk_get(np,0);if(IS_ERR(clk)){
@@ -818,6 +875,7 @@ static int sun4ican_probe(struct platform_device *pdev)CAN_CTRLMODE_3_SAMPLES;priv->base=addr;priv->clk=clk;+priv->reset=reset;spin_lock_init(&priv->cmdreg_lock);platform_set_drvdata(pdev,dev);
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:08
From: Evgeny Boger <redacted>
Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The
controller is the same as in earlier A10 and A20 SoCs, but needs reset
line to be deasserted before use.
This patch adds a CAN node and the corresponding pinctrl descriptions.
Link: https://lore.kernel.org/all/20211122104616.537156-4-boger@wirenboard.com
Signed-off-by: Evgeny Boger <redacted>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
arch/arm/boot/dts/sun8i-r40.dtsi | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:10
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
It's not clear what was the intention of redundant usage of IS_ERR()
around the clock pointer since with the error check of devm_clk_get()
followed by bailout it can't be invalid,
Simplify the code which fetches the input clock by using
devm_clk_get_optional(). It will allow to switch to device properties
approach in the future.
Link: https://lore.kernel.org/all/20211206165542.69887-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/hi311x.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:11
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
In some configurations, mainly ACPI-based, the clock frequency of the
device is supplied by very well established 'clock-frequency'
property. Hence, try to get it from the property at last if no other
providers are available.
Link: https://lore.kernel.org/all/20211206165542.69887-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/hi311x.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
@@ -830,17 +830,26 @@ static int hi3110_can_probe(struct spi_device *spi){conststructof_device_id*of_id=of_match_device(hi3110_of_match,&spi->dev);+structdevice*dev=&spi->dev;structnet_device*net;structhi3110_priv*priv;structclk*clk;-intfreq,ret;+u32freq;+intret;clk=devm_clk_get_optional(&spi->dev,NULL);if(IS_ERR(clk)){dev_err(&spi->dev,"no CAN clock source defined\n");returnPTR_ERR(clk);}-freq=clk_get_rate(clk);++if(clk){+freq=clk_get_rate(clk);+}else{+ret=device_property_read_u32(dev,"clock-frequency",&freq);+if(ret)+returndev_err_probe(dev,ret,"Failed to get clock-frequency!\n");+}/* Sanity check */if(freq>40000000)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:12
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Make use of device property API in this driver so that both OF based
system and ACPI based system can use this driver.
Link: https://lore.kernel.org/all/20211206165542.69887-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/hi311x.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
From: Marc Kleine-Budde <mkl@pengutronix.de> Date: 2021-12-08 12:51:12
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
When deferred the reason is saved for further debugging. Besides that,
it's fine to call dev_err_probe() in ->probe() when error code is
known. Convert the driver to use dev_err_probe().
Link: https://lore.kernel.org/all/20211206165542.69887-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
drivers/net/can/spi/hi311x.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
Hello:
This series was applied to netdev/net-next.git (master)
by Marc Kleine-Budde [off-list ref]:
On Wed, 8 Dec 2021 13:50:48 +0100 you wrote:
From: Vincent Mailhol <redacted>
In [1], we introduced a set of units in linux/can/bittiming.h. Since
then, generic SI prefixes were added to linux/units.h in [2]. Those
new prefixes can perfectly replace CAN specific ones.
This patch replaces all occurrences of the CAN units with their
corresponding prefix (from linux/units) and the unit (as a comment)
according to below table.
[...]