* [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x
@ 2012-08-04 16:03 Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 1/3] MIPS: ath79: use a helper function for USB resource initialization Gabor Juhos
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Gabor Juhos @ 2012-08-04 16:03 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Gabor Juhos
This patch-set adds AR934x specific glue into the USB
platform device registration code. Additionally, it
registers the USB host controller device on the
DB120 board.
This depends on the following patch set:
v3 of 'MIPS: ath79: various fixes'
v3:
- rebase aginas v3.6-rc1
- fix AR934X_EHCI_SIZE
Gabor Juhos (3):
MIPS: ath79: use a helper function for USB resource initialization
MIPS: ath79: add USB platform setup code for AR934X
MIPS: ath79: register USB host controller on the DB120 board
arch/mips/ath79/dev-usb.c | 92 ++++++++++++++----------
arch/mips/ath79/mach-db120.c | 2 +
arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 7 ++
3 files changed, 65 insertions(+), 36 deletions(-)
--
1.7.10
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] MIPS: ath79: use a helper function for USB resource initialization
2012-08-04 16:03 [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x Gabor Juhos
@ 2012-08-04 16:03 ` Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 2/3] MIPS: ath79: add USB platform setup code for AR934X Gabor Juhos
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2012-08-04 16:03 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Gabor Juhos
This improves code readability, and ensures that
all resource fields will be initialized correctly.
Additionally, it helps to reduce the size of the
kernel image by using uninitialized resource
variables.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
arch/mips/ath79/dev-usb.c | 64 ++++++++++++++++++++-------------------------
1 file changed, 28 insertions(+), 36 deletions(-)
diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c
index b2a2311..87fe48e 100644
--- a/arch/mips/ath79/dev-usb.c
+++ b/arch/mips/ath79/dev-usb.c
@@ -25,17 +25,7 @@
#include "common.h"
#include "dev-usb.h"
-static struct resource ath79_ohci_resources[] = {
- [0] = {
- /* .start and .end fields are filled dynamically */
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = ATH79_MISC_IRQ_OHCI,
- .end = ATH79_MISC_IRQ_OHCI,
- .flags = IORESOURCE_IRQ,
- },
-};
+static struct resource ath79_ohci_resources[2];
static u64 ath79_ohci_dmamask = DMA_BIT_MASK(32);
@@ -54,17 +44,7 @@ static struct platform_device ath79_ohci_device = {
},
};
-static struct resource ath79_ehci_resources[] = {
- [0] = {
- /* .start and .end fields are filled dynamically */
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = ATH79_CPU_IRQ_USB,
- .end = ATH79_CPU_IRQ_USB,
- .flags = IORESOURCE_IRQ,
- },
-};
+static struct resource ath79_ehci_resources[2];
static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32);
@@ -90,6 +70,20 @@ static struct platform_device ath79_ehci_device = {
},
};
+static void __init ath79_usb_init_resource(struct resource res[2],
+ unsigned long base,
+ unsigned long size,
+ int irq)
+{
+ res[0].flags = IORESOURCE_MEM;
+ res[0].start = base;
+ res[0].end = base + size - 1;
+
+ res[1].flags = IORESOURCE_IRQ;
+ res[1].start = irq;
+ res[1].end = irq;
+}
+
#define AR71XX_USB_RESET_MASK (AR71XX_RESET_USB_HOST | \
AR71XX_RESET_USB_PHY | \
AR71XX_RESET_USB_OHCI_DLL)
@@ -114,12 +108,12 @@ static void __init ath79_usb_setup(void)
mdelay(900);
- ath79_ohci_resources[0].start = AR71XX_OHCI_BASE;
- ath79_ohci_resources[0].end = AR71XX_OHCI_BASE + AR71XX_OHCI_SIZE - 1;
+ ath79_usb_init_resource(ath79_ohci_resources, AR71XX_OHCI_BASE,
+ AR71XX_OHCI_SIZE, ATH79_MISC_IRQ_OHCI);
platform_device_register(&ath79_ohci_device);
- ath79_ehci_resources[0].start = AR71XX_EHCI_BASE;
- ath79_ehci_resources[0].end = AR71XX_EHCI_BASE + AR71XX_EHCI_SIZE - 1;
+ ath79_usb_init_resource(ath79_ehci_resources, AR71XX_EHCI_BASE,
+ AR71XX_EHCI_SIZE, ATH79_CPU_IRQ_USB);
ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v1;
platform_device_register(&ath79_ehci_device);
}
@@ -143,10 +137,8 @@ static void __init ar7240_usb_setup(void)
iounmap(usb_ctrl_base);
- ath79_ohci_resources[0].start = AR7240_OHCI_BASE;
- ath79_ohci_resources[0].end = AR7240_OHCI_BASE + AR7240_OHCI_SIZE - 1;
- ath79_ohci_resources[1].start = ATH79_CPU_IRQ_USB;
- ath79_ohci_resources[1].end = ATH79_CPU_IRQ_USB;
+ ath79_usb_init_resource(ath79_ohci_resources, AR7240_OHCI_BASE,
+ AR7240_OHCI_SIZE, ATH79_CPU_IRQ_USB);
platform_device_register(&ath79_ohci_device);
}
@@ -161,8 +153,8 @@ static void __init ar724x_usb_setup(void)
ath79_device_reset_clear(AR724X_RESET_USB_PHY);
mdelay(10);
- ath79_ehci_resources[0].start = AR724X_EHCI_BASE;
- ath79_ehci_resources[0].end = AR724X_EHCI_BASE + AR724X_EHCI_SIZE - 1;
+ ath79_usb_init_resource(ath79_ehci_resources, AR724X_EHCI_BASE,
+ AR724X_EHCI_SIZE, ATH79_CPU_IRQ_USB);
ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
platform_device_register(&ath79_ehci_device);
}
@@ -178,8 +170,8 @@ static void __init ar913x_usb_setup(void)
ath79_device_reset_clear(AR913X_RESET_USB_PHY);
mdelay(10);
- ath79_ehci_resources[0].start = AR913X_EHCI_BASE;
- ath79_ehci_resources[0].end = AR913X_EHCI_BASE + AR913X_EHCI_SIZE - 1;
+ ath79_usb_init_resource(ath79_ehci_resources, AR913X_EHCI_BASE,
+ AR913X_EHCI_SIZE, ATH79_CPU_IRQ_USB);
ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
platform_device_register(&ath79_ehci_device);
}
@@ -195,8 +187,8 @@ static void __init ar933x_usb_setup(void)
ath79_device_reset_clear(AR933X_RESET_USB_PHY);
mdelay(10);
- ath79_ehci_resources[0].start = AR933X_EHCI_BASE;
- ath79_ehci_resources[0].end = AR933X_EHCI_BASE + AR933X_EHCI_SIZE - 1;
+ ath79_usb_init_resource(ath79_ehci_resources, AR933X_EHCI_BASE,
+ AR933X_EHCI_SIZE, ATH79_CPU_IRQ_USB);
ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
platform_device_register(&ath79_ehci_device);
}
--
1.7.10
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] MIPS: ath79: add USB platform setup code for AR934X
2012-08-04 16:03 [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 1/3] MIPS: ath79: use a helper function for USB resource initialization Gabor Juhos
@ 2012-08-04 16:03 ` Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 3/3] MIPS: ath79: register USB host controller on the DB120 board Gabor Juhos
2012-08-28 10:32 ` [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x John Crispin
3 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2012-08-04 16:03 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Gabor Juhos
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
arch/mips/ath79/dev-usb.c | 28 ++++++++++++++++++++++++
arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 7 ++++++
2 files changed, 35 insertions(+)
diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c
index 87fe48e..072bb9b 100644
--- a/arch/mips/ath79/dev-usb.c
+++ b/arch/mips/ath79/dev-usb.c
@@ -193,6 +193,32 @@ static void __init ar933x_usb_setup(void)
platform_device_register(&ath79_ehci_device);
}
+static void __init ar934x_usb_setup(void)
+{
+ u32 bootstrap;
+
+ bootstrap = ath79_reset_rr(AR934X_RESET_REG_BOOTSTRAP);
+ if (bootstrap & AR934X_BOOTSTRAP_USB_MODE_DEVICE)
+ return;
+
+ ath79_device_reset_set(AR934X_RESET_USBSUS_OVERRIDE);
+ udelay(1000);
+
+ ath79_device_reset_clear(AR934X_RESET_USB_PHY);
+ udelay(1000);
+
+ ath79_device_reset_clear(AR934X_RESET_USB_PHY_ANALOG);
+ udelay(1000);
+
+ ath79_device_reset_clear(AR934X_RESET_USB_HOST);
+ udelay(1000);
+
+ ath79_usb_init_resource(ath79_ehci_resources, AR934X_EHCI_BASE,
+ AR934X_EHCI_SIZE, ATH79_CPU_IRQ_USB);
+ ath79_ehci_device.dev.platform_data = &ath79_ehci_pdata_v2;
+ platform_device_register(&ath79_ehci_device);
+}
+
void __init ath79_register_usb(void)
{
if (soc_is_ar71xx())
@@ -205,6 +231,8 @@ void __init ath79_register_usb(void)
ar913x_usb_setup();
else if (soc_is_ar933x())
ar933x_usb_setup();
+ else if (soc_is_ar934x())
+ ar934x_usb_setup();
else
BUG();
}
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
index dde5044..3ccae12 100644
--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
@@ -63,6 +63,8 @@
#define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
#define AR934X_WMAC_SIZE 0x20000
+#define AR934X_EHCI_BASE 0x1b000000
+#define AR934X_EHCI_SIZE 0x200
/*
* DDR_CTRL block
@@ -288,6 +290,11 @@
#define AR933X_RESET_USB_PHY BIT(4)
#define AR933X_RESET_USBSUS_OVERRIDE BIT(3)
+#define AR934X_RESET_USB_PHY_ANALOG BIT(11)
+#define AR934X_RESET_USB_HOST BIT(5)
+#define AR934X_RESET_USB_PHY BIT(4)
+#define AR934X_RESET_USBSUS_OVERRIDE BIT(3)
+
#define AR933X_BOOTSTRAP_REF_CLK_40 BIT(0)
#define AR934X_BOOTSTRAP_SW_OPTION8 BIT(23)
--
1.7.10
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] MIPS: ath79: register USB host controller on the DB120 board
2012-08-04 16:03 [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 1/3] MIPS: ath79: use a helper function for USB resource initialization Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 2/3] MIPS: ath79: add USB platform setup code for AR934X Gabor Juhos
@ 2012-08-04 16:03 ` Gabor Juhos
2012-08-28 10:32 ` [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x John Crispin
3 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2012-08-04 16:03 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Gabor Juhos
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
arch/mips/ath79/mach-db120.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/ath79/mach-db120.c b/arch/mips/ath79/mach-db120.c
index 1983e4d..42f540a 100644
--- a/arch/mips/ath79/mach-db120.c
+++ b/arch/mips/ath79/mach-db120.c
@@ -25,6 +25,7 @@
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-spi.h"
+#include "dev-usb.h"
#include "dev-wmac.h"
#include "pci.h"
@@ -126,6 +127,7 @@ static void __init db120_setup(void)
db120_gpio_keys);
ath79_register_spi(&db120_spi_data, db120_spi_info,
ARRAY_SIZE(db120_spi_info));
+ ath79_register_usb();
ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET);
db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET);
}
--
1.7.10
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x
2012-08-04 16:03 [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x Gabor Juhos
` (2 preceding siblings ...)
2012-08-04 16:03 ` [PATCH v3 3/3] MIPS: ath79: register USB host controller on the DB120 board Gabor Juhos
@ 2012-08-28 10:32 ` John Crispin
2012-08-28 10:40 ` Gabor Juhos
3 siblings, 1 reply; 6+ messages in thread
From: John Crispin @ 2012-08-28 10:32 UTC (permalink / raw)
To: linux-mips
On 04/08/12 18:03, Gabor Juhos wrote:
> This patch-set adds AR934x specific glue into the USB
> platform device registration code. Additionally, it
> registers the USB host controller device on the
> DB120 board.
>
> This depends on the following patch set:
> v3 of 'MIPS: ath79: various fixes'
>
> v3:
> - rebase aginas v3.6-rc1
> - fix AR934X_EHCI_SIZE
>
> Gabor Juhos (3):
> MIPS: ath79: use a helper function for USB resource initialization
> MIPS: ath79: add USB platform setup code for AR934X
> MIPS: ath79: register USB host controller on the DB120 board
>
> arch/mips/ath79/dev-usb.c | 92 ++++++++++++++----------
> arch/mips/ath79/mach-db120.c | 2 +
> arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 7 ++
> 3 files changed, 65 insertions(+), 36 deletions(-)
>
> --
> 1.7.10
Linus pulled the pre-req series into his tree so I queued this one for 3.7
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x
2012-08-28 10:32 ` [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x John Crispin
@ 2012-08-28 10:40 ` Gabor Juhos
0 siblings, 0 replies; 6+ messages in thread
From: Gabor Juhos @ 2012-08-28 10:40 UTC (permalink / raw)
To: John Crispin; +Cc: linux-mips
2012.08.28. 12:32 keltezéssel, John Crispin írta:
> On 04/08/12 18:03, Gabor Juhos wrote:
>> This patch-set adds AR934x specific glue into the USB
>> platform device registration code. Additionally, it
>> registers the USB host controller device on the
>> DB120 board.
>>
>> This depends on the following patch set:
>> v3 of 'MIPS: ath79: various fixes'
>>
>> v3:
>> - rebase aginas v3.6-rc1
>> - fix AR934X_EHCI_SIZE
>>
>> Gabor Juhos (3):
>> MIPS: ath79: use a helper function for USB resource initialization
>> MIPS: ath79: add USB platform setup code for AR934X
>> MIPS: ath79: register USB host controller on the DB120 board
>>
>> arch/mips/ath79/dev-usb.c | 92 ++++++++++++++----------
>> arch/mips/ath79/mach-db120.c | 2 +
>> arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 7 ++
>> 3 files changed, 65 insertions(+), 36 deletions(-)
>>
>> --
>> 1.7.10
>
> Linus pulled the pre-req series into his tree so I queued this one for 3.7
Thanks!
-Gabor
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-08-28 10:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-04 16:03 [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 1/3] MIPS: ath79: use a helper function for USB resource initialization Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 2/3] MIPS: ath79: add USB platform setup code for AR934X Gabor Juhos
2012-08-04 16:03 ` [PATCH v3 3/3] MIPS: ath79: register USB host controller on the DB120 board Gabor Juhos
2012-08-28 10:32 ` [PATCH v3 0/3] MIPS: ath79: allow to use USB on AR934x John Crispin
2012-08-28 10:40 ` Gabor Juhos
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.