[PATCH v5 00/13] firmware: ti_sci: Partial-IO support

Markus Schneider-Pargmann posted 13 patches 11 months, 1 week ago
There is a newer version of this series
.../devicetree/bindings/net/can/bosch,m_can.yaml   |  18 +++
arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts           |  60 +++++++++
arch/arm64/boot/dts/ti/k3-am62.dtsi                |  22 ++++
arch/arm64/boot/dts/ti/k3-am62a.dtsi               |  27 +++++
arch/arm64/boot/dts/ti/k3-am62a7-sk.dts            |  76 ++++++++++++
arch/arm64/boot/dts/ti/k3-am62p.dtsi               |  27 +++++
arch/arm64/boot/dts/ti/k3-am62p5-sk.dts            |  76 ++++++++++++
arch/arm64/boot/dts/ti/k3-pinctrl.h                |   2 +
drivers/firmware/ti_sci.c                          | 134 ++++++++++++++++++++-
drivers/firmware/ti_sci.h                          |   5 +
drivers/net/can/m_can/m_can.c                      | 111 ++++++++++++++++-
drivers/net/can/m_can/m_can.h                      |   4 +
drivers/net/can/m_can/m_can_pci.c                  |   4 +-
drivers/net/can/m_can/m_can_platform.c             |   4 +-
drivers/net/can/m_can/tcan4x5x-core.c              |   4 +-
15 files changed, 562 insertions(+), 12 deletions(-)
[PATCH v5 00/13] firmware: ti_sci: Partial-IO support
Posted by Markus Schneider-Pargmann 11 months, 1 week ago
Hi,

up to last series, the Partial-IO support consisted of two independent
series. As this last rework introduced file-based conflicts, I merged
the mcan series introducing wakeup support into this series:

  can: m_can: Add am62 wakeup support
  https://lore.kernel.org/lkml/20241219-topic-mcan-wakeup-source-v6-12-v6-0-1356c7f7cfda@baylibre.com/

Series
------
The series contains three parts:
 - m_can support for Partial-IO, in particular 'wakeup' pinctrl support.
 - ti_sci support for Partial-IO, which checks wakeup-sources if they
   are enabled for Partial-IO
 - DT description of system states on am62, am62a, am62p and the
   enabling of wakeup support on the starter kits that support it.

The series is based on v6.14-rc1.

Partial-IO
----------
Partial-IO is a low power system state in which nearly everything is
turned off except the pins of the CANUART group. CANUART contains the
mcu_mcan0, mcu_mcan1, wkup_uart0 and mcu_uart0 devices. These can
trigger a wakeup of the system on pin activity. Note that this does not
resume the system as the DDR is off as well. So this state can be
considered a power-off state with wakeup capabilities.

The wakeup capability of a device is described in the devicetree with
the wakeup-source property. This can hold phandles to system states in
which the device is capable of wakeup. Additionally a WKUP_EN flag is
set in the pinctrl of devices that are wakeup enabled.

On poweroff ti_sci checks if potential wakeup-sources for Partial-IO are
wakeup-enabled by the user. If that is the case, the poweroff is done
by TI_SCI by sending a PREPARE_SLEEP message with a specific mode. Once
sent the system will poweroff apart from the CANUART pins.

Dependencies
------------
This series requires an updated DT binding for the wakeup-source
property that allows the use of system-states which are also being added
in this pullrequest:
 - dt-schema wakeup-source binding update
   https://github.com/devicetree-org/dt-schema/pull/150

Testing
-------
After enabling Wake-on-LAN the system can be powered off and will enter
the Partial-IO state in which it can be woken up by activity on the
specific pins:
    ethtool -s can0 wol p
    ethtool -s can1 wol p
    poweroff

These patches are tested on am62-lp-sk on linux-next.

Best,
Markus

Previous versions "firmware: ti_sci: Partial-IO support":
 v1: https://lore.kernel.org/lkml/20240523080225.1288617-1-msp@baylibre.com/
 v2: https://lore.kernel.org/lkml/20240729080101.3859701-1-msp@baylibre.com/
 v3: https://lore.kernel.org/r/20241012-topic-am62-partialio-v6-13-b4-v3-0-f7c6c2739681@baylibre.com
 v4: https://lore.kernel.org/r/20241219-topic-am62-partialio-v6-12-b4-v4-0-1cb8eabd407e@baylibre.com

Previous versions "can: m_can: Add am62 wakeup support":
 v1: https://lore.kernel.org/lkml/20240523075347.1282395-1-msp@baylibre.com/
 v2: https://lore.kernel.org/lkml/20240729074135.3850634-1-msp@baylibre.com/
 v3: https://lore.kernel.org/lkml/20241011-topic-mcan-wakeup-source-v6-12-v3-0-9752c714ad12@baylibre.com
 v4: https://lore.kernel.org/r/20241015-topic-mcan-wakeup-source-v6-12-v4-0-fdac1d1e7aa6@baylibre.com
 v5: https://lore.kernel.org/r/20241028-topic-mcan-wakeup-source-v6-12-v5-0-33edc0aba629@baylibre.com
 v6: https://lore.kernel.org/r/20241219-topic-mcan-wakeup-source-v6-12-v6-0-1356c7f7cfda@baylibre.com

Changes in v5:
 - Rebased to v6.14-rc1
 - Merged m_can and ti_sci series to avoid conflicts and show
   dependencies more easily
 - Added definitions of system-states for am62/am62a/am62p
 - Moved wakeup-source definitions into board dts files as they require
   a bit of support on the board.
 - Updated ti_sci support to walk through the wakeup-source phandle
   lists
 - Added pinctrl settings for mcu_mcan0/1 on all boards
 - Minor style updates for ti_sci support for transfers without response
 - Update and move the dt-binding for wakeup-source from the m_can
   binding to the dt-schema repository

Changes in v4:
 - Rebased to v6.13-rc1
 - Removed all regulator related structures from patches and implemented
   the wakeup-source property use instead.

Changes in v3:
 - Remove other modes declared for PREPARE_SLEEP as they probably won't
   ever be used in upstream.
 - Replace the wait loop after sending PREPARE_SLEEP with msleep and do
   an emergency_restart if it exits
 - Remove uarts from DT wakeup sources
 - Split no response handling in ti_sci_do_xfer() into a separate patch
   and use goto instead of if ()
 - Remove DT binding parital-io-wakeup-sources. Instead I am modeling
   the devices that are in the relevant group that are powered during
   Partial-IO with the power supplies that are externally provided to
   the SoC. In this case they are provided through 'vddshv_canuart'. All
   devices using this regulator can be considered a potential wakeup
   source if they are wakeup capable and wakeup enabled.
 - Added devicetree patches adding vcc_3v3_sys regulator and
   vddshv_canuart for am62-lp-sk
 - Add pinctrl entries for am62-lp-sk to add WKUP_EN for mcu_mcan0 and
   mcu_mcan1

Changes in v2:
 - Rebase to v6.11-rc1
 - dt-binding:
    - Update commit message
    - Add more verbose description of the new binding for a better
      explanation.
 - ti_sci driver:
    - Combine ti_sci_do_send() into ti_sci_do_xfer and only wait on a
      response if a flag is set.
    - On failure to enter Partial-IO, do emergency_restart()
    - Add comments
    - Fix small things

Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
---
Markus Schneider-Pargmann (13):
      firmware: ti_sci: Support transfers without response
      firmware: ti_sci: Partial-IO support
      dt-bindings: can: m_can: Add wakeup properties
      can: m_can: Map WoL to device_set_wakeup_enable
      can: m_can: Return ERR_PTR on error in allocation
      can: m_can: Support pinctrl wakeup state
      arm64: dts: ti: k3-pinctrl: Add WKUP_EN flag
      arm64: dts: ti: k3-am62: Define possible system states
      arm64: dts: ti: k3-am62a: Define possible system states
      arm64: dts: ti: k3-am62p: Define possible system states
      arm64: dts: ti: k3-am62-lp-sk: Set wakeup-source system-states
      arm64: dts: ti: k3-am62a7-sk: Set wakeup-source system-states
      arm64: dts: ti: k3-am62p5-sk: Set wakeup-source system-states

 .../devicetree/bindings/net/can/bosch,m_can.yaml   |  18 +++
 arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts           |  60 +++++++++
 arch/arm64/boot/dts/ti/k3-am62.dtsi                |  22 ++++
 arch/arm64/boot/dts/ti/k3-am62a.dtsi               |  27 +++++
 arch/arm64/boot/dts/ti/k3-am62a7-sk.dts            |  76 ++++++++++++
 arch/arm64/boot/dts/ti/k3-am62p.dtsi               |  27 +++++
 arch/arm64/boot/dts/ti/k3-am62p5-sk.dts            |  76 ++++++++++++
 arch/arm64/boot/dts/ti/k3-pinctrl.h                |   2 +
 drivers/firmware/ti_sci.c                          | 134 ++++++++++++++++++++-
 drivers/firmware/ti_sci.h                          |   5 +
 drivers/net/can/m_can/m_can.c                      | 111 ++++++++++++++++-
 drivers/net/can/m_can/m_can.h                      |   4 +
 drivers/net/can/m_can/m_can_pci.c                  |   4 +-
 drivers/net/can/m_can/m_can_platform.c             |   4 +-
 drivers/net/can/m_can/tcan4x5x-core.c              |   4 +-
 15 files changed, 562 insertions(+), 12 deletions(-)
---
base-commit: 7ec162622e66a4ff886f8f28712ea1b13069e1aa
change-id: 20241008-topic-am62-partialio-v6-12-b4-c273fbac4447

Best regards,
-- 
Markus Schneider-Pargmann <msp@baylibre.com>
Re: [PATCH v5 00/13] firmware: ti_sci: Partial-IO support
Posted by Markus Schneider-Pargmann 11 months, 1 week ago
On Thu, Mar 06, 2025 at 12:14:38PM +0100, Markus Schneider-Pargmann wrote:
> Hi,
> 
> up to last series, the Partial-IO support consisted of two independent
> series. As this last rework introduced file-based conflicts, I merged
> the mcan series introducing wakeup support into this series:
> 
>   can: m_can: Add am62 wakeup support
>   https://lore.kernel.org/lkml/20241219-topic-mcan-wakeup-source-v6-12-v6-0-1356c7f7cfda@baylibre.com/
> 
> Series
> ------
> The series contains three parts:
>  - m_can support for Partial-IO, in particular 'wakeup' pinctrl support.
>  - ti_sci support for Partial-IO, which checks wakeup-sources if they
>    are enabled for Partial-IO
>  - DT description of system states on am62, am62a, am62p and the
>    enabling of wakeup support on the starter kits that support it.
> 
> The series is based on v6.14-rc1.

Small correction here, this is based on next-20250305.

Best
Markus

> 
> Partial-IO
> ----------
> Partial-IO is a low power system state in which nearly everything is
> turned off except the pins of the CANUART group. CANUART contains the
> mcu_mcan0, mcu_mcan1, wkup_uart0 and mcu_uart0 devices. These can
> trigger a wakeup of the system on pin activity. Note that this does not
> resume the system as the DDR is off as well. So this state can be
> considered a power-off state with wakeup capabilities.
> 
> The wakeup capability of a device is described in the devicetree with
> the wakeup-source property. This can hold phandles to system states in
> which the device is capable of wakeup. Additionally a WKUP_EN flag is
> set in the pinctrl of devices that are wakeup enabled.
> 
> On poweroff ti_sci checks if potential wakeup-sources for Partial-IO are
> wakeup-enabled by the user. If that is the case, the poweroff is done
> by TI_SCI by sending a PREPARE_SLEEP message with a specific mode. Once
> sent the system will poweroff apart from the CANUART pins.
> 
> Dependencies
> ------------
> This series requires an updated DT binding for the wakeup-source
> property that allows the use of system-states which are also being added
> in this pullrequest:
>  - dt-schema wakeup-source binding update
>    https://github.com/devicetree-org/dt-schema/pull/150
> 
> Testing
> -------
> After enabling Wake-on-LAN the system can be powered off and will enter
> the Partial-IO state in which it can be woken up by activity on the
> specific pins:
>     ethtool -s can0 wol p
>     ethtool -s can1 wol p
>     poweroff
> 
> These patches are tested on am62-lp-sk on linux-next.
> 
> Best,
> Markus
> 
> Previous versions "firmware: ti_sci: Partial-IO support":
>  v1: https://lore.kernel.org/lkml/20240523080225.1288617-1-msp@baylibre.com/
>  v2: https://lore.kernel.org/lkml/20240729080101.3859701-1-msp@baylibre.com/
>  v3: https://lore.kernel.org/r/20241012-topic-am62-partialio-v6-13-b4-v3-0-f7c6c2739681@baylibre.com
>  v4: https://lore.kernel.org/r/20241219-topic-am62-partialio-v6-12-b4-v4-0-1cb8eabd407e@baylibre.com
> 
> Previous versions "can: m_can: Add am62 wakeup support":
>  v1: https://lore.kernel.org/lkml/20240523075347.1282395-1-msp@baylibre.com/
>  v2: https://lore.kernel.org/lkml/20240729074135.3850634-1-msp@baylibre.com/
>  v3: https://lore.kernel.org/lkml/20241011-topic-mcan-wakeup-source-v6-12-v3-0-9752c714ad12@baylibre.com
>  v4: https://lore.kernel.org/r/20241015-topic-mcan-wakeup-source-v6-12-v4-0-fdac1d1e7aa6@baylibre.com
>  v5: https://lore.kernel.org/r/20241028-topic-mcan-wakeup-source-v6-12-v5-0-33edc0aba629@baylibre.com
>  v6: https://lore.kernel.org/r/20241219-topic-mcan-wakeup-source-v6-12-v6-0-1356c7f7cfda@baylibre.com
> 
> Changes in v5:
>  - Rebased to v6.14-rc1
>  - Merged m_can and ti_sci series to avoid conflicts and show
>    dependencies more easily
>  - Added definitions of system-states for am62/am62a/am62p
>  - Moved wakeup-source definitions into board dts files as they require
>    a bit of support on the board.
>  - Updated ti_sci support to walk through the wakeup-source phandle
>    lists
>  - Added pinctrl settings for mcu_mcan0/1 on all boards
>  - Minor style updates for ti_sci support for transfers without response
>  - Update and move the dt-binding for wakeup-source from the m_can
>    binding to the dt-schema repository
> 
> Changes in v4:
>  - Rebased to v6.13-rc1
>  - Removed all regulator related structures from patches and implemented
>    the wakeup-source property use instead.
> 
> Changes in v3:
>  - Remove other modes declared for PREPARE_SLEEP as they probably won't
>    ever be used in upstream.
>  - Replace the wait loop after sending PREPARE_SLEEP with msleep and do
>    an emergency_restart if it exits
>  - Remove uarts from DT wakeup sources
>  - Split no response handling in ti_sci_do_xfer() into a separate patch
>    and use goto instead of if ()
>  - Remove DT binding parital-io-wakeup-sources. Instead I am modeling
>    the devices that are in the relevant group that are powered during
>    Partial-IO with the power supplies that are externally provided to
>    the SoC. In this case they are provided through 'vddshv_canuart'. All
>    devices using this regulator can be considered a potential wakeup
>    source if they are wakeup capable and wakeup enabled.
>  - Added devicetree patches adding vcc_3v3_sys regulator and
>    vddshv_canuart for am62-lp-sk
>  - Add pinctrl entries for am62-lp-sk to add WKUP_EN for mcu_mcan0 and
>    mcu_mcan1
> 
> Changes in v2:
>  - Rebase to v6.11-rc1
>  - dt-binding:
>     - Update commit message
>     - Add more verbose description of the new binding for a better
>       explanation.
>  - ti_sci driver:
>     - Combine ti_sci_do_send() into ti_sci_do_xfer and only wait on a
>       response if a flag is set.
>     - On failure to enter Partial-IO, do emergency_restart()
>     - Add comments
>     - Fix small things
> 
> Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
> ---
> Markus Schneider-Pargmann (13):
>       firmware: ti_sci: Support transfers without response
>       firmware: ti_sci: Partial-IO support
>       dt-bindings: can: m_can: Add wakeup properties
>       can: m_can: Map WoL to device_set_wakeup_enable
>       can: m_can: Return ERR_PTR on error in allocation
>       can: m_can: Support pinctrl wakeup state
>       arm64: dts: ti: k3-pinctrl: Add WKUP_EN flag
>       arm64: dts: ti: k3-am62: Define possible system states
>       arm64: dts: ti: k3-am62a: Define possible system states
>       arm64: dts: ti: k3-am62p: Define possible system states
>       arm64: dts: ti: k3-am62-lp-sk: Set wakeup-source system-states
>       arm64: dts: ti: k3-am62a7-sk: Set wakeup-source system-states
>       arm64: dts: ti: k3-am62p5-sk: Set wakeup-source system-states
> 
>  .../devicetree/bindings/net/can/bosch,m_can.yaml   |  18 +++
>  arch/arm64/boot/dts/ti/k3-am62-lp-sk.dts           |  60 +++++++++
>  arch/arm64/boot/dts/ti/k3-am62.dtsi                |  22 ++++
>  arch/arm64/boot/dts/ti/k3-am62a.dtsi               |  27 +++++
>  arch/arm64/boot/dts/ti/k3-am62a7-sk.dts            |  76 ++++++++++++
>  arch/arm64/boot/dts/ti/k3-am62p.dtsi               |  27 +++++
>  arch/arm64/boot/dts/ti/k3-am62p5-sk.dts            |  76 ++++++++++++
>  arch/arm64/boot/dts/ti/k3-pinctrl.h                |   2 +
>  drivers/firmware/ti_sci.c                          | 134 ++++++++++++++++++++-
>  drivers/firmware/ti_sci.h                          |   5 +
>  drivers/net/can/m_can/m_can.c                      | 111 ++++++++++++++++-
>  drivers/net/can/m_can/m_can.h                      |   4 +
>  drivers/net/can/m_can/m_can_pci.c                  |   4 +-
>  drivers/net/can/m_can/m_can_platform.c             |   4 +-
>  drivers/net/can/m_can/tcan4x5x-core.c              |   4 +-
>  15 files changed, 562 insertions(+), 12 deletions(-)
> ---
> base-commit: 7ec162622e66a4ff886f8f28712ea1b13069e1aa
> change-id: 20241008-topic-am62-partialio-v6-12-b4-c273fbac4447
> 
> Best regards,
> -- 
> Markus Schneider-Pargmann <msp@baylibre.com>
>