[PATCH v6 081/102] x86: Add a generic Intel GPIO driver

Wolfgang Wallner wolfgang.wallner at br-automation.com
Fri Dec 13 09:49:55 CET 2019


Hi Simon, Bin,

> +static int intel_gpio_direction_output(struct udevice *dev, uint offset,
> +				       int value)
> +{
> +	struct udevice *pinctrl = dev_get_parent(dev);
> +	uint config_offset = intel_pinctrl_get_config_reg_addr(pinctrl, offset);
> +
> +	pcr_clrsetbits32(dev, config_offset,

I think we should pass 'pinctrl' instead of 'dev' here.
As far as I understand the code the function pcr_clrsetbits32 expects a pinctrl
device with a p2sb parent.

> +			 PAD_CFG0_MODE_MASK | PAD_CFG0_RX_STATE |
> +				  PAD_CFG0_TX_DISABLE,

We also need to clear the bit PAD_CFG0_TX_STATE here.
Otherwise if a gpio is set to high once it can never be set to low again.

> +			 PAD_CFG0_MODE_GPIO | PAD_CFG0_RX_DISABLE |
> +				  (value ? PAD_CFG0_TX_STATE : 0));
> +
> +	return 0;
> +}

regards, Wolfgang


More information about the U-Boot mailing list