mbox series

[v3,0/3] usb: misc: onboard_usb_hub: add support for Cypress HX3 USB 3.0 family

Message ID 20230620-hx3-v3-0-2acbc03ca949@skidata.com
Headers show
Series usb: misc: onboard_usb_hub: add support for Cypress HX3 USB 3.0 family | expand

Message

Benjamin Bara June 21, 2023, 3:58 p.m. UTC
Hi!

This series adds support for the Cypress HX3 USB 3.0 family (2/3). For
now, it just contains the USB-related aspects and ignores the option to
connect it via i2c (3/3).

As the HX3 family operates with two power supplies, multiple power
supply support is implemented (1/3).

Thanks & best regards,
Benjamin

---
Changes in v3:
- 1/3: fix nits mentioned by Matthias
- Link to v2: https://lore.kernel.org/r/20230620-hx3-v2-0-76a53434c713@skidata.com

Changes in v2:
- don't re-order by VID/PID (thanks to Matthias)
- 1/3: replace (err != 0) with (err)
- Link to v1: https://lore.kernel.org/r/20230620-hx3-v1-0-3a649b34c85b@skidata.com

---
Benjamin Bara (3):
      usb: misc: onboard-hub: support multiple power supplies
      usb: misc: onboard-hub: add support for Cypress HX3 USB 3.0 family
      dt-bindings: usb: Add binding for Cypress HX3 USB 3.0 family

 .../devicetree/bindings/usb/cypress,hx3.yaml       | 77 ++++++++++++++++++++++
 drivers/usb/misc/onboard_usb_hub.c                 | 42 +++++++++---
 drivers/usb/misc/onboard_usb_hub.h                 |  8 +++
 3 files changed, 119 insertions(+), 8 deletions(-)
---
base-commit: 45a3e24f65e90a047bef86f927ebdc4c710edaa1
change-id: 20230620-hx3-cb935b4fdd76

Best regards,

Comments

Benjamin Bara June 21, 2023, 4:22 p.m. UTC | #1
On Wed, 21 Jun 2023 at 18:07, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Wed, Jun 21, 2023 at 05:58:30PM +0200, Benjamin Bara wrote:
> > From: Benjamin Bara <benjamin.bara@skidata.com>
> >
> > As some of the onboard hubs require multiple power supplies, provide the
> > environment to support them.
> >
> > Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> > ---
> > v3:
> > - fix nits mentioned in v2
> >
> > v2:
> > - replace (err != 0) with (err)
> > ---
> >  drivers/usb/misc/onboard_usb_hub.c | 39 ++++++++++++++++++++++++++++++--------
> >  drivers/usb/misc/onboard_usb_hub.h |  1 +
> >  2 files changed, 32 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/usb/misc/onboard_usb_hub.c b/drivers/usb/misc/onboard_usb_hub.c
> > index 12fc6eb67c3b..a56e712d3a45 100644
> > --- a/drivers/usb/misc/onboard_usb_hub.c
> > +++ b/drivers/usb/misc/onboard_usb_hub.c
> > @@ -27,6 +27,13 @@
> >
> >  #include "onboard_usb_hub.h"
> >
> > +#define MAX_SUPPLIES 2
>
> Why 2?

I picked 2 because with 3/3, this is the maximum of "required" supplies. The
currently implemented ones require only one (up to now just named "vdd"). The
new one added in 3/3 requires 2, therefore I tried to be generic if some future
hub might require 3 or more.

> > +
> > +static const char * const supply_names[] = {
> > +     "vdd",
> > +     "vdd2",
> > +};
>
> Do those names have anything to do with the number above?  If so, please
> document it!

I picked "vdd" for the first to be compatible with the existing device-trees. As
the actual names differ between hubs, I thought it might be generic to just use
"vdd2" here. If I should add some comment like "if you increase MAX_SUPPLIES,
please also add a supply_name below", I can do that. I could also implement
"vdd${i+1}" for i>0 instead.

>
> >  struct onboard_hub_pdata {
> >       unsigned long reset_us;         /* reset pulse width in us */
> > +     unsigned int num_supplies;      /* number of supplies: 0 considered as 1 */
>
> I can not understand that comment at all :(

This should just indicate that leaving the field empty means one supply is
required. Maybe "defaults to 1" is better?