[U-Boot] [PATCH v2] musb: sunxi: Use base address from device tree

Jun Nie jun.nie at linaro.org
Wed Jan 10 14:01:18 UTC 2018


2017-12-30 20:44 GMT+08:00 Chen-Yu Tsai <wens at csie.org>:
> Now that the musb sunxi glue driver is completely device model / device
> tree driven, we should use the base address from the device tree,
> instead of hard-coding it in the source code.
>
> Fixes: 3a61b080acee ("musb: sunxi: switch to the device model")
> Signed-off-by: Chen-Yu Tsai <wens at csie.org>
> ---
> Changes since v1:
>
>   - Check return value dev_read_addr_ptr()
>
> IMHO, having NULL represent an error for dev_read_addr_ptr() doesn't
> work so well as in the kernel, because U-boot doesn't acually map
> addresses. So NULL (or 0x0) is in fact a valid address. Something
> like ~0x0 might work better, but that's a whole other changeset.
>
> ---
>  drivers/usb/musb-new/sunxi.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
> index 7ee44ea91900..aedc24b93711 100644
> --- a/drivers/usb/musb-new/sunxi.c
> +++ b/drivers/usb/musb-new/sunxi.c
> @@ -312,13 +312,16 @@ static int musb_usb_probe(struct udevice *dev)
>  {
>         struct musb_host_data *host = dev_get_priv(dev);
>         struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
> +       void *base = dev_read_addr_ptr(dev);
>         int ret;

Chenyu,

I am not familiar with MUSB and not sure whether this driver support
both host and peripheral mode. I suppose it support both mode in
different build config according to macro CONFIG_USB_MUSB_HOST. H3
user manual says register address space is different for the two
modes,  0x1c19000 for device mode and 0x1c1a000 for host mode.
If my understanding is correct, we need different address in dts for
different mode. Or I misunderstand anything? Thank you for explaining
it!

Jun


More information about the U-Boot mailing list