TI SYSC 模块电源与 Idle 管理

TI SYSC 模块电源与 Idle 管理

1. 定位

ti-sysc.c约3500行,是TI OMAP/AM/DRA interconnect target module驱动。它统一管理目标模块的:

  • revision/SYSC/SYSS寄存器;
  • functional/interface/optional clocks;
  • reset;
  • smart/force/no-idle;
  • wakeup;
  • runtime PM;
  • child platform devices;
  • 大量代际quirk。

它不是通用syscon驱动,也不适用于Rockchip。

2. 初始化

1
2
3
module_init(sysc_init)
-> platform bus notifier
-> register sysc platform driver

Notifier用于给legacy children补clock和PM关系。

3. Probe流程

1
2
3
4
5
6
7
8
9
10
11
parse ranges/module address
-> select SoC/module data
-> map/check REV/SYSC/SYSS
-> parse idle modes and quirks
-> acquire fck/ick/optional clocks
-> acquire shared reset
-> enable clocks/deassert reset
-> read revision
-> soft reset/init sysconfig
-> enable runtime PM
-> of_platform_populate(simple-bus children)

对于early console、timer或legacy hwmod,部分模块需要延迟idle或跳过普通populate。

4. 数据描述

struct sysc保存:

  • register offsets和width;
  • physical module range;
  • clock/reset;
  • sysc mask和regbits;
  • capabilities;
  • quirk flags;
  • saved context;
  • child/legacy信息;
  • delayed work和list节点。

ti_sysc_module_data等platform data允许架构侧补充legacy callback。

5. Idle模式

SYSC寄存器可控制SIDLE/MSTANDBY:

  • force idle;
  • no idle;
  • smart idle;
  • smart idle wakeup。

选择取决于DT声明、硬件能力和quirk。错误配置会导致:

  • 模块永不休眠;
  • 事务进行中被idle;
  • wake事件丢失;
  • interconnect timeout。

6. Runtime PM

Resume大致:

1
2
3
4
5
enable clocks
-> deassert reset
-> restore/reinit sysconfig
-> enable module
-> allow interconnect access

Suspend逆序关闭module和clock,并可能assert reset。Clock domain deny/allow与runtime PM配合,防止寄存器访问时域被关。

7. Soft Reset

Driver写SOFTRESET并轮询RESETDONE/SYSS。部分硬件reset bit自清、部分需特殊顺序;timeout可能只warn,因为老平台存在不可靠状态位。

不能把一次soft reset成功视为child DMA已停止,child driver仍需先quiesce。

8. Context Lost

支持REINIT_ON_CTX_LOST的模块在cluster PM或域掉电后:

  • 比较关键sysconfig与saved value;
  • 识别context丢失;
  • 重新执行module初始化;
  • 必要时soft reset;
  • 恢复idle/wakeup。

CPU cluster PM notifier在exit时处理登记模块。

9. Child PM

Platform bus notifier处理child add:

  • 查找parent sysc;
  • 给child提供legacy clocks;
  • 可挂专用child PM domain;
  • 让child runtime suspend/resume联动parent。

该机制用于兼容旧hwmod设备树,不应复制到新平台替代标准genpd/device link。

10. Remove

1
2
3
4
5
6
cancel delayed idle work
-> runtime resume/get
-> of_platform_depopulate
-> runtime put/disable
-> assert reset
-> unprepare clocks

相比simple-pm-bus,TI SYSC拥有真实寄存器和资源,必须显式depopulate及逆序回滚。

11. 并发

并发来源包括:

  • runtime PM;
  • delayed idle work;
  • platform notifier;
  • CPU PM notifier;
  • child I/O;
  • remove。

Disabled/restored module全局list由锁保护。复杂操作尽量由PM和work上下文串行,而不是在hardirq执行。

12. RK3588边界

Kconfig要求ARCH_OMAP2PLUS,compatible及寄存器布局均为TI。RK3588相似功能由Rockchip genpd、clock/reset、syscon和功能driver分担,不能使用ti-sysc替换。

文章互动

阅读 --

留言

0 条留言

正在加载留言…