Skip to content

Commit 2e1f9ab

Browse files
committed
Timed out waiting for HCHalted. USBSTS: 000000
1 parent b420844 commit 2e1f9ab

File tree

2 files changed

+42
-36
lines changed

2 files changed

+42
-36
lines changed

README.md

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,30 @@ https://github.com/lupyuen/pinephone-nuttx-usb/blob/b80499b3b8ec837fe2110e9476e8
7676
TODO
7777

7878
```text
79-
DEBUGASSERT(sizeof(struct ehci_overlay_s) == SIZEOF_EHCI_OVERLAY);
79+
a64_ehci_initialize: sizeof(struct a64_qh_s)=72
80+
a64_ehci_initialize: sizeof(struct a64_qtd_s)=32
81+
a64_ehci_initialize: sizeof(struct ehci_itd_s)=64
82+
a64_ehci_initialize: sizeof(struct ehci_sitd_s)=28
83+
a64_ehci_initialize: sizeof(struct ehci_qtd_s)=32
84+
a64_ehci_initialize: sizeof(struct ehci_overlay_s)=32
85+
a64_ehci_initialize: sizeof(struct ehci_qh_s)=48
86+
a64_ehci_initialize: sizeof(struct ehci_fstn_s)=8
8087
```
8188

82-
TODO
89+
a64_qh_s Now: 48 + 8 + 4 + 8 = 68
8390

84-
```text
85-
sizeof(struct ehci_overlay_s)=32
91+
Align to 32-bit = 72
92+
93+
Need to align to 0x20 = 32
94+
95+
Pad to 96
96+
97+
```c
98+
uint8_t pad2[96 - 72]; // TODO: Pad from 72 to 96 bytes for 64-bit platform
8699
```
87100

101+
a64_qh_s Previously: 48 + 4 + 4 + 8 = 64
102+
88103
# Output Log
89104

90105
```text
@@ -114,8 +129,8 @@ Found U-Boot script /boot.scr
114129
653 bytes read in 3 ms (211.9 KiB/s)
115130
## Executing script at 4fc00000
116131
gpio: pin 114 (gpio 114) value is 1
117-
348854 bytes read in 21 ms (15.8 MiB/s)
118-
Uncompressed size: 10514432 = 0xA07000
132+
356655 bytes read in 20 ms (17 MiB/s)
133+
Uncompressed size: 10534912 = 0xA0C000
119134
36162 bytes read in 5 ms (6.9 MiB/s)
120135
1078500 bytes read in 50 ms (20.6 MiB/s)
121136
## Flattened Device Tree blob at 4fa00000
@@ -125,35 +140,24 @@ Uncompressed size: 10514432 = 0xA07000
125140
126141
Starting kernel ...
127142
128-
usbhost_registerclass: Registering class:0x40120658 nids:2
129-
a64_ehci_initialize: sizeof(struct a64_qh_s)=72
143+
usbhost_registerclass: Registering class:0x40124838 nids:2
144+
a64_ehci_initialize: sizeof(struct a64_qh_s)=96
130145
a64_ehci_initialize: sizeof(struct a64_qtd_s)=32
131-
_assert: Current Version: NuttX 12.0.3 4d922be-dirty Mar 7 2023 15:54:47 arm64
132-
_assert: Assertion failed : at file: chip/a64_ehci.c:4996 task: nsh_main 0x4008b0d0
133-
up_dump_register: stack = 0x40129660
134-
up_dump_register: x0: 0x40129660 x1: 0xa
135-
up_dump_register: x2: 0x20 x3: 0x400efb22
136-
up_dump_register: x4: 0x4a10 x5: 0x0
137-
up_dump_register: x6: 0x4 x7: 0x88
138-
up_dump_register: x8: 0x40a88268 x9: 0x0
139-
up_dump_register: x10: 0x1105000 x11: 0x5
140-
up_dump_register: x12: 0x0 x13: 0x1
141-
up_dump_register: x14: 0x0 x15: 0x1c28000
142-
up_dump_register: x16: 0x0 x17: 0x1
143-
up_dump_register: x18: 0x0 x19: 0x0
144-
up_dump_register: x20: 0x40a8d010 x21: 0x400ef92d
145-
up_dump_register: x22: 0x0 x23: 0x1384
146-
up_dump_register: x24: 0x4011e6fe x25: 0x40120000
147-
up_dump_register: x26: 0x0 x27: 0x0
148-
up_dump_register: x28: 0x0 x29: 0x0
149-
up_dump_register: x30: 0x4008b078
150-
up_dump_register:
151-
up_dump_register: STATUS Registers:
152-
up_dump_register: SPSR: 0x40000005
153-
up_dump_register: ELR: 0x40081000
154-
up_dump_register: SP_EL0: 0x40a8f300
155-
up_dump_register: SP_ELX: 0x40a8f250
156-
up_dump_register: TPIDR_EL0: 0x40a8d010
157-
up_dump_register: TPIDR_EL1: 0x40a8d010
158-
up_dump_register: EXE_DEPTH: 0xffffffffffffffff
146+
a64_ehci_initialize: sizeof(struct ehci_itd_s)=64
147+
a64_ehci_initialize: sizeof(struct ehci_sitd_s)=28
148+
a64_ehci_initialize: sizeof(struct ehci_qtd_s)=32
149+
a64_ehci_initialize: sizeof(struct ehci_overlay_s)=32
150+
a64_ehci_initialize: sizeof(struct ehci_qh_s)=48
151+
a64_ehci_initialize: sizeof(struct ehci_fstn_s)=8
152+
EHCI Initializing EHCI Stack
153+
a64_printreg: 01c1b010<-00000000
154+
a64_printreg: 01c1b014->00000000
155+
EHCI ERROR: Timed out waiting for HCHalted. USBSTS: 000000
156+
EHCI ERROR: a64_reset failed: 110
157+
a64_usbhost_initialize: ERROR: a64_ehci_initialize failed
158+
ERROR: Couldn't start usb -19
159+
nsh: mkfatfs: command not found
160+
161+
NuttShell (NSH) NuttX-12.0.3
162+
nsh>
159163
```

a64_ehci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
////#define CONFIG_USBHOST_INT_DISABLE // TODO CONFIG_USBHOST_INT_DISABLE
5353
#define CONFIG_A64_EHCI_REGDEBUG // TODO CONFIG_A64_EHCI_REGDEBUG
5454
#define ARMV7M_DCACHE_LINESIZE 32 // TODO ARMV7M_DCACHE_LINESIZE
55+
#define up_udelay(x) up_mdelay(x) // TODO up_udelay
5556

5657
#if defined(CONFIG_A64_USBOTG) && defined(CONFIG_USBHOST)
5758

@@ -197,6 +198,7 @@ struct a64_qh_s
197198
struct a64_epinfo_s *epinfo; /* Endpoint used for the transfer */
198199
uint32_t fqp; /* First qTD in the list (physical address) */
199200
uint8_t pad[8]; /* Padding to assure 32-byte alignment */
201+
uint8_t pad2[96 - 72]; // TODO: Pad from 72 to 96 bytes for 64-bit platform
200202
};
201203

202204
/* Internal representation of the EHCI Queue Element Transfer Descriptor

0 commit comments

Comments
 (0)