Skip to content

Commit 0585c1d

Browse files
TaliPerrywsakernel
authored andcommitted
i2c: npcm: Change the way of getting GCR regmap
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. Signed-off-by: Tali Perry <[email protected]> Signed-off-by: Tyrone Ting <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 4bca93a commit 0585c1d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/i2c/busses/i2c-npcm7xx.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,11 +2229,12 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
22292229

22302230
static int npcm_i2c_probe_bus(struct platform_device *pdev)
22312231
{
2232-
struct npcm_i2c *bus;
2233-
struct i2c_adapter *adap;
2234-
struct clk *i2c_clk;
2232+
struct device_node *np = pdev->dev.of_node;
22352233
static struct regmap *gcr_regmap;
22362234
static struct regmap *clk_regmap;
2235+
struct i2c_adapter *adap;
2236+
struct npcm_i2c *bus;
2237+
struct clk *i2c_clk;
22372238
int irq;
22382239
int ret;
22392240

@@ -2250,7 +2251,10 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
22502251
return PTR_ERR(i2c_clk);
22512252
bus->apb_clk = clk_get_rate(i2c_clk);
22522253

2253-
gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
2254+
gcr_regmap = syscon_regmap_lookup_by_phandle(np, "nuvoton,sys-mgr");
2255+
if (IS_ERR(gcr_regmap))
2256+
gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
2257+
22542258
if (IS_ERR(gcr_regmap))
22552259
return PTR_ERR(gcr_regmap);
22562260
regmap_write(gcr_regmap, NPCM_I2CSEGCTL, NPCM_I2CSEGCTL_INIT_VAL);

0 commit comments

Comments
 (0)