2022-03-03 09:32:53

by Tyrone Ting

[permalink] [raw]
Subject: [PATCH v3 04/11] i2c: npcm: Change the way of getting GCR regmap

From: Tali Perry <[email protected]>

Change the way of getting NPCM system manager reigster (GCR)
and still maintain the old mechanism as a fallback if getting
nuvoton,sys-mgr fails while working with the legacy devicetree
file.

Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
Signed-off-by: Tali Perry <[email protected]>
Signed-off-by: Tyrone Ting <[email protected]>
---
drivers/i2c/busses/i2c-npcm7xx.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 4c225e1a058f..fa12212b2428 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2236,6 +2236,7 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
static struct regmap *clk_regmap;
int irq;
int ret;
+ struct device_node *np = pdev->dev.of_node;

bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL);
if (!bus)
@@ -2250,7 +2251,10 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
return PTR_ERR(i2c_clk);
bus->apb_clk = clk_get_rate(i2c_clk);

- gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
+ gcr_regmap = syscon_regmap_lookup_by_phandle(np, "nuvoton,sys-mgr");
+ if (IS_ERR(gcr_regmap))
+ gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
+
if (IS_ERR(gcr_regmap))
return PTR_ERR(gcr_regmap);
regmap_write(gcr_regmap, NPCM_I2CSEGCTL, NPCM_I2CSEGCTL_INIT_VAL);
--
2.17.1


2022-03-03 10:59:18

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v3 04/11] i2c: npcm: Change the way of getting GCR regmap

On 03/03/2022 09:31, Tyrone Ting wrote:
> From: Tali Perry <[email protected]>
>
> Change the way of getting NPCM system manager reigster (GCR)
> and still maintain the old mechanism as a fallback if getting
> nuvoton,sys-mgr fails while working with the legacy devicetree
> file.
>
> Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
> Signed-off-by: Tali Perry <[email protected]>
> Signed-off-by: Tyrone Ting <[email protected]>
> ---
> drivers/i2c/busses/i2c-npcm7xx.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>


Acked-by: Krzysztof Kozlowski <[email protected]>


Best regards,
Krzysztof

2022-03-04 19:59:42

by Tyrone Ting

[permalink] [raw]
Subject: Re: [PATCH v3 04/11] i2c: npcm: Change the way of getting GCR regmap

Hi Krzysztof:

Thank you for your review.

Krzysztof Kozlowski <[email protected]> 於 2022年3月3日 週四 下午6:38寫道:
>
> On 03/03/2022 09:31, Tyrone Ting wrote:
> > From: Tali Perry <[email protected]>
> >
> > Change the way of getting NPCM system manager reigster (GCR)
> > and still maintain the old mechanism as a fallback if getting
> > nuvoton,sys-mgr fails while working with the legacy devicetree
> > file.
> >
> > Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
> > Signed-off-by: Tali Perry <[email protected]>
> > Signed-off-by: Tyrone Ting <[email protected]>
> > ---
> > drivers/i2c/busses/i2c-npcm7xx.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
>
>
> Acked-by: Krzysztof Kozlowski <[email protected]>
>
>
> Best regards,
> Krzysztof

Best regards,
Tyrone