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

Merge branch 'for_rmk' of git://git.mnementh.co.uk/linux-2.6-im into devel

authored by

Russell King and committed by
Russell King
1f7f569c a02f45cf

+558 -10
+35 -1
arch/arm/mach-pxa/e330.c
··· 1 1 /* 2 - * Hardware definitions for the Toshiba eseries PDAs 2 + * Hardware definitions for the Toshiba e330 PDAs 3 3 * 4 4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com> 5 5 * ··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 + #include <linux/clk.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/mfd/tc6387xb.h> 15 18 16 19 #include <asm/setup.h> 17 20 #include <asm/mach/arch.h> ··· 22 19 23 20 #include <mach/mfp-pxa25x.h> 24 21 #include <mach/hardware.h> 22 + #include <mach/pxa-regs.h> 23 + #include <mach/eseries-gpio.h> 25 24 #include <mach/udc.h> 26 25 27 26 #include "generic.h" 28 27 #include "eseries.h" 28 + #include "clock.h" 29 + 30 + /* -------------------- e330 tc6387xb parameters -------------------- */ 31 + 32 + static struct tc6387xb_platform_data e330_tc6387xb_info = { 33 + .enable = &eseries_tmio_enable, 34 + .disable = &eseries_tmio_disable, 35 + .suspend = &eseries_tmio_suspend, 36 + .resume = &eseries_tmio_resume, 37 + }; 38 + 39 + static struct platform_device e330_tc6387xb_device = { 40 + .name = "tc6387xb", 41 + .id = -1, 42 + .dev = { 43 + .platform_data = &e330_tc6387xb_info, 44 + }, 45 + .num_resources = 2, 46 + .resource = eseries_tmio_resources, 47 + }; 48 + 49 + /* --------------------------------------------------------------- */ 50 + 51 + static struct platform_device *devices[] __initdata = { 52 + &e330_tc6387xb_device, 53 + }; 29 54 30 55 static void __init e330_init(void) 31 56 { 57 + eseries_register_clks(); 58 + eseries_get_tmio_gpios(); 59 + platform_add_devices(devices, ARRAY_SIZE(devices)); 32 60 pxa_set_udc_info(&e7xx_udc_mach_info); 33 61 } 34 62
+35 -1
arch/arm/mach-pxa/e350.c
··· 1 1 /* 2 - * Hardware definitions for the Toshiba eseries PDAs 2 + * Hardware definitions for the Toshiba e350 PDAs 3 3 * 4 4 * Copyright (c) 2003 Ian Molton <spyro@f2s.com> 5 5 * ··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 + #include <linux/clk.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/mfd/t7l66xb.h> 15 18 16 19 #include <asm/setup.h> 17 20 #include <asm/mach/arch.h> 18 21 #include <asm/mach-types.h> 19 22 20 23 #include <mach/mfp-pxa25x.h> 24 + #include <mach/pxa-regs.h> 21 25 #include <mach/hardware.h> 26 + #include <mach/eseries-gpio.h> 22 27 #include <mach/udc.h> 23 28 24 29 #include "generic.h" 25 30 #include "eseries.h" 31 + #include "clock.h" 32 + 33 + /* -------------------- e350 t7l66xb parameters -------------------- */ 34 + 35 + static struct t7l66xb_platform_data e350_t7l66xb_info = { 36 + .irq_base = IRQ_BOARD_START, 37 + .enable = &eseries_tmio_enable, 38 + .suspend = &eseries_tmio_suspend, 39 + .resume = &eseries_tmio_resume, 40 + }; 41 + 42 + static struct platform_device e350_t7l66xb_device = { 43 + .name = "t7l66xb", 44 + .id = -1, 45 + .dev = { 46 + .platform_data = &e350_t7l66xb_info, 47 + }, 48 + .num_resources = 2, 49 + .resource = eseries_tmio_resources, 50 + }; 51 + 52 + /* ---------------------------------------------------------- */ 53 + 54 + static struct platform_device *devices[] __initdata = { 55 + &e350_t7l66xb_device, 56 + }; 26 57 27 58 static void __init e350_init(void) 28 59 { 60 + eseries_register_clks(); 61 + eseries_get_tmio_gpios(); 62 + platform_add_devices(devices, ARRAY_SIZE(devices)); 29 63 pxa_set_udc_info(&e7xx_udc_mach_info); 30 64 } 31 65
+62 -3
arch/arm/mach-pxa/e400.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 + #include <linux/clk.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/mfd/t7l66xb.h> 18 + #include <linux/mtd/nand.h> 19 + #include <linux/mtd/partitions.h> 15 20 16 21 #include <asm/setup.h> 17 22 #include <asm/mach/arch.h> 18 23 #include <asm/mach-types.h> 19 24 20 - #include <mach/pxa-regs.h> 21 25 #include <mach/mfp-pxa25x.h> 26 + #include <mach/pxa-regs.h> 22 27 #include <mach/hardware.h> 23 - 28 + #include <mach/eseries-gpio.h> 24 29 #include <mach/pxafb.h> 25 30 #include <mach/udc.h> 26 31 27 32 #include "generic.h" 28 33 #include "eseries.h" 34 + #include "clock.h" 29 35 30 36 /* ------------------------ E400 LCD definitions ------------------------ */ 31 37 ··· 71 65 GPIO42_BTUART_RXD, 72 66 GPIO43_BTUART_TXD, 73 67 GPIO44_BTUART_CTS, 74 - GPIO45_GPIO, /* Used by TMIO for #SUSPEND */ 68 + 69 + /* TMIO controller */ 70 + GPIO19_GPIO, /* t7l66xb #PCLR */ 71 + GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */ 75 72 76 73 /* wakeup */ 77 74 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, ··· 82 73 83 74 /* ---------------------------------------------------------------------- */ 84 75 76 + static struct mtd_partition partition_a = { 77 + .name = "Internal NAND flash", 78 + .offset = 0, 79 + .size = MTDPART_SIZ_FULL, 80 + }; 81 + 82 + static uint8_t scan_ff_pattern[] = { 0xff, 0xff }; 83 + 84 + static struct nand_bbt_descr e400_t7l66xb_nand_bbt = { 85 + .options = 0, 86 + .offs = 4, 87 + .len = 2, 88 + .pattern = scan_ff_pattern 89 + }; 90 + 91 + static struct tmio_nand_data e400_t7l66xb_nand_config = { 92 + .num_partitions = 1, 93 + .partition = &partition_a, 94 + .badblock_pattern = &e400_t7l66xb_nand_bbt, 95 + }; 96 + 97 + static struct t7l66xb_platform_data e400_t7l66xb_info = { 98 + .irq_base = IRQ_BOARD_START, 99 + .enable = &eseries_tmio_enable, 100 + .suspend = &eseries_tmio_suspend, 101 + .resume = &eseries_tmio_resume, 102 + 103 + .nand_data = &e400_t7l66xb_nand_config, 104 + }; 105 + 106 + static struct platform_device e400_t7l66xb_device = { 107 + .name = "t7l66xb", 108 + .id = -1, 109 + .dev = { 110 + .platform_data = &e400_t7l66xb_info, 111 + }, 112 + .num_resources = 2, 113 + .resource = eseries_tmio_resources, 114 + }; 115 + 116 + /* ---------------------------------------------------------- */ 117 + 118 + static struct platform_device *devices[] __initdata = { 119 + &e400_t7l66xb_device, 120 + }; 121 + 85 122 static void __init e400_init(void) 86 123 { 87 124 pxa2xx_mfp_config(ARRAY_AND_SIZE(e400_pin_config)); 125 + /* Fixme - e400 may have a switched clock */ 126 + eseries_register_clks(); 127 + eseries_get_tmio_gpios(); 88 128 set_pxa_fb_info(&e400_pxafb_mach_info); 129 + platform_add_devices(devices, ARRAY_SIZE(devices)); 89 130 pxa_set_udc_info(&e7xx_udc_mach_info); 90 131 } 91 132
+44 -2
arch/arm/mach-pxa/e740.c
··· 15 15 #include <linux/device.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/fb.h> 18 + #include <linux/clk.h> 19 + #include <linux/mfd/t7l66xb.h> 18 20 19 21 #include <video/w100fb.h> 20 22 ··· 25 23 #include <asm/mach-types.h> 26 24 27 25 #include <mach/mfp-pxa25x.h> 26 + #include <mach/pxa-regs.h> 28 27 #include <mach/hardware.h> 28 + #include <mach/eseries-gpio.h> 29 29 #include <mach/udc.h> 30 + #include <mach/irda.h> 30 31 31 32 #include "generic.h" 32 33 #include "eseries.h" 33 - 34 + #include "clock.h" 35 + #include "devices.h" 34 36 35 37 /* ------------------------ e740 video support --------------------------- */ 36 38 ··· 122 116 GPIO42_BTUART_RXD, 123 117 GPIO43_BTUART_TXD, 124 118 GPIO44_BTUART_CTS, 125 - GPIO45_GPIO, /* Used by TMIO for #SUSPEND */ 119 + 120 + /* TMIO controller */ 121 + GPIO19_GPIO, /* t7l66xb #PCLR */ 122 + GPIO45_GPIO, /* t7l66xb #SUSPEND (NOT BTUART!) */ 123 + 124 + /* UDC */ 125 + GPIO13_GPIO, 126 + GPIO3_GPIO, 127 + 128 + /* IrDA */ 129 + GPIO38_GPIO | MFP_LPM_DRIVE_HIGH, 126 130 127 131 /* PC Card */ 128 132 GPIO8_GPIO, /* CD0 */ ··· 158 142 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, 159 143 }; 160 144 145 + /* -------------------- e740 t7l66xb parameters -------------------- */ 146 + 147 + static struct t7l66xb_platform_data e740_t7l66xb_info = { 148 + .irq_base = IRQ_BOARD_START, 149 + .enable = &eseries_tmio_enable, 150 + .suspend = &eseries_tmio_suspend, 151 + .resume = &eseries_tmio_resume, 152 + }; 153 + 154 + static struct platform_device e740_t7l66xb_device = { 155 + .name = "t7l66xb", 156 + .id = -1, 157 + .dev = { 158 + .platform_data = &e740_t7l66xb_info, 159 + }, 160 + .num_resources = 2, 161 + .resource = eseries_tmio_resources, 162 + }; 163 + 161 164 /* ----------------------------------------------------------------------- */ 162 165 163 166 static struct platform_device *devices[] __initdata = { 164 167 &e740_fb_device, 168 + &e740_t7l66xb_device, 165 169 }; 166 170 167 171 static void __init e740_init(void) 168 172 { 169 173 pxa2xx_mfp_config(ARRAY_AND_SIZE(e740_pin_config)); 174 + eseries_register_clks(); 175 + clk_add_alias("CLK_CK48M", &e740_t7l66xb_device.dev, 176 + "UDCCLK", &pxa25x_device_udc.dev), 177 + eseries_get_tmio_gpios(); 170 178 platform_add_devices(devices, ARRAY_SIZE(devices)); 171 179 pxa_set_udc_info(&e7xx_udc_mach_info); 180 + e7xx_irda_init(); 181 + pxa_set_ficp_info(&e7xx_ficp_platform_data); 172 182 } 173 183 174 184 MACHINE_START(E740, "Toshiba e740")
+35 -1
arch/arm/mach-pxa/e750.c
··· 15 15 #include <linux/device.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/fb.h> 18 + #include <linux/mfd/tc6393xb.h> 18 19 19 20 #include <video/w100fb.h> 20 21 ··· 24 23 #include <asm/mach-types.h> 25 24 26 25 #include <mach/mfp-pxa25x.h> 26 + #include <mach/pxa-regs.h> 27 27 #include <mach/hardware.h> 28 + #include <mach/eseries-gpio.h> 28 29 #include <mach/udc.h> 30 + #include <mach/irda.h> 29 31 30 32 #include "generic.h" 31 33 #include "eseries.h" 34 + #include "clock.h" 32 35 33 36 /* ---------------------- E750 LCD definitions -------------------- */ 34 37 ··· 105 100 .resource = e750_fb_resources, 106 101 }; 107 102 108 - /* ----------------------------------------------------------------------- */ 103 + /* ----------------- e750 tc6393xb parameters ------------------ */ 104 + 105 + static struct tc6393xb_platform_data e750_tc6393xb_info = { 106 + .irq_base = IRQ_BOARD_START, 107 + .scr_pll2cr = 0x0cc1, 108 + .scr_gper = 0, 109 + .gpio_base = -1, 110 + .suspend = &eseries_tmio_suspend, 111 + .resume = &eseries_tmio_resume, 112 + .enable = &eseries_tmio_enable, 113 + .disable = &eseries_tmio_disable, 114 + }; 115 + 116 + static struct platform_device e750_tc6393xb_device = { 117 + .name = "tc6393xb", 118 + .id = -1, 119 + .dev = { 120 + .platform_data = &e750_tc6393xb_info, 121 + }, 122 + .num_resources = 2, 123 + .resource = eseries_tmio_resources, 124 + }; 125 + 126 + /* ------------------------------------------------------------- */ 109 127 110 128 static struct platform_device *devices[] __initdata = { 111 129 &e750_fb_device, 130 + &e750_tc6393xb_device, 112 131 }; 113 132 114 133 static void __init e750_init(void) 115 134 { 135 + clk_add_alias("CLK_CK3P6MI", &e750_tc6393xb_device.dev, 136 + "GPIO11_CLK", NULL), 137 + eseries_get_tmio_gpios(); 116 138 platform_add_devices(devices, ARRAY_SIZE(devices)); 117 139 pxa_set_udc_info(&e7xx_udc_mach_info); 140 + e7xx_irda_init(); 141 + pxa_set_ficp_info(&e7xx_ficp_platform_data); 118 142 } 119 143 120 144 MACHINE_START(E750, "Toshiba e750")
+30
arch/arm/mach-pxa/e800.c
··· 15 15 #include <linux/device.h> 16 16 #include <linux/platform_device.h> 17 17 #include <linux/fb.h> 18 + #include <linux/mfd/tc6393xb.h> 18 19 19 20 #include <video/w100fb.h> 20 21 ··· 24 23 #include <asm/mach-types.h> 25 24 26 25 #include <mach/mfp-pxa25x.h> 26 + #include <mach/pxa-regs.h> 27 27 #include <mach/hardware.h> 28 28 #include <mach/eseries-gpio.h> 29 29 #include <mach/udc.h> 30 30 31 31 #include "generic.h" 32 32 #include "eseries.h" 33 + #include "clock.h" 33 34 34 35 /* ------------------------ e800 LCD definitions ------------------------- */ 35 36 ··· 163 160 .gpio_pullup_inverted = 1 164 161 }; 165 162 163 + /* ----------------- e800 tc6393xb parameters ------------------ */ 164 + 165 + static struct tc6393xb_platform_data e800_tc6393xb_info = { 166 + .irq_base = IRQ_BOARD_START, 167 + .scr_pll2cr = 0x0cc1, 168 + .scr_gper = 0, 169 + .gpio_base = -1, 170 + .suspend = &eseries_tmio_suspend, 171 + .resume = &eseries_tmio_resume, 172 + .enable = &eseries_tmio_enable, 173 + .disable = &eseries_tmio_disable, 174 + }; 175 + 176 + static struct platform_device e800_tc6393xb_device = { 177 + .name = "tc6393xb", 178 + .id = -1, 179 + .dev = { 180 + .platform_data = &e800_tc6393xb_info, 181 + }, 182 + .num_resources = 2, 183 + .resource = eseries_tmio_resources, 184 + }; 185 + 166 186 /* ----------------------------------------------------------------------- */ 167 187 168 188 static struct platform_device *devices[] __initdata = { 169 189 &e800_fb_device, 190 + &e800_tc6393xb_device, 170 191 }; 171 192 172 193 static void __init e800_init(void) 173 194 { 195 + clk_add_alias("CLK_CK3P6MI", &e800_tc6393xb_device.dev, 196 + "GPIO11_CLK", NULL), 197 + eseries_get_tmio_gpios(); 174 198 platform_add_devices(devices, ARRAY_SIZE(devices)); 175 199 pxa_set_udc_info(&e800_udc_mach_info); 176 200 }
+124
arch/arm/mach-pxa/eseries.c
··· 12 12 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 + #include <linux/gpio.h> 16 + #include <linux/delay.h> 17 + #include <linux/platform_device.h> 15 18 16 19 #include <asm/setup.h> 17 20 #include <asm/mach/arch.h> ··· 24 21 #include <mach/hardware.h> 25 22 #include <mach/eseries-gpio.h> 26 23 #include <mach/udc.h> 24 + #include <mach/irda.h> 27 25 28 26 #include "generic.h" 27 + #include "clock.h" 29 28 30 29 /* Only e800 has 128MB RAM */ 31 30 void __init eseries_fixup(struct machine_desc *desc, ··· 47 42 .gpio_pullup = GPIO_E7XX_USB_PULLUP, 48 43 .gpio_pullup_inverted = 1 49 44 }; 45 + 46 + static void e7xx_irda_transceiver_mode(struct device *dev, int mode) 47 + { 48 + if (mode & IR_OFF) { 49 + gpio_set_value(GPIO_E7XX_IR_OFF, 1); 50 + pxa2xx_transceiver_mode(dev, mode); 51 + } else { 52 + pxa2xx_transceiver_mode(dev, mode); 53 + gpio_set_value(GPIO_E7XX_IR_OFF, 0); 54 + } 55 + } 56 + 57 + int e7xx_irda_init(void) 58 + { 59 + int ret; 60 + 61 + ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power"); 62 + if (ret) 63 + goto out; 64 + 65 + ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0); 66 + if (ret) 67 + goto out; 68 + 69 + e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF); 70 + out: 71 + return ret; 72 + } 73 + 74 + static void e7xx_irda_shutdown(struct device *dev) 75 + { 76 + e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); 77 + gpio_free(GPIO_E7XX_IR_OFF); 78 + } 79 + 80 + struct pxaficp_platform_data e7xx_ficp_platform_data = { 81 + .transceiver_cap = IR_SIRMODE | IR_OFF, 82 + .transceiver_mode = e7xx_irda_transceiver_mode, 83 + .shutdown = e7xx_irda_shutdown, 84 + }; 85 + 86 + int eseries_tmio_enable(struct platform_device *dev) 87 + { 88 + /* Reset - bring SUSPEND high before PCLR */ 89 + gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); 90 + gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0); 91 + msleep(1); 92 + gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1); 93 + msleep(1); 94 + gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 1); 95 + msleep(1); 96 + return 0; 97 + } 98 + 99 + int eseries_tmio_disable(struct platform_device *dev) 100 + { 101 + gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); 102 + gpio_set_value(GPIO_ESERIES_TMIO_PCLR, 0); 103 + return 0; 104 + } 105 + 106 + int eseries_tmio_suspend(struct platform_device *dev) 107 + { 108 + gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 0); 109 + return 0; 110 + } 111 + 112 + int eseries_tmio_resume(struct platform_device *dev) 113 + { 114 + gpio_set_value(GPIO_ESERIES_TMIO_SUSPEND, 1); 115 + msleep(1); 116 + return 0; 117 + } 118 + 119 + void eseries_get_tmio_gpios(void) 120 + { 121 + gpio_request(GPIO_ESERIES_TMIO_SUSPEND, NULL); 122 + gpio_request(GPIO_ESERIES_TMIO_PCLR, NULL); 123 + gpio_direction_output(GPIO_ESERIES_TMIO_SUSPEND, 0); 124 + gpio_direction_output(GPIO_ESERIES_TMIO_PCLR, 0); 125 + } 126 + 127 + /* TMIO controller uses the same resources on all e-series machines. */ 128 + struct resource eseries_tmio_resources[] = { 129 + [0] = { 130 + .start = PXA_CS4_PHYS, 131 + .end = PXA_CS4_PHYS + 0x1fffff, 132 + .flags = IORESOURCE_MEM, 133 + }, 134 + [1] = { 135 + .start = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), 136 + .end = IRQ_GPIO(GPIO_ESERIES_TMIO_IRQ), 137 + .flags = IORESOURCE_IRQ, 138 + }, 139 + }; 140 + 141 + /* Some e-series hardware cannot control the 32K clock */ 142 + static void clk_32k_dummy(struct clk *clk) 143 + { 144 + } 145 + 146 + static const struct clkops clk_32k_dummy_ops = { 147 + .enable = clk_32k_dummy, 148 + .disable = clk_32k_dummy, 149 + }; 150 + 151 + static struct clk tmio_dummy_clk = { 152 + .ops = &clk_32k_dummy_ops, 153 + .rate = 32768, 154 + }; 155 + 156 + static struct clk_lookup eseries_clkregs[] = { 157 + INIT_CLKREG(&tmio_dummy_clk, NULL, "CLK_CK32K"), 158 + }; 159 + 160 + void eseries_register_clks(void) 161 + { 162 + clks_register(eseries_clkregs, ARRAY_SIZE(eseries_clkregs)); 163 + } 50 164
+12
arch/arm/mach-pxa/eseries.h
··· 2 2 struct tag *tags, char **cmdline, struct meminfo *mi); 3 3 4 4 extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info; 5 + extern struct pxaficp_platform_data e7xx_ficp_platform_data; 6 + extern int e7xx_irda_init(void); 7 + 8 + extern int eseries_tmio_enable(struct platform_device *dev); 9 + extern int eseries_tmio_disable(struct platform_device *dev); 10 + extern int eseries_tmio_suspend(struct platform_device *dev); 11 + extern int eseries_tmio_resume(struct platform_device *dev); 12 + extern void eseries_get_tmio_gpios(void); 13 + extern struct resource eseries_tmio_resources[]; 14 + extern struct platform_device e300_tc6387xb_device; 15 + extern void eseries_register_clks(void); 16 +
+3 -1
arch/arm/mach-pxa/include/mach/eseries-gpio.h
··· 43 43 #define GPIO_E800_PCMCIA_PWR1 73 44 44 45 45 /* e7xx IrDA power control */ 46 - #define GPIO_E7XX_IR_ON 38 46 + #define GPIO_E7XX_IR_OFF 38 47 47 48 48 /* ASIC related GPIOs */ 49 49 #define GPIO_ESERIES_TMIO_IRQ 5 50 + #define GPIO_ESERIES_TMIO_PCLR 19 51 + #define GPIO_ESERIES_TMIO_SUSPEND 45 50 52 #define GPIO_E800_ANGELX_IRQ 8
+1 -1
drivers/pcmcia/Kconfig
··· 217 217 depends on ARM && ARCH_PXA && PCMCIA 218 218 depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ 219 219 || MACH_ARMCORE || ARCH_PXA_PALM || TRIZEPS_PCMCIA \ 220 - || ARCH_VIPER) 220 + || ARCH_VIPER || ARCH_PXA_ESERIES) 221 221 help 222 222 Say Y here to include support for the PXA2xx PCMCIA controller 223 223
+1
drivers/pcmcia/Makefile
··· 72 72 pxa2xx-obj-$(CONFIG_TRIZEPS_PCMCIA) += pxa2xx_trizeps4.o 73 73 pxa2xx-obj-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o 74 74 pxa2xx-obj-$(CONFIG_MACH_PALMLD) += pxa2xx_palmld.o 75 + pxa2xx-obj-$(CONFIG_MACH_E740) += pxa2xx_e740.o 75 76 76 77 obj-$(CONFIG_PCMCIA_PXA2XX) += pxa2xx_core.o $(pxa2xx-obj-y)
+176
drivers/pcmcia/pxa2xx_e740.c
··· 1 + /* 2 + * Toshiba e740 PCMCIA specific routines. 3 + * 4 + * (c) 2004 Ian Molton <spyro@f2s.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/init.h> 12 + #include <linux/module.h> 13 + #include <linux/kernel.h> 14 + #include <linux/errno.h> 15 + #include <linux/gpio.h> 16 + #include <linux/interrupt.h> 17 + #include <linux/platform_device.h> 18 + 19 + #include <mach/hardware.h> 20 + #include <mach/pxa-regs.h> 21 + #include <mach/eseries-gpio.h> 22 + 23 + #include <asm/irq.h> 24 + #include <asm/mach-types.h> 25 + 26 + #include "soc_common.h" 27 + 28 + static struct pcmcia_irqs cd_irqs[] = { 29 + { 30 + .sock = 0, 31 + .irq = IRQ_GPIO(GPIO_E740_PCMCIA_CD0), 32 + .str = "CF card detect" 33 + }, 34 + { 35 + .sock = 1, 36 + .irq = IRQ_GPIO(GPIO_E740_PCMCIA_CD1), 37 + .str = "Wifi switch" 38 + }, 39 + }; 40 + 41 + static int e740_pcmcia_hw_init(struct soc_pcmcia_socket *skt) 42 + { 43 + skt->irq = skt->nr == 0 ? IRQ_GPIO(GPIO_E740_PCMCIA_RDY0) : 44 + IRQ_GPIO(GPIO_E740_PCMCIA_RDY1); 45 + 46 + return soc_pcmcia_request_irqs(skt, &cd_irqs[skt->nr], 1); 47 + } 48 + 49 + /* 50 + * Release all resources. 51 + */ 52 + static void e740_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) 53 + { 54 + soc_pcmcia_free_irqs(skt, &cd_irqs[skt->nr], 1); 55 + } 56 + 57 + static void e740_pcmcia_socket_state(struct soc_pcmcia_socket *skt, 58 + struct pcmcia_state *state) 59 + { 60 + if (skt->nr == 0) { 61 + state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD0) ? 0 : 1; 62 + state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY0) ? 1 : 0; 63 + } else { 64 + state->detect = gpio_get_value(GPIO_E740_PCMCIA_CD1) ? 0 : 1; 65 + state->ready = gpio_get_value(GPIO_E740_PCMCIA_RDY1) ? 1 : 0; 66 + } 67 + 68 + state->vs_3v = 1; 69 + state->bvd1 = 1; 70 + state->bvd2 = 1; 71 + state->wrprot = 0; 72 + state->vs_Xv = 0; 73 + } 74 + 75 + static int e740_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, 76 + const socket_state_t *state) 77 + { 78 + if (state->flags & SS_RESET) { 79 + if (skt->nr == 0) 80 + gpio_set_value(GPIO_E740_PCMCIA_RST0, 1); 81 + else 82 + gpio_set_value(GPIO_E740_PCMCIA_RST1, 1); 83 + } else { 84 + if (skt->nr == 0) 85 + gpio_set_value(GPIO_E740_PCMCIA_RST0, 0); 86 + else 87 + gpio_set_value(GPIO_E740_PCMCIA_RST1, 0); 88 + } 89 + 90 + switch (state->Vcc) { 91 + case 0: /* Socket off */ 92 + if (skt->nr == 0) 93 + gpio_set_value(GPIO_E740_PCMCIA_PWR0, 0); 94 + else 95 + gpio_set_value(GPIO_E740_PCMCIA_PWR1, 1); 96 + break; 97 + case 50: 98 + case 33: /* socket on */ 99 + if (skt->nr == 0) 100 + gpio_set_value(GPIO_E740_PCMCIA_PWR0, 1); 101 + else 102 + gpio_set_value(GPIO_E740_PCMCIA_PWR1, 0); 103 + break; 104 + default: 105 + printk(KERN_ERR "e740_cs: Unsupported Vcc: %d\n", state->Vcc); 106 + } 107 + 108 + return 0; 109 + } 110 + 111 + /* 112 + * Enable card status IRQs on (re-)initialisation. This can 113 + * be called at initialisation, power management event, or 114 + * pcmcia event. 115 + */ 116 + static void e740_pcmcia_socket_init(struct soc_pcmcia_socket *skt) 117 + { 118 + soc_pcmcia_enable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs)); 119 + } 120 + 121 + /* 122 + * Disable card status IRQs on suspend. 123 + */ 124 + static void e740_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) 125 + { 126 + soc_pcmcia_disable_irqs(skt, cd_irqs, ARRAY_SIZE(cd_irqs)); 127 + } 128 + 129 + static struct pcmcia_low_level e740_pcmcia_ops = { 130 + .owner = THIS_MODULE, 131 + .hw_init = e740_pcmcia_hw_init, 132 + .hw_shutdown = e740_pcmcia_hw_shutdown, 133 + .socket_state = e740_pcmcia_socket_state, 134 + .configure_socket = e740_pcmcia_configure_socket, 135 + .socket_init = e740_pcmcia_socket_init, 136 + .socket_suspend = e740_pcmcia_socket_suspend, 137 + .nr = 2, 138 + }; 139 + 140 + static struct platform_device *e740_pcmcia_device; 141 + 142 + static int __init e740_pcmcia_init(void) 143 + { 144 + int ret; 145 + 146 + if (!machine_is_e740()) 147 + return -ENODEV; 148 + 149 + e740_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); 150 + if (!e740_pcmcia_device) 151 + return -ENOMEM; 152 + 153 + ret = platform_device_add_data(e740_pcmcia_device, &e740_pcmcia_ops, 154 + sizeof(e740_pcmcia_ops)); 155 + 156 + if (!ret) 157 + ret = platform_device_add(e740_pcmcia_device); 158 + 159 + if (ret) 160 + platform_device_put(e740_pcmcia_device); 161 + 162 + return ret; 163 + } 164 + 165 + static void __exit e740_pcmcia_exit(void) 166 + { 167 + platform_device_unregister(e740_pcmcia_device); 168 + } 169 + 170 + module_init(e740_pcmcia_init); 171 + module_exit(e740_pcmcia_exit); 172 + 173 + MODULE_LICENSE("GPL v2"); 174 + MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); 175 + MODULE_ALIAS("platform:pxa2xx-pcmcia"); 176 + MODULE_DESCRIPTION("e740 PCMCIA platform support");