Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 May 2014 10:49:07 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r266648 - in head/sys/arm/ti: . am335x omap4
Message-ID:  <201405251049.s4PAn7jd079920@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Sun May 25 10:49:07 2014
New Revision: 266648
URL: http://svnweb.freebsd.org/changeset/base/266648

Log:
  Allow the OMAP4 and AM335x prcm drivers to be compiled in the same kernel
  by renaming the structures used.

Modified:
  head/sys/arm/ti/am335x/am335x_prcm.c
  head/sys/arm/ti/omap4/omap4_prcm_clks.c
  head/sys/arm/ti/ti_prcm.c

Modified: head/sys/arm/ti/am335x/am335x_prcm.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_prcm.c	Sun May 25 10:17:26 2014	(r266647)
+++ head/sys/arm/ti/am335x/am335x_prcm.c	Sun May 25 10:49:07 2014	(r266648)
@@ -190,7 +190,7 @@ static int am335x_clk_pruss_activate(str
 		.clk_get_source_freq = am335x_clk_hsmmc_get_source_freq \
 	}
 
-struct ti_clock_dev ti_clk_devmap[] = {
+struct ti_clock_dev ti_am335x_clk_devmap[] = {
 	/* System clocks */
 	{	.id                  = SYS_CLK,
 		.clk_activate        = NULL,

Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c
==============================================================================
--- head/sys/arm/ti/omap4/omap4_prcm_clks.c	Sun May 25 10:17:26 2014	(r266647)
+++ head/sys/arm/ti/omap4/omap4_prcm_clks.c	Sun May 25 10:49:07 2014	(r266648)
@@ -256,7 +256,7 @@ static int omap4_clk_get_arm_fclk_freq(s
 	}
 
 
-struct ti_clock_dev ti_clk_devmap[] = {
+struct ti_clock_dev ti_omap4_clk_devmap[] = {
 
 	/* System clocks */
 	{	.id                  = SYS_CLK,

Modified: head/sys/arm/ti/ti_prcm.c
==============================================================================
--- head/sys/arm/ti/ti_prcm.c	Sun May 25 10:17:26 2014	(r266647)
+++ head/sys/arm/ti/ti_prcm.c	Sun May 25 10:49:07 2014	(r266648)
@@ -57,16 +57,18 @@ __FBSDID("$FreeBSD$");
 #include <machine/resource.h>
 #include <machine/intr.h>
 
+#include <arm/ti/ti_cpuid.h>
 #include <arm/ti/ti_prcm.h>
 
 /**
- *	ti_clk_devmap - Array of clock devices, should be defined one per SoC 
+ *	ti_*_clk_devmap - Array of clock devices, should be defined one per SoC 
  *
  *	This array is typically defined in one of the targeted *_prcm_clk.c
  *	files and is specific to the given SoC platform.  Each entry in the array
  *	corresponds to an individual clock device.
  */
-extern struct ti_clock_dev ti_clk_devmap[];
+extern struct ti_clock_dev ti_omap4_clk_devmap[];
+extern struct ti_clock_dev ti_am335x_clk_devmap[];
 
 /**
  *	ti_prcm_clk_dev - returns a pointer to the clock device with given id
@@ -90,7 +92,21 @@ ti_prcm_clk_dev(clk_ident_t clk)
 	 * loop for this, but this function should only called when a driver is 
 	 * being activated so IMHO not a big issue.
 	 */
-	clk_dev = &(ti_clk_devmap[0]);
+	clk_dev = NULL;
+	switch(ti_chip()) {
+#ifdef SOC_OMAP4
+	case CHIP_OMAP_4:
+		clk_dev = &(ti_omap4_clk_devmap[0]);
+		break;
+#endif
+#ifdef SOC_TI_AM335X
+	case CHIP_AM335X:
+		clk_dev = &(ti_am335x_clk_devmap[0]);
+		break;
+#endif
+	}
+	if (clk_dev == NULL)
+		panic("No clock devmap found");
 	while (clk_dev->id != INVALID_CLK_IDENT) {
 		if (clk_dev->id == clk) {
 			return (clk_dev);



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