diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2009-04-29 20:44:58 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-26 10:18:15 -0400 |
commit | e38d92fdcd04c79d28679682f63a83487c4c4c05 (patch) | |
tree | b48a7614aca3793440cdd995d6eb5c25a8a9ba86 /arch/arm/mach-davinci | |
parent | 95a3477fe57e0669dcb531516f2930fe1cf27e6b (diff) |
davinci: DM646x: add base SoC and board support
Add support for DM646x SoC (a.k.a DaVinci HD) and its Evalution
Module (EVM.)
Original support done by Sudhakar Rajashekhara.
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r-- | arch/arm/mach-davinci/Kconfig | 12 | ||||
-rw-r--r-- | arch/arm/mach-davinci/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/board-dm646x-evm.c | 280 | ||||
-rw-r--r-- | arch/arm/mach-davinci/dm646x.c | 402 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/dm646x.h | 18 |
5 files changed, 714 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig index 1c3ab40e2b6c..d7614a0ab2f4 100644 --- a/arch/arm/mach-davinci/Kconfig +++ b/arch/arm/mach-davinci/Kconfig | |||
@@ -13,6 +13,9 @@ config ARCH_DAVINCI_DM644x | |||
13 | config ARCH_DAVINCI_DM355 | 13 | config ARCH_DAVINCI_DM355 |
14 | bool "DaVinci 355 based system" | 14 | bool "DaVinci 355 based system" |
15 | 15 | ||
16 | config ARCH_DAVINCI_DM646x | ||
17 | bool "DaVinci 646x based system" | ||
18 | |||
16 | comment "DaVinci Board Type" | 19 | comment "DaVinci Board Type" |
17 | 20 | ||
18 | config MACH_DAVINCI_EVM | 21 | config MACH_DAVINCI_EVM |
@@ -47,6 +50,15 @@ config MACH_DM355_LEOPARD | |||
47 | Configure this option to specify the whether the board used | 50 | Configure this option to specify the whether the board used |
48 | for development is a DM355 Leopard board. | 51 | for development is a DM355 Leopard board. |
49 | 52 | ||
53 | config MACH_DAVINCI_DM6467_EVM | ||
54 | bool "TI DM6467 EVM" | ||
55 | default n | ||
56 | depends on ARCH_DAVINCI_DM646x | ||
57 | help | ||
58 | Configure this option to specify the whether the board used | ||
59 | for development is a DM6467 EVM | ||
60 | |||
61 | |||
50 | config DAVINCI_MUX | 62 | config DAVINCI_MUX |
51 | bool "DAVINCI multiplexing support" | 63 | bool "DAVINCI multiplexing support" |
52 | depends on ARCH_DAVINCI | 64 | depends on ARCH_DAVINCI |
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index 381c363d98ac..2873149da7f0 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile | |||
@@ -13,9 +13,11 @@ obj-$(CONFIG_CP_INTC) += cp_intc.o | |||
13 | # Chip specific | 13 | # Chip specific |
14 | obj-$(CONFIG_ARCH_DAVINCI_DM644x) += dm644x.o | 14 | obj-$(CONFIG_ARCH_DAVINCI_DM644x) += dm644x.o |
15 | obj-$(CONFIG_ARCH_DAVINCI_DM355) += dm355.o | 15 | obj-$(CONFIG_ARCH_DAVINCI_DM355) += dm355.o |
16 | obj-$(CONFIG_ARCH_DAVINCI_DM646x) += dm646x.o | ||
16 | 17 | ||
17 | # Board specific | 18 | # Board specific |
18 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o | 19 | obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o |
19 | obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o | 20 | obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o |
20 | obj-$(CONFIG_MACH_DAVINCI_DM355_EVM) += board-dm355-evm.o | 21 | obj-$(CONFIG_MACH_DAVINCI_DM355_EVM) += board-dm355-evm.o |
21 | obj-$(CONFIG_MACH_DM355_LEOPARD) += board-dm355-leopard.o | 22 | obj-$(CONFIG_MACH_DM355_LEOPARD) += board-dm355-leopard.o |
23 | obj-$(CONFIG_MACH_DAVINCI_DM6467_EVM) += board-dm646x-evm.o | ||
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c new file mode 100644 index 000000000000..94cb623b1ec9 --- /dev/null +++ b/arch/arm/mach-davinci/board-dm646x-evm.c | |||
@@ -0,0 +1,280 @@ | |||
1 | /* | ||
2 | * TI DaVinci DM646X EVM board | ||
3 | * | ||
4 | * Derived from: arch/arm/mach-davinci/board-evm.c | ||
5 | * Copyright (C) 2006 Texas Instruments. | ||
6 | * | ||
7 | * (C) 2007-2008, MontaVista Software, Inc. | ||
8 | * | ||
9 | * This file is licensed under the terms of the GNU General Public License | ||
10 | * version 2. This program is licensed "as is" without any warranty of any | ||
11 | * kind, whether express or implied. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | /************************************************************************** | ||
16 | * Included Files | ||
17 | **************************************************************************/ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/major.h> | ||
24 | #include <linux/root_dev.h> | ||
25 | #include <linux/dma-mapping.h> | ||
26 | #include <linux/serial.h> | ||
27 | #include <linux/serial_8250.h> | ||
28 | #include <linux/leds.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/io.h> | ||
31 | #include <linux/platform_device.h> | ||
32 | #include <linux/i2c.h> | ||
33 | #include <linux/i2c/at24.h> | ||
34 | #include <linux/i2c/pcf857x.h> | ||
35 | #include <linux/etherdevice.h> | ||
36 | |||
37 | #include <asm/setup.h> | ||
38 | #include <asm/mach-types.h> | ||
39 | #include <asm/mach/arch.h> | ||
40 | #include <asm/mach/map.h> | ||
41 | #include <asm/mach/flash.h> | ||
42 | |||
43 | #include <mach/dm646x.h> | ||
44 | #include <mach/common.h> | ||
45 | #include <mach/psc.h> | ||
46 | #include <mach/serial.h> | ||
47 | #include <mach/i2c.h> | ||
48 | |||
49 | static struct davinci_uart_config uart_config __initdata = { | ||
50 | .enabled_uarts = (1 << 0), | ||
51 | }; | ||
52 | |||
53 | /* LEDS */ | ||
54 | |||
55 | static struct gpio_led evm_leds[] = { | ||
56 | { .name = "DS1", .active_low = 1, }, | ||
57 | { .name = "DS2", .active_low = 1, }, | ||
58 | { .name = "DS3", .active_low = 1, }, | ||
59 | { .name = "DS4", .active_low = 1, }, | ||
60 | }; | ||
61 | |||
62 | static __initconst struct gpio_led_platform_data evm_led_data = { | ||
63 | .num_leds = ARRAY_SIZE(evm_leds), | ||
64 | .leds = evm_leds, | ||
65 | }; | ||
66 | |||
67 | static struct platform_device *evm_led_dev; | ||
68 | |||
69 | static int evm_led_setup(struct i2c_client *client, int gpio, | ||
70 | unsigned int ngpio, void *c) | ||
71 | { | ||
72 | struct gpio_led *leds = evm_leds; | ||
73 | int status; | ||
74 | |||
75 | while (ngpio--) { | ||
76 | leds->gpio = gpio++; | ||
77 | leds++; | ||
78 | }; | ||
79 | |||
80 | evm_led_dev = platform_device_alloc("leds-gpio", 0); | ||
81 | platform_device_add_data(evm_led_dev, &evm_led_data, | ||
82 | sizeof(evm_led_data)); | ||
83 | |||
84 | evm_led_dev->dev.parent = &client->dev; | ||
85 | status = platform_device_add(evm_led_dev); | ||
86 | if (status < 0) { | ||
87 | platform_device_put(evm_led_dev); | ||
88 | evm_led_dev = NULL; | ||
89 | } | ||
90 | return status; | ||
91 | } | ||
92 | |||
93 | static int evm_led_teardown(struct i2c_client *client, int gpio, | ||
94 | unsigned ngpio, void *c) | ||
95 | { | ||
96 | if (evm_led_dev) { | ||
97 | platform_device_unregister(evm_led_dev); | ||
98 | evm_led_dev = NULL; | ||
99 | } | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | static int evm_sw_gpio[4] = { -EINVAL, -EINVAL, -EINVAL, -EINVAL }; | ||
104 | |||
105 | static int evm_sw_setup(struct i2c_client *client, int gpio, | ||
106 | unsigned ngpio, void *c) | ||
107 | { | ||
108 | int status; | ||
109 | int i; | ||
110 | char label[10]; | ||
111 | |||
112 | for (i = 0; i < 4; ++i) { | ||
113 | snprintf(label, 10, "user_sw%d", i); | ||
114 | status = gpio_request(gpio, label); | ||
115 | if (status) | ||
116 | goto out_free; | ||
117 | evm_sw_gpio[i] = gpio++; | ||
118 | |||
119 | status = gpio_direction_input(evm_sw_gpio[i]); | ||
120 | if (status) { | ||
121 | gpio_free(evm_sw_gpio[i]); | ||
122 | evm_sw_gpio[i] = -EINVAL; | ||
123 | goto out_free; | ||
124 | } | ||
125 | |||
126 | status = gpio_export(evm_sw_gpio[i], 0); | ||
127 | if (status) { | ||
128 | gpio_free(evm_sw_gpio[i]); | ||
129 | evm_sw_gpio[i] = -EINVAL; | ||
130 | goto out_free; | ||
131 | } | ||
132 | } | ||
133 | return status; | ||
134 | out_free: | ||
135 | for (i = 0; i < 4; ++i) { | ||
136 | if (evm_sw_gpio[i] != -EINVAL) { | ||
137 | gpio_free(evm_sw_gpio[i]); | ||
138 | evm_sw_gpio[i] = -EINVAL; | ||
139 | } | ||
140 | } | ||
141 | return status; | ||
142 | } | ||
143 | |||
144 | static int evm_sw_teardown(struct i2c_client *client, int gpio, | ||
145 | unsigned ngpio, void *c) | ||
146 | { | ||
147 | int i; | ||
148 | |||
149 | for (i = 0; i < 4; ++i) { | ||
150 | if (evm_sw_gpio[i] != -EINVAL) { | ||
151 | gpio_unexport(evm_sw_gpio[i]); | ||
152 | gpio_free(evm_sw_gpio[i]); | ||
153 | evm_sw_gpio[i] = -EINVAL; | ||
154 | } | ||
155 | } | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int evm_pcf_setup(struct i2c_client *client, int gpio, | ||
160 | unsigned int ngpio, void *c) | ||
161 | { | ||
162 | int status; | ||
163 | |||
164 | if (ngpio < 8) | ||
165 | return -EINVAL; | ||
166 | |||
167 | status = evm_sw_setup(client, gpio, 4, c); | ||
168 | if (status) | ||
169 | return status; | ||
170 | |||
171 | return evm_led_setup(client, gpio+4, 4, c); | ||
172 | } | ||
173 | |||
174 | static int evm_pcf_teardown(struct i2c_client *client, int gpio, | ||
175 | unsigned int ngpio, void *c) | ||
176 | { | ||
177 | BUG_ON(ngpio < 8); | ||
178 | |||
179 | evm_sw_teardown(client, gpio, 4, c); | ||
180 | evm_led_teardown(client, gpio+4, 4, c); | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
185 | static struct pcf857x_platform_data pcf_data = { | ||
186 | .gpio_base = DAVINCI_N_GPIO+1, | ||
187 | .setup = evm_pcf_setup, | ||
188 | .teardown = evm_pcf_teardown, | ||
189 | }; | ||
190 | |||
191 | /* Most of this EEPROM is unused, but U-Boot uses some data: | ||
192 | * - 0x7f00, 6 bytes Ethernet Address | ||
193 | * - ... newer boards may have more | ||
194 | */ | ||
195 | static struct memory_accessor *at24_mem_acc; | ||
196 | |||
197 | static void at24_setup(struct memory_accessor *mem_acc, void *context) | ||
198 | { | ||
199 | char mac_addr[6]; | ||
200 | |||
201 | at24_mem_acc = mem_acc; | ||
202 | |||
203 | /* Read MAC addr from EEPROM */ | ||
204 | if (at24_mem_acc->read(at24_mem_acc, mac_addr, 0x7f00, ETH_ALEN) == | ||
205 | ETH_ALEN) | ||
206 | pr_info("Read MAC addr from EEPROM: %pM\n", mac_addr); | ||
207 | } | ||
208 | |||
209 | static struct at24_platform_data eeprom_info = { | ||
210 | .byte_len = (256*1024) / 8, | ||
211 | .page_size = 64, | ||
212 | .flags = AT24_FLAG_ADDR16, | ||
213 | .setup = at24_setup, | ||
214 | }; | ||
215 | |||
216 | int dm646xevm_eeprom_read(void *buf, off_t off, size_t count) | ||
217 | { | ||
218 | if (at24_mem_acc) | ||
219 | return at24_mem_acc->read(at24_mem_acc, buf, off, count); | ||
220 | return -ENODEV; | ||
221 | } | ||
222 | EXPORT_SYMBOL(dm646xevm_eeprom_read); | ||
223 | |||
224 | int dm646xevm_eeprom_write(void *buf, off_t off, size_t count) | ||
225 | { | ||
226 | if (at24_mem_acc) | ||
227 | return at24_mem_acc->write(at24_mem_acc, buf, off, count); | ||
228 | return -ENODEV; | ||
229 | } | ||
230 | EXPORT_SYMBOL(dm646xevm_eeprom_write); | ||
231 | |||
232 | static struct i2c_board_info __initdata i2c_info[] = { | ||
233 | { | ||
234 | I2C_BOARD_INFO("24c256", 0x50), | ||
235 | .platform_data = &eeprom_info, | ||
236 | }, | ||
237 | { | ||
238 | I2C_BOARD_INFO("pcf8574a", 0x38), | ||
239 | .platform_data = &pcf_data, | ||
240 | }, | ||
241 | }; | ||
242 | |||
243 | static struct davinci_i2c_platform_data i2c_pdata = { | ||
244 | .bus_freq = 100 /* kHz */, | ||
245 | .bus_delay = 0 /* usec */, | ||
246 | }; | ||
247 | |||
248 | static void __init evm_init_i2c(void) | ||
249 | { | ||
250 | davinci_init_i2c(&i2c_pdata); | ||
251 | i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); | ||
252 | } | ||
253 | |||
254 | static void __init davinci_map_io(void) | ||
255 | { | ||
256 | davinci_map_common_io(); | ||
257 | dm646x_init(); | ||
258 | } | ||
259 | |||
260 | static __init void evm_init(void) | ||
261 | { | ||
262 | evm_init_i2c(); | ||
263 | davinci_serial_init(&uart_config); | ||
264 | } | ||
265 | |||
266 | static __init void davinci_dm646x_evm_irq_init(void) | ||
267 | { | ||
268 | davinci_irq_init(); | ||
269 | } | ||
270 | |||
271 | MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") | ||
272 | .phys_io = IO_PHYS, | ||
273 | .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, | ||
274 | .boot_params = (0x80000100), | ||
275 | .map_io = davinci_map_io, | ||
276 | .init_irq = davinci_dm646x_evm_irq_init, | ||
277 | .timer = &davinci_timer, | ||
278 | .init_machine = evm_init, | ||
279 | MACHINE_END | ||
280 | |||
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c new file mode 100644 index 000000000000..93443a6637ea --- /dev/null +++ b/arch/arm/mach-davinci/dm646x.c | |||
@@ -0,0 +1,402 @@ | |||
1 | /* | ||
2 | * TI DaVinci DM644x chip specific setup | ||
3 | * | ||
4 | * Author: Kevin Hilman, Deep Root Systems, LLC | ||
5 | * | ||
6 | * 2007 (c) Deep Root Systems, LLC. This file is licensed under | ||
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 | ||
9 | * or implied. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | |||
16 | #include <mach/dm646x.h> | ||
17 | #include <mach/clock.h> | ||
18 | #include <mach/cputype.h> | ||
19 | #include <mach/edma.h> | ||
20 | #include <mach/irqs.h> | ||
21 | #include <mach/psc.h> | ||
22 | #include <mach/mux.h> | ||
23 | |||
24 | #include "clock.h" | ||
25 | #include "mux.h" | ||
26 | |||
27 | /* | ||
28 | * Device specific clocks | ||
29 | */ | ||
30 | #define DM646X_REF_FREQ 27000000 | ||
31 | #define DM646X_AUX_FREQ 24000000 | ||
32 | |||
33 | static struct pll_data pll1_data = { | ||
34 | .num = 1, | ||
35 | .phys_base = DAVINCI_PLL1_BASE, | ||
36 | }; | ||
37 | |||
38 | static struct pll_data pll2_data = { | ||
39 | .num = 2, | ||
40 | .phys_base = DAVINCI_PLL2_BASE, | ||
41 | }; | ||
42 | |||
43 | static struct clk ref_clk = { | ||
44 | .name = "ref_clk", | ||
45 | .rate = DM646X_REF_FREQ, | ||
46 | }; | ||
47 | |||
48 | static struct clk aux_clkin = { | ||
49 | .name = "aux_clkin", | ||
50 | .rate = DM646X_AUX_FREQ, | ||
51 | }; | ||
52 | |||
53 | static struct clk pll1_clk = { | ||
54 | .name = "pll1", | ||
55 | .parent = &ref_clk, | ||
56 | .pll_data = &pll1_data, | ||
57 | .flags = CLK_PLL, | ||
58 | }; | ||
59 | |||
60 | static struct clk pll1_sysclk1 = { | ||
61 | .name = "pll1_sysclk1", | ||
62 | .parent = &pll1_clk, | ||
63 | .flags = CLK_PLL, | ||
64 | .div_reg = PLLDIV1, | ||
65 | }; | ||
66 | |||
67 | static struct clk pll1_sysclk2 = { | ||
68 | .name = "pll1_sysclk2", | ||
69 | .parent = &pll1_clk, | ||
70 | .flags = CLK_PLL, | ||
71 | .div_reg = PLLDIV2, | ||
72 | }; | ||
73 | |||
74 | static struct clk pll1_sysclk3 = { | ||
75 | .name = "pll1_sysclk3", | ||
76 | .parent = &pll1_clk, | ||
77 | .flags = CLK_PLL, | ||
78 | .div_reg = PLLDIV3, | ||
79 | }; | ||
80 | |||
81 | static struct clk pll1_sysclk4 = { | ||
82 | .name = "pll1_sysclk4", | ||
83 | .parent = &pll1_clk, | ||
84 | .flags = CLK_PLL, | ||
85 | .div_reg = PLLDIV4, | ||
86 | }; | ||
87 | |||
88 | static struct clk pll1_sysclk5 = { | ||
89 | .name = "pll1_sysclk5", | ||
90 | .parent = &pll1_clk, | ||
91 | .flags = CLK_PLL, | ||
92 | .div_reg = PLLDIV5, | ||
93 | }; | ||
94 | |||
95 | static struct clk pll1_sysclk6 = { | ||
96 | .name = "pll1_sysclk6", | ||
97 | .parent = &pll1_clk, | ||
98 | .flags = CLK_PLL, | ||
99 | .div_reg = PLLDIV6, | ||
100 | }; | ||
101 | |||
102 | static struct clk pll1_sysclk8 = { | ||
103 | .name = "pll1_sysclk8", | ||
104 | .parent = &pll1_clk, | ||
105 | .flags = CLK_PLL, | ||
106 | .div_reg = PLLDIV8, | ||
107 | }; | ||
108 | |||
109 | static struct clk pll1_sysclk9 = { | ||
110 | .name = "pll1_sysclk9", | ||
111 | .parent = &pll1_clk, | ||
112 | .flags = CLK_PLL, | ||
113 | .div_reg = PLLDIV9, | ||
114 | }; | ||
115 | |||
116 | static struct clk pll1_sysclkbp = { | ||
117 | .name = "pll1_sysclkbp", | ||
118 | .parent = &pll1_clk, | ||
119 | .flags = CLK_PLL | PRE_PLL, | ||
120 | .div_reg = BPDIV, | ||
121 | }; | ||
122 | |||
123 | static struct clk pll1_aux_clk = { | ||
124 | .name = "pll1_aux_clk", | ||
125 | .parent = &pll1_clk, | ||
126 | .flags = CLK_PLL | PRE_PLL, | ||
127 | }; | ||
128 | |||
129 | static struct clk pll2_clk = { | ||
130 | .name = "pll2_clk", | ||
131 | .parent = &ref_clk, | ||
132 | .pll_data = &pll2_data, | ||
133 | .flags = CLK_PLL, | ||
134 | }; | ||
135 | |||
136 | static struct clk pll2_sysclk1 = { | ||
137 | .name = "pll2_sysclk1", | ||
138 | .parent = &pll2_clk, | ||
139 | .flags = CLK_PLL, | ||
140 | .div_reg = PLLDIV1, | ||
141 | }; | ||
142 | |||
143 | static struct clk dsp_clk = { | ||
144 | .name = "dsp", | ||
145 | .parent = &pll1_sysclk1, | ||
146 | .lpsc = DM646X_LPSC_C64X_CPU, | ||
147 | .flags = PSC_DSP, | ||
148 | .usecount = 1, /* REVISIT how to disable? */ | ||
149 | }; | ||
150 | |||
151 | static struct clk arm_clk = { | ||
152 | .name = "arm", | ||
153 | .parent = &pll1_sysclk2, | ||
154 | .lpsc = DM646X_LPSC_ARM, | ||
155 | .flags = ALWAYS_ENABLED, | ||
156 | }; | ||
157 | |||
158 | static struct clk uart0_clk = { | ||
159 | .name = "uart0", | ||
160 | .parent = &aux_clkin, | ||
161 | .lpsc = DM646X_LPSC_UART0, | ||
162 | }; | ||
163 | |||
164 | static struct clk uart1_clk = { | ||
165 | .name = "uart1", | ||
166 | .parent = &aux_clkin, | ||
167 | .lpsc = DM646X_LPSC_UART1, | ||
168 | }; | ||
169 | |||
170 | static struct clk uart2_clk = { | ||
171 | .name = "uart2", | ||
172 | .parent = &aux_clkin, | ||
173 | .lpsc = DM646X_LPSC_UART2, | ||
174 | }; | ||
175 | |||
176 | static struct clk i2c_clk = { | ||
177 | .name = "I2CCLK", | ||
178 | .parent = &pll1_sysclk3, | ||
179 | .lpsc = DM646X_LPSC_I2C, | ||
180 | }; | ||
181 | |||
182 | static struct clk gpio_clk = { | ||
183 | .name = "gpio", | ||
184 | .parent = &pll1_sysclk3, | ||
185 | .lpsc = DM646X_LPSC_GPIO, | ||
186 | }; | ||
187 | |||
188 | static struct clk aemif_clk = { | ||
189 | .name = "aemif", | ||
190 | .parent = &pll1_sysclk3, | ||
191 | .lpsc = DM646X_LPSC_AEMIF, | ||
192 | .flags = ALWAYS_ENABLED, | ||
193 | }; | ||
194 | |||
195 | static struct clk emac_clk = { | ||
196 | .name = "emac", | ||
197 | .parent = &pll1_sysclk3, | ||
198 | .lpsc = DM646X_LPSC_EMAC, | ||
199 | }; | ||
200 | |||
201 | static struct clk pwm0_clk = { | ||
202 | .name = "pwm0", | ||
203 | .parent = &pll1_sysclk3, | ||
204 | .lpsc = DM646X_LPSC_PWM0, | ||
205 | .usecount = 1, /* REVIST: disabling hangs system */ | ||
206 | }; | ||
207 | |||
208 | static struct clk pwm1_clk = { | ||
209 | .name = "pwm1", | ||
210 | .parent = &pll1_sysclk3, | ||
211 | .lpsc = DM646X_LPSC_PWM1, | ||
212 | .usecount = 1, /* REVIST: disabling hangs system */ | ||
213 | }; | ||
214 | |||
215 | static struct clk timer0_clk = { | ||
216 | .name = "timer0", | ||
217 | .parent = &pll1_sysclk3, | ||
218 | .lpsc = DM646X_LPSC_TIMER0, | ||
219 | }; | ||
220 | |||
221 | static struct clk timer1_clk = { | ||
222 | .name = "timer1", | ||
223 | .parent = &pll1_sysclk3, | ||
224 | .lpsc = DM646X_LPSC_TIMER1, | ||
225 | }; | ||
226 | |||
227 | static struct clk timer2_clk = { | ||
228 | .name = "timer2", | ||
229 | .parent = &pll1_sysclk3, | ||
230 | .flags = ALWAYS_ENABLED, /* no LPSC, always enabled; c.f. spruep9a */ | ||
231 | }; | ||
232 | |||
233 | static struct clk vpif0_clk = { | ||
234 | .name = "vpif0", | ||
235 | .parent = &ref_clk, | ||
236 | .lpsc = DM646X_LPSC_VPSSMSTR, | ||
237 | .flags = ALWAYS_ENABLED, | ||
238 | }; | ||
239 | |||
240 | static struct clk vpif1_clk = { | ||
241 | .name = "vpif1", | ||
242 | .parent = &ref_clk, | ||
243 | .lpsc = DM646X_LPSC_VPSSSLV, | ||
244 | .flags = ALWAYS_ENABLED, | ||
245 | }; | ||
246 | |||
247 | struct davinci_clk dm646x_clks[] = { | ||
248 | CLK(NULL, "ref", &ref_clk), | ||
249 | CLK(NULL, "aux", &aux_clkin), | ||
250 | CLK(NULL, "pll1", &pll1_clk), | ||
251 | CLK(NULL, "pll1_sysclk", &pll1_sysclk1), | ||
252 | CLK(NULL, "pll1_sysclk", &pll1_sysclk2), | ||
253 | CLK(NULL, "pll1_sysclk", &pll1_sysclk3), | ||
254 | CLK(NULL, "pll1_sysclk", &pll1_sysclk4), | ||
255 | CLK(NULL, "pll1_sysclk", &pll1_sysclk5), | ||
256 | CLK(NULL, "pll1_sysclk", &pll1_sysclk6), | ||
257 | CLK(NULL, "pll1_sysclk", &pll1_sysclk8), | ||
258 | CLK(NULL, "pll1_sysclk", &pll1_sysclk9), | ||
259 | CLK(NULL, "pll1_sysclk", &pll1_sysclkbp), | ||
260 | CLK(NULL, "pll1_aux", &pll1_aux_clk), | ||
261 | CLK(NULL, "pll2", &pll2_clk), | ||
262 | CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), | ||
263 | CLK(NULL, "dsp", &dsp_clk), | ||
264 | CLK(NULL, "arm", &arm_clk), | ||
265 | CLK(NULL, "uart0", &uart0_clk), | ||
266 | CLK(NULL, "uart1", &uart1_clk), | ||
267 | CLK(NULL, "uart2", &uart2_clk), | ||
268 | CLK("i2c_davinci.1", NULL, &i2c_clk), | ||
269 | CLK(NULL, "gpio", &gpio_clk), | ||
270 | CLK(NULL, "aemif", &aemif_clk), | ||
271 | CLK("davinci_emac.1", NULL, &emac_clk), | ||
272 | CLK(NULL, "pwm0", &pwm0_clk), | ||
273 | CLK(NULL, "pwm1", &pwm1_clk), | ||
274 | CLK(NULL, "timer0", &timer0_clk), | ||
275 | CLK(NULL, "timer1", &timer1_clk), | ||
276 | CLK("watchdog", NULL, &timer2_clk), | ||
277 | CLK(NULL, "vpif0", &vpif0_clk), | ||
278 | CLK(NULL, "vpif1", &vpif1_clk), | ||
279 | CLK(NULL, NULL, NULL), | ||
280 | }; | ||
281 | |||
282 | /* | ||
283 | * Device specific mux setup | ||
284 | * | ||
285 | * soc description mux mode mode mux dbg | ||
286 | * reg offset mask mode | ||
287 | */ | ||
288 | static const struct mux_config dm646x_pins[] = { | ||
289 | MUX_CFG(DM646X, ATAEN, 0, 0, 1, 1, true) | ||
290 | |||
291 | MUX_CFG(DM646X, AUDCK1, 0, 29, 1, 0, false) | ||
292 | |||
293 | MUX_CFG(DM646X, AUDCK0, 0, 28, 1, 0, false) | ||
294 | |||
295 | MUX_CFG(DM646X, CRGMUX, 0, 24, 7, 5, true) | ||
296 | |||
297 | MUX_CFG(DM646X, STSOMUX_DISABLE, 0, 22, 3, 0, true) | ||
298 | |||
299 | MUX_CFG(DM646X, STSIMUX_DISABLE, 0, 20, 3, 0, true) | ||
300 | |||
301 | MUX_CFG(DM646X, PTSOMUX_DISABLE, 0, 18, 3, 0, true) | ||
302 | |||
303 | MUX_CFG(DM646X, PTSIMUX_DISABLE, 0, 16, 3, 0, true) | ||
304 | |||
305 | MUX_CFG(DM646X, STSOMUX, 0, 22, 3, 2, true) | ||
306 | |||
307 | MUX_CFG(DM646X, STSIMUX, 0, 20, 3, 2, true) | ||
308 | |||
309 | MUX_CFG(DM646X, PTSOMUX_PARALLEL, 0, 18, 3, 2, true) | ||
310 | |||
311 | MUX_CFG(DM646X, PTSIMUX_PARALLEL, 0, 16, 3, 2, true) | ||
312 | |||
313 | MUX_CFG(DM646X, PTSOMUX_SERIAL, 0, 18, 3, 3, true) | ||
314 | |||
315 | MUX_CFG(DM646X, PTSIMUX_SERIAL, 0, 16, 3, 3, true) | ||
316 | }; | ||
317 | |||
318 | /*----------------------------------------------------------------------*/ | ||
319 | |||
320 | static const s8 dma_chan_dm646x_no_event[] = { | ||
321 | 0, 1, 2, 3, 13, | ||
322 | 14, 15, 24, 25, 26, | ||
323 | 27, 30, 31, 54, 55, | ||
324 | 56, | ||
325 | -1 | ||
326 | }; | ||
327 | |||
328 | static struct edma_soc_info dm646x_edma_info = { | ||
329 | .n_channel = 64, | ||
330 | .n_region = 6, /* 0-1, 4-7 */ | ||
331 | .n_slot = 512, | ||
332 | .n_tc = 4, | ||
333 | .noevent = dma_chan_dm646x_no_event, | ||
334 | }; | ||
335 | |||
336 | static struct resource edma_resources[] = { | ||
337 | { | ||
338 | .name = "edma_cc", | ||
339 | .start = 0x01c00000, | ||
340 | .end = 0x01c00000 + SZ_64K - 1, | ||
341 | .flags = IORESOURCE_MEM, | ||
342 | }, | ||
343 | { | ||
344 | .name = "edma_tc0", | ||
345 | .start = 0x01c10000, | ||
346 | .end = 0x01c10000 + SZ_1K - 1, | ||
347 | .flags = IORESOURCE_MEM, | ||
348 | }, | ||
349 | { | ||
350 | .name = "edma_tc1", | ||
351 | .start = 0x01c10400, | ||
352 | .end = 0x01c10400 + SZ_1K - 1, | ||
353 | .flags = IORESOURCE_MEM, | ||
354 | }, | ||
355 | { | ||
356 | .name = "edma_tc2", | ||
357 | .start = 0x01c10800, | ||
358 | .end = 0x01c10800 + SZ_1K - 1, | ||
359 | .flags = IORESOURCE_MEM, | ||
360 | }, | ||
361 | { | ||
362 | .name = "edma_tc3", | ||
363 | .start = 0x01c10c00, | ||
364 | .end = 0x01c10c00 + SZ_1K - 1, | ||
365 | .flags = IORESOURCE_MEM, | ||
366 | }, | ||
367 | { | ||
368 | .start = IRQ_CCINT0, | ||
369 | .flags = IORESOURCE_IRQ, | ||
370 | }, | ||
371 | { | ||
372 | .start = IRQ_CCERRINT, | ||
373 | .flags = IORESOURCE_IRQ, | ||
374 | }, | ||
375 | /* not using TC*_ERR */ | ||
376 | }; | ||
377 | |||
378 | static struct platform_device dm646x_edma_device = { | ||
379 | .name = "edma", | ||
380 | .id = -1, | ||
381 | .dev.platform_data = &dm646x_edma_info, | ||
382 | .num_resources = ARRAY_SIZE(edma_resources), | ||
383 | .resource = edma_resources, | ||
384 | }; | ||
385 | |||
386 | /*----------------------------------------------------------------------*/ | ||
387 | |||
388 | void __init dm646x_init(void) | ||
389 | { | ||
390 | davinci_clk_init(dm646x_clks); | ||
391 | davinci_mux_register(dm646x_pins, ARRAY_SIZE(dm646x_pins)); | ||
392 | } | ||
393 | |||
394 | static int __init dm646x_init_devices(void) | ||
395 | { | ||
396 | if (!cpu_is_davinci_dm646x()) | ||
397 | return 0; | ||
398 | |||
399 | platform_device_register(&dm646x_edma_device); | ||
400 | return 0; | ||
401 | } | ||
402 | postcore_initcall(dm646x_init_devices); | ||
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h new file mode 100644 index 000000000000..d917939af158 --- /dev/null +++ b/arch/arm/mach-davinci/include/mach/dm646x.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /* | ||
2 | * Chip specific defines for DM646x SoC | ||
3 | * | ||
4 | * Author: Kevin Hilman, Deep Root Systems, LLC | ||
5 | * | ||
6 | * 2007 (c) Deep Root Systems, LLC. This file is licensed under | ||
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 | ||
9 | * or implied. | ||
10 | */ | ||
11 | #ifndef __ASM_ARCH_DM646X_H | ||
12 | #define __ASM_ARCH_DM646X_H | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | |||
16 | void __init dm646x_init(void); | ||
17 | |||
18 | #endif /* __ASM_ARCH_DM646X_H */ | ||