This makes it possible to remove the raw write to the PWRCFG-register
from the s3c-hsudc driver.
The phy-power-handling is common to S3C2443/2416/2450, so introduce a
s3c2443-pm-common.c to handle this for all of them.
Signed-off-by: Heiko Stuebner <heiko@...>
arch/arm/mach-s3c2416/Kconfig | 1 +
arch/arm/mach-s3c2443/Kconfig | 1 +
arch/arm/plat-s3c24xx/Kconfig | 7 ++++
arch/arm/plat-s3c24xx/Makefile | 1 +
arch/arm/plat-s3c24xx/s3c2443-pm-common.c | 49 +++++++++++++++++++++++++++++
5 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/plat-s3c24xx/s3c2443-pm-common.c
@@ -15,6 +15,7 @@ config CPU_S3C2416
select CPU_LLSERIAL_S3C2440
select SAMSUNG_CLKSRC
select S3C2443_CLOCK
+ select S3C2443_PM_COMMON
help
Support for the S3C2416 SoC from the S3C24XX line
@@ -10,6 +10,7 @@ config CPU_S3C2443
select CPU_LLSERIAL_S3C2440
select SAMSUNG_CLKSRC
select S3C2443_CLOCK
+ select S3C2443_PM_COMMON
help
Support for the S3C2443 SoC from the S3C24XX line
@@ -50,6 +50,13 @@ config S3C2443_CLOCK
Clock code for the S3C2443 and similar processors, which includes
the S3C2416 and S3C2450.
+config S3C2443_PM_COMMON
+ bool
+ select PM_GENERIC_DOMAINS
+ help
+ Common power management code for the S3C2443 and similar processors,
+ which include the S3C2416 and S3C2450.
+
config S3C24XX_DCLK
bool
help
@@ -29,6 +29,7 @@ obj-$(CONFIG_PM) += irq-pm.o
obj-$(CONFIG_PM) += sleep.o
obj-$(CONFIG_S3C2410_CLOCK) += s3c2410-clock.o
obj-$(CONFIG_S3C2443_CLOCK) += s3c2443-clock.o
+obj-$(CONFIG_S3C2443_PM_COMMON) += s3c2443-pm-common.o
obj-$(CONFIG_S3C2410_DMA) += dma.o
obj-$(CONFIG_S3C2410_IOTIMING) += s3c2410-iotiming.o
obj-$(CONFIG_S3C2412_IOTIMING) += s3c2412-iotiming.o
@@ -0,0 +1,49 @@
+#include <linux/io.h>
+#include <linux/pm_domain.h>
+
+#include <mach/regs-s3c2443-clock.h>
+#include <plat/devs.h>
+
+
+static int s3c2443_usbphy_off(struct generic_pm_domain *domain)
+{
+ u32 val;
+
+ val = __raw_readl(S3C2443_PWRCFG);
+ val &= ~(S3C2443_PWRCFG_USBPHY);
+ __raw_writel(val, S3C2443_PWRCFG);
+
+ return 0;
+}
+
+static int s3c2443_usbphy_on(struct generic_pm_domain *domain)
+{
+ u32 val;
+
+ val = __raw_readl(S3C2443_PWRCFG);
+ val |= S3C2443_PWRCFG_USBPHY;
+ __raw_writel(val, S3C2443_PWRCFG);
+
+ return 0;
+}
+
+static struct generic_pm_domain s3c2443_usbphy_pd = {
+ .power_off = s3c2443_usbphy_off,
+ .power_on = s3c2443_usbphy_on,
+};
+
+static int __init s3c2443_pm_common_init(void)
+{
+ pm_genpd_init(&s3c2443_usbphy_pd, NULL, false);
+ pm_genpd_add_device(&s3c2443_usbphy_pd, &s3c_device_usb_hsudc.dev);
+
+ return 0;
+}
+arch_initcall(s3c2443_pm_common_init);
+
+static __init int s3c2443_pm_common_late_initcall(void)
+{
+ pm_genpd_poweroff_unused();
+ return 0;
+}
+late_initcall(s3c2443_pm_common_late_initcall);