assortment of fixes/enhancements
Subsystems (7)
cover assortment of fixes/enhancements
From: Marcel Ziswiler <[email protected]>
This patch set is an assortment of fixes/enhancements distilled straight from our downstream integration work.
Marcel Ziswiler (4):
net: asix: fix operation without eeprom
generic-board: allow showing custom board info
colibri_vf: remove spurious new line
mtd/nand/ubi: assortment of alignment fixes
Max Krummenacher (3):
fs/fs.c: read up to EOF when len would read past EOF image-fdt.c: store returned error value tftp.c: fix CONFIG_TFTP_TSIZE for small files
Stefan Agner (1):
logos: add Toradex logo
common/board_info.c | 2 +- common/cmd_ubi.c | 2 +- common/image-fdt.c | 3 ++- drivers/mtd/nand/nand_util.c | 2 +- drivers/usb/eth/asix.c | 27 ++++++++++++++++++++++++++- fs/fs.c | 6 ++---- fs/ubifs/super.c | 4 ++-- fs/ubifs/ubifs.c | 4 ++-- include/configs/colibri_vf.h | 1 - lib/gzip.c | 2 +- net/tftp.c | 2 ++ tools/logos/toradex.bmp | Bin 0 -> 24982 bytes 12 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 tools/logos/toradex.bmp
Signature · 1 line
1.9.3
PATCH 1/8 fs/fs.c: read up to EOF when len would read past EOF
From: Max Krummenacher <[email protected]>
http://lists.denx.de/pipermail/u-boot/2012-September/134347.html
allows for reading files in chunks from the shell.
When this feature is used to read past the end of a file an error was returned instead of returning the bytes read up to the end of file. Thus the following fails in the shell:
offset = 0
len = chunksize
do
read file, offset, len
write data
until bytes_read < len
The patch changes the behaviour to printing an informational message and returning the actual read number of bytes.
--- fs/fs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/fs.c +2 -4
@@ -301,10 +301,8 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,unmap_sysmem (buf);/* If we requested a specific number of bytes, check we got it */ -if (ret ==0 && len && *actread != len) { -printf ("** Unable to read file %s **\n" , filename); - ret =-1 ; - } +if (ret ==0 && len && *actread != len) +printf ("** %s shorter than offset + len **\n" , filename);fs_close ();return ret;
Signature · 1 line
1.9.3
PATCH 1/8 fs/fs.c: read up to EOF when len would read past EOF
Quoted 16 lines · Marcel Ziswiler
From: Max Krummenacher <[email protected]>
http://lists.denx.de/pipermail/u-boot/2012-September/134347.html
allows for reading files in chunks from the shell.When this feature is used to read past the end of a file an error was returned instead of returning the bytes read up to the end of file. Thus the following fails in the shell:
offset = 0
len = chunksize
do
read file, offset, len
write data
untilbytes_read< len
Quoted 5 lines
The patch changes the behaviour to printing an informational message and returning the actual read number of bytes.
Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>
So this behaves like read(2) now, right ?
Best regards,
Marek Vasut
PATCH 1/8 fs/fs.c: read up to EOF when len would read past EOF
Quoted 1 line · Marek Vasut
So this behaves like read(2) now, right ?
Exactly for convenient use in U-Boot scripts.
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
PATCH 2/8 net: asix: fix operation without eeprom
In reply to Marcel ZiswilerFrom: Marcel Ziswiler <[email protected]>
This patch fixes operation of our on-board AX88772B chip without EEPROM but with a ethaddr coming from the regular U-Boot environment. This is a forward port of some remaining parts initially implemented by Antmicro.
--- drivers/usb/eth/asix.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/usb/eth/asix.c +26 -1
@@ -1,5 +1,8 @@/* * Copyright (c) 2011 The Chromium OS Authors. +* Copyright (c) 2012-2014 Toradex, Inc. +* +* Patched for AX88772B by Antmicro Ltd <www.antmicro.com> * * SPDX-License-Identifier: GPL-2.0+ */
@@ -64,8 +67,14 @@ AX_MEDIUM_AC | AX_MEDIUM_RE)/* AX88772 & AX88178 RX_CTL values */ +#define AX_RX_CTL_RH2M 0x0200/* Enable IP header in receive +buffer aligned on 32-bit +boundary */ +#define AX_RX_CTL_RH1M 0x0100/* Enable RX-Header mode 0 */ #define AX_RX_CTL_SO 0x0080#define AX_RX_CTL_AB 0x0008 +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | \ + AX_RX_CTL_RH2M)#define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB)
@@ -426,7 +435,15 @@ static int asix_init(struct eth_device *eth, bd_t *bd)debug ("** %s()\n" , __func__); -if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) { +if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL | +AX_RX_HEADER_DEFAULT ) <0 ) + goto out_err; + }else if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) + goto out_err; + +if (asix_write_hwaddr (eth) <0 ) goto out_err; do {
@@ -447,6 +464,10 @@ static int asix_init(struct eth_device *eth, bd_t *bd) goto out_err; } +/* Wait some more to avoid timeout on first transfer +(e.g. EHCI timed out on TD - token=0x8008d80) */ +udelay (25000 ); +return 0 ; out_err:return -1 ;
@@ -533,6 +554,10 @@ static int asix_recv(struct eth_device *eth)return -1 ; } +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) + buf_ptr +=2 ; +/* Notify net stack */ net_process_received_packet (buf_ptr +sizeof (packet_len), packet_len);
Signature · 1 line
1.9.3
PATCH 2/8 net: asix: fix operation without eeprom
On Thursday, July 02, 2015 at 01:04:47 AM, Marcel Ziswiler wrote:
Hi!
[...]
drivers/usb/eth/asix.c line 70
Quoted 5 lines
drivers/usb/eth/asix.c +1
-0@@ -64,8 +67,14 @@ AX_MEDIUM_AC | AX_MEDIUM_RE)/* AX88772 & AX88178 RX_CTL values */ +#define AX_RX_CTL_RH2M 0x0200/* Enable IP header in
receive
drivers/usb/eth/asix.c line 72
Quoted 2 lines
drivers/usb/eth/asix.c +2
-0+buffer aligned on 32-bit +boundary */
The comments need a bit of polishing, though it is not the main problem I have with this patch. The multiline comments should be like this according to kernel coding style (to my knowledge):
/*
* foo
* bar
* baz
*/
Review line 73
Quoted 1 line
(quoted diff) +1
-0+#define AX_RX_CTL_RH1M 0x0100 /* Enable RX-Header mode
0 */
Quoted 8 lines
drivers/usb/eth/asix.c +2
-0#define AX_RX_CTL_SO 0x0080#define AX_RX_CTL_AB 0x0008 +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | \ + AX_RX_CTL_RH2M)#define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB)
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth, bd_t *bd) · line 439
Quoted 6 lines
drivers/usb/eth/asix.c +2
-1@@ -426,7 +435,15 @@ static int asix_init(struct eth_device *eth, bd_t *bd)debug ("** %s()\n" , __func__); -if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) {
I don't like hardcoding these constants here (and further down). I understand that those are AX88792B chips (or whatever the number is, there's a B at the end and they're not exactly compatible with the original AX88792), but what about making this a bit more generic?
What I expect is that when AX88792C comes, we'd just add another if (idVendor == ... ) into this code here with another magic number and it will become an unmaintainable horror.
Maybe add a function which handles quirks of each revision (B, C, ...) of the ASIX chip and definitelly define those magic numbers as macros.
Quoted 10 lines
drivers/usb/eth/asix.c +7
-0+if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL | +AX_RX_HEADER_DEFAULT ) <0 ) + goto out_err; + }else if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) + goto out_err; + +if (asix_write_hwaddr (eth) <0 ) goto out_err; do {
[...]
PATCH 2/8 net: asix: fix operation without eeprom
Quoted 12 lines · Marek Vasut
On Thursday, July 02, 2015 at 01:04:47 AM, Marcel Ziswiler wrote:
Hi!
[...]
drivers/usb/eth/asix.c line 70
Quoted 5 lines
drivers/usb/eth/asix.c +1
-0@@ -64,8 +67,14 @@ AX_MEDIUM_AC | AX_MEDIUM_RE)/* AX88772 & AX88178 RX_CTL values */ +#define AX_RX_CTL_RH2M 0x0200/* Enable IP header in receive
Quoted 6 lines
drivers/usb/eth/asix.c line 72
Quoted 2 lines
drivers/usb/eth/asix.c +2
-0+buffer aligned on 32-bit +boundary */ The comments need a bit of polishing, though it is not the main problem I have
with this patch.
I was hesitant at first but then decided to submit it anyway to get some feedback on the thematic. So thank you very much!
Quoted 9 lines
The multiline comments should be like this according to kernel
coding style (to my knowledge):/*
* foo
* bar
* baz
*/
Yeah, sorry. My bad. I since got educated in doing this but stumble over it at times on older patches.
Quoted 14 lines
Review line 73
Quoted 1 line
(quoted diff) +1
-0+#define AX_RX_CTL_RH1M 0x0100 /* Enable RX-Header mode0 */
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth,
Quoted 8 lines
drivers/usb/eth/asix.c +2
-0#define AX_RX_CTL_SO 0x0080#define AX_RX_CTL_AB 0x0008 +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | \ + AX_RX_CTL_RH2M)#define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB)@@ -426,7 +435,15 @@ static int asix_init(struct eth_device *eth,
bd_t*bd)Quoted 3 lines
drivers/usb/eth/asix.c +0
-0debug ("** %s()\n" , __func__);
Quoted 8 lines
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth, bd_t *bd) · line 439
Quoted 3 lines
drivers/usb/eth/asix.c +2
-1-if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) {I don't like hardcoding these constants here (and further down). I understand that those are AX88792B chips (or whatever the number is, there's a B at the end and they're not exactly compatible with the original AX88792), but what about making this a bit more generic?
AX88772B actually and yes there seem to be C variants of that same chip out now as well but we haven't gotten our hands on any such yet. I just do remember that ASIX does not take backwards compatibility too serious.
Quoted 3 lines
What I expect is that when AX88792C comes, we'd just add another if (idVendor == ... ) into this code here with another magic number and it will become an unmaintainable horror.
Understood.
Quoted 2 lines
Maybe add a function which handles quirks of each revision (B, C, ...) of the ASIX chip and definitelly define those magic numbers as macros.
Agreed.
Quoted 12 lines
Quoted 10 lines
drivers/usb/eth/asix.c +7
-0+if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL | +AX_RX_HEADER_DEFAULT ) <0 ) + goto out_err; + }else if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) + goto out_err; + +if (asix_write_hwaddr (eth) <0 ) goto out_err; do {[...]
PATCH 2/8 net: asix: fix operation without eeprom
Quoted 4 lines · Marcel Ziswiler
Quoted 3 lines · Marek Vasut
On Thursday, July 02, 2015 at 01:04:47 AM, Marcel Ziswiler wrote:
Hi!
Hi!
Quoted 19 lines
Quoted 12 lines
[...]
drivers/usb/eth/asix.c line 72
Quoted 7 lines
drivers/usb/eth/asix.c +1
-0@@ -64,8 +67,14 @@ AX_MEDIUM_AC | AX_MEDIUM_RE)/* AX88772 & AX88178 RX_CTL values */ +#define AX_RX_CTL_RH2M 0x0200/* Enable IP header in receive
Quoted 6 lines
drivers/usb/eth/asix.c line 72
Quoted 2 lines
drivers/usb/eth/asix.c +2
-0+buffer aligned on 32-bit +boundary */ The comments need a bit of polishing, though it is not the main problem I have
with this patch.
Quoted 2 lines
I was hesitant at first but then decided to submit it anyway to get some feedback on the thematic. So thank you very much!
No worries :)
Quoted 6 lines
Quoted 6 lines
The multiline comments should be like this according to kernel
coding style (to my knowledge):/*
Quoted 7 lines
Quoted 4 lines
* foo
* bar
* baz
*/Yeah, sorry. My bad. I since got educated in doing this but stumble over it at times on older patches.
Yeah, the code in certain areas of U-Boot isn't the pinacle of coding style excellence for sure.
Quoted 29 lines
Quoted 20 lines
Review line 75
Quoted 1 line
(quoted diff) +1
-0+#define AX_RX_CTL_RH1M 0x0100 /* Enable RX-Header mode0 */
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth,
Quoted 11 lines
drivers/usb/eth/asix.c +2
-0#define AX_RX_CTL_SO 0x0080#define AX_RX_CTL_AB 0x0008 +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | \ + AX_RX_CTL_RH2M)#define
AX_DEFAULT_RX_CTL\drivers/usb/eth/asix.c +0
-0(AX_RX_CTL_SO |AX_RX_CTL_AB )@@ -426,7 +435,15 @@ static int asix_init(struct eth_device *eth,
bd_t*bd)Quoted 2 lines
drivers/usb/eth/asix.c +0
-0debug ("** %s()\n" , __func__);Quoted 8 lines
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth, bd_t *bd) · line 439
Quoted 3 lines
drivers/usb/eth/asix.c +2
-1-if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) {I don't like hardcoding these constants here (and further down). I understand that those are AX88792B chips (or whatever the number is, there's a B at the end and they're not exactly compatible with the original AX88792), but what about making this a bit more generic?
Quoted 3 lines
AX88772B actually and yes there seem to be C variants of that same chip out now as well but we haven't gotten our hands on any such yet. I just do remember that ASIX does not take backwards compatibility too serious.
Yeah, that I can confirm this.
Quoted 10 lines
Quoted 3 lines
What I expect is that when AX88792C comes, we'd just add another if (idVendor == ... ) into this code here with another magic number and it will become an unmaintainable horror.
Understood.
Quoted 2 lines
Maybe add a function which handles quirks of each revision (B, C, ...) of the ASIX chip and definitelly define those magic numbers as macros.
Agreed.
OK, thanks! :-)
[...]
PATCH 2/8 net: asix: fix operation without eeprom
In reply to Marcel ZiswilerHi Marcel,
Quoted 26 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
This patch fixes operation of our on-board AX88772B chip without EEPROM but with a ethaddr coming from the regular U-Boot environment. This is a forward port of some remaining parts initially implemented by Antmicro.
Signed-off-by Marcel Ziswiler <[email protected]>--- drivers/usb/eth/asix.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)drivers/usb/eth/asix.c +3
-0@@ -1,5 +1,8 @@/* * Copyright (c) 2011 The Chromium OS Authors. +* Copyright (c) 2012-2014 Toradex, Inc. +* +* Patched for AX88772B by Antmicro Ltd <www.antmicro.com> * * SPDX-License-Identifier: GPL-2.0+ */
drivers/usb/eth/asix.c line 72
Quoted 6 lines
drivers/usb/eth/asix.c +3
-0@@ -64,8 +67,14 @@ AX_MEDIUM_AC | AX_MEDIUM_RE)/* AX88772 & AX88178 RX_CTL values */ +#define AX_RX_CTL_RH2M 0x0200/* Enable IP header in receive +buffer aligned on 32-bit +boundary */
Definitely use checkpatch.pl on this series. I recommend patman.
drivers/usb/eth/asix.c line 77
Quoted 5 lines
drivers/usb/eth/asix.c +3
-0+#define AX_RX_CTL_RH1M 0x0100/* Enable RX-Header mode 0 */ #define AX_RX_CTL_SO 0x0080#define AX_RX_CTL_AB 0x0008 +#define AX_RX_HEADER_DEFAULT (AX_RX_CTL_RH1M | \ + AX_RX_CTL_RH2M)
I'm guessing this is ported from the ASIX Linux driver. Perhaps mention in the log where it came from.
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth, bd_t *bd) · line 439
Quoted 10 lines
drivers/usb/eth/asix.c +2
-1#define AX_DEFAULT_RX_CTL \ (AX_RX_CTL_SO | AX_RX_CTL_AB)@@ -426,7 +435,15 @@ static int asix_init(struct eth_device *eth, bd_t *bd)debug ("** %s()\n" , __func__); -if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b )) {
Please don't use magic numbers. Also, ideally don't create PID hacks.
Quoted 11 lines
drivers/usb/eth/asix.c +7
-0+if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL | +AX_RX_HEADER_DEFAULT ) <0 ) + goto out_err; + }else if (asix_write_rx_ctl (dev,AX_DEFAULT_RX_CTL ) <0 ) + goto out_err; + +if (asix_write_hwaddr (eth) <0 ) goto out_err; do {
drivers/usb/eth/asix.c static int asix_init(struct eth_device *eth, bd_t *bd) · line 469
Quoted 6 lines
drivers/usb/eth/asix.c +3
-0@@ -447,6 +464,10 @@ static int asix_init(struct eth_device *eth, bd_t *bd) goto out_err; } +/* Wait some more to avoid timeout on first transfer +(e.g. EHCI timed out on TD - token=0x8008d80) */ +udelay (25000 );
Is this always needed or is it only helpful to your device?
drivers/usb/eth/asix.c static int asix_recv(struct eth_device *eth) · line 558
Quoted 10 lines
drivers/usb/eth/asix.c +3
-0+return 0 ; out_err:return -1 ;@@ -533,6 +554,10 @@ static int asix_recv(struct eth_device *eth)return -1 ; } +if ((dev->pusb_dev->descriptor.idVendor ==0x0b95 ) && + (dev->pusb_dev->descriptor.idProduct ==0x772b ))
Again, Avoid PID hacks and at least magic numbers.
drivers/usb/eth/asix.c static int asix_recv(struct eth_device *eth) · line 563
Quoted 5 lines
drivers/usb/eth/asix.c +2
-0+ buf_ptr +=2 ; +/* Notify net stack */ net_process_received_packet (buf_ptr +sizeof (packet_len), packet_len);
Thanks,
-Joe
PATCH 2/8 net: asix: fix operation without eeprom
Hi Joe
Quoted 1 line · Joe Hershberger
Definitely use checkpatch.pl on this series.
Yeah, it's been late and I somehow forgot about it. I already run v2 about to be posted through it now.
Quoted 1 line
I recommend patman.
So far I have not used that one yet but thanks for the tip.
Quoted 2 lines
I'm guessing this is ported from the ASIX Linux driver. Perhaps mention in the log where it came from.
As mentioned in the log it actually came from Antmicro who did an initial port way back 2011.
Quoted 1 line
Please don't use magic numbers.
I already got rid of this in v2.
Quoted 1 line
Also, ideally don't create PID hacks.
Understood, unfortunately I don't know what the effect of this on other ASIX variants is.
Quoted 1 line
Is this always needed or is it only helpful to your device?
Good question which posting it here I hoped to get some more feedback about.
Cheers
Marcel
PATCH 3/8 generic-board: allow showing custom board info
In reply to Marcel ZiswilerFrom: Marcel Ziswiler <[email protected]>
Allow showing custom board info from a checkboard() function being implemented if CONFIG_CUSTOM_BOARDINFO is specified.
--- common/board_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_info.c +1 -1
@@ -19,7 +19,7 @@ int __weak checkboard(void)*/ int show_board_info (void ) { -#ifdef CONFIG_OF_CONTROL +#if defined(CONFIG_OF_CONTROL ) && !defined(CONFIG_CUSTOM_BOARDINFO )DECLARE_GLOBAL_DATA_PTR ;const char *model;
Signature · 1 line
1.9.3
PATCH 3/8 generic-board: allow showing custom board info
Hi Marcel,
Quoted 5 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Allow showing custom board info from a
checkboard()function being implemented ifCONFIG_CUSTOM_BOARDINFOis specified.
Can you reword this? It seems confusing. From what I can tell you are turning off the device tree model display if CONFIG_CUSTOM_BOARDINFO is enabled.
Quoted 19 lines
Signed-off-by Marcel Ziswiler <[email protected]>--- common/board_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)common/board_info.c +1
-2@@ -19,7 +19,7 @@ int __weak checkboard(void)*/ int show_board_info (void ) { -#ifdef CONFIG_OF_CONTROL +#if defined(CONFIG_OF_CONTROL ) && !defined(CONFIG_CUSTOM_BOARDINFO )DECLARE_GLOBAL_DATA_PTR ;const char *model; --
Quoted 2 lines
1.9.3
Regards,
Simon
PATCH 4/8 logos: add Toradex logo
In reply to Marcel ZiswilerFrom: Stefan Agner <[email protected]>
Use the boot loader splash screen from WinCE which matches our wallpapers position wise. Although the logo is an 8-bit indexed BMP as well colours looked odd at first in U-Boot. After converting to full RGB palette and converting back to an indexed BMP using imagemagick the Logo showed up properly.
$ convert tools/logos/toradex-rgb.bmp -type Palette -colors 256 \ -compress none -verbose BMP3:tools/logos/toradex.bmp
--- tools/logos/toradex.bmp | Bin 0 -> 24982 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tools/logos/toradex.bmp
tools/logos/toradex.bmp new file binary +0 -0
z)o?ge$H&KN5I<3e=V$8d>X=FOvUf4RF-9GwOXm?&!4O0&+n+q7w at T?zki_KefM4U z{>E%7cX9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KWV8^D0I*mVt~PJGOmE9#<+EV64omZv35q*tnIPTyZuWZ5)f&7 z-0QnZ<Au)qzUx5-0W9t78Nrn9@m3^6|>cMjrbfb_@#o*NK0+sFpH85hr<%SLUPny zE|XoV@k7oK<8Ll8?R>UQf{oje5g!dZu{Y;JSgM3SvvA_W*F$cfAp}RVe5D<G(7}wO z6e)$fZ+uN}v7%n9Vnk}?VW|S2%6PQQi!(p$=S@M~9ErSJ??<%_(ACwm{+}5T?I4zF z2tNb$lY7fi6UhIL0Gf+Ijq4z<vU*U!B!GoE-C;)X0T){rA4>=yyJ at w83nXkzX3_A8 zHL<%Nj>fWqygWbM5y|ixM_$oHzUW)u&fB58h?8WuMhmOl+nmPNO9K at AHaUbOvk-H- zE*B{p0Wza?ECHRF&|1}KMT;Vb)I5kuun;XMHbOJ?nlSt)6?<s<Nog35(?jRYx&= z5R@ieP#6+}Q39>fxM>5Rcrs}hTgJj-f-H;$3}Oild(o;>{w1C^VEN|7>B92OOY%w_ zdFLhp+AEQGeVyJeER(d6*cUDur4n_#KA3t at db_ZcO^xrQ1NkjBvKKI~(CF>L(rs!2 z2-+e!9eV{h?$qTi!_w>wENsEd9?O0z;Wo at c7^!gG3~>69zH_U$O)phkc7Ir6YWyAU RodMc0QTRs=7z!{{x@?rvLx|
literal 0
HcmV?d00001
Signature · 1 line
1.9.3
PATCH 5/8 colibri_vf: remove spurious new line
In reply to Marcel ZiswilerFrom: Marcel Ziswiler <[email protected]>
Remove spurious new line in configuration file.
--- include/configs/colibri_vf.h | 1 - 1 file changed, 1 deletion(-)
include/configs/colibri_vf.h +0 -1
@@ -69,7 +69,6 @@"512k(u-boot-env)," \ "-(ubi)" -#define CONFIG_MMC #define CONFIG_FSL_ESDHC #define CONFIG_SYS_FSL_ESDHC_ADDR 0
Signature · 1 line
1.9.3
PATCH 5/8 colibri_vf: remove spurious new line
Quoted 5 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Remove spurious new line in configuration file.
Signed-off-by Marcel Ziswiler <[email protected]>
This doesn't break anything, so:
Best regards,
Marek Vasut
PATCH 6/8 image-fdt.c: store returned error value
In reply to Marcel ZiswilerFrom: Max Krummenacher <[email protected]>
This fixes the following warning (and the runtime error reporting):../common/image-fdt.c:491:4: warning: 'fdt_ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
--- common/image-fdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/image-fdt.c +2 -1
@@ -492,7 +492,8 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, } }if (IMAGE_OF_SYSTEM_SETUP ) { -if (ft_system_setup (blob, gd->bd)) { + fdt_ret =ft_system_setup (blob, gd->bd); +if (fdt_ret) {printf ("ERROR: system-specific fdt fixup failed: %s\n" ,fdt_strerror (fdt_ret)); goto err;
Signature · 1 line
1.9.3
PATCH 6/8 image-fdt.c: store returned error value
Quoted 8 lines · Marcel Ziswiler
From: Max Krummenacher <[email protected]>
This fixes the following warning (and the runtime error reporting):
../common/image-fdt.c:491:4: warning: 'fdt_ret' may be used uninitialized in this function [-Wmaybe-uninitialized]Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>
Best regards,
Marek Vasut
PATCH 6/8 image-fdt.c: store returned error value
Quoted 11 lines · Marek Vasut
Quoted 8 lines · Marcel Ziswiler
From: Max Krummenacher <[email protected]>
This fixes the following warning (and the runtime error reporting):
../common/image-fdt.c:491:4: warning: 'fdt_ret' may be used uninitialized in this function [-Wmaybe-uninitialized]Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>Acked-by Marek Vasut <[email protected]>
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
In reply to Marcel ZiswilerFrom: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer alignment into account which led to failures of the following form:
ERROR: v7_dcache_inval_range - start address is not aligned - 0x1f7f0108
ERROR: v7_dcache_inval_range - stop address is not aligned - 0x1f7f1108
--- common/cmd_ubi.c | 2 +- drivers/mtd/nand/nand_util.c | 2 +- fs/ubifs/super.c | 4 ++-- fs/ubifs/ubifs.c | 4 ++-- lib/gzip.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
common/cmd_ubi.c +1 -1
@@ -363,7 +363,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size) tbuf_size = vol->usable_leb_size;if (size < tbuf_size) tbuf_size =ALIGN (size, ubi->min_io_size); - tbuf =malloc (tbuf_size); + tbuf =memalign (ARCH_DMA_MINALIGN , tbuf_size);if (!tbuf) {printf ("NO MEM\n" );return ENOMEM ;
drivers/mtd/nand/nand_util.c +1 -1
@@ -839,7 +839,7 @@ int nand_torture(nand_info_t *nand, loff_t offset) patt_count =ARRAY_SIZE (patterns); - buf =malloc (nand->erasesize); + buf =memalign (ARCH_DMA_MINALIGN , nand->erasesize);if (buf ==NULL ) {puts ("Out of memory for erase block buffer\n" );return -ENOMEM ;
fs/ubifs/super.c +2 -2
@@ -57,7 +57,7 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino) {struct inode *inode; - inode = (struct inode *)malloc (sizeof (struct ubifs_inode )); + inode = (struct inode *)memalign (ARCH_DMA_MINALIGN ,sizeof (struct ubifs_inode ));if (inode) { inode->i_ino = ino; inode->i_sb = sb;
@@ -104,7 +104,7 @@ void iput(struct inode *inode)/* * Allocate and use new inode */ - ino = (struct inode *)malloc (sizeof (struct ubifs_inode )); + ino = (struct inode *)memalign (ARCH_DMA_MINALIGN ,sizeof (struct ubifs_inode ));memcpy (ino, inode,sizeof (struct ubifs_inode ));/*
fs/ubifs/ubifs.c +2 -2
@@ -108,7 +108,7 @@ static inline struct crypto_comp *crypto_alloc_comp(const char *alg_name,struct crypto_comp *ptr;int i =0 ; - ptr =malloc (sizeof (struct crypto_comp )); + ptr =memalign (ARCH_DMA_MINALIGN ,sizeof (struct crypto_comp ));while (i <UBIFS_COMPR_TYPES_CNT ) { comp = ubifs_compressors[i];if (!comp) {
@@ -723,7 +723,7 @@ static int do_readpage(struct ubifs_info *c, struct inode *inode,* destination area to a multiple of * UBIFS_BLOCK_SIZE. */ - buff =malloc (UBIFS_BLOCK_SIZE ); + buff =memalign (ARCH_DMA_MINALIGN ,UBIFS_BLOCK_SIZE );if (!buff) {printf ("%s: Error, malloc fails!\n" , __func__);
lib/gzip.c +1 -1
@@ -25,7 +25,7 @@ static void *zalloc(void *x, unsigned items, unsigned size) size *= items; size = (size +ZALLOC_ALIGNMENT -1 ) & ~(ZALLOC_ALIGNMENT -1 ); - p =malloc (size); + p =memalign (ARCH_DMA_MINALIGN , size);return (p); }
Signature · 1 line
1.9.3
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 9 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer alignment into account which led to failures of the following form:
ERROR:
v7_dcache_inval_range- start address is not aligned -0x1f7f0108
ERROR:v7_dcache_inval_range- stop address is not aligned -0x1f7f1108Signed-off-by Marcel Ziswiler <[email protected]>
What about using ALLOC_CACHE_ALIGN_BUFFER() and friends instead ? See include/common.h for their definition, this is what those functions are exactly for.
Best regards,
Marek Vasut
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 6 lines · Marek Vasut
Quoted 5 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer alignment into account which led to failures of the following form:
Quoted 8 lines
Quoted 4 lines
ERROR:
v7_dcache_inval_range- start address is not aligned -0x1f7f0108
ERROR:v7_dcache_inval_range- stop address is not aligned -0x1f7f1108Signed-off-by Marcel Ziswiler <[email protected]>What about using
ALLOC_CACHE_ALIGN_BUFFER()and friends instead ? Seeinclude/common.hfor their definition, this is what those functions are exactly for.
ALLOC_CACHE_ALIGN_BUFFER() is for statically allocating an aligned buffer. Dynamically allocating an aligned buffer is exactly what memalign() is for.
-Scott
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 11 lines · Scott Wood
Quoted 10 lines · Marek Vasut
Quoted 9 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer alignment into account which led to failures of the following form:
ERROR:
v7_dcache_inval_range- start address is not aligned -0x1f7f0108ERROR:v7_dcache_inval_range- stop address is not aligned
-0x1f7f1108
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Marcel Ziswiler <[email protected]>What about using
ALLOC_CACHE_ALIGN_BUFFER()and friends instead ? Seeinclude/common.hfor their definition, this is what those functions are exactly for.
ALLOC_CACHE_ALIGN_BUFFER()is for statically allocating an aligned buffer.
You're confusing this with DEFINE_ALIGN_BUFFER, no ?
Quoted 1 line
Dynamically allocating an aligned buffer is exactly what
memalign()is for.
Isn't memalign()ed memory aligned only to the start address, while the end address (and thus the length) is not aligned ? This is what memalign(3) has to say:
"
The function posix_memalign() allocates size bytes and places the address of the allocated memory in *memptr. The address of the allo? cated memory will be a multiple of alignment, which must be a power of two and a multiple of sizeof(void *). If size is 0, then the value placed in *memptr is either NULL, or a unique pointer value that can later be successfully passed to free(3).
The obsolete function memalign() allocates size bytes and returns a pointer to the allocated memory. The memory address will be a mul? tiple of alignment, which must be a power of two.
"
Best regards,
Marek Vasut
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 15 lines · Marek Vasut
Quoted 14 lines · Scott Wood
Quoted 13 lines · Marek Vasut
Quoted 11 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer
alignment into account which led to failures of the following form:ERROR:
v7_dcache_inval_range- start address is not aligned -0x1f7f0108ERROR:v7_dcache_inval_range- stop address is not aligned
-0x1f7f1108Signed-off-by Marcel Ziswiler <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
What about using
ALLOC_CACHE_ALIGN_BUFFER()and friends instead ? Seeinclude/common.hfor their definition, this is what those functions are exactly for.
ALLOC_CACHE_ALIGN_BUFFER()is for statically allocating an aligned buffer.You're confusing this with
DEFINE_ALIGN_BUFFER, no ?
OK, not "statically", but on the stack. It is not appropriate to turn dynamic allocations into stack allocations without considering how large the allocation can be. It'd also be more intrusive a change than necessary, even if the sizes were small enough.
Quoted 5 lines
Quoted 2 lines
Dynamically allocating an aligned buffer is exactly what
memalign()is for.Isn't memalign()ed memory aligned only to the start address, while the end address (and thus the length) is not aligned ?
The end address is aligned if the size passed to memalign is aligned. Maybe add a wrapper that calls memalign() with the size rounded up to ARCH_DMA_MINALIGN?
Quoted 11 lines
This is what memalign(3) has
to say:"
The functionposix_memalign()allocates size bytes and places the address of the allocated memory in *memptr. The address of the allo? cated memory will be a multiple of alignment, which must be a power of two and a multiple ofsizeof(void *). If size is 0, then the value placed in *memptr is either NULL, or a unique pointer value that can later be successfully passed to free(3).
Quoted 4 lines
The obsolete function
memalign()allocates size bytes and returns a pointer to the allocated memory. The memory address will be a mul? tiple of alignment, which must be a power of two.
"
posix_memalign() does not exist in U-Boot, and it's not clear to me why memalign() should be considered obsolete. Is the difference just the ability to return -EINVAL?
-Scott
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 23 lines · Scott Wood
Quoted 22 lines · Marek Vasut
Quoted 20 lines · Scott Wood
Quoted 11 lines · Marek Vasut
Quoted 10 lines · Marcel Ziswiler
From: Marcel Ziswiler <[email protected]>
Various U-Boot adoptions/extensions to MTD/NAND/UBI did not take buffer
alignment into account which led to failures of the following form:ERROR:
v7_dcache_inval_range- start address is not aligned -0x1f7f0108ERROR:v7_dcache_inval_range- stop address is not aligned -0x1f7f1108Quoted 5 lines
Quoted 1 line
Signed-off-by Marcel Ziswiler <[email protected]>What about using
ALLOC_CACHE_ALIGN_BUFFER()and friends instead ? Seeinclude/common.hfor their definition, this is what those functions are exactly for.
ALLOC_CACHE_ALIGN_BUFFER()is for statically allocating an aligned buffer.
Quoted 6 lines
Quoted 1 line
You're confusing this with
DEFINE_ALIGN_BUFFER, no ?OK, not "statically", but on the stack. It is not appropriate to turn dynamic allocations into stack allocations without considering how large the allocation can be. It'd also be more intrusive a change than necessary, even if the sizes were small enough.
Fine.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
Dynamically allocating an aligned buffer is exactly what
memalign()is for.Isn't memalign()ed memory aligned only to the start address, while the end address (and thus the length) is not aligned ?
The end address is aligned if the size passed to memalign is aligned. Maybe add a wrapper that calls
memalign()with the size rounded up toARCH_DMA_MINALIGN?
I agree.
Quoted 12 lines
Quoted 12 lines
This is what memalign(3) has
to say:
"
The functionposix_memalign()allocates size bytes and places the address of the allocated memory in *memptr. The address of the allo? cated memory will be a multiple of alignment, which must be a power of two and a multiple ofsizeof(void *). If size is 0, then the value placed in *memptr is either NULL, or a unique pointer value that can later be successfully passed to free(3).
Quoted 8 lines
Quoted 4 lines
The obsolete function
memalign()allocates size bytes and returns a pointer to the allocated memory. The memory address will be a mul? tiple of alignment, which must be a power of two.
"
posix_memalign()does not exist in U-Boot, and it's not clear to me whymemalign()should be considered obsolete. Is the difference just the ability to return-EINVAL?
The args are also totally different.
Best regards,
Marek Vasut
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 20 lines · Marek Vasut
Quoted 19 lines · Scott Wood
Quoted 17 lines · Marek Vasut
This is what memalign(3) has
to say:
"
The functionposix_memalign()allocates size bytes and places the address of the allocated memory in *memptr. The address of the allo? cated memory will be a multiple of alignment, which must be a power of two and a multiple ofsizeof(void *). If size is 0, then the value placed in *memptr is either NULL, or a unique pointer value that can later be successfully passed to free(3).The obsolete function
memalign()allocates size bytes and returns a pointer to the allocated memory. The memory address will be a mul? tiple of alignment, which must be a power of two.
"
Quoted 5 lines
Quoted 3 lines
posix_memalign()does not exist in U-Boot, and it's not clear to me whymemalign()should be considered obsolete. Is the difference just the ability to return-EINVAL?The args are also totally different.
...in order to accommodate returning an error value.
-Scott
PATCH 7/8 mtd/nand/ubi: assortment of alignment fixes
Quoted 20 lines · Scott Wood
Quoted 19 lines · Marek Vasut
Quoted 18 lines · Scott Wood
Quoted 16 lines · Marek Vasut
This is what memalign(3) has
to say:
"
The functionposix_memalign()allocates size bytes and places the address of the allocated memory in *memptr. The address of the allo? cated memory will be a multiple of alignment, which must be a power of two and a multiple ofsizeof(void *). If size is 0, then the value placed in *memptr is either NULL, or a unique pointer value that can later be successfully passed to free(3).The obsolete function
memalign()allocates size bytes and returns a pointer to the allocated memory. The memory address will be a mul? tiple of alignment, which must be a power of two.
"
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
posix_memalign()does not exist in U-Boot, and it's not clear to me whymemalign()should be considered obsolete. Is the difference just the ability to return-EINVAL?The args are also totally different.
...in order to accommodate returning an error value.
... of course.
Best regards,
Marek Vasut
PATCH 8/8 tftp.c: fix CONFIG_TFTP_TSIZE for small files
In reply to Marcel ZiswilerFrom: Max Krummenacher <[email protected]>
CONFIG_TFTP_TSIZE should limit a tftp downloads progress to 50 '#' chars. Make this work also for small files.
If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500.
When using CONFIG TFTP BLOCKSIZE together with CONFIG_IP_DEFRAG the issue is more notable.
--- net/tftp.c | 2 ++ 1 file changed, 2 insertions(+)
net/tftp.c +2 -0
@@ -249,6 +249,8 @@ static void show_block_marker(void)if (tftp_tsize) {ulong pos = tftp_cur_block * tftp_block_size + tftp_block_wrap_offset; +if (pos > tftp_tsize) + pos = tftp_tsize;while (tftp_tsize_num_hash < pos *50 / tftp_tsize) {putc ('#' );
Signature · 1 line
1.9.3
PATCH 8/8 tftp.c: fix CONFIG_TFTP_TSIZE for small files
Quoted 23 lines · Marcel Ziswiler
From: Max Krummenacher <[email protected]>
CONFIG_TFTP_TSIZEshould limit a tftp downloads progress to 50 '#' chars. Make this work also for small files.If the file size is small, i.e. smaller than 2 tftp block sizes the number of '#' can get much larger. i.e. with a 1 byte file 65000 characters are printed, with a 512 byte file around 500.
When using CONFIG TFTP BLOCKSIZE together with
CONFIG_IP_DEFRAGthe issue is more notable.Signed-off-by Max Krummenacher <[email protected]>Signed-off-by Marcel Ziswiler <[email protected]>--- net/tftp.c | 2 ++ 1 file changed, 2 insertions(+)net/tftp.c +0
-0
net/tftp.c static void show_block_marker(void) · line 252
Quoted 4 lines
net/tftp.c +1
-0@@ -249,6 +249,8 @@ static void show_block_marker(void)if (tftp_tsize) {ulong pos = tftp_cur_block * tftp_block_size + tftp_block_wrap_offset; +if (pos > tftp_tsize)
Nitpick:
if[SPACE](...
Best regards,
Marek Vasut