diff options
-rw-r--r-- | arch/sh/boards/mach-se/7724/setup.c | 9 | ||||
-rw-r--r-- | arch/sh/kernel/cpu/shmobile/sleep.S | 70 | ||||
-rw-r--r-- | drivers/clocksource/sh_cmt.c | 28 | ||||
-rw-r--r-- | drivers/video/sh_mobile_lcdcfb.c | 5 |
4 files changed, 106 insertions, 6 deletions
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 8fed45a2fb85..15456a0773bf 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -238,7 +238,7 @@ static struct platform_device ceu1_device = { | |||
238 | }, | 238 | }, |
239 | }; | 239 | }; |
240 | 240 | ||
241 | /* KEYSC */ | 241 | /* KEYSC in SoC (Needs SW33-2 set to ON) */ |
242 | static struct sh_keysc_info keysc_info = { | 242 | static struct sh_keysc_info keysc_info = { |
243 | .mode = SH_KEYSC_MODE_1, | 243 | .mode = SH_KEYSC_MODE_1, |
244 | .scan_timing = 10, | 244 | .scan_timing = 10, |
@@ -255,12 +255,13 @@ static struct sh_keysc_info keysc_info = { | |||
255 | 255 | ||
256 | static struct resource keysc_resources[] = { | 256 | static struct resource keysc_resources[] = { |
257 | [0] = { | 257 | [0] = { |
258 | .start = 0x1a204000, | 258 | .name = "KEYSC", |
259 | .end = 0x1a20400f, | 259 | .start = 0x044b0000, |
260 | .end = 0x044b000f, | ||
260 | .flags = IORESOURCE_MEM, | 261 | .flags = IORESOURCE_MEM, |
261 | }, | 262 | }, |
262 | [1] = { | 263 | [1] = { |
263 | .start = IRQ0_KEY, | 264 | .start = 79, |
264 | .flags = IORESOURCE_IRQ, | 265 | .flags = IORESOURCE_IRQ, |
265 | }, | 266 | }, |
266 | }; | 267 | }; |
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S index 5d888ef53d82..baf2d7d46b05 100644 --- a/arch/sh/kernel/cpu/shmobile/sleep.S +++ b/arch/sh/kernel/cpu/shmobile/sleep.S | |||
@@ -26,8 +26,30 @@ ENTRY(sh_mobile_standby) | |||
26 | 26 | ||
27 | tst #SUSP_SH_SF, r0 | 27 | tst #SUSP_SH_SF, r0 |
28 | bt skip_set_sf | 28 | bt skip_set_sf |
29 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
30 | /* DBSC: put memory in self-refresh mode */ | ||
29 | 31 | ||
30 | /* SDRAM: disable power down and put in self-refresh mode */ | 32 | mov.l dben_reg, r4 |
33 | mov.l dben_data0, r1 | ||
34 | mov.l r1, @r4 | ||
35 | |||
36 | mov.l dbrfpdn0_reg, r4 | ||
37 | mov.l dbrfpdn0_data0, r1 | ||
38 | mov.l r1, @r4 | ||
39 | |||
40 | mov.l dbcmdcnt_reg, r4 | ||
41 | mov.l dbcmdcnt_data0, r1 | ||
42 | mov.l r1, @r4 | ||
43 | |||
44 | mov.l dbcmdcnt_reg, r4 | ||
45 | mov.l dbcmdcnt_data1, r1 | ||
46 | mov.l r1, @r4 | ||
47 | |||
48 | mov.l dbrfpdn0_reg, r4 | ||
49 | mov.l dbrfpdn0_data1, r1 | ||
50 | mov.l r1, @r4 | ||
51 | #else | ||
52 | /* SBSC: disable power down and put in self-refresh mode */ | ||
31 | mov.l 1f, r4 | 53 | mov.l 1f, r4 |
32 | mov.l 2f, r1 | 54 | mov.l 2f, r1 |
33 | mov.l @r4, r2 | 55 | mov.l @r4, r2 |
@@ -35,6 +57,7 @@ ENTRY(sh_mobile_standby) | |||
35 | mov.l 3f, r3 | 57 | mov.l 3f, r3 |
36 | and r3, r2 | 58 | and r3, r2 |
37 | mov.l r2, @r4 | 59 | mov.l r2, @r4 |
60 | #endif | ||
38 | 61 | ||
39 | skip_set_sf: | 62 | skip_set_sf: |
40 | tst #SUSP_SH_SLEEP, r0 | 63 | tst #SUSP_SH_SLEEP, r0 |
@@ -84,7 +107,36 @@ done_sleep: | |||
84 | tst #SUSP_SH_SF, r0 | 107 | tst #SUSP_SH_SF, r0 |
85 | bt skip_restore_sf | 108 | bt skip_restore_sf |
86 | 109 | ||
87 | /* SDRAM: set auto-refresh mode */ | 110 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 |
111 | /* DBSC: put memory in auto-refresh mode */ | ||
112 | |||
113 | mov.l dbrfpdn0_reg, r4 | ||
114 | mov.l dbrfpdn0_data0, r1 | ||
115 | mov.l r1, @r4 | ||
116 | |||
117 | /* sleep 140 ns */ | ||
118 | nop | ||
119 | nop | ||
120 | nop | ||
121 | nop | ||
122 | |||
123 | mov.l dbcmdcnt_reg, r4 | ||
124 | mov.l dbcmdcnt_data0, r1 | ||
125 | mov.l r1, @r4 | ||
126 | |||
127 | mov.l dbcmdcnt_reg, r4 | ||
128 | mov.l dbcmdcnt_data1, r1 | ||
129 | mov.l r1, @r4 | ||
130 | |||
131 | mov.l dben_reg, r4 | ||
132 | mov.l dben_data1, r1 | ||
133 | mov.l r1, @r4 | ||
134 | |||
135 | mov.l dbrfpdn0_reg, r4 | ||
136 | mov.l dbrfpdn0_data2, r1 | ||
137 | mov.l r1, @r4 | ||
138 | #else | ||
139 | /* SBSC: set auto-refresh mode */ | ||
88 | mov.l 1f, r4 | 140 | mov.l 1f, r4 |
89 | mov.l @r4, r2 | 141 | mov.l @r4, r2 |
90 | mov.l 4f, r3 | 142 | mov.l 4f, r3 |
@@ -98,15 +150,29 @@ done_sleep: | |||
98 | add r4, r3 | 150 | add r4, r3 |
99 | or r2, r3 | 151 | or r2, r3 |
100 | mov.l r3, @r1 | 152 | mov.l r3, @r1 |
153 | #endif | ||
101 | skip_restore_sf: | 154 | skip_restore_sf: |
102 | rts | 155 | rts |
103 | nop | 156 | nop |
104 | 157 | ||
105 | .balign 4 | 158 | .balign 4 |
159 | #ifdef CONFIG_CPU_SUBTYPE_SH7724 | ||
160 | dben_reg: .long 0xfd000010 /* DBEN */ | ||
161 | dben_data0: .long 0 | ||
162 | dben_data1: .long 1 | ||
163 | dbrfpdn0_reg: .long 0xfd000040 /* DBRFPDN0 */ | ||
164 | dbrfpdn0_data0: .long 0 | ||
165 | dbrfpdn0_data1: .long 1 | ||
166 | dbrfpdn0_data2: .long 0x00010000 | ||
167 | dbcmdcnt_reg: .long 0xfd000014 /* DBCMDCNT */ | ||
168 | dbcmdcnt_data0: .long 2 | ||
169 | dbcmdcnt_data1: .long 4 | ||
170 | #else | ||
106 | 1: .long 0xfe400008 /* SDCR0 */ | 171 | 1: .long 0xfe400008 /* SDCR0 */ |
107 | 2: .long 0x00000400 | 172 | 2: .long 0x00000400 |
108 | 3: .long 0xffff7fff | 173 | 3: .long 0xffff7fff |
109 | 4: .long 0xfffffbff | 174 | 4: .long 0xfffffbff |
175 | #endif | ||
110 | 5: .long 0xa4150020 /* STBCR */ | 176 | 5: .long 0xa4150020 /* STBCR */ |
111 | 6: .long 0xfe40001c /* RTCOR */ | 177 | 6: .long 0xfe40001c /* RTCOR */ |
112 | 7: .long 0xfe400018 /* RTCNT */ | 178 | 7: .long 0xfe400018 /* RTCNT */ |
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c index 2964f5f4a7ef..6b3e0c2f33e2 100644 --- a/drivers/clocksource/sh_cmt.c +++ b/drivers/clocksource/sh_cmt.c | |||
@@ -40,6 +40,7 @@ struct sh_cmt_priv { | |||
40 | struct platform_device *pdev; | 40 | struct platform_device *pdev; |
41 | 41 | ||
42 | unsigned long flags; | 42 | unsigned long flags; |
43 | unsigned long flags_suspend; | ||
43 | unsigned long match_value; | 44 | unsigned long match_value; |
44 | unsigned long next_match_value; | 45 | unsigned long next_match_value; |
45 | unsigned long max_match_value; | 46 | unsigned long max_match_value; |
@@ -667,11 +668,38 @@ static int __devexit sh_cmt_remove(struct platform_device *pdev) | |||
667 | return -EBUSY; /* cannot unregister clockevent and clocksource */ | 668 | return -EBUSY; /* cannot unregister clockevent and clocksource */ |
668 | } | 669 | } |
669 | 670 | ||
671 | static int sh_cmt_suspend(struct device *dev) | ||
672 | { | ||
673 | struct platform_device *pdev = to_platform_device(dev); | ||
674 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
675 | |||
676 | /* save flag state and stop CMT channel */ | ||
677 | p->flags_suspend = p->flags; | ||
678 | sh_cmt_stop(p, p->flags); | ||
679 | return 0; | ||
680 | } | ||
681 | |||
682 | static int sh_cmt_resume(struct device *dev) | ||
683 | { | ||
684 | struct platform_device *pdev = to_platform_device(dev); | ||
685 | struct sh_cmt_priv *p = platform_get_drvdata(pdev); | ||
686 | |||
687 | /* start CMT channel from saved state */ | ||
688 | sh_cmt_start(p, p->flags_suspend); | ||
689 | return 0; | ||
690 | } | ||
691 | |||
692 | static struct dev_pm_ops sh_cmt_dev_pm_ops = { | ||
693 | .suspend = sh_cmt_suspend, | ||
694 | .resume = sh_cmt_resume, | ||
695 | }; | ||
696 | |||
670 | static struct platform_driver sh_cmt_device_driver = { | 697 | static struct platform_driver sh_cmt_device_driver = { |
671 | .probe = sh_cmt_probe, | 698 | .probe = sh_cmt_probe, |
672 | .remove = __devexit_p(sh_cmt_remove), | 699 | .remove = __devexit_p(sh_cmt_remove), |
673 | .driver = { | 700 | .driver = { |
674 | .name = "sh_cmt", | 701 | .name = "sh_cmt", |
702 | .pm = &sh_cmt_dev_pm_ops, | ||
675 | } | 703 | } |
676 | }; | 704 | }; |
677 | 705 | ||
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8f24564f77b0..07f22b625632 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -481,6 +481,9 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
481 | /* tell the board code to enable the panel */ | 481 | /* tell the board code to enable the panel */ |
482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 482 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
483 | ch = &priv->ch[k]; | 483 | ch = &priv->ch[k]; |
484 | if (!ch->enabled) | ||
485 | continue; | ||
486 | |||
484 | board_cfg = &ch->cfg.board_cfg; | 487 | board_cfg = &ch->cfg.board_cfg; |
485 | if (board_cfg->display_on) | 488 | if (board_cfg->display_on) |
486 | board_cfg->display_on(board_cfg->board_data); | 489 | board_cfg->display_on(board_cfg->board_data); |
@@ -498,6 +501,8 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
498 | /* clean up deferred io and ask board code to disable panel */ | 501 | /* clean up deferred io and ask board code to disable panel */ |
499 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { | 502 | for (k = 0; k < ARRAY_SIZE(priv->ch); k++) { |
500 | ch = &priv->ch[k]; | 503 | ch = &priv->ch[k]; |
504 | if (!ch->enabled) | ||
505 | continue; | ||
501 | 506 | ||
502 | /* deferred io mode: | 507 | /* deferred io mode: |
503 | * flush frame, and wait for frame end interrupt | 508 | * flush frame, and wait for frame end interrupt |