mpc83xx: Power Management support
Subsystems (2)
PATCH v2 5/8 mpc83xx: Power Management support
Basic PM support for 83xx. Standby is implemented as sleep. Suspend-to-RAM is implemented as "deep sleep" (with the processor turned off) on 831x.
Signed-off-by Scott Wood <[email protected]>
---
The enabling of i-cache at the end of the suspend code somehow fell off of the code that was sent out in the previous patch (it still works when booting high, which is what I tested, but not booting low).
The rest of the patchset stays the same.
arch/powerpc/platforms/83xx/Kconfig | 5 + arch/powerpc/platforms/83xx/Makefile | 1 + arch/powerpc/platforms/83xx/suspend-asm.S | 539 +++++++++++++++++++++++++++++ arch/powerpc/platforms/83xx/suspend.c | 423 ++++++++++++++++++++++ arch/powerpc/sysdev/fsl_soc.c | 33 ++ arch/powerpc/sysdev/fsl_soc.h | 10 + arch/powerpc/sysdev/ipic.c | 71 ++++ include/asm-powerpc/reg.h | 4 + include/linux/fsl_devices.h | 24 ++ 9 files changed, 1110 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/platforms/83xx/suspend-asm.S create mode 100644 arch/powerpc/platforms/83xx/suspend.c
arch/powerpc/platforms/83xx/Kconfig +5 -0
@@ -75,3 +75,8 @@ config PPC_MPC836x select PPC_UDBG_16550 select PPC_INDIRECT_PCI default y if MPC836x_MDS + +config PPC_83xx_SUSPEND + bool + default y + depends on PPC_83xx && SUSPEND
arch/powerpc/platforms/83xx/Makefile +1 -0
@@ -3,6 +3,7 @@ # obj-y := misc.o usb.o obj-$(CONFIG_PCI) += pci.o +obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
arch/powerpc/platforms/83xx/suspend-asm.S new file +539 -0
539 lines not on this page · raw message
arch/powerpc/platforms/83xx/suspend.c new file +423 -0
423 lines not on this page · raw message
arch/powerpc/sysdev/fsl_soc.c +33 -0
@@ -151,6 +151,33 @@ u32 get_baudrate(void)EXPORT_SYMBOL (get_baudrate);#endif /* CONFIG_CPM2 */ +int fsl_sleep_init (struct fsl_sleep_platform_data *sleep, +struct device_node *node) +{ +int proplen, ret = -ENODEV ; +const u32 *sleepdata =of_get_property (node,"sleep" , &proplen); +struct device_node *sleep_controller; + +if (!sleepdata || proplen !=8 ) +return -ENODEV ; + + sleep_controller =of_find_node_by_phandle (sleepdata[0 ]); +if (!sleep_controller) +return -ENODEV ; + +/* There can only be one fsl,mpc83xx-pmc device in the system; +* it is assumed that it is the one that the pmc driver matches. +*/ +if (of_device_is_compatible (sleep_controller,"fsl,mpc83xx-pmc" )) { + sleep->sccr_mask = sleepdata[1 ]; + ret =0 ; + } + +of_node_put (sleep_controller); +return ret; +} +EXPORT_SYMBOL (fsl_sleep_init); +static int __init gfar_mdio_of_init (void ) {struct device_node *np;
@@ -321,6 +348,8 @@ static int __init gfar_of_init(void)of_node_put (phy);of_node_put (mdio); +fsl_sleep_init (&gfar_data.sleep, np); + ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct
@@ -576,6 +605,8 @@ static int __init fsl_usb_of_init(void) prop =of_get_property (np,"phy_type" ,NULL ); usb_data.phy_mode =determine_usb_phy (prop); +fsl_sleep_init (&usb_data.sleep, np); + ret = platform_device_add_data(usb_dev_mph, &usb_data, sizeof(struct
@@ -640,6 +671,8 @@ static int __init fsl_usb_of_init(void) prop =of_get_property (np,"phy_type" ,NULL ); usb_data.phy_mode =determine_usb_phy (prop); +fsl_sleep_init (&usb_data.sleep, np); +if (usb_dev_dr_host) { usb_dev_dr_host->dev.coherent_dma_mask =0xffffffffUL ; usb_dev_dr_host->dev.dma_mask = &usb_dev_dr_host->
arch/powerpc/sysdev/fsl_soc.h +10 -0
@@ -10,12 +10,22 @@ extern u32 get_baudrate(void);extern u32 fsl_get_sys_freq (void );struct spi_board_info ; +struct fsl_sleep_platform_data ; +struct device_node ;extern int fsl_spi_init (struct spi_board_info *board_infos,unsigned int num_board_infos,void (*activate_cs)(u8 cs,u8 polarity),void (*deactivate_cs)(u8 cs,u8 polarity)); +int fsl_sleep_init (struct fsl_sleep_platform_data *sleep, +struct device_node *node); + +/* Calls to fsl_sleep_dev and fsl_wake_dev cannot be nested. */ +void fsl_sleep_dev (struct fsl_sleep_platform_data *sleep); +void fsl_wake_dev (struct fsl_sleep_platform_data *sleep); +extern void fsl_rstcr_restart (char *cmd); +#endif #endif
arch/powerpc/sysdev/ipic.c +71 -0
85 lines not on this page · raw message
include/asm-powerpc/reg.h +4 -0
@@ -149,7 +149,9 @@#define CTRL_RUNLATCH 0x1#define SPRN_DABR 0x3F5/* Data Address Breakpoint Register */ #define DABR_TRANSLATION (1UL << 2) +#define SPRN_DABR2 0x13D/* 83xx */ #define SPRN_DAR 0x013/* Data Address Register */ +#define SPRN_DBCR 0x136/* 83xx Data Breakpoint Control Reg */ #define SPRN_DSISR 0x012/* Data Storage Interrupt Status Register */ #define DSISR_NOHPTE 0x40000000/* no translation found */ #define DSISR_PROTFAULT 0x08000000/* protection fault */
@@ -255,6 +257,8 @@#define HID1_PS (1<<16)/* 750FX PLL selection */ #define SPRN_HID2 0x3F8/* Hardware Implementation Register 2 */ #define SPRN_IABR 0x3F2/* Instruction Address Breakpoint Register */ +#define SPRN_IABR2 0x3FA/* 83xx */ +#define SPRN_IBCR 0x135/* 83xx Insn Breakpoint Control Reg */ #define SPRN_HID4 0x3F4/* 970 HID4 */ #define SPRN_HID5 0x3F6/* 970 HID5 */ #define SPRN_HID6 0x3F9/* BE HID 6 */
include/linux/fsl_devices.h +24 -0
@@ -45,10 +45,27 @@* */ +struct fsl_sleep_platform_data { +/* +* The bits set in this mask will be cleared in the SCCR +* when put to sleep, and restored on wakeup. +*/ +u32 sccr_mask; +}; + +/* +* Calls to fsl_sleep_device do not nest -- if you call +* sleep twice without an intervening wake, you will not +* be able to wake the device again. +*/ +void fsl_sleep_device (struct fsl_sleep_platform_data *data); +void fsl_wake_device (struct fsl_sleep_platform_data *data); +struct gianfar_platform_data {/* device specific information */ u32 device_flags;/* board specific information */ +struct fsl_sleep_platform_data sleep;u32 board_flags;u32 bus_id;u32 phy_id;
@@ -104,6 +121,7 @@ struct fsl_usb2_platform_data {enum fsl_usb2_operating_modes operating_mode;enum fsl_usb2_phy_modes phy_mode;unsigned int port_enables; +struct fsl_sleep_platform_data sleep; };/* Flags in fsl_usb2_mph_platform_data */
@@ -126,5 +144,11 @@ struct mpc8xx_pcmcia_ops {int (*voltage_set)(int slot,int vcc,int vpp); }; +/* Returns non-zero if the current suspend operation would +* lead to a deep sleep (i.e. power removed from the core, +* instead of just the clock). +*/ +int fsl_deep_sleep (void ); +#endif /* _FSL_DEVICE_H_ */ #endif /* __KERNEL__ */
Signature · 1 line
1.5.3.7