diff mbox

[U-Boot,04/17] mvebu: Add board_pex_config()

Message ID d0fd5d4ce1e81e05a7aff65268fecc8a5fecc140.1479913469.git.mario.six@gdsys.cc
State Superseded
Delegated to: Stefan Roese
Headers show

Commit Message

Mario Six Nov. 23, 2016, 3:12 p.m. UTC
Allow boards to do some initialization when PCIe comes up.

Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
---
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 10 ++++++++++
 arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h |  2 ++
 2 files changed, 12 insertions(+)

Comments

Stefan Roese Dec. 1, 2016, 8:30 a.m. UTC | #1
On 23.11.2016 16:12, Mario Six wrote:
> Allow boards to do some initialization when PCIe comes up.

What is it that your boards needs to do when PCIe comes up? Could
you please give me an example here?

> Signed-off-by: Dirk Eibach <dirk.eibach@gdsys.cc>
> ---
>  arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 10 ++++++++++
>  arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h |  2 ++
>  2 files changed, 12 insertions(+)
>
> diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
> index 98c447c..2b85e6e 100644
> --- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
> +++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
> @@ -13,6 +13,13 @@
>  #include "ctrl_pex.h"
>  #include "sys_env_lib.h"
>
> +void __board_pex_config(void)
> +{
> +	/* nothing in this weak default implementation */
> +}
> +void board_pex_config(void)
> +	__attribute__((weak, alias("__board_pex_config")));
> +

Its easier to use this syntax instead:

__weak board_pex_config(void)
...

You don't need to add the __attribute this way.

Thanks,
Stefan
Dirk Eibach Dec. 1, 2016, 10:55 a.m. UTC | #2
2016-12-01 9:30 GMT+01:00 Stefan Roese <sr@denx.de>:
> On 23.11.2016 16:12, Mario Six wrote:
>>
>> Allow boards to do some initialization when PCIe comes up.
>
>
> What is it that your boards needs to do when PCIe comes up? Could
> you please give me an example here?

You might have a look at Patch 00 of this series. We have a quirky
FPGA as a PCIe device that needs some special treamtment when PCIe is
is coming up.

> ...
>> +void __board_pex_config(void)
>> +{
>> +       /* nothing in this weak default implementation */
>> +}
>> +void board_pex_config(void)
>> +       __attribute__((weak, alias("__board_pex_config")));
>> +
>
>
> Its easier to use this syntax instead:
>
> __weak board_pex_config(void)
> ...
>
> You don't need to add the __attribute this way.

Mario could you take car of this in V2?

Cheers
Dirk
diff mbox

Patch

diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
index 98c447c..2b85e6e 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
@@ -13,6 +13,13 @@ 
 #include "ctrl_pex.h"
 #include "sys_env_lib.h"
 
+void __board_pex_config(void)
+{
+	/* nothing in this weak default implementation */
+}
+void board_pex_config(void)
+	__attribute__((weak, alias("__board_pex_config")));
+
 int hws_pex_config(const struct serdes_map *serdes_map, u8 count)
 {
 	u32 pex_idx, tmp, next_busno, first_busno, temp_pex_reg,
@@ -77,6 +84,9 @@  int hws_pex_config(const struct serdes_map *serdes_map, u8 count)
 
 	/* Support gen1/gen2 */
 	DEBUG_INIT_FULL_S("Support gen1/gen2\n");
+
+	board_pex_config();
+
 	next_busno = 0;
 	mdelay(150);
 
diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
index 5f7e2c7..ca8a4d2 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
+++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h
@@ -83,4 +83,6 @@  int pex_local_bus_num_set(u32 pex_if, u32 bus_num);
 int pex_local_dev_num_set(u32 pex_if, u32 dev_num);
 u32 pex_config_read(u32 pex_if, u32 bus, u32 dev, u32 func, u32 reg_off);
 
+void board_pex_config(void);
+
 #endif