Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+323 -8
+1 -1
arch/arm/mach-msm/Makefile
··· 15 15 obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 16 16 obj-$(CONFIG_MSM_SMD) += last_radio_log.o 17 17 18 - obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o devices-msm7x00.o 18 + obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o board-trout-mmc.o devices-msm7x00.o 19 19 obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 20 20 obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 21 21 obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
-1
arch/arm/mach-msm/acpuclock-arm11.c
··· 17 17 * 18 18 */ 19 19 20 - #include <linux/version.h> 21 20 #include <linux/kernel.h> 22 21 #include <linux/init.h> 23 22 #include <linux/list.h>
+115
arch/arm/mach-msm/board-trout-gpio.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/io.h> 17 17 #include <linux/irq.h> 18 + #include <linux/interrupt.h> 18 19 #include <linux/gpio.h> 19 20 20 21 #include "board-trout.h" 22 + 23 + static uint8_t trout_int_mask[2] = { 24 + [0] = 0xff, /* mask all interrupts */ 25 + [1] = 0xff, 26 + }; 27 + static uint8_t trout_sleep_int_mask[] = { 28 + [0] = 0xff, 29 + [1] = 0xff, 30 + }; 21 31 22 32 struct msm_gpio_chip { 23 33 struct gpio_chip chip; ··· 105 95 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0), 106 96 }; 107 97 98 + static void trout_gpio_irq_ack(unsigned int irq) 99 + { 100 + int bank = TROUT_INT_TO_BANK(irq); 101 + uint8_t mask = TROUT_INT_TO_MASK(irq); 102 + int reg = TROUT_BANK_TO_STAT_REG(bank); 103 + /*printk(KERN_INFO "trout_gpio_irq_ack irq %d\n", irq);*/ 104 + writeb(mask, TROUT_CPLD_BASE + reg); 105 + } 106 + 107 + static void trout_gpio_irq_mask(unsigned int irq) 108 + { 109 + unsigned long flags; 110 + uint8_t reg_val; 111 + int bank = TROUT_INT_TO_BANK(irq); 112 + uint8_t mask = TROUT_INT_TO_MASK(irq); 113 + int reg = TROUT_BANK_TO_MASK_REG(bank); 114 + 115 + local_irq_save(flags); 116 + reg_val = trout_int_mask[bank] |= mask; 117 + /*printk(KERN_INFO "trout_gpio_irq_mask irq %d => %d:%02x\n", 118 + irq, bank, reg_val);*/ 119 + writeb(reg_val, TROUT_CPLD_BASE + reg); 120 + local_irq_restore(flags); 121 + } 122 + 123 + static void trout_gpio_irq_unmask(unsigned int irq) 124 + { 125 + unsigned long flags; 126 + uint8_t reg_val; 127 + int bank = TROUT_INT_TO_BANK(irq); 128 + uint8_t mask = TROUT_INT_TO_MASK(irq); 129 + int reg = TROUT_BANK_TO_MASK_REG(bank); 130 + 131 + local_irq_save(flags); 132 + reg_val = trout_int_mask[bank] &= ~mask; 133 + /*printk(KERN_INFO "trout_gpio_irq_unmask irq %d => %d:%02x\n", 134 + irq, bank, reg_val);*/ 135 + writeb(reg_val, TROUT_CPLD_BASE + reg); 136 + local_irq_restore(flags); 137 + } 138 + 139 + int trout_gpio_irq_set_wake(unsigned int irq, unsigned int on) 140 + { 141 + unsigned long flags; 142 + int bank = TROUT_INT_TO_BANK(irq); 143 + uint8_t mask = TROUT_INT_TO_MASK(irq); 144 + 145 + local_irq_save(flags); 146 + if(on) 147 + trout_sleep_int_mask[bank] &= ~mask; 148 + else 149 + trout_sleep_int_mask[bank] |= mask; 150 + local_irq_restore(flags); 151 + return 0; 152 + } 153 + 154 + static void trout_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 155 + { 156 + int j, m; 157 + unsigned v; 158 + int bank; 159 + int stat_reg; 160 + int int_base = TROUT_INT_START; 161 + uint8_t int_mask; 162 + 163 + for (bank = 0; bank < 2; bank++) { 164 + stat_reg = TROUT_BANK_TO_STAT_REG(bank); 165 + v = readb(TROUT_CPLD_BASE + stat_reg); 166 + int_mask = trout_int_mask[bank]; 167 + if (v & int_mask) { 168 + writeb(v & int_mask, TROUT_CPLD_BASE + stat_reg); 169 + printk(KERN_ERR "trout_gpio_irq_handler: got masked " 170 + "interrupt: %d:%02x\n", bank, v & int_mask); 171 + } 172 + v &= ~int_mask; 173 + while (v) { 174 + m = v & -v; 175 + j = fls(m) - 1; 176 + /*printk(KERN_INFO "msm_gpio_irq_handler %d:%02x %02x b" 177 + "it %d irq %d\n", bank, v, m, j, int_base + j);*/ 178 + v &= ~m; 179 + generic_handle_irq(int_base + j); 180 + } 181 + int_base += TROUT_INT_BANK0_COUNT; 182 + } 183 + desc->chip->ack(irq); 184 + } 185 + 186 + static struct irq_chip trout_gpio_irq_chip = { 187 + .name = "troutgpio", 188 + .ack = trout_gpio_irq_ack, 189 + .mask = trout_gpio_irq_mask, 190 + .unmask = trout_gpio_irq_unmask, 191 + .set_wake = trout_gpio_irq_set_wake, 192 + }; 193 + 108 194 /* 109 195 * Called from the processor-specific init to enable GPIO pin support. 110 196 */ 111 197 int __init trout_init_gpio(void) 112 198 { 113 199 int i; 200 + for(i = TROUT_INT_START; i <= TROUT_INT_END; i++) { 201 + set_irq_chip(i, &trout_gpio_irq_chip); 202 + set_irq_handler(i, handle_edge_irq); 203 + set_irq_flags(i, IRQF_VALID); 204 + } 114 205 115 206 for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++) 116 207 gpiochip_add(&msm_gpio_banks[i].chip); 208 + 209 + set_irq_type(MSM_GPIO_TO_INT(17), IRQF_TRIGGER_HIGH); 210 + set_irq_chained_handler(MSM_GPIO_TO_INT(17), trout_gpio_irq_handler); 211 + set_irq_wake(MSM_GPIO_TO_INT(17), 1); 117 212 118 213 return 0; 119 214 }
+186
arch/arm/mach-msm/board-trout-mmc.c
··· 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 ---- */ 30 + static 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 + 42 + static 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 + 51 + static 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 + 60 + static uint opt_disable_sdcard; 61 + 62 + static 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 + 72 + static struct vreg *vreg_sdslot; /* SD slot power */ 73 + 74 + struct mmc_vdd_xlat { 75 + int mask; 76 + int level; 77 + }; 78 + 79 + static 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 + 93 + static unsigned int sdslot_vdd = 0xffffffff; 94 + static unsigned int sdslot_vreg_enabled; 95 + 96 + static 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 + 150 + static 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 + 163 + static 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 + 169 + int __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 +
+11
arch/arm/mach-msm/board-trout.c
··· 30 30 #include "devices.h" 31 31 #include "board-trout.h" 32 32 33 + extern int trout_init_mmc(unsigned int); 34 + 33 35 static struct platform_device *devices[] __initdata = { 34 36 &msm_device_uart3, 35 37 &msm_device_smd, ··· 57 55 58 56 static void __init trout_init(void) 59 57 { 58 + int rc; 59 + 60 60 platform_add_devices(devices, ARRAY_SIZE(devices)); 61 + 62 + #ifdef CONFIG_MMC 63 + rc = trout_init_mmc(system_rev); 64 + if (rc) 65 + printk(KERN_CRIT "%s: MMC init failure (%d)\n", __func__, rc); 66 + #endif 67 + 61 68 } 62 69 63 70 static struct map_desc trout_io_desc[] __initdata = {
-1
arch/arm/mach-msm/clock.c
··· 14 14 * 15 15 */ 16 16 17 - #include <linux/version.h> 18 17 #include <linux/kernel.h> 19 18 #include <linux/init.h> 20 19 #include <linux/module.h>
+2 -1
arch/arm/mach-msm/devices-msm7x00.c
··· 322 322 &msm_device_sdc4, 323 323 }; 324 324 325 - int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat, 325 + int __init msm_add_sdcc(unsigned int controller, 326 + struct msm_mmc_platform_data *plat, 326 327 unsigned int stat_irq, unsigned long stat_irq_flags) 327 328 { 328 329 struct platform_device *pdev;
+4
arch/arm/mach-msm/include/mach/board.h
··· 18 18 #define __ASM_ARCH_MSM_BOARD_H 19 19 20 20 #include <linux/types.h> 21 + #include <mach/mmc.h> 21 22 22 23 /* platform device data structures */ 23 24 ··· 41 40 void __init msm_init_gpio(void); 42 41 void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks); 43 42 void __init msm_acpu_clock_init(struct msm_acpu_clock_platform_data *); 43 + int __init msm_add_sdcc(unsigned int controller, 44 + struct msm_mmc_platform_data *plat, 45 + unsigned int stat_irq, unsigned long stat_irq_flags); 44 46 45 47 #endif
+1 -1
arch/arm/mach-msm/include/mach/mmc.h
··· 15 15 int num_funcs; 16 16 }; 17 17 18 - struct mmc_platform_data { 18 + struct msm_mmc_platform_data { 19 19 unsigned int ocr_mask; /* available voltages */ 20 20 u32 (*translate_vdd)(struct device *, unsigned int); 21 21 unsigned int (*status)(struct device *);
+1 -1
arch/arm/mach-msm/smd.c
··· 997 997 return 0; 998 998 } 999 999 1000 - static int __init msm_smd_probe(struct platform_device *pdev) 1000 + static int __devinit msm_smd_probe(struct platform_device *pdev) 1001 1001 { 1002 1002 pr_info("smd_init()\n"); 1003 1003
+1 -1
drivers/mmc/host/msm_sdcc.c
··· 1060 1060 static int 1061 1061 msmsdcc_probe(struct platform_device *pdev) 1062 1062 { 1063 - struct mmc_platform_data *plat = pdev->dev.platform_data; 1063 + struct msm_mmc_platform_data *plat = pdev->dev.platform_data; 1064 1064 struct msmsdcc_host *host; 1065 1065 struct mmc_host *mmc; 1066 1066 struct resource *cmd_irqres = NULL;
+1 -1
drivers/mmc/host/msm_sdcc.h
··· 225 225 226 226 u32 pwr; 227 227 u32 saved_irq0mask; /* MMCIMASK0 reg value */ 228 - struct mmc_platform_data *plat; 228 + struct msm_mmc_platform_data *plat; 229 229 230 230 struct timer_list timer; 231 231 unsigned int oldstat;