Author: phk
Date: Sun Jan 21 21:27:41 2018
New Revision: 328223
URL: https://svnweb.freebsd.org/changeset/base/328223

Log:
  Rename rpi_pwm to bcm283x_pwm, and build it on armv[67] and arm64.
  
  Truncate ratio if period is lowered.
  
  Tested on Rpi2 and Rpi3.
  
  Rpi3 requires DTB->DTS->edit->DTB hack

Added:
  head/sys/modules/bcm283x_pwm/
     - copied from r328222, head/sys/modules/rpi_pwm/
Deleted:
  head/sys/modules/rpi_pwm/
Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c
  head/sys/modules/Makefile
  head/sys/modules/bcm283x_pwm/Makefile

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c
==============================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Jan 21 21:09:08 2018        
(r328222)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Jan 21 21:27:41 2018        
(r328223)
@@ -160,6 +160,8 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc)
 
        /* Config PWM */
        W_RNG(sc, sc->period);
+       if (sc->ratio > sc->period)
+               sc->ratio = sc->period;
        W_DAT(sc, sc->ratio);
 
        /* Start PWM */

Modified: head/sys/modules/Makefile
==============================================================================
--- head/sys/modules/Makefile   Sun Jan 21 21:09:08 2018        (r328222)
+++ head/sys/modules/Makefile   Sun Jan 21 21:27:41 2018        (r328223)
@@ -60,6 +60,7 @@ SUBDIR=       \
        ${_autofs} \
        ${_auxio} \
        ${_bce} \
+       ${_bcm283x_pwm} \
        bfe \
        bge \
        bhnd \
@@ -804,6 +805,10 @@ _cloudabi32=       cloudabi32
 _cloudabi64=   cloudabi64
 .endif
 
+.endif
+
+.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64"
+_bcm283x_pwm=  bcm283x_pwm
 .endif
 
 .if ${MACHINE_ARCH:Marmv[67]*} != ""

Modified: head/sys/modules/bcm283x_pwm/Makefile
==============================================================================
--- head/sys/modules/rpi_pwm/Makefile   Sun Jan 21 21:09:08 2018        
(r328222)
+++ head/sys/modules/bcm283x_pwm/Makefile       Sun Jan 21 21:27:41 2018        
(r328223)
@@ -2,7 +2,7 @@
 
 .PATH: ${SRCTOP}/sys/arm/broadcom/bcm2835/
 
-KMOD=  rpi_pwm
+KMOD=  bcm283x_pwm
 SRCS=  bcm2835_pwm.c
 
 SRCS+= bus_if.h device_if.h ofw_bus_if.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