openwrt/target/linux/bcm27xx/patches-6.1/950-0465-overlays-Add-overlay-pwm1.patch
Álvaro Fernández Rojas 793f8ab62c bcm27xx: 6.1: add kernel patches
Add kernel patches for version 6.1.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2023-06-09 19:12:30 +02:00

133 lines
3.6 KiB
Diff

From 6f5604a2d672ffb874f89f9ae276b565ae99dcc6 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 16 Nov 2022 14:54:08 +0000
Subject: [PATCH] overlays: Add overlay pwm1
pwm1 enables the second PWM interface found on BCM2711. It can only
be mapped to GPIOs 40 & 41.
See: https://forums.raspberrypi.com/viewtopic.php?t=342458
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 18 +++++++
arch/arm/boot/dts/overlays/overlay_map.dts | 4 ++
arch/arm/boot/dts/overlays/pwm1-overlay.dts | 60 +++++++++++++++++++++
4 files changed, 83 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/pwm1-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -183,6 +183,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
pwm.dtbo \
pwm-2chan.dtbo \
pwm-ir-tx.dtbo \
+ pwm1.dtbo \
qca7000.dtbo \
qca7000-uart0.dtbo \
ramoops.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -3216,6 +3216,24 @@ Params: gpio_pin Output G
func Pin function (default 2 = Alt5)
+Name: pwm1
+Info: Configures one or two PWM channel on PWM1 (BCM2711 only)
+ N.B.:
+ 1) The onboard analogue audio output uses both PWM channels.
+ 2) So be careful mixing audio and PWM.
+ Note that even when only one pin is enabled, both channels are available
+ from the PWM driver, so be careful to use the correct one.
+Load: dtoverlay=pwm1,<param>=<val>
+Params: clock PWM clock frequency (informational)
+ pins_40 Enable channel 0 (PWM1_0) on GPIO 40
+ pins_41 Enable channel 1 (PWM1_1) on GPIO 41
+ pins_40_41 Enable channels 0 (PWM1_0) and 1 (PW1_1) on
+ GPIOs 40 and 41 (default)
+ pull_up Enable pull-ups on the PWM pins (default)
+ pull_down Enable pull-downs on the PWM pins
+ pull_off Disable pulls on the PWM pins
+
+
Name: qca7000
Info: in-tech's Evaluation Board for PLC Stamp micro
This uses spi0 and a separate GPIO interrupt to connect the QCA7000.
--- a/arch/arm/boot/dts/overlays/overlay_map.dts
+++ b/arch/arm/boot/dts/overlays/overlay_map.dts
@@ -77,6 +77,10 @@
renamed = "miniuart-bt";
};
+ pwm1 {
+ bcm2711;
+ };
+
ramoops {
bcm2835;
bcm2711 = "ramoops-pi4";
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/pwm1-overlay.dts
@@ -0,0 +1,60 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/pinctrl/bcm2835.h>
+
+/ {
+ compatible = "brcm,bcm2711";
+
+ fragment@0 {
+ target = <&pins>;
+ __overlay__ {
+ brcm,pins = <40 41>;
+ };
+ };
+
+ fragment@1 {
+ target = <&pins>;
+ __dormant__ {
+ brcm,pins = <40>;
+ };
+ };
+
+ fragment@2 {
+ target = <&pins>;
+ __dormant__ {
+ brcm,pins = <41>;
+ };
+ };
+
+ fragment@3 {
+ target = <&gpio>;
+ __overlay__ {
+ pins: pwm1_overlay_pins {
+ brcm,pins = <40 41>;
+ brcm,function = <BCM2835_FSEL_ALT0>;
+ brcm,pull = <BCM2835_PUD_UP>;
+ };
+ };
+ };
+
+ fragment@4 {
+ target = <&pwm1>;
+ pwm: __overlay__ {
+ status = "okay";
+ assigned-clock-rates = <100000000>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pins>;
+ };
+ };
+
+ __overrides__ {
+ clock = <&pwm>, "assigned-clock-rates:0";
+ pins_40_41 = <0>,"+0-1-2";
+ pins_40 = <0>,"-0+1-2";
+ pins_41 = <0>,"-0-1+2";
+ pull_up = <&pins>, "brcm,pull:0=", <BCM2835_PUD_UP>;
+ pull_down = <&pins>, "brcm,pull:0=", <BCM2835_PUD_DOWN>;
+ pull_off = <&pins>, "brcm,pull:0=", <BCM2835_PUD_OFF>;
+ };
+};