Re: [PATCH 1/7 v2] i2c: imx: workaround for A-010650: implement bus recovery with gpio for Layerscape

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> Because pinctrl is not supported on Layerscape, current bus recovery
> is not avalible for Layerscape. This patch uses an open drain GPIO
> pin to connect to the IICx_SCL to drive nine clock pulses to unlock
> the I2C bus.

Sorry, but I have to reject it for two reasons:

> +enum pinmux_endian_type {
> +	BIG_ENDIAN,
> +	LITTLE_ENDIAN,
> +};
> +
> +struct pinmux_cfg {
> +	enum pinmux_endian_type endian; /* endian of RCWPMUXCR0 */
> +	u32 pmuxcr_offset;
> +	u32 pmuxcr_set_bit;		    /* pin mux of RCWPMUXCR0 */
> +};
> +
> +static struct pinmux_cfg ls1012a_pinmux_cfg = {
> +	.endian = BIG_ENDIAN,
> +	.pmuxcr_offset = 0x430,
> +	.pmuxcr_set_bit = 0x10,
> +};
> +
> +static struct pinmux_cfg ls1043a_pinmux_cfg = {
> +	.endian = BIG_ENDIAN,
> +	.pmuxcr_offset = 0x40C,
> +	.pmuxcr_set_bit = 0x10,
> +};
> +
> +static struct pinmux_cfg ls1046a_pinmux_cfg = {
> +	.endian = BIG_ENDIAN,
> +	.pmuxcr_offset = 0x40C,
> +	.pmuxcr_set_bit = 0x80000000,
> +};
> +
> +static const struct of_device_id pinmux_of_match[] = {
> +	{ .compatible = "fsl,ls1012a-vf610-i2c", .data = &ls1012a_pinmux_cfg},
> +	{ .compatible = "fsl,ls1043a-vf610-i2c", .data = &ls1043a_pinmux_cfg},
> +	{ .compatible = "fsl,ls1046a-vf610-i2c", .data = &ls1046a_pinmux_cfg},
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, pinmux_of_match);

1) This is basically an embedded pinmux driver, or? This really needs to
go to the pinctrl subsystem, not here.

> +	ret = gpio_request(i2c_imx->gpio, i2c_imx->adapter.name);
> +	if (ret) {
> +		dev_err(&i2c_imx->adapter.dev,
> +			"can't get gpio: %d\n", ret);
> +		return ret;
> +	}
> +
> +	/* Configure GPIO pin as an output and open drain. */
> +	gpio_direction_output(i2c_imx->gpio, 1);
> +	udelay(10);
> +
> +	/* Write data to generate 9 pulses */
> +	for (i = 0; i < 9; i++) {
> +		gpio_set_value(i2c_imx->gpio, 1);
> +		udelay(10);
> +		gpio_set_value(i2c_imx->gpio, 0);
> +		udelay(10);
> +	}

2) You are open coding the already existing i2c_bus_recovery
infrastructure which is not acceptable.

So, please use a proper pinctrl driver and fill out the struct
bus_recovery_info to use the GPIOs you want.

Regards,

   Wolfram

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux