Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2012 04:30:53 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239721 - head/sys/arm/at91
Message-ID:  <201208270430.q7R4Urrt038883@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Aug 27 04:30:53 2012
New Revision: 239721
URL: http://svn.freebsd.org/changeset/base/239721

Log:
  Add hint and sysctl support for 4 wire mode.
  
  PR:		155241
  Submitted by:	Ian Lapore

Modified:
  head/sys/arm/at91/at91_mci.c

Modified: head/sys/arm/at91/at91_mci.c
==============================================================================
--- head/sys/arm/at91/at91_mci.c	Mon Aug 27 04:08:43 2012	(r239720)
+++ head/sys/arm/at91/at91_mci.c	Mon Aug 27 04:30:53 2012	(r239721)
@@ -236,8 +236,10 @@ at91_mci_attach(device_t dev)
 	device_t child;
 	int err;
 
-	sc->dev = dev;
+	sctx = device_get_sysctl_ctx(dev);
+	soid = device_get_sysctl_tree(dev);
 
+	sc->dev = dev;
 	sc->sc_cap = 0;
 	if (at91_is_rm92())
 		sc->sc_cap |= CAP_NEEDS_BYTESWAP;
@@ -273,14 +275,18 @@ at91_mci_attach(device_t dev)
 		goto out;
 	}
 
-	sctx = device_get_sysctl_ctx(dev);
-	soid = device_get_sysctl_tree(dev);
-	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "4wire",
-	    CTLFLAG_RW, &sc->has_4wire, 0, "has 4 wire SD Card bus");
-
-#ifdef AT91_MCI_HAS_4WIRE
+	/*
+	 * Allow 4-wire to be initially set via #define.
+	 * Allow a device hint to override that.
+	 * Allow a sysctl to override that.
+	 */
+#if defined(AT91_MCI_HAS_4WIRE) && AT91_MCI_HAS_4WIRE != 0
 	sc->has_4wire = 1;
 #endif
+	resource_int_value(device_get_name(dev), device_get_unit(dev), 
+			   "4wire", &sc->has_4wire);
+	SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "4wire",
+	    CTLFLAG_RW, &sc->has_4wire, 0, "has 4 wire SD Card bus");
 	if (sc->has_4wire)
 		sc->sc_cap |= CAP_HAS_4WIRE;
 



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