From 7bd583e5f31e5c42df47f0286b0dcbc6df30765e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Beh=C3=BAn?= Date: Thu, 15 Jul 2021 20:48:33 +0200 Subject: [PATCH 1/9] uboot-envtools: mvebu: update uci defaults for Turris Omnia MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From version 2021.09 U-Boot will fixup Turris Omnia's DTB before booting, separating U-Boot's environment into separate MTD partition "u-boot-env" [1]. Check if "u-boot-env" MTD partition exists and set the uci defaults accordingly. [1] https://lists.denx.de/pipermail/u-boot/2021-July/455017.html Signed-off-by: Marek Behún (cherry picked from commit 713be7543909b79fbbccdea297e306cb3d3adb0c) --- package/boot/uboot-envtools/files/mvebu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 92b144330f..c4587f8de4 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -18,7 +18,10 @@ buffalo,ls421de) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" ;; cznic,turris-omnia) - if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then + idx="$(find_mtd_index u-boot-env)" + if [ -n "$idx" ]; then + ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000" + elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000" else ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000" From 2d69d098e0c339ab594ccd54f74784d94e2c4a9a Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 6 Mar 2022 19:12:47 +0000 Subject: [PATCH 2/9] kernel: bump 5.4 to 5.4.182 The following patch was integrated upstream: target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch All other updated automatically. The new config option CONFIG_BPF_UNPRIV_DEFAULT_OFF is now handled too. Compile-tested on: lantiq/xrx200, armvirt/64 Runtime-tested on: lantiq/xrx200, armvirt/64 Signed-off-by: Hauke Mehrtens --- include/kernel-version.mk | 4 +-- .../910-unaligned_access_hacks.patch | 4 +-- ...hci_fixup_endpoint-for-interval-adju.patch | 4 +-- ...ce-quirks-for-Freeway-Airmouse-T3-an.patch | 2 +- ...tft-Add-support-for-display-variants.patch | 2 +- ...-fix-support-for-DSL-and-CM-variants.patch | 30 ------------------- ...r-bridge-s-private-skb-space-on-xmit.patch | 4 +-- target/linux/generic/config-5.4 | 1 + .../generic/hack-5.4/204-module_strip.patch | 2 +- ...w_table-add-hardware-offload-support.patch | 6 ++-- ...-support-hardware-flow-table-offload.patch | 4 +-- .../pending-5.4/834-ledtrig-libata.patch | 8 ++--- .../pending-5.4/920-mangle_bootargs.patch | 2 +- ...utine-to-help-fetch-wakeup-source-ob.patch | 2 +- ...hc-poll-ESDHC_FLUSH_ASYNC_FIFO-bit-u.patch | 6 ++-- ...-of-esdhc-convert-to-use-esdhc_tunin.patch | 6 ++-- ...-of-esdhc-update-tuning-erratum-A-00.patch | 6 ++-- ...5-usb-dwc3-add-otg-properties-update.patch | 2 +- ...host-xhci-add-EH-SINGLE_STEP_SET_FEA.patch | 2 +- ...-host-xhci-add-.bus_suspend-override.patch | 2 +- .../oxnas/patches-5.4/999-libata-hacks.patch | 4 +-- 21 files changed, 37 insertions(+), 66 deletions(-) delete mode 100644 target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 0f035ac3fe..d963be1f9d 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,9 +6,9 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-5.4 = .179 +LINUX_VERSION-5.4 = .182 -LINUX_KERNEL_HASH-5.4.179 = 2c9bdec0922a95aff34e8d53d2e0ecf7e842033cd908d2959a43d34afb5d897d +LINUX_KERNEL_HASH-5.4.182 = b2f1201f64f010e9e3c85d6f303a559a7944a80a0244a86b8f5035bd23f1f40d remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch b/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch index 26c4a7b213..3828ae0784 100644 --- a/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch +++ b/target/linux/ath79/patches-5.4/910-unaligned_access_hacks.patch @@ -292,7 +292,7 @@ #endif /* _LINUX_TYPES_H */ --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c -@@ -1441,8 +1441,8 @@ struct sk_buff *inet_gro_receive(struct +@@ -1444,8 +1444,8 @@ struct sk_buff *inet_gro_receive(struct if (unlikely(ip_fast_csum((u8 *)iph, 5))) goto out_unlock; @@ -534,7 +534,7 @@ goto next_ht; --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c -@@ -240,7 +240,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * +@@ -242,7 +242,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff * continue; iph2 = (struct ipv6hdr *)(p->data + off); diff --git a/target/linux/bcm27xx/patches-5.4/950-0219-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch b/target/linux/bcm27xx/patches-5.4/950-0219-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch index cb3c8aafee..d69d14d91c 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0219-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0219-xhci-implement-xhci_fixup_endpoint-for-interval-adju.patch @@ -15,7 +15,7 @@ Signed-off-by: Jonathan Bell --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -1468,6 +1468,103 @@ command_cleanup: +@@ -1475,6 +1475,103 @@ command_cleanup: } /* @@ -119,7 +119,7 @@ Signed-off-by: Jonathan Bell * non-error returns are a promise to giveback() the urb later * we drop ownership so next owner (or urb unlink) can get it */ -@@ -5366,6 +5463,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5376,6 +5473,7 @@ static const struct hc_driver xhci_hc_dr .endpoint_reset = xhci_endpoint_reset, .check_bandwidth = xhci_check_bandwidth, .reset_bandwidth = xhci_reset_bandwidth, diff --git a/target/linux/bcm27xx/patches-5.4/950-0280-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch b/target/linux/bcm27xx/patches-5.4/950-0280-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch index 0794f66981..fb3efaa6cb 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0280-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0280-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch @@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL }, -@@ -193,6 +194,7 @@ static const struct hid_device_id hid_qu +@@ -194,6 +195,7 @@ static const struct hid_device_id hid_qu { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT }, diff --git a/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch index 30178b0eb8..ba81518b4c 100644 --- a/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch +++ b/target/linux/bcm27xx/patches-5.4/950-0960-staging-fbtft-Add-support-for-display-variants.patch @@ -190,7 +190,7 @@ Signed-off-by: Phil Elwell {}, \ }; \ \ -@@ -344,6 +355,11 @@ static void __exit fbtft_driver_module_e +@@ -347,6 +358,11 @@ static void __exit fbtft_driver_module_e module_init(fbtft_driver_module_init); \ module_exit(fbtft_driver_module_exit); diff --git a/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch b/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch deleted file mode 100644 index 6f4ae30108..0000000000 --- a/target/linux/bcm4908/patches-5.4/180-i2c-brcmstb-fix-support-for-DSL-and-CM-variants.patch +++ /dev/null @@ -1,30 +0,0 @@ -From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= -Date: Tue, 15 Feb 2022 08:27:35 +0100 -Subject: [PATCH] i2c: brcmstb: fix support for DSL and CM variants -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -DSL and CM (Cable Modem) support 8 B max transfer size and have a custom -DT binding for that reason. This driver was checking for a wrong -"compatible" however which resulted in an incorrect setup. - -Fixes: e2e5a2c61837 ("i2c: brcmstb: Adding support for CM and DSL SoCs") -Cc: Kamal Dasu -Signed-off-by: Rafał Miłecki -Acked-by: Florian Fainelli ---- - drivers/i2c/busses/i2c-brcmstb.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/i2c/busses/i2c-brcmstb.c -+++ b/drivers/i2c/busses/i2c-brcmstb.c -@@ -640,7 +640,7 @@ static int brcmstb_i2c_probe(struct plat - - /* set the data in/out register size for compatible SoCs */ - if (of_device_is_compatible(dev->device->of_node, -- "brcmstb,brcmper-i2c")) -+ "brcm,brcmper-i2c")) - dev->data_regsz = sizeof(u8); - else - dev->data_regsz = sizeof(u32); diff --git a/target/linux/generic/backport-5.4/610-v5.9-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch b/target/linux/generic/backport-5.4/610-v5.9-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch index f1862943f8..5704d05aad 100644 --- a/target/linux/generic/backport-5.4/610-v5.9-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch +++ b/target/linux/generic/backport-5.4/610-v5.9-net-bridge-clear-bridge-s-private-skb-space-on-xmit.patch @@ -17,8 +17,8 @@ Signed-off-by: David S. Miller --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c -@@ -36,6 +36,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff * - struct ethhdr *eth; +@@ -35,6 +35,8 @@ netdev_tx_t br_dev_xmit(struct sk_buff * + const unsigned char *dest; u16 vid = 0; + memset(skb->cb, 0, sizeof(struct br_input_skb_cb)); diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 680f0d0feb..b0e17e4988 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -652,6 +652,7 @@ CONFIG_BPF=y # CONFIG_BPFILTER is not set CONFIG_BPF_JIT=y # CONFIG_BPF_JIT_ALWAYS_ON is not set +# CONFIG_BPF_UNPRIV_DEFAULT_OFF is not set # CONFIG_BPF_STREAM_PARSER is not set CONFIG_BPF_SYSCALL=y # CONFIG_BPQETHER is not set diff --git a/target/linux/generic/hack-5.4/204-module_strip.patch b/target/linux/generic/hack-5.4/204-module_strip.patch index c6420739c0..ef7beae17d 100644 --- a/target/linux/generic/hack-5.4/204-module_strip.patch +++ b/target/linux/generic/hack-5.4/204-module_strip.patch @@ -96,7 +96,7 @@ Signed-off-by: Felix Fietkau --- a/init/Kconfig +++ b/init/Kconfig -@@ -2198,6 +2198,13 @@ config TRIM_UNUSED_KSYMS +@@ -2208,6 +2208,13 @@ config TRIM_UNUSED_KSYMS If unsure, or if you need to build out-of-tree modules, say N. diff --git a/target/linux/generic/pending-5.4/640-netfilter-nf_flow_table-add-hardware-offload-support.patch b/target/linux/generic/pending-5.4/640-netfilter-nf_flow_table-add-hardware-offload-support.patch index f5d9dcde99..bd4808c3c2 100644 --- a/target/linux/generic/pending-5.4/640-netfilter-nf_flow_table-add-hardware-offload-support.patch +++ b/target/linux/generic/pending-5.4/640-netfilter-nf_flow_table-add-hardware-offload-support.patch @@ -506,7 +506,7 @@ Signed-off-by: Pablo Neira Ayuso +MODULE_ALIAS("nf-flow-table-hw"); --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c -@@ -5743,6 +5743,13 @@ static int nf_tables_flowtable_parse_hoo +@@ -5748,6 +5748,13 @@ static int nf_tables_flowtable_parse_hoo if (err < 0) return err; @@ -520,7 +520,7 @@ Signed-off-by: Pablo Neira Ayuso ops = kcalloc(n, sizeof(struct nf_hook_ops), GFP_KERNEL); if (!ops) return -ENOMEM; -@@ -5873,10 +5880,19 @@ static int nf_tables_newflowtable(struct +@@ -5878,10 +5885,19 @@ static int nf_tables_newflowtable(struct } flowtable->data.type = type; @@ -540,7 +540,7 @@ Signed-off-by: Pablo Neira Ayuso err = nf_tables_flowtable_parse_hook(&ctx, nla[NFTA_FLOWTABLE_HOOK], flowtable); if (err < 0) -@@ -6002,7 +6018,8 @@ static int nf_tables_fill_flowtable_info +@@ -6007,7 +6023,8 @@ static int nf_tables_fill_flowtable_info nla_put_string(skb, NFTA_FLOWTABLE_NAME, flowtable->name) || nla_put_be32(skb, NFTA_FLOWTABLE_USE, htonl(flowtable->use)) || nla_put_be64(skb, NFTA_FLOWTABLE_HANDLE, cpu_to_be64(flowtable->handle), diff --git a/target/linux/generic/pending-5.4/643-net-bridge-support-hardware-flow-table-offload.patch b/target/linux/generic/pending-5.4/643-net-bridge-support-hardware-flow-table-offload.patch index fcfac748cb..d47482dc67 100644 --- a/target/linux/generic/pending-5.4/643-net-bridge-support-hardware-flow-table-offload.patch +++ b/target/linux/generic/pending-5.4/643-net-bridge-support-hardware-flow-table-offload.patch @@ -20,7 +20,7 @@ Signed-off-by: Felix Fietkau #include #include "br_private.h" -@@ -384,6 +388,28 @@ static const struct ethtool_ops br_ethto +@@ -382,6 +386,28 @@ static const struct ethtool_ops br_ethto .get_link = ethtool_op_get_link, }; @@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau static const struct net_device_ops br_netdev_ops = { .ndo_open = br_dev_open, .ndo_stop = br_dev_stop, -@@ -412,6 +438,9 @@ static const struct net_device_ops br_ne +@@ -410,6 +436,9 @@ static const struct net_device_ops br_ne .ndo_bridge_setlink = br_setlink, .ndo_bridge_dellink = br_dellink, .ndo_features_check = passthru_features_check, diff --git a/target/linux/generic/pending-5.4/834-ledtrig-libata.patch b/target/linux/generic/pending-5.4/834-ledtrig-libata.patch index 2c876ae55e..2fbbb5461b 100644 --- a/target/linux/generic/pending-5.4/834-ledtrig-libata.patch +++ b/target/linux/generic/pending-5.4/834-ledtrig-libata.patch @@ -65,7 +65,7 @@ Signed-off-by: Daniel Golle /** * ata_build_rw_tf - Build ATA taskfile for given read/write request * @tf: Target ATA taskfile -@@ -5151,6 +5164,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5152,6 +5165,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (tag < 0) return NULL; } @@ -75,7 +75,7 @@ Signed-off-by: Daniel Golle qc = __ata_qc_from_tag(ap, tag); qc->tag = qc->hw_tag = tag; -@@ -6087,6 +6103,9 @@ struct ata_port *ata_port_alloc(struct a +@@ -6088,6 +6104,9 @@ struct ata_port *ata_port_alloc(struct a ap->stats.unhandled_irq = 1; ap->stats.idle_irq = 1; #endif @@ -85,7 +85,7 @@ Signed-off-by: Daniel Golle ata_sff_port_init(ap); return ap; -@@ -6122,6 +6141,12 @@ static void ata_host_release(struct kref +@@ -6123,6 +6142,12 @@ static void ata_host_release(struct kref kfree(ap->pmp_link); kfree(ap->slave_link); @@ -98,7 +98,7 @@ Signed-off-by: Daniel Golle kfree(ap); host->ports[i] = NULL; } -@@ -6585,7 +6610,23 @@ int ata_host_register(struct ata_host *h +@@ -6586,7 +6611,23 @@ int ata_host_register(struct ata_host *h host->ports[i]->print_id = atomic_inc_return(&ata_print_id); host->ports[i]->local_port_no = i + 1; } diff --git a/target/linux/generic/pending-5.4/920-mangle_bootargs.patch b/target/linux/generic/pending-5.4/920-mangle_bootargs.patch index 83db92609b..09782e935f 100644 --- a/target/linux/generic/pending-5.4/920-mangle_bootargs.patch +++ b/target/linux/generic/pending-5.4/920-mangle_bootargs.patch @@ -13,7 +13,7 @@ Signed-off-by: Imre Kaloz --- a/init/Kconfig +++ b/init/Kconfig -@@ -1665,6 +1665,15 @@ config EMBEDDED +@@ -1675,6 +1675,15 @@ config EMBEDDED an embedded system so certain expert options are available for configuration. diff --git a/target/linux/layerscape/patches-5.4/813-pm-0004-PM-wakeup-Add-routine-to-help-fetch-wakeup-source-ob.patch b/target/linux/layerscape/patches-5.4/813-pm-0004-PM-wakeup-Add-routine-to-help-fetch-wakeup-source-ob.patch index 091588b1d7..816cdde874 100644 --- a/target/linux/layerscape/patches-5.4/813-pm-0004-PM-wakeup-Add-routine-to-help-fetch-wakeup-source-ob.patch +++ b/target/linux/layerscape/patches-5.4/813-pm-0004-PM-wakeup-Add-routine-to-help-fetch-wakeup-source-ob.patch @@ -20,7 +20,7 @@ Acked-by: Anson Huang --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c -@@ -250,6 +250,60 @@ void wakeup_source_unregister(struct wak +@@ -251,6 +251,60 @@ void wakeup_source_unregister(struct wak EXPORT_SYMBOL_GPL(wakeup_source_unregister); /** diff --git a/target/linux/layerscape/patches-5.4/816-sdhc-0001-mmc-sdhci-of-esdhc-poll-ESDHC_FLUSH_ASYNC_FIFO-bit-u.patch b/target/linux/layerscape/patches-5.4/816-sdhc-0001-mmc-sdhci-of-esdhc-poll-ESDHC_FLUSH_ASYNC_FIFO-bit-u.patch index 085de51c14..ec1f8324d4 100644 --- a/target/linux/layerscape/patches-5.4/816-sdhc-0001-mmc-sdhci-of-esdhc-poll-ESDHC_FLUSH_ASYNC_FIFO-bit-u.patch +++ b/target/linux/layerscape/patches-5.4/816-sdhc-0001-mmc-sdhci-of-esdhc-poll-ESDHC_FLUSH_ASYNC_FIFO-bit-u.patch @@ -14,7 +14,7 @@ Signed-off-by: Yangbo Lu --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c -@@ -592,6 +592,32 @@ static void esdhc_clock_enable(struct sd +@@ -596,6 +596,32 @@ static void esdhc_clock_enable(struct sd } } @@ -47,7 +47,7 @@ Signed-off-by: Yangbo Lu static void esdhc_of_set_clock(struct sdhci_host *host, unsigned int clock) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); -@@ -684,9 +710,7 @@ static void esdhc_of_set_clock(struct sd +@@ -688,9 +714,7 @@ static void esdhc_of_set_clock(struct sd sdhci_writel(host, temp | ESDHC_HS400_WNDW_ADJUST, ESDHC_TBCTL); esdhc_clock_enable(host, false); @@ -58,7 +58,7 @@ Signed-off-by: Yangbo Lu } /* Wait max 20 ms */ -@@ -888,10 +912,7 @@ static void esdhc_tuning_block_enable(st +@@ -892,10 +916,7 @@ static void esdhc_tuning_block_enable(st u32 val; esdhc_clock_enable(host, false); diff --git a/target/linux/layerscape/patches-5.4/816-sdhc-0002-LF-605-mmc-sdhci-of-esdhc-convert-to-use-esdhc_tunin.patch b/target/linux/layerscape/patches-5.4/816-sdhc-0002-LF-605-mmc-sdhci-of-esdhc-convert-to-use-esdhc_tunin.patch index df19568863..71db685b7f 100644 --- a/target/linux/layerscape/patches-5.4/816-sdhc-0002-LF-605-mmc-sdhci-of-esdhc-convert-to-use-esdhc_tunin.patch +++ b/target/linux/layerscape/patches-5.4/816-sdhc-0002-LF-605-mmc-sdhci-of-esdhc-convert-to-use-esdhc_tunin.patch @@ -15,7 +15,7 @@ Acked-by: Adrian Hunter --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c -@@ -924,20 +924,11 @@ static void esdhc_tuning_block_enable(st +@@ -928,20 +928,11 @@ static void esdhc_tuning_block_enable(st esdhc_clock_enable(host, true); } @@ -37,7 +37,7 @@ Acked-by: Adrian Hunter /* Write TBCTL[11:8]=4'h8 */ val = sdhci_readl(host, ESDHC_TBCTL); val &= ~(0xf << 8); -@@ -956,6 +947,25 @@ static void esdhc_prepare_sw_tuning(stru +@@ -960,6 +951,25 @@ static void esdhc_prepare_sw_tuning(stru val = sdhci_readl(host, ESDHC_TBSTAT); val = sdhci_readl(host, ESDHC_TBSTAT); @@ -63,7 +63,7 @@ Acked-by: Adrian Hunter /* Reset data lines by setting ESDHCCTL[RSTD] */ sdhci_reset(host, SDHCI_RESET_DATA); /* Write 32'hFFFF_FFFF to IRQSTAT register */ -@@ -966,10 +976,8 @@ static void esdhc_prepare_sw_tuning(stru +@@ -970,10 +980,8 @@ static void esdhc_prepare_sw_tuning(stru * then program TBPTR[TB_WNDW_END_PTR] = 4 * div_ratio * and program TBPTR[TB_WNDW_START_PTR] = 8 * div_ratio. */ diff --git a/target/linux/layerscape/patches-5.4/816-sdhc-0003-LF-605-mmc-sdhci-of-esdhc-update-tuning-erratum-A-00.patch b/target/linux/layerscape/patches-5.4/816-sdhc-0003-LF-605-mmc-sdhci-of-esdhc-update-tuning-erratum-A-00.patch index 4a16dbd505..f9dc0c0ca8 100644 --- a/target/linux/layerscape/patches-5.4/816-sdhc-0003-LF-605-mmc-sdhci-of-esdhc-update-tuning-erratum-A-00.patch +++ b/target/linux/layerscape/patches-5.4/816-sdhc-0003-LF-605-mmc-sdhci-of-esdhc-update-tuning-erratum-A-00.patch @@ -20,7 +20,7 @@ Acked-by: Adrian Hunter --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c -@@ -890,20 +890,20 @@ static int esdhc_signal_voltage_switch(s +@@ -894,20 +894,20 @@ static int esdhc_signal_voltage_switch(s } static struct soc_device_attribute soc_tuning_erratum_type1[] = { @@ -51,7 +51,7 @@ Acked-by: Adrian Hunter { }, }; -@@ -971,13 +971,13 @@ static void esdhc_prepare_sw_tuning(stru +@@ -975,13 +975,13 @@ static void esdhc_prepare_sw_tuning(stru /* Write 32'hFFFF_FFFF to IRQSTAT register */ sdhci_writel(host, 0xFFFFFFFF, SDHCI_INT_STATUS); @@ -68,7 +68,7 @@ Acked-by: Adrian Hunter *window_start = 8 * esdhc->div_ratio; *window_end = 4 * esdhc->div_ratio; } else { -@@ -1061,6 +1061,19 @@ static int esdhc_execute_tuning(struct m +@@ -1065,6 +1065,19 @@ static int esdhc_execute_tuning(struct m if (ret) break; diff --git a/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch b/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch index fc4c853cb9..37fee125d7 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0005-usb-dwc3-add-otg-properties-update.patch @@ -54,7 +54,7 @@ Signed-off-by: Peter Chen * All 3.1 IP version constants are greater than the 3.0 IP --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c -@@ -3655,6 +3655,10 @@ int dwc3_gadget_init(struct dwc3 *dwc) +@@ -3670,6 +3670,10 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc->gadget.sg_supported = true; dwc->gadget.name = "dwc3-gadget"; dwc->gadget.lpm_capable = true; diff --git a/target/linux/layerscape/patches-5.4/820-usb-0015-MLK-17380-4-usb-host-xhci-add-EH-SINGLE_STEP_SET_FEA.patch b/target/linux/layerscape/patches-5.4/820-usb-0015-MLK-17380-4-usb-host-xhci-add-EH-SINGLE_STEP_SET_FEA.patch index 4f4381c9a5..6b90c65677 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0015-MLK-17380-4-usb-host-xhci-add-EH-SINGLE_STEP_SET_FEA.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0015-MLK-17380-4-usb-host-xhci-add-EH-SINGLE_STEP_SET_FEA.patch @@ -174,7 +174,7 @@ Signed-off-by: Peter Chen * bursts that are required to move all packets in this TD. Only SuperSpeed --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -5393,6 +5393,7 @@ static const struct hc_driver xhci_hc_dr +@@ -5403,6 +5403,7 @@ static const struct hc_driver xhci_hc_dr .disable_usb3_lpm_timeout = xhci_disable_usb3_lpm_timeout, .find_raw_port_number = xhci_find_raw_port_number, .clear_tt_buffer_complete = xhci_clear_tt_buffer_complete, diff --git a/target/linux/layerscape/patches-5.4/820-usb-0018-MLK-18794-1-usb-host-xhci-add-.bus_suspend-override.patch b/target/linux/layerscape/patches-5.4/820-usb-0018-MLK-18794-1-usb-host-xhci-add-.bus_suspend-override.patch index 5947563516..bcf1bc0a9d 100644 --- a/target/linux/layerscape/patches-5.4/820-usb-0018-MLK-18794-1-usb-host-xhci-add-.bus_suspend-override.patch +++ b/target/linux/layerscape/patches-5.4/820-usb-0018-MLK-18794-1-usb-host-xhci-add-.bus_suspend-override.patch @@ -24,7 +24,7 @@ Signed-off-by: Peter Chen --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c -@@ -5414,6 +5414,8 @@ void xhci_init_driver(struct hc_driver * +@@ -5424,6 +5424,8 @@ void xhci_init_driver(struct hc_driver * drv->check_bandwidth = over->check_bandwidth; if (over->reset_bandwidth) drv->reset_bandwidth = over->reset_bandwidth; diff --git a/target/linux/oxnas/patches-5.4/999-libata-hacks.patch b/target/linux/oxnas/patches-5.4/999-libata-hacks.patch index cac7f48f43..d322514a7d 100644 --- a/target/linux/oxnas/patches-5.4/999-libata-hacks.patch +++ b/target/linux/oxnas/patches-5.4/999-libata-hacks.patch @@ -15,7 +15,7 @@ /* initialize internal qc */ qc = __ata_qc_from_tag(ap, ATA_TAG_INTERNAL); -@@ -5158,6 +5166,9 @@ struct ata_queued_cmd *ata_qc_new_init(s +@@ -5159,6 +5167,9 @@ struct ata_queued_cmd *ata_qc_new_init(s if (unlikely(ap->pflags & ATA_PFLAG_FROZEN)) return NULL; @@ -25,7 +25,7 @@ /* libsas case */ if (ap->flags & ATA_FLAG_SAS_HOST) { tag = ata_sas_allocate_tag(ap); -@@ -5203,6 +5214,8 @@ void ata_qc_free(struct ata_queued_cmd * +@@ -5204,6 +5215,8 @@ void ata_qc_free(struct ata_queued_cmd * qc->tag = ATA_TAG_POISON; if (ap->flags & ATA_FLAG_SAS_HOST) ata_sas_free_tag(tag, ap); From 49b2e6365d054aa49c88478ab2000eb2dd439cd8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 19 Jun 2021 14:45:11 -0700 Subject: [PATCH 3/9] tools/libressl: update to 3.3.3 Fix wrong FPIC variable usage. Fixes compilation under sparc64 host. Signed-off-by: Rosen Penev (cherry picked from commit bf4dbbb55e2b8e23f186e1334f1e9ce6a3a8ddfe) --- tools/libressl/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index 2b5a33450c..e25b5661ee 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=3.3.1 -PKG_HASH:=a6d331865e0164a13ac85a228e52517f7cf8f8488f2f95f34e7857302f97cfdb +PKG_VERSION:=3.3.3 +PKG_HASH:=a471565b36ccd1a70d0bd7d37c6e95c43a26a62829b487d9d2cdebfe58be3066 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:openbsd:libressl @@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/host-build.mk HOSTCC := $(HOSTCC_NOCACHE) HOST_CONFIGURE_ARGS += --enable-static --disable-shared --disable-tests -HOST_CFLAGS += $(FPIC) +HOST_CFLAGS += $(HOST_FPIC) ifeq ($(GNU_HOST_NAME),x86_64-linux-gnux32) HOST_CONFIGURE_ARGS += --disable-asm From 2736a5df94134fcad19dbd429fa21761536937b7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 1 Sep 2021 19:29:40 -0700 Subject: [PATCH 4/9] tools/libressl: update to 3.3.4 Signed-off-by: Rosen Penev (cherry picked from commit f78ad901e1ce07c42a9f5e670c39dbdcea15eb87) --- tools/libressl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index e25b5661ee..29fae1dfb6 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=3.3.3 -PKG_HASH:=a471565b36ccd1a70d0bd7d37c6e95c43a26a62829b487d9d2cdebfe58be3066 +PKG_VERSION:=3.3.4 +PKG_HASH:=bcce767a3fed252bfd1210f8a7e3505a2b54d3008f66e43d9b95e3f30c072931 PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:openbsd:libressl From 8ed3b5b04b4983d75f4192bab470c6fb7eb9c50f Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 22 Sep 2021 00:49:33 -0700 Subject: [PATCH 5/9] tools/libressl: update to 3.4.1 Signed-off-by: Rosen Penev (cherry picked from commit 03bb3412a2b8bf8ac69e062ea9fd88e2c6c6fb57) --- tools/libressl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index 29fae1dfb6..be053ac788 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=3.3.4 -PKG_HASH:=bcce767a3fed252bfd1210f8a7e3505a2b54d3008f66e43d9b95e3f30c072931 +PKG_VERSION:=3.4.1 +PKG_HASH:=107ceae6ca800e81cb563584c16afa36d6c7138fade94a2b3e9da65456f7c61c PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:openbsd:libressl From 03271046869ec2e681e0732e3ed6460ab1537243 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Wed, 23 Feb 2022 21:32:41 +0100 Subject: [PATCH 6/9] tools/libressl: update to version 3.4.2 Release notes: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.2-relnotes.txt ``` It includes the following security fix * In some situations the X.509 verifier would discard an error on an unverified certificate chain, resulting in an authentication bypass. Thanks to Ilya Shipitsin and Timo Steinlein for reporting. ``` Signed-off-by: Josef Schlehofer (cherry picked from commit 495c4f4e197166a6fa997d4620ca6c241e3abd45) --- tools/libressl/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/libressl/Makefile b/tools/libressl/Makefile index be053ac788..da7cd6201b 100644 --- a/tools/libressl/Makefile +++ b/tools/libressl/Makefile @@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libressl -PKG_VERSION:=3.4.1 -PKG_HASH:=107ceae6ca800e81cb563584c16afa36d6c7138fade94a2b3e9da65456f7c61c +PKG_VERSION:=3.4.2 +PKG_HASH:=cb82ca7d547336917352fbd23db2fc483c6c44d35157b32780214ec74197b3ce PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:openbsd:libressl From f1e1daa6e8c71c2185aa37e737f968e9ad838c50 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 21 Feb 2022 18:55:15 +0100 Subject: [PATCH 7/9] u-boot.mk: add LOCALVERSION (explicitly specify OpenWrt build) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For debugging purposes, we need to know if users are using modified U-boot versions or not. Currently, the U-boot version is somehow stripped. This is a little bit problematic when there are backported/wip/to-upstream patches. To make it more confusing, there was (before this commit) two U-boot versioning. U-boot compiled by OpenWrt build bots are missing ``Build:`` This is also the case when the U-boot is compiled locally. Example: ``` U-Boot SPL 2022.01 (Jan 27 2022 - 00:24:34 +0000) U-Boot 2022.01 (Jan 27 2022 - 00:24:34 +0000) ``` On the other hand, if you run full build, you can at least see, where it was compiled. Notice added ``Build:``. Example: ``` U-Boot 2022.01 (Jan 27 2022 - 00:24:34 +0000), Build: jenkins-turris-os-packages-burstlab-omnia-216 ``` In both cases, it is not clear to U-boot developers if it is an unmodified build. This is also caused that there is a missing ``.git`` file from U-boot folder, and so there is no history. It leads to that it can not contain suffix ``-dirty`` (uncommitted modifications) or even something else like number of commits, etc. [1] When U-boot is compiled as it should be, the version should look like this: ``U-Boot 2022.04-rc1-01173-g278195ea1f (Feb 11 2022 - 14:46:50 +0100)`` The date is not changed daily when there are new OpenWrt builds. This commit adds OpenWrt specific version, which could be verified by using strings. ``` $ strings bin/targets/mvebu/cortexa9/u-boot-omnia/u-boot-spl.kwb | grep -E "OpenWrt*" U-Boot SPL 2022.01-OpenWrt-r18942+54-cbfce92367 (Feb 21 2022 - 13:17:34 +0000) arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r18942+54-cbfce92367) 11.2.0 2022.01-OpenWrt-r18942+54-cbfce92367 U-Boot 2022.01-OpenWrt-r18942+54-cbfce92367 (Feb 21 2022 - 13:17:34 +0000) ``` [1] https://u-boot.readthedocs.io/en/latest/develop/version.html Reported-by: Pali Rohár Suggested-by: Karel Kočí [rebased for OpenWrt 21.02] Signed-off-by: Josef Schlehofer (cherry picked from commit d6aa9d9e071d9f23ed26f5142991bc66aefe20f5) --- include/u-boot.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/include/u-boot.mk b/include/u-boot.mk index ec9fb15b6c..a3dc540ebe 100644 --- a/include/u-boot.mk +++ b/include/u-boot.mk @@ -44,6 +44,7 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET)) UBOOT_MAKE_FLAGS = \ HOSTCC="$(HOSTCC)" \ HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \ + LOCALVERSION="-OpenWrt-$(REVISION)" \ HOSTLDFLAGS="$(HOST_LDFLAGS)" define Build/U-Boot/Target From e12ffac02d40affd3706943a5789741a5e42d643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 25 Feb 2022 10:47:08 +0100 Subject: [PATCH 8/9] bcm4908: fix USB PHY support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes problem with USB PHY not handling some USB 3.0 devices. Signed-off-by: Rafał Miłecki (cherry picked from commit 0dbcefdd5229daacf6cd4c9996b8e6f31c90ffd1) --- ...y-phy-brcm-usb-fixup-BCM4908-support.patch | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch diff --git a/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch b/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch new file mode 100644 index 0000000000..a9568bcbba --- /dev/null +++ b/target/linux/bcm4908/patches-5.4/088-v5.18-phy-phy-brcm-usb-fixup-BCM4908-support.patch @@ -0,0 +1,147 @@ +From 32942d33d63d27714ed16a4176e5a99547adb6e0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Fri, 18 Feb 2022 18:24:59 +0100 +Subject: [PATCH] phy: phy-brcm-usb: fixup BCM4908 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Just like every other family BCM4908 should get its own enum value. That +is required to properly handle it in chipset conditional code. + +The real change is excluding BCM4908 from the PLL reprogramming code +(see brcmusb_usb3_pll_54mhz()). I'm not sure what's the BCM4908 +reference clock frequency but: +1. BCM4908 custom driver from Broadcom's SDK doesn't reprogram PLL +2. Doing that in Linux driver stopped PHY handling some USB 3.0 devices + +This change makes USB 3.0 PHY recognize e.g.: +1. 04e8:6860 - Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode) +2. 1058:259f - Western Digital My Passport 259F + +Broadcom's STB SoCs come with a set of SUN_TOP_CTRL_* registers that +allow reading chip family and product ids. Such a block & register is +missing on BCM4908 so this commit introduces "compatible" string +specific binding. + +Fixes: 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908") +Signed-off-by: Rafał Miłecki +Reviewed-by: Florian Fainelli +Link: https://lore.kernel.org/r/20220218172459.10431-1-zajec5@gmail.com +Signed-off-by: Vinod Koul +--- + drivers/phy/broadcom/phy-brcm-usb-init.c | 36 ++++++++++++++++++++++++ + drivers/phy/broadcom/phy-brcm-usb-init.h | 1 + + drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++- + 3 files changed, 47 insertions(+), 1 deletion(-) + +--- a/drivers/phy/broadcom/phy-brcm-usb-init.c ++++ b/drivers/phy/broadcom/phy-brcm-usb-init.c +@@ -79,6 +79,7 @@ + + enum brcm_family_type { + BRCM_FAMILY_3390A0, ++ BRCM_FAMILY_4908, + BRCM_FAMILY_7250B0, + BRCM_FAMILY_7271A0, + BRCM_FAMILY_7364A0, +@@ -96,6 +97,7 @@ enum brcm_family_type { + + static const char *family_names[BRCM_FAMILY_COUNT] = { + USB_BRCM_FAMILY(3390A0), ++ USB_BRCM_FAMILY(4908), + USB_BRCM_FAMILY(7250B0), + USB_BRCM_FAMILY(7271A0), + USB_BRCM_FAMILY(7364A0), +@@ -203,6 +205,27 @@ usb_reg_bits_map_table[BRCM_FAMILY_COUNT + USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK, + ENDIAN_SETTINGS, /* USB_CTRL_SETUP ENDIAN bits */ + }, ++ /* 4908 */ ++ [BRCM_FAMILY_4908] = { ++ 0, /* USB_CTRL_SETUP_SCB1_EN_MASK */ ++ 0, /* USB_CTRL_SETUP_SCB2_EN_MASK */ ++ 0, /* USB_CTRL_SETUP_SS_EHCI64BIT_EN_MASK */ ++ 0, /* USB_CTRL_SETUP_STRAP_IPP_SEL_MASK */ ++ 0, /* USB_CTRL_SETUP_OC3_DISABLE_MASK */ ++ 0, /* USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK */ ++ 0, /* USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK */ ++ USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK, ++ USB_CTRL_USB_PM_USB_PWRDN_MASK, ++ 0, /* USB_CTRL_USB30_CTL1_XHC_SOFT_RESETB_MASK */ ++ 0, /* USB_CTRL_USB30_CTL1_USB3_IOC_MASK */ ++ 0, /* USB_CTRL_USB30_CTL1_USB3_IPP_MASK */ ++ 0, /* USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK */ ++ 0, /* USB_CTRL_USB_PM_SOFT_RESET_MASK */ ++ 0, /* USB_CTRL_SETUP_CC_DRD_MODE_ENABLE_MASK */ ++ 0, /* USB_CTRL_SETUP_STRAP_CC_DRD_MODE_ENABLE_SEL_MASK */ ++ 0, /* USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK */ ++ 0, /* USB_CTRL_SETUP ENDIAN bits */ ++ }, + /* 7250b0 */ + [BRCM_FAMILY_7250B0] = { + USB_CTRL_SETUP_SCB1_EN_MASK, +@@ -559,6 +582,7 @@ static void brcmusb_usb3_pll_54mhz(struc + */ + switch (params->selected_family) { + case BRCM_FAMILY_3390A0: ++ case BRCM_FAMILY_4908: + case BRCM_FAMILY_7250B0: + case BRCM_FAMILY_7366C0: + case BRCM_FAMILY_74371A0: +@@ -1004,6 +1028,18 @@ static const struct brcm_usb_init_ops bc + .set_dual_select = usb_set_dual_select, + }; + ++void brcm_usb_dvr_init_4908(struct brcm_usb_init_params *params) ++{ ++ int fam; ++ ++ fam = BRCM_FAMILY_4908; ++ params->selected_family = fam; ++ params->usb_reg_bits_map = ++ &usb_reg_bits_map_table[fam][0]; ++ params->family_name = family_names[fam]; ++ params->ops = &bcm7445_ops; ++} ++ + void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params) + { + int fam; +--- a/drivers/phy/broadcom/phy-brcm-usb-init.h ++++ b/drivers/phy/broadcom/phy-brcm-usb-init.h +@@ -64,6 +64,7 @@ struct brcm_usb_init_params { + bool suspend_with_clocks; + }; + ++void brcm_usb_dvr_init_4908(struct brcm_usb_init_params *params); + void brcm_usb_dvr_init_7445(struct brcm_usb_init_params *params); + void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params); + void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params); +--- a/drivers/phy/broadcom/phy-brcm-usb.c ++++ b/drivers/phy/broadcom/phy-brcm-usb.c +@@ -253,6 +253,15 @@ static const struct attribute_group brcm + .attrs = brcm_usb_phy_attrs, + }; + ++static const struct match_chip_info chip_info_4908 = { ++ .init_func = &brcm_usb_dvr_init_4908, ++ .required_regs = { ++ BRCM_REGS_CTRL, ++ BRCM_REGS_XHCI_EC, ++ -1, ++ }, ++}; ++ + static const struct match_chip_info chip_info_7216 = { + .init_func = &brcm_usb_dvr_init_7216, + .required_regs = { +@@ -288,7 +297,7 @@ static const struct match_chip_info chip + static const struct of_device_id brcm_usb_dt_ids[] = { + { + .compatible = "brcm,bcm4908-usb-phy", +- .data = &chip_info_7445, ++ .data = &chip_info_4908, + }, + { + .compatible = "brcm,bcm7216-usb-phy", From 13c9f1f37df6d34ee5f1ba1d8f7542a1b24736fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Fri, 4 Mar 2022 16:03:26 +0100 Subject: [PATCH 9/9] bcm4908: support "rootfs_data" on U-Boot devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Create "rootfs_data" dynamicaly U-Boot firmware images can contain only 2 UBI volumes: bootfs (container with U-Boot + kernel + DTBs) and rootfs (e.g. squashfs). There is no way to include "rootfs_data" UBI volume or make firmware file tell U-Boot to create one. For that reason "rootfs_data" needs to be created dynamically. Use preinit script to handle that. Fire it right before "mount_root" one. 2. Relate "rootfs_data" to flashed firmware As already explained flashing new firmware with U-Boot will do nothing to the "rootfs_data". It could result in new firmware reusing old "rootfs_data" overlay UBI volume and its file. Users expect a clean state after flashing firmware (even if flashing the same one). Solve that by reading flash counter of running firmware and storing it in "rootfs_data" UBI volume. Every mismatch will result in wiping old data. Signed-off-by: Rafał Miłecki (cherry picked from commit 93259e8ca261c7965618fe11c2d385638da5cfa6) --- .../base-files/lib/functions/bcm4908.sh | 73 +++++++++++++++++++ .../base-files/lib/preinit/75_rootfs_prepare | 35 +++++++++ .../base-files/lib/upgrade/platform.sh | 27 +++---- 3 files changed, 122 insertions(+), 13 deletions(-) create mode 100644 target/linux/bcm4908/base-files/lib/functions/bcm4908.sh create mode 100644 target/linux/bcm4908/base-files/lib/preinit/75_rootfs_prepare diff --git a/target/linux/bcm4908/base-files/lib/functions/bcm4908.sh b/target/linux/bcm4908/base-files/lib/functions/bcm4908.sh new file mode 100644 index 0000000000..aea31e794b --- /dev/null +++ b/target/linux/bcm4908/base-files/lib/functions/bcm4908.sh @@ -0,0 +1,73 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause + +FS_STATE_READY=2 + +# $(1): file to read from +# $(2): offset in bytes +get_hex_u32_le() { + dd if="$1" skip=$2 bs=1 count=4 2>/dev/null | hexdump -v -e '1/4 "%02x"' +} + +# Setup /tmp/env.config to provide "metadata" UBI volume access +# +# It can be used with "fw_printenv -c /tmp/env.config" +bcm4908_pkgtb_setup_env_config() { + local size=$((0x$(get_hex_u32_le /dev/ubi0_1 4))) + + dd if=/dev/ubi0_1 of=/tmp/env.head count=8 iflag=count_bytes + dd if=/dev/ubi0_1 of=/tmp/env.body skip=8 iflag=skip_bytes + printf "%s\t0x%x\t0x%x\t0x%x" "/tmp/env.body" 0x0 $size $size > /tmp/env.config +} + +bcm4908_committed_image_seq() { + bcm4908_pkgtb_setup_env_config + + commited="$(fw_printenv -n -c /tmp/env.config COMMITTED)" + [ -n "$commited" ] && { + seq=$(fw_printenv -n -c /tmp/env.config SEQ | cut -d ',' -f $commited) + [ -n "$seq" ] && { + echo $seq + return + } + } + + echo "Failed to read COMMITED and SEQ from metadata1" >&2 +} + +# Make sure "rootfs_data" UBI volume matches currently flashed image +# +# On mismatch "rootfs_data" will be wiped and assigned +# +# $1: UBI volume of "rootfs_data" (e.g. ubi0_123) +bcm4908_verify_rootfs_data() { + local ubivol="$1" + local dir=/tmp/rootfs_data + local seq="$(bcm4908_committed_image_seq)" + + [ -z "$seq" ] && return + + mkdir $dir + if ! mount -t ubifs /dev/$ubivol $dir; then + echo "Failed to mount $ubivol UBI volume" >&2 + rmdir $dir + return + fi + + # Wipe rootfs_data if it doesn't belong to us + [ "$(readlink $dir/.openwrt-image-seq)" != "$seq" ] && { + echo "Removing \"rootfs_data\" content" + rm -rf $dir/..?* $dir/.[!.]* $dir/* + } + + # If rootfs_data is clean (or was just wiped) claim it + [ -z "$(ls -A $dir)" ] && { + echo "Assigning \"rootfs_data\" to the current firmware" + # Claim this "rootfs_data" + ln -s $seq $dir/.openwrt-image-seq + # Mark it ready to avoid "mount_root" wiping it again + ln -s $FS_STATE_READY $dir/.fs_state + } + + umount $dir + rmdir $dir +} diff --git a/target/linux/bcm4908/base-files/lib/preinit/75_rootfs_prepare b/target/linux/bcm4908/base-files/lib/preinit/75_rootfs_prepare new file mode 100644 index 0000000000..09c12cd31d --- /dev/null +++ b/target/linux/bcm4908/base-files/lib/preinit/75_rootfs_prepare @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause + +. /lib/functions/bcm4908.sh + +rootfs_create() { + local blocks + + blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks) + [ -z "$blocks" ] && { + echo "Failed to read amount of available erase blocks" >&2 + return + } + + # Use 80% of remaining flash size for "rootfs_data" + ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 80)) + mknod -m 0600 /dev/ubi0_20 c 252 21 + + bcm4908_verify_rootfs_data ubi0_20 +} + +rootfs_prepare() { + # Do nothing on CFE devices + ubinfo /dev/ubi0 -N metadata1 > /dev/null 2>&1 || return + + # Find UBI volume device (e.g. ubi0_123) + local ubivol="$(grep rootfs_data /sys/devices/virtual/ubi/ubi*/ubi*/name | sed -n 's/.*\(ubi\d*_\d*\).*/\1/p')" + if [ -n "$ubivol" ]; then + bcm4908_verify_rootfs_data $ubivol + else + echo "Creating \"rootfs_data\" UBI volume" + rootfs_create + fi +} + +boot_hook_add preinit_main rootfs_prepare diff --git a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh index e7d4bfe4de..bee90e8366 100644 --- a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh @@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause -RAMFS_COPY_BIN="bcm4908img expr egrep fdtget fw_printenv fw_setenv tr" +. /lib/functions/bcm4908.sh + +RAMFS_COPY_BIN="bcm4908img expr egrep ln fdtget fw_printenv fw_setenv readlink tr" PART_NAME=firmware @@ -134,17 +136,7 @@ platform_pkgtb_get_image() { } } -platform_pkgtb_setup_env_config() { - local size=$((0x$(get_hex_u32_le /dev/ubi0_1 4))) - - dd if=/dev/ubi0_1 of=/tmp/env.head count=8 iflag=count_bytes - dd if=/dev/ubi0_1 of=/tmp/env.body skip=8 iflag=skip_bytes - printf "%s\t0x%x\t0x%x\t0x%x" "/tmp/env.body" 0x0 $size $size > /tmp/env.config -} - platform_pkgtb_get_upgrade_index() { - platform_pkgtb_setup_env_config - case "$(fw_printenv -l /tmp -n -c /tmp/env.config COMMITTED)" in 1) echo 2;; 2) echo 1;; @@ -160,8 +152,6 @@ platform_pkgtb_commit() { local seq2 local tmp - platform_pkgtb_setup_env_config - # Read current values for valid in $(fw_printenv -l /tmp -n -c /tmp/env.config VALID | tr ',' ' '); do case "$valid" in @@ -272,11 +262,20 @@ platform_check_image() { # upgrade # +platform_pkgtb_clean_rootfs_data() { + local ubidev=$(nand_find_ubi $CI_UBIPART) + local ubivol="$(nand_find_volume $ubidev rootfs_data)" + + bcm4908_verify_rootfs_data "$ubivol" +} + platform_do_upgrade_pkgtb() { local cmd="${2:-cat}" local size local idx bootfs_id rootfs_id + bcm4908_pkgtb_setup_env_config + idx=$(platform_pkgtb_get_upgrade_index) case "$idx" in 1) bootfs_id=3; rootfs_id=4;; @@ -295,6 +294,8 @@ platform_do_upgrade_pkgtb() { platform_pkgtb_commit $idx + CI_UBIPART="image" + platform_pkgtb_clean_rootfs_data nand_do_upgrade_success }