Merge Official Source

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2021-03-11 23:07:12 +08:00
commit b9b8644e9a
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
13 changed files with 204 additions and 151 deletions

View File

@ -184,6 +184,7 @@ $$(call addfield,Depends,$$(Package/$(1)/DEPENDS)
)$$(call addfield,Section,$(SECTION)
)$$(call addfield,Require-User,$(USERID)
)$$(call addfield,SourceDateEpoch,$(PKG_SOURCE_DATE_EPOCH)
)$$(if $$(ABIV_$(1)),ABIVersion: $$(ABIV_$(1))
)$(if $(PKG_CPE_ID),CPE-ID: $(PKG_CPE_ID)
)$(if $(filter hold,$(PKG_FLAGS)),Status: unknown hold not-installed
)$(if $(filter essential,$(PKG_FLAGS)),Essential: yes

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifd
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
@ -25,6 +25,10 @@ define Package/netifd
TITLE:=OpenWrt Network Interface Configuration Daemon
endef
define Package/netifd/conffiles
/etc/udhcpc.user
endef
TARGET_CFLAGS += \
-I$(STAGING_DIR)/usr/include/libnl-tiny \
-I$(STAGING_DIR)/usr/include \

View File

@ -0,0 +1 @@
# This script is sourced by udhcpc's dhcp.script at every DHCP event.

View File

@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=odhcp6c
PKG_RELEASE:=16
PKG_RELEASE:=17
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/odhcp6c.git
@ -42,12 +42,18 @@ define Package/odhcp6c/config
default 0
endef
define Package/odhcp6c/conffiles
/etc/odhcp6c.user
endef
define Package/odhcp6c/install
$(INSTALL_DIR) $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/odhcp6c $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/lib/netifd/proto
$(INSTALL_BIN) ./files/dhcpv6.sh $(1)/lib/netifd/proto/dhcpv6.sh
$(INSTALL_BIN) ./files/dhcpv6.script $(1)/lib/netifd/
$(INSTALL_DIR) $(1)/etc/
$(INSTALL_CONF) ./files/odhcp6c.user $(1)/etc/
endef
$(eval $(call BuildPackage,odhcp6c))

View File

@ -0,0 +1 @@
# This script is sourced by odhcp6c's dhcpv6.script at every DHCPv6 event.

View File

@ -14,9 +14,9 @@ PKG_FLAGS:=essential
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.openwrt.org/project/opkg-lede.git
PKG_SOURCE_DATE:=2020-12-24
PKG_SOURCE_VERSION:=9bbc7eae91edc3dbb020e2a50d51d9a3fbbf31ca
PKG_MIRROR_HASH:=baa32d1b381d0eb2e224f4742974581c6705c13814662442ebd1288a91c2d577
PKG_SOURCE_DATE:=2021-03-11
PKG_SOURCE_VERSION:=d71856a4f137dc9fb890c5e777790e2c51fde921
PKG_MIRROR_HASH:=4da8ef070474dbc3854435838fbec585d1bdf74f7c99a2fb27203798b7f93c19
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@ -12,10 +12,10 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
PKG_SOURCE_DATE:=2021-01-06
PKG_SOURCE_VERSION:=ea7f4717f8b210a8fa491d288ff99ef74409dbff
PKG_SOURCE_DATE:=2021-03-11
PKG_SOURCE_VERSION:=ccb75178cf6a726896729c6904bd623636aa0b29
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_MIRROR_HASH:=905deb3db4b222188d1c126f05428126d389b88d61d2dc1e22e81a617724c7a8
PKG_MIRROR_HASH:=87b1839275c209f9767057d6da5272cae973a064767fa28f380a37fb65e2e643
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=

View File

@ -271,6 +271,7 @@ CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NET_FLOW_LIMIT=y
CONFIG_NR_CPUS=2
CONFIG_NVMEM=y
CONFIG_NVMEM_BRCM_NVRAM=y
CONFIG_NVMEM_SYSFS=y
CONFIG_OF=y
CONFIG_OF_ADDRESS=y

View File

@ -0,0 +1,56 @@
From c39edb9f9dcb6c8a0ba0ebf5df9e0ac93ab94b82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 5 Mar 2021 19:32:35 +0100
Subject: [PATCH] dt-bindings: nvmem: add Broadcom's NVRAM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Broadcom's NVRAM structure contains device data and can be accessed
using I/O mapping.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
.../devicetree/bindings/nvmem/brcm,nvram.yaml | 34 +++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/brcm,nvram.yaml
@@ -0,0 +1,34 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/brcm,nvram.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom's NVRAM
+
+description: |
+ Broadcom's NVRAM is a structure containing device specific environment
+ variables. It is used for storing device configuration, booting parameters
+ and calibration data.
+
+ NVRAM can be accessed on Broadcom BCM47xx MIPS and Northstar ARM Cortex-A9
+ devices usiong I/O mapped memory.
+
+maintainers:
+ - Rafał Miłecki <rafal@milecki.pl>
+
+allOf:
+ - $ref: "nvmem.yaml#"
+
+properties:
+ compatible:
+ const: brcm,nvram
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ nvram@1eff0000 {
+ compatible = "brcm,nvram";
+ reg = <0x1eff0000 0x10000>;
+ };

View File

@ -0,0 +1,124 @@
From b152bbeb0282bfcf6f91d0d5befd7582c1c3fc23 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Fri, 5 Mar 2021 19:32:36 +0100
Subject: [PATCH] nvmem: brcm_nvram: new driver exposing Broadcom's NVRAM
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This driver provides access to Broadcom's NVRAM.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
drivers/nvmem/Kconfig | 9 +++++
drivers/nvmem/Makefile | 2 +
drivers/nvmem/brcm_nvram.c | 78 ++++++++++++++++++++++++++++++++++++++
3 files changed, 89 insertions(+)
create mode 100644 drivers/nvmem/brcm_nvram.c
--- a/drivers/nvmem/Kconfig
+++ b/drivers/nvmem/Kconfig
@@ -230,4 +230,13 @@ config NVMEM_ZYNQMP
If sure, say yes. If unsure, say no.
+
+config NVMEM_BRCM_NVRAM
+ tristate "Broadcom's NVRAM support"
+ depends on ARCH_BCM_5301X || COMPILE_TEST
+ depends on HAS_IOMEM
+ help
+ This driver provides support for Broadcom's NVRAM that can be accessed
+ using I/O mapping.
+
endif
--- a/drivers/nvmem/Makefile
+++ b/drivers/nvmem/Makefile
@@ -50,3 +50,5 @@ obj-$(CONFIG_SC27XX_EFUSE) += nvmem-sc27
nvmem-sc27xx-efuse-y := sc27xx-efuse.o
obj-$(CONFIG_NVMEM_ZYNQMP) += nvmem_zynqmp_nvmem.o
nvmem_zynqmp_nvmem-y := zynqmp_nvmem.o
+obj-$(CONFIG_NVMEM_BRCM_NVRAM) += nvmem_brcm_nvram.o
+nvmem_brcm_nvram-y := brcm_nvram.o
--- /dev/null
+++ b/drivers/nvmem/brcm_nvram.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
+ */
+
+#include <linux/io.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/nvmem-provider.h>
+#include <linux/platform_device.h>
+
+struct brcm_nvram {
+ struct device *dev;
+ void __iomem *base;
+};
+
+static int brcm_nvram_read(void *context, unsigned int offset, void *val,
+ size_t bytes)
+{
+ struct brcm_nvram *priv = context;
+ u8 *dst = val;
+
+ while (bytes--)
+ *dst++ = readb(priv->base + offset++);
+
+ return 0;
+}
+
+static int brcm_nvram_probe(struct platform_device *pdev)
+{
+ struct nvmem_config config = {
+ .name = "brcm-nvram",
+ .reg_read = brcm_nvram_read,
+ };
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ struct brcm_nvram *priv;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+ priv->dev = dev;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ priv->base = devm_ioremap_resource(dev, res);
+ if (IS_ERR(priv->base))
+ return PTR_ERR(priv->base);
+
+ config.dev = dev;
+ config.priv = priv;
+ config.size = resource_size(res);
+
+ return PTR_ERR_OR_ZERO(devm_nvmem_register(dev, &config));
+}
+
+static const struct of_device_id brcm_nvram_of_match_table[] = {
+ { .compatible = "brcm,nvram", },
+ {},
+};
+
+static struct platform_driver brcm_nvram_driver = {
+ .probe = brcm_nvram_probe,
+ .driver = {
+ .name = "brcm_nvram",
+ .of_match_table = brcm_nvram_of_match_table,
+ },
+};
+
+static int __init brcm_nvram_init(void)
+{
+ return platform_driver_register(&brcm_nvram_driver);
+}
+
+subsys_initcall_sync(brcm_nvram_init);
+
+MODULE_AUTHOR("Rafał Miłecki");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, brcm_nvram_of_match_table);

View File

@ -1,56 +0,0 @@
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Tue, 2 Mar 2021 08:23:35 +0100
Subject: [PATCH] dt-bindings: firmware: add Broadcom's NVRAM memory mapping
NVRAM structure contains device data and can be accessed using MMIO.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
.../bindings/firmware/brcm,nvram.yaml | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100644 Documentation/devicetree/bindings/firmware/brcm,nvram.yaml
--- /dev/null
+++ b/Documentation/devicetree/bindings/firmware/brcm,nvram.yaml
@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/firmware/brcm,nvram.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Broadcom's NVRAM
+
+maintainers:
+ - Rafał Miłecki <rafal@milecki.pl>
+
+description: |
+ NVRAM is a structure containing device specific environment variables.
+ It is used for storing device configuration, booting parameters and
+ calibration data.
+
+ It's required very early in booting process and so is made available
+ using memory mapping.
+
+ NVRAM can be found on Broadcom BCM47xx MIPS, Northstar ARM Cortex-A9
+ and some more devices.
+
+properties:
+ compatible:
+ const: brcm,nvram
+
+ reg:
+ description: memory region with NVRAM data
+ maxItems: 1
+
+required:
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ nvram@1e000000 {
+ compatible = "brcm,nvram";
+ reg = <0x1e000000 0x10000>;
+ };

View File

@ -1,85 +0,0 @@
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Date: Tue, 2 Mar 2021 08:33:13 +0100
Subject: [PATCH] firmware: bcm47xx_nvram: support platform device "brcm,nvram"
Add support for platform device providing mapping resource. This allows
reading NVRAM based on DT mapping binding. It's required for devices
that boot depending on NVRAM stored setup and provides early access to
NVRAM data.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
drivers/firmware/broadcom/bcm47xx_nvram.c | 55 +++++++++++++++++++++++
1 file changed, 55 insertions(+)
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/mtd/mtd.h>
+#include <linux/platform_device.h>
#include <linux/bcm47xx_nvram.h>
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
@@ -162,6 +163,60 @@ static int nvram_init(void)
return -ENXIO;
}
+static int brcm_nvram_probe(struct platform_device *pdev)
+{
+ struct nvram_header __iomem *header;
+ struct device *dev = &pdev->dev;
+ struct resource *res;
+ void __iomem *mmio;
+ size_t copy_len;
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(dev, "Failed to get resource\n");
+ return -ENODEV;
+ }
+
+ mmio = ioremap(res->start, resource_size(res));
+ if (!mmio)
+ return -ENOMEM;
+
+ header = (struct nvram_header *)mmio;
+ copy_len = DIV_ROUND_UP(sizeof(*header) + header->len, 4);
+ if (header->magic != NVRAM_MAGIC) {
+ dev_err(dev, "No NVRAM found at %pR\n", res);
+ return -EPROTO;
+ } else if (copy_len > resource_size(res)) {
+ dev_err(dev, "NVRAM size exceeds %pR\n", res);
+ return -ERANGE;
+ } else if (copy_len >= NVRAM_SPACE) {
+ dev_err(dev, "NVRAM size exceeds buffer size %d\n", NVRAM_SPACE);
+ return -ENOMEM;
+ }
+
+ __ioread32_copy(nvram_buf, mmio, copy_len);
+ nvram_buf[NVRAM_SPACE - 1] = '\0';
+
+ iounmap(mmio);
+
+ return 0;
+}
+
+static const struct of_device_id brcm_nvram_of_match[] = {
+ { .compatible = "brcm,nvram "},
+ {},
+};
+
+static struct platform_driver brcm_nvram_driver = {
+ .driver = {
+ .name = "brcm_nvram",
+ .of_match_table = brcm_nvram_of_match,
+ },
+ .probe = brcm_nvram_probe,
+};
+
+module_platform_driver(brcm_nvram_driver);
+
int bcm47xx_nvram_getenv(const char *name, char *val, size_t val_len)
{
char *var, *value, *end, *eq;

View File

@ -12,8 +12,8 @@ PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=c5e354589729c0ca63899923f18783fa6803462d
PKG_MIRROR_HASH:=f6f691f1d0f8789f2f143d9e0e785e96dc44cbf7b07bb41aff792f327a5dcb97
PKG_SOURCE_VERSION:=a151f2e05a64727c552a297d129b8ef242ffb3b6
PKG_MIRROR_HASH:=63802bbcbb851d08ea8e609edd2d3fc0828102c07da9cdd3639e16d07883ebae
PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz