diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/sharpsl_pm.c | 28 | ||||
-rw-r--r-- | arch/arm/kernel/process.c | 61 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-pxa/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi_pm.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-pxa/corgi_ssp.c | 42 | ||||
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 108 | ||||
-rw-r--r-- | arch/arm/mach-pxa/sharpsl_pm.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-pxa/spitz_pm.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 25 |
12 files changed, 293 insertions, 69 deletions
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c index 3cd8c9ee4510..045e37e07330 100644 --- a/arch/arm/common/sharpsl_pm.c +++ b/arch/arm/common/sharpsl_pm.c | |||
@@ -49,13 +49,6 @@ | |||
49 | #define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ | 49 | #define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */ |
50 | #define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ | 50 | #define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */ |
51 | 51 | ||
52 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | ||
53 | #define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ | ||
54 | #define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */ | ||
55 | #define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */ | ||
56 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ | ||
57 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ | ||
58 | |||
59 | /* | 52 | /* |
60 | * Prototypes | 53 | * Prototypes |
61 | */ | 54 | */ |
@@ -82,12 +75,13 @@ DEFINE_LED_TRIGGER(sharpsl_charge_led_trigger); | |||
82 | static int get_percentage(int voltage) | 75 | static int get_percentage(int voltage) |
83 | { | 76 | { |
84 | int i = sharpsl_pm.machinfo->bat_levels - 1; | 77 | int i = sharpsl_pm.machinfo->bat_levels - 1; |
78 | int bl_status = sharpsl_pm.machinfo->backlight_get_status ? sharpsl_pm.machinfo->backlight_get_status() : 0; | ||
85 | struct battery_thresh *thresh; | 79 | struct battery_thresh *thresh; |
86 | 80 | ||
87 | if (sharpsl_pm.charge_mode == CHRG_ON) | 81 | if (sharpsl_pm.charge_mode == CHRG_ON) |
88 | thresh=sharpsl_pm.machinfo->bat_levels_acin; | 82 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_acin_bl : sharpsl_pm.machinfo->bat_levels_acin; |
89 | else | 83 | else |
90 | thresh=sharpsl_pm.machinfo->bat_levels_noac; | 84 | thresh = bl_status ? sharpsl_pm.machinfo->bat_levels_noac_bl : sharpsl_pm.machinfo->bat_levels_noac; |
91 | 85 | ||
92 | while (i > 0 && (voltage > thresh[i].voltage)) | 86 | while (i > 0 && (voltage > thresh[i].voltage)) |
93 | i--; | 87 | i--; |
@@ -131,7 +125,7 @@ static void sharpsl_battery_thread(void *private_) | |||
131 | sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE); | 125 | sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE); |
132 | 126 | ||
133 | /* Corgi cannot confirm when battery fully charged so periodically kick! */ | 127 | /* Corgi cannot confirm when battery fully charged so periodically kick! */ |
134 | if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON) | 128 | if (!sharpsl_pm.machinfo->batfull_irq && (sharpsl_pm.charge_mode == CHRG_ON) |
135 | && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) | 129 | && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL)) |
136 | schedule_work(&toggle_charger); | 130 | schedule_work(&toggle_charger); |
137 | 131 | ||
@@ -166,11 +160,11 @@ static void sharpsl_battery_thread(void *private_) | |||
166 | && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || | 160 | && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) || |
167 | (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { | 161 | (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) { |
168 | if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { | 162 | if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) { |
169 | corgibl_limit_intensity(1); | 163 | sharpsl_pm.machinfo->backlight_limit(1); |
170 | sharpsl_pm.flags |= SHARPSL_BL_LIMIT; | 164 | sharpsl_pm.flags |= SHARPSL_BL_LIMIT; |
171 | } | 165 | } |
172 | } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) { | 166 | } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) { |
173 | corgibl_limit_intensity(0); | 167 | sharpsl_pm.machinfo->backlight_limit(0); |
174 | sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; | 168 | sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT; |
175 | } | 169 | } |
176 | 170 | ||
@@ -418,7 +412,7 @@ static int sharpsl_check_battery_temp(void) | |||
418 | val = get_select_val(buff); | 412 | val = get_select_val(buff); |
419 | 413 | ||
420 | dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); | 414 | dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val); |
421 | if (val > SHARPSL_CHARGE_ON_TEMP) | 415 | if (val > sharpsl_pm.machinfo->charge_on_temp) |
422 | return -1; | 416 | return -1; |
423 | 417 | ||
424 | return 0; | 418 | return 0; |
@@ -450,7 +444,7 @@ static int sharpsl_check_battery_voltage(void) | |||
450 | val = get_select_val(buff); | 444 | val = get_select_val(buff); |
451 | dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val); | 445 | dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val); |
452 | 446 | ||
453 | if (val < SHARPSL_CHARGE_ON_VOLT) | 447 | if (val < sharpsl_pm.machinfo->charge_on_volt) |
454 | return -1; | 448 | return -1; |
455 | 449 | ||
456 | return 0; | 450 | return 0; |
@@ -468,7 +462,7 @@ static int sharpsl_ac_check(void) | |||
468 | temp = get_select_val(buff); | 462 | temp = get_select_val(buff); |
469 | dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); | 463 | dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp); |
470 | 464 | ||
471 | if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) { | 465 | if ((temp > sharpsl_pm.machinfo->charge_acin_high) || (temp < sharpsl_pm.machinfo->charge_acin_low)) { |
472 | dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); | 466 | dev_err(sharpsl_pm.dev, "Error: AC check failed.\n"); |
473 | return -1; | 467 | return -1; |
474 | } | 468 | } |
@@ -627,8 +621,8 @@ static int sharpsl_fatal_check(void) | |||
627 | temp = get_select_val(buff); | 621 | temp = get_select_val(buff); |
628 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); | 622 | dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT)); |
629 | 623 | ||
630 | if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) || | 624 | if ((acin && (temp < sharpsl_pm.machinfo->fatal_acin_volt)) || |
631 | (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT))) | 625 | (!acin && (temp < sharpsl_pm.machinfo->fatal_noacin_volt))) |
632 | return -1; | 626 | return -1; |
633 | return 0; | 627 | return 0; |
634 | } | 628 | } |
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 7df6e1aaa323..17c38dbf2f3c 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/cpu.h> | 29 | #include <linux/cpu.h> |
30 | #include <linux/elfcore.h> | 30 | #include <linux/elfcore.h> |
31 | #include <linux/pm.h> | ||
31 | 32 | ||
32 | #include <asm/leds.h> | 33 | #include <asm/leds.h> |
33 | #include <asm/processor.h> | 34 | #include <asm/processor.h> |
@@ -71,8 +72,36 @@ static int __init hlt_setup(char *__unused) | |||
71 | __setup("nohlt", nohlt_setup); | 72 | __setup("nohlt", nohlt_setup); |
72 | __setup("hlt", hlt_setup); | 73 | __setup("hlt", hlt_setup); |
73 | 74 | ||
75 | void arm_machine_restart(char mode) | ||
76 | { | ||
77 | /* | ||
78 | * Clean and disable cache, and turn off interrupts | ||
79 | */ | ||
80 | cpu_proc_fin(); | ||
81 | |||
82 | /* | ||
83 | * Tell the mm system that we are going to reboot - | ||
84 | * we may need it to insert some 1:1 mappings so that | ||
85 | * soft boot works. | ||
86 | */ | ||
87 | setup_mm_for_reboot(mode); | ||
88 | |||
89 | /* | ||
90 | * Now call the architecture specific reboot code. | ||
91 | */ | ||
92 | arch_reset(mode); | ||
93 | |||
94 | /* | ||
95 | * Whoops - the architecture was unable to reboot. | ||
96 | * Tell the user! | ||
97 | */ | ||
98 | mdelay(1000); | ||
99 | printk("Reboot failed -- System halted\n"); | ||
100 | while (1); | ||
101 | } | ||
102 | |||
74 | /* | 103 | /* |
75 | * The following aren't currently used. | 104 | * Function pointers to optional machine specific functions |
76 | */ | 105 | */ |
77 | void (*pm_idle)(void); | 106 | void (*pm_idle)(void); |
78 | EXPORT_SYMBOL(pm_idle); | 107 | EXPORT_SYMBOL(pm_idle); |
@@ -80,6 +109,10 @@ EXPORT_SYMBOL(pm_idle); | |||
80 | void (*pm_power_off)(void); | 109 | void (*pm_power_off)(void); |
81 | EXPORT_SYMBOL(pm_power_off); | 110 | EXPORT_SYMBOL(pm_power_off); |
82 | 111 | ||
112 | void (*arm_pm_restart)(char str) = arm_machine_restart; | ||
113 | EXPORT_SYMBOL_GPL(arm_pm_restart); | ||
114 | |||
115 | |||
83 | /* | 116 | /* |
84 | * This is our default idle handler. We need to disable | 117 | * This is our default idle handler. We need to disable |
85 | * interrupts here to ensure we don't miss a wakeup call. | 118 | * interrupts here to ensure we don't miss a wakeup call. |
@@ -151,33 +184,9 @@ void machine_power_off(void) | |||
151 | pm_power_off(); | 184 | pm_power_off(); |
152 | } | 185 | } |
153 | 186 | ||
154 | |||
155 | void machine_restart(char * __unused) | 187 | void machine_restart(char * __unused) |
156 | { | 188 | { |
157 | /* | 189 | arm_pm_restart(reboot_mode); |
158 | * Clean and disable cache, and turn off interrupts | ||
159 | */ | ||
160 | cpu_proc_fin(); | ||
161 | |||
162 | /* | ||
163 | * Tell the mm system that we are going to reboot - | ||
164 | * we may need it to insert some 1:1 mappings so that | ||
165 | * soft boot works. | ||
166 | */ | ||
167 | setup_mm_for_reboot(reboot_mode); | ||
168 | |||
169 | /* | ||
170 | * Now call the architecture specific reboot code. | ||
171 | */ | ||
172 | arch_reset(reboot_mode); | ||
173 | |||
174 | /* | ||
175 | * Whoops - the architecture was unable to reboot. | ||
176 | * Tell the user! | ||
177 | */ | ||
178 | mdelay(1000); | ||
179 | printk("Reboot failed -- System halted\n"); | ||
180 | while (1); | ||
181 | } | 190 | } |
182 | 191 | ||
183 | void __show_regs(struct pt_regs *regs) | 192 | void __show_regs(struct pt_regs *regs) |
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 0104fd142e70..ea5137f319c4 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -61,6 +61,7 @@ config MACH_POODLE | |||
61 | bool "Enable Sharp SL-5600 (Poodle) Support" | 61 | bool "Enable Sharp SL-5600 (Poodle) Support" |
62 | depends PXA_SHARPSL_25x | 62 | depends PXA_SHARPSL_25x |
63 | select SHARP_LOCOMO | 63 | select SHARP_LOCOMO |
64 | select PXA_SSP | ||
64 | 65 | ||
65 | config MACH_CORGI | 66 | config MACH_CORGI |
66 | bool "Enable Sharp SL-C700 (Corgi) Support" | 67 | bool "Enable Sharp SL-C700 (Corgi) Support" |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index 4e8a983e2b83..1610690be419 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -15,7 +15,7 @@ obj-$(CONFIG_ARCH_PXA_IDP) += idp.o | |||
15 | obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o | 15 | obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o |
16 | obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o | 16 | obj-$(CONFIG_PXA_SHARP_Cxx00) += spitz.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o spitz_pm.o |
17 | obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o | 17 | obj-$(CONFIG_MACH_AKITA) += akita-ioexp.o |
18 | obj-$(CONFIG_MACH_POODLE) += poodle.o | 18 | obj-$(CONFIG_MACH_POODLE) += poodle.o corgi_ssp.o |
19 | obj-$(CONFIG_MACH_TOSA) += tosa.o | 19 | obj-$(CONFIG_MACH_TOSA) += tosa.o |
20 | 20 | ||
21 | # Support for blinky lights | 21 | # Support for blinky lights |
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c index d6d726036361..bf6648a83901 100644 --- a/arch/arm/mach-pxa/corgi.c +++ b/arch/arm/mach-pxa/corgi.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
22 | #include <linux/pm.h> | ||
22 | 23 | ||
23 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
24 | #include <asm/memory.h> | 25 | #include <asm/memory.h> |
@@ -26,6 +27,7 @@ | |||
26 | #include <asm/hardware.h> | 27 | #include <asm/hardware.h> |
27 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
28 | #include <asm/io.h> | 29 | #include <asm/io.h> |
30 | #include <asm/system.h> | ||
29 | 31 | ||
30 | #include <asm/mach/arch.h> | 32 | #include <asm/mach/arch.h> |
31 | #include <asm/mach/map.h> | 33 | #include <asm/mach/map.h> |
@@ -310,8 +312,31 @@ static struct platform_device *devices[] __initdata = { | |||
310 | &corgiled_device, | 312 | &corgiled_device, |
311 | }; | 313 | }; |
312 | 314 | ||
315 | static void corgi_poweroff(void) | ||
316 | { | ||
317 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
318 | |||
319 | if (!machine_is_corgi()) | ||
320 | /* Green LED off tells the bootloader to halt */ | ||
321 | reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | ||
322 | arm_machine_restart('h'); | ||
323 | } | ||
324 | |||
325 | static void corgi_restart(char mode) | ||
326 | { | ||
327 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
328 | |||
329 | if (!machine_is_corgi()) | ||
330 | /* Green LED on tells the bootloader to reboot */ | ||
331 | set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_LED_GREEN); | ||
332 | arm_machine_restart('h'); | ||
333 | } | ||
334 | |||
313 | static void __init corgi_init(void) | 335 | static void __init corgi_init(void) |
314 | { | 336 | { |
337 | pm_power_off = corgi_poweroff; | ||
338 | arm_pm_restart = corgi_restart; | ||
339 | |||
315 | /* setup sleep mode values */ | 340 | /* setup sleep mode values */ |
316 | PWER = 0x00000002; | 341 | PWER = 0x00000002; |
317 | PFER = 0x00000000; | 342 | PFER = 0x00000000; |
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index 7a1ab73e9e10..4c3de4008a43 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -27,6 +27,13 @@ | |||
27 | #include <asm/arch/pxa-regs.h> | 27 | #include <asm/arch/pxa-regs.h> |
28 | #include "sharpsl.h" | 28 | #include "sharpsl.h" |
29 | 29 | ||
30 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | ||
31 | #define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ | ||
32 | #define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */ | ||
33 | #define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */ | ||
34 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ | ||
35 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ | ||
36 | |||
30 | static void corgi_charger_init(void) | 37 | static void corgi_charger_init(void) |
31 | { | 38 | { |
32 | pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT); | 39 | pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT); |
@@ -195,9 +202,16 @@ static struct sharpsl_charger_machinfo corgi_pm_machinfo = { | |||
195 | .read_devdata = corgipm_read_devdata, | 202 | .read_devdata = corgipm_read_devdata, |
196 | .charger_wakeup = corgi_charger_wakeup, | 203 | .charger_wakeup = corgi_charger_wakeup, |
197 | .should_wakeup = corgi_should_wakeup, | 204 | .should_wakeup = corgi_should_wakeup, |
198 | .bat_levels = 40, | 205 | .backlight_limit = corgibl_limit_intensity, |
199 | .bat_levels_noac = spitz_battery_levels_noac, | 206 | .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, |
200 | .bat_levels_acin = spitz_battery_levels_acin, | 207 | .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, |
208 | .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, | ||
209 | .charge_acin_low = SHARPSL_CHARGE_ON_ACIN_LOW, | ||
210 | .fatal_acin_volt = SHARPSL_FATAL_ACIN_VOLT, | ||
211 | .fatal_noacin_volt= SHARPSL_FATAL_NOACIN_VOLT, | ||
212 | .bat_levels = 40, | ||
213 | .bat_levels_noac = spitz_battery_levels_noac, | ||
214 | .bat_levels_acin = spitz_battery_levels_acin, | ||
201 | .status_high_acin = 188, | 215 | .status_high_acin = 188, |
202 | .status_low_acin = 178, | 216 | .status_low_acin = 178, |
203 | .status_high_noac = 185, | 217 | .status_high_noac = 185, |
@@ -214,6 +228,9 @@ static int __devinit corgipm_init(void) | |||
214 | if (!corgipm_device) | 228 | if (!corgipm_device) |
215 | return -ENOMEM; | 229 | return -ENOMEM; |
216 | 230 | ||
231 | if (!machine_is_corgi()) | ||
232 | corgi_pm_machinfo.batfull_irq = 1; | ||
233 | |||
217 | corgipm_device->dev.platform_data = &corgi_pm_machinfo; | 234 | corgipm_device->dev.platform_data = &corgi_pm_machinfo; |
218 | ret = platform_device_add(corgipm_device); | 235 | ret = platform_device_add(corgipm_device); |
219 | 236 | ||
diff --git a/arch/arm/mach-pxa/corgi_ssp.c b/arch/arm/mach-pxa/corgi_ssp.c index 8a25a1c8019f..f9421318cb7a 100644 --- a/arch/arm/mach-pxa/corgi_ssp.c +++ b/arch/arm/mach-pxa/corgi_ssp.c | |||
@@ -50,12 +50,14 @@ unsigned long corgi_ssp_ads7846_putget(ulong data) | |||
50 | unsigned long ret,flag; | 50 | unsigned long ret,flag; |
51 | 51 | ||
52 | spin_lock_irqsave(&corgi_ssp_lock, flag); | 52 | spin_lock_irqsave(&corgi_ssp_lock, flag); |
53 | GPCR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | 53 | if (ssp_machinfo->cs_ads7846 >= 0) |
54 | GPCR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | ||
54 | 55 | ||
55 | ssp_write_word(&corgi_ssp_dev,data); | 56 | ssp_write_word(&corgi_ssp_dev,data); |
56 | ret = ssp_read_word(&corgi_ssp_dev); | 57 | ret = ssp_read_word(&corgi_ssp_dev); |
57 | 58 | ||
58 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | 59 | if (ssp_machinfo->cs_ads7846 >= 0) |
60 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | ||
59 | spin_unlock_irqrestore(&corgi_ssp_lock, flag); | 61 | spin_unlock_irqrestore(&corgi_ssp_lock, flag); |
60 | 62 | ||
61 | return ret; | 63 | return ret; |
@@ -68,12 +70,14 @@ unsigned long corgi_ssp_ads7846_putget(ulong data) | |||
68 | void corgi_ssp_ads7846_lock(void) | 70 | void corgi_ssp_ads7846_lock(void) |
69 | { | 71 | { |
70 | spin_lock(&corgi_ssp_lock); | 72 | spin_lock(&corgi_ssp_lock); |
71 | GPCR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | 73 | if (ssp_machinfo->cs_ads7846 >= 0) |
74 | GPCR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | ||
72 | } | 75 | } |
73 | 76 | ||
74 | void corgi_ssp_ads7846_unlock(void) | 77 | void corgi_ssp_ads7846_unlock(void) |
75 | { | 78 | { |
76 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | 79 | if (ssp_machinfo->cs_ads7846 >= 0) |
80 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); | ||
77 | spin_unlock(&corgi_ssp_lock); | 81 | spin_unlock(&corgi_ssp_lock); |
78 | } | 82 | } |
79 | 83 | ||
@@ -110,11 +114,13 @@ unsigned long corgi_ssp_dac_put(ulong data) | |||
110 | ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), sscr1, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_lcdcon)); | 114 | ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), sscr1, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_lcdcon)); |
111 | ssp_enable(&corgi_ssp_dev); | 115 | ssp_enable(&corgi_ssp_dev); |
112 | 116 | ||
113 | GPCR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); | 117 | if (ssp_machinfo->cs_lcdcon >= 0) |
118 | GPCR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); | ||
114 | ssp_write_word(&corgi_ssp_dev,data); | 119 | ssp_write_word(&corgi_ssp_dev,data); |
115 | /* Read null data back from device to prevent SSP overflow */ | 120 | /* Read null data back from device to prevent SSP overflow */ |
116 | ssp_read_word(&corgi_ssp_dev); | 121 | ssp_read_word(&corgi_ssp_dev); |
117 | GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); | 122 | if (ssp_machinfo->cs_lcdcon >= 0) |
123 | GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); | ||
118 | 124 | ||
119 | ssp_disable(&corgi_ssp_dev); | 125 | ssp_disable(&corgi_ssp_dev); |
120 | ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_ads7846)); | 126 | ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_ads7846)); |
@@ -147,7 +153,8 @@ int corgi_ssp_max1111_get(ulong data) | |||
147 | int voltage,voltage1,voltage2; | 153 | int voltage,voltage1,voltage2; |
148 | 154 | ||
149 | spin_lock_irqsave(&corgi_ssp_lock, flag); | 155 | spin_lock_irqsave(&corgi_ssp_lock, flag); |
150 | GPCR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); | 156 | if (ssp_machinfo->cs_max1111 >= 0) |
157 | GPCR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); | ||
151 | ssp_disable(&corgi_ssp_dev); | 158 | ssp_disable(&corgi_ssp_dev); |
152 | ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_max1111)); | 159 | ssp_config(&corgi_ssp_dev, (SSCR0_Motorola | (SSCR0_DSS & 0x07 )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_max1111)); |
153 | ssp_enable(&corgi_ssp_dev); | 160 | ssp_enable(&corgi_ssp_dev); |
@@ -169,7 +176,8 @@ int corgi_ssp_max1111_get(ulong data) | |||
169 | ssp_disable(&corgi_ssp_dev); | 176 | ssp_disable(&corgi_ssp_dev); |
170 | ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_ads7846)); | 177 | ssp_config(&corgi_ssp_dev, (SSCR0_National | (SSCR0_DSS & 0x0b )), 0, 0, SSCR0_SerClkDiv(ssp_machinfo->clk_ads7846)); |
171 | ssp_enable(&corgi_ssp_dev); | 178 | ssp_enable(&corgi_ssp_dev); |
172 | GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); | 179 | if (ssp_machinfo->cs_max1111 >= 0) |
180 | GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); | ||
173 | spin_unlock_irqrestore(&corgi_ssp_lock, flag); | 181 | spin_unlock_irqrestore(&corgi_ssp_lock, flag); |
174 | 182 | ||
175 | if (voltage1 & 0xc0 || voltage2 & 0x3f) | 183 | if (voltage1 & 0xc0 || voltage2 & 0x3f) |
@@ -196,9 +204,12 @@ static int __init corgi_ssp_probe(struct platform_device *dev) | |||
196 | int ret; | 204 | int ret; |
197 | 205 | ||
198 | /* Chip Select - Disable All */ | 206 | /* Chip Select - Disable All */ |
199 | pxa_gpio_mode(ssp_machinfo->cs_lcdcon | GPIO_OUT | GPIO_DFLT_HIGH); | 207 | if (ssp_machinfo->cs_lcdcon >= 0) |
200 | pxa_gpio_mode(ssp_machinfo->cs_max1111 | GPIO_OUT | GPIO_DFLT_HIGH); | 208 | pxa_gpio_mode(ssp_machinfo->cs_lcdcon | GPIO_OUT | GPIO_DFLT_HIGH); |
201 | pxa_gpio_mode(ssp_machinfo->cs_ads7846 | GPIO_OUT | GPIO_DFLT_HIGH); | 209 | if (ssp_machinfo->cs_max1111 >= 0) |
210 | pxa_gpio_mode(ssp_machinfo->cs_max1111 | GPIO_OUT | GPIO_DFLT_HIGH); | ||
211 | if (ssp_machinfo->cs_ads7846 >= 0) | ||
212 | pxa_gpio_mode(ssp_machinfo->cs_ads7846 | GPIO_OUT | GPIO_DFLT_HIGH); | ||
202 | 213 | ||
203 | ret = ssp_init(&corgi_ssp_dev, ssp_machinfo->port, 0); | 214 | ret = ssp_init(&corgi_ssp_dev, ssp_machinfo->port, 0); |
204 | 215 | ||
@@ -229,9 +240,12 @@ static int corgi_ssp_suspend(struct platform_device *dev, pm_message_t state) | |||
229 | 240 | ||
230 | static int corgi_ssp_resume(struct platform_device *dev) | 241 | static int corgi_ssp_resume(struct platform_device *dev) |
231 | { | 242 | { |
232 | GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ | 243 | if (ssp_machinfo->cs_lcdcon >= 0) |
233 | GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/ | 244 | GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */ |
234 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/ | 245 | if (ssp_machinfo->cs_max1111 >= 0) |
246 | GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/ | ||
247 | if (ssp_machinfo->cs_ads7846 >= 0) | ||
248 | GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/ | ||
235 | ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state); | 249 | ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state); |
236 | ssp_enable(&corgi_ssp_dev); | 250 | ssp_enable(&corgi_ssp_dev); |
237 | 251 | ||
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index a042473deedd..9a9fa87cea9f 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -18,11 +18,14 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
21 | #include <linux/pm.h> | ||
22 | #include <linux/delay.h> | ||
21 | 23 | ||
22 | #include <asm/hardware.h> | 24 | #include <asm/hardware.h> |
23 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
24 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
25 | #include <asm/setup.h> | 27 | #include <asm/setup.h> |
28 | #include <asm/system.h> | ||
26 | 29 | ||
27 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
28 | #include <asm/mach/map.h> | 31 | #include <asm/mach/map.h> |
@@ -34,12 +37,15 @@ | |||
34 | #include <asm/arch/irda.h> | 37 | #include <asm/arch/irda.h> |
35 | #include <asm/arch/poodle.h> | 38 | #include <asm/arch/poodle.h> |
36 | #include <asm/arch/pxafb.h> | 39 | #include <asm/arch/pxafb.h> |
40 | #include <asm/arch/sharpsl.h> | ||
41 | #include <asm/arch/ssp.h> | ||
37 | 42 | ||
38 | #include <asm/hardware/scoop.h> | 43 | #include <asm/hardware/scoop.h> |
39 | #include <asm/hardware/locomo.h> | 44 | #include <asm/hardware/locomo.h> |
40 | #include <asm/mach/sharpsl_param.h> | 45 | #include <asm/mach/sharpsl_param.h> |
41 | 46 | ||
42 | #include "generic.h" | 47 | #include "generic.h" |
48 | #include "sharpsl.h" | ||
43 | 49 | ||
44 | static struct resource poodle_scoop_resources[] = { | 50 | static struct resource poodle_scoop_resources[] = { |
45 | [0] = { | 51 | [0] = { |
@@ -117,13 +123,71 @@ static struct resource locomo_resources[] = { | |||
117 | }, | 123 | }, |
118 | }; | 124 | }; |
119 | 125 | ||
120 | static struct platform_device locomo_device = { | 126 | struct platform_device poodle_locomo_device = { |
121 | .name = "locomo", | 127 | .name = "locomo", |
122 | .id = 0, | 128 | .id = 0, |
123 | .num_resources = ARRAY_SIZE(locomo_resources), | 129 | .num_resources = ARRAY_SIZE(locomo_resources), |
124 | .resource = locomo_resources, | 130 | .resource = locomo_resources, |
125 | }; | 131 | }; |
126 | 132 | ||
133 | EXPORT_SYMBOL(poodle_locomo_device); | ||
134 | |||
135 | /* | ||
136 | * Poodle SSP Device | ||
137 | */ | ||
138 | |||
139 | struct platform_device poodle_ssp_device = { | ||
140 | .name = "corgi-ssp", | ||
141 | .id = -1, | ||
142 | }; | ||
143 | |||
144 | struct corgissp_machinfo poodle_ssp_machinfo = { | ||
145 | .port = 1, | ||
146 | .cs_lcdcon = -1, | ||
147 | .cs_ads7846 = -1, | ||
148 | .cs_max1111 = -1, | ||
149 | .clk_lcdcon = 2, | ||
150 | .clk_ads7846 = 36, | ||
151 | .clk_max1111 = 2, | ||
152 | }; | ||
153 | |||
154 | |||
155 | /* | ||
156 | * Poodle Touch Screen Device | ||
157 | */ | ||
158 | static struct resource poodlets_resources[] = { | ||
159 | [0] = { | ||
160 | .start = POODLE_IRQ_GPIO_TP_INT, | ||
161 | .end = POODLE_IRQ_GPIO_TP_INT, | ||
162 | .flags = IORESOURCE_IRQ, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | static unsigned long poodle_get_hsync_len(void) | ||
167 | { | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void poodle_null_hsync(void) | ||
172 | { | ||
173 | } | ||
174 | |||
175 | static struct corgits_machinfo poodle_ts_machinfo = { | ||
176 | .get_hsync_len = poodle_get_hsync_len, | ||
177 | .put_hsync = poodle_null_hsync, | ||
178 | .wait_hsync = poodle_null_hsync, | ||
179 | }; | ||
180 | |||
181 | static struct platform_device poodle_ts_device = { | ||
182 | .name = "corgi-ts", | ||
183 | .dev = { | ||
184 | .platform_data = &poodle_ts_machinfo, | ||
185 | }, | ||
186 | .id = -1, | ||
187 | .num_resources = ARRAY_SIZE(poodlets_resources), | ||
188 | .resource = poodlets_resources, | ||
189 | }; | ||
190 | |||
127 | 191 | ||
128 | /* | 192 | /* |
129 | * MMC/SD Device | 193 | * MMC/SD Device |
@@ -141,7 +205,9 @@ static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)( | |||
141 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | 205 | pxa_gpio_mode(GPIO6_MMCCLK_MD); |
142 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | 206 | pxa_gpio_mode(GPIO8_MMCCS0_MD); |
143 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); | 207 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); |
208 | pxa_gpio_mode(POODLE_GPIO_nSD_WP | GPIO_IN); | ||
144 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); | 209 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); |
210 | pxa_gpio_mode(POODLE_GPIO_SD_PWR1 | GPIO_OUT); | ||
145 | 211 | ||
146 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 212 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
147 | 213 | ||
@@ -160,12 +226,22 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd) | |||
160 | { | 226 | { |
161 | struct pxamci_platform_data* p_d = dev->platform_data; | 227 | struct pxamci_platform_data* p_d = dev->platform_data; |
162 | 228 | ||
163 | if (( 1 << vdd) & p_d->ocr_mask) | 229 | if (( 1 << vdd) & p_d->ocr_mask) { |
164 | GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 230 | GPSR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); |
165 | else | 231 | mdelay(2); |
166 | GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 232 | GPSR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); |
233 | } else { | ||
234 | GPCR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); | ||
235 | GPCR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); | ||
236 | } | ||
237 | } | ||
238 | |||
239 | static int poodle_mci_get_ro(struct device *dev) | ||
240 | { | ||
241 | return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP); | ||
167 | } | 242 | } |
168 | 243 | ||
244 | |||
169 | static void poodle_mci_exit(struct device *dev, void *data) | 245 | static void poodle_mci_exit(struct device *dev, void *data) |
170 | { | 246 | { |
171 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); | 247 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); |
@@ -174,6 +250,7 @@ static void poodle_mci_exit(struct device *dev, void *data) | |||
174 | static struct pxamci_platform_data poodle_mci_platform_data = { | 250 | static struct pxamci_platform_data poodle_mci_platform_data = { |
175 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 251 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
176 | .init = poodle_mci_init, | 252 | .init = poodle_mci_init, |
253 | .get_ro = poodle_mci_get_ro, | ||
177 | .setpower = poodle_mci_setpower, | 254 | .setpower = poodle_mci_setpower, |
178 | .exit = poodle_mci_exit, | 255 | .exit = poodle_mci_exit, |
179 | }; | 256 | }; |
@@ -243,14 +320,31 @@ static struct pxafb_mach_info poodle_fb_info __initdata = { | |||
243 | }; | 320 | }; |
244 | 321 | ||
245 | static struct platform_device *devices[] __initdata = { | 322 | static struct platform_device *devices[] __initdata = { |
246 | &locomo_device, | 323 | &poodle_locomo_device, |
247 | &poodle_scoop_device, | 324 | &poodle_scoop_device, |
325 | &poodle_ssp_device, | ||
326 | &poodle_ts_device, | ||
248 | }; | 327 | }; |
249 | 328 | ||
329 | static void poodle_poweroff(void) | ||
330 | { | ||
331 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
332 | arm_machine_restart('h'); | ||
333 | } | ||
334 | |||
335 | static void poodle_restart(char mode) | ||
336 | { | ||
337 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
338 | arm_machine_restart('h'); | ||
339 | } | ||
340 | |||
250 | static void __init poodle_init(void) | 341 | static void __init poodle_init(void) |
251 | { | 342 | { |
252 | int ret = 0; | 343 | int ret = 0; |
253 | 344 | ||
345 | pm_power_off = poodle_poweroff; | ||
346 | arm_pm_restart = poodle_restart; | ||
347 | |||
254 | /* setup sleep mode values */ | 348 | /* setup sleep mode values */ |
255 | PWER = 0x00000002; | 349 | PWER = 0x00000002; |
256 | PFER = 0x00000000; | 350 | PFER = 0x00000000; |
@@ -288,6 +382,7 @@ static void __init poodle_init(void) | |||
288 | GPSR1 = 0x00000000; | 382 | GPSR1 = 0x00000000; |
289 | GPSR2 = 0x00000000; | 383 | GPSR2 = 0x00000000; |
290 | 384 | ||
385 | set_pxa_fb_parent(&poodle_locomo_device.dev); | ||
291 | set_pxa_fb_info(&poodle_fb_info); | 386 | set_pxa_fb_info(&poodle_fb_info); |
292 | pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT); | 387 | pxa_gpio_mode(POODLE_GPIO_USB_PULLUP | GPIO_OUT); |
293 | pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT); | 388 | pxa_gpio_mode(POODLE_GPIO_IR_ON | GPIO_OUT); |
@@ -301,6 +396,7 @@ static void __init poodle_init(void) | |||
301 | if (ret) { | 396 | if (ret) { |
302 | printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n"); | 397 | printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n"); |
303 | } | 398 | } |
399 | corgi_ssp_set_machinfo(&poodle_ssp_machinfo); | ||
304 | } | 400 | } |
305 | 401 | ||
306 | static void __init fixup_poodle(struct machine_desc *desc, | 402 | static void __init fixup_poodle(struct machine_desc *desc, |
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c index 6d402b262d8a..0f1648780c41 100644 --- a/arch/arm/mach-pxa/sharpsl_pm.c +++ b/arch/arm/mach-pxa/sharpsl_pm.c | |||
@@ -128,6 +128,9 @@ struct battery_thresh spitz_battery_levels_noac[] = { | |||
128 | */ | 128 | */ |
129 | int sharpsl_pm_pxa_read_max1111(int channel) | 129 | int sharpsl_pm_pxa_read_max1111(int channel) |
130 | { | 130 | { |
131 | if (machine_is_tosa()) // Ugly, better move this function into another module | ||
132 | return 0; | ||
133 | |||
131 | return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1 | 134 | return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1 |
132 | | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); | 135 | | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); |
133 | } | 136 | } |
@@ -156,7 +159,7 @@ void sharpsl_pm_pxa_init(void) | |||
156 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal),IRQT_FALLING); | 159 | else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal),IRQT_FALLING); |
157 | } | 160 | } |
158 | 161 | ||
159 | if (!machine_is_corgi()) | 162 | if (sharpsl_pm.machinfo->batfull_irq) |
160 | { | 163 | { |
161 | /* Register interrupt handler. */ | 164 | /* Register interrupt handler. */ |
162 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, SA_INTERRUPT, "CO", sharpsl_chrg_full_isr)) { | 165 | if (request_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr, SA_INTERRUPT, "CO", sharpsl_chrg_full_isr)) { |
@@ -174,6 +177,6 @@ void sharpsl_pm_pxa_remove(void) | |||
174 | if (sharpsl_pm.machinfo->gpio_fatal) | 177 | if (sharpsl_pm.machinfo->gpio_fatal) |
175 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr); | 178 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_fatal), sharpsl_fatal_isr); |
176 | 179 | ||
177 | if (!machine_is_corgi()) | 180 | if (sharpsl_pm.machinfo->batfull_irq) |
178 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); | 181 | free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); |
179 | } | 182 | } |
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 44bcb8097c7a..eb9937f6f5cd 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/fs.h> | 20 | #include <linux/fs.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/mmc/host.h> | 22 | #include <linux/mmc/host.h> |
23 | #include <linux/pm.h> | ||
23 | 24 | ||
24 | #include <asm/setup.h> | 25 | #include <asm/setup.h> |
25 | #include <asm/memory.h> | 26 | #include <asm/memory.h> |
@@ -27,6 +28,7 @@ | |||
27 | #include <asm/hardware.h> | 28 | #include <asm/hardware.h> |
28 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
31 | #include <asm/system.h> | ||
30 | 32 | ||
31 | #include <asm/mach/arch.h> | 33 | #include <asm/mach/arch.h> |
32 | #include <asm/mach/map.h> | 34 | #include <asm/mach/map.h> |
@@ -432,8 +434,31 @@ static struct platform_device *devices[] __initdata = { | |||
432 | &spitzled_device, | 434 | &spitzled_device, |
433 | }; | 435 | }; |
434 | 436 | ||
437 | static void spitz_poweroff(void) | ||
438 | { | ||
439 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
440 | |||
441 | pxa_gpio_mode(SPITZ_GPIO_ON_RESET | GPIO_OUT); | ||
442 | GPSR(SPITZ_GPIO_ON_RESET) = GPIO_bit(SPITZ_GPIO_ON_RESET); | ||
443 | |||
444 | mdelay(1000); | ||
445 | arm_machine_restart('h'); | ||
446 | } | ||
447 | |||
448 | static void spitz_restart(char mode) | ||
449 | { | ||
450 | /* Bootloader magic for a reboot */ | ||
451 | if((MSC0 & 0xffff0000) == 0x7ff00000) | ||
452 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; | ||
453 | |||
454 | spitz_poweroff(); | ||
455 | } | ||
456 | |||
435 | static void __init common_init(void) | 457 | static void __init common_init(void) |
436 | { | 458 | { |
459 | pm_power_off = spitz_poweroff; | ||
460 | arm_pm_restart = spitz_restart; | ||
461 | |||
437 | PMCR = 0x00; | 462 | PMCR = 0x00; |
438 | 463 | ||
439 | /* setup sleep mode values */ | 464 | /* setup sleep mode values */ |
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c index 5e5bdc898482..40be833079c7 100644 --- a/arch/arm/mach-pxa/spitz_pm.c +++ b/arch/arm/mach-pxa/spitz_pm.c | |||
@@ -27,6 +27,13 @@ | |||
27 | #include <asm/arch/pxa-regs.h> | 27 | #include <asm/arch/pxa-regs.h> |
28 | #include "sharpsl.h" | 28 | #include "sharpsl.h" |
29 | 29 | ||
30 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | ||
31 | #define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ | ||
32 | #define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */ | ||
33 | #define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */ | ||
34 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ | ||
35 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ | ||
36 | |||
30 | static int spitz_last_ac_status; | 37 | static int spitz_last_ac_status; |
31 | 38 | ||
32 | static void spitz_charger_init(void) | 39 | static void spitz_charger_init(void) |
@@ -190,6 +197,7 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = { | |||
190 | .gpio_batlock = SPITZ_GPIO_BAT_COVER, | 197 | .gpio_batlock = SPITZ_GPIO_BAT_COVER, |
191 | .gpio_acin = SPITZ_GPIO_AC_IN, | 198 | .gpio_acin = SPITZ_GPIO_AC_IN, |
192 | .gpio_batfull = SPITZ_GPIO_CHRG_FULL, | 199 | .gpio_batfull = SPITZ_GPIO_CHRG_FULL, |
200 | .batfull_irq = 1, | ||
193 | .gpio_fatal = SPITZ_GPIO_FATAL_BAT, | 201 | .gpio_fatal = SPITZ_GPIO_FATAL_BAT, |
194 | .discharge = spitz_discharge, | 202 | .discharge = spitz_discharge, |
195 | .discharge1 = spitz_discharge1, | 203 | .discharge1 = spitz_discharge1, |
@@ -200,6 +208,13 @@ struct sharpsl_charger_machinfo spitz_pm_machinfo = { | |||
200 | .read_devdata = spitzpm_read_devdata, | 208 | .read_devdata = spitzpm_read_devdata, |
201 | .charger_wakeup = spitz_charger_wakeup, | 209 | .charger_wakeup = spitz_charger_wakeup, |
202 | .should_wakeup = spitz_should_wakeup, | 210 | .should_wakeup = spitz_should_wakeup, |
211 | .backlight_limit = corgibl_limit_intensity, | ||
212 | .charge_on_volt = SHARPSL_CHARGE_ON_VOLT, | ||
213 | .charge_on_temp = SHARPSL_CHARGE_ON_TEMP, | ||
214 | .charge_acin_high = SHARPSL_CHARGE_ON_ACIN_HIGH, | ||
215 | .charge_acin_low = SHARPSL_CHARGE_ON_ACIN_LOW, | ||
216 | .fatal_acin_volt = SHARPSL_FATAL_ACIN_VOLT, | ||
217 | .fatal_noacin_volt= SHARPSL_FATAL_NOACIN_VOLT, | ||
203 | .bat_levels = 40, | 218 | .bat_levels = 40, |
204 | .bat_levels_noac = spitz_battery_levels_noac, | 219 | .bat_levels_noac = spitz_battery_levels_noac, |
205 | .bat_levels_acin = spitz_battery_levels_acin, | 220 | .bat_levels_acin = spitz_battery_levels_acin, |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 76c0e7f0a219..afa223b9e7a2 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -19,12 +19,14 @@ | |||
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/mmc/host.h> | 21 | #include <linux/mmc/host.h> |
22 | #include <linux/pm.h> | ||
22 | 23 | ||
23 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
24 | #include <asm/memory.h> | 25 | #include <asm/memory.h> |
25 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
26 | #include <asm/hardware.h> | 27 | #include <asm/hardware.h> |
27 | #include <asm/irq.h> | 28 | #include <asm/irq.h> |
29 | #include <asm/system.h> | ||
28 | #include <asm/arch/irda.h> | 30 | #include <asm/arch/irda.h> |
29 | #include <asm/arch/mmc.h> | 31 | #include <asm/arch/mmc.h> |
30 | #include <asm/arch/udc.h> | 32 | #include <asm/arch/udc.h> |
@@ -266,8 +268,31 @@ static struct platform_device *devices[] __initdata = { | |||
266 | &tosaled_device, | 268 | &tosaled_device, |
267 | }; | 269 | }; |
268 | 270 | ||
271 | static void tosa_poweroff(void) | ||
272 | { | ||
273 | RCSR = RCSR_HWR | RCSR_WDR | RCSR_SMR | RCSR_GPR; | ||
274 | |||
275 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_OUT); | ||
276 | GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET); | ||
277 | |||
278 | mdelay(1000); | ||
279 | arm_machine_restart('h'); | ||
280 | } | ||
281 | |||
282 | static void tosa_restart(char mode) | ||
283 | { | ||
284 | /* Bootloader magic for a reboot */ | ||
285 | if((MSC0 & 0xffff0000) == 0x7ff00000) | ||
286 | MSC0 = (MSC0 & 0xffff) | 0x7ee00000; | ||
287 | |||
288 | tosa_poweroff(); | ||
289 | } | ||
290 | |||
269 | static void __init tosa_init(void) | 291 | static void __init tosa_init(void) |
270 | { | 292 | { |
293 | pm_power_off = tosa_poweroff; | ||
294 | arm_pm_restart = tosa_restart; | ||
295 | |||
271 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); | 296 | pxa_gpio_mode(TOSA_GPIO_ON_RESET | GPIO_IN); |
272 | pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); | 297 | pxa_gpio_mode(TOSA_GPIO_TC6393_INT | GPIO_IN); |
273 | pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); | 298 | pxa_gpio_mode(TOSA_GPIO_USB_IN | GPIO_IN); |