arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
Subsystems (2)
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.
--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/dts/armada-3720-db.dts +1 -1
@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/dts/armada-3720-espressobin.dts +1 -1
@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/dts/armada-3720-turris-mox.dts +1 -1
@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };
drivers/pci/pci-aardvark.c +3 -3
@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO.
@@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/ if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
Signature · 1 line
2.20.1
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPARE ensures that U-Boot executes driver's remove callback prior booting Linux kernel.
Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/pci/pci-aardvark.c +21 -6
@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)
@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO ) -struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO.
@@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state *
@@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), };
Signature · 1 line
2.20.1
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Pali Rohár________________________________________
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese; Kostya Porotchkin
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 1/2] arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
External Email
----------------------------------------------------------------------
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.
--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/dts/armada-3720-db.dts +1 -1
@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/dts/armada-3720-espressobin.dts +1 -1
@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };
arch/arm/dts/armada-3720-turris-mox.dts +1 -1
@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };
drivers/pci/pci-aardvark.c +3 -3
@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO.
@@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/ if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
--
2.20.1
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali Rohár________________________________________
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese; Kostya Porotchkin
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 2/2] arm64: a37xx: pci: Assert PERST# signal when unloading driver
External Email
----------------------------------------------------------------------
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPARE ensures that U-Boot executes driver's remove callback prior booting Linux kernel.
Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/pci/pci-aardvark.c +21 -6
@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)
@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO ) -struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO.
@@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state *
@@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), };
--
2.20.1
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Pali RohárQuoted 5 lines · Pali Roh?r
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.
Signed-off-by Pali Roh?r <[email protected]>
Thanks,
Stefan
Quoted 59 lines
--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)arch/arm/dts/armada-3720-db.dts +1
-1@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-espressobin.dts +1
-1@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-turris-mox.dts +1
-1@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };drivers/pci/pci-aardvark.c +1
-1@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 641
Quoted 10 lines
drivers/pci/pci-aardvark.c +2
-2if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali RohárQuoted 24 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)drivers/pci/pci-aardvark.c +0
-0
drivers/pci/pci-aardvark.c struct pcie_advk { · line 154
Quoted 7 lines
drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };
Adding more #ifdef's is not recommended. Can't you "depend" this driver on DM_GPIO in Kconfig instead? Are there any used that don't support DM_GPIO right now?
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 619
Quoted 5 lines
drivers/pci/pci-aardvark.c +0
-0static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO )
If you change the driver to rely on DM_GPIO, then please also remove all other #ifdef's with DM_GPIO.
Thanks,
Stefan
Quoted 43 lines
drivers/pci/pci-aardvark.c +16
-6-struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state *
drivers/pci/pci-aardvark.c U_BOOT_DRIVER(pcie_advk) = { · line 706
Quoted 7 lines
drivers/pci/pci-aardvark.c +2
-0@@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), };
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Kostya PorotchkinHi Kosta,
AFAICT, this mail does not contain any info from you. I can only assume, that you wanted to send a Reviewed-by tag. If yes, then please double-check which mails did not work and resend them with the correct tags. As they are automatically collected by patchwork.
Thanks,
Stefan
Quoted 87 lines · Kostya Porotchkin
________________________________________
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese; Kostya Porotchkin
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 1/2] arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DTExternal Email
----------------------------------------------------------------------
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.Signed-off-by Pali Roh?r <[email protected]>Reviewed-by Konstantin Porotchkin <[email protected]>--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)arch/arm/dts/armada-3720-db.dts +1
-1@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-espressobin.dts +1
-1@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-turris-mox.dts +1
-1@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };drivers/pci/pci-aardvark.c +3
-4@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/ if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); --
Quoted 2 lines
2.20.1
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Pali RohárQuoted 10 lines
-----Original Message-----
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese <[email protected]>; Kostya Porotchkin <[email protected]>
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 1/2] arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
Quoted 8 lines
External Email
----------------------------------------------------------------------
Change active-high to active-low and change DT property name from reset- gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.Signed-off-by Pali Roh?r <[email protected]>
Quoted 72 lines
--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada- 3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)arch/arm/dts/armada-3720- renamed from arch/arm/dts/armada-3720-db.dts +0
-0
db.dtsindex1b219c423b..1b1b66b94d100644arch/arm/dts/armada-3720-db.dts +1
-1@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-espressobin.dts +1
-1@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-turris-mox.dts +1
-1@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };drivers/pci/pci-aardvark.c index renamed from drivers/pci/pci-aardvark.c +0
-0
711b930d0f..5b3f23c184100644drivers/pci/pci-aardvark.c +3
-4@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev) #ifCONFIG_IS_ENABLED (DM_GPIO) struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/ if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); --2.20.1
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Stefan RoeseQuoted 20 lines · On Thursday 20 August 2020 07:05:58 Stefan Roese wrote:
Quoted 19 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
Quoted 16 lines
drivers/pci/pci-aardvark.c struct pcie_advk { · line 154
Quoted 12 lines
drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };Adding more #ifdef's is not recommended. Can't you "depend" this driver on
DM_GPIOinKconfiginstead? Are there any used that don't supportDM_GPIOright now?
I'm not sure if this dependency is what people want. CCing Simon.
In past Simon created commit bcee8d6764f9215f16b393a35581000178633254 where described that want to build SPL without GPIO uclass support.
Quoted 69 lines
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 618
Quoted 4 lines
drivers/pci/pci-aardvark.c +0
-0static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO )If you change the driver to rely on
DM_GPIO, then please also remove all other #ifdef's withDM_GPIO.Thanks,
StefanQuoted 42 lines
drivers/pci/pci-aardvark.c +16
-6-struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state * drivers/pci/pci-aardvark.c U_BOOT_DRIVER(pcie_advk) = { · line 706
Quoted 7 lines
drivers/pci/pci-aardvark.c +2
-0@@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), };Viele Gr??e,
StefanSignature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
Quoted 38 lines · Pali Roh?r
Quoted 20 lines · On Thursday 20 August 2020 07:05:58 Stefan Roese wrote:
Quoted 19 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)Quoted 16 lines
drivers/pci/pci-aardvark.c struct pcie_advk { · line 154
Quoted 12 lines
drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };Adding more #ifdef's is not recommended. Can't you "depend" this driver on
DM_GPIOinKconfiginstead? Are there any used that don't supportDM_GPIOright now?
Quoted 4 lines
I'm not sure if this dependency is what people want. CCing Simon.
In past Simon created commit
bcee8d6764f9215f16b393a35581000178633254where described that want to build SPL without GPIO uclass support.
Is this PCI driver ever built into SPL?
Thanks,
Stefan
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
Quoted 39 lines · On Thursday 20 August 2020 09:48:17 Stefan Roese wrote:
Quoted 38 lines · Pali Roh?r
Quoted 36 lines · On Thursday 20 August 2020 07:05:58 Stefan Roese wrote:
Quoted 24 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)drivers/pci/pci-aardvark.c +0
-0drivers/pci/pci-aardvark.c struct pcie_advk { · line 154
Quoted 7 lines
drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };Adding more #ifdef's is not recommended. Can't you "depend" this driver on
DM_GPIOinKconfiginstead? Are there any used that don't supportDM_GPIOright now?
Quoted 6 lines
Quoted 4 lines
I'm not sure if this dependency is what people want. CCing Simon.
In past Simon created commit
bcee8d6764f9215f16b393a35581000178633254where described that want to build SPL without GPIO uclass support.Is this PCI driver ever built into SPL?
SPL is not used for Espressobin and Turris MOX. But I'm not sure for other boards. Maybe Simon could provide more information about it.
Basically I added GPIO handling in aardvark driver as it was used on other place.
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Kostya PorotchkinHi Kosta,
this one as well please. ;)
Thanks,
Stefan
Quoted 100 lines · Kostya Porotchkin
________________________________________
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese; Kostya Porotchkin
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 2/2] arm64: a37xx: pci: Assert PERST# signal when unloading driverExternal Email
----------------------------------------------------------------------
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>Reviewed-by Konstantin Porotchkin <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)drivers/pci/pci-aardvark.c +21
-7@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO ) -struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state * @@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), }; --
Quoted 2 lines
2.20.1
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali RohárQuoted 42 lines · Pali Roh?r
Quoted 41 lines · On Thursday 20 August 2020 09:48:17 Stefan Roese wrote:
Quoted 40 lines · Pali Roh?r
Quoted 20 lines · On Thursday 20 August 2020 07:05:58 Stefan Roese wrote:
Quoted 19 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)Quoted 16 lines
drivers/pci/pci-aardvark.c struct pcie_advk { · line 154
Quoted 12 lines
drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };Adding more #ifdef's is not recommended. Can't you "depend" this driver on
DM_GPIOinKconfiginstead? Are there any used that don't supportDM_GPIOright now?I'm not sure if this dependency is what people want. CCing Simon.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
In past Simon created commit
bcee8d6764f9215f16b393a35581000178633254where described that want to build SPL without GPIO uclass support.Is this PCI driver ever built into SPL?
SPL is not used for Espressobin and Turris MOX. But I'm not sure for other boards. Maybe Simon could provide more information about it.
AFAIK (I did not work on Armada for quite some time), only 32bit Armada uses SPL. All 64bit Aramda 37xx / 7xxx / 8xxx do not use SPL.
Quoted 2 lines
Basically I added GPIO handling in aardvark driver as it was used on other place.
I understand.
I suggest to "depend" this driver on DM_GPIO and include the GPIO code without any #ifdef's. And please run a world-build (buildman, Travis...) to see, if nothing breaks.
Thanks,
Stefan
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali RohárQuoted 23 lines
-----Original Message-----
From: Pali Roh?r <[email protected]>
Sent: Wednesday, August 19, 2020 16:57
To: Stefan Roese <[email protected]>; Kostya Porotchkin <[email protected]>
Cc: u-boot at lists.denx.de
Subject: [EXT] [PATCH 2/2] arm64: a37xx: pci: Assert PERST# signal when unloading driverExternal Email
----------------------------------------------------------------------
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Quoted 5 lines
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>
Quoted 72 lines
--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)drivers/pci/pci-aardvark.c index renamed from drivers/pci/pci-aardvark.c +0
-0
5b3f23c184..8996be5309100644drivers/pci/pci-aardvark.c +3
-0@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif }; static inline void advk_writel(struct pcie_advk *pcie, uint val, uint reg) @@ -614,9 +617,7 @@ static int
pcie_advk_probe(struct udevice *dev)drivers/pci/pci-aardvark.c +10
-7struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO ) -struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg(pcie->dev, "PCIE Reset on GPIO support is missing\n"); @@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev) return pcie_advk_setup_hw(pcie); } +static int pcie_advk_remove (struct udevice *dev) {#if +CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 );#endif /*
DM_GPIO*/drivers/pci/pci-aardvark.c +6
-1+ +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state * @@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), }; --2.20.1
PATCH 1/1 arm64: a37xx: pci: Depends on DM_GPIO
In reply to Pali RohárFor proper initialization of aardvark pci driver it is required to de-assert reset GPIO. So depeneds on DM_GPIO option.
--- drivers/pci/Kconfig | 1 + drivers/pci/pci-aardvark.c | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-)
drivers/pci/Kconfig +1 -0
@@ -30,6 +30,7 @@ config PCI_AARDVARK bool "Enable Aardvark PCIe driver" default n depends on DM_PCI + depends on DM_GPIO depends on ARMADA_3700 help Say Y here if you want to enable PCIe controller support on
drivers/pci/pci-aardvark.c +2 -8
@@ -148,9 +148,7 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; -#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)
@@ -616,7 +614,6 @@ static int pcie_advk_probe(struct udevice *dev) {struct pcie_advk *pcie =dev_get_priv (dev); -#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/*
@@ -637,10 +634,9 @@ static int pcie_advk_probe(struct udevice *dev)dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 );dm_gpio_set_value (&pcie->reset_gpio,0 ); + }else { +dev_warn (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); } -#else -dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); -#endif /* DM_GPIO */ pcie->first_busno = dev->seq; pcie->dev =pci_get_controller (dev);
@@ -650,12 +646,10 @@ static int pcie_advk_probe(struct udevice *dev)static int pcie_advk_remove (struct udevice *dev) { -#if CONFIG_IS_ENABLED (DM_GPIO )struct pcie_advk *pcie =dev_get_priv (dev);if (dm_gpio_is_valid (&pcie->reset_gpio))dm_gpio_set_value (&pcie->reset_gpio,1 ); -#endif /* DM_GPIO */ return 0 ; }
Signature · 1 line
2.20.1
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Stefan RoeseQuoted 3 lines · On Thursday 20 August 2020 10:00:52 Stefan Roese wrote:
I suggest to "depend" this driver on
DM_GPIOand include the GPIO code without any #ifdef's. And please run a world-build (buildman, Travis...) to see, if nothing breaks.
I sent third patch which removes those #ifdef's and run CI testing on
Github: https://github.com/u-boot/u-boot/pull/37
Everything passed.
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
Quoted 9 lines · Pali Roh?r
Quoted 3 lines · On Thursday 20 August 2020 10:00:52 Stefan Roese wrote:
I suggest to "depend" this driver on
DM_GPIOand include the GPIO code without any #ifdef's. And please run a world-build (buildman, Travis...) to see, if nothing breaks.I sent third patch which removes those #ifdef's and run CI testing on
Github: https://github.com/u-boot/u-boot/pull/37Everything passed.
Perfect. ;)
Thanks,
Stefan
PATCH 1/1 arm64: a37xx: pci: Depends on DM_GPIO
In reply to Pali RohárQuoted 4 lines · Pali Roh?r
For proper initialization of aardvark pci driver it is required to de-assert reset GPIO. So depeneds on
DM_GPIOoption.Signed-off-by Pali Roh?r <[email protected]>
Thanks,
Stefan
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Pali RohárQuoted 5 lines · Pali Roh?r
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.
Signed-off-by Pali Roh?r <[email protected]>
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali RohárQuoted 10 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Quoted 5 lines
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>
PATCH 1/1 arm64: a37xx: pci: Depends on DM_GPIO
In reply to Pali RohárQuoted 4 lines · Pali Roh?r
For proper initialization of aardvark pci driver it is required to de-assert reset GPIO. So depeneds on
DM_GPIOoption.Signed-off-by Pali Roh?r <[email protected]>
PATCH 1/2 arm64: a37xx: pci: Make PCIe Reset GPIO DT compatible with Linux kernel DT
In reply to Pali RohárQuoted 5 lines · Pali Roh?r
Change active-high to active-low and change DT property name from reset-gpio to reset-gpios. This format of gpio reset is used by pci-aardvark driver in Linux kernel.
Signed-off-by Pali Roh?r <[email protected]>
Applied to u-boot-marvell/master
Thanks,
Stefan
Quoted 59 lines
--- arch/arm/dts/armada-3720-db.dts | 2 +- arch/arm/dts/armada-3720-espressobin.dts | 2 +- arch/arm/dts/armada-3720-turris-mox.dts | 2 +- drivers/pci/pci-aardvark.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-)arch/arm/dts/armada-3720-db.dts +1
-1@@ -159,6 +159,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-espressobin.dts +1
-1@@ -145,6 +145,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "okay"; };arch/arm/dts/armada-3720-turris-mox.dts +1
-1@@ -172,6 +172,6 @@ &pcie0 { pinctrl-names = "default"; pinctrl-0 = <&pcie_pins>; - reset-gpio = <&gpiosb 3 GPIO_ACTIVE_HIGH>; + reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>; status = "disabled"; };drivers/pci/pci-aardvark.c +1
-1@@ -616,7 +616,7 @@ static int pcie_advk_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -gpio_request_by_name (dev,"reset-gpio" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -633,9 +633,9 @@ static int pcie_advk_probe(struct udevice *dev)*/
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 641
Quoted 10 lines
drivers/pci/pci-aardvark.c +2
-2if (dm_gpio_is_valid (&reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,0 ); -mdelay (200 );dm_gpio_set_value (&reset_gpio,1 ); +mdelay (200 ); +dm_gpio_set_value (&reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 2/2 arm64: a37xx: pci: Assert PERST# signal when unloading driver
In reply to Pali RohárQuoted 10 lines · Pali Roh?r
This change ensures that PCIe card is put into reset state when U-Boot stops using it.
DM_FLAG_OS_PREPAREensures that U-Boot executes driver's remove callback prior booting Linux kernel.Linux kernel pci-aardvark driver needs to reset PCIe card via PERST# signal prior initializing it. If it does not issue reset then some PCIe cards (specially Compex WiFi cards) are not detected at all.
Quoted 5 lines
Putting PCIe card into reset state prior booting Linux kernel would ensure that card would be properly reset at time when Linux kernel starts initializing pci-aardvark driver.
Signed-off-by Pali Roh?r <[email protected]>
Applied to u-boot-marvell/master
Thanks,
Stefan
Quoted 65 lines
--- drivers/pci/pci-aardvark.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)drivers/pci/pci-aardvark.c +19
-6@@ -148,6 +148,9 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct gpio_desc reset_gpio; +#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)@@ -614,9 +617,7 @@ static int pcie_advk_probe(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);#if CONFIG_IS_ENABLED (DM_GPIO ) -struct gpio_desc reset_gpio; - -gpio_request_by_name (dev,"reset-gpios" ,0 , &reset_gpio, +gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* * Issue reset to add-in card through the dedicated GPIO. @@ -631,11 +632,11 @@ static int pcie_advk_probe(struct udevice *dev)* possible before PCIe PHY initialization. Moreover, the PCIe * clock should be gated as well. */ -if (dm_gpio_is_valid (&reset_gpio)) { +if (dm_gpio_is_valid (&pcie->reset_gpio)) {dev_dbg (pcie->dev,"Toggle PCIE Reset GPIO ...\n" ); -dm_gpio_set_value (&reset_gpio,1 ); +dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 ); -dm_gpio_set_value (&reset_gpio,0 ); +dm_gpio_set_value (&pcie->reset_gpio,0 ); }#else dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" );@@ -647,6 +648,18 @@ static int pcie_advk_probe(struct udevice *dev)return pcie_advk_setup_hw (pcie); } +static int pcie_advk_remove (struct udevice *dev) +{ +#if CONFIG_IS_ENABLED (DM_GPIO ) +struct pcie_advk *pcie =dev_get_priv (dev); + +if (dm_gpio_is_valid (&pcie->reset_gpio)) +dm_gpio_set_value (&pcie->reset_gpio,1 ); +#endif /* DM_GPIO */ + +return 0 ; +} +/** * pcie_advk_ofdata_to_platdata() - Translate from DT to device state *
drivers/pci/pci-aardvark.c U_BOOT_DRIVER(pcie_advk) = { · line 706
Quoted 7 lines
drivers/pci/pci-aardvark.c +2
-0@@ -687,5 +700,7 @@ U_BOOT_DRIVER(pcie_advk) = { .ops = &pcie_advk_ops, .ofdata_to_platdata = pcie_advk_ofdata_to_platdata, .probe = pcie_advk_probe, + .remove = pcie_advk_remove, + .flags = DM_FLAG_OS_PREPARE, .priv_auto_alloc_size = sizeof(struct pcie_advk), };
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/1 arm64: a37xx: pci: Depends on DM_GPIO
In reply to Pali RohárQuoted 4 lines · Pali Roh?r
For proper initialization of aardvark pci driver it is required to de-assert reset GPIO. So depeneds on
DM_GPIOoption.Signed-off-by Pali Roh?r <[email protected]>
Applied to u-boot-marvell/master
Thanks,
Stefan
Quoted 56 lines
--- drivers/pci/Kconfig | 1 + drivers/pci/pci-aardvark.c | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-)drivers/pci/Kconfig +1
-0@@ -30,6 +30,7 @@ config PCI_AARDVARK bool "Enable Aardvark PCIe driver" default n depends on DM_PCI + depends on DM_GPIO depends on ARMADA_3700 help Say Y here if you want to enable PCIe controller support ondrivers/pci/pci-aardvark.c +2
-6@@ -148,9 +148,7 @@ struct pcie_advk {void *base;int first_busno;struct udevice *dev; -#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc reset_gpio; -#endif };static inline void advk_writel (struct pcie_advk *pcie,uint val,uint reg)@@ -616,7 +614,6 @@ static int pcie_advk_probe(struct udevice *dev) {struct pcie_advk *pcie =dev_get_priv (dev); -#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"reset-gpios" ,0 , &pcie->reset_gpio,GPIOD_IS_OUT );/* @@ -637,10 +634,9 @@ static int pcie_advk_probe(struct udevice *dev)dm_gpio_set_value (&pcie->reset_gpio,1 );mdelay (200 );dm_gpio_set_value (&pcie->reset_gpio,0 ); + }else { +dev_warn (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); } -#else -dev_dbg (pcie->dev,"PCIE Reset on GPIO support is missing\n" ); -#endif /* DM_GPIO */ pcie->first_busno = dev->seq; pcie->dev =pci_get_controller (dev);@@ -650,12 +646,10 @@ static int pcie_advk_probe(struct udevice *dev)static int pcie_advk_remove (struct udevice *dev)
drivers/pci/pci-aardvark.c static int pcie_advk_probe(struct udevice *dev) · line 655
Quoted 10 lines
drivers/pci/pci-aardvark.c +0
-2{ -#if CONFIG_IS_ENABLED (DM_GPIO )struct pcie_advk *pcie =dev_get_priv (dev);if (dm_gpio_is_valid (&pcie->reset_gpio))dm_gpio_set_value (&pcie->reset_gpio,1 ); -#endif /* DM_GPIO */ return 0 ; }
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de