toolchain: switch to musl by default, except for mips64
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-3.18 / 190-bcma_hcd_add_bcm5301x_support.patch
1 Subject: [PATCH] bcma-hcd: add BCM5301x platform support
2
3 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
4 ---
5 --- a/drivers/usb/host/bcma-hcd.c
6 +++ b/drivers/usb/host/bcma-hcd.c
7 @@ -88,7 +88,7 @@ static void bcma_hcd_4716wa(struct bcma_
8 }
9
10 /* based on arch/mips/brcm-boards/bcm947xx/pcibios.c */
11 -static void bcma_hcd_init_chip(struct bcma_device *dev)
12 +static void bcma_hcd_init_chip_mips(struct bcma_device *dev)
13 {
14 u32 tmp;
15
16 @@ -159,6 +159,52 @@ static void bcma_hcd_init_chip(struct bc
17 }
18 }
19
20 +static void bcma_hcd_init_chip_arm(struct bcma_device *dev)
21 +{
22 + struct bcma_device *arm_core;
23 + void __iomem *dmu;
24 + u32 val;
25 +
26 + bcma_core_disable(dev, 0);
27 + bcma_core_enable(dev, 0);
28 +
29 + msleep(1);
30 +
31 + /* Set packet buffer OUT threshold */
32 + val = bcma_read32(dev, 0x94);
33 + val &= 0xffff;
34 + val |= 0x80 << 16;
35 + bcma_write32(dev, 0x94, val);
36 +
37 + /* Enable break memory transfer */
38 + val = bcma_read32(dev, 0x9c);
39 + val |= 1;
40 + bcma_write32(dev, 0x9c, val);
41 +
42 + if (dev->bus->chipinfo.pkg != BCMA_PKG_ID_BCM4707 &&
43 + dev->bus->chipinfo.pkg != BCMA_PKG_ID_BCM4708)
44 + return;
45 +
46 + arm_core = bcma_find_core(dev->bus, BCMA_CORE_ARMCA9);
47 + if (!arm_core)
48 + return;
49 +
50 + dmu = ioremap_nocache(arm_core->addr_s[0], 0x1000);
51 + if (!dmu)
52 + return;
53 +
54 + /* Unlock DMU PLL settings */
55 + iowrite32(0x0000ea68, dmu + 0x180);
56 +
57 + /* Write USB 2.0 PLL control setting */
58 + iowrite32(0x00dd10c3, dmu + 0x164);
59 +
60 + /* Lock DMU PLL settings */
61 + iowrite32(0x00000000, dmu + 0x180);
62 +
63 + iounmap(dmu);
64 +}
65 +
66 static const struct usb_ehci_pdata ehci_pdata = {
67 };
68
69 @@ -222,7 +268,8 @@ static int bcma_hcd_probe(struct bcma_de
70 chipinfo = &dev->bus->chipinfo;
71 /* USBcores are only connected on embedded devices. */
72 chipid_top = (chipinfo->id & 0xFF00);
73 - if (chipid_top != 0x4700 && chipid_top != 0x5300)
74 + if (chipid_top != 0x4700 && chipid_top != 0x5300 &&
75 + chipinfo->id != BCMA_CHIP_ID_BCM4707)
76 return -ENODEV;
77
78 /* TODO: Probably need checks here; is the core connected? */
79 @@ -234,7 +281,12 @@ static int bcma_hcd_probe(struct bcma_de
80 if (!usb_dev)
81 return -ENOMEM;
82
83 - bcma_hcd_init_chip(dev);
84 + if (IS_BUILTIN(CONFIG_ARCH_BCM_5301X) &&
85 + chipinfo->id == BCMA_CHIP_ID_BCM4707) {
86 + bcma_hcd_init_chip_arm(dev);
87 + } else if(IS_BUILTIN(CONFIG_BCM47XX)) {
88 + bcma_hcd_init_chip_mips(dev);
89 + }
90
91 /* In AI chips EHCI is addrspace 0, OHCI is 1 */
92 ohci_addr = dev->addr_s[0];
93 @@ -306,6 +358,7 @@ static int bcma_hcd_resume(struct bcma_d
94
95 static const struct bcma_device_id bcma_hcd_table[] = {
96 BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_USB20_HOST, BCMA_ANY_REV, BCMA_ANY_CLASS),
97 + BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_NS_USB20, BCMA_ANY_REV, BCMA_ANY_CLASS),
98 BCMA_CORETABLE_END
99 };
100 MODULE_DEVICE_TABLE(bcma, bcma_hcd_table);