Support for A3SP and A4R domains on SH7372
Subsystems (8)
cover Support for A3SP and A4R domains on SH7372
Hi,
Patches [2/3] and [3/3] add support for the SH7372's A3SP and A4R power domains, respectively.
Patch [1/3] is a fix that's needed for console wakeup to work with the A3SP domain patch.
Thanks,
Rafael
PATCH 1/3 PM / Sleep: Mark devices involved in wakeup signaling during suspend
From: Rafael J. Wysocki <[email protected]>
The generic PM domains code in drivers/base/power/domain.c has to avoid powering off domains that provide power to wakeup devices during system suspend. Currently, however, this only works for wakeup devices directly belonging to the given domain and not for their children (or the children of their children and so on). Thus, if there's a wakeup device whose parent belongs to a power domain handled by the generic PM domains code, the domain will be powered off during system suspend preventing the device from signaling wakeup.
To address this problem introduce a device flag, power.wakeup_path, that will be set during system suspend for all wakeup devices, their parents, the parents of their parents and so on. This way, all wakeup paths in the device hierarchy will be marked and the generic PM domains code will only need to avoid powering off domains containing devices whose power.wakeup_path is set.
--- drivers/base/power/domain.c | 4 ++-- drivers/base/power/main.c | 8 +++++++- include/linux/pm.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)
drivers/base/power/domain.c +2 -2
@@ -714,7 +714,7 @@ static int pm_genpd_suspend_noirq(structif (ret)return ret; -if (device_may_wakeup (dev) +if (dev->power.wakeup_path && genpd->active_wakeup && genpd->active_wakeup (dev))return 0 ;
@@ -938,7 +938,7 @@ static int pm_genpd_dev_poweroff_noirq(sif (ret)return ret; -if (device_may_wakeup (dev) +if (dev->power.wakeup_path && genpd->active_wakeup && genpd->active_wakeup (dev))return 0 ;
drivers/base/power/main.c +7 -1
@@ -917,7 +917,11 @@ static int __device_suspend(struct devic } End: - dev->power.is_suspended = !error; +if (!error) { + dev->power.is_suspended = true; +if (dev->power.wakeup_path && dev->parent) + dev->parent->power.wakeup_path = true; + }device_unlock (dev);complete_all (&dev->power.completion);
@@ -1020,6 +1024,8 @@ static int device_prepare(struct devicedevice_lock (dev); + dev->power.wakeup_path =device_may_wakeup (dev); +if (dev->pm_domain) {pm_dev_dbg (dev, state,"preparing power domain " );if (dev->pm_domain->ops.prepare)
include/linux/pm.h +1 -0
@@ -452,6 +452,7 @@ struct dev_pm_info {struct list_head entry;struct completion completion;struct wakeup_source *wakeup; + bool wakeup_path:1;#else unsigned int should_wakeup:1;#endif
Re: [PATCH 1/3] PM / Sleep: Mark devices involved in wakeup signaling during suspend
Hi Rafael
Just something, that made me wonder:
Quoted 25 lines · Rafael J. Wysocki
From: Rafael J. Wysocki <[email protected]>
The generic PM domains code in
drivers/base/power/domain.chas to avoid powering off domains that provide power to wakeup devices during system suspend. Currently, however, this only works for wakeup devices directly belonging to the given domain and not for their children (or the children of their children and so on). Thus, if there's a wakeup device whose parent belongs to a power domain handled by the generic PM domains code, the domain will be powered off during system suspend preventing the device from signaling wakeup.To address this problem introduce a device flag, power.wakeup_path, that will be set during system suspend for all wakeup devices, their parents, the parents of their parents and so on. This way, all wakeup paths in the device hierarchy will be marked and the generic PM domains code will only need to avoid powering off domains containing devices whose power.wakeup_path is set.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/base/power/domain.c | 4 ++-- drivers/base/power/main.c | 8 +++++++- include/linux/pm.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-)
[snip]
include/linux/pm.h struct dev_pm_info { · line 455
Quoted 8 lines
Index:
linux/include/linux/pm.h=================================> ---linux.orig/include/linux/pm.h+++linux/include/linux/pm.hinclude/linux/pm.h +1
-0@@ -452,6 +452,7 @@ struct dev_pm_info {struct list_head entry;struct completion completion;struct wakeup_source *wakeup; + bool wakeup_path:1;
This is an interesting idea... I'd presume, the compiler is aware, that one bit is enough for "bool," so, it should choose an optimal implementation by itself? I checked gcc 4.4.1 on ARM - without the bitfield notation the compiler just uses one byte in my example. Anyway, not a request-for-change, just wondering whether you really were trying to (potentially) save a couple of bits here or what was the motivation.
include/linux/pm.h struct dev_pm_info { · line 458
Quoted 3 lines
include/linux/pm.h +0
-0#else unsigned int should_wakeup:1;#endif
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
PATCH 2/3 ARM: mach-shmobile: sh7372 A3SP support (v4)
In reply to Rafael J. WysockiFrom: Magnus Damm <[email protected]>
This change adds support for the sh7372 A3SP power domain.
The sh7372 A3SP hardware power domain contains a wide range of I/O devices. The list of I/O devices include SCIF serial ports, DMA Engine hardware, SD and MMC controller hardware, USB controllers and I2C master controllers.
This patch adds the A3SP low level code which powers the hardware power domain on and off. It also ties in platform devices to the pm domain support code.
It is worth noting that the serial console is hooked up to SCIFA0 on most sh7372 boards, and the SCIFA0 port is included in the A3SP hardware power domain. For this reason we cannot output debug messages from the low level power control code in the case of A3SP.
QoS support is needed in drivers before we can enable the A3SP power control on the fly.
--- arch/arm/mach-shmobile/board-ap4evb.c | 4 +++ arch/arm/mach-shmobile/board-mackerel.c | 8 +++++++ arch/arm/mach-shmobile/include/mach/sh7372.h | 3 ++ arch/arm/mach-shmobile/pm-sh7372.c | 30 ++++++++++++++++++++++----- arch/arm/mach-shmobile/setup-sh7372.c | 14 ++++++++++++ 5 files changed, 54 insertions(+), 5 deletions(-)
arch/arm/mach-shmobile/board-ap4evb.c +4 -0
@@ -1409,6 +1409,10 @@ static void __init ap4evb_init(void)sh7372_add_device_to_domain (&sh7372_a4lc, &lcdc_device);sh7372_add_device_to_domain (&sh7372_a4mp, &fsi_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &sh_mmcif_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi0_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device); +hdmi_init_pm_clock ();fsi_init_pm_clock ();sh7372_pm_init ();
arch/arm/mach-shmobile/board-mackerel.c +8 -0
@@ -1588,6 +1588,14 @@ static void __init mackerel_init(void)sh7372_add_device_to_domain (&sh7372_a4lc, &lcdc_device);sh7372_add_device_to_domain (&sh7372_a4lc, &hdmi_lcdc_device);sh7372_add_device_to_domain (&sh7372_a4mp, &fsi_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &usbhs0_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &usbhs1_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &sh_mmcif_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi0_device); +#if !defined(CONFIG_MMC_SH_MMCIF ) && !defined(CONFIG_MMC_SH_MMCIF_MODULE ) +sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device); +#endif +sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi2_device);hdmi_init_pm_clock ();sh7372_pm_init ();
arch/arm/mach-shmobile/include/mach/sh7372.h +3 -0
@@ -479,7 +479,9 @@ struct platform_device;struct sh7372_pm_domain {struct generic_pm_domain genpd; +struct dev_power_governor *gov;unsigned int bit_shift; +bool no_debug; };static inline struct sh7372_pm_domain *to_sh7372_pd (struct generic_pm_domain *d)
@@ -493,6 +495,7 @@ extern struct sh7372_pm_domain sh7372_a4extern struct sh7372_pm_domain sh7372_d4;extern struct sh7372_pm_domain sh7372_a3rv;extern struct sh7372_pm_domain sh7372_a3ri; +extern struct sh7372_pm_domain sh7372_a3sp;extern struct sh7372_pm_domain sh7372_a3sg;extern void sh7372_init_pm_domain (struct sh7372_pm_domain *sh7372_pd);
arch/arm/mach-shmobile/pm-sh7372.c +25 -5
@@ -92,8 +92,9 @@ static int pd_power_down(struct generic_ } } -pr_debug ("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n" , - mask,__raw_readl (PSTR )); +if (!sh7372_pd->no_debug) +pr_debug ("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n" , + mask,__raw_readl (PSTR ));return 0 ; }
@@ -122,8 +123,9 @@ static int pd_power_up(struct generic_pm ret = -EIO ; out: -pr_debug ("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n" , - mask,__raw_readl (PSTR )); +if (!sh7372_pd->no_debug) +pr_debug ("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n" , + mask,__raw_readl (PSTR ));return ret; }
@@ -133,11 +135,20 @@ static bool pd_active_wakeup(struct devireturn true; } +static bool sh7372_power_down_forbidden (struct dev_pm_domain *domain) +{ +return false; +} + +struct dev_power_governor sh7372_always_on_gov = { + .power_down_ok = sh7372_power_down_forbidden, +}; +void sh7372_init_pm_domain (struct sh7372_pm_domain *sh7372_pd) {struct generic_pm_domain *genpd = &sh7372_pd->genpd; -pm_genpd_init (genpd,NULL , false); +pm_genpd_init (genpd, sh7372_pd->gov, false); genpd->stop_device = pm_clk_suspend; genpd->start_device = pm_clk_resume; genpd->dev_irq_safe = true;
@@ -183,6 +194,12 @@ struct sh7372_pm_domain sh7372_a3ri = { .bit_shift = 8, }; +struct sh7372_pm_domain sh7372_a3sp = { + .bit_shift =11 , + .gov = &sh7372_always_on_gov, + .no_debug = true, +}; +struct sh7372_pm_domain sh7372_a3sg = { .bit_shift =13 , };
@@ -422,6 +439,9 @@ void __init sh7372_pm_init(void)__raw_writel (0x0000a501 ,DBGREG9 );__raw_writel (0x00000000 ,DBGREG1 ); +/* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */ +__raw_writel (0 ,PDNSEL ); +sh7372_suspend_init ();sh7372_cpuidle_init (); }
arch/arm/mach-shmobile/setup-sh7372.c +14 -0
@@ -994,6 +994,7 @@ void __init sh7372_add_standard_devices(sh7372_init_pm_domain (&sh7372_a3rv);sh7372_init_pm_domain (&sh7372_a3ri);sh7372_init_pm_domain (&sh7372_a3sg); +sh7372_init_pm_domain (&sh7372_a3sp);sh7372_pm_add_subdomain (&sh7372_a4lc, &sh7372_a3rv);
@@ -1006,6 +1007,19 @@ void __init sh7372_add_standard_devices(sh7372_add_device_to_domain (&sh7372_a3rv, &vpu_device);sh7372_add_device_to_domain (&sh7372_a4mp, &spu0_device);sh7372_add_device_to_domain (&sh7372_a4mp, &spu1_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif0_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif1_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif2_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif3_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif4_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif5_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &scif6_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &iic1_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &dma0_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &dma1_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &dma2_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma0_device); +sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma1_device); }void __init sh7372_add_early_devices (void )
PATCH 3/3 ARM: mach-shmobile: sh7372 A4R support (v4)
In reply to Rafael J. WysockiFrom: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
The sh7372 A4R hardware power domain contains the SH CPU Core and a set of I/O devices including multimedia accelerators and I2C controllers.
One special case about A4R is the INTCS interrupt controller that needs to be saved and restored to keep working as expected. Also the LCDC hardware blocks are in a different hardware power domain but have their IRQs routed only through INTCS. So as long as LCDCs are active we cannot power down INTCS because that would risk losing interrupts.
--- arch/arm/mach-shmobile/board-ap4evb.c | 1 arch/arm/mach-shmobile/board-mackerel.c | 1 arch/arm/mach-shmobile/include/mach/sh7372.h | 7 +++ arch/arm/mach-shmobile/intc-sh7372.c | 52 ++++++++++++++++++++++++++- arch/arm/mach-shmobile/pm-sh7372.c | 29 ++++++++++++++- arch/arm/mach-shmobile/setup-sh7372.c | 8 ++++ 6 files changed, 96 insertions(+), 2 deletions(-)
arch/arm/mach-shmobile/board-ap4evb.c +1 -0
@@ -1412,6 +1412,7 @@ static void __init ap4evb_init(void)sh7372_add_device_to_domain (&sh7372_a3sp, &sh_mmcif_device);sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi0_device);sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &ceu_device);hdmi_init_pm_clock ();fsi_init_pm_clock ();
arch/arm/mach-shmobile/board-mackerel.c +1 -0
@@ -1596,6 +1596,7 @@ static void __init mackerel_init(void)sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device);#endif sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi2_device); +sh7372_add_device_to_domain (&sh7372_a4r, &ceu_device);hdmi_init_pm_clock ();sh7372_pm_init ();
arch/arm/mach-shmobile/include/mach/sh7372.h +7 -0
@@ -480,8 +480,11 @@ struct platform_device;struct sh7372_pm_domain {struct generic_pm_domain genpd;struct dev_power_governor *gov; +void (*suspend)(void ); +void (*resume)(void );unsigned int bit_shift;bool no_debug; +bool stay_on; };static inline struct sh7372_pm_domain *to_sh7372_pd (struct generic_pm_domain *d)
@@ -493,6 +496,7 @@ static inline struct sh7372_pm_domain *textern struct sh7372_pm_domain sh7372_a4lc;extern struct sh7372_pm_domain sh7372_a4mp;extern struct sh7372_pm_domain sh7372_d4; +extern struct sh7372_pm_domain sh7372_a4r;extern struct sh7372_pm_domain sh7372_a3rv;extern struct sh7372_pm_domain sh7372_a3ri;extern struct sh7372_pm_domain sh7372_a3sp;
@@ -509,4 +513,7 @@ extern void sh7372_pm_add_subdomain(stru#define sh7372_pm_add_subdomain (pd, sd) do { } while(0)#endif /* CONFIG_PM */ +extern void sh7372_intcs_suspend (void ); +extern void sh7372_intcs_resume (void ); +#endif /* __ASM_SH7372_H__ */
arch/arm/mach-shmobile/intc-sh7372.c +51 -1
63 lines not on this page · raw message
arch/arm/mach-shmobile/pm-sh7372.c +28 -1
@@ -44,6 +44,7 @@#define SPDCR 0xe6180008#define SWUCR 0xe6180014#define SBAR 0xe6180020 +#define WUPRMSK 0xe6180028#define WUPSMSK 0xe618002c#define WUPSMSK2 0xe6180048#define PSTR 0xe6180080
@@ -80,6 +81,12 @@ static int pd_power_down(struct generic_struct sh7372_pm_domain *sh7372_pd =to_sh7372_pd (genpd);unsigned int mask =1 << sh7372_pd->bit_shift; +if (sh7372_pd->suspend) + sh7372_pd->suspend (); + +if (sh7372_pd->stay_on) +return 0 ; +if (__raw_readl (PSTR ) & mask) {unsigned int retry_count;
@@ -106,6 +113,9 @@ static int pd_power_up(struct generic_pmunsigned int retry_count;int ret =0 ; +if (sh7372_pd->stay_on) + goto out; +if (__raw_readl (PSTR ) & mask) goto out;
@@ -122,14 +132,23 @@ static int pd_power_up(struct generic_pmif (__raw_readl (SWUCR ) & mask) ret = -EIO ; - out:if (!sh7372_pd->no_debug)pr_debug ("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n" , mask,__raw_readl (PSTR )); + out: +if (ret ==0 && sh7372_pd->resume) + sh7372_pd->resume (); +return ret; } +static void sh7372_a4r_suspend (void ) +{ +sh7372_intcs_suspend (); +__raw_writel (0x300fffff ,WUPRMSK );/* avoid wakeup */ +} +static bool pd_active_wakeup (struct device *dev) {return true;
@@ -186,6 +205,14 @@ struct sh7372_pm_domain sh7372_d4 = { .bit_shift = 3, }; +struct sh7372_pm_domain sh7372_a4r = { + .bit_shift =5 , + .gov = &sh7372_always_on_gov, + .suspend = sh7372_a4r_suspend, + .resume = sh7372_intcs_resume, + .stay_on = true, +}; +struct sh7372_pm_domain sh7372_a3rv = { .bit_shift =6 , };
arch/arm/mach-shmobile/setup-sh7372.c +8 -0
@@ -991,12 +991,14 @@ void __init sh7372_add_standard_devices(sh7372_init_pm_domain (&sh7372_a4lc);sh7372_init_pm_domain (&sh7372_a4mp);sh7372_init_pm_domain (&sh7372_d4); +sh7372_init_pm_domain (&sh7372_a4r);sh7372_init_pm_domain (&sh7372_a3rv);sh7372_init_pm_domain (&sh7372_a3ri);sh7372_init_pm_domain (&sh7372_a3sg);sh7372_init_pm_domain (&sh7372_a3sp);sh7372_pm_add_subdomain (&sh7372_a4lc, &sh7372_a3rv); +sh7372_pm_add_subdomain (&sh7372_a4r, &sh7372_a4lc);platform_add_devices (sh7372_early_devices,ARRAY_SIZE (sh7372_early_devices));
@@ -1020,6 +1022,12 @@ void __init sh7372_add_standard_devices(sh7372_add_device_to_domain (&sh7372_a3sp, &dma2_device);sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma0_device);sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &iic0_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu0_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu2_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu3_device); +sh7372_add_device_to_domain (&sh7372_a4r, &jpu_device); }void __init sh7372_add_early_devices (void )
Re: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
6b29305a PM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)
Thanks
Guennadi
Quoted 252 lines
The sh7372 A4R hardware power domain contains the SH CPU Core and a set of I/O devices including multimedia accelerators and I2C controllers.
One special case about A4R is the INTCS interrupt controller that needs to be saved and restored to keep working as expected. Also the LCDC hardware blocks are in a different hardware power domain but have their IRQs routed only through INTCS. So as long as LCDCs are active we cannot power down INTCS because that would risk losing interrupts.
Signed-off-by Magnus Damm <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>--- arch/arm/mach-shmobile/board-ap4evb.c | 1 arch/arm/mach-shmobile/board-mackerel.c | 1 arch/arm/mach-shmobile/include/mach/sh7372.h | 7 +++ arch/arm/mach-shmobile/intc-sh7372.c | 52 ++++++++++++++++++++++++++- arch/arm/mach-shmobile/pm-sh7372.c | 29 ++++++++++++++- arch/arm/mach-shmobile/setup-sh7372.c | 8 ++++ 6 files changed, 96 insertions(+), 2 deletions(-)Index:
linux/arch/arm/mach-shmobile/board-ap4evb.c=================================> ---linux.orig/arch/arm/mach-shmobile/board-ap4evb.c+++linux/arch/arm/mach-shmobile/board-ap4evb.carch/arm/mach-shmobile/board-ap4evb.c +1
-0@@ -1412,6 +1412,7 @@ static void __init ap4evb_init(void)sh7372_add_device_to_domain (&sh7372_a3sp, &sh_mmcif_device);sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi0_device);sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &ceu_device);hdmi_init_pm_clock ();fsi_init_pm_clock ();Index:
linux/arch/arm/mach-shmobile/board-mackerel.c=================================> ---linux.orig/arch/arm/mach-shmobile/board-mackerel.c+++linux/arch/arm/mach-shmobile/board-mackerel.carch/arm/mach-shmobile/board-mackerel.c +1
-0@@ -1596,6 +1596,7 @@ static void __init mackerel_init(void)sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi1_device);#endif sh7372_add_device_to_domain (&sh7372_a3sp, &sdhi2_device); +sh7372_add_device_to_domain (&sh7372_a4r, &ceu_device);hdmi_init_pm_clock ();sh7372_pm_init ();Index:
linux/arch/arm/mach-shmobile/include/mach/sh7372.h=================================> ---linux.orig/arch/arm/mach-shmobile/include/mach/sh7372.h+++linux/arch/arm/mach-shmobile/include/mach/sh7372.harch/arm/mach-shmobile/include/mach/sh7372.h +7
-0@@ -480,8 +480,11 @@ struct platform_device;struct sh7372_pm_domain {struct generic_pm_domain genpd;struct dev_power_governor *gov; +void (*suspend)(void ); +void (*resume)(void );unsigned int bit_shift;bool no_debug; +bool stay_on; };static inline struct sh7372_pm_domain *to_sh7372_pd (struct generic_pm_domain *d)@@ -493,6 +496,7 @@ static inline struct sh7372_pm_domain *textern struct sh7372_pm_domain sh7372_a4lc;extern struct sh7372_pm_domain sh7372_a4mp;extern struct sh7372_pm_domain sh7372_d4; +extern struct sh7372_pm_domain sh7372_a4r;extern struct sh7372_pm_domain sh7372_a3rv;extern struct sh7372_pm_domain sh7372_a3ri;extern struct sh7372_pm_domain sh7372_a3sp;@@ -509,4 +513,7 @@ extern void sh7372_pm_add_subdomain(stru#define sh7372_pm_add_subdomain (pd, sd) do { } while(0)#endif /* CONFIG_PM */ +extern void sh7372_intcs_suspend (void ); +extern void sh7372_intcs_resume (void ); +#endif /* __ASM_SH7372_H__ */ Index:
linux/arch/arm/mach-shmobile/intc-sh7372.c=================================> ---linux.orig/arch/arm/mach-shmobile/intc-sh7372.c+++linux/arch/arm/mach-shmobile/intc-sh7372.carch/arm/mach-shmobile/intc-sh7372.c +51
-1@@ -606,9 +606,16 @@ static void intcs_demux(unsigned int irqgeneric_handle_irq (intcs_evt2irq (evtcodeas)); } +static void __iomem *intcs_ffd2; +static void __iomem *intcs_ffd5; +void __init sh7372_init_irq (void ) { -void __iomem *intevtsa =ioremap_nocache (0xffd20100 ,PAGE_SIZE ); +void __iomem *intevtsa; + + intcs_ffd2 =ioremap_nocache (0xffd20000 ,PAGE_SIZE ); + intevtsa = intcs_ffd2 +0x100 ; + intcs_ffd5 =ioremap_nocache (0xffd50000 ,PAGE_SIZE );register_intc_controller (&intca_desc);register_intc_controller (&intcs_desc);@@ -617,3 +624,46 @@ void __init sh7372_init_irq(void)irq_set_handler_data (evt2irq (0xf80 ), (void *)intevtsa);irq_set_chained_handler (evt2irq (0xf80 ), intcs_demux); } + +static unsigned short ffd2[0x200 ]; +static unsigned short ffd5[0x100 ]; + +void sh7372_intcs_suspend (void ) +{ +int k; + +for (k =0x00 ; k <=0x30 ; k +=4 ) + ffd2[k] =__raw_readw (intcs_ffd2 + k); + +for (k =0x80 ; k <=0xb0 ; k +=4 ) + ffd2[k] =__raw_readb (intcs_ffd2 + k); + +for (k =0x180 ; k <=0x188 ; k +=4 ) + ffd2[k] =__raw_readb (intcs_ffd2 + k); + +for (k =0x00 ; k <=0x3c ; k +=4 ) + ffd5[k] =__raw_readw (intcs_ffd5 + k); + +for (k =0x80 ; k <=0x9c ; k +=4 ) + ffd5[k] =__raw_readb (intcs_ffd5 + k); +} + +void sh7372_intcs_resume (void ) +{ +int k; + +for (k =0x00 ; k <=0x30 ; k +=4 ) +__raw_writew (ffd2[k], intcs_ffd2 + k); + +for (k =0x80 ; k <=0xb0 ; k +=4 ) +__raw_writeb (ffd2[k], intcs_ffd2 + k); + +for (k =0x180 ; k <=0x188 ; k +=4 ) +__raw_writeb (ffd2[k], intcs_ffd2 + k); + +for (k =0x00 ; k <=0x3c ; k +=4 ) +__raw_writew (ffd5[k], intcs_ffd5 + k); + +for (k =0x80 ; k <=0x9c ; k +=4 ) +__raw_writeb (ffd5[k], intcs_ffd5 + k); +}Index:
linux/arch/arm/mach-shmobile/pm-sh7372.c=================================> ---linux.orig/arch/arm/mach-shmobile/pm-sh7372.c+++linux/arch/arm/mach-shmobile/pm-sh7372.carch/arm/mach-shmobile/pm-sh7372.c +28
-1@@ -44,6 +44,7 @@#define SPDCR 0xe6180008#define SWUCR 0xe6180014#define SBAR 0xe6180020 +#define WUPRMSK 0xe6180028#define WUPSMSK 0xe618002c#define WUPSMSK2 0xe6180048#define PSTR 0xe6180080@@ -80,6 +81,12 @@ static int pd_power_down(struct generic_struct sh7372_pm_domain *sh7372_pd =to_sh7372_pd (genpd);unsigned int mask =1 << sh7372_pd->bit_shift; +if (sh7372_pd->suspend) + sh7372_pd->suspend (); + +if (sh7372_pd->stay_on) +return 0 ; +if (__raw_readl (PSTR ) & mask) {unsigned int retry_count;@@ -106,6 +113,9 @@ static int pd_power_up(struct generic_pmunsigned int retry_count;int ret =0 ; +if (sh7372_pd->stay_on) + goto out; +if (__raw_readl (PSTR ) & mask) goto out;@@ -122,14 +132,23 @@ static int pd_power_up(struct generic_pmif (__raw_readl (SWUCR ) & mask) ret = -EIO ; - out:if (!sh7372_pd->no_debug)pr_debug ("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n" , mask,__raw_readl (PSTR )); + out: +if (ret =0 && sh7372_pd->resume) + sh7372_pd->resume (); +return ret; } +static void sh7372_a4r_suspend (void ) +{ +sh7372_intcs_suspend (); +__raw_writel (0x300fffff ,WUPRMSK );/* avoid wakeup */ +} +static bool pd_active_wakeup (struct device *dev) {return true;@@ -186,6 +205,14 @@ struct sh7372_pm_domain sh7372_d4 = { .bit_shift = 3, }; +struct sh7372_pm_domain sh7372_a4r = { + .bit_shift =5 , + .gov = &sh7372_always_on_gov, + .suspend = sh7372_a4r_suspend, + .resume = sh7372_intcs_resume, + .stay_on = true, +}; +struct sh7372_pm_domain sh7372_a3rv = { .bit_shift =6 , };Index:
linux/arch/arm/mach-shmobile/setup-sh7372.c=================================> ---linux.orig/arch/arm/mach-shmobile/setup-sh7372.c+++linux/arch/arm/mach-shmobile/setup-sh7372.carch/arm/mach-shmobile/setup-sh7372.c +8
-1@@ -991,12 +991,14 @@ void __init sh7372_add_standard_devices(sh7372_init_pm_domain (&sh7372_a4lc);sh7372_init_pm_domain (&sh7372_a4mp);sh7372_init_pm_domain (&sh7372_d4); +sh7372_init_pm_domain (&sh7372_a4r);sh7372_init_pm_domain (&sh7372_a3rv);sh7372_init_pm_domain (&sh7372_a3ri);sh7372_init_pm_domain (&sh7372_a3sg);sh7372_init_pm_domain (&sh7372_a3sp);sh7372_pm_add_subdomain (&sh7372_a4lc, &sh7372_a3rv); +sh7372_pm_add_subdomain (&sh7372_a4r, &sh7372_a4lc);platform_add_devices (sh7372_early_devices,ARRAY_SIZE (sh7372_early_devices));@@ -1020,6 +1022,12 @@ void __init sh7372_add_standard_devices(sh7372_add_device_to_domain (&sh7372_a3sp, &dma2_device);sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma0_device);sh7372_add_device_to_domain (&sh7372_a3sp, &usb_dma1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &iic0_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu0_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu1_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu2_device); +sh7372_add_device_to_domain (&sh7372_a4r, &veu3_device); +sh7372_add_device_to_domain (&sh7372_a4r, &jpu_device); }void __init sh7372_add_early_devices (void ) --
Quoted 4 lines
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Magnus Damm
maintainerRe: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
Quoted 6 lines · Guennadi Liakhovetski
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
Quoted 7 lines
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
6b29305aPM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)
Exactly how does it break IIC0?
Does the same happen with the code base for upcoming 3.2-rc1 from latest linux git?
Thanks,
/ magnus
Re: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
Hi Magnus
Quoted 11 lines · Magnus Damm
Quoted 9 lines · Guennadi Liakhovetski
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
Quoted 6 lines
Quoted 4 lines
6b29305aPM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)Exactly how does it break IIC0?
We discussed it a couple of weeks ago, remember? Here's a quote:
Quoted 13 lines
Quoted 6 lines
Quoted 3 lines
3. I2C #0 doesn't work (last worked with some 3.1-rc7 based kernel). It is needed for the keypad, without which I don't know how the board can be woken up
That's odd. It worked fine when I tested with Morimoto-san earlier today. Are we using the same code?
I hope so. I'm using what Rafael suggested in his mail:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.gitsh7372-testHEAD currently at commit
Quoted 7 lines
commit
2b7a2158042fbed2dc0c677d24efc2d3c8680186Author: Magnus Damm <[email protected]> Date: Sun Oct 16 23:35:59 2011 +0200ARM: mach-shmobile: sh7372 A4R support (v3)I2C works with HEAD^
Of course, now testing with v4 of A3SP and A4R patches. As for "exactly how":
i2c-sh_mobile i2c-sh_mobile.0: I2C adapter 0 with bus speed 100000 Hz i2c-sh_mobile i2c-sh_mobile.1: I2C adapter 1 with bus speed 100000 Hz Linux video capture interface: v2.00
soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0 sh_mobile_ceu sh_mobile_ceu.0: SuperH Mobile CEU driver attached to camera 0 sh_mobile_ceu sh_mobile_ceu.0: SuperH Mobile CEU driver detached from camera 0 sh_mobile_ceu sh_mobile_ceu.0: SuperH Mobile CEU driver attached to camera 0 sh_mobile_ceu sh_mobile_ceu.0: SuperH Mobile CEU driver detached from camera 0 i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out i2c-sh_mobile i2c-sh_mobile.0: Polling timed out
tca6416-keypad 0-0020: tca6416_read_reg failed, reg: 1, error: -5
tca6416-keypad: probe of 0-0020 failed with error -5
So, seems just not to be enabled.
Quoted 2 lines
Does the same happen with the code base for upcoming 3.2-rc1 from latest linux git?
Good question:
linux-2.6/arch/arm/kernel/entry-armv.S: Assembler messages:linux-2.6/arch/arm/kernel/entry-armv.S:501: Error: backward ref to unknown label "2:" linux-2.6/arch/arm/kernel/entry-armv.S:502: Error: backward ref to unknown label "3:" make[2]: *** [arch/arm/kernel/entry-armv.o] Error 1
So, no, it doesn't;-)
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Re: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
Quoted 66 lines · Guennadi Liakhovetski
Hi Magnus
Quoted 11 lines · Magnus Damm
Quoted 9 lines · Guennadi Liakhovetski
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
Quoted 6 lines
Quoted 4 lines
6b29305aPM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)Exactly how does it break IIC0?
We discussed it a couple of weeks ago, remember? Here's a quote:
Quoted 13 lines
Quoted 6 lines
Quoted 3 lines
3. I2C #0 doesn't work (last worked with some 3.1-rc7 based kernel). It is needed for the keypad, without which I don't know how the board can be woken up
That's odd. It worked fine when I tested with Morimoto-san earlier today. Are we using the same code?
I hope so. I'm using what Rafael suggested in his mail:
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.gitsh7372-testHEAD currently at commit
Quoted 7 lines
commit
2b7a2158042fbed2dc0c677d24efc2d3c8680186Author: Magnus Damm <[email protected]> Date: Sun Oct 16 23:35:59 2011 +0200ARM: mach-shmobile: sh7372 A4R support (v3)I2C works with HEAD^
Of course, now testing with v4 of A3SP and A4R patches. As for "exactly how":
i2c-sh_mobile i2c-sh_mobile.0: I2C adapter 0 with bus speed 100000 Hz i2c-sh_mobile i2c-sh_mobile.1: I2C adapter 1 with bus speed 100000 Hz Linux video capture interface: v2.00
soc-camera-pdrv soc-camera-pdrv.0: Probing soc-camera-pdrv.0sh_mobile_ceush_mobile_ceu.0: SuperH Mobile CEU driver attached to camera 0sh_mobile_ceush_mobile_ceu.0: SuperH Mobile CEU driver detached from camera 0sh_mobile_ceush_mobile_ceu.0: SuperH Mobile CEU driver attached to camera 0sh_mobile_ceush_mobile_ceu.0: SuperH Mobile CEU driver detached from camera 0 i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out i2c-sh_mobile i2c-sh_mobile.0: Polling timed out
tca6416-keypad 0-0020:tca6416_read_regfailed, reg: 1, error: -5
tca6416-keypad: probe of 0-0020 failed with error -5So, seems just not to be enabled.
Quoted 2 lines
Does the same happen with the code base for upcoming 3.2-rc1 from latest linux git?
Quoted 6 lines
Good question:
linux-2.6/arch/arm/kernel/entry-armv.S: Assembler messages:linux-2.6/arch/arm/kernel/entry-armv.S:501: Error: backward ref to unknown label "2:"linux-2.6/arch/arm/kernel/entry-armv.S:502: Error: backward ref to unknown label "3:" make[2]: *** [arch/arm/kernel/entry-armv.o] Error 1
After an "obvious" fix:
arch/arm/kernel/entry-armv.S +1 -1
@@ -497,7 +497,7 @@ ENDPROC(__und_usr) .popsection .pushsection __ex_table,"a" .long 1b, 4b -#if __LINUX_ARM_ARCH__ >= 7 +#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 7 .long 2b, 4b .long 3b, 4b #endif
(not sure, whether " && CONFIG_CPU_V7" is also needed), and a manual fix for ASoC / I2C Kconfig failure, the kernel builds and boots, but I2C fails in the same way. I.e., PM patches up to A3SP fix that problem, and A4R brings it back.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
Re: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
In reply to Magnus DammQuoted 11 lines · Magnus Damm
Quoted 9 lines · Guennadi Liakhovetski
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
Quoted 6 lines
Quoted 4 lines
6b29305aPM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)Exactly how does it break IIC0?
It causes some initialization issues to happen. I get the following messages on every boot:
i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out i2c-sh_mobile i2c-sh_mobile.0: Polling timed out
three times in a row (there's a delay too).
The A4R patch is the source of that.
Quoted 2 lines
Does the same happen with the code base for upcoming 3.2-rc1 from latest linux git?
Yes, it does, AFAICT.
Thanks,
Rafael
Re: [PATCH 3/3] ARM: mach-shmobile: sh7372 A4R support (v4)
Hi all
3.2-rc2 halts on ap4evb after
[ 0.085937] NetWinder Floating Point Emulator V0.97 (double precision) [ 0.085937] msgmni has been set to 246 [ 0.085937] io scheduler noop registered (default)
(normally the following would be printed out afterwards:
[ 0.398437] sh-mobile-hdmi sh-mobile-hdmi: Detected HDMI controller 0x0:0x0 [ 0.406250] sh_mobile_meram sh_mobile_meram.0: sh_mobile_meram initialized. [ 0.421875] Console: switching to colour frame buffer device 160x45 [ 0.429687] graphics fb0: registered sh_mobile_lcdc_fb/mainlcd as 1280x720 16bpp. [ 0.437500] graphics fb1: registered sh_mobile_lcdc_fb/mainlcd as 544x961 16bpp.
) and git bisect pointed out at this commit as a culprit. Indeed, reverting it fixes the hanger. I'll send my .config off-list.
Thanks
Guennadi
Quoted 32 lines · Rafael J. Wysocki
Quoted 11 lines · Magnus Damm
Quoted 9 lines · Guennadi Liakhovetski
Quoted 3 lines · Rafael J. Wysocki
From: Magnus Damm <[email protected]>
This change adds support for the sh7372 A4R power domain.
This version still breaks I2C (#0) on mackerel. Tested with your sh7372-test branch of Oct 18th plus these four patches:
Quoted 6 lines
Quoted 4 lines
6b29305aPM / Domains: Add default power off governor function (v2) 3d578ae PM / Domains: Add device stop governor function (v2) 6c2cd02 ARM: mach-shmobile: sh7372 A4R support (v4) 9da11f4 ARM: mach-shmobile: sh7372 A3SP support (v4)Exactly how does it break IIC0?
It causes some initialization issues to happen. I get the following messages on every boot:
i2c-sh_mobile i2c-sh_mobile.0: Transfer request timed out i2c-sh_mobile i2c-sh_mobile.0: Polling timed out
three times in a row (there's a delay too).
The A4R patch is the source of that.
Quoted 2 lines
Does the same happen with the code base for upcoming 3.2-rc1 from latest linux git?
Quoted 9 lines
Yes, it does, AFAICT.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/