From 9102efae6ab7d8ee2607b842f2cdf6cbffaadb86 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 11 Jan 2019 21:58:14 -0800 Subject: block: Alias block_op_close() to block_op_flush() The two functions are identical, so there's no need to keep two copies of the same code around. Alias block_op_close() to block_op_flush() and drop standalone definition for the former. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/block.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/common/block.c b/common/block.c index 8d0de42d90..549df71a9d 100644 --- a/common/block.c +++ b/common/block.c @@ -329,13 +329,6 @@ static ssize_t block_op_write(struct cdev *cdev, const void *buf, size_t count, } #endif -static int block_op_close(struct cdev *cdev) -{ - struct block_device *blk = cdev->priv; - - return writebuffer_flush(blk); -} - static int block_op_flush(struct cdev *cdev) { struct block_device *blk = cdev->priv; @@ -343,6 +336,8 @@ static int block_op_flush(struct cdev *cdev) return writebuffer_flush(blk); } +static int block_op_close(struct cdev *cdev) __alias(block_op_flush); + static struct cdev_operations block_ops = { .read = block_op_read, #ifdef CONFIG_BLOCK_WRITE -- cgit v1.2.3 From c19b36aeb723493489ed84930824b65712906dae Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 11 Jan 2019 21:58:15 -0800 Subject: block: Replace debug() with dev_dbg() All of the functions using debug() in that file have enough info to use dev_dbg instead. Convert all of the uses of debug() to dev_dbg() in order to get more informative debug output. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/block.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/common/block.c b/common/block.c index 549df71a9d..35173c65f1 100644 --- a/common/block.c +++ b/common/block.c @@ -76,7 +76,8 @@ static struct chunk *chunk_get_cached(struct block_device *blk, int block) list_for_each_entry(chunk, &blk->buffered_blocks, list) { if (block >= chunk->block_start && block < chunk->block_start + blk->rdbufsize) { - debug("%s: found %d in %d\n", __func__, block, chunk->num); + dev_dbg(blk->dev, "%s: found %d in %d\n", __func__, + block, chunk->num); /* * move most recently used entry to the head of the list */ @@ -153,8 +154,8 @@ static int block_cache(struct block_device *blk, int block) chunk->block_start = block & ~blk->blkmask; - debug("%s: %d to %d\n", __func__, chunk->block_start, - chunk->num); + dev_dbg(blk->dev, "%s: %d to %d\n", __func__, chunk->block_start, + chunk->num); num_blocks = min(blk->rdbufsize, blk->num_blocks - chunk->block_start); @@ -364,8 +365,8 @@ int blockdevice_register(struct block_device *blk) INIT_LIST_HEAD(&blk->idle_blocks); blk->blkmask = blk->rdbufsize - 1; - debug("%s: rdbufsize: %d blockbits: %d blkmask: 0x%08x\n", __func__, blk->rdbufsize, blk->blockbits, - blk->blkmask); + dev_dbg(blk->dev, "rdbufsize: %d blockbits: %d blkmask: 0x%08x\n", + blk->rdbufsize, blk->blockbits, blk->blkmask); for (i = 0; i < 32; i++) { struct chunk *chunk = xzalloc(sizeof(*chunk)); -- cgit v1.2.3 From c0e0503c1284b81c5ccd483d1e8cdb49ab52fd17 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Mon, 14 Jan 2019 23:06:39 +0300 Subject: MIPS: asm/types.h: drop unused stuff Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- arch/mips/include/asm/types.h | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h index cd76f53b50..78068e4113 100644 --- a/arch/mips/include/asm/types.h +++ b/arch/mips/include/asm/types.h @@ -10,39 +10,10 @@ #include -/* - * We don't use int-l64.h for the kernel anymore but still use it for - * userspace to avoid code changes. - */ -#if (_MIPS_SZLONG == 64) && !defined(__KERNEL__) -# include -#else -# include -#endif - #ifndef __ASSEMBLY__ typedef unsigned short umode_t; #endif /* __ASSEMBLY__ */ -/* - * These aren't exported outside the kernel to avoid name space clashes - */ -#ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -/* - * Don't use phys_t. You've been warned. - */ -#ifdef CONFIG_64BIT_PHYS_ADDR -typedef unsigned long long phys_t; -#else -typedef unsigned long phys_t; -#endif - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ - #endif /* _ASM_TYPES_H */ -- cgit v1.2.3 From 9dd59e11e595e648cd9743fe7d6a2b64b44a8b80 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Mon, 14 Jan 2019 23:06:40 +0300 Subject: move umode_t typedef from asm/types.h to linux/types.h Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- arch/arm/include/asm/types.h | 2 -- arch/blackfin/include/asm/types.h | 2 -- arch/mips/include/asm/types.h | 6 ------ arch/nios2/include/asm/types.h | 2 -- arch/openrisc/include/asm/types.h | 2 -- arch/ppc/include/asm/types.h | 2 -- arch/riscv/include/asm/types.h | 2 -- arch/sandbox/include/asm/types.h | 2 -- arch/x86/include/asm/types.h | 2 -- include/linux/types.h | 1 + 10 files changed, 1 insertion(+), 22 deletions(-) diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h index 1a7f47add0..9c21066882 100644 --- a/arch/arm/include/asm/types.h +++ b/arch/arm/include/asm/types.h @@ -3,8 +3,6 @@ #ifndef __ASSEMBLY__ -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/arch/blackfin/include/asm/types.h b/arch/blackfin/include/asm/types.h index e9d73377eb..086da34d7f 100644 --- a/arch/blackfin/include/asm/types.h +++ b/arch/blackfin/include/asm/types.h @@ -30,8 +30,6 @@ */ #ifndef __ASSEMBLY__ -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/arch/mips/include/asm/types.h b/arch/mips/include/asm/types.h index 78068e4113..c635c1aac1 100644 --- a/arch/mips/include/asm/types.h +++ b/arch/mips/include/asm/types.h @@ -10,10 +10,4 @@ #include -#ifndef __ASSEMBLY__ - -typedef unsigned short umode_t; - -#endif /* __ASSEMBLY__ */ - #endif /* _ASM_TYPES_H */ diff --git a/arch/nios2/include/asm/types.h b/arch/nios2/include/asm/types.h index 710ee55796..0067ea83c1 100644 --- a/arch/nios2/include/asm/types.h +++ b/arch/nios2/include/asm/types.h @@ -3,6 +3,4 @@ #include -typedef unsigned short umode_t; - #endif diff --git a/arch/openrisc/include/asm/types.h b/arch/openrisc/include/asm/types.h index 5b6391baf0..8ee6bb00f9 100644 --- a/arch/openrisc/include/asm/types.h +++ b/arch/openrisc/include/asm/types.h @@ -24,8 +24,6 @@ * need to be careful to avoid a name clashes. */ -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/arch/ppc/include/asm/types.h b/arch/ppc/include/asm/types.h index 6eb3877032..2d3ce0a283 100644 --- a/arch/ppc/include/asm/types.h +++ b/arch/ppc/include/asm/types.h @@ -3,8 +3,6 @@ #ifndef __ASSEMBLY__ -typedef unsigned short umode_t; - typedef __signed__ char __s8; typedef unsigned char __u8; diff --git a/arch/riscv/include/asm/types.h b/arch/riscv/include/asm/types.h index ba386ab4c5..8200a03349 100644 --- a/arch/riscv/include/asm/types.h +++ b/arch/riscv/include/asm/types.h @@ -15,8 +15,6 @@ #endif -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/arch/sandbox/include/asm/types.h b/arch/sandbox/include/asm/types.h index 501883f5aa..8426de4cc2 100644 --- a/arch/sandbox/include/asm/types.h +++ b/arch/sandbox/include/asm/types.h @@ -16,8 +16,6 @@ #endif -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/arch/x86/include/asm/types.h b/arch/x86/include/asm/types.h index 3caac398d8..e57ae2c8cf 100644 --- a/arch/x86/include/asm/types.h +++ b/arch/x86/include/asm/types.h @@ -18,8 +18,6 @@ #endif -typedef unsigned short umode_t; - /* * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the * header files exported to user space diff --git a/include/linux/types.h b/include/linux/types.h index ed3a5b6e81..c19d1dc053 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -15,6 +15,7 @@ typedef __kernel_fd_set fd_set; typedef __kernel_dev_t dev_t; typedef __kernel_ino_t ino_t; typedef __kernel_mode_t mode_t; +typedef unsigned short umode_t; typedef __kernel_off_t off_t; typedef __kernel_pid_t pid_t; typedef __kernel_daddr_t daddr_t; -- cgit v1.2.3 From 9f311d59e3736e66b33264271f76f0c0bf9d984d Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Wed, 16 Jan 2019 11:16:00 +0100 Subject: Documentation: state: fix closing brace without opening brace Also fix the resulting sphinx warning: Documentation/user/state.rst:650: WARNING: Explicit markup ends without a blank line; unexpected unindent. Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- Documentation/user/state.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/user/state.rst b/Documentation/user/state.rst index 89129add77..07743df0cb 100644 --- a/Documentation/user/state.rst +++ b/Documentation/user/state.rst @@ -647,7 +647,6 @@ within the EEPROM. }; }; }; -}; With this 'backend' definition it's possible to define the *state* variable set content, its backend-type and *state* variable layout. -- cgit v1.2.3 From a4f623587b779faa9271bf593b3e9a494bda3e49 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Wed, 16 Jan 2019 11:16:01 +0100 Subject: Documentation: i.MX: Kindle 4/5: fix sphinx warnings sphinx warns: Documentation/boards/imx/amazon-kindle-4-5.rst:39: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/boards/imx/amazon-kindle-4-5.rst:42: WARNING: Enumerated list ends without a blank line; unexpected unindent. Documentation/boards/imx/amazon-kindle-4-5.rst:45: WARNING: Enumerated list ends without a blank line; unexpected unindent. Solve this by fixing the list enumeration and adding blank lines. Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- Documentation/boards/imx/amazon-kindle-4-5.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/boards/imx/amazon-kindle-4-5.rst b/Documentation/boards/imx/amazon-kindle-4-5.rst index 58f38a058e..26f072e28d 100644 --- a/Documentation/boards/imx/amazon-kindle-4-5.rst +++ b/Documentation/boards/imx/amazon-kindle-4-5.rst @@ -36,13 +36,15 @@ USB bootloader mode by the SoC microcode: 1. Connect the Kindle to your host computer with a USB cable. 2. Power down the device by holding the power button until the power LED goes dark (about 10 seconds). -4. Hold the power button, and hold down a device-specific special key: +3. Hold the power button, and hold down a device-specific special key: + * the fiveway down button on the model D01100 * the home button on model D01200 + 4. Then release the power button, but still hold the special key. 5. A new USB device named ``NS Blank CODEX`` should appear on your host computer. You can now release the special button. -7. Finally, upload barebox to the Kindle by using: +6. Finally, upload barebox to the Kindle by using: .. code-block:: console -- cgit v1.2.3 From 92367b7b02824c65121b824cd65b4381e66983c9 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 17 Jan 2019 16:41:42 -0800 Subject: lib: strtox: Use plumbing from kstrtox.c Sync up implemenations of simple_str*() functions with their kernel counterparts in order to convert the code to use plumbing from kstrtox.c Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- lib/strtox.c | 102 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 48 insertions(+), 54 deletions(-) diff --git a/lib/strtox.c b/lib/strtox.c index 4b601a1b39..a5b770c8ca 100644 --- a/lib/strtox.c +++ b/lib/strtox.c @@ -1,38 +1,56 @@ #include #include -unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) +#include "kstrtox.h" + +/** + * simple_strtoull - convert a string to an unsigned long long + * @cp: The start of the string + * @endp: A pointer to the end of the parsed string will be placed here + * @base: The number base to use + * + * This function is obsolete. Please use kstrtoull instead. + */ +unsigned long long simple_strtoull(const char *cp, char **endp, + unsigned int base) { - unsigned long result = 0, value; - - if (*cp == '0') { - cp++; - - if ((*cp == 'x') && isxdigit(cp[1])) { - base = 16; - cp++; - } - - if (!base) - base = 8; - } + unsigned long long result; + unsigned int rv; - if (!base) - base = 10; - - while (isxdigit(*cp) && (value = isdigit(*cp) ? - *cp - '0' : toupper(*cp) - 'A' + 10) < base) { - result = result * base + value; - cp++; - } + cp = _parse_integer_fixup_radix(cp, &base); + rv = _parse_integer(cp, base, &result); + /* FIXME */ + cp += (rv & ~KSTRTOX_OVERFLOW); if (endp) *endp = (char *)cp; return result; } +EXPORT_SYMBOL(simple_strtoull); + +/** + * simple_strtoul - convert a string to an unsigned long + * @cp: The start of the string + * @endp: A pointer to the end of the parsed string will be placed here + * @base: The number base to use + * + * This function is obsolete. Please use kstrtoul instead. + */ +unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base) +{ + return simple_strtoull(cp, endp, base); +} EXPORT_SYMBOL(simple_strtoul); +/** + * simple_strtol - convert a string to a signed long + * @cp: The start of the string + * @endp: A pointer to the end of the parsed string will be placed here + * @base: The number base to use + * + * This function is obsolete. Please use kstrtol instead. + */ long simple_strtol(const char *cp, char **endp, unsigned int base) { if (*cp == '-') @@ -42,38 +60,14 @@ long simple_strtol(const char *cp, char **endp, unsigned int base) } EXPORT_SYMBOL(simple_strtol); -unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base) -{ - unsigned long long result = 0, value; - - if (*cp == '0') { - cp++; - - if ((*cp == 'x') && isxdigit(cp[1])) { - base = 16; - cp++; - } - - if (!base) - base = 8; - } - - if (!base) - base = 10; - - while (isxdigit(*cp) && (value = isdigit(*cp) ? - *cp - '0' : toupper(*cp) - 'A' + 10) < base) { - result = result * base + value; - cp++; - } - - if (endp) - *endp = (char *)cp; - - return result; -} -EXPORT_SYMBOL(simple_strtoull); - +/** + * simple_strtoll - convert a string to a signed long long + * @cp: The start of the string + * @endp: A pointer to the end of the parsed string will be placed here + * @base: The number base to use + * + * This function is obsolete. Please use kstrtoll instead. + */ long long simple_strtoll(const char *cp, char **endp, unsigned int base) { if (*cp == '-') -- cgit v1.2.3 From 80e383ce60db5b898d268c4ba141fd12e6787b53 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 19 Jan 2019 00:19:42 +0900 Subject: kconfig: remove unused zconf.hash.c For some reasons, I missed to delete this file in commit 997b70f585ef ("kconfig: sync to Linux 4.20"). Now really synced with Linux 4.20. Signed-off-by: Masahiro Yamada Signed-off-by: Sascha Hauer --- scripts/kconfig/zconf.hash.c | 289 ------------------------------------------- 1 file changed, 289 deletions(-) delete mode 100644 scripts/kconfig/zconf.hash.c diff --git a/scripts/kconfig/zconf.hash.c b/scripts/kconfig/zconf.hash.c deleted file mode 100644 index c77a8eff1e..0000000000 --- a/scripts/kconfig/zconf.hash.c +++ /dev/null @@ -1,289 +0,0 @@ -/* ANSI-C code produced by gperf version 3.0.4 */ -/* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf */ - -#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ - && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ - && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ - && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ - && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ - && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ - && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ - && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ - && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ - && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ - && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ - && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ - && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ - && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ - && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ - && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ - && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ - && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ - && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ - && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ - && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ - && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ - && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) -/* The character set is not based on ISO-646. */ -#error "gperf generated tables don't work with this execution character set. Please report a bug to ." -#endif - -#line 10 "scripts/kconfig/zconf.gperf" -struct kconf_id; - -static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); -/* maximum key range = 71, duplicates = 0 */ - -#ifdef __GNUC__ -__inline -#else -#ifdef __cplusplus -inline -#endif -#endif -static unsigned int -kconf_id_hash (register const char *str, register unsigned int len) -{ - static const unsigned char asso_values[] = - { - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 5, 25, 25, - 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, - 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, - 20, 5, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, - 73, 73, 73, 73, 73, 73 - }; - register int hval = len; - - switch (hval) - { - default: - hval += asso_values[(unsigned char)str[2]]; - /*FALLTHROUGH*/ - case 2: - case 1: - hval += asso_values[(unsigned char)str[0]]; - break; - } - return hval + asso_values[(unsigned char)str[len - 1]]; -} - -struct kconf_id_strings_t - { - char kconf_id_strings_str2[sizeof("if")]; - char kconf_id_strings_str3[sizeof("int")]; - char kconf_id_strings_str5[sizeof("endif")]; - char kconf_id_strings_str7[sizeof("default")]; - char kconf_id_strings_str8[sizeof("tristate")]; - char kconf_id_strings_str9[sizeof("endchoice")]; - char kconf_id_strings_str12[sizeof("def_tristate")]; - char kconf_id_strings_str13[sizeof("def_bool")]; - char kconf_id_strings_str14[sizeof("defconfig_list")]; - char kconf_id_strings_str17[sizeof("on")]; - char kconf_id_strings_str18[sizeof("optional")]; - char kconf_id_strings_str21[sizeof("option")]; - char kconf_id_strings_str22[sizeof("endmenu")]; - char kconf_id_strings_str23[sizeof("mainmenu")]; - char kconf_id_strings_str25[sizeof("menuconfig")]; - char kconf_id_strings_str27[sizeof("modules")]; - char kconf_id_strings_str28[sizeof("allnoconfig_y")]; - char kconf_id_strings_str29[sizeof("menu")]; - char kconf_id_strings_str31[sizeof("select")]; - char kconf_id_strings_str32[sizeof("comment")]; - char kconf_id_strings_str33[sizeof("env")]; - char kconf_id_strings_str35[sizeof("range")]; - char kconf_id_strings_str36[sizeof("choice")]; - char kconf_id_strings_str39[sizeof("bool")]; - char kconf_id_strings_str41[sizeof("source")]; - char kconf_id_strings_str42[sizeof("visible")]; - char kconf_id_strings_str43[sizeof("hex")]; - char kconf_id_strings_str46[sizeof("config")]; - char kconf_id_strings_str47[sizeof("boolean")]; - char kconf_id_strings_str51[sizeof("string")]; - char kconf_id_strings_str54[sizeof("help")]; - char kconf_id_strings_str56[sizeof("prompt")]; - char kconf_id_strings_str72[sizeof("depends")]; - }; -static const struct kconf_id_strings_t kconf_id_strings_contents = - { - "if", - "int", - "endif", - "default", - "tristate", - "endchoice", - "def_tristate", - "def_bool", - "defconfig_list", - "on", - "optional", - "option", - "endmenu", - "mainmenu", - "menuconfig", - "modules", - "allnoconfig_y", - "menu", - "select", - "comment", - "env", - "range", - "choice", - "bool", - "source", - "visible", - "hex", - "config", - "boolean", - "string", - "help", - "prompt", - "depends" - }; -#define kconf_id_strings ((const char *) &kconf_id_strings_contents) -#ifdef __GNUC__ -__inline -#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ -__attribute__ ((__gnu_inline__)) -#endif -#endif -const struct kconf_id * -kconf_id_lookup (register const char *str, register unsigned int len) -{ - enum - { - TOTAL_KEYWORDS = 33, - MIN_WORD_LENGTH = 2, - MAX_WORD_LENGTH = 14, - MIN_HASH_VALUE = 2, - MAX_HASH_VALUE = 72 - }; - - static const struct kconf_id wordlist[] = - { - {-1}, {-1}, -#line 25 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, -#line 36 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, - {-1}, -#line 26 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, - {-1}, -#line 29 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, -#line 31 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, -#line 20 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, - {-1}, {-1}, -#line 32 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE}, -#line 35 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, -#line 45 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION}, - {-1}, {-1}, -#line 43 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM}, -#line 28 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND}, - {-1}, {-1}, -#line 42 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND}, -#line 17 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND}, -#line 15 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_MAINMENU, TF_COMMAND}, - {-1}, -#line 23 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND}, - {-1}, -#line 44 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, -#line 47 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPT_ALLNOCONFIG_Y,TF_OPTION}, -#line 16 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, - {-1}, -#line 39 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, -#line 21 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, -#line 46 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION}, - {-1}, -#line 40 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND}, -#line 19 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND}, - {-1}, {-1}, -#line 33 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN}, - {-1}, -#line 18 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND}, -#line 41 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND}, -#line 37 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX}, - {-1}, {-1}, -#line 22 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND}, -#line 34 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, - {-1}, {-1}, {-1}, -#line 38 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING}, - {-1}, {-1}, -#line 24 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str54, T_HELP, TF_COMMAND}, - {-1}, -#line 30 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str56, T_PROMPT, TF_COMMAND}, - {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, - {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, -#line 27 "scripts/kconfig/zconf.gperf" - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str72, T_DEPENDS, TF_COMMAND} - }; - - if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) - { - register int key = kconf_id_hash (str, len); - - if (key <= MAX_HASH_VALUE && key >= 0) - { - register int o = wordlist[key].name; - if (o >= 0) - { - register const char *s = o + kconf_id_strings; - - if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') - return &wordlist[key]; - } - } - } - return 0; -} -#line 48 "scripts/kconfig/zconf.gperf" - -- cgit v1.2.3 From 167c14cc36e00314341492941b3d41506b53bf22 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 09:23:52 +0300 Subject: treewide: Remove trailing whitespaces and tabs Just a cleanup over barebox tree Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/boards/nxp-imx8mq-evk/ddr_init.c | 4 ++-- arch/arm/mach-imx/include/mach/iomux-mx8.h | 2 +- arch/arm/mach-mvebu/armada-370-xp.c | 6 +++--- common/image-fit.c | 2 +- drivers/clk/imx/clk-imx7.c | 2 +- drivers/efi/efi-device.c | 2 +- drivers/pci/pcie-designware-host.c | 2 +- fs/cramfs/cramfs.c | 2 +- scripts/kconfig/gconf.c | 2 +- scripts/socfpga_mkimage.c | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c b/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c index 44103b5e26..39addea973 100644 --- a/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c +++ b/arch/arm/boards/nxp-imx8mq-evk/ddr_init.c @@ -12,7 +12,7 @@ void ddr_cfg_phy(void); void ddr_init(void) { volatile unsigned int tmp, tmp_t; - + /** Initialize DDR clock and DDRC registers **/ reg32_write(0x3038a088,0x7070000); reg32_write(0x3038a084,0x4030000); @@ -177,7 +177,7 @@ void ddr_init(void) reg32_write(DDRC_SWCTL(0), 0x0000); /* * ------------------- 9 ------------------- - * Set DFIMISC.dfi_init_start to 1 + * Set DFIMISC.dfi_init_start to 1 * ----------------------------------------- */ reg32_write(DDRC_DFIMISC(0), 0x00000030); diff --git a/arch/arm/mach-imx/include/mach/iomux-mx8.h b/arch/arm/mach-imx/include/mach/iomux-mx8.h index 1caa2235b1..9660697d96 100644 --- a/arch/arm/mach-imx/include/mach/iomux-mx8.h +++ b/arch/arm/mach-imx/include/mach/iomux-mx8.h @@ -163,7 +163,7 @@ enum { IMX8MQ_PAD_SD1_DATA5__USDHC1_DATA5 = IOMUX_PAD(0x0324, 0x00BC, 0, 0x0000, 0, 0), IMX8MQ_PAD_SD1_DATA5__GPIO2_IO7 = IOMUX_PAD(0x0324, 0x00BC, 5, 0x0000, 0, 0), - IMX8MQ_PAD_SD1_DATA6__USDHC1_DATA6 = IOMUX_PAD(0x0328, 0x00C0, 0, 0x0000, 0, 0), + IMX8MQ_PAD_SD1_DATA6__USDHC1_DATA6 = IOMUX_PAD(0x0328, 0x00C0, 0, 0x0000, 0, 0), IMX8MQ_PAD_SD1_DATA6__GPIO2_IO8 = IOMUX_PAD(0x0328, 0x00C0, 5, 0x0000, 0, 0), IMX8MQ_PAD_SD1_DATA7__USDHC1_DATA7 = IOMUX_PAD(0x032C, 0x00C4, 0, 0x0000, 0, 0), diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c index 0612830025..2589f4fe72 100644 --- a/arch/arm/mach-mvebu/armada-370-xp.c +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -105,12 +105,12 @@ static void setup_usb_phys(void) /* Power up PLL and PHY channel */ setbits_le32(MV_USB_PHY_PLL_REG(2), BIT(9)); - + /* Assert VCOCAL_START */ setbits_le32(MV_USB_PHY_PLL_REG(1), BIT(21)); - + mdelay(1); - + /* * USB PHY init (change from defaults) specific for 40nm (78X30 78X60) */ diff --git a/common/image-fit.c b/common/image-fit.c index 87a55b7e27..6ac4644686 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -368,7 +368,7 @@ static int fit_verify_signature(struct device_node *sig_node, const void *fit) out_sl: string_list_free(&inc_nodes); string_list_free(&exc_props); - + return ret; } diff --git a/drivers/clk/imx/clk-imx7.c b/drivers/clk/imx/clk-imx7.c index 97fe7abda2..781bc43e09 100644 --- a/drivers/clk/imx/clk-imx7.c +++ b/drivers/clk/imx/clk-imx7.c @@ -743,7 +743,7 @@ static int imx7_ccm_probe(struct device_d *dev) "enet_axi_post_div", base + 0x4700, 0); clks[IMX7D_ENET1_TIME_ROOT_CLK] = imx_clk_gate2_shared2("enet1_time_root_clk", "enet1_time_post_div", base + 0x4700, 0); - clks[IMX7D_ENET2_IPG_ROOT_CLK] = imx_clk_gate2_shared2("enet2_ipg_root_clk", + clks[IMX7D_ENET2_IPG_ROOT_CLK] = imx_clk_gate2_shared2("enet2_ipg_root_clk", "enet_axi_post_div", base + 0x4710, 0); clks[IMX7D_ENET2_TIME_ROOT_CLK] = imx_clk_gate2_shared2("enet2_time_root_clk", "enet2_time_post_div", base + 0x4710, 0); diff --git a/drivers/efi/efi-device.c b/drivers/efi/efi-device.c index b7dea7c822..5cc68fb781 100644 --- a/drivers/efi/efi-device.c +++ b/drivers/efi/efi-device.c @@ -551,7 +551,7 @@ static int do_efi_protocol_dump(int argc, char **argv) if (len != 36) return -EINVAL; - + read_xbit(s, a, 32); if (*s != '-') return -EINVAL; diff --git a/drivers/pci/pcie-designware-host.c b/drivers/pci/pcie-designware-host.c index 6cc4b93a31..cc6a41be0c 100644 --- a/drivers/pci/pcie-designware-host.c +++ b/drivers/pci/pcie-designware-host.c @@ -391,7 +391,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) pci->iatu_unroll_enabled = dw_pcie_iatu_unroll_enabled(pci); dev_dbg(pci->dev, "iATU unroll: %s\n", pci->iatu_unroll_enabled ? "enabled" : "disabled"); - + dw_pcie_prog_outbound_atu(pci, PCIE_ATU_REGION_INDEX0, PCIE_ATU_TYPE_MEM, pp->mem_mod_base, pp->mem_bus_addr, pp->mem_size); diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index a3ce354c92..093657f62c 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -335,7 +335,7 @@ static struct inode *cramfs_alloc_inode(struct super_block *sb) struct cramfs_inode_info *info; info = xzalloc(sizeof(*info)); - + return &info->i_inode; } diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 36f578415c..0ac700bf12 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c @@ -640,7 +640,7 @@ on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data) void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *dialog; - const gchar *intro_text = + const gchar *intro_text = "Welcome to gkc, the GTK+ graphical configuration tool\n" "For each option, a blank box indicates the feature is disabled, a\n" "check indicates it is enabled, and a dot indicates that it is to\n" diff --git a/scripts/socfpga_mkimage.c b/scripts/socfpga_mkimage.c index fedcfb5b6f..03150cce8d 100644 --- a/scripts/socfpga_mkimage.c +++ b/scripts/socfpga_mkimage.c @@ -157,7 +157,7 @@ uint32_t crc32(uint32_t crc, void *_buf, int length) return crc; } -/* Create an ARM relative branch instuction +/* Create an ARM relative branch instuction * branch is where the instruction will be placed and dest points to where * it should branch too. */ static void branch(uint8_t *branch, uint8_t *dest) -- cgit v1.2.3 From a312a3d38af24c708a4166a69a5a6a8da87d2632 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 06:50:22 +0300 Subject: ARM: qemu-virt64: Remove orphan Kconfig arch/arm/boards/qemu-virt64/Kconfig is not used by build system, so it can be removed. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/boards/qemu-virt64/Kconfig | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 arch/arm/boards/qemu-virt64/Kconfig diff --git a/arch/arm/boards/qemu-virt64/Kconfig b/arch/arm/boards/qemu-virt64/Kconfig deleted file mode 100644 index b7bee3a245..0000000000 --- a/arch/arm/boards/qemu-virt64/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ - -if MACH_QEMU - -config ARCH_TEXT_BASE - hex - default 0x40000000 - -endif -- cgit v1.2.3 From 830ab7cb6633dadfbfbe870693508d07351f3dc8 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 06:50:23 +0300 Subject: ARM: omap: Remove reference to non-existent HAVE_DEFAULT_ENVIRONMENT_NEW symbol Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-omap/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig index e793175f38..49ca0ee157 100644 --- a/arch/arm/mach-omap/Kconfig +++ b/arch/arm/mach-omap/Kconfig @@ -186,7 +186,6 @@ config MACH_VSCOM_BALTOS config MACH_WAGO_PFC_AM35XX bool "Wago PFC200 Fieldbus Controller" select ARCH_AM35XX - select HAVE_DEFAULT_ENVIRONMENT_NEW select HAVE_PBL_MULTI_IMAGES select HAVE_CONFIGURABLE_MEMORY_LAYOUT help -- cgit v1.2.3 From d90948f2bd1f9462a765c665c45c643ab4a15deb Mon Sep 17 00:00:00 2001 From: Vivien Didelot Date: Fri, 18 Jan 2019 19:50:18 -0500 Subject: defaultenv-2: trigger DHCP before booting 'net' Some variables may be set from DHCP requests, as shown below: barebox@ZII VF610 Development Board, Rev C:/ echo $global.hostname dev-rev-c barebox@ZII VF610 Development Board, Rev C:/ echo $global.net.server 0.0.0.0 barebox@ZII VF610 Development Board, Rev C:/ dhcp eth0: 100Mbps full duplex link detected T T T eth0: DHCP client bound to address 192.168.203.31 barebox@ZII VF610 Development Board, Rev C:/ echo $global.hostname zii-dev-rev-c-1 barebox@ZII VF610 Development Board, Rev C:/ echo $global.net.server 192.168.203.1 barebox@ZII VF610 Development Board, Rev C:/ These variables are used by the boot/net script, so it is necessary to trigger DHCP before we set the TFTP file paths, otherwise booting from net will fail like below and will need to be triggered twice: running /env/bin/init... Hit m for menu or any key to stop autoboot: 1 booting 'net' eth0: 100Mbps full duplex link detected T T T eth0: DHCP client bound to address 192.168.203.31 WARNING: eth1: No MAC address set. Using random address 8a:ee:18:f5:98:e7 T T T T T T T T T T T T T T T T T T T T could not open /mnt/tftp/none-linux-dev-rev-c: No such file or directory ERROR: Booting 'net' failed: No such file or directory boot: No such file or directory type exit to get to the menu barebox@ZII VF610 Development Board, Rev C:/ boot booting 'net' Loading ARM Linux zImage '/mnt/tftp/none-linux-zii-dev-rev-c-1' Loaded initrd unknown '/mnt/tftp/none-initramfs-zii-dev-rev-c-1' initrd is at 0x82509000-0x835593ff Loading devicetree from '/mnt/tftp/none-oftree-zii-dev-rev-c-1' commandline: console=ttyLP0,115200n8 ip=dhcp Ucompressing Linux... done, booting the kernel. To fix this, bring the interfaces up before setting up tftpboot. Signed-off-by: Vivien Didelot Signed-off-by: Sascha Hauer --- defaultenv/defaultenv-2-base/boot/net | 3 +++ 1 file changed, 3 insertions(+) diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net index f8895290ad..26e931ce63 100644 --- a/defaultenv/defaultenv-2-base/boot/net +++ b/defaultenv/defaultenv-2-base/boot/net @@ -2,6 +2,9 @@ path="/mnt/tftp" +# global.net.server and global.hostname may be set by DHCP, so trigger it first +ifup -a + global.bootm.image="${path}/${global.user}-linux-${global.hostname}" oftree="${path}/${global.user}-oftree-${global.hostname}" -- cgit v1.2.3 From 7083e6b9f750f956c11984ed2ae1809e709b90e0 Mon Sep 17 00:00:00 2001 From: Vivien Didelot Date: Fri, 18 Jan 2019 19:50:39 -0500 Subject: defaultenv-2: centralize nfs commands for 'net' Setting the nfsroot variable as well as the kernel bootargs for the interface used to reach the server is specific to nfs, which are used only if there's no initramfs to load from tftp. Move these statements within the condition. Signed-off-by: Vivien Didelot Signed-off-by: Sascha Hauer --- defaultenv/defaultenv-2-base/boot/net | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/defaultenv/defaultenv-2-base/boot/net b/defaultenv/defaultenv-2-base/boot/net index 26e931ce63..e79432eb27 100644 --- a/defaultenv/defaultenv-2-base/boot/net +++ b/defaultenv/defaultenv-2-base/boot/net @@ -18,13 +18,11 @@ if [ $? != 0 ]; then exit 1 fi -nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}" - -ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip - initramfs="${path}/${global.user}-initramfs-${global.hostname}" if [ -f "${initramfs}" ]; then global.bootm.initrd="$initramfs" else + nfsroot="${nfsserver}:/home/${global.user}/nfsroot/${global.hostname}" + ip_route_get -b ${global.net.server} global.linux.bootargs.dyn.ip global.linux.bootargs.dyn.root="root=/dev/nfs nfsroot=$nfsroot,v3,tcp" fi -- cgit v1.2.3 From 662ff5a3558e81e3f15678acb7999669c03ac75e Mon Sep 17 00:00:00 2001 From: Vivien Didelot Date: Fri, 18 Jan 2019 19:50:51 -0500 Subject: boot: make it a little bit less verbose The current boot code prints too much error messages without much value in them. This patch prints the error string when it makes sense and simplifies the return path of bootscript_boot(). Make use of pr_err() in boot_entry() which is the shared code responsible for calling the boot_entry->boot callback. Remove the unnecessary print statement from bootsource_action() as well. This removes a single print statement ATM, allowing us to go from this: booting 'sd' Cannot set parameter mci0.probe: No such device running automount command 'mci${global.sd}.probe=1 && mount /dev/disk${global.sd}.0 /mnt/sd' failed could not open /mnt/sd/zImage: No such device ERROR: Booting 'sd' failed: No such device booting 'sd' failed: No such device boot: No such device to this: Booting entry 'sd' Cannot set parameter mci0.probe: No such device running automount command 'mci${global.sd}.probe=1 && mount /dev/disk${global.sd}.0 /mnt/sd' failed could not open /mnt/sd/zImage: No such device ERROR: Booting entry 'sd' failed boot: No such device Signed-off-by: Vivien Didelot Signed-off-by: Sascha Hauer --- common/boot.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/common/boot.c b/common/boot.c index 41bf1ce64b..974eaf5d02 100644 --- a/common/boot.c +++ b/common/boot.c @@ -96,8 +96,8 @@ static int bootscript_boot(struct bootentry *entry, int verbose, int dryrun) ret = run_command(bs->scriptpath); if (ret) { - printf("Running %s failed\n", bs->scriptpath); - goto out; + pr_err("Running script '%s' failed: %s\n", bs->scriptpath, strerror(-ret)); + return ret; } bootm_data_init_defaults(&data); @@ -107,11 +107,7 @@ static int bootscript_boot(struct bootentry *entry, int verbose, int dryrun) if (dryrun) data.dryrun = dryrun; - ret = bootm_boot(&data); - if (ret) - pr_err("Booting '%s' failed: %s\n", basename(bs->scriptpath), strerror(-ret)); -out: - return ret; + return bootm_boot(&data); } static unsigned int boot_watchdog_timeout; @@ -135,7 +131,7 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun) { int ret; - printf("booting '%s'\n", be->title); + printf("Booting entry '%s'\n", be->title); if (IS_ENABLED(CONFIG_WATCHDOG) && boot_watchdog_timeout) { ret = watchdog_set_timeout(boot_watchdog_timeout); @@ -144,9 +140,8 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun) } ret = be->boot(be, verbose, dryrun); - if (ret) - printf("booting '%s' failed: %s\n", be->title, strerror(-ret)); + pr_err("Booting entry '%s' failed\n", be->title); return ret; } @@ -154,11 +149,8 @@ int boot_entry(struct bootentry *be, int verbose, int dryrun) static void bootsource_action(struct menu *m, struct menu_entry *me) { struct bootentry *be = container_of(me, struct bootentry, me); - int ret; - ret = boot_entry(be, 0, 0); - if (ret) - printf("Booting failed with: %s\n", strerror(-ret)); + boot_entry(be, 0, 0); printf("Press any key to continue\n"); -- cgit v1.2.3 From 1ccf0a57cf8a9b4090e32307d5cfac855cd38b6f Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:24 +0300 Subject: ARM: mvebu: delete unused mach/kirkwood.h This removes the stale mach/kirkwood.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-mvebu/include/mach/kirkwood.h | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 arch/arm/mach-mvebu/include/mach/kirkwood.h diff --git a/arch/arm/mach-mvebu/include/mach/kirkwood.h b/arch/arm/mach-mvebu/include/mach/kirkwood.h deleted file mode 100644 index 7fe002d44d..0000000000 --- a/arch/arm/mach-mvebu/include/mach/kirkwood.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2013 Thomas Petazzoni - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef __MACH_KIRKWOOD_H -#define __MACH_KIRKWOOD_H - -int kirkwood_add_uart0(void); -void __naked __noreturn kirkwood_barebox_entry(void); - -#endif /* __MACH_KIRKWOOD_H */ -- cgit v1.2.3 From a11be08e73d8cfafa24178d309ca9c3a957195ad Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:26 +0300 Subject: ARM: omap: delete unused mach/am33xx-devices.h This removes the stale mach/am33xx-devices.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-omap/include/mach/am33xx-devices.h | 80 ------------------------ 1 file changed, 80 deletions(-) delete mode 100644 arch/arm/mach-omap/include/mach/am33xx-devices.h diff --git a/arch/arm/mach-omap/include/mach/am33xx-devices.h b/arch/arm/mach-omap/include/mach/am33xx-devices.h deleted file mode 100644 index 4790071c98..0000000000 --- a/arch/arm/mach-omap/include/mach/am33xx-devices.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef __MACH_OMAP3_DEVICES_H -#define __MACH_OMAP3_DEVICES_H - -#include -#include -#include -#include -#include -#include - -/* the device numbering is the same as in the TRM memory map (SPRUH73G) */ - -static inline struct device_d *am33xx_add_uart0(void) -{ - return omap_add_uart(0, AM33XX_UART0_BASE); -} - -static inline struct device_d *am33xx_add_uart1(void) -{ - return omap_add_uart(1, AM33XX_UART1_BASE); -} - -static inline struct device_d *am33xx_add_uart2(void) -{ - return omap_add_uart(2, AM33XX_UART2_BASE); -} - -static inline struct device_d *am33xx_add_mmc0(struct omap_hsmmc_platform_data *pdata) -{ - return add_generic_device("omap4-hsmmc", 0, NULL, - AM33XX_MMCHS0_BASE, SZ_4K, IORESOURCE_MEM, pdata); -} - -static inline struct device_d *am33xx_add_mmc1(struct omap_hsmmc_platform_data *pdata) -{ - return add_generic_device("omap4-hsmmc", 1, NULL, - AM33XX_MMC1_BASE, SZ_4K, IORESOURCE_MEM, pdata); -} - -static inline struct device_d *am33xx_add_cpsw(struct cpsw_platform_data *cpsw_data) -{ - return add_generic_device("cpsw", 0, NULL, - AM335X_CPSW_BASE, SZ_32K, IORESOURCE_MEM, cpsw_data); -} - -static inline struct device_d *am33xx_add_spi(int id, resource_size_t start) -{ - return add_generic_device("omap4-spi", id, NULL, start, SZ_4K, - IORESOURCE_MEM, NULL); -} - -static inline struct device_d *am33xx_add_spi0(void) -{ - return am33xx_add_spi(0, AM33XX_MCSPI0_BASE); -} - -static inline struct device_d *am33xx_add_spi1(void) -{ - return am33xx_add_spi(1, AM33XX_MCSPI1_BASE); -} - -static inline struct device_d *am33xx_add_i2c0(void *pdata) -{ - return add_generic_device("i2c-am33xx", 0, NULL, AM33XX_I2C0_BASE, - SZ_4K, IORESOURCE_MEM, pdata); -} - -static inline struct device_d *am33xx_add_i2c1(void *pdata) -{ - return add_generic_device("i2c-am33xx", 1, NULL, AM33XX_I2C1_BASE, - SZ_4K, IORESOURCE_MEM, pdata); -} - -static inline struct device_d *am33xx_add_i2c2(void *pdata) -{ - return add_generic_device("i2c-am33xx", 2, NULL, AM33XX_I2C2_BASE, - SZ_4K, IORESOURCE_MEM, pdata); -} - -#endif /* __MACH_OMAP3_DEVICES_H */ -- cgit v1.2.3 From 2e2180acab939322eae7c5b1a0d37e8f8cf685d6 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:28 +0300 Subject: ARM: imx: delete unused mach/clock-imx1.h This removes the stale mach/clock-imx1.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-imx/include/mach/clock-imx1.h | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 arch/arm/mach-imx/include/mach/clock-imx1.h diff --git a/arch/arm/mach-imx/include/mach/clock-imx1.h b/arch/arm/mach-imx/include/mach/clock-imx1.h deleted file mode 100644 index 8d456b84b2..0000000000 --- a/arch/arm/mach-imx/include/mach/clock-imx1.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifndef ASM_ARCH_CLOCK_IMX1_H -#define ASM_ARCH_CLOCK_IMX1_H - -#endif /* ASM_ARCH_CLOCK_IMX1_H */ - -- cgit v1.2.3 From 6094ee2c198dbad0ab15b059db0b69ec400325be Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:29 +0300 Subject: ARM: mvebu: delete unused mach/dove.h This removes the stale mach/dove.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-mvebu/include/mach/dove.h | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 arch/arm/mach-mvebu/include/mach/dove.h diff --git a/arch/arm/mach-mvebu/include/mach/dove.h b/arch/arm/mach-mvebu/include/mach/dove.h deleted file mode 100644 index 1712fa7a1d..0000000000 --- a/arch/arm/mach-mvebu/include/mach/dove.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright - * (C) 2013 Sebastian Hesselbarth - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#ifndef __MACH_MVEBU_DOVE_H -#define __MACH_MVEBU_DOVE_H - -int dove_add_uart(int num); -void __naked __noreturn dove_barebox_entry(void); - -#endif /* __MACH_MVEBU_DOVE_H */ -- cgit v1.2.3 From 695eb20a47f0d258ff3b0221c9504283f19a0439 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:30 +0300 Subject: PPC: delete unused asm/e300.h This removes the stale asm/e300.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/ppc/include/asm/e300.h | 130 -------------------------------------------- 1 file changed, 130 deletions(-) delete mode 100644 arch/ppc/include/asm/e300.h diff --git a/arch/ppc/include/asm/e300.h b/arch/ppc/include/asm/e300.h deleted file mode 100644 index 79dcae416f..0000000000 --- a/arch/ppc/include/asm/e300.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2004 Freescale Semiconductor, Inc. - * Liberty Eran (liberty@freescale.com) - */ - -#ifndef __E300_H__ -#define __E300_H__ - -/* - * e300 Processor Version & Revision Numbers - */ -#define PVR_83xx 0x80830000 -#define PVR_8349_REV10 (PVR_83xx | 0x0010) -#define PVR_8349_REV11 (PVR_83xx | 0x0011) -#define PVR_8360_REV10 (PVR_83xx | 0x0020) -#define PVR_8360_REV11 (PVR_83xx | 0x0020) - -/* - * Hardware Implementation-Dependent Register 0 (HID0) - */ - -/* #define HID0 1008 already defined in processor.h */ -#define HID0_MASK_MACHINE_CHECK 0x00000000 -#define HID0_ENABLE_MACHINE_CHECK 0x80000000 - -#define HID0_DISABLE_CACHE_PARITY 0x00000000 -#define HID0_ENABLE_CACHE_PARITY 0x40000000 - -#define HID0_DISABLE_ADDRESS_PARITY 0x00000000 /* on mpc8349ads must be disabled */ -#define HID0_ENABLE_ADDRESS_PARITY 0x20000000 - -#define HID0_DISABLE_DATA_PARITY 0x00000000 /* on mpc8349ads must be disabled */ -#define HID0_ENABLE_DATE_PARITY 0x10000000 - -#define HID0_CORE_CLK_OUT 0x00000000 -#define HID0_CORE_CLK_OUT_DIV_2 0x08000000 - -#define HID0_ENABLE_ARTRY_OUT_PRECHARGE 0x00000000 /* on mpc8349ads must be enabled */ -#define HID0_DISABLE_ARTRY_OUT_PRECHARGE 0x01000000 - -#define HID0_DISABLE_DOSE_MODE 0x00000000 -#define HID0_ENABLE_DOSE_MODE 0x00800000 - -#define HID0_DISABLE_NAP_MODE 0x00000000 -#define HID0_ENABLE_NAP_MODE 0x00400000 - -#define HID0_DISABLE_SLEEP_MODE 0x00000000 -#define HID0_ENABLE_SLEEP_MODE 0x00200000 - -#define HID0_DISABLE_DYNAMIC_POWER_MANAGMENT 0x00000000 -#define HID0_ENABLE_DYNAMIC_POWER_MANAGMENT 0x00100000 - -#define HID0_SOFT_RESET 0x00010000 - -#define HID0_DISABLE_INSTRUCTION_CACHE 0x00000000 -#define HID0_ENABLE_INSTRUCTION_CACHE 0x00008000 - -#define HID0_DISABLE_DATA_CACHE 0x00000000 -#define HID0_ENABLE_DATA_CACHE 0x00004000 - -#define HID0_LOCK_INSTRUCTION_CACHE 0x00002000 - -#define HID0_LOCK_DATA_CACHE 0x00001000 - -#define HID0_INVALIDATE_INSTRUCTION_CACHE 0x00000800 - -#define HID0_INVALIDATE_DATA_CACHE 0x00000400 - -#define HID0_DISABLE_M_BIT 0x00000000 -#define HID0_ENABLE_M_BIT 0x00000080 - -#define HID0_FBIOB 0x00000010 - -#define HID0_DISABLE_ADDRESS_BROADCAST 0x00000000 -#define HID0_ENABLE_ADDRESS_BROADCAST 0x00000008 - -#define HID0_ENABLE_NOOP_DCACHE_INSTRUCTION 0x00000000 -#define HID0_DISABLE_NOOP_DCACHE_INSTRUCTION 0x00000001 - -/* - * Hardware Implementation-Dependent Register 2 (HID2) - */ -#define HID2 1011 - -#define HID2_LET 0x08000000 -#define HID2_HBE 0x00040000 -#define HID2_IWLCK_000 0x00000000 /* no ways locked */ -#define HID2_IWLCK_001 0x00002000 /* way 0 locked */ -#define HID2_IWLCK_010 0x00004000 /* way 0 through way 1 locked */ -#define HID2_IWLCK_011 0x00006000 /* way 0 through way 2 locked */ -#define HID2_IWLCK_100 0x00008000 /* way 0 through way 3 locked */ -#define HID2_IWLCK_101 0x0000A000 /* way 0 through way 4 locked */ -#define HID2_IWLCK_110 0x0000C000 /* way 0 through way 5 locked */ - - -/* BAT (block address translation */ -#define BATU_BEPI_MSK 0xfffe0000 -#define BATU_BL_MSK 0x00001ffc - -#define BATU_BL_128K 0x00000000 -#define BATU_BL_256K 0x00000004 -#define BATU_BL_512K 0x0000000c -#define BATU_BL_1M 0x0000001c -#define BATU_BL_2M 0x0000003c -#define BATU_BL_4M 0x0000007c -#define BATU_BL_8M 0x000000fc -#define BATU_BL_16M 0x000001fc -#define BATU_BL_32M 0x000003fc -#define BATU_BL_64M 0x000007fc -#define BATU_BL_128M 0x00000ffc -#define BATU_BL_256M 0x00001ffc - -#define BATU_VS 0x00000002 -#define BATU_VP 0x00000001 - -#define BATL_BRPN_MSK 0xfffe0000 -#define BATL_WIMG_MSK 0x00000078 - -#define BATL_WRITETHROUGH 0x00000040 -#define BATL_CACHEINHIBIT 0x00000020 -#define BATL_MEMCOHERENCE 0x00000010 -#define BATL_GUARDEDSTORAGE 0x00000008 - -#define BATL_PP_MSK 0x00000003 -#define BATL_PP_00 0x00000000 /* No access */ -#define BATL_PP_01 0x00000001 /* Read-only */ -#define BATL_PP_10 0x00000002 /* Read-write */ -#define BATL_PP_11 0x00000003 - -#endif /* __E300_H__ */ -- cgit v1.2.3 From f9f68dac47fd603777e20a5d1ca998ddec6e1e58 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:31 +0300 Subject: PPC: delete unused asm/mc146818rtc.h This removes the stale asm/mc146818rtc.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/ppc/include/asm/mc146818rtc.h | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 arch/ppc/include/asm/mc146818rtc.h diff --git a/arch/ppc/include/asm/mc146818rtc.h b/arch/ppc/include/asm/mc146818rtc.h deleted file mode 100644 index adc4e24db7..0000000000 --- a/arch/ppc/include/asm/mc146818rtc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef __ASM_PPC_MC146818RTC_H -#define __ASM_PPC_MC146818RTC_H - -#include - -#ifndef RTC_PORT -#define RTC_PORT(x) (0x70 + (x)) -#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ -#endif - -/* - * The yet supported machines all access the RTC index register via - * an ISA port access but the way to access the date register differs ... - */ -#define CMOS_READ(addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -inb_p(RTC_PORT(1)); \ -}) -#define CMOS_WRITE(val, addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -outb_p((val),RTC_PORT(1)); \ -}) - -#endif /* __ASM_PPC_MC146818RTC_H */ -- cgit v1.2.3 From f722f2a12ae40a1c5975f1b36647ce1a3864cb0a Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:32 +0300 Subject: ARM: at91: delete unused mach/sama5d3_matrix.h This removes the stale mach/sama5d3_matrix.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-at91/include/mach/sama5d3_matrix.h | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/sama5d3_matrix.h diff --git a/arch/arm/mach-at91/include/mach/sama5d3_matrix.h b/arch/arm/mach-at91/include/mach/sama5d3_matrix.h deleted file mode 100644 index 8176b38bd3..0000000000 --- a/arch/arm/mach-at91/include/mach/sama5d3_matrix.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Matrix-centric header file for the SAMA5D3 family - * - * Copyright (C) 2009-2012 Atmel Corporation. - * - * Only EBI related registers. - * Write Protect register definitions may be useful. - * - * Licensed under GPLv2 or later. - */ - -#ifndef SAMA5D3_MATRIX_H -#define SAMA5D3_MATRIX_H - -#endif -- cgit v1.2.3 From 50f2adf72ca6ad796c2b2ab147a1b6e5968eba46 Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sun, 20 Jan 2019 13:35:33 +0300 Subject: ARM: netx: delete unused netx-devices.h This removes the stale netx-devices.h include as there is no user of it. Signed-off-by: Alexander Shiyan Signed-off-by: Sascha Hauer --- arch/arm/mach-netx/include/mach/netx-devices.h | 73 -------------------------- 1 file changed, 73 deletions(-) delete mode 100644 arch/arm/mach-netx/include/mach/netx-devices.h diff --git a/arch/arm/mach-netx/include/mach/netx-devices.h b/arch/arm/mach-netx/include/mach/netx-devices.h deleted file mode 100644 index 9c64adb5da..0000000000 --- a/arch/arm/mach-netx/include/mach/netx-devices.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * (c) 2012 Pengutronix, Juergen Beisert - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#ifndef _NETX_DEVICES_H -# define _NETX_DEVICES_H - -#include - -static inline struct device_d *netx_add_uart(resource_size_t base, int index) -{ - return add_generic_device("netx_serial", index, NULL, - base, 0x40, IORESOURCE_MEM, NULL); -} - -static inline struct device_d *netx_add_uart0(void) -{ - return netx_add_uart(NETX_PA_UART0, 0); -} - -static inline struct device_d *netx_add_uart1(void) -{ - return netx_add_uart(NETX_PA_UART1, 1); -} - -static inline struct device_d *netx_add_uart3(void) -{ - return netx_add_uart(NETX_PA_UART2, 2); -} - -/* parallel flash connected to the SRAM interface */ -static inline struct device_d *netx_add_pflash(resource_size_t size) -{ - return add_cfi_flash_device(0, NETX_CS0_BASE, size, 0); -} - -static inline struct device_d *netx_add_eth(int index, void *pdata) -{ - return add_generic_device("netx-eth", index, NULL, - 0, 0, IORESOURCE_MEM, pdata); -} - -static inline struct device_d *netx_add_eth0(void *pdata) -{ - return netx_add_eth(0, pdata); -} - -static inline struct device_d *netx_add_eth1(void *pdata) -{ - return netx_add_eth(1, pdata); -} - -static inline struct device_d *netx_add_eth2(void *pdata) -{ - return netx_add_eth(2, pdata); -} - -static inline struct device_d *netx_add_eth3(void *pdata) -{ - return netx_add_eth(3, pdata); -} - -#endif /* _NETX_DEVICES_H */ -- cgit v1.2.3 From cee4c2a064796db730c572bf8973e799c1b89b02 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Mon, 21 Jan 2019 17:56:16 +0100 Subject: ubi: prevent null pointer reference After flashing a bogus UBI image, e.g. when the UBI is bigger than the available flash size, it can happen that barebox hangs itself with a stacktrace when the board code or the environment does a ubi_attach() on boot: ERROR: ubi0 error: init_volumes: not enough PEBs, required 7478, available 4024 unable to handle NULL pointer dereference at address 0x00000204 pc : [<1fd1eaf2>] lr : [<1fd15aad>] sp : 1feefd30 ip : 0000000a fp : 1fd5d1d7 r10: 00001d34 r9 : 00000000 r8 : 1fd5d540 r7 : 14983148 r6 : 00000006 r5 : ffffffe4 r4 : 14983004 r3 : 1fd82bfc r2 : 021f0000 r1 : 0000000a r0 : 00000000 Flags: nzcv IRQs off FIQs off Mode SVC_32 [<1fd1eaf2>] (ubi_fastmap_destroy_checkmap+0x8/0xa) from [<1fd15aad>] (ubi_read_volume_table+0x4d9/0x71c) [<1fd15aad>] (ubi_read_volume_table+0x4d9/0x71c) from [<1fd1cbf7>] (ubi_attach+0x157/0x1f8) [<1fd1cbf7>] (ubi_attach+0x157/0x1f8) from [<1fd16ec3>] (ubi_attach_mtd_dev+0x4a3/0x954) [...] After this change, barebox at least boots to a prompt where the faulty flash can be repaired: ERROR: ubi0 error: init_volumes: not enough PEBs, required 7478, available 4024 ERROR: ubi0 error: ubi_attach_mtd_dev: failed to attach mtd0, error -28 [...] running /env/bin/init... barebox@boardname:/ Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- drivers/mtd/ubi/fastmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 84c2912bf5..32b60ccad8 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -1051,7 +1051,8 @@ int ubi_fastmap_init_checkmap(struct ubi_volume *vol, int leb_count) void ubi_fastmap_destroy_checkmap(struct ubi_volume *vol) { - kfree(vol->checkmap); + if (vol) + kfree(vol->checkmap); } /** -- cgit v1.2.3 From 17c4b989a5d00fe5fc84c528bbd59583c45d80d0 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 21 Jan 2019 22:06:24 -0800 Subject: block: Do not write past block device boundary during a flush When calling I/O functions of underlying block device driver we always need to make sure that its size is small enough to not go past device's boundary. Not only in get_chunk() and block_cache(), but in writebuffer_flush() as well. Since the same code is used in three different places, move it into a subroutine and adjust all of the calls to ->write()/->read() accordingly. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/block.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/common/block.c b/common/block.c index 35173c65f1..3a031a4fc7 100644 --- a/common/block.c +++ b/common/block.c @@ -38,6 +38,11 @@ struct chunk { #define BUFSIZE (PAGE_SIZE * 4) +static int writebuffer_io_len(struct block_device *blk, struct chunk *chunk) +{ + return min(blk->rdbufsize, blk->num_blocks - chunk->block_start); +} + /* * Write all dirty chunks back to the device */ @@ -51,7 +56,9 @@ static int writebuffer_flush(struct block_device *blk) list_for_each_entry(chunk, &blk->buffered_blocks, list) { if (chunk->dirty) { - ret = blk->ops->write(blk, chunk->data, chunk->block_start, blk->rdbufsize); + ret = blk->ops->write(blk, chunk->data, + chunk->block_start, + writebuffer_io_len(blk, chunk)); if (ret < 0) return ret; @@ -118,10 +125,9 @@ static struct chunk *get_chunk(struct block_device *blk) /* use last entry which is the most unused */ chunk = list_last_entry(&blk->buffered_blocks, struct chunk, list); if (chunk->dirty) { - size_t num_blocks = min(blk->rdbufsize, - blk->num_blocks - chunk->block_start); - ret = blk->ops->write(blk, chunk->data, chunk->block_start, - num_blocks); + ret = blk->ops->write(blk, chunk->data, + chunk->block_start, + writebuffer_io_len(blk, chunk)); if (ret < 0) return ERR_PTR(ret); @@ -145,7 +151,6 @@ static struct chunk *get_chunk(struct block_device *blk) static int block_cache(struct block_device *blk, int block) { struct chunk *chunk; - size_t num_blocks; int ret; chunk = get_chunk(blk); @@ -157,9 +162,8 @@ static int block_cache(struct block_device *blk, int block) dev_dbg(blk->dev, "%s: %d to %d\n", __func__, chunk->block_start, chunk->num); - num_blocks = min(blk->rdbufsize, blk->num_blocks - chunk->block_start); - - ret = blk->ops->read(blk, chunk->data, chunk->block_start, num_blocks); + ret = blk->ops->read(blk, chunk->data, chunk->block_start, + writebuffer_io_len(blk, chunk)); if (ret) { list_add_tail(&chunk->list, &blk->idle_blocks); return ret; -- cgit v1.2.3 From f24245742636ef9996aae66e92244aed659b7d72 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 21 Jan 2019 22:06:25 -0800 Subject: block: Move shared code in get_chunk() out of if statement Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- common/block.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/common/block.c b/common/block.c index 3a031a4fc7..2917218762 100644 --- a/common/block.c +++ b/common/block.c @@ -133,13 +133,12 @@ static struct chunk *get_chunk(struct block_device *blk) chunk->dirty = 0; } - - list_del(&chunk->list); } else { chunk = list_first_entry(&blk->idle_blocks, struct chunk, list); - list_del(&chunk->list); } + list_del(&chunk->list); + return chunk; } -- cgit v1.2.3 From 4ebb55e96177a4b5f05e1407e01095cb4924d0a5 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 17 Jan 2019 16:41:13 -0800 Subject: ls: Adjust amount of space allocated for filesize Maximum file size on 64-bit system is 2^63-1 (9223372036854775807), which takes more that 14 characters of space. In order to keep things properly aligned adjust that spacing to 20 on 64-bit platforms. Before: ls -l /dev/ d--------- 0 . d--------- 0 .. crw------- 16384 dds-eeprom crw------- 256 e1000-invm0 crw------- 16384 eeprom0 cr-------- 0 full crw------- 2048 imx-ocotp crw------- 16384 main-eeprom crw------- 64 mdio0-phy00 crw------- 9223372036854775807 mem c-w------- 0 netconsole-1 c-w------- 0 null crw------- 256060514304 nvme0n1 cr-------- 0 prng crw------- 4294967296 ram0 c-w------- 0 serial0-1 cr-------- 0 zero After: ls -l /dev/ d--------- 0 . d--------- 0 .. crw------- 16384 dds-eeprom crw------- 256 e1000-invm0 crw------- 16384 eeprom0 cr-------- 0 full crw------- 2048 imx-ocotp crw------- 16384 main-eeprom crw------- 64 mdio0-phy00 crw------- 9223372036854775807 mem c-w------- 0 netconsole-1 c-w------- 0 null crw------- 256060514304 nvme0n1 cr-------- 0 prng crw------- 4294967296 ram0 c-w------- 0 serial0-1 cr-------- 0 zero Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- commands/ls.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/commands/ls.c b/commands/ls.c index e54991862d..e5e37d75c5 100644 --- a/commands/ls.c +++ b/commands/ls.c @@ -26,6 +26,15 @@ #include #include +/* + * SIZELEN = strlen(itoa(MAX_LFS_FILESIZE)) + 1; + */ +#ifdef CONFIG_CPU_64 +#define SIZELEN 20 +#else +#define SIZELEN 14 +#endif + static void ls_one(const char *path, const char* fullname) { char modestr[11]; @@ -38,7 +47,8 @@ static void ls_one(const char *path, const char* fullname) return; mkmodestr(s.st_mode, modestr); - printf("%s %14llu %*.*s", modestr, s.st_size, namelen, namelen, path); + printf("%s %*llu %*.*s", modestr, SIZELEN, s.st_size, namelen, + namelen, path); if (S_ISLNK(s.st_mode)) { char realname[PATH_MAX]; -- cgit v1.2.3 From a24ae66249674eaba96e628454c1d49db57a30cb Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 17 Jan 2019 16:41:55 -0800 Subject: unlink_recursive: Drop struct data Drop struct data which doesn't seem to serve any purpose in the code and looks like a leftover. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- lib/unlink-recursive.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/unlink-recursive.c b/lib/unlink-recursive.c index 434fdc791b..f28c6dae5b 100644 --- a/lib/unlink-recursive.c +++ b/lib/unlink-recursive.c @@ -6,50 +6,37 @@ static char unlink_recursive_failedpath[PATH_MAX]; -struct data { - int error; -}; - static int file_action(const char *filename, struct stat *statbuf, void *userdata, int depth) { - struct data *data = userdata; - int ret; - - ret = unlink(filename); - if (ret) { + if (unlink(filename)) { strcpy(unlink_recursive_failedpath, filename); - data->error = ret; + return 0; } - return ret ? 0 : 1; + return 1; } static int dir_action(const char *dirname, struct stat *statbuf, void *userdata, int depth) { - struct data *data = userdata; - int ret; - - ret = rmdir(dirname); - if (ret) { + if (rmdir(dirname)) { strcpy(unlink_recursive_failedpath, dirname); - data->error = ret; + return 0; } - return ret ? 0 : 1; + return 1; } int unlink_recursive(const char *path, char **failedpath) { - struct data data = {}; int ret; if (failedpath) *failedpath = NULL; ret = recursive_action(path, ACTION_RECURSE | ACTION_DEPTHFIRST, - file_action, dir_action, &data, 0); + file_action, dir_action, NULL, 0); if (!ret && failedpath) *failedpath = unlink_recursive_failedpath; -- cgit v1.2.3 From f74f28ff60e27cf6d22b90376409b6af13d32772 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 24 Jan 2019 21:12:04 -0800 Subject: lib: image-sparse: Mark sparse_seek() as static Mark sparse_seek() as static to avoid -Wmissing-prototypes warnings Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- lib/image-sparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/image-sparse.c b/lib/image-sparse.c index 7137d15fd0..0c31742ab6 100644 --- a/lib/image-sparse.c +++ b/lib/image-sparse.c @@ -60,7 +60,7 @@ struct sparse_image_ctx { uint32_t fill_val; }; -int sparse_seek(struct sparse_image_ctx *si) +static int sparse_seek(struct sparse_image_ctx *si) { unsigned int chunk_data_sz, payload; loff_t offs; -- cgit v1.2.3 From 5d966f708a72bd81863dbe9b182929d88f7614fc Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 25 Jan 2019 21:35:04 +0100 Subject: gen-dtb-s: annotate magic values with their meaning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This helps understand how the imd stuff works because now $(git grep IMD_TYPE_OF_COMPATIBLE) also matches the critical code location that creates the imd entry. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- scripts/gen-dtb-s | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/gen-dtb-s b/scripts/gen-dtb-s index 4215461edb..2b44ffb361 100755 --- a/scripts/gen-dtb-s +++ b/scripts/gen-dtb-s @@ -25,7 +25,7 @@ if [ "$imd" = "y" ]; then if [ "$compat" != "notfound" ]; then compatlen=$($FDTGET -t s "$dtb" / compatible | wc -c) - le32 0x640c8005 + le32 0x640c8005 # IMD_TYPE_OF_COMPATIBLE le32 $compatlen echo ".byte " $compat echo ".balign 4" @@ -35,7 +35,7 @@ if [ "$imd" = "y" ]; then if [ "$model" != "notfound" ]; then modellen=$($FDTGET -t s "$dtb" / model | wc -c) - le32 0x640c8004 + le32 0x640c8004 # IMD_TYPE_MODEL le32 $modellen echo ".byte " $model echo ".balign 4" -- cgit v1.2.3 From d4c88b90c558d595bec49de933052ad855da5c69 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 25 Jan 2019 21:59:34 +0100 Subject: i2c_probe: limit slave addresses to [0x04, 0x77] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adresses below 0x04 and above 0x77 are reserved in the i2c bus specification, so don't probe these addresses unless requested explicitly. Also do more strict boundary checking: - ensure start address is greater or equal to zero; - don't decrease stopaddr after checking it being greater or equal to startaddr. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- commands/i2c.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/i2c.c b/commands/i2c.c index 2f7f820d4d..65ff7378ec 100644 --- a/commands/i2c.c +++ b/commands/i2c.c @@ -44,7 +44,7 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stop static int do_i2c_probe(int argc, char *argv[]) { struct i2c_adapter *adapter = NULL; - int startaddr = 0, stopaddr = 0x7f; + int startaddr = 4, stopaddr = 0x77; if (argc > 1) { adapter = i2c_get_adapter(simple_strtoul(argv[1], NULL, 0)); @@ -57,13 +57,15 @@ static int do_i2c_probe(int argc, char *argv[]) if (argc > 3) stopaddr = simple_strtol(argv[3], NULL, 0); + if (stopaddr > 0x7f) + stopaddr = 0x7f; + + if (startaddr < 0) + startaddr = 0; if (startaddr > stopaddr) return COMMAND_ERROR_USAGE; - if (stopaddr > 0x7F) - stopaddr = 0x7F; - if (adapter) { i2c_probe_range(adapter, startaddr, stopaddr); } else { -- cgit v1.2.3 From 1b6253ab991d272adf8c84b0a6063b4076253d61 Mon Sep 17 00:00:00 2001 From: Uwe Kleine-König Date: Fri, 25 Jan 2019 21:59:35 +0100 Subject: i2c_probe: Use a quick write transfer instead of writing a zero MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This matches the method implemented in i2cdetect(8) when using its -q option. With this change an rx8130 RTC is detectable using i2c_probe. This failed before because this chip acks the first byte (containing its address and the R/̅W bit) but nacks the following 0 (representing the target address to write nothing to) which makes i2c_write_reg() return with an error and so the chip is not listed as available. Signed-off-by: Uwe Kleine-König Signed-off-by: Sascha Hauer --- commands/i2c.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/commands/i2c.c b/commands/i2c.c index 65ff7378ec..77d65e3fa3 100644 --- a/commands/i2c.c +++ b/commands/i2c.c @@ -24,19 +24,19 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stopaddr) { - struct i2c_client client = {}; int addr; - int ret; - u8 reg; - - client.adapter = adapter; printf("probing i2c%d range 0x%02x-0x%02x: ", adapter->nr, startaddr, stopaddr); for (addr = startaddr; addr <= stopaddr && !ctrlc(); addr++) { - client.addr = addr; - ret = i2c_write_reg(&client, 0x00, ®, 0); - if (ret == 0) + struct i2c_msg msg = { + .addr = addr, + .buf = NULL, + .len = 0, + }; + int ret = i2c_transfer(adapter, &msg, 1); + if (ret == 1) printf("0x%02x ", addr); + } printf("\n"); } -- cgit v1.2.3 From eaa3484ad66da8912e19fa5a4bdceea86dddc4d4 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Jan 2019 14:07:54 +0100 Subject: mtd: peb: Add function to skip bad blocks This adds a function that given a pointer to a PEB number increases the number until the corresponding PEB is good. It also checks for the PEB number being inside the mtd device. Signed-off-by: Sascha Hauer --- drivers/mtd/peb.c | 27 +++++++++++++++++++++++++++ include/mtd/mtd-peb.h | 1 + 2 files changed, 28 insertions(+) diff --git a/drivers/mtd/peb.c b/drivers/mtd/peb.c index c35b63f2fd..388db7f587 100644 --- a/drivers/mtd/peb.c +++ b/drivers/mtd/peb.c @@ -129,6 +129,33 @@ int mtd_num_pebs(struct mtd_info *mtd) return mtd_div_by_eb(mtd->size, mtd); } +/** + * mtd_skip_bad - skip bad blocks + * @mtd: mtd device + * @pnum: The number of the block + * + * This function skips bad blocks beginning from @pnum. Returns 0 for success and + * a negative error code otherwise. on successful exit @pnum points to the next + * good block. + */ +int mtd_skip_bad(struct mtd_info *mtd, int *pnum) +{ + if (*pnum < 0) + return -EINVAL; + + while (1) { + loff_t offset = (uint64_t)mtd->erasesize * *pnum; + + if (offset >= mtd->size) + return -ENOSPC; + + if (!mtd_block_isbad(mtd, offset)) + return 0; + + *pnum = *pnum + 1; + } +} + /** * mtd_peb_mark_bad - mark a physical eraseblock as bad * @mtd: mtd device diff --git a/include/mtd/mtd-peb.h b/include/mtd/mtd-peb.h index e4fd01df90..23f89d89a8 100644 --- a/include/mtd/mtd-peb.h +++ b/include/mtd/mtd-peb.h @@ -12,6 +12,7 @@ int mtd_peb_torture(struct mtd_info *mtd, int pnum); int mtd_peb_erase(struct mtd_info *mtd, int pnum); int mtd_peb_mark_bad(struct mtd_info *mtd, int pnum); int mtd_peb_is_bad(struct mtd_info *mtd, int pnum); +int mtd_skip_bad(struct mtd_info *mtd, int *pnum); int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len, int warn); int mtd_peb_verify(struct mtd_info *mtd, const void *buf, int pnum, -- cgit v1.2.3 From 75df7ff694572cdc1380b045bab3c56f9f2b671b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Jan 2019 12:05:15 +0100 Subject: usb: fastboot: ubiformat: Fix bad block handling When fastboot handles UBI images in sparse file format then bad blocks of the underlying mtd device are not skipped. This patch fixes this. Signed-off-by: Sascha Hauer --- common/ubiformat.c | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/common/ubiformat.c b/common/ubiformat.c index 0811525bd2..1968bd98f8 100644 --- a/common/ubiformat.c +++ b/common/ubiformat.c @@ -710,8 +710,10 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count, loff_t offset) { int writesize = mtd->writesize >> mtd->subpage_sft; - size_t retlen; int ret; + int peb = 0; + int n_skip_blocks = mtd_div_by_eb(offset, mtd); + int offset_in_peb = mtd_mod_by_eb(offset, mtd); if (offset & (mtd->writesize - 1)) return -EINVAL; @@ -719,27 +721,44 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count, if (count & (mtd->writesize - 1)) return -EINVAL; + /* Seek forward to the first PEB we actually want to write */ + while (1) { + ret = mtd_skip_bad(mtd, &peb); + if (ret) + return ret; + + if (!n_skip_blocks) + break; + + peb++; + n_skip_blocks--; + } + while (count) { - size_t now; + size_t now = mtd->erasesize - offset_in_peb; - now = ALIGN(offset, mtd->erasesize) - offset; if (now > count) now = count; - if (!now) { + if (!offset_in_peb) { const struct ubi_ec_hdr *ec = buf; const struct ubi_vid_hdr *vid; + ret = mtd_skip_bad(mtd, &peb); + if (ret) + return ret; + if (be32_to_cpu(ec->magic) != UBI_EC_HDR_MAGIC) { pr_err("bad UBI magic %#08x, should be %#08x", be32_to_cpu(ec->magic), UBI_EC_HDR_MAGIC); return -EINVAL; } - /* skip ec header */ - offset += writesize; + /* skip ec header in both flash and image */ + offset_in_peb = writesize; buf += writesize; count -= writesize; + now -= writesize; if (!count) break; @@ -750,19 +769,16 @@ int ubiformat_write(struct mtd_info *mtd, const void *buf, size_t count, be32_to_cpu(vid->magic), UBI_VID_HDR_MAGIC); return -EINVAL; } - - continue; } - ret = mtd_write(mtd, offset, now, &retlen, buf); + ret = mtd_peb_write(mtd, buf, peb, offset_in_peb, now); if (ret < 0) return ret; - if (retlen != now) - return -EIO; buf += now; count -= now; - offset += now; + offset_in_peb = 0; + peb++; } return 0; -- cgit v1.2.3 From 6c54c3c818f215b37d0e3dd617d7d110c33b3426 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 28 Jan 2019 15:16:12 +0100 Subject: ARM: omap: Wago PFC200: Initialize switch registers The PFC200 has a KSZ886x switch connected. Some of its registers need to be initialized for proper ehternet support. Add the initialization code. Signed-off-by: Sascha Hauer Cc: Heinrich.Toews@wago.com --- arch/arm/boards/wago-pfc-am35xx/board.c | 45 +++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/arm/boards/wago-pfc-am35xx/board.c b/arch/arm/boards/wago-pfc-am35xx/board.c index 2bad40912d..c0a039ba50 100644 --- a/arch/arm/boards/wago-pfc-am35xx/board.c +++ b/arch/arm/boards/wago-pfc-am35xx/board.c @@ -3,6 +3,7 @@ * Copyright (C) 2014 WAGO Kontakttechnik GmbH & Co. KG * Author: Heinrich Toews */ +#define pr_fmt(fmt) "pfc200: " fmt #include #include @@ -10,6 +11,8 @@ #include #include #include +#include +#include #include #include @@ -23,6 +26,48 @@ static int pfc200_mem_init(void) } mem_initcall(pfc200_mem_init); +#define BMCR_HP_MDIX 0x20 + +static int pfc200_phy_fixup(struct mii_bus *mii, int phyadr) +{ + struct phy_device *phydev; + int ret; + + phydev = mdiobus_scan(mii, phyadr); + + if (IS_ERR(phydev)) { + pr_err("Cannot find phydev %d on mii bus\n", phyadr); + return PTR_ERR(phydev); + } + + ret = phy_write(phydev, MII_BMCR, BMCR_ANENABLE | BMCR_HP_MDIX); + if (ret) + pr_err("Failed to write to phy: %s\n", strerror(-ret)); + + return ret; +} + +static int pfc200_late_init(void) +{ + struct mii_bus *mii; + + if (!of_machine_is_compatible("ti,pfc200")) + return 0; + + mii = mdiobus_get_bus(0); + if (!mii) { + pr_err("Cannot find mii bus 0\n"); + return -ENODEV; + } + + pfc200_phy_fixup(mii, 1); + pfc200_phy_fixup(mii, 2); + + return 0; +} +late_initcall(pfc200_late_init); + + #define GPIO_KSZ886x_RESET 136 static int pfc200_devices_init(void) -- cgit v1.2.3 From 7172ee90b728375ee53f7a5186031ba3168ca0eb Mon Sep 17 00:00:00 2001 From: Robert Karszniewicz Date: Fri, 1 Feb 2019 13:46:55 +0100 Subject: readline: add ctrl-u (unix-line-discard) Signed-off-by: Robert Karszniewicz Signed-off-by: Sascha Hauer --- lib/readline.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/readline.c b/lib/readline.c index 904a776394..d026af1104 100644 --- a/lib/readline.c +++ b/lib/readline.c @@ -290,6 +290,7 @@ int readline(const char *prompt, char *buf, int len) insert = !insert; break; case BB_KEY_ERASE_LINE: + case CTL_CH('u'): BEGINNING_OF_LINE(); ERASE_TO_EOL(); break; -- cgit v1.2.3 From 90e9bfa36ea4deef2f1f322dc2503297420c2d20 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Fri, 1 Feb 2019 12:59:48 +0000 Subject: net: designware: drop bad RX frames In dwc_ether_rx(), check the RX descriptor status for various error conditions. On error, issue a warning with the error status bits and drop the received frame. Signed-off-by: Ian Abbott Signed-off-by: Sascha Hauer --- drivers/net/designware.c | 42 +++++++++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index ad70967e8c..21134cd5ab 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -326,24 +326,48 @@ static int dwc_ether_rx(struct eth_device *dev) u32 status = desc_p->txrx_status; int length = 0; + int ret = 0; /* Check if the owner is the CPU */ if (status & DESC_RXSTS_OWNBYDMA) return 0; - length = (status & DESC_RXSTS_FRMLENMSK) >> - DESC_RXSTS_FRMLENSHFT; + if ((status & (DESC_RXSTS_ERROR | DESC_RXSTS_DAFILTERFAIL | + DESC_RXSTS_SAFILTERFAIL)) || + (status & (DESC_RXSTS_RXIPC_GIANTFRAME | + DESC_RXSTS_RXFRAMEETHER)) == + DESC_RXSTS_RXIPC_GIANTFRAME) { + /* Error in packet - discard it */ + dev_warn(&dev->dev, "Rx error status (%x)\n", + status & (DESC_RXSTS_DAFILTERFAIL | + DESC_RXSTS_ERROR | + DESC_RXSTS_RXTRUNCATED | + DESC_RXSTS_SAFILTERFAIL | + DESC_RXSTS_RXIPC_GIANTFRAME | + DESC_RXSTS_RXDAMAGED | + DESC_RXSTS_RXIPC_GIANT | + DESC_RXSTS_RXCOLLISION | + DESC_RXSTS_RXFRAMEETHER | + DESC_RXSTS_RXWATCHDOG | + DESC_RXSTS_RXMIIERROR | + DESC_RXSTS_RXCRC)); + ret = -EIO; + } else { + length = (status & DESC_RXSTS_FRMLENMSK) >> + DESC_RXSTS_FRMLENSHFT; + + dma_sync_single_for_cpu((unsigned long)desc_p->dmamac_addr, + length, DMA_FROM_DEVICE); + net_receive(dev, desc_p->dmamac_addr, length); + dma_sync_single_for_device((unsigned long)desc_p->dmamac_addr, + length, DMA_FROM_DEVICE); + ret = length; + } /* * Make the current descriptor valid again and go to * the next one */ - dma_sync_single_for_cpu((unsigned long)desc_p->dmamac_addr, length, - DMA_FROM_DEVICE); - net_receive(dev, desc_p->dmamac_addr, length); - dma_sync_single_for_device((unsigned long)desc_p->dmamac_addr, length, - DMA_FROM_DEVICE); - desc_p->txrx_status |= DESC_RXSTS_OWNBYDMA; /* Test the wrap-around condition. */ @@ -352,7 +376,7 @@ static int dwc_ether_rx(struct eth_device *dev) priv->rx_currdescnum = desc_num; - return length; + return ret; } static void dwc_ether_halt (struct eth_device *dev) -- cgit v1.2.3 From ee5177069e32163d0db0a0fa0e7054d6560298e2 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 1 Feb 2019 11:24:23 +0100 Subject: net: Phy: Update phy interface modes from Linux This syncs the phy interface modes with Linux and adds names that were previously missing. With this we no longer have holes in the phy mode name arrays and thus of_get_phy_mode no longer derefences NULL pointers when it finds such a hole. Signed-off-by: Sascha Hauer --- drivers/of/of_net.c | 12 +++++++++++- include/linux/phy.h | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/of/of_net.c b/drivers/of/of_net.c index 9b54e44674..cee4597195 100644 --- a/drivers/of/of_net.c +++ b/drivers/of/of_net.c @@ -17,18 +17,28 @@ */ static const char *phy_modes[] = { [PHY_INTERFACE_MODE_NA] = "", + [PHY_INTERFACE_MODE_INTERNAL] = "internal", [PHY_INTERFACE_MODE_MII] = "mii", [PHY_INTERFACE_MODE_GMII] = "gmii", [PHY_INTERFACE_MODE_SGMII] = "sgmii", [PHY_INTERFACE_MODE_TBI] = "tbi", + [PHY_INTERFACE_MODE_REVMII] = "rev-mii", [PHY_INTERFACE_MODE_RMII] = "rmii", [PHY_INTERFACE_MODE_RGMII] = "rgmii", [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id", [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid", - [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid", + [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid", [PHY_INTERFACE_MODE_RTBI] = "rtbi", [PHY_INTERFACE_MODE_SMII] = "smii", + [PHY_INTERFACE_MODE_XGMII] = "xgmii", + [PHY_INTERFACE_MODE_MOCA] = "moca", [PHY_INTERFACE_MODE_QSGMII] = "qsgmii", + [PHY_INTERFACE_MODE_TRGMII] = "trgmii", + [PHY_INTERFACE_MODE_1000BASEX] = "1000base-x", + [PHY_INTERFACE_MODE_2500BASEX] = "2500base-x", + [PHY_INTERFACE_MODE_RXAUI] = "rxaui", + [PHY_INTERFACE_MODE_XAUI] = "xaui", + [PHY_INTERFACE_MODE_10GKR] = "10gbase-kr", }; /** diff --git a/include/linux/phy.h b/include/linux/phy.h index 5b2c63ff69..5081ebacb3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -43,10 +43,12 @@ /* Interface Mode definitions */ typedef enum { PHY_INTERFACE_MODE_NA, + PHY_INTERFACE_MODE_INTERNAL, PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_SGMII, PHY_INTERFACE_MODE_TBI, + PHY_INTERFACE_MODE_REVMII, PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII, PHY_INTERFACE_MODE_RGMII_ID, @@ -55,6 +57,7 @@ typedef enum { PHY_INTERFACE_MODE_RTBI, PHY_INTERFACE_MODE_SMII, PHY_INTERFACE_MODE_XGMII, + PHY_INTERFACE_MODE_MOCA, PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_1000BASEX, -- cgit v1.2.3 From 69b16bcc850c9eef0f399f531d0b0cfdacb9b4e4 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Wed, 6 Feb 2019 11:34:02 +0100 Subject: common: state: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_format_raw.c | 4 ++-- common/state/state.c | 2 +- common/state/state.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/state/backend_format_raw.c b/common/state/backend_format_raw.c index 4369f76e37..5a71149d34 100644 --- a/common/state/backend_format_raw.c +++ b/common/state/backend_format_raw.c @@ -127,7 +127,7 @@ static int backend_format_raw_verify(struct state_backend_format *format, return -EINVAL; } - if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) { + if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) { ret = backend_raw_digest_init(backend_raw); if (ret) return ret; @@ -153,7 +153,7 @@ static int backend_format_raw_verify(struct state_backend_format *format, *lenp = header->data_len + sizeof(*header); - if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTIFICATION)) { + if (backend_raw->algo && !(flags & STATE_FLAG_NO_AUTHENTICATION)) { const void *hmac = data + header->data_len; /* hmac over header and data */ diff --git a/common/state/state.c b/common/state/state.c index 54c57232e6..d3e048b990 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -128,7 +128,7 @@ int state_load(struct state *state) int state_load_no_auth(struct state *state) { - return state_do_load(state, STATE_FLAG_NO_AUTHENTIFICATION); + return state_do_load(state, STATE_FLAG_NO_AUTHENTICATION); } static int state_format_init(struct state *state, const char *backend_format, diff --git a/common/state/state.h b/common/state/state.h index 3a0662fd25..912d6d4848 100644 --- a/common/state/state.h +++ b/common/state/state.h @@ -6,7 +6,7 @@ struct state; struct mtd_info_user; enum state_flags { - STATE_FLAG_NO_AUTHENTIFICATION = (1 << 0), + STATE_FLAG_NO_AUTHENTICATION = (1 << 0), }; enum state_variable_type { -- cgit v1.2.3 From 6e3b4ec9480c6dc375846a4caa1cd18a99a9d29e Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Wed, 6 Feb 2019 11:34:03 +0100 Subject: state: Documentation: fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- Documentation/devicetree/bindings/barebox/barebox,state.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/barebox/barebox,state.rst b/Documentation/devicetree/bindings/barebox/barebox,state.rst index 2893937820..390e148a28 100644 --- a/Documentation/devicetree/bindings/barebox/barebox,state.rst +++ b/Documentation/devicetree/bindings/barebox/barebox,state.rst @@ -52,7 +52,7 @@ Optional Properties ``circular`` or ``noncircular``. If the backend memory needs to be erased prior a write it defaults to the ``circular`` storage backend type, for backend memories like RAMs or EEPROMs it defaults to the ``direct`` storage backend type. -* ``algo``: A HMAC algorithm used to detect manipulation of the data +* ``algo``: An HMAC algorithm used to detect manipulation of the data or header, sensible values follow this pattern ``hmac()``, e.g. ``hmac(sha256)``. Only available for the ``backend-type`` ``raw``. * ``keep-previous-content``: Check if a the bucket meta magic field contains -- cgit v1.2.3 From b34b27edaea649b22d17c9be8d8d9f0b0b077471 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:20 +0100 Subject: common: state: fix compiler warnings about wrong type conversion in messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To harmonize the common codebase this ports the remaining hunks of the following dt-utils commit, as the residual hunks have independently already been done before in barebox commit 1afbf6b5680e ("state: fix compile warnings for dev_err expansion"): | commit 9f1db73234b40f4ea071421e8179065df16211ec | Author: Philipp Rosenberger | Date: Thu Oct 18 09:17:23 2018 +0200 | | Fix compiler warnings about wrong type conversion in messages. | | These warning were observed with gcc-6.3 on x86-64. | | Signed-off-by: Philipp Rosenberger | Signed-off-by: Sascha Hauer Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_bucket_circular.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index 4b71d8751d..5a85650f40 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -165,13 +165,13 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ return ret; } - dev_dbg(circ->dev, "Read state from %ld length %zd\n", offset, + dev_dbg(circ->dev, "Read state from %ld length %d\n", offset, len); ret = read_full(circ->fd, buf, len); if (ret < 0) { - dev_err(circ->dev, "Failed to read circular storage len %zd, %d\n", + dev_err(circ->dev, "Failed to read circular storage len %d, %d\n", len, ret); free(buf); } @@ -196,7 +196,7 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir ret = write_full(circ->fd, buf, len); if (ret < 0) { - dev_err(circ->dev, "Failed to write circular to %ld length %zd, %d\n", + dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", offset, len, ret); return ret; } @@ -207,7 +207,7 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir */ flush(circ->fd); - dev_dbg(circ->dev, "Written state to offset %ld length %zd data length %zd\n", + dev_dbg(circ->dev, "Written state to offset %ld length %d data length %d\n", offset, len, len); return 0; @@ -298,7 +298,7 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck void *write_buf; if (written_length > circ->max_size) { - dev_err(circ->dev, "Error, state data too big to be written, to write: %zd, writesize: %zd, length: %zd, available: %zd\n", + dev_err(circ->dev, "Error, state data too big to be written, to write: %d, writesize: %zd, length: %zd, available: %zd\n", written_length, circ->writesize, len, circ->max_size); return -E2BIG; } @@ -345,12 +345,12 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck ret = state_mtd_peb_write(circ, write_buf, offset, written_length); if (ret < 0 && ret != -EUCLEAN) { - dev_err(circ->dev, "Failed to write circular to %ld length %zd, %d\n", + dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", offset, written_length, ret); goto out_free; } - dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %zd data length %zd\n", + dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %d data length %zd\n", circ->eraseblock, offset, written_length, len); out_free: -- cgit v1.2.3 From 0019513c41b0641c6582668f0356663a65ad36d4 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:21 +0100 Subject: common: state: fix formatting of "off_t" variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To harmonize the common codebase this ports the following dt-utils commit: | commit 89d033284cb69f834c1f2195c9e99a3d7f585cf1 | Author: Ulrich Ölmann | Date: Sun Feb 3 22:48:06 2019 +0100 | | state: fix formatting of "off_t" variables | | Explicitely casting an "off_t" variable to "long long" and formatting it via | "%lld" or "%llx" respectively makes 32- as well as 64-bit compilers | happy (tested with gcc-8.2.1 and clang-7.0.1). | | Signed-off-by: Ulrich Ölmann | Signed-off-by: Roland Hieber Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_bucket_circular.c | 32 ++++++++++++++++---------------- common/state/backend_storage.c | 20 ++++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index 5a85650f40..ae15fa2529 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -161,11 +161,11 @@ static int state_mtd_peb_read(struct state_backend_storage_bucket_circular *circ ret = lseek(circ->fd, offset, SEEK_SET); if (ret < 0) { dev_err(circ->dev, "Failed to set circular read position to %lld, %d\n", - offset, ret); + (long long) offset, ret); return ret; } - dev_dbg(circ->dev, "Read state from %ld length %d\n", offset, + dev_dbg(circ->dev, "Read state from %lld length %d\n", (long long) offset, len); @@ -189,15 +189,15 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir ret = lseek(circ->fd, offset, SEEK_SET); if (ret < 0) { - dev_err(circ->dev, "Failed to set position for circular write %ld, %d\n", - offset, ret); + dev_err(circ->dev, "Failed to set position for circular write %lld, %d\n", + (long long) offset, ret); return ret; } ret = write_full(circ->fd, buf, len); if (ret < 0) { - dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", - offset, len, ret); + dev_err(circ->dev, "Failed to write circular to %lld length %d, %d\n", + (long long) offset, len, ret); return ret; } @@ -207,8 +207,8 @@ static int state_mtd_peb_write(struct state_backend_storage_bucket_circular *cir */ flush(circ->fd); - dev_dbg(circ->dev, "Written state to offset %ld length %d data length %d\n", - offset, len, len); + dev_dbg(circ->dev, "Written state to offset %lld length %d data length %d\n", + (long long) offset, len, len); return 0; } @@ -265,8 +265,8 @@ static int state_backend_bucket_circular_read(struct state_backend_storage_bucke if (!buf) return -ENOMEM; - dev_dbg(circ->dev, "Read state from PEB %u global offset %ld length %zd\n", - circ->eraseblock, offset, read_len); + dev_dbg(circ->dev, "Read state from PEB %u global offset %lld length %zd\n", + circ->eraseblock, (long long) offset, read_len); ret = state_mtd_peb_read(circ, buf, offset, read_len); if (ret < 0 && ret != -EUCLEAN) { @@ -345,13 +345,13 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck ret = state_mtd_peb_write(circ, write_buf, offset, written_length); if (ret < 0 && ret != -EUCLEAN) { - dev_err(circ->dev, "Failed to write circular to %ld length %d, %d\n", - offset, written_length, ret); + dev_err(circ->dev, "Failed to write circular to %lld length %d, %d\n", + (long long) offset, written_length, ret); goto out_free; } - dev_dbg(circ->dev, "Written state to PEB %u offset %ld length %d data length %zd\n", - circ->eraseblock, offset, written_length, len); + dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %d data length %zd\n", + circ->eraseblock, (long long) offset, written_length, len); out_free: free(write_buf); @@ -445,8 +445,8 @@ static int bucket_circular_is_block_bad(struct state_backend_storage_bucket_circ ret = ioctl(circ->fd, MEMGETBADBLOCK, &offs); if (ret < 0) - dev_err(circ->dev, "Failed to use ioctl to check for bad block at offset %ld, %d\n", - offs, ret); + dev_err(circ->dev, "Failed to use ioctl to check for bad block at offset %lld, %d\n", + (long long) offs, ret); return ret; } diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index c6ebe86244..8cd822eec4 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -111,11 +111,11 @@ refresh: ret = bucket->write(bucket, buf, len); if (ret) { - dev_warn(storage->dev, "Failed to restore bucket %d@0x%08lx\n", - bucket->num, bucket->offset); + dev_warn(storage->dev, "Failed to restore bucket %d@0x%08llx\n", + bucket->num, (long long) bucket->offset); } else { - dev_info(storage->dev, "restored bucket %d@0x%08lx\n", - bucket->num, bucket->offset); + dev_info(storage->dev, "restored bucket %d@0x%08llx\n", + bucket->num, (long long) bucket->offset); bucket->needs_refresh = 0; } @@ -166,7 +166,7 @@ int state_storage_read(struct state_backend_storage *storage, if (!ret && !bucket_used) bucket_used = bucket; if (ret) - dev_info(storage->dev, "Ignoring broken bucket %d@0x%08lx...\n", bucket->num, bucket->offset); + dev_info(storage->dev, "Ignoring broken bucket %d@0x%08llx...\n", bucket->num, (long long) bucket->offset); } dev_dbg(storage->dev, "Checking redundant buckets finished.\n"); @@ -177,7 +177,7 @@ int state_storage_read(struct state_backend_storage *storage, return -ENOENT; } - dev_info(storage->dev, "Using bucket %d@0x%08lx\n", bucket_used->num, bucket_used->offset); + dev_info(storage->dev, "Using bucket %d@0x%08llx\n", bucket_used->num, (long long) bucket_used->offset); /* * Restore/refresh all buckets except the one we currently use (in case @@ -252,8 +252,8 @@ static int state_storage_mtd_buckets_init(struct state_backend_storage *storage, end = meminfo->size; if (!IS_ALIGNED(storage->offset, meminfo->erasesize)) { - dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %ld, erasesize %u\n", - storage->offset, meminfo->erasesize); + dev_err(storage->dev, "Offset within the device is not aligned to eraseblocks. Offset is %lld, erasesize %u\n", + (long long) storage->offset, meminfo->erasesize); return -EINVAL; } @@ -326,8 +326,8 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage &bucket, offset, stridesize); if (ret) { - dev_warn(storage->dev, "Failed to create direct bucket at '%s' offset %ld\n", - storage->path, offset); + dev_warn(storage->dev, "Failed to create direct bucket at '%s' offset %lld\n", + storage->path, (long long) offset); continue; } -- cgit v1.2.3 From ed86bd67ef9bda914c99c6ee939de836eff1dc10 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:22 +0100 Subject: common: state: fix formatting of "uint32_t" variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To harmonize the common codebase this ports the following dt-utils commit: | commit 5588a6c32d54bc4a1ef0b9f72807c46dd00bc20e | Author: Ulrich Ölmann | Date: Sun Feb 3 22:48:07 2019 +0100 | | state: fix formatting of "uint32_t" variables | | The format specifier "%zd" is for "size_t" typed variables and produces a | warning with gcc, so use "%u" instead. | | Signed-off-by: Ulrich Ölmann | Signed-off-by: Roland Hieber Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_bucket_circular.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index ae15fa2529..059a531aa4 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -298,7 +298,7 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck void *write_buf; if (written_length > circ->max_size) { - dev_err(circ->dev, "Error, state data too big to be written, to write: %d, writesize: %zd, length: %zd, available: %zd\n", + dev_err(circ->dev, "Error, state data too big to be written, to write: %u, writesize: %zd, length: %zd, available: %zd\n", written_length, circ->writesize, len, circ->max_size); return -E2BIG; } @@ -345,12 +345,12 @@ static int state_backend_bucket_circular_write(struct state_backend_storage_buck ret = state_mtd_peb_write(circ, write_buf, offset, written_length); if (ret < 0 && ret != -EUCLEAN) { - dev_err(circ->dev, "Failed to write circular to %lld length %d, %d\n", + dev_err(circ->dev, "Failed to write circular to %lld length %u, %d\n", (long long) offset, written_length, ret); goto out_free; } - dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %d data length %zd\n", + dev_dbg(circ->dev, "Written state to PEB %u offset %lld length %u data length %zd\n", circ->eraseblock, (long long) offset, written_length, len); out_free: -- cgit v1.2.3 From 04657b6af779bcf7ac06f36ffa0707f216a88b45 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:23 +0100 Subject: common: state: harmonize code with dt-utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Other than in barebox the offset and size of a state's backend device do not necessarily equal zero in Linux userspace (EEPROMs & block devices), so barebox' and dt-utils' state code differ here. Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/state.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common/state/state.c b/common/state/state.c index d3e048b990..3f5d43ecbf 100644 --- a/common/state/state.c +++ b/common/state/state.c @@ -596,6 +596,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly) const char *alias; uint32_t stridesize; struct device_node *partition_node; + off_t offset = 0; + size_t size = 0; alias = of_alias_get(node); if (!alias) { @@ -614,7 +616,11 @@ struct state *state_new_from_node(struct device_node *node, bool readonly) goto out_release_state; } +#ifdef __BAREBOX__ ret = of_find_path_by_node(partition_node, &state->backend_path, 0); +#else + ret = of_get_devicepath(partition_node, &state->backend_path, &offset, &size); +#endif if (ret) { if (ret != -EPROBE_DEFER) dev_err(&state->dev, "state failed to parse path to backend: %s\n", @@ -645,8 +651,8 @@ struct state *state_new_from_node(struct device_node *node, bool readonly) if (ret) goto out_release_state; - ret = state_storage_init(state, state->backend_path, 0, - 0, stridesize, storage_type); + ret = state_storage_init(state, state->backend_path, offset, + size, stridesize, storage_type); if (ret) goto out_release_state; -- cgit v1.2.3 From 240abfe2224f3701c2f81a3baeed1206f5539f24 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:24 +0100 Subject: common: state: harmonize code with dt-utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux userspace needs sys/param.h to have the definition of roundup(). Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_bucket_circular.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/state/backend_bucket_circular.c b/common/state/backend_bucket_circular.c index 059a531aa4..da7c8421ae 100644 --- a/common/state/backend_bucket_circular.c +++ b/common/state/backend_bucket_circular.c @@ -23,6 +23,10 @@ #include #include +#ifndef __BAREBOX__ +#include +#endif + #include "state.h" /* -- cgit v1.2.3 From b525657cd5360a4737df9c09169ef54d33420a99 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:25 +0100 Subject: common: state: harmonize code with dt-utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux userspace with recent glibc versions lets barebox-state suffer from linux/stat.h redefining 'struct statx' and because of that switched to the inclusion of sys/stat.h instead, see dt-utils commit 1c80e31872ae ("src: fix compilation for glibc version 2.27.9000-36.fc29 and newer"). We can follow this switch in barebox without any problems, too, as in barebox sys/stat.h includes linux/stat.h (and adds some more definitions on top that don't hurt us here). Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c index 8cd822eec4..fca887e93f 100644 --- a/common/state/backend_storage.c +++ b/common/state/backend_storage.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.3 From 5033b4f58f71e1535ab83d35dfcd8bb1b0384e22 Mon Sep 17 00:00:00 2001 From: Ulrich Ölmann Date: Fri, 8 Feb 2019 08:15:26 +0100 Subject: common: state: harmonize code with dt-utils MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Insert a helpful size check that is an outcome of the following dt-utils commits: | commit a6eb5350be0f7a5673162d20f2dd72569d5a4d0c | Author: Markus Pargmann | Date: Fri May 27 13:53:40 2016 +0200 | | barebox-state: Import updated state code | | Signed-off-by: Markus Pargmann | commit 583acea6669550ffa7ffb465301ddb3529206afc | Author: Sascha Hauer | Date: Thu Mar 23 11:29:50 2017 +0100 | | state: backend-direct: Fix max_size | | The max_size in the direct backend includes the meta data, so | substract its size when determing the max data size we can store. | | Signed-off-by: Sascha Hauer | commit dcf781f1b3d15aff5f5ff0b604bff447dee2040c | Author: Sascha Hauer | Date: Thu Mar 23 12:59:48 2017 +0100 | | state: backend_bucket_direct: max_size is always given | | max_size is always != 0, so if(direct->max_size) can be skipped. | | Signed-off-by: Sascha Hauer Signed-off-by: Ulrich Ölmann Signed-off-by: Sascha Hauer --- common/state/backend_bucket_direct.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/state/backend_bucket_direct.c b/common/state/backend_bucket_direct.c index 9d6a337e66..1f00b0fb2f 100644 --- a/common/state/backend_bucket_direct.c +++ b/common/state/backend_bucket_direct.c @@ -110,6 +110,9 @@ static int state_backend_bucket_direct_write(struct state_backend_storage_bucket int ret; struct state_backend_storage_bucket_direct_meta meta; + if (len > direct->max_size - sizeof(meta)) + return -E2BIG; + ret = lseek(direct->fd, direct->offset, SEEK_SET); if (ret < 0) { dev_err(direct->dev, "Failed to seek file, %d\n", ret); -- cgit v1.2.3 From 8a29e7b493c8c2aa57174c9e79c14b93c9807a4b Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Tue, 12 Feb 2019 16:10:41 +0100 Subject: memory: of_fixup: adapt to new memory layout Since kernel 4.16 the memory nodes got a @ suffix so the fixup won't work correctly anymore, because instead of adapting the extisting one the fixup creates a new node and keeps the old (maybe incorrect) node. To be compatible with the old and new layout delete the found memory node and create a new one. The new node follows the new @ style. The patch also renames the node parameter to make it clearer. Signed-off-by: Marco Felsch Signed-off-by: Sascha Hauer --- common/memory.c | 75 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 57 insertions(+), 18 deletions(-) diff --git a/common/memory.c b/common/memory.c index 00fa7c50ff..21b2b4f63a 100644 --- a/common/memory.c +++ b/common/memory.c @@ -224,39 +224,78 @@ int memory_bank_first_find_space(resource_size_t *retstart, #ifdef CONFIG_OFTREE -static int of_memory_fixup(struct device_node *node, void *unused) +static int of_memory_fixup(struct device_node *root, void *unused) { struct memory_bank *bank; int err; - int addr_cell_len, size_cell_len, len = 0; - struct device_node *memnode; - u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */ + int addr_cell_len, size_cell_len; + struct device_node *memnode, *tmp, *np; + char *memnode_name; - memnode = of_create_node(node, "/memory"); - if (!memnode) - return -ENOMEM; + /* + * Since kernel 4.16 the memory node got a @ suffix. To support + * the old and the new style delete any found memory node and add it + * again to be sure that the memory node exists only once. It shouldn't + * bother older kernels if the memory node has this suffix so adding it + * following the new style. + */ - err = of_property_write_string(memnode, "device_type", "memory"); - if (err) - return err; + for_each_child_of_node_safe(root, tmp, np) { + const char *device_type; - addr_cell_len = of_n_addr_cells(memnode); - size_cell_len = of_n_size_cells(memnode); + err = of_property_read_string(np, "device_type", &device_type); + if (err || of_node_cmp("memory", device_type)) + continue; + + /* delete every found memory node */ + of_delete_node(np); + } + + addr_cell_len = of_n_addr_cells(root); + size_cell_len = of_n_size_cells(root); for_each_memory_bank(bank) { - of_write_number(tmp + len, bank->start, addr_cell_len); + u8 tmp[16]; /* Up to 64-bit address + 64-bit size */ + int len = 0; + + /* Create a /memory node for each bank */ + memnode_name = basprintf("/memory@%lx", bank->start); + if (!memnode_name) { + err = -ENOMEM; + goto err_out; + } + + memnode = of_create_node(root, memnode_name); + if (!memnode) { + err = -ENOMEM; + goto err_free; + } + + err = of_property_write_string(memnode, "device_type", + "memory"); + if (err) + goto err_free; + + of_write_number(tmp, bank->start, addr_cell_len); len += addr_cell_len * 4; of_write_number(tmp + len, bank->size, size_cell_len); len += size_cell_len * 4; - } - err = of_set_property(memnode, "reg", tmp, len, 1); - if (err) { - pr_err("could not set reg %s.\n", strerror(-err)); - return err; + err = of_set_property(memnode, "reg", tmp, len, 1); + if (err) { + pr_err("could not set reg %s.\n", strerror(-err)); + goto err_free; + } + + free(memnode_name); } return 0; + +err_free: + free(memnode_name); +err_out: + return err; } static int of_register_memory_fixup(void) -- cgit v1.2.3 From 1714e048a62d214bf2cc298f519d8b78d90319b3 Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Mon, 11 Feb 2019 17:44:00 +0100 Subject: net: phy: micrel: backport ksz9031 125MHz ref-clk workaround This patch backports linux commit e1b505a60366 ("net: phy: micrel: add 125MHz reference clock workaround"). 8<--------------------- The original commit message ------------------- net: phy: micrel: add 125MHz reference clock workaround The micrel KSZ9031 phy has a optional clock pin (CLK125_NDO) which can be used as reference clock for the MAC unit. The clock signal must meet the RGMII requirements to ensure the correct data transmission between the MAC and the PHY. The KSZ9031 phy does not fulfill the duty cycle requirement if the phy is configured as slave. For a complete describtion look at the errata sheets: DS80000691D or DS80000692D. The errata sheet recommends to force the phy into master mode whenever there is a 1000Base-T link-up as work around. Only set the "micrel,force-master" property if you use the phy reference clock provided by CLK125_NDO pin as MAC reference clock in your application. Attenation, this workaround is only usable if the link partner can be configured to slave mode for 1000Base-T. Signed-off-by: Markus Niebel [m.felsch@pengutronix.de: fix dt-binding documentation] [m.felsch@pengutronix.de: use already existing result var for read/write] [m.felsch@pengutronix.de: add error handling] [m.felsch@pengutronix.de: add more comments] Signed-off-by: Marco Felsch Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller 8<--------------------------------------------------------------------- Signed-off-by: Marco Felsch Signed-off-by: Sascha Hauer --- drivers/net/phy/micrel.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 67c2ca9d54..8f0b81d8fa 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -220,6 +220,7 @@ static int ksz9031_config_init(struct phy_device *phydev) "txd2-skew-ps", "txd3-skew-ps" }; static const char *control_skews[2] = {"txen-skew-ps", "rxdv-skew-ps"}; + int ret; if (!of_node && dev->parent->device_node) of_node = dev->parent->device_node; @@ -240,9 +241,40 @@ static int ksz9031_config_init(struct phy_device *phydev) ksz9031_of_load_skew_values(phydev, of_node, MII_KSZ9031RN_TX_DATA_PAD_SKEW, 4, tx_data_skews, 4); + + /* Silicon Errata Sheet (DS80000691D or DS80000692D): + * When the device links in the 1000BASE-T slave mode only, + * the optional 125MHz reference output clock (CLK125_NDO) + * has wide duty cycle variation. + * + * The optional CLK125_NDO clock does not meet the RGMII + * 45/55 percent (min/max) duty cycle requirement and therefore + * cannot be used directly by the MAC side for clocking + * applications that have setup/hold time requirements on + * rising and falling clock edges. + * + * Workaround: + * Force the phy to be the master to receive a stable clock + * which meets the duty cycle requirement. + */ + if (of_property_read_bool(of_node, "micrel,force-master")) { + ret = phy_read(phydev, MII_CTRL1000); + if (ret < 0) + goto err_force_master; + + /* enable master mode, config & prefer master */ + ret |= CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER; + ret = phy_write(phydev, MII_CTRL1000, ret); + if (ret < 0) + goto err_force_master; + } } return ksz9031_center_flp_timing(phydev); + +err_force_master: + dev_err(dev, "failed to force the phy to master mode\n"); + return ret; } #define KSZ8873MLL_GLOBAL_CONTROL_4 0x06 -- cgit v1.2.3 From 7185b353c96e1e831533eeaaada06ad9bebf84a2 Mon Sep 17 00:00:00 2001 From: Antony Pavlov Date: Tue, 12 Feb 2019 09:34:39 +0300 Subject: nvmem: eeprom_93xx46: fix whitespaces Signed-off-by: Antony Pavlov Signed-off-by: Sascha Hauer --- drivers/nvmem/eeprom_93xx46.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/nvmem/eeprom_93xx46.c b/drivers/nvmem/eeprom_93xx46.c index d96ba32d07..49ed396dc2 100644 --- a/drivers/nvmem/eeprom_93xx46.c +++ b/drivers/nvmem/eeprom_93xx46.c @@ -339,7 +339,7 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi) if (of_property_read_bool(np, "read-only")) pd->flags |= EE_READONLY; - pd->select =of_get_named_gpio_flags(np, "select", 0, &of_flags); + pd->select = of_get_named_gpio_flags(np, "select", 0, &of_flags); if (gpio_is_valid(pd->select)) { char *name; @@ -441,6 +441,3 @@ static struct driver_d eeprom_93xx46_driver = { .of_compatible = DRV_OF_COMPAT(eeprom_93xx46_of_table), }; device_spi_driver(eeprom_93xx46_driver); - - - -- cgit v1.2.3