Re: [PATCH v3] Add two new configuration drivers for Microchip USB hubs
From: Christian Eggers
Date: Mon Aug 24 2020 - 06:32:19 EST
Hi Richard,
On Monday, 17 August 2020, 09:54:26 CEST, Richard Leitner wrote:
> Hi Christian,
> sorry for the late reply. My MUA somehow didn't show me that series
> earlier...
likewise... I was on holiday last week.
> I haven't looked into the patches in detail, but at a first glance it
> looks like a lot copy-n-paste.
> Have you thought about merging the (after your series) 3 hub drivers
> into one? Something like a "microchip i2c usb hub driver"?
> Would that be feasible for your point of view?
I'm not sure about the criteria for having separate drivers vs. a combined
one.
As changing the driver usually requires testing with real hardware, keeping
them separate may be easier. On the other hand, I already synced some changes
from usb251xb into "my" drivers, so it is likely that such work will also have
to done in future.
Rob Herring already suggested to create a common yaml document for the
device tree bindings. It would probably make sense to share the device tree
code between our drivers. But I would like to keep the "hardware" side of the
drivers independent, as there are subtle differences between the different hub
series.
Compared to usb251x, the new drivers don't write the full configuration memory
of the hub (the configuration memory space is much bigger than 8 bit and has
many holes). They rely on the defaults after hardware reset on perform read-
modify-write for the properties set in the device tree.
If the usb251xb hubs could be programmed in a similar way, merging all drivers
should be possible using a mic_usb_hub_ops struct with function pointers for
applying the (common) device tree properties (e.g. set_product_id(),
set_device_id(), ..., set_oc_delay(), set_manufacturer_string(), ...).
Best regards
Christian