aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README4
-rw-r--r--arch/arm/dts/mt7622.dtsi19
-rw-r--r--arch/arm/dts/mt7623.dtsi17
-rw-r--r--arch/arm/dts/mt7629.dtsi16
-rw-r--r--arch/arm/lib/bootm.c3
-rw-r--r--cmd/Kconfig9
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/booti.c40
-rw-r--r--cmd/fat.c6
-rw-r--r--cmd/mem.c92
-rw-r--r--cmd/unlz4.c45
-rw-r--r--common/image.c23
-rw-r--r--doc/README.SPL2
-rw-r--r--doc/README.distro12
-rw-r--r--doc/README.fdt-control2
-rw-r--r--doc/board/sifive/fu540.rst58
-rw-r--r--drivers/block/ide.c8
-rw-r--r--drivers/i2c/davinci_i2c.c2
-rw-r--r--drivers/i2c/kona_i2c.c2
-rw-r--r--drivers/i2c/sh_i2c.c2
-rw-r--r--drivers/i2c/soft_i2c.c2
-rw-r--r--drivers/pwm/Kconfig7
-rw-r--r--drivers/pwm/Makefile1
-rw-r--r--drivers/pwm/pwm-mtk.c188
-rw-r--r--drivers/tee/optee/core.c13
-rw-r--r--env/nvram.c2
-rw-r--r--env/remote.c4
-rw-r--r--fs/btrfs/extent-io.c6
-rw-r--r--include/ata.h41
-rw-r--r--include/image.h21
-rw-r--r--include/libata.h84
-rw-r--r--lib/Kconfig5
-rwxr-xr-xscripts/documentation-file-ref-check226
-rw-r--r--tools/dtoc/dtb_platdata.py4
-rwxr-xr-xtools/dtoc/dtoc.py2
-rw-r--r--tools/fit_image.c2
36 files changed, 832 insertions, 139 deletions
diff --git a/README b/README
index 19dae14ac08..7ebf9f577e6 100644
--- a/README
+++ b/README
@@ -3203,9 +3203,9 @@ is done by typing:
make NAME_defconfig
where "NAME_defconfig" is the name of one of the existing configu-
-rations; see boards.cfg for supported names.
+rations; see configs/*_defconfig for supported names.
-Note: for some board special configuration names may exist; check if
+Note: for some boards special configuration names may exist; check if
additional information is available from the board vendor; for
instance, the TQM823L systems are available without (standard)
or with LCD support. You can select such additional "features"
diff --git a/arch/arm/dts/mt7622.dtsi b/arch/arm/dts/mt7622.dtsi
index 1e8ec9b48be..f9ce0c6c3ec 100644
--- a/arch/arm/dts/mt7622.dtsi
+++ b/arch/arm/dts/mt7622.dtsi
@@ -227,4 +227,23 @@
#clock-cells = <1>;
};
+ pwm: pwm@11006000 {
+ compatible = "mediatek,mt7622-pwm";
+ reg = <0x11006000 0x1000>;
+ #clock-cells = <1>;
+ #pwm-cells = <2>;
+ interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&topckgen CLK_TOP_PWM_SEL>,
+ <&pericfg CLK_PERI_PWM_PD>,
+ <&pericfg CLK_PERI_PWM1_PD>,
+ <&pericfg CLK_PERI_PWM2_PD>,
+ <&pericfg CLK_PERI_PWM3_PD>,
+ <&pericfg CLK_PERI_PWM4_PD>,
+ <&pericfg CLK_PERI_PWM5_PD>,
+ <&pericfg CLK_PERI_PWM6_PD>;
+ clock-names = "top", "main", "pwm1", "pwm2", "pwm3", "pwm4",
+ "pwm5", "pwm6";
+ status = "disabled";
+ };
+
};
diff --git a/arch/arm/dts/mt7623.dtsi b/arch/arm/dts/mt7623.dtsi
index 1f45dea575b..0452889ef80 100644
--- a/arch/arm/dts/mt7623.dtsi
+++ b/arch/arm/dts/mt7623.dtsi
@@ -400,4 +400,21 @@
mediatek,ethsys = <&ethsys>;
status = "disabled";
};
+
+ pwm: pwm@11006000 {
+ compatible = "mediatek,mt7623-pwm";
+ reg = <0x11006000 0x1000>;
+ #clock-cells = <1>;
+ #pwm-cells = <2>;
+ clocks = <&topckgen CLK_TOP_PWM_SEL>,
+ <&pericfg CLK_PERI_PWM>,
+ <&pericfg CLK_PERI_PWM1>,
+ <&pericfg CLK_PERI_PWM2>,
+ <&pericfg CLK_PERI_PWM3>,
+ <&pericfg CLK_PERI_PWM4>,
+ <&pericfg CLK_PERI_PWM5>;
+ clock-names = "top", "main", "pwm1", "pwm2", "pwm3", "pwm4",
+ "pwm5";
+ status = "disabled";
+ };
};
diff --git a/arch/arm/dts/mt7629.dtsi b/arch/arm/dts/mt7629.dtsi
index a33a74a5568..644d2da4a88 100644
--- a/arch/arm/dts/mt7629.dtsi
+++ b/arch/arm/dts/mt7629.dtsi
@@ -281,4 +281,20 @@
reg = <0x1b130000 0x1000>;
#clock-cells = <1>;
};
+
+ pwm: pwm@11006000 {
+ compatible = "mediatek,mt7629-pwm";
+ reg = <0x11006000 0x1000>;
+ #clock-cells = <1>;
+ #pwm-cells = <2>;
+ interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+ clocks = <&topckgen CLK_TOP_PWM_SEL>,
+ <&pericfg CLK_PERI_PWM_PD>,
+ <&pericfg CLK_PERI_PWM1_PD>;
+ clock-names = "top", "main", "pwm1";
+ assigned-clocks = <&topckgen CLK_TOP_PWM_SEL>;
+ assigned-clock-parents = <&topckgen CLK_TOP_UNIVPLL2_D4>;
+ status = "disabled";
+ };
+
};
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index a135bcfc7b5..f4b5ca6de00 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -75,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb)
gd->bd->bi_dram[bank].size - 1;
if (sp > bank_end)
continue;
+ if (bank_end > gd->ram_top)
+ bank_end = gd->ram_top - 1;
+
lmb_reserve(lmb, sp, bank_end - sp + 1);
break;
}
diff --git a/cmd/Kconfig b/cmd/Kconfig
index faa133da650..a46c77d69de 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -770,6 +770,13 @@ config CMD_LZMADEC
Support decompressing an LZMA (Lempel-Ziv-Markov chain algorithm)
image from memory.
+config CMD_UNLZ4
+ bool "unlz4"
+ default y if CMD_BOOTI
+ select LZ4
+ help
+ Support decompressing an LZ4 image from memory region.
+
config CMD_UNZIP
bool "unzip"
default y if CMD_BOOTI
@@ -2096,7 +2103,7 @@ config CMD_BEDBUG
help
The bedbug (emBEDded deBUGger) command provides debugging features
for some PowerPC processors. For details please see the
- docuemntation in doc/README.beddbug
+ documentation in doc/README.bedbug.
config CMD_DIAG
bool "diag - Board diagnostics"
diff --git a/cmd/Makefile b/cmd/Makefile
index f1dd513a4b4..6692ed96c6f 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -144,6 +144,7 @@ obj-$(CONFIG_CMD_TSI148) += tsi148.o
obj-$(CONFIG_CMD_UBI) += ubi.o
obj-$(CONFIG_CMD_UBIFS) += ubifs.o
obj-$(CONFIG_CMD_UNIVERSE) += universe.o
+obj-$(CONFIG_CMD_UNLZ4) += unlz4.o
obj-$(CONFIG_CMD_UNZIP) += unzip.o
obj-$(CONFIG_CMD_VIRTIO) += virtio.o
obj-$(CONFIG_CMD_WDT) += wdt.o
diff --git a/cmd/booti.c b/cmd/booti.c
index de5058236e0..4fff8cfcf69 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -14,6 +14,7 @@
#include <linux/kernel.h>
#include <linux/sizes.h>
+DECLARE_GLOBAL_DATA_PTR;
/*
* Image booting support
*/
@@ -24,6 +25,12 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
ulong ld;
ulong relocated_addr;
ulong image_size;
+ uint8_t *temp;
+ ulong dest;
+ ulong dest_end;
+ unsigned long comp_len;
+ unsigned long decomp_len;
+ int ctype;
ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
images, 1);
@@ -38,6 +45,33 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
debug("* kernel: cmdline image address = 0x%08lx\n", ld);
}
+ temp = map_sysmem(ld, 0);
+ ctype = image_decomp_type(temp, 2);
+ if (ctype > 0) {
+ dest = env_get_ulong("kernel_comp_addr_r", 16, 0);
+ comp_len = env_get_ulong("kernel_comp_size", 16, 0);
+ if (!dest || !comp_len) {
+ puts("kernel_comp_addr_r or kernel_comp_size is not provided!\n");
+ return -EINVAL;
+ }
+ if (dest < gd->ram_base || dest > gd->ram_top) {
+ puts("kernel_comp_addr_r is outside of DRAM range!\n");
+ return -EINVAL;
+ }
+
+ debug("kernel image compression type %d size = 0x%08lx address = 0x%08lx\n",
+ ctype, comp_len, (ulong)dest);
+ decomp_len = comp_len * 10;
+ ret = image_decomp(ctype, 0, ld, IH_TYPE_KERNEL,
+ (void *)dest, (void *)ld, comp_len,
+ decomp_len, &dest_end);
+ if (ret)
+ return ret;
+ /* dest_end contains the uncompressed Image size */
+ memmove((void *) ld, (void *)dest, dest_end);
+ }
+ unmap_sysmem((void *)ld);
+
ret = booti_setup(ld, &relocated_addr, &image_size, false);
if (ret != 0)
return 1;
@@ -100,10 +134,14 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#ifdef CONFIG_SYS_LONGHELP
static char booti_help_text[] =
"[addr [initrd[:size]] [fdt]]\n"
- " - boot Linux 'Image' stored at 'addr'\n"
+ " - boot Linux flat or compressed 'Image' stored at 'addr'\n"
"\tThe argument 'initrd' is optional and specifies the address\n"
"\tof an initrd in memory. The optional parameter ':size' allows\n"
"\tspecifying the size of a RAW initrd.\n"
+ "\tCurrently only booting from gz, bz2, lzma and lz4 compression\n"
+ "\ttypes are supported. In order to boot from any of these compressed\n"
+ "\timages, user have to set kernel_comp_addr_r and kernel_comp_size enviornment\n"
+ "\tvariables beforehand.\n"
#if defined(CONFIG_OF_LIBFDT)
"\tSince booting a Linux kernel requires a flat device-tree, a\n"
"\tthird argument providing the address of the device-tree blob\n"
diff --git a/cmd/fat.c b/cmd/fat.c
index 50df127f6d2..abce2f1e0c0 100644
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -8,13 +8,7 @@
* Boot support
*/
#include <common.h>
-#include <command.h>
-#include <s_record.h>
-#include <net.h>
-#include <ata.h>
-#include <asm/io.h>
#include <mapmem.h>
-#include <part.h>
#include <fat.h>
#include <fs.h>
diff --git a/cmd/mem.c b/cmd/mem.c
index 6d54f195272..0bfb6081e7e 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -801,6 +801,59 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
return errs;
}
+static int compare_regions(volatile unsigned long *bufa,
+ volatile unsigned long *bufb, size_t count)
+{
+ volatile unsigned long *p1 = bufa;
+ volatile unsigned long *p2 = bufb;
+ int errs = 0;
+ size_t i;
+
+ for (i = 0; i < count; i++, p1++, p2++) {
+ if (*p1 != *p2) {
+ printf("FAILURE: 0x%08lx != 0x%08lx (delta=0x%08lx -> bit %ld) at offset 0x%08lx\n",
+ (unsigned long)*p1, (unsigned long)*p2,
+ *p1 ^ *p2, __ffs(*p1 ^ *p2),
+ (unsigned long)(i * sizeof(unsigned long)));
+ errs++;
+ }
+ }
+
+ return errs;
+}
+
+static ulong test_bitflip_comparison(volatile unsigned long *bufa,
+ volatile unsigned long *bufb, size_t count)
+{
+ volatile unsigned long *p1 = bufa;
+ volatile unsigned long *p2 = bufb;
+ unsigned int j, k;
+ unsigned long q;
+ size_t i;
+ int max;
+ int errs = 0;
+
+ max = sizeof(unsigned long) * 8;
+ for (k = 0; k < max; k++) {
+ q = 0x00000001L << k;
+ for (j = 0; j < 8; j++) {
+ WATCHDOG_RESET();
+ q = ~q;
+ p1 = (volatile unsigned long *)bufa;
+ p2 = (volatile unsigned long *)bufb;
+ for (i = 0; i < count; i++)
+ *p1++ = *p2++ = (i % 2) == 0 ? q : ~q;
+
+ errs += compare_regions(bufa, bufb, count);
+ }
+
+ if (ctrlc())
+ return -1UL;
+ }
+
+ return errs;
+}
+
static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
vu_long pattern, int iteration)
{
@@ -871,15 +924,10 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
ulong start, end;
vu_long *buf, *dummy;
ulong iteration_limit = 0;
- int ret;
+ ulong count = 0;
ulong errs = 0; /* number of errors, or -1 if interrupted */
ulong pattern = 0;
int iteration;
-#if defined(CONFIG_SYS_ALT_MEMTEST)
- const int alt_test = 1;
-#else
- const int alt_test = 0;
-#endif
start = CONFIG_SYS_MEMTEST_START;
end = CONFIG_SYS_MEMTEST_END;
@@ -921,40 +969,34 @@ static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
printf("Iteration: %6d\r", iteration + 1);
debug("\n");
- if (alt_test) {
+ if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
errs = mem_test_alt(buf, start, end, dummy);
+ if (errs == -1UL)
+ break;
+ count += errs;
+ errs = test_bitflip_comparison(buf,
+ buf + (end - start) / 2,
+ (end - start) /
+ sizeof(unsigned long));
} else {
errs = mem_test_quick(buf, start, end, pattern,
iteration);
}
if (errs == -1UL)
break;
+ count += errs;
}
- /*
- * Work-around for eldk-4.2 which gives this warning if we try to
- * case in the unmap_sysmem() call:
- * warning: initialization discards qualifiers from pointer target type
- */
- {
- void *vbuf = (void *)buf;
- void *vdummy = (void *)dummy;
-
- unmap_sysmem(vbuf);
- unmap_sysmem(vdummy);
- }
+ unmap_sysmem((void *)buf);
+ unmap_sysmem((void *)dummy);
if (errs == -1UL) {
/* Memory test was aborted - write a newline to finish off */
putc('\n');
- ret = 1;
- } else {
- printf("Tested %d iteration(s) with %lu errors.\n",
- iteration, errs);
- ret = errs != 0;
}
+ printf("Tested %d iteration(s) with %lu errors.\n", iteration, count);
- return ret;
+ return errs != 0;
}
#endif /* CONFIG_CMD_MEMTEST */
diff --git a/cmd/unlz4.c b/cmd/unlz4.c
new file mode 100644
index 00000000000..5320b378d33
--- /dev/null
+++ b/cmd/unlz4.c
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020
+ * FUJITSU COMPUTERTECHNOLOGIES LIMITED. All rights reserved.
+ */
+
+#include <common.h>
+#include <command.h>
+#include <env.h>
+#include <lz4.h>
+
+static int do_unlz4(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ unsigned long src, dst;
+ size_t src_len = ~0UL, dst_len = ~0UL;
+ int ret;
+
+ switch (argc) {
+ case 4:
+ src = simple_strtoul(argv[1], NULL, 16);
+ dst = simple_strtoul(argv[2], NULL, 16);
+ dst_len = simple_strtoul(argv[3], NULL, 16);
+ break;
+ default:
+ return CMD_RET_USAGE;
+ }
+
+ ret = ulz4fn((void *)src, src_len, (void *)dst, &dst_len);
+ if (ret) {
+ printf("Uncompressed err :%d\n", ret);
+ return 1;
+ }
+
+ printf("Uncompressed size: %zd = 0x%zX\n", dst_len, dst_len);
+ env_set_hex("filesize", dst_len);
+
+ return 0;
+}
+
+U_BOOT_CMD(unlz4, 4, 1, do_unlz4,
+ "lz4 uncompress a memory region",
+ "srcaddr dstaddr dstsize\n"
+ "NOTE: Specify the destination size that is sufficiently larger\n"
+ " than the source size.\n"
+);
diff --git a/common/image.c b/common/image.c
index 94873cb6ed5..d8d14e871c6 100644
--- a/common/image.c
+++ b/common/image.c
@@ -202,6 +202,14 @@ struct table_info {
const table_entry_t *table;
};
+static const struct comp_magic_map image_comp[] = {
+ { IH_COMP_BZIP2, "bzip2", {0x42, 0x5a},},
+ { IH_COMP_GZIP, "gzip", {0x1f, 0x8b},},
+ { IH_COMP_LZMA, "lzma", {0x5d, 0x00},},
+ { IH_COMP_LZO, "lzo", {0x89, 0x4c},},
+ { IH_COMP_NONE, "none", {}, },
+};
+
static const struct table_info table_info[IH_COUNT] = {
{ "architecture", IH_ARCH_COUNT, uimage_arch },
{ "compression", IH_COMP_COUNT, uimage_comp },
@@ -407,6 +415,21 @@ static void print_decomp_msg(int comp_type, int type, bool is_xip)
printf(" Uncompressing %s\n", name);
}
+int image_decomp_type(const unsigned char *buf, ulong len)
+{
+ const struct comp_magic_map *cmagic = image_comp;
+
+ if (len < 2)
+ return -EINVAL;
+
+ for (; cmagic->comp_id > 0; cmagic++) {
+ if (!memcmp(buf, cmagic->magic, 2))
+ break;
+ }
+
+ return cmagic->comp_id;
+}
+
int image_decomp(int comp, ulong load, ulong image_start, int type,
void *load_buf, void *image_buf, ulong image_len,
uint unc_len, ulong *load_end)
diff --git a/doc/README.SPL b/doc/README.SPL
index 929b9672b03..2beb6d8f11b 100644
--- a/doc/README.SPL
+++ b/doc/README.SPL
@@ -81,7 +81,7 @@ fdtgrep is also used to remove:
('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
All the nodes remaining in the SPL devicetree are bound
-(see driver-model/README.txt).
+(see doc/driver-model/design.rst).
Debugging
---------
diff --git a/doc/README.distro b/doc/README.distro
index ab6e6f4e74b..5076bebd180 100644
--- a/doc/README.distro
+++ b/doc/README.distro
@@ -246,6 +246,18 @@ kernel_addr_r:
A size of 16MB for the kernel is likely adequate.
+kernel_comp_addr_r:
+ Optional. This is only required if user wants to boot Linux from a compressed
+ Image(.gz, .bz2, .lzma, .lzo) using booti command. It represents the location
+ in RAM where the compressed Image will be decompressed temporarily. Once the
+ decompression is complete, decompressed data will be moved kernel_addr_r for
+ booting.
+
+kernel_comp_size:
+ Optional. This is only required if user wants to boot Linux from a compressed
+ Image using booti command. It represents the size of the compressed file. The
+ size has to at least the size of loaded image for decompression to succeed.
+
pxefile_addr_r:
Mandatory. The location in RAM where extlinux.conf will be loaded to prior
diff --git a/doc/README.fdt-control b/doc/README.fdt-control
index e53cf51875a..424d13fc5b1 100644
--- a/doc/README.fdt-control
+++ b/doc/README.fdt-control
@@ -182,7 +182,7 @@ U-Boot can be divided into three phases: TPL, SPL and U-Boot proper.
The full device tree is available to U-Boot proper, but normally only a subset
(or none at all) is available to TPL and SPL. See 'Pre-Relocation Support' and
-'SPL Support' in doc/driver-model/README.txt for more details.
+'SPL Support' in doc/driver-model/design.rst for more details.
Using several DTBs in the SPL (CONFIG_SPL_MULTI_DTB)
diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
index 3937222c6c6..610ba87074b 100644
--- a/doc/board/sifive/fu540.rst
+++ b/doc/board/sifive/fu540.rst
@@ -135,6 +135,11 @@ load uImage.
=> setenv netmask 255.255.252.0
=> setenv serverip 10.206.4.143
=> setenv gateway 10.206.4.1
+
+If you want to use a flat kernel image such as Image file
+
+.. code-block:: none
+
=> tftpboot ${kernel_addr_r} /sifive/fu540/Image
ethernet@10090000: PHY present at 0
ethernet@10090000: Starting autonegotiation...
@@ -174,6 +179,59 @@ load uImage.
1.2 MiB/s
done
Bytes transferred = 8867100 (874d1c hex)
+
+Or if you want to use a compressed kernel image file such as Image.gz
+
+.. code-block:: none
+
+ => tftpboot ${kernel_addr_r} /sifive/fu540/Image.gz
+ ethernet@10090000: PHY present at 0
+ ethernet@10090000: Starting autonegotiation...
+ ethernet@10090000: Autonegotiation complete
+ ethernet@10090000: link up, 1000Mbps full-duplex (lpa: 0x3c00)
+ Using ethernet@10090000 device
+ TFTP from server 10.206.4.143; our IP address is 10.206.7.133
+ Filename '/sifive/fu540/Image.gz'.
+ Load address: 0x84000000
+ Loading: #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ #################################################################
+ ##########################################
+ 1.2 MiB/s
+ done
+ Bytes transferred = 4809458 (4962f2 hex)
+ =>setenv kernel_comp_addr_r 0x90000000
+ =>setenv kernel_comp_size 0x500000
+
+By this time, correct kernel image is loaded and required enviornment variables
+are set. You can proceed to load the ramdisk and device tree from the tftp server
+as well.
+
+.. code-block:: none
+
=> tftpboot ${ramdisk_addr_r} /sifive/fu540/uRamdisk
ethernet@10090000: PHY present at 0
ethernet@10090000: Starting autonegotiation...
diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index 4b8a4eac176..67cc4fbc02e 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -231,7 +231,7 @@ unsigned char atapi_issue(int device, unsigned char *ccb, int ccblen,
(unsigned char) ((buflen >> 8) & 0xFF));
ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
- ide_outb(device, ATA_COMMAND, ATAPI_CMD_PACKET);
+ ide_outb(device, ATA_COMMAND, ATA_CMD_PACKET);
udelay(50);
mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
@@ -570,7 +570,7 @@ static void ide_ident(struct blk_desc *dev_desc)
/*
* Start Ident Command
*/
- ide_outb(device, ATA_COMMAND, ATAPI_CMD_IDENT);
+ ide_outb(device, ATA_COMMAND, ATA_CMD_ID_ATAPI);
/*
* Wait for completion - ATAPI devices need more time
* to become ready
@@ -582,7 +582,7 @@ static void ide_ident(struct blk_desc *dev_desc)
/*
* Start Ident Command
*/
- ide_outb(device, ATA_COMMAND, ATA_CMD_IDENT);
+ ide_outb(device, ATA_COMMAND, ATA_CMD_ID_ATA);
/*
* Wait for completion
@@ -966,7 +966,7 @@ ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
/* first check if the drive is in Powersaving mode, if yes,
* increase the timeout value */
- ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_PWR);
+ ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_POWER);
udelay(50);
c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c
index 2c77234c60e..edc40f706c1 100644
--- a/drivers/i2c/davinci_i2c.c
+++ b/drivers/i2c/davinci_i2c.c
@@ -8,7 +8,7 @@
* --------------------------------------------------------
*
* NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
+ * Please see doc/driver-model/i2c-howto.rst for instructions.
*/
#include <common.h>
diff --git a/drivers/i2c/kona_i2c.c b/drivers/i2c/kona_i2c.c
index 0726b4c9567..8e31481c0fd 100644
--- a/drivers/i2c/kona_i2c.c
+++ b/drivers/i2c/kona_i2c.c
@@ -3,7 +3,7 @@
* Copyright 2013 Broadcom Corporation.
*
* NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
+ * Please see doc/driver-model/i2c-howto.rst for instructions.
*/
#include <common.h>
diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c
index b69d2135939..834f1f2179f 100644
--- a/drivers/i2c/sh_i2c.c
+++ b/drivers/i2c/sh_i2c.c
@@ -4,7 +4,7 @@
* Copyright (C) 2011, 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
*
* NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
+ * Please see doc/driver-model/i2c-howto.rst for instructions.
*/
#include <common.h>
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index 7f0303cc051..9ad1c281ff2 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -12,7 +12,7 @@
* Neil Russell.
*
* NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
+ * Please see doc/driver-model/i2c-howto.rst for instructions.
*/
#include <common.h>
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index 1f36fc78fa7..edb3f0f538e 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -23,6 +23,13 @@ config PWM_IMX
help
This PWM is found i.MX27 and later i.MX SoCs.
+config PWM_MTK
+ bool "Enable support for MediaTek PWM"
+ depends on DM_PWM
+ help
+ This PWM is found on MT7622, MT7623, and MT7629. It supports a
+ programmable period and duty cycle.
+
config PWM_ROCKCHIP
bool "Enable support for the Rockchip PWM"
depends on DM_PWM
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index a837c35ed2e..2c3a069006a 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_DM_PWM) += pwm-uclass.o
obj-$(CONFIG_PWM_EXYNOS) += exynos_pwm.o
obj-$(CONFIG_PWM_IMX) += pwm-imx.o pwm-imx-util.o
+obj-$(CONFIG_PWM_MTK) += pwm-mtk.o
obj-$(CONFIG_PWM_ROCKCHIP) += rk_pwm.o
obj-$(CONFIG_PWM_SANDBOX) += sandbox_pwm.o
obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o
diff --git a/drivers/pwm/pwm-mtk.c b/drivers/pwm/pwm-mtk.c
new file mode 100644
index 00000000000..97ed477025f
--- /dev/null
+++ b/drivers/pwm/pwm-mtk.c
@@ -0,0 +1,188 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
+ *
+ * Author: Sam Shih <sam.shih@mediatek.com>
+ */
+
+#include <common.h>
+#include <clk.h>
+#include <dm.h>
+#include <pwm.h>
+#include <div64.h>
+#include <linux/bitops.h>
+#include <linux/io.h>
+
+/* PWM registers and bits definitions */
+#define PWMCON 0x00
+#define PWMHDUR 0x04
+#define PWMLDUR 0x08
+#define PWMGDUR 0x0c
+#define PWMWAVENUM 0x28
+#define PWMDWIDTH 0x2c
+#define PWM45DWIDTH_FIXUP 0x30
+#define PWMTHRES 0x30
+#define PWM45THRES_FIXUP 0x34
+
+#define PWM_CLK_DIV_MAX 7
+#define MAX_PWM_NUM 8
+
+#define NSEC_PER_SEC 1000000000L
+
+static const unsigned int mtk_pwm_reg_offset[] = {
+ 0x0010, 0x0050, 0x0090, 0x00d0, 0x0110, 0x0150, 0x0190, 0x0220
+};
+
+struct mtk_pwm_soc {
+ unsigned int num_pwms;
+ bool pwm45_fixup;
+};
+
+struct mtk_pwm_priv {
+ void __iomem *base;
+ struct clk top_clk;
+ struct clk main_clk;
+ struct clk pwm_clks[MAX_PWM_NUM];
+ const struct mtk_pwm_soc *soc;
+};
+
+static void mtk_pwm_w32(struct udevice *dev, uint channel, uint reg, uint val)
+{
+ struct mtk_pwm_priv *priv = dev_get_priv(dev);
+ u32 offset = mtk_pwm_reg_offset[channel];
+
+ writel(val, priv->base + offset + reg);
+}
+
+static int mtk_pwm_set_config(struct udevice *dev, uint channel,
+ uint period_ns, uint duty_ns)
+{
+ struct mtk_pwm_priv *priv = dev_get_priv(dev);
+ u32 clkdiv = 0, clksel = 0, cnt_period, cnt_duty,
+ reg_width = PWMDWIDTH, reg_thres = PWMTHRES;
+ u64 resolution;
+ int ret = 0;
+
+ clk_enable(&priv->top_clk);
+ clk_enable(&priv->main_clk);
+ /* Using resolution in picosecond gets accuracy higher */
+ resolution = (u64)NSEC_PER_SEC * 1000;
+ do_div(resolution, clk_get_rate(&priv->pwm_clks[channel]));
+ cnt_period = DIV_ROUND_CLOSEST_ULL((u64)period_ns * 1000, resolution);
+ while (cnt_period > 8191) {
+ resolution *= 2;
+ clkdiv++;
+ cnt_period = DIV_ROUND_CLOSEST_ULL((u64)period_ns * 1000,
+ resolution);
+ if (clkdiv > PWM_CLK_DIV_MAX && clksel == 0) {
+ clksel = 1;
+ clkdiv = 0;
+ resolution = (u64)NSEC_PER_SEC * 1000 * 1625;
+ do_div(resolution,
+ clk_get_rate(&priv->pwm_clks[channel]));
+ cnt_period = DIV_ROUND_CLOSEST_ULL(
+ (u64)period_ns * 1000, resolution);
+ clk_enable(&priv->pwm_clks[channel]);
+ }
+ }
+ if (clkdiv > PWM_CLK_DIV_MAX && clksel == 1) {
+ printf("pwm period %u not supported\n", period_ns);
+ return -EINVAL;
+ }
+ if (priv->soc->pwm45_fixup && channel > 2) {
+ /*
+ * PWM[4,5] has distinct offset for PWMDWIDTH and PWMTHRES
+ * from the other PWMs on MT7623.
+ */
+ reg_width = PWM45DWIDTH_FIXUP;
+ reg_thres = PWM45THRES_FIXUP;
+ }
+ cnt_duty = DIV_ROUND_CLOSEST_ULL((u64)duty_ns * 1000, resolution);
+ if (clksel == 1)
+ mtk_pwm_w32(dev, channel, PWMCON, BIT(15) | BIT(3) | clkdiv);
+ else
+ mtk_pwm_w32(dev, channel, PWMCON, BIT(15) | clkdiv);
+ mtk_pwm_w32(dev, channel, reg_width, cnt_period);
+ mtk_pwm_w32(dev, channel, reg_thres, cnt_duty);
+
+ return ret;
+};
+
+static int mtk_pwm_set_enable(struct udevice *dev, uint channel, bool enable)
+{
+ struct mtk_pwm_priv *priv = dev_get_priv(dev);
+ u32 val = 0;
+
+ val = readl(priv->base);
+ if (enable)
+ val |= BIT(channel);
+ else
+ val &= ~BIT(channel);
+ writel(val, priv->base);
+
+ return 0;
+};
+
+static int mtk_pwm_probe(struct udevice *dev)
+{
+ struct mtk_pwm_priv *priv = dev_get_priv(dev);
+ int ret = 0;
+ int i;
+
+ priv->soc = (struct mtk_pwm_soc *)dev_get_driver_data(dev);
+ priv->base = (void __iomem *)devfdt_get_addr(dev);
+ if (!priv->base)
+ return -EINVAL;
+ ret = clk_get_by_name(dev, "top", &priv->top_clk);
+ if (ret < 0)
+ return ret;
+ ret = clk_get_by_name(dev, "main", &priv->main_clk);
+ if (ret < 0)
+ return ret;
+ for (i = 0; i < priv->soc->num_pwms; i++) {
+ char name[8];
+
+ snprintf(name, sizeof(name), "pwm%d", i + 1);
+ ret = clk_get_by_name(dev, name, &priv->pwm_clks[i]);
+ if (ret < 0)
+ return ret;
+ }
+
+ return ret;
+}
+
+static const struct pwm_ops mtk_pwm_ops = {
+ .set_config = mtk_pwm_set_config,
+ .set_enable = mtk_pwm_set_enable,
+};
+
+static const struct mtk_pwm_soc mt7622_data = {
+ .num_pwms = 6,
+ .pwm45_fixup = false,
+};
+
+static const struct mtk_pwm_soc mt7623_data = {
+ .num_pwms = 5,
+ .pwm45_fixup = true,
+};
+
+static const struct mtk_pwm_soc mt7629_data = {
+ .num_pwms = 1,
+ .pwm45_fixup = false,
+};
+
+static const struct udevice_id mtk_pwm_ids[] = {
+ { .compatible = "mediatek,mt7622-pwm", .data = (ulong)&mt7622_data },
+ { .compatible = "mediatek,mt7623-pwm", .data = (ulong)&mt7623_data },
+ { .compatible = "mediatek,mt7629-pwm", .data = (ulong)&mt7629_data },
+ { }
+};
+
+U_BOOT_DRIVER(mtk_pwm) = {
+ .name = "mtk_pwm",
+ .id = UCLASS_PWM,
+ .of_match = mtk_pwm_ids,
+ .ops = &mtk_pwm_ops,
+ .probe = mtk_pwm_probe,
+ .priv_auto_alloc_size = sizeof(struct mtk_pwm_priv),
+};
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 9fb5e658f92..5260dab3ac0 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -512,7 +512,7 @@ static bool is_optee_api(optee_invoke_fn *invoke_fn)
res.a2 == OPTEE_MSG_UID_2 && res.a3 == OPTEE_MSG_UID_3;
}
-static void print_os_revision(optee_invoke_fn *invoke_fn)
+static void print_os_revision(struct udevice *dev, optee_invoke_fn *invoke_fn)
{
union {
struct arm_smccc_res smccc;
@@ -527,11 +527,12 @@ static void print_os_revision(optee_invoke_fn *invoke_fn)
&res.smccc);
if (res.result.build_id)
- debug("OP-TEE revision %lu.%lu (%08lx)\n", res.result.major,
- res.result.minor, res.result.build_id);
+ dev_info(dev, "OP-TEE: revision %lu.%lu (%08lx)\n",
+ res.result.major, res.result.minor,
+ res.result.build_id);
else
- debug("OP-TEE revision %lu.%lu\n", res.result.major,
- res.result.minor);
+ dev_info(dev, "OP-TEE: revision %lu.%lu\n",
+ res.result.major, res.result.minor);
}
static bool api_revision_is_compatible(optee_invoke_fn *invoke_fn)
@@ -626,7 +627,7 @@ static int optee_probe(struct udevice *dev)
return -ENOENT;
}
- print_os_revision(pdata->invoke_fn);
+ print_os_revision(dev, pdata->invoke_fn);
if (!api_revision_is_compatible(pdata->invoke_fn)) {
debug("%s: OP-TEE api revision mismatch\n", __func__);
diff --git a/env/nvram.c b/env/nvram.c
index a78db216236..1a9fcf1c069 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
extern void *nvram_read(void *dest, const long src, size_t count);
extern void nvram_write(long dest, const void *src, size_t count);
#else
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
#endif
#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
diff --git a/env/remote.c b/env/remote.c
index 50d77b8dfe0..e3f0608b16b 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -12,9 +12,9 @@
#include <u-boot/crc.h>
#ifdef ENV_IS_EMBEDDED
-env_t *env_ptr = &environment;
+static env_t *env_ptr = &environment;
#else /* ! ENV_IS_EMBEDDED */
-env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
+static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
#endif /* ENV_IS_EMBEDDED */
DECLARE_GLOBAL_DATA_PTR;
diff --git a/fs/btrfs/extent-io.c b/fs/btrfs/extent-io.c
index 66d0e1c7d65..2e4599cf64a 100644
--- a/fs/btrfs/extent-io.c
+++ b/fs/btrfs/extent-io.c
@@ -78,6 +78,12 @@ u64 btrfs_read_extent_reg(struct btrfs_path *path,
if (size > dlen - offset)
size = dlen - offset;
+ /* sparse extent */
+ if (extent->disk_bytenr == 0) {
+ memset(out, 0, size);
+ return size;
+ }
+
physical = btrfs_map_logical_to_physical(extent->disk_bytenr);
if (physical == -1ULL)
return -1ULL;
diff --git a/include/ata.h b/include/ata.h
index 3f4e4a0234e..3d870c973f2 100644
--- a/include/ata.h
+++ b/include/ata.h
@@ -6,11 +6,8 @@
/*
* Most of the following information was derived from the document
- * "Information Technology - AT Attachment-3 Interface (ATA-3)"
- * which can be found at:
- * http://www.dt.wdc.com/ata/ata-3/ata3r5v.zip
- * ftp://poctok.iae.nsk.su/pub/asm/Documents/IDE/ATA3R5V.ZIP
- * ftp://ftp.fee.vutbr.cz/pub/doc/io/ata/ata-3/ata3r5v.zip
+ * "Information Technology - AT Attachment-3 Interface (ATA-3)",
+ * ANSI X3.298-1997.
*/
#ifndef _ATA_H
@@ -71,42 +68,8 @@
#define ATA_LBA 0xE0
/*
- * ATA Commands (only mandatory commands listed here)
- */
-#define ATA_CMD_READ 0x20 /* Read Sectors (with retries) */
-#define ATA_CMD_READN 0x21 /* Read Sectors ( no retries) */
-#define ATA_CMD_WRITE 0x30 /* Write Sectores (with retries)*/
-#define ATA_CMD_WRITEN 0x31 /* Write Sectors ( no retries)*/
-#define ATA_CMD_VRFY 0x40 /* Read Verify (with retries) */
-#define ATA_CMD_VRFYN 0x41 /* Read verify ( no retries) */
-#define ATA_CMD_SEEK 0x70 /* Seek */
-#define ATA_CMD_DIAG 0x90 /* Execute Device Diagnostic */
-#define ATA_CMD_INIT 0x91 /* Initialize Device Parameters */
-#define ATA_CMD_RD_MULT 0xC4 /* Read Multiple */
-#define ATA_CMD_WR_MULT 0xC5 /* Write Multiple */
-#define ATA_CMD_SETMULT 0xC6 /* Set Multiple Mode */
-#define ATA_CMD_RD_DMA 0xC8 /* Read DMA (with retries) */
-#define ATA_CMD_RD_DMAN 0xC9 /* Read DMS ( no retries) */
-#define ATA_CMD_WR_DMA 0xCA /* Write DMA (with retries) */
-#define ATA_CMD_WR_DMAN 0xCB /* Write DMA ( no retires) */
-#define ATA_CMD_IDENT 0xEC /* Identify Device */
-#define ATA_CMD_SETF 0xEF /* Set Features */
-#define ATA_CMD_CHK_PWR 0xE5 /* Check Power Mode */
-
-#define ATA_CMD_READ_EXT 0x24 /* Read Sectors (with retries) with 48bit addressing */
-#define ATA_CMD_WRITE_EXT 0x34 /* Write Sectores (with retries) with 48bit addressing */
-#define ATA_CMD_VRFY_EXT 0x42 /* Read Verify (with retries) with 48bit addressing */
-
-#define ATA_CMD_FLUSH 0xE7 /* Flush drive cache */
-#define ATA_CMD_FLUSH_EXT 0xEA /* Flush drive cache, with 48bit addressing */
-
-/*
* ATAPI Commands
*/
-#define ATAPI_CMD_IDENT 0xA1 /* Identify AT Atachment Packed Interface Device */
-#define ATAPI_CMD_PACKET 0xA0 /* Packed Command */
-
-
#define ATAPI_CMD_INQUIRY 0x12
#define ATAPI_CMD_REQ_SENSE 0x03
#define ATAPI_CMD_READ_CAP 0x25
diff --git a/include/image.h b/include/image.h
index 2388c1f2044..de55b2fb573 100644
--- a/include/image.h
+++ b/include/image.h
@@ -453,6 +453,15 @@ typedef struct table_entry {
} table_entry_t;
/*
+ * Compression type and magic number mapping table.
+ */
+struct comp_magic_map {
+ int comp_id;
+ const char *name;
+ unsigned char magic[2];
+};
+
+/*
* get_table_entry_id() scans the translation table trying to find an
* entry that matches the given short name. If a matching entry is
* found, it's id is returned to the caller.
@@ -869,6 +878,18 @@ static inline int image_check_target_arch(const image_header_t *hdr)
#endif /* USE_HOSTCC */
/**
+ * image_decomp_type() - Find out compression type of an image
+ *
+ * @buf: Address in U-Boot memory where image is loaded.
+ * @len: Length of the compressed image.
+ * @return compression type or IH_COMP_NONE if not compressed.
+ *
+ * Note: Only following compression types are supported now.
+ * lzo, lzma, gzip, bzip2
+ */
+int image_decomp_type(const unsigned char *buf, ulong len);
+
+/**
* image_decomp() - decompress an image
*
* @comp: Compression algorithm that is used (IH_COMP_...)
diff --git a/include/libata.h b/include/libata.h
index 25296ac66d3..b03b29960df 100644
--- a/include/libata.h
+++ b/include/libata.h
@@ -133,49 +133,49 @@ enum {
ATA_REG_IRQ = ATA_REG_NSECT,
/* ATA device commands */
- ATA_CMD_DEV_RESET = 0x08, /* ATAPI device reset */
- ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
- ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
- ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
- ATA_CMD_EDD = 0x90, /* execute device diagnostic */
- ATA_CMD_FLUSH = 0xE7,
- ATA_CMD_FLUSH_EXT = 0xEA,
- ATA_CMD_ID_ATA = 0xEC,
- ATA_CMD_ID_ATAPI = 0xA1,
- ATA_CMD_READ = 0xC8,
- ATA_CMD_READ_EXT = 0x25,
- ATA_CMD_WRITE = 0xCA,
- ATA_CMD_WRITE_EXT = 0x35,
- ATA_CMD_WRITE_FUA_EXT = 0x3D,
- ATA_CMD_FPDMA_READ = 0x60,
- ATA_CMD_FPDMA_WRITE = 0x61,
- ATA_CMD_PIO_READ = 0x20,
- ATA_CMD_PIO_READ_EXT = 0x24,
- ATA_CMD_PIO_WRITE = 0x30,
- ATA_CMD_PIO_WRITE_EXT = 0x34,
- ATA_CMD_READ_MULTI = 0xC4,
- ATA_CMD_READ_MULTI_EXT = 0x29,
- ATA_CMD_WRITE_MULTI = 0xC5,
- ATA_CMD_WRITE_MULTI_EXT = 0x39,
- ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
- ATA_CMD_SET_FEATURES = 0xEF,
- ATA_CMD_SET_MULTI = 0xC6,
- ATA_CMD_PACKET = 0xA0,
- ATA_CMD_VERIFY = 0x40,
- ATA_CMD_VERIFY_EXT = 0x42,
- ATA_CMD_STANDBYNOW1 = 0xE0,
- ATA_CMD_IDLEIMMEDIATE = 0xE1,
- ATA_CMD_SLEEP = 0xE6,
- ATA_CMD_INIT_DEV_PARAMS = 0x91,
- ATA_CMD_READ_NATIVE_MAX = 0xF8,
+ ATA_CMD_DEV_RESET = 0x08, /* ATAPI device reset */
+ ATA_CMD_PIO_READ = 0x20, /* Read sectors with retry */
+ ATA_CMD_PIO_READ_EXT = 0x24,
+ ATA_CMD_READ_EXT = 0x25,
ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
- ATA_CMD_SET_MAX = 0xF9,
- ATA_CMD_SET_MAX_EXT = 0x37,
- ATA_CMD_READ_LOG_EXT = 0x2f,
- ATA_CMD_PMP_READ = 0xE4,
- ATA_CMD_PMP_WRITE = 0xE8,
- ATA_CMD_CONF_OVERLAY = 0xB1,
- ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
+ ATA_CMD_READ_MULTI_EXT = 0x29,
+ ATA_CMD_READ_LOG_EXT = 0x2f,
+ ATA_CMD_PIO_WRITE = 0x30, /* write sectors with retry */
+ ATA_CMD_PIO_WRITE_EXT = 0x34,
+ ATA_CMD_WRITE_EXT = 0x35,
+ ATA_CMD_SET_MAX_EXT = 0x37,
+ ATA_CMD_WRITE_MULTI_EXT = 0x39,
+ ATA_CMD_WRITE_FUA_EXT = 0x3D,
+ ATA_CMD_VERIFY = 0x40, /* read verify sectors with retry */
+ ATA_CMD_VERIFY_EXT = 0x42,
+ ATA_CMD_FPDMA_READ = 0x60,
+ ATA_CMD_FPDMA_WRITE = 0x61,
+ ATA_CMD_EDD = 0x90, /* execute device diagnostic */
+ ATA_CMD_INIT_DEV_PARAMS = 0x91, /* initialize device parameters */
+ ATA_CMD_PACKET = 0xA0, /* ATAPI packet */
+ ATA_CMD_ID_ATAPI = 0xA1, /* ATAPI identify device */
+ ATA_CMD_CONF_OVERLAY = 0xB1,
+ ATA_CMD_READ_MULTI = 0xC4, /* read multiple */
+ ATA_CMD_WRITE_MULTI = 0xC5, /* write multiple */
+ ATA_CMD_SET_MULTI = 0xC6, /* set multiple mode */
+ ATA_CMD_READ = 0xC8, /* read DMA with retry */
+ ATA_CMD_WRITE = 0xCA, /* write DMA with retry */
+ ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
+ ATA_CMD_STANDBYNOW1 = 0xE0, /* standby immediate */
+ ATA_CMD_IDLEIMMEDIATE = 0xE1, /* idle immediate */
+ ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
+ ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
+ ATA_CMD_PMP_READ = 0xE4, /* read buffer */
+ ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
+ ATA_CMD_SLEEP = 0xE6, /* sleep */
+ ATA_CMD_FLUSH = 0xE7,
+ ATA_CMD_PMP_WRITE = 0xE8, /* write buffer */
+ ATA_CMD_FLUSH_EXT = 0xEA,
+ ATA_CMD_ID_ATA = 0xEC, /* identify device */
+ ATA_CMD_SET_FEATURES = 0xEF, /* set features */
+ ATA_CMD_SEC_FREEZE_LOCK = 0xF5, /* security freeze */
+ ATA_CMD_READ_NATIVE_MAX = 0xF8,
+ ATA_CMD_SET_MAX = 0xF9,
/* READ_LOG_EXT pages */
ATA_LOG_SATA_NCQ = 0x10,
diff --git a/lib/Kconfig b/lib/Kconfig
index 452f390c802..144a54da280 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -409,6 +409,11 @@ config GZIP
help
This enables support for GZIP compression algorithm.
+config BZIP2
+ bool "Enable bzip2 decompression support"
+ help
+ This enables support for BZIP2 compression algorithm.
+
config ZLIB
bool
default y
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
new file mode 100755
index 00000000000..0bfc5feefbc
--- /dev/null
+++ b/scripts/documentation-file-ref-check
@@ -0,0 +1,226 @@
+#!/usr/bin/env perl
+# SPDX-License-Identifier: GPL-2.0
+#
+# Treewide grep for references to files under doc, and report
+# non-existing files in stderr.
+
+use warnings;
+use strict;
+use Getopt::Long qw(:config no_auto_abbrev);
+
+# NOTE: only add things here when the file was gone, but the text wants
+# to mention a past documentation file, for example, to give credits for
+# the original work.
+my %false_positives = (
+);
+
+my $scriptname = $0;
+$scriptname =~ s,.*/([^/]+/),$1,;
+
+# Parse arguments
+my $help = 0;
+my $fix = 0;
+my $warn = 0;
+
+if (! -d ".git") {
+ printf "Warning: can't check if file exists, as this is not a git tree";
+ exit 0;
+}
+
+GetOptions(
+ 'fix' => \$fix,
+ 'warn' => \$warn,
+ 'h|help|usage' => \$help,
+);
+
+if ($help != 0) {
+ print "$scriptname [--help] [--fix]\n";
+ exit -1;
+}
+
+# Step 1: find broken references
+print "Finding broken references. This may take a while... " if ($fix);
+
+my %broken_ref;
+
+my $doc_fix = 0;
+
+open IN, "git grep ':doc:\`' doc/|"
+ or die "Failed to run git grep";
+while (<IN>) {
+ next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,);
+
+ my $d = $1;
+ my $doc_ref = $2;
+
+ my $f = $doc_ref;
+
+ $d =~ s,(.*/).*,$1,;
+ $f =~ s,.*\<([^\>]+)\>,$1,;
+
+ $f ="$d$f.rst";
+
+ next if (grep -e, glob("$f"));
+
+ if ($fix && !$doc_fix) {
+ print STDERR "\nWARNING: Currently, can't fix broken :doc:`` fields\n";
+ }
+ $doc_fix++;
+
+ print STDERR "$f: :doc:`$doc_ref`\n";
+}
+close IN;
+
+open IN, "git grep 'doc/'|"
+ or die "Failed to run git grep";
+while (<IN>) {
+ next if (!m/^([^:]+):(.*)/);
+
+ my $f = $1;
+ my $ln = $2;
+
+ # On linux-next, discard the Next/ directory
+ next if ($f =~ m,^Next/,);
+
+ # Makefiles and scripts contain nasty expressions to parse docs
+ next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/);
+
+ # Skip this script
+ next if ($f eq $scriptname);
+
+ # Ignore the dir where documentation will be built
+ next if ($ln =~ m,\b(\S*)doc/output,);
+
+ if ($ln =~ m,\b(\S*)(doc/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) {
+ my $prefix = $1;
+ my $ref = $2;
+ my $base = $2;
+ my $extra = $3;
+
+ # some file references are like:
+ # /usr/src/linux/doc/DMA-{API,mapping}.txt
+ # For now, ignore them
+ next if ($extra =~ m/^{/);
+
+ # Remove footnotes at the end like:
+ # doc/devicetree/dt-object-internal.txt[1]
+ $ref =~ s/(txt|rst)\[\d+]$/$1/;
+
+ # Remove ending ']' without any '['
+ $ref =~ s/\].*// if (!($ref =~ m/\[/));
+
+ # Remove puntuation marks at the end
+ $ref =~ s/[\,\.]+$//;
+
+ my $fulref = "$prefix$ref";
+
+ $fulref =~ s/^(\<file|ref)://;
+ $fulref =~ s/^[\'\`]+//;
+ $fulref =~ s,^\$\(.*\)/,,;
+ $base =~ s,.*/,,;
+
+ # Remove URL false-positives
+ next if ($fulref =~ m/^http/);
+
+ # Check if exists, evaluating wildcards
+ next if (grep -e, glob("$ref $fulref"));
+
+ # Accept relative doc patches for tools/
+ if ($f =~ m/tools/) {
+ my $path = $f;
+ $path =~ s,(.*)/.*,$1,;
+ next if (grep -e, glob("$path/$ref $path/../$ref $path/$fulref"));
+ }
+
+ # Discard known false-positives
+ if (defined($false_positives{$f})) {
+ next if ($false_positives{$f} eq $fulref);
+ }
+
+ if ($fix) {
+ if (!($ref =~ m/(scripts|Kconfig|Kbuild)/)) {
+ $broken_ref{$ref}++;
+ }
+ } elsif ($warn) {
+ print STDERR "Warning: $f references a file that doesn't exist: $fulref\n";
+ } else {
+ print STDERR "$f: $fulref\n";
+ }
+ }
+}
+close IN;
+
+exit 0 if (!$fix);
+
+# Step 2: Seek for file name alternatives
+print "Auto-fixing broken references. Please double-check the results\n";
+
+foreach my $ref (keys %broken_ref) {
+ my $new =$ref;
+
+ my $basedir = ".";
+ # On translations, only seek inside the translations directory
+ $basedir = $1 if ($ref =~ m,(doc/translations/[^/]+),);
+
+ # get just the basename
+ $new =~ s,.*/,,;
+
+ my $f="";
+
+ # usual reason for breakage: DT file moved around
+ if ($ref =~ /devicetree/) {
+ # usual reason for breakage: DT file renamed to .yaml
+ if (!$f) {
+ my $new_ref = $ref;
+ $new_ref =~ s/\.txt$/.yaml/;
+ $f=$new_ref if (-f $new_ref);
+ }
+
+ if (!$f) {
+ my $search = $new;
+ $search =~ s,^.*/,,;
+ $f = qx(find doc/device-tree-bindings/ -iname "*$search*") if ($search);
+ if (!$f) {
+ # Manufacturer name may have changed
+ $search =~ s/^.*,//;
+ $f = qx(find doc/device-tree-bindings/ -iname "*$search*") if ($search);
+ }
+ }
+ }
+
+ # usual reason for breakage: file renamed to .rst
+ if (!$f) {
+ $new =~ s/\.txt$/.rst/;
+ $f=qx(find $basedir -iname $new) if ($new);
+ }
+
+ # usual reason for breakage: use dash or underline
+ if (!$f) {
+ $new =~ s/[-_]/[-_]/g;
+ $f=qx(find $basedir -iname $new) if ($new);
+ }
+
+ # Wild guess: seek for the same name on another place
+ if (!$f) {
+ $f = qx(find $basedir -iname $new) if ($new);
+ }
+
+ my @find = split /\s+/, $f;
+
+ if (!$f) {
+ print STDERR "ERROR: Didn't find a replacement for $ref\n";
+ } elsif (scalar(@find) > 1) {
+ print STDERR "WARNING: Won't auto-replace, as found multiple files close to $ref:\n";
+ foreach my $j (@find) {
+ $j =~ s,^./,,;
+ print STDERR " $j\n";
+ }
+ } else {
+ $f = $find[0];
+ $f =~ s,^./,,;
+ print "INFO: Replacing $ref to $f\n";
+ foreach my $j (qx(git grep -l $ref)) {
+ qx(sed "s\@$ref\@$f\@g" -i $j);
+ }
+ }
+}
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 037e82c8bbd..90a9e1a6269 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -423,7 +423,7 @@ class DtbPlatdata(object):
This writes out the body of a header file consisting of structure
definitions for node in self._valid_nodes. See the documentation in
- README.of-plat for more information.
+ doc/driver-model/of-plat.rst for more information.
"""
self.out_header()
self.out('#include <stdbool.h>\n')
@@ -527,7 +527,7 @@ class DtbPlatdata(object):
U_BOOT_DEVICE() declarations for each valid node. Where a node has
multiple compatible strings, a #define is used to make them equivalent.
- See the documentation in doc/driver-model/of-plat.txt for more
+ See the documentation in doc/driver-model/of-plat.rst for more
information.
"""
self.out_header()
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index b3596a5918f..f31cba900e5 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -22,7 +22,7 @@ Dtoc produces two output files:
This tool is used in U-Boot to provide device tree data to SPL without
increasing the code size of SPL. This supports the CONFIG_SPL_OF_PLATDATA
options. For more information about the use of this options and tool please
-see doc/driver-model/of-plat.txt
+see doc/driver-model/of-plat.rst
"""
from __future__ import print_function
diff --git a/tools/fit_image.c b/tools/fit_image.c
index dd61a816c93..4301b5decbb 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -642,7 +642,7 @@ static int copyfile(const char *src, const char *dst)
goto out;
}
- fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
+ fd_dst = open(dst, O_WRONLY | O_CREAT, 0666);
if (fd_dst < 0) {
printf("Can't open file %s (%s)\n", dst, strerror(errno));
goto out;