From 92aecfa95523384923b52c8ddaf948fc02a53e82 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Thu, 27 Mar 2008 14:51:39 -0400 Subject: 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 Reviewed-by: Tzachi Perelstein Acked-by: Russell King Signed-off-by: Nicolas Pitre --- drivers/usb/host/ehci-orion.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'drivers/usb/host') diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index e129981..0f0eb89 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -11,15 +11,19 @@ #include #include #include +#include #include +#include #define rdl(off) __raw_readl(hcd->regs + (off)) #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) -#define USB_CAUSE 0x310 -#define USB_MASK 0x314 #define USB_CMD 0x140 #define USB_MODE 0x1a8 +#define USB_CAUSE 0x310 +#define USB_MASK 0x314 +#define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4)) +#define USB_WINDOW_BASE(i) (0x324 + ((i) << 4)) #define USB_IPG 0x360 #define USB_PHY_PWR_CTRL 0x400 #define USB_PHY_TX_CTRL 0x420 @@ -162,8 +166,30 @@ static const struct hc_driver ehci_orion_hc_driver = { .bus_resume = ehci_bus_resume, }; +static void __init +ehci_orion_conf_mbus_windows(struct usb_hcd *hcd, + struct mbus_dram_target_info *dram) +{ + int i; + + for (i = 0; i < 4; i++) { + wrl(USB_WINDOW_CTRL(i), 0); + wrl(USB_WINDOW_BASE(i), 0); + } + + for (i = 0; i < dram->num_cs; i++) { + struct mbus_dram_window *cs = dram->cs + i; + + wrl(USB_WINDOW_CTRL(i), ((cs->size - 1) & 0xffff0000) | + (cs->mbus_attr << 8) | + (dram->mbus_dram_target_id << 4) | 1); + wrl(USB_WINDOW_BASE(i), cs->base); + } +} + static int __init ehci_orion_drv_probe(struct platform_device *pdev) { + struct orion_ehci_data *pd = pdev->dev.platform_data; struct resource *res; struct usb_hcd *hcd; struct ehci_hcd *ehci; @@ -227,6 +253,12 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev) ehci->sbrn = 0x20; /* + * (Re-)program MBUS remapping windows if we are asked to. + */ + if (pd != NULL && pd->dram != NULL) + ehci_orion_conf_mbus_windows(hcd, pd->dram); + + /* * setup Orion USB controller */ orion_usb_setup(hcd); -- cgit v1.1 From 705a752162768fed3e2c26fba5bffdd3a3bd04f2 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Thu, 27 Mar 2008 14:51:40 -0400 Subject: plat-orion: make ehci-orion available for all Orion families Signed-off-by: Lennert Buytenhek Reviewed-by: Tzachi Perelstein Acked-by: Russell King Signed-off-by: Nicolas Pitre --- drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ehci-orion.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers/usb/host') diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 46ee7f4..85074cb 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1033,7 +1033,7 @@ MODULE_LICENSE ("GPL"); #define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver #endif -#ifdef CONFIG_ARCH_ORION +#ifdef CONFIG_PLAT_ORION #include "ehci-orion.c" #define PLATFORM_DRIVER ehci_orion_driver #endif diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 0f0eb89..d187d03 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c @@ -12,8 +12,7 @@ #include #include #include -#include -#include +#include #define rdl(off) __raw_readl(hcd->regs + (off)) #define wrl(off, val) __raw_writel((val), hcd->regs + (off)) -- cgit v1.1