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>
This commit is contained in:
Adrian Chadd 2011-03-31 02:36:22 +00:00
parent bd119384c7
commit eab9f72a5a
2 changed files with 48 additions and 1 deletions

View File

@ -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
};

View File

@ -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 */