* [U-Boot] 'usb start' works very unstable
@ 2010-08-07 7:18 Sergei Trofimovich
2010-08-07 11:22 ` Wolfgang Denk
0 siblings, 1 reply; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-07 7:18 UTC (permalink / raw)
To: u-boot
I have 250GB USB-HDD attached to sheevaplug and using u-boot
U-Boot 2010.03-00176-g42f7128 (Aug 06 2010 - 22:24:34)
Marvell-Sheevaplug
It's a tip of 'u-boot-marvell/testing' branch.
I'm currently booting linux kernel from NAND
and using ext4 rootfs placed on this USB HDD.
Everything works mostly fine here (in-NAND
kernel and usb survive multiple reboots).
The problem is faulty usb detection in u-boot prompt.
After some reboots (one reboot is usually enough)
u-boot can't find attached USB storages:
# reboot linux kernel and stop at u-boot prompt
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... error in inquiry
0 Storage Device(s) found
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 0 Storage Device(s) found
#ok, usb is dead? let's see if linux kernel will find it
Marvell>> nand read 0x01000000 0x00100000 0x00400000
NAND read: device 0 offset 0x100000, size 0x400000
4194304 bytes read: OK
Marvell>> setenv boot
bootdelay bootargs bootcmd
Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sda3 rw rootwait #points to usb hdd!
Marvell>> bootm 0x01000000
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-2.6.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2192340 Bytes = 2.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
<skip>
[ 22.867424] Waiting for root device /dev/sda3...
[ 23.015860] scsi0 : usb-storage 1-1:1.0
[ 26.054268] scsi 0:0:0:0: Direct-Access StoreJet Transcend PQ: 0 ANSI: 2 CCS
[ 28.774083] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
[ 28.782324] sd 0:0:0:0: [sda] Write Protect is off
[ 28.787167] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.794693] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.800822] sda: sda1 sda2 sda3 sda4
[ 28.909571] sd 0:0:0:0: [sda] Assuming drive cache: write through
[ 28.915736] sd 0:0:0:0: [sda] Attached SCSI disk
[ 28.944594] EXT3-fs (sda3): error: couldn't mount because of unsupported optional features (240)
[ 28.953954] EXT2-fs (sda3): error: couldn't mount because of unsupported optional features (240)
[ 28.992562] EXT4-fs (sda3): mounted filesystem with ordered data mode. Opts: (null)
[ 29.000323] VFS: Mounted root (ext4 filesystem) on device 8:3.
[ 29.006227] Freeing init memory: 112K
INIT: version 2.87 booting
And it finds it! *phew*
It usually takes ~4 seconds to wait for root.
When I power off/power on sheevaplug I am able
to load something directly from USB:
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
Heh, capacity is reported incorrectly, but it works am I'm able
to load kernel from there.
Marvell>> ext2ls usb 0:2 /
<DIR> 1024 .
<DIR> 1024 ..
<DIR> 12288 lost+found
<SYM> 1 boot
0 .keep
4466528 vmlinuz-2.6.35
904705 System.map-2.6.35
49205 config-2.6.35
4466528 vmlinuz-2.6.35.old
904705 System.map-2.6.35.old
49205 config-2.6.35.old
2192404 uImage-2.6.35
331132 u-boot.kwb-20100806
Marvell>> ext2load usb 0:2 0x01000000 /uImage-2.6.35
Loading file "/uImage-2.6.35" from usb device 0:2 (usbda2)
2192404 bytes read
Marvell>> bootm 0x01000000
## Booting kernel from Legacy Image at 01000000 ...
Image Name: Linux-2.6.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2192340 Bytes = 2.1 MB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
and up to the shell#
If I reboot u-boot can't find usb storages (but the in-NAND kernel will boot):
[ 249.433555] Restarting system.
U-Boot 2010.03-00176-g42f7128 (Aug 06 2010 - 22:24:34)
Marvell-Sheevaplug
...
Hit any key to stop autoboot: 0
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... error in inquiry
0 Storage Device(s) found
All these things are almost 100% reproducible.
Vendor-shipped (Marvell's) u-boot has exactly the same disease:
** MARVELL BOARD: SHEEVA PLUG LE
U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16
--
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100807/3ef746d5/attachment.pgp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 7:18 [U-Boot] 'usb start' works very unstable Sergei Trofimovich
@ 2010-08-07 11:22 ` Wolfgang Denk
2010-08-07 13:39 ` Sergei Trofimovich
0 siblings, 1 reply; 14+ messages in thread
From: Wolfgang Denk @ 2010-08-07 11:22 UTC (permalink / raw)
To: u-boot
Dear Sergei,
In message <20100807101848.636cb978@mosly> you wrote:
>
> I have 250GB USB-HDD attached to sheevaplug and using u-boot
>
> U-Boot 2010.03-00176-g42f7128 (Aug 06 2010 - 22:24:34)
> Marvell-Sheevaplug
>
> It's a tip of 'u-boot-marvell/testing' branch.
Did you try current mainline instead? It is usually not recommended
to use any of the custodian trees and especially their testing
branches unless you know _exactly_ what these contain and what you are
looking after.
> [ 23.015860] scsi0 : usb-storage 1-1:1.0
> [ 26.054268] scsi 0:0:0:0: Direct-Access StoreJet Transcend PQ: 0 ANSI: 2 CCS
> [ 28.774083] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
...
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
>
> Heh, capacity is reported incorrectly, but it works am I'm able
> to load kernel from there.
The reason for this is that the multiplication 488397168 x 512 will
overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
fixed...
> All these things are almost 100% reproducible.
>
> Vendor-shipped (Marvell's) u-boot has exactly the same disease:
> ** MARVELL BOARD: SHEEVA PLUG LE
> U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16
This can be anything - issues with the USB driver, missing or
incorrect initializatioon of the SoC, or even hardware issues.
Can you try to debug it?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Who is the oldest inhabitant of this village?"
"We haven't got one; we had one, but he died three weeks ago."
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 11:22 ` Wolfgang Denk
@ 2010-08-07 13:39 ` Sergei Trofimovich
2010-08-07 15:47 ` Wolfgang Denk
2010-08-07 19:47 ` [U-Boot] 'usb start' works very unstable Prafulla Wadaskar
0 siblings, 2 replies; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-07 13:39 UTC (permalink / raw)
To: u-boot
> > It's a tip of 'u-boot-marvell/testing' branch.
>
> Did you try current mainline instead? It is usually not recommended
> to use any of the custodian trees and especially their testing
> branches unless you know _exactly_ what these contain and what you are
> looking after.
I was not sure sheevaplug support was merged. Pesky page [0] suggested it
and I thought i's called 'mainline'.
Ok, trying 'u-boot/master' v2010.06-267-gb1f95b4 with latest commit
> commit b1f95b4438a6d44e12f04e7f51412f7a711ef87b
> Author: Wolfgang Denk <wd@denx.de>
> Date: Sat Aug 7 00:32:50 2010 +0200
>
> Replace CHANGELOG files by auto-generated "snapshot.commit"
Marvell>> version
U-Boot 2010.06-00267-gb1f95b4 (Aug 07 2010 - 15:30:45)
Marvell-Sheevaplug
> > [ 23.015860] scsi0 : usb-storage 1-1:1.0
> > [ 26.054268] scsi 0:0:0:0: Direct-Access StoreJet Transcend PQ: 0 ANSI: 2 CCS
> > [ 28.774083] sd 0:0:0:0: [sda] 488397168 512-byte logical blocks: (250 GB/232 GiB)
> ...
>
> > Device 0: Vendor: StoreJet Rev: Prod: Transcend
> > Type: Hard Disk
> > Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
> >
> > Heh, capacity is reported incorrectly, but it works am I'm able
> > to load kernel from there.
> The reason for this is that the multiplication 488397168 x 512 will
> overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
> fixed...
This issue is still here:
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 1 Storage Device(s) found
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
Latest change in 'disk/part.c' is:
> commit 4b142febff71eabdb7ddbb125c7b583b24ddc434
> Author: Heiko Schocher <hs@denx.de>
> Date: Thu Dec 3 11:21:21 2009 +0100
Which looks older, than u-boot-marvell branch.
> > All these things are almost 100% reproducible.
> >
> > Vendor-shipped (Marvell's) u-boot has exactly the same disease:
> > ** MARVELL BOARD: SHEEVA PLUG LE
> > U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16
>
> This can be anything - issues with the USB driver, missing or
> incorrect initializatioon of the SoC, or even hardware issues.
>
> Can you try to debug it?
And I can't reproduce it anymore with 'u-boot/master'.
Rebooted 3 times and I have stable detection \o/.
I can still reproduce another (hardware?) failure in a dirty way:
1. Boot Linux kernel
2. run hdparm on the root partition (not the beast idea, as we will see):
sh-4.0# hdparm /dev/sda
/dev/sda:
HDIO_DRIVE_CMD(identify) failed: Invalid exchange
readonly = 0 (off)
readahead = 256 (on)
geometry = 30401/255/63, sectors = 488397168, start = 0
system losts USB, root, and ability to run binaries
3. attach with JTAG:
$sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
Open On-Chip Debugger 0.5.0-dev-00466-g28ddefd (2010-08-06-22:54)
...
> reset
4. get in u-boot prompt and run 'usb start'
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 0 Storage Device(s) found
Marvell>> usb info
1: Hub, USB Revision 2.0
- u-boot EHCI Host Controller
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms
Configuration: 0
- Interfaces: 0 Bus Powered 0mA
5. try to boot nand linux kernel to see if is able to find usb root and start:
[ 1.392621] Waiting for root device /dev/sda3...
[ 1.508952] usb 1-1: device descriptor read/64, error -32
[ 1.738954] usb 1-1: device descriptor read/64, error -32
[ 1.968955] usb 1-1: new high speed USB device using orion-ehci and address 3
[ 2.098954] usb 1-1: device descriptor read/64, error -32
[ 2.328956] usb 1-1: device descriptor read/64, error -32
[ 2.558956] usb 1-1: new high speed USB device using orion-ehci and address 4
[ 2.610990] usb 1-1: device descriptor read/8, error -71
[ 2.750990] usb 1-1: device descriptor read/8, error -71
[ 2.978955] usb 1-1: new high speed USB device using orion-ehci and address 5
[ 3.030990] usb 1-1: device descriptor read/8, error -71
[ 3.170990] usb 1-1: device descriptor read/8, error -71
[ 3.278964] hub 1-0:1.0: unable to enumerate USB device on port 1
<hung forever>
<trying more JTAG reset/kernel boot loops ... and it does not help, kernel does not see root>
*shrug* Seems, we have lost it.
Power off/power on restores USB operation. Kernel boots and usb survives several reboots.
feature request: would be nice to see some errors in 'usb start' output when the hardware
is in such bad state.
Thanks!
[0] http://www.plugcomputer.org/plugwiki/index.php/Das_U-boot_plug_support
--
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100807/3a053ea7/attachment.pgp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 13:39 ` Sergei Trofimovich
@ 2010-08-07 15:47 ` Wolfgang Denk
2010-08-07 19:35 ` Prafulla Wadaskar
2010-08-07 20:57 ` Sergei Trofimovich
2010-08-07 19:47 ` [U-Boot] 'usb start' works very unstable Prafulla Wadaskar
1 sibling, 2 replies; 14+ messages in thread
From: Wolfgang Denk @ 2010-08-07 15:47 UTC (permalink / raw)
To: u-boot
Dear Sergei Trofimovich,
In message <20100807163957.52c1cceb@mosly> you wrote:
>
> > > Heh, capacity is reported incorrectly, but it works am I'm able
> > > to load kernel from there.
> > The reason for this is that the multiplication 488397168 x 512 will
> > overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
> > fixed...
>
> This issue is still here:
Sorry for not being clear. What I meant was: this is a bug that needs
to be fixed (patches welcome).
> And I can't reproduce it anymore with 'u-boot/master'.
> Rebooted 3 times and I have stable detection \o/.
Good. At least one problem solved.
> $sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
> Open On-Chip Debugger 0.5.0-dev-00466-g28ddefd (2010-08-06-22:54)
> ...
> > reset
Hm... I am not sure what exactly the OpenOCD debugger does when you
run the reset command; eventually it performs some initializations
(defined in sheevaplug.cfg ?), and/or prevents others. The CPU may, or
may not, be in the virgin state expected by U-Boot.
Detach the debugger, and perform a real hard reset instead. Or try to
configure the debugger not to perform any initializations (i. e. the
equivalent of the "reset run" command on BDI2000/30000).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Democracy is mob rule, but with income taxes.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 15:47 ` Wolfgang Denk
@ 2010-08-07 19:35 ` Prafulla Wadaskar
2010-08-07 20:57 ` Sergei Trofimovich
1 sibling, 0 replies; 14+ messages in thread
From: Prafulla Wadaskar @ 2010-08-07 19:35 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Wolfgang Denk
> Sent: Saturday, August 07, 2010 9:18 PM
> To: Sergei Trofimovich
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] 'usb start' works very unstable
>
> Dear Sergei Trofimovich,
>
> In message <20100807163957.52c1cceb@mosly> you wrote:
> >
> > > > Heh, capacity is reported incorrectly, but it works am I'm able
> > > > to load kernel from there.
> > > The reason for this is that the multiplication 488397168
> x 512 will
> > > overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
> > > fixed...
> >
> > This issue is still here:
>
> Sorry for not being clear. What I meant was: this is a bug that needs
> to be fixed (patches welcome).
>
>
> > And I can't reproduce it anymore with 'u-boot/master'.
> > Rebooted 3 times and I have stable detection \o/.
>
> Good. At least one problem solved.
>
> > $sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
> > Open On-Chip Debugger 0.5.0-dev-00466-g28ddefd
> (2010-08-06-22:54)
> > ...
> > > reset
>
> Hm... I am not sure what exactly the OpenOCD debugger does when you
> run the reset command; eventually it performs some initializations
> (defined in sheevaplug.cfg ?), and/or prevents others. The CPU may, or
> may not, be in the virgin state expected by U-Boot.
It just perform system reset operation and resumes operation normally unless we halt if through debug commands
Regards..
Prafulla . .
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 13:39 ` Sergei Trofimovich
2010-08-07 15:47 ` Wolfgang Denk
@ 2010-08-07 19:47 ` Prafulla Wadaskar
2010-08-07 22:27 ` Wolfgang Denk
1 sibling, 1 reply; 14+ messages in thread
From: Prafulla Wadaskar @ 2010-08-07 19:47 UTC (permalink / raw)
To: u-boot
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Sergei Trofimovich
> Sent: Saturday, August 07, 2010 7:10 PM
> To: Wolfgang Denk
> Cc: u-boot at lists.denx.de
> Subject: Re: [U-Boot] 'usb start' works very unstable
>
> > > It's a tip of 'u-boot-marvell/testing' branch.
> >
> > Did you try current mainline instead? It is usually not recommended
> > to use any of the custodian trees and especially their testing
> > branches unless you know _exactly_ what these contain and
> what you are
> > looking after.
>
> I was not sure sheevaplug support was merged. Pesky page [0]
> suggested it
> and I thought i's called 'mainline'.
>
> Ok, trying 'u-boot/master' v2010.06-267-gb1f95b4 with latest commit
>
> > commit b1f95b4438a6d44e12f04e7f51412f7a711ef87b
> > Author: Wolfgang Denk <wd@denx.de>
> > Date: Sat Aug 7 00:32:50 2010 +0200
> >
> > Replace CHANGELOG files by auto-generated "snapshot.commit"
>
> Marvell>> version
>
> U-Boot 2010.06-00267-gb1f95b4 (Aug 07 2010 - 15:30:45)
> Marvell-Sheevaplug
>
> > > [ 23.015860] scsi0 : usb-storage 1-1:1.0
> > > [ 26.054268] scsi 0:0:0:0: Direct-Access
> StoreJet Transcend PQ: 0 ANSI: 2 CCS
> > > [ 28.774083] sd 0:0:0:0: [sda] 488397168 512-byte
> logical blocks: (250 GB/232 GiB)
> > ...
> >
> > > Device 0: Vendor: StoreJet Rev: Prod: Transcend
> > > Type: Hard Disk
> > > Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
> > >
> > > Heh, capacity is reported incorrectly, but it works am I'm able
> > > to load kernel from there.
> > The reason for this is that the multiplication 488397168 x 512 will
> > overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
> > fixed...
>
> This issue is still here:
>
> Marvell>> usb start
> (Re)start USB...
> USB: Register 10011 NbrPorts 1
> USB EHCI 1.00
> scanning bus for devices... 2 USB Device(s) found
> scanning bus for storage devices... 1 Storage
> Device(s) found
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
>
> Latest change in 'disk/part.c' is:
> > commit 4b142febff71eabdb7ddbb125c7b583b24ddc434
>
> > Author: Heiko Schocher <hs@denx.de>
>
> > Date: Thu Dec 3 11:21:21 2009 +0100
>
> Which looks older, than u-boot-marvell branch.
>
> > > All these things are almost 100% reproducible.
> > >
> > > Vendor-shipped (Marvell's) u-boot has exactly the same disease:
> > > ** MARVELL BOARD: SHEEVA PLUG LE
> > > U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16
> >
> > This can be anything - issues with the USB driver, missing or
> > incorrect initializatioon of the SoC, or even hardware issues.
> >
> > Can you try to debug it?
>
> And I can't reproduce it anymore with 'u-boot/master'.
> Rebooted 3 times and I have stable detection \o/.
>
> I can still reproduce another (hardware?) failure in a dirty way:
> 1. Boot Linux kernel
> 2. run hdparm on the root partition (not the beast idea, as
> we will see):
> sh-4.0# hdparm /dev/sda
> /dev/sda:
> HDIO_DRIVE_CMD(identify) failed: Invalid exchange
> readonly = 0 (off)
> readahead = 256 (on)
> geometry = 30401/255/63, sectors = 488397168, start = 0
> system losts USB, root, and ability to run binaries
> 3. attach with JTAG:
> $sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
> Open On-Chip Debugger 0.5.0-dev-00466-g28ddefd (2010-08-06-22:54)
> ...
> > reset
This will just reset the Kirkwood and not entire system, u-boot performs some basic initialization that may not be sufficient to bring back already sucked peripharal unless we reset them.
I think - If the things work with true system reset (i.e. re-power) that is well withing u-boot's scope and limitation.
Regards..
Prafulla . .
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 15:47 ` Wolfgang Denk
2010-08-07 19:35 ` Prafulla Wadaskar
@ 2010-08-07 20:57 ` Sergei Trofimovich
2010-08-08 9:05 ` [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity Sergei Trofimovich
1 sibling, 1 reply; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-07 20:57 UTC (permalink / raw)
To: u-boot
> > > > Heh, capacity is reported incorrectly, but it works am I'm able
> > > > to load kernel from there.
> > > The reason for this is that the multiplication 488397168 x 512 will
> > > overflow a 32 bit integer as used in "disk/part.c"; this shouldbe
> > > fixed...
> >
> > This issue is still here:
>
> Sorry for not being clear. What I meant was: this is a bug that needs
> to be fixed (patches welcome).
Oh, I've attached my solution.
> > $sudo openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg
> > Open On-Chip Debugger 0.5.0-dev-00466-g28ddefd (2010-08-06-22:54)
> > ...
> > > reset
>
> Hm... I am not sure what exactly the OpenOCD debugger does when you
> run the reset command; eventually it performs some initializations
> (defined in sheevaplug.cfg ?), and/or prevents others. The CPU may, or
> may not, be in the virgin state expected by U-Boot.
>
> Detach the debugger, and perform a real hard reset instead. Or try to
> configure the debugger not to perform any initializations (i. e. the
> equivalent of the "reset run" command on BDI2000/30000).
Sheevaplug has reset button on the box. So I've pushed it, no change.
sh-4.0# hdparm /dev/sda
/dev/sda:
HDIO_DRIVE_CMD(identify) failed: Invalid exchange
readonly = 0 (off)
readahead = 256 (on)
geometry = 30401/255/63, sectors = 488397168, start = 0
sh-4.0#
sh-4.0#
<pressed reset button>
U-Boot 2010.06-00267-gb1f95b4 (Aug 07 2010 - 15:30:45)
Marvell-Sheevaplug
SoC: Kirkwood 88F6281_A0
DRAM: 512 MiB
NAND: 512 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot: 0
Marvell>> usb start
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 0 Storage Device(s) found
Kernel does not boot as well:
[ 22.867512] Waiting for root device /dev/sda3...
[ 22.973783] usb 1-1: device descriptor read/64, error -32
[ 23.203774] usb 1-1: device descriptor read/64, error -32
--
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-disk-part.c-usb-storage-avoiding-overflow-when-outpu.patch
Type: text/x-patch
Size: 2210 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100807/1f8cbc37/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100807/1f8cbc37/attachment.pgp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] 'usb start' works very unstable
2010-08-07 19:47 ` [U-Boot] 'usb start' works very unstable Prafulla Wadaskar
@ 2010-08-07 22:27 ` Wolfgang Denk
0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2010-08-07 22:27 UTC (permalink / raw)
To: u-boot
Dear Prafulla Wadaskar,
In message <F766E4F80769BD478052FB6533FA745D19A65770C9@SC-VEXCH4.marvell.com> you wrote:
>
> I think - If the things work with true system reset (i.e. re-power) that is
> well withing u-boot's scope and limitation.
I disagree. The U-Boot "reset" command should perform exactly the same
level of resetting that a hardware reset does (hardware permitting, of
course; there _are_ broken pieces of hardware around for sure).
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Landru! Guide us!
-- A Beta 3-oid, "The Return of the Archons", stardate 3157.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-07 20:57 ` Sergei Trofimovich
@ 2010-08-08 9:05 ` Sergei Trofimovich
2010-08-08 10:01 ` Sergei Shtylyov
0 siblings, 1 reply; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-08 9:05 UTC (permalink / raw)
To: u-boot
From: Sergei Trofimovich <slyfox@gentoo.org>
Before:
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
After:
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
disk/part.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/disk/part.c b/disk/part.c
index b6bae17..ee5be2b 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -109,14 +109,31 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
/*
* reports device info to the user
*/
-void dev_print (block_dev_desc_t *dev_desc)
-{
+
#ifdef CONFIG_LBA48
- uint64_t lba512; /* number of blocks if 512bytes block size */
+typedef uint64_t lba512_t;
#else
- lbaint_t lba512;
+typedef lbaint_t lba512_t;
#endif
+/*
+ * Overflowless variant of (block_count * mul_by / div_by)
+ * when div_by > mul_by
+ */
+static lba512_t lba512_muldiv (lba512_t block_count, lba512_t mul_by, lba512_t div_by)
+{
+ lba512_t bc_quot, bc_rem;
+
+ /* x * m / d == x / d * m + (x % d) * m / d */
+ bc_quot = block_count / div_by;
+ bc_rem = block_count - div_by * bc_quot;
+ return bc_quot * mul_by + (bc_rem * mul_by) / div_by;
+}
+
+void dev_print (block_dev_desc_t *dev_desc)
+{
+ lba512_t lba512; /* number of blocks if 512bytes block size */
+
if (dev_desc->type == DEV_TYPE_UNKNOWN) {
puts ("not available\n");
return;
@@ -184,8 +201,9 @@ void dev_print (block_dev_desc_t *dev_desc)
lba = dev_desc->lba;
lba512 = (lba * (dev_desc->blksz/512));
- mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */
/* round to 1 digit */
+ mb = lba512_muldiv(lba512, 10, 2048); /* 2048 = (1024 * 1024) / 512 MB */
+
mb_quot = mb / 10;
mb_rem = mb - (10 * mb_quot);
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-08 9:05 ` [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity Sergei Trofimovich
@ 2010-08-08 10:01 ` Sergei Shtylyov
2010-08-08 12:05 ` Sergei Trofimovich
0 siblings, 1 reply; 14+ messages in thread
From: Sergei Shtylyov @ 2010-08-08 10:01 UTC (permalink / raw)
To: u-boot
Hello.
Sergei Trofimovich wrote:
> Before:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
> After:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
> disk/part.c | 28 +++++++++++++++++++++++-----
> 1 files changed, 23 insertions(+), 5 deletions(-)
> diff --git a/disk/part.c b/disk/part.c
> index b6bae17..ee5be2b 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -109,14 +109,31 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
> /*
> * reports device info to the user
> */
> -void dev_print (block_dev_desc_t *dev_desc)
> -{
> +
> #ifdef CONFIG_LBA48
> - uint64_t lba512; /* number of blocks if 512bytes block size */
> +typedef uint64_t lba512_t;
> #else
> - lbaint_t lba512;
> +typedef lbaint_t lba512_t;
> #endif
>
> +/*
> + * Overflowless variant of (block_count * mul_by / div_by)
> + * when div_by > mul_by
> + */
> +static lba512_t lba512_muldiv (lba512_t block_count, lba512_t mul_by, lba512_t div_by)
> +{
> + lba512_t bc_quot, bc_rem;
> +
> + /* x * m / d == x / d * m + (x % d) * m / d */
> + bc_quot = block_count / div_by;
> + bc_rem = block_count - div_by * bc_quot;
> + return bc_quot * mul_by + (bc_rem * mul_by) / div_by;
Please use tabs to indent the code to match the style of that file.
WBR, Sergei
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-08 10:01 ` Sergei Shtylyov
@ 2010-08-08 12:05 ` Sergei Trofimovich
2010-08-09 5:38 ` Prafulla Wadaskar
2010-08-10 21:10 ` Wolfgang Denk
0 siblings, 2 replies; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-08 12:05 UTC (permalink / raw)
To: u-boot
From: Sergei Trofimovich <slyfox@gentoo.org>
Before:
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
After:
Marvell>> usb storage
Device 0: Vendor: StoreJet Rev: Prod: Transcend
Type: Hard Disk
Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
Changes since V1:
Fixed space usage instead of tabs. Noticed by Sergei Shtylyov.
disk/part.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/disk/part.c b/disk/part.c
index b6bae17..3ba88c7 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -109,14 +109,31 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
/*
* reports device info to the user
*/
-void dev_print (block_dev_desc_t *dev_desc)
-{
+
#ifdef CONFIG_LBA48
- uint64_t lba512; /* number of blocks if 512bytes block size */
+typedef uint64_t lba512_t;
#else
- lbaint_t lba512;
+typedef lbaint_t lba512_t;
#endif
+/*
+ * Overflowless variant of (block_count * mul_by / div_by)
+ * when div_by > mul_by
+ */
+static lba512_t lba512_muldiv (lba512_t block_count, lba512_t mul_by, lba512_t div_by)
+{
+ lba512_t bc_quot, bc_rem;
+
+ /* x * m / d == x / d * m + (x % d) * m / d */
+ bc_quot = block_count / div_by;
+ bc_rem = block_count - div_by * bc_quot;
+ return bc_quot * mul_by + (bc_rem * mul_by) / div_by;
+}
+
+void dev_print (block_dev_desc_t *dev_desc)
+{
+ lba512_t lba512; /* number of blocks if 512bytes block size */
+
if (dev_desc->type == DEV_TYPE_UNKNOWN) {
puts ("not available\n");
return;
@@ -184,8 +201,9 @@ void dev_print (block_dev_desc_t *dev_desc)
lba = dev_desc->lba;
lba512 = (lba * (dev_desc->blksz/512));
- mb = (10 * lba512) / 2048; /* 2048 = (1024 * 1024) / 512 MB */
/* round to 1 digit */
+ mb = lba512_muldiv(lba512, 10, 2048); /* 2048 = (1024 * 1024) / 512 MB */
+
mb_quot = mb / 10;
mb_rem = mb - (10 * mb_quot);
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-08 12:05 ` Sergei Trofimovich
@ 2010-08-09 5:38 ` Prafulla Wadaskar
2010-08-09 18:19 ` Sergei Trofimovich
2010-08-10 21:10 ` Wolfgang Denk
1 sibling, 1 reply; 14+ messages in thread
From: Prafulla Wadaskar @ 2010-08-09 5:38 UTC (permalink / raw)
To: u-boot
Hi Sergei
> -----Original Message-----
> From: u-boot-bounces at lists.denx.de
> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Sergei Trofimovich
> Sent: Sunday, August 08, 2010 5:36 PM
> To: Sergei Shtylyov
> Cc: u-boot at lists.denx.de; Sergei Trofimovich
> Subject: [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding
> overflow when output capacity
>
> From: Sergei Trofimovich <slyfox@gentoo.org>
>
> Before:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
> After:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
>
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
You should change the version of the patch in the subject line
And you should add change log history here.
You can have reference from some other patches submitted on the list
Regards..
Prafulla . .
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-09 5:38 ` Prafulla Wadaskar
@ 2010-08-09 18:19 ` Sergei Trofimovich
0 siblings, 0 replies; 14+ messages in thread
From: Sergei Trofimovich @ 2010-08-09 18:19 UTC (permalink / raw)
To: u-boot
> You should change the version of the patch in the subject line
> And you should add change log history here.
Ok, will do.
> You can have reference from some other patches submitted on the list
Do you mean git send-email's --in-reply-to= option?
--
Sergei
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100809/be169906/attachment.pgp
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity
2010-08-08 12:05 ` Sergei Trofimovich
2010-08-09 5:38 ` Prafulla Wadaskar
@ 2010-08-10 21:10 ` Wolfgang Denk
1 sibling, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2010-08-10 21:10 UTC (permalink / raw)
To: u-boot
Dear Sergei Trofimovich,
In message <1281269139-8194-1-git-send-email-slyfox@inbox.ru> you wrote:
> From: Sergei Trofimovich <slyfox@gentoo.org>
>
> Before:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 28759.9 MB = 28.0 GB (488397168 x 512)
> After:
> Marvell>> usb storage
> Device 0: Vendor: StoreJet Rev: Prod: Transcend
> Type: Hard Disk
> Capacity: 238475.1 MB = 232.8 GB (488397168 x 512)
>
> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
> ---
> Changes since V1:
> Fixed space usage instead of tabs. Noticed by Sergei Shtylyov.
>
> disk/part.c | 28 +++++++++++++++++++++++-----
> 1 files changed, 23 insertions(+), 5 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Where shall I begin, please your Majesty?" he asked. "Begin at the
beginning," the King said, gravely, "and go on till you come to the
end: then stop." - Alice's Adventures in Wonderland, Lewis Carroll
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2010-08-10 21:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-07 7:18 [U-Boot] 'usb start' works very unstable Sergei Trofimovich
2010-08-07 11:22 ` Wolfgang Denk
2010-08-07 13:39 ` Sergei Trofimovich
2010-08-07 15:47 ` Wolfgang Denk
2010-08-07 19:35 ` Prafulla Wadaskar
2010-08-07 20:57 ` Sergei Trofimovich
2010-08-08 9:05 ` [U-Boot] [PATCH] disk/part.c: 'usb storage' avoiding overflow when output capacity Sergei Trofimovich
2010-08-08 10:01 ` Sergei Shtylyov
2010-08-08 12:05 ` Sergei Trofimovich
2010-08-09 5:38 ` Prafulla Wadaskar
2010-08-09 18:19 ` Sergei Trofimovich
2010-08-10 21:10 ` Wolfgang Denk
2010-08-07 19:47 ` [U-Boot] 'usb start' works very unstable Prafulla Wadaskar
2010-08-07 22:27 ` Wolfgang Denk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.