Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91188
b: refs/heads/master
c: 92aecfa
h: refs/heads/master
v: v3
  • Loading branch information
Lennert Buytenhek authored and Nicolas Pitre committed Mar 27, 2008
1 parent b5fbbf3 commit d1f89df
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f2223b12b62a97d66e39199db50ed3fae9222c0
refs/heads/master: 92aecfa95523384923b52c8ddaf948fc02a53e82
49 changes: 0 additions & 49 deletions trunk/arch/arm/mach-orion/addr-map.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,6 @@
#define ETH_MAX_WIN 6
#define ETH_MAX_REMAP_WIN 4

/*
* USB Address Decode Windows registers
*/
#define USB_WIN_CTRL(i, w) ((i == 0) ? ORION_USB0_REG(0x320 + ((w) << 4)) \
: ORION_USB1_REG(0x320 + ((w) << 4)))
#define USB_WIN_BASE(i, w) ((i == 0) ? ORION_USB0_REG(0x324 + ((w) << 4)) \
: ORION_USB1_REG(0x324 + ((w) << 4)))
#define USB_MAX_WIN 4

/*
* SATA Address Decode Windows registers
*/
Expand Down Expand Up @@ -262,46 +253,6 @@ void __init orion_setup_cpu_wins(void)
orion_mbus_dram_info.num_cs = cs;
}

void __init orion_setup_usb_wins(void)
{
int i;
u32 usb_if, dev, rev;
u32 max_usb_if = 1;

orion_pcie_id(&dev, &rev);
if (dev == MV88F5182_DEV_ID)
max_usb_if = 2;

for (usb_if = 0; usb_if < max_usb_if; usb_if++) {
/*
* First, disable and clear windows
*/
for (i = 0; i < USB_MAX_WIN; i++) {
orion_write(USB_WIN_BASE(usb_if, i), 0);
orion_write(USB_WIN_CTRL(usb_if, i), 0);
}

/*
* Setup windows for DDR banks.
*/
for (i = 0; i < DDR_MAX_CS; i++) {
u32 base, size;
size = orion_read(DDR_SIZE_CS(i));
base = orion_read(DDR_BASE_CS(i));
if (size & DDR_BANK_EN) {
base = DDR_REG_TO_BASE(base);
size = DDR_REG_TO_SIZE(size);
orion_write(USB_WIN_CTRL(usb_if, i),
((size-1) & 0xffff0000) |
(ATTR_DDR_CS(i) << 8) |
(TARGET_DDR << 4) | WIN_EN);
orion_write(USB_WIN_BASE(usb_if, i),
base & 0xffff0000);
}
}
}
}

void __init orion_setup_eth_wins(void)
{
int i;
Expand Down
8 changes: 7 additions & 1 deletion trunk/arch/arm/mach-orion/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/arch/hardware.h>
#include <asm/arch/platform.h>
#include "common.h"

/*****************************************************************************
Expand Down Expand Up @@ -149,6 +150,10 @@ static struct resource orion_ehci1_resources[] = {
},
};

static struct orion_ehci_data orion_ehci_data = {
.dram = &orion_mbus_dram_info,
};

static u64 ehci_dmamask = 0xffffffffUL;

static struct platform_device orion_ehci0 = {
Expand All @@ -157,6 +162,7 @@ static struct platform_device orion_ehci0 = {
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = 0xffffffff,
.platform_data = &orion_ehci_data,
},
.resource = orion_ehci0_resources,
.num_resources = ARRAY_SIZE(orion_ehci0_resources),
Expand All @@ -168,6 +174,7 @@ static struct platform_device orion_ehci1 = {
.dev = {
.dma_mask = &ehci_dmamask,
.coherent_dma_mask = 0xffffffff,
.platform_data = &orion_ehci_data,
},
.resource = orion_ehci1_resources,
.num_resources = ARRAY_SIZE(orion_ehci1_resources),
Expand Down Expand Up @@ -334,7 +341,6 @@ void __init orion_init(void)
* Setup Orion address map
*/
orion_setup_cpu_wins();
orion_setup_usb_wins();
orion_setup_eth_wins();
if (dev == MV88F5182_DEV_ID)
orion_setup_sata_wins();
Expand Down
1 change: 0 additions & 1 deletion trunk/arch/arm/mach-orion/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ extern struct mbus_dram_target_info orion_mbus_dram_info;
void orion_setup_cpu_win(enum orion_target target, u32 base, u32 size, int remap);
void orion_setup_cpu_wins(void);
void orion_setup_eth_wins(void);
void orion_setup_usb_wins(void);
void orion_setup_sata_wins(void);

/*
Expand Down
36 changes: 34 additions & 2 deletions trunk/drivers/usb/host/ehci-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mbus.h>
#include <asm/arch/orion.h>
#include <asm/arch/platform.h>

#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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -226,6 +252,12 @@ static int __init ehci_orion_drv_probe(struct platform_device *pdev)
ehci->is_tdi_rh_tt = 1;
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
*/
Expand Down
9 changes: 9 additions & 0 deletions trunk/include/asm-arm/arch-orion/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
#ifndef __ASM_ARCH_PLATFORM_H__
#define __ASM_ARCH_PLATFORM_H__

/*
* Orion EHCI platform driver data.
*/
struct orion_ehci_data {
struct mbus_dram_target_info *dram;
};


/*
* Device bus NAND private data
*/
Expand All @@ -22,4 +30,5 @@ struct orion_nand_data {
u8 width; /* buswidth */
};


#endif

0 comments on commit d1f89df

Please sign in to comment.