Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Jun 2017 04:26:37 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319936 - head/sys/powerpc/mpc85xx
Message-ID:  <201706140426.v5E4QbVt069865@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Wed Jun 14 04:26:37 2017
New Revision: 319936
URL: https://svnweb.freebsd.org/changeset/base/319936

Log:
  Actually add the mpc85xx_get_platform_clock() function.
  
  Follow up r319935 by actually committing the mpc85xx_get_platform_clock()
  function.  This function was created to facilitate other development, and I
  thought I had committed it earlier.
  
  Some blocks depend on the platform clock rather than the system clock.
  The System clock is derived from the platform clock as one-half the
  platform clock.  Rewrite mpc85xx_get_system_clock() to use the new
  function.
  
  Pointy-hat to:	jhibbits

Modified:
  head/sys/powerpc/mpc85xx/mpc85xx.c
  head/sys/powerpc/mpc85xx/mpc85xx.h

Modified: head/sys/powerpc/mpc85xx/mpc85xx.c
==============================================================================
--- head/sys/powerpc/mpc85xx/mpc85xx.c	Wed Jun 14 04:16:37 2017	(r319935)
+++ head/sys/powerpc/mpc85xx/mpc85xx.c	Wed Jun 14 04:26:37 2017	(r319936)
@@ -438,16 +438,28 @@ err:
 }
 
 uint32_t
-mpc85xx_get_system_clock(void)
+mpc85xx_get_platform_clock(void)
 {
 	phandle_t soc;
-	uint32_t freq;
+	static uint32_t freq;
 
+	if (freq != 0)
+		return (freq);
+
 	soc = OF_finddevice("/soc");
-	freq = 0;
 
 	/* freq isn't modified on error. */
 	OF_getencprop(soc, "bus-frequency", (void *)&freq, sizeof(freq));
+
+	return (freq);
+}
+
+uint32_t
+mpc85xx_get_system_clock(void)
+{
+	uint32_t freq;
+
+	freq = mpc85xx_get_platform_clock();
 
 	return (freq / 2);
 }

Modified: head/sys/powerpc/mpc85xx/mpc85xx.h
==============================================================================
--- head/sys/powerpc/mpc85xx/mpc85xx.h	Wed Jun 14 04:16:37 2017	(r319935)
+++ head/sys/powerpc/mpc85xx/mpc85xx.h	Wed Jun 14 04:26:37 2017	(r319936)
@@ -171,6 +171,7 @@ void mpc85xx_enable_l3_cache(void);
 void mpc85xx_fix_errata(vm_offset_t);
 void dataloss_erratum_access(vm_offset_t, uint32_t);
 int mpc85xx_is_qoriq(void);
+uint32_t mpc85xx_get_platform_clock(void);
 uint32_t mpc85xx_get_system_clock(void);
 
 #endif /* _MPC85XX_H_ */



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