Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jan 2018 21:27:41 +0000 (UTC)
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328223 - in head/sys: arm/broadcom/bcm2835 modules modules/bcm283x_pwm modules/rpi_pwm
Message-ID:  <201801212127.w0LLRfR0049230@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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