Commit fd3d3755 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge tag 'linux-can-next-for-5.12-20210129' of...

Merge tag 'linux-can-next-for-5.12-20210129' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
linux-can-next-for-5.12-20210129

All patches are by me and target the mcp251xfd driver. The first 4
patches update the information regarding the "85% of (FSYSCLK/2)"
errata. The other 4 are misc cleanups, unitfy error messages, add
missing postfix to a macro, simplify the return of a function, and
make use of dev_err_probe() in the mcp251xfd_probe() function.
====================

Link: https://lore.kernel.org/r/20210129084302.3040284-1-mkl@pengutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 6e10785e cf8ee6de
...@@ -596,11 +596,9 @@ static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv) ...@@ -596,11 +596,9 @@ static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv)
"Timeout waiting for Oscillator Ready (osc=0x%08x, osc_reference=0x%08x)\n", "Timeout waiting for Oscillator Ready (osc=0x%08x, osc_reference=0x%08x)\n",
osc, osc_reference); osc, osc_reference);
return -ETIMEDOUT; return -ETIMEDOUT;
} else if (err) {
return err;
} }
return 0; return err;
} }
static int mcp251xfd_chip_softreset_do(const struct mcp251xfd_priv *priv) static int mcp251xfd_chip_softreset_do(const struct mcp251xfd_priv *priv)
...@@ -651,7 +649,7 @@ static int mcp251xfd_chip_softreset_check(const struct mcp251xfd_priv *priv) ...@@ -651,7 +649,7 @@ static int mcp251xfd_chip_softreset_check(const struct mcp251xfd_priv *priv)
if (osc != osc_reference) { if (osc != osc_reference) {
netdev_info(priv->ndev, netdev_info(priv->ndev,
"Controller failed to reset. osc=0x%08x, reference value=0x%08x\n", "Controller failed to reset. osc=0x%08x, reference value=0x%08x.\n",
osc, osc_reference); osc, osc_reference);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -666,7 +664,7 @@ static int mcp251xfd_chip_softreset(const struct mcp251xfd_priv *priv) ...@@ -666,7 +664,7 @@ static int mcp251xfd_chip_softreset(const struct mcp251xfd_priv *priv)
for (i = 0; i < MCP251XFD_SOFTRESET_RETRIES_MAX; i++) { for (i = 0; i < MCP251XFD_SOFTRESET_RETRIES_MAX; i++) {
if (i) if (i)
netdev_info(priv->ndev, netdev_info(priv->ndev,
"Retrying to reset Controller.\n"); "Retrying to reset controller.\n");
err = mcp251xfd_chip_softreset_do(priv); err = mcp251xfd_chip_softreset_do(priv);
if (err == -ETIMEDOUT) if (err == -ETIMEDOUT)
...@@ -1239,7 +1237,7 @@ mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq) ...@@ -1239,7 +1237,7 @@ mcp251xfd_handle_tefif_recover(const struct mcp251xfd_priv *priv, const u32 seq)
} }
netdev_info(priv->ndev, netdev_info(priv->ndev,
"Transmit Event FIFO buffer %s. (seq=0x%08x, tef_tail=0x%08x, tef_head=0x%08x, tx_head=0x%08x)\n", "Transmit Event FIFO buffer %s. (seq=0x%08x, tef_tail=0x%08x, tef_head=0x%08x, tx_head=0x%08x).\n",
tef_sta & MCP251XFD_REG_TEFSTA_TEFFIF ? tef_sta & MCP251XFD_REG_TEFSTA_TEFFIF ?
"full" : tef_sta & MCP251XFD_REG_TEFSTA_TEFNEIF ? "full" : tef_sta & MCP251XFD_REG_TEFSTA_TEFNEIF ?
"not empty" : "empty", "not empty" : "empty",
...@@ -1465,7 +1463,7 @@ mcp251xfd_hw_rx_obj_to_skb(const struct mcp251xfd_priv *priv, ...@@ -1465,7 +1463,7 @@ mcp251xfd_hw_rx_obj_to_skb(const struct mcp251xfd_priv *priv,
hw_rx_obj->id); hw_rx_obj->id);
} }
dlc = FIELD_GET(MCP251XFD_OBJ_FLAGS_DLC, hw_rx_obj->flags); dlc = FIELD_GET(MCP251XFD_OBJ_FLAGS_DLC_MASK, hw_rx_obj->flags);
/* CANFD */ /* CANFD */
if (hw_rx_obj->flags & MCP251XFD_OBJ_FLAGS_FDF) { if (hw_rx_obj->flags & MCP251XFD_OBJ_FLAGS_FDF) {
...@@ -1891,7 +1889,7 @@ mcp251xfd_handle_modif(const struct mcp251xfd_priv *priv, bool *set_normal_mode) ...@@ -1891,7 +1889,7 @@ mcp251xfd_handle_modif(const struct mcp251xfd_priv *priv, bool *set_normal_mode)
"Controller changed into %s Mode (%u).\n", "Controller changed into %s Mode (%u).\n",
mcp251xfd_get_mode_str(mode), mode); mcp251xfd_get_mode_str(mode), mode);
/* After the application requests Normal mode, the Controller /* After the application requests Normal mode, the controller
* will automatically attempt to retransmit the message that * will automatically attempt to retransmit the message that
* caused the TX MAB underflow. * caused the TX MAB underflow.
* *
...@@ -2359,7 +2357,7 @@ mcp251xfd_tx_obj_from_skb(const struct mcp251xfd_priv *priv, ...@@ -2359,7 +2357,7 @@ mcp251xfd_tx_obj_from_skb(const struct mcp251xfd_priv *priv,
priv->can.ctrlmode); priv->can.ctrlmode);
} }
flags |= FIELD_PREP(MCP251XFD_OBJ_FLAGS_DLC, dlc); flags |= FIELD_PREP(MCP251XFD_OBJ_FLAGS_DLC_MASK, dlc);
load_buf = &tx_obj->buf; load_buf = &tx_obj->buf;
if (priv->devtype_data.quirks & MCP251XFD_QUIRK_CRC_TX) if (priv->devtype_data.quirks & MCP251XFD_QUIRK_CRC_TX)
...@@ -2851,32 +2849,28 @@ static int mcp251xfd_probe(struct spi_device *spi) ...@@ -2851,32 +2849,28 @@ static int mcp251xfd_probe(struct spi_device *spi)
rx_int = devm_gpiod_get_optional(&spi->dev, "microchip,rx-int", rx_int = devm_gpiod_get_optional(&spi->dev, "microchip,rx-int",
GPIOD_IN); GPIOD_IN);
if (PTR_ERR(rx_int) == -EPROBE_DEFER) if (IS_ERR(rx_int))
return -EPROBE_DEFER; return dev_err_probe(&spi->dev, PTR_ERR(rx_int),
else if (IS_ERR(rx_int)) "Failed to get RX-INT!\n");
return PTR_ERR(rx_int);
reg_vdd = devm_regulator_get_optional(&spi->dev, "vdd"); reg_vdd = devm_regulator_get_optional(&spi->dev, "vdd");
if (PTR_ERR(reg_vdd) == -EPROBE_DEFER) if (PTR_ERR(reg_vdd) == -ENODEV)
return -EPROBE_DEFER;
else if (PTR_ERR(reg_vdd) == -ENODEV)
reg_vdd = NULL; reg_vdd = NULL;
else if (IS_ERR(reg_vdd)) else if (IS_ERR(reg_vdd))
return PTR_ERR(reg_vdd); return dev_err_probe(&spi->dev, PTR_ERR(reg_vdd),
"Failed to get VDD regulator!\n");
reg_xceiver = devm_regulator_get_optional(&spi->dev, "xceiver"); reg_xceiver = devm_regulator_get_optional(&spi->dev, "xceiver");
if (PTR_ERR(reg_xceiver) == -EPROBE_DEFER) if (PTR_ERR(reg_xceiver) == -ENODEV)
return -EPROBE_DEFER;
else if (PTR_ERR(reg_xceiver) == -ENODEV)
reg_xceiver = NULL; reg_xceiver = NULL;
else if (IS_ERR(reg_xceiver)) else if (IS_ERR(reg_xceiver))
return PTR_ERR(reg_xceiver); return dev_err_probe(&spi->dev, PTR_ERR(reg_xceiver),
"Failed to get Transceiver regulator!\n");
clk = devm_clk_get(&spi->dev, NULL); clk = devm_clk_get(&spi->dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk))
dev_err(&spi->dev, "No Oscillator (clock) defined.\n"); dev_err_probe(&spi->dev, PTR_ERR(clk),
return PTR_ERR(clk); "Failed to get Oscillator (clock)!\n");
}
freq = clk_get_rate(clk); freq = clk_get_rate(clk);
/* Sanity check */ /* Sanity check */
...@@ -2932,7 +2926,7 @@ static int mcp251xfd_probe(struct spi_device *spi) ...@@ -2932,7 +2926,7 @@ static int mcp251xfd_probe(struct spi_device *spi)
spi_get_device_id(spi)->driver_data; spi_get_device_id(spi)->driver_data;
/* Errata Reference: /* Errata Reference:
* mcp2517fd: DS80000789B, mcp2518fd: DS80000792C 4. * mcp2517fd: DS80000792C 5., mcp2518fd: DS80000789C 4.
* *
* The SPI can write corrupted data to the RAM at fast SPI * The SPI can write corrupted data to the RAM at fast SPI
* speeds: * speeds:
...@@ -2945,18 +2939,16 @@ static int mcp251xfd_probe(struct spi_device *spi) ...@@ -2945,18 +2939,16 @@ static int mcp251xfd_probe(struct spi_device *spi)
* Ensure that FSCK is less than or equal to 0.85 * * Ensure that FSCK is less than or equal to 0.85 *
* (FSYSCLK/2). * (FSYSCLK/2).
* *
* Known good and bad combinations are: * Known good combinations are:
* *
* MCP ext-clk SoC SPI SPI-clk max-clk parent-clk Status config * MCP ext-clk SoC SPI SPI-clk max-clk parent-clk config
* *
* 2518 20 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 8333333 Hz 83.33% 600000000 Hz good assigned-clocks = <&ccu CLK_SPIx> * 2518 20 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 8333333 Hz 83.33% 600000000 Hz assigned-clocks = <&ccu CLK_SPIx>
* 2518 20 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 9375000 Hz 93.75% 600000000 Hz bad assigned-clocks = <&ccu CLK_SPIx> * 2518 40 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 16666667 Hz 83.33% 600000000 Hz assigned-clocks = <&ccu CLK_SPIx>
* 2518 40 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 16666667 Hz 83.33% 600000000 Hz good assigned-clocks = <&ccu CLK_SPIx> * 2517 40 MHz atmel,sama5d27 atmel,at91rm9200-spi 16400000 Hz 82.00% 82000000 Hz default
* 2518 40 MHz allwinner,sun8i-h3 allwinner,sun8i-h3-spi 18750000 Hz 93.75% 600000000 Hz bad assigned-clocks = <&ccu CLK_SPIx> * 2518 40 MHz atmel,sama5d27 atmel,at91rm9200-spi 16400000 Hz 82.00% 82000000 Hz default
* 2517 20 MHz fsl,imx8mm fsl,imx51-ecspi 8333333 Hz 83.33% 16666667 Hz good assigned-clocks = <&clk IMX8MM_CLK_ECSPIx_ROOT> * 2518 40 MHz fsl,imx6dl fsl,imx51-ecspi 15000000 Hz 75.00% 30000000 Hz default
* 2517 20 MHz fsl,imx8mm fsl,imx51-ecspi 9523809 Hz 95.34% 28571429 Hz bad assigned-clocks = <&clk IMX8MM_CLK_ECSPIx_ROOT> * 2517 20 MHz fsl,imx8mm fsl,imx51-ecspi 8333333 Hz 83.33% 16666667 Hz assigned-clocks = <&clk IMX8MM_CLK_ECSPIx_ROOT>
* 2517 40 MHz atmel,sama5d27 atmel,at91rm9200-spi 16400000 Hz 82.00% 82000000 Hz good default
* 2518 40 MHz atmel,sama5d27 atmel,at91rm9200-spi 16400000 Hz 82.00% 82000000 Hz good default
* *
*/ */
priv->spi_max_speed_hz_orig = spi->max_speed_hz; priv->spi_max_speed_hz_orig = spi->max_speed_hz;
......
...@@ -305,7 +305,7 @@ ...@@ -305,7 +305,7 @@
#define MCP251XFD_OBJ_FLAGS_BRS BIT(6) #define MCP251XFD_OBJ_FLAGS_BRS BIT(6)
#define MCP251XFD_OBJ_FLAGS_RTR BIT(5) #define MCP251XFD_OBJ_FLAGS_RTR BIT(5)
#define MCP251XFD_OBJ_FLAGS_IDE BIT(4) #define MCP251XFD_OBJ_FLAGS_IDE BIT(4)
#define MCP251XFD_OBJ_FLAGS_DLC GENMASK(3, 0) #define MCP251XFD_OBJ_FLAGS_DLC_MASK GENMASK(3, 0)
#define MCP251XFD_REG_FRAME_EFF_SID_MASK GENMASK(28, 18) #define MCP251XFD_REG_FRAME_EFF_SID_MASK GENMASK(28, 18)
#define MCP251XFD_REG_FRAME_EFF_EID_MASK GENMASK(17, 0) #define MCP251XFD_REG_FRAME_EFF_EID_MASK GENMASK(17, 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment