linux-can-fixes-for-6.6-20231009
-----BEGIN PGP SIGNATURE----- iQFHBAABCgAxFiEEDs2BvajyNKlf9TJQvlAcSiqKBOgFAmUjqCwTHG1rbEBwZW5n dXRyb25peC5kZQAKCRC+UBxKKooE6HJUB/sGBLojDlbGAqMFwhCmZ6ZNLg3xQcrB SNgIxA87jsMfSCGX9vkhkaXfNLOgDE2zYe4i2QB4M1iMatVY4MSY2vtJbw8oL6dr X6zT9STwFPBVlH/CIqfCq9eQNhKrIQ65khmYg2DtFJCBuZniBrhfZLwVROUj3FXr FUIAMNjn9Xtj2R5JwtOtn5hvdzO8z3dCQMtzqFVm9pSm5LJVkTGaDe85t/mkLdS2 stwlbGPVz+WElHueBDEjfbxiWnPgpEVSbuThTRxS0M5+a96uVHa4F+SFGgkSdYlI 2MQUGiJ797qZTy2MvkGaqa/1/uqcmNOWNm8NqzLfg4LQMvnFW8/qAaV8 =9CD6 -----END PGP SIGNATURE----- Merge tag 'linux-can-fixes-for-6.6-20231009' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can Marc Kleine-Budde says: ==================== pull-request: can 2023-10-09 Lukas Magel's patch for the CAN ISO-TP protocol fixes the TX state detection and wait behavior. John Watts contributes a patch to only show the sun4i_can Kconfig option on ARCH_SUNXI. A patch by Miquel Raynal fixes the soft-reset workaround for Renesas SoCs in the sja1000 driver. Markus Schneider-Pargmann's patch for the tcan4x5x m_can glue driver fixes the id2 register for the tcan4553. 2 patches by Haibo Chen fix the flexcan stop mode for the imx93 SoC. * tag 'linux-can-fixes-for-6.6-20231009' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can: can: tcan4x5x: Fix id2_register for tcan4553 can: flexcan: remove the auto stop mode for IMX93 can: sja1000: Always restart the Tx queue after an overrun arm64: dts: imx93: add the Flex-CAN stop mode by GPR can: sun4i_can: Only show Kconfig if ARCH_SUNXI is set can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior ==================== Link: https://lore.kernel.org/r/20231009085256.693378-1-mkl@pengutronix.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
b52acd02c1
|
@ -185,7 +185,7 @@
|
|||
#size-cells = <1>;
|
||||
ranges;
|
||||
|
||||
anomix_ns_gpr: syscon@44210000 {
|
||||
aonmix_ns_gpr: syscon@44210000 {
|
||||
compatible = "fsl,imx93-aonmix-ns-syscfg", "syscon";
|
||||
reg = <0x44210000 0x1000>;
|
||||
};
|
||||
|
@ -319,6 +319,7 @@
|
|||
assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
|
||||
assigned-clock-rates = <40000000>;
|
||||
fsl,clk-source = /bits/ 8 <0>;
|
||||
fsl,stop-mode = <&aonmix_ns_gpr 0x14 0>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
|
@ -591,6 +592,7 @@
|
|||
assigned-clock-parents = <&clk IMX93_CLK_SYS_PLL_PFD1_DIV2>;
|
||||
assigned-clock-rates = <40000000>;
|
||||
fsl,clk-source = /bits/ 8 <0>;
|
||||
fsl,stop-mode = <&wakeupmix_gpr 0x0c 2>;
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ config CAN_SLCAN
|
|||
|
||||
config CAN_SUN4I
|
||||
tristate "Allwinner A10 CAN controller"
|
||||
depends on MACH_SUN4I || MACH_SUN7I || RISCV || COMPILE_TEST
|
||||
depends on MACH_SUN4I || MACH_SUN7I || (RISCV && ARCH_SUNXI) || COMPILE_TEST
|
||||
help
|
||||
Say Y here if you want to use CAN controller found on Allwinner
|
||||
A10/A20/D1 SoCs.
|
||||
|
|
|
@ -348,7 +348,7 @@ static struct flexcan_devtype_data fsl_imx8mp_devtype_data = {
|
|||
static struct flexcan_devtype_data fsl_imx93_devtype_data = {
|
||||
.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
|
||||
FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_RX_MAILBOX |
|
||||
FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_AUTO_STOP_MODE |
|
||||
FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR |
|
||||
FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC |
|
||||
FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX |
|
||||
FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR,
|
||||
|
@ -544,11 +544,6 @@ static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv)
|
|||
} else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR) {
|
||||
regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
|
||||
1 << priv->stm.req_bit, 1 << priv->stm.req_bit);
|
||||
} else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE) {
|
||||
/* For the auto stop mode, software do nothing, hardware will cover
|
||||
* all the operation automatically after system go into low power mode.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
return flexcan_low_power_enter_ack(priv);
|
||||
|
@ -574,12 +569,6 @@ static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv)
|
|||
reg_mcr &= ~FLEXCAN_MCR_SLF_WAK;
|
||||
priv->write(reg_mcr, ®s->mcr);
|
||||
|
||||
/* For the auto stop mode, hardware will exist stop mode
|
||||
* automatically after system go out of low power mode.
|
||||
*/
|
||||
if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
|
||||
return 0;
|
||||
|
||||
return flexcan_low_power_exit_ack(priv);
|
||||
}
|
||||
|
||||
|
@ -1994,13 +1983,18 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev)
|
|||
ret = flexcan_setup_stop_mode_scfw(pdev);
|
||||
else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_SETUP_STOP_MODE_GPR)
|
||||
ret = flexcan_setup_stop_mode_gpr(pdev);
|
||||
else if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
|
||||
ret = 0;
|
||||
else
|
||||
/* return 0 directly if doesn't support stop mode feature */
|
||||
return 0;
|
||||
|
||||
if (ret)
|
||||
/* If ret is -EINVAL, this means SoC claim to support stop mode, but
|
||||
* dts file lack the stop mode property definition. For this case,
|
||||
* directly return 0, this will skip the wakeup capable setting and
|
||||
* will not block the driver probe.
|
||||
*/
|
||||
if (ret == -EINVAL)
|
||||
return 0;
|
||||
else if (ret)
|
||||
return ret;
|
||||
|
||||
device_set_wakeup_capable(&pdev->dev, true);
|
||||
|
@ -2320,16 +2314,8 @@ static int __maybe_unused flexcan_noirq_suspend(struct device *device)
|
|||
if (netif_running(dev)) {
|
||||
int err;
|
||||
|
||||
if (device_may_wakeup(device)) {
|
||||
if (device_may_wakeup(device))
|
||||
flexcan_enable_wakeup_irq(priv, true);
|
||||
/* For auto stop mode, need to keep the clock on before
|
||||
* system go into low power mode. After system go into
|
||||
* low power mode, hardware will config the flexcan into
|
||||
* stop mode, and gate off the clock automatically.
|
||||
*/
|
||||
if (priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = pm_runtime_force_suspend(device);
|
||||
if (err)
|
||||
|
@ -2347,15 +2333,9 @@ static int __maybe_unused flexcan_noirq_resume(struct device *device)
|
|||
if (netif_running(dev)) {
|
||||
int err;
|
||||
|
||||
/* For the wakeup in auto stop mode, no need to gate on the
|
||||
* clock here, hardware will do this automatically.
|
||||
*/
|
||||
if (!(device_may_wakeup(device) &&
|
||||
priv->devtype_data.quirks & FLEXCAN_QUIRK_AUTO_STOP_MODE)) {
|
||||
err = pm_runtime_force_resume(device);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (device_may_wakeup(device))
|
||||
flexcan_enable_wakeup_irq(priv, false);
|
||||
|
|
|
@ -68,8 +68,6 @@
|
|||
#define FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR BIT(15)
|
||||
/* Device supports RX via FIFO */
|
||||
#define FLEXCAN_QUIRK_SUPPORT_RX_FIFO BIT(16)
|
||||
/* auto enter stop mode to support wakeup */
|
||||
#define FLEXCAN_QUIRK_AUTO_STOP_MODE BIT(17)
|
||||
|
||||
struct flexcan_devtype_data {
|
||||
u32 quirks; /* quirks needed for different IP cores */
|
||||
|
|
|
@ -125,7 +125,7 @@ static const struct tcan4x5x_version_info tcan4x5x_versions[] = {
|
|||
},
|
||||
[TCAN4553] = {
|
||||
.name = "4553",
|
||||
.id2_register = 0x32353534,
|
||||
.id2_register = 0x33353534,
|
||||
},
|
||||
/* generic version with no id2_register at the end */
|
||||
[TCAN4X5X] = {
|
||||
|
|
|
@ -392,7 +392,13 @@ static irqreturn_t sja1000_reset_interrupt(int irq, void *dev_id)
|
|||
struct net_device *dev = (struct net_device *)dev_id;
|
||||
|
||||
netdev_dbg(dev, "performing a soft reset upon overrun\n");
|
||||
sja1000_start(dev);
|
||||
|
||||
netif_tx_lock(dev);
|
||||
|
||||
can_free_echo_skb(dev, 0, NULL);
|
||||
sja1000_set_mode(dev, CAN_MODE_START);
|
||||
|
||||
netif_tx_unlock(dev);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
|
|
@ -948,21 +948,18 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
|
|||
if (!so->bound || so->tx.state == ISOTP_SHUTDOWN)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
wait_free_buffer:
|
||||
while (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) {
|
||||
/* we do not support multiple buffers - for now */
|
||||
if (wq_has_sleeper(&so->wait) && (msg->msg_flags & MSG_DONTWAIT))
|
||||
if (msg->msg_flags & MSG_DONTWAIT)
|
||||
return -EAGAIN;
|
||||
|
||||
if (so->tx.state == ISOTP_SHUTDOWN)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
/* wait for complete transmission of current pdu */
|
||||
err = wait_event_interruptible(so->wait, so->tx.state == ISOTP_IDLE);
|
||||
if (err)
|
||||
goto err_event_drop;
|
||||
|
||||
if (cmpxchg(&so->tx.state, ISOTP_IDLE, ISOTP_SENDING) != ISOTP_IDLE) {
|
||||
if (so->tx.state == ISOTP_SHUTDOWN)
|
||||
return -EADDRNOTAVAIL;
|
||||
|
||||
goto wait_free_buffer;
|
||||
}
|
||||
|
||||
/* PDU size > default => try max_pdu_size */
|
||||
|
|
Loading…
Reference in New Issue