mbox series

[v3,0/3] arm: allwinner: Wire up USB ports

Message ID 20200217204812.9857-1-linux@roeck-us.net
Headers show
Series arm: allwinner: Wire up USB ports | expand

Message

Guenter Roeck Feb. 17, 2020, 8:48 p.m. UTC
Instantiate EHCI and OHCI controllers on Allwinner A10.

The first patch in the series moves the declaration of EHCISysBusState
from hcd-ohci.c to hcd-ohci.h. This lets us add the structure to
AwA10State. Similar, TYPE_SYSBUS_OHCI is moved to be able to use it
outside its driver.

The second patch introduces the ehci-sysbus property "companion-enable".
This lets us use object_property_set_bool() to enable companion mode.

The third patch instantiates EHCI and OHCI ports for Allwinner-A10
and marks the OHCI ports as companions of the respective EHCI ports.

Tested by attaching various high speed and full speed devices, and by
booting from USB drive.

v3: Rebased to master
v2: Add summary
    Rewrite to instantiate OHCI in companion mode; add patch 2/3
    Merge EHCI and OHCI instantiation into a single patch

----------------------------------------------------------------
Guenter Roeck (3):
      hw: usb: hcd-ohci: Move OHCISysBusState and TYPE_SYSBUS_OHCI to include file
      hcd-ehci: Introduce "companion-enable" sysbus property
      arm: allwinner: Wire up USB ports

 hw/arm/allwinner-a10.c         | 43 ++++++++++++++++++++++++++++++++++++++++++
 hw/usb/hcd-ehci-sysbus.c       |  2 ++
 hw/usb/hcd-ohci.c              | 15 ---------------
 hw/usb/hcd-ohci.h              | 16 ++++++++++++++++
 include/hw/arm/allwinner-a10.h |  6 ++++++
 5 files changed, 67 insertions(+), 15 deletions(-)

Comments

Philippe Mathieu-Daudé Feb. 18, 2020, 6:39 a.m. UTC | #1
Cc'ing Niek.

On 2/17/20 9:48 PM, Guenter Roeck wrote:
> Instantiate EHCI and OHCI controllers on Allwinner A10.
> 
> The first patch in the series moves the declaration of EHCISysBusState
> from hcd-ohci.c to hcd-ohci.h. This lets us add the structure to
> AwA10State. Similar, TYPE_SYSBUS_OHCI is moved to be able to use it
> outside its driver.
> 
> The second patch introduces the ehci-sysbus property "companion-enable".
> This lets us use object_property_set_bool() to enable companion mode.
> 
> The third patch instantiates EHCI and OHCI ports for Allwinner-A10
> and marks the OHCI ports as companions of the respective EHCI ports.
> 
> Tested by attaching various high speed and full speed devices, and by
> booting from USB drive.
> 
> v3: Rebased to master
> v2: Add summary
>      Rewrite to instantiate OHCI in companion mode; add patch 2/3
>      Merge EHCI and OHCI instantiation into a single patch
> 
> ----------------------------------------------------------------
> Guenter Roeck (3):
>        hw: usb: hcd-ohci: Move OHCISysBusState and TYPE_SYSBUS_OHCI to include file
>        hcd-ehci: Introduce "companion-enable" sysbus property
>        arm: allwinner: Wire up USB ports
> 
>   hw/arm/allwinner-a10.c         | 43 ++++++++++++++++++++++++++++++++++++++++++
>   hw/usb/hcd-ehci-sysbus.c       |  2 ++
>   hw/usb/hcd-ohci.c              | 15 ---------------
>   hw/usb/hcd-ohci.h              | 16 ++++++++++++++++
>   include/hw/arm/allwinner-a10.h |  6 ++++++
>   5 files changed, 67 insertions(+), 15 deletions(-)
>
Niek Linnenbank Feb. 18, 2020, 10:32 p.m. UTC | #2
Hi Guenter, Philippe,

On Tue, Feb 18, 2020 at 7:39 AM Philippe Mathieu-Daudé <philmd@redhat.com>
wrote:

> Cc'ing Niek.
>
> On 2/17/20 9:48 PM, Guenter Roeck wrote:
> > Instantiate EHCI and OHCI controllers on Allwinner A10.
> >
> > The first patch in the series moves the declaration of EHCISysBusState
> > from hcd-ohci.c to hcd-ohci.h. This lets us add the structure to
> > AwA10State. Similar, TYPE_SYSBUS_OHCI is moved to be able to use it
> > outside its driver.
> >
> > The second patch introduces the ehci-sysbus property "companion-enable".
> > This lets us use object_property_set_bool() to enable companion mode.
> >
> > The third patch instantiates EHCI and OHCI ports for Allwinner-A10
> > and marks the OHCI ports as companions of the respective EHCI ports.
> >
> > Tested by attaching various high speed and full speed devices, and by
> > booting from USB drive.
> >
> > v3: Rebased to master
> > v2: Add summary
> >      Rewrite to instantiate OHCI in companion mode; add patch 2/3
> >      Merge EHCI and OHCI instantiation into a single patch
> >
> > ----------------------------------------------------------------
> > Guenter Roeck (3):
> >        hw: usb: hcd-ohci: Move OHCISysBusState and TYPE_SYSBUS_OHCI to
> include file
> >        hcd-ehci: Introduce "companion-enable" sysbus property
> >        arm: allwinner: Wire up USB ports
> >
> >   hw/arm/allwinner-a10.c         | 43
> ++++++++++++++++++++++++++++++++++++++++++
> >   hw/usb/hcd-ehci-sysbus.c       |  2 ++
> >   hw/usb/hcd-ohci.c              | 15 ---------------
> >   hw/usb/hcd-ohci.h              | 16 ++++++++++++++++
> >   include/hw/arm/allwinner-a10.h |  6 ++++++
> >   5 files changed, 67 insertions(+), 15 deletions(-)
> >
>
>
Thanks for contributing this! I was able to test & verify it on my local
machine using latest Qemu master and linux 5.5.0.
I just had to add the -usb flag to the Qemu command and re-compile linux
with CONFIG_USB_STORAGE.

Output with buildroot on a USB mass storage disk as rootfs:

++ ./arm-softmmu/qemu-system-arm -M cubieboard -kernel
$HOME/cubie/linux.git/arch/arm/boot/zImage -nographic -append
'console=ttyS0,115200 earlyprintk debug rootwait root=/dev/sda ro
init=/sbin/init' -dtb
$HOME/cubie/linux.git/arch/arm/boot/dts/sun4i-a10-cubieboard.dtb -m 512 -s
-usb -drive
if=none,id=stick,file=$HOME/cubie/buildroot-2019.11/output/images/rootfs.ext2
-device usb-storage,bus=usb-bus.1,drive=stick -nic user
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.5.0-rc3 (me@host) (gcc version 7.4.0
(Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #6 SMP Tue Feb 18 23:21:36 CET 2020
[    0.000000] CPU: ARMv7 Processor [410fc080] revision 0 (ARMv7),
cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing
instruction cache
[    0.000000] OF: fdt: Machine model: Cubietech Cubieboard
[    0.000000] Memory policy: Data cache writeback
...
[    4.559154] random: fast init done
[    5.481107] scsi 1:0:0:0: Direct-Access     QEMU     QEMU HARDDISK
 2.5+ PQ: 0 ANSI: 5
[    5.493282] sd 1:0:0:0: Power-on or device reset occurred
[    5.513539] sd 1:0:0:0: [sda] 122880 512-byte logical blocks: (62.9
MB/60.0 MiB)
[    5.521970] sd 1:0:0:0: [sda] Write Protect is off
[    5.522683] sd 1:0:0:0: [sda] Mode Sense: 63 00 00 08
[    5.524552] sd 1:0:0:0: [sda] Write cache: enabled, read cache: enabled,
doesn't support DPO or FUA
[    5.613064] sd 1:0:0:0: [sda] Attached SCSI disk
[    5.681764] EXT4-fs (sda): INFO: recovery required on readonly filesystem
[    5.682530] EXT4-fs (sda): write access will be enabled during recovery
...
[    6.129348] EXT4-fs (sda): re-mounted. Opts: (null)
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Initializing random number generator: OK
Saving random seed: [    7.205617] random: dd: uninitialized urandom read
(512 bytes read)
OK
Starting network: OK

Welcome to Cubieboard2!
Cubieboard2 login:


Thanks!

Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>

Regards,
Niek
Peter Maydell Feb. 20, 2020, 2:50 p.m. UTC | #3
On Mon, 17 Feb 2020 at 20:48, Guenter Roeck <linux@roeck-us.net> wrote:
>
> Instantiate EHCI and OHCI controllers on Allwinner A10.
>
> The first patch in the series moves the declaration of EHCISysBusState
> from hcd-ohci.c to hcd-ohci.h. This lets us add the structure to
> AwA10State. Similar, TYPE_SYSBUS_OHCI is moved to be able to use it
> outside its driver.
>
> The second patch introduces the ehci-sysbus property "companion-enable".
> This lets us use object_property_set_bool() to enable companion mode.
>
> The third patch instantiates EHCI and OHCI ports for Allwinner-A10
> and marks the OHCI ports as companions of the respective EHCI ports.
>
> Tested by attaching various high speed and full speed devices, and by
> booting from USB drive.
>
> v3: Rebased to master
> v2: Add summary
>     Rewrite to instantiate OHCI in companion mode; add patch 2/3
>     Merge EHCI and OHCI instantiation into a single patch
>



Applied to target-arm.next, thanks.

-- PMM