Message ID | e6021f12f4e245dc2162a6ab479d416374efc799.1503249785.git.balaton@eik.bme.hu |
---|---|
State | New |
Headers | show |
On Sun, Aug 20, 2017 at 07:23:05PM +0200, BALATON Zoltan wrote: > Some PPC SoCs have an EHCI with OHCI companion USB controller. Add a > new type for this similar to types used for other embedded SoCs. > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Gerd, again, if it's convenient to you, I can queue this for 2.11. > --- > hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++ > hw/usb/hcd-ehci.h | 1 + > 2 files changed, 26 insertions(+) > > diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c > index 6c20604..3b83beb 100644 > --- a/hw/usb/hcd-ehci-sysbus.c > +++ b/hw/usb/hcd-ehci-sysbus.c > @@ -142,6 +142,30 @@ static const TypeInfo ehci_tegra2_type_info = { > .class_init = ehci_tegra2_class_init, > }; > > +static void ehci_ppc4xx_init(Object *o) > +{ > + EHCISysBusState *s = SYS_BUS_EHCI(o); > + > + s->ehci.companion_enable = true; > +} > + > +static void ehci_ppc4xx_class_init(ObjectClass *oc, void *data) > +{ > + SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); > + DeviceClass *dc = DEVICE_CLASS(oc); > + > + sec->capsbase = 0x0; > + sec->opregbase = 0x10; > + set_bit(DEVICE_CATEGORY_USB, dc->categories); > +} > + > +static const TypeInfo ehci_ppc4xx_type_info = { > + .name = TYPE_PPC4xx_EHCI, > + .parent = TYPE_SYS_BUS_EHCI, > + .class_init = ehci_ppc4xx_class_init, > + .instance_init = ehci_ppc4xx_init, > +}; > + > /* > * Faraday FUSBH200 USB 2.0 EHCI > */ > @@ -224,6 +248,7 @@ static void ehci_sysbus_register_types(void) > type_register_static(&ehci_xlnx_type_info); > type_register_static(&ehci_exynos4210_type_info); > type_register_static(&ehci_tegra2_type_info); > + type_register_static(&ehci_ppc4xx_type_info); > type_register_static(&ehci_fusbh200_type_info); > } > > diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h > index 821f1de..0bc364b 100644 > --- a/hw/usb/hcd-ehci.h > +++ b/hw/usb/hcd-ehci.h > @@ -344,6 +344,7 @@ typedef struct EHCIPCIState { > #define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" > #define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb" > #define TYPE_TEGRA2_EHCI "tegra2-ehci-usb" > +#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb" > #define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb" > > #define SYS_BUS_EHCI(obj) \
On Mon, 2017-08-21 at 14:18 +1000, David Gibson wrote: > On Sun, Aug 20, 2017 at 07:23:05PM +0200, BALATON Zoltan wrote: > > Some PPC SoCs have an EHCI with OHCI companion USB controller. Add > > a > > new type for this similar to types used for other embedded SoCs. > > > > Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> > > Reviewed-by: David Gibson <david@gibson.dropbear.id.au> > > Gerd, again, if it's convenient to you, I can queue this for 2.11. Yes please. I think merging this way it is easier, patches later in this series probably depend on these two usb patches. Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> cheers, Gerd
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index 6c20604..3b83beb 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -142,6 +142,30 @@ static const TypeInfo ehci_tegra2_type_info = { .class_init = ehci_tegra2_class_init, }; +static void ehci_ppc4xx_init(Object *o) +{ + EHCISysBusState *s = SYS_BUS_EHCI(o); + + s->ehci.companion_enable = true; +} + +static void ehci_ppc4xx_class_init(ObjectClass *oc, void *data) +{ + SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc); + DeviceClass *dc = DEVICE_CLASS(oc); + + sec->capsbase = 0x0; + sec->opregbase = 0x10; + set_bit(DEVICE_CATEGORY_USB, dc->categories); +} + +static const TypeInfo ehci_ppc4xx_type_info = { + .name = TYPE_PPC4xx_EHCI, + .parent = TYPE_SYS_BUS_EHCI, + .class_init = ehci_ppc4xx_class_init, + .instance_init = ehci_ppc4xx_init, +}; + /* * Faraday FUSBH200 USB 2.0 EHCI */ @@ -224,6 +248,7 @@ static void ehci_sysbus_register_types(void) type_register_static(&ehci_xlnx_type_info); type_register_static(&ehci_exynos4210_type_info); type_register_static(&ehci_tegra2_type_info); + type_register_static(&ehci_ppc4xx_type_info); type_register_static(&ehci_fusbh200_type_info); } diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 821f1de..0bc364b 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -344,6 +344,7 @@ typedef struct EHCIPCIState { #define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb" #define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb" #define TYPE_TEGRA2_EHCI "tegra2-ehci-usb" +#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb" #define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb" #define SYS_BUS_EHCI(obj) \
Some PPC SoCs have an EHCI with OHCI companion USB controller. Add a new type for this similar to types used for other embedded SoCs. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> --- hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++ hw/usb/hcd-ehci.h | 1 + 2 files changed, 26 insertions(+)