aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-davinci
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/Kconfig101
-rw-r--r--arch/arm/mach-davinci/Makefile4
-rw-r--r--arch/arm/mach-davinci/aemif.c133
-rw-r--r--arch/arm/mach-davinci/board-da830-evm.c93
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c525
-rw-r--r--arch/arm/mach-davinci/board-dm355-evm.c2
-rw-r--r--arch/arm/mach-davinci/board-dm355-leopard.c2
-rw-r--r--arch/arm/mach-davinci/board-dm365-evm.c17
-rw-r--r--arch/arm/mach-davinci/board-dm644x-evm.c28
-rw-r--r--arch/arm/mach-davinci/board-dm646x-evm.c25
-rw-r--r--arch/arm/mach-davinci/board-mityomapl138.c573
-rw-r--r--arch/arm/mach-davinci/board-neuros-osd2.c11
-rw-r--r--arch/arm/mach-davinci/board-omapl138-hawk.c346
-rw-r--r--arch/arm/mach-davinci/board-sffsdr.c9
-rw-r--r--arch/arm/mach-davinci/board-tnetv107x-evm.c115
-rw-r--r--arch/arm/mach-davinci/clock.c75
-rw-r--r--arch/arm/mach-davinci/clock.h7
-rw-r--r--arch/arm/mach-davinci/cp_intc.c34
-rw-r--r--arch/arm/mach-davinci/cpufreq.c36
-rw-r--r--arch/arm/mach-davinci/da830.c6
-rw-r--r--arch/arm/mach-davinci/da850.c224
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c210
-rw-r--r--arch/arm/mach-davinci/devices-tnetv107x.c90
-rw-r--r--arch/arm/mach-davinci/devices.c18
-rw-r--r--arch/arm/mach-davinci/dm355.c20
-rw-r--r--arch/arm/mach-davinci/dm365.c40
-rw-r--r--arch/arm/mach-davinci/dm644x.c29
-rw-r--r--arch/arm/mach-davinci/dm646x.c22
-rw-r--r--arch/arm/mach-davinci/dma.c8
-rw-r--r--arch/arm/mach-davinci/gpio-tnetv107x.c18
-rw-r--r--arch/arm/mach-davinci/gpio.c97
-rw-r--r--arch/arm/mach-davinci/include/mach/aemif.h36
-rw-r--r--arch/arm/mach-davinci/include/mach/clkdev.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/cputype.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h27
-rw-r--r--arch/arm/mach-davinci/include/mach/debug-macro.S49
-rw-r--r--arch/arm/mach-davinci/include/mach/dm365.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/dm644x.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/dm646x.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/edma.h36
-rw-r--r--arch/arm/mach-davinci/include/mach/hardware.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/io.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/memory.h22
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h4
-rw-r--r--arch/arm/mach-davinci/include/mach/nand.h6
-rw-r--r--arch/arm/mach-davinci/include/mach/psc.h3
-rw-r--r--arch/arm/mach-davinci/include/mach/serial.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/spi.h61
-rw-r--r--arch/arm/mach-davinci/include/mach/tnetv107x.h5
-rw-r--r--arch/arm/mach-davinci/include/mach/uncompress.h7
-rw-r--r--arch/arm/mach-davinci/irq.c91
-rw-r--r--arch/arm/mach-davinci/pm.c2
-rw-r--r--arch/arm/mach-davinci/psc.c13
-rw-r--r--arch/arm/mach-davinci/time.c31
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c36
-rw-r--r--arch/arm/mach-davinci/usb.c6
56 files changed, 2790 insertions, 582 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 71f90f864748..c0deacae778d 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -20,23 +20,23 @@ config ARCH_DAVINCI_DM644x
20 select ARCH_DAVINCI_DMx 20 select ARCH_DAVINCI_DMx
21 21
22config ARCH_DAVINCI_DM355 22config ARCH_DAVINCI_DM355
23 bool "DaVinci 355 based system" 23 bool "DaVinci 355 based system"
24 select AINTC 24 select AINTC
25 select ARCH_DAVINCI_DMx 25 select ARCH_DAVINCI_DMx
26 26
27config ARCH_DAVINCI_DM646x 27config ARCH_DAVINCI_DM646x
28 bool "DaVinci 646x based system" 28 bool "DaVinci 646x based system"
29 select AINTC 29 select AINTC
30 select ARCH_DAVINCI_DMx 30 select ARCH_DAVINCI_DMx
31 31
32config ARCH_DAVINCI_DA830 32config ARCH_DAVINCI_DA830
33 bool "DA830/OMAP-L137 based system" 33 bool "DA830/OMAP-L137/AM17x based system"
34 select CP_INTC 34 select CP_INTC
35 select ARCH_DAVINCI_DA8XX 35 select ARCH_DAVINCI_DA8XX
36 select CPU_DCACHE_WRITETHROUGH # needed on silicon revs 1.0, 1.1 36 select CPU_DCACHE_WRITETHROUGH # needed on silicon revs 1.0, 1.1
37 37
38config ARCH_DAVINCI_DA850 38config ARCH_DAVINCI_DA850
39 bool "DA850/OMAP-L138 based system" 39 bool "DA850/OMAP-L138/AM18x based system"
40 select CP_INTC 40 select CP_INTC
41 select ARCH_DAVINCI_DA8XX 41 select ARCH_DAVINCI_DA8XX
42 select ARCH_HAS_CPUFREQ 42 select ARCH_HAS_CPUFREQ
@@ -61,6 +61,9 @@ config MACH_DAVINCI_EVM
61 bool "TI DM644x EVM" 61 bool "TI DM644x EVM"
62 default ARCH_DAVINCI_DM644x 62 default ARCH_DAVINCI_DM644x
63 depends on ARCH_DAVINCI_DM644x 63 depends on ARCH_DAVINCI_DM644x
64 select MISC_DEVICES
65 select EEPROM_AT24
66 select I2C
64 help 67 help
65 Configure this option to specify the whether the board used 68 Configure this option to specify the whether the board used
66 for development is a DM644x EVM 69 for development is a DM644x EVM
@@ -68,6 +71,9 @@ config MACH_DAVINCI_EVM
68config MACH_SFFSDR 71config MACH_SFFSDR
69 bool "Lyrtech SFFSDR" 72 bool "Lyrtech SFFSDR"
70 depends on ARCH_DAVINCI_DM644x 73 depends on ARCH_DAVINCI_DM644x
74 select MISC_DEVICES
75 select EEPROM_AT24
76 select I2C
71 help 77 help
72 Say Y here to select the Lyrtech Small Form Factor 78 Say Y here to select the Lyrtech Small Form Factor
73 Software Defined Radio (SFFSDR) board. 79 Software Defined Radio (SFFSDR) board.
@@ -99,6 +105,9 @@ config MACH_DAVINCI_DM6467_EVM
99 default ARCH_DAVINCI_DM646x 105 default ARCH_DAVINCI_DM646x
100 depends on ARCH_DAVINCI_DM646x 106 depends on ARCH_DAVINCI_DM646x
101 select MACH_DAVINCI_DM6467TEVM 107 select MACH_DAVINCI_DM6467TEVM
108 select MISC_DEVICES
109 select EEPROM_AT24
110 select I2C
102 help 111 help
103 Configure this option to specify the whether the board used 112 Configure this option to specify the whether the board used
104 for development is a DM6467 EVM 113 for development is a DM6467 EVM
@@ -110,26 +119,32 @@ config MACH_DAVINCI_DM365_EVM
110 bool "TI DM365 EVM" 119 bool "TI DM365 EVM"
111 default ARCH_DAVINCI_DM365 120 default ARCH_DAVINCI_DM365
112 depends on ARCH_DAVINCI_DM365 121 depends on ARCH_DAVINCI_DM365
122 select MISC_DEVICES
123 select EEPROM_AT24
124 select I2C
113 help 125 help
114 Configure this option to specify whether the board used 126 Configure this option to specify whether the board used
115 for development is a DM365 EVM 127 for development is a DM365 EVM
116 128
117config MACH_DAVINCI_DA830_EVM 129config MACH_DAVINCI_DA830_EVM
118 bool "TI DA830/OMAP-L137 Reference Platform" 130 bool "TI DA830/OMAP-L137/AM17x Reference Platform"
119 default ARCH_DAVINCI_DA830 131 default ARCH_DAVINCI_DA830
120 depends on ARCH_DAVINCI_DA830 132 depends on ARCH_DAVINCI_DA830
121 select GPIO_PCF857X 133 select GPIO_PCF857X
134 select MISC_DEVICES
135 select EEPROM_AT24
136 select I2C
122 help 137 help
123 Say Y here to select the TI DA830/OMAP-L137 Evaluation Module. 138 Say Y here to select the TI DA830/OMAP-L137/AM17x Evaluation Module.
124 139
125choice 140choice
126 prompt "Select DA830/OMAP-L137 UI board peripheral" 141 prompt "Select DA830/OMAP-L137/AM17x UI board peripheral"
127 depends on MACH_DAVINCI_DA830_EVM 142 depends on MACH_DAVINCI_DA830_EVM
128 help 143 help
129 The presence of UI card on the DA830/OMAP-L137 EVM is detected 144 The presence of UI card on the DA830/OMAP-L137/AM17x EVM is
130 automatically based on successful probe of the I2C based GPIO 145 detected automatically based on successful probe of the I2C
131 expander on that board. This option selected in this menu has 146 based GPIO expander on that board. This option selected in this
132 an effect only in case of a successful UI card detection. 147 menu has an effect only in case of a successful UI card detection.
133 148
134config DA830_UI_LCD 149config DA830_UI_LCD
135 bool "LCD" 150 bool "LCD"
@@ -140,23 +155,22 @@ config DA830_UI_LCD
140config DA830_UI_NAND 155config DA830_UI_NAND
141 bool "NAND flash" 156 bool "NAND flash"
142 help 157 help
143 Say Y here to use the NAND flash. Do not forget to setup 158 Say Y here to use the NAND flash. Do not forget to setup
144 the switch correctly. 159 the switch correctly.
145endchoice 160endchoice
146 161
147config MACH_DAVINCI_DA850_EVM 162config MACH_DAVINCI_DA850_EVM
148 bool "TI DA850/OMAP-L138 Reference Platform" 163 bool "TI DA850/OMAP-L138/AM18x Reference Platform"
149 default ARCH_DAVINCI_DA850 164 default ARCH_DAVINCI_DA850
150 depends on ARCH_DAVINCI_DA850 165 depends on ARCH_DAVINCI_DA850
151 select GPIO_PCA953X
152 help 166 help
153 Say Y here to select the TI DA850/OMAP-L138 Evaluation Module. 167 Say Y here to select the TI DA850/OMAP-L138/AM18x Evaluation Module.
154 168
155choice 169choice
156 prompt "Select peripherals connected to expander on UI board" 170 prompt "Select peripherals connected to expander on UI board"
157 depends on MACH_DAVINCI_DA850_EVM 171 depends on MACH_DAVINCI_DA850_EVM
158 help 172 help
159 The presence of User Interface (UI) card on the DA850/OMAP-L138 173 The presence of User Interface (UI) card on the DA850/OMAP-L138/AM18x
160 EVM is detected automatically based on successful probe of the I2C 174 EVM is detected automatically based on successful probe of the I2C
161 based GPIO expander on that card. This option selected in this 175 based GPIO expander on that card. This option selected in this
162 menu has an effect only in case of a successful UI card detection. 176 menu has an effect only in case of a successful UI card detection.
@@ -165,19 +179,25 @@ config DA850_UI_NONE
165 bool "No peripheral is enabled" 179 bool "No peripheral is enabled"
166 help 180 help
167 Say Y if you do not want to enable any of the peripherals connected 181 Say Y if you do not want to enable any of the peripherals connected
168 to TCA6416 expander on DA850/OMAP-L138 EVM UI card 182 to TCA6416 expander on DA850/OMAP-L138/AM18x EVM UI card
169 183
170config DA850_UI_RMII 184config DA850_UI_RMII
171 bool "RMII Ethernet PHY" 185 bool "RMII Ethernet PHY"
172 help 186 help
173 Say Y if you want to use the RMII PHY on the DA850/OMAP-L138 EVM. 187 Say Y if you want to use the RMII PHY on the DA850/OMAP-L138/AM18x
174 This PHY is found on the UI daughter card that is supplied with 188 EVM. This PHY is found on the UI daughter card that is supplied with
175 the EVM. 189 the EVM.
176 NOTE: Please take care while choosing this option, MII PHY will 190 NOTE: Please take care while choosing this option, MII PHY will
177 not be functional if RMII mode is selected. 191 not be functional if RMII mode is selected.
178 192
179endchoice 193endchoice
180 194
195config GPIO_PCA953X
196 default MACH_DAVINCI_DA850_EVM
197
198config KEYBOARD_GPIO_POLLED
199 default MACH_DAVINCI_DA850_EVM
200
181config MACH_TNETV107X 201config MACH_TNETV107X
182 bool "TI TNETV107X Reference Platform" 202 bool "TI TNETV107X Reference Platform"
183 default ARCH_DAVINCI_TNETV107X 203 default ARCH_DAVINCI_TNETV107X
@@ -185,6 +205,25 @@ config MACH_TNETV107X
185 help 205 help
186 Say Y here to select the TI TNETV107X Evaluation Module. 206 Say Y here to select the TI TNETV107X Evaluation Module.
187 207
208config MACH_MITYOMAPL138
209 bool "Critical Link MityDSP-L138/MityARM-1808 SoM"
210 depends on ARCH_DAVINCI_DA850
211 select MISC_DEVICES
212 select EEPROM_AT24
213 select I2C
214 help
215 Say Y here to select the Critical Link MityDSP-L138/MityARM-1808
216 System on Module. Information on this SoM may be found at
217 http://www.mitydsp.com
218
219config MACH_OMAPL138_HAWKBOARD
220 bool "TI AM1808 / OMAPL-138 Hawkboard platform"
221 depends on ARCH_DAVINCI_DA850
222 help
223 Say Y here to select the TI AM1808 / OMAPL-138 Hawkboard platform .
224 Information of this board may be found at
225 http://www.hawkboard.org/
226
188config DAVINCI_MUX 227config DAVINCI_MUX
189 bool "DAVINCI multiplexing support" 228 bool "DAVINCI multiplexing support"
190 depends on ARCH_DAVINCI 229 depends on ARCH_DAVINCI
@@ -195,20 +234,20 @@ config DAVINCI_MUX
195 say Y. 234 say Y.
196 235
197config DAVINCI_MUX_DEBUG 236config DAVINCI_MUX_DEBUG
198 bool "Multiplexing debug output" 237 bool "Multiplexing debug output"
199 depends on DAVINCI_MUX 238 depends on DAVINCI_MUX
200 help 239 help
201 Makes the multiplexing functions print out a lot of debug info. 240 Makes the multiplexing functions print out a lot of debug info.
202 This is useful if you want to find out the correct values of the 241 This is useful if you want to find out the correct values of the
203 multiplexing registers. 242 multiplexing registers.
204 243
205config DAVINCI_MUX_WARNINGS 244config DAVINCI_MUX_WARNINGS
206 bool "Warn about pins the bootloader didn't set up" 245 bool "Warn about pins the bootloader didn't set up"
207 depends on DAVINCI_MUX 246 depends on DAVINCI_MUX
208 help 247 help
209 Choose Y here to warn whenever driver initialization logic needs 248 Choose Y here to warn whenever driver initialization logic needs
210 to change the pin multiplexing setup. When there are no warnings 249 to change the pin multiplexing setup. When there are no warnings
211 printed, it's safe to deselect DAVINCI_MUX for your product. 250 printed, it's safe to deselect DAVINCI_MUX for your product.
212 251
213config DAVINCI_RESET_CLOCKS 252config DAVINCI_RESET_CLOCKS
214 bool "Reset unused clocks during boot" 253 bool "Reset unused clocks during boot"
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index eab4c0fd667a..0b87a1ca2bb3 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -5,7 +5,7 @@
5 5
6# Common objects 6# Common objects
7obj-y := time.o clock.o serial.o io.o psc.o \ 7obj-y := time.o clock.o serial.o io.o psc.o \
8 gpio.o dma.o usb.o common.o sram.o 8 gpio.o dma.o usb.o common.o sram.o aemif.o
9 9
10obj-$(CONFIG_DAVINCI_MUX) += mux.o 10obj-$(CONFIG_DAVINCI_MUX) += mux.o
11 11
@@ -33,6 +33,8 @@ obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o
33obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o 33obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o
34obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o 34obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o
35obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o 35obj-$(CONFIG_MACH_TNETV107X) += board-tnetv107x-evm.o
36obj-$(CONFIG_MACH_MITYOMAPL138) += board-mityomapl138.o
37obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD) += board-omapl138-hawk.o
36 38
37# Power Management 39# Power Management
38obj-$(CONFIG_CPU_FREQ) += cpufreq.o 40obj-$(CONFIG_CPU_FREQ) += cpufreq.o
diff --git a/arch/arm/mach-davinci/aemif.c b/arch/arm/mach-davinci/aemif.c
new file mode 100644
index 000000000000..1ce70a91f2e9
--- /dev/null
+++ b/arch/arm/mach-davinci/aemif.c
@@ -0,0 +1,133 @@
1/*
2 * AEMIF support for DaVinci SoCs
3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated. http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/io.h>
13#include <linux/err.h>
14#include <linux/clk.h>
15#include <linux/module.h>
16#include <linux/time.h>
17
18#include <mach/aemif.h>
19
20/* Timing value configuration */
21
22#define TA(x) ((x) << 2)
23#define RHOLD(x) ((x) << 4)
24#define RSTROBE(x) ((x) << 7)
25#define RSETUP(x) ((x) << 13)
26#define WHOLD(x) ((x) << 17)
27#define WSTROBE(x) ((x) << 20)
28#define WSETUP(x) ((x) << 26)
29
30#define TA_MAX 0x3
31#define RHOLD_MAX 0x7
32#define RSTROBE_MAX 0x3f
33#define RSETUP_MAX 0xf
34#define WHOLD_MAX 0x7
35#define WSTROBE_MAX 0x3f
36#define WSETUP_MAX 0xf
37
38#define TIMING_MASK (TA(TA_MAX) | \
39 RHOLD(RHOLD_MAX) | \
40 RSTROBE(RSTROBE_MAX) | \
41 RSETUP(RSETUP_MAX) | \
42 WHOLD(WHOLD_MAX) | \
43 WSTROBE(WSTROBE_MAX) | \
44 WSETUP(WSETUP_MAX))
45
46/*
47 * aemif_calc_rate - calculate timing data.
48 * @wanted: The cycle time needed in nanoseconds.
49 * @clk: The input clock rate in kHz.
50 * @max: The maximum divider value that can be programmed.
51 *
52 * On success, returns the calculated timing value minus 1 for easy
53 * programming into AEMIF timing registers, else negative errno.
54 */
55static int aemif_calc_rate(int wanted, unsigned long clk, int max)
56{
57 int result;
58
59 result = DIV_ROUND_UP((wanted * clk), NSEC_PER_MSEC) - 1;
60
61 pr_debug("%s: result %d from %ld, %d\n", __func__, result, clk, wanted);
62
63 /* It is generally OK to have a more relaxed timing than requested... */
64 if (result < 0)
65 result = 0;
66
67 /* ... But configuring tighter timings is not an option. */
68 else if (result > max)
69 result = -EINVAL;
70
71 return result;
72}
73
74/**
75 * davinci_aemif_setup_timing - setup timing values for a given AEMIF interface
76 * @t: timing values to be progammed
77 * @base: The virtual base address of the AEMIF interface
78 * @cs: chip-select to program the timing values for
79 *
80 * This function programs the given timing values (in real clock) into the
81 * AEMIF registers taking the AEMIF clock into account.
82 *
83 * This function does not use any locking while programming the AEMIF
84 * because it is expected that there is only one user of a given
85 * chip-select.
86 *
87 * Returns 0 on success, else negative errno.
88 */
89int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
90 void __iomem *base, unsigned cs)
91{
92 unsigned set, val;
93 int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup;
94 unsigned offset = A1CR_OFFSET + cs * 4;
95 struct clk *aemif_clk;
96 unsigned long clkrate;
97
98 if (!t)
99 return 0; /* Nothing to do */
100
101 aemif_clk = clk_get(NULL, "aemif");
102 if (IS_ERR(aemif_clk))
103 return PTR_ERR(aemif_clk);
104
105 clkrate = clk_get_rate(aemif_clk);
106
107 clkrate /= 1000; /* turn clock into kHz for ease of use */
108
109 ta = aemif_calc_rate(t->ta, clkrate, TA_MAX);
110 rhold = aemif_calc_rate(t->rhold, clkrate, RHOLD_MAX);
111 rstrobe = aemif_calc_rate(t->rstrobe, clkrate, RSTROBE_MAX);
112 rsetup = aemif_calc_rate(t->rsetup, clkrate, RSETUP_MAX);
113 whold = aemif_calc_rate(t->whold, clkrate, WHOLD_MAX);
114 wstrobe = aemif_calc_rate(t->wstrobe, clkrate, WSTROBE_MAX);
115 wsetup = aemif_calc_rate(t->wsetup, clkrate, WSETUP_MAX);
116
117 if (ta < 0 || rhold < 0 || rstrobe < 0 || rsetup < 0 ||
118 whold < 0 || wstrobe < 0 || wsetup < 0) {
119 pr_err("%s: cannot get suitable timings\n", __func__);
120 return -EINVAL;
121 }
122
123 set = TA(ta) | RHOLD(rhold) | RSTROBE(rstrobe) | RSETUP(rsetup) |
124 WHOLD(whold) | WSTROBE(wstrobe) | WSETUP(wsetup);
125
126 val = __raw_readl(base + offset);
127 val &= ~TIMING_MASK;
128 val |= set;
129 __raw_writel(val, base + offset);
130
131 return 0;
132}
133EXPORT_SYMBOL(davinci_aemif_setup_timing);
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index c3994f341e49..8bc3701aa05c 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -20,6 +20,8 @@
20#include <linux/i2c/at24.h> 20#include <linux/i2c/at24.h>
21#include <linux/mtd/mtd.h> 21#include <linux/mtd/mtd.h>
22#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
23#include <linux/spi/spi.h>
24#include <linux/spi/flash.h>
23 25
24#include <asm/mach-types.h> 26#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -29,10 +31,10 @@
29#include <mach/nand.h> 31#include <mach/nand.h>
30#include <mach/da8xx.h> 32#include <mach/da8xx.h>
31#include <mach/usb.h> 33#include <mach/usb.h>
34#include <mach/aemif.h>
35#include <mach/spi.h>
32 36
33#define DA830_EVM_PHY_MASK 0x0 37#define DA830_EVM_PHY_ID ""
34#define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
35
36/* 38/*
37 * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4]. 39 * USB1 VBUS is controlled by GPIO1[15], over-current is reported on GPIO2[4].
38 */ 40 */
@@ -360,6 +362,16 @@ static struct nand_bbt_descr da830_evm_nand_bbt_mirror_descr = {
360 .pattern = da830_evm_nand_mirror_pattern 362 .pattern = da830_evm_nand_mirror_pattern
361}; 363};
362 364
365static struct davinci_aemif_timing da830_evm_nandflash_timing = {
366 .wsetup = 24,
367 .wstrobe = 21,
368 .whold = 14,
369 .rsetup = 19,
370 .rstrobe = 50,
371 .rhold = 0,
372 .ta = 20,
373};
374
363static struct davinci_nand_pdata da830_evm_nand_pdata = { 375static struct davinci_nand_pdata da830_evm_nand_pdata = {
364 .parts = da830_evm_nand_partitions, 376 .parts = da830_evm_nand_partitions,
365 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions), 377 .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions),
@@ -368,6 +380,7 @@ static struct davinci_nand_pdata da830_evm_nand_pdata = {
368 .options = NAND_USE_FLASH_BBT, 380 .options = NAND_USE_FLASH_BBT,
369 .bbt_td = &da830_evm_nand_bbt_main_descr, 381 .bbt_td = &da830_evm_nand_bbt_main_descr,
370 .bbt_md = &da830_evm_nand_bbt_mirror_descr, 382 .bbt_md = &da830_evm_nand_bbt_mirror_descr,
383 .timing = &da830_evm_nandflash_timing,
371}; 384};
372 385
373static struct resource da830_evm_nand_resources[] = { 386static struct resource da830_evm_nand_resources[] = {
@@ -524,6 +537,64 @@ static struct edma_rsv_info da830_edma_rsv[] = {
524 }, 537 },
525}; 538};
526 539
540static struct mtd_partition da830evm_spiflash_part[] = {
541 [0] = {
542 .name = "DSP-UBL",
543 .offset = 0,
544 .size = SZ_8K,
545 .mask_flags = MTD_WRITEABLE,
546 },
547 [1] = {
548 .name = "ARM-UBL",
549 .offset = MTDPART_OFS_APPEND,
550 .size = SZ_16K + SZ_8K,
551 .mask_flags = MTD_WRITEABLE,
552 },
553 [2] = {
554 .name = "U-Boot",
555 .offset = MTDPART_OFS_APPEND,
556 .size = SZ_256K - SZ_32K,
557 .mask_flags = MTD_WRITEABLE,
558 },
559 [3] = {
560 .name = "U-Boot-Environment",
561 .offset = MTDPART_OFS_APPEND,
562 .size = SZ_16K,
563 .mask_flags = 0,
564 },
565 [4] = {
566 .name = "Kernel",
567 .offset = MTDPART_OFS_APPEND,
568 .size = MTDPART_SIZ_FULL,
569 .mask_flags = 0,
570 },
571};
572
573static struct flash_platform_data da830evm_spiflash_data = {
574 .name = "m25p80",
575 .parts = da830evm_spiflash_part,
576 .nr_parts = ARRAY_SIZE(da830evm_spiflash_part),
577 .type = "w25x32",
578};
579
580static struct davinci_spi_config da830evm_spiflash_cfg = {
581 .io_type = SPI_IO_TYPE_DMA,
582 .c2tdelay = 8,
583 .t2cdelay = 8,
584};
585
586static struct spi_board_info da830evm_spi_info[] = {
587 {
588 .modalias = "m25p80",
589 .platform_data = &da830evm_spiflash_data,
590 .controller_data = &da830evm_spiflash_cfg,
591 .mode = SPI_MODE_0,
592 .max_speed_hz = 30000000,
593 .bus_num = 0,
594 .chip_select = 0,
595 },
596};
597
527static __init void da830_evm_init(void) 598static __init void da830_evm_init(void)
528{ 599{
529 struct davinci_soc_info *soc_info = &davinci_soc_info; 600 struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -546,9 +617,8 @@ static __init void da830_evm_init(void)
546 617
547 da830_evm_usb_init(); 618 da830_evm_usb_init();
548 619
549 soc_info->emac_pdata->phy_mask = DA830_EVM_PHY_MASK;
550 soc_info->emac_pdata->mdio_max_freq = DA830_EVM_MDIO_FREQUENCY;
551 soc_info->emac_pdata->rmii_en = 1; 620 soc_info->emac_pdata->rmii_en = 1;
621 soc_info->emac_pdata->phy_id = DA830_EVM_PHY_ID;
552 622
553 ret = davinci_cfg_reg_list(da830_cpgmac_pins); 623 ret = davinci_cfg_reg_list(da830_cpgmac_pins);
554 if (ret) 624 if (ret)
@@ -581,11 +651,20 @@ static __init void da830_evm_init(void)
581 ret = da8xx_register_rtc(); 651 ret = da8xx_register_rtc();
582 if (ret) 652 if (ret)
583 pr_warning("da830_evm_init: rtc setup failed: %d\n", ret); 653 pr_warning("da830_evm_init: rtc setup failed: %d\n", ret);
654
655 ret = da8xx_register_spi(0, da830evm_spi_info,
656 ARRAY_SIZE(da830evm_spi_info));
657 if (ret)
658 pr_warning("da830_evm_init: spi 0 registration failed: %d\n",
659 ret);
584} 660}
585 661
586#ifdef CONFIG_SERIAL_8250_CONSOLE 662#ifdef CONFIG_SERIAL_8250_CONSOLE
587static int __init da830_evm_console_init(void) 663static int __init da830_evm_console_init(void)
588{ 664{
665 if (!machine_is_davinci_da830_evm())
666 return 0;
667
589 return add_preferred_console("ttyS", 2, "115200"); 668 return add_preferred_console("ttyS", 2, "115200");
590} 669}
591console_initcall(da830_evm_console_init); 670console_initcall(da830_evm_console_init);
@@ -596,9 +675,7 @@ static void __init da830_evm_map_io(void)
596 da830_init(); 675 da830_init();
597} 676}
598 677
599MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137 EVM") 678MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM")
600 .phys_io = IO_PHYS,
601 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
602 .boot_params = (DA8XX_DDR_BASE + 0x100), 679 .boot_params = (DA8XX_DDR_BASE + 0x100),
603 .map_io = da830_evm_map_io, 680 .map_io = da830_evm_map_io,
604 .init_irq = cp_intc_init, 681 .init_irq = cp_intc_init,
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index fdc2cc500fc6..a7b41bf505f1 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -17,8 +17,10 @@
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/i2c/at24.h> 18#include <linux/i2c/at24.h>
19#include <linux/i2c/pca953x.h> 19#include <linux/i2c/pca953x.h>
20#include <linux/input.h>
20#include <linux/mfd/tps6507x.h> 21#include <linux/mfd/tps6507x.h>
21#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/gpio_keys.h>
22#include <linux/platform_device.h> 24#include <linux/platform_device.h>
23#include <linux/mtd/mtd.h> 25#include <linux/mtd/mtd.h>
24#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
@@ -26,8 +28,9 @@
26#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
27#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
28#include <linux/regulator/tps6507x.h> 30#include <linux/regulator/tps6507x.h>
29#include <linux/mfd/tps6507x.h>
30#include <linux/input/tps6507x-ts.h> 31#include <linux/input/tps6507x-ts.h>
32#include <linux/spi/spi.h>
33#include <linux/spi/flash.h>
31 34
32#include <asm/mach-types.h> 35#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -36,10 +39,10 @@
36#include <mach/da8xx.h> 39#include <mach/da8xx.h>
37#include <mach/nand.h> 40#include <mach/nand.h>
38#include <mach/mux.h> 41#include <mach/mux.h>
42#include <mach/aemif.h>
43#include <mach/spi.h>
39 44
40#define DA850_EVM_PHY_MASK 0x1 45#define DA850_EVM_PHY_ID "0:00"
41#define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
42
43#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8) 46#define DA850_LCD_PWR_PIN GPIO_TO_PIN(2, 8)
44#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15) 47#define DA850_LCD_BL_PIN GPIO_TO_PIN(2, 15)
45 48
@@ -48,6 +51,70 @@
48 51
49#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) 52#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
50 53
54static struct mtd_partition da850evm_spiflash_part[] = {
55 [0] = {
56 .name = "UBL",
57 .offset = 0,
58 .size = SZ_64K,
59 .mask_flags = MTD_WRITEABLE,
60 },
61 [1] = {
62 .name = "U-Boot",
63 .offset = MTDPART_OFS_APPEND,
64 .size = SZ_512K,
65 .mask_flags = MTD_WRITEABLE,
66 },
67 [2] = {
68 .name = "U-Boot-Env",
69 .offset = MTDPART_OFS_APPEND,
70 .size = SZ_64K,
71 .mask_flags = MTD_WRITEABLE,
72 },
73 [3] = {
74 .name = "Kernel",
75 .offset = MTDPART_OFS_APPEND,
76 .size = SZ_2M + SZ_512K,
77 .mask_flags = 0,
78 },
79 [4] = {
80 .name = "Filesystem",
81 .offset = MTDPART_OFS_APPEND,
82 .size = SZ_4M,
83 .mask_flags = 0,
84 },
85 [5] = {
86 .name = "MAC-Address",
87 .offset = SZ_8M - SZ_64K,
88 .size = SZ_64K,
89 .mask_flags = MTD_WRITEABLE,
90 },
91};
92
93static struct flash_platform_data da850evm_spiflash_data = {
94 .name = "m25p80",
95 .parts = da850evm_spiflash_part,
96 .nr_parts = ARRAY_SIZE(da850evm_spiflash_part),
97 .type = "m25p64",
98};
99
100static struct davinci_spi_config da850evm_spiflash_cfg = {
101 .io_type = SPI_IO_TYPE_DMA,
102 .c2tdelay = 8,
103 .t2cdelay = 8,
104};
105
106static struct spi_board_info da850evm_spi_info[] = {
107 {
108 .modalias = "m25p80",
109 .platform_data = &da850evm_spiflash_data,
110 .controller_data = &da850evm_spiflash_cfg,
111 .mode = SPI_MODE_0,
112 .max_speed_hz = 30000000,
113 .bus_num = 1,
114 .chip_select = 0,
115 },
116};
117
51static struct mtd_partition da850_evm_norflash_partition[] = { 118static struct mtd_partition da850_evm_norflash_partition[] = {
52 { 119 {
53 .name = "bootloaders + env", 120 .name = "bootloaders + env",
@@ -110,7 +177,7 @@ static struct platform_device da850_pm_device = {
110 * to boot, using TI's tools to install the secondary boot loader 177 * to boot, using TI's tools to install the secondary boot loader
111 * (UBL) and U-Boot. 178 * (UBL) and U-Boot.
112 */ 179 */
113struct mtd_partition da850_evm_nandflash_partition[] = { 180static struct mtd_partition da850_evm_nandflash_partition[] = {
114 { 181 {
115 .name = "u-boot env", 182 .name = "u-boot env",
116 .offset = 0, 183 .offset = 0,
@@ -143,12 +210,23 @@ struct mtd_partition da850_evm_nandflash_partition[] = {
143 }, 210 },
144}; 211};
145 212
213static struct davinci_aemif_timing da850_evm_nandflash_timing = {
214 .wsetup = 24,
215 .wstrobe = 21,
216 .whold = 14,
217 .rsetup = 19,
218 .rstrobe = 50,
219 .rhold = 0,
220 .ta = 20,
221};
222
146static struct davinci_nand_pdata da850_evm_nandflash_data = { 223static struct davinci_nand_pdata da850_evm_nandflash_data = {
147 .parts = da850_evm_nandflash_partition, 224 .parts = da850_evm_nandflash_partition,
148 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), 225 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition),
149 .ecc_mode = NAND_ECC_HW, 226 .ecc_mode = NAND_ECC_HW,
150 .ecc_bits = 4, 227 .ecc_bits = 4,
151 .options = NAND_USE_FLASH_BBT, 228 .options = NAND_USE_FLASH_BBT,
229 .timing = &da850_evm_nandflash_timing,
152}; 230};
153 231
154static struct resource da850_evm_nandflash_resource[] = { 232static struct resource da850_evm_nandflash_resource[] = {
@@ -196,7 +274,29 @@ static void __init da850_evm_init_nor(void)
196 iounmap(aemif_addr); 274 iounmap(aemif_addr);
197} 275}
198 276
199static u32 ui_card_detected; 277static const short da850_evm_nand_pins[] = {
278 DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3,
279 DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7,
280 DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
281 DA850_NEMA_WE, DA850_NEMA_OE,
282 -1
283};
284
285static const short da850_evm_nor_pins[] = {
286 DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
287 DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
288 DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
289 DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
290 DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
291 DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
292 DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
293 DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
294 DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
295 DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
296 DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
297 DA850_EMA_A_22, DA850_EMA_A_23,
298 -1
299};
200 300
201#if defined(CONFIG_MMC_DAVINCI) || \ 301#if defined(CONFIG_MMC_DAVINCI) || \
202 defined(CONFIG_MMC_DAVINCI_MODULE) 302 defined(CONFIG_MMC_DAVINCI_MODULE)
@@ -205,17 +305,17 @@ static u32 ui_card_detected;
205#define HAS_MMC 0 305#define HAS_MMC 0
206#endif 306#endif
207 307
208static __init void da850_evm_setup_nor_nand(void) 308static inline void da850_evm_setup_nor_nand(void)
209{ 309{
210 int ret = 0; 310 int ret = 0;
211 311
212 if (ui_card_detected & !HAS_MMC) { 312 if (!HAS_MMC) {
213 ret = davinci_cfg_reg_list(da850_nand_pins); 313 ret = davinci_cfg_reg_list(da850_evm_nand_pins);
214 if (ret) 314 if (ret)
215 pr_warning("da850_evm_init: nand mux setup failed: " 315 pr_warning("da850_evm_init: nand mux setup failed: "
216 "%d\n", ret); 316 "%d\n", ret);
217 317
218 ret = davinci_cfg_reg_list(da850_nor_pins); 318 ret = davinci_cfg_reg_list(da850_evm_nor_pins);
219 if (ret) 319 if (ret)
220 pr_warning("da850_evm_init: nor mux setup failed: %d\n", 320 pr_warning("da850_evm_init: nor mux setup failed: %d\n",
221 ret); 321 ret);
@@ -233,34 +333,115 @@ static inline void da850_evm_setup_emac_rmii(int rmii_sel)
233 struct davinci_soc_info *soc_info = &davinci_soc_info; 333 struct davinci_soc_info *soc_info = &davinci_soc_info;
234 334
235 soc_info->emac_pdata->rmii_en = 1; 335 soc_info->emac_pdata->rmii_en = 1;
236 gpio_set_value(rmii_sel, 0); 336 gpio_set_value_cansleep(rmii_sel, 0);
237} 337}
238#else 338#else
239static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } 339static inline void da850_evm_setup_emac_rmii(int rmii_sel) { }
240#endif 340#endif
241 341
342
343#define DA850_KEYS_DEBOUNCE_MS 10
344/*
345 * At 200ms polling interval it is possible to miss an
346 * event by tapping very lightly on the push button but most
347 * pushes do result in an event; longer intervals require the
348 * user to hold the button whereas shorter intervals require
349 * more CPU time for polling.
350 */
351#define DA850_GPIO_KEYS_POLL_MS 200
352
353enum da850_evm_ui_exp_pins {
354 DA850_EVM_UI_EXP_SEL_C = 5,
355 DA850_EVM_UI_EXP_SEL_B,
356 DA850_EVM_UI_EXP_SEL_A,
357 DA850_EVM_UI_EXP_PB8,
358 DA850_EVM_UI_EXP_PB7,
359 DA850_EVM_UI_EXP_PB6,
360 DA850_EVM_UI_EXP_PB5,
361 DA850_EVM_UI_EXP_PB4,
362 DA850_EVM_UI_EXP_PB3,
363 DA850_EVM_UI_EXP_PB2,
364 DA850_EVM_UI_EXP_PB1,
365};
366
367static const char const *da850_evm_ui_exp[] = {
368 [DA850_EVM_UI_EXP_SEL_C] = "sel_c",
369 [DA850_EVM_UI_EXP_SEL_B] = "sel_b",
370 [DA850_EVM_UI_EXP_SEL_A] = "sel_a",
371 [DA850_EVM_UI_EXP_PB8] = "pb8",
372 [DA850_EVM_UI_EXP_PB7] = "pb7",
373 [DA850_EVM_UI_EXP_PB6] = "pb6",
374 [DA850_EVM_UI_EXP_PB5] = "pb5",
375 [DA850_EVM_UI_EXP_PB4] = "pb4",
376 [DA850_EVM_UI_EXP_PB3] = "pb3",
377 [DA850_EVM_UI_EXP_PB2] = "pb2",
378 [DA850_EVM_UI_EXP_PB1] = "pb1",
379};
380
381#define DA850_N_UI_PB 8
382
383static struct gpio_keys_button da850_evm_ui_keys[] = {
384 [0 ... DA850_N_UI_PB - 1] = {
385 .type = EV_KEY,
386 .active_low = 1,
387 .wakeup = 0,
388 .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
389 .code = -1, /* assigned at runtime */
390 .gpio = -1, /* assigned at runtime */
391 .desc = NULL, /* assigned at runtime */
392 },
393};
394
395static struct gpio_keys_platform_data da850_evm_ui_keys_pdata = {
396 .buttons = da850_evm_ui_keys,
397 .nbuttons = ARRAY_SIZE(da850_evm_ui_keys),
398 .poll_interval = DA850_GPIO_KEYS_POLL_MS,
399};
400
401static struct platform_device da850_evm_ui_keys_device = {
402 .name = "gpio-keys-polled",
403 .id = 0,
404 .dev = {
405 .platform_data = &da850_evm_ui_keys_pdata
406 },
407};
408
409static void da850_evm_ui_keys_init(unsigned gpio)
410{
411 int i;
412 struct gpio_keys_button *button;
413
414 for (i = 0; i < DA850_N_UI_PB; i++) {
415 button = &da850_evm_ui_keys[i];
416 button->code = KEY_F8 - i;
417 button->desc = (char *)
418 da850_evm_ui_exp[DA850_EVM_UI_EXP_PB8 + i];
419 button->gpio = gpio + DA850_EVM_UI_EXP_PB8 + i;
420 }
421}
422
242static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, 423static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
243 unsigned ngpio, void *c) 424 unsigned ngpio, void *c)
244{ 425{
245 int sel_a, sel_b, sel_c, ret; 426 int sel_a, sel_b, sel_c, ret;
246 427
247 sel_a = gpio + 7; 428 sel_a = gpio + DA850_EVM_UI_EXP_SEL_A;
248 sel_b = gpio + 6; 429 sel_b = gpio + DA850_EVM_UI_EXP_SEL_B;
249 sel_c = gpio + 5; 430 sel_c = gpio + DA850_EVM_UI_EXP_SEL_C;
250 431
251 ret = gpio_request(sel_a, "sel_a"); 432 ret = gpio_request(sel_a, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_A]);
252 if (ret) { 433 if (ret) {
253 pr_warning("Cannot open UI expander pin %d\n", sel_a); 434 pr_warning("Cannot open UI expander pin %d\n", sel_a);
254 goto exp_setup_sela_fail; 435 goto exp_setup_sela_fail;
255 } 436 }
256 437
257 ret = gpio_request(sel_b, "sel_b"); 438 ret = gpio_request(sel_b, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_B]);
258 if (ret) { 439 if (ret) {
259 pr_warning("Cannot open UI expander pin %d\n", sel_b); 440 pr_warning("Cannot open UI expander pin %d\n", sel_b);
260 goto exp_setup_selb_fail; 441 goto exp_setup_selb_fail;
261 } 442 }
262 443
263 ret = gpio_request(sel_c, "sel_c"); 444 ret = gpio_request(sel_c, da850_evm_ui_exp[DA850_EVM_UI_EXP_SEL_C]);
264 if (ret) { 445 if (ret) {
265 pr_warning("Cannot open UI expander pin %d\n", sel_c); 446 pr_warning("Cannot open UI expander pin %d\n", sel_c);
266 goto exp_setup_selc_fail; 447 goto exp_setup_selc_fail;
@@ -271,7 +452,13 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
271 gpio_direction_output(sel_b, 1); 452 gpio_direction_output(sel_b, 1);
272 gpio_direction_output(sel_c, 1); 453 gpio_direction_output(sel_c, 1);
273 454
274 ui_card_detected = 1; 455 da850_evm_ui_keys_init(gpio);
456 ret = platform_device_register(&da850_evm_ui_keys_device);
457 if (ret) {
458 pr_warning("Could not register UI GPIO expander push-buttons");
459 goto exp_setup_keys_fail;
460 }
461
275 pr_info("DA850/OMAP-L138 EVM UI card detected\n"); 462 pr_info("DA850/OMAP-L138 EVM UI card detected\n");
276 463
277 da850_evm_setup_nor_nand(); 464 da850_evm_setup_nor_nand();
@@ -280,6 +467,8 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
280 467
281 return 0; 468 return 0;
282 469
470exp_setup_keys_fail:
471 gpio_free(sel_c);
283exp_setup_selc_fail: 472exp_setup_selc_fail:
284 gpio_free(sel_b); 473 gpio_free(sel_b);
285exp_setup_selb_fail: 474exp_setup_selb_fail:
@@ -291,14 +480,192 @@ exp_setup_sela_fail:
291static int da850_evm_ui_expander_teardown(struct i2c_client *client, 480static int da850_evm_ui_expander_teardown(struct i2c_client *client,
292 unsigned gpio, unsigned ngpio, void *c) 481 unsigned gpio, unsigned ngpio, void *c)
293{ 482{
483 platform_device_unregister(&da850_evm_ui_keys_device);
484
294 /* deselect all functionalities */ 485 /* deselect all functionalities */
295 gpio_set_value(gpio + 5, 1); 486 gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_C, 1);
296 gpio_set_value(gpio + 6, 1); 487 gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_B, 1);
297 gpio_set_value(gpio + 7, 1); 488 gpio_set_value_cansleep(gpio + DA850_EVM_UI_EXP_SEL_A, 1);
298 489
299 gpio_free(gpio + 5); 490 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
300 gpio_free(gpio + 6); 491 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
301 gpio_free(gpio + 7); 492 gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
493
494 return 0;
495}
496
497/* assign the baseboard expander's GPIOs after the UI board's */
498#define DA850_UI_EXPANDER_N_GPIOS ARRAY_SIZE(da850_evm_ui_exp)
499#define DA850_BB_EXPANDER_GPIO_BASE (DAVINCI_N_GPIO + DA850_UI_EXPANDER_N_GPIOS)
500
501enum da850_evm_bb_exp_pins {
502 DA850_EVM_BB_EXP_DEEP_SLEEP_EN = 0,
503 DA850_EVM_BB_EXP_SW_RST,
504 DA850_EVM_BB_EXP_TP_23,
505 DA850_EVM_BB_EXP_TP_22,
506 DA850_EVM_BB_EXP_TP_21,
507 DA850_EVM_BB_EXP_USER_PB1,
508 DA850_EVM_BB_EXP_USER_LED2,
509 DA850_EVM_BB_EXP_USER_LED1,
510 DA850_EVM_BB_EXP_USER_SW1,
511 DA850_EVM_BB_EXP_USER_SW2,
512 DA850_EVM_BB_EXP_USER_SW3,
513 DA850_EVM_BB_EXP_USER_SW4,
514 DA850_EVM_BB_EXP_USER_SW5,
515 DA850_EVM_BB_EXP_USER_SW6,
516 DA850_EVM_BB_EXP_USER_SW7,
517 DA850_EVM_BB_EXP_USER_SW8
518};
519
520static const char const *da850_evm_bb_exp[] = {
521 [DA850_EVM_BB_EXP_DEEP_SLEEP_EN] = "deep_sleep_en",
522 [DA850_EVM_BB_EXP_SW_RST] = "sw_rst",
523 [DA850_EVM_BB_EXP_TP_23] = "tp_23",
524 [DA850_EVM_BB_EXP_TP_22] = "tp_22",
525 [DA850_EVM_BB_EXP_TP_21] = "tp_21",
526 [DA850_EVM_BB_EXP_USER_PB1] = "user_pb1",
527 [DA850_EVM_BB_EXP_USER_LED2] = "user_led2",
528 [DA850_EVM_BB_EXP_USER_LED1] = "user_led1",
529 [DA850_EVM_BB_EXP_USER_SW1] = "user_sw1",
530 [DA850_EVM_BB_EXP_USER_SW2] = "user_sw2",
531 [DA850_EVM_BB_EXP_USER_SW3] = "user_sw3",
532 [DA850_EVM_BB_EXP_USER_SW4] = "user_sw4",
533 [DA850_EVM_BB_EXP_USER_SW5] = "user_sw5",
534 [DA850_EVM_BB_EXP_USER_SW6] = "user_sw6",
535 [DA850_EVM_BB_EXP_USER_SW7] = "user_sw7",
536 [DA850_EVM_BB_EXP_USER_SW8] = "user_sw8",
537};
538
539#define DA850_N_BB_USER_SW 8
540
541static struct gpio_keys_button da850_evm_bb_keys[] = {
542 [0] = {
543 .type = EV_KEY,
544 .active_low = 1,
545 .wakeup = 0,
546 .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
547 .code = KEY_PROG1,
548 .desc = NULL, /* assigned at runtime */
549 .gpio = -1, /* assigned at runtime */
550 },
551 [1 ... DA850_N_BB_USER_SW] = {
552 .type = EV_SW,
553 .active_low = 1,
554 .wakeup = 0,
555 .debounce_interval = DA850_KEYS_DEBOUNCE_MS,
556 .code = -1, /* assigned at runtime */
557 .desc = NULL, /* assigned at runtime */
558 .gpio = -1, /* assigned at runtime */
559 },
560};
561
562static struct gpio_keys_platform_data da850_evm_bb_keys_pdata = {
563 .buttons = da850_evm_bb_keys,
564 .nbuttons = ARRAY_SIZE(da850_evm_bb_keys),
565 .poll_interval = DA850_GPIO_KEYS_POLL_MS,
566};
567
568static struct platform_device da850_evm_bb_keys_device = {
569 .name = "gpio-keys-polled",
570 .id = 1,
571 .dev = {
572 .platform_data = &da850_evm_bb_keys_pdata
573 },
574};
575
576static void da850_evm_bb_keys_init(unsigned gpio)
577{
578 int i;
579 struct gpio_keys_button *button;
580
581 button = &da850_evm_bb_keys[0];
582 button->desc = (char *)
583 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_PB1];
584 button->gpio = gpio + DA850_EVM_BB_EXP_USER_PB1;
585
586 for (i = 0; i < DA850_N_BB_USER_SW; i++) {
587 button = &da850_evm_bb_keys[i + 1];
588 button->code = SW_LID + i;
589 button->desc = (char *)
590 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_SW1 + i];
591 button->gpio = gpio + DA850_EVM_BB_EXP_USER_SW1 + i;
592 }
593}
594
595#define DA850_N_BB_USER_LED 2
596
597static struct gpio_led da850_evm_bb_leds[] = {
598 [0 ... DA850_N_BB_USER_LED - 1] = {
599 .active_low = 1,
600 .gpio = -1, /* assigned at runtime */
601 .name = NULL, /* assigned at runtime */
602 },
603};
604
605static struct gpio_led_platform_data da850_evm_bb_leds_pdata = {
606 .leds = da850_evm_bb_leds,
607 .num_leds = ARRAY_SIZE(da850_evm_bb_leds),
608};
609
610static struct platform_device da850_evm_bb_leds_device = {
611 .name = "leds-gpio",
612 .id = -1,
613 .dev = {
614 .platform_data = &da850_evm_bb_leds_pdata
615 }
616};
617
618static void da850_evm_bb_leds_init(unsigned gpio)
619{
620 int i;
621 struct gpio_led *led;
622
623 for (i = 0; i < DA850_N_BB_USER_LED; i++) {
624 led = &da850_evm_bb_leds[i];
625
626 led->gpio = gpio + DA850_EVM_BB_EXP_USER_LED2 + i;
627 led->name =
628 da850_evm_bb_exp[DA850_EVM_BB_EXP_USER_LED2 + i];
629 }
630}
631
632static int da850_evm_bb_expander_setup(struct i2c_client *client,
633 unsigned gpio, unsigned ngpio,
634 void *c)
635{
636 int ret;
637
638 /*
639 * Register the switches and pushbutton on the baseboard as a gpio-keys
640 * device.
641 */
642 da850_evm_bb_keys_init(gpio);
643 ret = platform_device_register(&da850_evm_bb_keys_device);
644 if (ret) {
645 pr_warning("Could not register baseboard GPIO expander keys");
646 goto io_exp_setup_sw_fail;
647 }
648
649 da850_evm_bb_leds_init(gpio);
650 ret = platform_device_register(&da850_evm_bb_leds_device);
651 if (ret) {
652 pr_warning("Could not register baseboard GPIO expander LEDS");
653 goto io_exp_setup_leds_fail;
654 }
655
656 return 0;
657
658io_exp_setup_leds_fail:
659 platform_device_unregister(&da850_evm_bb_keys_device);
660io_exp_setup_sw_fail:
661 return ret;
662}
663
664static int da850_evm_bb_expander_teardown(struct i2c_client *client,
665 unsigned gpio, unsigned ngpio, void *c)
666{
667 platform_device_unregister(&da850_evm_bb_leds_device);
668 platform_device_unregister(&da850_evm_bb_keys_device);
302 669
303 return 0; 670 return 0;
304} 671}
@@ -307,6 +674,14 @@ static struct pca953x_platform_data da850_evm_ui_expander_info = {
307 .gpio_base = DAVINCI_N_GPIO, 674 .gpio_base = DAVINCI_N_GPIO,
308 .setup = da850_evm_ui_expander_setup, 675 .setup = da850_evm_ui_expander_setup,
309 .teardown = da850_evm_ui_expander_teardown, 676 .teardown = da850_evm_ui_expander_teardown,
677 .names = da850_evm_ui_exp,
678};
679
680static struct pca953x_platform_data da850_evm_bb_expander_info = {
681 .gpio_base = DA850_BB_EXPANDER_GPIO_BASE,
682 .setup = da850_evm_bb_expander_setup,
683 .teardown = da850_evm_bb_expander_teardown,
684 .names = da850_evm_bb_exp,
310}; 685};
311 686
312static struct i2c_board_info __initdata da850_evm_i2c_devices[] = { 687static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
@@ -317,6 +692,10 @@ static struct i2c_board_info __initdata da850_evm_i2c_devices[] = {
317 I2C_BOARD_INFO("tca6416", 0x20), 692 I2C_BOARD_INFO("tca6416", 0x20),
318 .platform_data = &da850_evm_ui_expander_info, 693 .platform_data = &da850_evm_ui_expander_info,
319 }, 694 },
695 {
696 I2C_BOARD_INFO("tca6416", 0x21),
697 .platform_data = &da850_evm_bb_expander_info,
698 },
320}; 699};
321 700
322static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = { 701static struct davinci_i2c_platform_data da850_evm_i2c_0_pdata = {
@@ -349,6 +728,13 @@ static struct snd_platform_data da850_evm_snd_data = {
349 .rxnumevt = 1, 728 .rxnumevt = 1,
350}; 729};
351 730
731static const short da850_evm_mcasp_pins[] __initconst = {
732 DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
733 DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
734 DA850_AXR_11, DA850_AXR_12,
735 -1
736};
737
352static int da850_evm_mmc_get_ro(int index) 738static int da850_evm_mmc_get_ro(int index)
353{ 739{
354 return gpio_get_value(DA850_MMCSD_WP_PIN); 740 return gpio_get_value(DA850_MMCSD_WP_PIN);
@@ -368,6 +754,13 @@ static struct davinci_mmc_config da850_mmc_config = {
368 .version = MMC_CTLR_VERSION_2, 754 .version = MMC_CTLR_VERSION_2,
369}; 755};
370 756
757static const short da850_evm_mmcsd0_pins[] __initconst = {
758 DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
759 DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
760 DA850_GPIO4_0, DA850_GPIO4_1,
761 -1
762};
763
371static void da850_panel_power_ctrl(int val) 764static void da850_panel_power_ctrl(int val)
372{ 765{
373 /* lcd backlight */ 766 /* lcd backlight */
@@ -406,7 +799,7 @@ static int da850_lcd_hw_init(void)
406/* TPS65070 voltage regulator support */ 799/* TPS65070 voltage regulator support */
407 800
408/* 3.3V */ 801/* 3.3V */
409struct regulator_consumer_supply tps65070_dcdc1_consumers[] = { 802static struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
410 { 803 {
411 .supply = "usb0_vdda33", 804 .supply = "usb0_vdda33",
412 }, 805 },
@@ -416,7 +809,7 @@ struct regulator_consumer_supply tps65070_dcdc1_consumers[] = {
416}; 809};
417 810
418/* 3.3V or 1.8V */ 811/* 3.3V or 1.8V */
419struct regulator_consumer_supply tps65070_dcdc2_consumers[] = { 812static struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
420 { 813 {
421 .supply = "dvdd3318_a", 814 .supply = "dvdd3318_a",
422 }, 815 },
@@ -429,14 +822,14 @@ struct regulator_consumer_supply tps65070_dcdc2_consumers[] = {
429}; 822};
430 823
431/* 1.2V */ 824/* 1.2V */
432struct regulator_consumer_supply tps65070_dcdc3_consumers[] = { 825static struct regulator_consumer_supply tps65070_dcdc3_consumers[] = {
433 { 826 {
434 .supply = "cvdd", 827 .supply = "cvdd",
435 }, 828 },
436}; 829};
437 830
438/* 1.8V LDO */ 831/* 1.8V LDO */
439struct regulator_consumer_supply tps65070_ldo1_consumers[] = { 832static struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
440 { 833 {
441 .supply = "sata_vddr", 834 .supply = "sata_vddr",
442 }, 835 },
@@ -452,7 +845,7 @@ struct regulator_consumer_supply tps65070_ldo1_consumers[] = {
452}; 845};
453 846
454/* 1.2V LDO */ 847/* 1.2V LDO */
455struct regulator_consumer_supply tps65070_ldo2_consumers[] = { 848static struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
456 { 849 {
457 .supply = "sata_vdd", 850 .supply = "sata_vdd",
458 }, 851 },
@@ -475,7 +868,7 @@ static struct tps6507x_reg_platform_data tps6507x_platform_data = {
475 .defdcdc_default = true, 868 .defdcdc_default = true,
476}; 869};
477 870
478struct regulator_init_data tps65070_regulator_data[] = { 871static struct regulator_init_data tps65070_regulator_data[] = {
479 /* dcdc1 */ 872 /* dcdc1 */
480 { 873 {
481 .constraints = { 874 .constraints = {
@@ -507,7 +900,7 @@ struct regulator_init_data tps65070_regulator_data[] = {
507 { 900 {
508 .constraints = { 901 .constraints = {
509 .min_uV = 950000, 902 .min_uV = 950000,
510 .max_uV = 1320000, 903 .max_uV = 1350000,
511 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE | 904 .valid_ops_mask = (REGULATOR_CHANGE_VOLTAGE |
512 REGULATOR_CHANGE_STATUS), 905 REGULATOR_CHANGE_STATUS),
513 .boot_on = 1, 906 .boot_on = 1,
@@ -558,7 +951,7 @@ static struct tps6507x_board tps_board = {
558 .tps6507x_ts_init_data = &tps6507x_touchscreen_data, 951 .tps6507x_ts_init_data = &tps6507x_touchscreen_data,
559}; 952};
560 953
561static struct i2c_board_info __initdata da850evm_tps65070_info[] = { 954static struct i2c_board_info __initdata da850_evm_tps65070_info[] = {
562 { 955 {
563 I2C_BOARD_INFO("tps6507x", 0x48), 956 I2C_BOARD_INFO("tps6507x", 0x48),
564 .platform_data = &tps_board, 957 .platform_data = &tps_board,
@@ -567,8 +960,8 @@ static struct i2c_board_info __initdata da850evm_tps65070_info[] = {
567 960
568static int __init pmic_tps65070_init(void) 961static int __init pmic_tps65070_init(void)
569{ 962{
570 return i2c_register_board_info(1, da850evm_tps65070_info, 963 return i2c_register_board_info(1, da850_evm_tps65070_info,
571 ARRAY_SIZE(da850evm_tps65070_info)); 964 ARRAY_SIZE(da850_evm_tps65070_info));
572} 965}
573 966
574static const short da850_evm_lcdc_pins[] = { 967static const short da850_evm_lcdc_pins[] = {
@@ -576,6 +969,23 @@ static const short da850_evm_lcdc_pins[] = {
576 -1 969 -1
577}; 970};
578 971
972static const short da850_evm_mii_pins[] = {
973 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
974 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
975 DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
976 DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
977 DA850_MDIO_D,
978 -1
979};
980
981static const short da850_evm_rmii_pins[] = {
982 DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
983 DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
984 DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
985 DA850_MDIO_D,
986 -1
987};
988
579static int __init da850_evm_config_emac(void) 989static int __init da850_evm_config_emac(void)
580{ 990{
581 void __iomem *cfg_chip3_base; 991 void __iomem *cfg_chip3_base;
@@ -593,12 +1003,12 @@ static int __init da850_evm_config_emac(void)
593 1003
594 if (rmii_en) { 1004 if (rmii_en) {
595 val |= BIT(8); 1005 val |= BIT(8);
596 ret = davinci_cfg_reg_list(da850_rmii_pins); 1006 ret = davinci_cfg_reg_list(da850_evm_rmii_pins);
597 pr_info("EMAC: RMII PHY configured, MII PHY will not be" 1007 pr_info("EMAC: RMII PHY configured, MII PHY will not be"
598 " functional\n"); 1008 " functional\n");
599 } else { 1009 } else {
600 val &= ~BIT(8); 1010 val &= ~BIT(8);
601 ret = davinci_cfg_reg_list(da850_cpgmac_pins); 1011 ret = davinci_cfg_reg_list(da850_evm_mii_pins);
602 pr_info("EMAC: MII PHY configured, RMII PHY will not be" 1012 pr_info("EMAC: MII PHY configured, RMII PHY will not be"
603 " functional\n"); 1013 " functional\n");
604 } 1014 }
@@ -625,8 +1035,7 @@ static int __init da850_evm_config_emac(void)
625 /* Enable/Disable MII MDIO clock */ 1035 /* Enable/Disable MII MDIO clock */
626 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en); 1036 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, rmii_en);
627 1037
628 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; 1038 soc_info->emac_pdata->phy_id = DA850_EVM_PHY_ID;
629 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
630 1039
631 ret = da8xx_register_emac(); 1040 ret = da8xx_register_emac();
632 if (ret) 1041 if (ret)
@@ -687,6 +1096,27 @@ static struct edma_rsv_info *da850_edma_rsv[2] = {
687 &da850_edma_cc1_rsv, 1096 &da850_edma_cc1_rsv,
688}; 1097};
689 1098
1099#ifdef CONFIG_CPU_FREQ
1100static __init int da850_evm_init_cpufreq(void)
1101{
1102 switch (system_rev & 0xF) {
1103 case 3:
1104 da850_max_speed = 456000;
1105 break;
1106 case 2:
1107 da850_max_speed = 408000;
1108 break;
1109 case 1:
1110 da850_max_speed = 372000;
1111 break;
1112 }
1113
1114 return da850_register_cpufreq("pll0_sysclk3");
1115}
1116#else
1117static __init int da850_evm_init_cpufreq(void) { return 0; }
1118#endif
1119
690static __init void da850_evm_init(void) 1120static __init void da850_evm_init(void)
691{ 1121{
692 int ret; 1122 int ret;
@@ -718,7 +1148,7 @@ static __init void da850_evm_init(void)
718 ret); 1148 ret);
719 1149
720 if (HAS_MMC) { 1150 if (HAS_MMC) {
721 ret = davinci_cfg_reg_list(da850_mmcsd0_pins); 1151 ret = davinci_cfg_reg_list(da850_evm_mmcsd0_pins);
722 if (ret) 1152 if (ret)
723 pr_warning("da850_evm_init: mmcsd0 mux setup failed:" 1153 pr_warning("da850_evm_init: mmcsd0 mux setup failed:"
724 " %d\n", ret); 1154 " %d\n", ret);
@@ -754,7 +1184,7 @@ static __init void da850_evm_init(void)
754 __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30); 1184 __raw_writel(0, IO_ADDRESS(DA8XX_UART1_BASE) + 0x30);
755 __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30); 1185 __raw_writel(0, IO_ADDRESS(DA8XX_UART0_BASE) + 0x30);
756 1186
757 ret = davinci_cfg_reg_list(da850_mcasp_pins); 1187 ret = davinci_cfg_reg_list(da850_evm_mcasp_pins);
758 if (ret) 1188 if (ret)
759 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n", 1189 pr_warning("da850_evm_init: mcasp mux setup failed: %d\n",
760 ret); 1190 ret);
@@ -787,7 +1217,7 @@ static __init void da850_evm_init(void)
787 if (ret) 1217 if (ret)
788 pr_warning("da850_evm_init: rtc setup failed: %d\n", ret); 1218 pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
789 1219
790 ret = da850_register_cpufreq(); 1220 ret = da850_evm_init_cpufreq();
791 if (ret) 1221 if (ret)
792 pr_warning("da850_evm_init: cpufreq registration failed: %d\n", 1222 pr_warning("da850_evm_init: cpufreq registration failed: %d\n",
793 ret); 1223 ret);
@@ -801,11 +1231,20 @@ static __init void da850_evm_init(void)
801 if (ret) 1231 if (ret)
802 pr_warning("da850_evm_init: suspend registration failed: %d\n", 1232 pr_warning("da850_evm_init: suspend registration failed: %d\n",
803 ret); 1233 ret);
1234
1235 ret = da8xx_register_spi(1, da850evm_spi_info,
1236 ARRAY_SIZE(da850evm_spi_info));
1237 if (ret)
1238 pr_warning("da850_evm_init: spi 1 registration failed: %d\n",
1239 ret);
804} 1240}
805 1241
806#ifdef CONFIG_SERIAL_8250_CONSOLE 1242#ifdef CONFIG_SERIAL_8250_CONSOLE
807static int __init da850_evm_console_init(void) 1243static int __init da850_evm_console_init(void)
808{ 1244{
1245 if (!machine_is_davinci_da850_evm())
1246 return 0;
1247
809 return add_preferred_console("ttyS", 2, "115200"); 1248 return add_preferred_console("ttyS", 2, "115200");
810} 1249}
811console_initcall(da850_evm_console_init); 1250console_initcall(da850_evm_console_init);
@@ -816,9 +1255,7 @@ static void __init da850_evm_map_io(void)
816 da850_init(); 1255 da850_init();
817} 1256}
818 1257
819MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138 EVM") 1258MACHINE_START(DAVINCI_DA850_EVM, "DaVinci DA850/OMAP-L138/AM18x EVM")
820 .phys_io = IO_PHYS,
821 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
822 .boot_params = (DA8XX_DDR_BASE + 0x100), 1259 .boot_params = (DA8XX_DDR_BASE + 0x100),
823 .map_io = da850_evm_map_io, 1260 .map_io = da850_evm_map_io,
824 .init_irq = cp_intc_init, 1261 .init_irq = cp_intc_init,
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index a3191015efee..6e7cad13352c 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -351,8 +351,6 @@ static __init void dm355_evm_init(void)
351} 351}
352 352
353MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM") 353MACHINE_START(DAVINCI_DM355_EVM, "DaVinci DM355 EVM")
354 .phys_io = IO_PHYS,
355 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
356 .boot_params = (0x80000100), 354 .boot_params = (0x80000100),
357 .map_io = dm355_evm_map_io, 355 .map_io = dm355_evm_map_io,
358 .init_irq = davinci_irq_init, 356 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-dm355-leopard.c b/arch/arm/mach-davinci/board-dm355-leopard.c
index f1d8132cf0c3..543f9911b281 100644
--- a/arch/arm/mach-davinci/board-dm355-leopard.c
+++ b/arch/arm/mach-davinci/board-dm355-leopard.c
@@ -270,8 +270,6 @@ static __init void dm355_leopard_init(void)
270} 270}
271 271
272MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard") 272MACHINE_START(DM355_LEOPARD, "DaVinci DM355 leopard")
273 .phys_io = IO_PHYS,
274 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
275 .boot_params = (0x80000100), 273 .boot_params = (0x80000100),
276 .map_io = dm355_leopard_map_io, 274 .map_io = dm355_leopard_map_io,
277 .init_irq = davinci_irq_init, 275 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 84acef1d0b3d..09a87e61ffcf 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -54,9 +54,7 @@ static inline int have_tvp7002(void)
54 return 0; 54 return 0;
55} 55}
56 56
57#define DM365_EVM_PHY_MASK (0x2) 57#define DM365_EVM_PHY_ID "0:01"
58#define DM365_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
59
60/* 58/*
61 * A MAX-II CPLD is used for various board control functions. 59 * A MAX-II CPLD is used for various board control functions.
62 */ 60 */
@@ -175,7 +173,9 @@ static struct at24_platform_data eeprom_info = {
175 .context = (void *)0x7f00, 173 .context = (void *)0x7f00,
176}; 174};
177 175
178static struct snd_platform_data dm365_evm_snd_data; 176static struct snd_platform_data dm365_evm_snd_data = {
177 .asp_chan_q = EVENTQ_3,
178};
179 179
180static struct i2c_board_info i2c_info[] = { 180static struct i2c_board_info i2c_info[] = {
181 { 181 {
@@ -520,7 +520,7 @@ fail:
520 */ 520 */
521 if (have_imager()) { 521 if (have_imager()) {
522 label = "HD imager"; 522 label = "HD imager";
523 mux |= 1; 523 mux |= 2;
524 524
525 /* externally mux MMC1/ENET/AIC33 to imager */ 525 /* externally mux MMC1/ENET/AIC33 to imager */
526 mux |= BIT(6) | BIT(5) | BIT(3); 526 mux |= BIT(6) | BIT(5) | BIT(3);
@@ -533,15 +533,14 @@ fail:
533 533
534 /* ... and ENET ... */ 534 /* ... and ENET ... */
535 dm365evm_emac_configure(); 535 dm365evm_emac_configure();
536 soc_info->emac_pdata->phy_mask = DM365_EVM_PHY_MASK; 536 soc_info->emac_pdata->phy_id = DM365_EVM_PHY_ID;
537 soc_info->emac_pdata->mdio_max_freq = DM365_EVM_MDIO_FREQUENCY;
538 resets &= ~BIT(3); 537 resets &= ~BIT(3);
539 538
540 /* ... and AIC33 */ 539 /* ... and AIC33 */
541 resets &= ~BIT(1); 540 resets &= ~BIT(1);
542 541
543 if (have_tvp7002()) { 542 if (have_tvp7002()) {
544 mux |= 2; 543 mux |= 1;
545 resets &= ~BIT(2); 544 resets &= ~BIT(2);
546 label = "tvp7002 HD"; 545 label = "tvp7002 HD";
547 } else { 546 } else {
@@ -613,8 +612,6 @@ static __init void dm365_evm_init(void)
613} 612}
614 613
615MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM") 614MACHINE_START(DAVINCI_DM365_EVM, "DaVinci DM365 EVM")
616 .phys_io = IO_PHYS,
617 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
618 .boot_params = (0x80000100), 615 .boot_params = (0x80000100),
619 .map_io = dm365_evm_map_io, 616 .map_io = dm365_evm_map_io,
620 .init_irq = davinci_irq_init, 617 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index 34c8b418cd72..556bbd468db3 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -37,10 +37,9 @@
37#include <mach/nand.h> 37#include <mach/nand.h>
38#include <mach/mmc.h> 38#include <mach/mmc.h>
39#include <mach/usb.h> 39#include <mach/usb.h>
40#include <mach/aemif.h>
40 41
41#define DM644X_EVM_PHY_MASK (0x2) 42#define DM644X_EVM_PHY_ID "0:01"
42#define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
43
44#define LXT971_PHY_ID (0x001378e2) 43#define LXT971_PHY_ID (0x001378e2)
45#define LXT971_PHY_MASK (0xfffffff0) 44#define LXT971_PHY_MASK (0xfffffff0)
46 45
@@ -137,11 +136,22 @@ static struct mtd_partition davinci_evm_nandflash_partition[] = {
137 */ 136 */
138}; 137};
139 138
139static struct davinci_aemif_timing davinci_evm_nandflash_timing = {
140 .wsetup = 20,
141 .wstrobe = 40,
142 .whold = 20,
143 .rsetup = 10,
144 .rstrobe = 40,
145 .rhold = 10,
146 .ta = 40,
147};
148
140static struct davinci_nand_pdata davinci_evm_nandflash_data = { 149static struct davinci_nand_pdata davinci_evm_nandflash_data = {
141 .parts = davinci_evm_nandflash_partition, 150 .parts = davinci_evm_nandflash_partition,
142 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition), 151 .nr_parts = ARRAY_SIZE(davinci_evm_nandflash_partition),
143 .ecc_mode = NAND_ECC_HW, 152 .ecc_mode = NAND_ECC_HW,
144 .options = NAND_USE_FLASH_BBT, 153 .options = NAND_USE_FLASH_BBT,
154 .timing = &davinci_evm_nandflash_timing,
145}; 155};
146 156
147static struct resource davinci_evm_nandflash_resource[] = { 157static struct resource davinci_evm_nandflash_resource[] = {
@@ -430,11 +440,6 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
430 gpio_request(gpio + 7, "nCF_SEL"); 440 gpio_request(gpio + 7, "nCF_SEL");
431 gpio_direction_output(gpio + 7, 1); 441 gpio_direction_output(gpio + 7, 1);
432 442
433 /* irlml6401 switches over 1A, in under 8 msec;
434 * now it can be managed by nDRV_VBUS ...
435 */
436 davinci_setup_usb(1000, 8);
437
438 return 0; 443 return 0;
439} 444}
440 445
@@ -695,9 +700,10 @@ static __init void davinci_evm_init(void)
695 davinci_serial_init(&uart_config); 700 davinci_serial_init(&uart_config);
696 dm644x_init_asp(&dm644x_evm_snd_data); 701 dm644x_init_asp(&dm644x_evm_snd_data);
697 702
698 soc_info->emac_pdata->phy_mask = DM644X_EVM_PHY_MASK; 703 /* irlml6401 switches over 1A, in under 8 msec */
699 soc_info->emac_pdata->mdio_max_freq = DM644X_EVM_MDIO_FREQUENCY; 704 davinci_setup_usb(1000, 8);
700 705
706 soc_info->emac_pdata->phy_id = DM644X_EVM_PHY_ID;
701 /* Register the fixup for PHY on DaVinci */ 707 /* Register the fixup for PHY on DaVinci */
702 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK, 708 phy_register_fixup_for_uid(LXT971_PHY_ID, LXT971_PHY_MASK,
703 davinci_phy_fixup); 709 davinci_phy_fixup);
@@ -706,8 +712,6 @@ static __init void davinci_evm_init(void)
706 712
707MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM") 713MACHINE_START(DAVINCI_EVM, "DaVinci DM644x EVM")
708 /* Maintainer: MontaVista Software <source@mvista.com> */ 714 /* Maintainer: MontaVista Software <source@mvista.com> */
709 .phys_io = IO_PHYS,
710 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
711 .boot_params = (DAVINCI_DDR_BASE + 0x100), 715 .boot_params = (DAVINCI_DDR_BASE + 0x100),
712 .map_io = davinci_evm_map_io, 716 .map_io = davinci_evm_map_io,
713 .init_irq = davinci_irq_init, 717 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index 4502f346b2b0..f6ac9ba74878 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -42,6 +42,7 @@
42#include <mach/nand.h> 42#include <mach/nand.h>
43#include <mach/clock.h> 43#include <mach/clock.h>
44#include <mach/cdce949.h> 44#include <mach/cdce949.h>
45#include <mach/aemif.h>
45 46
46#include "clock.h" 47#include "clock.h"
47 48
@@ -71,6 +72,16 @@ static struct mtd_partition davinci_nand_partitions[] = {
71 } 72 }
72}; 73};
73 74
75static struct davinci_aemif_timing dm6467tevm_nandflash_timing = {
76 .wsetup = 29,
77 .wstrobe = 24,
78 .whold = 14,
79 .rsetup = 19,
80 .rstrobe = 33,
81 .rhold = 0,
82 .ta = 29,
83};
84
74static struct davinci_nand_pdata davinci_nand_data = { 85static struct davinci_nand_pdata davinci_nand_data = {
75 .mask_cle = 0x80000, 86 .mask_cle = 0x80000,
76 .mask_ale = 0x40000, 87 .mask_ale = 0x40000,
@@ -718,9 +729,7 @@ static struct davinci_uart_config uart_config __initdata = {
718 .enabled_uarts = (1 << 0), 729 .enabled_uarts = (1 << 0),
719}; 730};
720 731
721#define DM646X_EVM_PHY_MASK (0x2) 732#define DM646X_EVM_PHY_ID "0:01"
722#define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
723
724/* 733/*
725 * The following EDMA channels/slots are not being used by drivers (for 734 * The following EDMA channels/slots are not being used by drivers (for
726 * example: Timer, GPIO, UART events etc) on dm646x, hence they are being 735 * example: Timer, GPIO, UART events etc) on dm646x, hence they are being
@@ -763,6 +772,9 @@ static __init void evm_init(void)
763 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]); 772 dm646x_init_mcasp0(&dm646x_evm_snd_data[0]);
764 dm646x_init_mcasp1(&dm646x_evm_snd_data[1]); 773 dm646x_init_mcasp1(&dm646x_evm_snd_data[1]);
765 774
775 if (machine_is_davinci_dm6467tevm())
776 davinci_nand_data.timing = &dm6467tevm_nandflash_timing;
777
766 platform_device_register(&davinci_nand_device); 778 platform_device_register(&davinci_nand_device);
767 779
768 dm646x_init_edma(dm646x_edma_rsv); 780 dm646x_init_edma(dm646x_edma_rsv);
@@ -770,8 +782,7 @@ static __init void evm_init(void)
770 if (HAS_ATA) 782 if (HAS_ATA)
771 davinci_init_ide(); 783 davinci_init_ide();
772 784
773 soc_info->emac_pdata->phy_mask = DM646X_EVM_PHY_MASK; 785 soc_info->emac_pdata->phy_id = DM646X_EVM_PHY_ID;
774 soc_info->emac_pdata->mdio_max_freq = DM646X_EVM_MDIO_FREQUENCY;
775} 786}
776 787
777#define DM646X_EVM_REF_FREQ 27000000 788#define DM646X_EVM_REF_FREQ 27000000
@@ -786,8 +797,6 @@ void __init dm646x_board_setup_refclk(struct clk *clk)
786} 797}
787 798
788MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") 799MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
789 .phys_io = IO_PHYS,
790 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
791 .boot_params = (0x80000100), 800 .boot_params = (0x80000100),
792 .map_io = davinci_map_io, 801 .map_io = davinci_map_io,
793 .init_irq = davinci_irq_init, 802 .init_irq = davinci_irq_init,
@@ -796,8 +805,6 @@ MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
796MACHINE_END 805MACHINE_END
797 806
798MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM") 807MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
799 .phys_io = IO_PHYS,
800 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
801 .boot_params = (0x80000100), 808 .boot_params = (0x80000100),
802 .map_io = davinci_map_io, 809 .map_io = davinci_map_io,
803 .init_irq = davinci_irq_init, 810 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c
new file mode 100644
index 000000000000..606a6f27ed6c
--- /dev/null
+++ b/arch/arm/mach-davinci/board-mityomapl138.c
@@ -0,0 +1,573 @@
1/*
2 * Critical Link MityOMAP-L138 SoM
3 *
4 * Copyright (C) 2010 Critical Link LLC - http://www.criticallink.com
5 *
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
8 * any kind, whether express or implied.
9 */
10
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/console.h>
14#include <linux/platform_device.h>
15#include <linux/mtd/partitions.h>
16#include <linux/regulator/machine.h>
17#include <linux/i2c.h>
18#include <linux/i2c/at24.h>
19#include <linux/etherdevice.h>
20#include <linux/spi/spi.h>
21#include <linux/spi/flash.h>
22
23#include <asm/mach-types.h>
24#include <asm/mach/arch.h>
25#include <mach/common.h>
26#include <mach/cp_intc.h>
27#include <mach/da8xx.h>
28#include <mach/nand.h>
29#include <mach/mux.h>
30#include <mach/spi.h>
31
32#define MITYOMAPL138_PHY_ID ""
33
34#define FACTORY_CONFIG_MAGIC 0x012C0138
35#define FACTORY_CONFIG_VERSION 0x00010001
36
37/* Data Held in On-Board I2C device */
38struct factory_config {
39 u32 magic;
40 u32 version;
41 u8 mac[6];
42 u32 fpga_type;
43 u32 spare;
44 u32 serialnumber;
45 char partnum[32];
46};
47
48static struct factory_config factory_config;
49
50struct part_no_info {
51 const char *part_no; /* part number string of interest */
52 int max_freq; /* khz */
53};
54
55static struct part_no_info mityomapl138_pn_info[] = {
56 {
57 .part_no = "L138-C",
58 .max_freq = 300000,
59 },
60 {
61 .part_no = "L138-D",
62 .max_freq = 375000,
63 },
64 {
65 .part_no = "L138-F",
66 .max_freq = 456000,
67 },
68 {
69 .part_no = "1808-C",
70 .max_freq = 300000,
71 },
72 {
73 .part_no = "1808-D",
74 .max_freq = 375000,
75 },
76 {
77 .part_no = "1808-F",
78 .max_freq = 456000,
79 },
80 {
81 .part_no = "1810-D",
82 .max_freq = 375000,
83 },
84};
85
86#ifdef CONFIG_CPU_FREQ
87static void mityomapl138_cpufreq_init(const char *partnum)
88{
89 int i, ret;
90
91 for (i = 0; partnum && i < ARRAY_SIZE(mityomapl138_pn_info); i++) {
92 /*
93 * the part number has additional characters beyond what is
94 * stored in the table. This information is not needed for
95 * determining the speed grade, and would require several
96 * more table entries. Only check the first N characters
97 * for a match.
98 */
99 if (!strncmp(partnum, mityomapl138_pn_info[i].part_no,
100 strlen(mityomapl138_pn_info[i].part_no))) {
101 da850_max_speed = mityomapl138_pn_info[i].max_freq;
102 break;
103 }
104 }
105
106 ret = da850_register_cpufreq("pll0_sysclk3");
107 if (ret)
108 pr_warning("cpufreq registration failed: %d\n", ret);
109}
110#else
111static void mityomapl138_cpufreq_init(const char *partnum) { }
112#endif
113
114static void read_factory_config(struct memory_accessor *a, void *context)
115{
116 int ret;
117 const char *partnum = NULL;
118 struct davinci_soc_info *soc_info = &davinci_soc_info;
119
120 ret = a->read(a, (char *)&factory_config, 0, sizeof(factory_config));
121 if (ret != sizeof(struct factory_config)) {
122 pr_warning("MityOMAPL138: Read Factory Config Failed: %d\n",
123 ret);
124 goto bad_config;
125 }
126
127 if (factory_config.magic != FACTORY_CONFIG_MAGIC) {
128 pr_warning("MityOMAPL138: Factory Config Magic Wrong (%X)\n",
129 factory_config.magic);
130 goto bad_config;
131 }
132
133 if (factory_config.version != FACTORY_CONFIG_VERSION) {
134 pr_warning("MityOMAPL138: Factory Config Version Wrong (%X)\n",
135 factory_config.version);
136 goto bad_config;
137 }
138
139 pr_info("MityOMAPL138: Found MAC = %pM\n", factory_config.mac);
140 if (is_valid_ether_addr(factory_config.mac))
141 memcpy(soc_info->emac_pdata->mac_addr,
142 factory_config.mac, ETH_ALEN);
143 else
144 pr_warning("MityOMAPL138: Invalid MAC found "
145 "in factory config block\n");
146
147 partnum = factory_config.partnum;
148 pr_info("MityOMAPL138: Part Number = %s\n", partnum);
149
150bad_config:
151 /* default maximum speed is valid for all platforms */
152 mityomapl138_cpufreq_init(partnum);
153}
154
155static struct at24_platform_data mityomapl138_fd_chip = {
156 .byte_len = 256,
157 .page_size = 8,
158 .flags = AT24_FLAG_READONLY | AT24_FLAG_IRUGO,
159 .setup = read_factory_config,
160 .context = NULL,
161};
162
163static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = {
164 .bus_freq = 100, /* kHz */
165 .bus_delay = 0, /* usec */
166};
167
168/* TPS65023 voltage regulator support */
169/* 1.2V Core */
170static struct regulator_consumer_supply tps65023_dcdc1_consumers[] = {
171 {
172 .supply = "cvdd",
173 },
174};
175
176/* 1.8V */
177static struct regulator_consumer_supply tps65023_dcdc2_consumers[] = {
178 {
179 .supply = "usb0_vdda18",
180 },
181 {
182 .supply = "usb1_vdda18",
183 },
184 {
185 .supply = "ddr_dvdd18",
186 },
187 {
188 .supply = "sata_vddr",
189 },
190};
191
192/* 1.2V */
193static struct regulator_consumer_supply tps65023_dcdc3_consumers[] = {
194 {
195 .supply = "sata_vdd",
196 },
197 {
198 .supply = "usb_cvdd",
199 },
200 {
201 .supply = "pll0_vdda",
202 },
203 {
204 .supply = "pll1_vdda",
205 },
206};
207
208/* 1.8V Aux LDO, not used */
209static struct regulator_consumer_supply tps65023_ldo1_consumers[] = {
210 {
211 .supply = "1.8v_aux",
212 },
213};
214
215/* FPGA VCC Aux (2.5 or 3.3) LDO */
216static struct regulator_consumer_supply tps65023_ldo2_consumers[] = {
217 {
218 .supply = "vccaux",
219 },
220};
221
222static struct regulator_init_data tps65023_regulator_data[] = {
223 /* dcdc1 */
224 {
225 .constraints = {
226 .min_uV = 1150000,
227 .max_uV = 1350000,
228 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
229 REGULATOR_CHANGE_STATUS,
230 .boot_on = 1,
231 },
232 .num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc1_consumers),
233 .consumer_supplies = tps65023_dcdc1_consumers,
234 },
235 /* dcdc2 */
236 {
237 .constraints = {
238 .min_uV = 1800000,
239 .max_uV = 1800000,
240 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
241 .boot_on = 1,
242 },
243 .num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc2_consumers),
244 .consumer_supplies = tps65023_dcdc2_consumers,
245 },
246 /* dcdc3 */
247 {
248 .constraints = {
249 .min_uV = 1200000,
250 .max_uV = 1200000,
251 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
252 .boot_on = 1,
253 },
254 .num_consumer_supplies = ARRAY_SIZE(tps65023_dcdc3_consumers),
255 .consumer_supplies = tps65023_dcdc3_consumers,
256 },
257 /* ldo1 */
258 {
259 .constraints = {
260 .min_uV = 1800000,
261 .max_uV = 1800000,
262 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
263 .boot_on = 1,
264 },
265 .num_consumer_supplies = ARRAY_SIZE(tps65023_ldo1_consumers),
266 .consumer_supplies = tps65023_ldo1_consumers,
267 },
268 /* ldo2 */
269 {
270 .constraints = {
271 .min_uV = 2500000,
272 .max_uV = 3300000,
273 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
274 REGULATOR_CHANGE_STATUS,
275 .boot_on = 1,
276 },
277 .num_consumer_supplies = ARRAY_SIZE(tps65023_ldo2_consumers),
278 .consumer_supplies = tps65023_ldo2_consumers,
279 },
280};
281
282static struct i2c_board_info __initdata mityomap_tps65023_info[] = {
283 {
284 I2C_BOARD_INFO("tps65023", 0x48),
285 .platform_data = &tps65023_regulator_data[0],
286 },
287 {
288 I2C_BOARD_INFO("24c02", 0x50),
289 .platform_data = &mityomapl138_fd_chip,
290 },
291};
292
293static int __init pmic_tps65023_init(void)
294{
295 return i2c_register_board_info(1, mityomap_tps65023_info,
296 ARRAY_SIZE(mityomap_tps65023_info));
297}
298
299/*
300 * SPI Devices:
301 * SPI1_CS0: 8M Flash ST-M25P64-VME6G
302 */
303static struct mtd_partition spi_flash_partitions[] = {
304 [0] = {
305 .name = "ubl",
306 .offset = 0,
307 .size = SZ_64K,
308 .mask_flags = MTD_WRITEABLE,
309 },
310 [1] = {
311 .name = "u-boot",
312 .offset = MTDPART_OFS_APPEND,
313 .size = SZ_512K,
314 .mask_flags = MTD_WRITEABLE,
315 },
316 [2] = {
317 .name = "u-boot-env",
318 .offset = MTDPART_OFS_APPEND,
319 .size = SZ_64K,
320 .mask_flags = MTD_WRITEABLE,
321 },
322 [3] = {
323 .name = "periph-config",
324 .offset = MTDPART_OFS_APPEND,
325 .size = SZ_64K,
326 .mask_flags = MTD_WRITEABLE,
327 },
328 [4] = {
329 .name = "reserved",
330 .offset = MTDPART_OFS_APPEND,
331 .size = SZ_256K + SZ_64K,
332 },
333 [5] = {
334 .name = "kernel",
335 .offset = MTDPART_OFS_APPEND,
336 .size = SZ_2M + SZ_1M,
337 },
338 [6] = {
339 .name = "fpga",
340 .offset = MTDPART_OFS_APPEND,
341 .size = SZ_2M,
342 },
343 [7] = {
344 .name = "spare",
345 .offset = MTDPART_OFS_APPEND,
346 .size = MTDPART_SIZ_FULL,
347 },
348};
349
350static struct flash_platform_data mityomapl138_spi_flash_data = {
351 .name = "m25p80",
352 .parts = spi_flash_partitions,
353 .nr_parts = ARRAY_SIZE(spi_flash_partitions),
354 .type = "m24p64",
355};
356
357static struct davinci_spi_config spi_eprom_config = {
358 .io_type = SPI_IO_TYPE_DMA,
359 .c2tdelay = 8,
360 .t2cdelay = 8,
361};
362
363static struct spi_board_info mityomapl138_spi_flash_info[] = {
364 {
365 .modalias = "m25p80",
366 .platform_data = &mityomapl138_spi_flash_data,
367 .controller_data = &spi_eprom_config,
368 .mode = SPI_MODE_0,
369 .max_speed_hz = 30000000,
370 .bus_num = 1,
371 .chip_select = 0,
372 },
373};
374
375/*
376 * MityDSP-L138 includes a 256 MByte large-page NAND flash
377 * (128K blocks).
378 */
379static struct mtd_partition mityomapl138_nandflash_partition[] = {
380 {
381 .name = "rootfs",
382 .offset = 0,
383 .size = SZ_128M,
384 .mask_flags = 0, /* MTD_WRITEABLE, */
385 },
386 {
387 .name = "homefs",
388 .offset = MTDPART_OFS_APPEND,
389 .size = MTDPART_SIZ_FULL,
390 .mask_flags = 0,
391 },
392};
393
394static struct davinci_nand_pdata mityomapl138_nandflash_data = {
395 .parts = mityomapl138_nandflash_partition,
396 .nr_parts = ARRAY_SIZE(mityomapl138_nandflash_partition),
397 .ecc_mode = NAND_ECC_HW,
398 .options = NAND_USE_FLASH_BBT | NAND_BUSWIDTH_16,
399 .ecc_bits = 1, /* 4 bit mode is not supported with 16 bit NAND */
400};
401
402static struct resource mityomapl138_nandflash_resource[] = {
403 {
404 .start = DA8XX_AEMIF_CS3_BASE,
405 .end = DA8XX_AEMIF_CS3_BASE + SZ_512K + 2 * SZ_1K - 1,
406 .flags = IORESOURCE_MEM,
407 },
408 {
409 .start = DA8XX_AEMIF_CTL_BASE,
410 .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1,
411 .flags = IORESOURCE_MEM,
412 },
413};
414
415static struct platform_device mityomapl138_nandflash_device = {
416 .name = "davinci_nand",
417 .id = 1,
418 .dev = {
419 .platform_data = &mityomapl138_nandflash_data,
420 },
421 .num_resources = ARRAY_SIZE(mityomapl138_nandflash_resource),
422 .resource = mityomapl138_nandflash_resource,
423};
424
425static struct platform_device *mityomapl138_devices[] __initdata = {
426 &mityomapl138_nandflash_device,
427};
428
429static void __init mityomapl138_setup_nand(void)
430{
431 platform_add_devices(mityomapl138_devices,
432 ARRAY_SIZE(mityomapl138_devices));
433}
434
435static struct davinci_uart_config mityomapl138_uart_config __initdata = {
436 .enabled_uarts = 0x7,
437};
438
439static const short mityomap_mii_pins[] = {
440 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
441 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
442 DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
443 DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
444 DA850_MDIO_D,
445 -1
446};
447
448static const short mityomap_rmii_pins[] = {
449 DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
450 DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
451 DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
452 DA850_MDIO_D,
453 -1
454};
455
456static void __init mityomapl138_config_emac(void)
457{
458 void __iomem *cfg_chip3_base;
459 int ret;
460 u32 val;
461 struct davinci_soc_info *soc_info = &davinci_soc_info;
462
463 soc_info->emac_pdata->rmii_en = 0; /* hardcoded for now */
464
465 cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
466 val = __raw_readl(cfg_chip3_base);
467
468 if (soc_info->emac_pdata->rmii_en) {
469 val |= BIT(8);
470 ret = davinci_cfg_reg_list(mityomap_rmii_pins);
471 pr_info("RMII PHY configured\n");
472 } else {
473 val &= ~BIT(8);
474 ret = davinci_cfg_reg_list(mityomap_mii_pins);
475 pr_info("MII PHY configured\n");
476 }
477
478 if (ret) {
479 pr_warning("mii/rmii mux setup failed: %d\n", ret);
480 return;
481 }
482
483 /* configure the CFGCHIP3 register for RMII or MII */
484 __raw_writel(val, cfg_chip3_base);
485
486 soc_info->emac_pdata->phy_id = MITYOMAPL138_PHY_ID;
487
488 ret = da8xx_register_emac();
489 if (ret)
490 pr_warning("emac registration failed: %d\n", ret);
491}
492
493static struct davinci_pm_config da850_pm_pdata = {
494 .sleepcount = 128,
495};
496
497static struct platform_device da850_pm_device = {
498 .name = "pm-davinci",
499 .dev = {
500 .platform_data = &da850_pm_pdata,
501 },
502 .id = -1,
503};
504
505static void __init mityomapl138_init(void)
506{
507 int ret;
508
509 /* for now, no special EDMA channels are reserved */
510 ret = da850_register_edma(NULL);
511 if (ret)
512 pr_warning("edma registration failed: %d\n", ret);
513
514 ret = da8xx_register_watchdog();
515 if (ret)
516 pr_warning("watchdog registration failed: %d\n", ret);
517
518 davinci_serial_init(&mityomapl138_uart_config);
519
520 ret = da8xx_register_i2c(0, &mityomap_i2c_0_pdata);
521 if (ret)
522 pr_warning("i2c0 registration failed: %d\n", ret);
523
524 ret = pmic_tps65023_init();
525 if (ret)
526 pr_warning("TPS65023 PMIC init failed: %d\n", ret);
527
528 mityomapl138_setup_nand();
529
530 ret = da8xx_register_spi(1, mityomapl138_spi_flash_info,
531 ARRAY_SIZE(mityomapl138_spi_flash_info));
532 if (ret)
533 pr_warning("spi 1 registration failed: %d\n", ret);
534
535 mityomapl138_config_emac();
536
537 ret = da8xx_register_rtc();
538 if (ret)
539 pr_warning("rtc setup failed: %d\n", ret);
540
541 ret = da8xx_register_cpuidle();
542 if (ret)
543 pr_warning("cpuidle registration failed: %d\n", ret);
544
545 ret = da850_register_pm(&da850_pm_device);
546 if (ret)
547 pr_warning("da850_evm_init: suspend registration failed: %d\n",
548 ret);
549}
550
551#ifdef CONFIG_SERIAL_8250_CONSOLE
552static int __init mityomapl138_console_init(void)
553{
554 if (!machine_is_mityomapl138())
555 return 0;
556
557 return add_preferred_console("ttyS", 1, "115200");
558}
559console_initcall(mityomapl138_console_init);
560#endif
561
562static void __init mityomapl138_map_io(void)
563{
564 da850_init();
565}
566
567MACHINE_START(MITYOMAPL138, "MityDSP-L138/MityARM-1808")
568 .boot_params = (DA8XX_DDR_BASE + 0x100),
569 .map_io = mityomapl138_map_io,
570 .init_irq = cp_intc_init,
571 .timer = &davinci_timer,
572 .init_machine = mityomapl138_init,
573MACHINE_END
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 4c30e929bbf9..3e7be2de96de 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -11,7 +11,7 @@
11 * DM644X-EVM board. It has: 11 * DM644X-EVM board. It has:
12 * DM6446M02 module with 256MB NAND, 256MB RAM, TLV320AIC32 AIC, 12 * DM6446M02 module with 256MB NAND, 256MB RAM, TLV320AIC32 AIC,
13 * USB, Ethernet, SD/MMC, UART, THS8200, TVP7000 for video. 13 * USB, Ethernet, SD/MMC, UART, THS8200, TVP7000 for video.
14 * Additionaly realtime clock, IR remote control receiver, 14 * Additionally realtime clock, IR remote control receiver,
15 * IR Blaster based on MSP430 (firmware although is different 15 * IR Blaster based on MSP430 (firmware although is different
16 * from used in DM644X-EVM), internal ATA-6 3.5” HDD drive 16 * from used in DM644X-EVM), internal ATA-6 3.5” HDD drive
17 * with PATA interface, two muxed red-green leds. 17 * with PATA interface, two muxed red-green leds.
@@ -39,9 +39,7 @@
39#include <mach/mmc.h> 39#include <mach/mmc.h>
40#include <mach/usb.h> 40#include <mach/usb.h>
41 41
42#define NEUROS_OSD2_PHY_MASK 0x2 42#define NEUROS_OSD2_PHY_ID "0:01"
43#define NEUROS_OSD2_MDIO_FREQUENCY 2200000 /* PHY bus frequency */
44
45#define LXT971_PHY_ID 0x001378e2 43#define LXT971_PHY_ID 0x001378e2
46#define LXT971_PHY_MASK 0xfffffff0 44#define LXT971_PHY_MASK 0xfffffff0
47 45
@@ -252,8 +250,7 @@ static __init void davinci_ntosd2_init(void)
252 davinci_serial_init(&uart_config); 250 davinci_serial_init(&uart_config);
253 dm644x_init_asp(&dm644x_ntosd2_snd_data); 251 dm644x_init_asp(&dm644x_ntosd2_snd_data);
254 252
255 soc_info->emac_pdata->phy_mask = NEUROS_OSD2_PHY_MASK; 253 soc_info->emac_pdata->phy_id = NEUROS_OSD2_PHY_ID;
256 soc_info->emac_pdata->mdio_max_freq = NEUROS_OSD2_MDIO_FREQUENCY;
257 254
258 davinci_setup_usb(1000, 8); 255 davinci_setup_usb(1000, 8);
259 /* 256 /*
@@ -275,8 +272,6 @@ static __init void davinci_ntosd2_init(void)
275 272
276MACHINE_START(NEUROS_OSD2, "Neuros OSD2") 273MACHINE_START(NEUROS_OSD2, "Neuros OSD2")
277 /* Maintainer: Neuros Technologies <neuros@groups.google.com> */ 274 /* Maintainer: Neuros Technologies <neuros@groups.google.com> */
278 .phys_io = IO_PHYS,
279 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
280 .boot_params = (DAVINCI_DDR_BASE + 0x100), 275 .boot_params = (DAVINCI_DDR_BASE + 0x100),
281 .map_io = davinci_ntosd2_map_io, 276 .map_io = davinci_ntosd2_map_io,
282 .init_irq = davinci_irq_init, 277 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
new file mode 100644
index 000000000000..67c38d0ecd10
--- /dev/null
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -0,0 +1,346 @@
1/*
2 * Hawkboard.org based on TI's OMAP-L138 Platform
3 *
4 * Initial code: Syed Mohammed Khasim
5 *
6 * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of
10 * any kind, whether express or implied.
11 */
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/console.h>
15#include <linux/gpio.h>
16
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19
20#include <mach/cp_intc.h>
21#include <mach/da8xx.h>
22#include <mach/mux.h>
23
24#define HAWKBOARD_PHY_ID "0:07"
25#define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12)
26#define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13)
27
28#define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4)
29#define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13)
30
31static short omapl138_hawk_mii_pins[] __initdata = {
32 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
33 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
34 DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
35 DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
36 DA850_MDIO_D,
37 -1
38};
39
40static __init void omapl138_hawk_config_emac(void)
41{
42 void __iomem *cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
43 int ret;
44 u32 val;
45 struct davinci_soc_info *soc_info = &davinci_soc_info;
46
47 val = __raw_readl(cfgchip3);
48 val &= ~BIT(8);
49 ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins);
50 if (ret) {
51 pr_warning("%s: cpgmac/mii mux setup failed: %d\n",
52 __func__, ret);
53 return;
54 }
55
56 /* configure the CFGCHIP3 register for MII */
57 __raw_writel(val, cfgchip3);
58 pr_info("EMAC: MII PHY configured\n");
59
60 soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID;
61
62 ret = da8xx_register_emac();
63 if (ret)
64 pr_warning("%s: emac registration failed: %d\n",
65 __func__, ret);
66}
67
68/*
69 * The following EDMA channels/slots are not being used by drivers (for
70 * example: Timer, GPIO, UART events etc) on da850/omap-l138 EVM/Hawkboard,
71 * hence they are being reserved for codecs on the DSP side.
72 */
73static const s16 da850_dma0_rsv_chans[][2] = {
74 /* (offset, number) */
75 { 8, 6},
76 {24, 4},
77 {30, 2},
78 {-1, -1}
79};
80
81static const s16 da850_dma0_rsv_slots[][2] = {
82 /* (offset, number) */
83 { 8, 6},
84 {24, 4},
85 {30, 50},
86 {-1, -1}
87};
88
89static const s16 da850_dma1_rsv_chans[][2] = {
90 /* (offset, number) */
91 { 0, 28},
92 {30, 2},
93 {-1, -1}
94};
95
96static const s16 da850_dma1_rsv_slots[][2] = {
97 /* (offset, number) */
98 { 0, 28},
99 {30, 90},
100 {-1, -1}
101};
102
103static struct edma_rsv_info da850_edma_cc0_rsv = {
104 .rsv_chans = da850_dma0_rsv_chans,
105 .rsv_slots = da850_dma0_rsv_slots,
106};
107
108static struct edma_rsv_info da850_edma_cc1_rsv = {
109 .rsv_chans = da850_dma1_rsv_chans,
110 .rsv_slots = da850_dma1_rsv_slots,
111};
112
113static struct edma_rsv_info *da850_edma_rsv[2] = {
114 &da850_edma_cc0_rsv,
115 &da850_edma_cc1_rsv,
116};
117
118static const short hawk_mmcsd0_pins[] = {
119 DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
120 DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
121 DA850_GPIO3_12, DA850_GPIO3_13,
122 -1
123};
124
125static int da850_hawk_mmc_get_ro(int index)
126{
127 return gpio_get_value(DA850_HAWK_MMCSD_WP_PIN);
128}
129
130static int da850_hawk_mmc_get_cd(int index)
131{
132 return !gpio_get_value(DA850_HAWK_MMCSD_CD_PIN);
133}
134
135static struct davinci_mmc_config da850_mmc_config = {
136 .get_ro = da850_hawk_mmc_get_ro,
137 .get_cd = da850_hawk_mmc_get_cd,
138 .wires = 4,
139 .max_freq = 50000000,
140 .caps = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
141 .version = MMC_CTLR_VERSION_2,
142};
143
144static __init void omapl138_hawk_mmc_init(void)
145{
146 int ret;
147
148 ret = davinci_cfg_reg_list(hawk_mmcsd0_pins);
149 if (ret) {
150 pr_warning("%s: MMC/SD0 mux setup failed: %d\n",
151 __func__, ret);
152 return;
153 }
154
155 ret = gpio_request_one(DA850_HAWK_MMCSD_CD_PIN,
156 GPIOF_DIR_IN, "MMC CD");
157 if (ret < 0) {
158 pr_warning("%s: can not open GPIO %d\n",
159 __func__, DA850_HAWK_MMCSD_CD_PIN);
160 return;
161 }
162
163 ret = gpio_request_one(DA850_HAWK_MMCSD_WP_PIN,
164 GPIOF_DIR_IN, "MMC WP");
165 if (ret < 0) {
166 pr_warning("%s: can not open GPIO %d\n",
167 __func__, DA850_HAWK_MMCSD_WP_PIN);
168 goto mmc_setup_wp_fail;
169 }
170
171 ret = da8xx_register_mmcsd0(&da850_mmc_config);
172 if (ret) {
173 pr_warning("%s: MMC/SD0 registration failed: %d\n",
174 __func__, ret);
175 goto mmc_setup_mmcsd_fail;
176 }
177
178 return;
179
180mmc_setup_mmcsd_fail:
181 gpio_free(DA850_HAWK_MMCSD_WP_PIN);
182mmc_setup_wp_fail:
183 gpio_free(DA850_HAWK_MMCSD_CD_PIN);
184}
185
186static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
187static da8xx_ocic_handler_t hawk_usb_ocic_handler;
188
189static const short da850_hawk_usb11_pins[] = {
190 DA850_GPIO2_4, DA850_GPIO6_13,
191 -1
192};
193
194static int hawk_usb_set_power(unsigned port, int on)
195{
196 gpio_set_value(DA850_USB1_VBUS_PIN, on);
197 return 0;
198}
199
200static int hawk_usb_get_power(unsigned port)
201{
202 return gpio_get_value(DA850_USB1_VBUS_PIN);
203}
204
205static int hawk_usb_get_oci(unsigned port)
206{
207 return !gpio_get_value(DA850_USB1_OC_PIN);
208}
209
210static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
211{
212 int irq = gpio_to_irq(DA850_USB1_OC_PIN);
213 int error = 0;
214
215 if (handler != NULL) {
216 hawk_usb_ocic_handler = handler;
217
218 error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
219 IRQF_DISABLED | IRQF_TRIGGER_RISING |
220 IRQF_TRIGGER_FALLING,
221 "OHCI over-current indicator", NULL);
222 if (error)
223 pr_err("%s: could not request IRQ to watch "
224 "over-current indicator changes\n", __func__);
225 } else {
226 free_irq(irq, NULL);
227 }
228 return error;
229}
230
231static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
232 .set_power = hawk_usb_set_power,
233 .get_power = hawk_usb_get_power,
234 .get_oci = hawk_usb_get_oci,
235 .ocic_notify = hawk_usb_ocic_notify,
236 /* TPS2087 switch @ 5V */
237 .potpgt = (3 + 1) / 2, /* 3 ms max */
238};
239
240static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
241{
242 hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
243 return IRQ_HANDLED;
244}
245
246static __init void omapl138_hawk_usb_init(void)
247{
248 int ret;
249 u32 cfgchip2;
250
251 ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
252 if (ret) {
253 pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
254 __func__, ret);
255 return;
256 }
257
258 /* Setup the Ref. clock frequency for the HAWK at 24 MHz. */
259
260 cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
261 cfgchip2 &= ~CFGCHIP2_REFFREQ;
262 cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ;
263 __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
264
265 ret = gpio_request_one(DA850_USB1_VBUS_PIN,
266 GPIOF_DIR_OUT, "USB1 VBUS");
267 if (ret < 0) {
268 pr_err("%s: failed to request GPIO for USB 1.1 port "
269 "power control: %d\n", __func__, ret);
270 return;
271 }
272
273 ret = gpio_request_one(DA850_USB1_OC_PIN,
274 GPIOF_DIR_IN, "USB1 OC");
275 if (ret < 0) {
276 pr_err("%s: failed to request GPIO for USB 1.1 port "
277 "over-current indicator: %d\n", __func__, ret);
278 goto usb11_setup_oc_fail;
279 }
280
281 ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
282 if (ret) {
283 pr_warning("%s: USB 1.1 registration failed: %d\n",
284 __func__, ret);
285 goto usb11_setup_fail;
286 }
287
288 return;
289
290usb11_setup_fail:
291 gpio_free(DA850_USB1_OC_PIN);
292usb11_setup_oc_fail:
293 gpio_free(DA850_USB1_VBUS_PIN);
294}
295
296static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
297 .enabled_uarts = 0x7,
298};
299
300static __init void omapl138_hawk_init(void)
301{
302 int ret;
303
304 davinci_serial_init(&omapl138_hawk_uart_config);
305
306 omapl138_hawk_config_emac();
307
308 ret = da850_register_edma(da850_edma_rsv);
309 if (ret)
310 pr_warning("%s: EDMA registration failed: %d\n",
311 __func__, ret);
312
313 omapl138_hawk_mmc_init();
314
315 omapl138_hawk_usb_init();
316
317 ret = da8xx_register_watchdog();
318 if (ret)
319 pr_warning("omapl138_hawk_init: "
320 "watchdog registration failed: %d\n",
321 ret);
322}
323
324#ifdef CONFIG_SERIAL_8250_CONSOLE
325static int __init omapl138_hawk_console_init(void)
326{
327 if (!machine_is_omapl138_hawkboard())
328 return 0;
329
330 return add_preferred_console("ttyS", 2, "115200");
331}
332console_initcall(omapl138_hawk_console_init);
333#endif
334
335static void __init omapl138_hawk_map_io(void)
336{
337 da850_init();
338}
339
340MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
341 .boot_params = (DA8XX_DDR_BASE + 0x100),
342 .map_io = omapl138_hawk_map_io,
343 .init_irq = cp_intc_init,
344 .timer = &davinci_timer,
345 .init_machine = omapl138_hawk_init,
346MACHINE_END
diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c
index 23e664a1a802..61ac96d8f00d 100644
--- a/arch/arm/mach-davinci/board-sffsdr.c
+++ b/arch/arm/mach-davinci/board-sffsdr.c
@@ -42,9 +42,7 @@
42#include <mach/mux.h> 42#include <mach/mux.h>
43#include <mach/usb.h> 43#include <mach/usb.h>
44 44
45#define SFFSDR_PHY_MASK (0x2) 45#define SFFSDR_PHY_ID "0:01"
46#define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */
47
48static struct mtd_partition davinci_sffsdr_nandflash_partition[] = { 46static struct mtd_partition davinci_sffsdr_nandflash_partition[] = {
49 /* U-Boot Environment: Block 0 47 /* U-Boot Environment: Block 0
50 * UBL: Block 1 48 * UBL: Block 1
@@ -143,8 +141,7 @@ static __init void davinci_sffsdr_init(void)
143 ARRAY_SIZE(davinci_sffsdr_devices)); 141 ARRAY_SIZE(davinci_sffsdr_devices));
144 sffsdr_init_i2c(); 142 sffsdr_init_i2c();
145 davinci_serial_init(&uart_config); 143 davinci_serial_init(&uart_config);
146 soc_info->emac_pdata->phy_mask = SFFSDR_PHY_MASK; 144 soc_info->emac_pdata->phy_id = SFFSDR_PHY_ID;
147 soc_info->emac_pdata->mdio_max_freq = SFFSDR_MDIO_FREQUENCY;
148 davinci_setup_usb(0, 0); /* We support only peripheral mode. */ 145 davinci_setup_usb(0, 0); /* We support only peripheral mode. */
149 146
150 /* mux VLYNQ pins */ 147 /* mux VLYNQ pins */
@@ -154,8 +151,6 @@ static __init void davinci_sffsdr_init(void)
154 151
155MACHINE_START(SFFSDR, "Lyrtech SFFSDR") 152MACHINE_START(SFFSDR, "Lyrtech SFFSDR")
156 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */ 153 /* Maintainer: Hugo Villeneuve hugo.villeneuve@lyrtech.com */
157 .phys_io = IO_PHYS,
158 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc,
159 .boot_params = (DAVINCI_DDR_BASE + 0x100), 154 .boot_params = (DAVINCI_DDR_BASE + 0x100),
160 .map_io = davinci_sffsdr_map_io, 155 .map_io = davinci_sffsdr_map_io,
161 .init_irq = davinci_irq_init, 156 .init_irq = davinci_irq_init,
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index fe2a9d9c8bb7..1a656e882262 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -23,6 +23,10 @@
23#include <linux/ratelimit.h> 23#include <linux/ratelimit.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/input.h>
27#include <linux/input/matrix_keypad.h>
28#include <linux/spi/spi.h>
29
26#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
27#include <asm/mach-types.h> 31#include <asm/mach-types.h>
28 32
@@ -34,6 +38,7 @@
34 38
35#define EVM_MMC_WP_GPIO 21 39#define EVM_MMC_WP_GPIO 21
36#define EVM_MMC_CD_GPIO 24 40#define EVM_MMC_CD_GPIO 24
41#define EVM_SPI_CS_GPIO 54
37 42
38static int initialize_gpio(int gpio, char *desc) 43static int initialize_gpio(int gpio, char *desc)
39{ 44{
@@ -96,6 +101,12 @@ static const short uart1_pins[] __initdata = {
96 -1 101 -1
97}; 102};
98 103
104static const short ssp_pins[] __initdata = {
105 TNETV107X_SSP0_0, TNETV107X_SSP0_1, TNETV107X_SSP0_2,
106 TNETV107X_SSP1_0, TNETV107X_SSP1_1, TNETV107X_SSP1_2,
107 TNETV107X_SSP1_3, -1
108};
109
99static struct mtd_partition nand_partitions[] = { 110static struct mtd_partition nand_partitions[] = {
100 /* bootloader (U-Boot, etc) in first 12 sectors */ 111 /* bootloader (U-Boot, etc) in first 12 sectors */
101 { 112 {
@@ -141,18 +152,120 @@ static struct davinci_uart_config serial_config __initconst = {
141 .enabled_uarts = BIT(1), 152 .enabled_uarts = BIT(1),
142}; 153};
143 154
155static const uint32_t keymap[] = {
156 KEY(0, 0, KEY_NUMERIC_1),
157 KEY(0, 1, KEY_NUMERIC_2),
158 KEY(0, 2, KEY_NUMERIC_3),
159 KEY(0, 3, KEY_FN_F1),
160 KEY(0, 4, KEY_MENU),
161
162 KEY(1, 0, KEY_NUMERIC_4),
163 KEY(1, 1, KEY_NUMERIC_5),
164 KEY(1, 2, KEY_NUMERIC_6),
165 KEY(1, 3, KEY_UP),
166 KEY(1, 4, KEY_FN_F2),
167
168 KEY(2, 0, KEY_NUMERIC_7),
169 KEY(2, 1, KEY_NUMERIC_8),
170 KEY(2, 2, KEY_NUMERIC_9),
171 KEY(2, 3, KEY_LEFT),
172 KEY(2, 4, KEY_ENTER),
173
174 KEY(3, 0, KEY_NUMERIC_STAR),
175 KEY(3, 1, KEY_NUMERIC_0),
176 KEY(3, 2, KEY_NUMERIC_POUND),
177 KEY(3, 3, KEY_DOWN),
178 KEY(3, 4, KEY_RIGHT),
179
180 KEY(4, 0, KEY_FN_F3),
181 KEY(4, 1, KEY_FN_F4),
182 KEY(4, 2, KEY_MUTE),
183 KEY(4, 3, KEY_HOME),
184 KEY(4, 4, KEY_BACK),
185
186 KEY(5, 0, KEY_VOLUMEDOWN),
187 KEY(5, 1, KEY_VOLUMEUP),
188 KEY(5, 2, KEY_F1),
189 KEY(5, 3, KEY_F2),
190 KEY(5, 4, KEY_F3),
191};
192
193static const struct matrix_keymap_data keymap_data = {
194 .keymap = keymap,
195 .keymap_size = ARRAY_SIZE(keymap),
196};
197
198static struct matrix_keypad_platform_data keypad_config = {
199 .keymap_data = &keymap_data,
200 .num_row_gpios = 6,
201 .num_col_gpios = 5,
202 .debounce_ms = 0, /* minimum */
203 .active_low = 0, /* pull up realization */
204 .no_autorepeat = 0,
205};
206
207static void spi_select_device(int cs)
208{
209 static int gpio;
210
211 if (!gpio) {
212 int ret;
213 ret = gpio_request(EVM_SPI_CS_GPIO, "spi chipsel");
214 if (ret < 0) {
215 pr_err("cannot open spi chipsel gpio\n");
216 gpio = -ENOSYS;
217 return;
218 } else {
219 gpio = EVM_SPI_CS_GPIO;
220 gpio_direction_output(gpio, 0);
221 }
222 }
223
224 if (gpio < 0)
225 return;
226
227 return gpio_set_value(gpio, cs ? 1 : 0);
228}
229
230static struct ti_ssp_spi_data spi_master_data = {
231 .num_cs = 2,
232 .select = spi_select_device,
233 .iosel = SSP_PIN_SEL(0, SSP_CLOCK) | SSP_PIN_SEL(1, SSP_DATA) |
234 SSP_PIN_SEL(2, SSP_CHIPSEL) | SSP_PIN_SEL(3, SSP_IN) |
235 SSP_INPUT_SEL(3),
236};
237
238static struct ti_ssp_data ssp_config = {
239 .out_clock = 250 * 1000,
240 .dev_data = {
241 [1] = {
242 .dev_name = "ti-ssp-spi",
243 .pdata = &spi_master_data,
244 .pdata_size = sizeof(spi_master_data),
245 },
246 },
247};
248
144static struct tnetv107x_device_info evm_device_info __initconst = { 249static struct tnetv107x_device_info evm_device_info __initconst = {
145 .serial_config = &serial_config, 250 .serial_config = &serial_config,
146 .mmc_config[1] = &mmc_config, /* controller 1 */ 251 .mmc_config[1] = &mmc_config, /* controller 1 */
147 .nand_config[0] = &nand_config, /* chip select 0 */ 252 .nand_config[0] = &nand_config, /* chip select 0 */
253 .keypad_config = &keypad_config,
254 .ssp_config = &ssp_config,
255};
256
257static struct spi_board_info spi_info[] __initconst = {
148}; 258};
149 259
150static __init void tnetv107x_evm_board_init(void) 260static __init void tnetv107x_evm_board_init(void)
151{ 261{
152 davinci_cfg_reg_list(sdio1_pins); 262 davinci_cfg_reg_list(sdio1_pins);
153 davinci_cfg_reg_list(uart1_pins); 263 davinci_cfg_reg_list(uart1_pins);
264 davinci_cfg_reg_list(ssp_pins);
154 265
155 tnetv107x_devices_init(&evm_device_info); 266 tnetv107x_devices_init(&evm_device_info);
267
268 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
156} 269}
157 270
158#ifdef CONFIG_SERIAL_8250_CONSOLE 271#ifdef CONFIG_SERIAL_8250_CONSOLE
@@ -164,8 +277,6 @@ console_initcall(tnetv107x_evm_console_init);
164#endif 277#endif
165 278
166MACHINE_START(TNETV107X, "TNETV107X EVM") 279MACHINE_START(TNETV107X, "TNETV107X EVM")
167 .phys_io = TNETV107X_IO_BASE,
168 .io_pg_offst = (TNETV107X_IO_VIRT >> 18) & 0xfffc,
169 .boot_params = (TNETV107X_DDR_BASE + 0x100), 280 .boot_params = (TNETV107X_DDR_BASE + 0x100),
170 .map_io = tnetv107x_init, 281 .map_io = tnetv107x_init,
171 .init_irq = cp_intc_init, 282 .init_irq = cp_intc_init,
diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
index 054c303caead..e4e3af179f02 100644
--- a/arch/arm/mach-davinci/clock.c
+++ b/arch/arm/mach-davinci/clock.c
@@ -236,7 +236,7 @@ static int __init clk_disable_unused(void)
236 if (!davinci_psc_is_clk_active(ck->gpsc, ck->lpsc)) 236 if (!davinci_psc_is_clk_active(ck->gpsc, ck->lpsc))
237 continue; 237 continue;
238 238
239 pr_info("Clocks: disable unused %s\n", ck->name); 239 pr_debug("Clocks: disable unused %s\n", ck->name);
240 240
241 davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc, 241 davinci_psc_config(psc_domain(ck), ck->gpsc, ck->lpsc,
242 (ck->flags & PSC_SWRSTDISABLE) ? 242 (ck->flags & PSC_SWRSTDISABLE) ?
@@ -287,6 +287,79 @@ static unsigned long clk_sysclk_recalc(struct clk *clk)
287 return rate; 287 return rate;
288} 288}
289 289
290int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate)
291{
292 unsigned v;
293 struct pll_data *pll;
294 unsigned long input;
295 unsigned ratio = 0;
296
297 /* If this is the PLL base clock, wrong function to call */
298 if (clk->pll_data)
299 return -EINVAL;
300
301 /* There must be a parent... */
302 if (WARN_ON(!clk->parent))
303 return -EINVAL;
304
305 /* ... the parent must be a PLL... */
306 if (WARN_ON(!clk->parent->pll_data))
307 return -EINVAL;
308
309 /* ... and this clock must have a divider. */
310 if (WARN_ON(!clk->div_reg))
311 return -EINVAL;
312
313 pll = clk->parent->pll_data;
314
315 input = clk->parent->rate;
316
317 /* If pre-PLL, source clock is before the multiplier and divider(s) */
318 if (clk->flags & PRE_PLL)
319 input = pll->input_rate;
320
321 if (input > rate) {
322 /*
323 * Can afford to provide an output little higher than requested
324 * only if maximum rate supported by hardware on this sysclk
325 * is known.
326 */
327 if (clk->maxrate) {
328 ratio = DIV_ROUND_CLOSEST(input, rate);
329 if (input / ratio > clk->maxrate)
330 ratio = 0;
331 }
332
333 if (ratio == 0)
334 ratio = DIV_ROUND_UP(input, rate);
335
336 ratio--;
337 }
338
339 if (ratio > pll->div_ratio_mask)
340 return -EINVAL;
341
342 do {
343 v = __raw_readl(pll->base + PLLSTAT);
344 } while (v & PLLSTAT_GOSTAT);
345
346 v = __raw_readl(pll->base + clk->div_reg);
347 v &= ~pll->div_ratio_mask;
348 v |= ratio | PLLDIV_EN;
349 __raw_writel(v, pll->base + clk->div_reg);
350
351 v = __raw_readl(pll->base + PLLCMD);
352 v |= PLLCMD_GOSET;
353 __raw_writel(v, pll->base + PLLCMD);
354
355 do {
356 v = __raw_readl(pll->base + PLLSTAT);
357 } while (v & PLLSTAT_GOSTAT);
358
359 return 0;
360}
361EXPORT_SYMBOL(davinci_set_sysclk_rate);
362
290static unsigned long clk_leafclk_recalc(struct clk *clk) 363static unsigned long clk_leafclk_recalc(struct clk *clk)
291{ 364{
292 if (WARN_ON(!clk->parent)) 365 if (WARN_ON(!clk->parent))
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index 01e36483ac3d..0dd22031ec62 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -68,7 +68,10 @@
68#ifndef __ASSEMBLER__ 68#ifndef __ASSEMBLER__
69 69
70#include <linux/list.h> 70#include <linux/list.h>
71#include <asm/clkdev.h> 71#include <linux/clkdev.h>
72
73#define PLLSTAT_GOSTAT BIT(0)
74#define PLLCMD_GOSET BIT(0)
72 75
73struct pll_data { 76struct pll_data {
74 u32 phys_base; 77 u32 phys_base;
@@ -86,6 +89,7 @@ struct clk {
86 struct module *owner; 89 struct module *owner;
87 const char *name; 90 const char *name;
88 unsigned long rate; 91 unsigned long rate;
92 unsigned long maxrate; /* H/W supported max rate */
89 u8 usecount; 93 u8 usecount;
90 u8 lpsc; 94 u8 lpsc;
91 u8 gpsc; 95 u8 gpsc;
@@ -118,6 +122,7 @@ struct clk {
118int davinci_clk_init(struct clk_lookup *clocks); 122int davinci_clk_init(struct clk_lookup *clocks);
119int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv, 123int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
120 unsigned int mult, unsigned int postdiv); 124 unsigned int mult, unsigned int postdiv);
125int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate);
121 126
122extern struct platform_device davinci_wdt_device; 127extern struct platform_device davinci_wdt_device;
123extern void davinci_watchdog_reset(struct platform_device *); 128extern void davinci_watchdog_reset(struct platform_device *);
diff --git a/arch/arm/mach-davinci/cp_intc.c b/arch/arm/mach-davinci/cp_intc.c
index bb4c40ecb803..f83152d643c5 100644
--- a/arch/arm/mach-davinci/cp_intc.c
+++ b/arch/arm/mach-davinci/cp_intc.c
@@ -26,30 +26,30 @@ static inline void cp_intc_write(unsigned long value, unsigned offset)
26 __raw_writel(value, davinci_intc_base + offset); 26 __raw_writel(value, davinci_intc_base + offset);
27} 27}
28 28
29static void cp_intc_ack_irq(unsigned int irq) 29static void cp_intc_ack_irq(struct irq_data *d)
30{ 30{
31 cp_intc_write(irq, CP_INTC_SYS_STAT_IDX_CLR); 31 cp_intc_write(d->irq, CP_INTC_SYS_STAT_IDX_CLR);
32} 32}
33 33
34/* Disable interrupt */ 34/* Disable interrupt */
35static void cp_intc_mask_irq(unsigned int irq) 35static void cp_intc_mask_irq(struct irq_data *d)
36{ 36{
37 /* XXX don't know why we need to disable nIRQ here... */ 37 /* XXX don't know why we need to disable nIRQ here... */
38 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_CLR); 38 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_CLR);
39 cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_CLR); 39 cp_intc_write(d->irq, CP_INTC_SYS_ENABLE_IDX_CLR);
40 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_SET); 40 cp_intc_write(1, CP_INTC_HOST_ENABLE_IDX_SET);
41} 41}
42 42
43/* Enable interrupt */ 43/* Enable interrupt */
44static void cp_intc_unmask_irq(unsigned int irq) 44static void cp_intc_unmask_irq(struct irq_data *d)
45{ 45{
46 cp_intc_write(irq, CP_INTC_SYS_ENABLE_IDX_SET); 46 cp_intc_write(d->irq, CP_INTC_SYS_ENABLE_IDX_SET);
47} 47}
48 48
49static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type) 49static int cp_intc_set_irq_type(struct irq_data *d, unsigned int flow_type)
50{ 50{
51 unsigned reg = BIT_WORD(irq); 51 unsigned reg = BIT_WORD(d->irq);
52 unsigned mask = BIT_MASK(irq); 52 unsigned mask = BIT_MASK(d->irq);
53 unsigned polarity = cp_intc_read(CP_INTC_SYS_POLARITY(reg)); 53 unsigned polarity = cp_intc_read(CP_INTC_SYS_POLARITY(reg));
54 unsigned type = cp_intc_read(CP_INTC_SYS_TYPE(reg)); 54 unsigned type = cp_intc_read(CP_INTC_SYS_TYPE(reg));
55 55
@@ -85,18 +85,18 @@ static int cp_intc_set_irq_type(unsigned int irq, unsigned int flow_type)
85 * generic drivers which call {enable|disable}_irq_wake for 85 * generic drivers which call {enable|disable}_irq_wake for
86 * wake up interrupt sources (eg RTC on DA850). 86 * wake up interrupt sources (eg RTC on DA850).
87 */ 87 */
88static int cp_intc_set_wake(unsigned int irq, unsigned int on) 88static int cp_intc_set_wake(struct irq_data *d, unsigned int on)
89{ 89{
90 return 0; 90 return 0;
91} 91}
92 92
93static struct irq_chip cp_intc_irq_chip = { 93static struct irq_chip cp_intc_irq_chip = {
94 .name = "cp_intc", 94 .name = "cp_intc",
95 .ack = cp_intc_ack_irq, 95 .irq_ack = cp_intc_ack_irq,
96 .mask = cp_intc_mask_irq, 96 .irq_mask = cp_intc_mask_irq,
97 .unmask = cp_intc_unmask_irq, 97 .irq_unmask = cp_intc_unmask_irq,
98 .set_type = cp_intc_set_irq_type, 98 .irq_set_type = cp_intc_set_irq_type,
99 .set_wake = cp_intc_set_wake, 99 .irq_set_wake = cp_intc_set_wake,
100}; 100};
101 101
102void __init cp_intc_init(void) 102void __init cp_intc_init(void)
@@ -167,9 +167,9 @@ void __init cp_intc_init(void)
167 167
168 /* Set up genirq dispatching for cp_intc */ 168 /* Set up genirq dispatching for cp_intc */
169 for (i = 0; i < num_irq; i++) { 169 for (i = 0; i < num_irq; i++) {
170 set_irq_chip(i, &cp_intc_irq_chip); 170 irq_set_chip(i, &cp_intc_irq_chip);
171 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 171 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
172 set_irq_handler(i, handle_edge_irq); 172 irq_set_handler(i, handle_edge_irq);
173 } 173 }
174 174
175 /* Enable global interrupt */ 175 /* Enable global interrupt */
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c
index d3fa6de1e20f..41669ecc1f91 100644
--- a/arch/arm/mach-davinci/cpufreq.c
+++ b/arch/arm/mach-davinci/cpufreq.c
@@ -34,6 +34,8 @@
34struct davinci_cpufreq { 34struct davinci_cpufreq {
35 struct device *dev; 35 struct device *dev;
36 struct clk *armclk; 36 struct clk *armclk;
37 struct clk *asyncclk;
38 unsigned long asyncrate;
37}; 39};
38static struct davinci_cpufreq cpufreq; 40static struct davinci_cpufreq cpufreq;
39 41
@@ -92,9 +94,7 @@ static int davinci_target(struct cpufreq_policy *policy,
92 if (freqs.old == freqs.new) 94 if (freqs.old == freqs.new)
93 return ret; 95 return ret;
94 96
95 cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, 97 dev_dbg(&cpufreq.dev, "transition: %u --> %u\n", freqs.old, freqs.new);
96 dev_driver_string(cpufreq.dev),
97 "transition: %u --> %u\n", freqs.old, freqs.new);
98 98
99 ret = cpufreq_frequency_table_target(policy, pdata->freq_table, 99 ret = cpufreq_frequency_table_target(policy, pdata->freq_table,
100 freqs.new, relation, &idx); 100 freqs.new, relation, &idx);
@@ -104,21 +104,33 @@ static int davinci_target(struct cpufreq_policy *policy,
104 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 104 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
105 105
106 /* if moving to higher frequency, up the voltage beforehand */ 106 /* if moving to higher frequency, up the voltage beforehand */
107 if (pdata->set_voltage && freqs.new > freqs.old) 107 if (pdata->set_voltage && freqs.new > freqs.old) {
108 pdata->set_voltage(idx); 108 ret = pdata->set_voltage(idx);
109 if (ret)
110 goto out;
111 }
109 112
110 ret = clk_set_rate(armclk, idx); 113 ret = clk_set_rate(armclk, idx);
114 if (ret)
115 goto out;
116
117 if (cpufreq.asyncclk) {
118 ret = clk_set_rate(cpufreq.asyncclk, cpufreq.asyncrate);
119 if (ret)
120 goto out;
121 }
111 122
112 /* if moving to lower freq, lower the voltage after lowering freq */ 123 /* if moving to lower freq, lower the voltage after lowering freq */
113 if (pdata->set_voltage && freqs.new < freqs.old) 124 if (pdata->set_voltage && freqs.new < freqs.old)
114 pdata->set_voltage(idx); 125 pdata->set_voltage(idx);
115 126
127out:
116 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 128 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
117 129
118 return ret; 130 return ret;
119} 131}
120 132
121static int __init davinci_cpu_init(struct cpufreq_policy *policy) 133static int davinci_cpu_init(struct cpufreq_policy *policy)
122{ 134{
123 int result = 0; 135 int result = 0;
124 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; 136 struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data;
@@ -153,7 +165,7 @@ static int __init davinci_cpu_init(struct cpufreq_policy *policy)
153 /* 165 /*
154 * Time measurement across the target() function yields ~1500-1800us 166 * Time measurement across the target() function yields ~1500-1800us
155 * time taken with no drivers on notification list. 167 * time taken with no drivers on notification list.
156 * Setting the latency to 2000 us to accomodate addition of drivers 168 * Setting the latency to 2000 us to accommodate addition of drivers
157 * to pre/post change notification list. 169 * to pre/post change notification list.
158 */ 170 */
159 policy->cpuinfo.transition_latency = 2000 * 1000; 171 policy->cpuinfo.transition_latency = 2000 * 1000;
@@ -185,6 +197,7 @@ static struct cpufreq_driver davinci_driver = {
185static int __init davinci_cpufreq_probe(struct platform_device *pdev) 197static int __init davinci_cpufreq_probe(struct platform_device *pdev)
186{ 198{
187 struct davinci_cpufreq_config *pdata = pdev->dev.platform_data; 199 struct davinci_cpufreq_config *pdata = pdev->dev.platform_data;
200 struct clk *asyncclk;
188 201
189 if (!pdata) 202 if (!pdata)
190 return -EINVAL; 203 return -EINVAL;
@@ -199,6 +212,12 @@ static int __init davinci_cpufreq_probe(struct platform_device *pdev)
199 return PTR_ERR(cpufreq.armclk); 212 return PTR_ERR(cpufreq.armclk);
200 } 213 }
201 214
215 asyncclk = clk_get(cpufreq.dev, "async");
216 if (!IS_ERR(asyncclk)) {
217 cpufreq.asyncclk = asyncclk;
218 cpufreq.asyncrate = clk_get_rate(asyncclk);
219 }
220
202 return cpufreq_register_driver(&davinci_driver); 221 return cpufreq_register_driver(&davinci_driver);
203} 222}
204 223
@@ -206,6 +225,9 @@ static int __exit davinci_cpufreq_remove(struct platform_device *pdev)
206{ 225{
207 clk_put(cpufreq.armclk); 226 clk_put(cpufreq.armclk);
208 227
228 if (cpufreq.asyncclk)
229 clk_put(cpufreq.asyncclk);
230
209 return cpufreq_unregister_driver(&davinci_driver); 231 return cpufreq_unregister_driver(&davinci_driver);
210} 232}
211 233
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index ec23ab473620..2ed2f822fc40 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -148,7 +148,7 @@ static struct clk scr2_ss_clk = {
148static struct clk dmax_clk = { 148static struct clk dmax_clk = {
149 .name = "dmax", 149 .name = "dmax",
150 .parent = &pll0_sysclk2, 150 .parent = &pll0_sysclk2,
151 .lpsc = DA8XX_LPSC0_DMAX, 151 .lpsc = DA8XX_LPSC0_PRUSS,
152 .flags = ALWAYS_ENABLED, 152 .flags = ALWAYS_ENABLED,
153}; 153};
154 154
@@ -397,8 +397,8 @@ static struct clk_lookup da830_clks[] = {
397 CLK(NULL, "uart0", &uart0_clk), 397 CLK(NULL, "uart0", &uart0_clk),
398 CLK(NULL, "uart1", &uart1_clk), 398 CLK(NULL, "uart1", &uart1_clk),
399 CLK(NULL, "uart2", &uart2_clk), 399 CLK(NULL, "uart2", &uart2_clk),
400 CLK("dm_spi.0", NULL, &spi0_clk), 400 CLK("spi_davinci.0", NULL, &spi0_clk),
401 CLK("dm_spi.1", NULL, &spi1_clk), 401 CLK("spi_davinci.1", NULL, &spi1_clk),
402 CLK(NULL, "ecap0", &ecap0_clk), 402 CLK(NULL, "ecap0", &ecap0_clk),
403 CLK(NULL, "ecap1", &ecap1_clk), 403 CLK(NULL, "ecap1", &ecap1_clk),
404 CLK(NULL, "ecap2", &ecap2_clk), 404 CLK(NULL, "ecap2", &ecap2_clk),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 68ed58a48252..133aac405853 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -86,6 +86,8 @@ static struct clk pll0_sysclk3 = {
86 .parent = &pll0_clk, 86 .parent = &pll0_clk,
87 .flags = CLK_PLL, 87 .flags = CLK_PLL,
88 .div_reg = PLLDIV3, 88 .div_reg = PLLDIV3,
89 .set_rate = davinci_set_sysclk_rate,
90 .maxrate = 100000000,
89}; 91};
90 92
91static struct clk pll0_sysclk4 = { 93static struct clk pll0_sysclk4 = {
@@ -323,12 +325,19 @@ static struct clk lcdc_clk = {
323 .gpsc = 1, 325 .gpsc = 1,
324}; 326};
325 327
326static struct clk mmcsd_clk = { 328static struct clk mmcsd0_clk = {
327 .name = "mmcsd", 329 .name = "mmcsd0",
328 .parent = &pll0_sysclk2, 330 .parent = &pll0_sysclk2,
329 .lpsc = DA8XX_LPSC0_MMC_SD, 331 .lpsc = DA8XX_LPSC0_MMC_SD,
330}; 332};
331 333
334static struct clk mmcsd1_clk = {
335 .name = "mmcsd1",
336 .parent = &pll0_sysclk2,
337 .lpsc = DA850_LPSC1_MMC_SD1,
338 .gpsc = 1,
339};
340
332static struct clk aemif_clk = { 341static struct clk aemif_clk = {
333 .name = "aemif", 342 .name = "aemif",
334 .parent = &pll0_sysclk3, 343 .parent = &pll0_sysclk3,
@@ -336,6 +345,34 @@ static struct clk aemif_clk = {
336 .flags = ALWAYS_ENABLED, 345 .flags = ALWAYS_ENABLED,
337}; 346};
338 347
348static struct clk usb11_clk = {
349 .name = "usb11",
350 .parent = &pll0_sysclk4,
351 .lpsc = DA8XX_LPSC1_USB11,
352 .gpsc = 1,
353};
354
355static struct clk usb20_clk = {
356 .name = "usb20",
357 .parent = &pll0_sysclk2,
358 .lpsc = DA8XX_LPSC1_USB20,
359 .gpsc = 1,
360};
361
362static struct clk spi0_clk = {
363 .name = "spi0",
364 .parent = &pll0_sysclk2,
365 .lpsc = DA8XX_LPSC0_SPI0,
366};
367
368static struct clk spi1_clk = {
369 .name = "spi1",
370 .parent = &pll0_sysclk2,
371 .lpsc = DA8XX_LPSC1_SPI1,
372 .gpsc = 1,
373 .flags = DA850_CLK_ASYNC3,
374};
375
339static struct clk_lookup da850_clks[] = { 376static struct clk_lookup da850_clks[] = {
340 CLK(NULL, "ref", &ref_clk), 377 CLK(NULL, "ref", &ref_clk),
341 CLK(NULL, "pll0", &pll0_clk), 378 CLK(NULL, "pll0", &pll0_clk),
@@ -375,8 +412,13 @@ static struct clk_lookup da850_clks[] = {
375 CLK("davinci_emac.1", NULL, &emac_clk), 412 CLK("davinci_emac.1", NULL, &emac_clk),
376 CLK("davinci-mcasp.0", NULL, &mcasp_clk), 413 CLK("davinci-mcasp.0", NULL, &mcasp_clk),
377 CLK("da8xx_lcdc.0", NULL, &lcdc_clk), 414 CLK("da8xx_lcdc.0", NULL, &lcdc_clk),
378 CLK("davinci_mmc.0", NULL, &mmcsd_clk), 415 CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
416 CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
379 CLK(NULL, "aemif", &aemif_clk), 417 CLK(NULL, "aemif", &aemif_clk),
418 CLK(NULL, "usb11", &usb11_clk),
419 CLK(NULL, "usb20", &usb20_clk),
420 CLK("spi_davinci.0", NULL, &spi0_clk),
421 CLK("spi_davinci.1", NULL, &spi1_clk),
380 CLK(NULL, NULL, NULL), 422 CLK(NULL, NULL, NULL),
381}; 423};
382 424
@@ -533,30 +575,19 @@ static const struct mux_config da850_pins[] = {
533 MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false) 575 MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false)
534 MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false) 576 MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false)
535 /* GPIO function */ 577 /* GPIO function */
578 MUX_CFG(DA850, GPIO2_4, 6, 12, 15, 8, false)
536 MUX_CFG(DA850, GPIO2_6, 6, 4, 15, 8, false) 579 MUX_CFG(DA850, GPIO2_6, 6, 4, 15, 8, false)
537 MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false) 580 MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false)
538 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) 581 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false)
582 MUX_CFG(DA850, GPIO3_12, 7, 12, 15, 8, false)
583 MUX_CFG(DA850, GPIO3_13, 7, 8, 15, 8, false)
539 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false) 584 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false)
540 MUX_CFG(DA850, GPIO4_1, 10, 24, 15, 8, false) 585 MUX_CFG(DA850, GPIO4_1, 10, 24, 15, 8, false)
586 MUX_CFG(DA850, GPIO6_13, 13, 8, 15, 8, false)
541 MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false) 587 MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false)
542#endif 588#endif
543}; 589};
544 590
545const short da850_uart0_pins[] __initdata = {
546 DA850_NUART0_CTS, DA850_NUART0_RTS, DA850_UART0_RXD, DA850_UART0_TXD,
547 -1
548};
549
550const short da850_uart1_pins[] __initdata = {
551 DA850_UART1_RXD, DA850_UART1_TXD,
552 -1
553};
554
555const short da850_uart2_pins[] __initdata = {
556 DA850_UART2_RXD, DA850_UART2_TXD,
557 -1
558};
559
560const short da850_i2c0_pins[] __initdata = { 591const short da850_i2c0_pins[] __initdata = {
561 DA850_I2C0_SDA, DA850_I2C0_SCL, 592 DA850_I2C0_SDA, DA850_I2C0_SCL,
562 -1 593 -1
@@ -567,30 +598,6 @@ const short da850_i2c1_pins[] __initdata = {
567 -1 598 -1
568}; 599};
569 600
570const short da850_cpgmac_pins[] __initdata = {
571 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
572 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
573 DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
574 DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
575 DA850_MDIO_D,
576 -1
577};
578
579const short da850_rmii_pins[] __initdata = {
580 DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
581 DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
582 DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
583 DA850_MDIO_D,
584 -1
585};
586
587const short da850_mcasp_pins[] __initdata = {
588 DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
589 DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
590 DA850_AXR_11, DA850_AXR_12,
591 -1
592};
593
594const short da850_lcdcntl_pins[] __initdata = { 601const short da850_lcdcntl_pins[] __initdata = {
595 DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3, 602 DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3,
596 DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7, 603 DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7,
@@ -600,37 +607,6 @@ const short da850_lcdcntl_pins[] __initdata = {
600 -1 607 -1
601}; 608};
602 609
603const short da850_mmcsd0_pins[] __initdata = {
604 DA850_MMCSD0_DAT_0, DA850_MMCSD0_DAT_1, DA850_MMCSD0_DAT_2,
605 DA850_MMCSD0_DAT_3, DA850_MMCSD0_CLK, DA850_MMCSD0_CMD,
606 DA850_GPIO4_0, DA850_GPIO4_1,
607 -1
608};
609
610const short da850_nand_pins[] __initdata = {
611 DA850_EMA_D_7, DA850_EMA_D_6, DA850_EMA_D_5, DA850_EMA_D_4,
612 DA850_EMA_D_3, DA850_EMA_D_2, DA850_EMA_D_1, DA850_EMA_D_0,
613 DA850_EMA_A_1, DA850_EMA_A_2, DA850_NEMA_CS_3, DA850_NEMA_CS_4,
614 DA850_NEMA_WE, DA850_NEMA_OE,
615 -1
616};
617
618const short da850_nor_pins[] __initdata = {
619 DA850_EMA_BA_1, DA850_EMA_CLK, DA850_EMA_WAIT_1, DA850_NEMA_CS_2,
620 DA850_NEMA_WE, DA850_NEMA_OE, DA850_EMA_D_0, DA850_EMA_D_1,
621 DA850_EMA_D_2, DA850_EMA_D_3, DA850_EMA_D_4, DA850_EMA_D_5,
622 DA850_EMA_D_6, DA850_EMA_D_7, DA850_EMA_D_8, DA850_EMA_D_9,
623 DA850_EMA_D_10, DA850_EMA_D_11, DA850_EMA_D_12, DA850_EMA_D_13,
624 DA850_EMA_D_14, DA850_EMA_D_15, DA850_EMA_A_0, DA850_EMA_A_1,
625 DA850_EMA_A_2, DA850_EMA_A_3, DA850_EMA_A_4, DA850_EMA_A_5,
626 DA850_EMA_A_6, DA850_EMA_A_7, DA850_EMA_A_8, DA850_EMA_A_9,
627 DA850_EMA_A_10, DA850_EMA_A_11, DA850_EMA_A_12, DA850_EMA_A_13,
628 DA850_EMA_A_14, DA850_EMA_A_15, DA850_EMA_A_16, DA850_EMA_A_17,
629 DA850_EMA_A_18, DA850_EMA_A_19, DA850_EMA_A_20, DA850_EMA_A_21,
630 DA850_EMA_A_22, DA850_EMA_A_23,
631 -1
632};
633
634/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */ 610/* FIQ are pri 0-1; otherwise 2-7, with 7 lowest priority */
635static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = { 611static u8 da850_default_priorities[DA850_N_CP_INTC_IRQ] = {
636 [IRQ_DA8XX_COMMTX] = 7, 612 [IRQ_DA8XX_COMMTX] = 7,
@@ -768,6 +744,13 @@ static struct davinci_id da850_ids[] = {
768 .cpu_id = DAVINCI_CPU_ID_DA850, 744 .cpu_id = DAVINCI_CPU_ID_DA850,
769 .name = "da850/omap-l138", 745 .name = "da850/omap-l138",
770 }, 746 },
747 {
748 .variant = 0x1,
749 .part_no = 0xb7d1,
750 .manufacturer = 0x017, /* 0x02f >> 1 */
751 .cpu_id = DAVINCI_CPU_ID_DA850,
752 .name = "da850/omap-l138/am18x",
753 },
771}; 754};
772 755
773static struct davinci_timer_instance da850_timer_instance[4] = { 756static struct davinci_timer_instance da850_timer_instance[4] = {
@@ -834,8 +817,7 @@ static void da850_set_async3_src(int pllnum)
834 * According to the TRM, minimum PLLM results in maximum power savings. 817 * According to the TRM, minimum PLLM results in maximum power savings.
835 * The OPP definitions below should keep the PLLM as low as possible. 818 * The OPP definitions below should keep the PLLM as low as possible.
836 * 819 *
837 * The output of the PLLM must be between 400 to 600 MHz. 820 * The output of the PLLM must be between 300 to 600 MHz.
838 * This rules out prediv of anything but divide-by-one for 24Mhz OSC input.
839 */ 821 */
840struct da850_opp { 822struct da850_opp {
841 unsigned int freq; /* in KHz */ 823 unsigned int freq; /* in KHz */
@@ -846,12 +828,39 @@ struct da850_opp {
846 unsigned int cvdd_max; /* in uV */ 828 unsigned int cvdd_max; /* in uV */
847}; 829};
848 830
831static const struct da850_opp da850_opp_456 = {
832 .freq = 456000,
833 .prediv = 1,
834 .mult = 19,
835 .postdiv = 1,
836 .cvdd_min = 1300000,
837 .cvdd_max = 1350000,
838};
839
840static const struct da850_opp da850_opp_408 = {
841 .freq = 408000,
842 .prediv = 1,
843 .mult = 17,
844 .postdiv = 1,
845 .cvdd_min = 1300000,
846 .cvdd_max = 1350000,
847};
848
849static const struct da850_opp da850_opp_372 = {
850 .freq = 372000,
851 .prediv = 2,
852 .mult = 31,
853 .postdiv = 1,
854 .cvdd_min = 1200000,
855 .cvdd_max = 1320000,
856};
857
849static const struct da850_opp da850_opp_300 = { 858static const struct da850_opp da850_opp_300 = {
850 .freq = 300000, 859 .freq = 300000,
851 .prediv = 1, 860 .prediv = 1,
852 .mult = 25, 861 .mult = 25,
853 .postdiv = 2, 862 .postdiv = 2,
854 .cvdd_min = 1140000, 863 .cvdd_min = 1200000,
855 .cvdd_max = 1320000, 864 .cvdd_max = 1320000,
856}; 865};
857 866
@@ -860,7 +869,7 @@ static const struct da850_opp da850_opp_200 = {
860 .prediv = 1, 869 .prediv = 1,
861 .mult = 25, 870 .mult = 25,
862 .postdiv = 3, 871 .postdiv = 3,
863 .cvdd_min = 1050000, 872 .cvdd_min = 1100000,
864 .cvdd_max = 1160000, 873 .cvdd_max = 1160000,
865}; 874};
866 875
@@ -869,7 +878,7 @@ static const struct da850_opp da850_opp_96 = {
869 .prediv = 1, 878 .prediv = 1,
870 .mult = 20, 879 .mult = 20,
871 .postdiv = 5, 880 .postdiv = 5,
872 .cvdd_min = 950000, 881 .cvdd_min = 1000000,
873 .cvdd_max = 1050000, 882 .cvdd_max = 1050000,
874}; 883};
875 884
@@ -880,6 +889,9 @@ static const struct da850_opp da850_opp_96 = {
880 } 889 }
881 890
882static struct cpufreq_frequency_table da850_freq_table[] = { 891static struct cpufreq_frequency_table da850_freq_table[] = {
892 OPP(456),
893 OPP(408),
894 OPP(372),
883 OPP(300), 895 OPP(300),
884 OPP(200), 896 OPP(200),
885 OPP(96), 897 OPP(96),
@@ -890,6 +902,19 @@ static struct cpufreq_frequency_table da850_freq_table[] = {
890}; 902};
891 903
892#ifdef CONFIG_REGULATOR 904#ifdef CONFIG_REGULATOR
905static int da850_set_voltage(unsigned int index);
906static int da850_regulator_init(void);
907#endif
908
909static struct davinci_cpufreq_config cpufreq_info = {
910 .freq_table = da850_freq_table,
911#ifdef CONFIG_REGULATOR
912 .init = da850_regulator_init,
913 .set_voltage = da850_set_voltage,
914#endif
915};
916
917#ifdef CONFIG_REGULATOR
893static struct regulator *cvdd; 918static struct regulator *cvdd;
894 919
895static int da850_set_voltage(unsigned int index) 920static int da850_set_voltage(unsigned int index)
@@ -899,7 +924,7 @@ static int da850_set_voltage(unsigned int index)
899 if (!cvdd) 924 if (!cvdd)
900 return -ENODEV; 925 return -ENODEV;
901 926
902 opp = (struct da850_opp *) da850_freq_table[index].index; 927 opp = (struct da850_opp *) cpufreq_info.freq_table[index].index;
903 928
904 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max); 929 return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
905} 930}
@@ -916,23 +941,31 @@ static int da850_regulator_init(void)
916} 941}
917#endif 942#endif
918 943
919static struct davinci_cpufreq_config cpufreq_info = {
920 .freq_table = &da850_freq_table[0],
921#ifdef CONFIG_REGULATOR
922 .init = da850_regulator_init,
923 .set_voltage = da850_set_voltage,
924#endif
925};
926
927static struct platform_device da850_cpufreq_device = { 944static struct platform_device da850_cpufreq_device = {
928 .name = "cpufreq-davinci", 945 .name = "cpufreq-davinci",
929 .dev = { 946 .dev = {
930 .platform_data = &cpufreq_info, 947 .platform_data = &cpufreq_info,
931 }, 948 },
949 .id = -1,
932}; 950};
933 951
934int __init da850_register_cpufreq(void) 952unsigned int da850_max_speed = 300000;
953
954int __init da850_register_cpufreq(char *async_clk)
935{ 955{
956 int i;
957
958 /* cpufreq driver can help keep an "async" clock constant */
959 if (async_clk)
960 clk_add_alias("async", da850_cpufreq_device.name,
961 async_clk, NULL);
962 for (i = 0; i < ARRAY_SIZE(da850_freq_table); i++) {
963 if (da850_freq_table[i].frequency <= da850_max_speed) {
964 cpufreq_info.freq_table = &da850_freq_table[i];
965 break;
966 }
967 }
968
936 return platform_device_register(&da850_cpufreq_device); 969 return platform_device_register(&da850_cpufreq_device);
937} 970}
938 971
@@ -940,17 +973,18 @@ static int da850_round_armrate(struct clk *clk, unsigned long rate)
940{ 973{
941 int i, ret = 0, diff; 974 int i, ret = 0, diff;
942 unsigned int best = (unsigned int) -1; 975 unsigned int best = (unsigned int) -1;
976 struct cpufreq_frequency_table *table = cpufreq_info.freq_table;
943 977
944 rate /= 1000; /* convert to kHz */ 978 rate /= 1000; /* convert to kHz */
945 979
946 for (i = 0; da850_freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { 980 for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) {
947 diff = da850_freq_table[i].frequency - rate; 981 diff = table[i].frequency - rate;
948 if (diff < 0) 982 if (diff < 0)
949 diff = -diff; 983 diff = -diff;
950 984
951 if (diff < best) { 985 if (diff < best) {
952 best = diff; 986 best = diff;
953 ret = da850_freq_table[i].frequency; 987 ret = table[i].frequency;
954 } 988 }
955 } 989 }
956 990
@@ -971,7 +1005,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index)
971 struct pll_data *pll = clk->pll_data; 1005 struct pll_data *pll = clk->pll_data;
972 int ret; 1006 int ret;
973 1007
974 opp = (struct da850_opp *) da850_freq_table[index].index; 1008 opp = (struct da850_opp *) cpufreq_info.freq_table[index].index;
975 prediv = opp->prediv; 1009 prediv = opp->prediv;
976 mult = opp->mult; 1010 mult = opp->mult;
977 postdiv = opp->postdiv; 1011 postdiv = opp->postdiv;
@@ -983,7 +1017,7 @@ static int da850_set_pll0rate(struct clk *clk, unsigned long index)
983 return 0; 1017 return 0;
984} 1018}
985#else 1019#else
986int __init da850_register_cpufreq(void) 1020int __init da850_register_cpufreq(char *async_clk)
987{ 1021{
988 return 0; 1022 return 0;
989} 1023}
@@ -1021,7 +1055,7 @@ int da850_register_pm(struct platform_device *pdev)
1021 if (!pdata->cpupll_reg_base) 1055 if (!pdata->cpupll_reg_base)
1022 return -ENOMEM; 1056 return -ENOMEM;
1023 1057
1024 pdata->ddrpll_reg_base = ioremap(DA8XX_PLL1_BASE, SZ_4K); 1058 pdata->ddrpll_reg_base = ioremap(DA850_PLL1_BASE, SZ_4K);
1025 if (!pdata->ddrpll_reg_base) { 1059 if (!pdata->ddrpll_reg_base) {
1026 ret = -ENOMEM; 1060 ret = -ENOMEM;
1027 goto no_ddrpll_mem; 1061 goto no_ddrpll_mem;
@@ -1089,7 +1123,7 @@ void __init da850_init(void)
1089 * This helps keeping the peripherals on this domain insulated 1123 * This helps keeping the peripherals on this domain insulated
1090 * from CPU frequency changes caused by DVFS. The firmware sets 1124 * from CPU frequency changes caused by DVFS. The firmware sets
1091 * both PLL0 and PLL1 to the same frequency so, there should not 1125 * both PLL0 and PLL1 to the same frequency so, there should not
1092 * be any noticible change even in non-DVFS use cases. 1126 * be any noticeable change even in non-DVFS use cases.
1093 */ 1127 */
1094 da850_set_async3_src(1); 1128 da850_set_async3_src(1);
1095 1129
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 52bc7b1c6ca3..fc4e98ea7543 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -24,26 +24,40 @@
24#include "clock.h" 24#include "clock.h"
25 25
26#define DA8XX_TPCC_BASE 0x01c00000 26#define DA8XX_TPCC_BASE 0x01c00000
27#define DA850_TPCC1_BASE 0x01e30000
28#define DA8XX_TPTC0_BASE 0x01c08000 27#define DA8XX_TPTC0_BASE 0x01c08000
29#define DA8XX_TPTC1_BASE 0x01c08400 28#define DA8XX_TPTC1_BASE 0x01c08400
30#define DA850_TPTC2_BASE 0x01e38000
31#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ 29#define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */
32#define DA8XX_I2C0_BASE 0x01c22000 30#define DA8XX_I2C0_BASE 0x01c22000
33#define DA8XX_RTC_BASE 0x01C23000 31#define DA8XX_RTC_BASE 0x01c23000
32#define DA8XX_MMCSD0_BASE 0x01c40000
33#define DA8XX_SPI0_BASE 0x01c41000
34#define DA830_SPI1_BASE 0x01e12000
35#define DA8XX_LCD_CNTRL_BASE 0x01e13000
36#define DA850_MMCSD1_BASE 0x01e1b000
34#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 37#define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
35#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 38#define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
36#define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 39#define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
37#define DA8XX_EMAC_MDIO_BASE 0x01e24000 40#define DA8XX_EMAC_MDIO_BASE 0x01e24000
38#define DA8XX_GPIO_BASE 0x01e26000
39#define DA8XX_I2C1_BASE 0x01e28000 41#define DA8XX_I2C1_BASE 0x01e28000
42#define DA850_TPCC1_BASE 0x01e30000
43#define DA850_TPTC2_BASE 0x01e38000
44#define DA850_SPI1_BASE 0x01f0e000
45#define DA8XX_DDR2_CTL_BASE 0xb0000000
40 46
41#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000 47#define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
42#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000 48#define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
43#define DA8XX_EMAC_RAM_OFFSET 0x0000 49#define DA8XX_EMAC_RAM_OFFSET 0x0000
44#define DA8XX_MDIO_REG_OFFSET 0x4000
45#define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K 50#define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
46 51
52#define DA8XX_DMA_SPI0_RX EDMA_CTLR_CHAN(0, 14)
53#define DA8XX_DMA_SPI0_TX EDMA_CTLR_CHAN(0, 15)
54#define DA8XX_DMA_MMCSD0_RX EDMA_CTLR_CHAN(0, 16)
55#define DA8XX_DMA_MMCSD0_TX EDMA_CTLR_CHAN(0, 17)
56#define DA8XX_DMA_SPI1_RX EDMA_CTLR_CHAN(0, 18)
57#define DA8XX_DMA_SPI1_TX EDMA_CTLR_CHAN(0, 19)
58#define DA850_DMA_MMCSD1_RX EDMA_CTLR_CHAN(1, 28)
59#define DA850_DMA_MMCSD1_TX EDMA_CTLR_CHAN(1, 29)
60
47void __iomem *da8xx_syscfg0_base; 61void __iomem *da8xx_syscfg0_base;
48void __iomem *da8xx_syscfg1_base; 62void __iomem *da8xx_syscfg1_base;
49 63
@@ -351,7 +365,7 @@ int __init da8xx_register_watchdog(void)
351static struct resource da8xx_emac_resources[] = { 365static struct resource da8xx_emac_resources[] = {
352 { 366 {
353 .start = DA8XX_EMAC_CPPI_PORT_BASE, 367 .start = DA8XX_EMAC_CPPI_PORT_BASE,
354 .end = DA8XX_EMAC_CPPI_PORT_BASE + 0x5000 - 1, 368 .end = DA8XX_EMAC_CPPI_PORT_BASE + SZ_16K - 1,
355 .flags = IORESOURCE_MEM, 369 .flags = IORESOURCE_MEM,
356 }, 370 },
357 { 371 {
@@ -380,7 +394,6 @@ struct emac_platform_data da8xx_emac_pdata = {
380 .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET, 394 .ctrl_reg_offset = DA8XX_EMAC_CTRL_REG_OFFSET,
381 .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET, 395 .ctrl_mod_reg_offset = DA8XX_EMAC_MOD_REG_OFFSET,
382 .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET, 396 .ctrl_ram_offset = DA8XX_EMAC_RAM_OFFSET,
383 .mdio_reg_offset = DA8XX_MDIO_REG_OFFSET,
384 .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE, 397 .ctrl_ram_size = DA8XX_EMAC_CTRL_RAM_SIZE,
385 .version = EMAC_VERSION_2, 398 .version = EMAC_VERSION_2,
386}; 399};
@@ -395,9 +408,34 @@ static struct platform_device da8xx_emac_device = {
395 .resource = da8xx_emac_resources, 408 .resource = da8xx_emac_resources,
396}; 409};
397 410
411static struct resource da8xx_mdio_resources[] = {
412 {
413 .start = DA8XX_EMAC_MDIO_BASE,
414 .end = DA8XX_EMAC_MDIO_BASE + SZ_4K - 1,
415 .flags = IORESOURCE_MEM,
416 },
417};
418
419static struct platform_device da8xx_mdio_device = {
420 .name = "davinci_mdio",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(da8xx_mdio_resources),
423 .resource = da8xx_mdio_resources,
424};
425
398int __init da8xx_register_emac(void) 426int __init da8xx_register_emac(void)
399{ 427{
400 return platform_device_register(&da8xx_emac_device); 428 int ret;
429
430 ret = platform_device_register(&da8xx_mdio_device);
431 if (ret < 0)
432 return ret;
433 ret = platform_device_register(&da8xx_emac_device);
434 if (ret < 0)
435 return ret;
436 ret = clk_add_alias(NULL, dev_name(&da8xx_mdio_device.dev),
437 NULL, &da8xx_emac_device.dev);
438 return ret;
401} 439}
402 440
403static struct resource da830_mcasp1_resources[] = { 441static struct resource da830_mcasp1_resources[] = {
@@ -456,8 +494,15 @@ static struct platform_device da850_mcasp_device = {
456 .resource = da850_mcasp_resources, 494 .resource = da850_mcasp_resources,
457}; 495};
458 496
497static struct platform_device davinci_pcm_device = {
498 .name = "davinci-pcm-audio",
499 .id = -1,
500};
501
459void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) 502void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata)
460{ 503{
504 platform_device_register(&davinci_pcm_device);
505
461 /* DA830/OMAP-L137 has 3 instances of McASP */ 506 /* DA830/OMAP-L137 has 3 instances of McASP */
462 if (cpu_is_davinci_da830() && id == 1) { 507 if (cpu_is_davinci_da830() && id == 1) {
463 da830_mcasp1_device.dev.platform_data = pdata; 508 da830_mcasp1_device.dev.platform_data = pdata;
@@ -542,13 +587,13 @@ static struct resource da8xx_mmcsd0_resources[] = {
542 .flags = IORESOURCE_IRQ, 587 .flags = IORESOURCE_IRQ,
543 }, 588 },
544 { /* DMA RX */ 589 { /* DMA RX */
545 .start = EDMA_CTLR_CHAN(0, 16), 590 .start = DA8XX_DMA_MMCSD0_RX,
546 .end = EDMA_CTLR_CHAN(0, 16), 591 .end = DA8XX_DMA_MMCSD0_RX,
547 .flags = IORESOURCE_DMA, 592 .flags = IORESOURCE_DMA,
548 }, 593 },
549 { /* DMA TX */ 594 { /* DMA TX */
550 .start = EDMA_CTLR_CHAN(0, 17), 595 .start = DA8XX_DMA_MMCSD0_TX,
551 .end = EDMA_CTLR_CHAN(0, 17), 596 .end = DA8XX_DMA_MMCSD0_TX,
552 .flags = IORESOURCE_DMA, 597 .flags = IORESOURCE_DMA,
553 }, 598 },
554}; 599};
@@ -566,6 +611,44 @@ int __init da8xx_register_mmcsd0(struct davinci_mmc_config *config)
566 return platform_device_register(&da8xx_mmcsd0_device); 611 return platform_device_register(&da8xx_mmcsd0_device);
567} 612}
568 613
614#ifdef CONFIG_ARCH_DAVINCI_DA850
615static struct resource da850_mmcsd1_resources[] = {
616 { /* registers */
617 .start = DA850_MMCSD1_BASE,
618 .end = DA850_MMCSD1_BASE + SZ_4K - 1,
619 .flags = IORESOURCE_MEM,
620 },
621 { /* interrupt */
622 .start = IRQ_DA850_MMCSDINT0_1,
623 .end = IRQ_DA850_MMCSDINT0_1,
624 .flags = IORESOURCE_IRQ,
625 },
626 { /* DMA RX */
627 .start = DA850_DMA_MMCSD1_RX,
628 .end = DA850_DMA_MMCSD1_RX,
629 .flags = IORESOURCE_DMA,
630 },
631 { /* DMA TX */
632 .start = DA850_DMA_MMCSD1_TX,
633 .end = DA850_DMA_MMCSD1_TX,
634 .flags = IORESOURCE_DMA,
635 },
636};
637
638static struct platform_device da850_mmcsd1_device = {
639 .name = "davinci_mmc",
640 .id = 1,
641 .num_resources = ARRAY_SIZE(da850_mmcsd1_resources),
642 .resource = da850_mmcsd1_resources,
643};
644
645int __init da850_register_mmcsd1(struct davinci_mmc_config *config)
646{
647 da850_mmcsd1_device.dev.platform_data = config;
648 return platform_device_register(&da850_mmcsd1_device);
649}
650#endif
651
569static struct resource da8xx_rtc_resources[] = { 652static struct resource da8xx_rtc_resources[] = {
570 { 653 {
571 .start = DA8XX_RTC_BASE, 654 .start = DA8XX_RTC_BASE,
@@ -656,3 +739,106 @@ int __init da8xx_register_cpuidle(void)
656 739
657 return platform_device_register(&da8xx_cpuidle_device); 740 return platform_device_register(&da8xx_cpuidle_device);
658} 741}
742
743static struct resource da8xx_spi0_resources[] = {
744 [0] = {
745 .start = DA8XX_SPI0_BASE,
746 .end = DA8XX_SPI0_BASE + SZ_4K - 1,
747 .flags = IORESOURCE_MEM,
748 },
749 [1] = {
750 .start = IRQ_DA8XX_SPINT0,
751 .end = IRQ_DA8XX_SPINT0,
752 .flags = IORESOURCE_IRQ,
753 },
754 [2] = {
755 .start = DA8XX_DMA_SPI0_RX,
756 .end = DA8XX_DMA_SPI0_RX,
757 .flags = IORESOURCE_DMA,
758 },
759 [3] = {
760 .start = DA8XX_DMA_SPI0_TX,
761 .end = DA8XX_DMA_SPI0_TX,
762 .flags = IORESOURCE_DMA,
763 },
764};
765
766static struct resource da8xx_spi1_resources[] = {
767 [0] = {
768 .start = DA830_SPI1_BASE,
769 .end = DA830_SPI1_BASE + SZ_4K - 1,
770 .flags = IORESOURCE_MEM,
771 },
772 [1] = {
773 .start = IRQ_DA8XX_SPINT1,
774 .end = IRQ_DA8XX_SPINT1,
775 .flags = IORESOURCE_IRQ,
776 },
777 [2] = {
778 .start = DA8XX_DMA_SPI1_RX,
779 .end = DA8XX_DMA_SPI1_RX,
780 .flags = IORESOURCE_DMA,
781 },
782 [3] = {
783 .start = DA8XX_DMA_SPI1_TX,
784 .end = DA8XX_DMA_SPI1_TX,
785 .flags = IORESOURCE_DMA,
786 },
787};
788
789struct davinci_spi_platform_data da8xx_spi_pdata[] = {
790 [0] = {
791 .version = SPI_VERSION_2,
792 .intr_line = 1,
793 .dma_event_q = EVENTQ_0,
794 },
795 [1] = {
796 .version = SPI_VERSION_2,
797 .intr_line = 1,
798 .dma_event_q = EVENTQ_0,
799 },
800};
801
802static struct platform_device da8xx_spi_device[] = {
803 [0] = {
804 .name = "spi_davinci",
805 .id = 0,
806 .num_resources = ARRAY_SIZE(da8xx_spi0_resources),
807 .resource = da8xx_spi0_resources,
808 .dev = {
809 .platform_data = &da8xx_spi_pdata[0],
810 },
811 },
812 [1] = {
813 .name = "spi_davinci",
814 .id = 1,
815 .num_resources = ARRAY_SIZE(da8xx_spi1_resources),
816 .resource = da8xx_spi1_resources,
817 .dev = {
818 .platform_data = &da8xx_spi_pdata[1],
819 },
820 },
821};
822
823int __init da8xx_register_spi(int instance, struct spi_board_info *info,
824 unsigned len)
825{
826 int ret;
827
828 if (instance < 0 || instance > 1)
829 return -EINVAL;
830
831 ret = spi_register_board_info(info, len);
832 if (ret)
833 pr_warning("%s: failed to register board info for spi %d :"
834 " %d\n", __func__, instance, ret);
835
836 da8xx_spi_pdata[instance].num_chipselect = len;
837
838 if (instance == 1 && cpu_is_davinci_da850()) {
839 da8xx_spi1_resources[0].start = DA850_SPI1_BASE;
840 da8xx_spi1_resources[0].end = DA850_SPI1_BASE + SZ_4K - 1;
841 }
842
843 return platform_device_register(&da8xx_spi_device[instance]);
844}
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 2718a3a90dff..6162cae7f868 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -31,8 +31,11 @@
31#define TNETV107X_TPTC0_BASE 0x01c10000 31#define TNETV107X_TPTC0_BASE 0x01c10000
32#define TNETV107X_TPTC1_BASE 0x01c10400 32#define TNETV107X_TPTC1_BASE 0x01c10400
33#define TNETV107X_WDOG_BASE 0x08086700 33#define TNETV107X_WDOG_BASE 0x08086700
34#define TNETV107X_TSC_BASE 0x08088500
34#define TNETV107X_SDIO0_BASE 0x08088700 35#define TNETV107X_SDIO0_BASE 0x08088700
35#define TNETV107X_SDIO1_BASE 0x08088800 36#define TNETV107X_SDIO1_BASE 0x08088800
37#define TNETV107X_KEYPAD_BASE 0x08088a00
38#define TNETV107X_SSP_BASE 0x08088c00
36#define TNETV107X_ASYNC_EMIF_CNTRL_BASE 0x08200000 39#define TNETV107X_ASYNC_EMIF_CNTRL_BASE 0x08200000
37#define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE 0x30000000 40#define TNETV107X_ASYNC_EMIF_DATA_CE0_BASE 0x30000000
38#define TNETV107X_ASYNC_EMIF_DATA_CE1_BASE 0x40000000 41#define TNETV107X_ASYNC_EMIF_DATA_CE1_BASE 0x40000000
@@ -298,12 +301,87 @@ static int __init nand_init(int chipsel, struct davinci_nand_pdata *data)
298 return platform_device_register(pdev); 301 return platform_device_register(pdev);
299} 302}
300 303
304static struct resource keypad_resources[] = {
305 {
306 .start = TNETV107X_KEYPAD_BASE,
307 .end = TNETV107X_KEYPAD_BASE + 0xff,
308 .flags = IORESOURCE_MEM,
309 },
310 {
311 .start = IRQ_TNETV107X_KEYPAD,
312 .flags = IORESOURCE_IRQ,
313 .name = "press",
314 },
315 {
316 .start = IRQ_TNETV107X_KEYPAD_FREE,
317 .flags = IORESOURCE_IRQ,
318 .name = "release",
319 },
320};
321
322static struct platform_device keypad_device = {
323 .name = "tnetv107x-keypad",
324 .num_resources = ARRAY_SIZE(keypad_resources),
325 .resource = keypad_resources,
326};
327
328static struct resource tsc_resources[] = {
329 {
330 .start = TNETV107X_TSC_BASE,
331 .end = TNETV107X_TSC_BASE + 0xff,
332 .flags = IORESOURCE_MEM,
333 },
334 {
335 .start = IRQ_TNETV107X_TSC,
336 .flags = IORESOURCE_IRQ,
337 },
338};
339
340static struct platform_device tsc_device = {
341 .name = "tnetv107x-ts",
342 .num_resources = ARRAY_SIZE(tsc_resources),
343 .resource = tsc_resources,
344};
345
346static struct resource ssp_resources[] = {
347 {
348 .start = TNETV107X_SSP_BASE,
349 .end = TNETV107X_SSP_BASE + 0x1ff,
350 .flags = IORESOURCE_MEM,
351 },
352 {
353 .start = IRQ_TNETV107X_SSP,
354 .flags = IORESOURCE_IRQ,
355 },
356};
357
358static struct platform_device ssp_device = {
359 .name = "ti-ssp",
360 .id = -1,
361 .num_resources = ARRAY_SIZE(ssp_resources),
362 .resource = ssp_resources,
363};
364
301void __init tnetv107x_devices_init(struct tnetv107x_device_info *info) 365void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
302{ 366{
303 int i; 367 int i, error;
368 struct clk *tsc_clk;
369
370 /*
371 * The reset defaults for tnetv107x tsc clock divider is set too high.
372 * This forces the clock down to a range that allows the ADC to
373 * complete sample conversion in time.
374 */
375 tsc_clk = clk_get(NULL, "sys_tsc_clk");
376 if (tsc_clk) {
377 error = clk_set_rate(tsc_clk, 5000000);
378 WARN_ON(error < 0);
379 clk_put(tsc_clk);
380 }
304 381
305 platform_device_register(&edma_device); 382 platform_device_register(&edma_device);
306 platform_device_register(&tnetv107x_wdt_device); 383 platform_device_register(&tnetv107x_wdt_device);
384 platform_device_register(&tsc_device);
307 385
308 if (info->serial_config) 386 if (info->serial_config)
309 davinci_serial_init(info->serial_config); 387 davinci_serial_init(info->serial_config);
@@ -317,4 +395,14 @@ void __init tnetv107x_devices_init(struct tnetv107x_device_info *info)
317 for (i = 0; i < 4; i++) 395 for (i = 0; i < 4; i++)
318 if (info->nand_config[i]) 396 if (info->nand_config[i])
319 nand_init(i, info->nand_config[i]); 397 nand_init(i, info->nand_config[i]);
398
399 if (info->keypad_config) {
400 keypad_device.dev.platform_data = info->keypad_config;
401 platform_device_register(&keypad_device);
402 }
403
404 if (info->ssp_config) {
405 ssp_device.dev.platform_data = info->ssp_config;
406 platform_device_register(&ssp_device);
407 }
320} 408}
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 8b7201e4c79c..806a2f02b980 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -33,6 +33,9 @@
33#define DM365_MMCSD0_BASE 0x01D11000 33#define DM365_MMCSD0_BASE 0x01D11000
34#define DM365_MMCSD1_BASE 0x01D00000 34#define DM365_MMCSD1_BASE 0x01D00000
35 35
36/* System control register offsets */
37#define DM64XX_VDD3P3V_PWDN 0x48
38
36static struct resource i2c_resources[] = { 39static struct resource i2c_resources[] = {
37 { 40 {
38 .start = DAVINCI_I2C_BASE, 41 .start = DAVINCI_I2C_BASE,
@@ -213,7 +216,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
213 IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE + 0x7c); 216 IO_ADDRESS(DAVINCI_SYSTEM_MODULE_BASE + 0x7c);
214 217
215 /* Configure pull down control */ 218 /* Configure pull down control */
216 __raw_writel((__raw_readl(pupdctl1) & ~0x400), 219 __raw_writel((__raw_readl(pupdctl1) & ~0xfc0),
217 pupdctl1); 220 pupdctl1);
218 221
219 mmcsd1_resources[0].start = DM365_MMCSD1_BASE; 222 mmcsd1_resources[0].start = DM365_MMCSD1_BASE;
@@ -295,6 +298,18 @@ static void davinci_init_wdt(void)
295 298
296/*-------------------------------------------------------------------------*/ 299/*-------------------------------------------------------------------------*/
297 300
301static struct platform_device davinci_pcm_device = {
302 .name = "davinci-pcm-audio",
303 .id = -1,
304};
305
306static void davinci_init_pcm(void)
307{
308 platform_device_register(&davinci_pcm_device);
309}
310
311/*-------------------------------------------------------------------------*/
312
298struct davinci_timer_instance davinci_timer_instance[2] = { 313struct davinci_timer_instance davinci_timer_instance[2] = {
299 { 314 {
300 .base = DAVINCI_TIMER0_BASE, 315 .base = DAVINCI_TIMER0_BASE,
@@ -315,6 +330,7 @@ static int __init davinci_init_devices(void)
315 /* please keep these calls, and their implementations above, 330 /* please keep these calls, and their implementations above,
316 * in alphabetical order so they're easier to sort through. 331 * in alphabetical order so they're easier to sort through.
317 */ 332 */
333 davinci_init_pcm();
318 davinci_init_wdt(); 334 davinci_init_wdt();
319 335
320 return 0; 336 return 0;
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 9be261beae7d..a3a94e9c9378 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -314,7 +314,7 @@ static struct clk timer2_clk = {
314 .name = "timer2", 314 .name = "timer2",
315 .parent = &pll1_aux_clk, 315 .parent = &pll1_aux_clk,
316 .lpsc = DAVINCI_LPSC_TIMER2, 316 .lpsc = DAVINCI_LPSC_TIMER2,
317 .usecount = 1, /* REVISIT: why cant' this be disabled? */ 317 .usecount = 1, /* REVISIT: why can't this be disabled? */
318}; 318};
319 319
320static struct clk timer3_clk = { 320static struct clk timer3_clk = {
@@ -359,8 +359,8 @@ static struct clk_lookup dm355_clks[] = {
359 CLK(NULL, "uart1", &uart1_clk), 359 CLK(NULL, "uart1", &uart1_clk),
360 CLK(NULL, "uart2", &uart2_clk), 360 CLK(NULL, "uart2", &uart2_clk),
361 CLK("i2c_davinci.1", NULL, &i2c_clk), 361 CLK("i2c_davinci.1", NULL, &i2c_clk),
362 CLK("davinci-asp.0", NULL, &asp0_clk), 362 CLK("davinci-mcbsp.0", NULL, &asp0_clk),
363 CLK("davinci-asp.1", NULL, &asp1_clk), 363 CLK("davinci-mcbsp.1", NULL, &asp1_clk),
364 CLK("davinci_mmc.0", NULL, &mmcsd0_clk), 364 CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
365 CLK("davinci_mmc.1", NULL, &mmcsd1_clk), 365 CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
366 CLK("spi_davinci.0", NULL, &spi0_clk), 366 CLK("spi_davinci.0", NULL, &spi0_clk),
@@ -403,21 +403,13 @@ static struct resource dm355_spi0_resources[] = {
403 .start = 16, 403 .start = 16,
404 .flags = IORESOURCE_DMA, 404 .flags = IORESOURCE_DMA,
405 }, 405 },
406 {
407 .start = EVENTQ_1,
408 .flags = IORESOURCE_DMA,
409 },
410}; 406};
411 407
412static struct davinci_spi_platform_data dm355_spi0_pdata = { 408static struct davinci_spi_platform_data dm355_spi0_pdata = {
413 .version = SPI_VERSION_1, 409 .version = SPI_VERSION_1,
414 .num_chipselect = 2, 410 .num_chipselect = 2,
415 .clk_internal = 1, 411 .cshold_bug = true,
416 .cs_hold = 1, 412 .dma_event_q = EVENTQ_1,
417 .intr_level = 0,
418 .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */
419 .c2tdelay = 0,
420 .t2cdelay = 0,
421}; 413};
422static struct platform_device dm355_spi0_device = { 414static struct platform_device dm355_spi0_device = {
423 .name = "spi_davinci", 415 .name = "spi_davinci",
@@ -664,7 +656,7 @@ static struct resource dm355_asp1_resources[] = {
664}; 656};
665 657
666static struct platform_device dm355_asp1_device = { 658static struct platform_device dm355_asp1_device = {
667 .name = "davinci-asp", 659 .name = "davinci-mcbsp",
668 .id = 1, 660 .id = 1,
669 .num_resources = ARRAY_SIZE(dm355_asp1_resources), 661 .num_resources = ARRAY_SIZE(dm355_asp1_resources),
670 .resource = dm355_asp1_resources, 662 .resource = dm355_asp1_resources,
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 7781e35daec3..4604e72d7d99 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -459,7 +459,7 @@ static struct clk_lookup dm365_clks[] = {
459 CLK(NULL, "usb", &usb_clk), 459 CLK(NULL, "usb", &usb_clk),
460 CLK("davinci_emac.1", NULL, &emac_clk), 460 CLK("davinci_emac.1", NULL, &emac_clk),
461 CLK("davinci_voicecodec", NULL, &voicecodec_clk), 461 CLK("davinci_voicecodec", NULL, &voicecodec_clk),
462 CLK("davinci-asp.0", NULL, &asp0_clk), 462 CLK("davinci-mcbsp", NULL, &asp0_clk),
463 CLK(NULL, "rto", &rto_clk), 463 CLK(NULL, "rto", &rto_clk),
464 CLK(NULL, "mjcp", &mjcp_clk), 464 CLK(NULL, "mjcp", &mjcp_clk),
465 CLK(NULL, NULL, NULL), 465 CLK(NULL, NULL, NULL),
@@ -625,12 +625,7 @@ static u64 dm365_spi0_dma_mask = DMA_BIT_MASK(32);
625static struct davinci_spi_platform_data dm365_spi0_pdata = { 625static struct davinci_spi_platform_data dm365_spi0_pdata = {
626 .version = SPI_VERSION_1, 626 .version = SPI_VERSION_1,
627 .num_chipselect = 2, 627 .num_chipselect = 2,
628 .clk_internal = 1, 628 .dma_event_q = EVENTQ_3,
629 .cs_hold = 1,
630 .intr_level = 0,
631 .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */
632 .c2tdelay = 0,
633 .t2cdelay = 0,
634}; 629};
635 630
636static struct resource dm365_spi0_resources[] = { 631static struct resource dm365_spi0_resources[] = {
@@ -651,10 +646,6 @@ static struct resource dm365_spi0_resources[] = {
651 .start = 16, 646 .start = 16,
652 .flags = IORESOURCE_DMA, 647 .flags = IORESOURCE_DMA,
653 }, 648 },
654 {
655 .start = EVENTQ_3,
656 .flags = IORESOURCE_DMA,
657 },
658}; 649};
659 650
660static struct platform_device dm365_spi0_device = { 651static struct platform_device dm365_spi0_device = {
@@ -691,7 +682,6 @@ static struct emac_platform_data dm365_emac_pdata = {
691 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, 682 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET,
692 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, 683 .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET,
693 .ctrl_ram_offset = DM365_EMAC_CNTRL_RAM_OFFSET, 684 .ctrl_ram_offset = DM365_EMAC_CNTRL_RAM_OFFSET,
694 .mdio_reg_offset = DM365_EMAC_MDIO_OFFSET,
695 .ctrl_ram_size = DM365_EMAC_CNTRL_RAM_SIZE, 685 .ctrl_ram_size = DM365_EMAC_CNTRL_RAM_SIZE,
696 .version = EMAC_VERSION_2, 686 .version = EMAC_VERSION_2,
697}; 687};
@@ -699,7 +689,7 @@ static struct emac_platform_data dm365_emac_pdata = {
699static struct resource dm365_emac_resources[] = { 689static struct resource dm365_emac_resources[] = {
700 { 690 {
701 .start = DM365_EMAC_BASE, 691 .start = DM365_EMAC_BASE,
702 .end = DM365_EMAC_BASE + 0x47ff, 692 .end = DM365_EMAC_BASE + SZ_16K - 1,
703 .flags = IORESOURCE_MEM, 693 .flags = IORESOURCE_MEM,
704 }, 694 },
705 { 695 {
@@ -734,6 +724,21 @@ static struct platform_device dm365_emac_device = {
734 .resource = dm365_emac_resources, 724 .resource = dm365_emac_resources,
735}; 725};
736 726
727static struct resource dm365_mdio_resources[] = {
728 {
729 .start = DM365_EMAC_MDIO_BASE,
730 .end = DM365_EMAC_MDIO_BASE + SZ_4K - 1,
731 .flags = IORESOURCE_MEM,
732 },
733};
734
735static struct platform_device dm365_mdio_device = {
736 .name = "davinci_mdio",
737 .id = 0,
738 .num_resources = ARRAY_SIZE(dm365_mdio_resources),
739 .resource = dm365_mdio_resources,
740};
741
737static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = { 742static u8 dm365_default_priorities[DAVINCI_N_AINTC_IRQ] = {
738 [IRQ_VDINT0] = 2, 743 [IRQ_VDINT0] = 2,
739 [IRQ_VDINT1] = 6, 744 [IRQ_VDINT1] = 6,
@@ -908,8 +913,8 @@ static struct resource dm365_asp_resources[] = {
908}; 913};
909 914
910static struct platform_device dm365_asp_device = { 915static struct platform_device dm365_asp_device = {
911 .name = "davinci-asp", 916 .name = "davinci-mcbsp",
912 .id = 0, 917 .id = -1,
913 .num_resources = ARRAY_SIZE(dm365_asp_resources), 918 .num_resources = ARRAY_SIZE(dm365_asp_resources),
914 .resource = dm365_asp_resources, 919 .resource = dm365_asp_resources,
915}; 920};
@@ -1219,7 +1224,12 @@ static int __init dm365_init_devices(void)
1219 1224
1220 davinci_cfg_reg(DM365_INT_EDMA_CC); 1225 davinci_cfg_reg(DM365_INT_EDMA_CC);
1221 platform_device_register(&dm365_edma_device); 1226 platform_device_register(&dm365_edma_device);
1227
1228 platform_device_register(&dm365_mdio_device);
1222 platform_device_register(&dm365_emac_device); 1229 platform_device_register(&dm365_emac_device);
1230 clk_add_alias(NULL, dev_name(&dm365_mdio_device.dev),
1231 NULL, &dm365_emac_device.dev);
1232
1223 /* Add isif clock alias */ 1233 /* Add isif clock alias */
1224 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL); 1234 clk_add_alias("master", dm365_isif_dev.name, "vpss_master", NULL);
1225 platform_device_register(&dm365_vpss_device); 1235 platform_device_register(&dm365_vpss_device);
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 5e5b0a7831fb..4c82c2716293 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -274,7 +274,7 @@ static struct clk timer2_clk = {
274 .name = "timer2", 274 .name = "timer2",
275 .parent = &pll1_aux_clk, 275 .parent = &pll1_aux_clk,
276 .lpsc = DAVINCI_LPSC_TIMER2, 276 .lpsc = DAVINCI_LPSC_TIMER2,
277 .usecount = 1, /* REVISIT: why cant' this be disabled? */ 277 .usecount = 1, /* REVISIT: why can't this be disabled? */
278}; 278};
279 279
280static struct clk_lookup dm644x_clks[] = { 280static struct clk_lookup dm644x_clks[] = {
@@ -302,7 +302,7 @@ static struct clk_lookup dm644x_clks[] = {
302 CLK("davinci_emac.1", NULL, &emac_clk), 302 CLK("davinci_emac.1", NULL, &emac_clk),
303 CLK("i2c_davinci.1", NULL, &i2c_clk), 303 CLK("i2c_davinci.1", NULL, &i2c_clk),
304 CLK("palm_bk3710", NULL, &ide_clk), 304 CLK("palm_bk3710", NULL, &ide_clk),
305 CLK("davinci-asp", NULL, &asp_clk), 305 CLK("davinci-mcbsp", NULL, &asp_clk),
306 CLK("davinci_mmc.0", NULL, &mmcsd_clk), 306 CLK("davinci_mmc.0", NULL, &mmcsd_clk),
307 CLK(NULL, "spi", &spi_clk), 307 CLK(NULL, "spi", &spi_clk),
308 CLK(NULL, "gpio", &gpio_clk), 308 CLK(NULL, "gpio", &gpio_clk),
@@ -322,7 +322,6 @@ static struct emac_platform_data dm644x_emac_pdata = {
322 .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET, 322 .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET,
323 .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET, 323 .ctrl_mod_reg_offset = DM644X_EMAC_CNTRL_MOD_OFFSET,
324 .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET, 324 .ctrl_ram_offset = DM644X_EMAC_CNTRL_RAM_OFFSET,
325 .mdio_reg_offset = DM644X_EMAC_MDIO_OFFSET,
326 .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE, 325 .ctrl_ram_size = DM644X_EMAC_CNTRL_RAM_SIZE,
327 .version = EMAC_VERSION_1, 326 .version = EMAC_VERSION_1,
328}; 327};
@@ -330,7 +329,7 @@ static struct emac_platform_data dm644x_emac_pdata = {
330static struct resource dm644x_emac_resources[] = { 329static struct resource dm644x_emac_resources[] = {
331 { 330 {
332 .start = DM644X_EMAC_BASE, 331 .start = DM644X_EMAC_BASE,
333 .end = DM644X_EMAC_BASE + 0x47ff, 332 .end = DM644X_EMAC_BASE + SZ_16K - 1,
334 .flags = IORESOURCE_MEM, 333 .flags = IORESOURCE_MEM,
335 }, 334 },
336 { 335 {
@@ -350,6 +349,21 @@ static struct platform_device dm644x_emac_device = {
350 .resource = dm644x_emac_resources, 349 .resource = dm644x_emac_resources,
351}; 350};
352 351
352static struct resource dm644x_mdio_resources[] = {
353 {
354 .start = DM644X_EMAC_MDIO_BASE,
355 .end = DM644X_EMAC_MDIO_BASE + SZ_4K - 1,
356 .flags = IORESOURCE_MEM,
357 },
358};
359
360static struct platform_device dm644x_mdio_device = {
361 .name = "davinci_mdio",
362 .id = 0,
363 .num_resources = ARRAY_SIZE(dm644x_mdio_resources),
364 .resource = dm644x_mdio_resources,
365};
366
353/* 367/*
354 * Device specific mux setup 368 * Device specific mux setup
355 * 369 *
@@ -566,7 +580,7 @@ static struct resource dm644x_asp_resources[] = {
566}; 580};
567 581
568static struct platform_device dm644x_asp_device = { 582static struct platform_device dm644x_asp_device = {
569 .name = "davinci-asp", 583 .name = "davinci-mcbsp",
570 .id = -1, 584 .id = -1,
571 .num_resources = ARRAY_SIZE(dm644x_asp_resources), 585 .num_resources = ARRAY_SIZE(dm644x_asp_resources),
572 .resource = dm644x_asp_resources, 586 .resource = dm644x_asp_resources,
@@ -776,7 +790,12 @@ static int __init dm644x_init_devices(void)
776 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL); 790 clk_add_alias("master", dm644x_ccdc_dev.name, "vpss_master", NULL);
777 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL); 791 clk_add_alias("slave", dm644x_ccdc_dev.name, "vpss_slave", NULL);
778 platform_device_register(&dm644x_edma_device); 792 platform_device_register(&dm644x_edma_device);
793
794 platform_device_register(&dm644x_mdio_device);
779 platform_device_register(&dm644x_emac_device); 795 platform_device_register(&dm644x_emac_device);
796 clk_add_alias(NULL, dev_name(&dm644x_mdio_device.dev),
797 NULL, &dm644x_emac_device.dev);
798
780 platform_device_register(&dm644x_vpss_device); 799 platform_device_register(&dm644x_vpss_device);
781 platform_device_register(&dm644x_ccdc_dev); 800 platform_device_register(&dm644x_ccdc_dev);
782 platform_device_register(&vpfe_capture_dev); 801 platform_device_register(&vpfe_capture_dev);
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 26e8a9c7f50b..1e0f809644bb 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -358,7 +358,6 @@ static struct emac_platform_data dm646x_emac_pdata = {
358 .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, 358 .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET,
359 .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET, 359 .ctrl_mod_reg_offset = DM646X_EMAC_CNTRL_MOD_OFFSET,
360 .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET, 360 .ctrl_ram_offset = DM646X_EMAC_CNTRL_RAM_OFFSET,
361 .mdio_reg_offset = DM646X_EMAC_MDIO_OFFSET,
362 .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE, 361 .ctrl_ram_size = DM646X_EMAC_CNTRL_RAM_SIZE,
363 .version = EMAC_VERSION_2, 362 .version = EMAC_VERSION_2,
364}; 363};
@@ -366,7 +365,7 @@ static struct emac_platform_data dm646x_emac_pdata = {
366static struct resource dm646x_emac_resources[] = { 365static struct resource dm646x_emac_resources[] = {
367 { 366 {
368 .start = DM646X_EMAC_BASE, 367 .start = DM646X_EMAC_BASE,
369 .end = DM646X_EMAC_BASE + 0x47ff, 368 .end = DM646X_EMAC_BASE + SZ_16K - 1,
370 .flags = IORESOURCE_MEM, 369 .flags = IORESOURCE_MEM,
371 }, 370 },
372 { 371 {
@@ -401,6 +400,21 @@ static struct platform_device dm646x_emac_device = {
401 .resource = dm646x_emac_resources, 400 .resource = dm646x_emac_resources,
402}; 401};
403 402
403static struct resource dm646x_mdio_resources[] = {
404 {
405 .start = DM646X_EMAC_MDIO_BASE,
406 .end = DM646X_EMAC_MDIO_BASE + SZ_4K - 1,
407 .flags = IORESOURCE_MEM,
408 },
409};
410
411static struct platform_device dm646x_mdio_device = {
412 .name = "davinci_mdio",
413 .id = 0,
414 .num_resources = ARRAY_SIZE(dm646x_mdio_resources),
415 .resource = dm646x_mdio_resources,
416};
417
404/* 418/*
405 * Device specific mux setup 419 * Device specific mux setup
406 * 420 *
@@ -896,7 +910,11 @@ static int __init dm646x_init_devices(void)
896 if (!cpu_is_davinci_dm646x()) 910 if (!cpu_is_davinci_dm646x())
897 return 0; 911 return 0;
898 912
913 platform_device_register(&dm646x_mdio_device);
899 platform_device_register(&dm646x_emac_device); 914 platform_device_register(&dm646x_emac_device);
915 clk_add_alias(NULL, dev_name(&dm646x_mdio_device.dev),
916 NULL, &dm646x_emac_device.dev);
917
900 return 0; 918 return 0;
901} 919}
902postcore_initcall(dm646x_init_devices); 920postcore_initcall(dm646x_init_devices);
diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
index 2ede598b77dd..6b9669869c46 100644
--- a/arch/arm/mach-davinci/dma.c
+++ b/arch/arm/mach-davinci/dma.c
@@ -354,10 +354,12 @@ static int irq2ctlr(int irq)
354static irqreturn_t dma_irq_handler(int irq, void *data) 354static irqreturn_t dma_irq_handler(int irq, void *data)
355{ 355{
356 int i; 356 int i;
357 unsigned ctlr; 357 int ctlr;
358 unsigned int cnt = 0; 358 unsigned int cnt = 0;
359 359
360 ctlr = irq2ctlr(irq); 360 ctlr = irq2ctlr(irq);
361 if (ctlr < 0)
362 return IRQ_NONE;
361 363
362 dev_dbg(data, "dma_irq_handler\n"); 364 dev_dbg(data, "dma_irq_handler\n");
363 365
@@ -408,10 +410,12 @@ static irqreturn_t dma_irq_handler(int irq, void *data)
408static irqreturn_t dma_ccerr_handler(int irq, void *data) 410static irqreturn_t dma_ccerr_handler(int irq, void *data)
409{ 411{
410 int i; 412 int i;
411 unsigned ctlr; 413 int ctlr;
412 unsigned int cnt = 0; 414 unsigned int cnt = 0;
413 415
414 ctlr = irq2ctlr(irq); 416 ctlr = irq2ctlr(irq);
417 if (ctlr < 0)
418 return IRQ_NONE;
415 419
416 dev_dbg(data, "dma_ccerr_handler\n"); 420 dev_dbg(data, "dma_ccerr_handler\n");
417 421
diff --git a/arch/arm/mach-davinci/gpio-tnetv107x.c b/arch/arm/mach-davinci/gpio-tnetv107x.c
index d10298620e2c..3fa3e2867e19 100644
--- a/arch/arm/mach-davinci/gpio-tnetv107x.c
+++ b/arch/arm/mach-davinci/gpio-tnetv107x.c
@@ -58,7 +58,7 @@ static int tnetv107x_gpio_request(struct gpio_chip *chip, unsigned offset)
58 58
59 spin_lock_irqsave(&ctlr->lock, flags); 59 spin_lock_irqsave(&ctlr->lock, flags);
60 60
61 gpio_reg_set_bit(&regs->enable, gpio); 61 gpio_reg_set_bit(regs->enable, gpio);
62 62
63 spin_unlock_irqrestore(&ctlr->lock, flags); 63 spin_unlock_irqrestore(&ctlr->lock, flags);
64 64
@@ -74,7 +74,7 @@ static void tnetv107x_gpio_free(struct gpio_chip *chip, unsigned offset)
74 74
75 spin_lock_irqsave(&ctlr->lock, flags); 75 spin_lock_irqsave(&ctlr->lock, flags);
76 76
77 gpio_reg_clear_bit(&regs->enable, gpio); 77 gpio_reg_clear_bit(regs->enable, gpio);
78 78
79 spin_unlock_irqrestore(&ctlr->lock, flags); 79 spin_unlock_irqrestore(&ctlr->lock, flags);
80} 80}
@@ -88,7 +88,7 @@ static int tnetv107x_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
88 88
89 spin_lock_irqsave(&ctlr->lock, flags); 89 spin_lock_irqsave(&ctlr->lock, flags);
90 90
91 gpio_reg_set_bit(&regs->direction, gpio); 91 gpio_reg_set_bit(regs->direction, gpio);
92 92
93 spin_unlock_irqrestore(&ctlr->lock, flags); 93 spin_unlock_irqrestore(&ctlr->lock, flags);
94 94
@@ -106,11 +106,11 @@ static int tnetv107x_gpio_dir_out(struct gpio_chip *chip,
106 spin_lock_irqsave(&ctlr->lock, flags); 106 spin_lock_irqsave(&ctlr->lock, flags);
107 107
108 if (value) 108 if (value)
109 gpio_reg_set_bit(&regs->data_out, gpio); 109 gpio_reg_set_bit(regs->data_out, gpio);
110 else 110 else
111 gpio_reg_clear_bit(&regs->data_out, gpio); 111 gpio_reg_clear_bit(regs->data_out, gpio);
112 112
113 gpio_reg_clear_bit(&regs->direction, gpio); 113 gpio_reg_clear_bit(regs->direction, gpio);
114 114
115 spin_unlock_irqrestore(&ctlr->lock, flags); 115 spin_unlock_irqrestore(&ctlr->lock, flags);
116 116
@@ -124,7 +124,7 @@ static int tnetv107x_gpio_get(struct gpio_chip *chip, unsigned offset)
124 unsigned gpio = chip->base + offset; 124 unsigned gpio = chip->base + offset;
125 int ret; 125 int ret;
126 126
127 ret = gpio_reg_get_bit(&regs->data_in, gpio); 127 ret = gpio_reg_get_bit(regs->data_in, gpio);
128 128
129 return ret ? 1 : 0; 129 return ret ? 1 : 0;
130} 130}
@@ -140,9 +140,9 @@ static void tnetv107x_gpio_set(struct gpio_chip *chip,
140 spin_lock_irqsave(&ctlr->lock, flags); 140 spin_lock_irqsave(&ctlr->lock, flags);
141 141
142 if (value) 142 if (value)
143 gpio_reg_set_bit(&regs->data_out, gpio); 143 gpio_reg_set_bit(regs->data_out, gpio);
144 else 144 else
145 gpio_reg_clear_bit(&regs->data_out, gpio); 145 gpio_reg_clear_bit(regs->data_out, gpio);
146 146
147 spin_unlock_irqrestore(&ctlr->lock, flags); 147 spin_unlock_irqrestore(&ctlr->lock, flags);
148} 148}
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
index bf0ff587e46a..cafbe13a82a5 100644
--- a/arch/arm/mach-davinci/gpio.c
+++ b/arch/arm/mach-davinci/gpio.c
@@ -62,7 +62,7 @@ static inline struct davinci_gpio_regs __iomem *irq2regs(int irq)
62{ 62{
63 struct davinci_gpio_regs __iomem *g; 63 struct davinci_gpio_regs __iomem *g;
64 64
65 g = (__force struct davinci_gpio_regs __iomem *)get_irq_chip_data(irq); 65 g = (__force struct davinci_gpio_regs __iomem *)irq_get_chip_data(irq);
66 66
67 return g; 67 return g;
68} 68}
@@ -205,20 +205,20 @@ pure_initcall(davinci_gpio_setup);
205 * serve as EDMA event triggers. 205 * serve as EDMA event triggers.
206 */ 206 */
207 207
208static void gpio_irq_disable(unsigned irq) 208static void gpio_irq_disable(struct irq_data *d)
209{ 209{
210 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 210 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
211 u32 mask = (u32) get_irq_data(irq); 211 u32 mask = (u32) irq_data_get_irq_handler_data(d);
212 212
213 __raw_writel(mask, &g->clr_falling); 213 __raw_writel(mask, &g->clr_falling);
214 __raw_writel(mask, &g->clr_rising); 214 __raw_writel(mask, &g->clr_rising);
215} 215}
216 216
217static void gpio_irq_enable(unsigned irq) 217static void gpio_irq_enable(struct irq_data *d)
218{ 218{
219 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 219 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
220 u32 mask = (u32) get_irq_data(irq); 220 u32 mask = (u32) irq_data_get_irq_handler_data(d);
221 unsigned status = irq_desc[irq].status; 221 unsigned status = irqd_get_trigger_type(d);
222 222
223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING; 223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
224 if (!status) 224 if (!status)
@@ -230,47 +230,42 @@ static void gpio_irq_enable(unsigned irq)
230 __raw_writel(mask, &g->set_rising); 230 __raw_writel(mask, &g->set_rising);
231} 231}
232 232
233static int gpio_irq_type(unsigned irq, unsigned trigger) 233static int gpio_irq_type(struct irq_data *d, unsigned trigger)
234{ 234{
235 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 235 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
236 u32 mask = (u32) get_irq_data(irq); 236 u32 mask = (u32) irq_data_get_irq_handler_data(d);
237 237
238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
239 return -EINVAL; 239 return -EINVAL;
240 240
241 irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
242 irq_desc[irq].status |= trigger;
243
244 /* don't enable the IRQ if it's currently disabled */
245 if (irq_desc[irq].depth == 0) {
246 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
247 ? &g->set_falling : &g->clr_falling);
248 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
249 ? &g->set_rising : &g->clr_rising);
250 }
251 return 0; 241 return 0;
252} 242}
253 243
254static struct irq_chip gpio_irqchip = { 244static struct irq_chip gpio_irqchip = {
255 .name = "GPIO", 245 .name = "GPIO",
256 .enable = gpio_irq_enable, 246 .irq_enable = gpio_irq_enable,
257 .disable = gpio_irq_disable, 247 .irq_disable = gpio_irq_disable,
258 .set_type = gpio_irq_type, 248 .irq_set_type = gpio_irq_type,
249 .flags = IRQCHIP_SET_TYPE_MASKED,
259}; 250};
260 251
261static void 252static void
262gpio_irq_handler(unsigned irq, struct irq_desc *desc) 253gpio_irq_handler(unsigned irq, struct irq_desc *desc)
263{ 254{
264 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 255 struct davinci_gpio_regs __iomem *g;
265 u32 mask = 0xffff; 256 u32 mask = 0xffff;
257 struct davinci_gpio_controller *d;
258
259 d = (struct davinci_gpio_controller *)irq_desc_get_handler_data(desc);
260 g = (struct davinci_gpio_regs __iomem *)d->regs;
266 261
267 /* we only care about one bank */ 262 /* we only care about one bank */
268 if (irq & 1) 263 if (irq & 1)
269 mask <<= 16; 264 mask <<= 16;
270 265
271 /* temporarily mask (level sensitive) parent IRQ */ 266 /* temporarily mask (level sensitive) parent IRQ */
272 desc->chip->mask(irq); 267 desc->irq_data.chip->irq_mask(&desc->irq_data);
273 desc->chip->ack(irq); 268 desc->irq_data.chip->irq_ack(&desc->irq_data);
274 while (1) { 269 while (1) {
275 u32 status; 270 u32 status;
276 int n; 271 int n;
@@ -281,11 +276,14 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
281 if (!status) 276 if (!status)
282 break; 277 break;
283 __raw_writel(status, &g->intstat); 278 __raw_writel(status, &g->intstat);
284 if (irq & 1)
285 status >>= 16;
286 279
287 /* now demux them to the right lowlevel handler */ 280 /* now demux them to the right lowlevel handler */
288 n = (int)get_irq_data(irq); 281 n = d->irq_base;
282 if (irq & 1) {
283 n += 16;
284 status >>= 16;
285 }
286
289 while (status) { 287 while (status) {
290 res = ffs(status); 288 res = ffs(status);
291 n += res; 289 n += res;
@@ -293,7 +291,7 @@ gpio_irq_handler(unsigned irq, struct irq_desc *desc)
293 status >>= res; 291 status >>= res;
294 } 292 }
295 } 293 }
296 desc->chip->unmask(irq); 294 desc->irq_data.chip->irq_unmask(&desc->irq_data);
297 /* now it may re-trigger */ 295 /* now it may re-trigger */
298} 296}
299 297
@@ -320,10 +318,10 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
320 return -ENODEV; 318 return -ENODEV;
321} 319}
322 320
323static int gpio_irq_type_unbanked(unsigned irq, unsigned trigger) 321static int gpio_irq_type_unbanked(struct irq_data *d, unsigned trigger)
324{ 322{
325 struct davinci_gpio_regs __iomem *g = irq2regs(irq); 323 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
326 u32 mask = (u32) get_irq_data(irq); 324 u32 mask = (u32) irq_data_get_irq_handler_data(d);
327 325
328 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 326 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
329 return -EINVAL; 327 return -EINVAL;
@@ -395,9 +393,9 @@ static int __init davinci_gpio_irq_setup(void)
395 393
396 /* AINTC handles mask/unmask; GPIO handles triggering */ 394 /* AINTC handles mask/unmask; GPIO handles triggering */
397 irq = bank_irq; 395 irq = bank_irq;
398 gpio_irqchip_unbanked = *get_irq_desc_chip(irq_to_desc(irq)); 396 gpio_irqchip_unbanked = *irq_get_chip(irq);
399 gpio_irqchip_unbanked.name = "GPIO-AINTC"; 397 gpio_irqchip_unbanked.name = "GPIO-AINTC";
400 gpio_irqchip_unbanked.set_type = gpio_irq_type_unbanked; 398 gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked;
401 399
402 /* default trigger: both edges */ 400 /* default trigger: both edges */
403 g = gpio2regs(0); 401 g = gpio2regs(0);
@@ -406,10 +404,10 @@ static int __init davinci_gpio_irq_setup(void)
406 404
407 /* set the direct IRQs up to use that irqchip */ 405 /* set the direct IRQs up to use that irqchip */
408 for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) { 406 for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) {
409 set_irq_chip(irq, &gpio_irqchip_unbanked); 407 irq_set_chip(irq, &gpio_irqchip_unbanked);
410 set_irq_data(irq, (void *) __gpio_mask(gpio)); 408 irq_set_handler_data(irq, (void *)__gpio_mask(gpio));
411 set_irq_chip_data(irq, (__force void *) g); 409 irq_set_chip_data(irq, (__force void *)g);
412 irq_desc[irq].status |= IRQ_TYPE_EDGE_BOTH; 410 irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH);
413 } 411 }
414 412
415 goto done; 413 goto done;
@@ -430,15 +428,20 @@ static int __init davinci_gpio_irq_setup(void)
430 __raw_writel(~0, &g->clr_rising); 428 __raw_writel(~0, &g->clr_rising);
431 429
432 /* set up all irqs in this bank */ 430 /* set up all irqs in this bank */
433 set_irq_chained_handler(bank_irq, gpio_irq_handler); 431 irq_set_chained_handler(bank_irq, gpio_irq_handler);
434 set_irq_chip_data(bank_irq, (__force void *) g); 432
435 set_irq_data(bank_irq, (void *) irq); 433 /*
434 * Each chip handles 32 gpios, and each irq bank consists of 16
435 * gpio irqs. Pass the irq bank's corresponding controller to
436 * the chained irq handler.
437 */
438 irq_set_handler_data(bank_irq, &chips[gpio / 32]);
436 439
437 for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) { 440 for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) {
438 set_irq_chip(irq, &gpio_irqchip); 441 irq_set_chip(irq, &gpio_irqchip);
439 set_irq_chip_data(irq, (__force void *) g); 442 irq_set_chip_data(irq, (__force void *)g);
440 set_irq_data(irq, (void *) __gpio_mask(gpio)); 443 irq_set_handler_data(irq, (void *)__gpio_mask(gpio));
441 set_irq_handler(irq, handle_simple_irq); 444 irq_set_handler(irq, handle_simple_irq);
442 set_irq_flags(irq, IRQF_VALID); 445 set_irq_flags(irq, IRQF_VALID);
443 } 446 }
444 447
diff --git a/arch/arm/mach-davinci/include/mach/aemif.h b/arch/arm/mach-davinci/include/mach/aemif.h
new file mode 100644
index 000000000000..05b293443097
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/aemif.h
@@ -0,0 +1,36 @@
1/*
2 * TI DaVinci AEMIF support
3 *
4 * Copyright 2010 (C) Texas Instruments, Inc. http://www.ti.com/
5 *
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
8 * kind, whether express or implied.
9 */
10#ifndef _MACH_DAVINCI_AEMIF_H
11#define _MACH_DAVINCI_AEMIF_H
12
13#define NRCSR_OFFSET 0x00
14#define AWCCR_OFFSET 0x04
15#define A1CR_OFFSET 0x10
16
17#define ACR_ASIZE_MASK 0x3
18#define ACR_EW_MASK BIT(30)
19#define ACR_SS_MASK BIT(31)
20
21/* All timings in nanoseconds */
22struct davinci_aemif_timing {
23 u8 wsetup;
24 u8 wstrobe;
25 u8 whold;
26
27 u8 rsetup;
28 u8 rstrobe;
29 u8 rhold;
30
31 u8 ta;
32};
33
34int davinci_aemif_setup_timing(struct davinci_aemif_timing *t,
35 void __iomem *base, unsigned cs);
36#endif
diff --git a/arch/arm/mach-davinci/include/mach/clkdev.h b/arch/arm/mach-davinci/include/mach/clkdev.h
index 730c49d1ebd8..14a504887189 100644
--- a/arch/arm/mach-davinci/include/mach/clkdev.h
+++ b/arch/arm/mach-davinci/include/mach/clkdev.h
@@ -1,6 +1,8 @@
1#ifndef __MACH_CLKDEV_H 1#ifndef __MACH_CLKDEV_H
2#define __MACH_CLKDEV_H 2#define __MACH_CLKDEV_H
3 3
4struct clk;
5
4static inline int __clk_get(struct clk *clk) 6static inline int __clk_get(struct clk *clk)
5{ 7{
6 return 1; 8 return 1;
diff --git a/arch/arm/mach-davinci/include/mach/cputype.h b/arch/arm/mach-davinci/include/mach/cputype.h
index cea6b8972043..957fb87e832e 100644
--- a/arch/arm/mach-davinci/include/mach/cputype.h
+++ b/arch/arm/mach-davinci/include/mach/cputype.h
@@ -4,7 +4,7 @@
4 * Author: Kevin Hilman, Deep Root Systems, LLC 4 * Author: Kevin Hilman, Deep Root Systems, LLC
5 * 5 *
6 * Defines the cpu_is_*() macros for runtime detection of DaVinci 6 * Defines the cpu_is_*() macros for runtime detection of DaVinci
7 * device type. In addtion, if support for a given device is not 7 * device type. In addition, if support for a given device is not
8 * compiled in to the kernel, the macros return 0 so that 8 * compiled in to the kernel, the macros return 0 so that
9 * resulting code can be optimized out. 9 * resulting code can be optimized out.
10 * 10 *
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 3c07059f526e..ad64da713fc8 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/davinci_emac.h> 17#include <linux/davinci_emac.h>
18#include <linux/spi/spi.h>
18 19
19#include <mach/serial.h> 20#include <mach/serial.h>
20#include <mach/edma.h> 21#include <mach/edma.h>
@@ -23,11 +24,19 @@
23#include <mach/mmc.h> 24#include <mach/mmc.h>
24#include <mach/usb.h> 25#include <mach/usb.h>
25#include <mach/pm.h> 26#include <mach/pm.h>
27#include <mach/spi.h>
26 28
27extern void __iomem *da8xx_syscfg0_base; 29extern void __iomem *da8xx_syscfg0_base;
28extern void __iomem *da8xx_syscfg1_base; 30extern void __iomem *da8xx_syscfg1_base;
29 31
30/* 32/*
33 * If the DA850/OMAP-L138/AM18x SoC on board is of a higher speed grade
34 * (than the regular 300Mhz variant), the board code should set this up
35 * with the supported speed before calling da850_register_cpufreq().
36 */
37extern unsigned int da850_max_speed;
38
39/*
31 * The cp_intc interrupt controller for the da8xx isn't in the same 40 * The cp_intc interrupt controller for the da8xx isn't in the same
32 * chunk of physical memory space as the other registers (like it is 41 * chunk of physical memory space as the other registers (like it is
33 * on the davincis) so it needs to be mapped separately. It will be 42 * on the davincis) so it needs to be mapped separately. It will be
@@ -55,13 +64,9 @@ extern void __iomem *da8xx_syscfg1_base;
55#define DA8XX_TIMER64P1_BASE 0x01c21000 64#define DA8XX_TIMER64P1_BASE 0x01c21000
56#define DA8XX_GPIO_BASE 0x01e26000 65#define DA8XX_GPIO_BASE 0x01e26000
57#define DA8XX_PSC1_BASE 0x01e27000 66#define DA8XX_PSC1_BASE 0x01e27000
58#define DA8XX_LCD_CNTRL_BASE 0x01e13000
59#define DA8XX_PLL1_BASE 0x01e1a000
60#define DA8XX_MMCSD0_BASE 0x01c40000
61#define DA8XX_AEMIF_CS2_BASE 0x60000000 67#define DA8XX_AEMIF_CS2_BASE 0x60000000
62#define DA8XX_AEMIF_CS3_BASE 0x62000000 68#define DA8XX_AEMIF_CS3_BASE 0x62000000
63#define DA8XX_AEMIF_CTL_BASE 0x68000000 69#define DA8XX_AEMIF_CTL_BASE 0x68000000
64#define DA8XX_DDR2_CTL_BASE 0xb0000000
65#define DA8XX_ARM_RAM_BASE 0xffff0000 70#define DA8XX_ARM_RAM_BASE 0xffff0000
66 71
67void __init da830_init(void); 72void __init da830_init(void);
@@ -70,15 +75,17 @@ void __init da850_init(void);
70int da830_register_edma(struct edma_rsv_info *rsv); 75int da830_register_edma(struct edma_rsv_info *rsv);
71int da850_register_edma(struct edma_rsv_info *rsv[2]); 76int da850_register_edma(struct edma_rsv_info *rsv[2]);
72int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); 77int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
78int da8xx_register_spi(int instance, struct spi_board_info *info, unsigned len);
73int da8xx_register_watchdog(void); 79int da8xx_register_watchdog(void);
74int da8xx_register_usb20(unsigned mA, unsigned potpgt); 80int da8xx_register_usb20(unsigned mA, unsigned potpgt);
75int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); 81int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
76int da8xx_register_emac(void); 82int da8xx_register_emac(void);
77int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); 83int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
78int da8xx_register_mmcsd0(struct davinci_mmc_config *config); 84int da8xx_register_mmcsd0(struct davinci_mmc_config *config);
85int da850_register_mmcsd1(struct davinci_mmc_config *config);
79void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata); 86void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata);
80int da8xx_register_rtc(void); 87int da8xx_register_rtc(void);
81int da850_register_cpufreq(void); 88int da850_register_cpufreq(char *async_clk);
82int da8xx_register_cpuidle(void); 89int da8xx_register_cpuidle(void);
83void __iomem * __init da8xx_get_mem_ctlr(void); 90void __iomem * __init da8xx_get_mem_ctlr(void);
84int da850_register_pm(struct platform_device *pdev); 91int da850_register_pm(struct platform_device *pdev);
@@ -87,6 +94,7 @@ extern struct platform_device da8xx_serial_device;
87extern struct emac_platform_data da8xx_emac_pdata; 94extern struct emac_platform_data da8xx_emac_pdata;
88extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata; 95extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
89extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata; 96extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
97extern struct davinci_spi_platform_data da8xx_spi_pdata[];
90 98
91extern struct platform_device da8xx_wdt_device; 99extern struct platform_device da8xx_wdt_device;
92 100
@@ -115,17 +123,8 @@ extern const short da830_ecap2_pins[];
115extern const short da830_eqep0_pins[]; 123extern const short da830_eqep0_pins[];
116extern const short da830_eqep1_pins[]; 124extern const short da830_eqep1_pins[];
117 125
118extern const short da850_uart0_pins[];
119extern const short da850_uart1_pins[];
120extern const short da850_uart2_pins[];
121extern const short da850_i2c0_pins[]; 126extern const short da850_i2c0_pins[];
122extern const short da850_i2c1_pins[]; 127extern const short da850_i2c1_pins[];
123extern const short da850_cpgmac_pins[];
124extern const short da850_rmii_pins[];
125extern const short da850_mcasp_pins[];
126extern const short da850_lcdcntl_pins[]; 128extern const short da850_lcdcntl_pins[];
127extern const short da850_mmcsd0_pins[];
128extern const short da850_nand_pins[];
129extern const short da850_nor_pins[];
130 129
131#endif /* __ASM_ARCH_DAVINCI_DA8XX_H */ 130#endif /* __ASM_ARCH_DAVINCI_DA8XX_H */
diff --git a/arch/arm/mach-davinci/include/mach/debug-macro.S b/arch/arm/mach-davinci/include/mach/debug-macro.S
index f761dfdb8689..f8b7ea4f6235 100644
--- a/arch/arm/mach-davinci/include/mach/debug-macro.S
+++ b/arch/arm/mach-davinci/include/mach/debug-macro.S
@@ -24,40 +24,47 @@
24 24
25#define UART_SHIFT 2 25#define UART_SHIFT 2
26 26
27#define davinci_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET)
28#define davinci_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET)
29
27 .pushsection .data 30 .pushsection .data
28davinci_uart_phys: .word 0 31davinci_uart_phys: .word 0
29davinci_uart_virt: .word 0 32davinci_uart_virt: .word 0
30 .popsection 33 .popsection
31 34
32 .macro addruart, rx, tmp 35 .macro addruart, rp, rv
33 36
34 /* Use davinci_uart_phys/virt if already configured */ 37 /* Use davinci_uart_phys/virt if already configured */
3510: mrc p15, 0, \rx, c1, c0 3810: mrc p15, 0, \rp, c1, c0
36 tst \rx, #1 @ MMU enabled? 39 tst \rp, #1 @ MMU enabled?
37 ldreq \rx, =__virt_to_phys(davinci_uart_phys) 40 ldreq \rp, =davinci_uart_v2p(davinci_uart_phys)
38 ldrne \rx, =davinci_uart_virt 41 ldrne \rp, =davinci_uart_phys
39 ldr \rx, [\rx] 42 add \rv, \rp, #4 @ davinci_uart_virt
40 cmp \rx, #0 @ is port configured? 43 ldr \rp, [\rp, #0]
44 ldr \rv, [\rv, #0]
45 cmp \rp, #0 @ is port configured?
46 cmpne \rv, #0
41 bne 99f @ already configured 47 bne 99f @ already configured
42 48
43 mrc p15, 0, \rx, c1, c0 49 /* Check the debug UART address set in uncompress.h */
44 tst \rx, #1 @ MMU enabled? 50 mrc p15, 0, \rp, c1, c0
51 tst \rp, #1 @ MMU enabled?
45 52
46 /* Copy uart phys address from decompressor uart info */ 53 /* Copy uart phys address from decompressor uart info */
47 ldreq \tmp, =__virt_to_phys(davinci_uart_phys) 54 ldreq \rv, =davinci_uart_v2p(davinci_uart_phys)
48 ldrne \tmp, =davinci_uart_phys 55 ldrne \rv, =davinci_uart_phys
49 ldreq \rx, =DAVINCI_UART_INFO 56 ldreq \rp, =DAVINCI_UART_INFO
50 ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO) 57 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
51 ldr \rx, [\rx, #0] 58 ldr \rp, [\rp, #0]
52 str \rx, [\tmp] 59 str \rp, [\rv]
53 60
54 /* Copy uart virt address from decompressor uart info */ 61 /* Copy uart virt address from decompressor uart info */
55 ldreq \tmp, =__virt_to_phys(davinci_uart_virt) 62 ldreq \rv, =davinci_uart_v2p(davinci_uart_virt)
56 ldrne \tmp, =davinci_uart_virt 63 ldrne \rv, =davinci_uart_virt
57 ldreq \rx, =DAVINCI_UART_INFO 64 ldreq \rp, =DAVINCI_UART_INFO
58 ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO) 65 ldrne \rp, =davinci_uart_p2v(DAVINCI_UART_INFO)
59 ldr \rx, [\rx, #4] 66 ldr \rp, [\rp, #4]
60 str \rx, [\tmp] 67 str \rp, [\rv]
61 68
62 b 10b 69 b 10b
6399: 7099:
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h
index ea5df3b49ec4..2563bf4e93a1 100644
--- a/arch/arm/mach-davinci/include/mach/dm365.h
+++ b/arch/arm/mach-davinci/include/mach/dm365.h
@@ -21,10 +21,10 @@
21#include <media/davinci/vpfe_capture.h> 21#include <media/davinci/vpfe_capture.h>
22 22
23#define DM365_EMAC_BASE (0x01D07000) 23#define DM365_EMAC_BASE (0x01D07000)
24#define DM365_EMAC_MDIO_BASE (DM365_EMAC_BASE + 0x4000)
24#define DM365_EMAC_CNTRL_OFFSET (0x0000) 25#define DM365_EMAC_CNTRL_OFFSET (0x0000)
25#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000) 26#define DM365_EMAC_CNTRL_MOD_OFFSET (0x3000)
26#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000) 27#define DM365_EMAC_CNTRL_RAM_OFFSET (0x1000)
27#define DM365_EMAC_MDIO_OFFSET (0x4000)
28#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000) 28#define DM365_EMAC_CNTRL_RAM_SIZE (0x2000)
29 29
30/* Base of key scan register bank */ 30/* Base of key scan register bank */
diff --git a/arch/arm/mach-davinci/include/mach/dm644x.h b/arch/arm/mach-davinci/include/mach/dm644x.h
index 6fca568a0fd2..5a1b26d4e68b 100644
--- a/arch/arm/mach-davinci/include/mach/dm644x.h
+++ b/arch/arm/mach-davinci/include/mach/dm644x.h
@@ -28,10 +28,10 @@
28#include <media/davinci/vpfe_capture.h> 28#include <media/davinci/vpfe_capture.h>
29 29
30#define DM644X_EMAC_BASE (0x01C80000) 30#define DM644X_EMAC_BASE (0x01C80000)
31#define DM644X_EMAC_MDIO_BASE (DM644X_EMAC_BASE + 0x4000)
31#define DM644X_EMAC_CNTRL_OFFSET (0x0000) 32#define DM644X_EMAC_CNTRL_OFFSET (0x0000)
32#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000) 33#define DM644X_EMAC_CNTRL_MOD_OFFSET (0x1000)
33#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000) 34#define DM644X_EMAC_CNTRL_RAM_OFFSET (0x2000)
34#define DM644X_EMAC_MDIO_OFFSET (0x4000)
35#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000) 35#define DM644X_EMAC_CNTRL_RAM_SIZE (0x2000)
36 36
37#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01E00000 37#define DM644X_ASYNC_EMIF_CONTROL_BASE 0x01E00000
diff --git a/arch/arm/mach-davinci/include/mach/dm646x.h b/arch/arm/mach-davinci/include/mach/dm646x.h
index 0a27ee9a70e1..7a27f3f13913 100644
--- a/arch/arm/mach-davinci/include/mach/dm646x.h
+++ b/arch/arm/mach-davinci/include/mach/dm646x.h
@@ -19,10 +19,10 @@
19#include <linux/davinci_emac.h> 19#include <linux/davinci_emac.h>
20 20
21#define DM646X_EMAC_BASE (0x01C80000) 21#define DM646X_EMAC_BASE (0x01C80000)
22#define DM646X_EMAC_MDIO_BASE (DM646X_EMAC_BASE + 0x4000)
22#define DM646X_EMAC_CNTRL_OFFSET (0x0000) 23#define DM646X_EMAC_CNTRL_OFFSET (0x0000)
23#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000) 24#define DM646X_EMAC_CNTRL_MOD_OFFSET (0x1000)
24#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000) 25#define DM646X_EMAC_CNTRL_RAM_OFFSET (0x2000)
25#define DM646X_EMAC_MDIO_OFFSET (0x4000)
26#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000) 26#define DM646X_EMAC_CNTRL_RAM_SIZE (0x2000)
27 27
28#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000 28#define DM646X_ASYNC_EMIF_CONTROL_BASE 0x20008000
diff --git a/arch/arm/mach-davinci/include/mach/edma.h b/arch/arm/mach-davinci/include/mach/edma.h
index dc10ef6cf572..20c77f29bf0f 100644
--- a/arch/arm/mach-davinci/include/mach/edma.h
+++ b/arch/arm/mach-davinci/include/mach/edma.h
@@ -151,42 +151,6 @@ struct edmacc_param {
151#define DA830_DMACH2EVENT_MAP1 0x00000000u 151#define DA830_DMACH2EVENT_MAP1 0x00000000u
152#define DA830_EDMA_ARM_OWN 0x30FFCCFFu 152#define DA830_EDMA_ARM_OWN 0x30FFCCFFu
153 153
154/* DA830 specific EDMA3 Events Information */
155enum DA830_edma_ch {
156 DA830_DMACH_MCASP0_RX,
157 DA830_DMACH_MCASP0_TX,
158 DA830_DMACH_MCASP1_RX,
159 DA830_DMACH_MCASP1_TX,
160 DA830_DMACH_MCASP2_RX,
161 DA830_DMACH_MCASP2_TX,
162 DA830_DMACH_GPIO_BNK0INT,
163 DA830_DMACH_GPIO_BNK1INT,
164 DA830_DMACH_UART0_RX,
165 DA830_DMACH_UART0_TX,
166 DA830_DMACH_TMR64P0_EVTOUT12,
167 DA830_DMACH_TMR64P0_EVTOUT34,
168 DA830_DMACH_UART1_RX,
169 DA830_DMACH_UART1_TX,
170 DA830_DMACH_SPI0_RX,
171 DA830_DMACH_SPI0_TX,
172 DA830_DMACH_MMCSD_RX,
173 DA830_DMACH_MMCSD_TX,
174 DA830_DMACH_SPI1_RX,
175 DA830_DMACH_SPI1_TX,
176 DA830_DMACH_DMAX_EVTOUT6,
177 DA830_DMACH_DMAX_EVTOUT7,
178 DA830_DMACH_GPIO_BNK2INT,
179 DA830_DMACH_GPIO_BNK3INT,
180 DA830_DMACH_I2C0_RX,
181 DA830_DMACH_I2C0_TX,
182 DA830_DMACH_I2C1_RX,
183 DA830_DMACH_I2C1_TX,
184 DA830_DMACH_GPIO_BNK4INT,
185 DA830_DMACH_GPIO_BNK5INT,
186 DA830_DMACH_UART2_RX,
187 DA830_DMACH_UART2_TX
188};
189
190/*ch_status paramater of callback function possible values*/ 154/*ch_status paramater of callback function possible values*/
191#define DMA_COMPLETE 1 155#define DMA_COMPLETE 1
192#define DMA_CC_ERROR 2 156#define DMA_CC_ERROR 2
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h
index c45ba1f62a11..414e0b93e741 100644
--- a/arch/arm/mach-davinci/include/mach/hardware.h
+++ b/arch/arm/mach-davinci/include/mach/hardware.h
@@ -21,9 +21,6 @@
21 */ 21 */
22#define DAVINCI_SYSTEM_MODULE_BASE 0x01C40000 22#define DAVINCI_SYSTEM_MODULE_BASE 0x01C40000
23 23
24/* System control register offsets */
25#define DM64XX_VDD3P3V_PWDN 0x48
26
27/* 24/*
28 * I/O mapping 25 * I/O mapping
29 */ 26 */
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h
index 62b0a90309ad..d1b954955c12 100644
--- a/arch/arm/mach-davinci/include/mach/io.h
+++ b/arch/arm/mach-davinci/include/mach/io.h
@@ -22,8 +22,8 @@
22#define __mem_isa(a) (a) 22#define __mem_isa(a) (a)
23 23
24#ifndef __ASSEMBLER__ 24#ifndef __ASSEMBLER__
25#define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t) 25#define __arch_ioremap davinci_ioremap
26#define __arch_iounmap(v) davinci_iounmap(v) 26#define __arch_iounmap davinci_iounmap
27 27
28void __iomem *davinci_ioremap(unsigned long phys, size_t size, 28void __iomem *davinci_ioremap(unsigned long phys, size_t size,
29 unsigned int type); 29 unsigned int type);
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index 22eb97c1c30b..491249ef209c 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -26,9 +26,9 @@
26#if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx) 26#if defined(CONFIG_ARCH_DAVINCI_DA8XX) && defined(CONFIG_ARCH_DAVINCI_DMx)
27#error Cannot enable DaVinci and DA8XX platforms concurrently 27#error Cannot enable DaVinci and DA8XX platforms concurrently
28#elif defined(CONFIG_ARCH_DAVINCI_DA8XX) 28#elif defined(CONFIG_ARCH_DAVINCI_DA8XX)
29#define PHYS_OFFSET DA8XX_DDR_BASE 29#define PLAT_PHYS_OFFSET DA8XX_DDR_BASE
30#else 30#else
31#define PHYS_OFFSET DAVINCI_DDR_BASE 31#define PLAT_PHYS_OFFSET DAVINCI_DDR_BASE
32#endif 32#endif
33 33
34#define DDR2_SDRCR_OFFSET 0xc 34#define DDR2_SDRCR_OFFSET 0xc
@@ -41,27 +41,11 @@
41 */ 41 */
42#define CONSISTENT_DMA_SIZE (14<<20) 42#define CONSISTENT_DMA_SIZE (14<<20)
43 43
44#ifndef __ASSEMBLY__
45/* 44/*
46 * Restrict DMA-able region to workaround silicon bug. The bug 45 * Restrict DMA-able region to workaround silicon bug. The bug
47 * restricts buffers available for DMA to video hardware to be 46 * restricts buffers available for DMA to video hardware to be
48 * below 128M 47 * below 128M
49 */ 48 */
50static inline void 49#define ARM_DMA_ZONE_SIZE SZ_128M
51__arch_adjust_zones(unsigned long *size, unsigned long *holes)
52{
53 unsigned int sz = (128<<20) >> PAGE_SHIFT;
54
55 size[1] = size[0] - sz;
56 size[0] = sz;
57}
58
59#define arch_adjust_zones(zone_size, holes) \
60 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(zone_size, holes)
61
62#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1)
63#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20))
64
65#endif
66 50
67#endif /* __ASM_ARCH_MEMORY_H */ 51#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index de11aac76a80..5d4e0fed828a 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -908,11 +908,15 @@ enum davinci_da850_index {
908 DA850_NEMA_CS_2, 908 DA850_NEMA_CS_2,
909 909
910 /* GPIO function */ 910 /* GPIO function */
911 DA850_GPIO2_4,
911 DA850_GPIO2_6, 912 DA850_GPIO2_6,
912 DA850_GPIO2_8, 913 DA850_GPIO2_8,
913 DA850_GPIO2_15, 914 DA850_GPIO2_15,
915 DA850_GPIO3_12,
916 DA850_GPIO3_13,
914 DA850_GPIO4_0, 917 DA850_GPIO4_0,
915 DA850_GPIO4_1, 918 DA850_GPIO4_1,
919 DA850_GPIO6_13,
916 DA850_RTC_ALARM, 920 DA850_RTC_ALARM,
917}; 921};
918 922
diff --git a/arch/arm/mach-davinci/include/mach/nand.h b/arch/arm/mach-davinci/include/mach/nand.h
index b2ad8090bd10..025151049f05 100644
--- a/arch/arm/mach-davinci/include/mach/nand.h
+++ b/arch/arm/mach-davinci/include/mach/nand.h
@@ -30,9 +30,6 @@
30 30
31#include <linux/mtd/nand.h> 31#include <linux/mtd/nand.h>
32 32
33#define NRCSR_OFFSET 0x00
34#define AWCCR_OFFSET 0x04
35#define A1CR_OFFSET 0x10
36#define NANDFCR_OFFSET 0x60 33#define NANDFCR_OFFSET 0x60
37#define NANDFSR_OFFSET 0x64 34#define NANDFSR_OFFSET 0x64
38#define NANDF1ECC_OFFSET 0x70 35#define NANDF1ECC_OFFSET 0x70
@@ -83,6 +80,9 @@ struct davinci_nand_pdata { /* platform_data */
83 /* Main and mirror bbt descriptor overrides */ 80 /* Main and mirror bbt descriptor overrides */
84 struct nand_bbt_descr *bbt_td; 81 struct nand_bbt_descr *bbt_td;
85 struct nand_bbt_descr *bbt_md; 82 struct nand_bbt_descr *bbt_md;
83
84 /* Access timings */
85 struct davinci_aemif_timing *timing;
86}; 86};
87 87
88#endif /* __ARCH_ARM_DAVINCI_NAND_H */ 88#endif /* __ARCH_ARM_DAVINCI_NAND_H */
diff --git a/arch/arm/mach-davinci/include/mach/psc.h b/arch/arm/mach-davinci/include/mach/psc.h
index 983da6e4554c..a47e6f29206e 100644
--- a/arch/arm/mach-davinci/include/mach/psc.h
+++ b/arch/arm/mach-davinci/include/mach/psc.h
@@ -150,7 +150,7 @@
150#define DA8XX_LPSC0_SCR0_SS 10 150#define DA8XX_LPSC0_SCR0_SS 10
151#define DA8XX_LPSC0_SCR1_SS 11 151#define DA8XX_LPSC0_SCR1_SS 11
152#define DA8XX_LPSC0_SCR2_SS 12 152#define DA8XX_LPSC0_SCR2_SS 12
153#define DA8XX_LPSC0_DMAX 13 153#define DA8XX_LPSC0_PRUSS 13
154#define DA8XX_LPSC0_ARM 14 154#define DA8XX_LPSC0_ARM 14
155#define DA8XX_LPSC0_GEM 15 155#define DA8XX_LPSC0_GEM 15
156 156
@@ -172,6 +172,7 @@
172#define DA8XX_LPSC1_UART2 13 172#define DA8XX_LPSC1_UART2 13
173#define DA8XX_LPSC1_LCDC 16 173#define DA8XX_LPSC1_LCDC 16
174#define DA8XX_LPSC1_PWM 17 174#define DA8XX_LPSC1_PWM 17
175#define DA850_LPSC1_MMC_SD1 18
175#define DA8XX_LPSC1_ECAP 20 176#define DA8XX_LPSC1_ECAP 20
176#define DA830_LPSC1_EQEP 21 177#define DA830_LPSC1_EQEP 21
177#define DA850_LPSC1_TPTC2 21 178#define DA850_LPSC1_TPTC2 21
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h
index 8051110b8ac3..c9e6ce185a66 100644
--- a/arch/arm/mach-davinci/include/mach/serial.h
+++ b/arch/arm/mach-davinci/include/mach/serial.h
@@ -22,7 +22,7 @@
22 * 22 *
23 * This area sits just below the page tables (see arch/arm/kernel/head.S). 23 * This area sits just below the page tables (see arch/arm/kernel/head.S).
24 */ 24 */
25#define DAVINCI_UART_INFO (PHYS_OFFSET + 0x3ff8) 25#define DAVINCI_UART_INFO (PLAT_PHYS_OFFSET + 0x3ff8)
26 26
27#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) 27#define DAVINCI_UART0_BASE (IO_PHYS + 0x20000)
28#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400) 28#define DAVINCI_UART1_BASE (IO_PHYS + 0x20400)
diff --git a/arch/arm/mach-davinci/include/mach/spi.h b/arch/arm/mach-davinci/include/mach/spi.h
index 910efbf099c0..7af305b37868 100644
--- a/arch/arm/mach-davinci/include/mach/spi.h
+++ b/arch/arm/mach-davinci/include/mach/spi.h
@@ -19,26 +19,71 @@
19#ifndef __ARCH_ARM_DAVINCI_SPI_H 19#ifndef __ARCH_ARM_DAVINCI_SPI_H
20#define __ARCH_ARM_DAVINCI_SPI_H 20#define __ARCH_ARM_DAVINCI_SPI_H
21 21
22#include <mach/edma.h>
23
24#define SPI_INTERN_CS 0xFF
25
22enum { 26enum {
23 SPI_VERSION_1, /* For DM355/DM365/DM6467 */ 27 SPI_VERSION_1, /* For DM355/DM365/DM6467 */
24 SPI_VERSION_2, /* For DA8xx */ 28 SPI_VERSION_2, /* For DA8xx */
25}; 29};
26 30
31/**
32 * davinci_spi_platform_data - Platform data for SPI master device on DaVinci
33 *
34 * @version: version of the SPI IP. Different DaVinci devices have slightly
35 * varying versions of the same IP.
36 * @num_chipselect: number of chipselects supported by this SPI master
37 * @intr_line: interrupt line used to connect the SPI IP to the ARM interrupt
38 * controller withn the SoC. Possible values are 0 and 1.
39 * @chip_sel: list of GPIOs which can act as chip-selects for the SPI.
40 * SPI_INTERN_CS denotes internal SPI chip-select. Not necessary
41 * to populate if all chip-selects are internal.
42 * @cshold_bug: set this to true if the SPI controller on your chip requires
43 * a write to CSHOLD bit in between transfers (like in DM355).
44 * @dma_event_q: DMA event queue to use if SPI_IO_TYPE_DMA is used for any
45 * device on the bus.
46 */
27struct davinci_spi_platform_data { 47struct davinci_spi_platform_data {
28 u8 version; 48 u8 version;
29 u8 num_chipselect; 49 u8 num_chipselect;
50 u8 intr_line;
51 u8 *chip_sel;
52 bool cshold_bug;
53 enum dma_event_q dma_event_q;
54};
55
56/**
57 * davinci_spi_config - Per-chip-select configuration for SPI slave devices
58 *
59 * @wdelay: amount of delay between transmissions. Measured in number of
60 * SPI module clocks.
61 * @odd_parity: polarity of parity flag at the end of transmit data stream.
62 * 0 - odd parity, 1 - even parity.
63 * @parity_enable: enable transmission of parity at end of each transmit
64 * data stream.
65 * @io_type: type of IO transfer. Choose between polled, interrupt and DMA.
66 * @timer_disable: disable chip-select timers (setup and hold)
67 * @c2tdelay: chip-select setup time. Measured in number of SPI module clocks.
68 * @t2cdelay: chip-select hold time. Measured in number of SPI module clocks.
69 * @t2edelay: transmit data finished to SPI ENAn pin inactive time. Measured
70 * in number of SPI clocks.
71 * @c2edelay: chip-select active to SPI ENAn signal active time. Measured in
72 * number of SPI clocks.
73 */
74struct davinci_spi_config {
30 u8 wdelay; 75 u8 wdelay;
31 u8 odd_parity; 76 u8 odd_parity;
32 u8 parity_enable; 77 u8 parity_enable;
33 u8 wait_enable; 78#define SPI_IO_TYPE_INTR 0
79#define SPI_IO_TYPE_POLL 1
80#define SPI_IO_TYPE_DMA 2
81 u8 io_type;
34 u8 timer_disable; 82 u8 timer_disable;
35 u8 clk_internal;
36 u8 cs_hold;
37 u8 intr_level;
38 u8 poll_mode;
39 u8 use_dma;
40 u8 c2tdelay; 83 u8 c2tdelay;
41 u8 t2cdelay; 84 u8 t2cdelay;
85 u8 t2edelay;
86 u8 c2edelay;
42}; 87};
43 88
44#endif /* __ARCH_ARM_DAVINCI_SPI_H */ 89#endif /* __ARCH_ARM_DAVINCI_SPI_H */
diff --git a/arch/arm/mach-davinci/include/mach/tnetv107x.h b/arch/arm/mach-davinci/include/mach/tnetv107x.h
index c72064733123..89c1fdc63c0b 100644
--- a/arch/arm/mach-davinci/include/mach/tnetv107x.h
+++ b/arch/arm/mach-davinci/include/mach/tnetv107x.h
@@ -33,6 +33,9 @@
33#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
34 34
35#include <linux/serial_8250.h> 35#include <linux/serial_8250.h>
36#include <linux/input/matrix_keypad.h>
37#include <linux/mfd/ti_ssp.h>
38
36#include <mach/mmc.h> 39#include <mach/mmc.h>
37#include <mach/nand.h> 40#include <mach/nand.h>
38#include <mach/serial.h> 41#include <mach/serial.h>
@@ -41,6 +44,8 @@ struct tnetv107x_device_info {
41 struct davinci_uart_config *serial_config; 44 struct davinci_uart_config *serial_config;
42 struct davinci_mmc_config *mmc_config[2]; /* 2 controllers */ 45 struct davinci_mmc_config *mmc_config[2]; /* 2 controllers */
43 struct davinci_nand_pdata *nand_config[4]; /* 4 chipsels */ 46 struct davinci_nand_pdata *nand_config[4]; /* 4 chipsels */
47 struct matrix_keypad_platform_data *keypad_config;
48 struct ti_ssp_data *ssp_config;
44}; 49};
45 50
46extern struct platform_device tnetv107x_wdt_device; 51extern struct platform_device tnetv107x_wdt_device;
diff --git a/arch/arm/mach-davinci/include/mach/uncompress.h b/arch/arm/mach-davinci/include/mach/uncompress.h
index 15a6192ad6eb..78d80683cdc2 100644
--- a/arch/arm/mach-davinci/include/mach/uncompress.h
+++ b/arch/arm/mach-davinci/include/mach/uncompress.h
@@ -25,8 +25,7 @@
25 25
26#include <mach/serial.h> 26#include <mach/serial.h>
27 27
28static u32 *uart; 28u32 *uart;
29static u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
30 29
31/* PORT_16C550A, in polled non-fifo mode */ 30/* PORT_16C550A, in polled non-fifo mode */
32static void putc(char c) 31static void putc(char c)
@@ -44,6 +43,8 @@ static inline void flush(void)
44 43
45static inline void set_uart_info(u32 phys, void * __iomem virt) 44static inline void set_uart_info(u32 phys, void * __iomem virt)
46{ 45{
46 u32 *uart_info = (u32 *)(DAVINCI_UART_INFO);
47
47 uart = (u32 *)phys; 48 uart = (u32 *)phys;
48 uart_info[0] = phys; 49 uart_info[0] = phys;
49 uart_info[1] = (u32)virt; 50 uart_info[1] = (u32)virt;
@@ -88,6 +89,8 @@ static inline void __arch_decomp_setup(unsigned long arch_id)
88 /* DA8xx boards */ 89 /* DA8xx boards */
89 DEBUG_LL_DA8XX(davinci_da830_evm, 2); 90 DEBUG_LL_DA8XX(davinci_da830_evm, 2);
90 DEBUG_LL_DA8XX(davinci_da850_evm, 2); 91 DEBUG_LL_DA8XX(davinci_da850_evm, 2);
92 DEBUG_LL_DA8XX(mityomapl138, 1);
93 DEBUG_LL_DA8XX(omapl138_hawkboard, 2);
91 94
92 /* TNETV107x boards */ 95 /* TNETV107x boards */
93 DEBUG_LL_TNETV107X(tnetv107x, 1); 96 DEBUG_LL_TNETV107X(tnetv107x, 1);
diff --git a/arch/arm/mach-davinci/irq.c b/arch/arm/mach-davinci/irq.c
index 784ddf3c5ad4..952dc126c390 100644
--- a/arch/arm/mach-davinci/irq.c
+++ b/arch/arm/mach-davinci/irq.c
@@ -29,8 +29,6 @@
29#include <mach/common.h> 29#include <mach/common.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
31 31
32#define IRQ_BIT(irq) ((irq) & 0x1f)
33
34#define FIQ_REG0_OFFSET 0x0000 32#define FIQ_REG0_OFFSET 0x0000
35#define FIQ_REG1_OFFSET 0x0004 33#define FIQ_REG1_OFFSET 0x0004
36#define IRQ_REG0_OFFSET 0x0008 34#define IRQ_REG0_OFFSET 0x0008
@@ -42,78 +40,39 @@
42#define IRQ_INTPRI0_REG_OFFSET 0x0030 40#define IRQ_INTPRI0_REG_OFFSET 0x0030
43#define IRQ_INTPRI7_REG_OFFSET 0x004C 41#define IRQ_INTPRI7_REG_OFFSET 0x004C
44 42
45static inline unsigned int davinci_irq_readl(int offset)
46{
47 return __raw_readl(davinci_intc_base + offset);
48}
49
50static inline void davinci_irq_writel(unsigned long value, int offset) 43static inline void davinci_irq_writel(unsigned long value, int offset)
51{ 44{
52 __raw_writel(value, davinci_intc_base + offset); 45 __raw_writel(value, davinci_intc_base + offset);
53} 46}
54 47
55/* Disable interrupt */ 48static __init void
56static void davinci_mask_irq(unsigned int irq) 49davinci_alloc_gc(void __iomem *base, unsigned int irq_start, unsigned int num)
57{ 50{
58 unsigned int mask; 51 struct irq_chip_generic *gc;
59 u32 l; 52 struct irq_chip_type *ct;
60
61 mask = 1 << IRQ_BIT(irq);
62
63 if (irq > 31) {
64 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET);
65 l &= ~mask;
66 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET);
67 } else {
68 l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET);
69 l &= ~mask;
70 davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET);
71 }
72}
73 53
74/* Enable interrupt */ 54 gc = irq_alloc_generic_chip("AINTC", 1, irq_start, base, handle_edge_irq);
75static void davinci_unmask_irq(unsigned int irq) 55 if (!gc) {
76{ 56 pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
77 unsigned int mask; 57 __func__, irq_start);
78 u32 l; 58 return;
79
80 mask = 1 << IRQ_BIT(irq);
81
82 if (irq > 31) {
83 l = davinci_irq_readl(IRQ_ENT_REG1_OFFSET);
84 l |= mask;
85 davinci_irq_writel(l, IRQ_ENT_REG1_OFFSET);
86 } else {
87 l = davinci_irq_readl(IRQ_ENT_REG0_OFFSET);
88 l |= mask;
89 davinci_irq_writel(l, IRQ_ENT_REG0_OFFSET);
90 } 59 }
91}
92
93/* EOI interrupt */
94static void davinci_ack_irq(unsigned int irq)
95{
96 unsigned int mask;
97 60
98 mask = 1 << IRQ_BIT(irq); 61 ct = gc->chip_types;
62 ct->chip.irq_ack = irq_gc_ack_set_bit;
63 ct->chip.irq_mask = irq_gc_mask_clr_bit;
64 ct->chip.irq_unmask = irq_gc_mask_set_bit;
99 65
100 if (irq > 31) 66 ct->regs.ack = IRQ_REG0_OFFSET;
101 davinci_irq_writel(mask, IRQ_REG1_OFFSET); 67 ct->regs.mask = IRQ_ENT_REG0_OFFSET;
102 else 68 irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
103 davinci_irq_writel(mask, IRQ_REG0_OFFSET); 69 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
104} 70}
105 71
106static struct irq_chip davinci_irq_chip_0 = {
107 .name = "AINTC",
108 .ack = davinci_ack_irq,
109 .mask = davinci_mask_irq,
110 .unmask = davinci_unmask_irq,
111};
112
113/* ARM Interrupt Controller Initialization */ 72/* ARM Interrupt Controller Initialization */
114void __init davinci_irq_init(void) 73void __init davinci_irq_init(void)
115{ 74{
116 unsigned i; 75 unsigned i, j;
117 const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios; 76 const u8 *davinci_def_priorities = davinci_soc_info.intc_irq_prios;
118 77
119 davinci_intc_type = DAVINCI_INTC_TYPE_AINTC; 78 davinci_intc_type = DAVINCI_INTC_TYPE_AINTC;
@@ -144,7 +103,6 @@ void __init davinci_irq_init(void)
144 davinci_irq_writel(~0x0, IRQ_REG1_OFFSET); 103 davinci_irq_writel(~0x0, IRQ_REG1_OFFSET);
145 104
146 for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) { 105 for (i = IRQ_INTPRI0_REG_OFFSET; i <= IRQ_INTPRI7_REG_OFFSET; i += 4) {
147 unsigned j;
148 u32 pri; 106 u32 pri;
149 107
150 for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++) 108 for (j = 0, pri = 0; j < 32; j += 4, davinci_def_priorities++)
@@ -152,13 +110,8 @@ void __init davinci_irq_init(void)
152 davinci_irq_writel(pri, i); 110 davinci_irq_writel(pri, i);
153 } 111 }
154 112
155 /* set up genirq dispatch for ARM INTC */ 113 for (i = 0, j = 0; i < davinci_soc_info.intc_irq_num; i += 32, j += 0x04)
156 for (i = 0; i < davinci_soc_info.intc_irq_num; i++) { 114 davinci_alloc_gc(davinci_intc_base + j, i, 32);
157 set_irq_chip(i, &davinci_irq_chip_0); 115
158 set_irq_flags(i, IRQF_VALID | IRQF_PROBE); 116 irq_set_handler(IRQ_TINT1_TINT34, handle_level_irq);
159 if (i != IRQ_TINT1_TINT34)
160 set_irq_handler(i, handle_edge_irq);
161 else
162 set_irq_handler(i, handle_level_irq);
163 }
164} 117}
diff --git a/arch/arm/mach-davinci/pm.c b/arch/arm/mach-davinci/pm.c
index fab953b43dea..1bd73a04be20 100644
--- a/arch/arm/mach-davinci/pm.c
+++ b/arch/arm/mach-davinci/pm.c
@@ -110,7 +110,7 @@ static int davinci_pm_enter(suspend_state_t state)
110 return ret; 110 return ret;
111} 111}
112 112
113static struct platform_suspend_ops davinci_pm_ops = { 113static const struct platform_suspend_ops davinci_pm_ops = {
114 .enter = davinci_pm_enter, 114 .enter = davinci_pm_enter,
115 .valid = suspend_valid_only_mem, 115 .valid = suspend_valid_only_mem,
116}; 116};
diff --git a/arch/arm/mach-davinci/psc.c b/arch/arm/mach-davinci/psc.c
index 1b15dbd0a77b..a41580400701 100644
--- a/arch/arm/mach-davinci/psc.c
+++ b/arch/arm/mach-davinci/psc.c
@@ -83,21 +83,16 @@ void davinci_psc_config(unsigned int domain, unsigned int ctlr,
83 pdctl1 = __raw_readl(psc_base + PDCTL1); 83 pdctl1 = __raw_readl(psc_base + PDCTL1);
84 pdctl1 |= 0x100; 84 pdctl1 |= 0x100;
85 __raw_writel(pdctl1, psc_base + PDCTL1); 85 __raw_writel(pdctl1, psc_base + PDCTL1);
86
87 do {
88 ptstat = __raw_readl(psc_base +
89 PTSTAT);
90 } while (!(((ptstat >> domain) & 1) == 0));
91 } else { 86 } else {
92 ptcmd = 1 << domain; 87 ptcmd = 1 << domain;
93 __raw_writel(ptcmd, psc_base + PTCMD); 88 __raw_writel(ptcmd, psc_base + PTCMD);
94
95 do {
96 ptstat = __raw_readl(psc_base + PTSTAT);
97 } while (!(((ptstat >> domain) & 1) == 0));
98 } 89 }
99 90
100 do { 91 do {
92 ptstat = __raw_readl(psc_base + PTSTAT);
93 } while (!(((ptstat >> domain) & 1) == 0));
94
95 do {
101 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 96 mdstat = __raw_readl(psc_base + MDSTAT + 4 * id);
102 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); 97 } while (!((mdstat & MDSTAT_STATE_MASK) == next_state));
103 98
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index 0f21c36e65dd..e1969ce904dc 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -272,15 +272,35 @@ static cycle_t read_cycles(struct clocksource *cs)
272 return (cycles_t)timer32_read(t); 272 return (cycles_t)timer32_read(t);
273} 273}
274 274
275/*
276 * Kernel assumes that sched_clock can be called early but may not have
277 * things ready yet.
278 */
279static cycle_t read_dummy(struct clocksource *cs)
280{
281 return 0;
282}
283
284
275static struct clocksource clocksource_davinci = { 285static struct clocksource clocksource_davinci = {
276 .rating = 300, 286 .rating = 300,
277 .read = read_cycles, 287 .read = read_dummy,
278 .mask = CLOCKSOURCE_MASK(32), 288 .mask = CLOCKSOURCE_MASK(32),
279 .shift = 24,
280 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 289 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
281}; 290};
282 291
283/* 292/*
293 * Overwrite weak default sched_clock with something more precise
294 */
295unsigned long long notrace sched_clock(void)
296{
297 const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci);
298
299 return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
300 clocksource_davinci.shift);
301}
302
303/*
284 * clockevent 304 * clockevent
285 */ 305 */
286static int davinci_set_next_event(unsigned long cycles, 306static int davinci_set_next_event(unsigned long cycles,
@@ -377,11 +397,10 @@ static void __init davinci_timer_init(void)
377 davinci_clock_tick_rate = clk_get_rate(timer_clk); 397 davinci_clock_tick_rate = clk_get_rate(timer_clk);
378 398
379 /* setup clocksource */ 399 /* setup clocksource */
400 clocksource_davinci.read = read_cycles;
380 clocksource_davinci.name = id_to_name[clocksource_id]; 401 clocksource_davinci.name = id_to_name[clocksource_id];
381 clocksource_davinci.mult = 402 if (clocksource_register_hz(&clocksource_davinci,
382 clocksource_khz2mult(davinci_clock_tick_rate/1000, 403 davinci_clock_tick_rate))
383 clocksource_davinci.shift);
384 if (clocksource_register(&clocksource_davinci))
385 printk(err, clocksource_davinci.name); 404 printk(err, clocksource_davinci.name);
386 405
387 /* setup clockevent */ 406 /* setup clockevent */
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index 864e60482c53..1b28fdd892a6 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -104,7 +104,7 @@ static u32 pll_ext_freq[] = {
104}; 104};
105 105
106/* PSC control registers */ 106/* PSC control registers */
107static u32 psc_regs[] __initconst = { TNETV107X_PSC_BASE }; 107static u32 psc_regs[] = { TNETV107X_PSC_BASE };
108 108
109/* Host map for interrupt controller */ 109/* Host map for interrupt controller */
110static u32 intc_host_map[] = { 0x01010000, 0x01010101, -1 }; 110static u32 intc_host_map[] = { 0x01010000, 0x01010101, -1 };
@@ -131,12 +131,13 @@ define_pll_clk(tdm, 1, 0x0ff, 0x200);
131define_pll_clk(eth, 2, 0x0ff, 0x400); 131define_pll_clk(eth, 2, 0x0ff, 0x400);
132 132
133/* Level 2 - divided outputs from the PLLs */ 133/* Level 2 - divided outputs from the PLLs */
134#define define_pll_div_clk(pll, cname, div) \ 134#define define_pll_div_clk(pll, cname, div) \
135 static struct clk pll##_##cname##_clk = { \ 135 static struct clk pll##_##cname##_clk = { \
136 .name = #pll "_" #cname "_clk",\ 136 .name = #pll "_" #cname "_clk", \
137 .parent = &pll_##pll##_clk, \ 137 .parent = &pll_##pll##_clk, \
138 .flags = CLK_PLL, \ 138 .flags = CLK_PLL, \
139 .div_reg = PLLDIV##div, \ 139 .div_reg = PLLDIV##div, \
140 .set_rate = davinci_set_sysclk_rate, \
140 } 141 }
141 142
142define_pll_div_clk(sys, arm1176, 1); 143define_pll_div_clk(sys, arm1176, 1);
@@ -192,6 +193,7 @@ lpsc_clk_enabled(system, sys_half_clk, SYSTEM);
192lpsc_clk_enabled(ddr2_vrst, sys_ddr_clk, DDR2_EMIF1_VRST); 193lpsc_clk_enabled(ddr2_vrst, sys_ddr_clk, DDR2_EMIF1_VRST);
193lpsc_clk_enabled(ddr2_vctl_rst, sys_ddr_clk, DDR2_EMIF2_VCTL_RST); 194lpsc_clk_enabled(ddr2_vctl_rst, sys_ddr_clk, DDR2_EMIF2_VCTL_RST);
194lpsc_clk_enabled(wdt_arm, sys_half_clk, WDT_ARM); 195lpsc_clk_enabled(wdt_arm, sys_half_clk, WDT_ARM);
196lpsc_clk_enabled(timer1, sys_half_clk, TIMER1);
195 197
196lpsc_clk(mbx_lite, sys_arm1176_clk, MBX_LITE); 198lpsc_clk(mbx_lite, sys_arm1176_clk, MBX_LITE);
197lpsc_clk(ethss, eth_125mhz_clk, ETHSS); 199lpsc_clk(ethss, eth_125mhz_clk, ETHSS);
@@ -205,16 +207,15 @@ lpsc_clk(mdio, sys_half_clk, MDIO);
205lpsc_clk(sdio0, sys_half_clk, SDIO0); 207lpsc_clk(sdio0, sys_half_clk, SDIO0);
206lpsc_clk(sdio1, sys_half_clk, SDIO1); 208lpsc_clk(sdio1, sys_half_clk, SDIO1);
207lpsc_clk(timer0, sys_half_clk, TIMER0); 209lpsc_clk(timer0, sys_half_clk, TIMER0);
208lpsc_clk(timer1, sys_half_clk, TIMER1);
209lpsc_clk(wdt_dsp, sys_half_clk, WDT_DSP); 210lpsc_clk(wdt_dsp, sys_half_clk, WDT_DSP);
210lpsc_clk(ssp, sys_half_clk, SSP); 211lpsc_clk(ssp, sys_half_clk, SSP);
211lpsc_clk(tdm0, tdm_0_clk, TDM0); 212lpsc_clk(tdm0, tdm_0_clk, TDM0);
212lpsc_clk(tdm1, tdm_1_clk, TDM1); 213lpsc_clk(tdm1, tdm_1_clk, TDM1);
213lpsc_clk(vlynq, sys_vlynq_ref_clk, VLYNQ); 214lpsc_clk(vlynq, sys_vlynq_ref_clk, VLYNQ);
214lpsc_clk(mcdma, sys_half_clk, MCDMA); 215lpsc_clk(mcdma, sys_half_clk, MCDMA);
215lpsc_clk(usb0, sys_half_clk, USB0);
216lpsc_clk(usb1, sys_half_clk, USB1);
217lpsc_clk(usbss, sys_half_clk, USBSS); 216lpsc_clk(usbss, sys_half_clk, USBSS);
217lpsc_clk(usb0, clk_usbss, USB0);
218lpsc_clk(usb1, clk_usbss, USB1);
218lpsc_clk(ethss_rgmii, eth_250mhz_clk, ETHSS_RGMII); 219lpsc_clk(ethss_rgmii, eth_250mhz_clk, ETHSS_RGMII);
219lpsc_clk(imcop, sys_dsp_clk, IMCOP); 220lpsc_clk(imcop, sys_dsp_clk, IMCOP);
220lpsc_clk(spare, sys_half_clk, SPARE); 221lpsc_clk(spare, sys_half_clk, SPARE);
@@ -277,11 +278,13 @@ static struct clk_lookup clks[] = {
277 CLK(NULL, "timer1", &clk_timer1), 278 CLK(NULL, "timer1", &clk_timer1),
278 CLK("tnetv107x_wdt.0", NULL, &clk_wdt_arm), 279 CLK("tnetv107x_wdt.0", NULL, &clk_wdt_arm),
279 CLK(NULL, "clk_wdt_dsp", &clk_wdt_dsp), 280 CLK(NULL, "clk_wdt_dsp", &clk_wdt_dsp),
280 CLK("ti-ssp.0", NULL, &clk_ssp), 281 CLK("ti-ssp", NULL, &clk_ssp),
281 CLK(NULL, "clk_tdm0", &clk_tdm0), 282 CLK(NULL, "clk_tdm0", &clk_tdm0),
282 CLK(NULL, "clk_vlynq", &clk_vlynq), 283 CLK(NULL, "clk_vlynq", &clk_vlynq),
283 CLK(NULL, "clk_mcdma", &clk_mcdma), 284 CLK(NULL, "clk_mcdma", &clk_mcdma),
285 CLK(NULL, "clk_usbss", &clk_usbss),
284 CLK(NULL, "clk_usb0", &clk_usb0), 286 CLK(NULL, "clk_usb0", &clk_usb0),
287 CLK(NULL, "clk_usb1", &clk_usb1),
285 CLK(NULL, "clk_tdm1", &clk_tdm1), 288 CLK(NULL, "clk_tdm1", &clk_tdm1),
286 CLK(NULL, "clk_debugss", &clk_debugss), 289 CLK(NULL, "clk_debugss", &clk_debugss),
287 CLK(NULL, "clk_ethss_rgmii", &clk_ethss_rgmii), 290 CLK(NULL, "clk_ethss_rgmii", &clk_ethss_rgmii),
@@ -289,8 +292,6 @@ static struct clk_lookup clks[] = {
289 CLK(NULL, "clk_imcop", &clk_imcop), 292 CLK(NULL, "clk_imcop", &clk_imcop),
290 CLK(NULL, "clk_spare", &clk_spare), 293 CLK(NULL, "clk_spare", &clk_spare),
291 CLK("davinci_mmc.1", NULL, &clk_sdio1), 294 CLK("davinci_mmc.1", NULL, &clk_sdio1),
292 CLK(NULL, "clk_usb1", &clk_usb1),
293 CLK(NULL, "clk_usbss", &clk_usbss),
294 CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst), 295 CLK(NULL, "clk_ddr2_vrst", &clk_ddr2_vrst),
295 CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst), 296 CLK(NULL, "clk_ddr2_vctl_rst", &clk_ddr2_vctl_rst),
296 CLK(NULL, NULL, NULL), 297 CLK(NULL, NULL, NULL),
@@ -581,7 +582,14 @@ static struct davinci_id ids[] = {
581 .part_no = 0xb8a1, 582 .part_no = 0xb8a1,
582 .manufacturer = 0x017, 583 .manufacturer = 0x017,
583 .cpu_id = DAVINCI_CPU_ID_TNETV107X, 584 .cpu_id = DAVINCI_CPU_ID_TNETV107X,
584 .name = "tnetv107x rev1.0", 585 .name = "tnetv107x rev 1.0",
586 },
587 {
588 .variant = 0x1,
589 .part_no = 0xb8a1,
590 .manufacturer = 0x017,
591 .cpu_id = DAVINCI_CPU_ID_TNETV107X,
592 .name = "tnetv107x rev 1.1/1.2",
585 }, 593 },
586}; 594};
587 595
diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c
index 31f0cbea0caa..23d2b6d9fa63 100644
--- a/arch/arm/mach-davinci/usb.c
+++ b/arch/arm/mach-davinci/usb.c
@@ -64,17 +64,19 @@ static struct resource usb_resources[] = {
64 { 64 {
65 .start = IRQ_USBINT, 65 .start = IRQ_USBINT,
66 .flags = IORESOURCE_IRQ, 66 .flags = IORESOURCE_IRQ,
67 .name = "mc"
67 }, 68 },
68 { 69 {
69 /* placeholder for the dedicated CPPI IRQ */ 70 /* placeholder for the dedicated CPPI IRQ */
70 .flags = IORESOURCE_IRQ, 71 .flags = IORESOURCE_IRQ,
72 .name = "dma"
71 }, 73 },
72}; 74};
73 75
74static u64 usb_dmamask = DMA_BIT_MASK(32); 76static u64 usb_dmamask = DMA_BIT_MASK(32);
75 77
76static struct platform_device usb_dev = { 78static struct platform_device usb_dev = {
77 .name = "musb_hdrc", 79 .name = "musb-davinci",
78 .id = -1, 80 .id = -1,
79 .dev = { 81 .dev = {
80 .platform_data = &usb_data, 82 .platform_data = &usb_data,
@@ -110,6 +112,7 @@ static struct resource da8xx_usb20_resources[] = {
110 { 112 {
111 .start = IRQ_DA8XX_USB_INT, 113 .start = IRQ_DA8XX_USB_INT,
112 .flags = IORESOURCE_IRQ, 114 .flags = IORESOURCE_IRQ,
115 .name = "mc",
113 }, 116 },
114}; 117};
115 118
@@ -121,6 +124,7 @@ int __init da8xx_register_usb20(unsigned mA, unsigned potpgt)
121 124
122 usb_dev.resource = da8xx_usb20_resources; 125 usb_dev.resource = da8xx_usb20_resources;
123 usb_dev.num_resources = ARRAY_SIZE(da8xx_usb20_resources); 126 usb_dev.num_resources = ARRAY_SIZE(da8xx_usb20_resources);
127 usb_dev.name = "musb-da8xx";
124 128
125 return platform_device_register(&usb_dev); 129 return platform_device_register(&usb_dev);
126} 130}