diff --git a/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch b/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch new file mode 100644 index 0000000000..0b7c8dd49b --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/370-mac80211-fix-TXQ-AC-confusion.patch @@ -0,0 +1,61 @@ +From: Johannes Berg +Date: Tue, 23 Mar 2021 21:05:01 +0100 +Subject: [PATCH] mac80211: fix TXQ AC confusion + +Normally, TXQs have + + txq->tid = tid; + txq->ac = ieee80211_ac_from_tid(tid); + +However, the special management TXQ actually has + + txq->tid = IEEE80211_NUM_TIDS; // 16 + txq->ac = IEEE80211_AC_VO; + +This makes sense, but ieee80211_ac_from_tid(16) is the same +as ieee80211_ac_from_tid(0) which is just IEEE80211_AC_BE. + +Now, normally this is fine. However, if the netdev queues +were stopped, then the code in ieee80211_tx_dequeue() will +propagate the stop from the interface (vif->txqs_stopped[]) +if the AC 2 (ieee80211_ac_from_tid(txq->tid)) is marked as +stopped. On wake, however, __ieee80211_wake_txqs() will wake +the TXQ if AC 0 (txq->ac) is woken up. + +If a driver stops all queues with ieee80211_stop_tx_queues() +and then wakes them again with ieee80211_wake_tx_queues(), +the ieee80211_wake_txqs() tasklet will run to resync queue +and TXQ state. If all queues were woken, then what'll happen +is that _ieee80211_wake_txqs() will run in order of HW queues +0-3, typically (and certainly for iwlwifi) corresponding to +ACs 0-3, so it'll call __ieee80211_wake_txqs() for each AC in +order 0-3. + +When __ieee80211_wake_txqs() is called for AC 0 (VO) that'll +wake up the management TXQ (remember its tid is 16), and the +driver's wake_tx_queue() will be called. That tries to get a +frame, which will immediately *stop* the TXQ again, because +now we check against AC 2, and AC 2 hasn't yet been marked as +woken up again in sdata->vif.txqs_stopped[] since we're only +in the __ieee80211_wake_txqs() call for AC 0. + +Thus, the management TXQ will never be started again. + +Fix this by checking txq->ac directly instead of calculating +the AC as ieee80211_ac_from_tid(txq->tid). + +Fixes: adf8ed01e4fd ("mac80211: add an optional TXQ for other PS-buffered frames") +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3589,7 +3589,7 @@ begin: + test_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags)) + goto out; + +- if (vif->txqs_stopped[ieee80211_ac_from_tid(txq->tid)]) { ++ if (vif->txqs_stopped[txq->ac]) { + set_bit(IEEE80211_TXQ_STOP_NETIF_TX, &txqi->flags); + goto out; + } diff --git a/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch new file mode 100644 index 0000000000..b439a3814c --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/371-mac80211-don-t-apply-flow-control-on-management-fram.patch @@ -0,0 +1,60 @@ +From: Johannes Berg +Date: Fri, 19 Mar 2021 23:28:01 +0100 +Subject: [PATCH] mac80211: don't apply flow control on management frames + +In some cases (depending on the driver, but it's true e.g. for +iwlwifi) we're using an internal TXQ for management packets, +mostly to simplify the code and to have a place to queue them. +However, it appears that in certain cases we can confuse the +code and management frames are dropped, which is certainly not +what we want. + +Short-circuit the processing of management frames. To keep the +impact minimal, only put them on the frags queue and check the +tid == management only for doing that and to skip the airtime +fairness checks, if applicable. + +Signed-off-by: Johannes Berg +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -5,7 +5,7 @@ + * Copyright 2006-2007 Jiri Benc + * Copyright 2007 Johannes Berg + * Copyright 2013-2014 Intel Mobile Communications GmbH +- * Copyright (C) 2018-2020 Intel Corporation ++ * Copyright (C) 2018-2021 Intel Corporation + * + * Transmit and frame generation functions. + */ +@@ -1403,8 +1403,17 @@ static void ieee80211_txq_enqueue(struct + ieee80211_set_skb_enqueue_time(skb); + + spin_lock_bh(&fq->lock); +- fq_tin_enqueue(fq, tin, flow_idx, skb, +- fq_skb_free_func); ++ /* ++ * For management frames, don't really apply codel etc., ++ * we don't want to apply any shaping or anything we just ++ * want to simplify the driver API by having them on the ++ * txqi. ++ */ ++ if (unlikely(txqi->txq.tid == IEEE80211_NUM_TIDS)) ++ __skb_queue_tail(&txqi->frags, skb); ++ else ++ fq_tin_enqueue(fq, tin, flow_idx, skb, ++ fq_skb_free_func); + spin_unlock_bh(&fq->lock); + } + +@@ -3846,6 +3855,9 @@ bool ieee80211_txq_airtime_check(struct + if (!txq->sta) + return true; + ++ if (unlikely(txq->tid == IEEE80211_NUM_TIDS)) ++ return true; ++ + sta = container_of(txq->sta, struct sta_info, sta); + if (atomic_read(&sta->airtime[txq->ac].aql_tx_pending) < + sta->airtime[txq->ac].aql_limit_low) diff --git a/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch new file mode 100644 index 0000000000..4d8a91a413 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/372-mac80211-set-sk_pacing_shift-for-802.3-txpath.patch @@ -0,0 +1,21 @@ +From: Lorenzo Bianconi +Date: Mon, 8 Mar 2021 23:01:49 +0100 +Subject: [PATCH] mac80211: set sk_pacing_shift for 802.3 txpath + +Similar to 802.11 txpath, set socket sk_pacing_shift for 802.3 tx path. + +Signed-off-by: Lorenzo Bianconi +--- + +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -4173,6 +4173,9 @@ static bool ieee80211_tx_8023(struct iee + unsigned long flags; + int q = info->hw_queue; + ++ if (sta) ++ sk_pacing_shift_update(skb->sk, local->hw.tx_sk_pacing_shift); ++ + if (ieee80211_queue_skb(local, sdata, sta, skb)) + return true; + diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index cc1e960a0c..04a9a38515 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses PKG_VERSION:=6.2 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) @@ -120,7 +120,19 @@ ifneq ($(HOST_OS),FreeBSD) mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \ done \ ) - for file in a/ansi d/dumb l/linux r/rxvt r/rxvt-unicode s/screen v/vt100 v/vt102 x/xterm x/xterm-color x/xterm-256color; do \ + for file in \ + a/ansi \ + d/dumb \ + l/linux \ + r/rxvt \ + r/rxvt-unicode \ + s/screen \ + s/screen-256color \ + v/vt100 \ + v/vt102 \ + x/xterm \ + x/xterm-color \ + x/xterm-256color; do \ $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \ $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \ $(1)/usr/share/terminfo/$$$$file; \ diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index 6fb9f73c3d..8ecfef01c5 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2021-03-19 -PKG_SOURCE_VERSION:=4a5b9010ccc56fdf288fe758023af445feb93fad -PKG_MIRROR_HASH:=2d15fe2f51ebdeae532a2e8130689400cf2364876e737cfbb1bf9c045719acf1 +PKG_SOURCE_DATE:=2021-03-29 +PKG_SOURCE_VERSION:=aa9621db401e881ffcdea03be272c94149484ccf +PKG_MIRROR_HASH:=11b7de10e6ab91742d8a633a0030dde86118ffe73031cdf9c192cb3fded97a20 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/target/linux/ath79/patches-5.10/404-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.10/404-mtd-cybertan-trx-parser.patch index 59ee57d277..923589661e 100644 --- a/target/linux/ath79/patches-5.10/404-mtd-cybertan-trx-parser.patch +++ b/target/linux/ath79/patches-5.10/404-mtd-cybertan-trx-parser.patch @@ -1,18 +1,18 @@ --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -7,6 +7,7 @@ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myl - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ofpart-y += ofpart_core.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o + ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o +obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -92,6 +92,14 @@ config MTD_OF_PARTS_BCM4908 - that can have multiple "firmware" partitions. It takes care of - finding currently used one and backup ones. +@@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS + two "firmware" partitions. Currently used firmware has to be detected + using CFE environment variable. +config MTD_PARSER_CYBERTAN + tristate "Parser for Cybertan format partitions" diff --git a/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch b/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch index 59ee57d277..923589661e 100644 --- a/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch +++ b/target/linux/ath79/patches-5.4/404-mtd-cybertan-trx-parser.patch @@ -1,18 +1,18 @@ --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -7,6 +7,7 @@ obj-$(CONFIG_MTD_MYLOADER_PARTS) += myl - obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o +@@ -8,6 +8,7 @@ obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o ofpart-y += ofpart_core.o ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o + ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o +obj-$(CONFIG_MTD_PARSER_CYBERTAN) += parser_cybertan.o obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -92,6 +92,14 @@ config MTD_OF_PARTS_BCM4908 - that can have multiple "firmware" partitions. It takes care of - finding currently used one and backup ones. +@@ -102,6 +102,14 @@ config MTD_OF_PARTS_LINKSYS_NS + two "firmware" partitions. Currently used firmware has to be detected + using CFE environment variable. +config MTD_PARSER_CYBERTAN + tristate "Parser for Cybertan format partitions" diff --git a/target/linux/bcm4908/config-5.4 b/target/linux/bcm4908/config-5.4 index 47529fc958..72ecdc0454 100644 --- a/target/linux/bcm4908/config-5.4 +++ b/target/linux/bcm4908/config-5.4 @@ -139,6 +139,7 @@ CONFIG_MTD_NAND_BRCMNAND=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_OF_PARTS_BCM4908=y +# CONFIG_MTD_OF_PARTS_LINKSYS_NS is not set CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPLIT_CFE_BOOTFS=y # CONFIG_MTD_SPLIT_SQUASHFS_ROOT is not set diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4 index 07a8f85aa0..f57bfd36b6 100644 --- a/target/linux/bcm53xx/config-5.4 +++ b/target/linux/bcm53xx/config-5.4 @@ -258,6 +258,7 @@ CONFIG_MTD_BCM47XX_PARTS=y CONFIG_MTD_NAND_BRCMNAND=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC_SW_HAMMING=y +CONFIG_MTD_OF_PARTS_LINKSYS_NS=y CONFIG_MTD_PARSER_TRX=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_SPI_NOR=y diff --git a/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Fix-Linksys-EA9500-partitions.patch b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Fix-Linksys-EA9500-partitions.patch new file mode 100644 index 0000000000..964773c377 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/130-ARM-dts-BCM5301X-Fix-Linksys-EA9500-partitions.patch @@ -0,0 +1,58 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Mon, 29 Mar 2021 07:32:29 +0200 +Subject: [PATCH] ARM: dts: BCM5301X: Fix Linksys EA9500 partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Partitions are basically fixed indeed but firmware ones don't have +hardcoded function ("firmware" vs "failsafe"). Actual function depends +on bootloader configuration. Use a proper binding for that. + +While at it fix numbers formatting to avoid: +arch/arm/boot/dts/bcm47094-linksys-panamera.dt.yaml: partitions: 'partition@1F00000' does not match any of the regexes: '^partition@[0-9a-f]+$', 'pinctrl-[0-9]+' + From schema: Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml + +Signed-off-by: Rafał Miłecki +--- + arch/arm/boot/dts/bcm47094-linksys-panamera.dts | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) + +--- a/arch/arm/boot/dts/bcm47094-linksys-panamera.dts ++++ b/arch/arm/boot/dts/bcm47094-linksys-panamera.dts +@@ -279,7 +279,7 @@ + + &nandcs { + partitions { +- compatible = "fixed-partitions"; ++ compatible = "linksys,ns-partitions"; + #address-cells = <1>; + #size-cells = <1>; + +@@ -300,20 +300,18 @@ + }; + + partition@200000 { +- label = "firmware"; +- reg = <0x0200000 0x01D00000>; +- compatible = "brcm,trx"; ++ reg = <0x0200000 0x01d00000>; ++ compatible = "linksys,ns-firmware", "brcm,trx"; + }; + +- partition@1F00000 { +- label = "failsafe"; +- reg = <0x01F00000 0x01D00000>; +- read-only; ++ partition@1f00000 { ++ reg = <0x01f00000 0x01d00000>; ++ compatible = "linksys,ns-firmware", "brcm,trx"; + }; + + partition@5200000 { + label = "system"; +- reg = <0x05200000 0x02E00000>; ++ reg = <0x05200000 0x02e00000>; + }; + }; + }; diff --git a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts index d82247d26c..094dca1585 100644 --- a/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts +++ b/target/linux/bmips/dts/bcm63168-comtrend-vr-3032u.dts @@ -12,6 +12,8 @@ led-running = &led_power_green; led-upgrade = &led_power_green; + led-dsl = &led_dsl_green; + led-internet = &led_internet_green; led-usb = &led_usb_green; }; @@ -21,14 +23,14 @@ reset { label = "reset"; - gpios = <&pinctrl 33 GPIO_ACTIVE_LOW>; + gpios = <&gpio 32 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; wps { label = "wps"; - gpios = <&pinctrl 34 GPIO_ACTIVE_LOW>; + gpios = <&gpio 33 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; @@ -75,7 +77,7 @@ label = "red:internet"; }; - led@3 { + led_dsl_green: led@3 { reg = <3>; active-low; label = "green:dsl"; @@ -93,7 +95,7 @@ label = "green:wps"; }; - led@8 { + led_internet_green: led@8 { reg = <8>; active-low; label = "green:internet"; diff --git a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts index 725c7e38cd..0a53ece140 100644 --- a/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts +++ b/target/linux/bmips/dts/bcm6318-comtrend-ar-5315u.dts @@ -8,9 +8,13 @@ aliases { led-boot = &led_power_green; - led-failsafe = &led_power_green; + led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; + + led-dsl = &led_dsl_green; + led-internet = &led_internet_green; + led-usb = &led_usb_green; }; keys { @@ -123,7 +127,7 @@ label = "green:power"; }; - led@2 { + led_usb_green: led@2 { reg = <2>; active-low; label = "green:usb"; @@ -157,7 +161,7 @@ /* EPHY3 Act */ }; - led@8 { + led_internet_green: led@8 { reg = <8>; active-low; label = "green:internet"; @@ -169,13 +173,13 @@ label = "red:internet"; }; - led@10 { + led_dsl_green: led@10 { reg = <10>; active-low; label = "green:dsl"; }; - led@11 { + led_power_red: led@11 { reg = <11>; active-low; label = "red:power"; diff --git a/target/linux/bmips/dts/bcm6318.dtsi b/target/linux/bmips/dts/bcm6318.dtsi index 6064c9ac4c..9f613ad47a 100644 --- a/target/linux/bmips/dts/bcm6318.dtsi +++ b/target/linux/bmips/dts/bcm6318.dtsi @@ -142,110 +142,115 @@ }; }; - gpio: syscon@10000080 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@10000080 { + compatible = "brcm,bcm6318-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0x10000080 0x80>; + ranges = <0 0x10000080 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm6318-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm6318-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 50>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc 0 0>, - <&ext_intc 1 0>; - interrupt-names = "gpio33", - "gpio34"; + pinctrl: pinctrl@18 { + compatible = "brcm,bcm6318-pinctrl"; + reg = <0x18 0x10>, <0x54 0x18>; - pinctrl_ephy0_spd_led: ephy0_spd_led { + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { function = "ephy0_spd_led"; pins = "gpio0"; }; - pinctrl_ephy1_spd_led: ephy1_spd_led { + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { function = "ephy1_spd_led"; pins = "gpio1"; }; - pinctrl_ephy2_spd_led: ephy2_spd_led { + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { function = "ephy2_spd_led"; pins = "gpio2"; }; - pinctrl_ephy3_spd_led: ephy3_spd_led { + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { function = "ephy3_spd_led"; pins = "gpio3"; }; - pinctrl_ephy0_act_led: ephy0_act_led { + pinctrl_ephy0_act_led: ephy0_act_led-pins { function = "ephy0_act_led"; pins = "gpio4"; }; - pinctrl_ephy1_act_led: ephy1_act_led { + pinctrl_ephy1_act_led: ephy1_act_led-pins { function = "ephy1_act_led"; pins = "gpio5"; }; - pinctrl_ephy2_act_led: ephy2_act_led { + pinctrl_ephy2_act_led: ephy2_act_led-pins { function = "ephy2_act_led"; pins = "gpio6"; }; - pinctrl_ephy3_act_led: ephy3_act_led { + pinctrl_ephy3_act_led: ephy3_act_led-pins { function = "ephy3_act_led"; pins = "gpio7"; }; - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { + pinctrl_serial_led: serial_led-pins { + pinctrl_serial_led_data: serial_led_data-pins { function = "serial_led_data"; pins = "gpio6"; }; - pinctrl_serial_led_clk: serial_led_clk { + pinctrl_serial_led_clk: serial_led_clk-pins { function = "serial_led_clk"; pins = "gpio7"; }; }; - pinctrl_inet_act_led: inet_act_led { + pinctrl_inet_act_led: inet_act_led-pins { function = "inet_act_led"; pins = "gpio8"; }; - pinctrl_inet_fail_led: inet_fail_led { + pinctrl_inet_fail_led: inet_fail_led-pins { function = "inet_fail_led"; pins = "gpio9"; }; - pinctrl_dsl_led: dsl_led { + pinctrl_dsl_led: dsl_led-pins { function = "dsl_led"; pins = "gpio10"; }; - pinctrl_post_fail_led: post_fail_led { + pinctrl_post_fail_led: post_fail_led-pins { function = "post_fail_led"; pins = "gpio11"; }; - pinctrl_wlan_wps_led: wlan_wps_led { + pinctrl_wlan_wps_led: wlan_wps_led-pins { function = "wlan_wps_led"; pins = "gpio12"; }; - pinctrl_usb_pwron: usb_pwron { + pinctrl_usb_pwron: usb_pwron-pins { function = "usb_pwron"; pins = "gpio13"; }; - pinctrl_usb_device_led: usb_device_led { + pinctrl_usb_device_led: usb_device_led-pins { function = "usb_device_led"; pins = "gpio13"; }; - pinctrl_usb_active: usb_active { + pinctrl_usb_active: usb_active-pins { function = "usb_active"; pins = "gpio40"; }; diff --git a/target/linux/bmips/dts/bcm63268.dtsi b/target/linux/bmips/dts/bcm63268.dtsi index d71cef4ccd..2ab14e5a33 100644 --- a/target/linux/bmips/dts/bcm63268.dtsi +++ b/target/linux/bmips/dts/bcm63268.dtsi @@ -153,131 +153,132 @@ #reset-cells = <1>; }; - gpio: syscon@100000c0 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@100000c0 { + compatible = "brcm,bcm63268-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0x100000c0 0x80>; + ranges = <0 0x100000c0 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm63268-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm63268-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 52>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc 0 0>, - <&ext_intc 1 0>, - <&ext_intc 2 0>, - <&ext_intc 3 0>; - interrupt-names = "gpio32", - "gpio33", - "gpio34", - "gpio35"; + pinctrl: pinctrl@10 { + compatible = "brcm,bcm63268-pinctrl"; + reg = <0x10 0x4>, <0x18 0x8>, <0x38 0x4>; - pinctrl_serial_led: serial_led { - pinctrl_serial_led_clk: serial_led_clk { + pinctrl_serial_led: serial_led-pins { + pinctrl_serial_led_clk: serial_led_clk-pins { function = "serial_led_clk"; pins = "gpio0"; }; - pinctrl_serial_led_data: serial_led_data { + pinctrl_serial_led_data: serial_led_data-pins { function = "serial_led_data"; pins = "gpio1"; }; }; - pinctrl_hsspi_cs4: hsspi_cs4 { + pinctrl_hsspi_cs4: hsspi_cs4-pins { function = "hsspi_cs4"; pins = "gpio16"; }; - pinctrl_hsspi_cs5: hsspi_cs5 { + pinctrl_hsspi_cs5: hsspi_cs5-pins { function = "hsspi_cs5"; pins = "gpio17"; }; - pinctrl_hsspi_cs6: hsspi_cs6 { + pinctrl_hsspi_cs6: hsspi_cs6-pins { function = "hsspi_cs6"; pins = "gpio8"; }; - pinctrl_hsspi_cs7: hsspi_cs7 { + pinctrl_hsspi_cs7: hsspi_cs7-pins { function = "hsspi_cs7"; pins = "gpio9"; }; pinctrl_adsl_spi: adsl_spi { - pinctrl_adsl_spi_miso: adsl_spi_miso { + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { function = "adsl_spi_miso"; pins = "gpio18"; }; - pinctrl_adsl_spi_mosi: adsl_spi_mosi { + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { function = "adsl_spi_mosi"; pins = "gpio19"; }; }; - pinctrl_vreq_clk: vreq_clk { + pinctrl_vreq_clk: vreq_clk-pins { function = "vreq_clk"; pins = "gpio22"; }; - pinctrl_pcie_clkreq_b: pcie_clkreq_b { + pinctrl_pcie_clkreq_b: pcie_clkreq_b-pins { function = "pcie_clkreq_b"; pins = "gpio23"; }; - pinctrl_robosw_led_clk: robosw_led_clk { + pinctrl_robosw_led_clk: robosw_led_clk-pins { function = "robosw_led_clk"; pins = "gpio30"; }; - pinctrl_robosw_led_data: robosw_led_data { + pinctrl_robosw_led_data: robosw_led_data-pins { function = "robosw_led_data"; pins = "gpio31"; }; - pinctrl_nand: nand { + pinctrl_nand: nand-pins { function = "nand"; group = "nand_grp"; }; - pinctrl_gpio35_alt: gpio35_alt { + pinctrl_gpio35_alt: gpio35_alt-pins { function = "gpio35_alt"; pin = "gpio35"; }; - pinctrl_dectpd: dectpd { + pinctrl_dectpd: dectpd-pins { function = "dectpd"; group = "dectpd_grp"; }; - pinctrl_vdsl_phy_override_0: vdsl_phy_override_0 { + pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { function = "vdsl_phy_override_0"; group = "vdsl_phy_override_0_grp"; }; - pinctrl_vdsl_phy_override_1: vdsl_phy_override_1 { + pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { function = "vdsl_phy_override_1"; group = "vdsl_phy_override_1_grp"; }; - pinctrl_vdsl_phy_override_2: vdsl_phy_override_2 { + pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { function = "vdsl_phy_override_2"; group = "vdsl_phy_override_2_grp"; }; - pinctrl_vdsl_phy_override_3: vdsl_phy_override_3 { + pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { function = "vdsl_phy_override_3"; group = "vdsl_phy_override_3_grp"; }; - pinctrl_dsl_gpio8: dsl_gpio8 { + pinctrl_dsl_gpio8: dsl_gpio8-pins { function = "dsl_gpio8"; group = "dsl_gpio8"; }; - pinctrl_dsl_gpio9: dsl_gpio9 { + pinctrl_dsl_gpio9: dsl_gpio9-pins { function = "dsl_gpio9"; group = "dsl_gpio9"; }; diff --git a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts index 14608fedb1..06fe1f9009 100644 --- a/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts +++ b/target/linux/bmips/dts/bcm6328-comtrend-ar-5387un.dts @@ -8,9 +8,12 @@ aliases { led-boot = &led_power_green; - led-failsafe = &led_power_green; + led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; + + led-dsl = &led_dsl_green; + led-internet = &led_internet_green; }; keys { @@ -19,7 +22,7 @@ reset { label = "reset"; - gpios = <&pinctrl 23 GPIO_ACTIVE_LOW>; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; @@ -120,12 +123,12 @@ label = "red:internet"; }; - led@4 { + led_power_red: led@4 { reg = <4>; label = "red:power"; }; - led@7 { + led_internet_green: led@7 { reg = <7>; label = "green:internet"; }; @@ -135,7 +138,7 @@ label = "green:power"; }; - led@11 { + led_dsl_green: led@11 { reg = <11>; active-low; label = "green:dsl"; diff --git a/target/linux/bmips/dts/bcm6328.dtsi b/target/linux/bmips/dts/bcm6328.dtsi index 6ca7e4d9a6..c8e9138ccb 100644 --- a/target/linux/bmips/dts/bcm6328.dtsi +++ b/target/linux/bmips/dts/bcm6328.dtsi @@ -145,99 +145,100 @@ }; }; - gpio: syscon@10000080 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@10000080 { + compatible = "brcm,bcm6328-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0x10000080 0x80>; + ranges = <0 0x10000080 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm6328-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm6328-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 32>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc 3 0>, - <&ext_intc 2 0>, - <&ext_intc 1 0>, - <&ext_intc 0 0>; - interrupt-names = "gpio12", - "gpio15", - "gpio23", - "gpio24"; + pinctrl: pinctrl@18 { + compatible = "brcm,bcm6328-pinctrl"; + reg = <0x18 0x10>; - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { + pinctrl_serial_led: serial_led-pins { + pinctrl_serial_led_data: serial_led_data-pins { function = "serial_led_data"; pins = "gpio6"; }; - pinctrl_serial_led_clk: serial_led_clk { + pinctrl_serial_led_clk: serial_led_clk-pins { function = "serial_led_clk"; pins = "gpio7"; }; }; - pinctrl_inet_act_led: inet_act_led { + pinctrl_inet_act_led: inet_act_led-pins { function = "inet_act_led"; pins = "gpio11"; }; - pinctrl_pcie_clkreq: pcie_clkreq { + pinctrl_pcie_clkreq: pcie_clkreq-pins { function = "pcie_clkreq"; pins = "gpio16"; }; - pinctrl_ephy0_spd_led: ephy0_spd_led { + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { function = "led"; pins = "gpio17"; }; - pinctrl_ephy1_spd_led: ephy1_spd_led { + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { function = "led"; pins = "gpio18"; }; - pinctrl_ephy2_spd_led: ephy2_spd_led { + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { function = "led"; pins = "gpio19"; }; - pinctrl_ephy3_spd_led: ephy3_spd_led { + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { function = "led"; pins = "gpio20"; }; - pinctrl_ephy0_act_led: ephy0_act_led { + pinctrl_ephy0_act_led: ephy0_act_led-pins { function = "ephy0_act_led"; pins = "gpio25"; }; - pinctrl_ephy1_act_led: ephy1_act_led { + pinctrl_ephy1_act_led: ephy1_act_led-pins { function = "ephy1_act_led"; pins = "gpio26"; }; - pinctrl_ephy2_act_led: ephy2_act_led { + pinctrl_ephy2_act_led: ephy2_act_led-pins { function = "ephy2_act_led"; pins = "gpio27"; }; - pinctrl_ephy3_act_led: ephy3_act_led { + pinctrl_ephy3_act_led: ephy3_act_led-pins { function = "ephy3_act_led"; pins = "gpio28"; }; - pinctrl_hsspi_cs1: hsspi_cs1 { + pinctrl_hsspi_cs1: hsspi_cs1-pins { function = "hsspi_cs1"; pins = "hsspi_cs1"; }; - pinctrl_usb_port1_device: usb_port1_device { + pinctrl_usb_port1_device: usb_port1_device-pins { function = "usb_device_port"; pins = "usb_port1"; }; - pinctrl_usb_port1_host: usb_port1_host { + pinctrl_usb_port1_host: usb_port1_host-pins { function = "usb_host_port"; pins = "usb_port1"; }; diff --git a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts index 65b4480ee1..1ec5a71515 100644 --- a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts +++ b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts @@ -7,14 +7,13 @@ model = "Huawei EchoLife HG556a (version B)"; aliases { - led-boot = &power_red; - led-failsafe = &power_red; - led-running = &power_red; - led-upgrade = &power_red; + led-boot = &led_power_red; + led-failsafe = &led_power_red; + led-running = &led_power_red; + led-upgrade = &led_power_red; - led-dsl = &dsl_red; - led-internet = &dsl_red; - led-usb = &hspa_red; + led-dsl = &led_dsl_red; + led-usb = &led_hspa_red; }; keys { @@ -23,28 +22,28 @@ help { label = "help"; - gpios = <&pinctrl 8 GPIO_ACTIVE_LOW>; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; wlan { label = "wlan"; - gpios = <&pinctrl 9 GPIO_ACTIVE_LOW>; + gpios = <&gpio 9 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; restart { label = "restart"; - gpios = <&pinctrl 10 GPIO_ACTIVE_LOW>; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; reset { label = "reset"; - gpios = <&pinctrl 11 GPIO_ACTIVE_LOW>; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; @@ -55,68 +54,68 @@ led@0 { label = "red:message"; - gpios = <&pinctrl 0 GPIO_ACTIVE_LOW>; + gpios = <&gpio 0 GPIO_ACTIVE_LOW>; }; - hspa_red: led@1 { + led_hspa_red: led@1 { label = "red:hspa"; - gpios = <&pinctrl 1 GPIO_ACTIVE_LOW>; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; }; - dsl_red: led@2 { + led_dsl_red: led@2 { label = "red:dsl"; - gpios = <&pinctrl 2 GPIO_ACTIVE_LOW>; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; }; - power_red: led@3 { + led_power_red: led@3 { label = "red:power"; - gpios = <&pinctrl 3 GPIO_ACTIVE_LOW>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; }; led@6 { label = "all"; - gpios = <&pinctrl 6 GPIO_ACTIVE_LOW>; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; default-state = "on"; }; led@12 { label = "green:lan1"; - gpios = <&pinctrl 12 GPIO_ACTIVE_LOW>; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; }; led@13 { label = "red:lan1"; - gpios = <&pinctrl 13 GPIO_ACTIVE_LOW>; + gpios = <&gpio 13 GPIO_ACTIVE_LOW>; }; led@15 { label = "green:lan2"; - gpios = <&pinctrl 15 GPIO_ACTIVE_LOW>; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; }; led@22 { label = "red:lan2"; - gpios = <&pinctrl 22 GPIO_ACTIVE_LOW>; + gpios = <&gpio 22 GPIO_ACTIVE_LOW>; }; led@23 { label = "green:lan3"; - gpios = <&pinctrl 23 GPIO_ACTIVE_LOW>; + gpios = <&gpio 23 GPIO_ACTIVE_LOW>; }; led@26 { label = "red:lan3"; - gpios = <&pinctrl 26 GPIO_ACTIVE_LOW>; + gpios = <&gpio 26 GPIO_ACTIVE_LOW>; }; led@27 { label = "green:lan4"; - gpios = <&pinctrl 27 GPIO_ACTIVE_LOW>; + gpios = <&gpio 27 GPIO_ACTIVE_LOW>; }; led@28 { label = "red:lan4"; - gpios = <&pinctrl 28 GPIO_ACTIVE_LOW>; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; }; diff --git a/target/linux/bmips/dts/bcm6358.dtsi b/target/linux/bmips/dts/bcm6358.dtsi index 3ebbf74613..34334df9ba 100644 --- a/target/linux/bmips/dts/bcm6358.dtsi +++ b/target/linux/bmips/dts/bcm6358.dtsi @@ -157,71 +157,68 @@ timeout-sec = <30>; }; - gpio: syscon@fffe0080 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@fffe0080 { + compatible = "brcm,bcm6358-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0xfffe0080 0x50>; + ranges = <0 0xfffe0080 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm6358-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm6358-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 40>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc1 0 0>, - <&ext_intc1 1 0>, - <&ext_intc0 0 0>, - <&ext_intc0 1 0>, - <&ext_intc0 2 0>, - <&ext_intc0 3 0>; - interrupt-names = "gpio32", - "gpio33", - "gpio34", - "gpio35", - "gpio36", - "gpio37"; + pinctrl: pinctrl@18 { + compatible = "brcm,bcm6358-pinctrl"; + reg = <0x18 0x4>; - pinctrl_ebi_cs: ebi_cs { + pinctrl_ebi_cs: ebi_cs-pins { function = "ebi_cs"; groups = "ebi_cs_grp"; }; - pinctrl_uart1: uart1 { + pinctrl_uart1: uart1-pins { function = "uart1"; groups = "uart1_grp"; }; - pinctrl_serial_led: serial_led { + pinctrl_serial_led: serial_led-pins { function = "serial_led"; groups = "serial_led_grp"; }; - pinctrl_legacy_led: legacy_led { + pinctrl_legacy_led: legacy_led-pins { function = "legacy_led"; groups = "legacy_led_grp"; }; - pinctrl_led: led { + pinctrl_led: led-pins { function = "led"; groups = "led_grp"; }; - pinctrl_spi_cs_23: spi_cs { + pinctrl_spi_cs_23: spi_cs-pins { function = "spi_cs"; groups = "spi_cs_grp"; }; - pinctrl_utopia: utopia { + pinctrl_utopia: utopia-pins { function = "utopia"; groups = "utopia_grp"; }; - pinctrl_pwm_syn_clk: pwm_syn_clk { + pinctrl_pwm_syn_clk: pwm_syn_clk-pins { function = "pwm_syn_clk"; groups = "pwm_syn_clk_grp"; }; - pinctrl_sys_irq: sys_irq { + pinctrl_sys_irq: sys_irq-pins { function = "sys_irq"; groups = "sys_irq_grp"; }; diff --git a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts index 3ad37fed71..9e5b1610dc 100644 --- a/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts +++ b/target/linux/bmips/dts/bcm6362-netgear-dgnd3700-v2.dts @@ -8,11 +8,13 @@ aliases { led-boot = &led_power_green; - led-failsafe = &led_power_green; + led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; + led-dsl = &led_dsl_green; led-ethernet = &led_ethernet_green; + led-internet = &led_internet_green; led-usb = &led_usb1_green; led-usb2 = &led_usb2_green; }; @@ -21,39 +23,39 @@ compatible = "gpio-keys-polled"; poll-interval = <20>; - reset { - label = "reset"; - gpios = <&pinctrl 24 GPIO_ACTIVE_LOW>; - linux,code = ; - debounce-interval = <60>; - }; - wlan { label = "wlan"; - gpios = <&pinctrl 25 GPIO_ACTIVE_LOW>; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; wps { label = "wps"; - gpios = <&pinctrl 26 GPIO_ACTIVE_LOW>; + gpios = <&gpio 25 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; + + reset { + label = "reset"; + gpios = <&gpio 31 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; }; leds { compatible = "gpio-leds"; - led@28 { + led_dsl_green: led@28 { label = "green:dsl"; - gpios = <&pinctrl 28 GPIO_ACTIVE_LOW>; + gpios = <&gpio 28 GPIO_ACTIVE_LOW>; }; - led@34 { + led_power_red: led@34 { label = "red:power"; - gpios = <&pinctrl 34 GPIO_ACTIVE_LOW>; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; }; }; }; @@ -79,7 +81,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_leds &pinctrl_serial_led>; - led@1 { + led_internet_green: led@1 { reg = <1>; active-low; label = "green:internet"; @@ -96,13 +98,13 @@ label = "green:wps"; }; - led@10 { + led_usb1_green: led@10 { reg = <10>; active-low; label = "green:usb1"; }; - led@11 { + led_usb2_green: led@11 { reg = <11>; active-low; label = "green:usb2"; @@ -126,13 +128,13 @@ label = "amber:dsl"; }; - led_usb1_green: led@16 { + led@16 { reg = <16>; active-low; label = "amber:usb1"; }; - led_usb2_green: led@17 { + led@17 { reg = <17>; active-low; label = "amber:usb2"; diff --git a/target/linux/bmips/dts/bcm6362.dtsi b/target/linux/bmips/dts/bcm6362.dtsi index 04df06c0db..77473c22bb 100644 --- a/target/linux/bmips/dts/bcm6362.dtsi +++ b/target/linux/bmips/dts/bcm6362.dtsi @@ -146,173 +146,174 @@ timeout-sec = <30>; }; - gpio: syscon@10000080 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@10000080 { + compatible = "brcm,bcm6362-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0x10000080 0x80>; + ranges = <0 0x10000080 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm6362-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm6362-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 48>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc 0 0>, - <&ext_intc 1 0>, - <&ext_intc 2 0>, - <&ext_intc 3 0>; - interrupt-names = "gpio24", - "gpio25", - "gpio26", - "gpio27"; + pinctrl: pinctrl@18 { + compatible = "brcm,bcm6362-pinctrl"; + reg = <0x18 0x10>, <0x38 0x4>; - pinctrl_usb_device_led: usb_device_led { + pinctrl_usb_device_led: usb_device_led-pins { function = "usb_device_led"; pins = "gpio0"; }; - pinctrl_sys_irq: sys_irq { + pinctrl_sys_irq: sys_irq-pins { function = "sys_irq"; pins = "gpio1"; }; - pinctrl_serial_led: serial_led { - pinctrl_serial_led_clk: serial_led_clk { + pinctrl_serial_led: serial_led-pins { + pinctrl_serial_led_clk: serial_led_clk-pins { function = "serial_led_clk"; pins = "gpio2"; }; - pinctrl_serial_led_data: serial_led_data { + pinctrl_serial_led_data: serial_led_data-pins { function = "serial_led_data"; pins = "gpio3"; }; }; - pinctrl_robosw_led_data: robosw_led_data { + pinctrl_robosw_led_data: robosw_led_data-pins { function = "robosw_led_data"; pins = "gpio4"; }; - pinctrl_robosw_led_clk: robosw_led_clk { + pinctrl_robosw_led_clk: robosw_led_clk-pins { function = "robosw_led_clk"; pins = "gpio5"; }; - pinctrl_robosw_led0: robosw_led0 { + pinctrl_robosw_led0: robosw_led0-pins { function = "robosw_led0"; pins = "gpio6"; }; - pinctrl_robosw_led1: robosw_led1 { + pinctrl_robosw_led1: robosw_led1-pins { function = "robosw_led1"; pins = "gpio7"; }; - pinctrl_inet_led: inet_led { + pinctrl_inet_led: inet_led-pins { function = "inet_led"; pins = "gpio8"; }; - pinctrl_spi_cs2: spi_cs2 { + pinctrl_spi_cs2: spi_cs2-pins { function = "spi_cs2"; pins = "gpio9"; }; - pinctrl_spi_cs3: spi_cs3 { + pinctrl_spi_cs3: spi_cs3-pins { function = "spi_cs3"; pins = "gpio10"; }; - pinctrl_ntr_pulse: ntr_pulse { + pinctrl_ntr_pulse: ntr_pulse-pins { function = "ntr_pulse"; pins = "gpio11"; }; - pinctrl_uart1_scts: uart1_scts { + pinctrl_uart1_scts: uart1_scts-pins { function = "uart1_scts"; pins = "gpio12"; }; - pinctrl_uart1_srts: uart1_srts { + pinctrl_uart1_srts: uart1_srts-pins { function = "uart1_srts"; pins = "gpio13"; }; - pinctrl_uart1: uart1 { - pinctrl_uart1_sdin: uart1_sdin { + pinctrl_uart1: uart1-pins { + pinctrl_uart1_sdin: uart1_sdin-pins { function = "uart1_sdin"; pins = "gpio14"; }; - pinctrl_uart1_sdout: uart1_sdout { + pinctrl_uart1_sdout: uart1_sdout-pins { function = "uart1_sdout"; pins = "gpio15"; }; }; - pinctrl_adsl_spi: adsl_spi { - pinctrl_adsl_spi_miso: adsl_spi_miso { + pinctrl_adsl_spi: adsl_spi-pins { + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { function = "adsl_spi_miso"; pins = "gpio16"; }; - pinctrl_adsl_spi_mosi: adsl_spi_mosi { + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { function = "adsl_spi_mosi"; pins = "gpio17"; }; - pinctrl_adsl_spi_clk: adsl_spi_clk { + pinctrl_adsl_spi_clk: adsl_spi_clk-pins { function = "adsl_spi_clk"; pins = "gpio18"; }; - pinctrl_adsl_spi_cs: adsl_spi_cs { + pinctrl_adsl_spi_cs: adsl_spi_cs-pins { function = "adsl_spi_cs"; pins = "gpio19"; }; }; - pinctrl_ephy0_led: ephy0_led { + pinctrl_ephy0_led: ephy0_led-pins { function = "ephy0_led"; pins = "gpio20"; }; - pinctrl_ephy1_led: ephy1_led { + pinctrl_ephy1_led: ephy1_led-pins { function = "ephy1_led"; pins = "gpio21"; }; - pinctrl_ephy2_led: ephy2_led { + pinctrl_ephy2_led: ephy2_led-pins { function = "ephy2_led"; pins = "gpio22"; }; - pinctrl_ephy3_led: ephy3_led { + pinctrl_ephy3_led: ephy3_led-pins { function = "ephy3_led"; pins = "gpio23"; }; - pinctrl_ext_irq0: ext_irq0 { + pinctrl_ext_irq0: ext_irq0-pins { function = "ext_irq0"; pins = "gpio24"; }; - pinctrl_ext_irq1: ext_irq1 { + pinctrl_ext_irq1: ext_irq1-pins { function = "ext_irq1"; pins = "gpio25"; }; - pinctrl_ext_irq2: ext_irq2 { + pinctrl_ext_irq2: ext_irq2-pins { function = "ext_irq2"; pins = "gpio26"; }; - pinctrl_ext_irq3: ext_irq3 { + pinctrl_ext_irq3: ext_irq3-pins { function = "ext_irq3"; pins = "gpio27"; }; - pinctrl_nand: nand { + pinctrl_nand: nand-pins { function = "nand"; group = "nand_grp"; }; diff --git a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts index 6466cb3aca..b4d2047cd8 100644 --- a/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts +++ b/target/linux/bmips/dts/bcm6368-comtrend-vr-3025u.dts @@ -11,6 +11,9 @@ led-failsafe = &led_power_red; led-running = &led_power_green; led-upgrade = &led_power_green; + + led-dsl = &led_dsl_green; + led-internet = &led_internet_green; }; keys { @@ -19,7 +22,7 @@ reset { label = "reset"; - gpios = <&pinctrl 34 GPIO_ACTIVE_LOW>; + gpios = <&gpio 34 GPIO_ACTIVE_LOW>; linux,code = ; debounce-interval = <60>; }; @@ -28,29 +31,29 @@ leds { compatible = "gpio-leds"; - led@2 { + led_dsl_green: led@2 { label = "green:dsl"; - gpios = <&pinctrl 2 GPIO_ACTIVE_LOW>; + gpios = <&gpio 2 GPIO_ACTIVE_LOW>; }; - led@5 { + led_internet_green: led@5 { label = "green:internet"; - gpios = <&pinctrl 5 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; }; led_power_green: led@22 { label = "green:power"; - gpios = <&pinctrl 22 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; }; led_power_red: led@24 { label = "red:power"; - gpios = <&pinctrl 24 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; }; led@31 { label = "red:internet"; - gpios = <&pinctrl 31 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; }; }; diff --git a/target/linux/bmips/dts/bcm6368.dtsi b/target/linux/bmips/dts/bcm6368.dtsi index afdf3c5dc0..b50a572fd0 100644 --- a/target/linux/bmips/dts/bcm6368.dtsi +++ b/target/linux/bmips/dts/bcm6368.dtsi @@ -148,198 +148,190 @@ timeout-sec = <30>; }; - gpio: syscon@10000080 { - compatible = "syscon", "simple-mfd"; + gpio_cntl: syscon@10000080 { + compatible = "brcm,bcm6368-gpio-sysctl", + "syscon", "simple-mfd"; reg = <0x10000080 0x80>; + ranges = <0 0x10000080 0x80>; native-endian; - pinctrl: pin-controller { - compatible = "brcm,bcm6368-pinctrl"; + gpio: gpio@0 { + compatible = "brcm,bcm6368-gpio"; + reg-names = "dirout", "dat"; + reg = <0x0 0x8>, <0x8 0x8>; gpio-controller; + gpio-ranges = <&pinctrl 0 0 38>; #gpio-cells = <2>; + }; - interrupts-extended = <&ext_intc1 0 0>, - <&ext_intc1 1 0>, - <&ext_intc0 0 0>, - <&ext_intc0 1 0>, - <&ext_intc0 2 0>, - <&ext_intc0 3 0>; - interrupt-names = "gpio32", - "gpio33", - "gpio34", - "gpio35", - "gpio36", - "gpio37"; + pinctrl: pinctrl@18 { + compatible = "brcm,bcm6368-pinctrl"; + reg = <0x18 0x4>, <0x38 0x4>; - pinctrl_analog_afe_0: analog_afe_0 { + pinctrl_analog_afe_0: analog_afe_0-pins { function = "analog_afe_0"; pins = "gpio0"; }; - pinctrl_analog_afe_1: analog_afe_1 { + pinctrl_analog_afe_1: analog_afe_1-pins { function = "analog_afe_1"; pins = "gpio1"; }; - pinctrl_sys_irq: sys_irq { + pinctrl_sys_irq: sys_irq-pins { function = "sys_irq"; pins = "gpio2"; }; - pinctrl_serial_led: serial_led { - pinctrl_serial_led_data: serial_led_data { + pinctrl_serial_led: serial_led-pins { + pinctrl_serial_led_data: serial_led_data-pins { function = "serial_led_data"; pins = "gpio3"; }; - pinctrl_serial_led_clk: serial_led_clk { + pinctrl_serial_led_clk: serial_led_clk-pins { function = "serial_led_clk"; pins = "gpio4"; }; }; - pinctrl_inet_led: inet_led { + pinctrl_inet_led: inet_led-pins { function = "inet_led"; pins = "gpio5"; }; - pinctrl_ephy0_led: ephy0_led { + pinctrl_ephy0_led: ephy0_led-pins { function = "ephy0_led"; pins = "gpio6"; }; - pinctrl_ephy1_led: ephy1_led { + pinctrl_ephy1_led: ephy1_led-pins { function = "ephy1_led"; pins = "gpio7"; }; - pinctrl_ephy2_led: ephy2_led { + pinctrl_ephy2_led: ephy2_led-pins { function = "ephy2_led"; pins = "gpio8"; }; - pinctrl_ephy3_led: ephy3_led { + pinctrl_ephy3_led: ephy3_led-pins { function = "ephy3_led"; pins = "gpio9"; }; - pinctrl_robosw_led_data: robosw_led_data { + pinctrl_robosw_led_data: robosw_led_data-pins { function = "robosw_led_data"; pins = "gpio10"; }; - pinctrl_robosw_led_clk: robosw_led_clk { + pinctrl_robosw_led_clk: robosw_led_clk-pins { function = "robosw_led_clk"; pins = "gpio11"; }; - pinctrl_robosw_led0: robosw_led0 { + pinctrl_robosw_led0: robosw_led0-pins { function = "robosw_led0"; pins = "gpio12"; }; - pinctrl_robosw_led1: robosw_led1 { + pinctrl_robosw_led1: robosw_led1-pins { function = "robosw_led1"; pins = "gpio13"; }; - pinctrl_usb_device_led: usb_device_led { + pinctrl_usb_device_led: usb_device_led-pins { function = "usb_device_led"; pins = "gpio14"; }; - pinctrl_pci: pci { - pinctrl_pci_req1: pci_req1 { + pinctrl_pci: pci-pins { + pinctrl_pci_req1: pci_req1-pins { function = "pci_req1"; pins = "gpio16"; }; - pinctrl_pci_gnt1: pci_gnt1 { + pinctrl_pci_gnt1: pci_gnt1-pins { function = "pci_gnt1"; pins = "gpio17"; }; - pinctrl_pci_intb: pci_intb { + pinctrl_pci_intb: pci_intb-pins { function = "pci_intb"; pins = "gpio18"; }; - pinctrl_pci_req0: pci_req0 { + pinctrl_pci_req0: pci_req0-pins { function = "pci_req0"; pins = "gpio19"; }; - pinctrl_pci_gnt0: pci_gnt0 { + pinctrl_pci_gnt0: pci_gnt0-pins { function = "pci_gnt0"; pins = "gpio20"; }; }; - pinctrl_pcmcia: pcmcia { - pinctrl_pcmcia_cd1: pcmcia_cd1 { + pinctrl_pcmcia: pcmcia-pins { + pinctrl_pcmcia_cd1: pcmcia_cd1-pins { function = "pcmcia_cd1"; pins = "gpio22"; }; - pinctrl_pcmcia_cd2: pcmcia_cd2 { + pinctrl_pcmcia_cd2: pcmcia_cd2-pins { function = "pcmcia_cd2"; pins = "gpio23"; }; - pinctrl_pcmcia_vs1: pcmcia_vs1 { + pinctrl_pcmcia_vs1: pcmcia_vs1-pins { function = "pcmcia_vs1"; pins = "gpio24"; }; - pinctrl_pcmcia_vs2: pcmcia_vs2 { + pinctrl_pcmcia_vs2: pcmcia_vs2-pins { function = "pcmcia_vs2"; pins = "gpio25"; }; }; - pinctrl_ebi_cs2: ebi_cs2 { + pinctrl_ebi_cs2: ebi_cs2-pins { function = "ebi_cs2"; pins = "gpio26"; }; - pinctrl_ebi_cs3: ebi_cs3 { + pinctrl_ebi_cs3: ebi_cs3-pins { function = "ebi_cs3"; pins = "gpio27"; }; - pinctrl_spi_cs2: spi_cs2 { + pinctrl_spi_cs2: spi_cs2-pins { function = "spi_cs2"; pins = "gpio28"; }; - pinctrl_spi_cs3: spi_cs3 { + pinctrl_spi_cs3: spi_cs3-pins { function = "spi_cs3"; pins = "gpio29"; }; - pinctrl_spi_cs4: spi_cs4 { + pinctrl_spi_cs4: spi_cs4-pins { function = "spi_cs4"; pins = "gpio30"; }; - pinctrl_spi_cs5: spi_cs5 { + pinctrl_spi_cs5: spi_cs5-pins { function = "spi_cs5"; pins = "gpio31"; }; - pinctrl_uart1: uart1 { + pinctrl_uart1: uart1-pins { function = "uart1"; group = "uart1_grp"; }; }; }; - gpiobasemode: gpiobasemode@100000b8 { - compatible = "brcm,bcm6368-gpiobasemode", "syscon"; - reg = <0x100000b8 0x4>; - }; - leds: led-controller@100000d0 { #address-cells = <1>; #size-cells = <0>; diff --git a/target/linux/bmips/patches-5.10/052-v5.13-gpio-guard-gpiochip_irqchip_add_domain-with-GPIOLIB_.patch b/target/linux/bmips/patches-5.10/052-v5.13-gpio-guard-gpiochip_irqchip_add_domain-with-GPIOLIB_.patch new file mode 100644 index 0000000000..b0093e9216 --- /dev/null +++ b/target/linux/bmips/patches-5.10/052-v5.13-gpio-guard-gpiochip_irqchip_add_domain-with-GPIOLIB_.patch @@ -0,0 +1,45 @@ +From 9c7d24693d864f90b27aad5d15fbfe226c02898b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:02 +0100 +Subject: [PATCH 01/22] gpio: guard gpiochip_irqchip_add_domain() with + GPIOLIB_IRQCHIP +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in +a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP +isn't enabled. + +Fixes: 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()") +Suggested-by: Michael Walle +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Linus Walleij +Reviewed-by: Michael Walle +Acked-by: Bartosz Golaszewski +Link: https://lore.kernel.org/r/20210324081923.20379-2-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + include/linux/gpio/driver.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/include/linux/gpio/driver.h ++++ b/include/linux/gpio/driver.h +@@ -637,8 +637,17 @@ int gpiochip_irqchip_add_key(struct gpio + bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc, + unsigned int offset); + ++#ifdef CONFIG_GPIOLIB_IRQCHIP + int gpiochip_irqchip_add_domain(struct gpio_chip *gc, + struct irq_domain *domain); ++#else ++static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc, ++ struct irq_domain *domain) ++{ ++ WARN_ON(1); ++ return -EINVAL; ++} ++#endif + + #ifdef CONFIG_LOCKDEP + diff --git a/target/linux/bmips/patches-5.10/053-v5.13-gpio-regmap-set-gpio_chip-of_node.patch b/target/linux/bmips/patches-5.10/053-v5.13-gpio-regmap-set-gpio_chip-of_node.patch new file mode 100644 index 0000000000..58dfaff8bd --- /dev/null +++ b/target/linux/bmips/patches-5.10/053-v5.13-gpio-regmap-set-gpio_chip-of_node.patch @@ -0,0 +1,63 @@ +From d46bf9ec4596654f36245e3b14765bcb422be6ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:03 +0100 +Subject: [PATCH 02/22] gpio: regmap: set gpio_chip of_node +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This is needed for properly registering GPIO regmap as a child of a regmap +pin controller. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Michael Walle +Reviewed-by: Andy Shevchenko +Acked-by: Bartosz Golaszewski +Link: https://lore.kernel.org/r/20210324081923.20379-3-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/gpio/gpio-regmap.c | 5 +++++ + include/linux/gpio/regmap.h | 4 ++++ + 2 files changed, 9 insertions(+) + +--- a/drivers/gpio/gpio-regmap.c ++++ b/drivers/gpio/gpio-regmap.c +@@ -254,6 +254,11 @@ struct gpio_regmap *gpio_regmap_register + chip->names = config->names; + chip->label = config->label ?: dev_name(config->parent); + ++#if defined(CONFIG_OF_GPIO) ++ /* gpiolib will use of_node of the parent if chip->of_node is NULL */ ++ chip->of_node = to_of_node(config->fwnode); ++#endif /* CONFIG_OF_GPIO */ ++ + /* + * If our regmap is fast_io we should probably set can_sleep to false. + * Right now, the regmap doesn't save this property, nor is there any +--- a/include/linux/gpio/regmap.h ++++ b/include/linux/gpio/regmap.h +@@ -4,6 +4,7 @@ + #define _LINUX_GPIO_REGMAP_H + + struct device; ++struct fwnode_handle; + struct gpio_regmap; + struct irq_domain; + struct regmap; +@@ -16,6 +17,8 @@ struct regmap; + * @parent: The parent device + * @regmap: The regmap used to access the registers + * given, the name of the device is used ++ * @fwnode: (Optional) The firmware node. ++ * If not given, the fwnode of the parent is used. + * @label: (Optional) Descriptive name for GPIO controller. + * If not given, the name of the device is used. + * @ngpio: Number of GPIOs +@@ -57,6 +60,7 @@ struct regmap; + struct gpio_regmap_config { + struct device *parent; + struct regmap *regmap; ++ struct fwnode_handle *fwnode; + + const char *label; + int ngpio; diff --git a/target/linux/bmips/patches-5.10/054-v5.13-dt-bindings-improve-BCM6345-GPIO-binding-documentati.patch b/target/linux/bmips/patches-5.10/054-v5.13-dt-bindings-improve-BCM6345-GPIO-binding-documentati.patch new file mode 100644 index 0000000000..85b751df05 --- /dev/null +++ b/target/linux/bmips/patches-5.10/054-v5.13-dt-bindings-improve-BCM6345-GPIO-binding-documentati.patch @@ -0,0 +1,163 @@ +From fb9da17bd26552f48cda4f2f658379e7f5860691 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:04 +0100 +Subject: [PATCH 03/22] dt-bindings: improve BCM6345 GPIO binding documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Convert existing BCM6345 GPIO binding documentation to YAML and add binding +documentation for the GPIO controller found in BCM6318, BCM6328, BCM6358, +BCM6362, BCM6368 and BCM63268 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-4-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../bindings/gpio/brcm,bcm6345-gpio.txt | 46 ---------- + .../bindings/gpio/brcm,bcm6345-gpio.yaml | 86 +++++++++++++++++++ + 2 files changed, 86 insertions(+), 46 deletions(-) + delete mode 100644 Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.txt + create mode 100644 Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml + +--- a/Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.txt ++++ /dev/null +@@ -1,46 +0,0 @@ +-Bindings for the Broadcom's brcm,bcm6345-gpio memory-mapped GPIO controllers. +- +-These bindings can be used on any BCM63xx SoC. However, BCM6338 and BCM6345 +-are the only ones which don't need a pinctrl driver. +-BCM6338 have 8-bit data and dirout registers, where GPIO state can be read +-and/or written, and the direction changed from input to output. +-BCM6345 have 16-bit data and dirout registers, where GPIO state can be read +-and/or written, and the direction changed from input to output. +- +-Required properties: +- - compatible: should be "brcm,bcm6345-gpio" +- - reg-names: must contain +- "dat" - data register +- "dirout" - direction (output) register +- - reg: address + size pairs describing the GPIO register sets; +- order must correspond with the order of entries in reg-names +- - #gpio-cells: must be set to 2. The first cell is the pin number and +- the second cell is used to specify the gpio polarity: +- 0 = active high +- 1 = active low +- - gpio-controller: Marks the device node as a gpio controller. +- +-Optional properties: +- - native-endian: use native endian memory. +- +-Examples: +- - BCM6338: +- gpio: gpio-controller@fffe0407 { +- compatible = "brcm,bcm6345-gpio"; +- reg-names = "dirout", "dat"; +- reg = <0xfffe0407 1>, <0xfffe040f 1>; +- +- #gpio-cells = <2>; +- gpio-controller; +- }; +- +- - BCM6345: +- gpio: gpio-controller@fffe0406 { +- compatible = "brcm,bcm6345-gpio"; +- reg-names = "dirout", "dat"; +- reg = <0xfffe0406 2>, <0xfffe040a 2>; +- native-endian; +- +- #gpio-cells = <2>; +- gpio-controller; +- }; +--- /dev/null ++++ b/Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml +@@ -0,0 +1,86 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/gpio/brcm,bcm6345-gpio.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6345 GPIO controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: |+ ++ Bindings for Broadcom's BCM63xx memory-mapped GPIO controllers. ++ ++ These bindings can be used on any BCM63xx SoC. However, BCM6338 and BCM6345 ++ are the only ones which don't need a pinctrl driver. ++ ++ BCM6338 have 8-bit data and dirout registers, where GPIO state can be read ++ and/or written, and the direction changed from input to output. ++ BCM6345 have 16-bit data and dirout registers, where GPIO state can be read ++ and/or written, and the direction changed from input to output. ++ BCM6318, BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268 have 32-bit data ++ and dirout registers, where GPIO state can be read and/or written, and the ++ direction changed from input to output. ++ ++properties: ++ compatible: ++ enum: ++ - brcm,bcm6318-gpio ++ - brcm,bcm6328-gpio ++ - brcm,bcm6345-gpio ++ - brcm,bcm6358-gpio ++ - brcm,bcm6362-gpio ++ - brcm,bcm6368-gpio ++ - brcm,bcm63268-gpio ++ ++ gpio-controller: true ++ ++ "#gpio-cells": ++ const: 2 ++ ++ gpio-ranges: ++ maxItems: 1 ++ ++ native-endian: true ++ ++ reg: ++ maxItems: 2 ++ ++ reg-names: ++ items: ++ - const: dirout ++ - const: dat ++ ++required: ++ - compatible ++ - reg ++ - reg-names ++ - gpio-controller ++ - '#gpio-cells' ++ ++additionalProperties: false ++ ++examples: ++ - | ++ gpio@fffe0406 { ++ compatible = "brcm,bcm6345-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0xfffe0406 2>, <0xfffe040a 2>; ++ native-endian; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; ++ ++ - | ++ gpio@0 { ++ compatible = "brcm,bcm63268-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 52>; ++ #gpio-cells = <2>; ++ }; diff --git a/target/linux/bmips/patches-5.10/055-v5.13-pinctrl-bcm-add-bcm63xx-base-code.patch b/target/linux/bmips/patches-5.10/055-v5.13-pinctrl-bcm-add-bcm63xx-base-code.patch new file mode 100644 index 0000000000..eec8b98a49 --- /dev/null +++ b/target/linux/bmips/patches-5.10/055-v5.13-pinctrl-bcm-add-bcm63xx-base-code.patch @@ -0,0 +1,208 @@ +From 132f95016db0a0a0659e99b471a7d3fd0c60f961 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:05 +0100 +Subject: [PATCH 04/22] pinctrl: bcm: add bcm63xx base code +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add a helper for registering BCM63XX pin controllers. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-5-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + drivers/pinctrl/bcm/Kconfig | 7 ++ + drivers/pinctrl/bcm/Makefile | 1 + + drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 109 ++++++++++++++++++++++++++ + drivers/pinctrl/bcm/pinctrl-bcm63xx.h | 43 ++++++++++ + 4 files changed, 160 insertions(+) + create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.c + create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.h + +--- a/drivers/pinctrl/bcm/Kconfig ++++ b/drivers/pinctrl/bcm/Kconfig +@@ -29,6 +29,13 @@ config PINCTRL_BCM2835 + help + Say Y here to enable the Broadcom BCM2835 GPIO driver. + ++config PINCTRL_BCM63XX ++ bool ++ select GENERIC_PINCONF ++ select GPIO_REGMAP ++ select PINCONF ++ select PINMUX ++ + config PINCTRL_IPROC_GPIO + bool "Broadcom iProc GPIO (with PINCONF) driver" + depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) +--- a/drivers/pinctrl/bcm/Makefile ++++ b/drivers/pinctrl/bcm/Makefile +@@ -3,6 +3,7 @@ + + obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o + obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o ++obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o + obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o + obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o + obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o +--- /dev/null ++++ b/drivers/pinctrl/bcm/pinctrl-bcm63xx.c +@@ -0,0 +1,109 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Driver for BCM63xx GPIO unit (pinctrl + GPIO) ++ * ++ * Copyright (C) 2021 Álvaro Fernández Rojas ++ * Copyright (C) 2016 Jonas Gorski ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "pinctrl-bcm63xx.h" ++ ++#define BCM63XX_BANK_SIZE 4 ++ ++#define BCM63XX_DIROUT_REG 0x04 ++#define BCM63XX_DATA_REG 0x0c ++ ++static int bcm63xx_reg_mask_xlate(struct gpio_regmap *gpio, ++ unsigned int base, unsigned int offset, ++ unsigned int *reg, unsigned int *mask) ++{ ++ unsigned int line = offset % BCM63XX_BANK_GPIOS; ++ unsigned int stride = offset / BCM63XX_BANK_GPIOS; ++ ++ *reg = base - stride * BCM63XX_BANK_SIZE; ++ *mask = BIT(line); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm63xx_gpio_of_match[] = { ++ { .compatible = "brcm,bcm6318-gpio", }, ++ { .compatible = "brcm,bcm6328-gpio", }, ++ { .compatible = "brcm,bcm6358-gpio", }, ++ { .compatible = "brcm,bcm6362-gpio", }, ++ { .compatible = "brcm,bcm6368-gpio", }, ++ { .compatible = "brcm,bcm63268-gpio", }, ++ { /* sentinel */ } ++}; ++ ++static int bcm63xx_gpio_probe(struct device *dev, struct device_node *node, ++ const struct bcm63xx_pinctrl_soc *soc, ++ struct bcm63xx_pinctrl *pc) ++{ ++ struct gpio_regmap_config grc = {0}; ++ ++ grc.parent = dev; ++ grc.fwnode = &node->fwnode; ++ grc.ngpio = soc->ngpios; ++ grc.ngpio_per_reg = BCM63XX_BANK_GPIOS; ++ grc.regmap = pc->regs; ++ grc.reg_dat_base = BCM63XX_DATA_REG; ++ grc.reg_dir_out_base = BCM63XX_DIROUT_REG; ++ grc.reg_set_base = BCM63XX_DATA_REG; ++ grc.reg_mask_xlate = bcm63xx_reg_mask_xlate; ++ ++ return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &grc)); ++} ++ ++int bcm63xx_pinctrl_probe(struct platform_device *pdev, ++ const struct bcm63xx_pinctrl_soc *soc, ++ void *driver_data) ++{ ++ struct device *dev = &pdev->dev; ++ struct bcm63xx_pinctrl *pc; ++ struct device_node *node; ++ int err; ++ ++ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); ++ if (!pc) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, pc); ++ ++ pc->dev = dev; ++ pc->driver_data = driver_data; ++ ++ pc->regs = syscon_node_to_regmap(dev->parent->of_node); ++ if (IS_ERR(pc->regs)) ++ return PTR_ERR(pc->regs); ++ ++ pc->pctl_desc.name = dev_name(dev); ++ pc->pctl_desc.pins = soc->pins; ++ pc->pctl_desc.npins = soc->npins; ++ pc->pctl_desc.pctlops = soc->pctl_ops; ++ pc->pctl_desc.pmxops = soc->pmx_ops; ++ pc->pctl_desc.owner = THIS_MODULE; ++ ++ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); ++ if (IS_ERR(pc->pctl_dev)) ++ return PTR_ERR(pc->pctl_dev); ++ ++ for_each_child_of_node(dev->parent->of_node, node) { ++ if (of_match_node(bcm63xx_gpio_of_match, node)) { ++ err = bcm63xx_gpio_probe(dev, node, soc, pc); ++ if (err) { ++ dev_err(dev, "could not add GPIO chip\n"); ++ of_node_put(node); ++ return err; ++ } ++ } ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/pinctrl/bcm/pinctrl-bcm63xx.h +@@ -0,0 +1,43 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2021 Álvaro Fernández Rojas ++ * Copyright (C) 2016 Jonas Gorski ++ */ ++ ++#ifndef __PINCTRL_BCM63XX_H__ ++#define __PINCTRL_BCM63XX_H__ ++ ++#include ++ ++#define BCM63XX_BANK_GPIOS 32 ++ ++struct bcm63xx_pinctrl_soc { ++ struct pinctrl_ops *pctl_ops; ++ struct pinmux_ops *pmx_ops; ++ ++ const struct pinctrl_pin_desc *pins; ++ unsigned npins; ++ ++ unsigned int ngpios; ++}; ++ ++struct bcm63xx_pinctrl { ++ struct device *dev; ++ struct regmap *regs; ++ ++ struct pinctrl_desc pctl_desc; ++ struct pinctrl_dev *pctl_dev; ++ ++ void *driver_data; ++}; ++ ++static inline unsigned int bcm63xx_bank_pin(unsigned int pin) ++{ ++ return pin % BCM63XX_BANK_GPIOS; ++} ++ ++int bcm63xx_pinctrl_probe(struct platform_device *pdev, ++ const struct bcm63xx_pinctrl_soc *soc, ++ void *driver_data); ++ ++#endif /* __PINCTRL_BCM63XX_H__ */ diff --git a/target/linux/bmips/patches-5.10/056-v5.13-dt-bindings-add-BCM6328-pincontroller-binding-docume.patch b/target/linux/bmips/patches-5.10/056-v5.13-dt-bindings-add-BCM6328-pincontroller-binding-docume.patch new file mode 100644 index 0000000000..af15da971f --- /dev/null +++ b/target/linux/bmips/patches-5.10/056-v5.13-dt-bindings-add-BCM6328-pincontroller-binding-docume.patch @@ -0,0 +1,152 @@ +From 44dbcd8eb08a0febbb46ac7b9331f28a320bdf9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:06 +0100 +Subject: [PATCH 05/22] dt-bindings: add BCM6328 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in BCM6328 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-6-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm6328-pinctrl.yaml | 127 ++++++++++++++++++ + 1 file changed, 127 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml +@@ -0,0 +1,127 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6328-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6328 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM6328 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm6328-pinctrl ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ serial_led_data, serial_led_clk, inet_act_led, pcie_clkreq, ++ led, ephy0_act_led, ephy1_act_led, ephy2_act_led, ++ ephy3_act_led, hsspi_cs1, usb_device_port, usb_host_port ] ++ ++ pins: ++ enum: [ gpio6, gpio7, gpio11, gpio16, gpio17, gpio18, gpio19, ++ gpio20, gpio25, gpio26, gpio27, gpio28, hsspi_cs1, ++ usb_port1 ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@18 { ++ compatible = "brcm,bcm6328-pinctrl"; ++ reg = <0x18 0x10>; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio7"; ++ }; ++ }; ++ ++ pinctrl_inet_act_led: inet_act_led-pins { ++ function = "inet_act_led"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_pcie_clkreq: pcie_clkreq-pins { ++ function = "pcie_clkreq"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_ephy0_spd_led: ephy0_spd_led-pins { ++ function = "led"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_ephy1_spd_led: ephy1_spd_led-pins { ++ function = "led"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_ephy2_spd_led: ephy2_spd_led-pins { ++ function = "led"; ++ pins = "gpio19"; ++ }; ++ ++ pinctrl_ephy3_spd_led: ephy3_spd_led-pins { ++ function = "led"; ++ pins = "gpio20"; ++ }; ++ ++ pinctrl_ephy0_act_led: ephy0_act_led-pins { ++ function = "ephy0_act_led"; ++ pins = "gpio25"; ++ }; ++ ++ pinctrl_ephy1_act_led: ephy1_act_led-pins { ++ function = "ephy1_act_led"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ephy2_act_led: ephy2_act_led-pins { ++ function = "ephy2_act_led"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_ephy3_act_led: ephy3_act_led-pins { ++ function = "ephy3_act_led"; ++ pins = "gpio28"; ++ }; ++ ++ pinctrl_hsspi_cs1: hsspi_cs1-pins { ++ function = "hsspi_cs1"; ++ pins = "hsspi_cs1"; ++ }; ++ ++ pinctrl_usb_port1_device: usb_port1_device-pins { ++ function = "usb_device_port"; ++ pins = "usb_port1"; ++ }; ++ ++ pinctrl_usb_port1_host: usb_port1_host-pins { ++ function = "usb_host_port"; ++ pins = "usb_port1"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/057-v5.13-dt-bindings-add-BCM6328-GPIO-sysctl-binding-document.patch b/target/linux/bmips/patches-5.10/057-v5.13-dt-bindings-add-BCM6328-GPIO-sysctl-binding-document.patch new file mode 100644 index 0000000000..3c1e48d300 --- /dev/null +++ b/target/linux/bmips/patches-5.10/057-v5.13-dt-bindings-add-BCM6328-GPIO-sysctl-binding-document.patch @@ -0,0 +1,185 @@ +From 7f9dfaa2afb6bc3481e531c405b05acf6091af29 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:07 +0100 +Subject: [PATCH 06/22] dt-bindings: add BCM6328 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM6328 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-7-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm6328-gpio-sysctl.yaml | 162 ++++++++++++++++++ + 1 file changed, 162 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm6328-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm6328-gpio-sysctl.yaml +@@ -0,0 +1,162 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm6328-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6328 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM6328 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm6328-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm6328-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@10000080 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm6328-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0x10000080 0x80>; ++ ranges = <0 0x10000080 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm6328-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 32>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@18 { ++ compatible = "brcm,bcm6328-pinctrl"; ++ reg = <0x18 0x10>; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio7"; ++ }; ++ }; ++ ++ pinctrl_inet_act_led: inet_act_led-pins { ++ function = "inet_act_led"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_pcie_clkreq: pcie_clkreq-pins { ++ function = "pcie_clkreq"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_ephy0_spd_led: ephy0_spd_led-pins { ++ function = "led"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_ephy1_spd_led: ephy1_spd_led-pins { ++ function = "led"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_ephy2_spd_led: ephy2_spd_led-pins { ++ function = "led"; ++ pins = "gpio19"; ++ }; ++ ++ pinctrl_ephy3_spd_led: ephy3_spd_led-pins { ++ function = "led"; ++ pins = "gpio20"; ++ }; ++ ++ pinctrl_ephy0_act_led: ephy0_act_led-pins { ++ function = "ephy0_act_led"; ++ pins = "gpio25"; ++ }; ++ ++ pinctrl_ephy1_act_led: ephy1_act_led-pins { ++ function = "ephy1_act_led"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ephy2_act_led: ephy2_act_led-pins { ++ function = "ephy2_act_led"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_ephy3_act_led: ephy3_act_led-pins { ++ function = "ephy3_act_led"; ++ pins = "gpio28"; ++ }; ++ ++ pinctrl_hsspi_cs1: hsspi_cs1-pins { ++ function = "hsspi_cs1"; ++ pins = "hsspi_cs1"; ++ }; ++ ++ pinctrl_usb_port1_device: usb_port1_device-pins { ++ function = "usb_device_port"; ++ pins = "usb_port1"; ++ }; ++ ++ pinctrl_usb_port1_host: usb_port1_host-pins { ++ function = "usb_host_port"; ++ pins = "usb_port1"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/401-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch b/target/linux/bmips/patches-5.10/058-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch similarity index 62% rename from target/linux/bmips/patches-5.10/401-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch rename to target/linux/bmips/patches-5.10/058-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch index 0e223f2fca..90929d8d1f 100644 --- a/target/linux/bmips/patches-5.10/401-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch +++ b/target/linux/bmips/patches-5.10/058-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6328.patch @@ -1,38 +1,38 @@ -From 3373a507212e6394921781766e9cd0dc155c62ba Mon Sep 17 00:00:00 2001 +From 9bf34ac5ab5805f0a798d40423c05596b7a0cee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:12:50 +0200 -Subject: [PATCH 02/12] pinctrl: add a pincontrol driver for BCM6328 +Date: Wed, 24 Mar 2021 09:19:08 +0100 +Subject: [PATCH 07/22] pinctrl: add a pincontrol driver for BCM6328 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as +Add a pincontrol driver for BCM6328. BCM6328 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-8-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm6328.c | 581 ++++++++++++++++++++++++++ - 3 files changed, 593 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm6328.c | 404 ++++++++++++++++++++++++++ + 3 files changed, 413 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -29,6 +29,17 @@ config PINCTRL_BCM2835 - help - Say Y here to enable the Broadcom BCM2835 GPIO driver. +@@ -36,6 +36,14 @@ config PINCTRL_BCM63XX + select PINCONF + select PINMUX +config PINCTRL_BCM6328 + bool "Broadcom BCM6328 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM6328 GPIO driver. @@ -42,17 +42,17 @@ Signed-off-by: Jonas Gorski depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -3,6 +3,7 @@ - +@@ -4,6 +4,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o + obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o +obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm6328.c -@@ -0,0 +1,581 @@ +@@ -0,0 +1,404 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM6328 GPIO unit (pinctrl + GPIO) @@ -61,36 +61,25 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm6328-pinctrl" ++#include "pinctrl-bcm63xx.h" ++ +#define BCM6328_NUM_GPIOS 32 + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#define BCM6328_DIROUT_REG 0x04 -+#define BCM6328_DATA_REG 0x0c +#define BCM6328_MODE_REG 0x18 +#define BCM6328_MUX_HI_REG 0x1c +#define BCM6328_MUX_LO_REG 0x20 +#define BCM6328_MUX_OTHER_REG 0x24 ++#define BCM6328_MUX_MASK GENMASK(1, 0) + +struct bcm6328_pingroup { + const char *name; @@ -107,14 +96,10 @@ Signed-off-by: Jonas Gorski + unsigned mux_val:2; +}; + -+struct bcm6328_pinctrl { -+ struct device *dev; -+ struct regmap *regs; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; ++static const unsigned int bcm6328_mux[] = { ++ BCM6328_MUX_LO_REG, ++ BCM6328_MUX_HI_REG, ++ BCM6328_MUX_OTHER_REG +}; + +static const struct pinctrl_pin_desc bcm6328_pins[] = { @@ -344,119 +329,11 @@ Signed-off-by: Jonas Gorski + BCM6328_MUX_FUN(usb_device_port, 2), +}; + -+static inline unsigned int bcm6328_bank_pin(unsigned int pin) ++static inline unsigned int bcm6328_mux_off(unsigned int pin) +{ -+ return pin % PINS_PER_BANK; -+} -+ -+static inline unsigned int bcm6318_mux_off(unsigned int pin) -+{ -+ static const unsigned int bcm6328_mux[] = { -+ BCM6328_MUX_LO_REG, -+ BCM6328_MUX_HI_REG, -+ BCM6328_MUX_OTHER_REG -+ }; -+ + return bcm6328_mux[pin / 16]; +} + -+static inline unsigned int bcm6328_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm6328_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm6328_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6328_reg_off(BCM6328_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6328_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm6328_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm6328_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6328_reg_off(BCM6328_DATA_REG, pin); -+ unsigned int dirout = bcm6328_reg_off(BCM6328_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6328_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm6328_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6328_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6328_reg_off(BCM6328_DATA_REG, pin); -+ unsigned int bank_pin = bcm6328_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm6328_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6328_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6328_reg_off(BCM6328_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6328_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm6328_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm6328_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6328_reg_off(BCM6328_DATA_REG, pin); -+ unsigned int bank_pin = bcm6328_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm6328_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ +static int bcm6328_pinctrl_get_group_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(bcm6328_groups); @@ -500,22 +377,22 @@ Signed-off-by: Jonas Gorski + return 0; +} + -+static void bcm6328_rmw_mux(struct bcm6328_pinctrl *pc, unsigned pin, ++static void bcm6328_rmw_mux(struct bcm63xx_pinctrl *pc, unsigned pin, + unsigned int mode, unsigned int mux) +{ + if (pin < BCM6328_NUM_GPIOS) + regmap_update_bits(pc->regs, BCM6328_MODE_REG, BIT(pin), + mode ? BIT(pin) : 0); + -+ regmap_update_bits(pc->regs, bcm6318_mux_off(pin), -+ 3UL << ((pin % 16) * 2), ++ regmap_update_bits(pc->regs, bcm6328_mux_off(pin), ++ BCM6328_MUX_MASK << ((pin % 16) * 2), + mux << ((pin % 16) * 2)); +} + +static int bcm6328_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm6328_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + const struct bcm6328_pingroup *pg = &bcm6328_groups[group]; + const struct bcm6328_function *f = &bcm6328_funcs[selector]; + @@ -528,7 +405,7 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm6328_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + + /* disable all functions using this pin */ + bcm6328_rmw_mux(pc, offset, 0, 0); @@ -537,98 +414,44 @@ Signed-off-by: Jonas Gorski +} + +static struct pinctrl_ops bcm6328_pctl_ops = { -+ .get_groups_count = bcm6328_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm6328_pinctrl_get_group_name, + .get_group_pins = bcm6328_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm6328_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm6328_pmx_ops = { -+ .get_functions_count = bcm6328_pinctrl_get_func_count, -+ .get_function_name = bcm6328_pinctrl_get_func_name, + .get_function_groups = bcm6328_pinctrl_get_groups, -+ .set_mux = bcm6328_pinctrl_set_mux, ++ .get_function_name = bcm6328_pinctrl_get_func_name, ++ .get_functions_count = bcm6328_pinctrl_get_func_count, + .gpio_request_enable = bcm6328_gpio_request_enable, ++ .set_mux = bcm6328_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm6328_soc = { ++ .ngpios = BCM6328_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm6328_pins), ++ .pctl_ops = &bcm6328_pctl_ops, ++ .pins = bcm6328_pins, ++ .pmx_ops = &bcm6328_pmx_ops, ++}; ++ +static int bcm6328_pinctrl_probe(struct platform_device *pdev) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm6328_pinctrl *pc; -+ int err; -+ -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm6328_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm6328_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm6328_gpio_get_direction; -+ pc->gpio_chip.get = bcm6328_gpio_get; -+ pc->gpio_chip.set = bcm6328_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM6328_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm6328_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); -+ return err; -+ } -+ -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm6328_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm6328_pins), -+ pc->pctl_desc.pctlops = &bcm6328_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm6328_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, -+ -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM6328_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); -+ -+ return 0; ++ return bcm63xx_pinctrl_probe(pdev, &bcm6328_soc, NULL); +} + +static const struct of_device_id bcm6328_pinctrl_match[] = { + { .compatible = "brcm,bcm6328-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm6328_pinctrl_driver = { + .probe = bcm6328_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm6328-pinctrl", + .of_match_table = bcm6328_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/059-v5.13-dt-bindings-add-BCM6358-pincontroller-binding-docume.patch b/target/linux/bmips/patches-5.10/059-v5.13-dt-bindings-add-BCM6358-pincontroller-binding-docume.patch new file mode 100644 index 0000000000..001f94c5a5 --- /dev/null +++ b/target/linux/bmips/patches-5.10/059-v5.13-dt-bindings-add-BCM6358-pincontroller-binding-docume.patch @@ -0,0 +1,118 @@ +From 6d591614bfe881bb7664c9bebb6a48231c059411 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:09 +0100 +Subject: [PATCH 08/22] dt-bindings: add BCM6358 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in BCM6358 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-9-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm6358-pinctrl.yaml | 93 +++++++++++++++++++ + 1 file changed, 93 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml +@@ -0,0 +1,93 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6358-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6358 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM6358 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm6358-pinctrl ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ ebi_cs, uart1, serial_led, legacy_led, led, spi_cs, utopia, ++ pwm_syn_clk, sys_irq ] ++ ++ pins: ++ enum: [ ebi_cs_grp, uart1_grp, serial_led_grp, legacy_led_grp, ++ led_grp, spi_cs_grp, utopia_grp, pwm_syn_clk, sys_irq_grp ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@18 { ++ compatible = "brcm,bcm6358-pinctrl"; ++ reg = <0x18 0x4>; ++ ++ pinctrl_ebi_cs: ebi_cs-pins { ++ function = "ebi_cs"; ++ groups = "ebi_cs_grp"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ function = "uart1"; ++ groups = "uart1_grp"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ function = "serial_led"; ++ groups = "serial_led_grp"; ++ }; ++ ++ pinctrl_legacy_led: legacy_led-pins { ++ function = "legacy_led"; ++ groups = "legacy_led_grp"; ++ }; ++ ++ pinctrl_led: led-pins { ++ function = "led"; ++ groups = "led_grp"; ++ }; ++ ++ pinctrl_spi_cs_23: spi_cs-pins { ++ function = "spi_cs"; ++ groups = "spi_cs_grp"; ++ }; ++ ++ pinctrl_utopia: utopia-pins { ++ function = "utopia"; ++ groups = "utopia_grp"; ++ }; ++ ++ pinctrl_pwm_syn_clk: pwm_syn_clk-pins { ++ function = "pwm_syn_clk"; ++ groups = "pwm_syn_clk_grp"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ groups = "sys_irq_grp"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/060-v5.13-dt-bindings-add-BCM6358-GPIO-sysctl-binding-document.patch b/target/linux/bmips/patches-5.10/060-v5.13-dt-bindings-add-BCM6358-GPIO-sysctl-binding-document.patch new file mode 100644 index 0000000000..a36984e7ad --- /dev/null +++ b/target/linux/bmips/patches-5.10/060-v5.13-dt-bindings-add-BCM6358-GPIO-sysctl-binding-document.patch @@ -0,0 +1,153 @@ +From cfb1b98bc8d5ffd813428cb03c63b54cf63dd785 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:10 +0100 +Subject: [PATCH 09/22] dt-bindings: add BCM6358 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM6358 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-10-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm6358-gpio-sysctl.yaml | 130 ++++++++++++++++++ + 1 file changed, 130 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm6358-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm6358-gpio-sysctl.yaml +@@ -0,0 +1,130 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm6358-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6358 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM6358 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm6358-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm6358-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@fffe0080 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm6358-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0xfffe0080 0x80>; ++ ranges = <0 0xfffe0080 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm6358-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 40>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@18 { ++ compatible = "brcm,bcm6358-pinctrl"; ++ reg = <0x18 0x4>; ++ ++ pinctrl_ebi_cs: ebi_cs-pins { ++ function = "ebi_cs"; ++ groups = "ebi_cs_grp"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ function = "uart1"; ++ groups = "uart1_grp"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ function = "serial_led"; ++ groups = "serial_led_grp"; ++ }; ++ ++ pinctrl_legacy_led: legacy_led-pins { ++ function = "legacy_led"; ++ groups = "legacy_led_grp"; ++ }; ++ ++ pinctrl_led: led-pins { ++ function = "led"; ++ groups = "led_grp"; ++ }; ++ ++ pinctrl_spi_cs_23: spi_cs-pins { ++ function = "spi_cs"; ++ groups = "spi_cs_grp"; ++ }; ++ ++ pinctrl_utopia: utopia-pins { ++ function = "utopia"; ++ groups = "utopia_grp"; ++ }; ++ ++ pinctrl_pwm_syn_clk: pwm_syn_clk-pins { ++ function = "pwm_syn_clk"; ++ groups = "pwm_syn_clk_grp"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ groups = "sys_irq_grp"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/403-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch b/target/linux/bmips/patches-5.10/061-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch similarity index 58% rename from target/linux/bmips/patches-5.10/403-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch rename to target/linux/bmips/patches-5.10/061-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch index fb8681d904..266ed686dc 100644 --- a/target/linux/bmips/patches-5.10/403-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch +++ b/target/linux/bmips/patches-5.10/061-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6358.patch @@ -1,7 +1,7 @@ -From b0e1ebc79a6d7f84f71a758f5a504c8cf954e2e0 Mon Sep 17 00:00:00 2001 +From 9494b16976e1ae3afc643abf638a25f2ce4c3f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:16:01 +0200 -Subject: [PATCH 04/12] pinctrl: add a pincontrol driver for BCM6358 +Date: Wed, 24 Mar 2021 09:19:11 +0100 +Subject: [PATCH 10/22] pinctrl: add a pincontrol driver for BCM6358 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -12,28 +12,28 @@ pins but only whole groups. These groups may overlap, and still require the directions to be set correctly in the GPIO register. In addition the functions register controls other, not directly mux related functions. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-11-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm6358.c | 526 ++++++++++++++++++++++++++ - 3 files changed, 538 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm6358.c | 369 ++++++++++++++++++++++++++ + 3 files changed, 378 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -40,6 +40,17 @@ config PINCTRL_BCM6328 +@@ -44,6 +44,14 @@ config PINCTRL_BCM6328 help Say Y here to enable the Broadcom BCM6328 GPIO driver. +config PINCTRL_BCM6358 + bool "Broadcom BCM6358 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM6358 GPIO driver. @@ -43,9 +43,9 @@ Signed-off-by: Jonas Gorski depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -4,6 +4,7 @@ - obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o +@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX) += pinct obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o + obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o +obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o @@ -53,7 +53,7 @@ Signed-off-by: Jonas Gorski obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm6358.c -@@ -0,0 +1,526 @@ +@@ -0,0 +1,369 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM6358 GPIO unit (pinctrl + GPIO) @@ -62,46 +62,33 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm6358-pinctrl" -+#define BCM6358_NUM_GPIOS 40 ++#include "pinctrl-bcm63xx.h" + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) ++#define BCM6358_NUM_GPIOS 40 + -+#define BCM6358_DIROUT_REG 0x04 -+#define BCM6358_DATA_REG 0x0c -+#define BCM6358_MODE_REG 0x18 -+ -+#define BCM6358_MODE_MUX_NONE 0 -+#define BCM6358_MODE_MUX_EBI_CS BIT(5) -+#define BCM6358_MODE_MUX_UART1 BIT(6) -+#define BCM6358_MODE_MUX_SPI_CS BIT(7) -+#define BCM6358_MODE_MUX_ASYNC_MODEM BIT(8) -+#define BCM6358_MODE_MUX_LEGACY_LED BIT(9) -+#define BCM6358_MODE_MUX_SERIAL_LED BIT(10) -+#define BCM6358_MODE_MUX_LED BIT(11) -+#define BCM6358_MODE_MUX_UTOPIA BIT(12) -+#define BCM6358_MODE_MUX_CLKRST BIT(13) -+#define BCM6358_MODE_MUX_PWM_SYN_CLK BIT(14) -+#define BCM6358_MODE_MUX_SYS_IRQ BIT(15) ++#define BCM6358_MODE_REG 0x18 ++#define BCM6358_MODE_MUX_NONE 0 ++#define BCM6358_MODE_MUX_EBI_CS BIT(5) ++#define BCM6358_MODE_MUX_UART1 BIT(6) ++#define BCM6358_MODE_MUX_SPI_CS BIT(7) ++#define BCM6358_MODE_MUX_ASYNC_MODEM BIT(8) ++#define BCM6358_MODE_MUX_LEGACY_LED BIT(9) ++#define BCM6358_MODE_MUX_SERIAL_LED BIT(10) ++#define BCM6358_MODE_MUX_LED BIT(11) ++#define BCM6358_MODE_MUX_UTOPIA BIT(12) ++#define BCM6358_MODE_MUX_CLKRST BIT(13) ++#define BCM6358_MODE_MUX_PWM_SYN_CLK BIT(14) ++#define BCM6358_MODE_MUX_SYS_IRQ BIT(15) + +struct bcm6358_pingroup { + const char *name; @@ -120,15 +107,8 @@ Signed-off-by: Jonas Gorski + const unsigned num_groups; +}; + -+struct bcm6358_pinctrl { -+ struct device *dev; -+ struct regmap *regs; ++struct bcm6358_priv { + struct regmap_field *overlays; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; +}; + +#define BCM6358_GPIO_PIN(a, b, bit1, bit2, bit3) \ @@ -287,108 +267,6 @@ Signed-off-by: Jonas Gorski + BCM6358_FUN(sys_irq), +}; + -+static inline unsigned int bcm6358_bank_pin(unsigned int pin) -+{ -+ return pin % PINS_PER_BANK; -+} -+ -+static inline unsigned int bcm6358_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm6358_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm6358_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6358_reg_off(BCM6358_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6358_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm6358_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm6358_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6358_reg_off(BCM6358_DATA_REG, pin); -+ unsigned int dirout = bcm6358_reg_off(BCM6358_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6358_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm6358_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6358_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6358_reg_off(BCM6358_DATA_REG, pin); -+ unsigned int bank_pin = bcm6358_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm6358_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6358_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6358_reg_off(BCM6358_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6358_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm6358_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm6358_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6358_reg_off(BCM6358_DATA_REG, pin); -+ unsigned int bank_pin = bcm6358_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm6358_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ +static int bcm6358_pinctrl_get_group_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(bcm6358_groups); @@ -435,7 +313,8 @@ Signed-off-by: Jonas Gorski +static int bcm6358_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm6358_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm6358_priv *priv = pc->driver_data; + const struct bcm6358_pingroup *pg = &bcm6358_groups[group]; + unsigned int val = pg->mode_val; + unsigned int mask = val; @@ -444,16 +323,21 @@ Signed-off-by: Jonas Gorski + for (pin = 0; pin < pg->num_pins; pin++) + mask |= (unsigned long)bcm6358_pins[pin].drv_data; + -+ regmap_field_update_bits(pc->overlays, mask, val); ++ regmap_field_update_bits(priv->overlays, mask, val); + + for (pin = 0; pin < pg->num_pins; pin++) { -+ int hw_gpio = bcm6358_pins[pin].number; -+ struct gpio_chip *gc = &pc->gpio_chip; ++ struct pinctrl_gpio_range *range; ++ unsigned int hw_gpio = bcm6358_pins[pin].number; + -+ if (pg->direction & BIT(pin)) -+ gc->direction_output(gc, hw_gpio, 0); -+ else -+ gc->direction_input(gc, hw_gpio); ++ range = pinctrl_find_gpio_range_from_pin(pctldev, hw_gpio); ++ if (range) { ++ struct gpio_chip *gc = range->gc; ++ ++ if (pg->direction & BIT(pin)) ++ gc->direction_output(gc, hw_gpio, 0); ++ else ++ gc->direction_input(gc, hw_gpio); ++ } + } + + return 0; @@ -463,7 +347,8 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm6358_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm6358_priv *priv = pc->driver_data; + unsigned int mask; + + mask = (unsigned long) bcm6358_pins[offset].drv_data; @@ -471,110 +356,68 @@ Signed-off-by: Jonas Gorski + return 0; + + /* disable all functions using this pin */ -+ return regmap_field_update_bits(pc->overlays, mask, 0); ++ return regmap_field_update_bits(priv->overlays, mask, 0); +} + +static struct pinctrl_ops bcm6358_pctl_ops = { -+ .get_groups_count = bcm6358_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm6358_pinctrl_get_group_name, + .get_group_pins = bcm6358_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm6358_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm6358_pmx_ops = { -+ .get_functions_count = bcm6358_pinctrl_get_func_count, -+ .get_function_name = bcm6358_pinctrl_get_func_name, + .get_function_groups = bcm6358_pinctrl_get_groups, -+ .set_mux = bcm6358_pinctrl_set_mux, ++ .get_function_name = bcm6358_pinctrl_get_func_name, ++ .get_functions_count = bcm6358_pinctrl_get_func_count, + .gpio_request_enable = bcm6358_gpio_request_enable, ++ .set_mux = bcm6358_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm6358_soc = { ++ .ngpios = BCM6358_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm6358_pins), ++ .pctl_ops = &bcm6358_pctl_ops, ++ .pins = bcm6358_pins, ++ .pmx_ops = &bcm6358_pmx_ops, ++}; ++ +static int bcm6358_pinctrl_probe(struct platform_device *pdev) +{ + struct reg_field overlays = REG_FIELD(BCM6358_MODE_REG, 0, 15); + struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm6358_pinctrl *pc; ++ struct bcm63xx_pinctrl *pc; ++ struct bcm6358_priv *priv; + int err; + -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) + return -ENOMEM; + -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->overlays = devm_regmap_field_alloc(&pdev->dev, pc->regs, overlays); -+ if (IS_ERR(pc->overlays)) -+ return PTR_ERR(pc->overlays); -+ -+ /* disable all muxes by default */ -+ regmap_field_write(pc->overlays, 0); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm6358_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm6358_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm6358_gpio_get_direction; -+ pc->gpio_chip.get = bcm6358_gpio_get; -+ pc->gpio_chip.set = bcm6358_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM6358_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm6358_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); ++ err = bcm63xx_pinctrl_probe(pdev, &bcm6358_soc, (void *) priv); ++ if (err) + return err; -+ } + -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm6358_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm6358_pins), -+ pc->pctl_desc.pctlops = &bcm6358_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm6358_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, ++ pc = platform_get_drvdata(pdev); + -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM6358_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); ++ priv->overlays = devm_regmap_field_alloc(dev, pc->regs, overlays); ++ if (IS_ERR(priv->overlays)) ++ return PTR_ERR(priv->overlays); + + return 0; +} + +static const struct of_device_id bcm6358_pinctrl_match[] = { + { .compatible = "brcm,bcm6358-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm6358_pinctrl_driver = { + .probe = bcm6358_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm6358-pinctrl", + .of_match_table = bcm6358_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/062-v5.13-dt-bindings-add-BCM6362-pincontroller-binding-docume.patch b/target/linux/bmips/patches-5.10/062-v5.13-dt-bindings-add-BCM6362-pincontroller-binding-docume.patch new file mode 100644 index 0000000000..afdfbff1c2 --- /dev/null +++ b/target/linux/bmips/patches-5.10/062-v5.13-dt-bindings-add-BCM6362-pincontroller-binding-docume.patch @@ -0,0 +1,231 @@ +From 6e4b5e1fc77513359989112e002e08553d0d8d5c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:12 +0100 +Subject: [PATCH 11/22] dt-bindings: add BCM6362 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in BCM6362 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-12-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm6362-pinctrl.yaml | 206 ++++++++++++++++++ + 1 file changed, 206 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml +@@ -0,0 +1,206 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6362-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6362 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM6362 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm6362-pinctrl ++ ++ reg: ++ maxItems: 2 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ usb_device_led, sys_irq, serial_led_clk, serial_led_data, ++ robosw_led_data, robosw_led_clk, robosw_led0, robosw_led1, ++ inet_led, spi_cs2, spi_cs3, ntr_pulse, uart1_scts, ++ uart1_srts, uart1_sdin, uart1_sdout, adsl_spi_miso, ++ adsl_spi_mosi, adsl_spi_clk, adsl_spi_cs, ephy0_led, ++ ephy1_led, ephy2_led, ephy3_led, ext_irq0, ext_irq1, ++ ext_irq2, ext_irq3, nand ] ++ ++ pins: ++ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, ++ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, ++ gpio15, gpio16, gpio17, gpio18, gpio19, gpio20, gpio21, ++ gpio22, gpio23, gpio24, gpio25, gpio26, gpio27, nand_grp ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@18 { ++ compatible = "brcm,bcm6362-pinctrl"; ++ reg = <0x18 0x10>, <0x38 0x4>; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio3"; ++ }; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio4"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_robosw_led0: robosw_led0-pins { ++ function = "robosw_led0"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_robosw_led1: robosw_led1-pins { ++ function = "robosw_led1"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_inet_led: inet_led-pins { ++ function = "inet_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_spi_cs2: spi_cs2-pins { ++ function = "spi_cs2"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_spi_cs3: spi_cs3-pins { ++ function = "spi_cs3"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_ntr_pulse: ntr_pulse-pins { ++ function = "ntr_pulse"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_uart1_scts: uart1_scts-pins { ++ function = "uart1_scts"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_uart1_srts: uart1_srts-pins { ++ function = "uart1_srts"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ pinctrl_uart1_sdin: uart1_sdin-pins { ++ function = "uart1_sdin"; ++ pins = "gpio14"; ++ }; ++ ++ pinctrl_uart1_sdout: uart1_sdout-pins { ++ function = "uart1_sdout"; ++ pins = "gpio15"; ++ }; ++ }; ++ ++ pinctrl_adsl_spi: adsl_spi-pins { ++ pinctrl_adsl_spi_miso: adsl_spi_miso-pins { ++ function = "adsl_spi_miso"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { ++ function = "adsl_spi_mosi"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_adsl_spi_clk: adsl_spi_clk-pins { ++ function = "adsl_spi_clk"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_adsl_spi_cs: adsl_spi_cs-pins { ++ function = "adsl_spi_cs"; ++ pins = "gpio19"; ++ }; ++ }; ++ ++ pinctrl_ephy0_led: ephy0_led-pins { ++ function = "ephy0_led"; ++ pins = "gpio20"; ++ }; ++ ++ pinctrl_ephy1_led: ephy1_led-pins { ++ function = "ephy1_led"; ++ pins = "gpio21"; ++ }; ++ ++ pinctrl_ephy2_led: ephy2_led-pins { ++ function = "ephy2_led"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_ephy3_led: ephy3_led-pins { ++ function = "ephy3_led"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_ext_irq0: ext_irq0-pins { ++ function = "ext_irq0"; ++ pins = "gpio24"; ++ }; ++ ++ pinctrl_ext_irq1: ext_irq1-pins { ++ function = "ext_irq1"; ++ pins = "gpio25"; ++ }; ++ ++ pinctrl_ext_irq2: ext_irq2-pins { ++ function = "ext_irq2"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ext_irq3: ext_irq3-pins { ++ function = "ext_irq3"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_nand: nand-pins { ++ function = "nand"; ++ group = "nand_grp"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/063-v5.13-dt-bindings-add-BCM6362-GPIO-sysctl-binding-document.patch b/target/linux/bmips/patches-5.10/063-v5.13-dt-bindings-add-BCM6362-GPIO-sysctl-binding-document.patch new file mode 100644 index 0000000000..db0952211e --- /dev/null +++ b/target/linux/bmips/patches-5.10/063-v5.13-dt-bindings-add-BCM6362-GPIO-sysctl-binding-document.patch @@ -0,0 +1,259 @@ +From 7ca989eafbd6ce1c216a775556c4893baab1959b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:13 +0100 +Subject: [PATCH 12/22] dt-bindings: add BCM6362 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM6362 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-13-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm6362-gpio-sysctl.yaml | 236 ++++++++++++++++++ + 1 file changed, 236 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm6362-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm6362-gpio-sysctl.yaml +@@ -0,0 +1,236 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm6362-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6362 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM6362 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm6362-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm6362-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@10000080 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm6362-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0x10000080 0x80>; ++ ranges = <0 0x10000080 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm6362-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 48>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@18 { ++ compatible = "brcm,bcm6362-pinctrl"; ++ reg = <0x18 0x10>, <0x38 0x4>; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio3"; ++ }; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio4"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_robosw_led0: robosw_led0-pins { ++ function = "robosw_led0"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_robosw_led1: robosw_led1-pins { ++ function = "robosw_led1"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_inet_led: inet_led-pins { ++ function = "inet_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_spi_cs2: spi_cs2-pins { ++ function = "spi_cs2"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_spi_cs3: spi_cs3-pins { ++ function = "spi_cs3"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_ntr_pulse: ntr_pulse-pins { ++ function = "ntr_pulse"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_uart1_scts: uart1_scts-pins { ++ function = "uart1_scts"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_uart1_srts: uart1_srts-pins { ++ function = "uart1_srts"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ pinctrl_uart1_sdin: uart1_sdin-pins { ++ function = "uart1_sdin"; ++ pins = "gpio14"; ++ }; ++ ++ pinctrl_uart1_sdout: uart1_sdout-pins { ++ function = "uart1_sdout"; ++ pins = "gpio15"; ++ }; ++ }; ++ ++ pinctrl_adsl_spi: adsl_spi-pins { ++ pinctrl_adsl_spi_miso: adsl_spi_miso-pins { ++ function = "adsl_spi_miso"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { ++ function = "adsl_spi_mosi"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_adsl_spi_clk: adsl_spi_clk-pins { ++ function = "adsl_spi_clk"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_adsl_spi_cs: adsl_spi_cs-pins { ++ function = "adsl_spi_cs"; ++ pins = "gpio19"; ++ }; ++ }; ++ ++ pinctrl_ephy0_led: ephy0_led-pins { ++ function = "ephy0_led"; ++ pins = "gpio20"; ++ }; ++ ++ pinctrl_ephy1_led: ephy1_led-pins { ++ function = "ephy1_led"; ++ pins = "gpio21"; ++ }; ++ ++ pinctrl_ephy2_led: ephy2_led-pins { ++ function = "ephy2_led"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_ephy3_led: ephy3_led-pins { ++ function = "ephy3_led"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_ext_irq0: ext_irq0-pins { ++ function = "ext_irq0"; ++ pins = "gpio24"; ++ }; ++ ++ pinctrl_ext_irq1: ext_irq1-pins { ++ function = "ext_irq1"; ++ pins = "gpio25"; ++ }; ++ ++ pinctrl_ext_irq2: ext_irq2-pins { ++ function = "ext_irq2"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ext_irq3: ext_irq3-pins { ++ function = "ext_irq3"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_nand: nand-pins { ++ function = "nand"; ++ group = "nand_grp"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/405-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch b/target/linux/bmips/patches-5.10/064-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch similarity index 71% rename from target/linux/bmips/patches-5.10/405-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch rename to target/linux/bmips/patches-5.10/064-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch index bfc6620ace..dc775c3c2c 100644 --- a/target/linux/bmips/patches-5.10/405-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch +++ b/target/linux/bmips/patches-5.10/064-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6362.patch @@ -1,7 +1,7 @@ -From 2872fcb5eac02d3a74d696e6350410a9e66281b4 Mon Sep 17 00:00:00 2001 +From 705791e23ecd93d6c2697234fdf0c22b499c0a5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:17:20 +0200 -Subject: [PATCH 06/12] pinctrl: add a pincontrol driver for BCM6362 +Date: Wed, 24 Mar 2021 09:19:14 +0100 +Subject: [PATCH 13/22] pinctrl: add a pincontrol driver for BCM6362 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -11,28 +11,28 @@ GPIO pins to the LED controller, to be available by the integrated wifi, or other functions. It also supports overlay groups, of which only NAND is documented. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-14-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm6362.c | 794 ++++++++++++++++++++++++++ - 3 files changed, 806 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm6362.c | 617 ++++++++++++++++++++++++++ + 3 files changed, 626 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -51,6 +51,17 @@ config PINCTRL_BCM6358 +@@ -52,6 +52,14 @@ config PINCTRL_BCM6358 help Say Y here to enable the Broadcom BCM6358 GPIO driver. +config PINCTRL_BCM6362 + bool "Broadcom BCM6362 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM6362 GPIO driver. @@ -42,8 +42,8 @@ Signed-off-by: Jonas Gorski depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX) += pinct - obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o +@@ -6,6 +6,7 @@ obj-$(CONFIG_PINCTRL_BCM2835) += pinctr + obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o +obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o @@ -52,7 +52,7 @@ Signed-off-by: Jonas Gorski obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm6362.c -@@ -0,0 +1,794 @@ +@@ -0,0 +1,617 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM6362 GPIO unit (pinctrl + GPIO) @@ -61,33 +61,22 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm6362-pinctrl" ++#include "pinctrl-bcm63xx.h" ++ ++#define BCM6362_BANK_GPIOS 32 +#define BCM6362_NUM_GPIOS 48 +#define BCM6362_NUM_LEDS 24 + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#define BCM6362_DIROUT_REG 0x04 -+#define BCM6362_DATA_REG 0x0c +#define BCM6362_LED_REG 0x10 +#define BCM6362_MODE_REG 0x18 +#define BCM6362_CTRL_REG 0x1c @@ -116,16 +105,6 @@ Signed-off-by: Jonas Gorski + uint32_t basemode_mask; +}; + -+struct bcm6362_pinctrl { -+ struct device *dev; -+ struct regmap *regs; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; -+}; -+ +#define BCM6362_PIN(a, b, mask) \ + { \ + .number = a, \ @@ -526,108 +505,6 @@ Signed-off-by: Jonas Gorski + BCM6362_BASEMODE_FUN(nand, BASEMODE_NAND), +}; + -+static inline unsigned int bcm6362_bank_pin(unsigned int pin) -+{ -+ return pin % PINS_PER_BANK; -+} -+ -+static inline unsigned int bcm6362_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm6362_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm6362_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6362_reg_off(BCM6362_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6362_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm6362_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm6362_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6362_reg_off(BCM6362_DATA_REG, pin); -+ unsigned int dirout = bcm6362_reg_off(BCM6362_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6362_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm6362_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6362_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6362_reg_off(BCM6362_DATA_REG, pin); -+ unsigned int bank_pin = bcm6362_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm6362_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6362_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6362_reg_off(BCM6362_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6362_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm6362_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm6362_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6362_reg_off(BCM6362_DATA_REG, pin); -+ unsigned int bank_pin = bcm6362_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm6362_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ +static int bcm6362_pinctrl_get_group_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(bcm6362_groups); @@ -671,16 +548,16 @@ Signed-off-by: Jonas Gorski + return 0; +} + -+static void bcm6362_set_gpio(struct bcm6362_pinctrl *pc, unsigned pin) ++static void bcm6362_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin) +{ + const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin]; -+ unsigned int mask = bcm6362_bank_pin(pin); ++ unsigned int mask = bcm63xx_bank_pin(pin); + + if (desc->drv_data) + regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG, + (uint32_t) desc->drv_data, 0); + -+ if (pin < PINS_PER_BANK) { ++ if (pin < BCM63XX_BANK_GPIOS) { + /* base mode 0 => gpio 1 => mux function */ + regmap_update_bits(pc->regs, BCM6362_MODE_REG, mask, 0); + @@ -696,7 +573,7 @@ Signed-off-by: Jonas Gorski +static int bcm6362_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm6362_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + const struct bcm6362_pingroup *pg = &bcm6362_groups[group]; + const struct bcm6362_function *f = &bcm6362_funcs[selector]; + unsigned i; @@ -741,7 +618,7 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm6362_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + + /* disable all functions using this pin */ + bcm6362_set_gpio(pc, offset); @@ -750,98 +627,44 @@ Signed-off-by: Jonas Gorski +} + +static struct pinctrl_ops bcm6362_pctl_ops = { -+ .get_groups_count = bcm6362_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm6362_pinctrl_get_group_name, + .get_group_pins = bcm6362_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm6362_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm6362_pmx_ops = { -+ .get_functions_count = bcm6362_pinctrl_get_func_count, -+ .get_function_name = bcm6362_pinctrl_get_func_name, + .get_function_groups = bcm6362_pinctrl_get_groups, -+ .set_mux = bcm6362_pinctrl_set_mux, ++ .get_function_name = bcm6362_pinctrl_get_func_name, ++ .get_functions_count = bcm6362_pinctrl_get_func_count, + .gpio_request_enable = bcm6362_gpio_request_enable, ++ .set_mux = bcm6362_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm6362_soc = { ++ .ngpios = BCM6362_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm6362_pins), ++ .pctl_ops = &bcm6362_pctl_ops, ++ .pins = bcm6362_pins, ++ .pmx_ops = &bcm6362_pmx_ops, ++}; ++ +static int bcm6362_pinctrl_probe(struct platform_device *pdev) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm6362_pinctrl *pc; -+ int err; -+ -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm6362_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm6362_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm6362_gpio_get_direction; -+ pc->gpio_chip.get = bcm6362_gpio_get; -+ pc->gpio_chip.set = bcm6362_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM6362_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm6362_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); -+ return err; -+ } -+ -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm6362_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm6362_pins), -+ pc->pctl_desc.pctlops = &bcm6362_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm6362_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, -+ -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM6362_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); -+ -+ return 0; ++ return bcm63xx_pinctrl_probe(pdev, &bcm6362_soc, NULL); +} + +static const struct of_device_id bcm6362_pinctrl_match[] = { + { .compatible = "brcm,bcm6362-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm6362_pinctrl_driver = { + .probe = bcm6362_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm6362-pinctrl", + .of_match_table = bcm6362_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/065-v5.13-dt-bindings-add-BCM6368-pincontroller-binding-docume.patch b/target/linux/bmips/patches-5.10/065-v5.13-dt-bindings-add-BCM6368-pincontroller-binding-docume.patch new file mode 100644 index 0000000000..e4e91e597f --- /dev/null +++ b/target/linux/bmips/patches-5.10/065-v5.13-dt-bindings-add-BCM6368-pincontroller-binding-docume.patch @@ -0,0 +1,242 @@ +From 9fbf8303796c89ecab026eb3dbadae7f98c49922 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:15 +0100 +Subject: [PATCH 14/22] dt-bindings: add BCM6368 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in BCM6368 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-15-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm6368-pinctrl.yaml | 217 ++++++++++++++++++ + 1 file changed, 217 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml +@@ -0,0 +1,217 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6368-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6368 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM6368 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm6368-pinctrl ++ ++ reg: ++ maxItems: 2 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ analog_afe_0, analog_afe_1, sys_irq, serial_led_data, ++ serial_led_clk, inet_led, ephy0_led, ephy1_led, ephy2_led, ++ ephy3_led, robosw_led_data, robosw_led_clk, robosw_led0, ++ robosw_led1, usb_device_led, pci_req1, pci_gnt1, pci_intb, ++ pci_req0, pci_gnt0, pcmcia_cd1, pcmcia_cd2, pcmcia_vs1, ++ pcmcia_vs2, ebi_cs2, ebi_cs3, spi_cs2, spi_cs3, spi_cs4, ++ spi_cs5, uart1 ] ++ ++ pins: ++ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, ++ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, ++ gpio16, gpio17, gpio18, gpio19, gpio20, gpio22, gpio23, ++ gpio24, gpio25, gpio26, gpio27, gpio28, gpio29, gpio30, ++ gpio31, uart1_grp ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@18 { ++ compatible = "brcm,bcm6368-pinctrl"; ++ reg = <0x18 0x4>, <0x38 0x4>; ++ ++ pinctrl_analog_afe_0: analog_afe_0-pins { ++ function = "analog_afe_0"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_analog_afe_1: analog_afe_1-pins { ++ function = "analog_afe_1"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio3"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio4"; ++ }; ++ }; ++ ++ pinctrl_inet_led: inet_led-pins { ++ function = "inet_led"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_ephy0_led: ephy0_led-pins { ++ function = "ephy0_led"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_ephy1_led: ephy1_led-pins { ++ function = "ephy1_led"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_ephy2_led: ephy2_led-pins { ++ function = "ephy2_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_ephy3_led: ephy3_led-pins { ++ function = "ephy3_led"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_robosw_led0: robosw_led0-pins { ++ function = "robosw_led0"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_robosw_led1: robosw_led1-pins { ++ function = "robosw_led1"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio14"; ++ }; ++ ++ pinctrl_pci: pci-pins { ++ pinctrl_pci_req1: pci_req1-pins { ++ function = "pci_req1"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_pci_gnt1: pci_gnt1-pins { ++ function = "pci_gnt1"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_pci_intb: pci_intb-pins { ++ function = "pci_intb"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_pci_req0: pci_req0-pins { ++ function = "pci_req0"; ++ pins = "gpio19"; ++ }; ++ ++ pinctrl_pci_gnt0: pci_gnt0-pins { ++ function = "pci_gnt0"; ++ pins = "gpio20"; ++ }; ++ }; ++ ++ pinctrl_pcmcia: pcmcia-pins { ++ pinctrl_pcmcia_cd1: pcmcia_cd1-pins { ++ function = "pcmcia_cd1"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_pcmcia_cd2: pcmcia_cd2-pins { ++ function = "pcmcia_cd2"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_pcmcia_vs1: pcmcia_vs1-pins { ++ function = "pcmcia_vs1"; ++ pins = "gpio24"; ++ }; ++ ++ pinctrl_pcmcia_vs2: pcmcia_vs2-pins { ++ function = "pcmcia_vs2"; ++ pins = "gpio25"; ++ }; ++ }; ++ ++ pinctrl_ebi_cs2: ebi_cs2-pins { ++ function = "ebi_cs2"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ebi_cs3: ebi_cs3-pins { ++ function = "ebi_cs3"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_spi_cs2: spi_cs2-pins { ++ function = "spi_cs2"; ++ pins = "gpio28"; ++ }; ++ ++ pinctrl_spi_cs3: spi_cs3-pins { ++ function = "spi_cs3"; ++ pins = "gpio29"; ++ }; ++ ++ pinctrl_spi_cs4: spi_cs4-pins { ++ function = "spi_cs4"; ++ pins = "gpio30"; ++ }; ++ ++ pinctrl_spi_cs5: spi_cs5-pins { ++ function = "spi_cs5"; ++ pins = "gpio31"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ function = "uart1"; ++ group = "uart1_grp"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/066-v5.13-dt-bindings-add-BCM6368-GPIO-sysctl-binding-document.patch b/target/linux/bmips/patches-5.10/066-v5.13-dt-bindings-add-BCM6368-GPIO-sysctl-binding-document.patch new file mode 100644 index 0000000000..d36cff6564 --- /dev/null +++ b/target/linux/bmips/patches-5.10/066-v5.13-dt-bindings-add-BCM6368-GPIO-sysctl-binding-document.patch @@ -0,0 +1,269 @@ +From fd22635f222f44dcb4dd6382d97de13144edad2b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:16 +0100 +Subject: [PATCH 15/22] dt-bindings: add BCM6368 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM6368 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-16-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm6368-gpio-sysctl.yaml | 246 ++++++++++++++++++ + 1 file changed, 246 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm6368-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm6368-gpio-sysctl.yaml +@@ -0,0 +1,246 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm6368-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6368 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM6368 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm6368-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm6368-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@10000080 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm6368-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0x10000080 0x80>; ++ ranges = <0 0x10000080 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm6368-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 38>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@18 { ++ compatible = "brcm,bcm6368-pinctrl"; ++ reg = <0x18 0x4>, <0x38 0x4>; ++ ++ pinctrl_analog_afe_0: analog_afe_0-pins { ++ function = "analog_afe_0"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_analog_afe_1: analog_afe_1-pins { ++ function = "analog_afe_1"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_sys_irq: sys_irq-pins { ++ function = "sys_irq"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio3"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio4"; ++ }; ++ }; ++ ++ pinctrl_inet_led: inet_led-pins { ++ function = "inet_led"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_ephy0_led: ephy0_led-pins { ++ function = "ephy0_led"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_ephy1_led: ephy1_led-pins { ++ function = "ephy1_led"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_ephy2_led: ephy2_led-pins { ++ function = "ephy2_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_ephy3_led: ephy3_led-pins { ++ function = "ephy3_led"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_robosw_led0: robosw_led0-pins { ++ function = "robosw_led0"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_robosw_led1: robosw_led1-pins { ++ function = "robosw_led1"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio14"; ++ }; ++ ++ pinctrl_pci: pci-pins { ++ pinctrl_pci_req1: pci_req1-pins { ++ function = "pci_req1"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_pci_gnt1: pci_gnt1-pins { ++ function = "pci_gnt1"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_pci_intb: pci_intb-pins { ++ function = "pci_intb"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_pci_req0: pci_req0-pins { ++ function = "pci_req0"; ++ pins = "gpio19"; ++ }; ++ ++ pinctrl_pci_gnt0: pci_gnt0-pins { ++ function = "pci_gnt0"; ++ pins = "gpio20"; ++ }; ++ }; ++ ++ pinctrl_pcmcia: pcmcia-pins { ++ pinctrl_pcmcia_cd1: pcmcia_cd1-pins { ++ function = "pcmcia_cd1"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_pcmcia_cd2: pcmcia_cd2-pins { ++ function = "pcmcia_cd2"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_pcmcia_vs1: pcmcia_vs1-pins { ++ function = "pcmcia_vs1"; ++ pins = "gpio24"; ++ }; ++ ++ pinctrl_pcmcia_vs2: pcmcia_vs2-pins { ++ function = "pcmcia_vs2"; ++ pins = "gpio25"; ++ }; ++ }; ++ ++ pinctrl_ebi_cs2: ebi_cs2-pins { ++ function = "ebi_cs2"; ++ pins = "gpio26"; ++ }; ++ ++ pinctrl_ebi_cs3: ebi_cs3-pins { ++ function = "ebi_cs3"; ++ pins = "gpio27"; ++ }; ++ ++ pinctrl_spi_cs2: spi_cs2-pins { ++ function = "spi_cs2"; ++ pins = "gpio28"; ++ }; ++ ++ pinctrl_spi_cs3: spi_cs3-pins { ++ function = "spi_cs3"; ++ pins = "gpio29"; ++ }; ++ ++ pinctrl_spi_cs4: spi_cs4-pins { ++ function = "spi_cs4"; ++ pins = "gpio30"; ++ }; ++ ++ pinctrl_spi_cs5: spi_cs5-pins { ++ function = "spi_cs5"; ++ pins = "gpio31"; ++ }; ++ ++ pinctrl_uart1: uart1-pins { ++ function = "uart1"; ++ group = "uart1_grp"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/407-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch b/target/linux/bmips/patches-5.10/067-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch similarity index 66% rename from target/linux/bmips/patches-5.10/407-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch rename to target/linux/bmips/patches-5.10/067-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch index 5a5dac3487..3965762407 100644 --- a/target/linux/bmips/patches-5.10/407-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch +++ b/target/linux/bmips/patches-5.10/067-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6368.patch @@ -1,7 +1,7 @@ -From a212dcb2f04ae42f35ec11122a2532b1bcf8a94f Mon Sep 17 00:00:00 2001 +From 50554accf7a79980cd04481e8903073bdb706daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:18:25 +0200 -Subject: [PATCH 08/12] pinctrl: add a pincontrol driver for BCM6368 +Date: Wed, 24 Mar 2021 09:19:17 +0100 +Subject: [PATCH 16/22] pinctrl: add a pincontrol driver for BCM6368 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -9,28 +9,28 @@ Content-Transfer-Encoding: 8bit Add a pincontrol driver for BCM6368. BCM6368 allows muxing the first 32 GPIOs onto alternative functions. Not all are documented. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-17-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm6368.c | 679 ++++++++++++++++++++++++++ - 3 files changed, 691 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm6368.c | 523 ++++++++++++++++++++++++++ + 3 files changed, 532 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -62,6 +62,17 @@ config PINCTRL_BCM6362 +@@ -60,6 +60,14 @@ config PINCTRL_BCM6362 help Say Y here to enable the Broadcom BCM6362 GPIO driver. +config PINCTRL_BCM6368 + bool "Broadcom BCM6368 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM6368 GPIO driver. @@ -40,7 +40,7 @@ Signed-off-by: Jonas Gorski depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -6,6 +6,7 @@ obj-$(CONFIG_PINCTRL_BCM2835) += pinctr +@@ -7,6 +7,7 @@ obj-$(CONFIG_PINCTRL_BCM63XX) += pinctr obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o @@ -50,7 +50,7 @@ Signed-off-by: Jonas Gorski obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm6368.c -@@ -0,0 +1,679 @@ +@@ -0,0 +1,523 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM6368 GPIO unit (pinctrl + GPIO) @@ -59,32 +59,20 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm6368-pinctrl" ++#include "pinctrl-bcm63xx.h" ++ +#define BCM6368_NUM_GPIOS 38 + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#define BCM6368_DIROUT_REG 0x04 -+#define BCM6368_DATA_REG 0x0c +#define BCM6368_MODE_REG 0x18 +#define BCM6368_BASEMODE_REG 0x38 +#define BCM6368_BASEMODE_MASK 0x7 @@ -106,15 +94,8 @@ Signed-off-by: Jonas Gorski + unsigned basemode:3; +}; + -+struct bcm6368_pinctrl { -+ struct device *dev; -+ struct regmap *regs; ++struct bcm6368_priv { + struct regmap_field *overlays; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; +}; + +#define BCM6368_BASEMODE_PIN(a, b) \ @@ -417,108 +398,6 @@ Signed-off-by: Jonas Gorski + BCM6368_BASEMODE_FUN(uart1, UART1, 0x6), +}; + -+static inline unsigned int bcm6368_bank_pin(unsigned int pin) -+{ -+ return pin % PINS_PER_BANK; -+} -+ -+static inline unsigned int bcm6368_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm6368_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm6368_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6368_reg_off(BCM6368_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6368_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm6368_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm6368_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6368_reg_off(BCM6368_DATA_REG, pin); -+ unsigned int dirout = bcm6368_reg_off(BCM6368_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6368_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm6368_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6368_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6368_reg_off(BCM6368_DATA_REG, pin); -+ unsigned int bank_pin = bcm6368_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm6368_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6368_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6368_reg_off(BCM6368_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6368_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm6368_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm6368_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6368_reg_off(BCM6368_DATA_REG, pin); -+ unsigned int bank_pin = bcm6368_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm6368_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ +static int bcm6368_pinctrl_get_group_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(bcm6368_groups); @@ -565,7 +444,8 @@ Signed-off-by: Jonas Gorski +static int bcm6368_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm6368_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm6368_priv *priv = pc->driver_data; + const struct bcm6368_pingroup *pg = &bcm6368_groups[group]; + const struct bcm6368_function *fun = &bcm6368_funcs[selector]; + int i, pin; @@ -575,17 +455,17 @@ Signed-off-by: Jonas Gorski + + for (i = 0; i < pg->num_pins; i++) { + pin = pg->pins[i]; -+ if (pin < PINS_PER_BANK) ++ if (pin < BCM63XX_BANK_GPIOS) + mask |= BIT(pin); + } + + regmap_update_bits(pc->regs, BCM6368_MODE_REG, mask, 0); -+ regmap_field_write(pc->overlays, fun->basemode); ++ regmap_field_write(priv->overlays, fun->basemode); + } else { + pin = pg->pins[0]; + + if (bcm6368_pins[pin].drv_data) -+ regmap_field_write(pc->overlays, ++ regmap_field_write(priv->overlays, + BCM6368_BASEMODE_GPIO); + + regmap_update_bits(pc->regs, BCM6368_MODE_REG, BIT(pin), @@ -593,13 +473,18 @@ Signed-off-by: Jonas Gorski + } + + for (pin = 0; pin < pg->num_pins; pin++) { ++ struct pinctrl_gpio_range *range; + int hw_gpio = bcm6368_pins[pin].number; -+ struct gpio_chip *gc = &pc->gpio_chip; + -+ if (fun->dir_out & BIT(pin)) -+ gc->direction_output(gc, hw_gpio, 0); -+ else -+ gc->direction_input(gc, hw_gpio); ++ range = pinctrl_find_gpio_range_from_pin(pctldev, hw_gpio); ++ if (range) { ++ struct gpio_chip *gc = range->gc; ++ ++ if (fun->dir_out & BIT(pin)) ++ gc->direction_output(gc, hw_gpio, 0); ++ else ++ gc->direction_input(gc, hw_gpio); ++ } + } + + return 0; @@ -609,122 +494,81 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm6368_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm6368_priv *priv = pc->driver_data; + -+ if (offset >= PINS_PER_BANK && !bcm6368_pins[offset].drv_data) ++ if (offset >= BCM63XX_BANK_GPIOS && !bcm6368_pins[offset].drv_data) + return 0; + + /* disable all functions using this pin */ -+ if (offset < PINS_PER_BANK) ++ if (offset < BCM63XX_BANK_GPIOS) + regmap_update_bits(pc->regs, BCM6368_MODE_REG, BIT(offset), 0); + + if (bcm6368_pins[offset].drv_data) -+ regmap_field_write(pc->overlays, BCM6368_BASEMODE_GPIO); ++ regmap_field_write(priv->overlays, BCM6368_BASEMODE_GPIO); + + return 0; +} + +static struct pinctrl_ops bcm6368_pctl_ops = { -+ .get_groups_count = bcm6368_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm6368_pinctrl_get_group_name, + .get_group_pins = bcm6368_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm6368_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm6368_pmx_ops = { -+ .get_functions_count = bcm6368_pinctrl_get_func_count, -+ .get_function_name = bcm6368_pinctrl_get_func_name, + .get_function_groups = bcm6368_pinctrl_get_groups, -+ .set_mux = bcm6368_pinctrl_set_mux, ++ .get_function_name = bcm6368_pinctrl_get_func_name, ++ .get_functions_count = bcm6368_pinctrl_get_func_count, + .gpio_request_enable = bcm6368_gpio_request_enable, ++ .set_mux = bcm6368_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm6368_soc = { ++ .ngpios = BCM6368_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm6368_pins), ++ .pctl_ops = &bcm6368_pctl_ops, ++ .pins = bcm6368_pins, ++ .pmx_ops = &bcm6368_pmx_ops, ++}; ++ +static int bcm6368_pinctrl_probe(struct platform_device *pdev) +{ + struct reg_field overlays = REG_FIELD(BCM6368_BASEMODE_REG, 0, 15); + struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm6368_pinctrl *pc; ++ struct bcm63xx_pinctrl *pc; ++ struct bcm6368_priv *priv; + int err; + -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) ++ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ++ if (!priv) + return -ENOMEM; + -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->overlays = devm_regmap_field_alloc(&pdev->dev, pc->regs, overlays); -+ if (IS_ERR(pc->overlays)) -+ return PTR_ERR(pc->overlays); -+ -+ /* disable all muxes by default */ -+ regmap_field_write(pc->overlays, 0); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm6368_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm6368_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm6368_gpio_get_direction; -+ pc->gpio_chip.get = bcm6368_gpio_get; -+ pc->gpio_chip.set = bcm6368_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM6368_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm6368_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); ++ err = bcm63xx_pinctrl_probe(pdev, &bcm6368_soc, (void *) priv); ++ if (err) + return err; -+ } + -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm6368_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm6368_pins), -+ pc->pctl_desc.pctlops = &bcm6368_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm6368_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, ++ pc = platform_get_drvdata(pdev); + -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM6368_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); ++ priv->overlays = devm_regmap_field_alloc(dev, pc->regs, overlays); ++ if (IS_ERR(priv->overlays)) ++ return PTR_ERR(priv->overlays); + + return 0; +} + +static const struct of_device_id bcm6368_pinctrl_match[] = { + { .compatible = "brcm,bcm6368-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm6368_pinctrl_driver = { + .probe = bcm6368_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm6368-pinctrl", + .of_match_table = bcm6368_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/068-v5.13-dt-bindings-add-BCM63268-pincontroller-binding-docum.patch b/target/linux/bmips/patches-5.10/068-v5.13-dt-bindings-add-BCM63268-pincontroller-binding-docum.patch new file mode 100644 index 0000000000..bffc1ab02f --- /dev/null +++ b/target/linux/bmips/patches-5.10/068-v5.13-dt-bindings-add-BCM63268-pincontroller-binding-docum.patch @@ -0,0 +1,190 @@ +From 9b3303413379af8bed307cd465fe7aa1bc3569ea Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:18 +0100 +Subject: [PATCH 17/22] dt-bindings: add BCM63268 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in the BCM63268 +family SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-18-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm63268-pinctrl.yaml | 164 ++++++++++++++++++ + 1 file changed, 164 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml +@@ -0,0 +1,164 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm63268-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM63268 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM63268 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm63268-pinctrl ++ ++ reg: ++ maxItems: 3 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ serial_led_clk, serial_led_data, hsspi_cs4, hsspi_cs5, ++ hsspi_cs6, hsspi_cs7, adsl_spi_miso, adsl_spi_mosi, ++ vreq_clk, pcie_clkreq_b, robosw_led_clk, robosw_led_data, ++ nand, gpio35_alt, dectpd, vdsl_phy_override_0, ++ vdsl_phy_override_1, vdsl_phy_override_2, ++ vdsl_phy_override_3, dsl_gpio8, dsl_gpio9 ] ++ ++ pins: ++ enum: [ gpio0, gpio1, gpio16, gpio17, gpio8, gpio9, gpio18, gpio19, ++ gpio22, gpio23, gpio30, gpio31, nand_grp, gpio35 ++ dectpd_grp, vdsl_phy_override_0_grp, ++ vdsl_phy_override_1_grp, vdsl_phy_override_2_grp, ++ vdsl_phy_override_3_grp, dsl_gpio8, dsl_gpio9 ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@10 { ++ compatible = "brcm,bcm63268-pinctrl"; ++ reg = <0x10 0x4>, <0x18 0x8>, <0x38 0x4>; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio1"; ++ }; ++ }; ++ ++ pinctrl_hsspi_cs4: hsspi_cs4-pins { ++ function = "hsspi_cs4"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_hsspi_cs5: hsspi_cs5-pins { ++ function = "hsspi_cs5"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_hsspi_cs6: hsspi_cs6-pins { ++ function = "hsspi_cs6"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_hsspi_cs7: hsspi_cs7-pins { ++ function = "hsspi_cs7"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_adsl_spi: adsl_spi-pins { ++ pinctrl_adsl_spi_miso: adsl_spi_miso-pins { ++ function = "adsl_spi_miso"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { ++ function = "adsl_spi_mosi"; ++ pins = "gpio19"; ++ }; ++ }; ++ ++ pinctrl_vreq_clk: vreq_clk-pins { ++ function = "vreq_clk"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_pcie_clkreq_b: pcie_clkreq_b-pins { ++ function = "pcie_clkreq_b"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio30"; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio31"; ++ }; ++ ++ pinctrl_nand: nand-pins { ++ function = "nand"; ++ group = "nand_grp"; ++ }; ++ ++ pinctrl_gpio35_alt: gpio35_alt-pins { ++ function = "gpio35_alt"; ++ pin = "gpio35"; ++ }; ++ ++ pinctrl_dectpd: dectpd-pins { ++ function = "dectpd"; ++ group = "dectpd_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { ++ function = "vdsl_phy_override_0"; ++ group = "vdsl_phy_override_0_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { ++ function = "vdsl_phy_override_1"; ++ group = "vdsl_phy_override_1_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { ++ function = "vdsl_phy_override_2"; ++ group = "vdsl_phy_override_2_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { ++ function = "vdsl_phy_override_3"; ++ group = "vdsl_phy_override_3_grp"; ++ }; ++ ++ pinctrl_dsl_gpio8: dsl_gpio8-pins { ++ function = "dsl_gpio8"; ++ group = "dsl_gpio8"; ++ }; ++ ++ pinctrl_dsl_gpio9: dsl_gpio9-pins { ++ function = "dsl_gpio9"; ++ group = "dsl_gpio9"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/069-v5.13-dt-bindings-add-BCM63268-GPIO-sysctl-binding-documen.patch b/target/linux/bmips/patches-5.10/069-v5.13-dt-bindings-add-BCM63268-GPIO-sysctl-binding-documen.patch new file mode 100644 index 0000000000..a130d60d42 --- /dev/null +++ b/target/linux/bmips/patches-5.10/069-v5.13-dt-bindings-add-BCM63268-GPIO-sysctl-binding-documen.patch @@ -0,0 +1,217 @@ +From ff8324355d7ae2e4ebbd304de27bb5fa75e20c6a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:19 +0100 +Subject: [PATCH 18/22] dt-bindings: add BCM63268 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM63268 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-19-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm63268-gpio-sysctl.yaml | 194 ++++++++++++++++++ + 1 file changed, 194 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm63268-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm63268-gpio-sysctl.yaml +@@ -0,0 +1,194 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm63268-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM63268 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM63268 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm63268-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm63268-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@100000c0 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm63268-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0x100000c0 0x80>; ++ ranges = <0 0x100000c0 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm63268-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 52>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@10 { ++ compatible = "brcm,bcm63268-pinctrl"; ++ reg = <0x10 0x4>, <0x18 0x8>, <0x38 0x4>; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio1"; ++ }; ++ }; ++ ++ pinctrl_hsspi_cs4: hsspi_cs4-pins { ++ function = "hsspi_cs4"; ++ pins = "gpio16"; ++ }; ++ ++ pinctrl_hsspi_cs5: hsspi_cs5-pins { ++ function = "hsspi_cs5"; ++ pins = "gpio17"; ++ }; ++ ++ pinctrl_hsspi_cs6: hsspi_cs6-pins { ++ function = "hsspi_cs6"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_hsspi_cs7: hsspi_cs7-pins { ++ function = "hsspi_cs7"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_adsl_spi: adsl_spi-pins { ++ pinctrl_adsl_spi_miso: adsl_spi_miso-pins { ++ function = "adsl_spi_miso"; ++ pins = "gpio18"; ++ }; ++ ++ pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { ++ function = "adsl_spi_mosi"; ++ pins = "gpio19"; ++ }; ++ }; ++ ++ pinctrl_vreq_clk: vreq_clk-pins { ++ function = "vreq_clk"; ++ pins = "gpio22"; ++ }; ++ ++ pinctrl_pcie_clkreq_b: pcie_clkreq_b-pins { ++ function = "pcie_clkreq_b"; ++ pins = "gpio23"; ++ }; ++ ++ pinctrl_robosw_led_clk: robosw_led_clk-pins { ++ function = "robosw_led_clk"; ++ pins = "gpio30"; ++ }; ++ ++ pinctrl_robosw_led_data: robosw_led_data-pins { ++ function = "robosw_led_data"; ++ pins = "gpio31"; ++ }; ++ ++ pinctrl_nand: nand-pins { ++ function = "nand"; ++ group = "nand_grp"; ++ }; ++ ++ pinctrl_gpio35_alt: gpio35_alt-pins { ++ function = "gpio35_alt"; ++ pin = "gpio35"; ++ }; ++ ++ pinctrl_dectpd: dectpd-pins { ++ function = "dectpd"; ++ group = "dectpd_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { ++ function = "vdsl_phy_override_0"; ++ group = "vdsl_phy_override_0_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { ++ function = "vdsl_phy_override_1"; ++ group = "vdsl_phy_override_1_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { ++ function = "vdsl_phy_override_2"; ++ group = "vdsl_phy_override_2_grp"; ++ }; ++ ++ pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { ++ function = "vdsl_phy_override_3"; ++ group = "vdsl_phy_override_3_grp"; ++ }; ++ ++ pinctrl_dsl_gpio8: dsl_gpio8-pins { ++ function = "dsl_gpio8"; ++ group = "dsl_gpio8"; ++ }; ++ ++ pinctrl_dsl_gpio9: dsl_gpio9-pins { ++ function = "dsl_gpio9"; ++ group = "dsl_gpio9"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/409-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch b/target/linux/bmips/patches-5.10/070-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch similarity index 73% rename from target/linux/bmips/patches-5.10/409-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch rename to target/linux/bmips/patches-5.10/070-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch index 8acc5dbfbb..933af5fb51 100644 --- a/target/linux/bmips/patches-5.10/409-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch +++ b/target/linux/bmips/patches-5.10/070-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM63268.patch @@ -1,7 +1,7 @@ -From 8ec959299a6e4bbdc65d62180aa952ae04cdcf07 Mon Sep 17 00:00:00 2001 +From 155cca1b0794a8f541e7eaa45be70df0a49964f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:19:12 +0200 -Subject: [PATCH 10/12] pinctrl: add a pincontrol driver for BCM63268 +Date: Wed, 24 Mar 2021 09:19:20 +0100 +Subject: [PATCH 19/22] pinctrl: add a pincontrol driver for BCM63268 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -10,28 +10,28 @@ Add a pincontrol driver for BCM63268. BCM63268 allows muxing GPIOs to different functions. Depending on the mux, these are either single pin configurations or whole pin groups. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-20-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm63268.c | 821 +++++++++++++++++++++++++ - 3 files changed, 833 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm63268.c | 643 +++++++++++++++++++++++++ + 3 files changed, 652 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -73,6 +73,17 @@ config PINCTRL_BCM6368 +@@ -68,6 +68,14 @@ config PINCTRL_BCM6368 help Say Y here to enable the Broadcom BCM6368 GPIO driver. +config PINCTRL_BCM63268 + bool "Broadcom BCM63268 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM63268 GPIO driver. @@ -41,7 +41,7 @@ Signed-off-by: Jonas Gorski depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -7,6 +7,7 @@ obj-$(CONFIG_PINCTRL_BCM6328) += pinctr +@@ -8,6 +8,7 @@ obj-$(CONFIG_PINCTRL_BCM6328) += pinctr obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o obj-$(CONFIG_PINCTRL_BCM6368) += pinctrl-bcm6368.o @@ -51,7 +51,7 @@ Signed-off-by: Jonas Gorski obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm63268.c -@@ -0,0 +1,821 @@ +@@ -0,0 +1,643 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM63268 GPIO unit (pinctrl + GPIO) @@ -60,33 +60,21 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm63268-pinctrl" ++#include "pinctrl-bcm63xx.h" ++ +#define BCM63268_NUM_GPIOS 52 +#define BCM63268_NUM_LEDS 24 + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#define BCM63268_DIROUT_REG 0x04 -+#define BCM63268_DATA_REG 0x0c +#define BCM63268_LED_REG 0x10 +#define BCM63268_MODE_REG 0x18 +#define BCM63268_CTRL_REG 0x1c @@ -121,16 +109,6 @@ Signed-off-by: Jonas Gorski + uint32_t mask; +}; + -+struct bcm63268_pinctrl { -+ struct device *dev; -+ struct regmap *regs; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; -+}; -+ +#define BCM63268_PIN(a, b, basemode) \ + { \ + .number = a, \ @@ -549,108 +527,6 @@ Signed-off-by: Jonas Gorski + BCM63268_BASEMODE_VDSL_PHY_3), +}; + -+static inline unsigned int bcm63268_bank_pin(unsigned int pin) -+{ -+ return pin % PINS_PER_BANK; -+} -+ -+static inline unsigned int bcm63268_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm63268_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm63268_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm63268_reg_off(BCM63268_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm63268_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm63268_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm63268_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm63268_reg_off(BCM63268_DATA_REG, pin); -+ unsigned int dirout = bcm63268_reg_off(BCM63268_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm63268_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm63268_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm63268_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm63268_reg_off(BCM63268_DATA_REG, pin); -+ unsigned int bank_pin = bcm63268_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm63268_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm63268_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm63268_reg_off(BCM63268_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm63268_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm63268_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm63268_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm63268_reg_off(BCM63268_DATA_REG, pin); -+ unsigned int bank_pin = bcm63268_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm63268_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); -+} -+ +static int bcm63268_pinctrl_get_group_count(struct pinctrl_dev *pctldev) +{ + return ARRAY_SIZE(bcm63268_groups); @@ -695,17 +571,17 @@ Signed-off-by: Jonas Gorski + return 0; +} + -+static void bcm63268_set_gpio(struct bcm63268_pinctrl *pc, unsigned pin) ++static void bcm63268_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin) +{ + const struct pinctrl_pin_desc *desc = &bcm63268_pins[pin]; + unsigned int basemode = (unsigned long) desc->drv_data; -+ unsigned int mask = BIT(bcm63268_bank_pin(pin)); ++ unsigned int mask = BIT(bcm63xx_bank_pin(pin)); + + if (basemode) + regmap_update_bits(pc->regs, BCM63268_BASEMODE_REG, basemode, + 0); + -+ if (pin < PINS_PER_BANK) { ++ if (pin < BCM63XX_BANK_GPIOS) { + /* base mode: 0 => gpio, 1 => mux function */ + regmap_update_bits(pc->regs, BCM63268_MODE_REG, mask, 0); + @@ -722,7 +598,7 @@ Signed-off-by: Jonas Gorski +static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm63268_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + const struct bcm63268_pingroup *pg = &bcm63268_groups[group]; + const struct bcm63268_function *f = &bcm63268_funcs[selector]; + unsigned i; @@ -767,7 +643,7 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm63268_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + + /* disable all functions using this pin */ + bcm63268_set_gpio(pc, offset); @@ -776,98 +652,44 @@ Signed-off-by: Jonas Gorski +} + +static struct pinctrl_ops bcm63268_pctl_ops = { -+ .get_groups_count = bcm63268_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm63268_pinctrl_get_group_name, + .get_group_pins = bcm63268_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm63268_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm63268_pmx_ops = { -+ .get_functions_count = bcm63268_pinctrl_get_func_count, -+ .get_function_name = bcm63268_pinctrl_get_func_name, + .get_function_groups = bcm63268_pinctrl_get_groups, -+ .set_mux = bcm63268_pinctrl_set_mux, ++ .get_function_name = bcm63268_pinctrl_get_func_name, ++ .get_functions_count = bcm63268_pinctrl_get_func_count, + .gpio_request_enable = bcm63268_gpio_request_enable, ++ .set_mux = bcm63268_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm63268_soc = { ++ .ngpios = BCM63268_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm63268_pins), ++ .pctl_ops = &bcm63268_pctl_ops, ++ .pins = bcm63268_pins, ++ .pmx_ops = &bcm63268_pmx_ops, ++}; ++ +static int bcm63268_pinctrl_probe(struct platform_device *pdev) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm63268_pinctrl *pc; -+ int err; -+ -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm63268_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm63268_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm63268_gpio_get_direction; -+ pc->gpio_chip.get = bcm63268_gpio_get; -+ pc->gpio_chip.set = bcm63268_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM63268_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm63268_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); -+ return err; -+ } -+ -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm63268_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm63268_pins), -+ pc->pctl_desc.pctlops = &bcm63268_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm63268_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, -+ -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM63268_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); -+ -+ return 0; ++ return bcm63xx_pinctrl_probe(pdev, &bcm63268_soc, NULL); +} + +static const struct of_device_id bcm63268_pinctrl_match[] = { + { .compatible = "brcm,bcm63268-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm63268_pinctrl_driver = { + .probe = bcm63268_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm63268-pinctrl", + .of_match_table = bcm63268_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/071-v5.13-dt-bindings-add-BCM6318-pincontroller-binding-docume.patch b/target/linux/bmips/patches-5.10/071-v5.13-dt-bindings-add-BCM6318-pincontroller-binding-docume.patch new file mode 100644 index 0000000000..3b490da098 --- /dev/null +++ b/target/linux/bmips/patches-5.10/071-v5.13-dt-bindings-add-BCM6318-pincontroller-binding-docume.patch @@ -0,0 +1,168 @@ +From b2f215141b985d5d39ed16fe7e2089d5aa162302 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:21 +0100 +Subject: [PATCH 20/22] dt-bindings: add BCM6318 pincontroller binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the pincontrol core found in BCM6318 SoCs. + +Co-developed-by: Jonas Gorski +Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-21-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../pinctrl/brcm,bcm6318-pinctrl.yaml | 143 ++++++++++++++++++ + 1 file changed, 143 insertions(+) + create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml +@@ -0,0 +1,143 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6318-pinctrl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6318 pin controller ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Bindings for Broadcom's BCM6318 memory-mapped pin controller. ++ ++properties: ++ compatible: ++ const: brcm,bcm6318-pinctrl ++ ++ reg: ++ maxItems: 2 ++ ++patternProperties: ++ '-pins$': ++ type: object ++ $ref: pinmux-node.yaml# ++ ++ properties: ++ function: ++ enum: [ ephy0_spd_led, ephy1_spd_led, ephy2_spd_led, ephy3_spd_led, ++ ephy0_act_led, ephy1_act_led, ephy2_act_led, ephy3_act_led, ++ serial_led_data, serial_led_clk, inet_act_led, inet_fail_led, ++ dsl_led, post_fail_led, wlan_wps_led, usb_pwron, ++ usb_device_led, usb_active ] ++ ++ pins: ++ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, ++ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio40 ] ++ ++required: ++ - compatible ++ - reg ++ ++additionalProperties: false ++ ++examples: ++ - | ++ pinctrl@18 { ++ compatible = "brcm,bcm6318-pinctrl"; ++ reg = <0x18 0x10>, <0x54 0x18>; ++ ++ pinctrl_ephy0_spd_led: ephy0_spd_led-pins { ++ function = "ephy0_spd_led"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_ephy1_spd_led: ephy1_spd_led-pins { ++ function = "ephy1_spd_led"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_ephy2_spd_led: ephy2_spd_led-pins { ++ function = "ephy2_spd_led"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_ephy3_spd_led: ephy3_spd_led-pins { ++ function = "ephy3_spd_led"; ++ pins = "gpio3"; ++ }; ++ ++ pinctrl_ephy0_act_led: ephy0_act_led-pins { ++ function = "ephy0_act_led"; ++ pins = "gpio4"; ++ }; ++ ++ pinctrl_ephy1_act_led: ephy1_act_led-pins { ++ function = "ephy1_act_led"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_ephy2_act_led: ephy2_act_led-pins { ++ function = "ephy2_act_led"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_ephy3_act_led: ephy3_act_led-pins { ++ function = "ephy3_act_led"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio7"; ++ }; ++ }; ++ ++ pinctrl_inet_act_led: inet_act_led-pins { ++ function = "inet_act_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_inet_fail_led: inet_fail_led-pins { ++ function = "inet_fail_led"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_dsl_led: dsl_led-pins { ++ function = "dsl_led"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_post_fail_led: post_fail_led-pins { ++ function = "post_fail_led"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_wlan_wps_led: wlan_wps_led-pins { ++ function = "wlan_wps_led"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_usb_pwron: usb_pwron-pins { ++ function = "usb_pwron"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_active: usb_active-pins { ++ function = "usb_active"; ++ pins = "gpio40"; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/072-v5.13-dt-bindings-add-BCM6318-GPIO-sysctl-binding-document.patch b/target/linux/bmips/patches-5.10/072-v5.13-dt-bindings-add-BCM6318-GPIO-sysctl-binding-document.patch new file mode 100644 index 0000000000..1ef13407c8 --- /dev/null +++ b/target/linux/bmips/patches-5.10/072-v5.13-dt-bindings-add-BCM6318-GPIO-sysctl-binding-document.patch @@ -0,0 +1,200 @@ +From b6d46b9454742a25f9d923be072869e40b2ecebb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= +Date: Wed, 24 Mar 2021 09:19:22 +0100 +Subject: [PATCH 21/22] dt-bindings: add BCM6318 GPIO sysctl binding + documentation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add binding documentation for the GPIO sysctl found in BCM6318 SoCs. + +Signed-off-by: Álvaro Fernández Rojas +Reviewed-by: Rob Herring +Link: https://lore.kernel.org/r/20210324081923.20379-22-noltari@gmail.com +Signed-off-by: Linus Walleij +--- + .../mfd/brcm,bcm6318-gpio-sysctl.yaml | 177 ++++++++++++++++++ + 1 file changed, 177 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mfd/brcm,bcm6318-gpio-sysctl.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mfd/brcm,bcm6318-gpio-sysctl.yaml +@@ -0,0 +1,177 @@ ++# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mfd/brcm,bcm6318-gpio-sysctl.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Broadcom BCM6318 GPIO System Controller Device Tree Bindings ++ ++maintainers: ++ - Álvaro Fernández Rojas ++ - Jonas Gorski ++ ++description: ++ Broadcom BCM6318 SoC GPIO system controller which provides a register map ++ for controlling the GPIO and pins of the SoC. ++ ++properties: ++ "#address-cells": true ++ ++ "#size-cells": true ++ ++ compatible: ++ items: ++ - const: brcm,bcm6318-gpio-sysctl ++ - const: syscon ++ - const: simple-mfd ++ ++ ranges: ++ maxItems: 1 ++ ++ reg: ++ maxItems: 1 ++ ++patternProperties: ++ "^gpio@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../gpio/brcm,bcm6345-gpio.yaml" ++ description: ++ GPIO controller for the SoC GPIOs. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. ++ ++ "^pinctrl@[0-9a-f]+$": ++ # Child node ++ type: object ++ $ref: "../pinctrl/brcm,bcm6318-pinctrl.yaml" ++ description: ++ Pin controller for the SoC pins. This child node definition ++ should follow the bindings specified in ++ Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml. ++ ++required: ++ - "#address-cells" ++ - compatible ++ - ranges ++ - reg ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ syscon@10000080 { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "brcm,bcm6318-gpio-sysctl", "syscon", "simple-mfd"; ++ reg = <0x10000080 0x80>; ++ ranges = <0 0x10000080 0x80>; ++ ++ gpio@0 { ++ compatible = "brcm,bcm6318-gpio"; ++ reg-names = "dirout", "dat"; ++ reg = <0x0 0x8>, <0x8 0x8>; ++ ++ gpio-controller; ++ gpio-ranges = <&pinctrl 0 0 50>; ++ #gpio-cells = <2>; ++ }; ++ ++ pinctrl: pinctrl@10 { ++ compatible = "brcm,bcm6318-pinctrl"; ++ reg = <0x18 0x10>, <0x54 0x18>; ++ ++ pinctrl_ephy0_spd_led: ephy0_spd_led-pins { ++ function = "ephy0_spd_led"; ++ pins = "gpio0"; ++ }; ++ ++ pinctrl_ephy1_spd_led: ephy1_spd_led-pins { ++ function = "ephy1_spd_led"; ++ pins = "gpio1"; ++ }; ++ ++ pinctrl_ephy2_spd_led: ephy2_spd_led-pins { ++ function = "ephy2_spd_led"; ++ pins = "gpio2"; ++ }; ++ ++ pinctrl_ephy3_spd_led: ephy3_spd_led-pins { ++ function = "ephy3_spd_led"; ++ pins = "gpio3"; ++ }; ++ ++ pinctrl_ephy0_act_led: ephy0_act_led-pins { ++ function = "ephy0_act_led"; ++ pins = "gpio4"; ++ }; ++ ++ pinctrl_ephy1_act_led: ephy1_act_led-pins { ++ function = "ephy1_act_led"; ++ pins = "gpio5"; ++ }; ++ ++ pinctrl_ephy2_act_led: ephy2_act_led-pins { ++ function = "ephy2_act_led"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_ephy3_act_led: ephy3_act_led-pins { ++ function = "ephy3_act_led"; ++ pins = "gpio7"; ++ }; ++ ++ pinctrl_serial_led: serial_led-pins { ++ pinctrl_serial_led_data: serial_led_data-pins { ++ function = "serial_led_data"; ++ pins = "gpio6"; ++ }; ++ ++ pinctrl_serial_led_clk: serial_led_clk-pins { ++ function = "serial_led_clk"; ++ pins = "gpio7"; ++ }; ++ }; ++ ++ pinctrl_inet_act_led: inet_act_led-pins { ++ function = "inet_act_led"; ++ pins = "gpio8"; ++ }; ++ ++ pinctrl_inet_fail_led: inet_fail_led-pins { ++ function = "inet_fail_led"; ++ pins = "gpio9"; ++ }; ++ ++ pinctrl_dsl_led: dsl_led-pins { ++ function = "dsl_led"; ++ pins = "gpio10"; ++ }; ++ ++ pinctrl_post_fail_led: post_fail_led-pins { ++ function = "post_fail_led"; ++ pins = "gpio11"; ++ }; ++ ++ pinctrl_wlan_wps_led: wlan_wps_led-pins { ++ function = "wlan_wps_led"; ++ pins = "gpio12"; ++ }; ++ ++ pinctrl_usb_pwron: usb_pwron-pins { ++ function = "usb_pwron"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_device_led: usb_device_led-pins { ++ function = "usb_device_led"; ++ pins = "gpio13"; ++ }; ++ ++ pinctrl_usb_active: usb_active-pins { ++ function = "usb_active"; ++ pins = "gpio40"; ++ }; ++ }; ++ }; diff --git a/target/linux/bmips/patches-5.10/411-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch b/target/linux/bmips/patches-5.10/073-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch similarity index 67% rename from target/linux/bmips/patches-5.10/411-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch rename to target/linux/bmips/patches-5.10/073-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch index b57b49d35f..afd8d9e1fa 100644 --- a/target/linux/bmips/patches-5.10/411-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch +++ b/target/linux/bmips/patches-5.10/073-v5.13-pinctrl-add-a-pincontrol-driver-for-BCM6318.patch @@ -1,7 +1,7 @@ -From e1764f96eb563a11c822ff91d1c6d7ed01c3925b Mon Sep 17 00:00:00 2001 +From d28039fccf948a407de69106465caa465b1dcf32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Fri, 24 Jun 2016 22:20:39 +0200 -Subject: [PATCH 12/12] pinctrl: add a pincontrol driver for BCM6318 +Date: Wed, 24 Mar 2021 09:19:23 +0100 +Subject: [PATCH 22/22] pinctrl: add a pincontrol driver for BCM6318 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -11,48 +11,48 @@ to different functions. BCM6318 is similar to BCM6328 with the addition of a pad register, and the GPIO meaning of the mux register changes based on the GPIO number. -Signed-off-by: Álvaro Fernández Rojas +Co-developed-by: Jonas Gorski Signed-off-by: Jonas Gorski +Signed-off-by: Álvaro Fernández Rojas +Link: https://lore.kernel.org/r/20210324081923.20379-23-noltari@gmail.com +Signed-off-by: Linus Walleij --- - drivers/pinctrl/bcm/Kconfig | 11 + + drivers/pinctrl/bcm/Kconfig | 8 + drivers/pinctrl/bcm/Makefile | 1 + - drivers/pinctrl/bcm/pinctrl-bcm6318.c | 674 ++++++++++++++++++++++++++ - 3 files changed, 686 insertions(+) + drivers/pinctrl/bcm/pinctrl-bcm6318.c | 498 ++++++++++++++++++++++++++ + 3 files changed, 507 insertions(+) create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c --- a/drivers/pinctrl/bcm/Kconfig +++ b/drivers/pinctrl/bcm/Kconfig -@@ -29,6 +29,17 @@ config PINCTRL_BCM2835 - help - Say Y here to enable the Broadcom BCM2835 GPIO driver. +@@ -36,6 +36,14 @@ config PINCTRL_BCM63XX + select PINCONF + select PINMUX +config PINCTRL_BCM6318 + bool "Broadcom BCM6318 GPIO driver" -+ depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) -+ select PINMUX -+ select PINCONF -+ select GENERIC_PINCONF -+ select MFD_SYSCON ++ depends on (BMIPS_GENERIC || COMPILE_TEST) ++ select PINCTRL_BCM63XX + default BMIPS_GENERIC + help + Say Y here to enable the Broadcom BCM6318 GPIO driver. + config PINCTRL_BCM6328 bool "Broadcom BCM6328 GPIO driver" - depends on OF_GPIO && (BMIPS_GENERIC || COMPILE_TEST) + depends on (BMIPS_GENERIC || COMPILE_TEST) --- a/drivers/pinctrl/bcm/Makefile +++ b/drivers/pinctrl/bcm/Makefile -@@ -3,6 +3,7 @@ - +@@ -4,6 +4,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o + obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o +obj-$(CONFIG_PINCTRL_BCM6318) += pinctrl-bcm6318.o obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o --- /dev/null +++ b/drivers/pinctrl/bcm/pinctrl-bcm6318.c -@@ -0,0 +1,674 @@ +@@ -0,0 +1,498 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Driver for BCM6318 GPIO unit (pinctrl + GPIO) @@ -61,36 +61,26 @@ Signed-off-by: Jonas Gorski + * Copyright (C) 2016 Jonas Gorski + */ + -+#include -+#include ++#include ++#include +#include -+#include +#include -+#include -+#include ++#include +#include +#include + -+#include -+#include -+#include -+#include -+ -+#include "../core.h" +#include "../pinctrl-utils.h" + -+#define MODULE_NAME "bcm6318-pinctrl" ++#include "pinctrl-bcm63xx.h" ++ +#define BCM6318_NUM_GPIOS 50 +#define BCM6318_NUM_MUX 48 + -+#define BANK_SIZE sizeof(uint32_t) -+#define PINS_PER_BANK (BANK_SIZE * BITS_PER_BYTE) -+ -+#define BCM6318_DIROUT_REG 0x04 -+#define BCM6318_DATA_REG 0x0c +#define BCM6318_MODE_REG 0x18 +#define BCM6318_MUX_REG 0x1c ++#define BCM6328_MUX_MASK GENMASK(1, 0) +#define BCM6318_PAD_REG 0x54 ++#define BCM6328_PAD_MASK GENMASK(3, 0) + +struct bcm6318_pingroup { + const char *name; @@ -107,16 +97,6 @@ Signed-off-by: Jonas Gorski + unsigned mux_val:2; +}; + -+struct bcm6318_pinctrl { -+ struct device *dev; -+ struct regmap *regs; -+ -+ struct pinctrl_dev *pctl_dev; -+ struct gpio_chip gpio_chip; -+ struct pinctrl_desc pctl_desc; -+ struct pinctrl_gpio_range gpio_range; -+}; -+ +static const struct pinctrl_pin_desc bcm6318_pins[] = { + PINCTRL_PIN(0, "gpio0"), + PINCTRL_PIN(1, "gpio1"), @@ -420,116 +400,14 @@ Signed-off-by: Jonas Gorski + BCM6318_MUX_FUN(usb_active, 2), +}; + -+static inline unsigned int bcm6318_bank_pin(unsigned int pin) -+{ -+ return pin % PINS_PER_BANK; -+} -+ +static inline unsigned int bcm6318_mux_off(unsigned int pin) +{ -+ return BCM6318_MUX_REG + (pin / 16) * BANK_SIZE; ++ return BCM6318_MUX_REG + (pin / 16) * 4; +} + +static inline unsigned int bcm6318_pad_off(unsigned int pin) +{ -+ return BCM6318_PAD_REG + (pin / 8) * BANK_SIZE; -+} -+ -+static inline unsigned int bcm6318_reg_off(unsigned int reg, unsigned int pin) -+{ -+ return reg - (pin / PINS_PER_BANK) * BANK_SIZE; -+} -+ -+static int bcm6318_gpio_direction_input(struct gpio_chip *chip, -+ unsigned int pin) -+{ -+ struct bcm6318_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6318_reg_off(BCM6318_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6318_bank_pin(pin); -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an input GPIO -+ */ -+ ret = pinctrl_gpio_direction_input(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), 0); -+ -+ return 0; -+} -+ -+static int bcm6318_gpio_direction_output(struct gpio_chip *chip, -+ unsigned int pin, int value) -+{ -+ struct bcm6318_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6318_reg_off(BCM6318_DATA_REG, pin); -+ unsigned int dirout = bcm6318_reg_off(BCM6318_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6318_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ int ret; -+ -+ /* -+ * Check with the pinctrl driver whether this pin is usable as -+ * an output GPIO -+ */ -+ ret = pinctrl_gpio_direction_output(chip->base + pin); -+ if (ret) -+ return ret; -+ -+ regmap_update_bits(pc->regs, dirout, BIT(bank_pin), BIT(bank_pin)); -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+ -+ return 0; -+} -+ -+static int bcm6318_gpio_get(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6318_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6318_reg_off(BCM6318_DATA_REG, pin); -+ unsigned int bank_pin = bcm6318_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, data, &val); -+ -+ return !!(val & BIT(bank_pin)); -+} -+ -+static int bcm6318_gpio_get_direction(struct gpio_chip *chip, unsigned int pin) -+{ -+ struct bcm6318_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int dirout = bcm6318_reg_off(BCM6318_DIROUT_REG, pin); -+ unsigned int bank_pin = bcm6318_bank_pin(pin); -+ unsigned int val; -+ -+ regmap_read(pc->regs, dirout, &val); -+ -+ if (val & BIT(bank_pin)) -+ return GPIO_LINE_DIRECTION_OUT; -+ -+ return GPIO_LINE_DIRECTION_IN; -+} -+ -+static void bcm6318_gpio_set(struct gpio_chip *chip, unsigned int pin, -+ int value) -+{ -+ struct bcm6318_pinctrl *pc = gpiochip_get_data(chip); -+ unsigned int data = bcm6318_reg_off(BCM6318_DATA_REG, pin); -+ unsigned int bank_pin = bcm6318_bank_pin(pin); -+ unsigned int val = value ? BIT(bank_pin) : 0; -+ -+ regmap_update_bits(pc->regs, data, BIT(bank_pin), val); -+} -+ -+static int bcm6318_gpio_to_irq(struct gpio_chip *chip, unsigned gpio) -+{ -+ char irq_name[7]; -+ -+ sprintf(irq_name, "gpio%d", gpio); -+ -+ return of_irq_get_byname(chip->of_node, irq_name); ++ return BCM6318_PAD_REG + (pin / 8) * 4; +} + +static int bcm6318_pinctrl_get_group_count(struct pinctrl_dev *pctldev) @@ -575,32 +453,32 @@ Signed-off-by: Jonas Gorski + return 0; +} + -+static inline void bcm6318_rmw_mux(struct bcm6318_pinctrl *pc, unsigned pin, ++static inline void bcm6318_rmw_mux(struct bcm63xx_pinctrl *pc, unsigned pin, + unsigned int mode, unsigned int mux) +{ -+ if (pin < PINS_PER_BANK) ++ if (pin < BCM63XX_BANK_GPIOS) + regmap_update_bits(pc->regs, BCM6318_MODE_REG, BIT(pin), + mode ? BIT(pin) : 0); + + if (pin < BCM6318_NUM_MUX) + regmap_update_bits(pc->regs, + bcm6318_mux_off(pin), -+ 3UL << ((pin % 16) * 2), ++ BCM6328_MUX_MASK << ((pin % 16) * 2), + mux << ((pin % 16) * 2)); +} + -+static inline void bcm6318_set_pad(struct bcm6318_pinctrl *pc, unsigned pin, ++static inline void bcm6318_set_pad(struct bcm63xx_pinctrl *pc, unsigned pin, + uint8_t val) +{ + regmap_update_bits(pc->regs, bcm6318_pad_off(pin), -+ 0xfUL << ((pin % 8) * 4), ++ BCM6328_PAD_MASK << ((pin % 8) * 4), + val << ((pin % 8) * 4)); +} + +static int bcm6318_pinctrl_set_mux(struct pinctrl_dev *pctldev, + unsigned selector, unsigned group) +{ -+ struct bcm6318_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + const struct bcm6318_pingroup *pg = &bcm6318_groups[group]; + const struct bcm6318_function *f = &bcm6318_funcs[selector]; + @@ -613,7 +491,7 @@ Signed-off-by: Jonas Gorski + struct pinctrl_gpio_range *range, + unsigned offset) +{ -+ struct bcm6318_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); + + /* disable all functions using this pin */ + if (offset < 13) { @@ -630,98 +508,44 @@ Signed-off-by: Jonas Gorski +} + +static struct pinctrl_ops bcm6318_pctl_ops = { -+ .get_groups_count = bcm6318_pinctrl_get_group_count, ++ .dt_free_map = pinctrl_utils_free_map, ++ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, + .get_group_name = bcm6318_pinctrl_get_group_name, + .get_group_pins = bcm6318_pinctrl_get_group_pins, -+ .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, -+ .dt_free_map = pinctrl_utils_free_map, ++ .get_groups_count = bcm6318_pinctrl_get_group_count, +}; + +static struct pinmux_ops bcm6318_pmx_ops = { -+ .get_functions_count = bcm6318_pinctrl_get_func_count, -+ .get_function_name = bcm6318_pinctrl_get_func_name, + .get_function_groups = bcm6318_pinctrl_get_groups, -+ .set_mux = bcm6318_pinctrl_set_mux, ++ .get_function_name = bcm6318_pinctrl_get_func_name, ++ .get_functions_count = bcm6318_pinctrl_get_func_count, + .gpio_request_enable = bcm6318_gpio_request_enable, ++ .set_mux = bcm6318_pinctrl_set_mux, + .strict = true, +}; + ++static const struct bcm63xx_pinctrl_soc bcm6318_soc = { ++ .ngpios = BCM6318_NUM_GPIOS, ++ .npins = ARRAY_SIZE(bcm6318_pins), ++ .pctl_ops = &bcm6318_pctl_ops, ++ .pins = bcm6318_pins, ++ .pmx_ops = &bcm6318_pmx_ops, ++}; ++ +static int bcm6318_pinctrl_probe(struct platform_device *pdev) +{ -+ struct device *dev = &pdev->dev; -+ struct device_node *np = dev->of_node; -+ struct bcm6318_pinctrl *pc; -+ int err; -+ -+ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); -+ if (!pc) -+ return -ENOMEM; -+ -+ platform_set_drvdata(pdev, pc); -+ pc->dev = dev; -+ -+ pc->regs = syscon_node_to_regmap(dev->parent->of_node); -+ if (IS_ERR(pc->regs)) -+ return PTR_ERR(pc->regs); -+ -+ pc->gpio_chip.label = MODULE_NAME; -+ pc->gpio_chip.owner = THIS_MODULE; -+ pc->gpio_chip.request = gpiochip_generic_request; -+ pc->gpio_chip.free = gpiochip_generic_free; -+ pc->gpio_chip.direction_input = bcm6318_gpio_direction_input; -+ pc->gpio_chip.direction_output = bcm6318_gpio_direction_output; -+ pc->gpio_chip.get_direction = bcm6318_gpio_get_direction; -+ pc->gpio_chip.get = bcm6318_gpio_get; -+ pc->gpio_chip.set = bcm6318_gpio_set; -+ pc->gpio_chip.set_config = gpiochip_generic_config; -+ pc->gpio_chip.base = -1; -+ pc->gpio_chip.ngpio = BCM6318_NUM_GPIOS; -+ pc->gpio_chip.can_sleep = false; -+ pc->gpio_chip.parent = dev; -+ pc->gpio_chip.of_node = np; -+ -+ if (of_get_property(np, "interrupt-names", NULL)) -+ pc->gpio_chip.to_irq = bcm6318_gpio_to_irq; -+ -+ err = gpiochip_add_data(&pc->gpio_chip, pc); -+ if (err) { -+ dev_err(dev, "could not add GPIO chip\n"); -+ return err; -+ } -+ -+ pc->pctl_desc.name = MODULE_NAME, -+ pc->pctl_desc.pins = bcm6318_pins, -+ pc->pctl_desc.npins = ARRAY_SIZE(bcm6318_pins), -+ pc->pctl_desc.pctlops = &bcm6318_pctl_ops, -+ pc->pctl_desc.pmxops = &bcm6318_pmx_ops, -+ pc->pctl_desc.owner = THIS_MODULE, -+ -+ pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); -+ if (IS_ERR(pc->pctl_dev)) { -+ gpiochip_remove(&pc->gpio_chip); -+ return PTR_ERR(pc->pctl_dev); -+ } -+ -+ pc->gpio_range.name = MODULE_NAME; -+ pc->gpio_range.npins = BCM6318_NUM_GPIOS; -+ pc->gpio_range.base = pc->gpio_chip.base; -+ pc->gpio_range.gc = &pc->gpio_chip; -+ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); -+ -+ dev_info(dev, "registered\n"); -+ -+ return 0; ++ return bcm63xx_pinctrl_probe(pdev, &bcm6318_soc, NULL); +} + +static const struct of_device_id bcm6318_pinctrl_match[] = { + { .compatible = "brcm,bcm6318-pinctrl", }, -+ { }, ++ { /* sentinel */ } +}; + +static struct platform_driver bcm6318_pinctrl_driver = { + .probe = bcm6318_pinctrl_probe, + .driver = { -+ .name = MODULE_NAME, ++ .name = "bcm6318-pinctrl", + .of_match_table = bcm6318_pinctrl_match, + }, +}; diff --git a/target/linux/bmips/patches-5.10/400-Documentation-add-BCM6328-pincontroller-binding-docu.patch b/target/linux/bmips/patches-5.10/400-Documentation-add-BCM6328-pincontroller-binding-docu.patch deleted file mode 100644 index 4ad97ad1e0..0000000000 --- a/target/linux/bmips/patches-5.10/400-Documentation-add-BCM6328-pincontroller-binding-docu.patch +++ /dev/null @@ -1,182 +0,0 @@ -From 3b6d70e7bae0dbba02435c53f878a042d6d4bd4d Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:33:56 +0200 -Subject: [PATCH 01/12] Documentation: add BCM6328 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in BCM6328 SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm6328-pinctrl.yaml | 161 ++++++++++++++++++ - 1 file changed, 161 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml -@@ -0,0 +1,161 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6328-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM6328 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm6328-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 4 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 4 -+ maxItems: 4 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ serial_led_data, serial_led_clk, inet_act_led, pcie_clkreq, -+ led, ephy0_act_led, ephy1_act_led, ephy2_act_led, -+ ephy3_act_led, hsspi_cs1, usb_device_port, usb_host_port ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ gpio6, gpio7, gpio11, gpio16, gpio17, gpio18, gpio19, -+ gpio20, gpio25, gpio26, gpio27, gpio28, hsspi_cs1, -+ usb_port1 ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@10000080 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0x10000080 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm6328-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc 3 0>, -+ <&ext_intc 2 0>, -+ <&ext_intc 1 0>, -+ <&ext_intc 0 0>; -+ interrupt-names = "gpio12", -+ "gpio15", -+ "gpio23", -+ "gpio24"; -+ -+ pinctrl_serial_led: serial_led { -+ pinctrl_serial_led_data: serial_led_data { -+ function = "serial_led_data"; -+ pins = "gpio6"; -+ }; -+ -+ pinctrl_serial_led_clk: serial_led_clk { -+ function = "serial_led_clk"; -+ pins = "gpio7"; -+ }; -+ }; -+ -+ pinctrl_inet_act_led: inet_act_led { -+ function = "inet_act_led"; -+ pins = "gpio11"; -+ }; -+ -+ pinctrl_pcie_clkreq: pcie_clkreq { -+ function = "pcie_clkreq"; -+ pins = "gpio16"; -+ }; -+ -+ pinctrl_ephy0_spd_led: ephy0_spd_led { -+ function = "led"; -+ pins = "gpio17"; -+ }; -+ -+ pinctrl_ephy1_spd_led: ephy1_spd_led { -+ function = "led"; -+ pins = "gpio18"; -+ }; -+ -+ pinctrl_ephy2_spd_led: ephy2_spd_led { -+ function = "led"; -+ pins = "gpio19"; -+ }; -+ -+ pinctrl_ephy3_spd_led: ephy3_spd_led { -+ function = "led"; -+ pins = "gpio20"; -+ }; -+ -+ pinctrl_ephy0_act_led: ephy0_act_led { -+ function = "ephy0_act_led"; -+ pins = "gpio25"; -+ }; -+ -+ pinctrl_ephy1_act_led: ephy1_act_led { -+ function = "ephy1_act_led"; -+ pins = "gpio26"; -+ }; -+ -+ pinctrl_ephy2_act_led: ephy2_act_led { -+ function = "ephy2_act_led"; -+ pins = "gpio27"; -+ }; -+ -+ pinctrl_ephy3_act_led: ephy3_act_led { -+ function = "ephy3_act_led"; -+ pins = "gpio28"; -+ }; -+ -+ pinctrl_hsspi_cs1: hsspi_cs1 { -+ function = "hsspi_cs1"; -+ pins = "hsspi_cs1"; -+ }; -+ -+ pinctrl_usb_port1_device: usb_port1_device { -+ function = "usb_device_port"; -+ pins = "usb_port1"; -+ }; -+ -+ pinctrl_usb_port1_host: usb_port1_host { -+ function = "usb_host_port"; -+ pins = "usb_port1"; -+ }; -+ }; -+ }; diff --git a/target/linux/bmips/patches-5.10/402-Documentation-add-BCM6358-pincontroller-binding-docu.patch b/target/linux/bmips/patches-5.10/402-Documentation-add-BCM6358-pincontroller-binding-docu.patch deleted file mode 100644 index e4c6343e3f..0000000000 --- a/target/linux/bmips/patches-5.10/402-Documentation-add-BCM6358-pincontroller-binding-docu.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 9fbcbe08479bcb3609952b66627e2d612173229a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:36:00 +0200 -Subject: [PATCH 03/12] Documentation: add BCM6358 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in BCM6358 SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm6358-pinctrl.yaml | 131 ++++++++++++++++++ - 1 file changed, 131 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml -@@ -0,0 +1,131 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6358-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM6358 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm6358-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 4 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 6 -+ maxItems: 6 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ ebi_cs, uart1, serial_led, legacy_led, led, spi_cs, utopia, -+ pwm_syn_clk, sys_irq ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ ebi_cs_grp, uart1_grp, serial_led_grp, legacy_led_grp, -+ led_grp, spi_cs_grp, utopia_grp, pwm_syn_clk, sys_irq_grp ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@fffe0080 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0xfffe0080 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm6358-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc1 0 0>, -+ <&ext_intc1 1 0>, -+ <&ext_intc0 0 0>, -+ <&ext_intc0 1 0>, -+ <&ext_intc0 2 0>, -+ <&ext_intc0 3 0>; -+ interrupt-names = "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37"; -+ -+ pinctrl_ebi_cs: ebi_cs { -+ function = "ebi_cs"; -+ groups = "ebi_cs_grp"; -+ }; -+ -+ pinctrl_uart1: uart1 { -+ function = "uart1"; -+ groups = "uart1_grp"; -+ }; -+ -+ pinctrl_serial_led: serial_led { -+ function = "serial_led"; -+ groups = "serial_led_grp"; -+ }; -+ -+ pinctrl_legacy_led: legacy_led { -+ function = "legacy_led"; -+ groups = "legacy_led_grp"; -+ }; -+ -+ pinctrl_led: led { -+ function = "led"; -+ groups = "led_grp"; -+ }; -+ -+ pinctrl_spi_cs_23: spi_cs { -+ function = "spi_cs"; -+ groups = "spi_cs_grp"; -+ }; -+ -+ pinctrl_utopia: utopia { -+ function = "utopia"; -+ groups = "utopia_grp"; -+ }; -+ -+ pinctrl_pwm_syn_clk: pwm_syn_clk { -+ function = "pwm_syn_clk"; -+ groups = "pwm_syn_clk_grp"; -+ }; -+ -+ pinctrl_sys_irq: sys_irq { -+ function = "sys_irq"; -+ groups = "sys_irq_grp"; -+ }; -+ }; -+ }; diff --git a/target/linux/bmips/patches-5.10/404-Documentation-add-BCM6362-pincontroller-binding-docu.patch b/target/linux/bmips/patches-5.10/404-Documentation-add-BCM6362-pincontroller-binding-docu.patch deleted file mode 100644 index 18739091aa..0000000000 --- a/target/linux/bmips/patches-5.10/404-Documentation-add-BCM6362-pincontroller-binding-docu.patch +++ /dev/null @@ -1,261 +0,0 @@ -From 1c839f287a008023b3b3ae7d892b4d25e3d224ad Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:36:18 +0200 -Subject: [PATCH 05/12] Documentation: add BCM6362 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in BCM6362 SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm6362-pinctrl.yaml | 240 ++++++++++++++++++ - 1 file changed, 240 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml -@@ -0,0 +1,240 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6362-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM6362 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm6362-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 4 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 4 -+ maxItems: 4 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ usb_device_led, sys_irq, serial_led_clk, serial_led_data, -+ robosw_led_data, robosw_led_clk, robosw_led0, robosw_led1, -+ inet_led, spi_cs2, spi_cs3, ntr_pulse, uart1_scts, -+ uart1_srts, uart1_sdin, uart1_sdout, adsl_spi_miso, -+ adsl_spi_mosi, adsl_spi_clk, adsl_spi_cs, ephy0_led, -+ ephy1_led, ephy2_led, ephy3_led, ext_irq0, ext_irq1, -+ ext_irq2, ext_irq3, nand ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, -+ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, -+ gpio15, gpio16, gpio17, gpio18, gpio19, gpio20, gpio21, -+ gpio22, gpio23, gpio24, gpio25, gpio26, gpio27, nand_grp ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@10000080 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0x10000080 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm6362-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc 0 0>, -+ <&ext_intc 1 0>, -+ <&ext_intc 2 0>, -+ <&ext_intc 3 0>; -+ interrupt-names = "gpio24", -+ "gpio25", -+ "gpio26", -+ "gpio27"; -+ -+ pinctrl_usb_device_led: usb_device_led { -+ function = "usb_device_led"; -+ pins = "gpio0"; -+ }; -+ -+ pinctrl_sys_irq: sys_irq { -+ function = "sys_irq"; -+ pins = "gpio1"; -+ }; -+ -+ pinctrl_serial_led: serial_led { -+ pinctrl_serial_led_clk: serial_led_clk { -+ function = "serial_led_clk"; -+ pins = "gpio2"; -+ }; -+ -+ pinctrl_serial_led_data: serial_led_data { -+ function = "serial_led_data"; -+ pins = "gpio3"; -+ }; -+ }; -+ -+ pinctrl_robosw_led_data: robosw_led_data { -+ function = "robosw_led_data"; -+ pins = "gpio4"; -+ }; -+ -+ pinctrl_robosw_led_clk: robosw_led_clk { -+ function = "robosw_led_clk"; -+ pins = "gpio5"; -+ }; -+ -+ pinctrl_robosw_led0: robosw_led0 { -+ function = "robosw_led0"; -+ pins = "gpio6"; -+ }; -+ -+ pinctrl_robosw_led1: robosw_led1 { -+ function = "robosw_led1"; -+ pins = "gpio7"; -+ }; -+ -+ pinctrl_inet_led: inet_led { -+ function = "inet_led"; -+ pins = "gpio8"; -+ }; -+ -+ pinctrl_spi_cs2: spi_cs2 { -+ function = "spi_cs2"; -+ pins = "gpio9"; -+ }; -+ -+ pinctrl_spi_cs3: spi_cs3 { -+ function = "spi_cs3"; -+ pins = "gpio10"; -+ }; -+ -+ pinctrl_ntr_pulse: ntr_pulse { -+ function = "ntr_pulse"; -+ pins = "gpio11"; -+ }; -+ -+ pinctrl_uart1_scts: uart1_scts { -+ function = "uart1_scts"; -+ pins = "gpio12"; -+ }; -+ -+ pinctrl_uart1_srts: uart1_srts { -+ function = "uart1_srts"; -+ pins = "gpio13"; -+ }; -+ -+ pinctrl_uart1: uart1 { -+ pinctrl_uart1_sdin: uart1_sdin { -+ function = "uart1_sdin"; -+ pins = "gpio14"; -+ }; -+ -+ pinctrl_uart1_sdout: uart1_sdout { -+ function = "uart1_sdout"; -+ pins = "gpio15"; -+ }; -+ }; -+ -+ pinctrl_adsl_spi: adsl_spi { -+ pinctrl_adsl_spi_miso: adsl_spi_miso { -+ function = "adsl_spi_miso"; -+ pins = "gpio16"; -+ }; -+ -+ pinctrl_adsl_spi_mosi: adsl_spi_mosi { -+ function = "adsl_spi_mosi"; -+ pins = "gpio17"; -+ }; -+ -+ pinctrl_adsl_spi_clk: adsl_spi_clk { -+ function = "adsl_spi_clk"; -+ pins = "gpio18"; -+ }; -+ -+ pinctrl_adsl_spi_cs: adsl_spi_cs { -+ function = "adsl_spi_cs"; -+ pins = "gpio19"; -+ }; -+ }; -+ -+ pinctrl_ephy0_led: ephy0_led { -+ function = "ephy0_led"; -+ pins = "gpio20"; -+ }; -+ -+ pinctrl_ephy1_led: ephy1_led { -+ function = "ephy1_led"; -+ pins = "gpio21"; -+ }; -+ -+ pinctrl_ephy2_led: ephy2_led { -+ function = "ephy2_led"; -+ pins = "gpio22"; -+ }; -+ -+ pinctrl_ephy3_led: ephy3_led { -+ function = "ephy3_led"; -+ pins = "gpio23"; -+ }; -+ -+ pinctrl_ext_irq0: ext_irq0 { -+ function = "ext_irq0"; -+ pins = "gpio24"; -+ }; -+ -+ pinctrl_ext_irq1: ext_irq1 { -+ function = "ext_irq1"; -+ pins = "gpio25"; -+ }; -+ -+ pinctrl_ext_irq2: ext_irq2 { -+ function = "ext_irq2"; -+ pins = "gpio26"; -+ }; -+ -+ pinctrl_ext_irq3: ext_irq3 { -+ function = "ext_irq3"; -+ pins = "gpio27"; -+ }; -+ -+ pinctrl_nand: nand { -+ function = "nand"; -+ group = "nand_grp"; -+ }; -+ }; -+ }; diff --git a/target/linux/bmips/patches-5.10/406-Documentation-add-BCM6368-pincontroller-binding-docu.patch b/target/linux/bmips/patches-5.10/406-Documentation-add-BCM6368-pincontroller-binding-docu.patch deleted file mode 100644 index 59fbdaeaaa..0000000000 --- a/target/linux/bmips/patches-5.10/406-Documentation-add-BCM6368-pincontroller-binding-docu.patch +++ /dev/null @@ -1,276 +0,0 @@ -From 12f1d5123ee405266596eaea238d9810e0628d18 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:36:51 +0200 -Subject: [PATCH 07/12] Documentation: add BCM6368 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in BCM6368 SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm6368-pinctrl.yaml | 255 ++++++++++++++++++ - 1 file changed, 255 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml -@@ -0,0 +1,255 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6368-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM6368 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm6368-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 6 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 6 -+ maxItems: 6 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ analog_afe_0, analog_afe_1, sys_irq, serial_led_data, -+ serial_led_clk, inet_led, ephy0_led, ephy1_led, ephy2_led, -+ ephy3_led, robosw_led_data, robosw_led_clk, robosw_led0, -+ robosw_led1, usb_device_led, pci_req1, pci_gnt1, pci_intb, -+ pci_req0, pci_gnt0, pcmcia_cd1, pcmcia_cd2, pcmcia_vs1, -+ pcmcia_vs2, ebi_cs2, ebi_cs3, spi_cs2, spi_cs3, spi_cs4, -+ spi_cs5, uart1 ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, -+ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, -+ gpio16, gpio17, gpio18, gpio19, gpio20, gpio22, gpio23, -+ gpio24, gpio25, gpio26, gpio27, gpio28, gpio29, gpio30, -+ gpio31, uart1_grp ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@10000080 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0x10000080 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm6368-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc1 0 0>, -+ <&ext_intc1 1 0>, -+ <&ext_intc0 0 0>, -+ <&ext_intc0 1 0>, -+ <&ext_intc0 2 0>, -+ <&ext_intc0 3 0>; -+ interrupt-names = "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35", -+ "gpio36", -+ "gpio37"; -+ -+ pinctrl_analog_afe_0: analog_afe_0 { -+ function = "analog_afe_0"; -+ pins = "gpio0"; -+ }; -+ -+ pinctrl_analog_afe_1: analog_afe_1 { -+ function = "analog_afe_1"; -+ pins = "gpio1"; -+ }; -+ -+ pinctrl_sys_irq: sys_irq { -+ function = "sys_irq"; -+ pins = "gpio2"; -+ }; -+ -+ pinctrl_serial_led: serial_led { -+ pinctrl_serial_led_data: serial_led_data { -+ function = "serial_led_data"; -+ pins = "gpio3"; -+ }; -+ -+ pinctrl_serial_led_clk: serial_led_clk { -+ function = "serial_led_clk"; -+ pins = "gpio4"; -+ }; -+ }; -+ -+ pinctrl_inet_led: inet_led { -+ function = "inet_led"; -+ pins = "gpio5"; -+ }; -+ -+ pinctrl_ephy0_led: ephy0_led { -+ function = "ephy0_led"; -+ pins = "gpio6"; -+ }; -+ -+ pinctrl_ephy1_led: ephy1_led { -+ function = "ephy1_led"; -+ pins = "gpio7"; -+ }; -+ -+ pinctrl_ephy2_led: ephy2_led { -+ function = "ephy2_led"; -+ pins = "gpio8"; -+ }; -+ -+ pinctrl_ephy3_led: ephy3_led { -+ function = "ephy3_led"; -+ pins = "gpio9"; -+ }; -+ -+ pinctrl_robosw_led_data: robosw_led_data { -+ function = "robosw_led_data"; -+ pins = "gpio10"; -+ }; -+ -+ pinctrl_robosw_led_clk: robosw_led_clk { -+ function = "robosw_led_clk"; -+ pins = "gpio11"; -+ }; -+ -+ pinctrl_robosw_led0: robosw_led0 { -+ function = "robosw_led0"; -+ pins = "gpio12"; -+ }; -+ -+ pinctrl_robosw_led1: robosw_led1 { -+ function = "robosw_led1"; -+ pins = "gpio13"; -+ }; -+ -+ pinctrl_usb_device_led: usb_device_led { -+ function = "usb_device_led"; -+ pins = "gpio14"; -+ }; -+ -+ pinctrl_pci: pci { -+ pinctrl_pci_req1: pci_req1 { -+ function = "pci_req1"; -+ pins = "gpio16"; -+ }; -+ -+ pinctrl_pci_gnt1: pci_gnt1 { -+ function = "pci_gnt1"; -+ pins = "gpio17"; -+ }; -+ -+ pinctrl_pci_intb: pci_intb { -+ function = "pci_intb"; -+ pins = "gpio18"; -+ }; -+ -+ pinctrl_pci_req0: pci_req0 { -+ function = "pci_req0"; -+ pins = "gpio19"; -+ }; -+ -+ pinctrl_pci_gnt0: pci_gnt0 { -+ function = "pci_gnt0"; -+ pins = "gpio20"; -+ }; -+ }; -+ -+ pinctrl_pcmcia: pcmcia { -+ pinctrl_pcmcia_cd1: pcmcia_cd1 { -+ function = "pcmcia_cd1"; -+ pins = "gpio22"; -+ }; -+ -+ pinctrl_pcmcia_cd2: pcmcia_cd2 { -+ function = "pcmcia_cd2"; -+ pins = "gpio23"; -+ }; -+ -+ pinctrl_pcmcia_vs1: pcmcia_vs1 { -+ function = "pcmcia_vs1"; -+ pins = "gpio24"; -+ }; -+ -+ pinctrl_pcmcia_vs2: pcmcia_vs2 { -+ function = "pcmcia_vs2"; -+ pins = "gpio25"; -+ }; -+ }; -+ -+ pinctrl_ebi_cs2: ebi_cs2 { -+ function = "ebi_cs2"; -+ pins = "gpio26"; -+ }; -+ -+ pinctrl_ebi_cs3: ebi_cs3 { -+ function = "ebi_cs3"; -+ pins = "gpio27"; -+ }; -+ -+ pinctrl_spi_cs2: spi_cs2 { -+ function = "spi_cs2"; -+ pins = "gpio28"; -+ }; -+ -+ pinctrl_spi_cs3: spi_cs3 { -+ function = "spi_cs3"; -+ pins = "gpio29"; -+ }; -+ -+ pinctrl_spi_cs4: spi_cs4 { -+ function = "spi_cs4"; -+ pins = "gpio30"; -+ }; -+ -+ pinctrl_spi_cs5: spi_cs5 { -+ function = "spi_cs5"; -+ pins = "gpio31"; -+ }; -+ -+ pinctrl_uart1: uart1 { -+ function = "uart1"; -+ group = "uart1_grp"; -+ }; -+ }; -+ }; diff --git a/target/linux/bmips/patches-5.10/408-Documentation-add-BCM63268-pincontroller-binding-doc.patch b/target/linux/bmips/patches-5.10/408-Documentation-add-BCM63268-pincontroller-binding-doc.patch deleted file mode 100644 index d51af84328..0000000000 --- a/target/linux/bmips/patches-5.10/408-Documentation-add-BCM63268-pincontroller-binding-doc.patch +++ /dev/null @@ -1,220 +0,0 @@ -From 826266914f8397c996d2d4d821b315d614bfc325 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:37:08 +0200 -Subject: [PATCH 09/12] Documentation: add BCM63268 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in the BCM63268 -family SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm63268-pinctrl.yaml | 198 ++++++++++++++++++ - 1 file changed, 198 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml -@@ -0,0 +1,198 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm63268-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM63268 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm63268-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 4 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 4 -+ maxItems: 4 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ serial_led_clk, serial_led_data, hsspi_cs4, hsspi_cs5, -+ hsspi_cs6, hsspi_cs7, adsl_spi_miso, adsl_spi_mosi, -+ vreq_clk, pcie_clkreq_b, robosw_led_clk, robosw_led_data, -+ nand, gpio35_alt, dectpd, vdsl_phy_override_0, -+ vdsl_phy_override_1, vdsl_phy_override_2, -+ vdsl_phy_override_3, dsl_gpio8, dsl_gpio9 ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ gpio0, gpio1, gpio16, gpio17, gpio8, gpio9, gpio18, gpio19, -+ gpio22, gpio23, gpio30, gpio31, nand_grp, gpio35 -+ dectpd_grp, vdsl_phy_override_0_grp, -+ vdsl_phy_override_1_grp, vdsl_phy_override_2_grp, -+ vdsl_phy_override_3_grp, dsl_gpio8, dsl_gpio9 ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@100000c0 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0x100000c0 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm63268-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc 0 0>, -+ <&ext_intc 1 0>, -+ <&ext_intc 2 0>, -+ <&ext_intc 3 0>; -+ interrupt-names = "gpio32", -+ "gpio33", -+ "gpio34", -+ "gpio35"; -+ -+ pinctrl_serial_led: serial_led { -+ pinctrl_serial_led_clk: serial_led_clk { -+ function = "serial_led_clk"; -+ pins = "gpio0"; -+ }; -+ -+ pinctrl_serial_led_data: serial_led_data { -+ function = "serial_led_data"; -+ pins = "gpio1"; -+ }; -+ }; -+ -+ pinctrl_hsspi_cs4: hsspi_cs4 { -+ function = "hsspi_cs4"; -+ pins = "gpio16"; -+ }; -+ -+ pinctrl_hsspi_cs5: hsspi_cs5 { -+ function = "hsspi_cs5"; -+ pins = "gpio17"; -+ }; -+ -+ pinctrl_hsspi_cs6: hsspi_cs6 { -+ function = "hsspi_cs6"; -+ pins = "gpio8"; -+ }; -+ -+ pinctrl_hsspi_cs7: hsspi_cs7 { -+ function = "hsspi_cs7"; -+ pins = "gpio9"; -+ }; -+ -+ pinctrl_adsl_spi: adsl_spi { -+ pinctrl_adsl_spi_miso: adsl_spi_miso { -+ function = "adsl_spi_miso"; -+ pins = "gpio18"; -+ }; -+ -+ pinctrl_adsl_spi_mosi: adsl_spi_mosi { -+ function = "adsl_spi_mosi"; -+ pins = "gpio19"; -+ }; -+ }; -+ -+ pinctrl_vreq_clk: vreq_clk { -+ function = "vreq_clk"; -+ pins = "gpio22"; -+ }; -+ -+ pinctrl_pcie_clkreq_b: pcie_clkreq_b { -+ function = "pcie_clkreq_b"; -+ pins = "gpio23"; -+ }; -+ -+ pinctrl_robosw_led_clk: robosw_led_clk { -+ function = "robosw_led_clk"; -+ pins = "gpio30"; -+ }; -+ -+ pinctrl_robosw_led_data: robosw_led_data { -+ function = "robosw_led_data"; -+ pins = "gpio31"; -+ }; -+ -+ pinctrl_nand: nand { -+ function = "nand"; -+ group = "nand_grp"; -+ }; -+ -+ pinctrl_gpio35_alt: gpio35_alt { -+ function = "gpio35_alt"; -+ pin = "gpio35"; -+ }; -+ -+ pinctrl_dectpd: dectpd { -+ function = "dectpd"; -+ group = "dectpd_grp"; -+ }; -+ -+ pinctrl_vdsl_phy_override_0: vdsl_phy_override_0 { -+ function = "vdsl_phy_override_0"; -+ group = "vdsl_phy_override_0_grp"; -+ }; -+ -+ pinctrl_vdsl_phy_override_1: vdsl_phy_override_1 { -+ function = "vdsl_phy_override_1"; -+ group = "vdsl_phy_override_1_grp"; -+ }; -+ -+ pinctrl_vdsl_phy_override_2: vdsl_phy_override_2 { -+ function = "vdsl_phy_override_2"; -+ group = "vdsl_phy_override_2_grp"; -+ }; -+ -+ pinctrl_vdsl_phy_override_3: vdsl_phy_override_3 { -+ function = "vdsl_phy_override_3"; -+ group = "vdsl_phy_override_3_grp"; -+ }; -+ -+ pinctrl_dsl_gpio8: dsl_gpio8 { -+ function = "dsl_gpio8"; -+ group = "dsl_gpio8"; -+ }; -+ -+ pinctrl_dsl_gpio9: dsl_gpio9 { -+ function = "dsl_gpio9"; -+ group = "dsl_gpio9"; -+ }; -+ }; -+ }; diff --git a/target/linux/bmips/patches-5.10/410-Documentation-add-BCM6318-pincontroller-binding-docu.patch b/target/linux/bmips/patches-5.10/410-Documentation-add-BCM6318-pincontroller-binding-docu.patch deleted file mode 100644 index 6577038756..0000000000 --- a/target/linux/bmips/patches-5.10/410-Documentation-add-BCM6318-pincontroller-binding-docu.patch +++ /dev/null @@ -1,194 +0,0 @@ -From f909bf5d5cf3db6b35c082f27f7982dfcb1447c2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= -Date: Wed, 27 Jul 2016 11:38:05 +0200 -Subject: [PATCH 11/12] Documentation: add BCM6318 pincontroller binding - documentation -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Add binding documentation for the pincontrol core found in BCM6318 SoCs. - -Signed-off-by: Álvaro Fernández Rojas -Signed-off-by: Jonas Gorski ---- - .../pinctrl/brcm,bcm6318-pinctrl.yaml | 173 ++++++++++++++++++ - 1 file changed, 173 insertions(+) - create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml - ---- /dev/null -+++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml -@@ -0,0 +1,173 @@ -+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause -+%YAML 1.2 -+--- -+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6318-pinctrl.yaml# -+$schema: http://devicetree.org/meta-schemas/core.yaml# -+ -+title: Broadcom BCM6318 pin controller -+ -+maintainers: -+ - Álvaro Fernández Rojas -+ - Jonas Gorski -+ -+description: |+ -+ The pin controller node should be the child of a syscon node. -+ -+ Refer to the the bindings described in -+ Documentation/devicetree/bindings/mfd/syscon.yaml -+ -+properties: -+ compatible: -+ const: brcm,bcm6318-pinctrl -+ -+ gpio-controller: true -+ -+ '#gpio-cells': -+ description: -+ Specifies the pin number and flags, as defined in -+ include/dt-bindings/gpio/gpio.h -+ const: 2 -+ -+ interrupts-extended: -+ description: -+ One interrupt per each of the 2 GPIO ports supported by the controller, -+ sorted by port number ascending order. -+ minItems: 2 -+ maxItems: 2 -+ -+patternProperties: -+ '^.*$': -+ if: -+ type: object -+ then: -+ properties: -+ function: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ ephy0_spd_led, ephy1_spd_led, ephy2_spd_led, ephy3_spd_led, -+ ephy0_act_led, ephy1_act_led, ephy2_act_led, ephy3_act_led, -+ serial_led_data, serial_led_clk, inet_act_led, inet_fail_led, -+ dsl_led, post_fail_led, wlan_wps_led, usb_pwron, -+ usb_device_led, usb_active ] -+ -+ pins: -+ $ref: "/schemas/types.yaml#/definitions/string" -+ enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, -+ gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio40 ] -+ -+required: -+ - compatible -+ - gpio-controller -+ - '#gpio-cells' -+ -+additionalProperties: false -+ -+examples: -+ - | -+ gpio@10000080 { -+ compatible = "syscon", "simple-mfd"; -+ reg = <0x10000080 0x80>; -+ -+ pinctrl: pinctrl { -+ compatible = "brcm,bcm6318-pinctrl"; -+ -+ gpio-controller; -+ #gpio-cells = <2>; -+ -+ interrupts-extended = <&ext_intc 0 0>, -+ <&ext_intc 1 0>; -+ interrupt-names = "gpio33", -+ "gpio34"; -+ -+ pinctrl_ephy0_spd_led: ephy0_spd_led { -+ function = "ephy0_spd_led"; -+ pins = "gpio0"; -+ }; -+ -+ pinctrl_ephy1_spd_led: ephy1_spd_led { -+ function = "ephy1_spd_led"; -+ pins = "gpio1"; -+ }; -+ -+ pinctrl_ephy2_spd_led: ephy2_spd_led { -+ function = "ephy2_spd_led"; -+ pins = "gpio2"; -+ }; -+ -+ pinctrl_ephy3_spd_led: ephy3_spd_led { -+ function = "ephy3_spd_led"; -+ pins = "gpio3"; -+ }; -+ -+ pinctrl_ephy0_act_led: ephy0_act_led { -+ function = "ephy0_act_led"; -+ pins = "gpio4"; -+ }; -+ -+ pinctrl_ephy1_act_led: ephy1_act_led { -+ function = "ephy1_act_led"; -+ pins = "gpio5"; -+ }; -+ -+ pinctrl_ephy2_act_led: ephy2_act_led { -+ function = "ephy2_act_led"; -+ pins = "gpio6"; -+ }; -+ -+ pinctrl_ephy3_act_led: ephy3_act_led { -+ function = "ephy3_act_led"; -+ pins = "gpio7"; -+ }; -+ -+ pinctrl_serial_led: serial_led { -+ pinctrl_serial_led_data: serial_led_data { -+ function = "serial_led_data"; -+ pins = "gpio6"; -+ }; -+ -+ pinctrl_serial_led_clk: serial_led_clk { -+ function = "serial_led_clk"; -+ pins = "gpio7"; -+ }; -+ }; -+ -+ pinctrl_inet_act_led: inet_act_led { -+ function = "inet_act_led"; -+ pins = "gpio8"; -+ }; -+ -+ pinctrl_inet_fail_led: inet_fail_led { -+ function = "inet_fail_led"; -+ pins = "gpio9"; -+ }; -+ -+ pinctrl_dsl_led: dsl_led { -+ function = "dsl_led"; -+ pins = "gpio10"; -+ }; -+ -+ pinctrl_post_fail_led: post_fail_led { -+ function = "post_fail_led"; -+ pins = "gpio11"; -+ }; -+ -+ pinctrl_wlan_wps_led: wlan_wps_led { -+ function = "wlan_wps_led"; -+ pins = "gpio12"; -+ }; -+ -+ pinctrl_usb_pwron: usb_pwron { -+ function = "usb_pwron"; -+ pins = "gpio13"; -+ }; -+ -+ pinctrl_usb_device_led: usb_device_led { -+ function = "usb_device_led"; -+ pins = "gpio13"; -+ }; -+ -+ pinctrl_usb_active: usb_active { -+ function = "usb_active"; -+ pins = "gpio40"; -+ }; -+ }; -+ }; diff --git a/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch b/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch new file mode 100644 index 0000000000..f1b778a6e1 --- /dev/null +++ b/target/linux/generic/backport-5.10/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch @@ -0,0 +1,34 @@ +From b87b6d2d6f540e29c3f98e1572d64e560d73d6c1 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Thu, 4 Mar 2021 06:46:00 +0000 +Subject: [PATCH] mtd: parsers: ofpart: make symbol 'bcm4908_partitions_quirks' + static + +The sparse tool complains as follows: + +drivers/mtd/parsers/ofpart_core.c:25:32: warning: + symbol 'bcm4908_partitions_quirks' was not declared. Should it be static? + +This symbol is not used outside of ofpart_core.c, so this +commit marks it static. + +Fixes: 457da931b608 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") +Reported-by: Hulk Robot +Signed-off-by: Wei Yongjun +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210304064600.3279138-1-weiyongjun1@huawei.com +--- + drivers/mtd/parsers/ofpart_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -22,7 +22,7 @@ struct fixed_partitions_quirks { + int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); + }; + +-struct fixed_partitions_quirks bcm4908_partitions_quirks = { ++static struct fixed_partitions_quirks bcm4908_partitions_quirks = { + .post_parse = bcm4908_partitions_post_parse, + }; + diff --git a/target/linux/generic/pending-5.10/401-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch b/target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch similarity index 100% rename from target/linux/generic/pending-5.10/401-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch rename to target/linux/generic/backport-5.10/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch diff --git a/target/linux/generic/pending-5.10/401-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch b/target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch similarity index 100% rename from target/linux/generic/pending-5.10/401-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch rename to target/linux/generic/backport-5.10/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch diff --git a/target/linux/generic/pending-5.10/401-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch b/target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch similarity index 100% rename from target/linux/generic/pending-5.10/401-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch rename to target/linux/generic/backport-5.10/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch diff --git a/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch b/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch new file mode 100644 index 0000000000..35a4afd67b --- /dev/null +++ b/target/linux/generic/backport-5.10/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch @@ -0,0 +1,98 @@ +From 2fa7294175c76e1ec568aa75c1891fd908728c8d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 14:49:18 +0100 +Subject: [PATCH] dt-bindings: mtd: add binding for Linksys Northstar + partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Linksys on Broadcom Northstar devices uses fixed flash layout with +multiple firmware partitions. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-1-zajec5@gmail.com +--- + .../mtd/partitions/linksys,ns-partitions.yaml | 74 +++++++++++++++++++ + 1 file changed, 74 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml +@@ -0,0 +1,74 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mtd/partitions/linksys,ns-partitions.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Linksys Northstar partitioning ++ ++description: | ++ Linksys devices based on Broadcom Northstar architecture often use two ++ firmware partitions. One is used for regular booting, the other is treated as ++ fallback. ++ ++ This binding allows defining all fixed partitions and marking those containing ++ firmware. System can use that information e.g. for booting or flashing ++ purposes. ++ ++maintainers: ++ - Rafał Miłecki ++ ++properties: ++ compatible: ++ const: linksys,ns-partitions ++ ++ "#address-cells": ++ enum: [ 1, 2 ] ++ ++ "#size-cells": ++ enum: [ 1, 2 ] ++ ++patternProperties: ++ "^partition@[0-9a-f]+$": ++ $ref: "partition.yaml#" ++ properties: ++ compatible: ++ items: ++ - const: linksys,ns-firmware ++ - const: brcm,trx ++ unevaluatedProperties: false ++ ++required: ++ - "#address-cells" ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ partitions { ++ compatible = "linksys,ns-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "boot"; ++ reg = <0x0 0x100000>; ++ read-only; ++ }; ++ ++ partition@100000 { ++ label = "nvram"; ++ reg = <0x100000 0x100000>; ++ }; ++ ++ partition@200000 { ++ compatible = "linksys,ns-firmware", "brcm,trx"; ++ reg = <0x200000 0xf00000>; ++ }; ++ ++ partition@1100000 { ++ compatible = "linksys,ns-firmware", "brcm,trx"; ++ reg = <0x1100000 0xf00000>; ++ }; ++ }; diff --git a/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch b/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch new file mode 100644 index 0000000000..f317889785 --- /dev/null +++ b/target/linux/generic/backport-5.10/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch @@ -0,0 +1,156 @@ +From 7134a2d026d942210b4d26d6059c9d979ca7866e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 14:49:19 +0100 +Subject: [PATCH] mtd: parsers: ofpart: support Linksys Northstar partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows extending ofpart parser with support for Linksys Northstar +devices. That support uses recently added quirks mechanism. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-2-zajec5@gmail.com +--- + drivers/mtd/parsers/Kconfig | 10 +++++ + drivers/mtd/parsers/Makefile | 1 + + drivers/mtd/parsers/ofpart_core.c | 6 +++ + drivers/mtd/parsers/ofpart_linksys_ns.c | 50 +++++++++++++++++++++++++ + drivers/mtd/parsers/ofpart_linksys_ns.h | 18 +++++++++ + 5 files changed, 85 insertions(+) + create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.c + create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.h + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -76,6 +76,16 @@ config MTD_OF_PARTS_BCM4908 + that can have multiple "firmware" partitions. It takes care of + finding currently used one and backup ones. + ++config MTD_OF_PARTS_LINKSYS_NS ++ bool "Linksys Northstar partitioning support" ++ depends on MTD_OF_PARTS && (ARCH_BCM_5301X || ARCH_BCM4908 || COMPILE_TEST) ++ default ARCH_BCM_5301X ++ help ++ This provides partitions parser for Linksys devices based on Broadcom ++ Northstar architecture. Linksys commonly uses fixed flash layout with ++ two "firmware" partitions. Currently used firmware has to be detected ++ using CFE environment variable. ++ + config MTD_PARSER_IMAGETAG + tristate "Parser for BCM963XX Image Tag format partitions" + depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -6,6 +6,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdl + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + ofpart-y += ofpart_core.o + ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ++ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -17,6 +17,7 @@ + #include + + #include "ofpart_bcm4908.h" ++#include "ofpart_linksys_ns.h" + + struct fixed_partitions_quirks { + int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); +@@ -26,6 +27,10 @@ static struct fixed_partitions_quirks bc + .post_parse = bcm4908_partitions_post_parse, + }; + ++static struct fixed_partitions_quirks linksys_ns_partitions_quirks = { ++ .post_parse = linksys_ns_partitions_post_parse, ++}; ++ + static const struct of_device_id parse_ofpart_match_table[]; + + static bool node_has_compatible(struct device_node *pp) +@@ -167,6 +172,7 @@ static const struct of_device_id parse_o + { .compatible = "fixed-partitions" }, + /* Customized */ + { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, ++ { .compatible = "linksys,ns-partitions", .data = &linksys_ns_partitions_quirks, }, + {}, + }; + MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_linksys_ns.c +@@ -0,0 +1,50 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2021 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++ ++#include "ofpart_linksys_ns.h" ++ ++#define NVRAM_BOOT_PART "bootpartition" ++ ++static int ofpart_linksys_ns_bootpartition(void) ++{ ++ char buf[4]; ++ int bootpartition; ++ ++ /* Check CFE environment variable */ ++ if (bcm47xx_nvram_getenv(NVRAM_BOOT_PART, buf, sizeof(buf)) > 0) { ++ if (!kstrtoint(buf, 0, &bootpartition)) ++ return bootpartition; ++ pr_warn("Failed to parse %s value \"%s\"\n", NVRAM_BOOT_PART, ++ buf); ++ } else { ++ pr_warn("Failed to get NVRAM \"%s\"\n", NVRAM_BOOT_PART); ++ } ++ ++ return 0; ++} ++ ++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts) ++{ ++ int bootpartition = ofpart_linksys_ns_bootpartition(); ++ int trx_idx = 0; ++ int i; ++ ++ for (i = 0; i < nr_parts; i++) { ++ if (of_device_is_compatible(parts[i].of_node, "linksys,ns-firmware")) { ++ if (trx_idx++ == bootpartition) ++ parts[i].name = "firmware"; ++ else ++ parts[i].name = "backup"; ++ } ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_linksys_ns.h +@@ -0,0 +1,18 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __OFPART_LINKSYS_NS_H ++#define __OFPART_LINKSYS_NS_H ++ ++#ifdef CONFIG_MTD_OF_PARTS_LINKSYS_NS ++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts); ++#else ++static inline int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts) ++{ ++ return -EOPNOTSUPP; ++} ++#endif ++ ++#endif diff --git a/target/linux/generic/backport-5.4/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch b/target/linux/generic/backport-5.4/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch new file mode 100644 index 0000000000..f1b778a6e1 --- /dev/null +++ b/target/linux/generic/backport-5.4/405-v5.13-mtd-parsers-ofpart-make-symbol-bcm4908_partitions_qu.patch @@ -0,0 +1,34 @@ +From b87b6d2d6f540e29c3f98e1572d64e560d73d6c1 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Thu, 4 Mar 2021 06:46:00 +0000 +Subject: [PATCH] mtd: parsers: ofpart: make symbol 'bcm4908_partitions_quirks' + static + +The sparse tool complains as follows: + +drivers/mtd/parsers/ofpart_core.c:25:32: warning: + symbol 'bcm4908_partitions_quirks' was not declared. Should it be static? + +This symbol is not used outside of ofpart_core.c, so this +commit marks it static. + +Fixes: 457da931b608 ("mtd: parsers: ofpart: support BCM4908 fixed partitions") +Reported-by: Hulk Robot +Signed-off-by: Wei Yongjun +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210304064600.3279138-1-weiyongjun1@huawei.com +--- + drivers/mtd/parsers/ofpart_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -22,7 +22,7 @@ struct fixed_partitions_quirks { + int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); + }; + +-struct fixed_partitions_quirks bcm4908_partitions_quirks = { ++static struct fixed_partitions_quirks bcm4908_partitions_quirks = { + .post_parse = bcm4908_partitions_post_parse, + }; + diff --git a/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch b/target/linux/generic/backport-5.4/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch similarity index 85% rename from target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch rename to target/linux/generic/backport-5.4/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch index 25801e4686..ecea743d87 100644 --- a/target/linux/generic/pending-5.4/405-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch +++ b/target/linux/generic/backport-5.4/406-v5.13-0001-mtd-core-add-nvmem-cells-compatible-to-parse-mtd-as-.patch @@ -1,4 +1,4 @@ -From a5d83d6e2bc747b13f347962d4b335d70b23559b Mon Sep 17 00:00:00 2001 +From 658c4448bbbf02a143abf1b89d09a3337ebd3ba6 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Fri, 12 Mar 2021 07:28:19 +0100 Subject: [PATCH] mtd: core: add nvmem-cells compatible to parse mtd as nvmem @@ -13,6 +13,8 @@ nvmem provider. Signed-off-by: Ansuel Smith Tested-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312062830.20548-1-ansuelsmth@gmail.com --- drivers/mtd/mtdcore.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch b/target/linux/generic/backport-5.4/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch similarity index 66% rename from target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch rename to target/linux/generic/backport-5.4/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch index 14ea3f6b8c..c0515bd571 100644 --- a/target/linux/generic/pending-5.4/405-0002-devicetree-nvmem-nvmem-drop-nodename-restriction.patch +++ b/target/linux/generic/backport-5.4/406-v5.13-0002-dt-bindings-nvmem-drop-nodename-restriction.patch @@ -1,12 +1,15 @@ -From 42645976c3289b03a12f1bd2bc131fd98fc27170 Mon Sep 17 00:00:00 2001 +From 52981a0fa9f7d68641e0e6bb584054c6d9eb2056 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Fri, 12 Mar 2021 07:28:20 +0100 -Subject: [PATCH] devicetree: nvmem: nvmem: drop $nodename restriction +Subject: [PATCH] dt-bindings: nvmem: drop $nodename restriction Drop $nodename restriction as now mtd partition can also be used as nvmem provider. Signed-off-by: Ansuel Smith +Reviewed-by: Rob Herring +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312062830.20548-2-ansuelsmth@gmail.com --- Documentation/devicetree/bindings/nvmem/nvmem.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch b/target/linux/generic/backport-5.4/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch similarity index 93% rename from target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch rename to target/linux/generic/backport-5.4/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch index 0eb4c637cf..552919f587 100644 --- a/target/linux/generic/pending-5.4/405-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch +++ b/target/linux/generic/backport-5.4/406-v5.13-0003-dt-bindings-mtd-Document-use-of-nvmem-cells-compatib.patch @@ -1,4 +1,4 @@ -From 377aa0135dc8489312edd3184d143ce3a89ff7ee Mon Sep 17 00:00:00 2001 +From ac42c46f983e4a9003a7bb91ad44a23ab7b8f534 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Fri, 12 Mar 2021 07:28:21 +0100 Subject: [PATCH] dt-bindings: mtd: Document use of nvmem-cells compatible @@ -8,6 +8,8 @@ nvmem provider. Signed-off-by: Ansuel Smith Reviewed-by: Rob Herring +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312062830.20548-3-ansuelsmth@gmail.com --- .../bindings/mtd/partitions/nvmem-cells.yaml | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/target/linux/generic/backport-5.4/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch b/target/linux/generic/backport-5.4/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch new file mode 100644 index 0000000000..35a4afd67b --- /dev/null +++ b/target/linux/generic/backport-5.4/407-v5.13-0001-dt-bindings-mtd-add-binding-for-Linksys-Northstar-pa.patch @@ -0,0 +1,98 @@ +From 2fa7294175c76e1ec568aa75c1891fd908728c8d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 14:49:18 +0100 +Subject: [PATCH] dt-bindings: mtd: add binding for Linksys Northstar + partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Linksys on Broadcom Northstar devices uses fixed flash layout with +multiple firmware partitions. + +Signed-off-by: Rafał Miłecki +Reviewed-by: Rob Herring +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-1-zajec5@gmail.com +--- + .../mtd/partitions/linksys,ns-partitions.yaml | 74 +++++++++++++++++++ + 1 file changed, 74 insertions(+) + create mode 100644 Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml + +--- /dev/null ++++ b/Documentation/devicetree/bindings/mtd/partitions/linksys,ns-partitions.yaml +@@ -0,0 +1,74 @@ ++# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause ++%YAML 1.2 ++--- ++$id: http://devicetree.org/schemas/mtd/partitions/linksys,ns-partitions.yaml# ++$schema: http://devicetree.org/meta-schemas/core.yaml# ++ ++title: Linksys Northstar partitioning ++ ++description: | ++ Linksys devices based on Broadcom Northstar architecture often use two ++ firmware partitions. One is used for regular booting, the other is treated as ++ fallback. ++ ++ This binding allows defining all fixed partitions and marking those containing ++ firmware. System can use that information e.g. for booting or flashing ++ purposes. ++ ++maintainers: ++ - Rafał Miłecki ++ ++properties: ++ compatible: ++ const: linksys,ns-partitions ++ ++ "#address-cells": ++ enum: [ 1, 2 ] ++ ++ "#size-cells": ++ enum: [ 1, 2 ] ++ ++patternProperties: ++ "^partition@[0-9a-f]+$": ++ $ref: "partition.yaml#" ++ properties: ++ compatible: ++ items: ++ - const: linksys,ns-firmware ++ - const: brcm,trx ++ unevaluatedProperties: false ++ ++required: ++ - "#address-cells" ++ - "#size-cells" ++ ++additionalProperties: false ++ ++examples: ++ - | ++ partitions { ++ compatible = "linksys,ns-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "boot"; ++ reg = <0x0 0x100000>; ++ read-only; ++ }; ++ ++ partition@100000 { ++ label = "nvram"; ++ reg = <0x100000 0x100000>; ++ }; ++ ++ partition@200000 { ++ compatible = "linksys,ns-firmware", "brcm,trx"; ++ reg = <0x200000 0xf00000>; ++ }; ++ ++ partition@1100000 { ++ compatible = "linksys,ns-firmware", "brcm,trx"; ++ reg = <0x1100000 0xf00000>; ++ }; ++ }; diff --git a/target/linux/generic/backport-5.4/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch b/target/linux/generic/backport-5.4/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch new file mode 100644 index 0000000000..75eb9391ae --- /dev/null +++ b/target/linux/generic/backport-5.4/407-v5.13-0002-mtd-parsers-ofpart-support-Linksys-Northstar-partiti.patch @@ -0,0 +1,156 @@ +From 7134a2d026d942210b4d26d6059c9d979ca7866e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 12 Mar 2021 14:49:19 +0100 +Subject: [PATCH] mtd: parsers: ofpart: support Linksys Northstar partitions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This allows extending ofpart parser with support for Linksys Northstar +devices. That support uses recently added quirks mechanism. + +Signed-off-by: Rafał Miłecki +Signed-off-by: Miquel Raynal +Link: https://lore.kernel.org/linux-mtd/20210312134919.7767-2-zajec5@gmail.com +--- + drivers/mtd/parsers/Kconfig | 10 +++++ + drivers/mtd/parsers/Makefile | 1 + + drivers/mtd/parsers/ofpart_core.c | 6 +++ + drivers/mtd/parsers/ofpart_linksys_ns.c | 50 +++++++++++++++++++++++++ + drivers/mtd/parsers/ofpart_linksys_ns.h | 18 +++++++++ + 5 files changed, 85 insertions(+) + create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.c + create mode 100644 drivers/mtd/parsers/ofpart_linksys_ns.h + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -76,6 +76,16 @@ config MTD_OF_PARTS_BCM4908 + that can have multiple "firmware" partitions. It takes care of + finding currently used one and backup ones. + ++config MTD_OF_PARTS_LINKSYS_NS ++ bool "Linksys Northstar partitioning support" ++ depends on MTD_OF_PARTS && (ARCH_BCM_5301X || ARCH_BCM4908 || COMPILE_TEST) ++ default ARCH_BCM_5301X ++ help ++ This provides partitions parser for Linksys devices based on Broadcom ++ Northstar architecture. Linksys commonly uses fixed flash layout with ++ two "firmware" partitions. Currently used firmware has to be detected ++ using CFE environment variable. ++ + config MTD_PARSER_IMAGETAG + tristate "Parser for BCM963XX Image Tag format partitions" + depends on BCM63XX || BMIPS_GENERIC || COMPILE_TEST +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -6,6 +6,7 @@ obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdl + obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o + ofpart-y += ofpart_core.o + ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += ofpart_bcm4908.o ++ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS)+= ofpart_linksys_ns.o + obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o + obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o +--- a/drivers/mtd/parsers/ofpart_core.c ++++ b/drivers/mtd/parsers/ofpart_core.c +@@ -17,6 +17,7 @@ + #include + + #include "ofpart_bcm4908.h" ++#include "ofpart_linksys_ns.h" + + struct fixed_partitions_quirks { + int (*post_parse)(struct mtd_info *mtd, struct mtd_partition *parts, int nr_parts); +@@ -26,6 +27,10 @@ static struct fixed_partitions_quirks bc + .post_parse = bcm4908_partitions_post_parse, + }; + ++static struct fixed_partitions_quirks linksys_ns_partitions_quirks = { ++ .post_parse = linksys_ns_partitions_post_parse, ++}; ++ + static const struct of_device_id parse_ofpart_match_table[]; + + static bool node_has_compatible(struct device_node *pp) +@@ -164,6 +169,7 @@ static const struct of_device_id parse_o + { .compatible = "fixed-partitions" }, + /* Customized */ + { .compatible = "brcm,bcm4908-partitions", .data = &bcm4908_partitions_quirks, }, ++ { .compatible = "linksys,ns-partitions", .data = &linksys_ns_partitions_quirks, }, + {}, + }; + MODULE_DEVICE_TABLE(of, parse_ofpart_match_table); +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_linksys_ns.c +@@ -0,0 +1,50 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (C) 2021 Rafał Miłecki ++ */ ++ ++#include ++#include ++#include ++ ++#include "ofpart_linksys_ns.h" ++ ++#define NVRAM_BOOT_PART "bootpartition" ++ ++static int ofpart_linksys_ns_bootpartition(void) ++{ ++ char buf[4]; ++ int bootpartition; ++ ++ /* Check CFE environment variable */ ++ if (bcm47xx_nvram_getenv(NVRAM_BOOT_PART, buf, sizeof(buf)) > 0) { ++ if (!kstrtoint(buf, 0, &bootpartition)) ++ return bootpartition; ++ pr_warn("Failed to parse %s value \"%s\"\n", NVRAM_BOOT_PART, ++ buf); ++ } else { ++ pr_warn("Failed to get NVRAM \"%s\"\n", NVRAM_BOOT_PART); ++ } ++ ++ return 0; ++} ++ ++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts) ++{ ++ int bootpartition = ofpart_linksys_ns_bootpartition(); ++ int trx_idx = 0; ++ int i; ++ ++ for (i = 0; i < nr_parts; i++) { ++ if (of_device_is_compatible(parts[i].of_node, "linksys,ns-firmware")) { ++ if (trx_idx++ == bootpartition) ++ parts[i].name = "firmware"; ++ else ++ parts[i].name = "backup"; ++ } ++ } ++ ++ return 0; ++} +--- /dev/null ++++ b/drivers/mtd/parsers/ofpart_linksys_ns.h +@@ -0,0 +1,18 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++#ifndef __OFPART_LINKSYS_NS_H ++#define __OFPART_LINKSYS_NS_H ++ ++#ifdef CONFIG_MTD_OF_PARTS_LINKSYS_NS ++int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts); ++#else ++static inline int linksys_ns_partitions_post_parse(struct mtd_info *mtd, ++ struct mtd_partition *parts, ++ int nr_parts) ++{ ++ return -EOPNOTSUPP; ++} ++#endif ++ ++#endif diff --git a/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch index 7853cae325..ab1e09a5f1 100644 --- a/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.10/435-mtd-add-routerbootpart-parser-config.patch @@ -16,7 +16,7 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -185,3 +185,12 @@ config MTD_REDBOOT_PARTS_READONLY +@@ -195,3 +195,12 @@ config MTD_REDBOOT_PARTS_READONLY 'FIS directory' images, enable this option. endif # MTD_REDBOOT_PARTS @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -12,3 +12,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o +@@ -13,3 +13,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch index 7853cae325..ab1e09a5f1 100644 --- a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -16,7 +16,7 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -185,3 +185,12 @@ config MTD_REDBOOT_PARTS_READONLY +@@ -195,3 +195,12 @@ config MTD_REDBOOT_PARTS_READONLY 'FIS directory' images, enable this option. endif # MTD_REDBOOT_PARTS @@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE + formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -12,3 +12,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o +@@ -13,3 +13,4 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o diff --git a/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch b/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch index 0b54e0772e..6b7119b8e0 100644 --- a/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch +++ b/target/linux/ipq806x/patches-5.4/0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch @@ -18,7 +18,7 @@ Signed-off-by: Ram Chandra Jangir --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -128,6 +128,13 @@ config MTD_PARSER_TRX +@@ -138,6 +138,13 @@ config MTD_PARSER_TRX This driver will parse TRX header and report at least two partitions: kernel and rootfs. @@ -34,7 +34,7 @@ Signed-off-by: Ram Chandra Jangir depends on MTD_NAND_SHARPSL || MTD_NAND_TMIO || COMPILE_TEST --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -10,6 +10,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_BCM4908) += +@@ -11,6 +11,7 @@ ofpart-$(CONFIG_MTD_OF_PARTS_LINKSYS_NS) obj-$(CONFIG_MTD_PARSER_IMAGETAG) += parser_imagetag.o obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o diff --git a/target/linux/kirkwood/patches-5.10/202-linksys-find-active-root.patch b/target/linux/kirkwood/patches-5.10/202-linksys-find-active-root.patch index 214a0cd649..b50c0370bd 100644 --- a/target/linux/kirkwood/patches-5.10/202-linksys-find-active-root.patch +++ b/target/linux/kirkwood/patches-5.10/202-linksys-find-active-root.patch @@ -5,7 +5,7 @@ Signed-off-by: Imre Kaloz --- --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c -@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d +@@ -38,6 +38,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -42,6 +44,7 @@ static int parse_fixed_partitions(struct +@@ -47,6 +49,7 @@ static int parse_fixed_partitions(struct struct mtd_partition *parts; struct device_node *mtd_node; struct device_node *ofpart_node; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz const char *partname; struct device_node *pp; int nr_parts, i, ret = 0; -@@ -126,9 +129,15 @@ static int parse_fixed_partitions(struct +@@ -131,9 +134,15 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -41,7 +41,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -244,6 +253,18 @@ static int __init ofpart_parser_init(voi +@@ -250,6 +259,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch index 3077e718c3..016ec01112 100644 --- a/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch +++ b/target/linux/kirkwood/patches-5.4/202-linksys-find-active-root.patch @@ -5,7 +5,7 @@ Signed-off-by: Imre Kaloz --- --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c -@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d +@@ -38,6 +38,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -42,6 +44,7 @@ static int parse_fixed_partitions(struct +@@ -47,6 +49,7 @@ static int parse_fixed_partitions(struct struct mtd_partition *parts; struct device_node *mtd_node; struct device_node *ofpart_node; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz const char *partname; struct device_node *pp; int nr_parts, i, ret = 0; -@@ -126,9 +129,15 @@ static int parse_fixed_partitions(struct +@@ -131,9 +134,15 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -41,7 +41,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -241,6 +250,18 @@ static int __init ofpart_parser_init(voi +@@ -247,6 +256,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch index 201cdd3f87..6e55ef9d7a 100644 --- a/target/linux/lantiq/patches-5.4/0101-find_active_root.patch +++ b/target/linux/lantiq/patches-5.4/0101-find_active_root.patch @@ -1,6 +1,6 @@ --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c -@@ -33,6 +33,38 @@ static bool node_has_compatible(struct d +@@ -38,6 +38,38 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -39,7 +39,7 @@ static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -46,6 +78,8 @@ static int parse_fixed_partitions(struct +@@ -51,6 +83,8 @@ static int parse_fixed_partitions(struct struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; @@ -48,7 +48,7 @@ /* Pull of_node from the master device node */ mtd_node = mtd_get_of_node(master); -@@ -88,7 +122,9 @@ static int parse_fixed_partitions(struct +@@ -93,7 +127,9 @@ static int parse_fixed_partitions(struct return 0; parts = kcalloc(nr_parts, sizeof(*parts), GFP_KERNEL); @@ -59,7 +59,7 @@ return -ENOMEM; i = 0; -@@ -137,6 +173,11 @@ static int parse_fixed_partitions(struct +@@ -142,6 +178,11 @@ static int parse_fixed_partitions(struct if (of_get_property(pp, "lock", &len)) parts[i].mask_flags |= MTD_POWERUP_LOCK; @@ -71,7 +71,7 @@ i++; } -@@ -146,6 +187,11 @@ static int parse_fixed_partitions(struct +@@ -151,6 +192,11 @@ static int parse_fixed_partitions(struct if (quirks && quirks->post_parse) quirks->post_parse(master, parts, nr_parts); @@ -83,7 +83,7 @@ *pparts = parts; return nr_parts; -@@ -156,6 +202,7 @@ ofpart_fail: +@@ -161,6 +207,7 @@ ofpart_fail: ofpart_none: of_node_put(pp); kfree(parts); diff --git a/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch b/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch index 5f06cad4cd..fa94c22304 100644 --- a/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch +++ b/target/linux/mediatek/patches-5.10/351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch @@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -121,7 +121,7 @@ config MTD_AFS_PARTS +@@ -131,7 +131,7 @@ config MTD_AFS_PARTS config MTD_PARSER_TRX tristate "Parser for TRX format partitions" diff --git a/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch b/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch index 5f06cad4cd..fa94c22304 100644 --- a/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch +++ b/target/linux/mediatek/patches-5.4/0351-mtd-parsers-Remove-dependency-to-BRCM-architectures.patch @@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -121,7 +121,7 @@ config MTD_AFS_PARTS +@@ -131,7 +131,7 @@ config MTD_AFS_PARTS config MTD_PARSER_TRX tristate "Parser for TRX format partitions" diff --git a/target/linux/mvebu/patches-5.10/400-find_active_root.patch b/target/linux/mvebu/patches-5.10/400-find_active_root.patch index 6146c8e038..63b4c48dcf 100644 --- a/target/linux/mvebu/patches-5.10/400-find_active_root.patch +++ b/target/linux/mvebu/patches-5.10/400-find_active_root.patch @@ -5,7 +5,7 @@ Signed-off-by: Imre Kaloz --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c -@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d +@@ -38,6 +38,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -43,6 +45,7 @@ static int parse_fixed_partitions(struct +@@ -48,6 +50,7 @@ static int parse_fixed_partitions(struct struct device_node *mtd_node; struct device_node *ofpart_node; const char *partname; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; -@@ -126,9 +129,13 @@ static int parse_fixed_partitions(struct +@@ -131,9 +134,13 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -39,7 +39,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -244,6 +251,18 @@ static int __init ofpart_parser_init(voi +@@ -250,6 +257,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/mvebu/patches-5.4/400-find_active_root.patch b/target/linux/mvebu/patches-5.4/400-find_active_root.patch index 6ac777a1d2..3bdb1eab8f 100644 --- a/target/linux/mvebu/patches-5.4/400-find_active_root.patch +++ b/target/linux/mvebu/patches-5.4/400-find_active_root.patch @@ -5,7 +5,7 @@ Signed-off-by: Imre Kaloz --- a/drivers/mtd/parsers/ofpart_core.c +++ b/drivers/mtd/parsers/ofpart_core.c -@@ -33,6 +33,8 @@ static bool node_has_compatible(struct d +@@ -38,6 +38,8 @@ static bool node_has_compatible(struct d return of_get_property(pp, "compatible", NULL); } @@ -14,7 +14,7 @@ Signed-off-by: Imre Kaloz static int parse_fixed_partitions(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) -@@ -43,6 +45,7 @@ static int parse_fixed_partitions(struct +@@ -48,6 +50,7 @@ static int parse_fixed_partitions(struct struct device_node *mtd_node; struct device_node *ofpart_node; const char *partname; @@ -22,7 +22,7 @@ Signed-off-by: Imre Kaloz struct device_node *pp; int nr_parts, i, ret = 0; bool dedicated = true; -@@ -126,9 +129,13 @@ static int parse_fixed_partitions(struct +@@ -131,9 +134,13 @@ static int parse_fixed_partitions(struct parts[i].size = of_read_number(reg + a_cells, s_cells); parts[i].of_node = pp; @@ -39,7 +39,7 @@ Signed-off-by: Imre Kaloz parts[i].name = partname; if (of_get_property(pp, "read-only", &len)) -@@ -241,6 +248,18 @@ static int __init ofpart_parser_init(voi +@@ -247,6 +254,18 @@ static int __init ofpart_parser_init(voi return 0; } diff --git a/target/linux/sunxi/cortexa53/config-5.4 b/target/linux/sunxi/cortexa53/config-5.4 index 203ab9fa38..1d8fd49d43 100644 --- a/target/linux/sunxi/cortexa53/config-5.4 +++ b/target/linux/sunxi/cortexa53/config-5.4 @@ -125,8 +125,10 @@ CONFIG_KVM_INDIRECT_VECTORS=y CONFIG_MDIO_BUS_MUX=y CONFIG_MICREL_PHY=y CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MUSB_PIO_ONLY=y CONFIG_NEED_SG_DMA_LENGTH=y CONFIG_NO_IOPORT_MAP=y +CONFIG_NOP_USB_XCEIV=y CONFIG_PINCTRL_SUN50I_A64=y CONFIG_PINCTRL_SUN50I_A64_R=y CONFIG_PINCTRL_SUN50I_H5=y @@ -150,5 +152,10 @@ CONFIG_SUN50I_H6_R_CCU=y CONFIG_SYSCTL_EXCEPTION_TRACE=y CONFIG_THREAD_INFO_IN_TASK=y CONFIG_UNMAP_KERNEL_AT_EL0=y +CONFIG_USB_MUSB_DUAL_ROLE=y +# CONFIG_USB_MUSB_GADGET is not set +CONFIG_USB_MUSB_HDRC=y +# CONFIG_USB_MUSB_HOST is not set +CONFIG_USB_MUSB_SUNXI=y CONFIG_VMAP_STACK=y CONFIG_ZONE_DMA32=y diff --git a/target/linux/sunxi/image/cortexa53.mk b/target/linux/sunxi/image/cortexa53.mk index 117d25ea90..fe561d0923 100644 --- a/target/linux/sunxi/image/cortexa53.mk +++ b/target/linux/sunxi/image/cortexa53.mk @@ -66,6 +66,7 @@ TARGET_DEVICES += olimex_a64-olinuxino-emmc define Device/pine64_pine64-plus DEVICE_VENDOR := Pine64 DEVICE_MODEL := Pine64+ + DEVICE_PACKAGES := kmod-rtl8723bs rtl8723bs-firmware $(Device/sun50i-a64) endef TARGET_DEVICES += pine64_pine64-plus @@ -73,6 +74,7 @@ TARGET_DEVICES += pine64_pine64-plus define Device/pine64_sopine-baseboard DEVICE_VENDOR := Pine64 DEVICE_MODEL := SoPine + DEVICE_PACKAGES := kmod-rtl8723bs rtl8723bs-firmware $(Device/sun50i-a64) endef TARGET_DEVICES += pine64_sopine-baseboard diff --git a/target/linux/sunxi/patches-5.4/450-arm64-dts-enable-wifi-on-pine64-boards.patch b/target/linux/sunxi/patches-5.4/450-arm64-dts-enable-wifi-on-pine64-boards.patch new file mode 100644 index 0000000000..8117338029 --- /dev/null +++ b/target/linux/sunxi/patches-5.4/450-arm64-dts-enable-wifi-on-pine64-boards.patch @@ -0,0 +1,72 @@ +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts +@@ -78,6 +78,11 @@ + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + }; ++ ++ wifi_pwrseq: wifi_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */ ++ }; + }; + + &ac_power_supply { +@@ -138,6 +143,21 @@ + reg = <1>; + }; + }; ++ ++&mmc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc1_pins>; ++ vmmc-supply = <®_dldo4>; ++ vqmmc-supply = <®_eldo1>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ bus-width = <4>; ++ non-removable; ++ status = "okay"; ++ ++ rtl8723cs: wifi@1 { ++ reg = <1>; ++ }; ++}; + + &mmc2 { + pinctrl-names = "default"; +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts +@@ -73,6 +73,11 @@ + }; + }; + }; ++ ++ wifi_pwrseq: wifi_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */ ++ }; + }; + + &codec { +@@ -146,6 +151,21 @@ + status = "okay"; + }; + ++&mmc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc1_pins>; ++ vmmc-supply = <®_dldo4>; ++ vqmmc-supply = <®_eldo1>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ bus-width = <4>; ++ non-removable; ++ status = "okay"; ++ ++ rtl8723cs: wifi@1 { ++ reg = <1>; ++ }; ++}; ++ + &ohci0 { + status = "okay"; + };