Skip to contentSkip to conversation

pci: pcie_dw_rockchip: Fixed the below compilation error

PATCH In review Anand Moon 2 participants 6 messages Jun 5, 2021 – Jun 18, 2021

Subsystems (2)
lore
Share & tools
lore

Anand Moon

author
#0 lore raw

PATCH v4 1/3 pci: pcie_dw_rockchip: Fixed the below compilation error

Use the generic error number instead of specific error number. Changes fix the below error.

drivers/pci/pcie_dw_rockchip.c: In function 'rk_pcie_read':
drivers/pci/pcie_dw_rockchip.c:70:10: error: 'PCIBIOS_UNSUPPORTED'
undeclared (first use in this function)

   70 |   return PCIBIOS_UNSUPPORTED;
      |          ^~~~~~~~~~~~~~~~~~~
drivers/pci/pcie_dw_rockchip.c: In function 'rk_pcie_write':
drivers/pci/pcie_dw_rockchip.c:90:10: error: 'PCIBIOS_UNSUPPORTED'
                        undeclared (first use in this function)
   90 |   return PCIBIOS_UNSUPPORTED;
      |          ^~~~~~~~~~~~~~~~~~~
---
 drivers/pci/pcie_dw_rockchip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pcie_dw_rockchip.c +2 -2
index bc22af4230..3ac2434b69 100644
@@ -67,7 +67,7 @@ static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
 {
 	if ((uintptr_t)addr & (size - 1)) {
 		*val = 0;
-		return PCIBIOS_UNSUPPORTED;
+		return -EOPNOTSUPP;
 	}
 
 	if (size == 4) {
@@ -87,7 +87,7 @@ static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
 static int rk_pcie_write(void __iomem *addr, int size, u32 val)
 {
 	if ((uintptr_t)addr & (size - 1))
-		return PCIBIOS_UNSUPPORTED;
+		return -EOPNOTSUPP;
 
 	if (size == 4)
 		writel(val, addr);
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH v4 2/3 pci: pcie_dw_rockchip: Drop the unused variable warning

Drop the unused variable warning below.

drivers/pci/pcie_dw_rockchip.c:161:6: warning: unused variable 'val' [-Wunused-variable]

  161 |  u32 val;
       |      ^~~
---
 drivers/pci/pcie_dw_rockchip.c | 2 --
 1 file changed, 2 deletions(-)
drivers/pci/pcie_dw_rockchip.c +0 -2
index 3ac2434b69..4e448c0a3d 100644
@@ -158,8 +158,6 @@ static inline void rk_pcie_writel_apb(struct rk_pcie *rk_pcie, u32 reg,
  */
 static void rk_pcie_configure(struct rk_pcie *pci, u32 cap_speed)
 {
-	u32 val;
-
 	dw_pcie_dbi_write_enable(&pci->dw, true);
 
 	clrsetbits_le32(pci->dw.dbi_base + PCIE_LINK_CAPABILITY,
Signature · 1 line
2.31.1
author
#3 lore raw

PATCH v4 3/3 pci: pcie_dw_rockchip: Replace msleep occurences by udelay

In reply to Anand Moon

Replace msleep occurences by udelay.

drivers/pci/pcie_dw_rockchip.c:254:3: warning: implicit
declaration of function 'msleep' [-Wimplicit-function-declaration]

Cc Patrick Wildt <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kever Yang <[email protected]>

---
Keep is simple...sorry !!!

---
 drivers/pci/pcie_dw_rockchip.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pcie_dw_rockchip.c +5 -5
index 4e448c0a3d..9322e735b9 100644
@@ -61,7 +61,7 @@ struct rk_pcie {
 #define PCIE_CLIENT_DBF_EN		0xffff0003
 
 /* Parameters for the waiting for #perst signal */
-#define PERST_WAIT_MS			1000
+#define MACRO_US			1000
 
 static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
 {
@@ -249,7 +249,7 @@ static int rk_pcie_link_up(struct rk_pcie *priv, u32 cap_speed)
 		 * some wired devices need much more, such as 600ms.
 		 * Add a enough delay to cover all cases.
 		 */
-		msleep(PERST_WAIT_MS);
+		udelay(MACRO_US * 1000);
 		dm_gpio_set_value(&priv->rst_gpio, 1);
 	}
 
@@ -271,12 +271,12 @@ static int rk_pcie_link_up(struct rk_pcie *priv, u32 cap_speed)
 		dev_info(priv->dw.dev, "PCIe Linking... LTSSM is 0x%x\n",
 			 rk_pcie_readl_apb(priv, PCIE_CLIENT_LTSSM_STATUS));
 		rk_pcie_debug_dump(priv);
-		msleep(1000);
+		udelay(MACRO_US * 1000);
 	}
 
 	dev_err(priv->dw.dev, "PCIe-%d Link Fail\n", dev_seq(priv->dw.dev));
 	/* Link maybe in Gen switch recovery but we need to wait more 1s */
-	msleep(1000);
+	udelay(MACRO_US * 1000);
 	return -EIO;
 }
 
@@ -296,7 +296,7 @@ static int rockchip_pcie_init_port(struct udevice *dev)
 		}
 	}
 
-	msleep(1000);
+	udelay(MACRO_US * 1000);
 
 	ret = generic_phy_init(&priv->phy);
 	if (ret) {
Signature · 1 line
2.31.1
Reviewed-by on v4 1/3
#5 lore raw
In reply to Anand Moon
Quoted 14 lines · Anand Moon

Use the generic error number instead of specific error number. Changes fix the below error.

drivers/pci/pcie_dw_rockchip.c: In function 'rk_pcie_read':
drivers/pci/pcie_dw_rockchip.c:70:10: error: 'PCIBIOS_UNSUPPORTED'

                         undeclared (first use in this function)
    70 |   return PCIBIOS_UNSUPPORTED;
       |          ^~~~~~~~~~~~~~~~~~~
drivers/pci/pcie_dw_rockchip.c: In function 'rk_pcie_write':
drivers/pci/pcie_dw_rockchip.c:90:10: error: 'PCIBIOS_UNSUPPORTED'
                         undeclared (first use in this function)
    90 |   return PCIBIOS_UNSUPPORTED;
       |          ^~~~~~~~~~~~~~~~~~~
Quoted 6 lines

Thanks,
- Kever

Quoted 26 lines
---
  drivers/pci/pcie_dw_rockchip.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pcie_dw_rockchip.c +2 -2
index bc22af4230..3ac2434b69 100644
@@ -67,7 +67,7 @@ static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
  {
  	if ((uintptr_t)addr & (size - 1)) {
  		*val = 0;
-		return PCIBIOS_UNSUPPORTED;
+		return -EOPNOTSUPP;
  	}
 
  	if (size == 4) {
@@ -87,7 +87,7 @@ static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
  static int rk_pcie_write(void __iomem *addr, int size, u32 val)
  {
  	if ((uintptr_t)addr & (size - 1))
-		return PCIBIOS_UNSUPPORTED;
+		return -EOPNOTSUPP;
 
  	if (size == 4)
  		writel(val, addr);
Reviewed-by on v4 2/3
#2 lore raw

Re: [PATCHv4 2/3] pci: pcie_dw_rockchip: Drop the unused variable warning

In reply to Anand Moon
Quoted 4 lines · Anand Moon

Drop the unused variable warning below.

drivers/pci/pcie_dw_rockchip.c:161:6: warning: unused variable 'val' [-Wunused-variable]

Quoted 8 lines
   161 |  u32 val;
        |      ^~~

Thanks,
- Kever

Quoted 17 lines
---
  drivers/pci/pcie_dw_rockchip.c | 2 --
  1 file changed, 2 deletions(-)
drivers/pci/pcie_dw_rockchip.c +0 -2
index 3ac2434b69..4e448c0a3d 100644
@@ -158,8 +158,6 @@ static inline void rk_pcie_writel_apb(struct rk_pcie *rk_pcie, u32 reg,
   */
  static void rk_pcie_configure(struct rk_pcie *pci, u32 cap_speed)
  {
-	u32 val;
-
  	dw_pcie_dbi_write_enable(&pci->dw, true);
 
  	clrsetbits_le32(pci->dw.dbi_base + PCIE_LINK_CAPABILITY,
Reviewed-by on v4 3/3
#4 lore raw

Re: [PATCHv4 3/3] pci: pcie_dw_rockchip: Replace msleep occurences by udelay

In reply to Anand Moon
Quoted 9 lines · Anand Moon

Replace msleep occurences by udelay.

drivers/pci/pcie_dw_rockchip.c:254:3: warning: implicit
declaration of function 'msleep' [-Wimplicit-function-declaration]

Cc Patrick Wildt <[email protected]>
Cc Neil Armstrong <[email protected]>
Cc Kever Yang <[email protected]>

Thanks,
- Kever

Quoted 52 lines

---
Keep is simple...sorry !!!

---
  drivers/pci/pcie_dw_rockchip.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pcie_dw_rockchip.c +5 -5
index 4e448c0a3d..9322e735b9 100644
@@ -61,7 +61,7 @@ struct rk_pcie {
  #define PCIE_CLIENT_DBF_EN		0xffff0003
 
  /* Parameters for the waiting for #perst signal */
-#define PERST_WAIT_MS			1000
+#define MACRO_US			1000
 
  static int rk_pcie_read(void __iomem *addr, int size, u32 *val)
  {
@@ -249,7 +249,7 @@ static int rk_pcie_link_up(struct rk_pcie *priv, u32 cap_speed)
  		 * some wired devices need much more, such as 600ms.
  		 * Add a enough delay to cover all cases.
  		 */
-		msleep(PERST_WAIT_MS);
+		udelay(MACRO_US * 1000);
  		dm_gpio_set_value(&priv->rst_gpio, 1);
  	}
 
@@ -271,12 +271,12 @@ static int rk_pcie_link_up(struct rk_pcie *priv, u32 cap_speed)
  		dev_info(priv->dw.dev, "PCIe Linking... LTSSM is 0x%x\n",
  			 rk_pcie_readl_apb(priv, PCIE_CLIENT_LTSSM_STATUS));
  		rk_pcie_debug_dump(priv);
-		msleep(1000);
+		udelay(MACRO_US * 1000);
  	}
 
  	dev_err(priv->dw.dev, "PCIe-%d Link Fail\n", dev_seq(priv->dw.dev));
  	/* Link maybe in Gen switch recovery but we need to wait more 1s */
-	msleep(1000);
+	udelay(MACRO_US * 1000);
  	return -EIO;
  }
 
@@ -296,7 +296,7 @@ static int rockchip_pcie_init_port(struct udevice *dev)
  		}
  	}
 
-	msleep(1000);
+	udelay(MACRO_US * 1000);
 
  	ret = generic_phy_init(&priv->phy);
  	if (ret) {