aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-03-27 14:51:39 -0400
committerNicolas Pitre <nico@marvell.com>2008-03-27 14:51:39 -0400
commit92aecfa95523384923b52c8ddaf948fc02a53e82 (patch)
tree0bea3d5d3ee86b1540cecd5aeab9afa48919ee7d /drivers/usb
parent1f2223b12b62a97d66e39199db50ed3fae9222c0 (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 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-orion.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index e129981f139f..0f0eb89c8cf3 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -11,15 +11,19 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/mbus.h>
14#include <asm/arch/orion.h> 15#include <asm/arch/orion.h>
16#include <asm/arch/platform.h>
15 17
16#define rdl(off) __raw_readl(hcd->regs + (off)) 18#define rdl(off) __raw_readl(hcd->regs + (off))
17#define wrl(off, val) __raw_writel((val), hcd->regs + (off)) 19#define wrl(off, val) __raw_writel((val), hcd->regs + (off))
18 20
19#define USB_CAUSE 0x310
20#define USB_MASK 0x314
21#define USB_CMD 0x140 21#define USB_CMD 0x140
22#define USB_MODE 0x1a8 22#define USB_MODE 0x1a8
23#define USB_CAUSE 0x310
24#define USB_MASK 0x314
25#define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4))
26#define USB_WINDOW_BASE(i) (0x324 + ((i) << 4))
23#define USB_IPG 0x360 27#define USB_IPG 0x360
24#define USB_PHY_PWR_CTRL 0x400 28#define USB_PHY_PWR_CTRL 0x400
25#define USB_PHY_TX_CTRL 0x420 29#define USB_PHY_TX_CTRL 0x420
@@ -162,8 +166,30 @@ static const struct hc_driver ehci_orion_hc_driver = {
162 .bus_resume = ehci_bus_resume, 166 .bus_resume = ehci_bus_resume,
163}; 167};
164 168
169static void __init
170ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
171 struct mbus_dram_target_info *dram)
172{
173 int i;
174
175 for (i = 0; i < 4; i++) {
176 wrl(USB_WINDOW_CTRL(i), 0);
177 wrl(USB_WINDOW_BASE(i), 0);
178 }
179
180 for (i = 0; i < dram->num_cs; i++) {
181 struct mbus_dram_window *cs = dram->cs + i;
182
183 wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) |
184 (cs->mbus_attr << 8) |
185 (dram->mbus_dram_target_id << 4) | 1);
186 wrl(USB_WINDOW_BASE(i), cs->base);
187 }
188}
189
165static int __init ehci_orion_drv_probe(struct platform_device *pdev) 190static int __init ehci_orion_drv_probe(struct platform_device *pdev)
166{ 191{
192 struct orion_ehci_data *pd = pdev->dev.platform_data;
167 struct resource *res; 193 struct resource *res;
168 struct usb_hcd *hcd; 194 struct usb_hcd *hcd;
169 struct ehci_hcd *ehci; 195 struct ehci_hcd *ehci;
@@ -227,6 +253,12 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
227 ehci->sbrn = 0x20; 253 ehci->sbrn = 0x20;
228 254
229 /* 255 /*
256 * (Re-)program MBUS remapping windows if we are asked to.
257 */
258 if (pd != NULL && pd->dram != NULL)
259 ehci_orion_conf_mbus_windows(hcd, pd->dram);
260
261 /*
230 * setup Orion USB controller 262 * setup Orion USB controller
231 */ 263 */
232 orion_usb_setup(hcd); 264 orion_usb_setup(hcd);