Commit 948c66df0d5e23dbcb84bee39a11b56c8a0d3e41

Authored by Sekhar Nori
Committed by Kevin Hilman
1 parent e2da3aaa42

davinci: cpuidle: move mapping of DDR2 controller registers out of driver

When suspend is supported, both cpuidle and suspend code
need to work on DDR2 registers. Instead of mapping the
DDR2 registers twice, do it once outside of cpuidle
driver and let cpuidle driver get the virtual base address
of DDR2 registers.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>

Showing 4 changed files with 21 additions and 30 deletions Inline Diff

arch/arm/mach-davinci/cpuidle.c
1 /* 1 /*
2 * CPU idle for DaVinci SoCs 2 * CPU idle for DaVinci SoCs
3 * 3 *
4 * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/ 4 * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/
5 * 5 *
6 * Derived from Marvell Kirkwood CPU idle code 6 * Derived from Marvell Kirkwood CPU idle code
7 * (arch/arm/mach-kirkwood/cpuidle.c) 7 * (arch/arm/mach-kirkwood/cpuidle.c)
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13
14 #include <linux/kernel.h> 14 #include <linux/kernel.h>
15 #include <linux/init.h> 15 #include <linux/init.h>
16 #include <linux/platform_device.h> 16 #include <linux/platform_device.h>
17 #include <linux/cpuidle.h> 17 #include <linux/cpuidle.h>
18 #include <linux/io.h> 18 #include <linux/io.h>
19 #include <asm/proc-fns.h> 19 #include <asm/proc-fns.h>
20 20
21 #include <mach/cpuidle.h> 21 #include <mach/cpuidle.h>
22 #include <mach/memory.h> 22 #include <mach/memory.h>
23 23
24 #define DAVINCI_CPUIDLE_MAX_STATES 2 24 #define DAVINCI_CPUIDLE_MAX_STATES 2
25 25
26 struct davinci_ops { 26 struct davinci_ops {
27 void (*enter) (u32 flags); 27 void (*enter) (u32 flags);
28 void (*exit) (u32 flags); 28 void (*exit) (u32 flags);
29 u32 flags; 29 u32 flags;
30 }; 30 };
31 31
32 /* fields in davinci_ops.flags */ 32 /* fields in davinci_ops.flags */
33 #define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0) 33 #define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0)
34 34
35 static struct cpuidle_driver davinci_idle_driver = { 35 static struct cpuidle_driver davinci_idle_driver = {
36 .name = "cpuidle-davinci", 36 .name = "cpuidle-davinci",
37 .owner = THIS_MODULE, 37 .owner = THIS_MODULE,
38 }; 38 };
39 39
40 static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); 40 static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device);
41 static void __iomem *ddr2_reg_base; 41 static void __iomem *ddr2_reg_base;
42 42
43 static void davinci_save_ddr_power(int enter, bool pdown) 43 static void davinci_save_ddr_power(int enter, bool pdown)
44 { 44 {
45 u32 val; 45 u32 val;
46 46
47 val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET); 47 val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET);
48 48
49 if (enter) { 49 if (enter) {
50 if (pdown) 50 if (pdown)
51 val |= DDR2_SRPD_BIT; 51 val |= DDR2_SRPD_BIT;
52 else 52 else
53 val &= ~DDR2_SRPD_BIT; 53 val &= ~DDR2_SRPD_BIT;
54 val |= DDR2_LPMODEN_BIT; 54 val |= DDR2_LPMODEN_BIT;
55 } else { 55 } else {
56 val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT); 56 val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT);
57 } 57 }
58 58
59 __raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET); 59 __raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET);
60 } 60 }
61 61
62 static void davinci_c2state_enter(u32 flags) 62 static void davinci_c2state_enter(u32 flags)
63 { 63 {
64 davinci_save_ddr_power(1, !!(flags & DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN)); 64 davinci_save_ddr_power(1, !!(flags & DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN));
65 } 65 }
66 66
67 static void davinci_c2state_exit(u32 flags) 67 static void davinci_c2state_exit(u32 flags)
68 { 68 {
69 davinci_save_ddr_power(0, !!(flags & DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN)); 69 davinci_save_ddr_power(0, !!(flags & DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN));
70 } 70 }
71 71
72 static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = { 72 static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = {
73 [1] = { 73 [1] = {
74 .enter = davinci_c2state_enter, 74 .enter = davinci_c2state_enter,
75 .exit = davinci_c2state_exit, 75 .exit = davinci_c2state_exit,
76 }, 76 },
77 }; 77 };
78 78
79 /* Actual code that puts the SoC in different idle states */ 79 /* Actual code that puts the SoC in different idle states */
80 static int davinci_enter_idle(struct cpuidle_device *dev, 80 static int davinci_enter_idle(struct cpuidle_device *dev,
81 struct cpuidle_state *state) 81 struct cpuidle_state *state)
82 { 82 {
83 struct davinci_ops *ops = cpuidle_get_statedata(state); 83 struct davinci_ops *ops = cpuidle_get_statedata(state);
84 struct timeval before, after; 84 struct timeval before, after;
85 int idle_time; 85 int idle_time;
86 86
87 local_irq_disable(); 87 local_irq_disable();
88 do_gettimeofday(&before); 88 do_gettimeofday(&before);
89 89
90 if (ops && ops->enter) 90 if (ops && ops->enter)
91 ops->enter(ops->flags); 91 ops->enter(ops->flags);
92 /* Wait for interrupt state */ 92 /* Wait for interrupt state */
93 cpu_do_idle(); 93 cpu_do_idle();
94 if (ops && ops->exit) 94 if (ops && ops->exit)
95 ops->exit(ops->flags); 95 ops->exit(ops->flags);
96 96
97 do_gettimeofday(&after); 97 do_gettimeofday(&after);
98 local_irq_enable(); 98 local_irq_enable();
99 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + 99 idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
100 (after.tv_usec - before.tv_usec); 100 (after.tv_usec - before.tv_usec);
101 return idle_time; 101 return idle_time;
102 } 102 }
103 103
104 static int __init davinci_cpuidle_probe(struct platform_device *pdev) 104 static int __init davinci_cpuidle_probe(struct platform_device *pdev)
105 { 105 {
106 int ret; 106 int ret;
107 struct cpuidle_device *device; 107 struct cpuidle_device *device;
108 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 108 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
109 struct resource *ddr2_regs;
110 resource_size_t len;
111 109
112 device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); 110 device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
113 111
114 if (!pdata) { 112 if (!pdata) {
115 dev_err(&pdev->dev, "cannot get platform data\n"); 113 dev_err(&pdev->dev, "cannot get platform data\n");
116 return -ENOENT; 114 return -ENOENT;
117 } 115 }
118 116
119 ddr2_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 117 ddr2_reg_base = pdata->ddr2_ctlr_base;
120 if (!ddr2_regs) {
121 dev_err(&pdev->dev, "cannot get DDR2 controller register base");
122 return -ENODEV;
123 }
124 118
125 len = resource_size(ddr2_regs);
126
127 ddr2_regs = request_mem_region(ddr2_regs->start, len, ddr2_regs->name);
128 if (!ddr2_regs)
129 return -EBUSY;
130
131 ddr2_reg_base = ioremap(ddr2_regs->start, len);
132 if (!ddr2_reg_base) {
133 ret = -ENOMEM;
134 goto ioremap_fail;
135 }
136
137 ret = cpuidle_register_driver(&davinci_idle_driver); 119 ret = cpuidle_register_driver(&davinci_idle_driver);
138 if (ret) { 120 if (ret) {
139 dev_err(&pdev->dev, "failed to register driver\n"); 121 dev_err(&pdev->dev, "failed to register driver\n");
140 goto driver_register_fail; 122 return ret;
141 } 123 }
142 124
143 /* Wait for interrupt state */ 125 /* Wait for interrupt state */
144 device->states[0].enter = davinci_enter_idle; 126 device->states[0].enter = davinci_enter_idle;
145 device->states[0].exit_latency = 1; 127 device->states[0].exit_latency = 1;
146 device->states[0].target_residency = 10000; 128 device->states[0].target_residency = 10000;
147 device->states[0].flags = CPUIDLE_FLAG_TIME_VALID; 129 device->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
148 strcpy(device->states[0].name, "WFI"); 130 strcpy(device->states[0].name, "WFI");
149 strcpy(device->states[0].desc, "Wait for interrupt"); 131 strcpy(device->states[0].desc, "Wait for interrupt");
150 132
151 /* Wait for interrupt and DDR self refresh state */ 133 /* Wait for interrupt and DDR self refresh state */
152 device->states[1].enter = davinci_enter_idle; 134 device->states[1].enter = davinci_enter_idle;
153 device->states[1].exit_latency = 10; 135 device->states[1].exit_latency = 10;
154 device->states[1].target_residency = 10000; 136 device->states[1].target_residency = 10000;
155 device->states[1].flags = CPUIDLE_FLAG_TIME_VALID; 137 device->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
156 strcpy(device->states[1].name, "DDR SR"); 138 strcpy(device->states[1].name, "DDR SR");
157 strcpy(device->states[1].desc, "WFI and DDR Self Refresh"); 139 strcpy(device->states[1].desc, "WFI and DDR Self Refresh");
158 if (pdata->ddr2_pdown) 140 if (pdata->ddr2_pdown)
159 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN; 141 davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN;
160 cpuidle_set_statedata(&device->states[1], &davinci_states[1]); 142 cpuidle_set_statedata(&device->states[1], &davinci_states[1]);
161 143
162 device->state_count = DAVINCI_CPUIDLE_MAX_STATES; 144 device->state_count = DAVINCI_CPUIDLE_MAX_STATES;
163 145
164 ret = cpuidle_register_device(device); 146 ret = cpuidle_register_device(device);
165 if (ret) { 147 if (ret) {
166 dev_err(&pdev->dev, "failed to register device\n"); 148 dev_err(&pdev->dev, "failed to register device\n");
167 goto device_register_fail; 149 cpuidle_unregister_driver(&davinci_idle_driver);
150 return ret;
168 } 151 }
169 152
170 return 0; 153 return 0;
171
172 device_register_fail:
173 cpuidle_unregister_driver(&davinci_idle_driver);
174 driver_register_fail:
175 iounmap(ddr2_reg_base);
176 ioremap_fail:
177 release_mem_region(ddr2_regs->start, len);
178 return ret;
179 } 154 }
180 155
181 static struct platform_driver davinci_cpuidle_driver = { 156 static struct platform_driver davinci_cpuidle_driver = {
182 .driver = { 157 .driver = {
183 .name = "cpuidle-davinci", 158 .name = "cpuidle-davinci",
184 .owner = THIS_MODULE, 159 .owner = THIS_MODULE,
185 }, 160 },
186 }; 161 };
187 162
188 static int __init davinci_cpuidle_init(void) 163 static int __init davinci_cpuidle_init(void)
189 { 164 {
190 return platform_driver_probe(&davinci_cpuidle_driver, 165 return platform_driver_probe(&davinci_cpuidle_driver,
191 davinci_cpuidle_probe); 166 davinci_cpuidle_probe);
192 } 167 }
193 device_initcall(davinci_cpuidle_init); 168 device_initcall(davinci_cpuidle_init);
194 169
arch/arm/mach-davinci/devices-da8xx.c
1 /* 1 /*
2 * DA8XX/OMAP L1XX platform device data 2 * DA8XX/OMAP L1XX platform device data
3 * 3 *
4 * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com> 4 * Copyright (c) 2007-2009, MontaVista Software, Inc. <source@mvista.com>
5 * Derived from code that was: 5 * Derived from code that was:
6 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com> 6 * Copyright (C) 2006 Komal Shah <komal_shah802003@yahoo.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version. 11 * (at your option) any later version.
12 */ 12 */
13 #include <linux/init.h> 13 #include <linux/init.h>
14 #include <linux/platform_device.h> 14 #include <linux/platform_device.h>
15 #include <linux/dma-mapping.h> 15 #include <linux/dma-mapping.h>
16 #include <linux/serial_8250.h> 16 #include <linux/serial_8250.h>
17 17
18 #include <mach/cputype.h> 18 #include <mach/cputype.h>
19 #include <mach/common.h> 19 #include <mach/common.h>
20 #include <mach/time.h> 20 #include <mach/time.h>
21 #include <mach/da8xx.h> 21 #include <mach/da8xx.h>
22 #include <mach/cpuidle.h> 22 #include <mach/cpuidle.h>
23 23
24 #include "clock.h" 24 #include "clock.h"
25 25
26 #define DA8XX_TPCC_BASE 0x01c00000 26 #define DA8XX_TPCC_BASE 0x01c00000
27 #define DA8XX_TPTC0_BASE 0x01c08000 27 #define DA8XX_TPTC0_BASE 0x01c08000
28 #define DA8XX_TPTC1_BASE 0x01c08400 28 #define DA8XX_TPTC1_BASE 0x01c08400
29 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ 29 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
30 #define DA8XX_I2C0_BASE 0x01c22000 30 #define DA8XX_I2C0_BASE 0x01c22000
31 #define DA8XX_RTC_BASE 0x01C23000 31 #define DA8XX_RTC_BASE 0x01C23000
32 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 32 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
33 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 33 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
34 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 34 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
35 #define DA8XX_EMAC_MDIO_BASE 0x01e24000 35 #define DA8XX_EMAC_MDIO_BASE 0x01e24000
36 #define DA8XX_GPIO_BASE 0x01e26000 36 #define DA8XX_GPIO_BASE 0x01e26000
37 #define DA8XX_I2C1_BASE 0x01e28000 37 #define DA8XX_I2C1_BASE 0x01e28000
38 38
39 #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 39 #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
40 #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 40 #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
41 #define DA8XX_EMAC_RAM_OFFSET 0x0000 41 #define DA8XX_EMAC_RAM_OFFSET 0x0000
42 #define DA8XX_MDIO_REG_OFFSET 0x4000 42 #define DA8XX_MDIO_REG_OFFSET 0x4000
43 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K 43 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
44 44
45 void __iomem *da8xx_syscfg0_base; 45 void __iomem *da8xx_syscfg0_base;
46 void __iomem *da8xx_syscfg1_base; 46 void __iomem *da8xx_syscfg1_base;
47 47
48 static struct plat_serial8250_port da8xx_serial_pdata[] = { 48 static struct plat_serial8250_port da8xx_serial_pdata[] = {
49 { 49 {
50 .mapbase = DA8XX_UART0_BASE, 50 .mapbase = DA8XX_UART0_BASE,
51 .irq = IRQ_DA8XX_UARTINT0, 51 .irq = IRQ_DA8XX_UARTINT0,
52 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 52 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
53 UPF_IOREMAP, 53 UPF_IOREMAP,
54 .iotype = UPIO_MEM, 54 .iotype = UPIO_MEM,
55 .regshift = 2, 55 .regshift = 2,
56 }, 56 },
57 { 57 {
58 .mapbase = DA8XX_UART1_BASE, 58 .mapbase = DA8XX_UART1_BASE,
59 .irq = IRQ_DA8XX_UARTINT1, 59 .irq = IRQ_DA8XX_UARTINT1,
60 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 60 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
61 UPF_IOREMAP, 61 UPF_IOREMAP,
62 .iotype = UPIO_MEM, 62 .iotype = UPIO_MEM,
63 .regshift = 2, 63 .regshift = 2,
64 }, 64 },
65 { 65 {
66 .mapbase = DA8XX_UART2_BASE, 66 .mapbase = DA8XX_UART2_BASE,
67 .irq = IRQ_DA8XX_UARTINT2, 67 .irq = IRQ_DA8XX_UARTINT2,
68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
69 UPF_IOREMAP, 69 UPF_IOREMAP,
70 .iotype = UPIO_MEM, 70 .iotype = UPIO_MEM,
71 .regshift = 2, 71 .regshift = 2,
72 }, 72 },
73 { 73 {
74 .flags = 0, 74 .flags = 0,
75 }, 75 },
76 }; 76 };
77 77
78 struct platform_device da8xx_serial_device = { 78 struct platform_device da8xx_serial_device = {
79 .name = "serial8250", 79 .name = "serial8250",
80 .id = PLAT8250_DEV_PLATFORM, 80 .id = PLAT8250_DEV_PLATFORM,
81 .dev = { 81 .dev = {
82 .platform_data = da8xx_serial_pdata, 82 .platform_data = da8xx_serial_pdata,
83 }, 83 },
84 }; 84 };
85 85
86 static const s8 da8xx_dma_chan_no_event[] = { 86 static const s8 da8xx_dma_chan_no_event[] = {
87 20, 21, 87 20, 21,
88 -1 88 -1
89 }; 89 };
90 90
91 static const s8 da8xx_queue_tc_mapping[][2] = { 91 static const s8 da8xx_queue_tc_mapping[][2] = {
92 /* {event queue no, TC no} */ 92 /* {event queue no, TC no} */
93 {0, 0}, 93 {0, 0},
94 {1, 1}, 94 {1, 1},
95 {-1, -1} 95 {-1, -1}
96 }; 96 };
97 97
98 static const s8 da8xx_queue_priority_mapping[][2] = { 98 static const s8 da8xx_queue_priority_mapping[][2] = {
99 /* {event queue no, Priority} */ 99 /* {event queue no, Priority} */
100 {0, 3}, 100 {0, 3},
101 {1, 7}, 101 {1, 7},
102 {-1, -1} 102 {-1, -1}
103 }; 103 };
104 104
105 static struct edma_soc_info da8xx_edma_info[] = { 105 static struct edma_soc_info da8xx_edma_info[] = {
106 { 106 {
107 .n_channel = 32, 107 .n_channel = 32,
108 .n_region = 4, 108 .n_region = 4,
109 .n_slot = 128, 109 .n_slot = 128,
110 .n_tc = 2, 110 .n_tc = 2,
111 .n_cc = 1, 111 .n_cc = 1,
112 .noevent = da8xx_dma_chan_no_event, 112 .noevent = da8xx_dma_chan_no_event,
113 .queue_tc_mapping = da8xx_queue_tc_mapping, 113 .queue_tc_mapping = da8xx_queue_tc_mapping,
114 .queue_priority_mapping = da8xx_queue_priority_mapping, 114 .queue_priority_mapping = da8xx_queue_priority_mapping,
115 }, 115 },
116 }; 116 };
117 117
118 static struct resource da8xx_edma_resources[] = { 118 static struct resource da8xx_edma_resources[] = {
119 { 119 {
120 .name = "edma_cc0", 120 .name = "edma_cc0",
121 .start = DA8XX_TPCC_BASE, 121 .start = DA8XX_TPCC_BASE,
122 .end = DA8XX_TPCC_BASE + SZ_32K - 1, 122 .end = DA8XX_TPCC_BASE + SZ_32K - 1,
123 .flags = IORESOURCE_MEM, 123 .flags = IORESOURCE_MEM,
124 }, 124 },
125 { 125 {
126 .name = "edma_tc0", 126 .name = "edma_tc0",
127 .start = DA8XX_TPTC0_BASE, 127 .start = DA8XX_TPTC0_BASE,
128 .end = DA8XX_TPTC0_BASE + SZ_1K - 1, 128 .end = DA8XX_TPTC0_BASE + SZ_1K - 1,
129 .flags = IORESOURCE_MEM, 129 .flags = IORESOURCE_MEM,
130 }, 130 },
131 { 131 {
132 .name = "edma_tc1", 132 .name = "edma_tc1",
133 .start = DA8XX_TPTC1_BASE, 133 .start = DA8XX_TPTC1_BASE,
134 .end = DA8XX_TPTC1_BASE + SZ_1K - 1, 134 .end = DA8XX_TPTC1_BASE + SZ_1K - 1,
135 .flags = IORESOURCE_MEM, 135 .flags = IORESOURCE_MEM,
136 }, 136 },
137 { 137 {
138 .name = "edma0", 138 .name = "edma0",
139 .start = IRQ_DA8XX_CCINT0, 139 .start = IRQ_DA8XX_CCINT0,
140 .flags = IORESOURCE_IRQ, 140 .flags = IORESOURCE_IRQ,
141 }, 141 },
142 { 142 {
143 .name = "edma0_err", 143 .name = "edma0_err",
144 .start = IRQ_DA8XX_CCERRINT, 144 .start = IRQ_DA8XX_CCERRINT,
145 .flags = IORESOURCE_IRQ, 145 .flags = IORESOURCE_IRQ,
146 }, 146 },
147 }; 147 };
148 148
149 static struct platform_device da8xx_edma_device = { 149 static struct platform_device da8xx_edma_device = {
150 .name = "edma", 150 .name = "edma",
151 .id = -1, 151 .id = -1,
152 .dev = { 152 .dev = {
153 .platform_data = da8xx_edma_info, 153 .platform_data = da8xx_edma_info,
154 }, 154 },
155 .num_resources = ARRAY_SIZE(da8xx_edma_resources), 155 .num_resources = ARRAY_SIZE(da8xx_edma_resources),
156 .resource = da8xx_edma_resources, 156 .resource = da8xx_edma_resources,
157 }; 157 };
158 158
159 int __init da8xx_register_edma(void) 159 int __init da8xx_register_edma(void)
160 { 160 {
161 return platform_device_register(&da8xx_edma_device); 161 return platform_device_register(&da8xx_edma_device);
162 } 162 }
163 163
164 static struct resource da8xx_i2c_resources0[] = { 164 static struct resource da8xx_i2c_resources0[] = {
165 { 165 {
166 .start = DA8XX_I2C0_BASE, 166 .start = DA8XX_I2C0_BASE,
167 .end = DA8XX_I2C0_BASE + SZ_4K - 1, 167 .end = DA8XX_I2C0_BASE + SZ_4K - 1,
168 .flags = IORESOURCE_MEM, 168 .flags = IORESOURCE_MEM,
169 }, 169 },
170 { 170 {
171 .start = IRQ_DA8XX_I2CINT0, 171 .start = IRQ_DA8XX_I2CINT0,
172 .end = IRQ_DA8XX_I2CINT0, 172 .end = IRQ_DA8XX_I2CINT0,
173 .flags = IORESOURCE_IRQ, 173 .flags = IORESOURCE_IRQ,
174 }, 174 },
175 }; 175 };
176 176
177 static struct platform_device da8xx_i2c_device0 = { 177 static struct platform_device da8xx_i2c_device0 = {
178 .name = "i2c_davinci", 178 .name = "i2c_davinci",
179 .id = 1, 179 .id = 1,
180 .num_resources = ARRAY_SIZE(da8xx_i2c_resources0), 180 .num_resources = ARRAY_SIZE(da8xx_i2c_resources0),
181 .resource = da8xx_i2c_resources0, 181 .resource = da8xx_i2c_resources0,
182 }; 182 };
183 183
184 static struct resource da8xx_i2c_resources1[] = { 184 static struct resource da8xx_i2c_resources1[] = {
185 { 185 {
186 .start = DA8XX_I2C1_BASE, 186 .start = DA8XX_I2C1_BASE,
187 .end = DA8XX_I2C1_BASE + SZ_4K - 1, 187 .end = DA8XX_I2C1_BASE + SZ_4K - 1,
188 .flags = IORESOURCE_MEM, 188 .flags = IORESOURCE_MEM,
189 }, 189 },
190 { 190 {
191 .start = IRQ_DA8XX_I2CINT1, 191 .start = IRQ_DA8XX_I2CINT1,
192 .end = IRQ_DA8XX_I2CINT1, 192 .end = IRQ_DA8XX_I2CINT1,
193 .flags = IORESOURCE_IRQ, 193 .flags = IORESOURCE_IRQ,
194 }, 194 },
195 }; 195 };
196 196
197 static struct platform_device da8xx_i2c_device1 = { 197 static struct platform_device da8xx_i2c_device1 = {
198 .name = "i2c_davinci", 198 .name = "i2c_davinci",
199 .id = 2, 199 .id = 2,
200 .num_resources = ARRAY_SIZE(da8xx_i2c_resources1), 200 .num_resources = ARRAY_SIZE(da8xx_i2c_resources1),
201 .resource = da8xx_i2c_resources1, 201 .resource = da8xx_i2c_resources1,
202 }; 202 };
203 203
204 int __init da8xx_register_i2c(int instance, 204 int __init da8xx_register_i2c(int instance,
205 struct davinci_i2c_platform_data *pdata) 205 struct davinci_i2c_platform_data *pdata)
206 { 206 {
207 struct platform_device *pdev; 207 struct platform_device *pdev;
208 208
209 if (instance == 0) 209 if (instance == 0)
210 pdev = &da8xx_i2c_device0; 210 pdev = &da8xx_i2c_device0;
211 else if (instance == 1) 211 else if (instance == 1)
212 pdev = &da8xx_i2c_device1; 212 pdev = &da8xx_i2c_device1;
213 else 213 else
214 return -EINVAL; 214 return -EINVAL;
215 215
216 pdev->dev.platform_data = pdata; 216 pdev->dev.platform_data = pdata;
217 return platform_device_register(pdev); 217 return platform_device_register(pdev);
218 } 218 }
219 219
220 static struct resource da8xx_watchdog_resources[] = { 220 static struct resource da8xx_watchdog_resources[] = {
221 { 221 {
222 .start = DA8XX_WDOG_BASE, 222 .start = DA8XX_WDOG_BASE,
223 .end = DA8XX_WDOG_BASE + SZ_4K - 1, 223 .end = DA8XX_WDOG_BASE + SZ_4K - 1,
224 .flags = IORESOURCE_MEM, 224 .flags = IORESOURCE_MEM,
225 }, 225 },
226 }; 226 };
227 227
228 struct platform_device davinci_wdt_device = { 228 struct platform_device davinci_wdt_device = {
229 .name = "watchdog", 229 .name = "watchdog",
230 .id = -1, 230 .id = -1,
231 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), 231 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources),
232 .resource = da8xx_watchdog_resources, 232 .resource = da8xx_watchdog_resources,
233 }; 233 };
234 234
235 int __init da8xx_register_watchdog(void) 235 int __init da8xx_register_watchdog(void)
236 { 236 {
237 return platform_device_register(&davinci_wdt_device); 237 return platform_device_register(&davinci_wdt_device);
238 } 238 }
239 239
240 static struct resource da8xx_emac_resources[] = { 240 static struct resource da8xx_emac_resources[] = {
241 { 241 {
242 .start = DA8XX_EMAC_CPPI_PORT_BASE, 242 .start = DA8XX_EMAC_CPPI_PORT_BASE,
243 .end = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1, 243 .end = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1,
244 .flags = IORESOURCE_MEM, 244 .flags = IORESOURCE_MEM,
245 }, 245 },
246 { 246 {
247 .start = IRQ_DA8XX_C0_RX_THRESH_PULSE, 247 .start = IRQ_DA8XX_C0_RX_THRESH_PULSE,
248 .end = IRQ_DA8XX_C0_RX_THRESH_PULSE, 248 .end = IRQ_DA8XX_C0_RX_THRESH_PULSE,
249 .flags = IORESOURCE_IRQ, 249 .flags = IORESOURCE_IRQ,
250 }, 250 },
251 { 251 {
252 .start = IRQ_DA8XX_C0_RX_PULSE, 252 .start = IRQ_DA8XX_C0_RX_PULSE,
253 .end = IRQ_DA8XX_C0_RX_PULSE, 253 .end = IRQ_DA8XX_C0_RX_PULSE,
254 .flags = IORESOURCE_IRQ, 254 .flags = IORESOURCE_IRQ,
255 }, 255 },
256 { 256 {
257 .start = IRQ_DA8XX_C0_TX_PULSE, 257 .start = IRQ_DA8XX_C0_TX_PULSE,
258 .end = IRQ_DA8XX_C0_TX_PULSE, 258 .end = IRQ_DA8XX_C0_TX_PULSE,
259 .flags = IORESOURCE_IRQ, 259 .flags = IORESOURCE_IRQ,
260 }, 260 },
261 { 261 {
262 .start = IRQ_DA8XX_C0_MISC_PULSE, 262 .start = IRQ_DA8XX_C0_MISC_PULSE,
263 .end = IRQ_DA8XX_C0_MISC_PULSE, 263 .end = IRQ_DA8XX_C0_MISC_PULSE,
264 .flags = IORESOURCE_IRQ, 264 .flags = IORESOURCE_IRQ,
265 }, 265 },
266 }; 266 };
267 267
268 struct emac_platform_data da8xx_emac_pdata = { 268 struct emac_platform_data da8xx_emac_pdata = {
269 .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, 269 .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET,
270 .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, 270 .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET,
271 .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, 271 .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET,
272 .mdio_reg_offset = DA8XX_MDIO_REG_OFFSET, 272 .mdio_reg_offset = DA8XX_MDIO_REG_OFFSET,
273 .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, 273 .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE,
274 .version = EMAC_VERSION_2, 274 .version = EMAC_VERSION_2,
275 }; 275 };
276 276
277 static struct platform_device da8xx_emac_device = { 277 static struct platform_device da8xx_emac_device = {
278 .name = "davinci_emac", 278 .name = "davinci_emac",
279 .id = 1, 279 .id = 1,
280 .dev = { 280 .dev = {
281 .platform_data = &da8xx_emac_pdata, 281 .platform_data = &da8xx_emac_pdata,
282 }, 282 },
283 .num_resources = ARRAY_SIZE(da8xx_emac_resources), 283 .num_resources = ARRAY_SIZE(da8xx_emac_resources),
284 .resource = da8xx_emac_resources, 284 .resource = da8xx_emac_resources,
285 }; 285 };
286 286
287 int __init da8xx_register_emac(void) 287 int __init da8xx_register_emac(void)
288 { 288 {
289 return platform_device_register(&da8xx_emac_device); 289 return platform_device_register(&da8xx_emac_device);
290 } 290 }
291 291
292 static struct resource da830_mcasp1_resources[] = { 292 static struct resource da830_mcasp1_resources[] = {
293 { 293 {
294 .name = "mcasp1", 294 .name = "mcasp1",
295 .start = DAVINCI_DA830_MCASP1_REG_BASE, 295 .start = DAVINCI_DA830_MCASP1_REG_BASE,
296 .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1, 296 .end = DAVINCI_DA830_MCASP1_REG_BASE + (SZ_1K * 12) - 1,
297 .flags = IORESOURCE_MEM, 297 .flags = IORESOURCE_MEM,
298 }, 298 },
299 /* TX event */ 299 /* TX event */
300 { 300 {
301 .start = DAVINCI_DA830_DMA_MCASP1_AXEVT, 301 .start = DAVINCI_DA830_DMA_MCASP1_AXEVT,
302 .end = DAVINCI_DA830_DMA_MCASP1_AXEVT, 302 .end = DAVINCI_DA830_DMA_MCASP1_AXEVT,
303 .flags = IORESOURCE_DMA, 303 .flags = IORESOURCE_DMA,
304 }, 304 },
305 /* RX event */ 305 /* RX event */
306 { 306 {
307 .start = DAVINCI_DA830_DMA_MCASP1_AREVT, 307 .start = DAVINCI_DA830_DMA_MCASP1_AREVT,
308 .end = DAVINCI_DA830_DMA_MCASP1_AREVT, 308 .end = DAVINCI_DA830_DMA_MCASP1_AREVT,
309 .flags = IORESOURCE_DMA, 309 .flags = IORESOURCE_DMA,
310 }, 310 },
311 }; 311 };
312 312
313 static struct platform_device da830_mcasp1_device = { 313 static struct platform_device da830_mcasp1_device = {
314 .name = "davinci-mcasp", 314 .name = "davinci-mcasp",
315 .id = 1, 315 .id = 1,
316 .num_resources = ARRAY_SIZE(da830_mcasp1_resources), 316 .num_resources = ARRAY_SIZE(da830_mcasp1_resources),
317 .resource = da830_mcasp1_resources, 317 .resource = da830_mcasp1_resources,
318 }; 318 };
319 319
320 static struct resource da850_mcasp_resources[] = { 320 static struct resource da850_mcasp_resources[] = {
321 { 321 {
322 .name = "mcasp", 322 .name = "mcasp",
323 .start = DAVINCI_DA8XX_MCASP0_REG_BASE, 323 .start = DAVINCI_DA8XX_MCASP0_REG_BASE,
324 .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1, 324 .end = DAVINCI_DA8XX_MCASP0_REG_BASE + (SZ_1K * 12) - 1,
325 .flags = IORESOURCE_MEM, 325 .flags = IORESOURCE_MEM,
326 }, 326 },
327 /* TX event */ 327 /* TX event */
328 { 328 {
329 .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 329 .start = DAVINCI_DA8XX_DMA_MCASP0_AXEVT,
330 .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT, 330 .end = DAVINCI_DA8XX_DMA_MCASP0_AXEVT,
331 .flags = IORESOURCE_DMA, 331 .flags = IORESOURCE_DMA,
332 }, 332 },
333 /* RX event */ 333 /* RX event */
334 { 334 {
335 .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 335 .start = DAVINCI_DA8XX_DMA_MCASP0_AREVT,
336 .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT, 336 .end = DAVINCI_DA8XX_DMA_MCASP0_AREVT,
337 .flags = IORESOURCE_DMA, 337 .flags = IORESOURCE_DMA,
338 }, 338 },
339 }; 339 };
340 340
341 static struct platform_device da850_mcasp_device = { 341 static struct platform_device da850_mcasp_device = {
342 .name = "davinci-mcasp", 342 .name = "davinci-mcasp",
343 .id = 0, 343 .id = 0,
344 .num_resources = ARRAY_SIZE(da850_mcasp_resources), 344 .num_resources = ARRAY_SIZE(da850_mcasp_resources),
345 .resource = da850_mcasp_resources, 345 .resource = da850_mcasp_resources,
346 }; 346 };
347 347
348 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) 348 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
349 { 349 {
350 /* DA830/OMAP-L137 has 3 instances of McASP */ 350 /* DA830/OMAP-L137 has 3 instances of McASP */
351 if (cpu_is_davinci_da830() && id == 1) { 351 if (cpu_is_davinci_da830() && id == 1) {
352 da830_mcasp1_device.dev.platform_data = pdata; 352 da830_mcasp1_device.dev.platform_data = pdata;
353 platform_device_register(&da830_mcasp1_device); 353 platform_device_register(&da830_mcasp1_device);
354 } else if (cpu_is_davinci_da850()) { 354 } else if (cpu_is_davinci_da850()) {
355 da850_mcasp_device.dev.platform_data = pdata; 355 da850_mcasp_device.dev.platform_data = pdata;
356 platform_device_register(&da850_mcasp_device); 356 platform_device_register(&da850_mcasp_device);
357 } 357 }
358 } 358 }
359 359
360 static const struct display_panel disp_panel = { 360 static const struct display_panel disp_panel = {
361 QVGA, 361 QVGA,
362 16, 362 16,
363 16, 363 16,
364 COLOR_ACTIVE, 364 COLOR_ACTIVE,
365 }; 365 };
366 366
367 static struct lcd_ctrl_config lcd_cfg = { 367 static struct lcd_ctrl_config lcd_cfg = {
368 &disp_panel, 368 &disp_panel,
369 .ac_bias = 255, 369 .ac_bias = 255,
370 .ac_bias_intrpt = 0, 370 .ac_bias_intrpt = 0,
371 .dma_burst_sz = 16, 371 .dma_burst_sz = 16,
372 .bpp = 16, 372 .bpp = 16,
373 .fdd = 255, 373 .fdd = 255,
374 .tft_alt_mode = 0, 374 .tft_alt_mode = 0,
375 .stn_565_mode = 0, 375 .stn_565_mode = 0,
376 .mono_8bit_mode = 0, 376 .mono_8bit_mode = 0,
377 .invert_line_clock = 1, 377 .invert_line_clock = 1,
378 .invert_frm_clock = 1, 378 .invert_frm_clock = 1,
379 .sync_edge = 0, 379 .sync_edge = 0,
380 .sync_ctrl = 1, 380 .sync_ctrl = 1,
381 .raster_order = 0, 381 .raster_order = 0,
382 }; 382 };
383 383
384 struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = { 384 struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata = {
385 .manu_name = "sharp", 385 .manu_name = "sharp",
386 .controller_data = &lcd_cfg, 386 .controller_data = &lcd_cfg,
387 .type = "Sharp_LCD035Q3DG01", 387 .type = "Sharp_LCD035Q3DG01",
388 }; 388 };
389 389
390 struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = { 390 struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata = {
391 .manu_name = "sharp", 391 .manu_name = "sharp",
392 .controller_data = &lcd_cfg, 392 .controller_data = &lcd_cfg,
393 .type = "Sharp_LK043T1DG01", 393 .type = "Sharp_LK043T1DG01",
394 }; 394 };
395 395
396 static struct resource da8xx_lcdc_resources[] = { 396 static struct resource da8xx_lcdc_resources[] = {
397 [0] = { /* registers */ 397 [0] = { /* registers */
398 .start = DA8XX_LCD_CNTRL_BASE, 398 .start = DA8XX_LCD_CNTRL_BASE,
399 .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1, 399 .end = DA8XX_LCD_CNTRL_BASE + SZ_4K - 1,
400 .flags = IORESOURCE_MEM, 400 .flags = IORESOURCE_MEM,
401 }, 401 },
402 [1] = { /* interrupt */ 402 [1] = { /* interrupt */
403 .start = IRQ_DA8XX_LCDINT, 403 .start = IRQ_DA8XX_LCDINT,
404 .end = IRQ_DA8XX_LCDINT, 404 .end = IRQ_DA8XX_LCDINT,
405 .flags = IORESOURCE_IRQ, 405 .flags = IORESOURCE_IRQ,
406 }, 406 },
407 }; 407 };
408 408
409 static struct platform_device da8xx_lcdc_device = { 409 static struct platform_device da8xx_lcdc_device = {
410 .name = "da8xx_lcdc", 410 .name = "da8xx_lcdc",
411 .id = 0, 411 .id = 0,
412 .num_resources = ARRAY_SIZE(da8xx_lcdc_resources), 412 .num_resources = ARRAY_SIZE(da8xx_lcdc_resources),
413 .resource = da8xx_lcdc_resources, 413 .resource = da8xx_lcdc_resources,
414 }; 414 };
415 415
416 int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) 416 int __init da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
417 { 417 {
418 da8xx_lcdc_device.dev.platform_data = pdata; 418 da8xx_lcdc_device.dev.platform_data = pdata;
419 return platform_device_register(&da8xx_lcdc_device); 419 return platform_device_register(&da8xx_lcdc_device);
420 } 420 }
421 421
422 static struct resource da8xx_mmcsd0_resources[] = { 422 static struct resource da8xx_mmcsd0_resources[] = {
423 { /* registers */ 423 { /* registers */
424 .start = DA8XX_MMCSD0_BASE, 424 .start = DA8XX_MMCSD0_BASE,
425 .end = DA8XX_MMCSD0_BASE + SZ_4K - 1, 425 .end = DA8XX_MMCSD0_BASE + SZ_4K - 1,
426 .flags = IORESOURCE_MEM, 426 .flags = IORESOURCE_MEM,
427 }, 427 },
428 { /* interrupt */ 428 { /* interrupt */
429 .start = IRQ_DA8XX_MMCSDINT0, 429 .start = IRQ_DA8XX_MMCSDINT0,
430 .end = IRQ_DA8XX_MMCSDINT0, 430 .end = IRQ_DA8XX_MMCSDINT0,
431 .flags = IORESOURCE_IRQ, 431 .flags = IORESOURCE_IRQ,
432 }, 432 },
433 { /* DMA RX */ 433 { /* DMA RX */
434 .start = EDMA_CTLR_CHAN(0, 16), 434 .start = EDMA_CTLR_CHAN(0, 16),
435 .end = EDMA_CTLR_CHAN(0, 16), 435 .end = EDMA_CTLR_CHAN(0, 16),
436 .flags = IORESOURCE_DMA, 436 .flags = IORESOURCE_DMA,
437 }, 437 },
438 { /* DMA TX */ 438 { /* DMA TX */
439 .start = EDMA_CTLR_CHAN(0, 17), 439 .start = EDMA_CTLR_CHAN(0, 17),
440 .end = EDMA_CTLR_CHAN(0, 17), 440 .end = EDMA_CTLR_CHAN(0, 17),
441 .flags = IORESOURCE_DMA, 441 .flags = IORESOURCE_DMA,
442 }, 442 },
443 }; 443 };
444 444
445 static struct platform_device da8xx_mmcsd0_device = { 445 static struct platform_device da8xx_mmcsd0_device = {
446 .name = "davinci_mmc", 446 .name = "davinci_mmc",
447 .id = 0, 447 .id = 0,
448 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources), 448 .num_resources = ARRAY_SIZE(da8xx_mmcsd0_resources),
449 .resource = da8xx_mmcsd0_resources, 449 .resource = da8xx_mmcsd0_resources,
450 }; 450 };
451 451
452 int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config) 452 int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
453 { 453 {
454 da8xx_mmcsd0_device.dev.platform_data = config; 454 da8xx_mmcsd0_device.dev.platform_data = config;
455 return platform_device_register(&da8xx_mmcsd0_device); 455 return platform_device_register(&da8xx_mmcsd0_device);
456 } 456 }
457 457
458 static struct resource da8xx_rtc_resources[] = { 458 static struct resource da8xx_rtc_resources[] = {
459 { 459 {
460 .start = DA8XX_RTC_BASE, 460 .start = DA8XX_RTC_BASE,
461 .end = DA8XX_RTC_BASE + SZ_4K - 1, 461 .end = DA8XX_RTC_BASE + SZ_4K - 1,
462 .flags = IORESOURCE_MEM, 462 .flags = IORESOURCE_MEM,
463 }, 463 },
464 { /* timer irq */ 464 { /* timer irq */
465 .start = IRQ_DA8XX_RTC, 465 .start = IRQ_DA8XX_RTC,
466 .end = IRQ_DA8XX_RTC, 466 .end = IRQ_DA8XX_RTC,
467 .flags = IORESOURCE_IRQ, 467 .flags = IORESOURCE_IRQ,
468 }, 468 },
469 { /* alarm irq */ 469 { /* alarm irq */
470 .start = IRQ_DA8XX_RTC, 470 .start = IRQ_DA8XX_RTC,
471 .end = IRQ_DA8XX_RTC, 471 .end = IRQ_DA8XX_RTC,
472 .flags = IORESOURCE_IRQ, 472 .flags = IORESOURCE_IRQ,
473 }, 473 },
474 }; 474 };
475 475
476 static struct platform_device da8xx_rtc_device = { 476 static struct platform_device da8xx_rtc_device = {
477 .name = "omap_rtc", 477 .name = "omap_rtc",
478 .id = -1, 478 .id = -1,
479 .num_resources = ARRAY_SIZE(da8xx_rtc_resources), 479 .num_resources = ARRAY_SIZE(da8xx_rtc_resources),
480 .resource = da8xx_rtc_resources, 480 .resource = da8xx_rtc_resources,
481 }; 481 };
482 482
483 int da8xx_register_rtc(void) 483 int da8xx_register_rtc(void)
484 { 484 {
485 int ret; 485 int ret;
486 486
487 /* Unlock the rtc's registers */ 487 /* Unlock the rtc's registers */
488 __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c)); 488 __raw_writel(0x83e70b13, IO_ADDRESS(DA8XX_RTC_BASE + 0x6c));
489 __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70)); 489 __raw_writel(0x95a4f1e0, IO_ADDRESS(DA8XX_RTC_BASE + 0x70));
490 490
491 ret = platform_device_register(&da8xx_rtc_device); 491 ret = platform_device_register(&da8xx_rtc_device);
492 if (!ret) 492 if (!ret)
493 /* Atleast on DA850, RTC is a wakeup source */ 493 /* Atleast on DA850, RTC is a wakeup source */
494 device_init_wakeup(&da8xx_rtc_device.dev, true); 494 device_init_wakeup(&da8xx_rtc_device.dev, true);
495 495
496 return ret; 496 return ret;
497 } 497 }
498 498
499 static void __iomem *da8xx_ddr2_ctlr_base;
500 void __iomem * __init da8xx_get_mem_ctlr(void)
501 {
502 if (da8xx_ddr2_ctlr_base)
503 return da8xx_ddr2_ctlr_base;
504
505 da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K);
506 if (!da8xx_ddr2_ctlr_base)
507 pr_warning("%s: Unable to map DDR2 controller", __func__);
508
509 return da8xx_ddr2_ctlr_base;
510 }
511
499 static struct resource da8xx_cpuidle_resources[] = { 512 static struct resource da8xx_cpuidle_resources[] = {
500 { 513 {
501 .start = DA8XX_DDR2_CTL_BASE, 514 .start = DA8XX_DDR2_CTL_BASE,
502 .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1, 515 .end = DA8XX_DDR2_CTL_BASE + SZ_32K - 1,
503 .flags = IORESOURCE_MEM, 516 .flags = IORESOURCE_MEM,
504 }, 517 },
505 }; 518 };
506 519
507 /* DA8XX devices support DDR2 power down */ 520 /* DA8XX devices support DDR2 power down */
508 static struct davinci_cpuidle_config da8xx_cpuidle_pdata = { 521 static struct davinci_cpuidle_config da8xx_cpuidle_pdata = {
509 .ddr2_pdown = 1, 522 .ddr2_pdown = 1,
510 }; 523 };
511 524
512 525
513 static struct platform_device da8xx_cpuidle_device = { 526 static struct platform_device da8xx_cpuidle_device = {
514 .name = "cpuidle-davinci", 527 .name = "cpuidle-davinci",
515 .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources), 528 .num_resources = ARRAY_SIZE(da8xx_cpuidle_resources),
516 .resource = da8xx_cpuidle_resources, 529 .resource = da8xx_cpuidle_resources,
517 .dev = { 530 .dev = {
518 .platform_data = &da8xx_cpuidle_pdata, 531 .platform_data = &da8xx_cpuidle_pdata,
519 }, 532 },
520 }; 533 };
521 534
522 int __init da8xx_register_cpuidle(void) 535 int __init da8xx_register_cpuidle(void)
523 { 536 {
537 da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr();
538
524 return platform_device_register(&da8xx_cpuidle_device); 539 return platform_device_register(&da8xx_cpuidle_device);
525 } 540 }
526 541
arch/arm/mach-davinci/include/mach/cpuidle.h
1 /* 1 /*
2 * TI DaVinci cpuidle platform support 2 * TI DaVinci cpuidle platform support
3 * 3 *
4 * 2009 (C) Texas Instruments, Inc. http://www.ti.com/ 4 * 2009 (C) Texas Instruments, Inc. http://www.ti.com/
5 * 5 *
6 * This file is licensed under the terms of the GNU General Public License 6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any 7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied. 8 * kind, whether express or implied.
9 */ 9 */
10 #ifndef _MACH_DAVINCI_CPUIDLE_H 10 #ifndef _MACH_DAVINCI_CPUIDLE_H
11 #define _MACH_DAVINCI_CPUIDLE_H 11 #define _MACH_DAVINCI_CPUIDLE_H
12 12
13 struct davinci_cpuidle_config { 13 struct davinci_cpuidle_config {
14 u32 ddr2_pdown; 14 u32 ddr2_pdown;
15 void __iomem *ddr2_ctlr_base;
15 }; 16 };
16 17
17 #endif 18 #endif
18 19
arch/arm/mach-davinci/include/mach/da8xx.h
1 /* 1 /*
2 * Chip specific defines for DA8XX/OMAP L1XX SoC 2 * Chip specific defines for DA8XX/OMAP L1XX SoC
3 * 3 *
4 * Author: Mark A. Greer <mgreer@mvista.com> 4 * Author: Mark A. Greer <mgreer@mvista.com>
5 * 5 *
6 * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under 6 * 2007, 2009 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program 7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
10 */ 10 */
11 #ifndef __ASM_ARCH_DAVINCI_DA8XX_H 11 #ifndef __ASM_ARCH_DAVINCI_DA8XX_H
12 #define __ASM_ARCH_DAVINCI_DA8XX_H 12 #define __ASM_ARCH_DAVINCI_DA8XX_H
13 13
14 #include <video/da8xx-fb.h> 14 #include <video/da8xx-fb.h>
15 15
16 #include <mach/serial.h> 16 #include <mach/serial.h>
17 #include <mach/edma.h> 17 #include <mach/edma.h>
18 #include <mach/i2c.h> 18 #include <mach/i2c.h>
19 #include <mach/emac.h> 19 #include <mach/emac.h>
20 #include <mach/asp.h> 20 #include <mach/asp.h>
21 #include <mach/mmc.h> 21 #include <mach/mmc.h>
22 #include <mach/usb.h> 22 #include <mach/usb.h>
23 23
24 extern void __iomem *da8xx_syscfg0_base; 24 extern void __iomem *da8xx_syscfg0_base;
25 extern void __iomem *da8xx_syscfg1_base; 25 extern void __iomem *da8xx_syscfg1_base;
26 26
27 /* 27 /*
28 * The cp_intc interrupt controller for the da8xx isn't in the same 28 * The cp_intc interrupt controller for the da8xx isn't in the same
29 * chunk of physical memory space as the other registers (like it is 29 * chunk of physical memory space as the other registers (like it is
30 * on the davincis) so it needs to be mapped separately. It will be 30 * on the davincis) so it needs to be mapped separately. It will be
31 * mapped early on when the I/O space is mapped and we'll put it just 31 * mapped early on when the I/O space is mapped and we'll put it just
32 * before the I/O space in the processor's virtual memory space. 32 * before the I/O space in the processor's virtual memory space.
33 */ 33 */
34 #define DA8XX_CP_INTC_BASE 0xfffee000 34 #define DA8XX_CP_INTC_BASE 0xfffee000
35 #define DA8XX_CP_INTC_SIZE SZ_8K 35 #define DA8XX_CP_INTC_SIZE SZ_8K
36 #define DA8XX_CP_INTC_VIRT (IO_VIRT - DA8XX_CP_INTC_SIZE - SZ_4K) 36 #define DA8XX_CP_INTC_VIRT (IO_VIRT - DA8XX_CP_INTC_SIZE - SZ_4K)
37 37
38 #define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000) 38 #define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000)
39 #define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) 39 #define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x))
40 #define DA8XX_JTAG_ID_REG 0x18 40 #define DA8XX_JTAG_ID_REG 0x18
41 #define DA8XX_CFGCHIP0_REG 0x17c 41 #define DA8XX_CFGCHIP0_REG 0x17c
42 #define DA8XX_CFGCHIP2_REG 0x184 42 #define DA8XX_CFGCHIP2_REG 0x184
43 #define DA8XX_CFGCHIP3_REG 0x188 43 #define DA8XX_CFGCHIP3_REG 0x188
44 44
45 #define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000) 45 #define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000)
46 #define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x)) 46 #define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x))
47 47
48 #define DA8XX_PSC0_BASE 0x01c10000 48 #define DA8XX_PSC0_BASE 0x01c10000
49 #define DA8XX_PLL0_BASE 0x01c11000 49 #define DA8XX_PLL0_BASE 0x01c11000
50 #define DA8XX_TIMER64P0_BASE 0x01c20000 50 #define DA8XX_TIMER64P0_BASE 0x01c20000
51 #define DA8XX_TIMER64P1_BASE 0x01c21000 51 #define DA8XX_TIMER64P1_BASE 0x01c21000
52 #define DA8XX_GPIO_BASE 0x01e26000 52 #define DA8XX_GPIO_BASE 0x01e26000
53 #define DA8XX_PSC1_BASE 0x01e27000 53 #define DA8XX_PSC1_BASE 0x01e27000
54 #define DA8XX_LCD_CNTRL_BASE 0x01e13000 54 #define DA8XX_LCD_CNTRL_BASE 0x01e13000
55 #define DA8XX_MMCSD0_BASE 0x01c40000 55 #define DA8XX_MMCSD0_BASE 0x01c40000
56 #define DA8XX_AEMIF_CS2_BASE 0x60000000 56 #define DA8XX_AEMIF_CS2_BASE 0x60000000
57 #define DA8XX_AEMIF_CS3_BASE 0x62000000 57 #define DA8XX_AEMIF_CS3_BASE 0x62000000
58 #define DA8XX_AEMIF_CTL_BASE 0x68000000 58 #define DA8XX_AEMIF_CTL_BASE 0x68000000
59 #define DA8XX_DDR2_CTL_BASE 0xb0000000 59 #define DA8XX_DDR2_CTL_BASE 0xb0000000
60 60
61 #define PINMUX0 0x00 61 #define PINMUX0 0x00
62 #define PINMUX1 0x04 62 #define PINMUX1 0x04
63 #define PINMUX2 0x08 63 #define PINMUX2 0x08
64 #define PINMUX3 0x0c 64 #define PINMUX3 0x0c
65 #define PINMUX4 0x10 65 #define PINMUX4 0x10
66 #define PINMUX5 0x14 66 #define PINMUX5 0x14
67 #define PINMUX6 0x18 67 #define PINMUX6 0x18
68 #define PINMUX7 0x1c 68 #define PINMUX7 0x1c
69 #define PINMUX8 0x20 69 #define PINMUX8 0x20
70 #define PINMUX9 0x24 70 #define PINMUX9 0x24
71 #define PINMUX10 0x28 71 #define PINMUX10 0x28
72 #define PINMUX11 0x2c 72 #define PINMUX11 0x2c
73 #define PINMUX12 0x30 73 #define PINMUX12 0x30
74 #define PINMUX13 0x34 74 #define PINMUX13 0x34
75 #define PINMUX14 0x38 75 #define PINMUX14 0x38
76 #define PINMUX15 0x3c 76 #define PINMUX15 0x3c
77 #define PINMUX16 0x40 77 #define PINMUX16 0x40
78 #define PINMUX17 0x44 78 #define PINMUX17 0x44
79 #define PINMUX18 0x48 79 #define PINMUX18 0x48
80 #define PINMUX19 0x4c 80 #define PINMUX19 0x4c
81 81
82 void __init da830_init(void); 82 void __init da830_init(void);
83 void __init da850_init(void); 83 void __init da850_init(void);
84 84
85 int da8xx_register_edma(void); 85 int da8xx_register_edma(void);
86 int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); 86 int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
87 int da8xx_register_watchdog(void); 87 int da8xx_register_watchdog(void);
88 int da8xx_register_usb20(unsigned mA, unsigned potpgt); 88 int da8xx_register_usb20(unsigned mA, unsigned potpgt);
89 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); 89 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
90 int da8xx_register_emac(void); 90 int da8xx_register_emac(void);
91 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); 91 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
92 int da8xx_register_mmcsd0(struct davinci_mmc_config *config); 92 int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
93 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata); 93 void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
94 int da8xx_register_rtc(void); 94 int da8xx_register_rtc(void);
95 int da850_register_cpufreq(void); 95 int da850_register_cpufreq(void);
96 int da8xx_register_cpuidle(void); 96 int da8xx_register_cpuidle(void);
97 void __iomem * __init da8xx_get_mem_ctlr(void);
97 98
98 extern struct platform_device da8xx_serial_device; 99 extern struct platform_device da8xx_serial_device;
99 extern struct emac_platform_data da8xx_emac_pdata; 100 extern struct emac_platform_data da8xx_emac_pdata;
100 extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata; 101 extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
101 extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata; 102 extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
102 103
103 extern const short da830_emif25_pins[]; 104 extern const short da830_emif25_pins[];
104 extern const short da830_spi0_pins[]; 105 extern const short da830_spi0_pins[];
105 extern const short da830_spi1_pins[]; 106 extern const short da830_spi1_pins[];
106 extern const short da830_mmc_sd_pins[]; 107 extern const short da830_mmc_sd_pins[];
107 extern const short da830_uart0_pins[]; 108 extern const short da830_uart0_pins[];
108 extern const short da830_uart1_pins[]; 109 extern const short da830_uart1_pins[];
109 extern const short da830_uart2_pins[]; 110 extern const short da830_uart2_pins[];
110 extern const short da830_usb20_pins[]; 111 extern const short da830_usb20_pins[];
111 extern const short da830_usb11_pins[]; 112 extern const short da830_usb11_pins[];
112 extern const short da830_uhpi_pins[]; 113 extern const short da830_uhpi_pins[];
113 extern const short da830_cpgmac_pins[]; 114 extern const short da830_cpgmac_pins[];
114 extern const short da830_emif3c_pins[]; 115 extern const short da830_emif3c_pins[];
115 extern const short da830_mcasp0_pins[]; 116 extern const short da830_mcasp0_pins[];
116 extern const short da830_mcasp1_pins[]; 117 extern const short da830_mcasp1_pins[];
117 extern const short da830_mcasp2_pins[]; 118 extern const short da830_mcasp2_pins[];
118 extern const short da830_i2c0_pins[]; 119 extern const short da830_i2c0_pins[];
119 extern const short da830_i2c1_pins[]; 120 extern const short da830_i2c1_pins[];
120 extern const short da830_lcdcntl_pins[]; 121 extern const short da830_lcdcntl_pins[];
121 extern const short da830_pwm_pins[]; 122 extern const short da830_pwm_pins[];
122 extern const short da830_ecap0_pins[]; 123 extern const short da830_ecap0_pins[];
123 extern const short da830_ecap1_pins[]; 124 extern const short da830_ecap1_pins[];
124 extern const short da830_ecap2_pins[]; 125 extern const short da830_ecap2_pins[];
125 extern const short da830_eqep0_pins[]; 126 extern const short da830_eqep0_pins[];
126 extern const short da830_eqep1_pins[]; 127 extern const short da830_eqep1_pins[];
127 128
128 extern const short da850_uart0_pins[]; 129 extern const short da850_uart0_pins[];
129 extern const short da850_uart1_pins[]; 130 extern const short da850_uart1_pins[];
130 extern const short da850_uart2_pins[]; 131 extern const short da850_uart2_pins[];
131 extern const short da850_i2c0_pins[]; 132 extern const short da850_i2c0_pins[];
132 extern const short da850_i2c1_pins[]; 133 extern const short da850_i2c1_pins[];
133 extern const short da850_cpgmac_pins[]; 134 extern const short da850_cpgmac_pins[];
134 extern const short da850_rmii_pins[]; 135 extern const short da850_rmii_pins[];
135 extern const short da850_mcasp_pins[]; 136 extern const short da850_mcasp_pins[];
136 extern const short da850_lcdcntl_pins[]; 137 extern const short da850_lcdcntl_pins[];
137 extern const short da850_mmcsd0_pins[]; 138 extern const short da850_mmcsd0_pins[];
138 extern const short da850_nand_pins[]; 139 extern const short da850_nand_pins[];
139 extern const short da850_nor_pins[]; 140 extern const short da850_nor_pins[];
140 141
141 int da8xx_pinmux_setup(const short pins[]); 142 int da8xx_pinmux_setup(const short pins[]);
142 143
143 #endif /* __ASM_ARCH_DAVINCI_DA8XX_H */ 144 #endif /* __ASM_ARCH_DAVINCI_DA8XX_H */
144 145