mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-12-17 17:27:54 +00:00
Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
commit
cec31d8c48
@ -58,6 +58,10 @@ menu "Global build settings"
|
|||||||
bool "Enable signature checking in opkg"
|
bool "Enable signature checking in opkg"
|
||||||
default SIGNED_PACKAGES
|
default SIGNED_PACKAGES
|
||||||
|
|
||||||
|
config DOWNLOAD_CHECK_CERTIFICATE
|
||||||
|
bool "Enable TLS certificate verification during package download"
|
||||||
|
default y
|
||||||
|
|
||||||
comment "General build options"
|
comment "General build options"
|
||||||
|
|
||||||
config TESTING_KERNEL
|
config TESTING_KERNEL
|
||||||
|
|||||||
@ -192,7 +192,10 @@ $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
|
|||||||
mkdir -p $(dir $@)
|
mkdir -p $(dir $@)
|
||||||
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
$(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
|
||||||
|
|
||||||
prereq: $(STAGING_DIR_HOST)/bin/mkhash
|
$(STAGING_DIR_HOST)/bin/xxd: $(SCRIPT_DIR)/xxdi.pl
|
||||||
|
$(LN) $< $@
|
||||||
|
|
||||||
|
prereq: $(STAGING_DIR_HOST)/bin/mkhash $(STAGING_DIR_HOST)/bin/xxd
|
||||||
|
|
||||||
# Install ldconfig stub
|
# Install ldconfig stub
|
||||||
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
|
$(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
|
||||||
|
|||||||
@ -418,6 +418,15 @@ ucidef_set_led_default() {
|
|||||||
json_select ..
|
json_select ..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ucidef_set_led_heartbeat() {
|
||||||
|
_ucidef_set_led_common "$1" "$2" "$3"
|
||||||
|
|
||||||
|
json_add_string trigger heartbeat
|
||||||
|
json_select ..
|
||||||
|
|
||||||
|
json_select ..
|
||||||
|
}
|
||||||
|
|
||||||
ucidef_set_led_gpio() {
|
ucidef_set_led_gpio() {
|
||||||
local gpio="$4"
|
local gpio="$4"
|
||||||
local inverted="$5"
|
local inverted="$5"
|
||||||
|
|||||||
3
rules.mk
3
rules.mk
@ -265,6 +265,9 @@ TARGET_CXX:=$(TARGET_CROSS)g++
|
|||||||
KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh
|
KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh
|
||||||
SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
|
SED:=$(STAGING_DIR_HOST)/bin/sed -i -e
|
||||||
ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
|
ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e
|
||||||
|
# DOWNLOAD_CHECK_CERTIFICATE is used in /scripts, so we export it here.
|
||||||
|
DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE)
|
||||||
|
export DOWNLOAD_CHECK_CERTIFICATE
|
||||||
CP:=cp -fpR
|
CP:=cp -fpR
|
||||||
LN:=ln -sf
|
LN:=ln -sf
|
||||||
XARGS:=xargs -r
|
XARGS:=xargs -r
|
||||||
|
|||||||
@ -24,6 +24,8 @@ my $scriptdir = dirname($0);
|
|||||||
my @mirrors;
|
my @mirrors;
|
||||||
my $ok;
|
my $ok;
|
||||||
|
|
||||||
|
my $check_certificate = $ENV{DOWNLOAD_CHECK_CERTIFICATE} eq "y";
|
||||||
|
|
||||||
$url_filename or $url_filename = $filename;
|
$url_filename or $url_filename = $filename;
|
||||||
|
|
||||||
sub localmirrors {
|
sub localmirrors {
|
||||||
@ -74,7 +76,7 @@ sub download_cmd($) {
|
|||||||
my $url = shift;
|
my $url = shift;
|
||||||
my $have_curl = 0;
|
my $have_curl = 0;
|
||||||
|
|
||||||
if (open CURL, '-|', 'curl', '--version') {
|
if (open CURL, "curl --version 2>/dev/null |") {
|
||||||
if (defined(my $line = readline CURL)) {
|
if (defined(my $line = readline CURL)) {
|
||||||
$have_curl = 1 if $line =~ /^curl /;
|
$have_curl = 1 if $line =~ /^curl /;
|
||||||
}
|
}
|
||||||
@ -82,8 +84,14 @@ sub download_cmd($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $have_curl
|
return $have_curl
|
||||||
? (qw(curl -f --connect-timeout 20 --retry 5 --location --insecure), shellwords($ENV{CURL_OPTIONS} || ''), $url)
|
? (qw(curl -f --connect-timeout 20 --retry 5 --location),
|
||||||
: (qw(wget --tries=5 --timeout=20 --no-check-certificate --output-document=-), shellwords($ENV{WGET_OPTIONS} || ''), $url)
|
$check_certificate ? () : '--insecure',
|
||||||
|
shellwords($ENV{CURL_OPTIONS} || ''),
|
||||||
|
$url)
|
||||||
|
: (qw(wget --tries=5 --timeout=20 --output-document=-),
|
||||||
|
$check_certificate ? () : '--no-check-certificate',
|
||||||
|
shellwords($ENV{WGET_OPTIONS} || ''),
|
||||||
|
$url)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
66
scripts/xxdi.pl
Executable file
66
scripts/xxdi.pl
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
#
|
||||||
|
# xxdi.pl - perl implementation of 'xxd -i' mode
|
||||||
|
#
|
||||||
|
# Copyright 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
# Copyright 2013 Linux Foundation
|
||||||
|
#
|
||||||
|
# Released under the GPLv2.
|
||||||
|
#
|
||||||
|
# Implements the "basic" functionality of 'xxd -i' in perl to keep build
|
||||||
|
# systems from having to build/install/rely on vim-core, which not all
|
||||||
|
# distros want to do. But everyone has perl, so use it instead.
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
my $indata;
|
||||||
|
my $var_name = "stdin";
|
||||||
|
my $full_output = (@ARGV > 0 && $ARGV[0] eq '-i') ? shift @ARGV : undef;
|
||||||
|
|
||||||
|
{
|
||||||
|
local $/;
|
||||||
|
my $fh;
|
||||||
|
|
||||||
|
if (@ARGV) {
|
||||||
|
$var_name = $ARGV[0];
|
||||||
|
open($fh, '<:raw', $var_name) || die("xxdi.pl: Unable to open $var_name: $!\n");
|
||||||
|
} elsif (! -t STDIN) {
|
||||||
|
$fh = \*STDIN;
|
||||||
|
undef $full_output;
|
||||||
|
} else {
|
||||||
|
die "usage: xxdi.pl [-i] [infile]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$indata = readline $fh;
|
||||||
|
|
||||||
|
close $fh;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $len_data = length($indata);
|
||||||
|
my $num_digits_per_line = 12;
|
||||||
|
my $outdata = "";
|
||||||
|
|
||||||
|
# Use the variable name of the file we read from, converting '/' and '.
|
||||||
|
# to '_', or, if this is stdin, just use "stdin" as the name.
|
||||||
|
$var_name =~ s/\//_/g;
|
||||||
|
$var_name =~ s/\./_/g;
|
||||||
|
$var_name = "__$var_name" if $var_name =~ /^\d/;
|
||||||
|
|
||||||
|
$outdata = "unsigned char $var_name\[] = { " if $full_output;
|
||||||
|
|
||||||
|
for (my $key= 0; $key < $len_data; $key++) {
|
||||||
|
if ($key % $num_digits_per_line == 0) {
|
||||||
|
$outdata = substr($outdata, 0, -1)."\n ";
|
||||||
|
}
|
||||||
|
$outdata .= sprintf("0x%.2x, ", ord(substr($indata, $key, 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
$outdata = substr($outdata, 0, -2);
|
||||||
|
$outdata .= "\n";
|
||||||
|
|
||||||
|
$outdata .= "};\nunsigned int $var_name\_len = $len_data;\n" if $full_output;
|
||||||
|
|
||||||
|
binmode STDOUT;
|
||||||
|
print $outdata;
|
||||||
@ -150,6 +150,7 @@ CONFIG_MEMFD_CREATE=y
|
|||||||
CONFIG_MFD_SYSCON=y
|
CONFIG_MFD_SYSCON=y
|
||||||
CONFIG_MIGRATION=y
|
CONFIG_MIGRATION=y
|
||||||
CONFIG_MODULES_USE_ELF_RELA=y
|
CONFIG_MODULES_USE_ELF_RELA=y
|
||||||
|
CONFIG_MTD_BRCM_U_BOOT=y
|
||||||
CONFIG_MTD_CMDLINE_PARTS=y
|
CONFIG_MTD_CMDLINE_PARTS=y
|
||||||
CONFIG_MTD_NAND_BRCMNAND=y
|
CONFIG_MTD_NAND_BRCMNAND=y
|
||||||
CONFIG_MTD_NAND_CORE=y
|
CONFIG_MTD_NAND_CORE=y
|
||||||
|
|||||||
@ -0,0 +1,137 @@
|
|||||||
|
From 002181f5b150e60c77f21de7ad4dd10e4614cd91 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Mon, 11 Jul 2022 17:30:41 +0200
|
||||||
|
Subject: [PATCH] mtd: parsers: add Broadcom's U-Boot parser
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Broadcom stores environment variables blocks inside U-Boot partition
|
||||||
|
itself. This driver finds & registers them.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||||
|
Link: https://lore.kernel.org/linux-mtd/20220711153041.6036-2-zajec5@gmail.com
|
||||||
|
---
|
||||||
|
drivers/mtd/parsers/Kconfig | 10 ++++
|
||||||
|
drivers/mtd/parsers/Makefile | 1 +
|
||||||
|
drivers/mtd/parsers/brcm_u-boot.c | 84 +++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 95 insertions(+)
|
||||||
|
create mode 100644 drivers/mtd/parsers/brcm_u-boot.c
|
||||||
|
|
||||||
|
--- a/drivers/mtd/parsers/Kconfig
|
||||||
|
+++ b/drivers/mtd/parsers/Kconfig
|
||||||
|
@@ -20,6 +20,16 @@ config MTD_BCM63XX_PARTS
|
||||||
|
This provides partition parsing for BCM63xx devices with CFE
|
||||||
|
bootloaders.
|
||||||
|
|
||||||
|
+config MTD_BRCM_U_BOOT
|
||||||
|
+ tristate "Broadcom's U-Boot partition parser"
|
||||||
|
+ depends on ARCH_BCM4908 || COMPILE_TEST
|
||||||
|
+ help
|
||||||
|
+ Broadcom uses a custom way of storing U-Boot environment variables.
|
||||||
|
+ They are placed inside U-Boot partition itself at unspecified offset.
|
||||||
|
+ It's possible to locate them by looking for a custom header with a
|
||||||
|
+ magic value. This driver does that and creates subpartitions for
|
||||||
|
+ each found environment variables block.
|
||||||
|
+
|
||||||
|
config MTD_CMDLINE_PARTS
|
||||||
|
tristate "Command line partition table parsing"
|
||||||
|
depends on MTD
|
||||||
|
--- a/drivers/mtd/parsers/Makefile
|
||||||
|
+++ b/drivers/mtd/parsers/Makefile
|
||||||
|
@@ -2,6 +2,7 @@
|
||||||
|
obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o
|
||||||
|
obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o
|
||||||
|
obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o
|
||||||
|
+obj-$(CONFIG_MTD_BRCM_U_BOOT) += brcm_u-boot.o
|
||||||
|
obj-$(CONFIG_MTD_CMDLINE_PARTS) += cmdlinepart.o
|
||||||
|
obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o
|
||||||
|
obj-$(CONFIG_MTD_OF_PARTS) += ofpart.o
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/mtd/parsers/brcm_u-boot.c
|
||||||
|
@@ -0,0 +1,84 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
+/*
|
||||||
|
+ * Copyright © 2022 Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+#include <linux/mtd/mtd.h>
|
||||||
|
+#include <linux/mtd/partitions.h>
|
||||||
|
+
|
||||||
|
+#define BRCM_U_BOOT_MAX_OFFSET 0x200000
|
||||||
|
+#define BRCM_U_BOOT_STEP 0x1000
|
||||||
|
+
|
||||||
|
+#define BRCM_U_BOOT_MAX_PARTS 2
|
||||||
|
+
|
||||||
|
+#define BRCM_U_BOOT_MAGIC 0x75456e76 /* uEnv */
|
||||||
|
+
|
||||||
|
+struct brcm_u_boot_header {
|
||||||
|
+ __le32 magic;
|
||||||
|
+ __le32 length;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
+static const char *names[BRCM_U_BOOT_MAX_PARTS] = {
|
||||||
|
+ "u-boot-env",
|
||||||
|
+ "u-boot-env-backup",
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int brcm_u_boot_parse(struct mtd_info *mtd,
|
||||||
|
+ const struct mtd_partition **pparts,
|
||||||
|
+ struct mtd_part_parser_data *data)
|
||||||
|
+{
|
||||||
|
+ struct brcm_u_boot_header header;
|
||||||
|
+ struct mtd_partition *parts;
|
||||||
|
+ size_t bytes_read;
|
||||||
|
+ size_t offset;
|
||||||
|
+ int err;
|
||||||
|
+ int i = 0;
|
||||||
|
+
|
||||||
|
+ parts = kcalloc(BRCM_U_BOOT_MAX_PARTS, sizeof(*parts), GFP_KERNEL);
|
||||||
|
+ if (!parts)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ for (offset = 0;
|
||||||
|
+ offset < min_t(size_t, mtd->size, BRCM_U_BOOT_MAX_OFFSET);
|
||||||
|
+ offset += BRCM_U_BOOT_STEP) {
|
||||||
|
+ err = mtd_read(mtd, offset, sizeof(header), &bytes_read, (uint8_t *)&header);
|
||||||
|
+ if (err && !mtd_is_bitflip(err)) {
|
||||||
|
+ pr_err("Failed to read from %s at 0x%zx: %d\n", mtd->name, offset, err);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (le32_to_cpu(header.magic) != BRCM_U_BOOT_MAGIC)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ parts[i].name = names[i];
|
||||||
|
+ parts[i].offset = offset;
|
||||||
|
+ parts[i].size = sizeof(header) + le32_to_cpu(header.length);
|
||||||
|
+ i++;
|
||||||
|
+ pr_info("offset:0x%zx magic:0x%08x BINGO\n", offset, header.magic);
|
||||||
|
+
|
||||||
|
+ if (i == BRCM_U_BOOT_MAX_PARTS)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *pparts = parts;
|
||||||
|
+
|
||||||
|
+ return i;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct of_device_id brcm_u_boot_of_match_table[] = {
|
||||||
|
+ { .compatible = "brcm,u-boot" },
|
||||||
|
+ {},
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, brcm_u_boot_of_match_table);
|
||||||
|
+
|
||||||
|
+static struct mtd_part_parser brcm_u_boot_mtd_parser = {
|
||||||
|
+ .parse_fn = brcm_u_boot_parse,
|
||||||
|
+ .name = "brcm_u-boot",
|
||||||
|
+ .of_match_table = brcm_u_boot_of_match_table,
|
||||||
|
+};
|
||||||
|
+module_mtd_part_parser(brcm_u_boot_mtd_parser);
|
||||||
|
+
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
@ -1,5 +1,6 @@
|
|||||||
|
From ddeacc4f6494e07cbb6f033627926623f3e7a9d0 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
Date: Tue, 22 Jun 2021 07:05:04 +0200
|
Date: Tue, 22 Jun 2021 07:24:15 +0200
|
||||||
Subject: [PATCH] net: broadcom: bcm4908_enet: reset DMA rings sw indexes
|
Subject: [PATCH] net: broadcom: bcm4908_enet: reset DMA rings sw indexes
|
||||||
properly
|
properly
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
@ -15,6 +16,7 @@ down & up sequence.
|
|||||||
|
|
||||||
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
|
Fixes: 4feffeadbcb2 ("net: broadcom: bcm4908enet: add BCM4908 controller driver")
|
||||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||||
---
|
---
|
||||||
drivers/net/ethernet/broadcom/bcm4908_enet.c | 6 +++---
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 6 +++---
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
From e93a766da57fff3273bcb618edf5dfca1fb86b89 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 15 Sep 2022 15:30:13 +0200
|
||||||
|
Subject: [PATCH] net: broadcom: bcm4908_enet: handle -EPROBE_DEFER when
|
||||||
|
getting MAC
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Reading MAC from OF may return -EPROBE_DEFER if underlaying NVMEM device
|
||||||
|
isn't ready yet. In such case pass that error code up and "wait" to be
|
||||||
|
probed later.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Link: https://lore.kernel.org/r/20220915133013.2243-1-zajec5@gmail.com
|
||||||
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/broadcom/bcm4908_enet.c | 13 +++++++++----
|
||||||
|
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
+++ b/drivers/net/ethernet/broadcom/bcm4908_enet.c
|
||||||
|
@@ -716,10 +716,14 @@ static int bcm4908_enet_probe(struct pla
|
||||||
|
|
||||||
|
SET_NETDEV_DEV(netdev, &pdev->dev);
|
||||||
|
mac = of_get_mac_address(dev->of_node);
|
||||||
|
- if (!IS_ERR(mac))
|
||||||
|
+ if (!IS_ERR(mac)) {
|
||||||
|
ether_addr_copy(netdev->dev_addr, mac);
|
||||||
|
- else
|
||||||
|
+ } else if (PTR_ERR(mac) == -EPROBE_DEFER) {
|
||||||
|
+ err = -EPROBE_DEFER;
|
||||||
|
+ goto err_dma_free;
|
||||||
|
+ } else {
|
||||||
|
eth_hw_addr_random(netdev);
|
||||||
|
+ }
|
||||||
|
netdev->netdev_ops = &bcm4908_enet_netdev_ops;
|
||||||
|
netdev->min_mtu = ETH_ZLEN;
|
||||||
|
netdev->mtu = ETH_DATA_LEN;
|
||||||
|
@@ -728,14 +732,17 @@ static int bcm4908_enet_probe(struct pla
|
||||||
|
netif_napi_add(netdev, &enet->rx_ring.napi, bcm4908_enet_poll_rx, NAPI_POLL_WEIGHT);
|
||||||
|
|
||||||
|
err = register_netdev(netdev);
|
||||||
|
- if (err) {
|
||||||
|
- bcm4908_enet_dma_free(enet);
|
||||||
|
- return err;
|
||||||
|
- }
|
||||||
|
+ if (err)
|
||||||
|
+ goto err_dma_free;
|
||||||
|
|
||||||
|
platform_set_drvdata(pdev, enet);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
+
|
||||||
|
+err_dma_free:
|
||||||
|
+ bcm4908_enet_dma_free(enet);
|
||||||
|
+
|
||||||
|
+ return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int bcm4908_enet_remove(struct platform_device *pdev)
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
From 6e977eaa8280e957b87904b536661550f2a6b3e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Fri, 25 Feb 2022 17:58:20 +0000
|
||||||
|
Subject: [PATCH] nvmem: brcm_nvram: parse NVRAM content into NVMEM cells
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
NVRAM consist of header and NUL separated key-value pairs. Parse it and
|
||||||
|
create NVMEM cell for every key-value entry.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
Link: https://lore.kernel.org/r/20220225175822.8293-3-srinivas.kandagatla@linaro.org
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
---
|
||||||
|
drivers/nvmem/brcm_nvram.c | 90 ++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 90 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/nvmem/brcm_nvram.c
|
||||||
|
+++ b/drivers/nvmem/brcm_nvram.c
|
||||||
|
@@ -6,12 +6,26 @@
|
||||||
|
#include <linux/io.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
+#include <linux/nvmem-consumer.h>
|
||||||
|
#include <linux/nvmem-provider.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+
|
||||||
|
+#define NVRAM_MAGIC "FLSH"
|
||||||
|
|
||||||
|
struct brcm_nvram {
|
||||||
|
struct device *dev;
|
||||||
|
void __iomem *base;
|
||||||
|
+ struct nvmem_cell_info *cells;
|
||||||
|
+ int ncells;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct brcm_nvram_header {
|
||||||
|
+ char magic[4];
|
||||||
|
+ __le32 len;
|
||||||
|
+ __le32 crc_ver_init; /* 0:7 crc, 8:15 ver, 16:31 sdram_init */
|
||||||
|
+ __le32 config_refresh; /* 0:15 sdram_config, 16:31 sdram_refresh */
|
||||||
|
+ __le32 config_ncdl; /* ncdl values for memc */
|
||||||
|
};
|
||||||
|
|
||||||
|
static int brcm_nvram_read(void *context, unsigned int offset, void *val,
|
||||||
|
@@ -26,6 +40,75 @@ static int brcm_nvram_read(void *context
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int brcm_nvram_add_cells(struct brcm_nvram *priv, uint8_t *data,
|
||||||
|
+ size_t len)
|
||||||
|
+{
|
||||||
|
+ struct device *dev = priv->dev;
|
||||||
|
+ char *var, *value, *eq;
|
||||||
|
+ int idx;
|
||||||
|
+
|
||||||
|
+ priv->ncells = 0;
|
||||||
|
+ for (var = data + sizeof(struct brcm_nvram_header);
|
||||||
|
+ var < (char *)data + len && *var;
|
||||||
|
+ var += strlen(var) + 1) {
|
||||||
|
+ priv->ncells++;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ priv->cells = devm_kcalloc(dev, priv->ncells, sizeof(*priv->cells), GFP_KERNEL);
|
||||||
|
+ if (!priv->cells)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ for (var = data + sizeof(struct brcm_nvram_header), idx = 0;
|
||||||
|
+ var < (char *)data + len && *var;
|
||||||
|
+ var = value + strlen(value) + 1, idx++) {
|
||||||
|
+ eq = strchr(var, '=');
|
||||||
|
+ if (!eq)
|
||||||
|
+ break;
|
||||||
|
+ *eq = '\0';
|
||||||
|
+ value = eq + 1;
|
||||||
|
+
|
||||||
|
+ priv->cells[idx].name = devm_kstrdup(dev, var, GFP_KERNEL);
|
||||||
|
+ if (!priv->cells[idx].name)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ priv->cells[idx].offset = value - (char *)data;
|
||||||
|
+ priv->cells[idx].bytes = strlen(value);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int brcm_nvram_parse(struct brcm_nvram *priv)
|
||||||
|
+{
|
||||||
|
+ struct device *dev = priv->dev;
|
||||||
|
+ struct brcm_nvram_header header;
|
||||||
|
+ uint8_t *data;
|
||||||
|
+ size_t len;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ memcpy_fromio(&header, priv->base, sizeof(header));
|
||||||
|
+
|
||||||
|
+ if (memcmp(header.magic, NVRAM_MAGIC, 4)) {
|
||||||
|
+ dev_err(dev, "Invalid NVRAM magic\n");
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ len = le32_to_cpu(header.len);
|
||||||
|
+
|
||||||
|
+ data = kcalloc(1, len, GFP_KERNEL);
|
||||||
|
+ memcpy_fromio(data, priv->base, len);
|
||||||
|
+ data[len - 1] = '\0';
|
||||||
|
+
|
||||||
|
+ err = brcm_nvram_add_cells(priv, data, len);
|
||||||
|
+ if (err) {
|
||||||
|
+ dev_err(dev, "Failed to add cells: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ kfree(data);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int brcm_nvram_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct nvmem_config config = {
|
||||||
|
@@ -35,6 +118,7 @@ static int brcm_nvram_probe(struct platf
|
||||||
|
struct device *dev = &pdev->dev;
|
||||||
|
struct resource *res;
|
||||||
|
struct brcm_nvram *priv;
|
||||||
|
+ int err;
|
||||||
|
|
||||||
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||||
|
if (!priv)
|
||||||
|
@@ -46,7 +130,13 @@ static int brcm_nvram_probe(struct platf
|
||||||
|
if (IS_ERR(priv->base))
|
||||||
|
return PTR_ERR(priv->base);
|
||||||
|
|
||||||
|
+ err = brcm_nvram_parse(priv);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
config.dev = dev;
|
||||||
|
+ config.cells = priv->cells;
|
||||||
|
+ config.ncells = priv->ncells;
|
||||||
|
config.priv = priv;
|
||||||
|
config.size = resource_size(res);
|
||||||
|
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
From 207775f7e17b8fd0426a2ac4a5b81e4e1d71849e Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Fri, 29 Apr 2022 17:26:47 +0100
|
||||||
|
Subject: [PATCH] nvmem: brcm_nvram: find Device Tree nodes for NVMEM cells
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
DT binding for Broadcom's NVRAM supports specifying NVMEM cells as NVMEM
|
||||||
|
device (provider) subnodes. Look for such subnodes when collecing NVMEM
|
||||||
|
cells. This allows NVMEM consumers to use NVRAM variables.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
Link: https://lore.kernel.org/r/20220429162701.2222-3-srinivas.kandagatla@linaro.org
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
---
|
||||||
|
drivers/nvmem/brcm_nvram.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/nvmem/brcm_nvram.c
|
||||||
|
+++ b/drivers/nvmem/brcm_nvram.c
|
||||||
|
@@ -8,6 +8,7 @@
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/nvmem-consumer.h>
|
||||||
|
#include <linux/nvmem-provider.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/slab.h>
|
||||||
|
|
||||||
|
@@ -72,6 +73,7 @@ static int brcm_nvram_add_cells(struct b
|
||||||
|
return -ENOMEM;
|
||||||
|
priv->cells[idx].offset = value - (char *)data;
|
||||||
|
priv->cells[idx].bytes = strlen(value);
|
||||||
|
+ priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
@ -20,12 +20,12 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
|||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/mod_devicetable.h>
|
#include <linux/mod_devicetable.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@@ -46,6 +47,8 @@ static int brcm_nvram_probe(struct platf
|
@@ -136,6 +137,8 @@ static int brcm_nvram_probe(struct platf
|
||||||
if (IS_ERR(priv->base))
|
if (err)
|
||||||
return PTR_ERR(priv->base);
|
return err;
|
||||||
|
|
||||||
+ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
|
+ bcm47xx_nvram_init_from_iomem(priv->base, resource_size(res));
|
||||||
+
|
+
|
||||||
config.dev = dev;
|
config.dev = dev;
|
||||||
config.priv = priv;
|
config.cells = priv->cells;
|
||||||
config.size = resource_size(res);
|
config.ncells = priv->ncells;
|
||||||
|
|||||||
@ -0,0 +1,106 @@
|
|||||||
|
From ad9b10d1eaada169bd764abcab58f08538877e26 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
||||||
|
Date: Wed, 22 Jun 2022 03:06:28 +0200
|
||||||
|
Subject: mtd: core: introduce of support for dynamic partitions
|
||||||
|
|
||||||
|
We have many parser that register mtd partitions at runtime. One example
|
||||||
|
is the cmdlinepart or the smem-part parser where the compatible is defined
|
||||||
|
in the dts and the partitions gets detected and registered by the
|
||||||
|
parser. This is problematic for the NVMEM subsystem that requires an OF
|
||||||
|
node to detect NVMEM cells.
|
||||||
|
|
||||||
|
To fix this problem, introduce an additional logic that will try to
|
||||||
|
assign an OF node to the MTD if declared.
|
||||||
|
|
||||||
|
On MTD addition, it will be checked if the MTD has an OF node and if
|
||||||
|
not declared will check if a partition with the same label / node name is
|
||||||
|
declared in DTS. If an exact match is found, the partition dynamically
|
||||||
|
allocated by the parser will have a connected OF node.
|
||||||
|
|
||||||
|
The NVMEM subsystem will detect the OF node and register any NVMEM cells
|
||||||
|
declared statically in the DTS.
|
||||||
|
|
||||||
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
||||||
|
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||||
|
Link: https://lore.kernel.org/linux-mtd/20220622010628.30414-4-ansuelsmth@gmail.com
|
||||||
|
---
|
||||||
|
drivers/mtd/mtdcore.c | 61 +++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 61 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/mtd/mtdcore.c
|
||||||
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
|
@@ -589,6 +589,66 @@ static int mtd_nvmem_add(struct mtd_info
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void mtd_check_of_node(struct mtd_info *mtd)
|
||||||
|
+{
|
||||||
|
+ struct device_node *partitions, *parent_dn, *mtd_dn = NULL;
|
||||||
|
+ const char *pname, *prefix = "partition-";
|
||||||
|
+ int plen, mtd_name_len, offset, prefix_len;
|
||||||
|
+ struct mtd_info *parent;
|
||||||
|
+ bool found = false;
|
||||||
|
+
|
||||||
|
+ /* Check if MTD already has a device node */
|
||||||
|
+ if (dev_of_node(&mtd->dev))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ /* Check if a partitions node exist */
|
||||||
|
+ parent = mtd_get_master(mtd);
|
||||||
|
+ parent_dn = dev_of_node(&parent->dev);
|
||||||
|
+ if (!parent_dn)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ partitions = of_get_child_by_name(parent_dn, "partitions");
|
||||||
|
+ if (!partitions)
|
||||||
|
+ goto exit_parent;
|
||||||
|
+
|
||||||
|
+ prefix_len = strlen(prefix);
|
||||||
|
+ mtd_name_len = strlen(mtd->name);
|
||||||
|
+
|
||||||
|
+ /* Search if a partition is defined with the same name */
|
||||||
|
+ for_each_child_of_node(partitions, mtd_dn) {
|
||||||
|
+ offset = 0;
|
||||||
|
+
|
||||||
|
+ /* Skip partition with no/wrong prefix */
|
||||||
|
+ if (!of_node_name_prefix(mtd_dn, "partition-"))
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
|
+ /* Label have priority. Check that first */
|
||||||
|
+ if (of_property_read_string(mtd_dn, "label", &pname)) {
|
||||||
|
+ of_property_read_string(mtd_dn, "name", &pname);
|
||||||
|
+ offset = prefix_len;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ plen = strlen(pname) - offset;
|
||||||
|
+ if (plen == mtd_name_len &&
|
||||||
|
+ !strncmp(mtd->name, pname + offset, plen)) {
|
||||||
|
+ found = true;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!found)
|
||||||
|
+ goto exit_partitions;
|
||||||
|
+
|
||||||
|
+ /* Set of_node only for nvmem */
|
||||||
|
+ if (of_device_is_compatible(mtd_dn, "nvmem-cells"))
|
||||||
|
+ mtd_set_of_node(mtd, mtd_dn);
|
||||||
|
+
|
||||||
|
+exit_partitions:
|
||||||
|
+ of_node_put(partitions);
|
||||||
|
+exit_parent:
|
||||||
|
+ of_node_put(parent_dn);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/**
|
||||||
|
* add_mtd_device - register an MTD device
|
||||||
|
* @mtd: pointer to new MTD device info structure
|
||||||
|
@@ -672,6 +732,7 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||||
|
mtd->dev.devt = MTD_DEVT(i);
|
||||||
|
dev_set_name(&mtd->dev, "mtd%d", i);
|
||||||
|
dev_set_drvdata(&mtd->dev, mtd);
|
||||||
|
+ mtd_check_of_node(mtd);
|
||||||
|
of_node_get(mtd_get_of_node(mtd));
|
||||||
|
error = device_register(&mtd->dev);
|
||||||
|
if (error)
|
||||||
@ -25,7 +25,7 @@ Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
|||||||
|
|
||||||
--- a/drivers/mtd/mtdcore.c
|
--- a/drivers/mtd/mtdcore.c
|
||||||
+++ b/drivers/mtd/mtdcore.c
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
@@ -1006,6 +1006,34 @@ int __get_mtd_device(struct mtd_info *mt
|
@@ -1067,6 +1067,34 @@ int __get_mtd_device(struct mtd_info *mt
|
||||||
EXPORT_SYMBOL_GPL(__get_mtd_device);
|
EXPORT_SYMBOL_GPL(__get_mtd_device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
From dbc2f62061c6bfba0aee93161ee3194dcee84bd0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Fri, 29 Apr 2022 17:26:46 +0100
|
||||||
|
Subject: [PATCH] nvmem: core: support passing DT node in cell info
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Some hardware may have NVMEM cells described in Device Tree using
|
||||||
|
individual nodes. Let drivers pass such nodes to the NVMEM subsystem so
|
||||||
|
they can be later used by NVMEM consumers.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
Link: https://lore.kernel.org/r/20220429162701.2222-2-srinivas.kandagatla@linaro.org
|
||||||
|
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||||
|
---
|
||||||
|
drivers/nvmem/core.c | 1 +
|
||||||
|
include/linux/nvmem-consumer.h | 1 +
|
||||||
|
2 files changed, 2 insertions(+)
|
||||||
|
|
||||||
|
--- a/drivers/nvmem/core.c
|
||||||
|
+++ b/drivers/nvmem/core.c
|
||||||
|
@@ -141,6 +141,7 @@ static int nvmem_cell_info_to_nvmem_cell
|
||||||
|
|
||||||
|
cell->bit_offset = info->bit_offset;
|
||||||
|
cell->nbits = info->nbits;
|
||||||
|
+ cell->np = info->np;
|
||||||
|
|
||||||
|
if (cell->nbits)
|
||||||
|
cell->bytes = DIV_ROUND_UP(cell->nbits + cell->bit_offset,
|
||||||
|
--- a/include/linux/nvmem-consumer.h
|
||||||
|
+++ b/include/linux/nvmem-consumer.h
|
||||||
|
@@ -25,6 +25,7 @@ struct nvmem_cell_info {
|
||||||
|
unsigned int bytes;
|
||||||
|
unsigned int bit_offset;
|
||||||
|
unsigned int nbits;
|
||||||
|
+ struct device_node *np;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
@ -0,0 +1,29 @@
|
|||||||
|
From d69efcf951df4dcc74a0e1554969c533aec8aa9b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 15 Sep 2022 22:06:29 +0200
|
||||||
|
Subject: [PATCH] nvmem: u-boot-env: find Device Tree nodes for NVMEM cells
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
DT binding allows specifying NVMEM cells as NVMEM device (provider)
|
||||||
|
subnodes. Looks for such subnodes when building NVMEM cells.
|
||||||
|
|
||||||
|
This allows NVMEM consumers to use U-Boot environment variables.
|
||||||
|
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
---
|
||||||
|
drivers/nvmem/u-boot-env.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
--- a/drivers/nvmem/u-boot-env.c
|
||||||
|
+++ b/drivers/nvmem/u-boot-env.c
|
||||||
|
@@ -92,6 +92,7 @@ static int u_boot_env_add_cells(struct u
|
||||||
|
return -ENOMEM;
|
||||||
|
priv->cells[idx].offset = data_offset + value - data;
|
||||||
|
priv->cells[idx].bytes = strlen(value);
|
||||||
|
+ priv->cells[idx].np = of_get_child_by_name(dev->of_node, priv->cells[idx].name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WARN_ON(idx != priv->ncells))
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
From 60bbaad38109684b156e21112322e0a922f92cde Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||||
|
Date: Thu, 18 Aug 2022 06:38:37 +0200
|
||||||
|
Subject: [PATCH] nvmem: u-boot-env: fix crc32 casting type
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This fixes:
|
||||||
|
drivers/nvmem/u-boot-env.c:141:17: sparse: sparse: cast to restricted __le32
|
||||||
|
|
||||||
|
Reported-by: kernel test robot <lkp@intel.com>
|
||||||
|
Fixes: f955dc1445069 ("nvmem: add driver handling U-Boot environment variables")
|
||||||
|
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||||
|
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||||
|
---
|
||||||
|
drivers/nvmem/u-boot-env.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
--- a/drivers/nvmem/u-boot-env.c
|
||||||
|
+++ b/drivers/nvmem/u-boot-env.c
|
||||||
|
@@ -139,7 +139,7 @@ static int u_boot_env_parse(struct u_boo
|
||||||
|
data_offset = offsetof(struct u_boot_env_image_redundant, data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- crc32 = le32_to_cpu(*(uint32_t *)(buf + crc32_offset));
|
||||||
|
+ crc32 = le32_to_cpu(*(__le32 *)(buf + crc32_offset));
|
||||||
|
crc32_data_len = priv->mtd->size - crc32_data_offset;
|
||||||
|
data_len = priv->mtd->size - data_offset;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
|
|||||||
#include <linux/nvmem-provider.h>
|
#include <linux/nvmem-provider.h>
|
||||||
|
|
||||||
#include <linux/mtd/mtd.h>
|
#include <linux/mtd/mtd.h>
|
||||||
@@ -699,6 +700,15 @@ int add_mtd_device(struct mtd_info *mtd)
|
@@ -760,6 +761,15 @@ int add_mtd_device(struct mtd_info *mtd)
|
||||||
of this try_ nonsense, and no bitching about it
|
of this try_ nonsense, and no bitching about it
|
||||||
either. :) */
|
either. :) */
|
||||||
__module_get(THIS_MODULE);
|
__module_get(THIS_MODULE);
|
||||||
|
|||||||
@ -17,7 +17,7 @@ Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
|||||||
|
|
||||||
--- a/drivers/mtd/mtdcore.c
|
--- a/drivers/mtd/mtdcore.c
|
||||||
+++ b/drivers/mtd/mtdcore.c
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
@@ -1081,6 +1081,44 @@ out_unlock:
|
@@ -1142,6 +1142,44 @@ out_unlock:
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(get_mtd_device_nm);
|
EXPORT_SYMBOL_GPL(get_mtd_device_nm);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ Signed-off-by: Abhimanyu Vishwakarma <Abhimanyu.Vishwakarma@imgtec.com>
|
|||||||
mtd->type = MTD_NORFLASH;
|
mtd->type = MTD_NORFLASH;
|
||||||
--- a/drivers/mtd/mtdcore.c
|
--- a/drivers/mtd/mtdcore.c
|
||||||
+++ b/drivers/mtd/mtdcore.c
|
+++ b/drivers/mtd/mtdcore.c
|
||||||
@@ -779,6 +779,17 @@ out_error:
|
@@ -840,6 +840,17 @@ out_error:
|
||||||
*/
|
*/
|
||||||
static void mtd_set_dev_defaults(struct mtd_info *mtd)
|
static void mtd_set_dev_defaults(struct mtd_info *mtd)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -26,6 +26,14 @@
|
|||||||
gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
|
gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
watchdog {
|
||||||
|
compatible = "linux,wdt-gpio";
|
||||||
|
gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
|
||||||
|
hw_algo = "toggle";
|
||||||
|
hw_margin_ms = <20000>;
|
||||||
|
always-running;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
&pcie {
|
&pcie {
|
||||||
|
|||||||
@ -89,6 +89,8 @@ CONFIG_GENERIC_TIME_VSYSCALL=y
|
|||||||
CONFIG_GPIOLIB=y
|
CONFIG_GPIOLIB=y
|
||||||
# CONFIG_GPIO_MT7621 is not set
|
# CONFIG_GPIO_MT7621 is not set
|
||||||
CONFIG_GPIO_RALINK=y
|
CONFIG_GPIO_RALINK=y
|
||||||
|
CONFIG_GPIO_WATCHDOG=y
|
||||||
|
# CONFIG_GPIO_WATCHDOG_ARCH_INITCALL is not set
|
||||||
CONFIG_HANDLE_DOMAIN_IRQ=y
|
CONFIG_HANDLE_DOMAIN_IRQ=y
|
||||||
CONFIG_HARDWARE_WATCHPOINTS=y
|
CONFIG_HARDWARE_WATCHPOINTS=y
|
||||||
CONFIG_HAS_DMA=y
|
CONFIG_HAS_DMA=y
|
||||||
|
|||||||
@ -25,7 +25,7 @@ tools-y += autoconf autoconf-archive automake bc bison cmake dosfstools
|
|||||||
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
|
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
|
||||||
tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
|
tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
|
||||||
tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image
|
tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image
|
||||||
tools-y += patchelf pkgconf quilt squashfskit4 sstrip xxd zip zlib zstd
|
tools-y += patchelf pkgconf quilt squashfskit4 sstrip zip zlib zstd
|
||||||
tools-$(BUILD_B43_TOOLS) += b43-tools
|
tools-$(BUILD_B43_TOOLS) += b43-tools
|
||||||
tools-$(BUILD_ISL) += isl
|
tools-$(BUILD_ISL) += isl
|
||||||
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr
|
tools-$(BUILD_TOOLCHAIN) += expat gmp libelf mpc mpfr
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
include $(TOPDIR)/rules.mk
|
|
||||||
|
|
||||||
PKG_NAME:=xxd
|
|
||||||
PKG_VERSION:=1.10
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
|
||||||
PKG_SOURCE_URL:=http://grail.cba.csuohio.edu/~somos/
|
|
||||||
PKG_HASH:=9bf05c19b9084973e3cc877696a7f9881a5c87fa5a9fa438d9962519726559f9
|
|
||||||
PKG_CPE_ID:=cpe:/a:vim:vim
|
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/host-build.mk
|
|
||||||
|
|
||||||
define Host/Install
|
|
||||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
|
|
||||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/xxd $(STAGING_DIR_HOST)/bin/
|
|
||||||
endef
|
|
||||||
|
|
||||||
$(eval $(call HostBuild))
|
|
||||||
Loading…
Reference in New Issue
Block a user