From 85aa3d4cd47b4766ad8685c7d5308e2ba9e66f7f Mon Sep 17 00:00:00 2001 From: ryan_chen Date: Wed, 25 May 2022 16:56:13 +0800 Subject: [PATCH] pciecfg:aspeed refine and remove no used. Signed-off-by: ryan_chen Change-Id: I3b1783bcebc6da40ee0102390ca4901b37b2ffa2 --- drivers/pci/controller/aspeed_pciecfg.c | 32 +++++++++---------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/drivers/pci/controller/aspeed_pciecfg.c b/drivers/pci/controller/aspeed_pciecfg.c index b886fdf413f4..512d9648082f 100644 --- a/drivers/pci/controller/aspeed_pciecfg.c +++ b/drivers/pci/controller/aspeed_pciecfg.c @@ -14,12 +14,11 @@ #include struct aspeed_pciecfg { - struct device *dev; void __iomem *reg; + struct regmap *ahbc; struct reset_control *rst; struct reset_control *rc_low_rst; struct reset_control *rc_high_rst; - struct regmap *ahbc; }; static const struct of_device_id aspeed_pciecfg_of_match[] = { @@ -30,14 +29,13 @@ static const struct of_device_id aspeed_pciecfg_of_match[] = { #define AHBC_UNLOCK 0xAEED1A03 static void aspeed_pciecfg_init(struct aspeed_pciecfg *pciecfg) { - //h2x reset init reset_control_assert(pciecfg->rst); - //rcL assert + if (pciecfg->rc_low_rst) { reset_control_deassert(pciecfg->rc_low_rst); reset_control_assert(pciecfg->rc_low_rst); } - //rch assert + if (pciecfg->rc_high_rst) { reset_control_deassert(pciecfg->rc_high_rst); reset_control_assert(pciecfg->rc_high_rst); @@ -45,19 +43,17 @@ static void aspeed_pciecfg_init(struct aspeed_pciecfg *pciecfg) reset_control_deassert(pciecfg->rst); - //init - writel(0x1, pciecfg->reg + 0x00); + regmap_write(pciecfg->ahbc, 0x00, AHBC_UNLOCK); + regmap_update_bits(pciecfg->ahbc, 0x8C, BIT(5), BIT(5)); + regmap_write(pciecfg->ahbc, 0x00, 0x1); + + writel(BIT(0), pciecfg->reg + 0x00); //ahb to pcie rc writel(0xe0006000, pciecfg->reg + 0x60); writel(0x00000000, pciecfg->reg + 0x64); writel(0xFFFFFFFF, pciecfg->reg + 0x68); - //ahbc remap enable - regmap_write(pciecfg->ahbc, 0x00, AHBC_UNLOCK); - regmap_update_bits(pciecfg->ahbc, 0x8C, BIT(5), BIT(5)); - regmap_write(pciecfg->ahbc, 0x00, 0x1); - } static int aspeed_pciecfg_probe(struct platform_device *pdev) @@ -69,7 +65,6 @@ static int aspeed_pciecfg_probe(struct platform_device *pdev) if (!pciecfg) return -ENOMEM; - pciecfg->dev = &pdev->dev; pciecfg->reg = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pciecfg->reg)) return PTR_ERR(pciecfg->reg); @@ -83,7 +78,7 @@ static int aspeed_pciecfg_probe(struct platform_device *pdev) if (of_device_is_available(of_parse_phandle(dev->of_node, "aspeed,pcie0", 0))) { pciecfg->rc_low_rst = devm_reset_control_get_shared(&pdev->dev, "rc_low"); if (IS_ERR(pciecfg->rc_low_rst)) { - dev_err(&pdev->dev, "can't get RC low reset\n"); + dev_info(&pdev->dev, "No RC low reset\n"); pciecfg->rc_low_rst = NULL; } } else @@ -93,7 +88,7 @@ static int aspeed_pciecfg_probe(struct platform_device *pdev) if (of_device_is_available(of_parse_phandle(dev->of_node, "aspeed,pcie1", 0))) { pciecfg->rc_high_rst = devm_reset_control_get_shared(&pdev->dev, "rc_high"); if (IS_ERR(pciecfg->rc_high_rst)) { - dev_err(&pdev->dev, "can't get RC high reset\n"); + dev_info(&pdev->dev, "No RC high reset\n"); pciecfg->rc_high_rst = NULL; } } else @@ -116,9 +111,4 @@ static struct platform_driver aspeed_pciecfg_driver = { }, .probe = aspeed_pciecfg_probe, }; - -static int __init aspeed_pcicfg_init(void) -{ - return platform_driver_register(&aspeed_pciecfg_driver); -} -postcore_initcall(aspeed_pcicfg_init); +builtin_platform_driver(aspeed_pciecfg_driver);