[PATCH] usb: otg: Add support to register more than one otg dev

2021-02-16 Thread Jules Maselbas
This allow each otg controller to register one otg device for host/peripheral mode switch. The first otg device registered "otg0" will also be aliased by "otg" for compatibility. Signed-off-by: Jules Maselbas --- drivers/usb/otg/otgdev.c | 63 +++- 1 file

[PATCH 3/8] block: use 64-bit types for sector offset and count on all platforms

2021-02-16 Thread Ahmad Fatoum
barebox' use of int for the sector offset puts an upper bound of 1TB on the size of supported block devices, which is already exceeded by common place USB mass storage. Increasing the sizes involved to 64 bit like Linux does won't magically add missing driver support, but it gives us at least a

[PATCH 7/8] show_progress: change HASHES_PER_LINE from 65 to 64 to avoid division

2021-02-16 Thread Ahmad Fatoum
Decreasing the progress bar length by one won't change visuals much, but will allow the compiler to optimize a multiplication and a modulo into bitwise operations. Signed-off-by: Ahmad Fatoum --- lib/show_progress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 4/8] usb: storage: support USB disks up to 2TiB of size

2021-02-16 Thread Ahmad Fatoum
SCSI Read Capacity (10) only supports up to 0x_ sectors at most, which at 512 bytes per sector equals a disk size of 2 TiB. Due to barebox block layer limits, however, the barebox mass storage driver doesn't address sectors that need more than 31 bits to describe. These block layer limits

[PATCH 5/8] fs: ext4: use sector_t and loff_t where appropriate

2021-02-16 Thread Ahmad Fatoum
While the block API now supports 64-bit LBAs, file systems like ext4 still use 31- and 32-bit integers at a couple of places. Fix them up. Signed-off-by: Ahmad Fatoum --- fs/ext4/ext4_common.c | 23 +-- fs/ext4/ext4_common.h | 4 ++-- fs/ext4/ext4fs.c | 34

[PATCH 6/8] fs: ext4: support files exceeding 4G

2021-02-16 Thread Ahmad Fatoum
ext4 redefines directory ACL to hold the most-significant 32-bit of the inode size for regular files. For directories, it can either be ACL or, when using largedir, the most-significant 32-bit of the directory size. Adapt the code take these upper 32-bit into consideration for determining regular

[PATCH 2/8] fs: ext4: ext4fs.h: remove unused struct members of ext_filesystem

2021-02-16 Thread Ahmad Fatoum
struct ext_filesystem is for in-memory bookkeeping but most of it is unused by barebox and just takes up space. Drop the unused members. Signed-off-by: Ahmad Fatoum --- fs/ext4/ext4fs.h | 29 - 1 file changed, 29 deletions(-) diff --git a/fs/ext4/ext4fs.h

[PATCH 0/8] Support large files on larger ext4 partitions on larger still USB disks

2021-02-16 Thread Ahmad Fatoum
Most of this series is patching in 64-bit types at a lot of places. I hope this doesn't add any nasty regressions elsewhere. I tested this on ARM 32-bit (i.MX6) and sandbox x86 and x86_64. Stuff that newly works: - Accessing all of a 2 TiB USB drive - Having multi-TB ext4 partitions - Having

[PATCH 8/8] copy_file: fix progress bar for files larger than 2G

2021-02-16 Thread Ahmad Fatoum
Files larger than 2G cause the benign bug, that the progress bar is no longer accurate. Use loff_t to fix this. Note that printed % HASHES_PER_LINE in show_progress implies a 64-bit division. A previous commit changed the constant divisor to a power of two, so a division shouldn't be generated.

[PATCH 1/8] ext4: ext_common.h: drop declaration of never-defined part_offset

2021-02-16 Thread Ahmad Fatoum
part_offset is a left-over from the U-Boot port and unused anywhere. Drop it. Signed-off-by: Ahmad Fatoum --- fs/ext4/ext_common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/ext4/ext_common.h b/fs/ext4/ext_common.h index a28f591bc441..350cc6efe535 100644 --- a/fs/ext4/ext_common.h

[PATCH 1/4] treewide: include wrapper instead of

2021-02-16 Thread Ahmad Fatoum
isn't meant for direct usage as may override this on a per-architecture basis. We don't do that currently, but in the future we might. Include the instead. No functional change. Signed-off-by: Ahmad Fatoum --- arch/arm/mach-omap/am33xx_clock.c | 2 +-

[PATCH 2/4] include: asm-generic: don't do 64-bit soft division on 64-bit platforms

2021-02-16 Thread Ahmad Fatoum
barebox implements do_div() as soft division unconditionally, even on 64-bit platforms that could use hardware 64-bit division directly. Import the whole Linux asm-generic/div64.h header to avoid this. This also has potential positive effect on 32-bit platforms: 64-bit division with constant

[PATCH 3/4] lib: remove duplicate __div64_32

2021-02-16 Thread Ahmad Fatoum
f933da28cf3f ("include: : sync with upstream") imported the div64 code from Linux, which also defines __div64_32 as a weak symbol. __div64_32 was defined before in a separate file though and used from do_div. Remove this duplication. No functional change. Signed-off-by: Ahmad Fatoum ---

[PATCH 4/4] drivers: replaces references to

2021-02-16 Thread Ahmad Fatoum
With included for do_div instead of , there remains only 3 references to asm-generic headers in drivers/. Fix them up. Signed-off-by: Ahmad Fatoum --- drivers/mci/dw_mmc.c| 2 +- drivers/mci/imx-esdhc-pbl.c | 2 +- drivers/mtd/nand/nand_s3c24xx.c | 2 +- 3 files changed, 3

Re: [PATCH v2 1/2] usb: gadget: dfu: Rework print messages

2021-02-16 Thread Jules Maselbas
Hi Sascha, On Tue, Feb 16, 2021 at 10:27:29AM +0100, Sascha Hauer wrote: > > > @@ -209,7 +210,7 @@ dfu_bind(struct usb_configuration *c, struct > > > usb_function *f) > > > dfu->dnreq = usb_ep_alloc_request(c->cdev->gadget->ep0); > > > if (!dfu->dnreq) { > > > -

Re: [PATCH v2 1/2] usb: gadget: dfu: Rework print messages

2021-02-16 Thread Jules Maselbas
Hi Bartek, On Tue, Feb 16, 2021 at 10:19:00AM +0100, Bartosz Bilas wrote: > > @@ -209,7 +210,7 @@ dfu_bind(struct usb_configuration *c, struct > > usb_function *f) > > dfu->dnreq = usb_ep_alloc_request(c->cdev->gadget->ep0); > > if (!dfu->dnreq) { > > -

Re: [PATCH] usb: hub: fix state change check for not powercycled ports

2021-02-16 Thread Sascha Hauer
On Tue, Feb 16, 2021 at 09:20:01AM +0100, Michael Grzeschik wrote: > Hi! > > On Thu, Feb 11, 2021 at 01:03:54PM +0100, Ahmad Fatoum wrote: > > Hello, > > > > On 18.01.21 20:09, Michael Grzeschik wrote: > > > Since we don't power cycle the ports on start since patch "19bb0b2a usb: > > > hub: Do

Re: [PATCH v2 1/2] usb: gadget: dfu: Rework print messages

2021-02-16 Thread Sascha Hauer
On Tue, Feb 16, 2021 at 10:19:00AM +0100, Bartosz Bilas wrote: > Hello Jules, > > On 15.02.2021 15:18, Jules Maselbas wrote: > > Replace printf with pr_err and debug with pr_debug. > > Defines "dfu :" as a prefix for formatted prints. > > > > --- > > v1 -> v2: > > - add `pr_fmt(fmt) "dfu: "

Re: [PATCH] sandbox: support 64-bit file IO in 32-bit build

2021-02-16 Thread Sascha Hauer
On Mon, Feb 15, 2021 at 11:24:42AM +0100, Ahmad Fatoum wrote: > This allows an easy way to test upcoming changes to the barebox block > layer to support 64-bit block IO. > > Signed-off-by: Ahmad Fatoum > --- Applied, thanks Sascha > arch/sandbox/board/hostfile.c | 17

Re: [PATCH v2] fs: increase reference count for backing store when loop mounting

2021-02-16 Thread Sascha Hauer
On Fri, Feb 12, 2021 at 10:34:50AM +0100, Ahmad Fatoum wrote: > From: Ahmad Fatoum > > The VFS layer already increase the mount reference count for the mount > point. This means e.g. following sequence is well-behaving: > > mkdir -p /mnt/disk0.0/media > mount -o loop backing.squashfs

Re: [PATCH v2 1/2] usb: gadget: dfu: Rework print messages

2021-02-16 Thread Bartosz Bilas
Hello Jules, On 15.02.2021 15:18, Jules Maselbas wrote: Replace printf with pr_err and debug with pr_debug. Defines "dfu :" as a prefix for formatted prints. --- v1 -> v2: - add `pr_fmt(fmt) "dfu: " fmt` - change debug call to pr_debug - remove "dfu: " in print messages Signed-off-by:

Re: [PATCH] usb: hub: fix state change check for not powercycled ports

2021-02-16 Thread Michael Grzeschik
Hi! On Thu, Feb 11, 2021 at 01:03:54PM +0100, Ahmad Fatoum wrote: Hello, On 18.01.21 20:09, Michael Grzeschik wrote: Since we don't power cycle the ports on start since patch "19bb0b2a usb: hub: Do not power-cycle usb devices on init" it is possible that the device on this port is already