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
This commit is contained in:
Poul-Henning Kamp 2018-01-21 21:27:41 +00:00
parent bdf16dd67c
commit 137a344c63
3 changed files with 8 additions and 1 deletions
sys
arm/broadcom/bcm2835
modules
Makefile
bcm283x_pwm

@ -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 */

@ -60,6 +60,7 @@ SUBDIR= \
${_autofs} \
${_auxio} \
${_bce} \
${_bcm283x_pwm} \
bfe \
bge \
bhnd \
@ -806,6 +807,10 @@ _cloudabi64= cloudabi64
.endif
.if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64"
_bcm283x_pwm= bcm283x_pwm
.endif
.if ${MACHINE_ARCH:Marmv[67]*} != ""
_ffec= ffec
.endif

@ -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