aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 13:07:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-12 13:07:32 -0400
commitce4327d372af7e2f2d403286e9904ab012e72827 (patch)
treeaa95c33aa9277d3ecb4d7c46cee13c8b59611c7c /arch
parent4032816dca04141e3d49ec4ed717c9f7cc5444c5 (diff)
parentb5d643de3ea28d7844a3a1a00a0a6f50897a2a6b (diff)
Merge branch 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm
* 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm: msm: mmc: Add msm prefix to platform data structure msm: trout: Remove extern declaration from source file arm: msm: Fix section mismatch in smd.c. arm: msm: trout add mmc support arm: msm: trout: add trout specific gpio interrupts arm: msm: remove unused #include <linux/version.h>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-msm/Makefile2
-rw-r--r--arch/arm/mach-msm/acpuclock-arm11.c1
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c115
-rw-r--r--arch/arm/mach-msm/board-trout-mmc.c186
-rw-r--r--arch/arm/mach-msm/board-trout.c11
-rw-r--r--arch/arm/mach-msm/clock.c1
-rw-r--r--arch/arm/mach-msm/devices-msm7x00.c3
-rw-r--r--arch/arm/mach-msm/include/mach/board.h4
-rw-r--r--arch/arm/mach-msm/include/mach/mmc.h2
-rw-r--r--arch/arm/mach-msm/smd.c2
10 files changed, 321 insertions, 6 deletions
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 7ff8020d4d24..704610648a25 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
15obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 15obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
16obj-$(CONFIG_MSM_SMD) += last_radio_log.o 16obj-$(CONFIG_MSM_SMD) += last_radio_log.o
17 17
18obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o devices-msm7x00.o 18obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o
19obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 19obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
20obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 20obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
21obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 21obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
diff --git a/arch/arm/mach-msm/acpuclock-arm11.c b/arch/arm/mach-msm/acpuclock-arm11.c
index f060a3959a75..7ffbd987eb5d 100644
--- a/arch/arm/mach-msm/acpuclock-arm11.c
+++ b/arch/arm/mach-msm/acpuclock-arm11.c
@@ -17,7 +17,6 @@
17 * 17 *
18 */ 18 */
19 19
20#include <linux/version.h>
21#include <linux/kernel.h> 20#include <linux/kernel.h>
22#include <linux/init.h> 21#include <linux/init.h>
23#include <linux/list.h> 22#include <linux/list.h>
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
index 523d213bf79e..c50f3afc3134 100644
--- a/arch/arm/mach-msm/board-trout-gpio.c
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -15,10 +15,20 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h>
18#include <linux/gpio.h> 19#include <linux/gpio.h>
19 20
20#include "board-trout.h" 21#include "board-trout.h"
21 22
23static uint8_t trout_int_mask[2] = {
24 [0] = 0xff, /* mask all interrupts */
25 [1] = 0xff,
26};
27static uint8_t trout_sleep_int_mask[] = {
28 [0] = 0xff,
29 [1] = 0xff,
30};
31
22struct msm_gpio_chip { 32struct msm_gpio_chip {
23 struct gpio_chip chip; 33 struct gpio_chip chip;
24 void __iomem *reg; /* Base of register bank */ 34 void __iomem *reg; /* Base of register bank */
@@ -95,16 +105,121 @@ static struct msm_gpio_chip msm_gpio_banks[] = {
95 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0), 105 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0),
96}; 106};
97 107
108static void trout_gpio_irq_ack(unsigned int irq)
109{
110 int bank = TROUT_INT_TO_BANK(irq);
111 uint8_t mask = TROUT_INT_TO_MASK(irq);
112 int reg = TROUT_BANK_TO_STAT_REG(bank);
113 /*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", irq);*/
114 writeb(mask, TROUT_CPLD_BASE + reg);
115}
116
117static void trout_gpio_irq_mask(unsigned int irq)
118{
119 unsigned long flags;
120 uint8_t reg_val;
121 int bank = TROUT_INT_TO_BANK(irq);
122 uint8_t mask = TROUT_INT_TO_MASK(irq);
123 int reg = TROUT_BANK_TO_MASK_REG(bank);
124
125 local_irq_save(flags);
126 reg_val = trout_int_mask[bank] |= mask;
127 /*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n",
128 irq, bank, reg_val);*/
129 writeb(reg_val, TROUT_CPLD_BASE + reg);
130 local_irq_restore(flags);
131}
132
133static void trout_gpio_irq_unmask(unsigned int irq)
134{
135 unsigned long flags;
136 uint8_t reg_val;
137 int bank = TROUT_INT_TO_BANK(irq);
138 uint8_t mask = TROUT_INT_TO_MASK(irq);
139 int reg = TROUT_BANK_TO_MASK_REG(bank);
140
141 local_irq_save(flags);
142 reg_val = trout_int_mask[bank] &= ~mask;
143 /*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n",
144 irq, bank, reg_val);*/
145 writeb(reg_val, TROUT_CPLD_BASE + reg);
146 local_irq_restore(flags);
147}
148
149int trout_gpio_irq_set_wake(unsigned int irq, unsigned int on)
150{
151 unsigned long flags;
152 int bank = TROUT_INT_TO_BANK(irq);
153 uint8_t mask = TROUT_INT_TO_MASK(irq);
154
155 local_irq_save(flags);
156 if(on)
157 trout_sleep_int_mask[bank] &= ~mask;
158 else
159 trout_sleep_int_mask[bank] |= mask;
160 local_irq_restore(flags);
161 return 0;
162}
163
164static void trout_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
165{
166 int j, m;
167 unsigned v;
168 int bank;
169 int stat_reg;
170 int int_base = TROUT_INT_START;
171 uint8_t int_mask;
172
173 for (bank = 0; bank < 2; bank++) {
174 stat_reg = TROUT_BANK_TO_STAT_REG(bank);
175 v = readb(TROUT_CPLD_BASE + stat_reg);
176 int_mask = trout_int_mask[bank];
177 if (v & int_mask) {
178 writeb(v & int_mask, TROUT_CPLD_BASE + stat_reg);
179 printk(KERN_ERR "trout_gpio_irq_handler: got masked "
180 "interrupt: %d:%02x\n", bank, v & int_mask);
181 }
182 v &= ~int_mask;
183 while (v) {
184 m = v & -v;
185 j = fls(m) - 1;
186 /*printk(KERN_INFO "msm_gpio_irq_handler %d:%02x %02x b"
187 "it %d irq %d\n", bank, v, m, j, int_base + j);*/
188 v &= ~m;
189 generic_handle_irq(int_base + j);
190 }
191 int_base += TROUT_INT_BANK0_COUNT;
192 }
193 desc->chip->ack(irq);
194}
195
196static struct irq_chip trout_gpio_irq_chip = {
197 .name = "troutgpio",
198 .ack = trout_gpio_irq_ack,
199 .mask = trout_gpio_irq_mask,
200 .unmask = trout_gpio_irq_unmask,
201 .set_wake = trout_gpio_irq_set_wake,
202};
203
98/* 204/*
99 * Called from the processor-specific init to enable GPIO pin support. 205 * Called from the processor-specific init to enable GPIO pin support.
100 */ 206 */
101int __init trout_init_gpio(void) 207int __init trout_init_gpio(void)
102{ 208{
103 int i; 209 int i;
210 for(i = TROUT_INT_START; i <= TROUT_INT_END; i++) {
211 set_irq_chip(i, &trout_gpio_irq_chip);
212 set_irq_handler(i, handle_edge_irq);
213 set_irq_flags(i, IRQF_VALID);
214 }
104 215
105 for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++) 216 for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++)
106 gpiochip_add(&msm_gpio_banks[i].chip); 217 gpiochip_add(&msm_gpio_banks[i].chip);
107 218
219 set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH);
220 set_irq_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler);
221 set_irq_wake(MSM_GPIO_TO_INT(17), 1);
222
108 return 0; 223 return 0;
109} 224}
110 225
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
new file mode 100644
index 000000000000..44be8464657b
--- /dev/null
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -0,0 +1,186 @@
1/* linux/arch/arm/mach-msm/board-trout-mmc.c
2** Author: Brian Swetland <swetland@google.com>
3*/
4
5#include <linux/kernel.h>
6#include <linux/init.h>
7#include <linux/platform_device.h>
8#include <linux/delay.h>
9#include <linux/mmc/host.h>
10#include <linux/mmc/sdio_ids.h>
11#include <linux/err.h>
12#include <linux/debugfs.h>
13
14#include <asm/gpio.h>
15#include <asm/io.h>
16
17#include <mach/vreg.h>
18
19#include <mach/mmc.h>
20
21#include "devices.h"
22
23#include "board-trout.h"
24
25#include "proc_comm.h"
26
27#define DEBUG_SDSLOT_VDD 1
28
29/* ---- COMMON ---- */
30static void config_gpio_table(uint32_t *table, int len)
31{
32 int n;
33 unsigned id;
34 for(n = 0; n < len; n++) {
35 id = table[n];
36 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &id, 0);
37 }
38}
39
40/* ---- SDCARD ---- */
41
42static uint32_t sdcard_on_gpio_table[] = {
43 PCOM_GPIO_CFG(62, 2, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_8MA), /* CLK */
44 PCOM_GPIO_CFG(63, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* CMD */
45 PCOM_GPIO_CFG(64, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT3 */
46 PCOM_GPIO_CFG(65, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_8MA), /* DAT2 */
47 PCOM_GPIO_CFG(66, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT1 */
48 PCOM_GPIO_CFG(67, 2, GPIO_OUTPUT, GPIO_PULL_UP, GPIO_4MA), /* DAT0 */
49};
50
51static uint32_t sdcard_off_gpio_table[] = {
52 PCOM_GPIO_CFG(62, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CLK */
53 PCOM_GPIO_CFG(63, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* CMD */
54 PCOM_GPIO_CFG(64, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT3 */
55 PCOM_GPIO_CFG(65, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT2 */
56 PCOM_GPIO_CFG(66, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT1 */
57 PCOM_GPIO_CFG(67, 0, GPIO_OUTPUT, GPIO_NO_PULL, GPIO_4MA), /* DAT0 */
58};
59
60static uint opt_disable_sdcard;
61
62static int __init trout_disablesdcard_setup(char *str)
63{
64 int cal = simple_strtol(str, NULL, 0);
65
66 opt_disable_sdcard = cal;
67 return 1;
68}
69
70__setup("board_trout.disable_sdcard=", trout_disablesdcard_setup);
71
72static struct vreg *vreg_sdslot; /* SD slot power */
73
74struct mmc_vdd_xlat {
75 int mask;
76 int level;
77};
78
79static struct mmc_vdd_xlat mmc_vdd_table[] = {
80 { MMC_VDD_165_195, 1800 },
81 { MMC_VDD_20_21, 2050 },
82 { MMC_VDD_21_22, 2150 },
83 { MMC_VDD_22_23, 2250 },
84 { MMC_VDD_23_24, 2350 },
85 { MMC_VDD_24_25, 2450 },
86 { MMC_VDD_25_26, 2550 },
87 { MMC_VDD_26_27, 2650 },
88 { MMC_VDD_27_28, 2750 },
89 { MMC_VDD_28_29, 2850 },
90 { MMC_VDD_29_30, 2950 },
91};
92
93static unsigned int sdslot_vdd = 0xffffffff;
94static unsigned int sdslot_vreg_enabled;
95
96static uint32_t trout_sdslot_switchvdd(struct device *dev, unsigned int vdd)
97{
98 int i, rc;
99
100 BUG_ON(!vreg_sdslot);
101
102 if (vdd == sdslot_vdd)
103 return 0;
104
105 sdslot_vdd = vdd;
106
107 if (vdd == 0) {
108#if DEBUG_SDSLOT_VDD
109 printk("%s: Disabling SD slot power\n", __func__);
110#endif
111 config_gpio_table(sdcard_off_gpio_table,
112 ARRAY_SIZE(sdcard_off_gpio_table));
113 vreg_disable(vreg_sdslot);
114 sdslot_vreg_enabled = 0;
115 return 0;
116 }
117
118 if (!sdslot_vreg_enabled) {
119 rc = vreg_enable(vreg_sdslot);
120 if (rc) {
121 printk(KERN_ERR "%s: Error enabling vreg (%d)\n",
122 __func__, rc);
123 }
124 config_gpio_table(sdcard_on_gpio_table,
125 ARRAY_SIZE(sdcard_on_gpio_table));
126 sdslot_vreg_enabled = 1;
127 }
128
129 for (i = 0; i < ARRAY_SIZE(mmc_vdd_table); i++) {
130 if (mmc_vdd_table[i].mask == (1 << vdd)) {
131#if DEBUG_SDSLOT_VDD
132 printk("%s: Setting level to %u\n",
133 __func__, mmc_vdd_table[i].level);
134#endif
135 rc = vreg_set_level(vreg_sdslot,
136 mmc_vdd_table[i].level);
137 if (rc) {
138 printk(KERN_ERR
139 "%s: Error setting vreg level (%d)\n",
140 __func__, rc);
141 }
142 return 0;
143 }
144 }
145
146 printk(KERN_ERR "%s: Invalid VDD %d specified\n", __func__, vdd);
147 return 0;
148}
149
150static unsigned int trout_sdslot_status(struct device *dev)
151{
152 unsigned int status;
153
154 status = (unsigned int) gpio_get_value(TROUT_GPIO_SDMC_CD_N);
155 return (!status);
156}
157
158#define TROUT_MMC_VDD MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
159 | MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
160 | MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
161 | MMC_VDD_28_29 | MMC_VDD_29_30
162
163static struct msm_mmc_platform_data trout_sdslot_data = {
164 .ocr_mask = TROUT_MMC_VDD,
165 .status = trout_sdslot_status,
166 .translate_vdd = trout_sdslot_switchvdd,
167};
168
169int __init trout_init_mmc(unsigned int sys_rev)
170{
171 sdslot_vreg_enabled = 0;
172
173 vreg_sdslot = vreg_get(0, "gp6");
174 if (IS_ERR(vreg_sdslot))
175 return PTR_ERR(vreg_sdslot);
176
177 set_irq_wake(TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 1);
178
179 if (!opt_disable_sdcard)
180 msm_add_sdcc(2, &trout_sdslot_data,
181 TROUT_GPIO_TO_INT(TROUT_GPIO_SDMC_CD_N), 0);
182 else
183 printk(KERN_INFO "trout: SD-Card interface disabled\n");
184 return 0;
185}
186
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index e69a1502e4e8..469e0be3499d 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -30,6 +30,8 @@
30#include "devices.h" 30#include "devices.h"
31#include "board-trout.h" 31#include "board-trout.h"
32 32
33extern int trout_init_mmc(unsigned int);
34
33static struct platform_device *devices[] __initdata = { 35static struct platform_device *devices[] __initdata = {
34 &msm_device_uart3, 36 &msm_device_uart3,
35 &msm_device_smd, 37 &msm_device_smd,
@@ -55,7 +57,16 @@ static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
55 57
56static void __init trout_init(void) 58static void __init trout_init(void)
57{ 59{
60 int rc;
61
58 platform_add_devices(devices, ARRAY_SIZE(devices)); 62 platform_add_devices(devices, ARRAY_SIZE(devices));
63
64#ifdef CONFIG_MMC
65 rc = trout_init_mmc(system_rev);
66 if (rc)
67 printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc);
68#endif
69
59} 70}
60 71
61static struct map_desc trout_io_desc[] __initdata = { 72static struct map_desc trout_io_desc[] __initdata = {
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 9cb1276ab749..c57210f4f06a 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -14,7 +14,6 @@
14 * 14 *
15 */ 15 */
16 16
17#include <linux/version.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/init.h> 18#include <linux/init.h>
20#include <linux/module.h> 19#include <linux/module.h>
diff --git a/arch/arm/mach-msm/devices-msm7x00.c b/arch/arm/mach-msm/devices-msm7x00.c
index fde9d8f69f10..4e8c0bcdc92d 100644
--- a/arch/arm/mach-msm/devices-msm7x00.c
+++ b/arch/arm/mach-msm/devices-msm7x00.c
@@ -322,7 +322,8 @@ static struct platform_device *msm_sdcc_devices[] __initdata = {
322 &msm_device_sdc4, 322 &msm_device_sdc4,
323}; 323};
324 324
325int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat, 325int __init msm_add_sdcc(unsigned int controller,
326 struct msm_mmc_platform_data *plat,
326 unsigned int stat_irq, unsigned long stat_irq_flags) 327 unsigned int stat_irq, unsigned long stat_irq_flags)
327{ 328{
328 struct platform_device *pdev; 329 struct platform_device *pdev;
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index e302fbdc439b..5a79bcf50413 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -18,6 +18,7 @@
18#define __ASM_ARCH_MSM_BOARD_H 18#define __ASM_ARCH_MSM_BOARD_H
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <mach/mmc.h>
21 22
22/* platform device data structures */ 23/* platform device data structures */
23 24
@@ -40,5 +41,8 @@ void __init msm_init_irq(void);
40void __init msm_init_gpio(void); 41void __init msm_init_gpio(void);
41void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks); 42void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks);
42void __init msm_acpu_clock_init(struct msm_acpu_clock_platform_data *); 43void __init msm_acpu_clock_init(struct msm_acpu_clock_platform_data *);
44int __init msm_add_sdcc(unsigned int controller,
45 struct msm_mmc_platform_data *plat,
46 unsigned int stat_irq, unsigned long stat_irq_flags);
43 47
44#endif 48#endif
diff --git a/arch/arm/mach-msm/include/mach/mmc.h b/arch/arm/mach-msm/include/mach/mmc.h
index 0ecf25426284..d54b6b086cff 100644
--- a/arch/arm/mach-msm/include/mach/mmc.h
+++ b/arch/arm/mach-msm/include/mach/mmc.h
@@ -15,7 +15,7 @@ struct embedded_sdio_data {
15 int num_funcs; 15 int num_funcs;
16}; 16};
17 17
18struct mmc_platform_data { 18struct msm_mmc_platform_data {
19 unsigned int ocr_mask; /* available voltages */ 19 unsigned int ocr_mask; /* available voltages */
20 u32 (*translate_vdd)(struct device *, unsigned int); 20 u32 (*translate_vdd)(struct device *, unsigned int);
21 unsigned int (*status)(struct device *); 21 unsigned int (*status)(struct device *);
diff --git a/arch/arm/mach-msm/smd.c b/arch/arm/mach-msm/smd.c
index cf11d414b425..f07dc7c738f0 100644
--- a/arch/arm/mach-msm/smd.c
+++ b/arch/arm/mach-msm/smd.c
@@ -997,7 +997,7 @@ int smd_core_init(void)
997 return 0; 997 return 0;
998} 998}
999 999
1000static int __init msm_smd_probe(struct platform_device *pdev) 1000static int __devinit msm_smd_probe(struct platform_device *pdev)
1001{ 1001{
1002 pr_info("smd_init()\n"); 1002 pr_info("smd_init()\n");
1003 1003