提交 0585c1d2 编写于 作者: T Tali Perry 提交者: Wolfram Sang

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: NTali Perry <tali.perry1@gmail.com>
Signed-off-by: NTyrone Ting <kfting@nuvoton.com>
Acked-by: NKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: NWolfram Sang <wsa@kernel.org>
上级 4bca93ab
...@@ -2229,11 +2229,12 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev, ...@@ -2229,11 +2229,12 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
static int npcm_i2c_probe_bus(struct platform_device *pdev) static int npcm_i2c_probe_bus(struct platform_device *pdev)
{ {
struct npcm_i2c *bus; struct device_node *np = pdev->dev.of_node;
struct i2c_adapter *adap;
struct clk *i2c_clk;
static struct regmap *gcr_regmap; static struct regmap *gcr_regmap;
static struct regmap *clk_regmap; static struct regmap *clk_regmap;
struct i2c_adapter *adap;
struct npcm_i2c *bus;
struct clk *i2c_clk;
int irq; int irq;
int ret; int ret;
...@@ -2250,7 +2251,10 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev) ...@@ -2250,7 +2251,10 @@ static int npcm_i2c_probe_bus(struct platform_device *pdev)
return PTR_ERR(i2c_clk); return PTR_ERR(i2c_clk);
bus->apb_clk = clk_get_rate(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)) if (IS_ERR(gcr_regmap))
return PTR_ERR(gcr_regmap); return PTR_ERR(gcr_regmap);
regmap_write(gcr_regmap, NPCM_I2CSEGCTL, NPCM_I2CSEGCTL_INIT_VAL); regmap_write(gcr_regmap, NPCM_I2CSEGCTL, NPCM_I2CSEGCTL_INIT_VAL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册