Re: [PATCH v3 08/11] i2c: nomadik: support Mobileye EyeQ5 I2C controller

From: Andi Shyti
Date: Thu Mar 07 2024 - 18:11:20 EST


Hi Theo,

..

> +static inline u8 nmk_i2c_readb(const struct nmk_i2c_dev *priv,
> + unsigned long reg)
> +{
> + if (priv->has_32b_bus)
> + return readl(priv->virtbase + reg);
> + else
> + return readb(priv->virtbase + reg);
> +}

you forgot to remove the else... not a problem, it's coherent
with its writeb counterpart.

..

> +static int nmk_i2c_eyeq5_probe(struct nmk_i2c_dev *priv)
> +{
> + struct device *dev = &priv->adev->dev;
> + struct device_node *np = dev->of_node;
> + unsigned int mask, speed_mode;
> + struct regmap *olb;
> + unsigned int id;
> +
> + priv->has_32b_bus = true;
> +
> + olb = syscon_regmap_lookup_by_phandle_args(np, "mobileye,olb", 1, &id);
> + if (IS_ERR(olb))
> + return PTR_ERR(olb);
> + if (id >= ARRAY_SIZE(nmk_i2c_eyeq5_masks))
> + return -ENOENT;
> +
> + if (priv->clk_freq <= 400000)
> + speed_mode = I2C_EYEQ5_SPEED_FAST;
> + else if (priv->clk_freq <= 1000000)
> + speed_mode = I2C_EYEQ5_SPEED_FAST_PLUS;
> + else
> + speed_mode = I2C_EYEQ5_SPEED_HIGH_SPEED;
> +
> + mask = nmk_i2c_eyeq5_masks[id];
> + regmap_update_bits(olb, NMK_I2C_EYEQ5_OLB_IOCR2,
> + mask, speed_mode << __fls(mask));
> +
> + return 0;
> +}
> +
> static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
> {
> int ret = 0;
> @@ -1012,8 +1087,15 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
>
> priv->vendor = vendor;
> priv->adev = adev;
> + priv->has_32b_bus = false;
> nmk_i2c_of_probe(np, priv);
>
> + if (of_device_is_compatible(np, "mobileye,eyeq5-i2c")) {
> + ret = nmk_i2c_eyeq5_probe(priv);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed OLB lookup\n");
> + }
> +

Looks good!

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx>

Thanks,
Andi