aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sa1100
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2009-12-06 11:53:09 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-12-06 11:53:12 -0500
commitba71e17269633ea36e776d744d5cc0fcb5a41f93 (patch)
tree0a51c86e5c218ac2ae74ff8193880a64053a77bc /arch/arm/mach-sa1100
parent729fae44dd8332cbf5b9d05a9af17a7455e165b2 (diff)
parent9823b2d0f9547742fc40857f9ef153d6956266f2 (diff)
Merge branch 'for-lak' of git://git.linuxtogo.org/home/thesing/collie into sa1100
Diffstat (limited to 'arch/arm/mach-sa1100')
-rw-r--r--arch/arm/mach-sa1100/collie.c79
-rw-r--r--arch/arm/mach-sa1100/include/mach/collie.h77
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h19
-rw-r--r--arch/arm/mach-sa1100/include/mach/mcp.h1
4 files changed, 123 insertions, 53 deletions
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index be7e5a3c47d0..9982c5c28edf 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -26,6 +26,7 @@
26#include <linux/mtd/partitions.h> 26#include <linux/mtd/partitions.h>
27#include <linux/timer.h> 27#include <linux/timer.h>
28#include <linux/gpio.h> 28#include <linux/gpio.h>
29#include <linux/pda_power.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -56,6 +57,7 @@ static struct resource collie_scoop_resources[] = {
56static struct scoop_config collie_scoop_setup = { 57static struct scoop_config collie_scoop_setup = {
57 .io_dir = COLLIE_SCOOP_IO_DIR, 58 .io_dir = COLLIE_SCOOP_IO_DIR,
58 .io_out = COLLIE_SCOOP_IO_OUT, 59 .io_out = COLLIE_SCOOP_IO_OUT,
60 .gpio_base = COLLIE_SCOOP_GPIO_BASE,
59}; 61};
60 62
61struct platform_device colliescoop_device = { 63struct platform_device colliescoop_device = {
@@ -85,6 +87,70 @@ static struct scoop_pcmcia_config collie_pcmcia_config = {
85static struct mcp_plat_data collie_mcp_data = { 87static struct mcp_plat_data collie_mcp_data = {
86 .mccr0 = MCCR0_ADM | MCCR0_ExtClk, 88 .mccr0 = MCCR0_ADM | MCCR0_ExtClk,
87 .sclk_rate = 9216000, 89 .sclk_rate = 9216000,
90 .gpio_base = COLLIE_TC35143_GPIO_BASE,
91};
92
93/*
94 * Collie AC IN
95 */
96static int collie_power_init(struct device *dev)
97{
98 int ret = gpio_request(COLLIE_GPIO_AC_IN, "ac in");
99 if (ret)
100 goto err_gpio_req;
101
102 ret = gpio_direction_input(COLLIE_GPIO_AC_IN);
103 if (ret)
104 goto err_gpio_in;
105
106 return 0;
107
108err_gpio_in:
109 gpio_free(COLLIE_GPIO_AC_IN);
110err_gpio_req:
111 return ret;
112}
113
114static void collie_power_exit(struct device *dev)
115{
116 gpio_free(COLLIE_GPIO_AC_IN);
117}
118
119static int collie_power_ac_online(void)
120{
121 return gpio_get_value(COLLIE_GPIO_AC_IN) == 2;
122}
123
124static char *collie_ac_supplied_to[] = {
125 "main-battery",
126 "backup-battery",
127};
128
129static struct pda_power_pdata collie_power_data = {
130 .init = collie_power_init,
131 .is_ac_online = collie_power_ac_online,
132 .exit = collie_power_exit,
133 .supplied_to = collie_ac_supplied_to,
134 .num_supplicants = ARRAY_SIZE(collie_ac_supplied_to),
135};
136
137static struct resource collie_power_resource[] = {
138 {
139 .name = "ac",
140 .start = gpio_to_irq(COLLIE_GPIO_AC_IN),
141 .end = gpio_to_irq(COLLIE_GPIO_AC_IN),
142 .flags = IORESOURCE_IRQ |
143 IORESOURCE_IRQ_HIGHEDGE |
144 IORESOURCE_IRQ_LOWEDGE,
145 },
146};
147
148static struct platform_device collie_power_device = {
149 .name = "pda-power",
150 .id = -1,
151 .dev.platform_data = &collie_power_data,
152 .resource = collie_power_resource,
153 .num_resources = ARRAY_SIZE(collie_power_resource),
88}; 154};
89 155
90#ifdef CONFIG_SHARP_LOCOMO 156#ifdef CONFIG_SHARP_LOCOMO
@@ -178,6 +244,7 @@ struct platform_device collie_locomo_device = {
178static struct platform_device *devices[] __initdata = { 244static struct platform_device *devices[] __initdata = {
179 &collie_locomo_device, 245 &collie_locomo_device,
180 &colliescoop_device, 246 &colliescoop_device,
247 &collie_power_device,
181}; 248};
182 249
183static struct mtd_partition collie_partitions[] = { 250static struct mtd_partition collie_partitions[] = {
@@ -248,22 +315,24 @@ static void __init collie_init(void)
248 GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | 315 GPDR = GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 |
249 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | 316 GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD |
250 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | 317 GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK |
251 COLLIE_GPIO_UCB1x00_RESET | COLLIE_GPIO_nMIC_ON | 318 _COLLIE_GPIO_UCB1x00_RESET | _COLLIE_GPIO_nMIC_ON |
252 COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz; 319 _COLLIE_GPIO_nREMOCON_ON | GPIO_32_768kHz;
253 320
254 PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | 321 PPDR = PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 |
255 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS | 322 PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS |
256 PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM; 323 PPC_TXD1 | PPC_TXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM;
257 324
258 PWER = COLLIE_GPIO_AC_IN | COLLIE_GPIO_CO | COLLIE_GPIO_ON_KEY | 325 PWER = _COLLIE_GPIO_AC_IN | _COLLIE_GPIO_CO | _COLLIE_GPIO_ON_KEY |
259 COLLIE_GPIO_WAKEUP | COLLIE_GPIO_nREMOCON_INT | PWER_RTC; 326 _COLLIE_GPIO_WAKEUP | _COLLIE_GPIO_nREMOCON_INT | PWER_RTC;
260 327
261 PGSR = COLLIE_GPIO_nREMOCON_ON; 328 PGSR = _COLLIE_GPIO_nREMOCON_ON;
262 329
263 PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4; 330 PSDR = PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4;
264 331
265 PCFR = PCFR_OPDE; 332 PCFR = PCFR_OPDE;
266 333
334 GPSR |= _COLLIE_GPIO_UCB1x00_RESET;
335
267 336
268 platform_scoop_config = &collie_pcmcia_config; 337 platform_scoop_config = &collie_pcmcia_config;
269 338
diff --git a/arch/arm/mach-sa1100/include/mach/collie.h b/arch/arm/mach-sa1100/include/mach/collie.h
index 9efb569cdb60..71a0b3fdcc8c 100644
--- a/arch/arm/mach-sa1100/include/mach/collie.h
+++ b/arch/arm/mach-sa1100/include/mach/collie.h
@@ -25,29 +25,39 @@
25#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7) 25#define COLLIE_GPIO_VPEN (COLLIE_SCOOP_GPIO_BASE + 7)
26#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19 26#define COLLIE_SCP_LB_VOL_CHG SCOOP_GPCR_PA19
27 27
28#define COLLIE_SCOOP_IO_DIR ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \ 28#define COLLIE_SCOOP_IO_DIR (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R | \
29 COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \ 29 COLLIE_SCP_5VON | COLLIE_SCP_AMP_ON | \
30 COLLIE_SCP_LB_VOL_CHG ) 30 COLLIE_SCP_LB_VOL_CHG)
31#define COLLIE_SCOOP_IO_OUT ( COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R ) 31#define COLLIE_SCOOP_IO_OUT (COLLIE_SCP_MUTE_L | COLLIE_SCP_MUTE_R)
32 32
33/* GPIOs for which the generic definition doesn't say much */ 33/* GPIOs for gpiolib */
34 34
35#define COLLIE_GPIO_ON_KEY GPIO_GPIO (0) 35#define COLLIE_GPIO_ON_KEY (0)
36#define COLLIE_GPIO_AC_IN GPIO_GPIO (1) 36#define COLLIE_GPIO_AC_IN (1)
37#define COLLIE_GPIO_SDIO_INT GPIO_GPIO (11) 37#define COLLIE_GPIO_SDIO_INT (11)
38#define COLLIE_GPIO_CF_IRQ GPIO_GPIO (14) 38#define COLLIE_GPIO_CF_IRQ (14)
39#define COLLIE_GPIO_nREMOCON_INT GPIO_GPIO (15) 39#define COLLIE_GPIO_nREMOCON_INT (15)
40#define COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO (16) 40#define COLLIE_GPIO_UCB1x00_RESET (16)
41#define COLLIE_GPIO_nMIC_ON GPIO_GPIO (17) 41#define COLLIE_GPIO_nMIC_ON (17)
42#define COLLIE_GPIO_nREMOCON_ON GPIO_GPIO (18) 42#define COLLIE_GPIO_nREMOCON_ON (18)
43#define COLLIE_GPIO_CO GPIO_GPIO (20) 43#define COLLIE_GPIO_CO (20)
44#define COLLIE_GPIO_MCP_CLK GPIO_GPIO (21) 44#define COLLIE_GPIO_MCP_CLK (21)
45#define COLLIE_GPIO_CF_CD GPIO_GPIO (22) 45#define COLLIE_GPIO_CF_CD (22)
46#define COLLIE_GPIO_UCB1x00_IRQ GPIO_GPIO (23) 46#define COLLIE_GPIO_UCB1x00_IRQ (23)
47#define COLLIE_GPIO_WAKEUP GPIO_GPIO (24) 47#define COLLIE_GPIO_WAKEUP (24)
48#define COLLIE_GPIO_GA_INT GPIO_GPIO (25) 48#define COLLIE_GPIO_GA_INT (25)
49#define COLLIE_GPIO_MAIN_BAT_LOW GPIO_GPIO (26) 49#define COLLIE_GPIO_MAIN_BAT_LOW (26)
50 50
51/* GPIO definitions for direct register access */
52
53#define _COLLIE_GPIO_ON_KEY GPIO_GPIO(0)
54#define _COLLIE_GPIO_AC_IN GPIO_GPIO(1)
55#define _COLLIE_GPIO_nREMOCON_INT GPIO_GPIO(15)
56#define _COLLIE_GPIO_UCB1x00_RESET GPIO_GPIO(16)
57#define _COLLIE_GPIO_nMIC_ON GPIO_GPIO(17)
58#define _COLLIE_GPIO_nREMOCON_ON GPIO_GPIO(18)
59#define _COLLIE_GPIO_CO GPIO_GPIO(20)
60#define _COLLIE_GPIO_WAKEUP GPIO_GPIO(24)
51/* Interrupts */ 61/* Interrupts */
52 62
53#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0 63#define COLLIE_IRQ_GPIO_ON_KEY IRQ_GPIO0
@@ -70,19 +80,20 @@
70#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14 80#define COLLIE_LCM_IRQ_GPIO_nSD_WP IRQ_LOCOMO_GPIO14
71 81
72/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */ 82/* GPIO's on the TC35143AF (Toshiba Analog Frontend) */
73#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0 /* GPIO0=Version */ 83#define COLLIE_TC35143_GPIO_BASE (GPIO_MAX + 13)
74#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1 /* GPIO1=TBL_CHK */ 84#define COLLIE_TC35143_GPIO_VERSION0 UCB_IO_0
75#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2 /* GPIO2=VPNE_ON */ 85#define COLLIE_TC35143_GPIO_TBL_CHK UCB_IO_1
76#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3 /* GPIO3=IR_ON */ 86#define COLLIE_TC35143_GPIO_VPEN_ON UCB_IO_2
77#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4 /* GPIO4=AMP_ON */ 87#define COLLIE_TC35143_GPIO_IR_ON UCB_IO_3
78#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5 /* GPIO5=Version */ 88#define COLLIE_TC35143_GPIO_AMP_ON UCB_IO_4
79#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5 /* GPIO5=fs 8k LPF */ 89#define COLLIE_TC35143_GPIO_VERSION1 UCB_IO_5
80#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6 /* GPIO6=BUZZER BIAS */ 90#define COLLIE_TC35143_GPIO_FS8KLPF UCB_IO_5
81#define COLLIE_TC35143_GPIO_MBAT_ON UCB_IO_7 /* GPIO7=MBAT_ON */ 91#define COLLIE_TC35143_GPIO_BUZZER_BIAS UCB_IO_6
82#define COLLIE_TC35143_GPIO_BBAT_ON UCB_IO_8 /* GPIO8=BBAT_ON */ 92#define COLLIE_GPIO_MBAT_ON (COLLIE_TC35143_GPIO_BASE + 7)
83#define COLLIE_TC35143_GPIO_TMP_ON UCB_IO_9 /* GPIO9=TMP_ON */ 93#define COLLIE_GPIO_BBAT_ON (COLLIE_TC35143_GPIO_BASE + 8)
84#define COLLIE_TC35143_GPIO_IN ( UCB_IO_0 | UCB_IO_2 | UCB_IO_5 ) 94#define COLLIE_GPIO_TMP_ON (COLLIE_TC35143_GPIO_BASE + 9)
85#define COLLIE_TC35143_GPIO_OUT ( UCB_IO_1 | UCB_IO_3 | UCB_IO_4 | UCB_IO_6 | \ 95#define COLLIE_TC35143_GPIO_IN (UCB_IO_0 | UCB_IO_2 | UCB_IO_5)
86 UCB_IO_7 | UCB_IO_8 | UCB_IO_9 ) 96#define COLLIE_TC35143_GPIO_OUT (UCB_IO_1 | UCB_IO_3 | UCB_IO_4 \
97 | UCB_IO_6)
87 98
88#endif 99#endif
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 582a0c92da53..7befc104e9a9 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -49,20 +49,9 @@ static inline void gpio_set_value(unsigned gpio, int value)
49 49
50#define gpio_cansleep __gpio_cansleep 50#define gpio_cansleep __gpio_cansleep
51 51
52static inline unsigned gpio_to_irq(unsigned gpio) 52#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
53{ 53 (IRQ_GPIO11 - 11 + gpio))
54 if (gpio < 11) 54#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
55 return IRQ_GPIO0 + gpio; 55 (irq - IRQ_GPIO11 + 11))
56 else
57 return IRQ_GPIO11 - 11 + gpio;
58}
59
60static inline unsigned irq_to_gpio(unsigned irq)
61{
62 if (irq < IRQ_GPIO11_27)
63 return irq - IRQ_GPIO0;
64 else
65 return irq - IRQ_GPIO11 + 11;
66}
67 56
68#endif 57#endif
diff --git a/arch/arm/mach-sa1100/include/mach/mcp.h b/arch/arm/mach-sa1100/include/mach/mcp.h
index fb8b09a57ad7..ed1a331508a7 100644
--- a/arch/arm/mach-sa1100/include/mach/mcp.h
+++ b/arch/arm/mach-sa1100/include/mach/mcp.h
@@ -16,6 +16,7 @@ struct mcp_plat_data {
16 u32 mccr0; 16 u32 mccr0;
17 u32 mccr1; 17 u32 mccr1;
18 unsigned int sclk_rate; 18 unsigned int sclk_rate;
19 int gpio_base;
19}; 20};
20 21
21#endif 22#endif