* [PATCH v2 0/9] Add support for Sonoff iHost RV1126 Smart Home Gateway @ 2023-11-22 12:22 Tim Lunn 2023-11-22 12:22 ` [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 Tim Lunn 0 siblings, 1 reply; 6+ messages in thread From: Tim Lunn @ 2023-11-22 12:22 UTC (permalink / raw) To: linux-rockchip, devicetree Cc: Tim Lunn, Jagan Teki, Rob Herring, linux-arm-kernel, Heiko Stuebner, Krzysztof Kozlowski, Conor Dooley, Andi Shyti, linux-i2c Sonoff iHost is gateway device designed to provide a Smart Home Hub, most notably it includes builtin radios for Wifi, BT and Zigbee, which make it suitable SBC for use with many of the open home automation platforms. It is availabe in two versions, first is based on Rockchip RV1126 and 4GB DDR4 RAM. There is a second version based off the RV1109 dual core SoC and 2GB RAM. Features: - Rockchip RV1126 (or RV1109) - 4GB DDR4 - 8GB eMMC - microSD slot - RMII Ethernet PHY - 1x USB 2.0 Host - 1x USB 2.0 OTG - Realtek RTL8723DS WiFi/BT - EFR32MG21 Silabs Zigbee radio - Speaker/Microphone This patch series adds the various device tree nodes required to support this device. It also adds the initial dts for this device, This work was largely based off the device trees for mainline Edgeble Neu2 and downstream Rockchip rv1126-evb-v13 configs. It has been adapted with relevant peripherals and GPIO pins for the iHost. Implemented in this series are most of the core periperhals including Ethernet, Wifi, BT, Zigbee and RTC. Sound and USB will be added in a later series. Changes in v2: - i2c: clarify commit message - Address review comments from Heiko - Split out rv1109.dtsi to new patch - Collect Robh Ack for dt-bindings patch Tim Lunn (9): ARM: dts: rockchip: rv1126: Add alternate UART pins ARM: dts: rockchip: rv1126: Serial aliases i2c: rk3x: Adjust offset for i2c2 on rv1126 ARM: dts: rockchip: rv1126: Add i2c2 nodes ARM: dts: rockchip: rv1126: Split up rgmii1 pinctrl ARM: dts: rockchip: rv1126: Add ethernet alias ARM: dts: rockchip: Add rv1109 SoC ARM: dts: Add Sonoff iHost Smart Home Hub dt-bindings: arm: rockchip: Add Sonoff iHost .../devicetree/bindings/arm/rockchip.yaml | 7 + arch/arm/boot/dts/rockchip/Makefile | 2 + .../boot/dts/rockchip/rv1109-sonoff-ihost.dts | 13 + arch/arm/boot/dts/rockchip/rv1109.dtsi | 23 + .../dts/rockchip/rv1126-edgeble-neu2-io.dts | 2 +- .../arm/boot/dts/rockchip/rv1126-pinctrl.dtsi | 72 +++- .../boot/dts/rockchip/rv1126-sonoff-ihost.dts | 13 + .../dts/rockchip/rv1126-sonoff-ihost.dtsi | 407 ++++++++++++++++++ arch/arm/boot/dts/rockchip/rv1126.dtsi | 21 + drivers/i2c/busses/i2c-rk3x.c | 7 +- 10 files changed, 551 insertions(+), 16 deletions(-) create mode 100644 arch/arm/boot/dts/rockchip/rv1109-sonoff-ihost.dts create mode 100644 arch/arm/boot/dts/rockchip/rv1109.dtsi create mode 100644 arch/arm/boot/dts/rockchip/rv1126-sonoff-ihost.dts create mode 100644 arch/arm/boot/dts/rockchip/rv1126-sonoff-ihost.dtsi -- 2.40.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 2023-11-22 12:22 [PATCH v2 0/9] Add support for Sonoff iHost RV1126 Smart Home Gateway Tim Lunn @ 2023-11-22 12:22 ` Tim Lunn 2023-11-26 19:43 ` Andi Shyti 0 siblings, 1 reply; 6+ messages in thread From: Tim Lunn @ 2023-11-22 12:22 UTC (permalink / raw) To: linux-rockchip, devicetree Cc: Tim Lunn, Jagan Teki, Rob Herring, linux-arm-kernel, Heiko Stuebner, Krzysztof Kozlowski, Conor Dooley, Andi Shyti, linux-i2c Rockchip RV1126 has special case mask bits for i2c2. i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone is not sufficient to enable i2c2. This patch fixes the i2c2 bus. Signed-off-by: Tim Lunn <tim@feathertop.org> --- Changes in v2: - i2c: clarify commit message drivers/i2c/busses/i2c-rk3x.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c index a044ca0c35a1..151927466d1d 100644 --- a/drivers/i2c/busses/i2c-rk3x.c +++ b/drivers/i2c/busses/i2c-rk3x.c @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev) return -EINVAL; } - /* 27+i: write mask, 11+i: value */ - value = BIT(27 + bus_nr) | BIT(11 + bus_nr); + if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) + value = BIT(20) | BIT(4); + else + /* 27+i: write mask, 11+i: value */ + value = BIT(27 + bus_nr) | BIT(11 + bus_nr); ret = regmap_write(grf, i2c->soc_data->grf_offset, value); if (ret != 0) { -- 2.40.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 2023-11-22 12:22 ` [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 Tim Lunn @ 2023-11-26 19:43 ` Andi Shyti 2023-11-27 0:26 ` Heiko Stübner 0 siblings, 1 reply; 6+ messages in thread From: Andi Shyti @ 2023-11-26 19:43 UTC (permalink / raw) To: Tim Lunn Cc: linux-rockchip, devicetree, Jagan Teki, Rob Herring, linux-arm-kernel, Heiko Stuebner, Krzysztof Kozlowski, Conor Dooley, linux-i2c Hi Tim, On Wed, Nov 22, 2023 at 11:22:26PM +1100, Tim Lunn wrote: > Rockchip RV1126 has special case mask bits for i2c2. > > i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone > is not sufficient to enable i2c2. This patch fixes the i2c2 bus. If I don't have sufficient information about the hardware this description is completely meaningless to me. > Signed-off-by: Tim Lunn <tim@feathertop.org> > --- > > Changes in v2: > - i2c: clarify commit message > > drivers/i2c/busses/i2c-rk3x.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c > index a044ca0c35a1..151927466d1d 100644 > --- a/drivers/i2c/busses/i2c-rk3x.c > +++ b/drivers/i2c/busses/i2c-rk3x.c > @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev) > return -EINVAL; > } > > - /* 27+i: write mask, 11+i: value */ > - value = BIT(27 + bus_nr) | BIT(11 + bus_nr); > + if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) > + value = BIT(20) | BIT(4); Any chance to put a comment here as it is in the other assignment? Are the two assignment mutually exclusive? Heiko, any chance to take a look here? Thanks, Andi > + else > + /* 27+i: write mask, 11+i: value */ > + value = BIT(27 + bus_nr) | BIT(11 + bus_nr); > > ret = regmap_write(grf, i2c->soc_data->grf_offset, value); > if (ret != 0) { > -- > 2.40.1 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 2023-11-26 19:43 ` Andi Shyti @ 2023-11-27 0:26 ` Heiko Stübner 2023-11-27 10:11 ` Tim Lunn 0 siblings, 1 reply; 6+ messages in thread From: Heiko Stübner @ 2023-11-27 0:26 UTC (permalink / raw) To: Tim Lunn, Andi Shyti Cc: linux-rockchip, devicetree, Jagan Teki, Rob Herring, linux-arm-kernel, Krzysztof Kozlowski, Conor Dooley, linux-i2c Hi Andi, Am Sonntag, 26. November 2023, 20:43:11 CET schrieb Andi Shyti: > Hi Tim, > > On Wed, Nov 22, 2023 at 11:22:26PM +1100, Tim Lunn wrote: > > Rockchip RV1126 has special case mask bits for i2c2. > > > > i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone > > is not sufficient to enable i2c2. This patch fixes the i2c2 bus. > > If I don't have sufficient information about the hardware this > description is completely meaningless to me. > > > Signed-off-by: Tim Lunn <tim@feathertop.org> > > --- > > > > Changes in v2: > > - i2c: clarify commit message > > > > drivers/i2c/busses/i2c-rk3x.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c > > index a044ca0c35a1..151927466d1d 100644 > > --- a/drivers/i2c/busses/i2c-rk3x.c > > +++ b/drivers/i2c/busses/i2c-rk3x.c > > @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev) > > return -EINVAL; > > } > > > > - /* 27+i: write mask, 11+i: value */ > > - value = BIT(27 + bus_nr) | BIT(11 + bus_nr); > > + if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) > > + value = BIT(20) | BIT(4); > > Any chance to put a comment here as it is in the other > assignment? > > Are the two assignment mutually exclusive? > > Heiko, any chance to take a look here? So the background is, that on some SoCs Rockchip implemented to different variants for the i2c controller. One new-style controller that they started using in rk3066 and are using even today. For these old socs they kept the "old" controller block as a sort of fallback if the new thing didn't work out, and the bit above is switching between the Hence that is limited to rk3066, rk3188 and seemingly the rv1126. And while the bits controlling the i2c controllers on the original socs are order sequentially in the grf register, the rv1126 seems to have those bits in non-consequtive places. So TL;DR the change itself is likely good, and hopefully there won't be any more of those, as all the new socs don't need this anymore. I do agree with the request for a comment describing the issue in the code, but otherwise Acked-by: Heiko Stuebner <heiko@sntech.de> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 2023-11-27 0:26 ` Heiko Stübner @ 2023-11-27 10:11 ` Tim Lunn 2023-11-27 21:57 ` Andi Shyti 0 siblings, 1 reply; 6+ messages in thread From: Tim Lunn @ 2023-11-27 10:11 UTC (permalink / raw) To: Heiko Stübner, Andi Shyti Cc: linux-rockchip, devicetree, Jagan Teki, Rob Herring, linux-arm-kernel, Krzysztof Kozlowski, Conor Dooley, linux-i2c On 11/27/23 11:26, Heiko Stübner wrote: > Hi Andi, > > Am Sonntag, 26. November 2023, 20:43:11 CET schrieb Andi Shyti: >> Hi Tim, >> >> On Wed, Nov 22, 2023 at 11:22:26PM +1100, Tim Lunn wrote: >>> Rockchip RV1126 has special case mask bits for i2c2. >>> >>> i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone >>> is not sufficient to enable i2c2. This patch fixes the i2c2 bus. >> If I don't have sufficient information about the hardware this >> description is completely meaningless to me. >> >>> Signed-off-by: Tim Lunn <tim@feathertop.org> >>> --- >>> >>> Changes in v2: >>> - i2c: clarify commit message >>> >>> drivers/i2c/busses/i2c-rk3x.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c >>> index a044ca0c35a1..151927466d1d 100644 >>> --- a/drivers/i2c/busses/i2c-rk3x.c >>> +++ b/drivers/i2c/busses/i2c-rk3x.c >>> @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev) >>> return -EINVAL; >>> } >>> >>> - /* 27+i: write mask, 11+i: value */ >>> - value = BIT(27 + bus_nr) | BIT(11 + bus_nr); >>> + if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) >>> + value = BIT(20) | BIT(4); >> Any chance to put a comment here as it is in the other >> assignment? >> >> Are the two assignment mutually exclusive? Yes they are mutually exclusive, and its only i2c2 that is non-sequential (as per Heikos description below). >> >> Heiko, any chance to take a look here? > So the background is, that on some SoCs Rockchip implemented to > different variants for the i2c controller. One new-style controller > that they started using in rk3066 and are using even today. > > For these old socs they kept the "old" controller block as a sort > of fallback if the new thing didn't work out, and the bit above is > switching between the > > Hence that is limited to rk3066, rk3188 and seemingly the rv1126. > And while the bits controlling the i2c controllers on the original socs > are order sequentially in the grf register, the rv1126 seems to have > those bits in non-consequtive places. > > > So TL;DR the change itself is likely good, and hopefully there won't > be any more of those, as all the new socs don't need this anymore. rv1108 is also similar but different bits again (only going off the BSP sources). I dont have hardware or the TRM to validate this on rv1108. > > I do agree with the request for a comment describing the issue > in the code, but otherwise I will fix this. > Acked-by: Heiko Stuebner <heiko@sntech.de> > > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 2023-11-27 10:11 ` Tim Lunn @ 2023-11-27 21:57 ` Andi Shyti 0 siblings, 0 replies; 6+ messages in thread From: Andi Shyti @ 2023-11-27 21:57 UTC (permalink / raw) To: Tim Lunn Cc: Heiko Stübner, linux-rockchip, devicetree, Jagan Teki, Rob Herring, linux-arm-kernel, Krzysztof Kozlowski, Conor Dooley, linux-i2c Hi Heiko and Tim, On Mon, Nov 27, 2023 at 09:11:57PM +1100, Tim Lunn wrote: > On 11/27/23 11:26, Heiko Stübner wrote: > > Am Sonntag, 26. November 2023, 20:43:11 CET schrieb Andi Shyti: > > > On Wed, Nov 22, 2023 at 11:22:26PM +1100, Tim Lunn wrote: > > > > Rockchip RV1126 has special case mask bits for i2c2. > > > > > > > > i2c2 wasnt previously enabled in rv1126.dtsi, adding DT node alone > > > > is not sufficient to enable i2c2. This patch fixes the i2c2 bus. > > > If I don't have sufficient information about the hardware this > > > description is completely meaningless to me. > > > > > > > Signed-off-by: Tim Lunn <tim@feathertop.org> > > > > --- > > > > > > > > Changes in v2: > > > > - i2c: clarify commit message > > > > > > > > drivers/i2c/busses/i2c-rk3x.c | 7 +++++-- > > > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > > > > > diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c > > > > index a044ca0c35a1..151927466d1d 100644 > > > > --- a/drivers/i2c/busses/i2c-rk3x.c > > > > +++ b/drivers/i2c/busses/i2c-rk3x.c > > > > @@ -1288,8 +1288,11 @@ static int rk3x_i2c_probe(struct platform_device *pdev) > > > > return -EINVAL; > > > > } > > > > - /* 27+i: write mask, 11+i: value */ > > > > - value = BIT(27 + bus_nr) | BIT(11 + bus_nr); > > > > + if (i2c->soc_data == &rv1126_soc_data && bus_nr == 2) > > > > + value = BIT(20) | BIT(4); > > > Any chance to put a comment here as it is in the other > > > assignment? > > > > > > Are the two assignment mutually exclusive? > Yes they are mutually exclusive, and its only i2c2 that is non-sequential > (as per Heikos description below). > > > > > > Heiko, any chance to take a look here? > > So the background is, that on some SoCs Rockchip implemented to > > different variants for the i2c controller. One new-style controller > > that they started using in rk3066 and are using even today. > > > > For these old socs they kept the "old" controller block as a sort > > of fallback if the new thing didn't work out, and the bit above is > > switching between the > > > > Hence that is limited to rk3066, rk3188 and seemingly the rv1126. > > And while the bits controlling the i2c controllers on the original socs > > are order sequentially in the grf register, the rv1126 seems to have > > those bits in non-consequtive places. > > > > > > So TL;DR the change itself is likely good, and hopefully there won't > > be any more of those, as all the new socs don't need this anymore. > rv1108 is also similar but different bits again (only going off the BSP > sources). > I dont have hardware or the TRM to validate this on rv1108. > > > > I do agree with the request for a comment describing the issue > > in the code, but otherwise > > I will fix this. > > > Acked-by: Heiko Stuebner <heiko@sntech.de> Thanks for your ack and answer. Will wait, then for Tim's v2. Andi ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-11-27 21:57 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-11-22 12:22 [PATCH v2 0/9] Add support for Sonoff iHost RV1126 Smart Home Gateway Tim Lunn 2023-11-22 12:22 ` [PATCH v2 3/9] i2c: rk3x: Adjust offset for i2c2 on rv1126 Tim Lunn 2023-11-26 19:43 ` Andi Shyti 2023-11-27 0:26 ` Heiko Stübner 2023-11-27 10:11 ` Tim Lunn 2023-11-27 21:57 ` Andi Shyti
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox