Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 342329
b: refs/heads/master
c: 77dae54
h: refs/heads/master
i:
  342327: bb9c23b
v: v3
  • Loading branch information
Andrew Lunn authored and Jason Cooper committed Nov 24, 2012
1 parent 5085993 commit d77a59c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 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: ec65aed950d619c6ec9883679631bdf6e7aa4527
refs/heads/master: 77dae54ab385033e488d8b07045bc7f8d931740f
15 changes: 15 additions & 0 deletions trunk/Documentation/devicetree/bindings/usb/ehci-orion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* EHCI controller, Orion Marvell variants

Required properties:
- compatible: must be "marvell,orion-ehci"
- reg: physical base address of the controller and length of memory mapped
region.
- interrupts: The EHCI interrupt

Example:

ehci@50000 {
compatible = "marvell,orion-ehci";
reg = <0x50000 0x1000>;
interrupts = <19>;
};
38 changes: 35 additions & 3 deletions trunk/drivers/usb/host/ehci-orion.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <linux/mbus.h>
#include <linux/clk.h>
#include <linux/platform_data/usb-ehci-orion.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_irq.h>

#define rdl(off) __raw_readl(hcd->regs + (off))
#define wrl(off, val) __raw_writel((val), hcd->regs + (off))
Expand Down Expand Up @@ -181,6 +184,8 @@ ehci_orion_conf_mbus_windows(struct usb_hcd *hcd,
}
}

static u64 ehci_orion_dma_mask = DMA_BIT_MASK(32);

static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
{
struct orion_ehci_data *pd = pdev->dev.platform_data;
Expand All @@ -191,13 +196,17 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
struct clk *clk;
void __iomem *regs;
int irq, err;
enum orion_ehci_phy_ver phy_version;

if (usb_disabled())
return -ENODEV;

pr_debug("Initializing Orion-SoC USB Host Controller\n");

irq = platform_get_irq(pdev, 0);
if (pdev->dev.of_node)
irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
else
irq = platform_get_irq(pdev, 0);
if (irq <= 0) {
dev_err(&pdev->dev,
"Found HC with no IRQ. Check %s setup!\n",
Expand All @@ -215,6 +224,14 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
goto err1;
}

/*
* Right now device-tree probed devices don't get dma_mask
* set. Since shared usb code relies on it, set it here for
* now. Once we have dma capability bindings this can go away.
*/
if (!pdev->dev.dma_mask)
pdev->dev.dma_mask = &ehci_orion_dma_mask;

if (!request_mem_region(res->start, resource_size(res),
ehci_orion_hc_driver.description)) {
dev_dbg(&pdev->dev, "controller already in use\n");
Expand Down Expand Up @@ -262,7 +279,12 @@ static int __devinit ehci_orion_drv_probe(struct platform_device *pdev)
/*
* setup Orion USB controller.
*/
switch (pd->phy_version) {
if (pdev->dev.of_node)
phy_version = EHCI_PHY_NA;
else
phy_version = pd->phy_version;

switch (phy_version) {
case EHCI_PHY_NA: /* dont change USB phy settings */
break;
case EHCI_PHY_ORION:
Expand Down Expand Up @@ -317,9 +339,19 @@ static int __exit ehci_orion_drv_remove(struct platform_device *pdev)

MODULE_ALIAS("platform:orion-ehci");

static const struct of_device_id ehci_orion_dt_ids[] __devinitdata = {
{ .compatible = "marvell,orion-ehci", },
{},
};
MODULE_DEVICE_TABLE(of, ehci_orion_dt_ids);

static struct platform_driver ehci_orion_driver = {
.probe = ehci_orion_drv_probe,
.remove = __exit_p(ehci_orion_drv_remove),
.shutdown = usb_hcd_platform_shutdown,
.driver.name = "orion-ehci",
.driver = {
.name = "orion-ehci",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(ehci_orion_dt_ids),
},
};

0 comments on commit d77a59c

Please sign in to comment.