[PATCH v5 2/3] usb: ohci-at91: Enable OHCI functionality and register into DM

Marek Vasut marex at denx.de
Tue Jul 25 18:17:31 CEST 2023


On 7/25/23 17:43, Eugen Hristev wrote:

[...]

> +static int ohci_atmel_probe(struct udevice *dev)
> +{
> +	struct ohci_at91_priv *ohci_at91 = dev_get_priv(dev);
> +	struct at91_usbh_data *pdata = dev_get_plat(dev);
> +	struct ohci_regs *regs;
> +	int ret;
> +	u32 i;
> +
> +	regs = (struct ohci_regs *)dev_read_addr(dev);
> +	if (IS_ERR(regs)) {
> +		ret = PTR_ERR(regs);
> +		goto fail;
> +	}
> +
> +	pdata->ports = dev_read_u32_default(dev, "num-ports", 3);
> +
> +	at91_for_each_port(i, pdata->ports)
> +		gpio_request_by_name(dev, "atmel,vbus-gpio", i,
> +				     &pdata->vbus_pin[i], GPIOD_IS_OUT |
> +				     GPIOD_IS_OUT_ACTIVE);
> +
> +	ret = clk_get_bulk(dev, &ohci_at91->clks);

If this fails, and ohci_at91->clks is not populated ...

> +	if (ret)
> +		goto fail;
> +
> +	ret = clk_enable_bulk(&ohci_at91->clks);
> +	if (ret)
> +		goto fail;
> +
> +	ret = at91_start_hc(dev);
> +	if (ret)
> +		goto fail;
> +
> +	return ohci_register(dev, regs);
> +
> +fail:
> +	at91_for_each_port(i, pdata->ports)
> +		if (dm_gpio_is_valid(&pdata->vbus_pin[i]))
> +			gpio_free(pdata->vbus_pin[i].offset);
> +
> +	clk_disable_bulk(&ohci_at91->clks);

... then this clk_disable_bulk() would likely misbehave, right ?


More information about the U-Boot mailing list