public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Add support for Sonoff iHost RV1126 Smart Home Gateway
@ 2023-11-13 12:06 Tim Lunn
  2023-11-13 12:07 ` [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126 Tim Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Lunn @ 2023-11-13 12:06 UTC (permalink / raw)
  To: linux-rockchip, devicetree
  Cc: Jagan Teki, Krzysztof Kozlowski, Tim Lunn, Rob Herring,
	Heiko Stuebner, linux-arm-kernel, Conor Dooley, Andi Shyti,
	linux-i2c


Sonoff iHost is gateway device designed to provide a Smart Home Hub,
it notably 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 with
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.


Tim Lunn (8):
  ARM: dts: rockchip: rv1126: Add alternate UART pins
  ARM: dts: rockchip: rv1126: Serial aliases
  i2c: rk3x: Adjust grf 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: 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     | 409 ++++++++++++++++++
 arch/arm/boot/dts/rockchip/rv1126.dtsi        |  21 +
 drivers/i2c/busses/i2c-rk3x.c                 |   8 +-
 10 files changed, 554 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] 4+ messages in thread

* [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126
  2023-11-13 12:06 [PATCH 0/8] Add support for Sonoff iHost RV1126 Smart Home Gateway Tim Lunn
@ 2023-11-13 12:07 ` Tim Lunn
  2023-11-16 19:54   ` Heiko Stuebner
  0 siblings, 1 reply; 4+ messages in thread
From: Tim Lunn @ 2023-11-13 12:07 UTC (permalink / raw)
  To: linux-rockchip, devicetree
  Cc: Jagan Teki, Krzysztof Kozlowski, Tim Lunn, Rob Herring,
	Heiko Stuebner, linux-arm-kernel, Conor Dooley, Andi Shyti,
	linux-i2c

Rockchip RV1126 has a special case grf offset/mask for i2c2

Signed-off-by: Tim Lunn <tim@feathertop.org>
---

 drivers/i2c/busses/i2c-rk3x.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index a044ca0c35a1..83b7bf7b48a7 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -1288,8 +1288,12 @@ 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)
+			/* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */
+			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] 4+ messages in thread

* Re: [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126
  2023-11-13 12:07 ` [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126 Tim Lunn
@ 2023-11-16 19:54   ` Heiko Stuebner
  2023-11-18  0:31     ` Tim Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Heiko Stuebner @ 2023-11-16 19:54 UTC (permalink / raw)
  To: linux-rockchip, devicetree, Tim Lunn
  Cc: Jagan Teki, Krzysztof Kozlowski, Tim Lunn, Rob Herring,
	linux-arm-kernel, Conor Dooley, Andi Shyti, linux-i2c

Hi,

Am Montag, 13. November 2023, 13:07:00 CET schrieb Tim Lunn:
> Rockchip RV1126 has a special case grf offset/mask for i2c2

This sounds misleading. When looking at the soc-data, the grf offset
seems to be the same for all busses of the rv1126, only the offset
seems to be different for i2c2.

Sadly I don't have (and didn't find any) rv1126 TRM, so couldn't verify.

Change itself looks nice. As it's only this one bus of one soc so far,
we likely won't need a more involved solution just now.


> Signed-off-by: Tim Lunn <tim@feathertop.org>
> ---
> 
>  drivers/i2c/busses/i2c-rk3x.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index a044ca0c35a1..83b7bf7b48a7 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -1288,8 +1288,12 @@ 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)
> +			/* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */

same here, comment could drop the offset reference I guess.

> +			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) {
> 


Heiko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126
  2023-11-16 19:54   ` Heiko Stuebner
@ 2023-11-18  0:31     ` Tim Lunn
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Lunn @ 2023-11-18  0:31 UTC (permalink / raw)
  To: Heiko Stuebner, linux-rockchip, devicetree
  Cc: Jagan Teki, Krzysztof Kozlowski, Rob Herring, linux-arm-kernel,
	Conor Dooley, Andi Shyti, linux-i2c

Hi Heiko,

On 11/17/23 06:54, Heiko Stuebner wrote:
> Hi,
>
> Am Montag, 13. November 2023, 13:07:00 CET schrieb Tim Lunn:
>> Rockchip RV1126 has a special case grf offset/mask for i2c2
> This sounds misleading. When looking at the soc-data, the grf offset
> seems to be the same for all busses of the rv1126, only the offset
> seems to be different for i2c2.
>
> Sadly I don't have (and didn't find any) rv1126 TRM, so couldn't verify.
>
> Change itself looks nice. As it's only this one bus of one soc so far,
> we likely won't need a more involved solution just now.
>
Thanks for your comments. I agree it sounds a bit misleading, I will clarify
  the commit message and comments in v2 of this series.

Unfortunately I dont have access to the TRM either, however I have validated
  that this fixes i2c2 on actual hardware.

>
>> Signed-off-by: Tim Lunn <tim@feathertop.org>
>> ---
>>
>>   drivers/i2c/busses/i2c-rk3x.c | 8 ++++++--
>>   1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
>> index a044ca0c35a1..83b7bf7b48a7 100644
>> --- a/drivers/i2c/busses/i2c-rk3x.c
>> +++ b/drivers/i2c/busses/i2c-rk3x.c
>> @@ -1288,8 +1288,12 @@ 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)
>> +			/* rv1126 i2c2 set pmugrf offset-0x118, bit-4 */
> same here, comment could drop the offset reference I guess.
>
>> +			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) {
>>
>
> Heiko
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-18  0:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-13 12:06 [PATCH 0/8] Add support for Sonoff iHost RV1126 Smart Home Gateway Tim Lunn
2023-11-13 12:07 ` [PATCH 3/8] i2c: rk3x: Adjust grf offset for i2c2 on rv1126 Tim Lunn
2023-11-16 19:54   ` Heiko Stuebner
2023-11-18  0:31     ` Tim Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox