Root/target/linux/ar71xx/patches-3.6/002-MIPS-ath79-add-USB-platform-setup-code-for-AR934X.patch

1From 9d9e4d955b1def6d63470bcf45e8ead1b2ae4892 Mon Sep 17 00:00:00 2001
2From: Gabor Juhos <juhosg@openwrt.org>
3Date: Sat, 4 Aug 2012 15:03:56 +0000
4Subject: [PATCH] MIPS: ath79: add USB platform setup code for AR934X
5
6commit 00ffed582fe8a3f7556593c0e8baaf3da3df85b0 upstream.
7
8Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
9Patchwork: http://patchwork.linux-mips.org/patch/4172/
10Signed-off-by: John Crispin <blogic@openwrt.org>
11
12Conflicts:
13
14    arch/mips/include/asm/mach-ath79/ar71xx_regs.h
15---
16 arch/mips/ath79/dev-usb.c | 28 ++++++++++++++++++++++++
17 arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 7 ++++++
18 2 files changed, 35 insertions(+)
19
20--- a/arch/mips/ath79/dev-usb.c
21+++ b/arch/mips/ath79/dev-usb.c
22@@ -193,6 +193,32 @@ static void __init ar933x_usb_setup(void
23     platform_device_register(&ath79_ehci_device);
24 }
25 
26+static void __init ar934x_usb_setup(void)
27+{
28+ u32 bootstrap;
29+
30+ bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
31+ if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
32+ return;
33+
34+ ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
35+ udelay(1000);
36+
37+ ath79_device_reset_clear(AR934X_RESET_USB_PHY);
38+ udelay(1000);
39+
40+ ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
41+ udelay(1000);
42+
43+ ath79_device_reset_clear(AR934X_RESET_USB_HOST);
44+ udelay(1000);
45+
46+ ath79_usb_init_resource(ath79_ehci_resources, AR934X_EHCI_BASE,
47+ AR934X_EHCI_SIZE, ATH79_CPU_IRQ_USB);
48+ ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
49+ platform_device_register(&ath79_ehci_device);
50+}
51+
52 void __init ath79_register_usb(void)
53 {
54     if (soc_is_ar71xx())
55@@ -205,6 +231,8 @@ void __init ath79_register_usb(void)
56         ar913x_usb_setup();
57     else if (soc_is_ar933x())
58         ar933x_usb_setup();
59+ else if (soc_is_ar934x())
60+ ar934x_usb_setup();
61     else
62         BUG();
63 }
64--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
65+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
66@@ -65,6 +65,8 @@
67 #define AR934X_WMAC_SIZE 0x20000
68 #define AR934X_SRIF_BASE (AR71XX_APB_BASE + 0x00116000)
69 #define AR934X_SRIF_SIZE 0x1000
70+#define AR934X_EHCI_BASE 0x1b000000
71+#define AR934X_EHCI_SIZE 0x200
72 
73 /*
74  * DDR_CTRL block
75@@ -290,6 +292,11 @@
76 #define AR933X_RESET_USB_PHY BIT(4)
77 #define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
78 
79+#define AR934X_RESET_USB_PHY_ANALOG BIT(11)
80+#define AR934X_RESET_USB_HOST BIT(5)
81+#define AR934X_RESET_USB_PHY BIT(4)
82+#define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
83+
84 #define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
85 
86 #define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
87

Archive Download this file



interactive