Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 2015 18:35:03 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281863 - head/sys/arm/broadcom/bcm2835
Message-ID:  <201504221835.t3MIZ3ud018105@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Wed Apr 22 18:35:02 2015
New Revision: 281863
URL: https://svnweb.freebsd.org/changeset/base/281863

Log:
  Fetch the SDHCI frequency from videocore (our prefered source) and only if
  it fails, fetch the clock-frequency from DTB.
  
  If both methods fail, use the hardcoded default.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Wed Apr 22 18:15:18 2015	(r281862)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c	Wed Apr 22 18:35:02 2015	(r281863)
@@ -181,17 +181,16 @@ bcm_sdhci_attach(device_t dev)
 	if (err == 0) {
 		/* Convert to MHz */
 		default_freq /= 1000000;
-		if (bootverbose)
-			device_printf(dev, "default frequency: %dMHz\n",
-			    default_freq);
+	}
+	if (default_freq == 0) {
+		node = ofw_bus_get_node(sc->sc_dev);
+		if ((OF_getencprop(node, "clock-frequency", &cell,
+		    sizeof(cell))) > 0)
+			default_freq = cell / 1000000;
 	}
 	if (default_freq == 0)
 		default_freq = BCM2835_DEFAULT_SDHCI_FREQ;
 
-	node = ofw_bus_get_node(sc->sc_dev);
-	if ((OF_getprop(node, "clock-frequency", &cell, sizeof(cell))) > 0)
-		default_freq = fdt32_to_cpu(cell)/1000000;
-
 	if (bootverbose)
 		device_printf(dev, "SDHCI frequency: %dMHz\n", default_freq);
 



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