From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 15EB119924D; Wed, 9 Oct 2024 14:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482472; cv=none; b=ku8O3/u9DO+MFYS4QpRLb4+H143na8TBwlDcbA/NXBWSp6ZTdhnKyxGwTp+MXJrLwd2K39HGkLdn7yW91Xt0FQ2VxzJdGyGx8OM1seATWj8EaWqoQvclA0TH1lUKQTha5cJGH9pEp4JQbCTFdg45HlMrQFGTcJNE4WzHjfAps2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482472; c=relaxed/simple; bh=5NTa9IDzSmGwLAEbnDA5FoBDhJmYbZiG/RmiM3fGt+I=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nqTbNo+kfEqrfR7Ej+m+ujESLqYlCtXzKZlAhq3uO6NKQyP7cU4ABjDegxpO4bNUK4/8j95mHdWVzTiIWe66vYjLZPEOdf7TaYEk/ZtKgSN8xxNgLmwi2Hg08AvaswxchdlYbux0etVfgePQK81sfsSxgi4vfGkphSRsXH9iSW8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=QOtzPyaq; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="QOtzPyaq" Received: by mail.gandi.net (Postfix) with ESMTPSA id 0C2371BF208; Wed, 9 Oct 2024 14:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482468; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GRl0oDUhVdNBfOFkIyXrQQ0mGfXjI5s9AX24o2wX49U=; b=QOtzPyaq8gmyrFlK2iT5M7O8TCY7xw5/mlTNjwLNHYwWaindmPyfdlXvXfVTbwgc8M6BoM 2LjWcfhMFaR0DKrxRVJlRU8Exa24gkVD/3+YC4djPgqcsOztNrWOU18rgQoOzF111j3CQ6 xTVbPijLsqb5Zwe4PIngdkHIue0OEJlmEPzowHoURhV+sS4m+ERtyYhwQlVqHYjuertucz L0exLmmfcBLzblvgO/Gda/qO4351PZoog7x/bvcRaTsRDBa0Uj7JprQe5XuCH6prDe0/Af wMmo4VpFsRgcXsBywq11AdnzywnSoaUxfIEIBxV06r5sv1yx05/8e6JxiSuvBQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:07 +0200 Subject: [PATCH v3 1/6] dt-bindings: i2c: nomadik: add mobileye,eyeq6h-i2c bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-1-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com After EyeQ5, it is time for Mobileye EyeQ6H to reuse the Nomadik I2C controller. Add a specific compatible because its HW integration is slightly different from EyeQ5. Do NOT add an example as it looks like EyeQ5 from a DT standpoint (without the mobileye,olb property). Reviewed-by: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. Reviewed-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml b/Do= cumentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml index 44c54b162bb10741ec7aac70d165403c28176eba..7e84465c20094b799697a71a66c= 66d144d621f46 100644 --- a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml @@ -22,6 +22,7 @@ select: enum: - st,nomadik-i2c - mobileye,eyeq5-i2c + - mobileye,eyeq6h-i2c required: - compatible =20 @@ -29,15 +30,15 @@ properties: compatible: oneOf: - items: - - const: st,nomadik-i2c + - enum: + - st,nomadik-i2c + - mobileye,eyeq5-i2c + - mobileye,eyeq6h-i2c - const: arm,primecell - items: - const: stericsson,db8500-i2c - const: st,nomadik-i2c - const: arm,primecell - - items: - - const: mobileye,eyeq5-i2c - - const: arm,primecell =20 reg: maxItems: 1 @@ -54,7 +55,7 @@ properties: - items: - const: mclk - const: apb_pclk - # Clock name in DB8500 or EyeQ5 + # Clock name in DB8500 or EyeQ - items: - const: i2cclk - const: apb_pclk --=20 2.46.2 From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90812197558; Wed, 9 Oct 2024 14:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482472; cv=none; b=IpDhzxy9sRHbgA6WI1lioOu/dmLFC5Zi69yMMu8YDT+BaAw3GRQV8WnIOBrlkhlxSrffAJRB/scsNJsBg2lNKNdU2ds/v3xIU85Ymy3TITz569htaPUS/V9gqV04uzWCGpo57j14uUefkq0GecsNsKv7dde+HeHcDYulUNtmTF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482472; c=relaxed/simple; bh=3MSs1fdm/p1+LrhWHubFXSBSpCZhYGnR8WaGMOsiEUo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mn2GmBvGr2ZTV3S0j0P/S6dnAdKnQmzminYmXjfNdT13l6nAYdT790qAzl3DC1JQHOOz3v7LvNDXlBWrntfV2CnvJM4R+eHGtqXbwBZn4OB+JVa9quFcRsNyoed9ll9EYokaba6he/gVXJTnc1J4/98vJkBhESibPYtNxDOooBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=b2jo1umh; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="b2jo1umh" Received: by mail.gandi.net (Postfix) with ESMTPSA id 9DA7B1BF205; Wed, 9 Oct 2024 14:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gA2VtzJur2fLfrAh7HiOZK9GKI0XRlL4niun8+mE/+k=; b=b2jo1umh/A1j9iiRQpuv8IobE+8z3xMSlPprZC7+qc/zEYrw9hdJxIPIVSWQcSOwq+ATWR cBqbqhPTca8N7tm2EY/PCleh5FgDGsnbZRqTGNeABg8QpsrNyWc+hOYMRFEvKP4SekANYI peYF2opUr/J5GXkFIuSzJaCoemNceFMo5NH7ZMayeEZtDUkTOvPQfpb0/JvbW775e7H/xL W76H8vbHBa86aL5meHk7UXBbVHALrvosc/c0GzvF4a2aSGCxUl2vWab0gquF3xnORQXsEl zQCzI6LCQwb+XC/58lF4IALwgHmtPsep+Tr0sp4elDjCROPMzV/3vJlQL8+TOQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:08 +0200 Subject: [PATCH v3 2/6] dt-bindings: i2c: nomadik: support 400kHz < clock-frequency <= 3.4MHz Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-2-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com Hardware is not limited to 400kHz, its documentation does mention how to configure it for high-speed (a specific Speed-Mode enum value and a different bus rate clock divider register to be used). Reviewed-by: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. Reviewed-by: Rob Herring (Arm) --- Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml b/Do= cumentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml index 7e84465c20094b799697a71a66c66d144d621f46..012402debfeb244b85dcecdc041= 1a77ada4494df 100644 --- a/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml @@ -68,7 +68,7 @@ properties: =20 clock-frequency: minimum: 1 - maximum: 400000 + maximum: 3400000 =20 mobileye,olb: $ref: /schemas/types.yaml#/definitions/phandle-array --=20 2.46.2 From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77DA719994B; Wed, 9 Oct 2024 14:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482473; cv=none; b=cmQvxAhEvmwmM+z7naQqDsnTKXbJtzPvN0gsbgP/FDJmN+UA9oCdGOhIBqqFifKSMSte4nqt0JuGJrHioNoROR0dqB1Tlr7julYcdo52D+uCSxCQl+LgHkc8e4lm7fCHNmbrjsHc+JweDqwjmBl4Ywwckf6diL9wbwA9rUmPMxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482473; c=relaxed/simple; bh=/tmvgtv1YRkuY7e7u2QsEYffXzgajAc9/AbktQhVIrY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=IA57AyABc/MNzml7Th2sYYLsWCYd8nkl++YWo1Zh+sg3FfBrNCF74oR3jOmyBZOkPYPuycOhtzTH7Nciky8zn+3xpT2Jn35OwfYfFReHcxgk2IvRQfHDnxNyFYkj+6Nq258oAcO3VKf7wIXXHiu6pL05Et3SuT8gdpDRTIEScNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=fgy1aY3l; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="fgy1aY3l" Received: by mail.gandi.net (Postfix) with ESMTPSA id 38E7E1BF209; Wed, 9 Oct 2024 14:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482469; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=51tFhwkIfjKQ6rs73rgZmRnnNukZhWLjQRX8i+8ldQ4=; b=fgy1aY3lMaGsku5c0wMK7goxdf6EpwET4Lj+sHWKLdxzWf1H4X7BS1TgDXcx2PHQzAnPtY mtMAsnTgjEGP3Tt03BpBIuXkK8+xrTj3V3+4UGNTu5HGbMnJWlgvST8lfyVa8HtAXRtS/G a5iHduX3rgjlxxqjwb1XzltPNNKNsNvXmOWZqcIIeVB4cq9I1xq81q79CYPjaGrftmUTU9 PhB9/CQykCjNSV2sOEwHPWBmn2BVOwgYpQhcJdJ+R1tE9bSo2jgEbchHyrOkBkx5tTGzVD Kzonp6YG6j7Ve/d5rE2gAEteZYx4T7IwvPyOSf2OSQCv2L8E38G+zy7dgzhaKQ== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:09 +0200 Subject: [PATCH v3 3/6] i2c: nomadik: switch from of_device_is_compatible() to of_match_device() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-3-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com Compatible-specific behavior is implemented using a if-condition on the return value from of_device_is_compatible(), from probe. It does not scale well when compatible number increases. Switch to using a match table and a call to of_match_device(). We DO NOT attach a .of_match_table field to our amba driver, as we do not use the table to match our driver to devices. Sort probe variable declarations in reverse christmas tree to try and introduce some logic into the ordering. Reviewed-by: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. --- drivers/i2c/busses/i2c-nomadik.c | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-noma= dik.c index ad0f02acdb1215a1c04729f97bb14a4d93f88456..c40328d1bca6cdefc61906cf916= 0f8411e37922a 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1046,8 +1047,6 @@ static int nmk_i2c_eyeq5_probe(struct nmk_i2c_dev *pr= iv) struct regmap *olb; unsigned int id; =20 - priv->has_32b_bus =3D true; - olb =3D syscon_regmap_lookup_by_phandle_args(np, "mobileye,olb", 1, &id); if (IS_ERR(olb)) return PTR_ERR(olb); @@ -1068,15 +1067,35 @@ static int nmk_i2c_eyeq5_probe(struct nmk_i2c_dev *= priv) return 0; } =20 +#define NMK_I2C_EYEQ_FLAG_32B_BUS BIT(0) +#define NMK_I2C_EYEQ_FLAG_IS_EYEQ5 BIT(1) + +static const struct of_device_id nmk_i2c_eyeq_match_table[] =3D { + { + .compatible =3D "mobileye,eyeq5-i2c", + .data =3D (void *)(NMK_I2C_EYEQ_FLAG_32B_BUS | NMK_I2C_EYEQ_FLAG_IS_EYEQ= 5), + }, +}; + static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *i= d) { - int ret =3D 0; - struct nmk_i2c_dev *priv; - struct device_node *np =3D adev->dev.of_node; - struct device *dev =3D &adev->dev; - struct i2c_adapter *adap; struct i2c_vendor_data *vendor =3D id->data; u32 max_fifo_threshold =3D (vendor->fifodepth / 2) - 1; + struct device_node *np =3D adev->dev.of_node; + const struct of_device_id *match; + struct device *dev =3D &adev->dev; + unsigned long match_flags =3D 0; + struct nmk_i2c_dev *priv; + struct i2c_adapter *adap; + int ret =3D 0; + + /* + * We do not want to attach a .of_match_table to our amba driver. + * Do not convert to device_get_match_data(). + */ + match =3D of_match_device(nmk_i2c_eyeq_match_table, dev); + if (match) + match_flags =3D (unsigned long)match->data; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -1084,10 +1103,10 @@ static int nmk_i2c_probe(struct amba_device *adev, = const struct amba_id *id) =20 priv->vendor =3D vendor; priv->adev =3D adev; - priv->has_32b_bus =3D false; + priv->has_32b_bus =3D match_flags & NMK_I2C_EYEQ_FLAG_32B_BUS; nmk_i2c_of_probe(np, priv); =20 - if (of_device_is_compatible(np, "mobileye,eyeq5-i2c")) { + if (match_flags & NMK_I2C_EYEQ_FLAG_IS_EYEQ5) { ret =3D nmk_i2c_eyeq5_probe(priv); if (ret) return dev_err_probe(dev, ret, "failed OLB lookup\n"); --=20 2.46.2 From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16CBB19995E; Wed, 9 Oct 2024 14:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482474; cv=none; b=l2WLqzepj2EcmKi9rPeXdTSDzHkrb52IcBOXHXjuNJwRAJ9om2/6wffjQ+tHF0/XGM3rPRSJicBkHcIZp26qk/VwgAqWbuhpGwPlB+DnSonRumnZ4S5PimMq31Lg6btVd7+YSiguFzpoBJpTL4+2DzW8BAjfYLNdj4EeHkjItd8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482474; c=relaxed/simple; bh=yfaVgBPbGJvvDLZMPnLTI2HWdOa8D9pnhvAtR5Ux59U=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TeTbipAUl3Z8oJbPS1T6V8svv9ngR01Ove9eqkTewAbbL++rAwk8tTh+jcBlI4qVClAJXhV6XCOd2BQcPdEHubh64bP5xvp3JWF6kHDaUcM96nzqK5oVlVzX5Mx8qXld+UVAebcG/DPUCRxbKc+ZuVIf1/89yyFnqZ3vHHehfkw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=a8NfnaQs; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="a8NfnaQs" Received: by mail.gandi.net (Postfix) with ESMTPSA id CF36E1BF20E; Wed, 9 Oct 2024 14:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2PT2bSMDA58VSAM1Q9Akc5IbSMb7rRJeyxTRzP7FAJ8=; b=a8NfnaQsS+Jzoxbcv4gY17SL9n5+x7zfsvdNPXdI7XrpvaBaq17tS1D6Z7tQoR/AR3v0Xj McNGKxxGqo4HO/Vjt8+zswwAcVGpbaI4e2eZ9PAPFAm+I1BsI0IYPTa8wiOFdAUehrpkWG tP4RVgDdkcNc8JVRhjQ+opJMDk4r7ll1C3M+SAXbkYG7e1JYjvDAUfBcTbWeV74X+EzEO6 /9dSzBoyWKzZA6kVEvkhloI2twwTjeI6xlvE4YoyvbCj4vlibBKTP4OoBYzCKBKy9+BRhe tRMugjaYSLFUnM6eRhszVB2Kgd/0LVehoLnntwuy8z5ulKblxUnF1FJ92OB5zA== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:10 +0200 Subject: [PATCH v3 4/6] i2c: nomadik: support Mobileye EyeQ6H I2C controller Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-4-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com Add EyeQ6H support to the nmk-i2c AMBA driver. It shares the same quirk as EyeQ5: the memory bus only supports 32-bit accesses. Avoid writeb() and readb() by reusing the same `priv->has_32b_bus` flag. It does NOT need to write speed-mode specific value into a register; therefore it does not depend on the mobileye,olb DT property. Reviewed-by: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. --- drivers/i2c/busses/i2c-nomadik.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-noma= dik.c index c40328d1bca6cdefc61906cf9160f8411e37922a..8f52ae4d6285af2dd2b3dc70706= 72757e831a019 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -6,10 +6,10 @@ * I2C master mode controller driver, used in Nomadik 8815 * and Ux500 platforms. * - * The Mobileye EyeQ5 platform is also supported; it uses + * The Mobileye EyeQ5 and EyeQ6H platforms are also supported; they use * the same Ux500/DB8500 IP block with two quirks: * - The memory bus only supports 32-bit accesses. - * - A register must be configured for the I2C speed mode; + * - (only EyeQ5) A register must be configured for the I2C speed mode; * it is located in a shared register region called OLB. * * Author: Srinidhi Kasagar @@ -1075,6 +1075,10 @@ static const struct of_device_id nmk_i2c_eyeq_match_= table[] =3D { .compatible =3D "mobileye,eyeq5-i2c", .data =3D (void *)(NMK_I2C_EYEQ_FLAG_32B_BUS | NMK_I2C_EYEQ_FLAG_IS_EYEQ= 5), }, + { + .compatible =3D "mobileye,eyeq6h-i2c", + .data =3D (void *)NMK_I2C_EYEQ_FLAG_32B_BUS, + }, }; =20 static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *i= d) --=20 2.46.2 From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A485D199FCC; Wed, 9 Oct 2024 14:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482475; cv=none; b=T6DrDCMXlulmOJTUTb69RHBJ9Rz71BgVwvxlyoywVq9jrjiK4iH5fIkHNzqq8l3NPgLGusrSiWoViWGHudXQi5Pfh7pB9DI+CczKF3yeQ8/WOwOwQ3AyAS3Bvc9/dLnLAJsEWTH9iqr7XtMyBhT2elwycMG0d5dzP1o6oTgWmKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482475; c=relaxed/simple; bh=p+Ur6Pon0boWoB29NiZyqCLsNliG7afgQ+2OrjsUK2A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hj0s+byiQwFSJsIaSODsaAIOfAbCK2dshrxFinZn1kgP4wJDpqx4q6LG9cCGxGGQSls7QmFHEw3KU5dXfwTJEM2cZCurqPbxhdZ3hGsH2D9zhPh6syi5O1zWEw/Hnk2yAtjgSxmnNq/ojSAFeZaL9EBJogPva+OhlYyPglkuBrA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=iAQ96K4o; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="iAQ96K4o" Received: by mail.gandi.net (Postfix) with ESMTPSA id 77EEC1BF20D; Wed, 9 Oct 2024 14:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=21HMetQOB+SaHvQI49UY0p8Ueen8RrlyJb33LwQyLmE=; b=iAQ96K4opWXLxs+g8ssUsorkBfi3YbyCkyZ/iAdhAMOpzQ+lVw2hR/MAMmm8wXXUMcKJmc yQqjrM9z+NDI1KW2Pq35sMwD3GIY4rzeR8kNshzaPsBjClcROU1COWTzwwuBt+B1MB6Kep WxRrkQebHBfe0ub1xb3UFBVkXTmnMpq2cTRDzuAWAfBXYgF++x/jG0ZgPztCCgqDN0KnrU tzchQ4Q206nthTtc61aXfLa7tP1Xy0HJz40rCH9+/jLOZGlSP6ZFzvHrL2azDXOKyPbGm3 PiAsMqvQm9CPKIXS4pEqI0nypV0OHgzz16Kf237yaHvxHk5YxYyOwKpd4u3W5Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:11 +0200 Subject: [PATCH v3 5/6] i2c: nomadik: fix BRCR computation Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-5-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com Current BRCR computation is: brcr =3D floor(i2cclk / (clkfreq * div)) With brcr: "baud rate counter", an internal clock divider, and i2cclk: input clock rate (24MHz, 38.4MHz or 48MHz), and clkfreq: desired bus rate, and div: speed-mode dependent divider (2 for standard, 3 otherwise). Assume i2cclk=3D48MHz, clkfreq=3D3.4MHz, div=3D3, then brcr =3D floor(48MHz / (3.4MHz * 3)) =3D 4 and resulting bus rate =3D 48MHz / (4 * 3) =3D 4MHz Assume i2cclk=3D38.4MHz, clkfreq=3D1.0MHz, div=3D3, then brcr =3D floor(38.4MHz / (1.0MHz * 3)) =3D 12 and resulting bus rate =3D 38.4MHz / (12 * 3) =3D 1066kHz The current computation means we always pick the smallest divider that gives a bus rate above target. We should instead pick the largest divider that gives a bus rate below target, using: brcr =3D floor(i2cclk / (clkfreq * div)) + 1 If we redo the above examples: Assume i2cclk=3D48MHz, clkfreq=3D3.4MHz, div=3D3, then brcr =3D floor(48MHz / (3.4MHz * 3)) + 1 =3D 5 and resulting bus rate =3D 48MHz / (5 * 3) =3D 3.2MHz Assume i2cclk=3D38.4MHz, clkfreq=3D1.0MHz, div=3D3, then brcr =3D floor(38.4MHz / (1.0MHz * 3)) + 1 =3D 13 and resulting bus rate =3D 38.4MHz / (13 * 3) =3D 985kHz In kernel C code, floor(x) is DIV_ROUND_DOWN() and, floor(x)+1 is DIV_ROUND_UP(). This is much less of an issue with slower bus rates (ie those currently supported), because the gap from one divider to the next is much smaller. It however keeps us from always using bus rates superior to the target. This fix is required for later on supporting faster bus rates: I2C_FREQ_MODE_FAST_PLUS (1MHz) and I2C_FREQ_MODE_HIGH_SPEED (3.4MHz). Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. --- drivers/i2c/busses/i2c-nomadik.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-noma= dik.c index 8f52ae4d6285af2dd2b3dc7070672757e831a019..90e3390cd66de5b3aa47d94de7f= b30e1d67ac70e 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -454,9 +454,13 @@ static void setup_i2c_controller(struct nmk_i2c_dev *p= riv) * operation, and the other is for std, fast mode, fast mode * plus operation. Currently we do not supprt high speed mode * so set brcr1 to 0. + * + * BRCR is a clock divider amount. Pick highest value that + * leads to rate strictly below target. Eg when asking for + * 400kHz you want a bus rate <=3D400kHz (and not >=3D400kHz). */ brcr1 =3D FIELD_PREP(I2C_BRCR_BRCNT1, 0); - brcr2 =3D FIELD_PREP(I2C_BRCR_BRCNT2, i2c_clk / (priv->clk_freq * div)); + brcr2 =3D FIELD_PREP(I2C_BRCR_BRCNT2, DIV_ROUND_UP(i2c_clk, priv->clk_fre= q * div)); =20 /* set the baud rate counter register */ writel((brcr1 | brcr2), priv->virtbase + I2C_BRCR); --=20 2.46.2 From nobody Wed Nov 27 15:45:53 2024 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E8AE819AD86; Wed, 9 Oct 2024 14:01:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482475; cv=none; b=JTTBLjxbMIxFricqxvyxdUvWezM2GEG0dcLtaRpIiOmSjbgbNYsM4TkPXws1s6DfZipYdyaLhJEvROnW1xekr/d8JdNGlfjlZYa42X2w+xG9bZ2I3LzP7Pj0mJ5Kh9CSzg6nxbwAfs4LC8WQirRdPZPS77LBjR3QjsJzwjLADkg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728482475; c=relaxed/simple; bh=9kaHINEv4/7SSdXuzvpM/8FbTviCbgIiOfx2HjQC/Us=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RyZtXFAnToN2E1L9nk/Yy4l9T2vAbygG9/ra/A83lSExhMYINcYh6V0gsXqlkumQATa0dgxb7l9p/fsxJwr5j8SwXsbaTHI3jr+sJhx+oqy59pmDO7MyYEcV+Av1/OxLVO142KZC99b0l+ZF5eSRuYatlvZ4q9ItCxEE8OqQs5U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=V9WBB2Io; arc=none smtp.client-ip=217.70.183.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="V9WBB2Io" Received: by mail.gandi.net (Postfix) with ESMTPSA id 0E36B1BF20F; Wed, 9 Oct 2024 14:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1728482471; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KN4a14PZ8SWOObiK/DnNIgNJ+gCkWYqBAi+54cWiank=; b=V9WBB2Io+6zw/6SSxWaygTW2qxD+pr0kCkqPuKUogz+niFRH/WqurvOvsNdkgvY+v9WG++ 7quuOThLEQrCPzWM8Ot/8Psm8WFsex3ibZ0F+KTBbJqVY6NIW1zVhQ1GOEmiZkYdkyyKtX 0FGJwbqLQqLcXO7LFQdM1PKyQj8aBwhI7bs8FaW4wprwJlp9d4/OQvaVQnN0kRbNHWYMvk l1vxqOQxE4OBHnrNR1Sp8ON8mOLGnVWKtQO1zO0/iCnT9anaXAn+RmNRQ97nNr2LoE53os TnBMJ3AF0UVw3zmaJb08+DptPEPfKb+2nR0sh8WHXaG3h2oD1nzFtrzSjdnw6Q== From: =?utf-8?q?Th=C3=A9o_Lebrun?= Date: Wed, 09 Oct 2024 16:01:12 +0200 Subject: [PATCH v3 6/6] i2c: nomadik: support >=1MHz speed modes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241009-mbly-i2c-v3-6-e7fd13bcf1c4@bootlin.com> References: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> In-Reply-To: <20241009-mbly-i2c-v3-0-e7fd13bcf1c4@bootlin.com> To: Linus Walleij , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vladimir Kondratiev , =?utf-8?q?Gr=C3=A9gory_Clement?= , Thomas Petazzoni , Tawfik Bayouk , =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: b4 0.14.2 X-GND-Sasl: theo.lebrun@bootlin.com - BRCR value must go into the BRCR1 field when in high-speed mode. It goes into BRCR2 otherwise. - Remove fallback to standard mode if priv->sm > I2C_FREQ_MODE_FAST. - Set SM properly in probe; previously it only checked STANDARD versus FAST. Now we set STANDARD, FAST, FAST_PLUS or HIGH_SPEED. - Remove all comment sections saying we only support low-speeds. Reviewed-by: Linus Walleij Signed-off-by: Th=C3=A9o Lebrun Reviewed-By trailers from this V3 if you like. --- drivers/i2c/busses/i2c-nomadik.c | 40 ++++++++++++++++--------------------= ---- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-noma= dik.c index 90e3390cd66de5b3aa47d94de7fb30e1d67ac70e..efb33802804fdde82fe6d38d4f8= 9d0b898f1667e 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -397,7 +397,7 @@ static u32 load_i2c_mcr_reg(struct nmk_i2c_dev *priv, u= 16 flags) */ static void setup_i2c_controller(struct nmk_i2c_dev *priv) { - u32 brcr1, brcr2; + u32 brcr; u32 i2c_clk, div; u32 ns; u16 slsu; @@ -444,7 +444,7 @@ static void setup_i2c_controller(struct nmk_i2c_dev *pr= iv) /* * The spec says, in case of std. mode the divider is * 2 whereas it is 3 for fast and fastplus mode of - * operation. TODO - high speed support. + * operation. */ div =3D (priv->clk_freq > I2C_MAX_STANDARD_MODE_FREQ) ? 3 : 2; =20 @@ -452,34 +452,23 @@ static void setup_i2c_controller(struct nmk_i2c_dev *= priv) * generate the mask for baud rate counters. The controller * has two baud rate counters. One is used for High speed * operation, and the other is for std, fast mode, fast mode - * plus operation. Currently we do not supprt high speed mode - * so set brcr1 to 0. + * plus operation. * * BRCR is a clock divider amount. Pick highest value that * leads to rate strictly below target. Eg when asking for * 400kHz you want a bus rate <=3D400kHz (and not >=3D400kHz). */ - brcr1 =3D FIELD_PREP(I2C_BRCR_BRCNT1, 0); - brcr2 =3D FIELD_PREP(I2C_BRCR_BRCNT2, DIV_ROUND_UP(i2c_clk, priv->clk_fre= q * div)); + brcr =3D DIV_ROUND_UP(i2c_clk, priv->clk_freq * div); + + if (priv->sm =3D=3D I2C_FREQ_MODE_HIGH_SPEED) + brcr =3D FIELD_PREP(I2C_BRCR_BRCNT1, brcr); + else + brcr =3D FIELD_PREP(I2C_BRCR_BRCNT2, brcr); =20 /* set the baud rate counter register */ - writel((brcr1 | brcr2), priv->virtbase + I2C_BRCR); + writel(brcr, priv->virtbase + I2C_BRCR); =20 - /* - * set the speed mode. Currently we support - * only standard and fast mode of operation - * TODO - support for fast mode plus (up to 1Mb/s) - * and high speed (up to 3.4 Mb/s) - */ - if (priv->sm > I2C_FREQ_MODE_FAST) { - dev_err(&priv->adev->dev, - "do not support this mode defaulting to std. mode\n"); - brcr2 =3D FIELD_PREP(I2C_BRCR_BRCNT2, - i2c_clk / (I2C_MAX_STANDARD_MODE_FREQ * 2)); - writel((brcr1 | brcr2), priv->virtbase + I2C_BRCR); - writel(FIELD_PREP(I2C_CR_SM, I2C_FREQ_MODE_STANDARD), - priv->virtbase + I2C_CR); - } + /* set the speed mode */ writel(FIELD_PREP(I2C_CR_SM, priv->sm), priv->virtbase + I2C_CR); =20 /* set the Tx and Rx FIFO threshold */ @@ -1020,11 +1009,14 @@ static void nmk_i2c_of_probe(struct device_node *np, if (of_property_read_u32(np, "clock-frequency", &priv->clk_freq)) priv->clk_freq =3D I2C_MAX_STANDARD_MODE_FREQ; =20 - /* This driver only supports 'standard' and 'fast' modes of operation. */ if (priv->clk_freq <=3D I2C_MAX_STANDARD_MODE_FREQ) priv->sm =3D I2C_FREQ_MODE_STANDARD; - else + else if (priv->clk_freq <=3D I2C_MAX_FAST_MODE_FREQ) priv->sm =3D I2C_FREQ_MODE_FAST; + else if (priv->clk_freq <=3D I2C_MAX_FAST_MODE_PLUS_FREQ) + priv->sm =3D I2C_FREQ_MODE_FAST_PLUS; + else + priv->sm =3D I2C_FREQ_MODE_HIGH_SPEED; priv->tft =3D 1; /* Tx FIFO threshold */ priv->rft =3D 8; /* Rx FIFO threshold */ =20 --=20 2.46.2