Merge branch '2020-04-17-master-imports'
- Further cleanups for 'make refcheckdocs' - Another BTRFS fix. - Support for automatic decompression of images with booti as well as unlz4 command for manual decompression.
This commit is contained in:
commit
a063758059
4
README
4
README
@ -3203,9 +3203,9 @@ is done by typing:
|
|||||||
make NAME_defconfig
|
make NAME_defconfig
|
||||||
|
|
||||||
where "NAME_defconfig" is the name of one of the existing configu-
|
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
|
additional information is available from the board vendor; for
|
||||||
instance, the TQM823L systems are available without (standard)
|
instance, the TQM823L systems are available without (standard)
|
||||||
or with LCD support. You can select such additional "features"
|
or with LCD support. You can select such additional "features"
|
||||||
|
@ -227,4 +227,23 @@
|
|||||||
#clock-cells = <1>;
|
#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";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -400,4 +400,21 @@
|
|||||||
mediatek,ethsys = <ðsys>;
|
mediatek,ethsys = <ðsys>;
|
||||||
status = "disabled";
|
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";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
@ -281,4 +281,20 @@
|
|||||||
reg = <0x1b130000 0x1000>;
|
reg = <0x1b130000 0x1000>;
|
||||||
#clock-cells = <1>;
|
#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";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -75,6 +75,9 @@ void arch_lmb_reserve(struct lmb *lmb)
|
|||||||
gd->bd->bi_dram[bank].size - 1;
|
gd->bd->bi_dram[bank].size - 1;
|
||||||
if (sp > bank_end)
|
if (sp > bank_end)
|
||||||
continue;
|
continue;
|
||||||
|
if (bank_end > gd->ram_top)
|
||||||
|
bank_end = gd->ram_top - 1;
|
||||||
|
|
||||||
lmb_reserve(lmb, sp, bank_end - sp + 1);
|
lmb_reserve(lmb, sp, bank_end - sp + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -770,6 +770,13 @@ config CMD_LZMADEC
|
|||||||
Support decompressing an LZMA (Lempel-Ziv-Markov chain algorithm)
|
Support decompressing an LZMA (Lempel-Ziv-Markov chain algorithm)
|
||||||
image from memory.
|
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
|
config CMD_UNZIP
|
||||||
bool "unzip"
|
bool "unzip"
|
||||||
default y if CMD_BOOTI
|
default y if CMD_BOOTI
|
||||||
@ -2096,7 +2103,7 @@ config CMD_BEDBUG
|
|||||||
help
|
help
|
||||||
The bedbug (emBEDded deBUGger) command provides debugging features
|
The bedbug (emBEDded deBUGger) command provides debugging features
|
||||||
for some PowerPC processors. For details please see the
|
for some PowerPC processors. For details please see the
|
||||||
docuemntation in doc/README.beddbug
|
documentation in doc/README.bedbug.
|
||||||
|
|
||||||
config CMD_DIAG
|
config CMD_DIAG
|
||||||
bool "diag - Board diagnostics"
|
bool "diag - Board diagnostics"
|
||||||
|
@ -144,6 +144,7 @@ obj-$(CONFIG_CMD_TSI148) += tsi148.o
|
|||||||
obj-$(CONFIG_CMD_UBI) += ubi.o
|
obj-$(CONFIG_CMD_UBI) += ubi.o
|
||||||
obj-$(CONFIG_CMD_UBIFS) += ubifs.o
|
obj-$(CONFIG_CMD_UBIFS) += ubifs.o
|
||||||
obj-$(CONFIG_CMD_UNIVERSE) += universe.o
|
obj-$(CONFIG_CMD_UNIVERSE) += universe.o
|
||||||
|
obj-$(CONFIG_CMD_UNLZ4) += unlz4.o
|
||||||
obj-$(CONFIG_CMD_UNZIP) += unzip.o
|
obj-$(CONFIG_CMD_UNZIP) += unzip.o
|
||||||
obj-$(CONFIG_CMD_VIRTIO) += virtio.o
|
obj-$(CONFIG_CMD_VIRTIO) += virtio.o
|
||||||
obj-$(CONFIG_CMD_WDT) += wdt.o
|
obj-$(CONFIG_CMD_WDT) += wdt.o
|
||||||
|
40
cmd/booti.c
40
cmd/booti.c
@ -14,6 +14,7 @@
|
|||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/sizes.h>
|
#include <linux/sizes.h>
|
||||||
|
|
||||||
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
/*
|
/*
|
||||||
* Image booting support
|
* Image booting support
|
||||||
*/
|
*/
|
||||||
@ -24,6 +25,12 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||||||
ulong ld;
|
ulong ld;
|
||||||
ulong relocated_addr;
|
ulong relocated_addr;
|
||||||
ulong image_size;
|
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,
|
ret = do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START,
|
||||||
images, 1);
|
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);
|
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);
|
ret = booti_setup(ld, &relocated_addr, &image_size, false);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return 1;
|
return 1;
|
||||||
@ -100,10 +134,14 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||||||
#ifdef CONFIG_SYS_LONGHELP
|
#ifdef CONFIG_SYS_LONGHELP
|
||||||
static char booti_help_text[] =
|
static char booti_help_text[] =
|
||||||
"[addr [initrd[:size]] [fdt]]\n"
|
"[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"
|
"\tThe argument 'initrd' is optional and specifies the address\n"
|
||||||
"\tof an initrd in memory. The optional parameter ':size' allows\n"
|
"\tof an initrd in memory. The optional parameter ':size' allows\n"
|
||||||
"\tspecifying the size of a RAW initrd.\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)
|
#if defined(CONFIG_OF_LIBFDT)
|
||||||
"\tSince booting a Linux kernel requires a flat device-tree, a\n"
|
"\tSince booting a Linux kernel requires a flat device-tree, a\n"
|
||||||
"\tthird argument providing the address of the device-tree blob\n"
|
"\tthird argument providing the address of the device-tree blob\n"
|
||||||
|
@ -8,13 +8,7 @@
|
|||||||
* Boot support
|
* Boot support
|
||||||
*/
|
*/
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <command.h>
|
|
||||||
#include <s_record.h>
|
|
||||||
#include <net.h>
|
|
||||||
#include <ata.h>
|
|
||||||
#include <asm/io.h>
|
|
||||||
#include <mapmem.h>
|
#include <mapmem.h>
|
||||||
#include <part.h>
|
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
|
|
||||||
|
92
cmd/mem.c
92
cmd/mem.c
@ -801,6 +801,59 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
|
|||||||
return errs;
|
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,
|
static ulong mem_test_quick(vu_long *buf, ulong start_addr, ulong end_addr,
|
||||||
vu_long pattern, int iteration)
|
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;
|
ulong start, end;
|
||||||
vu_long *buf, *dummy;
|
vu_long *buf, *dummy;
|
||||||
ulong iteration_limit = 0;
|
ulong iteration_limit = 0;
|
||||||
int ret;
|
ulong count = 0;
|
||||||
ulong errs = 0; /* number of errors, or -1 if interrupted */
|
ulong errs = 0; /* number of errors, or -1 if interrupted */
|
||||||
ulong pattern = 0;
|
ulong pattern = 0;
|
||||||
int iteration;
|
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;
|
start = CONFIG_SYS_MEMTEST_START;
|
||||||
end = CONFIG_SYS_MEMTEST_END;
|
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);
|
printf("Iteration: %6d\r", iteration + 1);
|
||||||
debug("\n");
|
debug("\n");
|
||||||
if (alt_test) {
|
if (IS_ENABLED(CONFIG_SYS_ALT_MEMTEST)) {
|
||||||
errs = mem_test_alt(buf, start, end, dummy);
|
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 {
|
} else {
|
||||||
errs = mem_test_quick(buf, start, end, pattern,
|
errs = mem_test_quick(buf, start, end, pattern,
|
||||||
iteration);
|
iteration);
|
||||||
}
|
}
|
||||||
if (errs == -1UL)
|
if (errs == -1UL)
|
||||||
break;
|
break;
|
||||||
|
count += errs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
unmap_sysmem((void *)buf);
|
||||||
* Work-around for eldk-4.2 which gives this warning if we try to
|
unmap_sysmem((void *)dummy);
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errs == -1UL) {
|
if (errs == -1UL) {
|
||||||
/* Memory test was aborted - write a newline to finish off */
|
/* Memory test was aborted - write a newline to finish off */
|
||||||
putc('\n');
|
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 */
|
#endif /* CONFIG_CMD_MEMTEST */
|
||||||
|
|
||||||
|
45
cmd/unlz4.c
Normal file
45
cmd/unlz4.c
Normal file
@ -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"
|
||||||
|
);
|
@ -202,6 +202,14 @@ struct table_info {
|
|||||||
const table_entry_t *table;
|
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] = {
|
static const struct table_info table_info[IH_COUNT] = {
|
||||||
{ "architecture", IH_ARCH_COUNT, uimage_arch },
|
{ "architecture", IH_ARCH_COUNT, uimage_arch },
|
||||||
{ "compression", IH_COMP_COUNT, uimage_comp },
|
{ "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);
|
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,
|
int image_decomp(int comp, ulong load, ulong image_start, int type,
|
||||||
void *load_buf, void *image_buf, ulong image_len,
|
void *load_buf, void *image_buf, ulong image_len,
|
||||||
uint unc_len, ulong *load_end)
|
uint unc_len, ulong *load_end)
|
||||||
|
@ -81,7 +81,7 @@ fdtgrep is also used to remove:
|
|||||||
('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
|
('u-boot,dm-pre-reloc', 'u-boot,dm-spl' and 'u-boot,dm-tpl')
|
||||||
|
|
||||||
All the nodes remaining in the SPL devicetree are bound
|
All the nodes remaining in the SPL devicetree are bound
|
||||||
(see driver-model/README.txt).
|
(see doc/driver-model/design.rst).
|
||||||
|
|
||||||
Debugging
|
Debugging
|
||||||
---------
|
---------
|
||||||
|
@ -246,6 +246,18 @@ kernel_addr_r:
|
|||||||
|
|
||||||
A size of 16MB for the kernel is likely adequate.
|
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:
|
pxefile_addr_r:
|
||||||
|
|
||||||
Mandatory. The location in RAM where extlinux.conf will be loaded to prior
|
Mandatory. The location in RAM where extlinux.conf will be loaded to prior
|
||||||
|
@ -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
|
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
|
(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)
|
Using several DTBs in the SPL (CONFIG_SPL_MULTI_DTB)
|
||||||
|
@ -135,6 +135,11 @@ load uImage.
|
|||||||
=> setenv netmask 255.255.252.0
|
=> setenv netmask 255.255.252.0
|
||||||
=> setenv serverip 10.206.4.143
|
=> setenv serverip 10.206.4.143
|
||||||
=> setenv gateway 10.206.4.1
|
=> 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
|
=> tftpboot ${kernel_addr_r} /sifive/fu540/Image
|
||||||
ethernet@10090000: PHY present at 0
|
ethernet@10090000: PHY present at 0
|
||||||
ethernet@10090000: Starting autonegotiation...
|
ethernet@10090000: Starting autonegotiation...
|
||||||
@ -174,6 +179,59 @@ load uImage.
|
|||||||
1.2 MiB/s
|
1.2 MiB/s
|
||||||
done
|
done
|
||||||
Bytes transferred = 8867100 (874d1c hex)
|
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
|
=> tftpboot ${ramdisk_addr_r} /sifive/fu540/uRamdisk
|
||||||
ethernet@10090000: PHY present at 0
|
ethernet@10090000: PHY present at 0
|
||||||
ethernet@10090000: Starting autonegotiation...
|
ethernet@10090000: Starting autonegotiation...
|
||||||
|
@ -231,7 +231,7 @@ unsigned char atapi_issue(int device, unsigned char *ccb, int ccblen,
|
|||||||
(unsigned char) ((buflen >> 8) & 0xFF));
|
(unsigned char) ((buflen >> 8) & 0xFF));
|
||||||
ide_outb(device, ATA_DEV_HD, ATA_LBA | ATA_DEVICE(device));
|
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);
|
udelay(50);
|
||||||
|
|
||||||
mask = ATA_STAT_DRQ | ATA_STAT_BUSY | ATA_STAT_ERR;
|
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
|
* 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
|
* Wait for completion - ATAPI devices need more time
|
||||||
* to become ready
|
* to become ready
|
||||||
@ -582,7 +582,7 @@ static void ide_ident(struct blk_desc *dev_desc)
|
|||||||
/*
|
/*
|
||||||
* Start Ident Command
|
* Start Ident Command
|
||||||
*/
|
*/
|
||||||
ide_outb(device, ATA_COMMAND, ATA_CMD_IDENT);
|
ide_outb(device, ATA_COMMAND, ATA_CMD_ID_ATA);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wait for completion
|
* 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,
|
/* first check if the drive is in Powersaving mode, if yes,
|
||||||
* increase the timeout value */
|
* increase the timeout value */
|
||||||
ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_PWR);
|
ide_outb(device, ATA_COMMAND, ATA_CMD_CHK_POWER);
|
||||||
udelay(50);
|
udelay(50);
|
||||||
|
|
||||||
c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
|
c = ide_wait(device, IDE_TIME_OUT); /* can't take over 500 ms */
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* --------------------------------------------------------
|
* --------------------------------------------------------
|
||||||
*
|
*
|
||||||
* NOTE: This driver should be converted to driver model before June 2017.
|
* 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>
|
#include <common.h>
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* Copyright 2013 Broadcom Corporation.
|
* Copyright 2013 Broadcom Corporation.
|
||||||
*
|
*
|
||||||
* NOTE: This driver should be converted to driver model before June 2017.
|
* 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>
|
#include <common.h>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2011, 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
|
* Copyright (C) 2011, 2013 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
|
||||||
*
|
*
|
||||||
* NOTE: This driver should be converted to driver model before June 2017.
|
* 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>
|
#include <common.h>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Neil Russell.
|
* Neil Russell.
|
||||||
*
|
*
|
||||||
* NOTE: This driver should be converted to driver model before June 2017.
|
* 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>
|
#include <common.h>
|
||||||
|
@ -23,6 +23,13 @@ config PWM_IMX
|
|||||||
help
|
help
|
||||||
This PWM is found i.MX27 and later i.MX SoCs.
|
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
|
config PWM_ROCKCHIP
|
||||||
bool "Enable support for the Rockchip PWM"
|
bool "Enable support for the Rockchip PWM"
|
||||||
depends on DM_PWM
|
depends on DM_PWM
|
||||||
|
@ -12,6 +12,7 @@ obj-$(CONFIG_DM_PWM) += pwm-uclass.o
|
|||||||
|
|
||||||
obj-$(CONFIG_PWM_EXYNOS) += exynos_pwm.o
|
obj-$(CONFIG_PWM_EXYNOS) += exynos_pwm.o
|
||||||
obj-$(CONFIG_PWM_IMX) += pwm-imx.o pwm-imx-util.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_ROCKCHIP) += rk_pwm.o
|
||||||
obj-$(CONFIG_PWM_SANDBOX) += sandbox_pwm.o
|
obj-$(CONFIG_PWM_SANDBOX) += sandbox_pwm.o
|
||||||
obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o
|
obj-$(CONFIG_PWM_TEGRA) += tegra_pwm.o
|
||||||
|
188
drivers/pwm/pwm-mtk.c
Normal file
188
drivers/pwm/pwm-mtk.c
Normal file
@ -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),
|
||||||
|
};
|
@ -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;
|
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 {
|
union {
|
||||||
struct arm_smccc_res smccc;
|
struct arm_smccc_res smccc;
|
||||||
@ -527,11 +527,12 @@ static void print_os_revision(optee_invoke_fn *invoke_fn)
|
|||||||
&res.smccc);
|
&res.smccc);
|
||||||
|
|
||||||
if (res.result.build_id)
|
if (res.result.build_id)
|
||||||
debug("OP-TEE revision %lu.%lu (%08lx)\n", res.result.major,
|
dev_info(dev, "OP-TEE: revision %lu.%lu (%08lx)\n",
|
||||||
res.result.minor, res.result.build_id);
|
res.result.major, res.result.minor,
|
||||||
|
res.result.build_id);
|
||||||
else
|
else
|
||||||
debug("OP-TEE revision %lu.%lu\n", res.result.major,
|
dev_info(dev, "OP-TEE: revision %lu.%lu\n",
|
||||||
res.result.minor);
|
res.result.major, res.result.minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool api_revision_is_compatible(optee_invoke_fn *invoke_fn)
|
static bool api_revision_is_compatible(optee_invoke_fn *invoke_fn)
|
||||||
@ -626,7 +627,7 @@ static int optee_probe(struct udevice *dev)
|
|||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_os_revision(pdata->invoke_fn);
|
print_os_revision(dev, pdata->invoke_fn);
|
||||||
|
|
||||||
if (!api_revision_is_compatible(pdata->invoke_fn)) {
|
if (!api_revision_is_compatible(pdata->invoke_fn)) {
|
||||||
debug("%s: OP-TEE api revision mismatch\n", __func__);
|
debug("%s: OP-TEE api revision mismatch\n", __func__);
|
||||||
|
2
env/nvram.c
vendored
2
env/nvram.c
vendored
@ -38,7 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||||||
extern void *nvram_read(void *dest, const long src, size_t count);
|
extern void *nvram_read(void *dest, const long src, size_t count);
|
||||||
extern void nvram_write(long dest, const void *src, size_t count);
|
extern void nvram_write(long dest, const void *src, size_t count);
|
||||||
#else
|
#else
|
||||||
env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
|
static env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
|
#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
|
||||||
|
4
env/remote.c
vendored
4
env/remote.c
vendored
@ -12,9 +12,9 @@
|
|||||||
#include <u-boot/crc.h>
|
#include <u-boot/crc.h>
|
||||||
|
|
||||||
#ifdef ENV_IS_EMBEDDED
|
#ifdef ENV_IS_EMBEDDED
|
||||||
env_t *env_ptr = &environment;
|
static env_t *env_ptr = &environment;
|
||||||
#else /* ! ENV_IS_EMBEDDED */
|
#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 */
|
#endif /* ENV_IS_EMBEDDED */
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
@ -78,6 +78,12 @@ u64 btrfs_read_extent_reg(struct btrfs_path *path,
|
|||||||
if (size > dlen - offset)
|
if (size > dlen - offset)
|
||||||
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);
|
physical = btrfs_map_logical_to_physical(extent->disk_bytenr);
|
||||||
if (physical == -1ULL)
|
if (physical == -1ULL)
|
||||||
return -1ULL;
|
return -1ULL;
|
||||||
|
@ -6,11 +6,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Most of the following information was derived from the document
|
* Most of the following information was derived from the document
|
||||||
* "Information Technology - AT Attachment-3 Interface (ATA-3)"
|
* "Information Technology - AT Attachment-3 Interface (ATA-3)",
|
||||||
* which can be found at:
|
* ANSI X3.298-1997.
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ATA_H
|
#ifndef _ATA_H
|
||||||
@ -70,43 +67,9 @@
|
|||||||
#endif /* ATA_DEVICE */
|
#endif /* ATA_DEVICE */
|
||||||
#define ATA_LBA 0xE0
|
#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
|
* 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_INQUIRY 0x12
|
||||||
#define ATAPI_CMD_REQ_SENSE 0x03
|
#define ATAPI_CMD_REQ_SENSE 0x03
|
||||||
#define ATAPI_CMD_READ_CAP 0x25
|
#define ATAPI_CMD_READ_CAP 0x25
|
||||||
|
@ -452,6 +452,15 @@ typedef struct table_entry {
|
|||||||
char *lname; /* long (output) name to print for messages */
|
char *lname; /* long (output) name to print for messages */
|
||||||
} table_entry_t;
|
} 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
|
* get_table_entry_id() scans the translation table trying to find an
|
||||||
* entry that matches the given short name. If a matching entry is
|
* entry that matches the given short name. If a matching entry is
|
||||||
@ -868,6 +877,18 @@ static inline int image_check_target_arch(const image_header_t *hdr)
|
|||||||
}
|
}
|
||||||
#endif /* USE_HOSTCC */
|
#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
|
* image_decomp() - decompress an image
|
||||||
*
|
*
|
||||||
|
@ -133,49 +133,49 @@ enum {
|
|||||||
ATA_REG_IRQ = ATA_REG_NSECT,
|
ATA_REG_IRQ = ATA_REG_NSECT,
|
||||||
|
|
||||||
/* ATA device commands */
|
/* ATA device commands */
|
||||||
ATA_CMD_DEV_RESET = 0x08, /* ATAPI device reset */
|
ATA_CMD_DEV_RESET = 0x08, /* ATAPI device reset */
|
||||||
ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
|
ATA_CMD_PIO_READ = 0x20, /* Read sectors with retry */
|
||||||
ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
|
ATA_CMD_PIO_READ_EXT = 0x24,
|
||||||
ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
|
ATA_CMD_READ_EXT = 0x25,
|
||||||
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_READ_NATIVE_MAX_EXT = 0x27,
|
ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
|
||||||
ATA_CMD_SET_MAX = 0xF9,
|
ATA_CMD_READ_MULTI_EXT = 0x29,
|
||||||
ATA_CMD_SET_MAX_EXT = 0x37,
|
ATA_CMD_READ_LOG_EXT = 0x2f,
|
||||||
ATA_CMD_READ_LOG_EXT = 0x2f,
|
ATA_CMD_PIO_WRITE = 0x30, /* write sectors with retry */
|
||||||
ATA_CMD_PMP_READ = 0xE4,
|
ATA_CMD_PIO_WRITE_EXT = 0x34,
|
||||||
ATA_CMD_PMP_WRITE = 0xE8,
|
ATA_CMD_WRITE_EXT = 0x35,
|
||||||
ATA_CMD_CONF_OVERLAY = 0xB1,
|
ATA_CMD_SET_MAX_EXT = 0x37,
|
||||||
ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
|
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 */
|
/* READ_LOG_EXT pages */
|
||||||
ATA_LOG_SATA_NCQ = 0x10,
|
ATA_LOG_SATA_NCQ = 0x10,
|
||||||
|
@ -409,6 +409,11 @@ config GZIP
|
|||||||
help
|
help
|
||||||
This enables support for GZIP compression algorithm.
|
This enables support for GZIP compression algorithm.
|
||||||
|
|
||||||
|
config BZIP2
|
||||||
|
bool "Enable bzip2 decompression support"
|
||||||
|
help
|
||||||
|
This enables support for BZIP2 compression algorithm.
|
||||||
|
|
||||||
config ZLIB
|
config ZLIB
|
||||||
bool
|
bool
|
||||||
default y
|
default y
|
||||||
|
226
scripts/documentation-file-ref-check
Executable file
226
scripts/documentation-file-ref-check
Executable file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -423,7 +423,7 @@ class DtbPlatdata(object):
|
|||||||
|
|
||||||
This writes out the body of a header file consisting of structure
|
This writes out the body of a header file consisting of structure
|
||||||
definitions for node in self._valid_nodes. See the documentation in
|
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_header()
|
||||||
self.out('#include <stdbool.h>\n')
|
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
|
U_BOOT_DEVICE() declarations for each valid node. Where a node has
|
||||||
multiple compatible strings, a #define is used to make them equivalent.
|
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.
|
information.
|
||||||
"""
|
"""
|
||||||
self.out_header()
|
self.out_header()
|
||||||
|
@ -22,7 +22,7 @@ Dtoc produces two output files:
|
|||||||
This tool is used in U-Boot to provide device tree data to SPL without
|
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
|
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
|
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
|
from __future__ import print_function
|
||||||
|
@ -642,7 +642,7 @@ static int copyfile(const char *src, const char *dst)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
fd_dst = open(dst, O_WRONLY | O_CREAT, 0700);
|
fd_dst = open(dst, O_WRONLY | O_CREAT, 0666);
|
||||||
if (fd_dst < 0) {
|
if (fd_dst < 0) {
|
||||||
printf("Can't open file %s (%s)\n", dst, strerror(errno));
|
printf("Can't open file %s (%s)\n", dst, strerror(errno));
|
||||||
goto out;
|
goto out;
|
||||||
|
Loading…
Reference in New Issue
Block a user