Skip to content

Commit 9c7a86c

Browse files
hauketsbogend
authored andcommitted
MIPS: lantiq: improve USB initialization
This adds code to initialize the USB controller and PHY also on Danube, Amazon SE and AR10. This code is based on the Vendor driver from different UGW versions and compared to the hardware documentation. This patch is included in OpenWrt for many years. Signed-off-by: Hauke Mehrtens <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 680e786 commit 9c7a86c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arch/mips/lantiq/xway/sysctrl.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,25 @@ static void pmu_disable(struct clk *clk)
247247
pr_warn("deactivating PMU module failed!");
248248
}
249249

250+
static void usb_set_clock(void)
251+
{
252+
unsigned int val = ltq_cgu_r32(ifccr);
253+
254+
if (of_machine_is_compatible("lantiq,ar10") ||
255+
of_machine_is_compatible("lantiq,grx390")) {
256+
val &= ~0x03; /* XTAL divided by 3 */
257+
} else if (of_machine_is_compatible("lantiq,ar9") ||
258+
of_machine_is_compatible("lantiq,vr9")) {
259+
/* TODO: this depends on the XTAL frequency */
260+
val |= 0x03; /* XTAL divided by 3 */
261+
} else if (of_machine_is_compatible("lantiq,ase")) {
262+
val |= 0x20; /* from XTAL */
263+
} else if (of_machine_is_compatible("lantiq,danube")) {
264+
val |= 0x30; /* 12 MHz, generated from 36 MHz */
265+
}
266+
ltq_cgu_w32(val, ifccr);
267+
}
268+
250269
/* the pci enable helper */
251270
static int pci_enable(struct clk *clk)
252271
{
@@ -588,4 +607,5 @@ void __init ltq_soc_init(void)
588607
clkdev_add_pmu("1e116000.mei", "dfe", 1, 0, PMU_DFE);
589608
clkdev_add_pmu("1e100400.serial", NULL, 1, 0, PMU_ASC0);
590609
}
610+
usb_set_clock();
591611
}

0 commit comments

Comments
 (0)