Skip to content

Commit

Permalink
Merge branch 'pm-shmobile'
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rjwysocki committed Sep 17, 2012
2 parents d6a56ae + caaca99 commit cf89968
Show file tree
Hide file tree
Showing 18 changed files with 407 additions and 336 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-shmobile/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

# Common objects
obj-y := timer.o console.o clock.o common.o
obj-y := timer.o console.o clock.o

# CPU objects
obj-$(CONFIG_ARCH_SH7367) += setup-sh7367.o clock-sh7367.o intc-sh7367.o
Expand Down
21 changes: 12 additions & 9 deletions arch/arm/mach-shmobile/board-ap4evb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,15 @@ static struct i2c_board_info i2c1_devices[] = {
#define USCCR1 0xE6058144
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;
struct clk *clk;

Expand Down Expand Up @@ -1461,14 +1470,8 @@ static void __init ap4evb_init(void)

platform_add_devices(ap4evb_devices, ARRAY_SIZE(ap4evb_devices));

rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc1_device);
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
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);
rmobile_add_devices_to_domains(domain_devices,
ARRAY_SIZE(domain_devices));

hdmi_init_pm_clock();
fsi_init_pm_clock();
Expand All @@ -1483,6 +1486,6 @@ MACHINE_START(AP4EVB, "ap4evb")
.init_irq = sh7372_init_irq,
.handle_irq = shmobile_handle_irq_intc,
.init_machine = ap4evb_init,
.init_late = shmobile_init_late,
.init_late = sh7372_pm_init_late,
.timer = &shmobile_timer,
MACHINE_END
6 changes: 3 additions & 3 deletions arch/arm/mach-shmobile/board-armadillo800eva.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,10 +1182,10 @@ static void __init eva_init(void)

eva_clock_init();

rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &lcdc0_device);
rmobile_add_device_to_domain(&r8a7740_pd_a4lc, &hdmi_lcdc_device);
rmobile_add_device_to_domain("A4LC", &lcdc0_device);
rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
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)
Expand Down
34 changes: 19 additions & 15 deletions arch/arm/mach-shmobile/board-mackerel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,22 @@ static struct i2c_board_info i2c1_devices[] = {
#define USCCR1 0xE6058144
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;
struct clk *clk;

Expand Down Expand Up @@ -1624,20 +1640,8 @@ static void __init mackerel_init(void)

platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));

rmobile_add_device_to_domain(&sh7372_pd_a4lc, &lcdc_device);
rmobile_add_device_to_domain(&sh7372_pd_a4lc, &hdmi_lcdc_device);
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);
rmobile_add_devices_to_domains(domain_devices,
ARRAY_SIZE(domain_devices));

hdmi_init_pm_clock();
sh7372_pm_init();
Expand All @@ -1651,6 +1655,6 @@ MACHINE_START(MACKEREL, "mackerel")
.init_irq = sh7372_init_irq,
.handle_irq = shmobile_handle_irq_intc,
.init_machine = mackerel_init,
.init_late = shmobile_init_late,
.init_late = sh7372_pm_init_late,
.timer = &shmobile_timer,
MACHINE_END
24 changes: 0 additions & 24 deletions arch/arm/mach-shmobile/common.c

This file was deleted.

39 changes: 13 additions & 26 deletions arch/arm/mach-shmobile/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,38 @@
#include <asm/cpuidle.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();
}

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;
return 0;
}

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",
.owner = THIS_MODULE,
.en_core_tk_irqen = 1,
.states[0] = ARM_CPUIDLE_WFI_STATE,
.states[0].enter = shmobile_enter_wfi,
.safe_state_index = 0, /* C1 */
.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)
{
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);

return 0;
Expand Down
14 changes: 10 additions & 4 deletions arch/arm/mach-shmobile/include/mach/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ extern int shmobile_clk_init(void);
extern void shmobile_handle_irq_intc(struct pt_regs *);
extern struct platform_suspend_ops shmobile_suspend_ops;
struct cpuidle_driver;
extern void (*shmobile_cpuidle_modes[])(void);
extern void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
struct cpuidle_device;
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_map_io(void);
Expand Down Expand Up @@ -86,8 +88,6 @@ extern int r8a7779_boot_secondary(unsigned int cpu);
extern void r8a7779_smp_prepare_cpus(void);
extern void r8a7779_register_twd(void);

extern void shmobile_init_late(void);

#ifdef CONFIG_SUSPEND
int shmobile_suspend_init(void);
#else
Expand All @@ -100,4 +100,10 @@ int shmobile_cpuidle_init(void);
static inline int shmobile_cpuidle_init(void) { return 0; }
#endif

static inline void shmobile_init_late(void)
{
shmobile_suspend_init();
shmobile_cpuidle_init();
}

#endif /* __ARCH_MACH_COMMON_H */
35 changes: 27 additions & 8 deletions arch/arm/mach-shmobile/include/mach/pm-rmobile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

#include <linux/pm_domain.h>

#define DEFAULT_DEV_LATENCY_NS 250000

struct platform_device;

struct rmobile_pm_domain {
Expand All @@ -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);
}

struct pm_domain_device {
const char *domain_name;
struct platform_device *pdev;
};

#ifdef CONFIG_PM
extern void rmobile_init_pm_domain(struct rmobile_pm_domain *rmobile_pd);
extern void rmobile_add_device_to_domain(struct rmobile_pm_domain *rmobile_pd,
struct platform_device *pdev);
extern void rmobile_pm_add_subdomain(struct rmobile_pm_domain *rmobile_pd,
struct rmobile_pm_domain *rmobile_sd);
extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
extern void rmobile_add_device_to_domain_td(const char *domain_name,
struct platform_device *pdev,
struct gpd_timing_data *td);

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
#define rmobile_init_pm_domain(pd) do { } while (0)
#define rmobile_add_device_to_domain(pd, pdev) do { } while (0)
#define rmobile_pm_add_subdomain(pd, sd) do { } while (0)

#define rmobile_init_domains(domains, num) 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 /* PM_RMOBILE_H */
6 changes: 3 additions & 3 deletions arch/arm/mach-shmobile/include/mach/r8a7740.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@ enum {
};

#ifdef CONFIG_PM
extern struct rmobile_pm_domain r8a7740_pd_a4s;
extern struct rmobile_pm_domain r8a7740_pd_a3sp;
extern struct rmobile_pm_domain r8a7740_pd_a4lc;
extern void __init r8a7740_init_pm_domains(void);
#else
static inline void r8a7740_init_pm_domains(void) {}
#endif /* CONFIG_PM */

#endif /* __ASM_R8A7740_H__ */
12 changes: 2 additions & 10 deletions arch/arm/mach-shmobile/include/mach/r8a7779.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

#ifdef CONFIG_PM
extern struct r8a7779_pm_domain r8a7779_sh4a;
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);
extern void __init r8a7779_init_pm_domains(void);
#else
#define r8a7779_init_pm_domain(pd) do { } while (0)
#define r8a7779_add_device_to_domain(pd, pdev) do { } while (0)
static inline void r8a7779_init_pm_domains(void) {}
#endif /* CONFIG_PM */

#endif /* __ASM_R8A7779_H__ */
20 changes: 8 additions & 12 deletions arch/arm/mach-shmobile/include/mach/sh7372.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,21 +478,17 @@ extern struct clk sh7372_fsibck_clk;
extern struct clk sh7372_fsidiva_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_resume(void);
extern void sh7372_intca_suspend(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__ */
Loading

0 comments on commit cf89968

Please sign in to comment.