[PATCHv3 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; | ^~~~~~~~~~~~~~~~~~~
Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com --- v1: Drop the PCI ERROR MACRO, v2: added the Neil review tag. --- --- drivers/pci/pcie_dw_rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index bc22af4230..3ac2434b69 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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);

Drop the unused variable warning below.
drivers/pci/pcie_dw_rockchip.c:161:6: warning: unused variable 'val' [-Wunused-variable] 161 | u32 val; | ^~~ Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com --- V1 V2: Added Neil review tags. --- drivers/pci/pcie_dw_rockchip.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 3ac2434b69..4e448c0a3d 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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,

Am Fri, Jun 04, 2021 at 04:56:06AM +0000 schrieb Anand Moon:
Drop the unused variable warning below.
drivers/pci/pcie_dw_rockchip.c:161:6: warning: unused variable 'val' [-Wunused-variable] 161 | u32 val; | ^~~ Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com
V1 V2: Added Neil review tags.
drivers/pci/pcie_dw_rockchip.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 3ac2434b69..4e448c0a3d 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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,
-- 2.31.1
Reviewed-by: Patrick Wildt patrick@blueri.se

On 2021/6/4 下午12:56, Anand Moon wrote:
Drop the unused variable warning below.
drivers/pci/pcie_dw_rockchip.c:161:6: warning: unused variable 'val' [-Wunused-variable] 161 | u32 val; | ^~~ Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
V1 V2: Added Neil review tags.
drivers/pci/pcie_dw_rockchip.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 3ac2434b69..4e448c0a3d 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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,

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 patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Signed-off-by: Anand Moon linux.amoon@gmail.com --- V2: drop the msleep macro. --- drivers/pci/pcie_dw_rockchip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 4e448c0a3d..039266a357 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -62,6 +62,7 @@ struct rk_pcie {
/* 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 +250,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(PERST_WAIT_MS); dm_gpio_set_value(&priv->rst_gpio, 1); }
@@ -271,12 +272,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(PERST_WAIT_MS * MACRO_US); }
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(PERST_WAIT_MS * MACRO_US); return -EIO; }
@@ -296,7 +297,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) } }
- msleep(1000); + udelay(PERST_WAIT_MS * MACRO_US);
ret = generic_phy_init(&priv->phy); if (ret) {

Am Fri, Jun 04, 2021 at 04:56:07AM +0000 schrieb 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 patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Signed-off-by: Anand Moon linux.amoon@gmail.com
V2: drop the msleep macro.
drivers/pci/pcie_dw_rockchip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 4e448c0a3d..039266a357 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -62,6 +62,7 @@ struct rk_pcie {
/* 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 +250,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(PERST_WAIT_MS);
You're missing the * MACRO_US here. I'm not sure though that really needs a macro for MS to US, or did someone request that?
dm_gpio_set_value(&priv->rst_gpio, 1);
}
@@ -271,12 +272,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(PERST_WAIT_MS * MACRO_US);
}
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(PERST_WAIT_MS * MACRO_US); return -EIO;
}
@@ -296,7 +297,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) } }
- msleep(1000);
udelay(PERST_WAIT_MS * MACRO_US);
ret = generic_phy_init(&priv->phy); if (ret) {
-- 2.31.1

Hi Patrick.
On Fri, 4 Jun 2021 at 21:14, Patrick Wildt patrick@blueri.se wrote:
Am Fri, Jun 04, 2021 at 04:56:07AM +0000 schrieb 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 patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Signed-off-by: Anand Moon linux.amoon@gmail.com
V2: drop the msleep macro.
drivers/pci/pcie_dw_rockchip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 4e448c0a3d..039266a357 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -62,6 +62,7 @@ struct rk_pcie {
/* 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 +250,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(PERST_WAIT_MS);
You're missing the * MACRO_US here. I'm not sure though that really
Thanks, I forgot to update, it got skipped.
needs a macro for MS to US, or did someone request that?
Neil suggested something in my review commend.
Please replace msleep occurences by udelay with either: - udelay(MACRO_MS * 1000) - udelay(MACRO_US) and replace MACRO_MS with MACRO_US with values *1000
Opps I miss read the request.
Thanks -Anand

On 2021/6/4 下午12:56, Anand Moon wrote:
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 patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Signed-off-by: Anand Moon linux.amoon@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
V2: drop the msleep macro.
drivers/pci/pcie_dw_rockchip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index 4e448c0a3d..039266a357 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -62,6 +62,7 @@ struct rk_pcie {
/* 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 +250,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);
dm_gpio_set_value(&priv->rst_gpio, 1); }udelay(PERST_WAIT_MS);
@@ -271,12 +272,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(PERST_WAIT_MS * MACRO_US);
}
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(PERST_WAIT_MS * MACRO_US); return -EIO; }
@@ -296,7 +297,7 @@ static int rockchip_pcie_init_port(struct udevice *dev) } }
- msleep(1000);
udelay(PERST_WAIT_MS * MACRO_US);
ret = generic_phy_init(&priv->phy); if (ret) {

Am Fri, Jun 04, 2021 at 04:56:05AM +0000 schrieb 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; | ^~~~~~~~~~~~~~~~~~~
Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com
v1: Drop the PCI ERROR MACRO, v2: added the Neil review tag.
drivers/pci/pcie_dw_rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index bc22af4230..3ac2434b69 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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);
-- 2.31.1
Reviewed-by: Patrick Wildt patrick@blueri.se

On 2021/6/4 下午12:56, Anand Moon wrote:
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; | ^~~~~~~~~~~~~~~~~~~
Cc: Patrick Wildt patrick@blueri.se Cc: Neil Armstrong narmstrong@baylibre.com Cc: Kever Yang kever.yang@rock-chips.com Reviewed-by: Neil Armstrong narmstrong@baylibre.com Signed-off-by: Anand Moon linux.amoon@gmail.com
Reviewed-by: Kever Yang kever.yang@rock-chips.com
Thanks, - Kever
v1: Drop the PCI ERROR MACRO, v2: added the Neil review tag.
drivers/pci/pcie_dw_rockchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c index bc22af4230..3ac2434b69 100644 --- a/drivers/pci/pcie_dw_rockchip.c +++ b/drivers/pci/pcie_dw_rockchip.c @@ -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);
participants (3)
-
Anand Moon
-
Kever Yang
-
Patrick Wildt