From owner-svn-src-head@FreeBSD.ORG Thu Mar 31 02:36:22 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1FBF106564A; Thu, 31 Mar 2011 02:36:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C74AB8FC21; Thu, 31 Mar 2011 02:36:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p2V2aMLX088679; Thu, 31 Mar 2011 02:36:22 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p2V2aMwD088676; Thu, 31 Mar 2011 02:36:22 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201103310236.p2V2aMwD088676@svn.freebsd.org> From: Adrian Chadd Date: Thu, 31 Mar 2011 02:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r220180 - head/sys/mips/atheros X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Mar 2011 02:36:23 -0000 Author: adrian Date: Thu Mar 31 02:36:22 2011 New Revision: 220180 URL: http://svn.freebsd.org/changeset/base/220180 Log: 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 Modified: head/sys/mips/atheros/ar724x_chip.c head/sys/mips/atheros/ar724xreg.h Modified: head/sys/mips/atheros/ar724x_chip.c ============================================================================== --- head/sys/mips/atheros/ar724x_chip.c Thu Mar 31 01:14:06 2011 (r220179) +++ head/sys/mips/atheros/ar724x_chip.c Thu Mar 31 02:36:22 2011 (r220180) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include static void @@ -151,6 +152,50 @@ ar724x_chip_get_eth_pll(unsigned int mac 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 }; Modified: head/sys/mips/atheros/ar724xreg.h ============================================================================== --- head/sys/mips/atheros/ar724xreg.h Thu Mar 31 01:14:06 2011 (r220179) +++ head/sys/mips/atheros/ar724xreg.h Thu Mar 31 02:36:22 2011 (r220180) @@ -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 */