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_ */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to