[PATCH v1 1/3] drivers: gpio-uclass: support PMIC GPIO children

Tom Rini trini at konsulko.com
Fri Nov 3 20:46:58 CET 2023


On Fri, Nov 03, 2023 at 09:39:51PM +0200, Svyatoslav Ryhel wrote:
> 
> 
> 3 листопада 2023 р. 21:03:39 GMT+02:00, Tom Rini <trini at konsulko.com> написав(-ла):
> >On Tue, Oct 24, 2023 at 11:37:59AM +0300, Svyatoslav Ryhel wrote:
> >
> >> UCLASS_PMIC may have GPIO children without exposed fdt node,
> >> in this case if requesting fails, check if uclass is PMIC.
> >> If so, iterate through its children to find correct device.
> >> 
> >> Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
> >> ---
> >>  drivers/gpio/gpio-uclass.c | 19 ++++++++++++++++---
> >>  1 file changed, 16 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
> >> index 7aece85a70..a3fc470a5d 100644
> >> --- a/drivers/gpio/gpio-uclass.c
> >> +++ b/drivers/gpio/gpio-uclass.c
> >> @@ -1143,9 +1143,22 @@ static int gpio_request_tail(int ret, const char *nodename,
> >>  		ret = uclass_get_device_by_ofnode(UCLASS_GPIO, args->node,
> >>  						  &desc->dev);
> >>  		if (ret) {
> >> -			debug("%s: uclass_get_device_by_ofnode failed\n",
> >> -			      __func__);
> >> -			goto err;
> >> +			struct udevice *pmic;
> >> +			ret = uclass_get_device_by_ofnode(UCLASS_PMIC, args->node,
> >> +							  &pmic);
> >> +			if (ret) {
> >> +				log_err("PMIC device get failed, err %d\n", ret);
> >> +				goto err;
> >> +			}
> >> +
> >> +			device_foreach_child(desc->dev, pmic) {
> >> +				if (device_get_uclass_id(desc->dev) == UCLASS_GPIO)
> >> +					break;
> >> +			}
> >> +
> >> +			/* if loop exits without GPIO device return error */
> >> +			if (device_get_uclass_id(desc->dev) != UCLASS_GPIO)
> >> +				goto err;
> >>  		}
> >>  	}
> >>  	ret = gpio_find_and_xlate(desc, args);
> >
> >This needs to check for DM_PMIC or so as it leads to a lot of size
> >increase and one failure to link due to running out of space now.
> 
> Thanks for checking! I will look into it deeper to reduce the size inflation, not sure though why it occurs at all.

Note that it's not a huge inflation (it's 128 bytes), but for every
board that includes this file, in SPL, it grows that much, and then
sometimes might also be "and now we pull in funcX" as well.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231103/d707eee6/attachment.sig>


More information about the U-Boot mailing list