[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <xy2nxcjxkw6pkprrjx2sol62xvq2nr3ukdwpn4h3wuwpnnu43j@2djyqtkdpcwc>
Date: Fri, 8 Mar 2024 00:11:06 +0100
From: Andi Shyti <andi.shyti@...nel.org>
To: Théo Lebrun <theo.lebrun@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>, Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
linux-arm-kernel@...ts.infradead.org, linux-i2c@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
Gregory Clement <gregory.clement@...tlin.com>, Vladimir Kondratiev <vladimir.kondratiev@...ileye.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>, Tawfik Bayouk <tawfik.bayouk@...ileye.com>
Subject: Re: [PATCH v3 08/11] i2c: nomadik: support Mobileye EyeQ5 I2C
controller
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@...nel.org>
Thanks,
Andi
Powered by blists - more mailing lists