From owner-svn-src-head@FreeBSD.ORG Tue Mar 18 12:19:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E562EAFC; Tue, 18 Mar 2014 12:19:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B7BB2817; Tue, 18 Mar 2014 12:19:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2ICJdRJ027921; Tue, 18 Mar 2014 12:19:39 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2ICJd6O027918; Tue, 18 Mar 2014 12:19:39 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201403181219.s2ICJd6O027918@svn.freebsd.org> From: Adrian Chadd Date: Tue, 18 Mar 2014 12:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r263296 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 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: Tue, 18 Mar 2014 12:19:40 -0000 Author: adrian Date: Tue Mar 18 12:19:39 2014 New Revision: 263296 URL: http://svnweb.freebsd.org/changeset/base/263296 Log: Extend the Atheros SoC support to include a method to enable/disable the NAND flash controller. Add the AR934x NAND flash controller reset routines. (It's different on subsequent SoCs.) Tested: * AR9344, Atheros DB120 reference platform Obtained from: OpenWRT Modified: head/sys/mips/atheros/ar71xx_cpudef.h head/sys/mips/atheros/ar934x_chip.c Modified: head/sys/mips/atheros/ar71xx_cpudef.h ============================================================================== --- head/sys/mips/atheros/ar71xx_cpudef.h Tue Mar 18 12:18:35 2014 (r263295) +++ head/sys/mips/atheros/ar71xx_cpudef.h Tue Mar 18 12:19:39 2014 (r263296) @@ -63,6 +63,8 @@ struct ar71xx_cpu_def { void (* ar71xx_chip_reset_wmac) (void); void (* ar71xx_chip_init_gmac) (void); + + void (* ar71xx_chip_reset_nfc) (int); }; extern struct ar71xx_cpu_def * ar71xx_cpu_ops; @@ -140,6 +142,13 @@ static inline void ar71xx_device_ddr_flu ar71xx_cpu_ops->ar71xx_chip_ddr_flush_ip2(); } +static inline void ar71xx_reset_nfc(int active) +{ + + if (ar71xx_cpu_ops->ar71xx_chip_reset_nfc) + ar71xx_cpu_ops->ar71xx_chip_reset_nfc(active); +} + /* XXX shouldn't be here! */ extern uint32_t u_ar71xx_refclk; extern uint32_t u_ar71xx_cpu_freq; Modified: head/sys/mips/atheros/ar934x_chip.c ============================================================================== --- head/sys/mips/atheros/ar934x_chip.c Tue Mar 18 12:18:35 2014 (r263295) +++ head/sys/mips/atheros/ar934x_chip.c Tue Mar 18 12:19:39 2014 (r263296) @@ -375,6 +375,7 @@ static void ar934x_chip_reset_wmac(void) { + /* XXX TODO */ } static void @@ -391,6 +392,31 @@ ar934x_chip_init_gmac(void) } } +/* + * Reset the NAND Flash Controller. + * + * + active=1 means "make it active". + * + active=0 means "make it inactive". + */ +static void +ar934x_chip_reset_nfc(int active) +{ + + if (active) { + ar71xx_device_start(AR934X_RESET_NANDF); + DELAY(100); + + ar71xx_device_start(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(250); + } else { + ar71xx_device_stop(AR934X_RESET_ETH_SWITCH_ANALOG); + DELAY(250); + + ar71xx_device_stop(AR934X_RESET_NANDF); + DELAY(100); + } +} + struct ar71xx_cpu_def ar934x_chip_def = { &ar934x_chip_detect_mem_size, &ar934x_chip_detect_sys_frequency, @@ -407,4 +433,5 @@ struct ar71xx_cpu_def ar934x_chip_def = &ar934x_chip_reset_ethernet_switch, &ar934x_chip_reset_wmac, &ar934x_chip_init_gmac, + &ar934x_chip_reset_nfc, };