svn commit: r257407 - head/sys/arm/freescale/imx

Ian Lepore ian at FreeBSD.org
Thu Oct 31 01:45:55 UTC 2013


Author: ian
Date: Thu Oct 31 01:45:55 2013
New Revision: 257407
URL: http://svnweb.freebsd.org/changeset/base/257407

Log:
  Expand the list of compatible devices this driver works with.  Increase
  the target frequency from 1 to 10 MHz because these SoCs are plenty fast
  enough to benefit from the extra event timer resolution.

Modified:
  head/sys/arm/freescale/imx/imx_gpt.c

Modified: head/sys/arm/freescale/imx/imx_gpt.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_gpt.c	Wed Oct 30 22:45:35 2013	(r257406)
+++ head/sys/arm/freescale/imx/imx_gpt.c	Thu Oct 31 01:45:55 2013	(r257407)
@@ -95,7 +95,7 @@ struct imx_gpt_softc *imx_gpt_sc = NULL;
 static const int imx_gpt_delay_count = 78;
 
 /* Try to divide down an available fast clock to this frequency. */
-#define	TARGET_FREQUENCY	1000000
+#define	TARGET_FREQUENCY	10000000
 
 /* Don't try to set an event timer period smaller than this. */
 #define	MIN_ET_PERIOD		10LLU
@@ -107,16 +107,26 @@ static struct resource_spec imx_gpt_spec
 	{ -1, 0 }
 };
 
+static struct ofw_compat_data compat_data[] = {
+	{"fsl,imx6q-gpt",  1},
+	{"fsl,imx53-gpt",  1},
+	{"fsl,imx51-gpt",  1},
+	{"fsl,imx31-gpt",  1},
+	{"fsl,imx27-gpt",  1},
+	{"fsl,imx25-gpt",  1},
+	{NULL,             0}
+};
+
 static int
 imx_gpt_probe(device_t dev)
 {
 
-	if (!ofw_bus_is_compatible(dev, "fsl,imx51-gpt") &&
-	    !ofw_bus_is_compatible(dev, "fsl,imx53-gpt"))
-		return (ENXIO);
+	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
+		device_set_desc(dev, "Freescale i.MX GPT timer");
+		return (BUS_PROBE_DEFAULT);
+	}
 
-	device_set_desc(dev, "Freescale i.MX GPT timer");
-	return (BUS_PROBE_DEFAULT);
+	return (ENXIO);
 }
 
 static int
@@ -142,10 +152,7 @@ imx_gpt_attach(device_t dev)
 	 * we're running on.  Eventually we could allow selection from the fdt;
 	 * the code in this driver will cope with any clock frequency.
 	 */
-	if (ofw_bus_is_compatible(dev, "fsl,imx6-gpt"))
-		sc->sc_clksrc = GPT_CR_CLKSRC_24M;
-	else
-		sc->sc_clksrc = GPT_CR_CLKSRC_IPG;
+	sc->sc_clksrc = GPT_CR_CLKSRC_IPG;
 
 	ctlreg = 0;
 


More information about the svn-src-head mailing list