3 @@ -1511,6 +1511,10 @@ source "net/Kconfig"
5 source "drivers/Kconfig"
8 +source "drivers/cbus/Kconfig"
13 source "arch/arm/Kconfig.debug"
14 --- a/arch/arm/mach-omap1/board-fsample.c
15 +++ b/arch/arm/mach-omap1/board-fsample.c
16 @@ -107,7 +107,7 @@ static struct resource smc91x_resources[
17 .flags = IORESOURCE_MEM,
20 - .start = INT_730_MPU_EXT_NIRQ,
21 + .start = INT_7XX_MPU_EXT_NIRQ,
23 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
25 @@ -196,8 +196,8 @@ static struct platform_device smc91x_dev
27 static struct resource kp_resources[] = {
29 - .start = INT_730_MPUIO_KEYPAD,
30 - .end = INT_730_MPUIO_KEYPAD,
31 + .start = INT_7XX_MPUIO_KEYPAD,
32 + .end = INT_7XX_MPUIO_KEYPAD,
33 .flags = IORESOURCE_IRQ,
36 @@ -309,7 +309,7 @@ static void __init omap_fsample_map_io(v
38 * Hold GSM Reset until needed
40 - omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
41 + omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
44 * UARTs -> done automagically by 8250 driver
45 @@ -320,21 +320,21 @@ static void __init omap_fsample_map_io(v
48 /* Flash: CS0 timings setup */
49 - omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
50 - omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
51 + omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
52 + omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
55 * Ethernet support through the debug board
58 - omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
59 - omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
60 + omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
61 + omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
64 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
65 * It is used as the Ethernet controller interrupt
67 - omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
68 + omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
71 MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
72 --- a/arch/arm/mach-omap1/board-perseus2.c
73 +++ b/arch/arm/mach-omap1/board-perseus2.c
74 @@ -74,7 +74,7 @@ static struct resource smc91x_resources[
75 .flags = IORESOURCE_MEM,
78 - .start = INT_730_MPU_EXT_NIRQ,
79 + .start = INT_7XX_MPU_EXT_NIRQ,
81 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
83 @@ -163,8 +163,8 @@ static struct platform_device smc91x_dev
85 static struct resource kp_resources[] = {
87 - .start = INT_730_MPUIO_KEYPAD,
88 - .end = INT_730_MPUIO_KEYPAD,
89 + .start = INT_7XX_MPUIO_KEYPAD,
90 + .end = INT_7XX_MPUIO_KEYPAD,
91 .flags = IORESOURCE_IRQ,
94 @@ -270,7 +270,7 @@ static void __init omap_perseus2_map_io(
96 * Hold GSM Reset until needed
98 - omap_writew(omap_readw(OMAP730_DSP_M_CTL) & ~1, OMAP730_DSP_M_CTL);
99 + omap_writew(omap_readw(OMAP7XX_DSP_M_CTL) & ~1, OMAP7XX_DSP_M_CTL);
102 * UARTs -> done automagically by 8250 driver
103 @@ -281,21 +281,21 @@ static void __init omap_perseus2_map_io(
106 /* Flash: CS0 timings setup */
107 - omap_writel(0x0000fff3, OMAP730_FLASH_CFG_0);
108 - omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
109 + omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_0);
110 + omap_writel(0x00000088, OMAP7XX_FLASH_ACFG_0);
113 * Ethernet support through the debug board
116 - omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
117 - omap_writel(0x00000000, OMAP730_FLASH_ACFG_1);
118 + omap_writel(0x0000fff3, OMAP7XX_FLASH_CFG_1);
119 + omap_writel(0x00000000, OMAP7XX_FLASH_ACFG_1);
122 * Configure MPU_EXT_NIRQ IO in IO_CONF9 register,
123 * It is used as the Ethernet controller interrupt
125 - omap_writel(omap_readl(OMAP730_IO_CONF_9) & 0x1FFFFFFF, OMAP730_IO_CONF_9);
126 + omap_writel(omap_readl(OMAP7XX_IO_CONF_9) & 0x1FFFFFFF, OMAP7XX_IO_CONF_9);
129 MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
130 --- a/arch/arm/mach-omap1/clock.c
131 +++ b/arch/arm/mach-omap1/clock.c
132 @@ -69,13 +69,13 @@ struct omap_clk {
135 #define CK_310 (1 << 0)
136 -#define CK_730 (1 << 1)
137 +#define CK_7XX (1 << 1)
138 #define CK_1510 (1 << 2)
139 #define CK_16XX (1 << 3)
141 static struct omap_clk omap_clks[] = {
142 /* non-ULPD clocks */
143 - CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310),
144 + CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX),
145 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310),
147 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
148 @@ -83,7 +83,7 @@ static struct omap_clk omap_clks[] = {
149 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
150 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
151 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
152 - CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
153 + CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
154 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
155 CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
156 CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX),
157 @@ -97,7 +97,7 @@ static struct omap_clk omap_clks[] = {
158 CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
159 CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
161 - CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_730),
162 + CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
163 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
164 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX),
165 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
166 @@ -108,7 +108,7 @@ static struct omap_clk omap_clks[] = {
167 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
168 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
169 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
170 - CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_730),
171 + CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX),
172 CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
174 CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
175 @@ -398,7 +398,7 @@ static int omap1_select_table_rate(struc
176 * Reprogramming the DPLL is tricky, it must be done from SRAM.
177 * (on 730, bit 13 must always be 1)
179 - if (cpu_is_omap730())
180 + if (cpu_is_omap7xx())
181 omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val | 0x2000);
183 omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val);
184 @@ -783,8 +783,8 @@ int __init omap1_clk_init(void)
186 if (cpu_is_omap1510())
188 - if (cpu_is_omap730())
189 - cpu_mask |= CK_730;
190 + if (cpu_is_omap7xx())
191 + cpu_mask |= CK_7XX;
192 if (cpu_is_omap310())
195 @@ -800,7 +800,7 @@ int __init omap1_clk_init(void)
196 crystal_type = info->system_clock_type;
199 -#if defined(CONFIG_ARCH_OMAP730)
200 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
201 ck_ref.rate = 13000000;
202 #elif defined(CONFIG_ARCH_OMAP16XX)
203 if (crystal_type == 2)
204 @@ -847,7 +847,7 @@ int __init omap1_clk_init(void)
205 printk(KERN_ERR "System frequencies not set. Check your config.\n");
206 /* Guess sane values (60MHz) */
207 omap_writew(0x2290, DPLL_CTL);
208 - omap_writew(cpu_is_omap730() ? 0x3005 : 0x1005, ARM_CKCTL);
209 + omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
210 ck_dpll1.rate = 60000000;
213 @@ -862,7 +862,7 @@ int __init omap1_clk_init(void)
215 #if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
216 /* Select slicer output as OMAP input clock */
217 - omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL);
218 + omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
221 /* Amstrad Delta wants BCLK high when inactive */
222 @@ -873,7 +873,7 @@ int __init omap1_clk_init(void)
224 /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
225 /* (on 730, bit 13 must not be cleared) */
226 - if (cpu_is_omap730())
227 + if (cpu_is_omap7xx())
228 omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
230 omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
231 --- a/arch/arm/mach-omap1/io.c
232 +++ b/arch/arm/mach-omap1/io.c
233 @@ -36,33 +36,17 @@ static struct map_desc omap_io_desc[] __
237 -#ifdef CONFIG_ARCH_OMAP730
238 -static struct map_desc omap730_io_desc[] __initdata = {
239 +#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
240 +static struct map_desc omap7xx_io_desc[] __initdata = {
242 - .virtual = OMAP730_DSP_BASE,
243 - .pfn = __phys_to_pfn(OMAP730_DSP_START),
244 - .length = OMAP730_DSP_SIZE,
245 + .virtual = OMAP7XX_DSP_BASE,
246 + .pfn = __phys_to_pfn(OMAP7XX_DSP_START),
247 + .length = OMAP7XX_DSP_SIZE,
250 - .virtual = OMAP730_DSPREG_BASE,
251 - .pfn = __phys_to_pfn(OMAP730_DSPREG_START),
252 - .length = OMAP730_DSPREG_SIZE,
258 -#ifdef CONFIG_ARCH_OMAP850
259 -static struct map_desc omap850_io_desc[] __initdata = {
261 - .virtual = OMAP850_DSP_BASE,
262 - .pfn = __phys_to_pfn(OMAP850_DSP_START),
263 - .length = OMAP850_DSP_SIZE,
266 - .virtual = OMAP850_DSPREG_BASE,
267 - .pfn = __phys_to_pfn(OMAP850_DSPREG_START),
268 - .length = OMAP850_DSPREG_SIZE,
269 + .virtual = OMAP7XX_DSPREG_BASE,
270 + .pfn = __phys_to_pfn(OMAP7XX_DSPREG_START),
271 + .length = OMAP7XX_DSPREG_SIZE,
275 @@ -120,18 +104,11 @@ void __init omap1_map_common_io(void)
277 omap_check_revision();
279 -#ifdef CONFIG_ARCH_OMAP730
280 - if (cpu_is_omap730()) {
281 - iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
285 -#ifdef CONFIG_ARCH_OMAP850
286 - if (cpu_is_omap850()) {
287 - iotable_init(omap850_io_desc, ARRAY_SIZE(omap850_io_desc));
288 +#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
289 + if (cpu_is_omap7xx()) {
290 + iotable_init(omap7xx_io_desc, ARRAY_SIZE(omap7xx_io_desc));
294 #ifdef CONFIG_ARCH_OMAP15XX
295 if (cpu_is_omap15xx()) {
296 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
297 --- a/arch/arm/mach-omap1/irq.c
298 +++ b/arch/arm/mach-omap1/irq.c
299 @@ -137,16 +137,8 @@ static void omap_irq_set_cfg(int irq, in
300 irq_bank_writel(val, bank, offset);
303 -#ifdef CONFIG_ARCH_OMAP730
304 -static struct omap_irq_bank omap730_irq_banks[] = {
305 - { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3f8e22f },
306 - { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb9c1f2 },
307 - { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0x800040f3 },
311 -#ifdef CONFIG_ARCH_OMAP850
312 -static struct omap_irq_bank omap850_irq_banks[] = {
313 +#if defined (CONFIG_ARCH_OMAP730) || defined (CONFIG_ARCH_OMAP850)
314 +static struct omap_irq_bank omap7xx_irq_banks[] = {
315 { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3f8e22f },
316 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb9c1f2 },
317 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0x800040f3 },
318 @@ -186,16 +178,10 @@ void __init omap_init_irq(void)
322 -#ifdef CONFIG_ARCH_OMAP730
323 - if (cpu_is_omap730()) {
324 - irq_banks = omap730_irq_banks;
325 - irq_bank_count = ARRAY_SIZE(omap730_irq_banks);
328 -#ifdef CONFIG_ARCH_OMAP850
329 - if (cpu_is_omap850()) {
330 - irq_banks = omap850_irq_banks;
331 - irq_bank_count = ARRAY_SIZE(omap850_irq_banks);
332 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
333 + if (cpu_is_omap7xx()) {
334 + irq_banks = omap7xx_irq_banks;
335 + irq_bank_count = ARRAY_SIZE(omap7xx_irq_banks);
338 #ifdef CONFIG_ARCH_OMAP15XX
339 @@ -247,10 +233,8 @@ void __init omap_init_irq(void)
341 /* Unmask level 2 handler */
343 - if (cpu_is_omap730())
344 - omap_unmask_irq(INT_730_IH2_IRQ);
345 - else if (cpu_is_omap850())
346 - omap_unmask_irq(INT_850_IH2_IRQ);
347 + if (cpu_is_omap7xx())
348 + omap_unmask_irq(INT_7XX_IH2_IRQ);
349 else if (cpu_is_omap15xx())
350 omap_unmask_irq(INT_1510_IH2_IRQ);
351 else if (cpu_is_omap16xx())
352 --- a/arch/arm/mach-omap1/mcbsp.c
353 +++ b/arch/arm/mach-omap1/mcbsp.c
354 @@ -79,29 +79,29 @@ static struct omap_mcbsp_ops omap1_mcbsp
355 .free = omap1_mcbsp_free,
358 -#ifdef CONFIG_ARCH_OMAP730
359 -static struct omap_mcbsp_platform_data omap730_mcbsp_pdata[] = {
360 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
361 +static struct omap_mcbsp_platform_data omap7xx_mcbsp_pdata[] = {
363 - .phys_base = OMAP730_MCBSP1_BASE,
364 + .phys_base = OMAP7XX_MCBSP1_BASE,
365 .dma_rx_sync = OMAP_DMA_MCBSP1_RX,
366 .dma_tx_sync = OMAP_DMA_MCBSP1_TX,
367 - .rx_irq = INT_730_McBSP1RX,
368 - .tx_irq = INT_730_McBSP1TX,
369 + .rx_irq = INT_7XX_McBSP1RX,
370 + .tx_irq = INT_7XX_McBSP1TX,
371 .ops = &omap1_mcbsp_ops,
374 - .phys_base = OMAP730_MCBSP2_BASE,
375 + .phys_base = OMAP7XX_MCBSP2_BASE,
376 .dma_rx_sync = OMAP_DMA_MCBSP3_RX,
377 .dma_tx_sync = OMAP_DMA_MCBSP3_TX,
378 - .rx_irq = INT_730_McBSP2RX,
379 - .tx_irq = INT_730_McBSP2TX,
380 + .rx_irq = INT_7XX_McBSP2RX,
381 + .tx_irq = INT_7XX_McBSP2TX,
382 .ops = &omap1_mcbsp_ops,
385 -#define OMAP730_MCBSP_PDATA_SZ ARRAY_SIZE(omap730_mcbsp_pdata)
386 +#define OMAP7XX_MCBSP_PDATA_SZ ARRAY_SIZE(omap7xx_mcbsp_pdata)
388 -#define omap730_mcbsp_pdata NULL
389 -#define OMAP730_MCBSP_PDATA_SZ 0
390 +#define omap7xx_mcbsp_pdata NULL
391 +#define OMAP7XX_MCBSP_PDATA_SZ 0
394 #ifdef CONFIG_ARCH_OMAP15XX
395 @@ -172,8 +172,8 @@ static struct omap_mcbsp_platform_data o
397 int __init omap1_mcbsp_init(void)
399 - if (cpu_is_omap730())
400 - omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ;
401 + if (cpu_is_omap7xx())
402 + omap_mcbsp_count = OMAP7XX_MCBSP_PDATA_SZ;
403 if (cpu_is_omap15xx())
404 omap_mcbsp_count = OMAP15XX_MCBSP_PDATA_SZ;
405 if (cpu_is_omap16xx())
406 @@ -184,9 +184,9 @@ int __init omap1_mcbsp_init(void)
410 - if (cpu_is_omap730())
411 - omap_mcbsp_register_board_cfg(omap730_mcbsp_pdata,
412 - OMAP730_MCBSP_PDATA_SZ);
413 + if (cpu_is_omap7xx())
414 + omap_mcbsp_register_board_cfg(omap7xx_mcbsp_pdata,
415 + OMAP7XX_MCBSP_PDATA_SZ);
417 if (cpu_is_omap15xx())
418 omap_mcbsp_register_board_cfg(omap15xx_mcbsp_pdata,
419 --- a/arch/arm/mach-omap1/mux.c
420 +++ b/arch/arm/mach-omap1/mux.c
423 static struct omap_mux_cfg arch_mux_cfg;
425 -#ifdef CONFIG_ARCH_OMAP730
426 -static struct pin_config __initdata_or_module omap730_pins[] = {
427 -MUX_CFG_730("E2_730_KBR0", 12, 21, 0, 20, 1, 0)
428 -MUX_CFG_730("J7_730_KBR1", 12, 25, 0, 24, 1, 0)
429 -MUX_CFG_730("E1_730_KBR2", 12, 29, 0, 28, 1, 0)
430 -MUX_CFG_730("F3_730_KBR3", 13, 1, 0, 0, 1, 0)
431 -MUX_CFG_730("D2_730_KBR4", 13, 5, 0, 4, 1, 0)
432 -MUX_CFG_730("C2_730_KBC0", 13, 9, 0, 8, 1, 0)
433 -MUX_CFG_730("D3_730_KBC1", 13, 13, 0, 12, 1, 0)
434 -MUX_CFG_730("E4_730_KBC2", 13, 17, 0, 16, 1, 0)
435 -MUX_CFG_730("F4_730_KBC3", 13, 21, 0, 20, 1, 0)
436 -MUX_CFG_730("E3_730_KBC4", 13, 25, 0, 24, 1, 0)
438 -MUX_CFG_730("AA17_730_USB_DM", 2, 21, 0, 20, 0, 0)
439 -MUX_CFG_730("W16_730_USB_PU_EN", 2, 25, 0, 24, 0, 0)
440 -MUX_CFG_730("W17_730_USB_VBUSI", 2, 29, 0, 28, 0, 0)
441 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
442 +static struct pin_config __initdata_or_module omap7xx_pins[] = {
443 +MUX_CFG_7XX("E2_7XX_KBR0", 12, 21, 0, 20, 1, 0)
444 +MUX_CFG_7XX("J7_7XX_KBR1", 12, 25, 0, 24, 1, 0)
445 +MUX_CFG_7XX("E1_7XX_KBR2", 12, 29, 0, 28, 1, 0)
446 +MUX_CFG_7XX("F3_7XX_KBR3", 13, 1, 0, 0, 1, 0)
447 +MUX_CFG_7XX("D2_7XX_KBR4", 13, 5, 0, 4, 1, 0)
448 +MUX_CFG_7XX("C2_7XX_KBC0", 13, 9, 0, 8, 1, 0)
449 +MUX_CFG_7XX("D3_7XX_KBC1", 13, 13, 0, 12, 1, 0)
450 +MUX_CFG_7XX("E4_7XX_KBC2", 13, 17, 0, 16, 1, 0)
451 +MUX_CFG_7XX("F4_7XX_KBC3", 13, 21, 0, 20, 1, 0)
452 +MUX_CFG_7XX("E3_7XX_KBC4", 13, 25, 0, 24, 1, 0)
454 +MUX_CFG_7XX("AA17_7XX_USB_DM", 2, 21, 0, 20, 0, 0)
455 +MUX_CFG_7XX("W16_7XX_USB_PU_EN", 2, 25, 0, 24, 0, 0)
456 +MUX_CFG_7XX("W17_7XX_USB_VBUSI", 2, 29, 0, 28, 0, 0)
458 -#define OMAP730_PINS_SZ ARRAY_SIZE(omap730_pins)
459 +#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins)
461 -#define omap730_pins NULL
462 -#define OMAP730_PINS_SZ 0
463 -#endif /* CONFIG_ARCH_OMAP730 */
465 -#ifdef CONFIG_ARCH_OMAP850
466 -struct pin_config __initdata_or_module omap850_pins[] = {
467 -MUX_CFG_850("E2_850_KBR0", 12, 21, 0, 20, 1, 0)
468 -MUX_CFG_850("J7_850_KBR1", 12, 25, 0, 24, 1, 0)
469 -MUX_CFG_850("E1_850_KBR2", 12, 29, 0, 28, 1, 0)
470 -MUX_CFG_850("F3_850_KBR3", 13, 1, 0, 0, 1, 0)
471 -MUX_CFG_850("D2_850_KBR4", 13, 5, 0, 4, 1, 0)
472 -MUX_CFG_850("C2_850_KBC0", 13, 9, 0, 8, 1, 0)
473 -MUX_CFG_850("D3_850_KBC1", 13, 13, 0, 12, 1, 0)
474 -MUX_CFG_850("E4_850_KBC2", 13, 17, 0, 16, 1, 0)
475 -MUX_CFG_850("F4_850_KBC3", 13, 21, 0, 20, 1, 0)
476 -MUX_CFG_850("E3_850_KBC4", 13, 25, 0, 24, 1, 0)
478 -MUX_CFG_850("AA17_850_USB_DM", 2, 21, 0, 20, 0, 0)
479 -MUX_CFG_850("W16_850_USB_PU_EN", 2, 25, 0, 24, 0, 0)
480 -MUX_CFG_850("W17_850_USB_VBUSI", 2, 29, 0, 28, 0, 0)
483 +#define omap7xx_pins NULL
484 +#define OMAP7XX_PINS_SZ 0
485 +#endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */
487 #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
488 static struct pin_config __initdata_or_module omap1xxx_pins[] = {
489 @@ -438,11 +419,6 @@ int __init_or_module omap1_cfg_reg(const
490 printk(" %s (0x%08x) = 0x%08x -> 0x%08x\n",
491 cfg->pull_name, cfg->pull_reg, pull_orig, pull);
494 -#ifdef CONFIG_ARCH_OMAP850
495 - omap_mux_register(omap850_pins, ARRAY_SIZE(omap850_pins));
500 #ifdef CONFIG_OMAP_MUX_ERRORS
501 @@ -454,9 +430,9 @@ int __init_or_module omap1_cfg_reg(const
503 int __init omap1_mux_init(void)
505 - if (cpu_is_omap730()) {
506 - arch_mux_cfg.pins = omap730_pins;
507 - arch_mux_cfg.size = OMAP730_PINS_SZ;
508 + if (cpu_is_omap7xx()) {
509 + arch_mux_cfg.pins = omap7xx_pins;
510 + arch_mux_cfg.size = OMAP7XX_PINS_SZ;
511 arch_mux_cfg.cfg_reg = omap1_cfg_reg;
514 --- a/arch/arm/mach-omap1/pm.c
515 +++ b/arch/arm/mach-omap1/pm.c
517 static unsigned int arm_sleep_save[ARM_SLEEP_SAVE_SIZE];
518 static unsigned short dsp_sleep_save[DSP_SLEEP_SAVE_SIZE];
519 static unsigned short ulpd_sleep_save[ULPD_SLEEP_SAVE_SIZE];
520 -static unsigned int mpui730_sleep_save[MPUI730_SLEEP_SAVE_SIZE];
521 +static unsigned int mpui7xx_sleep_save[MPUI7XX_SLEEP_SAVE_SIZE];
522 static unsigned int mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_SIZE];
523 static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
525 @@ -183,9 +183,9 @@ static void omap_pm_wakeup_setup(void)
526 * drivers must still separately call omap_set_gpio_wakeup() to
527 * wake up to a GPIO interrupt.
529 - if (cpu_is_omap730())
530 - level1_wake = OMAP_IRQ_BIT(INT_730_GPIO_BANK1) |
531 - OMAP_IRQ_BIT(INT_730_IH2_IRQ);
532 + if (cpu_is_omap7xx())
533 + level1_wake = OMAP_IRQ_BIT(INT_7XX_GPIO_BANK1) |
534 + OMAP_IRQ_BIT(INT_7XX_IH2_IRQ);
535 else if (cpu_is_omap15xx())
536 level1_wake = OMAP_IRQ_BIT(INT_GPIO_BANK1) |
537 OMAP_IRQ_BIT(INT_1510_IH2_IRQ);
538 @@ -195,10 +195,10 @@ static void omap_pm_wakeup_setup(void)
540 omap_writel(~level1_wake, OMAP_IH1_MIR);
542 - if (cpu_is_omap730()) {
543 + if (cpu_is_omap7xx()) {
544 omap_writel(~level2_wake, OMAP_IH2_0_MIR);
545 - omap_writel(~(OMAP_IRQ_BIT(INT_730_WAKE_UP_REQ) |
546 - OMAP_IRQ_BIT(INT_730_MPUIO_KEYPAD)),
547 + omap_writel(~(OMAP_IRQ_BIT(INT_7XX_WAKE_UP_REQ) |
548 + OMAP_IRQ_BIT(INT_7XX_MPUIO_KEYPAD)),
550 } else if (cpu_is_omap15xx()) {
551 level2_wake |= OMAP_IRQ_BIT(INT_KEYBOARD);
552 @@ -253,15 +253,15 @@ void omap1_pm_suspend(void)
553 * Save interrupt, MPUI, ARM and UPLD control registers.
556 - if (cpu_is_omap730()) {
557 - MPUI730_SAVE(OMAP_IH1_MIR);
558 - MPUI730_SAVE(OMAP_IH2_0_MIR);
559 - MPUI730_SAVE(OMAP_IH2_1_MIR);
560 - MPUI730_SAVE(MPUI_CTRL);
561 - MPUI730_SAVE(MPUI_DSP_BOOT_CONFIG);
562 - MPUI730_SAVE(MPUI_DSP_API_CONFIG);
563 - MPUI730_SAVE(EMIFS_CONFIG);
564 - MPUI730_SAVE(EMIFF_SDRAM_CONFIG);
565 + if (cpu_is_omap7xx()) {
566 + MPUI7XX_SAVE(OMAP_IH1_MIR);
567 + MPUI7XX_SAVE(OMAP_IH2_0_MIR);
568 + MPUI7XX_SAVE(OMAP_IH2_1_MIR);
569 + MPUI7XX_SAVE(MPUI_CTRL);
570 + MPUI7XX_SAVE(MPUI_DSP_BOOT_CONFIG);
571 + MPUI7XX_SAVE(MPUI_DSP_API_CONFIG);
572 + MPUI7XX_SAVE(EMIFS_CONFIG);
573 + MPUI7XX_SAVE(EMIFF_SDRAM_CONFIG);
575 } else if (cpu_is_omap15xx()) {
576 MPUI1510_SAVE(OMAP_IH1_MIR);
577 @@ -306,7 +306,7 @@ void omap1_pm_suspend(void)
578 omap_writew(omap_readw(ARM_RSTCT1) & ~(1 << DSP_EN), ARM_RSTCT1);
580 /* shut down dsp_ck */
581 - if (!cpu_is_omap730())
582 + if (!cpu_is_omap7xx())
583 omap_writew(omap_readw(ARM_CKCTL) & ~(1 << EN_DSPCK), ARM_CKCTL);
585 /* temporarily enabling api_ck to access DSP registers */
586 @@ -383,12 +383,12 @@ void omap1_pm_suspend(void)
587 ULPD_RESTORE(ULPD_CLOCK_CTRL);
588 ULPD_RESTORE(ULPD_STATUS_REQ);
590 - if (cpu_is_omap730()) {
591 - MPUI730_RESTORE(EMIFS_CONFIG);
592 - MPUI730_RESTORE(EMIFF_SDRAM_CONFIG);
593 - MPUI730_RESTORE(OMAP_IH1_MIR);
594 - MPUI730_RESTORE(OMAP_IH2_0_MIR);
595 - MPUI730_RESTORE(OMAP_IH2_1_MIR);
596 + if (cpu_is_omap7xx()) {
597 + MPUI7XX_RESTORE(EMIFS_CONFIG);
598 + MPUI7XX_RESTORE(EMIFF_SDRAM_CONFIG);
599 + MPUI7XX_RESTORE(OMAP_IH1_MIR);
600 + MPUI7XX_RESTORE(OMAP_IH2_0_MIR);
601 + MPUI7XX_RESTORE(OMAP_IH2_1_MIR);
602 } else if (cpu_is_omap15xx()) {
603 MPUI1510_RESTORE(MPUI_CTRL);
604 MPUI1510_RESTORE(MPUI_DSP_BOOT_CONFIG);
605 @@ -461,13 +461,13 @@ static int omap_pm_read_proc(
606 ULPD_SAVE(ULPD_DPLL_CTRL);
607 ULPD_SAVE(ULPD_POWER_CTRL);
609 - if (cpu_is_omap730()) {
610 - MPUI730_SAVE(MPUI_CTRL);
611 - MPUI730_SAVE(MPUI_DSP_STATUS);
612 - MPUI730_SAVE(MPUI_DSP_BOOT_CONFIG);
613 - MPUI730_SAVE(MPUI_DSP_API_CONFIG);
614 - MPUI730_SAVE(EMIFF_SDRAM_CONFIG);
615 - MPUI730_SAVE(EMIFS_CONFIG);
616 + if (cpu_is_omap7xx()) {
617 + MPUI7XX_SAVE(MPUI_CTRL);
618 + MPUI7XX_SAVE(MPUI_DSP_STATUS);
619 + MPUI7XX_SAVE(MPUI_DSP_BOOT_CONFIG);
620 + MPUI7XX_SAVE(MPUI_DSP_API_CONFIG);
621 + MPUI7XX_SAVE(EMIFF_SDRAM_CONFIG);
622 + MPUI7XX_SAVE(EMIFS_CONFIG);
623 } else if (cpu_is_omap15xx()) {
624 MPUI1510_SAVE(MPUI_CTRL);
625 MPUI1510_SAVE(MPUI_DSP_STATUS);
626 @@ -517,20 +517,20 @@ static int omap_pm_read_proc(
627 ULPD_SHOW(ULPD_STATUS_REQ),
628 ULPD_SHOW(ULPD_POWER_CTRL));
630 - if (cpu_is_omap730()) {
631 + if (cpu_is_omap7xx()) {
632 my_buffer_offset += sprintf(my_base + my_buffer_offset,
633 - "MPUI730_CTRL_REG 0x%-8x \n"
634 - "MPUI730_DSP_STATUS_REG: 0x%-8x \n"
635 - "MPUI730_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
636 - "MPUI730_DSP_API_CONFIG_REG: 0x%-8x \n"
637 - "MPUI730_SDRAM_CONFIG_REG: 0x%-8x \n"
638 - "MPUI730_EMIFS_CONFIG_REG: 0x%-8x \n",
639 - MPUI730_SHOW(MPUI_CTRL),
640 - MPUI730_SHOW(MPUI_DSP_STATUS),
641 - MPUI730_SHOW(MPUI_DSP_BOOT_CONFIG),
642 - MPUI730_SHOW(MPUI_DSP_API_CONFIG),
643 - MPUI730_SHOW(EMIFF_SDRAM_CONFIG),
644 - MPUI730_SHOW(EMIFS_CONFIG));
645 + "MPUI7XX_CTRL_REG 0x%-8x \n"
646 + "MPUI7XX_DSP_STATUS_REG: 0x%-8x \n"
647 + "MPUI7XX_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
648 + "MPUI7XX_DSP_API_CONFIG_REG: 0x%-8x \n"
649 + "MPUI7XX_SDRAM_CONFIG_REG: 0x%-8x \n"
650 + "MPUI7XX_EMIFS_CONFIG_REG: 0x%-8x \n",
651 + MPUI7XX_SHOW(MPUI_CTRL),
652 + MPUI7XX_SHOW(MPUI_DSP_STATUS),
653 + MPUI7XX_SHOW(MPUI_DSP_BOOT_CONFIG),
654 + MPUI7XX_SHOW(MPUI_DSP_API_CONFIG),
655 + MPUI7XX_SHOW(EMIFF_SDRAM_CONFIG),
656 + MPUI7XX_SHOW(EMIFS_CONFIG));
657 } else if (cpu_is_omap15xx()) {
658 my_buffer_offset += sprintf(my_base + my_buffer_offset,
659 "MPUI1510_CTRL_REG 0x%-8x \n"
660 @@ -668,9 +668,9 @@ static int __init omap_pm_init(void)
661 * These routines need to be in SRAM as that's the only
662 * memory the MPU can see when it wakes up.
664 - if (cpu_is_omap730()) {
665 - omap_sram_suspend = omap_sram_push(omap730_cpu_suspend,
666 - omap730_cpu_suspend_sz);
667 + if (cpu_is_omap7xx()) {
668 + omap_sram_suspend = omap_sram_push(omap7xx_cpu_suspend,
669 + omap7xx_cpu_suspend_sz);
670 } else if (cpu_is_omap15xx()) {
671 omap_sram_suspend = omap_sram_push(omap1510_cpu_suspend,
672 omap1510_cpu_suspend_sz);
673 @@ -686,8 +686,8 @@ static int __init omap_pm_init(void)
675 pm_idle = omap1_pm_idle;
677 - if (cpu_is_omap730())
678 - setup_irq(INT_730_WAKE_UP_REQ, &omap_wakeup_irq);
679 + if (cpu_is_omap7xx())
680 + setup_irq(INT_7XX_WAKE_UP_REQ, &omap_wakeup_irq);
681 else if (cpu_is_omap16xx())
682 setup_irq(INT_1610_WAKE_UP_REQ, &omap_wakeup_irq);
684 @@ -700,8 +700,8 @@ static int __init omap_pm_init(void)
685 omap_writew(ULPD_POWER_CTRL_REG_VAL, ULPD_POWER_CTRL);
687 /* Configure IDLECT3 */
688 - if (cpu_is_omap730())
689 - omap_writel(OMAP730_IDLECT3_VAL, OMAP730_IDLECT3);
690 + if (cpu_is_omap7xx())
691 + omap_writel(OMAP7XX_IDLECT3_VAL, OMAP7XX_IDLECT3);
692 else if (cpu_is_omap16xx())
693 omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3);
695 --- a/arch/arm/mach-omap1/pm.h
696 +++ b/arch/arm/mach-omap1/pm.h
698 #define OMAP1610_IDLECT3 0xfffece24
699 #define OMAP1610_IDLE_LOOP_REQUEST 0x0400
701 -#define OMAP730_IDLECT1_SLEEP_VAL 0x16c7
702 -#define OMAP730_IDLECT2_SLEEP_VAL 0x09c7
703 -#define OMAP730_IDLECT3_VAL 0x3f
704 -#define OMAP730_IDLECT3 0xfffece24
705 -#define OMAP730_IDLE_LOOP_REQUEST 0x0C00
706 +#define OMAP7XX_IDLECT1_SLEEP_VAL 0x16c7
707 +#define OMAP7XX_IDLECT2_SLEEP_VAL 0x09c7
708 +#define OMAP7XX_IDLECT3_VAL 0x3f
709 +#define OMAP7XX_IDLECT3 0xfffece24
710 +#define OMAP7XX_IDLE_LOOP_REQUEST 0x0C00
712 #if !defined(CONFIG_ARCH_OMAP730) && \
713 + !defined(CONFIG_ARCH_OMAP850) && \
714 !defined(CONFIG_ARCH_OMAP15XX) && \
715 !defined(CONFIG_ARCH_OMAP16XX)
716 #warning "Power management for this processor not implemented yet"
717 @@ -122,17 +123,17 @@ extern void allow_idle_sleep(void);
718 extern void omap1_pm_idle(void);
719 extern void omap1_pm_suspend(void);
721 -extern void omap730_cpu_suspend(unsigned short, unsigned short);
722 +extern void omap7xx_cpu_suspend(unsigned short, unsigned short);
723 extern void omap1510_cpu_suspend(unsigned short, unsigned short);
724 extern void omap1610_cpu_suspend(unsigned short, unsigned short);
725 -extern void omap730_idle_loop_suspend(void);
726 +extern void omap7xx_idle_loop_suspend(void);
727 extern void omap1510_idle_loop_suspend(void);
728 extern void omap1610_idle_loop_suspend(void);
730 -extern unsigned int omap730_cpu_suspend_sz;
731 +extern unsigned int omap7xx_cpu_suspend_sz;
732 extern unsigned int omap1510_cpu_suspend_sz;
733 extern unsigned int omap1610_cpu_suspend_sz;
734 -extern unsigned int omap730_idle_loop_suspend_sz;
735 +extern unsigned int omap7xx_idle_loop_suspend_sz;
736 extern unsigned int omap1510_idle_loop_suspend_sz;
737 extern unsigned int omap1610_idle_loop_suspend_sz;
739 @@ -155,9 +156,9 @@ extern void omap_serial_wake_trigger(int
740 #define ULPD_RESTORE(x) omap_writew((ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]), (x))
741 #define ULPD_SHOW(x) ulpd_sleep_save[ULPD_SLEEP_SAVE_##x]
743 -#define MPUI730_SAVE(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x] = omap_readl(x)
744 -#define MPUI730_RESTORE(x) omap_writel((mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]), (x))
745 -#define MPUI730_SHOW(x) mpui730_sleep_save[MPUI730_SLEEP_SAVE_##x]
746 +#define MPUI7XX_SAVE(x) mpui7xx_sleep_save[MPUI7XX_SLEEP_SAVE_##x] = omap_readl(x)
747 +#define MPUI7XX_RESTORE(x) omap_writel((mpui7xx_sleep_save[MPUI7XX_SLEEP_SAVE_##x]), (x))
748 +#define MPUI7XX_SHOW(x) mpui7xx_sleep_save[MPUI7XX_SLEEP_SAVE_##x]
750 #define MPUI1510_SAVE(x) mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x] = omap_readl(x)
751 #define MPUI1510_RESTORE(x) omap_writel((mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_##x]), (x))
752 @@ -232,24 +233,24 @@ enum mpui1510_save_state {
756 -enum mpui730_save_state {
757 - MPUI730_SLEEP_SAVE_START = 0,
758 +enum mpui7xx_save_state {
759 + MPUI7XX_SLEEP_SAVE_START = 0,
761 * MPUI registers 32 bits
763 - MPUI730_SLEEP_SAVE_MPUI_CTRL,
764 - MPUI730_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
765 - MPUI730_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
766 - MPUI730_SLEEP_SAVE_MPUI_DSP_STATUS,
767 - MPUI730_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
768 - MPUI730_SLEEP_SAVE_EMIFS_CONFIG,
769 - MPUI730_SLEEP_SAVE_OMAP_IH1_MIR,
770 - MPUI730_SLEEP_SAVE_OMAP_IH2_0_MIR,
771 - MPUI730_SLEEP_SAVE_OMAP_IH2_1_MIR,
772 -#if defined(CONFIG_ARCH_OMAP730)
773 - MPUI730_SLEEP_SAVE_SIZE
774 + MPUI7XX_SLEEP_SAVE_MPUI_CTRL,
775 + MPUI7XX_SLEEP_SAVE_MPUI_DSP_BOOT_CONFIG,
776 + MPUI7XX_SLEEP_SAVE_MPUI_DSP_API_CONFIG,
777 + MPUI7XX_SLEEP_SAVE_MPUI_DSP_STATUS,
778 + MPUI7XX_SLEEP_SAVE_EMIFF_SDRAM_CONFIG,
779 + MPUI7XX_SLEEP_SAVE_EMIFS_CONFIG,
780 + MPUI7XX_SLEEP_SAVE_OMAP_IH1_MIR,
781 + MPUI7XX_SLEEP_SAVE_OMAP_IH2_0_MIR,
782 + MPUI7XX_SLEEP_SAVE_OMAP_IH2_1_MIR,
783 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
784 + MPUI7XX_SLEEP_SAVE_SIZE
786 - MPUI730_SLEEP_SAVE_SIZE = 0
787 + MPUI7XX_SLEEP_SAVE_SIZE = 0
791 --- a/arch/arm/mach-omap1/serial.c
792 +++ b/arch/arm/mach-omap1/serial.c
793 @@ -64,7 +64,6 @@ static void __init omap_serial_reset(str
795 static struct plat_serial8250_port serial_platform_data[] = {
797 - .membase = OMAP1_IO_ADDRESS(OMAP_UART1_BASE),
798 .mapbase = OMAP_UART1_BASE,
800 .flags = UPF_BOOT_AUTOCONF,
801 @@ -73,7 +72,6 @@ static struct plat_serial8250_port seria
802 .uartclk = OMAP16XX_BASE_BAUD * 16,
805 - .membase = OMAP1_IO_ADDRESS(OMAP_UART2_BASE),
806 .mapbase = OMAP_UART2_BASE,
808 .flags = UPF_BOOT_AUTOCONF,
809 @@ -82,7 +80,6 @@ static struct plat_serial8250_port seria
810 .uartclk = OMAP16XX_BASE_BAUD * 16,
813 - .membase = OMAP1_IO_ADDRESS(OMAP_UART3_BASE),
814 .mapbase = OMAP_UART3_BASE,
816 .flags = UPF_BOOT_AUTOCONF,
817 @@ -90,7 +87,6 @@ static struct plat_serial8250_port seria
819 .uartclk = OMAP16XX_BASE_BAUD * 16,
824 static struct platform_device serial_device = {
825 @@ -110,18 +106,11 @@ void __init omap_serial_init(void)
829 - if (cpu_is_omap730()) {
830 + if (cpu_is_omap7xx()) {
831 serial_platform_data[0].regshift = 0;
832 serial_platform_data[1].regshift = 0;
833 - serial_platform_data[0].irq = INT_730_UART_MODEM_1;
834 - serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
837 - if (cpu_is_omap850()) {
838 - serial_platform_data[0].regshift = 0;
839 - serial_platform_data[1].regshift = 0;
840 - serial_platform_data[0].irq = INT_850_UART_MODEM_1;
841 - serial_platform_data[1].irq = INT_850_UART_MODEM_IRDA_2;
842 + serial_platform_data[0].irq = INT_7XX_UART_MODEM_1;
843 + serial_platform_data[1].irq = INT_7XX_UART_MODEM_IRDA_2;
846 if (cpu_is_omap15xx()) {
847 --- a/arch/arm/mach-omap1/sleep.S
848 +++ b/arch/arm/mach-omap1/sleep.S
851 * linux/arch/arm/mach-omap1/sleep.S
853 - * Low-level OMAP730/1510/1610 sleep/wakeUp support
854 + * Low-level OMAP7XX/1510/1610 sleep/wakeUp support
856 * Initial SA1110 code:
857 * Copyright (c) 2001 Cliff Brake <cbrake@accelent.com>
862 -#if defined(CONFIG_ARCH_OMAP730)
863 -ENTRY(omap730_cpu_suspend)
864 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
865 +ENTRY(omap7xx_cpu_suspend)
867 @ save registers on stack
868 stmfd sp!, {r0 - r12, lr}
869 @@ -91,13 +91,13 @@ ENTRY(omap730_cpu_suspend)
871 @ turn off clock domains
872 @ do not disable PERCK (0x04)
873 - mov r5, #OMAP730_IDLECT2_SLEEP_VAL & 0xff
874 - orr r5, r5, #OMAP730_IDLECT2_SLEEP_VAL & 0xff00
875 + mov r5, #OMAP7XX_IDLECT2_SLEEP_VAL & 0xff
876 + orr r5, r5, #OMAP7XX_IDLECT2_SLEEP_VAL & 0xff00
877 strh r5, [r4, #ARM_IDLECT2_ASM_OFFSET & 0xff]
880 - mov r3, #OMAP730_IDLECT1_SLEEP_VAL & 0xff
881 - orr r3, r3, #OMAP730_IDLECT1_SLEEP_VAL & 0xff00
882 + mov r3, #OMAP7XX_IDLECT1_SLEEP_VAL & 0xff
883 + orr r3, r3, #OMAP7XX_IDLECT1_SLEEP_VAL & 0xff00
884 strh r3, [r4, #ARM_IDLECT1_ASM_OFFSET & 0xff]
886 @ disable instruction cache
887 @@ -113,7 +113,7 @@ ENTRY(omap730_cpu_suspend)
889 mcr p15, 0, r2, c7, c0, 4 @ wait for interrupt
891 - * omap730_cpu_suspend()'s resume point.
892 + * omap7xx_cpu_suspend()'s resume point.
894 * It will just start executing here, so we'll restore stuff from the
896 @@ -132,9 +132,9 @@ ENTRY(omap730_cpu_suspend)
897 @ restore regs and return
898 ldmfd sp!, {r0 - r12, pc}
900 -ENTRY(omap730_cpu_suspend_sz)
901 - .word . - omap730_cpu_suspend
902 -#endif /* CONFIG_ARCH_OMAP730 */
903 +ENTRY(omap7xx_cpu_suspend_sz)
904 + .word . - omap7xx_cpu_suspend
905 +#endif /* CONFIG_ARCH_OMAP730 || CONFIG_ARCH_OMAP850 */
907 #ifdef CONFIG_ARCH_OMAP15XX
908 ENTRY(omap1510_cpu_suspend)
909 --- a/arch/arm/mach-omap2/Makefile
910 +++ b/arch/arm/mach-omap2/Makefile
911 @@ -80,6 +80,7 @@ obj-$(CONFIG_MACH_OMAP_4430SDP) += boar
912 # Platform specific device init code
914 obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
917 onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o
918 obj-y += $(onenand-m) $(onenand-y)
919 --- a/arch/arm/mach-omap2/board-2430sdp.c
920 +++ b/arch/arm/mach-omap2/board-2430sdp.c
921 @@ -221,7 +221,7 @@ static void __init omap_2430sdp_map_io(v
922 MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
923 /* Maintainer: Syed Khasim - Texas Instruments Inc */
924 .phys_io = 0x48000000,
925 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
926 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
927 .boot_params = 0x80000100,
928 .map_io = omap_2430sdp_map_io,
929 .init_irq = omap_2430sdp_init_irq,
930 --- a/arch/arm/mach-omap2/board-3430sdp.c
931 +++ b/arch/arm/mach-omap2/board-3430sdp.c
932 @@ -618,6 +618,18 @@ static void enable_board_wakeup_source(v
933 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */
936 +static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
938 + .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
939 + .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
940 + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
943 + .reset_gpio_port[0] = 57,
944 + .reset_gpio_port[1] = 61,
945 + .reset_gpio_port[2] = -EINVAL
948 static void __init omap_3430sdp_init(void)
951 @@ -635,6 +647,7 @@ static void __init omap_3430sdp_init(voi
953 sdp3430_display_init();
954 enable_board_wakeup_source();
955 + usb_ehci_init(&ehci_pdata);
958 static void __init omap_3430sdp_map_io(void)
959 @@ -646,7 +659,7 @@ static void __init omap_3430sdp_map_io(v
960 MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
961 /* Maintainer: Syed Khasim - Texas Instruments Inc */
962 .phys_io = 0x48000000,
963 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
964 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
965 .boot_params = 0x80000100,
966 .map_io = omap_3430sdp_map_io,
967 .init_irq = omap_3430sdp_init_irq,
968 --- a/arch/arm/mach-omap2/board-4430sdp.c
969 +++ b/arch/arm/mach-omap2/board-4430sdp.c
970 @@ -52,8 +52,17 @@ static struct omap_board_config_kernel s
972 static void __init gic_init_irq(void)
974 - gic_dist_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_DIST_BASE), 29);
975 - gic_cpu_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE));
976 + void __iomem *base;
978 + /* Static mapping, never released */
979 + base = ioremap(OMAP44XX_GIC_DIST_BASE, SZ_4K);
981 + gic_dist_init(0, base, 29);
983 + /* Static mapping, never released */
984 + base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_256);
986 + gic_cpu_init(0, OMAP44XX_GIC_CPU_BASE);
989 static void __init omap_4430sdp_init_irq(void)
990 @@ -84,7 +93,7 @@ static void __init omap_4430sdp_map_io(v
991 MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
992 /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */
993 .phys_io = 0x48000000,
994 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
995 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
996 .boot_params = 0x80000100,
997 .map_io = omap_4430sdp_map_io,
998 .init_irq = omap_4430sdp_init_irq,
999 --- a/arch/arm/mach-omap2/board-apollon.c
1000 +++ b/arch/arm/mach-omap2/board-apollon.c
1001 @@ -333,7 +333,7 @@ static void __init omap_apollon_map_io(v
1002 MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
1003 /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
1004 .phys_io = 0x48000000,
1005 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1006 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1007 .boot_params = 0x80000100,
1008 .map_io = omap_apollon_map_io,
1009 .init_irq = omap_apollon_init_irq,
1010 --- a/arch/arm/mach-omap2/board-generic.c
1011 +++ b/arch/arm/mach-omap2/board-generic.c
1012 @@ -56,7 +56,7 @@ static void __init omap_generic_map_io(v
1013 MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
1014 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
1015 .phys_io = 0x48000000,
1016 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1017 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1018 .boot_params = 0x80000100,
1019 .map_io = omap_generic_map_io,
1020 .init_irq = omap_generic_init_irq,
1021 --- a/arch/arm/mach-omap2/board-h4.c
1022 +++ b/arch/arm/mach-omap2/board-h4.c
1023 @@ -376,7 +376,7 @@ static void __init omap_h4_map_io(void)
1024 MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
1025 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
1026 .phys_io = 0x48000000,
1027 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1028 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1029 .boot_params = 0x80000100,
1030 .map_io = omap_h4_map_io,
1031 .init_irq = omap_h4_init_irq,
1032 --- a/arch/arm/mach-omap2/board-ldp.c
1033 +++ b/arch/arm/mach-omap2/board-ldp.c
1034 @@ -399,7 +399,7 @@ static void __init omap_ldp_map_io(void)
1036 MACHINE_START(OMAP_LDP, "OMAP LDP board")
1037 .phys_io = 0x48000000,
1038 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1039 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1040 .boot_params = 0x80000100,
1041 .map_io = omap_ldp_map_io,
1042 .init_irq = omap_ldp_init_irq,
1043 --- a/arch/arm/mach-omap2/board-n8x0.c
1044 +++ b/arch/arm/mach-omap2/board-n8x0.c
1045 @@ -121,7 +121,7 @@ static void __init n8x0_init_machine(voi
1047 MACHINE_START(NOKIA_N800, "Nokia N800")
1048 .phys_io = 0x48000000,
1049 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1050 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1051 .boot_params = 0x80000100,
1052 .map_io = n8x0_map_io,
1053 .init_irq = n8x0_init_irq,
1054 @@ -131,7 +131,7 @@ MACHINE_END
1056 MACHINE_START(NOKIA_N810, "Nokia N810")
1057 .phys_io = 0x48000000,
1058 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1059 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1060 .boot_params = 0x80000100,
1061 .map_io = n8x0_map_io,
1062 .init_irq = n8x0_init_irq,
1063 @@ -141,7 +141,7 @@ MACHINE_END
1065 MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
1066 .phys_io = 0x48000000,
1067 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1068 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1069 .boot_params = 0x80000100,
1070 .map_io = n8x0_map_io,
1071 .init_irq = n8x0_init_irq,
1072 --- a/arch/arm/mach-omap2/board-omap3beagle.c
1073 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
1074 @@ -400,6 +400,18 @@ static void __init omap3beagle_flash_ini
1078 +static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
1080 + .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
1081 + .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
1082 + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1084 + .phy_reset = true,
1085 + .reset_gpio_port[0] = -EINVAL,
1086 + .reset_gpio_port[1] = 147,
1087 + .reset_gpio_port[2] = -EINVAL
1090 static void __init omap3_beagle_init(void)
1092 omap3_beagle_i2c_init();
1093 @@ -413,6 +425,7 @@ static void __init omap3_beagle_init(voi
1094 gpio_direction_output(170, true);
1097 + usb_ehci_init(&ehci_pdata);
1098 omap3beagle_flash_init();
1100 /* Ensure SDRC pins are mux'd for self-refresh */
1101 @@ -429,7 +442,7 @@ static void __init omap3_beagle_map_io(v
1102 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
1103 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
1104 .phys_io = 0x48000000,
1105 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1106 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1107 .boot_params = 0x80000100,
1108 .map_io = omap3_beagle_map_io,
1109 .init_irq = omap3_beagle_init_irq,
1110 --- a/arch/arm/mach-omap2/board-omap3evm.c
1111 +++ b/arch/arm/mach-omap2/board-omap3evm.c
1112 @@ -297,6 +297,18 @@ static struct platform_device *omap3_evm
1113 &omap3evm_smc911x_device,
1116 +static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
1118 + .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1119 + .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
1120 + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1122 + .phy_reset = true,
1123 + .reset_gpio_port[0] = -EINVAL,
1124 + .reset_gpio_port[1] = 135,
1125 + .reset_gpio_port[2] = -EINVAL
1128 static void __init omap3_evm_init(void)
1130 omap3_evm_i2c_init();
1131 @@ -312,6 +324,9 @@ static void __init omap3_evm_init(void)
1132 usb_nop_xceiv_register();
1135 + /* Setup EHCI phy reset padconfig */
1136 + omap_cfg_reg(AF4_34XX_GPIO135_OUT);
1137 + usb_ehci_init(&ehci_pdata);
1141 @@ -324,7 +339,7 @@ static void __init omap3_evm_map_io(void
1142 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
1143 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
1144 .phys_io = 0x48000000,
1145 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1146 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1147 .boot_params = 0x80000100,
1148 .map_io = omap3_evm_map_io,
1149 .init_irq = omap3_evm_init_irq,
1150 --- a/arch/arm/mach-omap2/board-omap3pandora.c
1151 +++ b/arch/arm/mach-omap2/board-omap3pandora.c
1152 @@ -387,6 +387,18 @@ static struct platform_device *omap3pand
1156 +static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
1158 + .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
1159 + .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1160 + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1162 + .phy_reset = true,
1163 + .reset_gpio_port[0] = 16,
1164 + .reset_gpio_port[1] = -EINVAL,
1165 + .reset_gpio_port[2] = -EINVAL
1168 static void __init omap3pandora_init(void)
1170 omap3pandora_i2c_init();
1171 @@ -396,6 +408,7 @@ static void __init omap3pandora_init(voi
1172 spi_register_board_info(omap3pandora_spi_board_info,
1173 ARRAY_SIZE(omap3pandora_spi_board_info));
1174 omap3pandora_ads7846_init();
1175 + usb_ehci_init(&ehci_pdata);
1176 pandora_keys_gpio_init();
1179 @@ -412,7 +425,7 @@ static void __init omap3pandora_map_io(v
1181 MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
1182 .phys_io = 0x48000000,
1183 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1184 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1185 .boot_params = 0x80000100,
1186 .map_io = omap3pandora_map_io,
1187 .init_irq = omap3pandora_init_irq,
1188 --- a/arch/arm/mach-omap2/board-overo.c
1189 +++ b/arch/arm/mach-omap2/board-overo.c
1190 @@ -384,6 +384,18 @@ static struct platform_device *overo_dev
1194 +static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
1195 + .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1196 + .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
1197 + .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
1199 + .phy_reset = true,
1200 + .reset_gpio_port[0] = -EINVAL,
1201 + .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
1202 + .reset_gpio_port[2] = -EINVAL
1206 static void __init overo_init(void)
1209 @@ -391,6 +403,7 @@ static void __init overo_init(void)
1213 + usb_ehci_init(&ehci_pdata);
1214 overo_ads7846_init();
1215 overo_init_smsc911x();
1217 @@ -433,14 +446,6 @@ static void __init overo_init(void)
1219 printk(KERN_ERR "could not obtain gpio for "
1220 "OVERO_GPIO_USBH_CPEN\n");
1222 - if ((gpio_request(OVERO_GPIO_USBH_NRESET,
1223 - "OVERO_GPIO_USBH_NRESET") == 0) &&
1224 - (gpio_direction_output(OVERO_GPIO_USBH_NRESET, 1) == 0))
1225 - gpio_export(OVERO_GPIO_USBH_NRESET, 0);
1227 - printk(KERN_ERR "could not obtain gpio for "
1228 - "OVERO_GPIO_USBH_NRESET\n");
1231 static void __init overo_map_io(void)
1232 @@ -451,7 +456,7 @@ static void __init overo_map_io(void)
1234 MACHINE_START(OVERO, "Gumstix Overo")
1235 .phys_io = 0x48000000,
1236 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1237 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1238 .boot_params = 0x80000100,
1239 .map_io = overo_map_io,
1240 .init_irq = overo_init_irq,
1241 --- a/arch/arm/mach-omap2/board-rx51.c
1242 +++ b/arch/arm/mach-omap2/board-rx51.c
1243 @@ -84,7 +84,7 @@ static void __init rx51_map_io(void)
1244 MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
1245 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
1246 .phys_io = 0x48000000,
1247 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1248 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1249 .boot_params = 0x80000100,
1250 .map_io = rx51_map_io,
1251 .init_irq = rx51_init_irq,
1252 --- a/arch/arm/mach-omap2/board-zoom2.c
1253 +++ b/arch/arm/mach-omap2/board-zoom2.c
1254 @@ -282,7 +282,7 @@ static void __init omap_zoom2_map_io(voi
1256 MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
1257 .phys_io = 0x48000000,
1258 - .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
1259 + .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
1260 .boot_params = 0x80000100,
1261 .map_io = omap_zoom2_map_io,
1262 .init_irq = omap_zoom2_init_irq,
1263 --- a/arch/arm/mach-omap2/cm.h
1264 +++ b/arch/arm/mach-omap2/cm.h
1266 #include "prcm-common.h"
1268 #define OMAP2420_CM_REGADDR(module, reg) \
1269 - OMAP2_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
1270 + OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
1271 #define OMAP2430_CM_REGADDR(module, reg) \
1272 - OMAP2_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
1273 + OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
1274 #define OMAP34XX_CM_REGADDR(module, reg) \
1275 - OMAP2_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
1276 + OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
1279 * Architecture-specific global CM registers
1280 --- a/arch/arm/mach-omap2/id.c
1281 +++ b/arch/arm/mach-omap2/id.c
1283 static struct omap_chip_id omap_chip;
1284 static unsigned int omap_revision;
1286 +u32 omap3_features;
1288 unsigned int omap_rev(void)
1290 @@ -155,12 +156,37 @@ void __init omap24xx_check_revision(void
1294 -void __init omap34xx_check_revision(void)
1295 +#define OMAP3_CHECK_FEATURE(status,feat) \
1296 + if (((status & OMAP3_ ##feat## _MASK) \
1297 + >> OMAP3_ ##feat## _SHIFT) != FEAT_ ##feat## _NONE) { \
1298 + omap3_features |= OMAP3_HAS_ ##feat; \
1301 +void __init omap3_check_features(void)
1305 + omap3_features = 0;
1307 + status = omap_ctrl_readl(OMAP3_CONTROL_OMAP_STATUS);
1309 + OMAP3_CHECK_FEATURE(status, L2CACHE);
1310 + OMAP3_CHECK_FEATURE(status, IVA);
1311 + OMAP3_CHECK_FEATURE(status, SGX);
1312 + OMAP3_CHECK_FEATURE(status, NEON);
1313 + OMAP3_CHECK_FEATURE(status, ISP);
1316 + * TODO: Get additional info (where applicable)
1317 + * e.g. Size of L2 cache.
1321 +void __init omap3_check_revision(void)
1326 - char *rev_name = "ES1.0";
1329 * We cannot access revision registers on ES1.0.
1330 @@ -170,7 +196,7 @@ void __init omap34xx_check_revision(void
1331 cpuid = read_cpuid(CPUID_ID);
1332 if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
1333 omap_revision = OMAP3430_REV_ES1_0;
1339 @@ -183,33 +209,111 @@ void __init omap34xx_check_revision(void
1340 hawkeye = (idcode >> 12) & 0xffff;
1341 rev = (idcode >> 28) & 0xff;
1343 - if (hawkeye == 0xb7ae) {
1344 + switch (hawkeye) {
1346 + /* Handle 34xx/35xx devices */
1349 + case 0: /* Take care of early samples */
1351 omap_revision = OMAP3430_REV_ES2_0;
1352 - rev_name = "ES2.0";
1355 omap_revision = OMAP3430_REV_ES2_1;
1356 - rev_name = "ES2.1";
1359 omap_revision = OMAP3430_REV_ES3_0;
1360 - rev_name = "ES3.0";
1363 omap_revision = OMAP3430_REV_ES3_1;
1364 - rev_name = "ES3.1";
1367 /* Use the latest known revision as default */
1368 omap_revision = OMAP3430_REV_ES3_1;
1369 - rev_name = "Unknown revision\n";
1373 + /* Handle 36xx devices */
1376 + omap_revision = OMAP3630_REV_ES1_0;
1379 + /* Use the latest known revision as default */
1380 + omap_revision = OMAP3630_REV_ES1_0;
1384 + /* Unknown default to latest silicon rev as default*/
1385 + omap_revision = OMAP3630_REV_ES1_0;
1390 - pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
1391 +#define OMAP3_SHOW_FEATURE(feat) \
1392 + if (omap3_has_ ##feat()) { \
1393 + pr_info (" - "#feat" : Y"); \
1395 + pr_info (" - "#feat" : N"); \
1398 +void __init omap3_cpuinfo(void)
1400 + u8 rev = GET_OMAP_REVISION();
1401 + char cpu_name[16], cpu_rev[16];
1403 + /* OMAP3430 and OMAP3530 are assumed to be same.
1405 + * OMAP3525, OMAP3515 and OMAP3503 can be detected only based
1406 + * on available features. Upon detection, update the CPU id
1407 + * and CPU class bits.
1409 + if (cpu_is_omap3630())
1410 + strcpy(cpu_name, "3630");
1411 + else if (omap3_has_iva() && omap3_has_sgx())
1412 + strcpy(cpu_name, "3430/3530");
1413 + else if (omap3_has_sgx()) {
1414 + omap_revision = OMAP3525_REV(rev);
1415 + strcpy(cpu_name, "3525");
1417 + else if (omap3_has_iva()) {
1418 + omap_revision = OMAP3515_REV(rev);
1419 + strcpy(cpu_name, "3515");
1422 + omap_revision = OMAP3503_REV(rev);
1423 + strcpy(cpu_name, "3503");
1427 + case OMAP_REVBITS_00:
1428 + strcpy(cpu_rev, "1.0");
1430 + case OMAP_REVBITS_10:
1431 + strcpy(cpu_rev, "2.0");
1433 + case OMAP_REVBITS_20:
1434 + strcpy(cpu_rev, "2.1");
1436 + case OMAP_REVBITS_30:
1437 + strcpy(cpu_rev, "3.0");
1439 + case OMAP_REVBITS_40:
1440 + strcpy(cpu_rev, "3.1");
1443 + /* Use the latest known revision as default */
1444 + strcpy(cpu_rev, "3.1");
1448 + * Print verbose information
1450 + pr_info("OMAP%s ES%s\n", cpu_name, cpu_rev);
1452 + OMAP3_SHOW_FEATURE(l2cache);
1453 + OMAP3_SHOW_FEATURE(iva);
1454 + OMAP3_SHOW_FEATURE(sgx);
1455 + OMAP3_SHOW_FEATURE(neon);
1456 + OMAP3_SHOW_FEATURE(isp);
1460 @@ -223,8 +327,11 @@ void __init omap2_check_revision(void)
1462 if (cpu_is_omap24xx())
1463 omap24xx_check_revision();
1464 - else if (cpu_is_omap34xx())
1465 - omap34xx_check_revision();
1466 + else if (cpu_is_omap34xx()) {
1467 + omap3_check_features();
1468 + omap3_check_revision();
1471 else if (cpu_is_omap44xx()) {
1472 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n");
1474 --- a/arch/arm/mach-omap2/io.c
1475 +++ b/arch/arm/mach-omap2/io.c
1476 @@ -204,6 +204,24 @@ static struct map_desc omap44xx_io_desc[
1480 + .virtual = OMAP44XX_EMIF1_VIRT,
1481 + .pfn = __phys_to_pfn(OMAP44XX_EMIF1_PHYS),
1482 + .length = OMAP44XX_EMIF1_SIZE,
1483 + .type = MT_DEVICE,
1486 + .virtual = OMAP44XX_EMIF2_VIRT,
1487 + .pfn = __phys_to_pfn(OMAP44XX_EMIF2_PHYS),
1488 + .length = OMAP44XX_EMIF2_SIZE,
1489 + .type = MT_DEVICE,
1492 + .virtual = OMAP44XX_DMM_VIRT,
1493 + .pfn = __phys_to_pfn(OMAP44XX_DMM_PHYS),
1494 + .length = OMAP44XX_DMM_SIZE,
1495 + .type = MT_DEVICE,
1498 .virtual = L4_PER_44XX_VIRT,
1499 .pfn = __phys_to_pfn(L4_PER_44XX_PHYS),
1500 .length = L4_PER_44XX_SIZE,
1501 --- a/arch/arm/mach-omap2/irq.c
1502 +++ b/arch/arm/mach-omap2/irq.c
1503 @@ -178,12 +178,20 @@ void __init omap_init_irq(void)
1506 for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
1507 + unsigned long base;
1508 struct omap_irq_bank *bank = irq_banks + i;
1510 if (cpu_is_omap24xx())
1511 - bank->base_reg = OMAP2_IO_ADDRESS(OMAP24XX_IC_BASE);
1512 + base = OMAP24XX_IC_BASE;
1513 else if (cpu_is_omap34xx())
1514 - bank->base_reg = OMAP2_IO_ADDRESS(OMAP34XX_IC_BASE);
1515 + base = OMAP34XX_IC_BASE;
1517 + /* Static mapping, never released */
1518 + bank->base_reg = ioremap(base, SZ_4K);
1519 + if (!bank->base_reg) {
1520 + printk(KERN_ERR "Could not ioremap irq bank%i\n", i);
1524 omap_irq_bank_init_one(bank);
1526 --- a/arch/arm/mach-omap2/omap-smp.c
1527 +++ b/arch/arm/mach-omap2/omap-smp.c
1529 #include <mach/hardware.h>
1531 /* Registers used for communicating startup information */
1532 -#define OMAP4_AUXCOREBOOT_REG0 (OMAP44XX_VA_WKUPGEN_BASE + 0x800)
1533 -#define OMAP4_AUXCOREBOOT_REG1 (OMAP44XX_VA_WKUPGEN_BASE + 0x804)
1534 +static void __iomem *omap4_auxcoreboot_reg0;
1535 +static void __iomem *omap4_auxcoreboot_reg1;
1537 /* SCU base address */
1538 -static void __iomem *scu_base = OMAP44XX_VA_SCU_BASE;
1539 +static void __iomem *scu_base;
1542 * Use SCU config register to count number of cores
1543 @@ -46,6 +46,8 @@ static DEFINE_SPINLOCK(boot_lock);
1545 void __cpuinit platform_secondary_init(unsigned int cpu)
1547 + void __iomem *gic_cpu_base;
1549 trace_hardirqs_off();
1552 @@ -54,7 +56,10 @@ void __cpuinit platform_secondary_init(u
1556 - gic_cpu_init(0, OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE));
1557 + /* Static mapping, never released */
1558 + gic_cpu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_256);
1559 + BUG_ON(!gic_cpu_base);
1560 + gic_cpu_init(0, gic_cpu_base);
1563 * Synchronise with the boot thread.
1564 @@ -79,7 +84,7 @@ int __cpuinit boot_secondary(unsigned in
1565 * the AuxCoreBoot1 register is updated with cpu state
1566 * A barrier is added to ensure that write buffer is drained
1568 - __raw_writel(cpu, OMAP4_AUXCOREBOOT_REG1);
1569 + __raw_writel(cpu, omap4_auxcoreboot_reg1);
1572 timeout = jiffies + (1 * HZ);
1573 @@ -104,7 +109,7 @@ static void __init wakeup_secondary(void
1574 * A barrier is added to ensure that write buffer is drained
1576 __raw_writel(virt_to_phys(omap_secondary_startup), \
1577 - OMAP4_AUXCOREBOOT_REG0);
1578 + omap4_auxcoreboot_reg0);
1582 @@ -130,6 +135,7 @@ void __init smp_prepare_cpus(unsigned in
1584 unsigned int ncores = get_core_count();
1585 unsigned int cpu = smp_processor_id();
1586 + void __iomem *omap4_wkupgen_base;
1590 @@ -161,6 +167,16 @@ void __init smp_prepare_cpus(unsigned in
1591 for (i = 0; i < max_cpus; i++)
1592 set_cpu_present(i, true);
1594 + /* Never released */
1595 + omap4_wkupgen_base = ioremap(OMAP44XX_WKUPGEN_BASE, SZ_4K);
1596 + BUG_ON(!omap4_wkupgen_base);
1597 + omap4_auxcoreboot_reg0 = omap4_wkupgen_base + 0x800;
1598 + omap4_auxcoreboot_reg0 = omap4_wkupgen_base + 0x804;
1600 + /* Never released */
1601 + scu_base = ioremap(OMAP44XX_GIC_CPU_BASE, SZ_256);
1602 + BUG_ON(!scu_base);
1606 * Enable the local timer or broadcast device for the
1607 --- a/arch/arm/mach-omap2/omap_hwmod.c
1608 +++ b/arch/arm/mach-omap2/omap_hwmod.c
1609 @@ -496,6 +496,7 @@ static void __iomem *_find_mpu_rt_base(s
1610 struct omap_hwmod_addr_space *mem;
1613 + void __iomem *va_start;
1615 if (!oh || oh->slaves_cnt == 0)
1617 @@ -509,16 +510,20 @@ static void __iomem *_find_mpu_rt_base(s
1621 - /* XXX use ioremap() instead? */
1625 + va_start = ioremap(mem->pa_start, mem->pa_end - mem->pa_start);
1627 + pr_err("omap_hwmod: %s: Could not ioremap\n", oh->name);
1630 pr_debug("omap_hwmod: %s: MPU register target at va %p\n",
1631 - oh->name, OMAP2_IO_ADDRESS(mem->pa_start));
1633 + oh->name, va_start);
1635 pr_debug("omap_hwmod: %s: no MPU register target found\n",
1639 - return (found) ? OMAP2_IO_ADDRESS(mem->pa_start) : NULL;
1640 + return (found) ? va_start : NULL;
1644 @@ -1148,6 +1153,7 @@ int omap_hwmod_unregister(struct omap_hw
1645 pr_debug("omap_hwmod: %s: unregistering\n", oh->name);
1647 mutex_lock(&omap_hwmod_mutex);
1648 + iounmap(oh->_rt_va);
1649 list_del(&oh->node);
1650 mutex_unlock(&omap_hwmod_mutex);
1652 --- a/arch/arm/mach-omap2/pm-debug.c
1653 +++ b/arch/arm/mach-omap2/pm-debug.c
1654 @@ -51,7 +51,8 @@ int omap2_pm_debug;
1655 regs[reg_count++].val = __raw_readl(reg)
1656 #define DUMP_INTC_REG(reg, off) \
1657 regs[reg_count].name = #reg; \
1658 - regs[reg_count++].val = __raw_readl(OMAP2_IO_ADDRESS(0x480fe000 + (off)))
1659 + regs[reg_count++].val = \
1660 + __raw_readl(OMAP2_L4_IO_ADDRESS(0x480fe000 + (off)))
1662 static int __init pm_dbg_init(void);
1664 --- a/arch/arm/mach-omap2/prm.h
1665 +++ b/arch/arm/mach-omap2/prm.h
1667 #include "prcm-common.h"
1669 #define OMAP2420_PRM_REGADDR(module, reg) \
1670 - OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
1671 + OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
1672 #define OMAP2430_PRM_REGADDR(module, reg) \
1673 - OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
1674 + OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
1675 #define OMAP34XX_PRM_REGADDR(module, reg) \
1676 - OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
1677 + OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
1680 * Architecture-specific global PRM registers
1681 --- a/arch/arm/mach-omap2/sdrc.h
1682 +++ b/arch/arm/mach-omap2/sdrc.h
1683 @@ -48,9 +48,12 @@ static inline u32 sms_read_reg(u16 reg)
1684 return __raw_readl(OMAP_SMS_REGADDR(reg));
1687 -#define OMAP242X_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
1688 -#define OMAP243X_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
1689 -#define OMAP34XX_SDRC_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
1690 +#define OMAP242X_SDRC_REGADDR(reg) \
1691 + OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
1692 +#define OMAP243X_SDRC_REGADDR(reg) \
1693 + OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
1694 +#define OMAP34XX_SDRC_REGADDR(reg) \
1695 + OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
1696 #endif /* __ASSEMBLER__ */
1699 --- a/arch/arm/mach-omap2/serial.c
1700 +++ b/arch/arm/mach-omap2/serial.c
1701 @@ -73,7 +73,6 @@ static LIST_HEAD(uart_list);
1703 static struct plat_serial8250_port serial_platform_data0[] = {
1705 - .membase = OMAP2_IO_ADDRESS(OMAP_UART1_BASE),
1706 .mapbase = OMAP_UART1_BASE,
1708 .flags = UPF_BOOT_AUTOCONF,
1709 @@ -87,7 +86,6 @@ static struct plat_serial8250_port seria
1711 static struct plat_serial8250_port serial_platform_data1[] = {
1713 - .membase = OMAP2_IO_ADDRESS(OMAP_UART2_BASE),
1714 .mapbase = OMAP_UART2_BASE,
1716 .flags = UPF_BOOT_AUTOCONF,
1717 @@ -101,7 +99,6 @@ static struct plat_serial8250_port seria
1719 static struct plat_serial8250_port serial_platform_data2[] = {
1721 - .membase = OMAP2_IO_ADDRESS(OMAP_UART3_BASE),
1722 .mapbase = OMAP_UART3_BASE,
1724 .flags = UPF_BOOT_AUTOCONF,
1725 @@ -116,7 +113,6 @@ static struct plat_serial8250_port seria
1726 #ifdef CONFIG_ARCH_OMAP4
1727 static struct plat_serial8250_port serial_platform_data3[] = {
1729 - .membase = OMAP2_IO_ADDRESS(OMAP_UART4_BASE),
1730 .mapbase = OMAP_UART4_BASE,
1732 .flags = UPF_BOOT_AUTOCONF,
1733 @@ -539,7 +535,7 @@ static inline void omap_uart_idle_init(s
1734 #define DEV_CREATE_FILE(dev, attr)
1735 #endif /* CONFIG_PM */
1737 -static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = {
1738 +static struct omap_uart_state omap_uart[] = {
1741 .name = "serial8250",
1742 @@ -589,12 +585,22 @@ void __init omap_serial_early_init(void)
1746 - for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
1747 + for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
1748 struct omap_uart_state *uart = &omap_uart[i];
1749 struct platform_device *pdev = &uart->pdev;
1750 struct device *dev = &pdev->dev;
1751 struct plat_serial8250_port *p = dev->platform_data;
1754 + * Module 4KB + L4 interconnect 4KB
1755 + * Static mapping, never released
1757 + p->membase = ioremap(p->mapbase, SZ_8K);
1758 + if (!p->membase) {
1759 + printk(KERN_ERR "ioremap failed for uart%i\n", i + 1);
1763 sprintf(name, "uart%d_ick", i+1);
1764 uart->ick = clk_get(NULL, name);
1765 if (IS_ERR(uart->ick)) {
1766 @@ -631,7 +637,7 @@ void __init omap_serial_init(void)
1770 - for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
1771 + for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
1772 struct omap_uart_state *uart = &omap_uart[i];
1773 struct platform_device *pdev = &uart->pdev;
1774 struct device *dev = &pdev->dev;
1775 --- a/arch/arm/mach-omap2/sram242x.S
1776 +++ b/arch/arm/mach-omap2/sram242x.S
1777 @@ -128,7 +128,7 @@ omap242x_sdi_prcm_voltctrl:
1780 omap242x_sdi_timer_32ksynct_cr:
1781 - .word OMAP2_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
1782 + .word OMAP2_L4_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
1783 ENTRY(omap242x_sram_ddr_init_sz)
1784 .word . - omap242x_sram_ddr_init
1786 @@ -224,7 +224,7 @@ omap242x_srs_prcm_voltctrl:
1789 omap242x_srs_timer_32ksynct:
1790 - .word OMAP2_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
1791 + .word OMAP2_L4_IO_ADDRESS(OMAP2420_32KSYNCT_BASE + 0x010)
1793 ENTRY(omap242x_sram_reprogram_sdrc_sz)
1794 .word . - omap242x_sram_reprogram_sdrc
1795 --- a/arch/arm/mach-omap2/sram243x.S
1796 +++ b/arch/arm/mach-omap2/sram243x.S
1797 @@ -128,7 +128,7 @@ omap243x_sdi_prcm_voltctrl:
1800 omap243x_sdi_timer_32ksynct_cr:
1801 - .word OMAP2_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
1802 + .word OMAP2_L4_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
1803 ENTRY(omap243x_sram_ddr_init_sz)
1804 .word . - omap243x_sram_ddr_init
1806 @@ -224,7 +224,7 @@ omap243x_srs_prcm_voltctrl:
1809 omap243x_srs_timer_32ksynct:
1810 - .word OMAP2_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
1811 + .word OMAP2_L4_IO_ADDRESS(OMAP2430_32KSYNCT_BASE + 0x010)
1813 ENTRY(omap243x_sram_reprogram_sdrc_sz)
1814 .word . - omap243x_sram_reprogram_sdrc
1815 --- a/arch/arm/mach-omap2/timer-gp.c
1816 +++ b/arch/arm/mach-omap2/timer-gp.c
1817 @@ -231,7 +231,8 @@ static void __init omap2_gp_clocksource_
1818 static void __init omap2_gp_timer_init(void)
1820 #ifdef CONFIG_LOCAL_TIMERS
1821 - twd_base = OMAP2_IO_ADDRESS(OMAP44XX_LOCAL_TWD_BASE);
1822 + twd_base = ioremap(OMAP44XX_LOCAL_TWD_BASE, SZ_256);
1823 + BUG_ON(!twd_base);
1825 omap_dm_timer_init();
1828 +++ b/arch/arm/mach-omap2/usb-ehci.c
1831 + * linux/arch/arm/mach-omap2/usb-ehci.c
1833 + * This file will contain the board specific details for the
1834 + * Synopsys EHCI host controller on OMAP3430
1836 + * Copyright (C) 2007 Texas Instruments
1837 + * Author: Vikram Pandita <vikram.pandita@ti.com>
1839 + * Generalization by:
1840 + * Felipe Balbi <felipe.balbi@nokia.com>
1842 + * This program is free software; you can redistribute it and/or modify
1843 + * it under the terms of the GNU General Public License version 2 as
1844 + * published by the Free Software Foundation.
1847 +#include <linux/types.h>
1848 +#include <linux/errno.h>
1849 +#include <linux/delay.h>
1850 +#include <linux/platform_device.h>
1851 +#include <linux/clk.h>
1852 +#include <asm/io.h>
1853 +#include <mach/mux.h>
1855 +#include <mach/hardware.h>
1856 +#include <mach/irqs.h>
1857 +#include <mach/usb.h>
1859 +#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
1861 +static struct resource ehci_resources[] = {
1863 + .start = OMAP34XX_EHCI_BASE,
1864 + .end = OMAP34XX_EHCI_BASE + SZ_1K - 1,
1865 + .flags = IORESOURCE_MEM,
1868 + .start = OMAP34XX_UHH_CONFIG_BASE,
1869 + .end = OMAP34XX_UHH_CONFIG_BASE + SZ_1K - 1,
1870 + .flags = IORESOURCE_MEM,
1873 + .start = OMAP34XX_USBTLL_BASE,
1874 + .end = OMAP34XX_USBTLL_BASE + SZ_4K - 1,
1875 + .flags = IORESOURCE_MEM,
1877 + { /* general IRQ */
1878 + .start = INT_34XX_EHCI_IRQ,
1879 + .flags = IORESOURCE_IRQ,
1883 +static u64 ehci_dmamask = ~(u32)0;
1884 +static struct platform_device ehci_device = {
1885 + .name = "ehci-omap",
1888 + .dma_mask = &ehci_dmamask,
1889 + .coherent_dma_mask = 0xffffffff,
1890 + .platform_data = NULL,
1892 + .num_resources = ARRAY_SIZE(ehci_resources),
1893 + .resource = ehci_resources,
1896 +/* MUX settings for EHCI pins */
1898 + * setup_ehci_io_mux - initialize IO pad mux for USBHOST
1900 +static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
1902 + switch (port_mode[0]) {
1903 + case EHCI_HCD_OMAP_MODE_PHY:
1904 + omap_cfg_reg(Y9_3430_USB1HS_PHY_STP);
1905 + omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK);
1906 + omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR);
1907 + omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT);
1908 + omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0);
1909 + omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1);
1910 + omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2);
1911 + omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3);
1912 + omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4);
1913 + omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5);
1914 + omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6);
1915 + omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7);
1917 + case EHCI_HCD_OMAP_MODE_TLL:
1918 + omap_cfg_reg(Y9_3430_USB1HS_TLL_STP);
1919 + omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK);
1920 + omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR);
1921 + omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT);
1922 + omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0);
1923 + omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1);
1924 + omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2);
1925 + omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3);
1926 + omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4);
1927 + omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5);
1928 + omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6);
1929 + omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7);
1931 + case EHCI_HCD_OMAP_MODE_UNKNOWN:
1937 + switch (port_mode[1]) {
1938 + case EHCI_HCD_OMAP_MODE_PHY:
1939 + omap_cfg_reg(AA10_3430_USB2HS_PHY_STP);
1940 + omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK);
1941 + omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR);
1942 + omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT);
1943 + omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0);
1944 + omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1);
1945 + omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2);
1946 + omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3);
1947 + omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4);
1948 + omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5);
1949 + omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6);
1950 + omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7);
1952 + case EHCI_HCD_OMAP_MODE_TLL:
1953 + omap_cfg_reg(AA10_3430_USB2HS_TLL_STP);
1954 + omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK);
1955 + omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR);
1956 + omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT);
1957 + omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0);
1958 + omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1);
1959 + omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2);
1960 + omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3);
1961 + omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4);
1962 + omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5);
1963 + omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6);
1964 + omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7);
1966 + case EHCI_HCD_OMAP_MODE_UNKNOWN:
1972 + switch (port_mode[2]) {
1973 + case EHCI_HCD_OMAP_MODE_PHY:
1974 + printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
1976 + case EHCI_HCD_OMAP_MODE_TLL:
1977 + omap_cfg_reg(AB3_3430_USB3HS_TLL_STP);
1978 + omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK);
1979 + omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR);
1980 + omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT);
1981 + omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0);
1982 + omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1);
1983 + omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2);
1984 + omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3);
1985 + omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4);
1986 + omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5);
1987 + omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6);
1988 + omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7);
1990 + case EHCI_HCD_OMAP_MODE_UNKNOWN:
1999 +void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
2001 + platform_device_add_data(&ehci_device, pdata, sizeof(*pdata));
2003 + /* Setup Pin IO MUX for EHCI */
2004 + if (cpu_is_omap34xx())
2005 + setup_ehci_io_mux(pdata->port_mode);
2007 + if (platform_device_register(&ehci_device) < 0) {
2008 + printk(KERN_ERR "Unable to register HS-USB (EHCI) device\n");
2015 +void __init usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata)
2020 +#endif /* CONFIG_USB_EHCI_HCD */
2022 --- a/arch/arm/plat-omap/common.c
2023 +++ b/arch/arm/plat-omap/common.c
2024 @@ -224,12 +224,12 @@ static void __init __omap2_set_globals(s
2026 static struct omap_globals omap242x_globals = {
2027 .class = OMAP242X_CLASS,
2028 - .tap = OMAP2_IO_ADDRESS(0x48014000),
2029 - .sdrc = OMAP2_IO_ADDRESS(OMAP2420_SDRC_BASE),
2030 - .sms = OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE),
2031 - .ctrl = OMAP2_IO_ADDRESS(OMAP2420_CTRL_BASE),
2032 - .prm = OMAP2_IO_ADDRESS(OMAP2420_PRM_BASE),
2033 - .cm = OMAP2_IO_ADDRESS(OMAP2420_CM_BASE),
2034 + .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
2035 + .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
2036 + .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
2037 + .ctrl = OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
2038 + .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
2039 + .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
2042 void __init omap2_set_globals_242x(void)
2043 @@ -242,12 +242,12 @@ void __init omap2_set_globals_242x(void)
2045 static struct omap_globals omap243x_globals = {
2046 .class = OMAP243X_CLASS,
2047 - .tap = OMAP2_IO_ADDRESS(0x4900a000),
2048 - .sdrc = OMAP2_IO_ADDRESS(OMAP243X_SDRC_BASE),
2049 - .sms = OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE),
2050 - .ctrl = OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE),
2051 - .prm = OMAP2_IO_ADDRESS(OMAP2430_PRM_BASE),
2052 - .cm = OMAP2_IO_ADDRESS(OMAP2430_CM_BASE),
2053 + .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
2054 + .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
2055 + .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
2056 + .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
2057 + .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
2058 + .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
2061 void __init omap2_set_globals_243x(void)
2062 @@ -260,12 +260,12 @@ void __init omap2_set_globals_243x(void)
2064 static struct omap_globals omap343x_globals = {
2065 .class = OMAP343X_CLASS,
2066 - .tap = OMAP2_IO_ADDRESS(0x4830A000),
2067 - .sdrc = OMAP2_IO_ADDRESS(OMAP343X_SDRC_BASE),
2068 - .sms = OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE),
2069 - .ctrl = OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE),
2070 - .prm = OMAP2_IO_ADDRESS(OMAP3430_PRM_BASE),
2071 - .cm = OMAP2_IO_ADDRESS(OMAP3430_CM_BASE),
2072 + .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
2073 + .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
2074 + .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
2075 + .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
2076 + .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
2077 + .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
2080 void __init omap2_set_globals_343x(void)
2081 @@ -277,10 +277,10 @@ void __init omap2_set_globals_343x(void)
2082 #if defined(CONFIG_ARCH_OMAP4)
2083 static struct omap_globals omap4_globals = {
2084 .class = OMAP443X_CLASS,
2085 - .tap = OMAP2_IO_ADDRESS(0x4830a000),
2086 - .ctrl = OMAP2_IO_ADDRESS(OMAP443X_CTRL_BASE),
2087 - .prm = OMAP2_IO_ADDRESS(OMAP4430_PRM_BASE),
2088 - .cm = OMAP2_IO_ADDRESS(OMAP4430_CM_BASE),
2089 + .tap = OMAP2_L4_IO_ADDRESS(0x4830a000),
2090 + .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
2091 + .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
2092 + .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
2095 void __init omap2_set_globals_443x(void)
2096 --- a/arch/arm/plat-omap/devices.c
2097 +++ b/arch/arm/plat-omap/devices.c
2098 @@ -113,17 +113,17 @@ static void omap_init_kp(void)
2099 omap_cfg_reg(E19_1610_KBR4);
2100 omap_cfg_reg(N19_1610_KBR5);
2101 } else if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
2102 - omap_cfg_reg(E2_730_KBR0);
2103 - omap_cfg_reg(J7_730_KBR1);
2104 - omap_cfg_reg(E1_730_KBR2);
2105 - omap_cfg_reg(F3_730_KBR3);
2106 - omap_cfg_reg(D2_730_KBR4);
2108 - omap_cfg_reg(C2_730_KBC0);
2109 - omap_cfg_reg(D3_730_KBC1);
2110 - omap_cfg_reg(E4_730_KBC2);
2111 - omap_cfg_reg(F4_730_KBC3);
2112 - omap_cfg_reg(E3_730_KBC4);
2113 + omap_cfg_reg(E2_7XX_KBR0);
2114 + omap_cfg_reg(J7_7XX_KBR1);
2115 + omap_cfg_reg(E1_7XX_KBR2);
2116 + omap_cfg_reg(F3_7XX_KBR3);
2117 + omap_cfg_reg(D2_7XX_KBR4);
2119 + omap_cfg_reg(C2_7XX_KBC0);
2120 + omap_cfg_reg(D3_7XX_KBC1);
2121 + omap_cfg_reg(E4_7XX_KBC2);
2122 + omap_cfg_reg(F4_7XX_KBC3);
2123 + omap_cfg_reg(E3_7XX_KBC4);
2124 } else if (machine_is_omap_h4()) {
2125 omap_cfg_reg(T19_24XX_KBR0);
2126 omap_cfg_reg(R19_24XX_KBR1);
2127 --- a/arch/arm/plat-omap/dma.c
2128 +++ b/arch/arm/plat-omap/dma.c
2129 @@ -2359,40 +2359,46 @@ EXPORT_SYMBOL(omap_stop_lcd_dma);
2131 static int __init omap_init_dma(void)
2133 + unsigned long base;
2136 if (cpu_class_is_omap1()) {
2137 - omap_dma_base = OMAP1_IO_ADDRESS(OMAP1_DMA_BASE);
2138 + base = OMAP1_DMA_BASE;
2139 dma_lch_count = OMAP1_LOGICAL_DMA_CH_COUNT;
2140 } else if (cpu_is_omap24xx()) {
2141 - omap_dma_base = OMAP2_IO_ADDRESS(OMAP24XX_DMA4_BASE);
2142 + base = OMAP24XX_DMA4_BASE;
2143 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2144 } else if (cpu_is_omap34xx()) {
2145 - omap_dma_base = OMAP2_IO_ADDRESS(OMAP34XX_DMA4_BASE);
2146 + base = OMAP34XX_DMA4_BASE;
2147 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2148 } else if (cpu_is_omap44xx()) {
2149 - omap_dma_base = OMAP2_IO_ADDRESS(OMAP44XX_DMA4_BASE);
2150 + base = OMAP44XX_DMA4_BASE;
2151 dma_lch_count = OMAP_DMA4_LOGICAL_DMA_CH_COUNT;
2153 pr_err("DMA init failed for unsupported omap\n");
2157 + omap_dma_base = ioremap(base, SZ_4K);
2158 + BUG_ON(!omap_dma_base);
2160 if (cpu_class_is_omap2() && omap_dma_reserve_channels
2161 && (omap_dma_reserve_channels <= dma_lch_count))
2162 dma_lch_count = omap_dma_reserve_channels;
2164 dma_chan = kzalloc(sizeof(struct omap_dma_lch) * dma_lch_count,
2173 if (cpu_class_is_omap2()) {
2174 dma_linked_lch = kzalloc(sizeof(struct dma_link_info) *
2175 dma_lch_count, GFP_KERNEL);
2176 if (!dma_linked_lch) {
2184 @@ -2466,7 +2472,7 @@ static int __init omap_init_dma(void)
2185 for (i = 0; i < ch; i++)
2186 free_irq(omap1_dma_irq[i],
2193 @@ -2508,11 +2514,19 @@ static int __init omap_init_dma(void)
2195 for (i = 0; i < dma_chan_count; i++)
2196 free_irq(omap1_dma_irq[i], (void *) (i + 1));
2208 + iounmap(omap_dma_base);
2213 arch_initcall(omap_init_dma);
2214 --- a/arch/arm/plat-omap/dmtimer.c
2215 +++ b/arch/arm/plat-omap/dmtimer.c
2216 @@ -742,16 +742,17 @@ EXPORT_SYMBOL_GPL(omap_dm_timers_active)
2217 int __init omap_dm_timer_init(void)
2219 struct omap_dm_timer *timer;
2221 + int i, map_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */
2223 if (!(cpu_is_omap16xx() || cpu_class_is_omap2()))
2226 spin_lock_init(&dm_timer_lock);
2228 - if (cpu_class_is_omap1())
2229 + if (cpu_class_is_omap1()) {
2230 dm_timers = omap1_dm_timers;
2231 - else if (cpu_is_omap24xx()) {
2233 + } else if (cpu_is_omap24xx()) {
2234 dm_timers = omap2_dm_timers;
2235 dm_source_names = omap2_dm_source_names;
2236 dm_source_clocks = omap2_dm_source_clocks;
2237 @@ -774,10 +775,11 @@ int __init omap_dm_timer_init(void)
2239 for (i = 0; i < dm_timer_count; i++) {
2240 timer = &dm_timers[i];
2241 - if (cpu_class_is_omap1())
2242 - timer->io_base = OMAP1_IO_ADDRESS(timer->phys_base);
2244 - timer->io_base = OMAP2_IO_ADDRESS(timer->phys_base);
2246 + /* Static mapping, never released */
2247 + timer->io_base = ioremap(timer->phys_base, map_size);
2248 + BUG_ON(!timer->io_base);
2250 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
2251 defined(CONFIG_ARCH_OMAP4)
2252 if (cpu_class_is_omap2()) {
2253 --- a/arch/arm/plat-omap/gpio.c
2254 +++ b/arch/arm/plat-omap/gpio.c
2257 * OMAP1510 GPIO registers
2259 -#define OMAP1510_GPIO_BASE OMAP1_IO_ADDRESS(0xfffce000)
2260 +#define OMAP1510_GPIO_BASE 0xfffce000
2261 #define OMAP1510_GPIO_DATA_INPUT 0x00
2262 #define OMAP1510_GPIO_DATA_OUTPUT 0x04
2263 #define OMAP1510_GPIO_DIR_CONTROL 0x08
2266 * OMAP1610 specific GPIO registers
2268 -#define OMAP1610_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbe400)
2269 -#define OMAP1610_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbec00)
2270 -#define OMAP1610_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbb400)
2271 -#define OMAP1610_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbbc00)
2272 +#define OMAP1610_GPIO1_BASE 0xfffbe400
2273 +#define OMAP1610_GPIO2_BASE 0xfffbec00
2274 +#define OMAP1610_GPIO3_BASE 0xfffbb400
2275 +#define OMAP1610_GPIO4_BASE 0xfffbbc00
2276 #define OMAP1610_GPIO_REVISION 0x0000
2277 #define OMAP1610_GPIO_SYSCONFIG 0x0010
2278 #define OMAP1610_GPIO_SYSSTATUS 0x0014
2280 #define OMAP1610_GPIO_SET_DATAOUT 0x00f0
2283 - * OMAP730 specific GPIO registers
2284 + * OMAP7XX specific GPIO registers
2286 -#define OMAP730_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000)
2287 -#define OMAP730_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800)
2288 -#define OMAP730_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000)
2289 -#define OMAP730_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800)
2290 -#define OMAP730_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000)
2291 -#define OMAP730_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800)
2292 -#define OMAP730_GPIO_DATA_INPUT 0x00
2293 -#define OMAP730_GPIO_DATA_OUTPUT 0x04
2294 -#define OMAP730_GPIO_DIR_CONTROL 0x08
2295 -#define OMAP730_GPIO_INT_CONTROL 0x0c
2296 -#define OMAP730_GPIO_INT_MASK 0x10
2297 -#define OMAP730_GPIO_INT_STATUS 0x14
2298 +#define OMAP7XX_GPIO1_BASE 0xfffbc000
2299 +#define OMAP7XX_GPIO2_BASE 0xfffbc800
2300 +#define OMAP7XX_GPIO3_BASE 0xfffbd000
2301 +#define OMAP7XX_GPIO4_BASE 0xfffbd800
2302 +#define OMAP7XX_GPIO5_BASE 0xfffbe000
2303 +#define OMAP7XX_GPIO6_BASE 0xfffbe800
2304 +#define OMAP7XX_GPIO_DATA_INPUT 0x00
2305 +#define OMAP7XX_GPIO_DATA_OUTPUT 0x04
2306 +#define OMAP7XX_GPIO_DIR_CONTROL 0x08
2307 +#define OMAP7XX_GPIO_INT_CONTROL 0x0c
2308 +#define OMAP7XX_GPIO_INT_MASK 0x10
2309 +#define OMAP7XX_GPIO_INT_STATUS 0x14
2312 - * OMAP850 specific GPIO registers
2314 -#define OMAP850_GPIO1_BASE OMAP1_IO_ADDRESS(0xfffbc000)
2315 -#define OMAP850_GPIO2_BASE OMAP1_IO_ADDRESS(0xfffbc800)
2316 -#define OMAP850_GPIO3_BASE OMAP1_IO_ADDRESS(0xfffbd000)
2317 -#define OMAP850_GPIO4_BASE OMAP1_IO_ADDRESS(0xfffbd800)
2318 -#define OMAP850_GPIO5_BASE OMAP1_IO_ADDRESS(0xfffbe000)
2319 -#define OMAP850_GPIO6_BASE OMAP1_IO_ADDRESS(0xfffbe800)
2320 -#define OMAP850_GPIO_DATA_INPUT 0x00
2321 -#define OMAP850_GPIO_DATA_OUTPUT 0x04
2322 -#define OMAP850_GPIO_DIR_CONTROL 0x08
2323 -#define OMAP850_GPIO_INT_CONTROL 0x0c
2324 -#define OMAP850_GPIO_INT_MASK 0x10
2325 -#define OMAP850_GPIO_INT_STATUS 0x14
2327 -#define OMAP1_MPUIO_VBASE OMAP1_IO_ADDRESS(OMAP1_MPUIO_BASE)
2328 +#define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
2331 * omap24xx specific GPIO registers
2333 -#define OMAP242X_GPIO1_BASE OMAP2_IO_ADDRESS(0x48018000)
2334 -#define OMAP242X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4801a000)
2335 -#define OMAP242X_GPIO3_BASE OMAP2_IO_ADDRESS(0x4801c000)
2336 -#define OMAP242X_GPIO4_BASE OMAP2_IO_ADDRESS(0x4801e000)
2338 -#define OMAP243X_GPIO1_BASE OMAP2_IO_ADDRESS(0x4900C000)
2339 -#define OMAP243X_GPIO2_BASE OMAP2_IO_ADDRESS(0x4900E000)
2340 -#define OMAP243X_GPIO3_BASE OMAP2_IO_ADDRESS(0x49010000)
2341 -#define OMAP243X_GPIO4_BASE OMAP2_IO_ADDRESS(0x49012000)
2342 -#define OMAP243X_GPIO5_BASE OMAP2_IO_ADDRESS(0x480B6000)
2343 +#define OMAP242X_GPIO1_BASE 0x48018000
2344 +#define OMAP242X_GPIO2_BASE 0x4801a000
2345 +#define OMAP242X_GPIO3_BASE 0x4801c000
2346 +#define OMAP242X_GPIO4_BASE 0x4801e000
2348 +#define OMAP243X_GPIO1_BASE 0x4900C000
2349 +#define OMAP243X_GPIO2_BASE 0x4900E000
2350 +#define OMAP243X_GPIO3_BASE 0x49010000
2351 +#define OMAP243X_GPIO4_BASE 0x49012000
2352 +#define OMAP243X_GPIO5_BASE 0x480B6000
2354 #define OMAP24XX_GPIO_REVISION 0x0000
2355 #define OMAP24XX_GPIO_SYSCONFIG 0x0010
2356 @@ -170,24 +154,25 @@
2357 * omap34xx specific GPIO registers
2360 -#define OMAP34XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x48310000)
2361 -#define OMAP34XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x49050000)
2362 -#define OMAP34XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x49052000)
2363 -#define OMAP34XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x49054000)
2364 -#define OMAP34XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x49056000)
2365 -#define OMAP34XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x49058000)
2366 +#define OMAP34XX_GPIO1_BASE 0x48310000
2367 +#define OMAP34XX_GPIO2_BASE 0x49050000
2368 +#define OMAP34XX_GPIO3_BASE 0x49052000
2369 +#define OMAP34XX_GPIO4_BASE 0x49054000
2370 +#define OMAP34XX_GPIO5_BASE 0x49056000
2371 +#define OMAP34XX_GPIO6_BASE 0x49058000
2374 * OMAP44XX specific GPIO registers
2376 -#define OMAP44XX_GPIO1_BASE OMAP2_IO_ADDRESS(0x4a310000)
2377 -#define OMAP44XX_GPIO2_BASE OMAP2_IO_ADDRESS(0x48055000)
2378 -#define OMAP44XX_GPIO3_BASE OMAP2_IO_ADDRESS(0x48057000)
2379 -#define OMAP44XX_GPIO4_BASE OMAP2_IO_ADDRESS(0x48059000)
2380 -#define OMAP44XX_GPIO5_BASE OMAP2_IO_ADDRESS(0x4805B000)
2381 -#define OMAP44XX_GPIO6_BASE OMAP2_IO_ADDRESS(0x4805D000)
2382 +#define OMAP44XX_GPIO1_BASE 0x4a310000
2383 +#define OMAP44XX_GPIO2_BASE 0x48055000
2384 +#define OMAP44XX_GPIO3_BASE 0x48057000
2385 +#define OMAP44XX_GPIO4_BASE 0x48059000
2386 +#define OMAP44XX_GPIO5_BASE 0x4805B000
2387 +#define OMAP44XX_GPIO6_BASE 0x4805D000
2390 + unsigned long pbase;
2393 u16 virtual_irq_start;
2394 @@ -215,96 +200,111 @@ struct gpio_bank {
2395 #define METHOD_MPUIO 0
2396 #define METHOD_GPIO_1510 1
2397 #define METHOD_GPIO_1610 2
2398 -#define METHOD_GPIO_730 3
2399 -#define METHOD_GPIO_850 4
2400 +#define METHOD_GPIO_7XX 3
2401 #define METHOD_GPIO_24XX 5
2403 #ifdef CONFIG_ARCH_OMAP16XX
2404 static struct gpio_bank gpio_bank_1610[5] = {
2405 - { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO},
2406 - { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 },
2407 - { OMAP1610_GPIO2_BASE, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16, METHOD_GPIO_1610 },
2408 - { OMAP1610_GPIO3_BASE, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32, METHOD_GPIO_1610 },
2409 - { OMAP1610_GPIO4_BASE, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48, METHOD_GPIO_1610 },
2410 + { OMAP1_MPUIO_VBASE, 0, INT_MPUIO, IH_MPUIO_BASE,
2412 + { OMAP1610_GPIO1_BASE, 0, INT_GPIO_BANK1, IH_GPIO_BASE,
2413 + METHOD_GPIO_1610 },
2414 + { OMAP1610_GPIO2_BASE, 0, INT_1610_GPIO_BANK2, IH_GPIO_BASE + 16,
2415 + METHOD_GPIO_1610 },
2416 + { OMAP1610_GPIO3_BASE, 0, INT_1610_GPIO_BANK3, IH_GPIO_BASE + 32,
2417 + METHOD_GPIO_1610 },
2418 + { OMAP1610_GPIO4_BASE, 0, INT_1610_GPIO_BANK4, IH_GPIO_BASE + 48,
2419 + METHOD_GPIO_1610 },
2423 #ifdef CONFIG_ARCH_OMAP15XX
2424 static struct gpio_bank gpio_bank_1510[2] = {
2425 - { OMAP1_MPUIO_VBASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
2426 - { OMAP1510_GPIO_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1510 }
2430 -#ifdef CONFIG_ARCH_OMAP730
2431 -static struct gpio_bank gpio_bank_730[7] = {
2432 - { OMAP1_MPUIO_VBASE, INT_730_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
2433 - { OMAP730_GPIO1_BASE, INT_730_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_730 },
2434 - { OMAP730_GPIO2_BASE, INT_730_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_730 },
2435 - { OMAP730_GPIO3_BASE, INT_730_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_730 },
2436 - { OMAP730_GPIO4_BASE, INT_730_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_730 },
2437 - { OMAP730_GPIO5_BASE, INT_730_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_730 },
2438 - { OMAP730_GPIO6_BASE, INT_730_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_730 },
2439 + { OMAP1_MPUIO_VBASE, 0, INT_MPUIO, IH_MPUIO_BASE,
2441 + { OMAP1510_GPIO_BASE, 0, INT_GPIO_BANK1, IH_GPIO_BASE,
2442 + METHOD_GPIO_1510 }
2446 -#ifdef CONFIG_ARCH_OMAP850
2447 -static struct gpio_bank gpio_bank_850[7] = {
2448 - { OMAP1_MPUIO_VBASE, INT_850_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO },
2449 - { OMAP850_GPIO1_BASE, INT_850_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_850 },
2450 - { OMAP850_GPIO2_BASE, INT_850_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_850 },
2451 - { OMAP850_GPIO3_BASE, INT_850_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_850 },
2452 - { OMAP850_GPIO4_BASE, INT_850_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_850 },
2453 - { OMAP850_GPIO5_BASE, INT_850_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_850 },
2454 - { OMAP850_GPIO6_BASE, INT_850_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_850 },
2455 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2456 +static struct gpio_bank gpio_bank_7xx[7] = {
2457 + { OMAP1_MPUIO_VBASE, 0, INT_7XX_MPUIO, IH_MPUIO_BASE,
2459 + { OMAP7XX_GPIO1_BASE, 0, INT_7XX_GPIO_BANK1, IH_GPIO_BASE,
2460 + METHOD_GPIO_7XX },
2461 + { OMAP7XX_GPIO2_BASE, 0, INT_7XX_GPIO_BANK2, IH_GPIO_BASE + 32,
2462 + METHOD_GPIO_7XX },
2463 + { OMAP7XX_GPIO3_BASE, 0, INT_7XX_GPIO_BANK3, IH_GPIO_BASE + 64,
2464 + METHOD_GPIO_7XX },
2465 + { OMAP7XX_GPIO4_BASE, 0, INT_7XX_GPIO_BANK4, IH_GPIO_BASE + 96,
2466 + METHOD_GPIO_7XX },
2467 + { OMAP7XX_GPIO5_BASE, 0, INT_7XX_GPIO_BANK5, IH_GPIO_BASE + 128,
2468 + METHOD_GPIO_7XX },
2469 + { OMAP7XX_GPIO6_BASE, 0, INT_7XX_GPIO_BANK6, IH_GPIO_BASE + 160,
2470 + METHOD_GPIO_7XX },
2475 #ifdef CONFIG_ARCH_OMAP24XX
2477 static struct gpio_bank gpio_bank_242x[4] = {
2478 - { OMAP242X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
2479 - { OMAP242X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
2480 - { OMAP242X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
2481 - { OMAP242X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
2482 + { OMAP242X_GPIO1_BASE, 0, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
2483 + METHOD_GPIO_24XX },
2484 + { OMAP242X_GPIO2_BASE, 0, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
2485 + METHOD_GPIO_24XX },
2486 + { OMAP242X_GPIO3_BASE, 0, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
2487 + METHOD_GPIO_24XX },
2488 + { OMAP242X_GPIO4_BASE, 0, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
2489 + METHOD_GPIO_24XX },
2492 static struct gpio_bank gpio_bank_243x[5] = {
2493 - { OMAP243X_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
2494 - { OMAP243X_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
2495 - { OMAP243X_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
2496 - { OMAP243X_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
2497 - { OMAP243X_GPIO5_BASE, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_24XX },
2498 + { OMAP243X_GPIO1_BASE, 0, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,
2499 + METHOD_GPIO_24XX },
2500 + { OMAP243X_GPIO2_BASE, 0, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,
2501 + METHOD_GPIO_24XX },
2502 + { OMAP243X_GPIO3_BASE, 0, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,
2503 + METHOD_GPIO_24XX },
2504 + { OMAP243X_GPIO4_BASE, 0, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,
2505 + METHOD_GPIO_24XX },
2506 + { OMAP243X_GPIO5_BASE, 0, INT_24XX_GPIO_BANK5, IH_GPIO_BASE + 128,
2507 + METHOD_GPIO_24XX },
2512 #ifdef CONFIG_ARCH_OMAP34XX
2513 static struct gpio_bank gpio_bank_34xx[6] = {
2514 - { OMAP34XX_GPIO1_BASE, INT_34XX_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_24XX },
2515 - { OMAP34XX_GPIO2_BASE, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32, METHOD_GPIO_24XX },
2516 - { OMAP34XX_GPIO3_BASE, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64, METHOD_GPIO_24XX },
2517 - { OMAP34XX_GPIO4_BASE, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96, METHOD_GPIO_24XX },
2518 - { OMAP34XX_GPIO5_BASE, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128, METHOD_GPIO_24XX },
2519 - { OMAP34XX_GPIO6_BASE, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160, METHOD_GPIO_24XX },
2520 + { OMAP34XX_GPIO1_BASE, 0, INT_34XX_GPIO_BANK1, IH_GPIO_BASE,
2521 + METHOD_GPIO_24XX },
2522 + { OMAP34XX_GPIO2_BASE, 0, INT_34XX_GPIO_BANK2, IH_GPIO_BASE + 32,
2523 + METHOD_GPIO_24XX },
2524 + { OMAP34XX_GPIO3_BASE, 0, INT_34XX_GPIO_BANK3, IH_GPIO_BASE + 64,
2525 + METHOD_GPIO_24XX },
2526 + { OMAP34XX_GPIO4_BASE, 0, INT_34XX_GPIO_BANK4, IH_GPIO_BASE + 96,
2527 + METHOD_GPIO_24XX },
2528 + { OMAP34XX_GPIO5_BASE, 0, INT_34XX_GPIO_BANK5, IH_GPIO_BASE + 128,
2529 + METHOD_GPIO_24XX },
2530 + { OMAP34XX_GPIO6_BASE, 0, INT_34XX_GPIO_BANK6, IH_GPIO_BASE + 160,
2531 + METHOD_GPIO_24XX },
2536 #ifdef CONFIG_ARCH_OMAP4
2537 static struct gpio_bank gpio_bank_44xx[6] = {
2538 - { OMAP44XX_GPIO1_BASE, INT_44XX_GPIO_BANK1, IH_GPIO_BASE, \
2539 + { OMAP44XX_GPIO1_BASE, 0, INT_44XX_GPIO_BANK1, IH_GPIO_BASE,
2541 - { OMAP44XX_GPIO2_BASE, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32, \
2542 + { OMAP44XX_GPIO2_BASE, 0, INT_44XX_GPIO_BANK2, IH_GPIO_BASE + 32,
2544 - { OMAP44XX_GPIO3_BASE, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64, \
2545 + { OMAP44XX_GPIO3_BASE, 0, INT_44XX_GPIO_BANK3, IH_GPIO_BASE + 64,
2547 - { OMAP44XX_GPIO4_BASE, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96, \
2548 + { OMAP44XX_GPIO4_BASE, 0, INT_44XX_GPIO_BANK4, IH_GPIO_BASE + 96,
2550 - { OMAP44XX_GPIO5_BASE, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128, \
2551 + { OMAP44XX_GPIO5_BASE, 0, INT_44XX_GPIO_BANK5, IH_GPIO_BASE + 128,
2553 - { OMAP44XX_GPIO6_BASE, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160, \
2554 + { OMAP44XX_GPIO6_BASE, 0, INT_44XX_GPIO_BANK6, IH_GPIO_BASE + 160,
2558 @@ -402,14 +402,9 @@ static void _set_gpio_direction(struct g
2559 reg += OMAP1610_GPIO_DIRECTION;
2562 -#ifdef CONFIG_ARCH_OMAP730
2563 - case METHOD_GPIO_730:
2564 - reg += OMAP730_GPIO_DIR_CONTROL;
2567 -#ifdef CONFIG_ARCH_OMAP850
2568 - case METHOD_GPIO_850:
2569 - reg += OMAP850_GPIO_DIR_CONTROL;
2570 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2571 + case METHOD_GPIO_7XX:
2572 + reg += OMAP7XX_GPIO_DIR_CONTROL;
2575 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
2576 @@ -469,19 +464,9 @@ static void _set_gpio_dataout(struct gpi
2580 -#ifdef CONFIG_ARCH_OMAP730
2581 - case METHOD_GPIO_730:
2582 - reg += OMAP730_GPIO_DATA_OUTPUT;
2583 - l = __raw_readl(reg);
2587 - l &= ~(1 << gpio);
2590 -#ifdef CONFIG_ARCH_OMAP850
2591 - case METHOD_GPIO_850:
2592 - reg += OMAP850_GPIO_DATA_OUTPUT;
2593 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2594 + case METHOD_GPIO_7XX:
2595 + reg += OMAP7XX_GPIO_DATA_OUTPUT;
2596 l = __raw_readl(reg);
2599 @@ -537,14 +522,9 @@ static int _get_gpio_datain(struct gpio_
2600 reg += OMAP1610_GPIO_DATAIN;
2603 -#ifdef CONFIG_ARCH_OMAP730
2604 - case METHOD_GPIO_730:
2605 - reg += OMAP730_GPIO_DATA_INPUT;
2608 -#ifdef CONFIG_ARCH_OMAP850
2609 - case METHOD_GPIO_850:
2610 - reg += OMAP850_GPIO_DATA_INPUT;
2611 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2612 + case METHOD_GPIO_7XX:
2613 + reg += OMAP7XX_GPIO_DATA_INPUT;
2616 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
2617 @@ -588,14 +568,9 @@ static int _get_gpio_dataout(struct gpio
2618 reg += OMAP1610_GPIO_DATAOUT;
2621 -#ifdef CONFIG_ARCH_OMAP730
2622 - case METHOD_GPIO_730:
2623 - reg += OMAP730_GPIO_DATA_OUTPUT;
2626 -#ifdef CONFIG_ARCH_OMAP850
2627 - case METHOD_GPIO_850:
2628 - reg += OMAP850_GPIO_DATA_OUTPUT;
2629 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2630 + case METHOD_GPIO_7XX:
2631 + reg += OMAP7XX_GPIO_DATA_OUTPUT;
2634 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
2635 @@ -797,21 +772,9 @@ static int _set_gpio_triggering(struct g
2636 __raw_writel(1 << gpio, bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA);
2639 -#ifdef CONFIG_ARCH_OMAP730
2640 - case METHOD_GPIO_730:
2641 - reg += OMAP730_GPIO_INT_CONTROL;
2642 - l = __raw_readl(reg);
2643 - if (trigger & IRQ_TYPE_EDGE_RISING)
2645 - else if (trigger & IRQ_TYPE_EDGE_FALLING)
2646 - l &= ~(1 << gpio);
2651 -#ifdef CONFIG_ARCH_OMAP850
2652 - case METHOD_GPIO_850:
2653 - reg += OMAP850_GPIO_INT_CONTROL;
2654 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2655 + case METHOD_GPIO_7XX:
2656 + reg += OMAP7XX_GPIO_INT_CONTROL;
2657 l = __raw_readl(reg);
2658 if (trigger & IRQ_TYPE_EDGE_RISING)
2660 @@ -897,14 +860,9 @@ static void _clear_gpio_irqbank(struct g
2661 reg += OMAP1610_GPIO_IRQSTATUS1;
2664 -#ifdef CONFIG_ARCH_OMAP730
2665 - case METHOD_GPIO_730:
2666 - reg += OMAP730_GPIO_INT_STATUS;
2669 -#ifdef CONFIG_ARCH_OMAP850
2670 - case METHOD_GPIO_850:
2671 - reg += OMAP850_GPIO_INT_STATUS;
2672 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2673 + case METHOD_GPIO_7XX:
2674 + reg += OMAP7XX_GPIO_INT_STATUS;
2677 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
2678 @@ -971,16 +929,9 @@ static u32 _get_gpio_irqbank_mask(struct
2682 -#ifdef CONFIG_ARCH_OMAP730
2683 - case METHOD_GPIO_730:
2684 - reg += OMAP730_GPIO_INT_MASK;
2685 - mask = 0xffffffff;
2689 -#ifdef CONFIG_ARCH_OMAP850
2690 - case METHOD_GPIO_850:
2691 - reg += OMAP850_GPIO_INT_MASK;
2692 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2693 + case METHOD_GPIO_7XX:
2694 + reg += OMAP7XX_GPIO_INT_MASK;
2698 @@ -1044,19 +995,9 @@ static void _enable_gpio_irqbank(struct
2702 -#ifdef CONFIG_ARCH_OMAP730
2703 - case METHOD_GPIO_730:
2704 - reg += OMAP730_GPIO_INT_MASK;
2705 - l = __raw_readl(reg);
2707 - l &= ~(gpio_mask);
2712 -#ifdef CONFIG_ARCH_OMAP850
2713 - case METHOD_GPIO_850:
2714 - reg += OMAP850_GPIO_INT_MASK;
2715 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2716 + case METHOD_GPIO_7XX:
2717 + reg += OMAP7XX_GPIO_INT_MASK;
2718 l = __raw_readl(reg);
2721 @@ -1249,13 +1190,9 @@ static void gpio_irq_handler(unsigned in
2722 if (bank->method == METHOD_GPIO_1610)
2723 isr_reg = bank->base + OMAP1610_GPIO_IRQSTATUS1;
2725 -#ifdef CONFIG_ARCH_OMAP730
2726 - if (bank->method == METHOD_GPIO_730)
2727 - isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
2729 -#ifdef CONFIG_ARCH_OMAP850
2730 - if (bank->method == METHOD_GPIO_850)
2731 - isr_reg = bank->base + OMAP850_GPIO_INT_STATUS;
2732 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2733 + if (bank->method == METHOD_GPIO_7XX)
2734 + isr_reg = bank->base + OMAP7XX_GPIO_INT_STATUS;
2736 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
2737 if (bank->method == METHOD_GPIO_24XX)
2738 @@ -1524,11 +1461,8 @@ static int gpio_is_input(struct gpio_ban
2739 case METHOD_GPIO_1610:
2740 reg += OMAP1610_GPIO_DIRECTION;
2742 - case METHOD_GPIO_730:
2743 - reg += OMAP730_GPIO_DIR_CONTROL;
2745 - case METHOD_GPIO_850:
2746 - reg += OMAP850_GPIO_DIR_CONTROL;
2747 + case METHOD_GPIO_7XX:
2748 + reg += OMAP7XX_GPIO_DIR_CONTROL;
2750 case METHOD_GPIO_24XX:
2751 reg += OMAP24XX_GPIO_OE;
2752 @@ -1607,6 +1541,23 @@ static struct clk * gpio5_fck;
2753 static struct clk *gpio_iclks[OMAP34XX_NR_GPIOS];
2756 +static void __init omap_gpio_show_rev(void)
2760 + if (cpu_is_omap16xx())
2761 + rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION);
2762 + else if (cpu_is_omap24xx() || cpu_is_omap34xx())
2763 + rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
2764 + else if (cpu_is_omap44xx())
2765 + rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION);
2769 + printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n",
2770 + (rev >> 4) & 0x0f, rev & 0x0f);
2773 /* This lock class tells lockdep that GPIO irqs are in a different
2774 * category than their parents, so it won't report false recursion.
2776 @@ -1617,6 +1568,7 @@ static int __init _omap_gpio_init(void)
2779 struct gpio_bank *bank;
2780 + int bank_size = SZ_8K; /* Module 4KB + L4 4KB except on omap1 */
2784 @@ -1679,77 +1631,45 @@ static int __init _omap_gpio_init(void)
2786 #ifdef CONFIG_ARCH_OMAP15XX
2787 if (cpu_is_omap15xx()) {
2788 - printk(KERN_INFO "OMAP1510 GPIO hardware\n");
2789 gpio_bank_count = 2;
2790 gpio_bank = gpio_bank_1510;
2791 + bank_size = SZ_2K;
2794 #if defined(CONFIG_ARCH_OMAP16XX)
2795 if (cpu_is_omap16xx()) {
2798 gpio_bank_count = 5;
2799 gpio_bank = gpio_bank_1610;
2800 - rev = __raw_readw(gpio_bank[1].base + OMAP1610_GPIO_REVISION);
2801 - printk(KERN_INFO "OMAP GPIO hardware version %d.%d\n",
2802 - (rev >> 4) & 0x0f, rev & 0x0f);
2803 + bank_size = SZ_2K;
2806 -#ifdef CONFIG_ARCH_OMAP730
2807 - if (cpu_is_omap730()) {
2808 - printk(KERN_INFO "OMAP730 GPIO hardware\n");
2809 - gpio_bank_count = 7;
2810 - gpio_bank = gpio_bank_730;
2813 -#ifdef CONFIG_ARCH_OMAP850
2814 - if (cpu_is_omap850()) {
2815 - printk(KERN_INFO "OMAP850 GPIO hardware\n");
2816 +#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
2817 + if (cpu_is_omap7xx()) {
2818 gpio_bank_count = 7;
2819 - gpio_bank = gpio_bank_850;
2820 + gpio_bank = gpio_bank_7xx;
2821 + bank_size = SZ_2K;
2825 #ifdef CONFIG_ARCH_OMAP24XX
2826 if (cpu_is_omap242x()) {
2829 gpio_bank_count = 4;
2830 gpio_bank = gpio_bank_242x;
2831 - rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
2832 - printk(KERN_INFO "OMAP242x GPIO hardware version %d.%d\n",
2833 - (rev >> 4) & 0x0f, rev & 0x0f);
2835 if (cpu_is_omap243x()) {
2838 gpio_bank_count = 5;
2839 gpio_bank = gpio_bank_243x;
2840 - rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
2841 - printk(KERN_INFO "OMAP243x GPIO hardware version %d.%d\n",
2842 - (rev >> 4) & 0x0f, rev & 0x0f);
2845 #ifdef CONFIG_ARCH_OMAP34XX
2846 if (cpu_is_omap34xx()) {
2849 gpio_bank_count = OMAP34XX_NR_GPIOS;
2850 gpio_bank = gpio_bank_34xx;
2851 - rev = __raw_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
2852 - printk(KERN_INFO "OMAP34xx GPIO hardware version %d.%d\n",
2853 - (rev >> 4) & 0x0f, rev & 0x0f);
2856 #ifdef CONFIG_ARCH_OMAP4
2857 if (cpu_is_omap44xx()) {
2860 gpio_bank_count = OMAP34XX_NR_GPIOS;
2861 gpio_bank = gpio_bank_44xx;
2862 - rev = __raw_readl(gpio_bank[0].base + OMAP4_GPIO_REVISION);
2863 - printk(KERN_INFO "OMAP44xx GPIO hardware version %d.%d\n",
2864 - (rev >> 4) & 0x0f, rev & 0x0f);
2867 for (i = 0; i < gpio_bank_count; i++) {
2868 @@ -1757,6 +1677,14 @@ static int __init _omap_gpio_init(void)
2870 bank = &gpio_bank[i];
2871 spin_lock_init(&bank->lock);
2873 + /* Static mapping, never released */
2874 + bank->base = ioremap(bank->pbase, bank_size);
2875 + if (!bank->base) {
2876 + printk(KERN_ERR "Could not ioremap gpio bank%i\n", i);
2880 if (bank_is_mpuio(bank))
2881 __raw_writew(0xffff, bank->base + OMAP_MPUIO_GPIO_MASKIT);
2882 if (cpu_is_omap15xx() && bank->method == METHOD_GPIO_1510) {
2883 @@ -1768,11 +1696,11 @@ static int __init _omap_gpio_init(void)
2884 __raw_writew(0xffff, bank->base + OMAP1610_GPIO_IRQSTATUS1);
2885 __raw_writew(0x0014, bank->base + OMAP1610_GPIO_SYSCONFIG);
2887 - if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_730) {
2888 - __raw_writel(0xffffffff, bank->base + OMAP730_GPIO_INT_MASK);
2889 - __raw_writel(0x00000000, bank->base + OMAP730_GPIO_INT_STATUS);
2890 + if (cpu_is_omap7xx() && bank->method == METHOD_GPIO_7XX) {
2891 + __raw_writel(0xffffffff, bank->base + OMAP7XX_GPIO_INT_MASK);
2892 + __raw_writel(0x00000000, bank->base + OMAP7XX_GPIO_INT_STATUS);
2894 - gpio_count = 32; /* 730 has 32-bit GPIOs */
2895 + gpio_count = 32; /* 7xx has 32-bit GPIOs */
2898 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) || \
2899 @@ -1862,6 +1790,8 @@ static int __init _omap_gpio_init(void)
2900 if (cpu_is_omap34xx())
2901 omap_writel(1 << 0, 0x48306814);
2903 + omap_gpio_show_rev();
2908 @@ -2160,8 +2090,7 @@ static int dbg_gpio_show(struct seq_file
2910 if (bank_is_mpuio(bank))
2911 gpio = OMAP_MPUIO(0);
2912 - else if (cpu_class_is_omap2() || cpu_is_omap730() ||
2914 + else if (cpu_class_is_omap2() || cpu_is_omap7xx())
2917 for (j = 0; j < bankwidth; j++, gpio++, mask <<= 1) {
2918 --- a/arch/arm/plat-omap/include/mach/control.h
2919 +++ b/arch/arm/plat-omap/include/mach/control.h
2922 #ifndef __ASSEMBLY__
2923 #define OMAP242X_CTRL_REGADDR(reg) \
2924 - OMAP2_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
2925 + OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
2926 #define OMAP243X_CTRL_REGADDR(reg) \
2927 - OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
2928 + OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
2929 #define OMAP343X_CTRL_REGADDR(reg) \
2930 - OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
2931 + OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
2933 -#define OMAP242X_CTRL_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
2934 -#define OMAP243X_CTRL_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
2935 -#define OMAP343X_CTRL_REGADDR(reg) OMAP2_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
2936 +#define OMAP242X_CTRL_REGADDR(reg) \
2937 + OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE + (reg))
2938 +#define OMAP243X_CTRL_REGADDR(reg) \
2939 + OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE + (reg))
2940 +#define OMAP343X_CTRL_REGADDR(reg) \
2941 + OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE + (reg))
2942 #endif /* __ASSEMBLY__ */
2945 @@ -202,6 +205,40 @@
2946 #define OMAP3_PADCONF_WAKEUPEVENT0 (1 << 15)
2947 #define OMAP3_PADCONF_WAKEUPENABLE0 (1 << 14)
2950 + * CONTROL OMAP STATUS register to identify OMAP3 features
2952 +#define OMAP3_CONTROL_OMAP_STATUS 0x044c
2954 +#define OMAP3_SGX_SHIFT 13
2955 +#define OMAP3_SGX_MASK (3 << OMAP3_SGX_SHIFT)
2956 +#define FEAT_SGX_FULL 0
2957 +#define FEAT_SGX_HALF 1
2958 +#define FEAT_SGX_NONE 2
2960 +#define OMAP3_IVA_SHIFT 12
2961 +#define OMAP3_IVA_MASK (1 << OMAP3_SGX_SHIFT)
2963 +#define FEAT_IVA_NONE 1
2965 +#define OMAP3_L2CACHE_SHIFT 10
2966 +#define OMAP3_L2CACHE_MASK (3 << OMAP3_L2CACHE_SHIFT)
2967 +#define FEAT_L2CACHE_NONE 0
2968 +#define FEAT_L2CACHE_64KB 1
2969 +#define FEAT_L2CACHE_128KB 2
2970 +#define FEAT_L2CACHE_256KB 3
2972 +#define OMAP3_ISP_SHIFT 5
2973 +#define OMAP3_ISP_MASK (1<< OMAP3_ISP_SHIFT)
2975 +#define FEAT_ISP_NONE 1
2977 +#define OMAP3_NEON_SHIFT 4
2978 +#define OMAP3_NEON_MASK (1<< OMAP3_NEON_SHIFT)
2979 +#define FEAT_NEON 0
2980 +#define FEAT_NEON_NONE 1
2983 #ifndef __ASSEMBLY__
2984 #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
2985 defined(CONFIG_ARCH_OMAP4)
2986 --- a/arch/arm/plat-omap/include/mach/cpu.h
2987 +++ b/arch/arm/plat-omap/include/mach/cpu.h
2989 #ifndef __ASM_ARCH_OMAP_CPU_H
2990 #define __ASM_ARCH_OMAP_CPU_H
2992 +#include <linux/bitops.h>
2995 * Omap device type i.e. EMU/HS/TST/GP/BAD
2997 @@ -57,6 +59,23 @@ struct omap_chip_id {
2998 unsigned int omap_rev(void);
3001 + * Define CPU revision bits
3003 + * Verbose meaning of the revision bits may be different for a silicon
3004 + * family. This difference can be handled separately.
3006 +#define OMAP_REVBITS_00 0x00
3007 +#define OMAP_REVBITS_10 0x10
3008 +#define OMAP_REVBITS_20 0x20
3009 +#define OMAP_REVBITS_30 0x30
3010 +#define OMAP_REVBITS_40 0x40
3013 + * Get the CPU revision for OMAP devices
3015 +#define GET_OMAP_REVISION() ((omap_rev() >> 8) & 0xff)
3018 * Test if multicore OMAP support is needed
3021 @@ -161,6 +180,7 @@ IS_OMAP_CLASS(34xx, 0x34)
3022 IS_OMAP_SUBCLASS(242x, 0x242)
3023 IS_OMAP_SUBCLASS(243x, 0x243)
3024 IS_OMAP_SUBCLASS(343x, 0x343)
3025 +IS_OMAP_SUBCLASS(363x, 0x363)
3027 #define cpu_is_omap7xx() 0
3028 #define cpu_is_omap15xx() 0
3029 @@ -301,7 +321,12 @@ IS_OMAP_TYPE(3430, 0x3430)
3030 #define cpu_is_omap2422() 0
3031 #define cpu_is_omap2423() 0
3032 #define cpu_is_omap2430() 0
3033 +#define cpu_is_omap3503() 0
3034 +#define cpu_is_omap3515() 0
3035 +#define cpu_is_omap3525() 0
3036 +#define cpu_is_omap3530() 0
3037 #define cpu_is_omap3430() 0
3038 +#define cpu_is_omap3630() 0
3041 * Whether we have MULTI_OMAP1 or not, we still need to distinguish
3042 @@ -351,7 +376,23 @@ IS_OMAP_TYPE(3430, 0x3430)
3044 #if defined(CONFIG_ARCH_OMAP34XX)
3045 # undef cpu_is_omap3430
3046 +# undef cpu_is_omap3503
3047 +# undef cpu_is_omap3515
3048 +# undef cpu_is_omap3525
3049 +# undef cpu_is_omap3530
3050 # define cpu_is_omap3430() is_omap3430()
3051 +# define cpu_is_omap3503 (cpu_is_omap3430() && \
3052 + (!omap3_has_iva()) && \
3053 + (!omap3_has_sgx()))
3054 +# define cpu_is_omap3515 (cpu_is_omap3430() && \
3055 + (omap3_has_iva()) && \
3056 + (!omap3_has_sgx()))
3057 +# define cpu_is_omap3525 (cpu_is_omap3430() && \
3058 + (omap3_has_sgx()) && \
3059 + (!omap3_has_iva()))
3060 +# define cpu_is_omap3530 (cpu_is_omap3430())
3061 +# undef cpu_is_omap3630
3062 +# define cpu_is_omap3630() is_omap363x()
3065 # if defined(CONFIG_ARCH_OMAP4)
3066 @@ -382,6 +423,14 @@ IS_OMAP_TYPE(3430, 0x3430)
3067 #define OMAP3430_REV_ES3_0 0x34303034
3068 #define OMAP3430_REV_ES3_1 0x34304034
3070 +#define OMAP3630_REV_ES1_0 0x36300034
3072 +#define OMAP35XX_CLASS 0x35000034
3073 +#define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 12))
3074 +#define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 12))
3075 +#define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 12))
3076 +#define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 12))
3078 #define OMAP443X_CLASS 0x44300034
3081 @@ -423,4 +472,27 @@ IS_OMAP_TYPE(3430, 0x3430)
3082 int omap_chip_is(struct omap_chip_id oci);
3083 void omap2_check_revision(void);
3086 + * Runtime detection of OMAP3 features
3088 +extern u32 omap3_features;
3090 +#define OMAP3_HAS_L2CACHE BIT(0)
3091 +#define OMAP3_HAS_IVA BIT(1)
3092 +#define OMAP3_HAS_SGX BIT(2)
3093 +#define OMAP3_HAS_NEON BIT(3)
3094 +#define OMAP3_HAS_ISP BIT(4)
3096 +#define OMAP3_HAS_FEATURE(feat,flag) \
3097 +static inline unsigned int omap3_has_ ##feat(void) \
3099 + return (omap3_features & OMAP3_HAS_ ##flag); \
3102 +OMAP3_HAS_FEATURE(l2cache, L2CACHE)
3103 +OMAP3_HAS_FEATURE(sgx, SGX)
3104 +OMAP3_HAS_FEATURE(iva, IVA)
3105 +OMAP3_HAS_FEATURE(neon, NEON)
3106 +OMAP3_HAS_FEATURE(isp, ISP)
3109 --- a/arch/arm/plat-omap/include/mach/debug-macro.S
3110 +++ b/arch/arm/plat-omap/include/mach/debug-macro.S
3113 #elif CONFIG_ARCH_OMAP2
3114 moveq \rx, #0x48000000 @ physical base address
3115 - movne \rx, #0xd8000000 @ virtual base
3116 + movne \rx, #0xfa000000 @ virtual base
3117 orr \rx, \rx, #0x0006a000
3118 #ifdef CONFIG_OMAP_LL_DEBUG_UART2
3119 add \rx, \rx, #0x00002000 @ UART 2
3122 #elif defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
3123 moveq \rx, #0x48000000 @ physical base address
3124 - movne \rx, #0xd8000000 @ virtual base
3125 + movne \rx, #0xfa000000 @ virtual base
3126 orr \rx, \rx, #0x0006a000
3127 #ifdef CONFIG_OMAP_LL_DEBUG_UART2
3128 add \rx, \rx, #0x00002000 @ UART 2
3129 --- a/arch/arm/plat-omap/include/mach/entry-macro.S
3130 +++ b/arch/arm/plat-omap/include/mach/entry-macro.S
3133 #if defined(CONFIG_ARCH_OMAP1)
3135 -#if defined(CONFIG_ARCH_OMAP730) && \
3136 +#if (defined(CONFIG_ARCH_OMAP730)||defined(CONFIG_ARCH_OMAP850)) && \
3137 (defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX))
3138 -#error "FIXME: OMAP730 doesn't support multiple-OMAP"
3139 -#elif defined(CONFIG_ARCH_OMAP730)
3140 -#define INT_IH2_IRQ INT_730_IH2_IRQ
3141 +#error "FIXME: OMAP7XX doesn't support multiple-OMAP"
3142 +#elif defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
3143 +#define INT_IH2_IRQ INT_7XX_IH2_IRQ
3144 #elif defined(CONFIG_ARCH_OMAP15XX)
3145 #define INT_IH2_IRQ INT_1510_IH2_IRQ
3146 #elif defined(CONFIG_ARCH_OMAP16XX)
3149 /* REVISIT: This should be set dynamically if CONFIG_MULTI_OMAP2 is selected */
3150 #if defined(CONFIG_ARCH_OMAP2420) || defined(CONFIG_ARCH_OMAP2430)
3151 -#define OMAP2_VA_IC_BASE OMAP2_IO_ADDRESS(OMAP24XX_IC_BASE)
3152 +#define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP24XX_IC_BASE)
3153 #elif defined(CONFIG_ARCH_OMAP34XX)
3154 -#define OMAP2_VA_IC_BASE OMAP2_IO_ADDRESS(OMAP34XX_IC_BASE)
3155 +#define OMAP2_VA_IC_BASE OMAP2_L4_IO_ADDRESS(OMAP34XX_IC_BASE)
3157 #if defined(CONFIG_ARCH_OMAP4)
3158 #include <mach/omap44xx.h>
3163 +#define OMAP44XX_VA_GIC_CPU_BASE OMAP2_L4_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
3166 * The interrupt numbering scheme is defined in the
3167 * interrupt controller spec. To wit:
3168 --- a/arch/arm/plat-omap/include/mach/hardware.h
3169 +++ b/arch/arm/plat-omap/include/mach/hardware.h
3171 * ---------------------------------------------------------------------------
3174 -#include "omap730.h"
3175 +#include "omap7xx.h"
3176 #include "omap1510.h"
3177 #include "omap16xx.h"
3178 #include "omap24xx.h"
3179 --- a/arch/arm/plat-omap/include/mach/io.h
3180 +++ b/arch/arm/plat-omap/include/mach/io.h
3182 #define OMAP1_IO_OFFSET 0x01000000 /* Virtual IO = 0xfefb0000 */
3183 #define OMAP1_IO_ADDRESS(pa) IOMEM((pa) - OMAP1_IO_OFFSET)
3185 -#define OMAP2_IO_OFFSET 0x90000000
3186 -#define OMAP2_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_IO_OFFSET) /* L3 and L4 */
3187 +#define OMAP2_L3_IO_OFFSET 0x90000000
3188 +#define OMAP2_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L3_IO_OFFSET) /* L3 */
3191 +#define OMAP2_L4_IO_OFFSET 0xb2000000
3192 +#define OMAP2_L4_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_L4_IO_OFFSET) /* L4 */
3194 +#define OMAP4_L3_IO_OFFSET 0xb4000000
3195 +#define OMAP4_L3_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_L3_IO_OFFSET) /* L3 */
3197 +#define OMAP4_L3_PER_IO_OFFSET 0xb1100000
3198 +#define OMAP4_L3_PER_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_L3_PER_IO_OFFSET)
3200 +#define OMAP4_GPMC_IO_OFFSET 0xa9000000
3201 +#define OMAP4_GPMC_IO_ADDRESS(pa) IOMEM((pa) + OMAP4_GPMC_IO_OFFSET)
3203 +#define OMAP2_EMU_IO_OFFSET 0xaa800000 /* Emulation */
3204 +#define OMAP2_EMU_IO_ADDRESS(pa) IOMEM((pa) + OMAP2_EMU_IO_OFFSET)
3207 * ----------------------------------------------------------------------------
3211 /* We map both L3 and L4 on OMAP2 */
3212 -#define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 */
3213 -#define L3_24XX_VIRT 0xf8000000
3214 +#define L3_24XX_PHYS L3_24XX_BASE /* 0x68000000 --> 0xf8000000*/
3215 +#define L3_24XX_VIRT (L3_24XX_PHYS + OMAP2_L3_IO_OFFSET)
3216 #define L3_24XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */
3217 -#define L4_24XX_PHYS L4_24XX_BASE /* 0x48000000 */
3218 -#define L4_24XX_VIRT 0xd8000000
3219 +#define L4_24XX_PHYS L4_24XX_BASE /* 0x48000000 --> 0xfa000000 */
3220 +#define L4_24XX_VIRT (L4_24XX_PHYS + OMAP2_L4_IO_OFFSET)
3221 #define L4_24XX_SIZE SZ_1M /* 1MB of 128MB used, want 1MB sect */
3223 -#define L4_WK_243X_PHYS L4_WK_243X_BASE /* 0x49000000 */
3224 -#define L4_WK_243X_VIRT 0xd9000000
3225 +#define L4_WK_243X_PHYS L4_WK_243X_BASE /* 0x49000000 --> 0xfb000000 */
3226 +#define L4_WK_243X_VIRT (L4_WK_243X_PHYS + OMAP2_L4_IO_OFFSET)
3227 #define L4_WK_243X_SIZE SZ_1M
3228 -#define OMAP243X_GPMC_PHYS OMAP243X_GPMC_BASE /* 0x49000000 */
3229 -#define OMAP243X_GPMC_VIRT 0xFE000000
3230 +#define OMAP243X_GPMC_PHYS OMAP243X_GPMC_BASE
3231 +#define OMAP243X_GPMC_VIRT (OMAP243X_GPMC_PHYS + OMAP2_L3_IO_OFFSET)
3232 + /* 0x6e000000 --> 0xfe000000 */
3233 #define OMAP243X_GPMC_SIZE SZ_1M
3234 #define OMAP243X_SDRC_PHYS OMAP243X_SDRC_BASE
3235 -#define OMAP243X_SDRC_VIRT 0xFD000000
3236 + /* 0x6D000000 --> 0xfd000000 */
3237 +#define OMAP243X_SDRC_VIRT (OMAP243X_SDRC_PHYS + OMAP2_L3_IO_OFFSET)
3238 #define OMAP243X_SDRC_SIZE SZ_1M
3239 #define OMAP243X_SMS_PHYS OMAP243X_SMS_BASE
3240 -#define OMAP243X_SMS_VIRT 0xFC000000
3241 + /* 0x6c000000 --> 0xfc000000 */
3242 +#define OMAP243X_SMS_VIRT (OMAP243X_SMS_PHYS + OMAP2_L3_IO_OFFSET)
3243 #define OMAP243X_SMS_SIZE SZ_1M
3246 @@ -121,12 +140,12 @@
3249 /* We map both L3 and L4 on OMAP3 */
3250 -#define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 */
3251 -#define L3_34XX_VIRT 0xf8000000
3252 +#define L3_34XX_PHYS L3_34XX_BASE /* 0x68000000 --> 0xf8000000 */
3253 +#define L3_34XX_VIRT (L3_34XX_PHYS + OMAP2_L3_IO_OFFSET)
3254 #define L3_34XX_SIZE SZ_1M /* 44kB of 128MB used, want 1MB sect */
3256 -#define L4_34XX_PHYS L4_34XX_BASE /* 0x48000000 */
3257 -#define L4_34XX_VIRT 0xd8000000
3258 +#define L4_34XX_PHYS L4_34XX_BASE /* 0x48000000 --> 0xfa000000 */
3259 +#define L4_34XX_VIRT (L4_34XX_PHYS + OMAP2_L4_IO_OFFSET)
3260 #define L4_34XX_SIZE SZ_4M /* 1MB of 128MB used, want 1MB sect */
3263 @@ -134,28 +153,33 @@
3264 * VPOM3430 was not working for Int controller
3267 -#define L4_WK_34XX_PHYS L4_WK_34XX_BASE /* 0x48300000 */
3268 -#define L4_WK_34XX_VIRT 0xd8300000
3269 +#define L4_WK_34XX_PHYS L4_WK_34XX_BASE /* 0x48300000 --> 0xfa300000 */
3270 +#define L4_WK_34XX_VIRT (L4_WK_34XX_PHYS + OMAP2_L4_IO_OFFSET)
3271 #define L4_WK_34XX_SIZE SZ_1M
3273 -#define L4_PER_34XX_PHYS L4_PER_34XX_BASE /* 0x49000000 */
3274 -#define L4_PER_34XX_VIRT 0xd9000000
3275 +#define L4_PER_34XX_PHYS L4_PER_34XX_BASE
3276 + /* 0x49000000 --> 0xfb000000 */
3277 +#define L4_PER_34XX_VIRT (L4_PER_34XX_PHYS + OMAP2_L4_IO_OFFSET)
3278 #define L4_PER_34XX_SIZE SZ_1M
3280 -#define L4_EMU_34XX_PHYS L4_EMU_34XX_BASE /* 0x54000000 */
3281 -#define L4_EMU_34XX_VIRT 0xe4000000
3282 -#define L4_EMU_34XX_SIZE SZ_64M
3284 -#define OMAP34XX_GPMC_PHYS OMAP34XX_GPMC_BASE /* 0x6E000000 */
3285 -#define OMAP34XX_GPMC_VIRT 0xFE000000
3286 +#define L4_EMU_34XX_PHYS L4_EMU_34XX_BASE
3287 + /* 0x54000000 --> 0xfe800000 */
3288 +#define L4_EMU_34XX_VIRT (L4_EMU_34XX_PHYS + OMAP2_EMU_IO_OFFSET)
3289 +#define L4_EMU_34XX_SIZE SZ_8M
3291 +#define OMAP34XX_GPMC_PHYS OMAP34XX_GPMC_BASE
3292 + /* 0x6e000000 --> 0xfe000000 */
3293 +#define OMAP34XX_GPMC_VIRT (OMAP34XX_GPMC_PHYS + OMAP2_L3_IO_OFFSET)
3294 #define OMAP34XX_GPMC_SIZE SZ_1M
3296 -#define OMAP343X_SMS_PHYS OMAP343X_SMS_BASE /* 0x6C000000 */
3297 -#define OMAP343X_SMS_VIRT 0xFC000000
3298 +#define OMAP343X_SMS_PHYS OMAP343X_SMS_BASE
3299 + /* 0x6c000000 --> 0xfc000000 */
3300 +#define OMAP343X_SMS_VIRT (OMAP343X_SMS_PHYS + OMAP2_L3_IO_OFFSET)
3301 #define OMAP343X_SMS_SIZE SZ_1M
3303 -#define OMAP343X_SDRC_PHYS OMAP343X_SDRC_BASE /* 0x6D000000 */
3304 -#define OMAP343X_SDRC_VIRT 0xFD000000
3305 +#define OMAP343X_SDRC_PHYS OMAP343X_SDRC_BASE
3306 + /* 0x6D000000 --> 0xfd000000 */
3307 +#define OMAP343X_SDRC_VIRT (OMAP343X_SDRC_PHYS + OMAP2_L3_IO_OFFSET)
3308 #define OMAP343X_SDRC_SIZE SZ_1M
3311 @@ -176,32 +200,54 @@
3314 /* We map both L3 and L4 on OMAP4 */
3315 -#define L3_44XX_PHYS L3_44XX_BASE
3316 -#define L3_44XX_VIRT 0xd4000000
3317 +#define L3_44XX_PHYS L3_44XX_BASE /* 0x44000000 --> 0xf8000000 */
3318 +#define L3_44XX_VIRT (L3_44XX_PHYS + OMAP4_L3_IO_OFFSET)
3319 #define L3_44XX_SIZE SZ_1M
3321 -#define L4_44XX_PHYS L4_44XX_BASE
3322 -#define L4_44XX_VIRT 0xda000000
3323 +#define L4_44XX_PHYS L4_44XX_BASE /* 0x4a000000 --> 0xfc000000 */
3324 +#define L4_44XX_VIRT (L4_44XX_PHYS + OMAP2_L4_IO_OFFSET)
3325 #define L4_44XX_SIZE SZ_4M
3328 -#define L4_WK_44XX_PHYS L4_WK_44XX_BASE
3329 -#define L4_WK_44XX_VIRT 0xda300000
3330 +#define L4_WK_44XX_PHYS L4_WK_44XX_BASE /* 0x4a300000 --> 0xfc300000 */
3331 +#define L4_WK_44XX_VIRT (L4_WK_44XX_PHYS + OMAP2_L4_IO_OFFSET)
3332 #define L4_WK_44XX_SIZE SZ_1M
3334 #define L4_PER_44XX_PHYS L4_PER_44XX_BASE
3335 -#define L4_PER_44XX_VIRT 0xd8000000
3336 + /* 0x48000000 --> 0xfa000000 */
3337 +#define L4_PER_44XX_VIRT (L4_PER_44XX_PHYS + OMAP2_L4_IO_OFFSET)
3338 #define L4_PER_44XX_SIZE SZ_4M
3340 +#define L4_ABE_44XX_PHYS L4_ABE_44XX_BASE
3341 + /* 0x49000000 --> 0xfb000000 */
3342 +#define L4_ABE_44XX_VIRT (L4_ABE_44XX_PHYS + OMAP2_L4_IO_OFFSET)
3343 +#define L4_ABE_44XX_SIZE SZ_1M
3345 #define L4_EMU_44XX_PHYS L4_EMU_44XX_BASE
3346 -#define L4_EMU_44XX_VIRT 0xe4000000
3347 -#define L4_EMU_44XX_SIZE SZ_64M
3348 + /* 0x54000000 --> 0xfe800000 */
3349 +#define L4_EMU_44XX_VIRT (L4_EMU_44XX_PHYS + OMAP2_EMU_IO_OFFSET)
3350 +#define L4_EMU_44XX_SIZE SZ_8M
3352 #define OMAP44XX_GPMC_PHYS OMAP44XX_GPMC_BASE
3353 -#define OMAP44XX_GPMC_VIRT 0xe0000000
3354 + /* 0x50000000 --> 0xf9000000 */
3355 +#define OMAP44XX_GPMC_VIRT (OMAP44XX_GPMC_PHYS + OMAP4_GPMC_IO_OFFSET)
3356 #define OMAP44XX_GPMC_SIZE SZ_1M
3359 +#define OMAP44XX_EMIF1_PHYS OMAP44XX_EMIF1_BASE
3360 + /* 0x4c000000 --> 0xfd100000 */
3361 +#define OMAP44XX_EMIF1_VIRT (OMAP44XX_EMIF1_PHYS + OMAP4_L3_PER_IO_OFFSET)
3362 +#define OMAP44XX_EMIF1_SIZE SZ_1M
3364 +#define OMAP44XX_EMIF2_PHYS OMAP44XX_EMIF2_BASE
3365 + /* 0x4d000000 --> 0xfd200000 */
3366 +#define OMAP44XX_EMIF2_VIRT (OMAP44XX_EMIF2_PHYS + OMAP4_L3_PER_IO_OFFSET)
3367 +#define OMAP44XX_EMIF2_SIZE SZ_1M
3369 +#define OMAP44XX_DMM_PHYS OMAP44XX_DMM_BASE
3370 + /* 0x4e000000 --> 0xfd300000 */
3371 +#define OMAP44XX_DMM_VIRT (OMAP44XX_DMM_PHYS + OMAP4_L3_PER_IO_OFFSET)
3372 +#define OMAP44XX_DMM_SIZE SZ_1M
3374 * ----------------------------------------------------------------------------
3375 * Omap specific register access
3376 --- a/arch/arm/plat-omap/include/mach/irqs.h
3377 +++ b/arch/arm/plat-omap/include/mach/irqs.h
3379 #define INT_1610_SSR_FIFO_0 29
3382 - * OMAP-730 specific IRQ numbers for interrupt handler 1
3383 + * OMAP-7xx specific IRQ numbers for interrupt handler 1
3385 -#define INT_730_IH2_FIQ 0
3386 -#define INT_730_IH2_IRQ 1
3387 -#define INT_730_USB_NON_ISO 2
3388 -#define INT_730_USB_ISO 3
3389 -#define INT_730_ICR 4
3390 -#define INT_730_EAC 5
3391 -#define INT_730_GPIO_BANK1 6
3392 -#define INT_730_GPIO_BANK2 7
3393 -#define INT_730_GPIO_BANK3 8
3394 -#define INT_730_McBSP2TX 10
3395 -#define INT_730_McBSP2RX 11
3396 -#define INT_730_McBSP2RX_OVF 12
3397 -#define INT_730_LCD_LINE 14
3398 -#define INT_730_GSM_PROTECT 15
3399 -#define INT_730_TIMER3 16
3400 -#define INT_730_GPIO_BANK5 17
3401 -#define INT_730_GPIO_BANK6 18
3402 -#define INT_730_SPGIO_WR 29
3405 - * OMAP-850 specific IRQ numbers for interrupt handler 1
3407 -#define INT_850_IH2_FIQ 0
3408 -#define INT_850_IH2_IRQ 1
3409 -#define INT_850_USB_NON_ISO 2
3410 -#define INT_850_USB_ISO 3
3411 -#define INT_850_ICR 4
3412 -#define INT_850_EAC 5
3413 -#define INT_850_GPIO_BANK1 6
3414 -#define INT_850_GPIO_BANK2 7
3415 -#define INT_850_GPIO_BANK3 8
3416 -#define INT_850_McBSP2TX 10
3417 -#define INT_850_McBSP2RX 11
3418 -#define INT_850_McBSP2RX_OVF 12
3419 -#define INT_850_LCD_LINE 14
3420 -#define INT_850_GSM_PROTECT 15
3421 -#define INT_850_TIMER3 16
3422 -#define INT_850_GPIO_BANK5 17
3423 -#define INT_850_GPIO_BANK6 18
3424 -#define INT_850_SPGIO_WR 29
3426 +#define INT_7XX_IH2_FIQ 0
3427 +#define INT_7XX_IH2_IRQ 1
3428 +#define INT_7XX_USB_NON_ISO 2
3429 +#define INT_7XX_USB_ISO 3
3430 +#define INT_7XX_ICR 4
3431 +#define INT_7XX_EAC 5
3432 +#define INT_7XX_GPIO_BANK1 6
3433 +#define INT_7XX_GPIO_BANK2 7
3434 +#define INT_7XX_GPIO_BANK3 8
3435 +#define INT_7XX_McBSP2TX 10
3436 +#define INT_7XX_McBSP2RX 11
3437 +#define INT_7XX_McBSP2RX_OVF 12
3438 +#define INT_7XX_LCD_LINE 14
3439 +#define INT_7XX_GSM_PROTECT 15
3440 +#define INT_7XX_TIMER3 16
3441 +#define INT_7XX_GPIO_BANK5 17
3442 +#define INT_7XX_GPIO_BANK6 18
3443 +#define INT_7XX_SPGIO_WR 29
3446 * IRQ numbers for interrupt handler 2
3447 @@ -206,120 +183,62 @@
3448 #define INT_1610_SHA1MD5 (91 + IH2_BASE)
3451 - * OMAP-730 specific IRQ numbers for interrupt handler 2
3453 -#define INT_730_HW_ERRORS (0 + IH2_BASE)
3454 -#define INT_730_NFIQ_PWR_FAIL (1 + IH2_BASE)
3455 -#define INT_730_CFCD (2 + IH2_BASE)
3456 -#define INT_730_CFIREQ (3 + IH2_BASE)
3457 -#define INT_730_I2C (4 + IH2_BASE)
3458 -#define INT_730_PCC (5 + IH2_BASE)
3459 -#define INT_730_MPU_EXT_NIRQ (6 + IH2_BASE)
3460 -#define INT_730_SPI_100K_1 (7 + IH2_BASE)
3461 -#define INT_730_SYREN_SPI (8 + IH2_BASE)
3462 -#define INT_730_VLYNQ (9 + IH2_BASE)
3463 -#define INT_730_GPIO_BANK4 (10 + IH2_BASE)
3464 -#define INT_730_McBSP1TX (11 + IH2_BASE)
3465 -#define INT_730_McBSP1RX (12 + IH2_BASE)
3466 -#define INT_730_McBSP1RX_OF (13 + IH2_BASE)
3467 -#define INT_730_UART_MODEM_IRDA_2 (14 + IH2_BASE)
3468 -#define INT_730_UART_MODEM_1 (15 + IH2_BASE)
3469 -#define INT_730_MCSI (16 + IH2_BASE)
3470 -#define INT_730_uWireTX (17 + IH2_BASE)
3471 -#define INT_730_uWireRX (18 + IH2_BASE)
3472 -#define INT_730_SMC_CD (19 + IH2_BASE)
3473 -#define INT_730_SMC_IREQ (20 + IH2_BASE)
3474 -#define INT_730_HDQ_1WIRE (21 + IH2_BASE)
3475 -#define INT_730_TIMER32K (22 + IH2_BASE)
3476 -#define INT_730_MMC_SDIO (23 + IH2_BASE)
3477 -#define INT_730_UPLD (24 + IH2_BASE)
3478 -#define INT_730_USB_HHC_1 (27 + IH2_BASE)
3479 -#define INT_730_USB_HHC_2 (28 + IH2_BASE)
3480 -#define INT_730_USB_GENI (29 + IH2_BASE)
3481 -#define INT_730_USB_OTG (30 + IH2_BASE)
3482 -#define INT_730_CAMERA_IF (31 + IH2_BASE)
3483 -#define INT_730_RNG (32 + IH2_BASE)
3484 -#define INT_730_DUAL_MODE_TIMER (33 + IH2_BASE)
3485 -#define INT_730_DBB_RF_EN (34 + IH2_BASE)
3486 -#define INT_730_MPUIO_KEYPAD (35 + IH2_BASE)
3487 -#define INT_730_SHA1_MD5 (36 + IH2_BASE)
3488 -#define INT_730_SPI_100K_2 (37 + IH2_BASE)
3489 -#define INT_730_RNG_IDLE (38 + IH2_BASE)
3490 -#define INT_730_MPUIO (39 + IH2_BASE)
3491 -#define INT_730_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
3492 -#define INT_730_LLPC_OE_FALLING (41 + IH2_BASE)
3493 -#define INT_730_LLPC_OE_RISING (42 + IH2_BASE)
3494 -#define INT_730_LLPC_VSYNC (43 + IH2_BASE)
3495 -#define INT_730_WAKE_UP_REQ (46 + IH2_BASE)
3496 -#define INT_730_DMA_CH6 (53 + IH2_BASE)
3497 -#define INT_730_DMA_CH7 (54 + IH2_BASE)
3498 -#define INT_730_DMA_CH8 (55 + IH2_BASE)
3499 -#define INT_730_DMA_CH9 (56 + IH2_BASE)
3500 -#define INT_730_DMA_CH10 (57 + IH2_BASE)
3501 -#define INT_730_DMA_CH11 (58 + IH2_BASE)
3502 -#define INT_730_DMA_CH12 (59 + IH2_BASE)
3503 -#define INT_730_DMA_CH13 (60 + IH2_BASE)
3504 -#define INT_730_DMA_CH14 (61 + IH2_BASE)
3505 -#define INT_730_DMA_CH15 (62 + IH2_BASE)
3506 -#define INT_730_NAND (63 + IH2_BASE)
3509 - * OMAP-850 specific IRQ numbers for interrupt handler 2
3510 + * OMAP-7xx specific IRQ numbers for interrupt handler 2
3512 -#define INT_850_HW_ERRORS (0 + IH2_BASE)
3513 -#define INT_850_NFIQ_PWR_FAIL (1 + IH2_BASE)
3514 -#define INT_850_CFCD (2 + IH2_BASE)
3515 -#define INT_850_CFIREQ (3 + IH2_BASE)
3516 -#define INT_850_I2C (4 + IH2_BASE)
3517 -#define INT_850_PCC (5 + IH2_BASE)
3518 -#define INT_850_MPU_EXT_NIRQ (6 + IH2_BASE)
3519 -#define INT_850_SPI_100K_1 (7 + IH2_BASE)
3520 -#define INT_850_SYREN_SPI (8 + IH2_BASE)
3521 -#define INT_850_VLYNQ (9 + IH2_BASE)
3522 -#define INT_850_GPIO_BANK4 (10 + IH2_BASE)
3523 -#define INT_850_McBSP1TX (11 + IH2_BASE)
3524 -#define INT_850_McBSP1RX (12 + IH2_BASE)
3525 -#define INT_850_McBSP1RX_OF (13 + IH2_BASE)
3526 -#define INT_850_UART_MODEM_IRDA_2 (14 + IH2_BASE)
3527 -#define INT_850_UART_MODEM_1 (15 + IH2_BASE)
3528 -#define INT_850_MCSI (16 + IH2_BASE)
3529 -#define INT_850_uWireTX (17 + IH2_BASE)
3530 -#define INT_850_uWireRX (18 + IH2_BASE)
3531 -#define INT_850_SMC_CD (19 + IH2_BASE)
3532 -#define INT_850_SMC_IREQ (20 + IH2_BASE)
3533 -#define INT_850_HDQ_1WIRE (21 + IH2_BASE)
3534 -#define INT_850_TIMER32K (22 + IH2_BASE)
3535 -#define INT_850_MMC_SDIO (23 + IH2_BASE)
3536 -#define INT_850_UPLD (24 + IH2_BASE)
3537 -#define INT_850_USB_HHC_1 (27 + IH2_BASE)
3538 -#define INT_850_USB_HHC_2 (28 + IH2_BASE)
3539 -#define INT_850_USB_GENI (29 + IH2_BASE)
3540 -#define INT_850_USB_OTG (30 + IH2_BASE)
3541 -#define INT_850_CAMERA_IF (31 + IH2_BASE)
3542 -#define INT_850_RNG (32 + IH2_BASE)
3543 -#define INT_850_DUAL_MODE_TIMER (33 + IH2_BASE)
3544 -#define INT_850_DBB_RF_EN (34 + IH2_BASE)
3545 -#define INT_850_MPUIO_KEYPAD (35 + IH2_BASE)
3546 -#define INT_850_SHA1_MD5 (36 + IH2_BASE)
3547 -#define INT_850_SPI_100K_2 (37 + IH2_BASE)
3548 -#define INT_850_RNG_IDLE (38 + IH2_BASE)
3549 -#define INT_850_MPUIO (39 + IH2_BASE)
3550 -#define INT_850_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
3551 -#define INT_850_LLPC_OE_FALLING (41 + IH2_BASE)
3552 -#define INT_850_LLPC_OE_RISING (42 + IH2_BASE)
3553 -#define INT_850_LLPC_VSYNC (43 + IH2_BASE)
3554 -#define INT_850_WAKE_UP_REQ (46 + IH2_BASE)
3555 -#define INT_850_DMA_CH6 (53 + IH2_BASE)
3556 -#define INT_850_DMA_CH7 (54 + IH2_BASE)
3557 -#define INT_850_DMA_CH8 (55 + IH2_BASE)
3558 -#define INT_850_DMA_CH9 (56 + IH2_BASE)
3559 -#define INT_850_DMA_CH10 (57 + IH2_BASE)
3560 -#define INT_850_DMA_CH11 (58 + IH2_BASE)
3561 -#define INT_850_DMA_CH12 (59 + IH2_BASE)
3562 -#define INT_850_DMA_CH13 (60 + IH2_BASE)
3563 -#define INT_850_DMA_CH14 (61 + IH2_BASE)
3564 -#define INT_850_DMA_CH15 (62 + IH2_BASE)
3565 -#define INT_850_NAND (63 + IH2_BASE)
3566 +#define INT_7XX_HW_ERRORS (0 + IH2_BASE)
3567 +#define INT_7XX_NFIQ_PWR_FAIL (1 + IH2_BASE)
3568 +#define INT_7XX_CFCD (2 + IH2_BASE)
3569 +#define INT_7XX_CFIREQ (3 + IH2_BASE)
3570 +#define INT_7XX_I2C (4 + IH2_BASE)
3571 +#define INT_7XX_PCC (5 + IH2_BASE)
3572 +#define INT_7XX_MPU_EXT_NIRQ (6 + IH2_BASE)
3573 +#define INT_7XX_SPI_100K_1 (7 + IH2_BASE)
3574 +#define INT_7XX_SYREN_SPI (8 + IH2_BASE)
3575 +#define INT_7XX_VLYNQ (9 + IH2_BASE)
3576 +#define INT_7XX_GPIO_BANK4 (10 + IH2_BASE)
3577 +#define INT_7XX_McBSP1TX (11 + IH2_BASE)
3578 +#define INT_7XX_McBSP1RX (12 + IH2_BASE)
3579 +#define INT_7XX_McBSP1RX_OF (13 + IH2_BASE)
3580 +#define INT_7XX_UART_MODEM_IRDA_2 (14 + IH2_BASE)
3581 +#define INT_7XX_UART_MODEM_1 (15 + IH2_BASE)
3582 +#define INT_7XX_MCSI (16 + IH2_BASE)
3583 +#define INT_7XX_uWireTX (17 + IH2_BASE)
3584 +#define INT_7XX_uWireRX (18 + IH2_BASE)
3585 +#define INT_7XX_SMC_CD (19 + IH2_BASE)
3586 +#define INT_7XX_SMC_IREQ (20 + IH2_BASE)
3587 +#define INT_7XX_HDQ_1WIRE (21 + IH2_BASE)
3588 +#define INT_7XX_TIMER32K (22 + IH2_BASE)
3589 +#define INT_7XX_MMC_SDIO (23 + IH2_BASE)
3590 +#define INT_7XX_UPLD (24 + IH2_BASE)
3591 +#define INT_7XX_USB_HHC_1 (27 + IH2_BASE)
3592 +#define INT_7XX_USB_HHC_2 (28 + IH2_BASE)
3593 +#define INT_7XX_USB_GENI (29 + IH2_BASE)
3594 +#define INT_7XX_USB_OTG (30 + IH2_BASE)
3595 +#define INT_7XX_CAMERA_IF (31 + IH2_BASE)
3596 +#define INT_7XX_RNG (32 + IH2_BASE)
3597 +#define INT_7XX_DUAL_MODE_TIMER (33 + IH2_BASE)
3598 +#define INT_7XX_DBB_RF_EN (34 + IH2_BASE)
3599 +#define INT_7XX_MPUIO_KEYPAD (35 + IH2_BASE)
3600 +#define INT_7XX_SHA1_MD5 (36 + IH2_BASE)
3601 +#define INT_7XX_SPI_100K_2 (37 + IH2_BASE)
3602 +#define INT_7XX_RNG_IDLE (38 + IH2_BASE)
3603 +#define INT_7XX_MPUIO (39 + IH2_BASE)
3604 +#define INT_7XX_LLPC_LCD_CTRL_CAN_BE_OFF (40 + IH2_BASE)
3605 +#define INT_7XX_LLPC_OE_FALLING (41 + IH2_BASE)
3606 +#define INT_7XX_LLPC_OE_RISING (42 + IH2_BASE)
3607 +#define INT_7XX_LLPC_VSYNC (43 + IH2_BASE)
3608 +#define INT_7XX_WAKE_UP_REQ (46 + IH2_BASE)
3609 +#define INT_7XX_DMA_CH6 (53 + IH2_BASE)
3610 +#define INT_7XX_DMA_CH7 (54 + IH2_BASE)
3611 +#define INT_7XX_DMA_CH8 (55 + IH2_BASE)
3612 +#define INT_7XX_DMA_CH9 (56 + IH2_BASE)
3613 +#define INT_7XX_DMA_CH10 (57 + IH2_BASE)
3614 +#define INT_7XX_DMA_CH11 (58 + IH2_BASE)
3615 +#define INT_7XX_DMA_CH12 (59 + IH2_BASE)
3616 +#define INT_7XX_DMA_CH13 (60 + IH2_BASE)
3617 +#define INT_7XX_DMA_CH14 (61 + IH2_BASE)
3618 +#define INT_7XX_DMA_CH15 (62 + IH2_BASE)
3619 +#define INT_7XX_NAND (63 + IH2_BASE)
3621 #define INT_24XX_SYS_NIRQ 7
3622 #define INT_24XX_SDMA_IRQ0 12
3623 --- a/arch/arm/plat-omap/include/mach/mcbsp.h
3624 +++ b/arch/arm/plat-omap/include/mach/mcbsp.h
3626 #include <mach/hardware.h>
3627 #include <mach/clock.h>
3629 -#define OMAP730_MCBSP1_BASE 0xfffb1000
3630 -#define OMAP730_MCBSP2_BASE 0xfffb1800
3631 +#define OMAP7XX_MCBSP1_BASE 0xfffb1000
3632 +#define OMAP7XX_MCBSP2_BASE 0xfffb1800
3634 #define OMAP1510_MCBSP1_BASE 0xe1011800
3635 #define OMAP1510_MCBSP2_BASE 0xfffb1000
3637 #define OMAP44XX_MCBSP3_BASE 0x49026000
3638 #define OMAP44XX_MCBSP4_BASE 0x48074000
3640 -#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730)
3641 +#if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
3643 #define OMAP_MCBSP_REG_DRR2 0x00
3644 #define OMAP_MCBSP_REG_DRR1 0x02
3645 --- a/arch/arm/plat-omap/include/mach/mux.h
3646 +++ b/arch/arm/plat-omap/include/mach/mux.h
3648 .pu_pd_reg = PU_PD_SEL_##reg, \
3649 .pu_pd_val = status,
3651 -#define MUX_REG_730(reg, mode_offset, mode) .mux_reg_name = "OMAP730_IO_CONF_"#reg, \
3652 - .mux_reg = OMAP730_IO_CONF_##reg, \
3653 +#define MUX_REG_7XX(reg, mode_offset, mode) .mux_reg_name = "OMAP7XX_IO_CONF_"#reg, \
3654 + .mux_reg = OMAP7XX_IO_CONF_##reg, \
3655 .mask_offset = mode_offset, \
3658 -#define PULL_REG_730(reg, bit, status) .pull_name = "OMAP730_IO_CONF_"#reg, \
3659 - .pull_reg = OMAP730_IO_CONF_##reg, \
3660 - .pull_bit = bit, \
3661 - .pull_val = status,
3663 -#define MUX_REG_850(reg, mode_offset, mode) .mux_reg_name = "OMAP850_IO_CONF_"#reg, \
3664 - .mux_reg = OMAP850_IO_CONF_##reg, \
3665 - .mask_offset = mode_offset, \
3668 -#define PULL_REG_850(reg, bit, status) .pull_name = "OMAP850_IO_CONF_"#reg, \
3669 - .pull_reg = OMAP850_IO_CONF_##reg, \
3670 +#define PULL_REG_7XX(reg, bit, status) .pull_name = "OMAP7XX_IO_CONF_"#reg, \
3671 + .pull_reg = OMAP7XX_IO_CONF_##reg, \
3676 #define PU_PD_REG(reg, status) .pu_pd_reg = PU_PD_SEL_##reg, \
3677 .pu_pd_val = status,
3679 -#define MUX_REG_730(reg, mode_offset, mode) \
3680 - .mux_reg = OMAP730_IO_CONF_##reg, \
3681 +#define MUX_REG_7XX(reg, mode_offset, mode) \
3682 + .mux_reg = OMAP7XX_IO_CONF_##reg, \
3683 .mask_offset = mode_offset, \
3686 -#define PULL_REG_730(reg, bit, status) .pull_reg = OMAP730_IO_CONF_##reg, \
3687 - .pull_bit = bit, \
3688 - .pull_val = status,
3690 -#define MUX_REG_850(reg, mode_offset, mode) \
3691 - .mux_reg = OMAP850_IO_CONF_##reg, \
3692 - .mask_offset = mode_offset, \
3695 -#define PULL_REG_850(reg, bit, status) .pull_reg = OMAP850_IO_CONF_##reg, \
3696 +#define PULL_REG_7XX(reg, bit, status) .pull_reg = OMAP7XX_IO_CONF_##reg, \
3700 @@ -118,32 +99,21 @@
3703 * OMAP730/850 has a slightly different config for the pin mux.
3704 - * - config regs are the OMAP730_IO_CONF_x regs (see omap730.h) regs and
3705 + * - config regs are the OMAP7XX_IO_CONF_x regs (see omap730.h) regs and
3706 * not the FUNC_MUX_CTRL_x regs from hardware.h
3707 * - for pull-up/down, only has one enable bit which is is in the same register
3710 -#define MUX_CFG_730(desc, mux_reg, mode_offset, mode, \
3711 +#define MUX_CFG_7XX(desc, mux_reg, mode_offset, mode, \
3712 pull_bit, pull_status, debug_status)\
3715 .debug = debug_status, \
3716 - MUX_REG_730(mux_reg, mode_offset, mode) \
3717 - PULL_REG_730(mux_reg, pull_bit, pull_status) \
3718 + MUX_REG_7XX(mux_reg, mode_offset, mode) \
3719 + PULL_REG_7XX(mux_reg, pull_bit, pull_status) \
3723 -#define MUX_CFG_850(desc, mux_reg, mode_offset, mode, \
3724 - pull_bit, pull_status, debug_status)\
3727 - .debug = debug_status, \
3728 - MUX_REG_850(mux_reg, mode_offset, mode) \
3729 - PULL_REG_850(mux_reg, pull_bit, pull_status) \
3730 - PU_PD_REG(NA, 0) \
3734 #define MUX_CFG_24XX(desc, reg_offset, mode, \
3735 pull_en, pull_mode, dbg) \
3737 @@ -232,45 +202,25 @@ struct pin_config {
3741 -enum omap730_index {
3742 +enum omap7xx_index {
3743 /* OMAP 730 keyboard */
3757 - W16_730_USB_PU_EN,
3758 - W17_730_USB_VBUSI,
3761 -enum omap850_index {
3762 - /* OMAP 850 keyboard */
3786 - W16_850_USB_PU_EN,
3787 - W17_850_USB_VBUSI,
3789 + W16_7XX_USB_PU_EN,
3790 + W17_7XX_USB_VBUSI,
3794 enum omap1xxx_index {
3795 /* UART1 (BT_UART_GATING)*/
3797 --- a/arch/arm/plat-omap/include/mach/omap34xx.h
3798 +++ b/arch/arm/plat-omap/include/mach/omap34xx.h
3801 #define OMAP34XX_IVA_INTC_BASE 0x40000000
3802 #define OMAP34XX_HSUSB_OTG_BASE (L4_34XX_BASE + 0xAB000)
3803 -#define OMAP34XX_HSUSB_HOST_BASE (L4_34XX_BASE + 0x64000)
3804 #define OMAP34XX_USBTLL_BASE (L4_34XX_BASE + 0x62000)
3805 +#define OMAP34XX_UHH_CONFIG_BASE (L4_34XX_BASE + 0x64000)
3806 +#define OMAP34XX_OHCI_BASE (L4_34XX_BASE + 0x64400)
3807 +#define OMAP34XX_EHCI_BASE (L4_34XX_BASE + 0x64800)
3808 +#define OMAP34XX_SR1_BASE 0x480C9000
3809 +#define OMAP34XX_SR2_BASE 0x480CB000
3811 #define OMAP34XX_MAILBOX_BASE (L4_34XX_BASE + 0x94000)
3813 --- a/arch/arm/plat-omap/include/mach/omap44xx.h
3814 +++ b/arch/arm/plat-omap/include/mach/omap44xx.h
3816 #define L4_PER_44XX_BASE 0x48000000
3817 #define L4_EMU_44XX_BASE 0x54000000
3818 #define L3_44XX_BASE 0x44000000
3819 +#define OMAP44XX_EMIF1_BASE 0x4c000000
3820 +#define OMAP44XX_EMIF2_BASE 0x4d000000
3821 +#define OMAP44XX_DMM_BASE 0x4e000000
3822 #define OMAP4430_32KSYNCT_BASE 0x4a304000
3823 #define OMAP4430_CM_BASE 0x4a004000
3824 #define OMAP4430_PRM_BASE 0x48306000
3826 #define IRQ_SIR_IRQ 0x0040
3827 #define OMAP44XX_GIC_DIST_BASE 0x48241000
3828 #define OMAP44XX_GIC_CPU_BASE 0x48240100
3829 -#define OMAP44XX_VA_GIC_CPU_BASE OMAP2_IO_ADDRESS(OMAP44XX_GIC_CPU_BASE)
3830 #define OMAP44XX_SCU_BASE 0x48240000
3831 -#define OMAP44XX_VA_SCU_BASE OMAP2_IO_ADDRESS(OMAP44XX_SCU_BASE)
3832 #define OMAP44XX_LOCAL_TWD_BASE 0x48240600
3833 -#define OMAP44XX_VA_LOCAL_TWD_BASE OMAP2_IO_ADDRESS(OMAP44XX_LOCAL_TWD_BASE)
3834 -#define OMAP44XX_LOCAL_TWD_SIZE 0x00000100
3835 #define OMAP44XX_WKUPGEN_BASE 0x48281000
3836 -#define OMAP44XX_VA_WKUPGEN_BASE OMAP2_IO_ADDRESS(OMAP44XX_WKUPGEN_BASE)
3838 #endif /* __ASM_ARCH_OMAP44XX_H */
3841 +++ b/arch/arm/plat-omap/include/mach/omap7xx.h
3843 +/* arch/arm/plat-omap/include/mach/omap7xx.h
3845 + * Hardware definitions for TI OMAP7XX processor.
3847 + * Cleanup for Linux-2.6 by Dirk Behme <dirk.behme@de.bosch.com>
3848 + * Adapted for omap850 by Zebediah C. McClure <zmc@lurian.net>
3849 + * Adapted for omap7xx by Alistair Buxton <a.j.buxton@gmail.com>
3851 + * This program is free software; you can redistribute it and/or modify it
3852 + * under the terms of the GNU General Public License as published by the
3853 + * Free Software Foundation; either version 2 of the License, or (at your
3854 + * option) any later version.
3856 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
3857 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
3858 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
3859 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
3860 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
3861 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
3862 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
3863 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3864 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3865 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3867 + * You should have received a copy of the GNU General Public License along
3868 + * with this program; if not, write to the Free Software Foundation, Inc.,
3869 + * 675 Mass Ave, Cambridge, MA 02139, USA.
3872 +#ifndef __ASM_ARCH_OMAP7XX_H
3873 +#define __ASM_ARCH_OMAP7XX_H
3876 + * ----------------------------------------------------------------------------
3878 + * ----------------------------------------------------------------------------
3881 +/* Syntax: XX_BASE = Virtual base address, XX_START = Physical base address */
3883 +#define OMAP7XX_DSP_BASE 0xE0000000
3884 +#define OMAP7XX_DSP_SIZE 0x50000
3885 +#define OMAP7XX_DSP_START 0xE0000000
3887 +#define OMAP7XX_DSPREG_BASE 0xE1000000
3888 +#define OMAP7XX_DSPREG_SIZE SZ_128K
3889 +#define OMAP7XX_DSPREG_START 0xE1000000
3892 + * ----------------------------------------------------------------------------
3893 + * OMAP7XX specific configuration registers
3894 + * ----------------------------------------------------------------------------
3896 +#define OMAP7XX_CONFIG_BASE 0xfffe1000
3897 +#define OMAP7XX_IO_CONF_0 0xfffe1070
3898 +#define OMAP7XX_IO_CONF_1 0xfffe1074
3899 +#define OMAP7XX_IO_CONF_2 0xfffe1078
3900 +#define OMAP7XX_IO_CONF_3 0xfffe107c
3901 +#define OMAP7XX_IO_CONF_4 0xfffe1080
3902 +#define OMAP7XX_IO_CONF_5 0xfffe1084
3903 +#define OMAP7XX_IO_CONF_6 0xfffe1088
3904 +#define OMAP7XX_IO_CONF_7 0xfffe108c
3905 +#define OMAP7XX_IO_CONF_8 0xfffe1090
3906 +#define OMAP7XX_IO_CONF_9 0xfffe1094
3907 +#define OMAP7XX_IO_CONF_10 0xfffe1098
3908 +#define OMAP7XX_IO_CONF_11 0xfffe109c
3909 +#define OMAP7XX_IO_CONF_12 0xfffe10a0
3910 +#define OMAP7XX_IO_CONF_13 0xfffe10a4
3912 +#define OMAP7XX_MODE_1 0xfffe1010
3913 +#define OMAP7XX_MODE_2 0xfffe1014
3915 +/* CSMI specials: in terms of base + offset */
3916 +#define OMAP7XX_MODE2_OFFSET 0x14
3919 + * ----------------------------------------------------------------------------
3920 + * OMAP7XX traffic controller configuration registers
3921 + * ----------------------------------------------------------------------------
3923 +#define OMAP7XX_FLASH_CFG_0 0xfffecc10
3924 +#define OMAP7XX_FLASH_ACFG_0 0xfffecc50
3925 +#define OMAP7XX_FLASH_CFG_1 0xfffecc14
3926 +#define OMAP7XX_FLASH_ACFG_1 0xfffecc54
3929 + * ----------------------------------------------------------------------------
3930 + * OMAP7XX DSP control registers
3931 + * ----------------------------------------------------------------------------
3933 +#define OMAP7XX_ICR_BASE 0xfffbb800
3934 +#define OMAP7XX_DSP_M_CTL 0xfffbb804
3935 +#define OMAP7XX_DSP_MMU_BASE 0xfffed200
3938 + * ----------------------------------------------------------------------------
3939 + * OMAP7XX PCC_UPLD configuration registers
3940 + * ----------------------------------------------------------------------------
3942 +#define OMAP7XX_PCC_UPLD_CTRL_BASE (0xfffe0900)
3943 +#define OMAP7XX_PCC_UPLD_CTRL (OMAP7XX_PCC_UPLD_CTRL_BASE + 0x00)
3945 +#endif /* __ASM_ARCH_OMAP7XX_H */
3947 --- a/arch/arm/plat-omap/include/mach/sdrc.h
3948 +++ b/arch/arm/plat-omap/include/mach/sdrc.h
3952 #define OMAP242X_SMS_REGADDR(reg) \
3953 - (void __iomem *)OMAP2_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
3954 + (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE + reg)
3955 #define OMAP243X_SMS_REGADDR(reg) \
3956 - (void __iomem *)OMAP2_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
3957 + (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE + reg)
3958 #define OMAP343X_SMS_REGADDR(reg) \
3959 - (void __iomem *)OMAP2_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
3960 + (void __iomem *)OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE + reg)
3962 /* SMS register offsets - read/write with sms_{read,write}_reg() */
3964 --- a/arch/arm/plat-omap/include/mach/serial.h
3965 +++ b/arch/arm/plat-omap/include/mach/serial.h
3967 #define OMAP_UART1_BASE 0xfffb0000
3968 #define OMAP_UART2_BASE 0xfffb0800
3969 #define OMAP_UART3_BASE 0xfffb9800
3970 -#define OMAP_MAX_NR_PORTS 3
3971 #elif defined(CONFIG_ARCH_OMAP2)
3972 /* OMAP2 serial ports */
3973 #define OMAP_UART1_BASE 0x4806a000
3974 #define OMAP_UART2_BASE 0x4806c000
3975 #define OMAP_UART3_BASE 0x4806e000
3976 -#define OMAP_MAX_NR_PORTS 3
3977 #elif defined(CONFIG_ARCH_OMAP3)
3978 /* OMAP3 serial ports */
3979 #define OMAP_UART1_BASE 0x4806a000
3980 #define OMAP_UART2_BASE 0x4806c000
3981 #define OMAP_UART3_BASE 0x49020000
3982 -#define OMAP_MAX_NR_PORTS 3
3983 #elif defined(CONFIG_ARCH_OMAP4)
3984 /* OMAP4 serial ports */
3985 #define OMAP_UART1_BASE 0x4806a000
3986 #define OMAP_UART2_BASE 0x4806c000
3987 #define OMAP_UART3_BASE 0x48020000
3988 #define OMAP_UART4_BASE 0x4806e000
3989 -#define OMAP_MAX_NR_PORTS 4
3992 #define OMAP1510_BASE_BAUD (12000000/16)
3993 --- a/arch/arm/plat-omap/include/mach/uncompress.h
3994 +++ b/arch/arm/plat-omap/include/mach/uncompress.h
3995 @@ -25,6 +25,7 @@ unsigned int system_rev;
3997 #define UART_OMAP_MDR1 0x08 /* mode definition register */
3998 #define OMAP_ID_730 0x355F
3999 +#define OMAP_ID_850 0x362C
4000 #define ID_MASK 0x7fff
4001 #define check_port(base, shift) ((base[UART_OMAP_MDR1 << shift] & 7) == 0)
4002 #define omap_get_id() ((*(volatile unsigned int *)(0xfffed404)) >> 12) & ID_MASK
4003 @@ -53,7 +54,7 @@ static void putc(int c)
4004 /* MMU is not on, so cpu_is_omapXXXX() won't work here */
4005 unsigned int omap_id = omap_get_id();
4007 - if (omap_id == OMAP_ID_730)
4008 + if (omap_id == OMAP_ID_730 || omap_id == OMAP_ID_850)
4011 if (check_port(uart, shift))
4012 --- a/arch/arm/plat-omap/include/mach/usb.h
4013 +++ b/arch/arm/plat-omap/include/mach/usb.h
4016 #include <mach/board.h>
4018 +#define OMAP3_HS_USB_PORTS 3
4019 +enum ehci_hcd_omap_mode {
4020 + EHCI_HCD_OMAP_MODE_UNKNOWN,
4021 + EHCI_HCD_OMAP_MODE_PHY,
4022 + EHCI_HCD_OMAP_MODE_TLL,
4025 +struct ehci_hcd_omap_platform_data {
4026 + enum ehci_hcd_omap_mode port_mode[OMAP3_HS_USB_PORTS];
4027 + unsigned phy_reset:1;
4029 + /* have to be valid if phy_reset is true and portx is in phy mode */
4030 + int reset_gpio_port[OMAP3_HS_USB_PORTS];
4033 /*-------------------------------------------------------------------------*/
4035 #define OMAP1_OTG_BASE 0xfffb0400
4038 extern void usb_musb_init(void);
4040 +extern void usb_ehci_init(struct ehci_hcd_omap_platform_data *pdata);
4044 void omap_usb_init(struct omap_usb_config *pdata);
4045 --- a/arch/arm/plat-omap/include/mach/vmalloc.h
4046 +++ b/arch/arm/plat-omap/include/mach/vmalloc.h
4048 * along with this program; if not, write to the Free Software
4049 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4051 -#define VMALLOC_END (PAGE_OFFSET + 0x18000000)
4052 +#define VMALLOC_END (PAGE_OFFSET + 0x38000000)
4054 --- a/arch/arm/plat-omap/io.c
4055 +++ b/arch/arm/plat-omap/io.c
4057 #include <linux/io.h>
4058 #include <linux/mm.h>
4060 -#include <mach/omap730.h>
4061 +#include <mach/omap7xx.h>
4062 #include <mach/omap1510.h>
4063 #include <mach/omap16xx.h>
4064 #include <mach/omap24xx.h>
4065 @@ -33,13 +33,13 @@ void __iomem *omap_ioremap(unsigned long
4066 if (BETWEEN(p, OMAP1_IO_PHYS, OMAP1_IO_SIZE))
4067 return XLATE(p, OMAP1_IO_PHYS, OMAP1_IO_VIRT);
4069 - if (cpu_is_omap730()) {
4070 - if (BETWEEN(p, OMAP730_DSP_BASE, OMAP730_DSP_SIZE))
4071 - return XLATE(p, OMAP730_DSP_BASE, OMAP730_DSP_START);
4073 - if (BETWEEN(p, OMAP730_DSPREG_BASE, OMAP730_DSPREG_SIZE))
4074 - return XLATE(p, OMAP730_DSPREG_BASE,
4075 - OMAP730_DSPREG_START);
4076 + if (cpu_is_omap7xx()) {
4077 + if (BETWEEN(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_SIZE))
4078 + return XLATE(p, OMAP7XX_DSP_BASE, OMAP7XX_DSP_START);
4080 + if (BETWEEN(p, OMAP7XX_DSPREG_BASE, OMAP7XX_DSPREG_SIZE))
4081 + return XLATE(p, OMAP7XX_DSPREG_BASE,
4082 + OMAP7XX_DSPREG_START);
4084 if (cpu_is_omap15xx()) {
4085 if (BETWEEN(p, OMAP1510_DSP_BASE, OMAP1510_DSP_SIZE))
4086 @@ -114,6 +114,14 @@ void __iomem *omap_ioremap(unsigned long
4087 return XLATE(p, L4_WK_44XX_PHYS, L4_WK_44XX_VIRT);
4088 if (BETWEEN(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_SIZE))
4089 return XLATE(p, OMAP44XX_GPMC_PHYS, OMAP44XX_GPMC_VIRT);
4090 + if (BETWEEN(p, OMAP44XX_EMIF1_PHYS, OMAP44XX_EMIF1_SIZE))
4091 + return XLATE(p, OMAP44XX_EMIF1_PHYS, \
4092 + OMAP44XX_EMIF1_VIRT);
4093 + if (BETWEEN(p, OMAP44XX_EMIF2_PHYS, OMAP44XX_EMIF2_SIZE))
4094 + return XLATE(p, OMAP44XX_EMIF2_PHYS, \
4095 + OMAP44XX_EMIF2_VIRT);
4096 + if (BETWEEN(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_SIZE))
4097 + return XLATE(p, OMAP44XX_DMM_PHYS, OMAP44XX_DMM_VIRT);
4098 if (BETWEEN(p, L4_PER_44XX_PHYS, L4_PER_44XX_SIZE))
4099 return XLATE(p, L4_PER_44XX_PHYS, L4_PER_44XX_VIRT);
4100 if (BETWEEN(p, L4_EMU_44XX_PHYS, L4_EMU_44XX_SIZE))
4101 @@ -142,7 +150,7 @@ u8 omap_readb(u32 pa)
4102 if (cpu_class_is_omap1())
4103 return __raw_readb(OMAP1_IO_ADDRESS(pa));
4105 - return __raw_readb(OMAP2_IO_ADDRESS(pa));
4106 + return __raw_readb(OMAP2_L4_IO_ADDRESS(pa));
4108 EXPORT_SYMBOL(omap_readb);
4110 @@ -151,7 +159,7 @@ u16 omap_readw(u32 pa)
4111 if (cpu_class_is_omap1())
4112 return __raw_readw(OMAP1_IO_ADDRESS(pa));
4114 - return __raw_readw(OMAP2_IO_ADDRESS(pa));
4115 + return __raw_readw(OMAP2_L4_IO_ADDRESS(pa));
4117 EXPORT_SYMBOL(omap_readw);
4119 @@ -160,7 +168,7 @@ u32 omap_readl(u32 pa)
4120 if (cpu_class_is_omap1())
4121 return __raw_readl(OMAP1_IO_ADDRESS(pa));
4123 - return __raw_readl(OMAP2_IO_ADDRESS(pa));
4124 + return __raw_readl(OMAP2_L4_IO_ADDRESS(pa));
4126 EXPORT_SYMBOL(omap_readl);
4128 @@ -169,7 +177,7 @@ void omap_writeb(u8 v, u32 pa)
4129 if (cpu_class_is_omap1())
4130 __raw_writeb(v, OMAP1_IO_ADDRESS(pa));
4132 - __raw_writeb(v, OMAP2_IO_ADDRESS(pa));
4133 + __raw_writeb(v, OMAP2_L4_IO_ADDRESS(pa));
4135 EXPORT_SYMBOL(omap_writeb);
4137 @@ -178,7 +186,7 @@ void omap_writew(u16 v, u32 pa)
4138 if (cpu_class_is_omap1())
4139 __raw_writew(v, OMAP1_IO_ADDRESS(pa));
4141 - __raw_writew(v, OMAP2_IO_ADDRESS(pa));
4142 + __raw_writew(v, OMAP2_L4_IO_ADDRESS(pa));
4144 EXPORT_SYMBOL(omap_writew);
4146 @@ -187,6 +195,6 @@ void omap_writel(u32 v, u32 pa)
4147 if (cpu_class_is_omap1())
4148 __raw_writel(v, OMAP1_IO_ADDRESS(pa));
4150 - __raw_writel(v, OMAP2_IO_ADDRESS(pa));
4151 + __raw_writel(v, OMAP2_L4_IO_ADDRESS(pa));
4153 EXPORT_SYMBOL(omap_writel);
4154 --- a/arch/arm/plat-omap/omap_device.c
4155 +++ b/arch/arm/plat-omap/omap_device.c
4156 @@ -103,21 +103,6 @@
4157 /* Private functions */
4160 - * _read_32ksynct - read the OMAP 32K sync timer
4162 - * Returns the current value of the 32KiHz synchronization counter.
4163 - * XXX this should be generalized to simply read the system clocksource.
4164 - * XXX this should be moved to a separate synctimer32k.c file
4166 -static u32 _read_32ksynct(void)
4168 - if (!cpu_class_is_omap2())
4171 - return __raw_readl(OMAP2_IO_ADDRESS(OMAP_32KSYNCT_BASE + 0x010));
4175 * _omap_device_activate - increase device readiness
4176 * @od: struct omap_device *
4177 * @ignore_lat: increase to latency target (0) or full readiness (1)?
4178 @@ -133,13 +118,13 @@ static u32 _read_32ksynct(void)
4180 static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
4183 + struct timespec a, b, c;
4185 pr_debug("omap_device: %s: activating\n", od->pdev.name);
4187 while (od->pm_lat_level > 0) {
4188 struct omap_device_pm_latency *odpl;
4190 + unsigned long long act_lat = 0;
4194 @@ -149,20 +134,22 @@ static int _omap_device_activate(struct
4195 (od->dev_wakeup_lat <= od->_dev_wakeup_lat_limit))
4198 - a = _read_32ksynct();
4199 + getnstimeofday(&a);
4201 /* XXX check return code */
4202 odpl->activate_func(od);
4204 - b = _read_32ksynct();
4205 + getnstimeofday(&b);
4207 - act_lat = (b - a) >> 15; /* 32KiHz cycles to microseconds */
4208 + c = timespec_sub(b, a);
4209 + act_lat = timespec_to_ns(&c) * NSEC_PER_USEC;
4211 pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time "
4212 - "%d usec\n", od->pdev.name, od->pm_lat_level, act_lat);
4213 + "%llu usec\n", od->pdev.name, od->pm_lat_level,
4216 WARN(act_lat > odpl->activate_lat, "omap_device: %s.%d: "
4217 - "activate step %d took longer than expected (%d > %d)\n",
4218 + "activate step %d took longer than expected (%llu > %d)\n",
4219 od->pdev.name, od->pdev.id, od->pm_lat_level,
4220 act_lat, odpl->activate_lat);
4222 @@ -188,13 +175,13 @@ static int _omap_device_activate(struct
4224 static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
4227 + struct timespec a, b, c;
4229 pr_debug("omap_device: %s: deactivating\n", od->pdev.name);
4231 while (od->pm_lat_level < od->pm_lats_cnt) {
4232 struct omap_device_pm_latency *odpl;
4233 - int deact_lat = 0;
4234 + unsigned long long deact_lat = 0;
4236 odpl = od->pm_lats + od->pm_lat_level;
4238 @@ -203,23 +190,24 @@ static int _omap_device_deactivate(struc
4239 od->_dev_wakeup_lat_limit))
4242 - a = _read_32ksynct();
4243 + getnstimeofday(&a);
4245 /* XXX check return code */
4246 odpl->deactivate_func(od);
4248 - b = _read_32ksynct();
4249 + getnstimeofday(&b);
4251 - deact_lat = (b - a) >> 15; /* 32KiHz cycles to microseconds */
4252 + c = timespec_sub(b, a);
4253 + deact_lat = timespec_to_ns(&c) * NSEC_PER_USEC;
4255 pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time "
4256 - "%d usec\n", od->pdev.name, od->pm_lat_level,
4257 + "%llu usec\n", od->pdev.name, od->pm_lat_level,
4260 WARN(deact_lat > odpl->deactivate_lat, "omap_device: %s.%d: "
4261 - "deactivate step %d took longer than expected (%d > %d)\n",
4262 - od->pdev.name, od->pdev.id, od->pm_lat_level,
4263 - deact_lat, odpl->deactivate_lat);
4264 + "deactivate step %d took longer than expected "
4265 + "(%llu > %d)\n", od->pdev.name, od->pdev.id,
4266 + od->pm_lat_level, deact_lat, odpl->deactivate_lat);
4268 od->dev_wakeup_lat += odpl->activate_lat;
4270 --- a/arch/arm/plat-omap/sram.c
4271 +++ b/arch/arm/plat-omap/sram.c
4273 #define OMAP1_SRAM_VA VMALLOC_END
4274 #define OMAP2_SRAM_PA 0x40200000
4275 #define OMAP2_SRAM_PUB_PA 0x4020f800
4276 -#define OMAP2_SRAM_VA 0xe3000000
4277 +#define OMAP2_SRAM_VA 0xfe400000
4278 #define OMAP2_SRAM_PUB_VA (OMAP2_SRAM_VA + 0x800)
4279 #define OMAP3_SRAM_PA 0x40200000
4280 -#define OMAP3_SRAM_VA 0xe3000000
4281 +#define OMAP3_SRAM_VA 0xfe400000
4282 #define OMAP3_SRAM_PUB_PA 0x40208000
4283 #define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000)
4284 #define OMAP4_SRAM_PA 0x40200000 /*0x402f0000*/
4285 -#define OMAP4_SRAM_VA 0xd7000000 /*0xd70f0000*/
4286 +#define OMAP4_SRAM_VA 0xfe400000 /*0xfe4f0000*/
4288 #if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
4289 #define SRAM_BOOTLOADER_SZ 0x00
4291 #define SRAM_BOOTLOADER_SZ 0x80
4294 -#define OMAP24XX_VA_REQINFOPERM0 OMAP2_IO_ADDRESS(0x68005048)
4295 -#define OMAP24XX_VA_READPERM0 OMAP2_IO_ADDRESS(0x68005050)
4296 -#define OMAP24XX_VA_WRITEPERM0 OMAP2_IO_ADDRESS(0x68005058)
4298 -#define OMAP34XX_VA_REQINFOPERM0 OMAP2_IO_ADDRESS(0x68012848)
4299 -#define OMAP34XX_VA_READPERM0 OMAP2_IO_ADDRESS(0x68012850)
4300 -#define OMAP34XX_VA_WRITEPERM0 OMAP2_IO_ADDRESS(0x68012858)
4301 -#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_IO_ADDRESS(0x68012880)
4302 -#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_IO_ADDRESS(0x6C000048)
4303 -#define OMAP34XX_VA_CONTROL_STAT OMAP2_IO_ADDRESS(0x480022F0)
4304 +#define OMAP24XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68005048)
4305 +#define OMAP24XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68005050)
4306 +#define OMAP24XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68005058)
4308 +#define OMAP34XX_VA_REQINFOPERM0 OMAP2_L3_IO_ADDRESS(0x68012848)
4309 +#define OMAP34XX_VA_READPERM0 OMAP2_L3_IO_ADDRESS(0x68012850)
4310 +#define OMAP34XX_VA_WRITEPERM0 OMAP2_L3_IO_ADDRESS(0x68012858)
4311 +#define OMAP34XX_VA_ADDR_MATCH2 OMAP2_L3_IO_ADDRESS(0x68012880)
4312 +#define OMAP34XX_VA_SMS_RG_ATT0 OMAP2_L3_IO_ADDRESS(0x6C000048)
4313 +#define OMAP34XX_VA_CONTROL_STAT OMAP2_L4_IO_ADDRESS(0x480022F0)
4315 #define GP_DEVICE 0x300
4317 --- a/arch/arm/plat-omap/usb.c
4318 +++ b/arch/arm/plat-omap/usb.c
4319 @@ -614,8 +614,8 @@ omap_otg_init(struct omap_usb_config *co
4320 if (config->otg || config->register_host) {
4321 syscon &= ~HST_IDLE_EN;
4322 ohci_device.dev.platform_data = config;
4323 - if (cpu_is_omap730())
4324 - ohci_resources[1].start = INT_730_USB_HHC_1;
4325 + if (cpu_is_omap7xx())
4326 + ohci_resources[1].start = INT_7XX_USB_HHC_1;
4327 status = platform_device_register(&ohci_device);
4329 pr_debug("can't register OHCI device, %d\n", status);
4330 @@ -626,8 +626,8 @@ omap_otg_init(struct omap_usb_config *co
4332 syscon &= ~OTG_IDLE_EN;
4333 otg_device.dev.platform_data = config;
4334 - if (cpu_is_omap730())
4335 - otg_resources[1].start = INT_730_USB_OTG;
4336 + if (cpu_is_omap7xx())
4337 + otg_resources[1].start = INT_7XX_USB_OTG;
4338 status = platform_device_register(&otg_device);
4340 pr_debug("can't register OTG device, %d\n", status);
4341 @@ -731,7 +731,7 @@ static inline void omap_1510_usb_init(st
4343 void __init omap_usb_init(struct omap_usb_config *pdata)
4345 - if (cpu_is_omap730() || cpu_is_omap16xx() || cpu_is_omap24xx())
4346 + if (cpu_is_omap7xx() || cpu_is_omap16xx() || cpu_is_omap24xx())
4347 omap_otg_init(pdata);
4348 else if (cpu_is_omap15xx())
4349 omap_1510_usb_init(pdata);
4350 --- a/drivers/Makefile
4351 +++ b/drivers/Makefile
4352 @@ -72,7 +72,7 @@ obj-$(CONFIG_GAMEPORT) += input/gamepor
4353 obj-$(CONFIG_INPUT) += input/
4354 obj-$(CONFIG_I2O) += message/
4355 obj-$(CONFIG_RTC_LIB) += rtc/
4356 -obj-y += i2c/ media/
4357 +obj-y += i2c/ media/ cbus/
4358 obj-$(CONFIG_PPS) += pps/
4359 obj-$(CONFIG_W1) += w1/
4360 obj-$(CONFIG_POWER_SUPPLY) += power/
4362 +++ b/drivers/cbus/Kconfig
4365 +# CBUS device configuration
4368 +menu "CBUS support"
4371 + depends on ARCH_OMAP
4372 + bool "CBUS support on OMAP"
4374 + CBUS is a proprietary serial protocol by Nokia. It is mainly
4375 + used for accessing Energy Management auxiliary chips.
4377 + If you want CBUS support, you should say Y here.
4381 + bool "Support for Tahvo"
4383 + Tahvo is a mixed signal ASIC with some system features
4385 + If you want Tahvo support, you should say Y here.
4387 +config CBUS_TAHVO_USER
4388 + depends on CBUS_TAHVO
4389 + bool "Support for Tahvo user space functions"
4391 + If you want support for Tahvo's user space read/write etc. functions,
4392 + you should say Y here.
4394 +config CBUS_TAHVO_USB
4395 + depends on CBUS_TAHVO && USB
4396 + tristate "Support for Tahvo USB transceiver"
4398 + If you want Tahvo support for USB transceiver, say Y or M here.
4400 +config CBUS_TAHVO_USB_HOST_BY_DEFAULT
4401 + depends on CBUS_TAHVO_USB && USB_OTG
4402 + boolean "Device in USB host mode by default"
4404 + Say Y here, if you want the device to enter USB host mode
4405 + by default on bootup.
4409 + bool "Support for Retu"
4411 + Retu is a mixed signal ASIC with some system features
4413 + If you want Retu support, you should say Y here.
4415 +config CBUS_RETU_USER
4416 + depends on CBUS_RETU
4417 + bool "Support for Retu user space functions"
4419 + If you want support for Retu's user space read/write etc. functions,
4420 + you should say Y here.
4422 +config CBUS_RETU_POWERBUTTON
4423 + depends on CBUS_RETU
4424 + bool "Support for Retu power button"
4426 + The power button on Nokia 770 is connected to the Retu ASIC.
4428 + If you want support for the Retu power button, you should say Y here.
4430 +config CBUS_RETU_RTC
4431 + depends on CBUS_RETU && SYSFS
4432 + tristate "Support for Retu pseudo-RTC"
4434 + Say Y here if you want support for the device that alleges to be an
4435 + RTC in Retu. This will expose a sysfs interface for it.
4437 +config CBUS_RETU_WDT
4438 + depends on CBUS_RETU && SYSFS
4439 + tristate "Support for Retu watchdog timer"
4441 + Say Y here if you want support for the watchdog in Retu. This will
4442 + expose a sysfs interface to grok it.
4444 +config CBUS_RETU_HEADSET
4445 + depends on CBUS_RETU && SYSFS
4446 + tristate "Support for headset detection with Retu/Vilma"
4448 + Say Y here if you want support detecting a headset that's connected
4449 + to Retu/Vilma. Detection state and events are exposed through
4454 +++ b/drivers/cbus/Makefile
4457 +# Makefile for CBUS.
4460 +obj-$(CONFIG_CBUS) += cbus.o
4461 +obj-$(CONFIG_CBUS_TAHVO) += tahvo.o
4462 +obj-$(CONFIG_CBUS_RETU) += retu.o
4463 +obj-$(CONFIG_CBUS_TAHVO_USB) += tahvo-usb.o
4464 +obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += retu-pwrbutton.o
4465 +obj-$(CONFIG_CBUS_RETU_RTC) += retu-rtc.o
4466 +obj-$(CONFIG_CBUS_RETU_WDT) += retu-wdt.o
4467 +obj-$(CONFIG_CBUS_TAHVO_USER) += tahvo-user.o
4468 +obj-$(CONFIG_CBUS_RETU_USER) += retu-user.o
4469 +obj-$(CONFIG_CBUS_RETU_HEADSET) += retu-headset.o
4471 +++ b/drivers/cbus/cbus.c
4474 + * drivers/cbus/cbus.c
4476 + * Support functions for CBUS serial protocol
4478 + * Copyright (C) 2004, 2005 Nokia Corporation
4480 + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
4481 + * David Weinehall <david.weinehall@nokia.com>, and
4482 + * Mikko Ylinen <mikko.k.ylinen@nokia.com>
4484 + * This file is subject to the terms and conditions of the GNU General
4485 + * Public License. See the file "COPYING" in the main directory of this
4486 + * archive for more details.
4488 + * This program is distributed in the hope that it will be useful,
4489 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4490 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4491 + * GNU General Public License for more details.
4493 + * You should have received a copy of the GNU General Public License
4494 + * along with this program; if not, write to the Free Software
4495 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4498 +#include <linux/device.h>
4499 +#include <linux/init.h>
4500 +#include <linux/kernel.h>
4501 +#include <linux/delay.h>
4502 +#include <linux/spinlock.h>
4503 +#include <linux/gpio.h>
4505 +#include <mach/board.h>
4506 +#include <mach/board-nokia.h>
4508 +#include <asm/io.h>
4512 +struct cbus_host *cbus_host = NULL;
4514 +#ifdef CONFIG_ARCH_OMAP1
4515 +/* We use our own MPUIO functions to get closer to 1MHz bus speed */
4517 +static inline void cbus_set_gpio_direction(u32 base, int mpuio, int is_input)
4522 + w = __raw_readw(base + OMAP_MPUIO_IO_CNTL);
4526 + w &= ~(1 << mpuio);
4527 + __raw_writew(w, base + OMAP_MPUIO_IO_CNTL);
4531 +static inline void cbus_set_gpio_dataout(u32 base, int mpuio, int enable)
4536 + w = __raw_readw(base + OMAP_MPUIO_OUTPUT);
4540 + w &= ~(1 << mpuio);
4541 + __raw_writew(w, base + OMAP_MPUIO_OUTPUT);
4544 +static inline int cbus_get_gpio_datain(u32 base, int mpuio)
4548 + return (__raw_readw(base + OMAP_MPUIO_INPUT_LATCH) & (1 << mpuio)) != 0;
4551 +static void cbus_send_bit(struct cbus_host *host, u32 base, int bit,
4554 + cbus_set_gpio_dataout(base, host->dat_gpio, bit ? 1 : 0);
4555 + cbus_set_gpio_dataout(base, host->clk_gpio, 1);
4557 + /* The data bit is read on the rising edge of CLK */
4559 + cbus_set_gpio_direction(base, host->dat_gpio, 1);
4561 + cbus_set_gpio_dataout(base, host->clk_gpio, 0);
4564 +static u8 cbus_receive_bit(struct cbus_host *host, u32 base)
4568 + cbus_set_gpio_dataout(base, host->clk_gpio, 1);
4569 + ret = cbus_get_gpio_datain(base, host->dat_gpio);
4570 + cbus_set_gpio_dataout(base, host->clk_gpio, 0);
4575 +#define cbus_output(base, gpio, val) cbus_set_gpio_direction(base, gpio, 0)
4579 +#define cbus_output(base, gpio, val) gpio_direction_output(gpio, val)
4580 +#define cbus_set_gpio_dataout(base, gpio, enable) gpio_set_value(gpio, enable)
4581 +#define cbus_get_gpio_datain(base, int, gpio) gpio_get_value(gpio)
4583 +static void _cbus_send_bit(struct cbus_host *host, int bit, int set_to_input)
4585 + gpio_set_value(host->dat_gpio, bit ? 1 : 0);
4586 + gpio_set_value(host->clk_gpio, 1);
4588 + /* The data bit is read on the rising edge of CLK */
4590 + gpio_direction_input(host->dat_gpio);
4592 + gpio_set_value(host->clk_gpio, 0);
4595 +static u8 _cbus_receive_bit(struct cbus_host *host)
4599 + gpio_set_value(host->clk_gpio, 1);
4600 + ret = gpio_get_value(host->dat_gpio);
4601 + gpio_set_value(host->clk_gpio, 0);
4606 +#define cbus_send_bit(host, base, bit, set_to_input) _cbus_send_bit(host, bit, set_to_input)
4607 +#define cbus_receive_bit(host, base) _cbus_receive_bit(host)
4611 +static int cbus_transfer(struct cbus_host *host, int dev, int reg, int data)
4615 + unsigned long flags;
4618 +#ifdef CONFIG_ARCH_OMAP1
4619 + base = OMAP1_IO_ADDRESS(OMAP_MPUIO_BASE);
4627 + /* We don't want interrupts disturbing our transfer */
4628 + spin_lock_irqsave(&host->lock, flags);
4630 + /* Reset state and start of transfer, SEL stays down during transfer */
4631 + cbus_set_gpio_dataout(base, host->sel_gpio, 0);
4633 + /* Set the DAT pin to output */
4634 + cbus_output(base, host->dat_gpio, 1);
4636 + /* Send the device address */
4637 + for (i = 3; i > 0; i--)
4638 + cbus_send_bit(host, base, dev & (1 << (i - 1)), 0);
4640 + /* Send the rw flag */
4641 + cbus_send_bit(host, base, is_read, 0);
4643 + /* Send the register address */
4644 + for (i = 5; i > 0; i--) {
4645 + int set_to_input = 0;
4647 + if (is_read && i == 1)
4650 + cbus_send_bit(host, base, reg & (1 << (i - 1)), set_to_input);
4654 + for (i = 16; i > 0; i--)
4655 + cbus_send_bit(host, base, data & (1 << (i - 1)), 0);
4657 + cbus_set_gpio_dataout(base, host->clk_gpio, 1);
4660 + for (i = 16; i > 0; i--) {
4661 + u8 bit = cbus_receive_bit(host, base);
4664 + data |= 1 << (i - 1);
4668 + /* Indicate end of transfer, SEL goes up until next transfer */
4669 + cbus_set_gpio_dataout(base, host->sel_gpio, 1);
4670 + cbus_set_gpio_dataout(base, host->clk_gpio, 1);
4671 + cbus_set_gpio_dataout(base, host->clk_gpio, 0);
4673 + spin_unlock_irqrestore(&host->lock, flags);
4675 + return is_read ? data : 0;
4679 + * Read a given register from the device
4681 +int cbus_read_reg(struct cbus_host *host, int dev, int reg)
4683 + return cbus_host ? cbus_transfer(host, dev, reg, -1) : -ENODEV;
4687 + * Write to a given register of the device
4689 +int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val)
4691 + return cbus_host ? cbus_transfer(host, dev, reg, (int)val) : -ENODEV;
4694 +int __init cbus_bus_init(void)
4696 + const struct omap_cbus_config * cbus_config;
4697 + struct cbus_host *chost;
4700 + chost = kmalloc(sizeof (*chost), GFP_KERNEL);
4701 + if (chost == NULL)
4704 + memset(chost, 0, sizeof (*chost));
4706 + spin_lock_init(&chost->lock);
4708 + cbus_config = omap_get_config(OMAP_TAG_CBUS, struct omap_cbus_config);
4710 + if (cbus_config == NULL) {
4711 + printk(KERN_ERR "cbus: Unable to retrieve config data\n");
4715 + chost->clk_gpio = cbus_config->clk_gpio;
4716 + chost->dat_gpio = cbus_config->dat_gpio;
4717 + chost->sel_gpio = cbus_config->sel_gpio;
4719 +#ifdef CONFIG_ARCH_OMAP1
4720 + if (!OMAP_GPIO_IS_MPUIO(chost->clk_gpio) ||
4721 + !OMAP_GPIO_IS_MPUIO(chost->dat_gpio) ||
4722 + !OMAP_GPIO_IS_MPUIO(chost->sel_gpio)) {
4723 + printk(KERN_ERR "cbus: Only MPUIO pins supported\n");
4729 + if ((ret = gpio_request(chost->clk_gpio, "CBUS clk")) < 0)
4732 + if ((ret = gpio_request(chost->dat_gpio, "CBUS data")) < 0)
4735 + if ((ret = gpio_request(chost->sel_gpio, "CBUS sel")) < 0)
4738 + gpio_direction_output(chost->clk_gpio, 0);
4739 + gpio_direction_input(chost->dat_gpio);
4740 + gpio_direction_output(chost->sel_gpio, 1);
4742 + gpio_set_value(chost->clk_gpio, 1);
4743 + gpio_set_value(chost->clk_gpio, 0);
4745 + cbus_host = chost;
4749 + gpio_free(chost->dat_gpio);
4751 + gpio_free(chost->clk_gpio);
4757 +subsys_initcall(cbus_bus_init);
4759 +EXPORT_SYMBOL(cbus_host);
4760 +EXPORT_SYMBOL(cbus_read_reg);
4761 +EXPORT_SYMBOL(cbus_write_reg);
4763 +MODULE_DESCRIPTION("CBUS serial protocol");
4764 +MODULE_LICENSE("GPL");
4765 +MODULE_AUTHOR("Juha Yrjölä, David Weinehall, and Mikko Ylinen");
4767 +++ b/drivers/cbus/cbus.h
4770 + * drivers/cbus/cbus.h
4772 + * Copyright (C) 2004, 2005 Nokia Corporation
4774 + * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
4775 + * David Weinehall <david.weinehall@nokia.com>
4777 + * This file is subject to the terms and conditions of the GNU General
4778 + * Public License. See the file "COPYING" in the main directory of this
4779 + * archive for more details.
4781 + * This program is distributed in the hope that it will be useful,
4782 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4783 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4784 + * GNU General Public License for more details.
4786 + * You should have received a copy of the GNU General Public License
4787 + * along with this program; if not, write to the Free Software
4788 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4791 +#ifndef __DRIVERS_CBUS_CBUS_H
4792 +#define __DRIVERS_CBUS_CBUS_H
4795 + int clk_gpio, dat_gpio, sel_gpio;
4799 +extern struct cbus_host *cbus_host;
4801 +extern int cbus_read_reg(struct cbus_host *host, int dev, int reg);
4802 +extern int cbus_write_reg(struct cbus_host *host, int dev, int reg, u16 val);
4804 +#endif /* __DRIVERS_CBUS_CBUS_H */
4806 +++ b/drivers/cbus/retu-headset.c
4809 + * Retu/Vilma headset detection
4811 + * Copyright (C) 2006 Nokia Corporation
4813 + * Written by Juha Yrjölä
4815 + * This file is subject to the terms and conditions of the GNU General
4816 + * Public License. See the file "COPYING" in the main directory of this
4817 + * archive for more details.
4819 + * This program is distributed in the hope that it will be useful,
4820 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4821 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4822 + * GNU General Public License for more details.
4824 + * You should have received a copy of the GNU General Public License
4825 + * along with this program; if not, write to the Free Software
4826 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
4829 +#include <linux/module.h>
4830 +#include <linux/init.h>
4831 +#include <linux/kernel.h>
4832 +#include <linux/delay.h>
4833 +#include <linux/input.h>
4834 +#include <linux/platform_device.h>
4838 +#define RETU_ADC_CHANNEL_HOOKDET 0x05
4840 +#define RETU_HEADSET_KEY KEY_PHONE
4842 +struct retu_headset {
4844 + struct mutex mutex;
4845 + struct platform_device *pdev;
4846 + struct input_dev *idev;
4847 + unsigned bias_enabled;
4848 + unsigned detection_enabled;
4850 + struct timer_list enable_timer;
4851 + struct timer_list detect_timer;
4854 +static void retu_headset_set_bias(int enable)
4857 + retu_set_clear_reg_bits(RETU_REG_AUDTXR,
4858 + (1 << 0) | (1 << 1), 0);
4860 + retu_set_clear_reg_bits(RETU_REG_AUDTXR, 1 << 3, 0);
4862 + retu_set_clear_reg_bits(RETU_REG_AUDTXR, 0,
4863 + (1 << 0) | (1 << 1) | (1 << 3));
4867 +static void retu_headset_enable(struct retu_headset *hs)
4869 + mutex_lock(&hs->mutex);
4870 + if (!hs->bias_enabled) {
4871 + hs->bias_enabled = 1;
4872 + retu_headset_set_bias(1);
4874 + mutex_unlock(&hs->mutex);
4877 +static void retu_headset_disable(struct retu_headset *hs)
4879 + mutex_lock(&hs->mutex);
4880 + if (hs->bias_enabled) {
4881 + hs->bias_enabled = 0;
4882 + retu_headset_set_bias(0);
4884 + mutex_unlock(&hs->mutex);
4887 +static void retu_headset_det_enable(struct retu_headset *hs)
4889 + mutex_lock(&hs->mutex);
4890 + if (!hs->detection_enabled) {
4891 + hs->detection_enabled = 1;
4892 + retu_set_clear_reg_bits(RETU_REG_CC1, (1 << 10) | (1 << 8), 0);
4893 + retu_enable_irq(RETU_INT_HOOK);
4895 + mutex_unlock(&hs->mutex);
4898 +static void retu_headset_det_disable(struct retu_headset *hs)
4900 + unsigned long flags;
4902 + mutex_lock(&hs->mutex);
4903 + if (hs->detection_enabled) {
4904 + hs->detection_enabled = 0;
4905 + retu_disable_irq(RETU_INT_HOOK);
4906 + del_timer_sync(&hs->enable_timer);
4907 + del_timer_sync(&hs->detect_timer);
4908 + spin_lock_irqsave(&hs->lock, flags);
4910 + input_report_key(hs->idev, RETU_HEADSET_KEY, 0);
4911 + spin_unlock_irqrestore(&hs->lock, flags);
4912 + retu_set_clear_reg_bits(RETU_REG_CC1, 0, (1 << 10) | (1 << 8));
4914 + mutex_unlock(&hs->mutex);
4917 +static ssize_t retu_headset_hookdet_show(struct device *dev,
4918 + struct device_attribute *attr,
4923 + val = retu_read_adc(RETU_ADC_CHANNEL_HOOKDET);
4924 + return sprintf(buf, "%d\n", val);
4927 +static DEVICE_ATTR(hookdet, S_IRUGO, retu_headset_hookdet_show, NULL);
4929 +static ssize_t retu_headset_enable_show(struct device *dev,
4930 + struct device_attribute *attr,
4933 + struct retu_headset *hs = dev_get_drvdata(dev);
4935 + return sprintf(buf, "%u\n", hs->bias_enabled);
4938 +static ssize_t retu_headset_enable_store(struct device *dev,
4939 + struct device_attribute *attr,
4940 + const char *buf, size_t count)
4942 + struct retu_headset *hs = dev_get_drvdata(dev);
4945 + if (sscanf(buf, "%u", &enable) != 1)
4948 + retu_headset_enable(hs);
4950 + retu_headset_disable(hs);
4954 +static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR | S_IWGRP,
4955 + retu_headset_enable_show, retu_headset_enable_store);
4957 +static ssize_t retu_headset_enable_det_show(struct device *dev,
4958 + struct device_attribute *attr,
4961 + struct retu_headset *hs = dev_get_drvdata(dev);
4963 + return sprintf(buf, "%u\n", hs->detection_enabled);
4966 +static ssize_t retu_headset_enable_det_store(struct device *dev,
4967 + struct device_attribute *attr,
4968 + const char *buf, size_t count)
4970 + struct retu_headset *hs = dev_get_drvdata(dev);
4973 + if (sscanf(buf, "%u", &enable) != 1)
4976 + retu_headset_det_enable(hs);
4978 + retu_headset_det_disable(hs);
4982 +static DEVICE_ATTR(enable_det, S_IRUGO | S_IWUSR | S_IWGRP,
4983 + retu_headset_enable_det_show,
4984 + retu_headset_enable_det_store);
4986 +static void retu_headset_hook_interrupt(unsigned long arg)
4988 + struct retu_headset *hs = (struct retu_headset *) arg;
4989 + unsigned long flags;
4991 + retu_ack_irq(RETU_INT_HOOK);
4992 + spin_lock_irqsave(&hs->lock, flags);
4993 + if (!hs->pressed) {
4994 + /* Headset button was just pressed down. */
4996 + input_report_key(hs->idev, RETU_HEADSET_KEY, 1);
4998 + spin_unlock_irqrestore(&hs->lock, flags);
4999 + retu_set_clear_reg_bits(RETU_REG_CC1, 0, (1 << 10) | (1 << 8));
5000 + mod_timer(&hs->enable_timer, jiffies + msecs_to_jiffies(50));
5003 +static void retu_headset_enable_timer(unsigned long arg)
5005 + struct retu_headset *hs = (struct retu_headset *) arg;
5007 + retu_set_clear_reg_bits(RETU_REG_CC1, (1 << 10) | (1 << 8), 0);
5008 + mod_timer(&hs->detect_timer, jiffies + msecs_to_jiffies(350));
5011 +static void retu_headset_detect_timer(unsigned long arg)
5013 + struct retu_headset *hs = (struct retu_headset *) arg;
5014 + unsigned long flags;
5016 + spin_lock_irqsave(&hs->lock, flags);
5017 + if (hs->pressed) {
5019 + input_report_key(hs->idev, RETU_HEADSET_KEY, 0);
5021 + spin_unlock_irqrestore(&hs->lock, flags);
5024 +static int __init retu_headset_probe(struct platform_device *pdev)
5026 + struct retu_headset *hs;
5029 + hs = kzalloc(sizeof(*hs), GFP_KERNEL);
5035 + hs->idev = input_allocate_device();
5036 + if (hs->idev == NULL) {
5040 + hs->idev->name = "retu-headset";
5041 + hs->idev->dev.parent = &pdev->dev;
5042 + set_bit(EV_KEY, hs->idev->evbit);
5043 + set_bit(RETU_HEADSET_KEY, hs->idev->keybit);
5044 + r = input_register_device(hs->idev);
5048 + r = device_create_file(&pdev->dev, &dev_attr_hookdet);
5051 + r = device_create_file(&pdev->dev, &dev_attr_enable);
5054 + r = device_create_file(&pdev->dev, &dev_attr_enable_det);
5057 + platform_set_drvdata(pdev, hs);
5059 + spin_lock_init(&hs->lock);
5060 + mutex_init(&hs->mutex);
5061 + setup_timer(&hs->enable_timer, retu_headset_enable_timer,
5062 + (unsigned long) hs);
5063 + setup_timer(&hs->detect_timer, retu_headset_detect_timer,
5064 + (unsigned long) hs);
5066 + r = retu_request_irq(RETU_INT_HOOK, retu_headset_hook_interrupt,
5067 + (unsigned long) hs, "hookdet");
5069 + dev_err(&pdev->dev, "hookdet IRQ not available\n");
5072 + retu_disable_irq(RETU_INT_HOOK);
5075 + device_remove_file(&pdev->dev, &dev_attr_enable_det);
5077 + device_remove_file(&pdev->dev, &dev_attr_enable);
5079 + device_remove_file(&pdev->dev, &dev_attr_hookdet);
5081 + input_unregister_device(hs->idev);
5083 + input_free_device(hs->idev);
5089 +static int retu_headset_remove(struct platform_device *pdev)
5091 + struct retu_headset *hs = platform_get_drvdata(pdev);
5093 + device_remove_file(&pdev->dev, &dev_attr_hookdet);
5094 + device_remove_file(&pdev->dev, &dev_attr_enable);
5095 + device_remove_file(&pdev->dev, &dev_attr_enable_det);
5096 + retu_headset_disable(hs);
5097 + retu_headset_det_disable(hs);
5098 + retu_free_irq(RETU_INT_HOOK);
5099 + input_unregister_device(hs->idev);
5100 + input_free_device(hs->idev);
5104 +static int retu_headset_suspend(struct platform_device *pdev,
5105 + pm_message_t mesg)
5107 + struct retu_headset *hs = platform_get_drvdata(pdev);
5109 + mutex_lock(&hs->mutex);
5110 + if (hs->bias_enabled)
5111 + retu_headset_set_bias(0);
5112 + mutex_unlock(&hs->mutex);
5117 +static int retu_headset_resume(struct platform_device *pdev)
5119 + struct retu_headset *hs = platform_get_drvdata(pdev);
5121 + mutex_lock(&hs->mutex);
5122 + if (hs->bias_enabled)
5123 + retu_headset_set_bias(1);
5124 + mutex_unlock(&hs->mutex);
5129 +static struct platform_driver retu_headset_driver = {
5130 + .probe = retu_headset_probe,
5131 + .remove = retu_headset_remove,
5132 + .suspend = retu_headset_suspend,
5133 + .resume = retu_headset_resume,
5135 + .name = "retu-headset",
5139 +static int __init retu_headset_init(void)
5143 + printk(KERN_INFO "Retu/Vilma headset driver initializing\n");
5145 + r = platform_driver_register(&retu_headset_driver);
5152 +static void __exit retu_headset_exit(void)
5154 + platform_driver_unregister(&retu_headset_driver);
5157 +module_init(retu_headset_init);
5158 +module_exit(retu_headset_exit);
5160 +MODULE_DESCRIPTION("Retu/Vilma headset detection");
5161 +MODULE_LICENSE("GPL");
5162 +MODULE_AUTHOR("Juha Yrjölä");
5164 +++ b/drivers/cbus/retu-pwrbutton.c
5167 + * drivers/cbus/retu-pwrbutton.c
5169 + * Driver for sending retu power button event to input-layer
5171 + * Copyright (C) 2004 Nokia Corporation
5173 + * Written by Ari Saastamoinen <ari.saastamoinen@elektrobit.com>
5175 + * Contact Juha Yrjölä <juha.yrjola@nokia.com>
5177 + * This file is subject to the terms and conditions of the GNU General
5178 + * Public License. See the file "COPYING" in the main directory of this
5179 + * archive for more details.
5181 + * This program is distributed in the hope that it will be useful,
5182 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5183 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5184 + * GNU General Public License for more details.
5186 + * You should have received a copy of the GNU General Public License
5187 + * along with this program; if not, write to the Free Software
5188 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5191 +#include <linux/module.h>
5192 +#include <linux/init.h>
5193 +#include <linux/kernel.h>
5194 +#include <linux/errno.h>
5195 +#include <linux/input.h>
5196 +#include <linux/timer.h>
5197 +#include <linux/jiffies.h>
5198 +#include <linux/bitops.h>
5202 +#define RETU_STATUS_PWRONX (1 << 5)
5204 +#define PWRBTN_DELAY 20
5205 +#define PWRBTN_UP 0
5206 +#define PWRBTN_PRESSED 1
5208 +static int pwrbtn_state;
5209 +static struct input_dev *pwrbtn_dev;
5210 +static struct timer_list pwrbtn_timer;
5212 +static void retubutton_timer_func(unsigned long arg)
5216 + if (retu_read_reg(RETU_REG_STATUS) & RETU_STATUS_PWRONX)
5217 + state = PWRBTN_UP;
5219 + state = PWRBTN_PRESSED;
5221 + if (pwrbtn_state != state) {
5222 + input_report_key(pwrbtn_dev, KEY_POWER, state);
5223 + pwrbtn_state = state;
5228 + * Interrupt function is called whenever power button key is pressed
5231 +static void retubutton_irq(unsigned long arg)
5233 + retu_ack_irq(RETU_INT_PWR);
5234 + mod_timer(&pwrbtn_timer, jiffies + msecs_to_jiffies(PWRBTN_DELAY));
5239 + * Allocates interrupt for power button and registers itself to input layer.
5241 +static int __init retubutton_init(void)
5245 + printk(KERN_INFO "Retu power button driver initialized\n");
5246 + irq = RETU_INT_PWR;
5248 + init_timer(&pwrbtn_timer);
5249 + pwrbtn_timer.function = retubutton_timer_func;
5251 + if (retu_request_irq(irq, &retubutton_irq, 0, "PwrOnX") < 0) {
5252 + printk(KERN_ERR "%s@%s: Cannot allocate irq\n",
5253 + __FUNCTION__, __FILE__);
5257 + pwrbtn_dev = input_allocate_device();
5261 + pwrbtn_dev->evbit[0] = BIT_MASK(EV_KEY);
5262 + pwrbtn_dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
5263 + pwrbtn_dev->name = "retu-pwrbutton";
5265 + return input_register_device(pwrbtn_dev);
5269 + * Cleanup function which is called when driver is unloaded
5271 +static void __exit retubutton_exit(void)
5273 + retu_free_irq(RETU_INT_PWR);
5274 + del_timer_sync(&pwrbtn_timer);
5275 + input_unregister_device(pwrbtn_dev);
5278 +module_init(retubutton_init);
5279 +module_exit(retubutton_exit);
5281 +MODULE_DESCRIPTION("Retu Power Button");
5282 +MODULE_LICENSE("GPL");
5283 +MODULE_AUTHOR("Ari Saastamoinen");
5285 +++ b/drivers/cbus/retu-rtc.c
5288 + * drivers/cbus/retu-rtc.c
5290 + * Support for Retu RTC
5292 + * Copyright (C) 2004, 2005 Nokia Corporation
5294 + * Written by Paul Mundt <paul.mundt@nokia.com> and
5295 + * Igor Stoppa <igor.stoppa@nokia.com>
5297 + * The Retu RTC is essentially a partial read-only RTC that gives us Retu's
5298 + * idea of what time actually is. It's left as a userspace excercise to map
5299 + * this back to time in the real world and ensure that calibration settings
5300 + * are sane to compensate for any horrible drift (on account of not being able
5301 + * to set the clock to anything).
5303 + * Days are semi-writeable. Namely, Retu will only track 255 days for us
5304 + * consecutively, after which the counter is explicitly stuck at 255 until
5305 + * someone comes along and clears it with a write. In the event that no one
5306 + * comes along and clears it, we no longer have any idea what day it is.
5308 + * This file is subject to the terms and conditions of the GNU General
5309 + * Public License. See the file "COPYING" in the main directory of this
5310 + * archive for more details.
5312 + * This program is distributed in the hope that it will be useful,
5313 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5314 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5315 + * GNU General Public License for more details.
5317 + * You should have received a copy of the GNU General Public License
5318 + * along with this program; if not, write to the Free Software
5319 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5322 +#include <linux/device.h>
5323 +#include <linux/init.h>
5324 +#include <linux/kernel.h>
5325 +#include <linux/module.h>
5326 +#include <linux/completion.h>
5327 +#include <linux/platform_device.h>
5328 +#include <linux/mutex.h>
5329 +#include <linux/workqueue.h>
5334 +static struct mutex retu_rtc_mutex;
5335 +static u16 retu_rtc_alarm_expired;
5336 +static u16 retu_rtc_reset_occurred;
5338 +static DECLARE_COMPLETION(retu_rtc_exited);
5339 +static DECLARE_COMPLETION(retu_rtc_sync);
5341 +static void retu_rtc_barrier(void);
5343 +static void retu_rtc_device_release(struct device *dev)
5345 + complete(&retu_rtc_exited);
5348 +static ssize_t retu_rtc_time_show(struct device *dev, struct device_attribute *attr,
5351 + u16 dsr, hmr, dsr2;
5353 + mutex_lock(&retu_rtc_mutex);
5359 + * Not being in_interrupt() for a retu rtc IRQ, we need to
5360 + * read twice for consistency..
5362 + dummy = retu_read_reg(RETU_REG_RTCDSR);
5363 + dsr = retu_read_reg(RETU_REG_RTCDSR);
5365 + dummy = retu_read_reg(RETU_REG_RTCHMR);
5366 + hmr = retu_read_reg(RETU_REG_RTCHMR);
5368 + dummy = retu_read_reg(RETU_REG_RTCDSR);
5369 + dsr2 = retu_read_reg(RETU_REG_RTCDSR);
5370 + } while ((dsr != dsr2));
5372 + mutex_unlock(&retu_rtc_mutex);
5375 + * Format a 32-bit date-string for userspace
5377 + * days | hours | minutes | seconds
5379 + * 8 bits for each.
5381 + * This mostly sucks because days and seconds are tracked in RTCDSR
5382 + * while hours and minutes are tracked in RTCHMR. And yes, there
5383 + * really are no words that can describe an 8 bit day register (or
5384 + * rather, none that will be reprinted here).
5386 + return sprintf(buf, "0x%08x\n", (((dsr >> 8) & 0xff) << 24) |
5387 + (((hmr >> 8) & 0x1f) << 16) |
5388 + ((hmr & 0x3f) << 8) | (dsr & 0x3f));
5391 +static ssize_t retu_rtc_time_store(struct device *dev, struct device_attribute *attr,
5392 + const char *buf, size_t count)
5394 + mutex_lock(&retu_rtc_mutex);
5396 + * Writing anything to the day counter forces it to 0
5397 + * The seconds counter would be cleared by resetting the minutes counter,
5398 + * however this won't happen, since we are using the hh:mm counters as
5399 + * a set of free running counters and the day counter as a multiple
5400 + * overflow holder.
5403 + /* Reset day counter, but keep Temperature Shutdown state */
5404 + retu_write_reg(RETU_REG_RTCDSR,
5405 + retu_read_reg(RETU_REG_RTCDSR) & (1 << 6));
5407 + mutex_unlock(&retu_rtc_mutex);
5412 +static DEVICE_ATTR(time, S_IRUGO | S_IWUSR, retu_rtc_time_show,
5413 + retu_rtc_time_store);
5416 +static ssize_t retu_rtc_reset_show(struct device *dev, struct device_attribute *attr, char *buf)
5419 + * Returns the status of the rtc
5421 + * 0: no reset has occurred or the status has been cleared
5422 + * 1: a reset has occurred
5424 + * RTC needs to be reset only when both main battery
5425 + * _AND_ backup battery are discharged
5427 + return sprintf(buf, "%u\n", retu_rtc_reset_occurred);
5430 +static void retu_rtc_do_reset(void)
5434 + ccr1 = retu_read_reg(RETU_REG_CC1);
5435 + /* RTC in reset */
5436 + retu_write_reg(RETU_REG_CC1, ccr1 | 0x0001);
5437 + /* RTC in normal operating mode */
5438 + retu_write_reg(RETU_REG_CC1, ccr1 & ~0x0001);
5440 + retu_rtc_barrier();
5441 + /* Disable alarm and RTC WD */
5442 + retu_write_reg(RETU_REG_RTCHMAR, 0x7f3f);
5443 + /* Set Calibration register to default value */
5444 + retu_write_reg(RETU_REG_RTCCALR, 0x00c0);
5446 + retu_rtc_alarm_expired = 0;
5447 + retu_rtc_reset_occurred = 1;
5450 +static ssize_t retu_rtc_reset_store(struct device *dev, struct device_attribute *attr,
5451 + const char *buf, size_t count)
5455 + if(sscanf(buf, "%u", &choice) != 1)
5457 + mutex_lock(&retu_rtc_mutex);
5459 + retu_rtc_reset_occurred = 0;
5460 + else if (choice == 1)
5461 + retu_rtc_do_reset();
5462 + mutex_unlock(&retu_rtc_mutex);
5466 +static DEVICE_ATTR(reset, S_IRUGO | S_IWUSR, retu_rtc_reset_show,
5467 + retu_rtc_reset_store);
5469 +static ssize_t retu_rtc_alarm_show(struct device *dev, struct device_attribute *attr,
5475 + mutex_lock(&retu_rtc_mutex);
5477 + * Format a 16-bit date-string for userspace
5480 + * 8 bits for each.
5482 + chmar = retu_read_reg(RETU_REG_RTCHMAR);
5483 + /* No shifting needed, only masking unrelated bits */
5484 + retval = sprintf(buf, "0x%04x\n", chmar & 0x1f3f);
5485 + mutex_unlock(&retu_rtc_mutex);
5490 +static ssize_t retu_rtc_alarm_store(struct device *dev, struct device_attribute *attr,
5491 + const char *buf, size_t count)
5498 + mutex_lock(&retu_rtc_mutex);
5500 + if(sscanf(buf, "%x", &alrm) != 1)
5502 + hours = (alrm >> 8) & 0x001f;
5503 + minutes = (alrm >> 0) & 0x003f;
5504 + if ((hours < 24 && minutes < 60) || (hours == 24 && minutes == 60)) {
5506 + * OK, the time format for the alarm is valid (including the
5507 + * disabling values)
5509 + /* Keeps the RTC watchdog status */
5510 + chmar = retu_read_reg(RETU_REG_RTCHMAR) & 0x6000;
5511 + chmar |= alrm & 0x1f3f; /* Stores the requested alarm */
5512 + retu_rtc_barrier();
5513 + retu_write_reg(RETU_REG_RTCHMAR, chmar);
5514 + /* If the alarm is being disabled */
5515 + if (hours == 24 && minutes == 60) {
5516 + /* disable the interrupt */
5517 + retu_disable_irq(RETU_INT_RTCA);
5518 + retu_rtc_alarm_expired = 0;
5520 + /* enable the interrupt */
5521 + retu_enable_irq(RETU_INT_RTCA);
5523 + mutex_unlock(&retu_rtc_mutex);
5528 +static DEVICE_ATTR(alarm, S_IRUGO | S_IWUSR, retu_rtc_alarm_show,
5529 + retu_rtc_alarm_store);
5531 +static ssize_t retu_rtc_alarm_expired_show(struct device *dev, struct device_attribute *attr,
5536 + retval = sprintf(buf, "%u\n", retu_rtc_alarm_expired);
5541 +static ssize_t retu_rtc_alarm_expired_store(struct device *dev, struct device_attribute *attr,
5542 + const char *buf, size_t count)
5544 + retu_rtc_alarm_expired = 0;
5549 +static DEVICE_ATTR(alarm_expired, S_IRUGO | S_IWUSR, retu_rtc_alarm_expired_show,
5550 + retu_rtc_alarm_expired_store);
5553 +static ssize_t retu_rtc_cal_show(struct device *dev, struct device_attribute *attr,
5558 + mutex_lock(&retu_rtc_mutex);
5559 + rtccalr1 = retu_read_reg(RETU_REG_RTCCALR);
5560 + mutex_unlock(&retu_rtc_mutex);
5563 + * Shows the status of the Calibration Register.
5565 + * Default, after power loss: 0x0000
5566 + * Default, for R&D: 0x00C0
5567 + * Default, for factory: 0x00??
5570 + return sprintf(buf, "0x%04x\n", rtccalr1 & 0x00ff);
5573 +static ssize_t retu_rtc_cal_store(struct device *dev, struct device_attribute *attr,
5574 + const char *buf, size_t count)
5576 + unsigned calibration_value;
5578 + if (sscanf(buf, "%x", &calibration_value) != 1)
5581 + mutex_lock(&retu_rtc_mutex);
5582 + retu_rtc_barrier();
5583 + retu_write_reg(RETU_REG_RTCCALR, calibration_value & 0x00ff);
5584 + mutex_unlock(&retu_rtc_mutex);
5589 +static DEVICE_ATTR(cal, S_IRUGO | S_IWUSR, retu_rtc_cal_show,
5590 + retu_rtc_cal_store);
5592 +static struct platform_device retu_rtc_device;
5594 +static void retu_rtca_disable(void)
5596 + retu_disable_irq(RETU_INT_RTCA);
5597 + retu_rtc_alarm_expired = 1;
5598 + retu_rtc_barrier();
5599 + retu_write_reg(RETU_REG_RTCHMAR, (24 << 8) | 60);
5602 +static void retu_rtca_expired(struct work_struct *unused)
5604 + retu_rtca_disable();
5605 + sysfs_notify(&retu_rtc_device.dev.kobj, NULL, "alarm_expired");
5608 +DECLARE_WORK(retu_rtca_work, retu_rtca_expired);
5611 + * RTCHMR RTCHMAR RTCCAL must be accessed within 0.9 s since the seconds
5612 + * interrupt has been signaled in the IDR register
5614 +static void retu_rtcs_interrupt(unsigned long unused)
5616 + retu_ack_irq(RETU_INT_RTCS);
5617 + complete_all(&retu_rtc_sync);
5620 +static void retu_rtca_interrupt(unsigned long unused)
5622 + retu_ack_irq(RETU_INT_RTCA);
5623 + schedule_work(&retu_rtca_work);
5626 +static int retu_rtc_init_irq(void)
5630 + ret = retu_request_irq(RETU_INT_RTCS, retu_rtcs_interrupt, 0, "RTCS");
5634 + * We will take care of enabling and disabling the interrupt
5635 + * elsewhere, so leave it off by default..
5637 + retu_disable_irq(RETU_INT_RTCS);
5639 + ret = retu_request_irq(RETU_INT_RTCA, retu_rtca_interrupt, 0, "RTCA");
5641 + retu_free_irq(RETU_INT_RTCS);
5644 + retu_disable_irq(RETU_INT_RTCA);
5650 +static int __devinit retu_rtc_probe(struct device *dev)
5654 + retu_rtc_alarm_expired = retu_read_reg(RETU_REG_IDR) &
5655 + (0x1 << RETU_INT_RTCA);
5657 + if ((r = retu_rtc_init_irq()) != 0)
5660 + mutex_init(&retu_rtc_mutex);
5662 + /* If the calibration register is zero, we've probably lost
5664 + if (retu_read_reg(RETU_REG_RTCCALR) & 0x00ff)
5665 + retu_rtc_reset_occurred = 0;
5667 + retu_rtc_do_reset();
5669 + if ((r = device_create_file(dev, &dev_attr_time)) != 0)
5671 + else if ((r = device_create_file(dev, &dev_attr_reset)) != 0)
5672 + goto err_unregister_time;
5673 + else if ((r = device_create_file(dev, &dev_attr_alarm)) != 0)
5674 + goto err_unregister_reset;
5675 + else if ((r = device_create_file(dev, &dev_attr_alarm_expired)) != 0)
5676 + goto err_unregister_alarm;
5677 + else if ((r = device_create_file(dev, &dev_attr_cal)) != 0)
5678 + goto err_unregister_alarm_expired;
5682 +err_unregister_alarm_expired:
5683 + device_remove_file(dev, &dev_attr_alarm_expired);
5684 +err_unregister_alarm:
5685 + device_remove_file(dev, &dev_attr_alarm);
5686 +err_unregister_reset:
5687 + device_remove_file(dev, &dev_attr_reset);
5688 +err_unregister_time:
5689 + device_remove_file(dev, &dev_attr_time);
5693 +static int __devexit retu_rtc_remove(struct device *dev)
5695 + retu_disable_irq(RETU_INT_RTCS);
5696 + retu_free_irq(RETU_INT_RTCS);
5697 + retu_free_irq(RETU_INT_RTCA);
5698 + device_remove_file(dev, &dev_attr_cal);
5699 + device_remove_file(dev, &dev_attr_alarm_expired);
5700 + device_remove_file(dev, &dev_attr_alarm);
5701 + device_remove_file(dev, &dev_attr_reset);
5702 + device_remove_file(dev, &dev_attr_time);
5706 +static struct device_driver retu_rtc_driver = {
5707 + .name = "retu-rtc",
5708 + .bus = &platform_bus_type,
5709 + .probe = retu_rtc_probe,
5710 + .remove = __devexit_p(retu_rtc_remove),
5713 +static struct platform_device retu_rtc_device = {
5714 + .name = "retu-rtc",
5717 + .release = retu_rtc_device_release,
5721 +/* This function provides syncronization with the RTCS interrupt handler */
5722 +static void retu_rtc_barrier(void)
5724 + INIT_COMPLETION(retu_rtc_sync);
5725 + retu_ack_irq(RETU_INT_RTCS);
5726 + retu_enable_irq(RETU_INT_RTCS);
5727 + wait_for_completion(&retu_rtc_sync);
5728 + retu_disable_irq(RETU_INT_RTCS);
5731 +static int __init retu_rtc_init(void)
5735 + init_completion(&retu_rtc_exited);
5737 + if ((ret = driver_register(&retu_rtc_driver)) != 0)
5740 + if ((ret = platform_device_register(&retu_rtc_device)) != 0)
5741 + goto err_unregister_driver;
5745 +err_unregister_driver:
5746 + driver_unregister(&retu_rtc_driver);
5750 +static void __exit retu_rtc_exit(void)
5752 + platform_device_unregister(&retu_rtc_device);
5753 + driver_unregister(&retu_rtc_driver);
5755 + wait_for_completion(&retu_rtc_exited);
5758 +module_init(retu_rtc_init);
5759 +module_exit(retu_rtc_exit);
5761 +MODULE_DESCRIPTION("Retu RTC");
5762 +MODULE_LICENSE("GPL");
5763 +MODULE_AUTHOR("Paul Mundt and Igor Stoppa");
5765 +++ b/drivers/cbus/retu-user.c
5768 + * drivers/cbus/retu-user.c
5770 + * Retu user space interface functions
5772 + * Copyright (C) 2004, 2005 Nokia Corporation
5774 + * Written by Mikko Ylinen <mikko.k.ylinen@nokia.com>
5776 + * This file is subject to the terms and conditions of the GNU General
5777 + * Public License. See the file "COPYING" in the main directory of this
5778 + * archive for more details.
5780 + * This program is distributed in the hope that it will be useful,
5781 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5782 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5783 + * GNU General Public License for more details.
5785 + * You should have received a copy of the GNU General Public License
5786 + * along with this program; if not, write to the Free Software
5787 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5790 +#include <linux/types.h>
5791 +#include <linux/kernel.h>
5792 +#include <linux/interrupt.h>
5793 +#include <linux/module.h>
5794 +#include <linux/init.h>
5795 +#include <linux/fs.h>
5796 +#include <linux/miscdevice.h>
5797 +#include <linux/poll.h>
5798 +#include <linux/list.h>
5799 +#include <linux/spinlock.h>
5800 +#include <linux/mutex.h>
5802 +#include <asm/uaccess.h>
5806 +#include "user_retu_tahvo.h"
5808 +/* Maximum size of IRQ node buffer/pool */
5809 +#define RETU_MAX_IRQ_BUF_LEN 16
5811 +#define PFX "retu-user: "
5813 +/* Bitmap for marking the interrupt sources as having the handlers */
5814 +static u32 retu_irq_bits;
5816 +/* For allowing only one user process to subscribe to the retu interrupts */
5817 +static struct file *retu_irq_subscr = NULL;
5819 +/* For poll and IRQ passing */
5822 + struct list_head node;
5825 +static spinlock_t retu_irqs_lock;
5826 +static struct retu_irq *retu_irq_block;
5827 +static LIST_HEAD(retu_irqs);
5828 +static LIST_HEAD(retu_irqs_reserve);
5830 +/* Wait queue - used when user wants to read the device */
5831 +DECLARE_WAIT_QUEUE_HEAD(retu_user_waitqueue);
5833 +/* Semaphore to protect irq subscription sequence */
5834 +static struct mutex retu_mutex;
5836 +/* This array specifies RETU register types (read/write/toggle) */
5837 +static const u8 retu_access_bits[] = {
5873 + * The handler for all RETU interrupts.
5875 + * arg is the interrupt source in RETU.
5877 +static void retu_user_irq_handler(unsigned long arg)
5879 + struct retu_irq *irq;
5881 + retu_ack_irq(arg);
5883 + spin_lock(&retu_irqs_lock);
5884 + if (list_empty(&retu_irqs_reserve)) {
5885 + spin_unlock(&retu_irqs_lock);
5888 + irq = list_entry((&retu_irqs_reserve)->next, struct retu_irq, node);
5890 + list_move_tail(&irq->node, &retu_irqs);
5891 + spin_unlock(&retu_irqs_lock);
5893 + /* wake up waiting thread */
5894 + wake_up(&retu_user_waitqueue);
5898 + * This routine sets up the interrupt handler and marks an interrupt source
5899 + * in RETU as a candidate for signal delivery to the user process.
5901 +static int retu_user_subscribe_to_irq(int id, struct file *filp)
5905 + mutex_lock(&retu_mutex);
5906 + if ((retu_irq_subscr != NULL) && (retu_irq_subscr != filp)) {
5907 + mutex_unlock(&retu_mutex);
5910 + /* Store the file pointer of the first user process registering IRQs */
5911 + retu_irq_subscr = filp;
5912 + mutex_unlock(&retu_mutex);
5914 + if (retu_irq_bits & (1 << id))
5917 + ret = retu_request_irq(id, retu_user_irq_handler, id, "");
5921 + /* Mark that this interrupt has a handler */
5922 + retu_irq_bits |= 1 << id;
5928 + * Unregisters all RETU interrupt handlers.
5930 +static void retu_unreg_irq_handlers(void)
5934 + if (!retu_irq_bits)
5937 + for (id = 0; id < MAX_RETU_IRQ_HANDLERS; id++)
5938 + if (retu_irq_bits & (1 << id))
5939 + retu_free_irq(id);
5941 + retu_irq_bits = 0;
5945 + * Write to RETU register.
5946 + * Returns 0 upon success, a negative error value otherwise.
5948 +static int retu_user_write_with_mask(u32 field, u16 value)
5953 + unsigned long flags;
5955 + mask = MASK(field);
5958 + /* Detect bad mask and reg */
5959 + if (mask == 0 || reg > RETU_REG_MAX ||
5960 + retu_access_bits[reg] == READ_ONLY) {
5961 + printk(KERN_ERR PFX "invalid arguments (reg=%#x, mask=%#x)\n",
5966 + /* Justify value according to mask */
5967 + while (!(mask & 1)) {
5968 + value = value << 1;
5972 + spin_lock_irqsave(&retu_lock, flags);
5973 + if (retu_access_bits[reg] == TOGGLE) {
5974 + /* No need to detect previous content of register */
5977 + /* Read current value of register */
5978 + tmp = retu_read_reg(reg);
5981 + /* Generate new value */
5982 + tmp = (tmp & ~MASK(field)) | (value & MASK(field));
5983 + /* Write data to RETU */
5984 + retu_write_reg(reg, tmp);
5985 + spin_unlock_irqrestore(&retu_lock, flags);
5991 + * Read RETU register.
5993 +static u32 retu_user_read_with_mask(u32 field)
5998 + mask = MASK(field);
6001 + /* Detect bad mask and reg */
6002 + if (mask == 0 || reg > RETU_REG_MAX) {
6003 + printk(KERN_ERR PFX "invalid arguments (reg=%#x, mask=%#x)\n",
6008 + /* Read the register */
6009 + value = retu_read_reg(reg) & mask;
6011 + /* Right justify value */
6012 + while (!(mask & 1)) {
6013 + value = value >> 1;
6023 +static int retu_close(struct inode *inode, struct file *filp)
6025 + /* Unregister all interrupts that have been registered */
6026 + if (retu_irq_subscr == filp) {
6027 + retu_unreg_irq_handlers();
6028 + retu_irq_subscr = NULL;
6035 + * Device control (ioctl)
6037 +static int retu_ioctl(struct inode *inode, struct file *filp,
6038 + unsigned int cmd, unsigned long arg)
6040 + struct retu_tahvo_write_parms par;
6044 + case URT_IOCT_IRQ_SUBSCR:
6045 + return retu_user_subscribe_to_irq(arg, filp);
6046 + case RETU_IOCH_READ:
6047 + return retu_user_read_with_mask(arg);
6048 + case RETU_IOCX_WRITE:
6049 + ret = copy_from_user(&par, (void __user *) arg, sizeof(par));
6051 + printk(KERN_ERR "copy_from_user failed: %d\n", ret);
6052 + par.result = retu_user_write_with_mask(par.field, par.value);
6053 + ret = copy_to_user((void __user *) arg, &par, sizeof(par));
6055 + printk(KERN_ERR "copy_to_user failed: %d\n", ret);
6057 + case RETU_IOCH_ADC_READ:
6058 + return retu_read_adc(arg);
6060 + return -ENOIOCTLCMD;
6066 + * Read from device
6068 +static ssize_t retu_read(struct file *filp, char *buf, size_t count,
6071 + struct retu_irq *irq;
6075 + /* read not permitted if neither filp nor anyone has registered IRQs */
6076 + if (retu_irq_subscr != filp)
6079 + if ((count < sizeof(u32)) || ((count % sizeof(u32)) != 0))
6082 + nr = count / sizeof(u32);
6084 + for (i = 0; i < nr; i++) {
6085 + unsigned long flags;
6089 + ret = wait_event_interruptible(retu_user_waitqueue,
6090 + !list_empty(&retu_irqs));
6094 + spin_lock_irqsave(&retu_irqs_lock, flags);
6095 + irq = list_entry((&retu_irqs)->next, struct retu_irq, node);
6097 + list_move(&irq->node, &retu_irqs_reserve);
6098 + spin_unlock_irqrestore(&retu_irqs_lock, flags);
6100 + ret = copy_to_user(buf + i * sizeof(irq_id), &irq_id,
6103 + printk(KERN_ERR "copy_to_user failed: %d\n", ret);
6112 +static unsigned retu_poll(struct file *filp, struct poll_table_struct *pt)
6114 + if (!list_empty(&retu_irqs))
6117 + poll_wait(filp, &retu_user_waitqueue, pt);
6119 + if (!list_empty(&retu_irqs))
6125 +static struct file_operations retu_user_fileops = {
6126 + .owner = THIS_MODULE,
6127 + .ioctl = retu_ioctl,
6128 + .read = retu_read,
6129 + .release = retu_close,
6133 +static struct miscdevice retu_device = {
6134 + .minor = MISC_DYNAMIC_MINOR,
6136 + .fops = &retu_user_fileops
6142 + * @return 0 if successful, error value otherwise.
6144 +int retu_user_init(void)
6146 + struct retu_irq *irq;
6149 + irq = kmalloc(sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN, GFP_KERNEL);
6150 + if (irq == NULL) {
6151 + printk(KERN_ERR PFX "kmalloc failed\n");
6154 + memset(irq, 0, sizeof(*irq) * RETU_MAX_IRQ_BUF_LEN);
6155 + for (i = 0; i < RETU_MAX_IRQ_BUF_LEN; i++)
6156 + list_add(&irq[i].node, &retu_irqs_reserve);
6158 + retu_irq_block = irq;
6160 + spin_lock_init(&retu_irqs_lock);
6161 + mutex_init(&retu_mutex);
6163 + /* Request a misc device */
6164 + res = misc_register(&retu_device);
6166 + printk(KERN_ERR PFX "unable to register misc device for %s\n",
6167 + retu_device.name);
6178 +void retu_user_cleanup(void)
6180 + /* Unregister our misc device */
6181 + misc_deregister(&retu_device);
6182 + /* Unregister and disable all RETU interrupts used by this module */
6183 + retu_unreg_irq_handlers();
6184 + kfree(retu_irq_block);
6187 +MODULE_DESCRIPTION("Retu ASIC user space functions");
6188 +MODULE_LICENSE("GPL");
6189 +MODULE_AUTHOR("Mikko Ylinen");
6191 +++ b/drivers/cbus/retu-wdt.c
6194 + * drivers/cbus/retu-wdt.c
6196 + * Driver for Retu watchdog
6198 + * Copyright (C) 2004, 2005 Nokia Corporation
6200 + * Written by Amit Kucheria <amit.kucheria@nokia.com>
6202 + * This file is subject to the terms and conditions of the GNU General
6203 + * Public License. See the file "COPYING" in the main directory of this
6204 + * archive for more details.
6206 + * This program is distributed in the hope that it will be useful,
6207 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6208 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6209 + * GNU General Public License for more details.
6211 + * You should have received a copy of the GNU General Public License
6212 + * along with this program; if not, write to the Free Software
6213 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6216 +#include <linux/kernel.h>
6217 +#include <linux/module.h>
6218 +#include <linux/device.h>
6219 +#include <linux/init.h>
6221 +#include <linux/completion.h>
6222 +#include <linux/errno.h>
6223 +#include <linux/moduleparam.h>
6224 +#include <linux/platform_device.h>
6229 +/* Watchdog timeout in seconds */
6230 +#define RETU_WDT_MIN_TIMER 0
6231 +#define RETU_WDT_DEFAULT_TIMER 32
6232 +#define RETU_WDT_MAX_TIMER 63
6234 +static struct completion retu_wdt_completion;
6235 +static DEFINE_MUTEX(retu_wdt_mutex);
6237 +/* Current period of watchdog */
6238 +static unsigned int period_val = RETU_WDT_DEFAULT_TIMER;
6239 +static int counter_param = RETU_WDT_MAX_TIMER;
6241 +static int retu_modify_counter(unsigned int new)
6245 + if (new < RETU_WDT_MIN_TIMER || new > RETU_WDT_MAX_TIMER)
6248 + mutex_lock(&retu_wdt_mutex);
6251 + retu_write_reg(RETU_REG_WATCHDOG, (u16)period_val);
6253 + mutex_unlock(&retu_wdt_mutex);
6257 +static ssize_t retu_wdt_period_show(struct device *dev,
6258 + struct device_attribute *attr, char *buf)
6260 + /* Show current max counter */
6261 + return sprintf(buf, "%u\n", (u16)period_val);
6264 +static ssize_t retu_wdt_period_store(struct device *dev,
6265 + struct device_attribute *attr,
6266 + const char *buf, size_t count)
6268 + unsigned int new_period;
6271 + if (sscanf(buf, "%u", &new_period) != 1) {
6272 + printk(KERN_ALERT "retu_wdt_period_store: Invalid input\n");
6276 + ret = retu_modify_counter(new_period);
6280 + return strnlen(buf, count);
6283 +static ssize_t retu_wdt_counter_show(struct device *dev,
6284 + struct device_attribute *attr, char *buf)
6288 + /* Show current value in watchdog counter */
6289 + counter = retu_read_reg(RETU_REG_WATCHDOG);
6291 + /* Only the 5 LSB are important */
6292 + return snprintf(buf, PAGE_SIZE, "%u\n", (counter & 0x3F));
6295 +static DEVICE_ATTR(period, S_IRUGO | S_IWUSR, retu_wdt_period_show, \
6296 + retu_wdt_period_store);
6297 +static DEVICE_ATTR(counter, S_IRUGO, retu_wdt_counter_show, NULL);
6299 +static int __devinit retu_wdt_probe(struct device *dev)
6303 + ret = device_create_file(dev, &dev_attr_period);
6305 + printk(KERN_ERR "retu_wdt_probe: Error creating "
6306 + "sys device file: period\n");
6310 + ret = device_create_file(dev, &dev_attr_counter);
6312 + device_remove_file(dev, &dev_attr_period);
6313 + printk(KERN_ERR "retu_wdt_probe: Error creating "
6314 + "sys device file: counter\n");
6320 +static int __devexit retu_wdt_remove(struct device *dev)
6322 + device_remove_file(dev, &dev_attr_period);
6323 + device_remove_file(dev, &dev_attr_counter);
6327 +static void retu_wdt_device_release(struct device *dev)
6329 + complete(&retu_wdt_completion);
6332 +static struct platform_device retu_wdt_device = {
6333 + .name = "retu-watchdog",
6336 + .release = retu_wdt_device_release,
6340 +static struct device_driver retu_wdt_driver = {
6341 + .name = "retu-watchdog",
6342 + .bus = &platform_bus_type,
6343 + .probe = retu_wdt_probe,
6344 + .remove = __devexit_p(retu_wdt_remove),
6347 +static int __init retu_wdt_init(void)
6351 + init_completion(&retu_wdt_completion);
6353 + ret = driver_register(&retu_wdt_driver);
6357 + ret = platform_device_register(&retu_wdt_device);
6361 + /* passed as module parameter? */
6362 + ret = retu_modify_counter(counter_param);
6363 + if (ret == -EINVAL) {
6364 + ret = retu_modify_counter(RETU_WDT_DEFAULT_TIMER);
6366 + "retu_wdt_init: Intializing to default value\n");
6369 + printk(KERN_INFO "Retu watchdog driver initialized\n");
6373 + driver_unregister(&retu_wdt_driver);
6374 + wait_for_completion(&retu_wdt_completion);
6379 +static void __exit retu_wdt_exit(void)
6381 + platform_device_unregister(&retu_wdt_device);
6382 + driver_unregister(&retu_wdt_driver);
6384 + wait_for_completion(&retu_wdt_completion);
6387 +module_init(retu_wdt_init);
6388 +module_exit(retu_wdt_exit);
6389 +module_param(counter_param, int, 0);
6391 +MODULE_DESCRIPTION("Retu WatchDog");
6392 +MODULE_AUTHOR("Amit Kucheria");
6393 +MODULE_LICENSE("GPL");
6396 +++ b/drivers/cbus/retu.c
6399 + * drivers/cbus/retu.c
6401 + * Support functions for Retu ASIC
6403 + * Copyright (C) 2004, 2005 Nokia Corporation
6405 + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
6406 + * David Weinehall <david.weinehall@nokia.com>, and
6407 + * Mikko Ylinen <mikko.k.ylinen@nokia.com>
6409 + * This file is subject to the terms and conditions of the GNU General
6410 + * Public License. See the file "COPYING" in the main directory of this
6411 + * archive for more details.
6413 + * This program is distributed in the hope that it will be useful,
6414 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6415 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6416 + * GNU General Public License for more details.
6418 + * You should have received a copy of the GNU General Public License
6419 + * along with this program; if not, write to the Free Software
6420 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6423 +#include <linux/module.h>
6424 +#include <linux/init.h>
6426 +#include <linux/kernel.h>
6427 +#include <linux/errno.h>
6428 +#include <linux/device.h>
6429 +#include <linux/miscdevice.h>
6430 +#include <linux/poll.h>
6431 +#include <linux/fs.h>
6432 +#include <linux/irq.h>
6433 +#include <linux/interrupt.h>
6434 +#include <linux/platform_device.h>
6435 +#include <linux/gpio.h>
6437 +#include <asm/uaccess.h>
6439 +#include <mach/mux.h>
6440 +#include <mach/board.h>
6441 +#include <mach/board-nokia.h>
6446 +#define RETU_ID 0x01
6447 +#define PFX "retu: "
6449 +static int retu_initialized;
6450 +static int retu_irq_pin;
6451 +static int retu_is_vilma;
6453 +static struct tasklet_struct retu_tasklet;
6454 +spinlock_t retu_lock = SPIN_LOCK_UNLOCKED;
6456 +static struct completion device_release;
6458 +struct retu_irq_handler_desc {
6459 + int (*func)(unsigned long);
6460 + unsigned long arg;
6464 +static struct retu_irq_handler_desc retu_irq_handlers[MAX_RETU_IRQ_HANDLERS];
6467 + * retu_read_reg - Read a value from a register in Retu
6468 + * @reg: the register to read from
6470 + * This function returns the contents of the specified register
6472 +int retu_read_reg(int reg)
6474 + BUG_ON(!retu_initialized);
6475 + return cbus_read_reg(cbus_host, RETU_ID, reg);
6479 + * retu_write_reg - Write a value to a register in Retu
6480 + * @reg: the register to write to
6481 + * @reg: the value to write to the register
6483 + * This function writes a value to the specified register
6485 +void retu_write_reg(int reg, u16 val)
6487 + BUG_ON(!retu_initialized);
6488 + cbus_write_reg(cbus_host, RETU_ID, reg, val);
6491 +void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
6493 + unsigned long flags;
6496 + spin_lock_irqsave(&retu_lock, flags);
6497 + w = retu_read_reg(reg);
6500 + retu_write_reg(reg, w);
6501 + spin_unlock_irqrestore(&retu_lock, flags);
6504 +#define ADC_MAX_CHAN_NUMBER 13
6506 +int retu_read_adc(int channel)
6508 + unsigned long flags;
6511 + if (channel < 0 || channel > ADC_MAX_CHAN_NUMBER)
6514 + spin_lock_irqsave(&retu_lock, flags);
6516 + if ((channel == 8) && retu_is_vilma) {
6517 + int scr = retu_read_reg(RETU_REG_ADCSCR);
6518 + int ch = (retu_read_reg(RETU_REG_ADCR) >> 10) & 0xf;
6519 + if (((scr & 0xff) != 0) && (ch != 8))
6520 + retu_write_reg (RETU_REG_ADCSCR, (scr & ~0xff));
6523 + /* Select the channel and read result */
6524 + retu_write_reg(RETU_REG_ADCR, channel << 10);
6525 + res = retu_read_reg(RETU_REG_ADCR) & 0x3ff;
6527 + if (retu_is_vilma)
6528 + retu_write_reg(RETU_REG_ADCR, (1 << 13));
6531 + spin_unlock_irqrestore(&retu_lock, flags);
6537 +static u16 retu_disable_bogus_irqs(u16 mask)
6541 + for (i = 0; i < MAX_RETU_IRQ_HANDLERS; i++) {
6542 + if (mask & (1 << i))
6544 + if (retu_irq_handlers[i].func != NULL)
6546 + /* an IRQ was enabled but we don't have a handler for it */
6547 + printk(KERN_INFO PFX "disabling bogus IRQ %d\n", i);
6554 + * Disable given RETU interrupt
6556 +void retu_disable_irq(int id)
6558 + unsigned long flags;
6561 + spin_lock_irqsave(&retu_lock, flags);
6562 + mask = retu_read_reg(RETU_REG_IMR);
6564 + mask = retu_disable_bogus_irqs(mask);
6565 + retu_write_reg(RETU_REG_IMR, mask);
6566 + spin_unlock_irqrestore(&retu_lock, flags);
6570 + * Enable given RETU interrupt
6572 +void retu_enable_irq(int id)
6574 + unsigned long flags;
6578 + printk("Enabling Retu IRQ %d\n", id);
6581 + spin_lock_irqsave(&retu_lock, flags);
6582 + mask = retu_read_reg(RETU_REG_IMR);
6583 + mask &= ~(1 << id);
6584 + mask = retu_disable_bogus_irqs(mask);
6585 + retu_write_reg(RETU_REG_IMR, mask);
6586 + spin_unlock_irqrestore(&retu_lock, flags);
6590 + * Acknowledge given RETU interrupt
6592 +void retu_ack_irq(int id)
6594 + retu_write_reg(RETU_REG_IDR, 1 << id);
6598 + * RETU interrupt handler. Only schedules the tasklet.
6600 +static irqreturn_t retu_irq_handler(int irq, void *dev_id)
6602 + tasklet_schedule(&retu_tasklet);
6603 + return IRQ_HANDLED;
6609 +static void retu_tasklet_handler(unsigned long data)
6611 + struct retu_irq_handler_desc *hnd;
6617 + id = retu_read_reg(RETU_REG_IDR);
6618 + im = ~retu_read_reg(RETU_REG_IMR);
6624 + for (i = 0; id != 0; i++, id >>= 1) {
6627 + hnd = &retu_irq_handlers[i];
6628 + if (hnd->func == NULL) {
6629 + /* Spurious retu interrupt - disable and ack it */
6630 + printk(KERN_INFO "Spurious Retu interrupt "
6632 + retu_disable_irq(i);
6636 + hnd->func(hnd->arg);
6638 + * Don't acknowledge the interrupt here
6639 + * It must be done explicitly
6646 + * Register the handler for a given RETU interrupt source.
6648 +int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name)
6650 + struct retu_irq_handler_desc *hnd;
6652 + if (irq_handler == NULL || id >= MAX_RETU_IRQ_HANDLERS ||
6654 + printk(KERN_ERR PFX "Invalid arguments to %s\n",
6658 + hnd = &retu_irq_handlers[id];
6659 + if (hnd->func != NULL) {
6660 + printk(KERN_ERR PFX "IRQ %d already reserved\n", id);
6663 + printk(KERN_INFO PFX "Registering interrupt %d for device %s\n",
6665 + hnd->func = irq_handler;
6667 + strlcpy(hnd->name, name, sizeof(hnd->name));
6670 + retu_enable_irq(id);
6676 + * Unregister the handler for a given RETU interrupt source.
6678 +void retu_free_irq(int id)
6680 + struct retu_irq_handler_desc *hnd;
6682 + if (id >= MAX_RETU_IRQ_HANDLERS) {
6683 + printk(KERN_ERR PFX "Invalid argument to %s\n",
6687 + hnd = &retu_irq_handlers[id];
6688 + if (hnd->func == NULL) {
6689 + printk(KERN_ERR PFX "IRQ %d already freed\n", id);
6693 + retu_disable_irq(id);
6698 + * retu_power_off - Shut down power to system
6700 + * This function puts the system in power off state
6702 +static void retu_power_off(void)
6704 + /* Ignore power button state */
6705 + retu_write_reg(RETU_REG_CC1, retu_read_reg(RETU_REG_CC1) | 2);
6706 + /* Expire watchdog immediately */
6707 + retu_write_reg(RETU_REG_WATCHDOG, 0);
6708 + /* Wait for poweroff*/
6713 + * retu_probe - Probe for Retu ASIC
6714 + * @dev: the Retu device
6716 + * Probe for the Retu ASIC and allocate memory
6717 + * for its device-struct if found
6719 +static int __devinit retu_probe(struct device *dev)
6721 + const struct omap_em_asic_bb5_config * em_asic_config;
6724 + /* Prepare tasklet */
6725 + tasklet_init(&retu_tasklet, retu_tasklet_handler, 0);
6727 + em_asic_config = omap_get_config(OMAP_TAG_EM_ASIC_BB5,
6728 + struct omap_em_asic_bb5_config);
6729 + if (em_asic_config == NULL) {
6730 + printk(KERN_ERR PFX "Unable to retrieve config data\n");
6734 + retu_irq_pin = em_asic_config->retu_irq_gpio;
6736 + if ((ret = gpio_request(retu_irq_pin, "RETU irq")) < 0) {
6737 + printk(KERN_ERR PFX "Unable to reserve IRQ GPIO\n");
6741 + /* Set the pin as input */
6742 + gpio_direction_input(retu_irq_pin);
6744 + /* Rising edge triggers the IRQ */
6745 + set_irq_type(gpio_to_irq(retu_irq_pin), IRQ_TYPE_EDGE_RISING);
6747 + retu_initialized = 1;
6749 + rev = retu_read_reg(RETU_REG_ASICR) & 0xff;
6750 + if (rev & (1 << 7))
6751 + retu_is_vilma = 1;
6753 + printk(KERN_INFO "%s v%d.%d found\n", retu_is_vilma ? "Vilma" : "Retu",
6754 + (rev >> 4) & 0x07, rev & 0x0f);
6756 + /* Mask all RETU interrupts */
6757 + retu_write_reg(RETU_REG_IMR, 0xffff);
6759 + ret = request_irq(gpio_to_irq(retu_irq_pin), retu_irq_handler, 0,
6762 + printk(KERN_ERR PFX "Unable to register IRQ handler\n");
6763 + gpio_free(retu_irq_pin);
6766 + set_irq_wake(gpio_to_irq(retu_irq_pin), 1);
6768 + /* Register power off function */
6769 + pm_power_off = retu_power_off;
6771 +#ifdef CONFIG_CBUS_RETU_USER
6772 + /* Initialize user-space interface */
6773 + if (retu_user_init() < 0) {
6774 + printk(KERN_ERR "Unable to initialize driver\n");
6775 + free_irq(gpio_to_irq(retu_irq_pin), 0);
6776 + gpio_free(retu_irq_pin);
6784 +static int retu_remove(struct device *dev)
6786 +#ifdef CONFIG_CBUS_RETU_USER
6787 + retu_user_cleanup();
6789 + /* Mask all RETU interrupts */
6790 + retu_write_reg(RETU_REG_IMR, 0xffff);
6791 + free_irq(gpio_to_irq(retu_irq_pin), 0);
6792 + gpio_free(retu_irq_pin);
6793 + tasklet_kill(&retu_tasklet);
6798 +static void retu_device_release(struct device *dev)
6800 + complete(&device_release);
6803 +static struct device_driver retu_driver = {
6805 + .bus = &platform_bus_type,
6806 + .probe = retu_probe,
6807 + .remove = retu_remove,
6810 +static struct platform_device retu_device = {
6814 + .release = retu_device_release,
6819 + * retu_init - initialise Retu driver
6821 + * Initialise the Retu driver and return 0 if everything worked ok
6823 +static int __init retu_init(void)
6827 + printk(KERN_INFO "Retu/Vilma driver initialising\n");
6829 + init_completion(&device_release);
6831 + if ((ret = driver_register(&retu_driver)) < 0)
6834 + if ((ret = platform_device_register(&retu_device)) < 0) {
6835 + driver_unregister(&retu_driver);
6844 +static void __exit retu_exit(void)
6846 + platform_device_unregister(&retu_device);
6847 + driver_unregister(&retu_driver);
6848 + wait_for_completion(&device_release);
6851 +EXPORT_SYMBOL(retu_request_irq);
6852 +EXPORT_SYMBOL(retu_free_irq);
6853 +EXPORT_SYMBOL(retu_enable_irq);
6854 +EXPORT_SYMBOL(retu_disable_irq);
6855 +EXPORT_SYMBOL(retu_ack_irq);
6856 +EXPORT_SYMBOL(retu_read_reg);
6857 +EXPORT_SYMBOL(retu_write_reg);
6859 +subsys_initcall(retu_init);
6860 +module_exit(retu_exit);
6862 +MODULE_DESCRIPTION("Retu ASIC control");
6863 +MODULE_LICENSE("GPL");
6864 +MODULE_AUTHOR("Juha Yrjölä, David Weinehall, and Mikko Ylinen");
6866 +++ b/drivers/cbus/retu.h
6869 + * drivers/cbus/retu.h
6871 + * Copyright (C) 2004, 2005 Nokia Corporation
6873 + * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
6874 + * David Weinehall <david.weinehall@nokia.com>
6876 + * This file is subject to the terms and conditions of the GNU General
6877 + * Public License. See the file "COPYING" in the main directory of this
6878 + * archive for more details.
6880 + * This program is distributed in the hope that it will be useful,
6881 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6882 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6883 + * GNU General Public License for more details.
6885 + * You should have received a copy of the GNU General Public License
6886 + * along with this program; if not, write to the Free Software
6887 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6890 +#ifndef __DRIVERS_CBUS_RETU_H
6891 +#define __DRIVERS_CBUS_RETU_H
6893 +#include <linux/types.h>
6896 +#define RETU_REG_ASICR 0x00 /* ASIC ID & revision */
6897 +#define RETU_REG_IDR 0x01 /* Interrupt ID */
6898 +#define RETU_REG_IMR 0x02 /* Interrupt mask */
6899 +#define RETU_REG_RTCDSR 0x03 /* RTC seconds register */
6900 +#define RETU_REG_RTCHMR 0x04 /* RTC hours and minutes register */
6901 +#define RETU_REG_RTCHMAR 0x05 /* RTC hours and minutes alarm and time set register */
6902 +#define RETU_REG_RTCCALR 0x06 /* RTC calibration register */
6903 +#define RETU_REG_ADCR 0x08 /* ADC result */
6904 +#define RETU_REG_ADCSCR 0x09 /* ADC sample ctrl */
6905 +#define RETU_REG_CC1 0x0d /* Common control register 1 */
6906 +#define RETU_REG_CC2 0x0e /* Common control register 2 */
6907 +#define RETU_REG_CTRL_CLR 0x0f /* Regulator clear register */
6908 +#define RETU_REG_CTRL_SET 0x10 /* Regulator set register */
6909 +#define RETU_REG_STATUS 0x16 /* Status register */
6910 +#define RETU_REG_WATCHDOG 0x17 /* Watchdog register */
6911 +#define RETU_REG_AUDTXR 0x18 /* Audio Codec Tx register */
6912 +#define RETU_REG_MAX 0x1f
6914 +/* Interrupt sources */
6915 +#define RETU_INT_PWR 0
6916 +#define RETU_INT_CHAR 1
6917 +#define RETU_INT_RTCS 2
6918 +#define RETU_INT_RTCM 3
6919 +#define RETU_INT_RTCD 4
6920 +#define RETU_INT_RTCA 5
6921 +#define RETU_INT_HOOK 6
6922 +#define RETU_INT_HEAD 7
6923 +#define RETU_INT_ADCS 8
6925 +#define MAX_RETU_IRQ_HANDLERS 16
6927 +int retu_read_reg(int reg);
6928 +void retu_write_reg(int reg, u16 val);
6929 +void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
6930 +int retu_read_adc(int channel);
6931 +int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
6932 +void retu_free_irq(int id);
6933 +void retu_enable_irq(int id);
6934 +void retu_disable_irq(int id);
6935 +void retu_ack_irq(int id);
6937 +#ifdef CONFIG_CBUS_RETU_USER
6938 +int retu_user_init(void);
6939 +void retu_user_cleanup(void);
6942 +extern spinlock_t retu_lock;
6944 +#endif /* __DRIVERS_CBUS_RETU_H */
6946 +++ b/drivers/cbus/tahvo-usb.c
6949 + * drivers/cbus/tahvo-usb.c
6951 + * Tahvo USB transeiver
6953 + * Copyright (C) 2005-2006 Nokia Corporation
6955 + * Parts copied from drivers/i2c/chips/isp1301_omap.c
6956 + * Copyright (C) 2004 Texas Instruments
6957 + * Copyright (C) 2004 David Brownell
6959 + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
6960 + * Tony Lindgren <tony@atomide.com>, and
6961 + * Timo Teräs <timo.teras@nokia.com>
6963 + * This file is subject to the terms and conditions of the GNU General
6964 + * Public License. See the file "COPYING" in the main directory of this
6965 + * archive for more details.
6967 + * This program is distributed in the hope that it will be useful,
6968 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6969 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6970 + * GNU General Public License for more details.
6972 + * You should have received a copy of the GNU General Public License
6973 + * along with this program; if not, write to the Free Software
6974 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6977 +#include <linux/kernel.h>
6978 +#include <linux/module.h>
6979 +#include <linux/init.h>
6980 +#include <linux/slab.h>
6981 +#include <linux/io.h>
6982 +#include <linux/interrupt.h>
6983 +#include <linux/platform_device.h>
6984 +#include <linux/usb/ch9.h>
6985 +#include <linux/usb/gadget.h>
6986 +#include <linux/usb.h>
6987 +#include <linux/usb/otg.h>
6988 +#include <linux/i2c.h>
6989 +#include <linux/workqueue.h>
6990 +#include <linux/kobject.h>
6991 +#include <linux/clk.h>
6992 +#include <linux/mutex.h>
6994 +#include <asm/irq.h>
6995 +#include <mach/usb.h>
7000 +#define DRIVER_NAME "tahvo-usb"
7002 +#define USBR_SLAVE_CONTROL (1 << 8)
7003 +#define USBR_VPPVIO_SW (1 << 7)
7004 +#define USBR_SPEED (1 << 6)
7005 +#define USBR_REGOUT (1 << 5)
7006 +#define USBR_MASTER_SW2 (1 << 4)
7007 +#define USBR_MASTER_SW1 (1 << 3)
7008 +#define USBR_SLAVE_SW (1 << 2)
7009 +#define USBR_NSUSPEND (1 << 1)
7010 +#define USBR_SEMODE (1 << 0)
7012 +/* bits in OTG_CTRL */
7014 +/* Bits that are controlled by OMAP OTG and are read-only */
7015 +#define OTG_CTRL_OMAP_MASK (OTG_PULLDOWN|OTG_PULLUP|OTG_DRV_VBUS|\
7016 + OTG_PD_VBUS|OTG_PU_VBUS|OTG_PU_ID)
7017 +/* Bits that are controlled by transceiver */
7018 +#define OTG_CTRL_XCVR_MASK (OTG_ASESSVLD|OTG_BSESSEND|\
7019 + OTG_BSESSVLD|OTG_VBUSVLD|OTG_ID)
7020 +/* Bits that are controlled by system */
7021 +#define OTG_CTRL_SYS_MASK (OTG_A_BUSREQ|OTG_A_SETB_HNPEN|OTG_B_BUSREQ|\
7022 + OTG_B_HNPEN|OTG_BUSDROP)
7024 +#if defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OTG)
7025 +#error tahvo-otg.c does not work with OCHI yet!
7028 +#define TAHVO_MODE_HOST 0
7029 +#define TAHVO_MODE_PERIPHERAL 1
7031 +#ifdef CONFIG_USB_OTG
7032 +#define TAHVO_MODE(tu) (tu)->tahvo_mode
7033 +#elif defined(CONFIG_USB_GADGET_OMAP)
7034 +#define TAHVO_MODE(tu) TAHVO_MODE_PERIPHERAL
7036 +#define TAHVO_MODE(tu) TAHVO_MODE_HOST
7040 + struct platform_device *pt_dev;
7041 + struct otg_transceiver otg;
7043 + struct work_struct irq_work;
7044 + struct mutex serialize;
7045 +#ifdef CONFIG_USB_OTG
7049 +static struct platform_device tahvo_usb_device;
7052 + * ---------------------------------------------------------------------------
7053 + * OTG related functions
7055 + * These shoud be separated into omap-otg.c driver module, as they are used
7056 + * by various transceivers. These functions are needed in the UDC-only case
7057 + * as well. These functions are copied from GPL isp1301_omap.c
7058 + * ---------------------------------------------------------------------------
7060 +static struct platform_device *tahvo_otg_dev;
7062 +static irqreturn_t omap_otg_irq(int irq, void *arg)
7064 + struct platform_device *otg_dev = (struct platform_device *) arg;
7065 + struct tahvo_usb *tu = (struct tahvo_usb *) otg_dev->dev.driver_data;
7068 + otg_irq = omap_readw(OTG_IRQ_SRC);
7069 + if (otg_irq & OPRT_CHG) {
7070 + omap_writew(OPRT_CHG, OTG_IRQ_SRC);
7071 + } else if (otg_irq & B_SRP_TMROUT) {
7072 + omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
7073 + } else if (otg_irq & B_HNP_FAIL) {
7074 + omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
7075 + } else if (otg_irq & A_SRP_DETECT) {
7076 + omap_writew(A_SRP_DETECT, OTG_IRQ_SRC);
7077 + } else if (otg_irq & A_REQ_TMROUT) {
7078 + omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
7079 + } else if (otg_irq & A_VBUS_ERR) {
7080 + omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
7081 + } else if (otg_irq & DRIVER_SWITCH) {
7082 + if ((!(omap_readl(OTG_CTRL) & OTG_DRIVER_SEL)) &&
7083 + tu->otg.host && tu->otg.state == OTG_STATE_A_HOST) {
7084 + /* role is host */
7085 + usb_bus_start_enum(tu->otg.host,
7086 + tu->otg.host->otg_port);
7088 + omap_writew(DRIVER_SWITCH, OTG_IRQ_SRC);
7092 + return IRQ_HANDLED;
7096 +static int omap_otg_init(void)
7100 +#ifdef CONFIG_USB_OTG
7101 + if (!tahvo_otg_dev) {
7102 + printk("tahvo-usb: no tahvo_otg_dev\n");
7107 + l = omap_readl(OTG_SYSCON_1);
7108 + l &= ~OTG_IDLE_EN;
7109 + omap_writel(l, OTG_SYSCON_1);
7112 + /* some of these values are board-specific... */
7113 + l = omap_readl(OTG_SYSCON_2);
7115 + /* for B-device: */
7116 + | SRP_GPDATA /* 9msec Bdev D+ pulse */
7117 + | SRP_GPDVBUS /* discharge after VBUS pulse */
7118 + // | (3 << 24) /* 2msec VBUS pulse */
7119 + /* for A-device: */
7120 + | (0 << 20) /* 200ms nominal A_WAIT_VRISE timer */
7121 + | SRP_DPW /* detect 167+ns SRP pulses */
7122 + | SRP_DATA | SRP_VBUS; /* accept both kinds of SRP pulse */
7123 + omap_writel(l, OTG_SYSCON_2);
7125 + omap_writew(DRIVER_SWITCH | OPRT_CHG
7126 + | B_SRP_TMROUT | B_HNP_FAIL
7127 + | A_VBUS_ERR | A_SRP_DETECT | A_REQ_TMROUT,
7129 + l = omap_readl(OTG_SYSCON_2);
7131 + omap_writel(l, OTG_SYSCON_2);
7136 +static int omap_otg_probe(struct device *dev)
7140 + tahvo_otg_dev = to_platform_device(dev);
7141 + ret = omap_otg_init();
7143 + printk(KERN_ERR "tahvo-usb: omap_otg_init failed\n");
7147 + return request_irq(tahvo_otg_dev->resource[1].start,
7148 + omap_otg_irq, IRQF_DISABLED, DRIVER_NAME,
7149 + &tahvo_usb_device);
7152 +static int omap_otg_remove(struct device *dev)
7154 + free_irq(tahvo_otg_dev->resource[1].start, &tahvo_usb_device);
7155 + tahvo_otg_dev = NULL;
7160 +struct device_driver omap_otg_driver = {
7161 + .name = "omap_otg",
7162 + .bus = &platform_bus_type,
7163 + .probe = omap_otg_probe,
7164 + .remove = omap_otg_remove,
7168 + * ---------------------------------------------------------------------------
7169 + * Tahvo related functions
7170 + * These are Nokia proprietary code, except for the OTG register settings,
7171 + * which are copied from isp1301.c
7172 + * ---------------------------------------------------------------------------
7174 +static ssize_t vbus_state_show(struct device *device,
7175 + struct device_attribute *attr, char *buf)
7177 + struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
7178 + return sprintf(buf, "%d\n", tu->vbus_state);
7180 +static DEVICE_ATTR(vbus_state, 0444, vbus_state_show, NULL);
7182 +int vbus_active = 0;
7186 +static int host_suspend(struct tahvo_usb *tu)
7188 + struct device *dev;
7190 + if (!tu->otg.host)
7193 + /* Currently ASSUMES only the OTG port matters;
7194 + * other ports could be active...
7196 + dev = tu->otg.host->controller;
7197 + return dev->driver->suspend(dev, PMSG_SUSPEND);
7200 +static int host_resume(struct tahvo_usb *tu)
7202 + struct device *dev;
7204 + if (!tu->otg.host)
7207 + dev = tu->otg.host->controller;
7208 + return dev->driver->resume(dev);
7213 +static int host_suspend(struct tahvo_usb *tu)
7218 +static int host_resume(struct tahvo_usb *tu)
7225 +static void check_vbus_state(struct tahvo_usb *tu)
7227 + int reg, prev_state;
7229 + reg = tahvo_read_reg(TAHVO_REG_IDSR);
7234 + switch (tu->otg.state) {
7235 + case OTG_STATE_B_IDLE:
7236 + /* Enable the gadget driver */
7237 + if (tu->otg.gadget)
7238 + usb_gadget_vbus_connect(tu->otg.gadget);
7239 + /* Set B-session valid and not B-sessio ended to indicate
7240 + * Vbus to be ok. */
7241 + l = omap_readl(OTG_CTRL);
7242 + l &= ~OTG_BSESSEND;
7243 + l |= OTG_BSESSVLD;
7244 + omap_writel(l, OTG_CTRL);
7246 + tu->otg.state = OTG_STATE_B_PERIPHERAL;
7248 + case OTG_STATE_A_IDLE:
7249 + /* Session is now valid assuming the USB hub is driving Vbus */
7250 + tu->otg.state = OTG_STATE_A_HOST;
7256 + printk("USB cable connected\n");
7258 + switch (tu->otg.state) {
7259 + case OTG_STATE_B_PERIPHERAL:
7260 + if (tu->otg.gadget)
7261 + usb_gadget_vbus_disconnect(tu->otg.gadget);
7262 + tu->otg.state = OTG_STATE_B_IDLE;
7264 + case OTG_STATE_A_HOST:
7265 + tu->otg.state = OTG_STATE_A_IDLE;
7270 + printk("USB cable disconnected\n");
7274 + prev_state = tu->vbus_state;
7275 + tu->vbus_state = reg & 0x01;
7276 + if (prev_state != tu->vbus_state)
7277 + sysfs_notify(&tu->pt_dev->dev.kobj, NULL, "vbus_state");
7280 +static void tahvo_usb_become_host(struct tahvo_usb *tu)
7284 + /* Clear system and transceiver controlled bits
7285 + * also mark the A-session is always valid */
7288 + l = omap_readl(OTG_CTRL);
7289 + l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK);
7290 + l |= OTG_ASESSVLD;
7291 + omap_writel(l, OTG_CTRL);
7293 + /* Power up the transceiver in USB host mode */
7294 + tahvo_write_reg(TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND |
7295 + USBR_MASTER_SW2 | USBR_MASTER_SW1);
7296 + tu->otg.state = OTG_STATE_A_IDLE;
7298 + check_vbus_state(tu);
7301 +static void tahvo_usb_stop_host(struct tahvo_usb *tu)
7304 + tu->otg.state = OTG_STATE_A_IDLE;
7307 +static void tahvo_usb_become_peripheral(struct tahvo_usb *tu)
7311 + /* Clear system and transceiver controlled bits
7312 + * and enable ID to mark peripheral mode and
7313 + * BSESSEND to mark no Vbus */
7315 + l = omap_readl(OTG_CTRL);
7316 + l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
7317 + l |= OTG_ID | OTG_BSESSEND;
7318 + omap_writel(l, OTG_CTRL);
7320 + /* Power up transceiver and set it in USB perhiperal mode */
7321 + tahvo_write_reg(TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | USBR_NSUSPEND | USBR_SLAVE_SW);
7322 + tu->otg.state = OTG_STATE_B_IDLE;
7324 + check_vbus_state(tu);
7327 +static void tahvo_usb_stop_peripheral(struct tahvo_usb *tu)
7331 + l = omap_readl(OTG_CTRL);
7332 + l &= ~OTG_BSESSVLD;
7333 + l |= OTG_BSESSEND;
7334 + omap_writel(l, OTG_CTRL);
7336 + if (tu->otg.gadget)
7337 + usb_gadget_vbus_disconnect(tu->otg.gadget);
7338 + tu->otg.state = OTG_STATE_B_IDLE;
7342 +static void tahvo_usb_power_off(struct tahvo_usb *tu)
7347 + /* Disable gadget controller if any */
7348 + if (tu->otg.gadget)
7349 + usb_gadget_vbus_disconnect(tu->otg.gadget);
7353 + /* Disable OTG and interrupts */
7354 + if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
7358 + l = omap_readl(OTG_CTRL);
7359 + l &= ~(OTG_CTRL_XCVR_MASK | OTG_CTRL_SYS_MASK | OTG_BSESSVLD);
7360 + l |= id | OTG_BSESSEND;
7361 + omap_writel(l, OTG_CTRL);
7362 + omap_writew(0, OTG_IRQ_EN);
7364 + l = omap_readl(OTG_SYSCON_2);
7366 + omap_writel(l, OTG_SYSCON_2);
7368 + l = omap_readl(OTG_SYSCON_1);
7370 + omap_writel(l, OTG_SYSCON_1);
7372 + /* Power off transceiver */
7373 + tahvo_write_reg(TAHVO_REG_USBR, 0);
7374 + tu->otg.state = OTG_STATE_UNDEFINED;
7378 +static int tahvo_usb_set_power(struct otg_transceiver *dev, unsigned mA)
7380 + struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
7382 + dev_dbg(&tu->pt_dev->dev, "set_power %d mA\n", mA);
7384 + if (dev->state == OTG_STATE_B_PERIPHERAL) {
7385 + /* REVISIT: Can Tahvo charge battery from VBUS? */
7390 +static int tahvo_usb_set_suspend(struct otg_transceiver *dev, int suspend)
7392 + struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
7395 + dev_dbg(&tu->pt_dev->dev, "set_suspend\n");
7397 + w = tahvo_read_reg(TAHVO_REG_USBR);
7399 + w &= ~USBR_NSUSPEND;
7401 + w |= USBR_NSUSPEND;
7402 + tahvo_write_reg(TAHVO_REG_USBR, w);
7407 +static int tahvo_usb_start_srp(struct otg_transceiver *dev)
7409 + struct tahvo_usb *tu = container_of(dev, struct tahvo_usb, otg);
7412 + dev_dbg(&tu->pt_dev->dev, "start_srp\n");
7414 + if (!dev || tu->otg.state != OTG_STATE_B_IDLE)
7417 + otg_ctrl = omap_readl(OTG_CTRL);
7418 + if (!(otg_ctrl & OTG_BSESSEND))
7421 + otg_ctrl |= OTG_B_BUSREQ;
7422 + otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_SYS_MASK;
7423 + omap_writel(otg_ctrl, OTG_CTRL);
7424 + tu->otg.state = OTG_STATE_B_SRP_INIT;
7429 +static int tahvo_usb_start_hnp(struct otg_transceiver *otg)
7431 + struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
7433 + dev_dbg(&tu->pt_dev->dev, "start_hnp\n");
7434 +#ifdef CONFIG_USB_OTG
7435 + /* REVISIT: Add this for OTG */
7440 +static int tahvo_usb_set_host(struct otg_transceiver *otg, struct usb_bus *host)
7442 + struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
7445 + dev_dbg(&tu->pt_dev->dev, "set_host %p\n", host);
7450 +#if defined(CONFIG_USB_OTG) || !defined(CONFIG_USB_GADGET_OMAP)
7452 + mutex_lock(&tu->serialize);
7454 + if (host == NULL) {
7455 + if (TAHVO_MODE(tu) == TAHVO_MODE_HOST)
7456 + tahvo_usb_power_off(tu);
7457 + tu->otg.host = NULL;
7458 + mutex_unlock(&tu->serialize);
7462 + l = omap_readl(OTG_SYSCON_1);
7463 + l &= ~(OTG_IDLE_EN | HST_IDLE_EN | DEV_IDLE_EN);
7464 + omap_writel(l, OTG_SYSCON_1);
7466 + if (TAHVO_MODE(tu) == TAHVO_MODE_HOST) {
7467 + tu->otg.host = NULL;
7468 + tahvo_usb_become_host(tu);
7472 + tu->otg.host = host;
7474 + mutex_unlock(&tu->serialize);
7476 + /* No host mode configured, so do not allow host controlled to be set */
7483 +static int tahvo_usb_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
7485 + struct tahvo_usb *tu = container_of(otg, struct tahvo_usb, otg);
7487 + dev_dbg(&tu->pt_dev->dev, "set_peripheral %p\n", gadget);
7492 +#if defined(CONFIG_USB_OTG) || defined(CONFIG_USB_GADGET_OMAP)
7494 + mutex_lock(&tu->serialize);
7497 + if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
7498 + tahvo_usb_power_off(tu);
7499 + tu->otg.gadget = NULL;
7500 + mutex_unlock(&tu->serialize);
7504 + tu->otg.gadget = gadget;
7505 + if (TAHVO_MODE(tu) == TAHVO_MODE_PERIPHERAL)
7506 + tahvo_usb_become_peripheral(tu);
7508 + mutex_unlock(&tu->serialize);
7510 + /* No gadget mode configured, so do not allow host controlled to be set */
7517 +static void tahvo_usb_irq_work(struct work_struct *work)
7519 + struct tahvo_usb *tu = container_of(work, struct tahvo_usb, irq_work);
7521 + mutex_lock(&tu->serialize);
7522 + check_vbus_state(tu);
7523 + mutex_unlock(&tu->serialize);
7526 +static void tahvo_usb_vbus_interrupt(unsigned long arg)
7528 + struct tahvo_usb *tu = (struct tahvo_usb *) arg;
7530 + tahvo_ack_irq(TAHVO_INT_VBUSON);
7531 + /* Seems we need this to acknowledge the interrupt */
7532 + tahvo_read_reg(TAHVO_REG_IDSR);
7533 + schedule_work(&tu->irq_work);
7536 +#ifdef CONFIG_USB_OTG
7537 +static ssize_t otg_mode_show(struct device *device,
7538 + struct device_attribute *attr, char *buf)
7540 + struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
7541 + switch (tu->tahvo_mode) {
7542 + case TAHVO_MODE_HOST:
7543 + return sprintf(buf, "host\n");
7544 + case TAHVO_MODE_PERIPHERAL:
7545 + return sprintf(buf, "peripheral\n");
7547 + return sprintf(buf, "unknown\n");
7550 +static ssize_t otg_mode_store(struct device *device,
7551 + struct device_attribute *attr,
7552 + const char *buf, size_t count)
7554 + struct tahvo_usb *tu = (struct tahvo_usb*) device->driver_data;
7558 + mutex_lock(&tu->serialize);
7559 + if (strncmp(buf, "host", 4) == 0) {
7560 + if (tu->tahvo_mode == TAHVO_MODE_PERIPHERAL)
7561 + tahvo_usb_stop_peripheral(tu);
7562 + tu->tahvo_mode = TAHVO_MODE_HOST;
7563 + if (tu->otg.host) {
7564 + printk(KERN_INFO "Selected HOST mode: host controller present.\n");
7565 + tahvo_usb_become_host(tu);
7567 + printk(KERN_INFO "Selected HOST mode: no host controller, powering off.\n");
7568 + tahvo_usb_power_off(tu);
7570 + } else if (strncmp(buf, "peripheral", 10) == 0) {
7571 + if (tu->tahvo_mode == TAHVO_MODE_HOST)
7572 + tahvo_usb_stop_host(tu);
7573 + tu->tahvo_mode = TAHVO_MODE_PERIPHERAL;
7574 + if (tu->otg.gadget) {
7575 + printk(KERN_INFO "Selected PERIPHERAL mode: gadget driver present.\n");
7576 + tahvo_usb_become_peripheral(tu);
7578 + printk(KERN_INFO "Selected PERIPHERAL mode: no gadget driver, powering off.\n");
7579 + tahvo_usb_power_off(tu);
7584 + mutex_unlock(&tu->serialize);
7588 +static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
7591 +static int tahvo_usb_probe(struct device *dev)
7593 + struct tahvo_usb *tu;
7596 + dev_dbg(dev, "probe\n");
7598 + /* Create driver data */
7599 + tu = kmalloc(sizeof(*tu), GFP_KERNEL);
7602 + memset(tu, 0, sizeof(*tu));
7603 + tu->pt_dev = container_of(dev, struct platform_device, dev);
7604 +#ifdef CONFIG_USB_OTG
7605 + /* Default mode */
7606 +#ifdef CONFIG_CBUS_TAHVO_USB_HOST_BY_DEFAULT
7607 + tu->tahvo_mode = TAHVO_MODE_HOST;
7609 + tu->tahvo_mode = TAHVO_MODE_PERIPHERAL;
7613 + INIT_WORK(&tu->irq_work, tahvo_usb_irq_work);
7614 + mutex_init(&tu->serialize);
7616 + /* Set initial state, so that we generate kevents only on
7617 + * state changes */
7618 + tu->vbus_state = tahvo_read_reg(TAHVO_REG_IDSR) & 0x01;
7620 + /* We cannot enable interrupt until omap_udc is initialized */
7621 + ret = tahvo_request_irq(TAHVO_INT_VBUSON, tahvo_usb_vbus_interrupt,
7622 + (unsigned long) tu, "vbus_interrupt");
7625 + printk(KERN_ERR "Could not register Tahvo interrupt for VBUS\n");
7630 + ret = device_create_file(dev, &dev_attr_vbus_state);
7631 +#ifdef CONFIG_USB_OTG
7632 + ret |= device_create_file(dev, &dev_attr_otg_mode);
7635 + printk(KERN_ERR "attribute creation failed: %d\n", ret);
7637 + /* Create OTG interface */
7638 + tahvo_usb_power_off(tu);
7639 + tu->otg.state = OTG_STATE_UNDEFINED;
7640 + tu->otg.label = DRIVER_NAME;
7641 + tu->otg.set_host = tahvo_usb_set_host;
7642 + tu->otg.set_peripheral = tahvo_usb_set_peripheral;
7643 + tu->otg.set_power = tahvo_usb_set_power;
7644 + tu->otg.set_suspend = tahvo_usb_set_suspend;
7645 + tu->otg.start_srp = tahvo_usb_start_srp;
7646 + tu->otg.start_hnp = tahvo_usb_start_hnp;
7648 + ret = otg_set_transceiver(&tu->otg);
7650 + printk(KERN_ERR "Cannot register USB transceiver\n");
7652 + tahvo_free_irq(TAHVO_INT_VBUSON);
7656 + dev->driver_data = tu;
7658 + /* Act upon current vbus state once at startup. A vbus state irq may or
7659 + * may not be generated in addition to this. */
7660 + schedule_work(&tu->irq_work);
7664 +static int tahvo_usb_remove(struct device *dev)
7666 + dev_dbg(dev, "remove\n");
7668 + tahvo_free_irq(TAHVO_INT_VBUSON);
7669 + flush_scheduled_work();
7670 + otg_set_transceiver(0);
7671 + device_remove_file(dev, &dev_attr_vbus_state);
7672 +#ifdef CONFIG_USB_OTG
7673 + device_remove_file(dev, &dev_attr_otg_mode);
7678 +static struct device_driver tahvo_usb_driver = {
7679 + .name = "tahvo-usb",
7680 + .bus = &platform_bus_type,
7681 + .probe = tahvo_usb_probe,
7682 + .remove = tahvo_usb_remove,
7685 +static struct platform_device tahvo_usb_device = {
7686 + .name = "tahvo-usb",
7690 +static int __init tahvo_usb_init(void)
7694 + printk(KERN_INFO "Tahvo USB transceiver driver initializing\n");
7695 + ret = driver_register(&tahvo_usb_driver);
7698 + ret = platform_device_register(&tahvo_usb_device);
7700 + driver_unregister(&tahvo_usb_driver);
7703 + ret = driver_register(&omap_otg_driver);
7705 + platform_device_unregister(&tahvo_usb_device);
7706 + driver_unregister(&tahvo_usb_driver);
7712 +subsys_initcall(tahvo_usb_init);
7714 +static void __exit tahvo_usb_exit(void)
7716 + driver_unregister(&omap_otg_driver);
7717 + platform_device_unregister(&tahvo_usb_device);
7718 + driver_unregister(&tahvo_usb_driver);
7720 +module_exit(tahvo_usb_exit);
7722 +MODULE_DESCRIPTION("Tahvo USB OTG Transceiver Driver");
7723 +MODULE_LICENSE("GPL");
7724 +MODULE_AUTHOR("Juha Yrjölä, Tony Lindgren, and Timo Teräs");
7726 +++ b/drivers/cbus/tahvo-user.c
7729 + * drivers/cbus/tahvo-user.c
7731 + * Tahvo user space interface functions
7733 + * Copyright (C) 2004, 2005 Nokia Corporation
7735 + * Written by Mikko Ylinen <mikko.k.ylinen@nokia.com>
7737 + * This file is subject to the terms and conditions of the GNU General
7738 + * Public License. See the file "COPYING" in the main directory of this
7739 + * archive for more details.
7741 + * This program is distributed in the hope that it will be useful,
7742 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7743 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7744 + * GNU General Public License for more details.
7746 + * You should have received a copy of the GNU General Public License
7747 + * along with this program; if not, write to the Free Software
7748 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7751 +#include <linux/types.h>
7752 +#include <linux/kernel.h>
7753 +#include <linux/interrupt.h>
7754 +#include <linux/module.h>
7755 +#include <linux/init.h>
7756 +#include <linux/fs.h>
7757 +#include <linux/miscdevice.h>
7758 +#include <linux/poll.h>
7759 +#include <linux/list.h>
7760 +#include <linux/spinlock.h>
7761 +#include <linux/mutex.h>
7763 +#include <asm/uaccess.h>
7767 +#include "user_retu_tahvo.h"
7769 +/* Maximum size of IRQ node buffer/pool */
7770 +#define TAHVO_MAX_IRQ_BUF_LEN 16
7772 +#define PFX "tahvo-user: "
7774 +/* Bitmap for marking the interrupt sources as having the handlers */
7775 +static u32 tahvo_irq_bits;
7777 +/* For allowing only one user process to subscribe to the tahvo interrupts */
7778 +static struct file *tahvo_irq_subscr = NULL;
7780 +/* For poll and IRQ passing */
7783 + struct list_head node;
7786 +static spinlock_t tahvo_irqs_lock;
7787 +static struct tahvo_irq *tahvo_irq_block;
7788 +static LIST_HEAD(tahvo_irqs);
7789 +static LIST_HEAD(tahvo_irqs_reserve);
7791 +/* Wait queue - used when user wants to read the device */
7792 +DECLARE_WAIT_QUEUE_HEAD(tahvo_user_waitqueue);
7794 +/* Semaphore to protect irq subscription sequence */
7795 +static struct mutex tahvo_mutex;
7797 +/* This array specifies TAHVO register types (read/write/toggle) */
7798 +static const u8 tahvo_access_bits[] = {
7816 + * The handler for all TAHVO interrupts.
7818 + * arg is the interrupt source in TAHVO.
7820 +static void tahvo_user_irq_handler(unsigned long arg)
7822 + struct tahvo_irq *irq;
7824 + /* user has to re-enable the interrupt once ready
7825 + * for receiving them again */
7826 + tahvo_disable_irq(arg);
7827 + tahvo_ack_irq(arg);
7829 + spin_lock(&tahvo_irqs_lock);
7830 + if (list_empty(&tahvo_irqs_reserve)) {
7831 + spin_unlock(&tahvo_irqs_lock);
7834 + irq = list_entry((&tahvo_irqs_reserve)->next, struct tahvo_irq, node);
7836 + list_move_tail(&irq->node, &tahvo_irqs);
7837 + spin_unlock(&tahvo_irqs_lock);
7839 + /* wake up waiting thread */
7840 + wake_up(&tahvo_user_waitqueue);
7844 + * This routine sets up the interrupt handler and marks an interrupt source
7845 + * in TAHVO as a candidate for signal delivery to the user process.
7847 +static int tahvo_user_subscribe_to_irq(int id, struct file *filp)
7851 + mutex_lock(&tahvo_mutex);
7852 + if ((tahvo_irq_subscr != NULL) && (tahvo_irq_subscr != filp)) {
7853 + mutex_unlock(&tahvo_mutex);
7856 + /* Store the file pointer of the first user process registering IRQs */
7857 + tahvo_irq_subscr = filp;
7858 + mutex_unlock(&tahvo_mutex);
7860 + if (tahvo_irq_bits & (1 << id))
7863 + ret = tahvo_request_irq(id, tahvo_user_irq_handler, id, "");
7867 + /* Mark that this interrupt has a handler */
7868 + tahvo_irq_bits |= 1 << id;
7874 + * Unregister all TAHVO interrupt handlers
7876 +static void tahvo_unreg_irq_handlers(void)
7880 + if (!tahvo_irq_bits)
7883 + for (id = 0; id < MAX_TAHVO_IRQ_HANDLERS; id++)
7884 + if (tahvo_irq_bits & (1 << id))
7885 + tahvo_free_irq(id);
7887 + tahvo_irq_bits = 0;
7891 + * Write to TAHVO register.
7892 + * Returns 0 upon success, a negative error value otherwise.
7894 +static int tahvo_user_write_with_mask(u32 field, u16 value)
7899 + unsigned long flags;
7901 + mask = MASK(field);
7904 + /* Detect bad mask and reg */
7905 + if (mask == 0 || reg > TAHVO_REG_MAX ||
7906 + tahvo_access_bits[reg] == READ_ONLY) {
7907 + printk(KERN_ERR PFX "invalid arguments (reg=%#x, mask=%#x)\n",
7912 + /* Justify value according to mask */
7913 + while (!(mask & 1)) {
7914 + value = value << 1;
7918 + spin_lock_irqsave(&tahvo_lock, flags);
7919 + if (tahvo_access_bits[reg] == TOGGLE) {
7920 + /* No need to detect previous content of register */
7923 + /* Read current value of register */
7924 + tmp = tahvo_read_reg(reg);
7926 + /* Generate a new value */
7927 + tmp = (tmp & ~MASK(field)) | (value & MASK(field));
7928 + /* Write data to TAHVO */
7929 + tahvo_write_reg(reg, tmp);
7930 + spin_unlock_irqrestore(&tahvo_lock, flags);
7936 + * Read TAHVO register.
7938 +static u32 tahvo_user_read_with_mask(u32 field)
7943 + mask = MASK(field);
7946 + /* Detect bad mask and reg */
7947 + if (mask == 0 || reg > TAHVO_REG_MAX) {
7948 + printk(KERN_ERR PFX "invalid arguments (reg=%#x, mask=%#x)\n",
7953 + /* Read the register */
7954 + value = tahvo_read_reg(reg) & mask;
7956 + /* Right justify value */
7957 + while (!(mask & 1)) {
7958 + value = value >> 1;
7968 +static int tahvo_close(struct inode *inode, struct file *filp)
7970 + /* Unregister all interrupts that have been registered */
7971 + if (tahvo_irq_subscr == filp) {
7972 + tahvo_unreg_irq_handlers();
7973 + tahvo_irq_subscr = NULL;
7980 + * Device control (ioctl)
7982 +static int tahvo_ioctl(struct inode *inode, struct file *filp,
7983 + unsigned int cmd, unsigned long arg)
7985 + struct retu_tahvo_write_parms par;
7989 + case URT_IOCT_IRQ_SUBSCR:
7990 + return tahvo_user_subscribe_to_irq(arg, filp);
7991 + case TAHVO_IOCH_READ:
7992 + return tahvo_user_read_with_mask(arg);
7993 + case TAHVO_IOCX_WRITE:
7994 + ret = copy_from_user(&par, (void __user *) arg, sizeof(par));
7996 + printk(KERN_ERR "copy_from_user failed: %d\n", ret);
7997 + par.result = tahvo_user_write_with_mask(par.field, par.value);
7998 + ret = copy_to_user((void __user *) arg, &par, sizeof(par));
8000 + printk(KERN_ERR "copy_to_user failed: %d\n", ret);
8003 + return -ENOIOCTLCMD;
8009 + * Read from device
8011 +static ssize_t tahvo_read(struct file *filp, char *buf, size_t count,
8014 + struct tahvo_irq *irq;
8018 + /* read not permitted if neither filp nor anyone has registered IRQs */
8019 + if (tahvo_irq_subscr != filp)
8022 + if ((count < sizeof(u32)) || ((count % sizeof(u32)) != 0))
8025 + nr = count / sizeof(u32);
8027 + for (i = 0; i < nr; i++) {
8028 + unsigned long flags;
8032 + ret = wait_event_interruptible(tahvo_user_waitqueue,
8033 + !list_empty(&tahvo_irqs));
8037 + spin_lock_irqsave(&tahvo_irqs_lock, flags);
8038 + irq = list_entry((&tahvo_irqs)->next, struct tahvo_irq, node);
8040 + list_move(&irq->node, &tahvo_irqs_reserve);
8041 + spin_unlock_irqrestore(&tahvo_irqs_lock, flags);
8043 + ret = copy_to_user(buf + i * sizeof(irq_id), &irq_id,
8046 + printk(KERN_ERR "copy_to_user failed: %d\n", ret);
8055 +static unsigned tahvo_poll(struct file *filp, struct poll_table_struct *pt)
8057 + if (!list_empty(&tahvo_irqs))
8060 + poll_wait(filp, &tahvo_user_waitqueue, pt);
8062 + if (!list_empty(&tahvo_irqs))
8068 +static struct file_operations tahvo_user_fileops = {
8069 + .owner = THIS_MODULE,
8070 + .ioctl = tahvo_ioctl,
8071 + .read = tahvo_read,
8072 + .release = tahvo_close,
8073 + .poll = tahvo_poll
8076 +static struct miscdevice tahvo_device = {
8077 + .minor = MISC_DYNAMIC_MINOR,
8079 + .fops = &tahvo_user_fileops
8085 + * @return 0 if successful, error value otherwise.
8087 +int tahvo_user_init(void)
8089 + struct tahvo_irq *irq;
8092 + irq = kmalloc(sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN, GFP_KERNEL);
8093 + if (irq == NULL) {
8094 + printk(KERN_ERR PFX "kmalloc failed\n");
8097 + memset(irq, 0, sizeof(*irq) * TAHVO_MAX_IRQ_BUF_LEN);
8098 + for (i = 0; i < TAHVO_MAX_IRQ_BUF_LEN; i++)
8099 + list_add(&irq[i].node, &tahvo_irqs_reserve);
8101 + tahvo_irq_block = irq;
8103 + spin_lock_init(&tahvo_irqs_lock);
8104 + mutex_init(&tahvo_mutex);
8106 + /* Request a misc device */
8107 + res = misc_register(&tahvo_device);
8109 + printk(KERN_ERR PFX "unable to register misc device for %s\n",
8110 + tahvo_device.name);
8121 +void tahvo_user_cleanup(void)
8123 + /* Unregister our misc device */
8124 + misc_deregister(&tahvo_device);
8125 + /* Unregister and disable all TAHVO interrupts */
8126 + tahvo_unreg_irq_handlers();
8127 + kfree(tahvo_irq_block);
8130 +MODULE_DESCRIPTION("Tahvo ASIC user space functions");
8131 +MODULE_LICENSE("GPL");
8132 +MODULE_AUTHOR("Mikko Ylinen");
8134 +++ b/drivers/cbus/tahvo.c
8137 + * drivers/cbus/tahvo.c
8139 + * Support functions for Tahvo ASIC
8141 + * Copyright (C) 2004, 2005 Nokia Corporation
8143 + * Written by Juha Yrjölä <juha.yrjola@nokia.com>,
8144 + * David Weinehall <david.weinehall@nokia.com>, and
8145 + * Mikko Ylinen <mikko.k.ylinen@nokia.com>
8147 + * This file is subject to the terms and conditions of the GNU General
8148 + * Public License. See the file "COPYING" in the main directory of this
8149 + * archive for more details.
8151 + * This program is distributed in the hope that it will be useful,
8152 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8153 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8154 + * GNU General Public License for more details.
8156 + * You should have received a copy of the GNU General Public License
8157 + * along with this program; if not, write to the Free Software
8158 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8161 +#include <linux/module.h>
8162 +#include <linux/init.h>
8164 +#include <linux/kernel.h>
8165 +#include <linux/errno.h>
8166 +#include <linux/device.h>
8167 +#include <linux/miscdevice.h>
8168 +#include <linux/poll.h>
8169 +#include <linux/fs.h>
8170 +#include <linux/irq.h>
8171 +#include <linux/interrupt.h>
8172 +#include <linux/platform_device.h>
8173 +#include <linux/gpio.h>
8175 +#include <asm/uaccess.h>
8177 +#include <mach/mux.h>
8178 +#include <mach/board.h>
8179 +#include <mach/board-nokia.h>
8184 +#define TAHVO_ID 0x02
8185 +#define PFX "tahvo: "
8187 +static int tahvo_initialized;
8188 +static int tahvo_irq_pin;
8189 +static int tahvo_is_betty;
8191 +static struct tasklet_struct tahvo_tasklet;
8192 +spinlock_t tahvo_lock = SPIN_LOCK_UNLOCKED;
8194 +static struct completion device_release;
8196 +struct tahvo_irq_handler_desc {
8197 + int (*func)(unsigned long);
8198 + unsigned long arg;
8202 +static struct tahvo_irq_handler_desc tahvo_irq_handlers[MAX_TAHVO_IRQ_HANDLERS];
8205 + * tahvo_read_reg - Read a value from a register in Tahvo
8206 + * @reg: the register to read from
8208 + * This function returns the contents of the specified register
8210 +int tahvo_read_reg(int reg)
8212 + BUG_ON(!tahvo_initialized);
8213 + return cbus_read_reg(cbus_host, TAHVO_ID, reg);
8217 + * tahvo_write_reg - Write a value to a register in Tahvo
8218 + * @reg: the register to write to
8219 + * @reg: the value to write to the register
8221 + * This function writes a value to the specified register
8223 +void tahvo_write_reg(int reg, u16 val)
8225 + BUG_ON(!tahvo_initialized);
8226 + cbus_write_reg(cbus_host, TAHVO_ID, reg, val);
8230 + * tahvo_set_clear_reg_bits - set and clear register bits atomically
8231 + * @reg: the register to write to
8232 + * @bits: the bits to set
8234 + * This function sets and clears the specified Tahvo register bits atomically
8236 +void tahvo_set_clear_reg_bits(int reg, u16 set, u16 clear)
8238 + unsigned long flags;
8241 + spin_lock_irqsave(&tahvo_lock, flags);
8242 + w = tahvo_read_reg(reg);
8245 + tahvo_write_reg(reg, w);
8246 + spin_unlock_irqrestore(&tahvo_lock, flags);
8250 + * Disable given TAHVO interrupt
8252 +void tahvo_disable_irq(int id)
8254 + unsigned long flags;
8257 + spin_lock_irqsave(&tahvo_lock, flags);
8258 + mask = tahvo_read_reg(TAHVO_REG_IMR);
8260 + tahvo_write_reg(TAHVO_REG_IMR, mask);
8261 + spin_unlock_irqrestore(&tahvo_lock, flags);
8265 + * Enable given TAHVO interrupt
8267 +void tahvo_enable_irq(int id)
8269 + unsigned long flags;
8272 + spin_lock_irqsave(&tahvo_lock, flags);
8273 + mask = tahvo_read_reg(TAHVO_REG_IMR);
8274 + mask &= ~(1 << id);
8275 + tahvo_write_reg(TAHVO_REG_IMR, mask);
8276 + spin_unlock_irqrestore(&tahvo_lock, flags);
8280 + * Acknowledge given TAHVO interrupt
8282 +void tahvo_ack_irq(int id)
8284 + tahvo_write_reg(TAHVO_REG_IDR, 1 << id);
8287 +static int tahvo_7bit_backlight;
8289 +int tahvo_get_backlight_level(void)
8293 + if (tahvo_7bit_backlight)
8297 + return tahvo_read_reg(TAHVO_REG_LEDPWMR) & mask;
8300 +int tahvo_get_max_backlight_level(void)
8302 + if (tahvo_7bit_backlight)
8308 +void tahvo_set_backlight_level(int level)
8312 + max_level = tahvo_get_max_backlight_level();
8313 + if (level > max_level)
8314 + level = max_level;
8315 + tahvo_write_reg(TAHVO_REG_LEDPWMR, level);
8319 + * TAHVO interrupt handler. Only schedules the tasklet.
8321 +static irqreturn_t tahvo_irq_handler(int irq, void *dev_id)
8323 + tasklet_schedule(&tahvo_tasklet);
8324 + return IRQ_HANDLED;
8330 +static void tahvo_tasklet_handler(unsigned long data)
8332 + struct tahvo_irq_handler_desc *hnd;
8338 + id = tahvo_read_reg(TAHVO_REG_IDR);
8339 + im = ~tahvo_read_reg(TAHVO_REG_IMR);
8345 + for (i = 0; id != 0; i++, id >>= 1) {
8348 + hnd = &tahvo_irq_handlers[i];
8349 + if (hnd->func == NULL) {
8350 + /* Spurious tahvo interrupt - just ack it */
8351 + printk(KERN_INFO "Spurious Tahvo interrupt "
8353 + tahvo_disable_irq(i);
8357 + hnd->func(hnd->arg);
8359 + * Don't acknowledge the interrupt here
8360 + * It must be done explicitly
8367 + * Register the handler for a given TAHVO interrupt source.
8369 +int tahvo_request_irq(int id, void *irq_handler, unsigned long arg, char *name)
8371 + struct tahvo_irq_handler_desc *hnd;
8373 + if (irq_handler == NULL || id >= MAX_TAHVO_IRQ_HANDLERS ||
8375 + printk(KERN_ERR PFX "Invalid arguments to %s\n",
8379 + hnd = &tahvo_irq_handlers[id];
8380 + if (hnd->func != NULL) {
8381 + printk(KERN_ERR PFX "IRQ %d already reserved\n", id);
8384 + printk(KERN_INFO PFX "Registering interrupt %d for device %s\n",
8386 + hnd->func = irq_handler;
8388 + strlcpy(hnd->name, name, sizeof(hnd->name));
8390 + tahvo_ack_irq(id);
8391 + tahvo_enable_irq(id);
8397 + * Unregister the handler for a given TAHVO interrupt source.
8399 +void tahvo_free_irq(int id)
8401 + struct tahvo_irq_handler_desc *hnd;
8403 + if (id >= MAX_TAHVO_IRQ_HANDLERS) {
8404 + printk(KERN_ERR PFX "Invalid argument to %s\n",
8408 + hnd = &tahvo_irq_handlers[id];
8409 + if (hnd->func == NULL) {
8410 + printk(KERN_ERR PFX "IRQ %d already freed\n", id);
8414 + tahvo_disable_irq(id);
8419 + * tahvo_probe - Probe for Tahvo ASIC
8420 + * @dev: the Tahvo device
8422 + * Probe for the Tahvo ASIC and allocate memory
8423 + * for its device-struct if found
8425 +static int __devinit tahvo_probe(struct device *dev)
8427 + const struct omap_em_asic_bb5_config * em_asic_config;
8430 + /* Prepare tasklet */
8431 + tasklet_init(&tahvo_tasklet, tahvo_tasklet_handler, 0);
8433 + em_asic_config = omap_get_config(OMAP_TAG_EM_ASIC_BB5,
8434 + struct omap_em_asic_bb5_config);
8435 + if (em_asic_config == NULL) {
8436 + printk(KERN_ERR PFX "Unable to retrieve config data\n");
8440 + tahvo_initialized = 1;
8442 + rev = tahvo_read_reg(TAHVO_REG_ASICR);
8444 + id = (rev >> 8) & 0xff;
8446 + if ((rev & 0xff) >= 0x50)
8447 + tahvo_7bit_backlight = 1;
8448 + } else if (id == 0x0b) {
8449 + tahvo_is_betty = 1;
8450 + tahvo_7bit_backlight = 1;
8452 + printk(KERN_ERR "Tahvo/Betty chip not found");
8456 + printk(KERN_INFO "%s v%d.%d found\n", tahvo_is_betty ? "Betty" : "Tahvo",
8457 + (rev >> 4) & 0x0f, rev & 0x0f);
8459 + tahvo_irq_pin = em_asic_config->tahvo_irq_gpio;
8461 + if ((ret = gpio_request(tahvo_irq_pin, "TAHVO irq")) < 0) {
8462 + printk(KERN_ERR PFX "Unable to reserve IRQ GPIO\n");
8466 + /* Set the pin as input */
8467 + gpio_direction_input(tahvo_irq_pin);
8469 + /* Rising edge triggers the IRQ */
8470 + set_irq_type(gpio_to_irq(tahvo_irq_pin), IRQ_TYPE_EDGE_RISING);
8472 + /* Mask all TAHVO interrupts */
8473 + tahvo_write_reg(TAHVO_REG_IMR, 0xffff);
8475 + ret = request_irq(gpio_to_irq(tahvo_irq_pin), tahvo_irq_handler, 0,
8478 + printk(KERN_ERR PFX "Unable to register IRQ handler\n");
8479 + gpio_free(tahvo_irq_pin);
8482 +#ifdef CONFIG_CBUS_TAHVO_USER
8483 + /* Initialize user-space interface */
8484 + if (tahvo_user_init() < 0) {
8485 + printk(KERN_ERR "Unable to initialize driver\n");
8486 + free_irq(gpio_to_irq(tahvo_irq_pin), 0);
8487 + gpio_free(tahvo_irq_pin);
8494 +static int tahvo_remove(struct device *dev)
8496 +#ifdef CONFIG_CBUS_TAHVO_USER
8497 + tahvo_user_cleanup();
8499 + /* Mask all TAHVO interrupts */
8500 + tahvo_write_reg(TAHVO_REG_IMR, 0xffff);
8501 + free_irq(gpio_to_irq(tahvo_irq_pin), 0);
8502 + gpio_free(tahvo_irq_pin);
8503 + tasklet_kill(&tahvo_tasklet);
8508 +static void tahvo_device_release(struct device *dev)
8510 + complete(&device_release);
8513 +static struct device_driver tahvo_driver = {
8515 + .bus = &platform_bus_type,
8516 + .probe = tahvo_probe,
8517 + .remove = tahvo_remove,
8520 +static struct platform_device tahvo_device = {
8524 + .release = tahvo_device_release,
8529 + * tahvo_init - initialise Tahvo driver
8531 + * Initialise the Tahvo driver and return 0 if everything worked ok
8533 +static int __init tahvo_init(void)
8537 + printk(KERN_INFO "Tahvo/Betty driver initialising\n");
8539 + init_completion(&device_release);
8541 + if ((ret = driver_register(&tahvo_driver)) < 0)
8544 + if ((ret = platform_device_register(&tahvo_device)) < 0) {
8545 + driver_unregister(&tahvo_driver);
8554 +static void __exit tahvo_exit(void)
8556 + platform_device_unregister(&tahvo_device);
8557 + driver_unregister(&tahvo_driver);
8558 + wait_for_completion(&device_release);
8561 +EXPORT_SYMBOL(tahvo_request_irq);
8562 +EXPORT_SYMBOL(tahvo_free_irq);
8563 +EXPORT_SYMBOL(tahvo_enable_irq);
8564 +EXPORT_SYMBOL(tahvo_disable_irq);
8565 +EXPORT_SYMBOL(tahvo_ack_irq);
8566 +EXPORT_SYMBOL(tahvo_read_reg);
8567 +EXPORT_SYMBOL(tahvo_write_reg);
8568 +EXPORT_SYMBOL(tahvo_get_backlight_level);
8569 +EXPORT_SYMBOL(tahvo_get_max_backlight_level);
8570 +EXPORT_SYMBOL(tahvo_set_backlight_level);
8572 +subsys_initcall(tahvo_init);
8573 +module_exit(tahvo_exit);
8575 +MODULE_DESCRIPTION("Tahvo ASIC control");
8576 +MODULE_LICENSE("GPL");
8577 +MODULE_AUTHOR("Juha Yrjölä, David Weinehall, and Mikko Ylinen");
8579 +++ b/drivers/cbus/tahvo.h
8582 + * drivers/cbus/tahvo.h
8584 + * Copyright (C) 2004, 2005 Nokia Corporation
8586 + * Written by Juha Yrjölä <juha.yrjola@nokia.com> and
8587 + * David Weinehall <david.weinehall@nokia.com>
8589 + * This file is subject to the terms and conditions of the GNU General
8590 + * Public License. See the file "COPYING" in the main directory of this
8591 + * archive for more details.
8593 + * This program is distributed in the hope that it will be useful,
8594 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8595 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8596 + * GNU General Public License for more details.
8598 + * You should have received a copy of the GNU General Public License
8599 + * along with this program; if not, write to the Free Software
8600 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8603 +#ifndef __DRIVERS_CBUS_TAHVO_H
8604 +#define __DRIVERS_CBUS_TAHVO_H
8606 +#include <linux/types.h>
8609 +#define TAHVO_REG_ASICR 0x00 /* ASIC ID & revision */
8610 +#define TAHVO_REG_IDR 0x01 /* Interrupt ID */
8611 +#define TAHVO_REG_IDSR 0x02 /* Interrupt status */
8612 +#define TAHVO_REG_IMR 0x03 /* Interrupt mask */
8613 +#define TAHVO_REG_LEDPWMR 0x05 /* LED PWM */
8614 +#define TAHVO_REG_USBR 0x06 /* USB control */
8615 +#define TAHVO_REG_MAX 0x0d
8617 +/* Interrupt sources */
8618 +#define TAHVO_INT_VBUSON 0
8620 +#define MAX_TAHVO_IRQ_HANDLERS 8
8622 +int tahvo_read_reg(int reg);
8623 +void tahvo_write_reg(int reg, u16 val);
8624 +void tahvo_set_clear_reg_bits(int reg, u16 set, u16 clear);
8625 +int tahvo_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
8626 +void tahvo_free_irq(int id);
8627 +void tahvo_enable_irq(int id);
8628 +void tahvo_disable_irq(int id);
8629 +void tahvo_ack_irq(int id);
8630 +int tahvo_get_backlight_level(void);
8631 +int tahvo_get_max_backlight_level(void);
8632 +void tahvo_set_backlight_level(int level);
8634 +#ifdef CONFIG_CBUS_TAHVO_USER
8635 +int tahvo_user_init(void);
8636 +void tahvo_user_cleanup(void);
8639 +extern spinlock_t tahvo_lock;
8641 +#endif /* __DRIVERS_CBUS_TAHVO_H */
8643 +++ b/drivers/cbus/user_retu_tahvo.h
8646 + * drivers/cbus/user_retu_tahvo.h
8648 + * Copyright (C) 2004, 2005 Nokia Corporation
8650 + * Written by Mikko Ylinen <mikko.k.ylinen@nokia.com>
8652 + * Definitions and types used by both retu-user and tahvo-user.
8654 + * This file is subject to the terms and conditions of the GNU General
8655 + * Public License. See the file "COPYING" in the main directory of this
8656 + * archive for more details.
8658 + * This program is distributed in the hope that it will be useful,
8659 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8660 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8661 + * GNU General Public License for more details.
8663 + * You should have received a copy of the GNU General Public License
8664 + * along with this program; if not, write to the Free Software
8665 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8668 +#ifndef _USER_RETU_TAHVO_H
8669 +#define _USER_RETU_TAHVO_H
8672 +#define CHIP_RETU 1
8673 +#define CHIP_TAHVO 2
8675 +/* Register access type bits */
8676 +#define READ_ONLY 1
8677 +#define WRITE_ONLY 2
8678 +#define READ_WRITE 3
8681 +#define MASK(field) ((u16)(field & 0xFFFF))
8682 +#define REG(field) ((u16)((field >> 16) & 0x3F))
8684 +/*** IOCTL definitions. These should be kept in sync with user space **********/
8686 +#define URT_IOC_MAGIC '`'
8689 + * IOCTL function naming conventions:
8690 + * ==================================
8691 + * 0 -- No argument and return value
8692 + * S -- Set through a pointer
8693 + * T -- Tell directly with the argument value
8694 + * G -- Reply by setting through a pointer
8695 + * Q -- response is on the return value
8696 + * X -- S and G atomically
8697 + * H -- T and Q atomically
8701 +#define URT_IOCT_IRQ_SUBSCR _IO(URT_IOC_MAGIC, 0)
8704 +#define RETU_IOCH_READ _IO(URT_IOC_MAGIC, 1)
8705 +#define RETU_IOCX_WRITE _IO(URT_IOC_MAGIC, 2)
8706 +#define RETU_IOCH_ADC_READ _IO(URT_IOC_MAGIC, 3)
8709 +#define TAHVO_IOCH_READ _IO(URT_IOC_MAGIC, 4)
8710 +#define TAHVO_IOCX_WRITE _IO(URT_IOC_MAGIC, 5)
8712 +/* This structure is used for writing RETU/TAHVO registers */
8713 +struct retu_tahvo_write_parms {
8720 --- a/drivers/spi/omap_uwire.c
8721 +++ b/drivers/spi/omap_uwire.c
8723 #include <asm/mach-types.h>
8725 #include <mach/mux.h>
8726 -#include <mach/omap730.h> /* OMAP730_IO_CONF registers */
8727 +#include <mach/omap7xx.h> /* OMAP7XX_IO_CONF registers */
8730 /* FIXME address is now a platform device resource,
8731 @@ -504,7 +504,7 @@ static int __init uwire_probe(struct pla
8733 clk_enable(uwire->ck);
8735 - if (cpu_is_omap730())
8736 + if (cpu_is_omap7xx())
8737 uwire_idx_shift = 1;
8739 uwire_idx_shift = 2;
8740 @@ -573,8 +573,8 @@ static int __init omap_uwire_init(void)
8742 if (machine_is_omap_perseus2()) {
8743 /* configure pins: MPU_UW_nSCS1, MPU_UW_SDO, MPU_UW_SCLK */
8744 - int val = omap_readl(OMAP730_IO_CONF_9) & ~0x00EEE000;
8745 - omap_writel(val | 0x00AAA000, OMAP730_IO_CONF_9);
8746 + int val = omap_readl(OMAP7XX_IO_CONF_9) & ~0x00EEE000;
8747 + omap_writel(val | 0x00AAA000, OMAP7XX_IO_CONF_9);
8750 return platform_driver_probe(&uwire_driver, uwire_probe);
8751 --- a/drivers/usb/Kconfig
8752 +++ b/drivers/usb/Kconfig
8753 @@ -60,6 +60,7 @@ config USB_ARCH_HAS_EHCI
8754 default y if ARCH_IXP4XX
8755 default y if ARCH_W90X900
8756 default y if ARCH_AT91SAM9G45
8757 + default y if ARCH_OMAP34XX
8760 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
8761 --- a/drivers/usb/host/ehci-hcd.c
8762 +++ b/drivers/usb/host/ehci-hcd.c
8763 @@ -1111,6 +1111,11 @@ MODULE_LICENSE ("GPL");
8764 #define PLATFORM_DRIVER ehci_hcd_au1xxx_driver
8767 +#ifdef CONFIG_ARCH_OMAP34XX
8768 +#include "ehci-omap.c"
8769 +#define PLATFORM_DRIVER ehci_hcd_omap_driver
8772 #ifdef CONFIG_PPC_PS3
8773 #include "ehci-ps3.c"
8774 #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
8776 +++ b/drivers/usb/host/ehci-omap.c
8779 + * ehci-omap.c - driver for USBHOST on OMAP 34xx processor
8781 + * Bus Glue for OMAP34xx USBHOST 3 port EHCI controller
8782 + * Tested on OMAP3430 ES2.0 SDP
8784 + * Copyright (C) 2007-2008 Texas Instruments, Inc.
8785 + * Author: Vikram Pandita <vikram.pandita@ti.com>
8787 + * Copyright (C) 2009 Nokia Corporation
8788 + * Contact: Felipe Balbi <felipe.balbi@nokia.com>
8790 + * Based on "ehci-fsl.c" and "ehci-au1xxx.c" ehci glue layers
8792 + * This program is free software; you can redistribute it and/or modify
8793 + * it under the terms of the GNU General Public License as published by
8794 + * the Free Software Foundation; either version 2 of the License, or
8795 + * (at your option) any later version.
8797 + * This program is distributed in the hope that it will be useful,
8798 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
8799 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8800 + * GNU General Public License for more details.
8802 + * You should have received a copy of the GNU General Public License
8803 + * along with this program; if not, write to the Free Software
8804 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8806 + * TODO (last updated Feb 23rd, 2009):
8807 + * - add kernel-doc
8808 + * - enable AUTOIDLE
8809 + * - move DPLL5 programming to clock fw
8810 + * - add suspend/resume
8811 + * - move workarounds to board-files
8814 +#include <linux/platform_device.h>
8815 +#include <linux/clk.h>
8816 +#include <linux/gpio.h>
8817 +#include <mach/usb.h>
8820 + * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES
8821 + * Use ehci_omap_readl()/ehci_omap_writel() functions
8824 +/* TLL Register Set */
8825 +#define OMAP_USBTLL_REVISION (0x00)
8826 +#define OMAP_USBTLL_SYSCONFIG (0x10)
8827 +#define OMAP_USBTLL_SYSCONFIG_CACTIVITY (1 << 8)
8828 +#define OMAP_USBTLL_SYSCONFIG_SIDLEMODE (1 << 3)
8829 +#define OMAP_USBTLL_SYSCONFIG_ENAWAKEUP (1 << 2)
8830 +#define OMAP_USBTLL_SYSCONFIG_SOFTRESET (1 << 1)
8831 +#define OMAP_USBTLL_SYSCONFIG_AUTOIDLE (1 << 0)
8833 +#define OMAP_USBTLL_SYSSTATUS (0x14)
8834 +#define OMAP_USBTLL_SYSSTATUS_RESETDONE (1 << 0)
8836 +#define OMAP_USBTLL_IRQSTATUS (0x18)
8837 +#define OMAP_USBTLL_IRQENABLE (0x1C)
8839 +#define OMAP_TLL_SHARED_CONF (0x30)
8840 +#define OMAP_TLL_SHARED_CONF_USB_90D_DDR_EN (1 << 6)
8841 +#define OMAP_TLL_SHARED_CONF_USB_180D_SDR_EN (1 << 5)
8842 +#define OMAP_TLL_SHARED_CONF_USB_DIVRATION (1 << 2)
8843 +#define OMAP_TLL_SHARED_CONF_FCLK_REQ (1 << 1)
8844 +#define OMAP_TLL_SHARED_CONF_FCLK_IS_ON (1 << 0)
8846 +#define OMAP_TLL_CHANNEL_CONF(num) (0x040 + 0x004 * num)
8847 +#define OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF (1 << 11)
8848 +#define OMAP_TLL_CHANNEL_CONF_ULPI_ULPIAUTOIDLE (1 << 10)
8849 +#define OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE (1 << 9)
8850 +#define OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE (1 << 8)
8851 +#define OMAP_TLL_CHANNEL_CONF_CHANEN (1 << 0)
8853 +#define OMAP_TLL_ULPI_FUNCTION_CTRL(num) (0x804 + 0x100 * num)
8854 +#define OMAP_TLL_ULPI_INTERFACE_CTRL(num) (0x807 + 0x100 * num)
8855 +#define OMAP_TLL_ULPI_OTG_CTRL(num) (0x80A + 0x100 * num)
8856 +#define OMAP_TLL_ULPI_INT_EN_RISE(num) (0x80D + 0x100 * num)
8857 +#define OMAP_TLL_ULPI_INT_EN_FALL(num) (0x810 + 0x100 * num)
8858 +#define OMAP_TLL_ULPI_INT_STATUS(num) (0x813 + 0x100 * num)
8859 +#define OMAP_TLL_ULPI_INT_LATCH(num) (0x814 + 0x100 * num)
8860 +#define OMAP_TLL_ULPI_DEBUG(num) (0x815 + 0x100 * num)
8861 +#define OMAP_TLL_ULPI_SCRATCH_REGISTER(num) (0x816 + 0x100 * num)
8863 +#define OMAP_TLL_CHANNEL_COUNT 3
8864 +#define OMAP_TLL_CHANNEL_1_EN_MASK (1 << 1)
8865 +#define OMAP_TLL_CHANNEL_2_EN_MASK (1 << 2)
8866 +#define OMAP_TLL_CHANNEL_3_EN_MASK (1 << 4)
8868 +/* UHH Register Set */
8869 +#define OMAP_UHH_REVISION (0x00)
8870 +#define OMAP_UHH_SYSCONFIG (0x10)
8871 +#define OMAP_UHH_SYSCONFIG_MIDLEMODE (1 << 12)
8872 +#define OMAP_UHH_SYSCONFIG_CACTIVITY (1 << 8)
8873 +#define OMAP_UHH_SYSCONFIG_SIDLEMODE (1 << 3)
8874 +#define OMAP_UHH_SYSCONFIG_ENAWAKEUP (1 << 2)
8875 +#define OMAP_UHH_SYSCONFIG_SOFTRESET (1 << 1)
8876 +#define OMAP_UHH_SYSCONFIG_AUTOIDLE (1 << 0)
8878 +#define OMAP_UHH_SYSSTATUS (0x14)
8879 +#define OMAP_UHH_HOSTCONFIG (0x40)
8880 +#define OMAP_UHH_HOSTCONFIG_ULPI_BYPASS (1 << 0)
8881 +#define OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS (1 << 0)
8882 +#define OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS (1 << 11)
8883 +#define OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS (1 << 12)
8884 +#define OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN (1 << 2)
8885 +#define OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN (1 << 3)
8886 +#define OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN (1 << 4)
8887 +#define OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN (1 << 5)
8888 +#define OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS (1 << 8)
8889 +#define OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS (1 << 9)
8890 +#define OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS (1 << 10)
8892 +#define OMAP_UHH_DEBUG_CSR (0x44)
8894 +/* EHCI Register Set */
8895 +#define EHCI_INSNREG05_ULPI (0xA4)
8896 +#define EHCI_INSNREG05_ULPI_CONTROL_SHIFT 31
8897 +#define EHCI_INSNREG05_ULPI_PORTSEL_SHIFT 24
8898 +#define EHCI_INSNREG05_ULPI_OPSEL_SHIFT 22
8899 +#define EHCI_INSNREG05_ULPI_REGADD_SHIFT 16
8900 +#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
8901 +#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
8903 +/*-------------------------------------------------------------------------*/
8905 +static inline void ehci_omap_writel(void __iomem *base, u32 reg, u32 val)
8907 + __raw_writel(val, base + reg);
8910 +static inline u32 ehci_omap_readl(void __iomem *base, u32 reg)
8912 + return __raw_readl(base + reg);
8915 +static inline void ehci_omap_writeb(void __iomem *base, u8 reg, u8 val)
8917 + __raw_writeb(val, base + reg);
8920 +static inline u8 ehci_omap_readb(void __iomem *base, u8 reg)
8922 + return __raw_readb(base + reg);
8925 +/*-------------------------------------------------------------------------*/
8927 +struct ehci_hcd_omap {
8928 + struct ehci_hcd *ehci;
8929 + struct device *dev;
8931 + struct clk *usbhost_ick;
8932 + struct clk *usbhost2_120m_fck;
8933 + struct clk *usbhost1_48m_fck;
8934 + struct clk *usbtll_fck;
8935 + struct clk *usbtll_ick;
8937 + /* FIXME the following two workarounds are
8938 + * board specific not silicon-specific so these
8939 + * should be moved to board-file instead.
8941 + * Maybe someone from TI will know better which
8942 + * board is affected and needs the workarounds
8946 + /* gpio for resetting phy */
8947 + int reset_gpio_port[OMAP3_HS_USB_PORTS];
8949 + /* phy reset workaround */
8952 + /* desired phy_mode: TLL, PHY */
8953 + enum ehci_hcd_omap_mode port_mode[OMAP3_HS_USB_PORTS];
8955 + void __iomem *uhh_base;
8956 + void __iomem *tll_base;
8957 + void __iomem *ehci_base;
8960 +/*-------------------------------------------------------------------------*/
8962 +static void omap_usb_utmi_init(struct ehci_hcd_omap *omap, u8 tll_channel_mask)
8967 + /* Program the 3 TLL channels upfront */
8968 + for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
8969 + reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i));
8971 + /* Disable AutoIdle, BitStuffing and use SDR Mode */
8972 + reg &= ~(OMAP_TLL_CHANNEL_CONF_UTMIAUTOIDLE
8973 + | OMAP_TLL_CHANNEL_CONF_ULPINOBITSTUFF
8974 + | OMAP_TLL_CHANNEL_CONF_ULPIDDRMODE);
8975 + ehci_omap_writel(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i), reg);
8978 + /* Program Common TLL register */
8979 + reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_SHARED_CONF);
8980 + reg |= (OMAP_TLL_SHARED_CONF_FCLK_IS_ON
8981 + | OMAP_TLL_SHARED_CONF_USB_DIVRATION
8982 + | OMAP_TLL_SHARED_CONF_USB_180D_SDR_EN);
8983 + reg &= ~OMAP_TLL_SHARED_CONF_USB_90D_DDR_EN;
8985 + ehci_omap_writel(omap->tll_base, OMAP_TLL_SHARED_CONF, reg);
8987 + /* Enable channels now */
8988 + for (i = 0; i < OMAP_TLL_CHANNEL_COUNT; i++) {
8989 + reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i));
8991 + /* Enable only the reg that is needed */
8992 + if (!(tll_channel_mask & 1<<i))
8995 + reg |= OMAP_TLL_CHANNEL_CONF_CHANEN;
8996 + ehci_omap_writel(omap->tll_base, OMAP_TLL_CHANNEL_CONF(i), reg);
8998 + ehci_omap_writeb(omap->tll_base,
8999 + OMAP_TLL_ULPI_SCRATCH_REGISTER(i), 0xbe);
9000 + dev_dbg(omap->dev, "ULPI_SCRATCH_REG[ch=%d]= 0x%02x\n",
9001 + i+1, ehci_omap_readb(omap->tll_base,
9002 + OMAP_TLL_ULPI_SCRATCH_REGISTER(i)));
9006 +/*-------------------------------------------------------------------------*/
9009 + * - Start the TI USBHOST controller
9011 +static int omap_start_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd)
9013 + unsigned long timeout = jiffies + msecs_to_jiffies(1000);
9014 + u8 tll_ch_mask = 0;
9018 + dev_dbg(omap->dev, "starting TI EHCI USB Controller\n");
9020 + /* Enable Clocks for USBHOST */
9021 + omap->usbhost_ick = clk_get(omap->dev, "usbhost_ick");
9022 + if (IS_ERR(omap->usbhost_ick)) {
9023 + ret = PTR_ERR(omap->usbhost_ick);
9024 + goto err_host_ick;
9026 + clk_enable(omap->usbhost_ick);
9028 + omap->usbhost2_120m_fck = clk_get(omap->dev, "usbhost_120m_fck");
9029 + if (IS_ERR(omap->usbhost2_120m_fck)) {
9030 + ret = PTR_ERR(omap->usbhost2_120m_fck);
9031 + goto err_host_120m_fck;
9033 + clk_enable(omap->usbhost2_120m_fck);
9035 + omap->usbhost1_48m_fck = clk_get(omap->dev, "usbhost_48m_fck");
9036 + if (IS_ERR(omap->usbhost1_48m_fck)) {
9037 + ret = PTR_ERR(omap->usbhost1_48m_fck);
9038 + goto err_host_48m_fck;
9040 + clk_enable(omap->usbhost1_48m_fck);
9042 + if (omap->phy_reset) {
9043 + /* Refer: ISSUE1 */
9044 + if (gpio_is_valid(omap->reset_gpio_port[0])) {
9045 + gpio_request(omap->reset_gpio_port[0],
9046 + "USB1 PHY reset");
9047 + gpio_direction_output(omap->reset_gpio_port[0], 0);
9050 + if (gpio_is_valid(omap->reset_gpio_port[1])) {
9051 + gpio_request(omap->reset_gpio_port[1],
9052 + "USB2 PHY reset");
9053 + gpio_direction_output(omap->reset_gpio_port[1], 0);
9056 + /* Hold the PHY in RESET for enough time till DIR is high */
9060 + /* Configure TLL for 60Mhz clk for ULPI */
9061 + omap->usbtll_fck = clk_get(omap->dev, "usbtll_fck");
9062 + if (IS_ERR(omap->usbtll_fck)) {
9063 + ret = PTR_ERR(omap->usbtll_fck);
9066 + clk_enable(omap->usbtll_fck);
9068 + omap->usbtll_ick = clk_get(omap->dev, "usbtll_ick");
9069 + if (IS_ERR(omap->usbtll_ick)) {
9070 + ret = PTR_ERR(omap->usbtll_ick);
9073 + clk_enable(omap->usbtll_ick);
9075 + /* perform TLL soft reset, and wait until reset is complete */
9076 + ehci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
9077 + OMAP_USBTLL_SYSCONFIG_SOFTRESET);
9079 + /* Wait for TLL reset to complete */
9080 + while (!(ehci_omap_readl(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
9081 + & OMAP_USBTLL_SYSSTATUS_RESETDONE)) {
9084 + if (time_after(jiffies, timeout)) {
9085 + dev_dbg(omap->dev, "operation timed out\n");
9087 + goto err_sys_status;
9091 + dev_dbg(omap->dev, "TLL RESET DONE\n");
9093 + /* (1<<3) = no idle mode only for initial debugging */
9094 + ehci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG,
9095 + OMAP_USBTLL_SYSCONFIG_ENAWAKEUP |
9096 + OMAP_USBTLL_SYSCONFIG_SIDLEMODE |
9097 + OMAP_USBTLL_SYSCONFIG_CACTIVITY);
9100 + /* Put UHH in NoIdle/NoStandby mode */
9101 + reg = ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSCONFIG);
9102 + reg |= (OMAP_UHH_SYSCONFIG_ENAWAKEUP
9103 + | OMAP_UHH_SYSCONFIG_SIDLEMODE
9104 + | OMAP_UHH_SYSCONFIG_CACTIVITY
9105 + | OMAP_UHH_SYSCONFIG_MIDLEMODE);
9106 + reg &= ~OMAP_UHH_SYSCONFIG_AUTOIDLE;
9108 + ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
9110 + reg = ehci_omap_readl(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
9112 + /* setup ULPI bypass and burst configurations */
9113 + reg |= (OMAP_UHH_HOSTCONFIG_INCR4_BURST_EN
9114 + | OMAP_UHH_HOSTCONFIG_INCR8_BURST_EN
9115 + | OMAP_UHH_HOSTCONFIG_INCR16_BURST_EN);
9116 + reg &= ~OMAP_UHH_HOSTCONFIG_INCRX_ALIGN_EN;
9118 + if (omap->port_mode[0] == EHCI_HCD_OMAP_MODE_UNKNOWN)
9119 + reg &= ~OMAP_UHH_HOSTCONFIG_P1_CONNECT_STATUS;
9120 + if (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_UNKNOWN)
9121 + reg &= ~OMAP_UHH_HOSTCONFIG_P2_CONNECT_STATUS;
9122 + if (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_UNKNOWN)
9123 + reg &= ~OMAP_UHH_HOSTCONFIG_P3_CONNECT_STATUS;
9125 + /* Bypass the TLL module for PHY mode operation */
9126 + if (omap_rev() <= OMAP3430_REV_ES2_1) {
9127 + dev_dbg(omap->dev, "OMAP3 ES version <= ES2.1 \n");
9128 + if ((omap->port_mode[0] == EHCI_HCD_OMAP_MODE_PHY) ||
9129 + (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_PHY) ||
9130 + (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_PHY))
9131 + reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
9133 + reg |= OMAP_UHH_HOSTCONFIG_ULPI_BYPASS;
9135 + dev_dbg(omap->dev, "OMAP3 ES version > ES2.1\n");
9136 + if (omap->port_mode[0] == EHCI_HCD_OMAP_MODE_PHY)
9137 + reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
9138 + else if (omap->port_mode[0] == EHCI_HCD_OMAP_MODE_TLL)
9139 + reg |= OMAP_UHH_HOSTCONFIG_ULPI_P1_BYPASS;
9141 + if (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_PHY)
9142 + reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS;
9143 + else if (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_TLL)
9144 + reg |= OMAP_UHH_HOSTCONFIG_ULPI_P2_BYPASS;
9146 + if (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_PHY)
9147 + reg &= ~OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS;
9148 + else if (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_TLL)
9149 + reg |= OMAP_UHH_HOSTCONFIG_ULPI_P3_BYPASS;
9152 + ehci_omap_writel(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
9153 + dev_dbg(omap->dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
9156 + if ((omap->port_mode[0] == EHCI_HCD_OMAP_MODE_TLL) ||
9157 + (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_TLL) ||
9158 + (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_TLL)) {
9160 + if (omap->port_mode[0] == EHCI_HCD_OMAP_MODE_TLL)
9161 + tll_ch_mask |= OMAP_TLL_CHANNEL_1_EN_MASK;
9162 + if (omap->port_mode[1] == EHCI_HCD_OMAP_MODE_TLL)
9163 + tll_ch_mask |= OMAP_TLL_CHANNEL_2_EN_MASK;
9164 + if (omap->port_mode[2] == EHCI_HCD_OMAP_MODE_TLL)
9165 + tll_ch_mask |= OMAP_TLL_CHANNEL_3_EN_MASK;
9167 + /* Enable UTMI mode for required TLL channels */
9168 + omap_usb_utmi_init(omap, tll_ch_mask);
9171 + if (omap->phy_reset) {
9173 + * Hold the PHY in RESET for enough time till
9174 + * PHY is settled and ready
9178 + if (gpio_is_valid(omap->reset_gpio_port[0]))
9179 + gpio_set_value(omap->reset_gpio_port[0], 1);
9181 + if (gpio_is_valid(omap->reset_gpio_port[1]))
9182 + gpio_set_value(omap->reset_gpio_port[1], 1);
9188 + clk_disable(omap->usbtll_ick);
9189 + clk_put(omap->usbtll_ick);
9192 + clk_disable(omap->usbtll_fck);
9193 + clk_put(omap->usbtll_fck);
9196 + clk_disable(omap->usbhost1_48m_fck);
9197 + clk_put(omap->usbhost1_48m_fck);
9199 + if (omap->phy_reset) {
9200 + if (gpio_is_valid(omap->reset_gpio_port[0]))
9201 + gpio_free(omap->reset_gpio_port[0]);
9203 + if (gpio_is_valid(omap->reset_gpio_port[1]))
9204 + gpio_free(omap->reset_gpio_port[1]);
9208 + clk_disable(omap->usbhost2_120m_fck);
9209 + clk_put(omap->usbhost2_120m_fck);
9212 + clk_disable(omap->usbhost_ick);
9213 + clk_put(omap->usbhost_ick);
9219 +static void omap_stop_ehc(struct ehci_hcd_omap *omap, struct usb_hcd *hcd)
9221 + unsigned long timeout = jiffies + msecs_to_jiffies(100);
9223 + dev_dbg(omap->dev, "stopping TI EHCI USB Controller\n");
9225 + /* Reset OMAP modules for insmod/rmmod to work */
9226 + ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG,
9227 + OMAP_UHH_SYSCONFIG_SOFTRESET);
9228 + while (!(ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSSTATUS)
9232 + if (time_after(jiffies, timeout))
9233 + dev_dbg(omap->dev, "operation timed out\n");
9236 + while (!(ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSSTATUS)
9240 + if (time_after(jiffies, timeout))
9241 + dev_dbg(omap->dev, "operation timed out\n");
9244 + while (!(ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSSTATUS)
9248 + if (time_after(jiffies, timeout))
9249 + dev_dbg(omap->dev, "operation timed out\n");
9252 + ehci_omap_writel(omap->tll_base, OMAP_USBTLL_SYSCONFIG, (1 << 1));
9254 + while (!(ehci_omap_readl(omap->tll_base, OMAP_USBTLL_SYSSTATUS)
9258 + if (time_after(jiffies, timeout))
9259 + dev_dbg(omap->dev, "operation timed out\n");
9262 + if (omap->usbtll_fck != NULL) {
9263 + clk_disable(omap->usbtll_fck);
9264 + clk_put(omap->usbtll_fck);
9265 + omap->usbtll_fck = NULL;
9268 + if (omap->usbhost_ick != NULL) {
9269 + clk_disable(omap->usbhost_ick);
9270 + clk_put(omap->usbhost_ick);
9271 + omap->usbhost_ick = NULL;
9274 + if (omap->usbhost1_48m_fck != NULL) {
9275 + clk_disable(omap->usbhost1_48m_fck);
9276 + clk_put(omap->usbhost1_48m_fck);
9277 + omap->usbhost1_48m_fck = NULL;
9280 + if (omap->usbhost2_120m_fck != NULL) {
9281 + clk_disable(omap->usbhost2_120m_fck);
9282 + clk_put(omap->usbhost2_120m_fck);
9283 + omap->usbhost2_120m_fck = NULL;
9286 + if (omap->usbtll_ick != NULL) {
9287 + clk_disable(omap->usbtll_ick);
9288 + clk_put(omap->usbtll_ick);
9289 + omap->usbtll_ick = NULL;
9292 + if (omap->phy_reset) {
9293 + if (gpio_is_valid(omap->reset_gpio_port[0]))
9294 + gpio_free(omap->reset_gpio_port[0]);
9296 + if (gpio_is_valid(omap->reset_gpio_port[1]))
9297 + gpio_free(omap->reset_gpio_port[1]);
9300 + dev_dbg(omap->dev, "Clock to USB host has been disabled\n");
9303 +/*-------------------------------------------------------------------------*/
9305 +static const struct hc_driver ehci_omap_hc_driver;
9307 +/* configure so an HC device and id are always provided */
9308 +/* always called with process context; sleeping is OK */
9311 + * ehci_hcd_omap_probe - initialize TI-based HCDs
9313 + * Allocates basic resources for this USB host controller, and
9314 + * then invokes the start() method for the HCD associated with it
9315 + * through the hotplug entry's driver_data.
9317 +static int ehci_hcd_omap_probe(struct platform_device *pdev)
9319 + struct ehci_hcd_omap_platform_data *pdata = pdev->dev.platform_data;
9320 + struct ehci_hcd_omap *omap;
9321 + struct resource *res;
9322 + struct usb_hcd *hcd;
9324 + int irq = platform_get_irq(pdev, 0);
9325 + int ret = -ENODEV;
9328 + dev_dbg(&pdev->dev, "missing platform_data\n");
9332 + if (usb_disabled())
9333 + goto err_disabled;
9335 + omap = kzalloc(sizeof(*omap), GFP_KERNEL);
9338 + goto err_create_hcd;
9341 + hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev,
9342 + dev_name(&pdev->dev));
9344 + dev_dbg(&pdev->dev, "failed to create hcd with err %d\n", ret);
9346 + goto err_create_hcd;
9349 + platform_set_drvdata(pdev, omap);
9350 + omap->dev = &pdev->dev;
9351 + omap->phy_reset = pdata->phy_reset;
9352 + omap->reset_gpio_port[0] = pdata->reset_gpio_port[0];
9353 + omap->reset_gpio_port[1] = pdata->reset_gpio_port[1];
9354 + omap->reset_gpio_port[2] = pdata->reset_gpio_port[2];
9355 + omap->port_mode[0] = pdata->port_mode[0];
9356 + omap->port_mode[1] = pdata->port_mode[1];
9357 + omap->port_mode[2] = pdata->port_mode[2];
9358 + omap->ehci = hcd_to_ehci(hcd);
9359 + omap->ehci->sbrn = 0x20;
9361 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
9363 + hcd->rsrc_start = res->start;
9364 + hcd->rsrc_len = resource_size(res);
9366 + hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
9368 + dev_err(&pdev->dev, "EHCI ioremap failed\n");
9373 + /* we know this is the memory we want, no need to ioremap again */
9374 + omap->ehci->caps = hcd->regs;
9375 + omap->ehci_base = hcd->regs;
9377 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
9378 + omap->uhh_base = ioremap(res->start, resource_size(res));
9379 + if (!omap->uhh_base) {
9380 + dev_err(&pdev->dev, "UHH ioremap failed\n");
9382 + goto err_uhh_ioremap;
9385 + res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
9386 + omap->tll_base = ioremap(res->start, resource_size(res));
9387 + if (!omap->tll_base) {
9388 + dev_err(&pdev->dev, "TLL ioremap failed\n");
9390 + goto err_tll_ioremap;
9393 + ret = omap_start_ehc(omap, hcd);
9395 + dev_dbg(&pdev->dev, "failed to start ehci\n");
9399 + omap->ehci->regs = hcd->regs
9400 + + HC_LENGTH(readl(&omap->ehci->caps->hc_capbase));
9402 + /* cache this readonly data; minimize chip reads */
9403 + omap->ehci->hcs_params = readl(&omap->ehci->caps->hcs_params);
9405 + /* SET 1 micro-frame Interrupt interval */
9406 + writel(readl(&omap->ehci->regs->command) | (1 << 16),
9407 + &omap->ehci->regs->command);
9409 + ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
9411 + dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret);
9418 + omap_stop_ehc(omap, hcd);
9421 + iounmap(omap->tll_base);
9424 + iounmap(omap->uhh_base);
9427 + iounmap(hcd->regs);
9438 +/* may be called without controller electrically present */
9439 +/* may be called with controller, bus, and devices active */
9442 + * ehci_hcd_omap_remove - shutdown processing for EHCI HCDs
9443 + * @pdev: USB Host Controller being removed
9445 + * Reverses the effect of usb_ehci_hcd_omap_probe(), first invoking
9446 + * the HCD's stop() method. It is always called from a thread
9447 + * context, normally "rmmod", "apmd", or something similar.
9449 +static int ehci_hcd_omap_remove(struct platform_device *pdev)
9451 + struct ehci_hcd_omap *omap = platform_get_drvdata(pdev);
9452 + struct usb_hcd *hcd = ehci_to_hcd(omap->ehci);
9454 + usb_remove_hcd(hcd);
9455 + omap_stop_ehc(omap, hcd);
9456 + iounmap(hcd->regs);
9457 + iounmap(omap->tll_base);
9458 + iounmap(omap->uhh_base);
9464 +static void ehci_hcd_omap_shutdown(struct platform_device *pdev)
9466 + struct ehci_hcd_omap *omap = platform_get_drvdata(pdev);
9467 + struct usb_hcd *hcd = ehci_to_hcd(omap->ehci);
9469 + if (hcd->driver->shutdown)
9470 + hcd->driver->shutdown(hcd);
9473 +static struct platform_driver ehci_hcd_omap_driver = {
9474 + .probe = ehci_hcd_omap_probe,
9475 + .remove = ehci_hcd_omap_remove,
9476 + .shutdown = ehci_hcd_omap_shutdown,
9477 + /*.suspend = ehci_hcd_omap_suspend, */
9478 + /*.resume = ehci_hcd_omap_resume, */
9480 + .name = "ehci-omap",
9484 +/*-------------------------------------------------------------------------*/
9486 +static const struct hc_driver ehci_omap_hc_driver = {
9487 + .description = hcd_name,
9488 + .product_desc = "OMAP-EHCI Host Controller",
9489 + .hcd_priv_size = sizeof(struct ehci_hcd),
9492 + * generic hardware linkage
9495 + .flags = HCD_MEMORY | HCD_USB2,
9498 + * basic lifecycle operations
9500 + .reset = ehci_init,
9501 + .start = ehci_run,
9502 + .stop = ehci_stop,
9503 + .shutdown = ehci_shutdown,
9506 + * managing i/o requests and associated device resources
9508 + .urb_enqueue = ehci_urb_enqueue,
9509 + .urb_dequeue = ehci_urb_dequeue,
9510 + .endpoint_disable = ehci_endpoint_disable,
9511 + .endpoint_reset = ehci_endpoint_reset,
9514 + * scheduling support
9516 + .get_frame_number = ehci_get_frame,
9519 + * root hub support
9521 + .hub_status_data = ehci_hub_status_data,
9522 + .hub_control = ehci_hub_control,
9523 + .bus_suspend = ehci_bus_suspend,
9524 + .bus_resume = ehci_bus_resume,
9526 + .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
9529 +MODULE_ALIAS("platform:omap-ehci");
9530 +MODULE_AUTHOR("Texas Instruments, Inc.");
9531 +MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
9533 --- a/drivers/video/omap/dispc.c
9534 +++ b/drivers/video/omap/dispc.c
9535 @@ -210,6 +210,7 @@ static u32 inline dispc_read_reg(int idx
9536 /* Select RFBI or bypass mode */
9537 static void enable_rfbi_mode(int enable)
9539 + void __iomem *rfbi_control;
9542 l = dispc_read_reg(DISPC_CONTROL);
9543 @@ -222,9 +223,15 @@ static void enable_rfbi_mode(int enable)
9544 dispc_write_reg(DISPC_CONTROL, l);
9546 /* Set bypass mode in RFBI module */
9547 - l = __raw_readl(OMAP2_IO_ADDRESS(RFBI_CONTROL));
9548 + rfbi_control = ioremap(RFBI_CONTROL, SZ_1K);
9549 + if (!rfbi_control) {
9550 + pr_err("Unable to ioremap rfbi_control\n");
9553 + l = __raw_readl(rfbi_control);
9554 l |= enable ? 0 : (1 << 1);
9555 - __raw_writel(l, OMAP2_IO_ADDRESS(RFBI_CONTROL));
9556 + __raw_writel(l, rfbi_control);
9557 + iounmap(rfbi_control);
9560 static void set_lcd_data_lines(int data_lines)
9561 @@ -1373,6 +1380,7 @@ static int omap_dispc_init(struct omapfb
9564 struct lcd_panel *panel = fbdev->panel;
9565 + void __iomem *ram_fw_base;
9569 @@ -1453,7 +1461,13 @@ static int omap_dispc_init(struct omapfb
9572 /* L3 firewall setting: enable access to OCM RAM */
9573 - __raw_writel(0x402000b0, OMAP2_IO_ADDRESS(0x680050a0));
9574 + ram_fw_base = ioremap(0x68005000, SZ_1K);
9575 + if (!ram_fw_base) {
9576 + dev_err(dispc.fbdev->dev, "Cannot ioremap to enable OCM RAM\n");
9579 + __raw_writel(0x402000b0, ram_fw_base + 0xa0);
9580 + iounmap(ram_fw_base);
9582 if ((r = alloc_palette_ram()) < 0)