Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 May 2014 01:28:19 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265208 - in head/sys: boot/fdt/dts/arm dev/sdhci
Message-ID:  <201405020128.s421SJeR056626@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Fri May  2 01:28:19 2014
New Revision: 265208
URL: http://svnweb.freebsd.org/changeset/base/265208

Log:
  Honor the max-frequency property if it appears in the fdt data.
  Adjust the exynos and zedboard dts files to use max-frequency (the
  documented standard property) instead of clock-frequency.
  
  Submitted by:	Thomas Skibo <ThomasSkibo@sbcglobal.net>

Modified:
  head/sys/boot/fdt/dts/arm/exynos5250.dtsi
  head/sys/boot/fdt/dts/arm/zedboard.dts
  head/sys/dev/sdhci/sdhci_fdt.c

Modified: head/sys/boot/fdt/dts/arm/exynos5250.dtsi
==============================================================================
--- head/sys/boot/fdt/dts/arm/exynos5250.dtsi	Fri May  2 01:20:13 2014	(r265207)
+++ head/sys/boot/fdt/dts/arm/exynos5250.dtsi	Fri May  2 01:28:19 2014	(r265208)
@@ -126,7 +126,7 @@
 			reg = <0x12200000 0x1000>;
 			interrupts = <107>;
 			interrupt-parent = <&GIC>;
-			clock-frequency = <24000000>; /* TODO: verify freq */
+			max-frequency = <24000000>; /* TODO: verify freq */
 		};
 
 		sdhci@12210000 {
@@ -134,7 +134,7 @@
 			reg = <0x12210000 0x1000>;
 			interrupts = <108>;
 			interrupt-parent = <&GIC>;
-			clock-frequency = <24000000>;
+			max-frequency = <24000000>;
 		};
 
 		sdhci@12220000 {
@@ -142,7 +142,7 @@
 			reg = <0x12220000 0x1000>;
 			interrupts = <109>;
 			interrupt-parent = <&GIC>;
-			clock-frequency = <24000000>;
+			max-frequency = <24000000>;
 		};
 
 		sdhci@12230000 {
@@ -150,7 +150,7 @@
 			reg = <0x12230000 0x1000>;
 			interrupts = <110>;
 			interrupt-parent = <&GIC>;
-			clock-frequency = <24000000>;
+			max-frequency = <24000000>;
 		};
 
 		serial0: serial@12C00000 {

Modified: head/sys/boot/fdt/dts/arm/zedboard.dts
==============================================================================
--- head/sys/boot/fdt/dts/arm/zedboard.dts	Fri May  2 01:20:13 2014	(r265207)
+++ head/sys/boot/fdt/dts/arm/zedboard.dts	Fri May  2 01:28:19 2014	(r265208)
@@ -183,7 +183,7 @@
 			reg = <0x100000 0x1000>;
 			interrupts = <56>;
 			interrupt-parent = <&GIC>;
-			clock-frequency = <50000000>;
+			max-frequency = <50000000>;
 		};
 
 		// QSPI

Modified: head/sys/dev/sdhci/sdhci_fdt.c
==============================================================================
--- head/sys/dev/sdhci/sdhci_fdt.c	Fri May  2 01:20:13 2014	(r265207)
+++ head/sys/dev/sdhci/sdhci_fdt.c	Fri May  2 01:28:19 2014	(r265208)
@@ -66,6 +66,7 @@ struct sdhci_fdt_softc {
 	device_t	dev;		/* Controller device */
 	u_int		quirks;		/* Chip specific quirks */
 	u_int		caps;		/* If we override SDHCI_CAPABILITIES */
+	uint32_t	max_clk;	/* Max possible freq */
 	struct resource *irq_res;	/* IRQ resource */
 	void 		*intrhand;	/* Interrupt handle */
 
@@ -156,6 +157,7 @@ sdhci_fdt_probe(device_t dev)
 
 	sc->quirks = 0;
 	sc->num_slots = 1;
+	sc->max_clk = 0;
 
 	if (!ofw_bus_status_okay(dev))
 		return (ENXIO);
@@ -170,11 +172,14 @@ sdhci_fdt_probe(device_t dev)
 
 	node = ofw_bus_get_node(dev);
 
-	/* Allow dts to patch quirks and slots. */
-	if ((OF_getprop(node, "quirks", &cid, sizeof(cid))) > 0)
-		sc->quirks = fdt32_to_cpu(cid);
-	if ((OF_getprop(node, "num-slots", &cid, sizeof(cid))) > 0)
-		sc->num_slots = fdt32_to_cpu(cid);
+	/* Allow dts to patch quirks, slots, and max-frequency. */
+	if ((OF_getencprop(node, "quirks", &cid, sizeof(cid))) > 0)
+		sc->quirks = cid;
+	if ((OF_getencprop(node, "num-slots", &cid, sizeof(cid))) > 0)
+		sc->num_slots = cid;
+	if ((OF_getencprop(node, "max-frequency", &cid, sizeof(cid))) > 0)
+		sc->max_clk = cid;
+
 		
 	return (0);
 }
@@ -214,6 +219,7 @@ sdhci_fdt_attach(device_t dev)
 
 		slot->quirks = sc->quirks;
 		slot->caps = sc->caps;
+		slot->max_clk = sc->max_clk;
 
 		if (sdhci_init_slot(dev, slot, i) != 0)
 			continue;



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