Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jul 2013 04:18:35 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252863 - head/sys/arm/ti
Message-ID:  <201307060418.r664IZTh010490@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Sat Jul  6 04:18:34 2013
New Revision: 252863
URL: http://svnweb.freebsd.org/changeset/base/252863

Log:
  Don't clear the SYSCONFIG register on boot.
  
  This follows section 18.4.2.2 SD Soft Reset Flow in the TI AM335x Technical
  Reference Manual and seems to fix the "ti_mmchs0: Error: current cmd NULL,
  already done?" messages.

Modified:
  head/sys/arm/ti/ti_mmchs.c
  head/sys/arm/ti/ti_mmchs.h

Modified: head/sys/arm/ti/ti_mmchs.c
==============================================================================
--- head/sys/arm/ti/ti_mmchs.c	Sat Jul  6 04:13:47 2013	(r252862)
+++ head/sys/arm/ti/ti_mmchs.c	Sat Jul  6 04:18:34 2013	(r252863)
@@ -1327,7 +1327,7 @@ ti_mmchs_hw_init(device_t dev)
 	unsigned long timeout;
 	uint32_t sysctl;
 	uint32_t capa;
-	uint32_t con;
+	uint32_t con, sysconfig;
 
 	/* 1: Enable the controller and interface/functional clocks */
 	clk = MMC0_CLK + sc->device_id;
@@ -1344,7 +1344,9 @@ ti_mmchs_hw_init(device_t dev)
 	}
 
 	/* 2: Issue a softreset to the controller */
-	ti_mmchs_write_4(sc, MMCHS_SYSCONFIG, 0x0002);
+	sysconfig = ti_mmchs_read_4(sc, MMCHS_SYSCONFIG);
+	sysconfig |= MMCHS_SYSCONFIG_SRST;
+	ti_mmchs_write_4(sc, MMCHS_SYSCONFIG, sysconfig);
 	timeout = 100;
 	while ((ti_mmchs_read_4(sc, MMCHS_SYSSTATUS) & 0x01) == 0x0) {
 		DELAY(1000);

Modified: head/sys/arm/ti/ti_mmchs.h
==============================================================================
--- head/sys/arm/ti/ti_mmchs.h	Sat Jul  6 04:13:47 2013	(r252862)
+++ head/sys/arm/ti/ti_mmchs.h	Sat Jul  6 04:18:34 2013	(r252863)
@@ -67,6 +67,12 @@
 #define AM335X_MMCHS_REG_OFFSET     0x100
 
 /* Register bit settings */
+#define	MMCHS_SYSCONFIG_CLK_FUN	    (2 << 8)
+#define	MMCHS_SYSCONFIG_CLK_IFC	    (1 << 8)
+#define	MMCHS_SYSCONFIG_SIDL	    (2 << 3)
+#define	MMCHS_SYSCONFIG_ENW	    (1 << 2)
+#define	MMCHS_SYSCONFIG_SRST	    (1 << 1)
+#define	MMCHS_SYSCONFIG_AIDL	    (1 << 0)
 #define MMCHS_STAT_BADA             (1UL << 29)
 #define MMCHS_STAT_CERR             (1UL << 28)
 #define MMCHS_STAT_ACE              (1UL << 24)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307060418.r664IZTh010490>