Commit cf899680 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-shmobile'

* pm-shmobile:
  ARM: shmobile: Add A4S cpuidle state on sh7372
  ARM: shmobile: Make sh7372 cpuidle handling more straightforward
  ARM: shmobile: Move definition of shmobile_init_late() to header
  ARM: shmobile: Remove the console check from sh7372_enter_suspend()
  ARM: shmobile: Rework adding devices to PM domains on AP4EVB
  ARM: shmobile: Rework adding devices to PM domains on Mackerel
  ARM: shmobile: Specify device latencies for Mackerel devices directly
  ARM: shmobile: Specify device latencies for SH7372 devices directly
  ARM: shmobile: Allow device latencies to be specified directly
  ARM: shmobile: Set PM domain on/off latencies directly
  ARM: shmobile: Make rmobile_init_pm_domain() static
  ARM: shmobile: Move r8a7779's PM domain objects to a table
  ARM: shmobile: Move r8a7740's PM domain objects to a table
  ARM: shmobile: Move sh7372's PM domain objects to a table
  ARM: shmobile: Do not access sh7372 A4S domain internals directly
  ARM: shmobile: Add routine for automatic PM domains initialization
  ARM: shmobile: Use domain names when adding subdomains to power domains
  ARM: shmobile: Drop r8a7779_add_device_to_domain()
  ARM: shmobile: Use names of power domains for adding devices to them
parents d6a56ae7 caaca999
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
# Common objects # Common objects
obj-y := timer.o console.o clock.o common.o obj-y := timer.o console.o clock.o
# CPU objects # CPU objects
obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
......
...@@ -1229,6 +1229,15 @@ static struct i2c_board_info i2c1_devices[] = { ...@@ -1229,6 +1229,15 @@ static struct i2c_board_info i2c1_devices[] = {
#define USCCR1 0xE6058144 #define USCCR1 0xE6058144
static void __init ap4evb_init(void) static void __init ap4evb_init(void)
{ {
struct pm_domain_device domain_devices[] = {
{ "A4LC", &lcdc1_device, },
{ "A4LC", &lcdc_device, },
{ "A4MP", &fsi_device, },
{ "A3SP", &sh_mmcif_device, },
{ "A3SP", &sdhi0_device, },
{ "A3SP", &sdhi1_device, },
{ "A4R", &ceu_device, },
};
u32 srcr4; u32 srcr4;
struct clk *clk; struct clk *clk;
...@@ -1461,14 +1470,8 @@ static void __init ap4evb_init(void) ...@@ -1461,14 +1470,8 @@ static void __init ap4evb_init(void)
platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices)); platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device); rmobile_add_devices_to_domains(domain_devices,
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); ARRAY_SIZE(domain_devices));
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
hdmi_init_pm_clock(); hdmi_init_pm_clock();
fsi_init_pm_clock(); fsi_init_pm_clock();
...@@ -1483,6 +1486,6 @@ MACHINE_START(AP4EVB, "ap4evb") ...@@ -1483,6 +1486,6 @@ MACHINE_START(AP4EVB, "ap4evb")
.init_irq = sh7372_init_irq, .init_irq = sh7372_init_irq,
.handle_irq = shmobile_handle_irq_intc, .handle_irq = shmobile_handle_irq_intc,
.init_machine = ap4evb_init, .init_machine = ap4evb_init,
.init_late = shmobile_init_late, .init_late = sh7372_pm_init_late,
.timer = &shmobile_timer, .timer = &shmobile_timer,
MACHINE_END MACHINE_END
...@@ -1182,10 +1182,10 @@ static void __init eva_init(void) ...@@ -1182,10 +1182,10 @@ static void __init eva_init(void)
eva_clock_init(); eva_clock_init();
rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device); rmobile_add_device_to_domain("A4LC", &lcdc0_device);
rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device); rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
if (usb) if (usb)
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, usb); rmobile_add_device_to_domain("A3SP", usb);
} }
static void __init eva_earlytimer_init(void) static void __init eva_earlytimer_init(void)
......
...@@ -1410,6 +1410,22 @@ static struct i2c_board_info i2c1_devices[] = { ...@@ -1410,6 +1410,22 @@ static struct i2c_board_info i2c1_devices[] = {
#define USCCR1 0xE6058144 #define USCCR1 0xE6058144
static void __init mackerel_init(void) static void __init mackerel_init(void)
{ {
struct pm_domain_device domain_devices[] = {
{ "A4LC", &lcdc_device, },
{ "A4LC", &hdmi_lcdc_device, },
{ "A4LC", &meram_device, },
{ "A4MP", &fsi_device, },
{ "A3SP", &usbhs0_device, },
{ "A3SP", &usbhs1_device, },
{ "A3SP", &nand_flash_device, },
{ "A3SP", &sh_mmcif_device, },
{ "A3SP", &sdhi0_device, },
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
{ "A3SP", &sdhi1_device, },
#endif
{ "A3SP", &sdhi2_device, },
{ "A4R", &ceu_device, },
};
u32 srcr4; u32 srcr4;
struct clk *clk; struct clk *clk;
...@@ -1624,20 +1640,8 @@ static void __init mackerel_init(void) ...@@ -1624,20 +1640,8 @@ static void __init mackerel_init(void)
platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices)); platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device); rmobile_add_devices_to_domains(domain_devices,
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device); ARRAY_SIZE(domain_devices));
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &meram_device);
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &fsi_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs0_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usbhs1_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &nand_flash_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sh_mmcif_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi0_device);
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi1_device);
#endif
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &sdhi2_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &ceu_device);
hdmi_init_pm_clock(); hdmi_init_pm_clock();
sh7372_pm_init(); sh7372_pm_init();
...@@ -1651,6 +1655,6 @@ MACHINE_START(MACKEREL, "mackerel") ...@@ -1651,6 +1655,6 @@ MACHINE_START(MACKEREL, "mackerel")
.init_irq = sh7372_init_irq, .init_irq = sh7372_init_irq,
.handle_irq = shmobile_handle_irq_intc, .handle_irq = shmobile_handle_irq_intc,
.init_machine = mackerel_init, .init_machine = mackerel_init,
.init_late = shmobile_init_late, .init_late = sh7372_pm_init_late,
.timer = &shmobile_timer, .timer = &shmobile_timer,
MACHINE_END MACHINE_END
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <mach/common.h>
void __init shmobile_init_late(void)
{
shmobile_suspend_init();
shmobile_cpuidle_init();
}
...@@ -16,51 +16,38 @@ ...@@ -16,51 +16,38 @@
#include <asm/cpuidle.h> #include <asm/cpuidle.h>
#include <asm/io.h> #include <asm/io.h>
static void shmobile_enter_wfi(void) int shmobile_enter_wfi(struct cpuidle_device *dev, struct cpuidle_driver *drv,
int index)
{ {
cpu_do_idle(); cpu_do_idle();
} return 0;
void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = {
shmobile_enter_wfi, /* regular sleep mode */
};
static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
struct cpuidle_driver *drv,
int index)
{
shmobile_cpuidle_modes[index]();
return index;
} }
static struct cpuidle_device shmobile_cpuidle_dev; static struct cpuidle_device shmobile_cpuidle_dev;
static struct cpuidle_driver shmobile_cpuidle_driver = { static struct cpuidle_driver shmobile_cpuidle_default_driver = {
.name = "shmobile_cpuidle", .name = "shmobile_cpuidle",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.en_core_tk_irqen = 1, .en_core_tk_irqen = 1,
.states[0] = ARM_CPUIDLE_WFI_STATE, .states[0] = ARM_CPUIDLE_WFI_STATE,
.states[0].enter = shmobile_enter_wfi,
.safe_state_index = 0, /* C1 */ .safe_state_index = 0, /* C1 */
.state_count = 1, .state_count = 1,
}; };
void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
{
cpuidle_drv = drv;
}
int shmobile_cpuidle_init(void) int shmobile_cpuidle_init(void)
{ {
struct cpuidle_device *dev = &shmobile_cpuidle_dev; struct cpuidle_device *dev = &shmobile_cpuidle_dev;
struct cpuidle_driver *drv = &shmobile_cpuidle_driver;
int i;
for (i = 0; i < CPUIDLE_STATE_MAX; i++)
drv->states[i].enter = shmobile_cpuidle_enter;
if (shmobile_cpuidle_setup)
shmobile_cpuidle_setup(drv);
cpuidle_register_driver(drv); cpuidle_register_driver(cpuidle_drv);
dev->state_count = drv->state_count; dev->state_count = cpuidle_drv->state_count;
cpuidle_register_device(dev); cpuidle_register_device(dev);
return 0; return 0;
......
...@@ -14,8 +14,10 @@ extern int shmobile_clk_init(void); ...@@ -14,8 +14,10 @@ extern int shmobile_clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *); extern void shmobile_handle_irq_intc(struct pt_regs *);
extern struct platform_suspend_ops shmobile_suspend_ops; extern struct platform_suspend_ops shmobile_suspend_ops;
struct cpuidle_driver; struct cpuidle_driver;
extern void (*shmobile_cpuidle_modes[])(void); struct cpuidle_device;
extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); extern int shmobile_enter_wfi(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index);
extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv);
extern void sh7367_init_irq(void); extern void sh7367_init_irq(void);
extern void sh7367_map_io(void); extern void sh7367_map_io(void);
...@@ -86,8 +88,6 @@ extern int r8a7779_boot_secondary(unsigned int cpu); ...@@ -86,8 +88,6 @@ extern int r8a7779_boot_secondary(unsigned int cpu);
extern void r8a7779_smp_prepare_cpus(void); extern void r8a7779_smp_prepare_cpus(void);
extern void r8a7779_register_twd(void); extern void r8a7779_register_twd(void);
extern void shmobile_init_late(void);
#ifdef CONFIG_SUSPEND #ifdef CONFIG_SUSPEND
int shmobile_suspend_init(void); int shmobile_suspend_init(void);
#else #else
...@@ -100,4 +100,10 @@ int shmobile_cpuidle_init(void); ...@@ -100,4 +100,10 @@ int shmobile_cpuidle_init(void);
static inline int shmobile_cpuidle_init(void) { return 0; } static inline int shmobile_cpuidle_init(void) { return 0; }
#endif #endif
static inline void shmobile_init_late(void)
{
shmobile_suspend_init();
shmobile_cpuidle_init();
}
#endif /* __ARCH_MACH_COMMON_H */ #endif /* __ARCH_MACH_COMMON_H */
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <linux/pm_domain.h> #include <linux/pm_domain.h>
#define DEFAULT_DEV_LATENCY_NS 250000
struct platform_device; struct platform_device;
struct rmobile_pm_domain { struct rmobile_pm_domain {
...@@ -29,16 +31,33 @@ struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d) ...@@ -29,16 +31,33 @@ struct rmobile_pm_domain *to_rmobile_pd(struct generic_pm_domain *d)
return container_of(d, struct rmobile_pm_domain, genpd); return container_of(d, struct rmobile_pm_domain, genpd);
} }
struct pm_domain_device {
const char *domain_name;
struct platform_device *pdev;
};
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd); extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, extern void rmobile_add_device_to_domain_td(const char *domain_name,
struct platform_device *pdev); struct platform_device *pdev,
extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, struct gpd_timing_data *td);
struct rmobile_pm_domain *rmobile_sd);
static inline void rmobile_add_device_to_domain(const char *domain_name,
struct platform_device *pdev)
{
rmobile_add_device_to_domain_td(domain_name, pdev, NULL);
}
extern void rmobile_add_devices_to_domains(struct pm_domain_device data[],
int size);
#else #else
#define rmobile_init_pm_domain(pd) do { } while (0)
#define rmobile_add_device_to_domain(pd, pdev) do { } while (0) #define rmobile_init_domains(domains, num) do { } while (0)
#define rmobile_pm_add_subdomain(pd, sd) do { } while (0) #define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0)
#define rmobile_add_device_to_domain(name, pdev) do { } while (0)
static inline void rmobile_add_devices_to_domains(struct pm_domain_device d[],
int size) {}
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* PM_RMOBILE_H */ #endif /* PM_RMOBILE_H */
...@@ -607,9 +607,9 @@ enum { ...@@ -607,9 +607,9 @@ enum {
}; };
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern struct rmobile_pm_domain r8a7740_pd_a4s; extern void __init r8a7740_init_pm_domains(void);
extern struct rmobile_pm_domain r8a7740_pd_a3sp; #else
extern struct rmobile_pm_domain r8a7740_pd_a4lc; static inline void r8a7740_init_pm_domains(void) {}
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* __ASM_R8A7740_H__ */ #endif /* __ASM_R8A7740_H__ */
...@@ -347,17 +347,9 @@ extern int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch); ...@@ -347,17 +347,9 @@ extern int r8a7779_sysc_power_down(struct r8a7779_pm_ch *r8a7779_ch);
extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch); extern int r8a7779_sysc_power_up(struct r8a7779_pm_ch *r8a7779_ch);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern struct r8a7779_pm_domain r8a7779_sh4a; extern void __init r8a7779_init_pm_domains(void);
extern struct r8a7779_pm_domain r8a7779_sgx;
extern struct r8a7779_pm_domain r8a7779_vdp1;
extern struct r8a7779_pm_domain r8a7779_impx3;
extern void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd);
extern void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd,
struct platform_device *pdev);
#else #else
#define r8a7779_init_pm_domain(pd) do { } while (0) static inline void r8a7779_init_pm_domains(void) {}
#define r8a7779_add_device_to_domain(pd, pdev) do { } while (0)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
#endif /* __ASM_R8A7779_H__ */ #endif /* __ASM_R8A7779_H__ */
...@@ -478,21 +478,17 @@ extern struct clk sh7372_fsibck_clk; ...@@ -478,21 +478,17 @@ extern struct clk sh7372_fsibck_clk;
extern struct clk sh7372_fsidiva_clk; extern struct clk sh7372_fsidiva_clk;
extern struct clk sh7372_fsidivb_clk; extern struct clk sh7372_fsidivb_clk;
#ifdef CONFIG_PM
extern struct rmobile_pm_domain sh7372_pd_a4lc;
extern struct rmobile_pm_domain sh7372_pd_a4mp;
extern struct rmobile_pm_domain sh7372_pd_d4;
extern struct rmobile_pm_domain sh7372_pd_a4r;
extern struct rmobile_pm_domain sh7372_pd_a3rv;
extern struct rmobile_pm_domain sh7372_pd_a3ri;
extern struct rmobile_pm_domain sh7372_pd_a4s;
extern struct rmobile_pm_domain sh7372_pd_a3sp;
extern struct rmobile_pm_domain sh7372_pd_a3sg;
#endif /* CONFIG_PM */
extern void sh7372_intcs_suspend(void); extern void sh7372_intcs_suspend(void);
extern void sh7372_intcs_resume(void); extern void sh7372_intcs_resume(void);
extern void sh7372_intca_suspend(void); extern void sh7372_intca_suspend(void);
extern void sh7372_intca_resume(void); extern void sh7372_intca_resume(void);
#ifdef CONFIG_PM
extern void __init sh7372_init_pm_domains(void);
#else
static inline void sh7372_init_pm_domains(void) {}
#endif
extern void __init sh7372_pm_init_late(void);
#endif /* __ASM_SH7372_H__ */ #endif /* __ASM_SH7372_H__ */
...@@ -21,14 +21,6 @@ static int r8a7740_pd_a4s_suspend(void) ...@@ -21,14 +21,6 @@ static int r8a7740_pd_a4s_suspend(void)
return -EBUSY; return -EBUSY;
} }
struct rmobile_pm_domain r8a7740_pd_a4s = {
.genpd.name = "A4S",
.bit_shift = 10,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
.suspend = r8a7740_pd_a4s_suspend,
};
static int r8a7740_pd_a3sp_suspend(void) static int r8a7740_pd_a3sp_suspend(void)
{ {
/* /*
...@@ -38,17 +30,31 @@ static int r8a7740_pd_a3sp_suspend(void) ...@@ -38,17 +30,31 @@ static int r8a7740_pd_a3sp_suspend(void)
return console_suspend_enabled ? 0 : -EBUSY; return console_suspend_enabled ? 0 : -EBUSY;
} }
struct rmobile_pm_domain r8a7740_pd_a3sp = { static struct rmobile_pm_domain r8a7740_pm_domains[] = {
.genpd.name = "A3SP", {
.bit_shift = 11, .genpd.name = "A4S",
.gov = &pm_domain_always_on_gov, .bit_shift = 10,
.no_debug = true, .gov = &pm_domain_always_on_gov,
.suspend = r8a7740_pd_a3sp_suspend, .no_debug = true,
.suspend = r8a7740_pd_a4s_suspend,
},
{
.genpd.name = "A3SP",
.bit_shift = 11,
.gov = &pm_domain_always_on_gov,
.no_debug = true,
.suspend = r8a7740_pd_a3sp_suspend,
},
{
.genpd.name = "A4LC",
.bit_shift = 1,
},
}; };
struct rmobile_pm_domain r8a7740_pd_a4lc = { void __init r8a7740_init_pm_domains(void)
.genpd.name = "A4LC", {
.bit_shift = 1, rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains));
}; pm_genpd_add_subdomain_names("A4S", "A3SP");
}
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
...@@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct device *dev) ...@@ -183,7 +183,7 @@ static bool pd_active_wakeup(struct device *dev)
return true; return true;
} }
void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) static void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
{ {
struct generic_pm_domain *genpd = &r8a7779_pd->genpd; struct generic_pm_domain *genpd = &r8a7779_pd->genpd;
...@@ -199,43 +199,44 @@ void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd) ...@@ -199,43 +199,44 @@ void r8a7779_init_pm_domain(struct r8a7779_pm_domain *r8a7779_pd)
pd_power_up(&r8a7779_pd->genpd); pd_power_up(&r8a7779_pd->genpd);
} }
void r8a7779_add_device_to_domain(struct r8a7779_pm_domain *r8a7779_pd, static struct r8a7779_pm_domain r8a7779_pm_domains[] = {
struct platform_device *pdev) {
{ .genpd.name = "SH4A",
struct device *dev = &pdev->dev; .ch = {
.chan_offs = 0x80, /* PWRSR1 .. PWRER1 */
pm_genpd_add_device(&r8a7779_pd->genpd, dev); .isr_bit = 16, /* SH4A */
if (pm_clk_no_clocks(dev)) },
pm_clk_add(dev, NULL); },
} {
.genpd.name = "SGX",
struct r8a7779_pm_domain r8a7779_sh4a = { .ch = {
.ch = { .chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */
.chan_offs = 0x80, /* PWRSR1 .. PWRER1 */ .isr_bit = 20, /* SGX */
.isr_bit = 16, /* SH4A */ },
} },
}; {
.genpd.name = "VDP1",
struct r8a7779_pm_domain r8a7779_sgx = { .ch = {
.ch = { .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */
.chan_offs = 0xc0, /* PWRSR2 .. PWRER2 */ .isr_bit = 21, /* VDP */
.isr_bit = 20, /* SGX */ },
} },
{
.genpd.name = "IMPX3",
.ch = {
.chan_offs = 0x140, /* PWRSR4 .. PWRER4 */
.isr_bit = 24, /* IMP */
},
},
}; };
struct r8a7779_pm_domain r8a7779_vdp1 = { void __init r8a7779_init_pm_domains(void)
.ch = { {
.chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ int j;
.isr_bit = 21, /* VDP */
}
};
struct r8a7779_pm_domain r8a7779_impx3 = { for (j = 0; j < ARRAY_SIZE(r8a7779_pm_domains); j++)
.ch = { r8a7779_init_pm_domain(&r8a7779_pm_domains[j]);
.chan_offs = 0x140, /* PWRSR4 .. PWRER4 */ }
.isr_bit = 24, /* IMP */
}
};
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
......
...@@ -134,7 +134,7 @@ static int rmobile_pd_start_dev(struct device *dev) ...@@ -134,7 +134,7 @@ static int rmobile_pd_start_dev(struct device *dev)
return ret; return ret;
} }
void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) static void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
{ {
struct generic_pm_domain *genpd = &rmobile_pd->genpd; struct generic_pm_domain *genpd = &rmobile_pd->genpd;
struct dev_power_governor *gov = rmobile_pd->gov; struct dev_power_governor *gov = rmobile_pd->gov;
...@@ -149,19 +149,38 @@ void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd) ...@@ -149,19 +149,38 @@ void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd)
__rmobile_pd_power_up(rmobile_pd, false); __rmobile_pd_power_up(rmobile_pd, false);
} }
void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd, void rmobile_init_domains(struct rmobile_pm_domain domains[], int num)
struct platform_device *pdev) {
int j;
for (j = 0; j < num; j++)
rmobile_init_pm_domain(&domains[j]);
}
void rmobile_add_device_to_domain_td(const char *domain_name,
struct platform_device *pdev,
struct gpd_timing_data *td)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
pm_genpd_add_device(&rmobile_pd->genpd, dev); __pm_genpd_name_add_device(domain_name, dev, td);
if (pm_clk_no_clocks(dev)) if (pm_clk_no_clocks(dev))
pm_clk_add(dev, NULL); pm_clk_add(dev, NULL);
} }
void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd, void rmobile_add_devices_to_domains(struct pm_domain_device data[],
struct rmobile_pm_domain *rmobile_sd) int size)
{ {
pm_genpd_add_subdomain(&rmobile_pd->genpd, &rmobile_sd->genpd); struct gpd_timing_data latencies = {
.stop_latency_ns = DEFAULT_DEV_LATENCY_NS,
.start_latency_ns = DEFAULT_DEV_LATENCY_NS,
.save_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
.restore_state_latency_ns = DEFAULT_DEV_LATENCY_NS,
};
int j;
for (j = 0; j < size; j++)
rmobile_add_device_to_domain_td(data[j].domain_name,
data[j].pdev, &latencies);
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
This diff is collapsed.
...@@ -673,12 +673,7 @@ void __init r8a7740_add_standard_devices(void) ...@@ -673,12 +673,7 @@ void __init r8a7740_add_standard_devices(void)
r8a7740_i2c_workaround(&i2c0_device); r8a7740_i2c_workaround(&i2c0_device);
r8a7740_i2c_workaround(&i2c1_device); r8a7740_i2c_workaround(&i2c1_device);
/* PM domain */ r8a7740_init_pm_domains();
rmobile_init_pm_domain(&r8a7740_pd_a4s);
rmobile_init_pm_domain(&r8a7740_pd_a3sp);
rmobile_init_pm_domain(&r8a7740_pd_a4lc);
rmobile_pm_add_subdomain(&r8a7740_pd_a4s, &r8a7740_pd_a3sp);
/* add devices */ /* add devices */
platform_add_devices(r8a7740_early_devices, platform_add_devices(r8a7740_early_devices,
...@@ -688,16 +683,16 @@ void __init r8a7740_add_standard_devices(void) ...@@ -688,16 +683,16 @@ void __init r8a7740_add_standard_devices(void)
/* add devices to PM domain */ /* add devices to PM domain */
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif0_device); rmobile_add_device_to_domain("A3SP", &scif0_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif1_device); rmobile_add_device_to_domain("A3SP", &scif1_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif2_device); rmobile_add_device_to_domain("A3SP", &scif2_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif3_device); rmobile_add_device_to_domain("A3SP", &scif3_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif4_device); rmobile_add_device_to_domain("A3SP", &scif4_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif5_device); rmobile_add_device_to_domain("A3SP", &scif5_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif6_device); rmobile_add_device_to_domain("A3SP", &scif6_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scif7_device); rmobile_add_device_to_domain("A3SP", &scif7_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &scifb_device); rmobile_add_device_to_domain("A3SP", &scifb_device);
rmobile_add_device_to_domain(&r8a7740_pd_a3sp, &i2c1_device); rmobile_add_device_to_domain("A3SP", &i2c1_device);
} }
static void __init r8a7740_earlytimer_init(void) static void __init r8a7740_earlytimer_init(void)
......
...@@ -251,10 +251,7 @@ void __init r8a7779_add_standard_devices(void) ...@@ -251,10 +251,7 @@ void __init r8a7779_add_standard_devices(void)
#endif #endif
r8a7779_pm_init(); r8a7779_pm_init();
r8a7779_init_pm_domain(&r8a7779_sh4a); r8a7779_init_pm_domains();
r8a7779_init_pm_domain(&r8a7779_sgx);
r8a7779_init_pm_domain(&r8a7779_vdp1);
r8a7779_init_pm_domain(&r8a7779_impx3);
platform_add_devices(r8a7779_early_devices, platform_add_devices(r8a7779_early_devices,
ARRAY_SIZE(r8a7779_early_devices)); ARRAY_SIZE(r8a7779_early_devices));
......
...@@ -1001,21 +1001,34 @@ static struct platform_device *sh7372_late_devices[] __initdata = { ...@@ -1001,21 +1001,34 @@ static struct platform_device *sh7372_late_devices[] __initdata = {
void __init sh7372_add_standard_devices(void) void __init sh7372_add_standard_devices(void)
{ {
rmobile_init_pm_domain(&sh7372_pd_a4lc); struct pm_domain_device domain_devices[] = {
rmobile_init_pm_domain(&sh7372_pd_a4mp); { "A3RV", &vpu_device, },
rmobile_init_pm_domain(&sh7372_pd_d4); { "A4MP", &spu0_device, },
rmobile_init_pm_domain(&sh7372_pd_a4r); { "A4MP", &spu1_device, },
rmobile_init_pm_domain(&sh7372_pd_a3rv); { "A3SP", &scif0_device, },
rmobile_init_pm_domain(&sh7372_pd_a3ri); { "A3SP", &scif1_device, },
rmobile_init_pm_domain(&sh7372_pd_a4s); { "A3SP", &scif2_device, },
rmobile_init_pm_domain(&sh7372_pd_a3sp); { "A3SP", &scif3_device, },
rmobile_init_pm_domain(&sh7372_pd_a3sg); { "A3SP", &scif4_device, },
{ "A3SP", &scif5_device, },
rmobile_pm_add_subdomain(&sh7372_pd_a4lc, &sh7372_pd_a3rv); { "A3SP", &scif6_device, },
rmobile_pm_add_subdomain(&sh7372_pd_a4r, &sh7372_pd_a4lc); { "A3SP", &iic1_device, },
{ "A3SP", &dma0_device, },
rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sg); { "A3SP", &dma1_device, },
rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sp); { "A3SP", &dma2_device, },
{ "A3SP", &usb_dma0_device, },
{ "A3SP", &usb_dma1_device, },
{ "A4R", &iic0_device, },
{ "A4R", &veu0_device, },
{ "A4R", &veu1_device, },
{ "A4R", &veu2_device, },
{ "A4R", &veu3_device, },
{ "A4R", &jpu_device, },
{ "A4R", &tmu00_device, },
{ "A4R", &tmu01_device, },
};
sh7372_init_pm_domains();
platform_add_devices(sh7372_early_devices, platform_add_devices(sh7372_early_devices,
ARRAY_SIZE(sh7372_early_devices)); ARRAY_SIZE(sh7372_early_devices));
...@@ -1023,30 +1036,8 @@ void __init sh7372_add_standard_devices(void) ...@@ -1023,30 +1036,8 @@ void __init sh7372_add_standard_devices(void)
platform_add_devices(sh7372_late_devices, platform_add_devices(sh7372_late_devices,
ARRAY_SIZE(sh7372_late_devices)); ARRAY_SIZE(sh7372_late_devices));
rmobile_add_device_to_domain(&sh7372_pd_a3rv, &vpu_device); rmobile_add_devices_to_domains(domain_devices,
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu0_device); ARRAY_SIZE(domain_devices));
rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu1_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif0_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif1_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif2_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif3_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif4_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif5_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif6_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &iic1_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma0_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma1_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma2_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma0_device);
rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma1_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &iic0_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu0_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu1_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu2_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu3_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &jpu_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu00_device);
rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu01_device);
} }
static void __init sh7372_earlytimer_init(void) static void __init sh7372_earlytimer_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment