Message ID | 20240523075347.1282395-1-msp@baylibre.com |
---|---|
Headers | show |
Series | can: m_can: Add am62 wakeup support | expand |
On 09:53-20240523, Markus Schneider-Pargmann wrote: > From: Vibhore Vardhan <vibhore@ti.com> > > mcu_mcan0 and mcu_mcan1 can be wakeup sources for the SoC. Mark them > accordingly in the devicetree. Based on the patch for AM62a. > > Signed-off-by: Vibhore Vardhan <vibhore@ti.com> > Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> > --- > arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi b/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi > index b973b550eb9d..e434b258e90c 100644 > --- a/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi > +++ b/arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi > @@ -162,6 +162,7 @@ mcu_mcan0: can@4e08000 { > interrupts = <GIC_SPI 26 IRQ_TYPE_LEVEL_HIGH>, > <GIC_SPI 27 IRQ_TYPE_LEVEL_HIGH>; > interrupt-names = "int0", "int1"; > + wakeup-source; > status = "disabled"; > }; > > @@ -177,6 +178,7 @@ mcu_mcan1: can@4e18000 { > interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>, > <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; > interrupt-names = "int0", "int1"; > + wakeup-source; > status = "disabled"; > }; > > -- > 2.43.0 > Curious: https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html#supported-low-power-modes Does not seem to call out am62p. Is that an documentation oversight? what happens to j722s?
On 23.05.2024 09:53:43, Markus Schneider-Pargmann wrote: > In some devices the pins of the m_can module can act as a wakeup source. > This patch helps do that by connecting the PHY_WAKE WoL option to > device_set_wakeup_enable. By marking this device as being wakeup > enabled, this setting can be used by platform code to decide which > sleep or poweroff mode to use. > > Also this prepares the driver for the next patch in which the pinctrl > settings are changed depending on the desired wakeup source. > > Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com> > --- > drivers/net/can/m_can/m_can.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c > index 14b231c4d7ec..80964e403a5e 100644 > --- a/drivers/net/can/m_can/m_can.c > +++ b/drivers/net/can/m_can/m_can.c > @@ -2129,6 +2129,26 @@ static int m_can_set_coalesce(struct net_device *dev, > return 0; > } > > +static void m_can_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) > +{ > + struct m_can_classdev *cdev = netdev_priv(dev); > + > + wol->supported = device_can_wakeup(cdev->dev) ? WAKE_PHY : 0; > + wol->wolopts = device_may_wakeup(cdev->dev) ? WAKE_PHY : 0; > +} > + > +static int m_can_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) > +{ > + struct m_can_classdev *cdev = netdev_priv(dev); > + > + if ((wol->wolopts & WAKE_PHY) != wol->wolopts) > + return -EINVAL; > + > + device_set_wakeup_enable(cdev->dev, !!wol->wolopts & WAKE_PHY); Can you please add error handling here? Same for the modifications in the next patch. regards, Marc