summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2011-03-31 02:36:22 +0000
committeradrian <adrian@FreeBSD.org>2011-03-31 02:36:22 +0000
commit9c147e526d5f9ce2c5e278840951eca92ddc10b6 (patch)
treedf4aa7bf3ae66dbd6eaed75ef7c2694ecd204487 /sys/mips
parent0d8889331268513fb67163106bca98ffe96409de (diff)
downloadFreeBSD-src-9c147e526d5f9ce2c5e278840951eca92ddc10b6.zip
FreeBSD-src-9c147e526d5f9ce2c5e278840951eca92ddc10b6.tar.gz
Implement AR724x USB initialisation code.
This (again) still requires an offset for the AR913x/AR724x before USB will function. Submitted by: Luiz Otavio O Souzau <loos.br@gmail.com>
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/atheros/ar724x_chip.c47
-rw-r--r--sys/mips/atheros/ar724xreg.h2
2 files changed, 48 insertions, 1 deletions
diff --git a/sys/mips/atheros/ar724x_chip.c b/sys/mips/atheros/ar724x_chip.c
index 63a8ffb..70192de 100644
--- a/sys/mips/atheros/ar724x_chip.c
+++ b/sys/mips/atheros/ar724x_chip.c
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include <mips/atheros/ar724xreg.h>
#include <mips/atheros/ar71xx_cpudef.h>
+#include <mips/atheros/ar71xx_setup.h>
#include <mips/atheros/ar724x_chip.h>
static void
@@ -151,6 +152,50 @@ ar724x_chip_get_eth_pll(unsigned int mac, int speed)
return 0;
}
+static void
+ar724x_chip_init_usb_peripheral(void)
+{
+
+ switch (ar71xx_soc) {
+ case AR71XX_SOC_AR7240:
+
+ ar71xx_device_stop(AR724X_RESET_MODULE_USB_OHCI_DLL |
+ AR724X_RESET_USB_HOST);
+ DELAY(1000);
+
+ ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL |
+ AR724X_RESET_USB_HOST);
+ DELAY(1000);
+
+ /*
+ * WAR for HW bug. Here it adjusts the duration
+ * between two SOFS.
+ */
+ ATH_WRITE_REG(AR71XX_USB_CTRL_FLADJ,
+ (3 << USB_CTRL_FLADJ_A0_SHIFT));
+
+ break;
+
+ case AR71XX_SOC_AR7241:
+ case AR71XX_SOC_AR7242:
+
+ ar71xx_device_start(AR724X_RESET_MODULE_USB_OHCI_DLL);
+ DELAY(100);
+
+ ar71xx_device_start(AR724X_RESET_USB_HOST);
+ DELAY(100);
+
+ ar71xx_device_start(AR724X_RESET_USB_PHY);
+ DELAY(100);
+
+ break;
+
+ default:
+ /* fallthrough */
+ break;
+ }
+}
+
struct ar71xx_cpu_def ar724x_chip_def = {
&ar724x_chip_detect_mem_size,
&ar724x_chip_detect_sys_frequency,
@@ -163,5 +208,5 @@ struct ar71xx_cpu_def ar724x_chip_def = {
&ar724x_chip_ddr_flush_ge1,
&ar724x_chip_get_eth_pll,
NULL, /* ar71xx_chip_irq_flush_ip2 */
- NULL /* ar71xx_chip_init_usb_peripheral */
+ &ar724x_chip_init_usb_peripheral
};
diff --git a/sys/mips/atheros/ar724xreg.h b/sys/mips/atheros/ar724xreg.h
index ad3fa78..ab83e00 100644
--- a/sys/mips/atheros/ar724xreg.h
+++ b/sys/mips/atheros/ar724xreg.h
@@ -51,6 +51,8 @@
#define AR724X_DDR_REG_FLUSH_GE1 (AR71XX_DDR_CONFIG + 0x80)
#define AR724X_RESET_REG_RESET_MODULE AR71XX_RST_BLOCK_BASE + 0x1c
+#define AR724X_RESET_USB_HOST (1 << 5)
+#define AR724X_RESET_USB_PHY (1 << 4)
#define AR724X_RESET_MODULE_USB_OHCI_DLL (1 << 3)
/* XXX so USB requires different init code? -adrian */
OpenPOWER on IntegriCloud