diff options
author | Lennert Buytenhek <buytenh@wantstofly.org> | 2008-03-27 14:51:39 -0400 |
---|---|---|
committer | Nicolas Pitre <nico@marvell.com> | 2008-03-27 14:51:39 -0400 |
commit | 92aecfa95523384923b52c8ddaf948fc02a53e82 (patch) | |
tree | 0bea3d5d3ee86b1540cecd5aeab9afa48919ee7d /arch | |
parent | 1f2223b12b62a97d66e39199db50ed3fae9222c0 (diff) |
ehci-orion: mbus decode window support
Make it possible to pass mbus_dram_target_info to the ehci-orion
driver via the platform data, make the ehci-orion driver program
the window registers based on this data if it is passed in, and
make the Orion platform setup code use this method instead of
programming the EHCI mbus window registers by hand.
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Reviewed-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-orion/addr-map.c | 49 | ||||
-rw-r--r-- | arch/arm/mach-orion/common.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-orion/common.h | 1 |
3 files changed, 7 insertions, 51 deletions
diff --git a/arch/arm/mach-orion/addr-map.c b/arch/arm/mach-orion/addr-map.c index 69cd0876f6b9..40bcb986ab96 100644 --- a/arch/arm/mach-orion/addr-map.c +++ b/arch/arm/mach-orion/addr-map.c | |||
@@ -104,15 +104,6 @@ | |||
104 | #define ETH_MAX_REMAP_WIN 4 | 104 | #define ETH_MAX_REMAP_WIN 4 |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * USB Address Decode Windows registers | ||
108 | */ | ||
109 | #define USB_WIN_CTRL(i, w) ((i == 0) ? ORION_USB0_REG(0x320 + ((w) << 4)) \ | ||
110 | : ORION_USB1_REG(0x320 + ((w) << 4))) | ||
111 | #define USB_WIN_BASE(i, w) ((i == 0) ? ORION_USB0_REG(0x324 + ((w) << 4)) \ | ||
112 | : ORION_USB1_REG(0x324 + ((w) << 4))) | ||
113 | #define USB_MAX_WIN 4 | ||
114 | |||
115 | /* | ||
116 | * SATA Address Decode Windows registers | 107 | * SATA Address Decode Windows registers |
117 | */ | 108 | */ |
118 | #define SATA_WIN_CTRL(win) ORION_SATA_REG(0x30 + ((win) * 0x10)) | 109 | #define SATA_WIN_CTRL(win) ORION_SATA_REG(0x30 + ((win) * 0x10)) |
@@ -262,46 +253,6 @@ void __init orion_setup_cpu_wins(void) | |||
262 | orion_mbus_dram_info.num_cs = cs; | 253 | orion_mbus_dram_info.num_cs = cs; |
263 | } | 254 | } |
264 | 255 | ||
265 | void __init orion_setup_usb_wins(void) | ||
266 | { | ||
267 | int i; | ||
268 | u32 usb_if, dev, rev; | ||
269 | u32 max_usb_if = 1; | ||
270 | |||
271 | orion_pcie_id(&dev, &rev); | ||
272 | if (dev == MV88F5182_DEV_ID) | ||
273 | max_usb_if = 2; | ||
274 | |||
275 | for (usb_if = 0; usb_if < max_usb_if; usb_if++) { | ||
276 | /* | ||
277 | * First, disable and clear windows | ||
278 | */ | ||
279 | for (i = 0; i < USB_MAX_WIN; i++) { | ||
280 | orion_write(USB_WIN_BASE(usb_if, i), 0); | ||
281 | orion_write(USB_WIN_CTRL(usb_if, i), 0); | ||
282 | } | ||
283 | |||
284 | /* | ||
285 | * Setup windows for DDR banks. | ||
286 | */ | ||
287 | for (i = 0; i < DDR_MAX_CS; i++) { | ||
288 | u32 base, size; | ||
289 | size = orion_read(DDR_SIZE_CS(i)); | ||
290 | base = orion_read(DDR_BASE_CS(i)); | ||
291 | if (size & DDR_BANK_EN) { | ||
292 | base = DDR_REG_TO_BASE(base); | ||
293 | size = DDR_REG_TO_SIZE(size); | ||
294 | orion_write(USB_WIN_CTRL(usb_if, i), | ||
295 | ((size-1) & 0xffff0000) | | ||
296 | (ATTR_DDR_CS(i) << 8) | | ||
297 | (TARGET_DDR << 4) | WIN_EN); | ||
298 | orion_write(USB_WIN_BASE(usb_if, i), | ||
299 | base & 0xffff0000); | ||
300 | } | ||
301 | } | ||
302 | } | ||
303 | } | ||
304 | |||
305 | void __init orion_setup_eth_wins(void) | 256 | void __init orion_setup_eth_wins(void) |
306 | { | 257 | { |
307 | int i; | 258 | int i; |
diff --git a/arch/arm/mach-orion/common.c b/arch/arm/mach-orion/common.c index cc16588e8c0c..d33c01dfc3f2 100644 --- a/arch/arm/mach-orion/common.c +++ b/arch/arm/mach-orion/common.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <asm/mach/arch.h> | 23 | #include <asm/mach/arch.h> |
24 | #include <asm/mach/map.h> | 24 | #include <asm/mach/map.h> |
25 | #include <asm/arch/hardware.h> | 25 | #include <asm/arch/hardware.h> |
26 | #include <asm/arch/platform.h> | ||
26 | #include "common.h" | 27 | #include "common.h" |
27 | 28 | ||
28 | /***************************************************************************** | 29 | /***************************************************************************** |
@@ -149,6 +150,10 @@ static struct resource orion_ehci1_resources[] = { | |||
149 | }, | 150 | }, |
150 | }; | 151 | }; |
151 | 152 | ||
153 | static struct orion_ehci_data orion_ehci_data = { | ||
154 | .dram = &orion_mbus_dram_info, | ||
155 | }; | ||
156 | |||
152 | static u64 ehci_dmamask = 0xffffffffUL; | 157 | static u64 ehci_dmamask = 0xffffffffUL; |
153 | 158 | ||
154 | static struct platform_device orion_ehci0 = { | 159 | static struct platform_device orion_ehci0 = { |
@@ -157,6 +162,7 @@ static struct platform_device orion_ehci0 = { | |||
157 | .dev = { | 162 | .dev = { |
158 | .dma_mask = &ehci_dmamask, | 163 | .dma_mask = &ehci_dmamask, |
159 | .coherent_dma_mask = 0xffffffff, | 164 | .coherent_dma_mask = 0xffffffff, |
165 | .platform_data = &orion_ehci_data, | ||
160 | }, | 166 | }, |
161 | .resource = orion_ehci0_resources, | 167 | .resource = orion_ehci0_resources, |
162 | .num_resources = ARRAY_SIZE(orion_ehci0_resources), | 168 | .num_resources = ARRAY_SIZE(orion_ehci0_resources), |
@@ -168,6 +174,7 @@ static struct platform_device orion_ehci1 = { | |||
168 | .dev = { | 174 | .dev = { |
169 | .dma_mask = &ehci_dmamask, | 175 | .dma_mask = &ehci_dmamask, |
170 | .coherent_dma_mask = 0xffffffff, | 176 | .coherent_dma_mask = 0xffffffff, |
177 | .platform_data = &orion_ehci_data, | ||
171 | }, | 178 | }, |
172 | .resource = orion_ehci1_resources, | 179 | .resource = orion_ehci1_resources, |
173 | .num_resources = ARRAY_SIZE(orion_ehci1_resources), | 180 | .num_resources = ARRAY_SIZE(orion_ehci1_resources), |
@@ -334,7 +341,6 @@ void __init orion_init(void) | |||
334 | * Setup Orion address map | 341 | * Setup Orion address map |
335 | */ | 342 | */ |
336 | orion_setup_cpu_wins(); | 343 | orion_setup_cpu_wins(); |
337 | orion_setup_usb_wins(); | ||
338 | orion_setup_eth_wins(); | 344 | orion_setup_eth_wins(); |
339 | if (dev == MV88F5182_DEV_ID) | 345 | if (dev == MV88F5182_DEV_ID) |
340 | orion_setup_sata_wins(); | 346 | orion_setup_sata_wins(); |
diff --git a/arch/arm/mach-orion/common.h b/arch/arm/mach-orion/common.h index 961daaa0b91b..c100355754f3 100644 --- a/arch/arm/mach-orion/common.h +++ b/arch/arm/mach-orion/common.h | |||
@@ -33,7 +33,6 @@ extern struct mbus_dram_target_info orion_mbus_dram_info; | |||
33 | void orion_setup_cpu_win(enum orion_target target, u32 base, u32 size, int remap); | 33 | void orion_setup_cpu_win(enum orion_target target, u32 base, u32 size, int remap); |
34 | void orion_setup_cpu_wins(void); | 34 | void orion_setup_cpu_wins(void); |
35 | void orion_setup_eth_wins(void); | 35 | void orion_setup_eth_wins(void); |
36 | void orion_setup_usb_wins(void); | ||
37 | void orion_setup_sata_wins(void); | 36 | void orion_setup_sata_wins(void); |
38 | 37 | ||
39 | /* | 38 | /* |