board/freescale: Share qbman init between archs
Subsystems (2)
PATCH 1/1 board/freescale: Share qbman init between archs
From: Ahmed Mansour <[email protected]>
This patch adds changes necessary to move functionality present in PowerPC folders with ARM architectures that have DPAA1 QBMan hardware
- Created new board/freescale/common/portals.c to house shared device tree fixups for DPAA1 devices with ARM and PowerPC cores
- Added new header file to top includes directory to allow files in both architectures to grab the function prototypes
- Port inhibit_portals() from PowerPC to ARM. This function is used in setup to disable interrupts on all QMan and BMan portals. It is needed because the interrupts are enabled by default for all portals including unused/uninitialised portals. When the kernel attempts to go to deep sleep the unused portals prevent it from doing so
--- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 7 + arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 15 + .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 3 + .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 29 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 3 +- arch/powerpc/cpu/mpc85xx/fdt.c | 1 + arch/powerpc/cpu/mpc85xx/portals.c | 281 ------------------- arch/powerpc/include/asm/fsl_liodn.h | 5 +- arch/powerpc/include/asm/fsl_portals.h | 4 - arch/powerpc/include/asm/immap_85xx.h | 60 ---- board/freescale/common/Makefile | 2 + board/freescale/common/portals.c | 312 +++++++++++++++++++++ include/configs/ls1043a_common.h | 2 + include/fsl_qbman.h | 75 +++++ 14 files changed, 451 insertions(+), 348 deletions(-) create mode 100644 board/freescale/common/portals.c create mode 100644 include/fsl_qbman.h
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +7 -0
@@ -26,6 +26,10 @@#ifdef CONFIG_SYS_FSL_DDR #include <fsl_ddr.h> #endif +#include <fsl_immap.h> +#ifdef CONFIG_SYS_DPAA_QBMAN +#include <fsl_qbman.h> +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -511,6 +515,9 @@ int arch_early_init_r(void)#ifdef CONFIG_FMAN_ENET fman_enet_init ();#endif +#ifdef CONFIG_SYS_DPAA_QBMAN +setup_qbman_portals (); +#endif return 0 ; }
arch/arm/cpu/armv8/fsl-layerscape/fdt.c +15 -0
@@ -26,6 +26,8 @@#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT #include <asm/armv8/sec_firmware.h> #endif +#include <asm/arch/speed.h> +#include <fsl_qbman.h> int fdt_fixup_phy_connection (void *blob,int offset,phy_interface_t phyc) {
@@ -364,6 +366,12 @@ void ft_cpu_setup(void *blob, bd_t *bd)#endif #endif +#ifdef CONFIG_SYS_DPAA_QBMAN +struct sys_info sysinfo; + +get_sys_info (&sysinfo); +#endif +#ifdef CONFIG_MP ft_fixup_cpu (blob);#endif
@@ -384,6 +392,13 @@ void ft_cpu_setup(void *blob, bd_t *bd)fdt_fixup_esdhc (blob, bd);#endif +#ifdef CONFIG_SYS_DPAA_QBMAN +fdt_fixup_bportals (blob); +fdt_fixup_qportals (blob); +do_fixup_by_compat_u32 (blob,"fsl,qman" , +"clock-frequency" , sysinfo.freq_qman,1 ); +#endif +#ifdef CONFIG_SYS_DPAA_FMAN fdt_fixup_fman_firmware (blob);#endif
arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c +3 -0
@@ -155,6 +155,9 @@ void get_sys_info(struct sys_info *sys_info) sys_info->freq_localbus = sys_info->freq_systembus /CONFIG_SYS_FSL_IFC_CLK_DIV ;#endif +#ifdef CONFIG_SYS_DPAA_QBMAN + sys_info->freq_qman = sys_info->freq_systembus; +#endif }int get_clocks (void )
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +29 -0
@@ -24,6 +24,8 @@#define CONFIG_SYS_FSL_GUTS_ADDR (CONFIG_SYS_IMMR + 0x00ee0000)#define CONFIG_SYS_FSL_RST_ADDR (CONFIG_SYS_IMMR + 0x00ee00b0)#define CONFIG_SYS_FSL_SCFG_ADDR (CONFIG_SYS_IMMR + 0x00570000) +#define CONFIG_SYS_FSL_BMAN_ADDR (CONFIG_SYS_IMMR + 0x00890000) +#define CONFIG_SYS_FSL_QMAN_ADDR (CONFIG_SYS_IMMR + 0x00880000)#define CONFIG_SYS_FSL_FMAN_ADDR (CONFIG_SYS_IMMR + 0x00a00000)#define CONFIG_SYS_FSL_SERDES_ADDR (CONFIG_SYS_IMMR + 0x00ea0000)#define CONFIG_SYS_FSL_DCFG_ADDR (CONFIG_SYS_IMMR + 0x00ee0000)
@@ -41,6 +43,33 @@#define CONFIG_SYS_SEC_MON_ADDR (CONFIG_SYS_IMMR + 0xe90000)#define CONFIG_SYS_SFP_ADDR (CONFIG_SYS_IMMR + 0xe80200) +#define CONFIG_SYS_BMAN_NUM_PORTALS 10 +#define CONFIG_SYS_BMAN_MEM_BASE 0x508000000 +#define CONFIG_SYS_BMAN_MEM_PHYS (0xf00000000ull + \ + CONFIG_SYS_BMAN_MEM_BASE) +#define CONFIG_SYS_BMAN_MEM_SIZE 0x08000000 +#define CONFIG_SYS_BMAN_SP_CENA_SIZE 0x10000 +#define CONFIG_SYS_BMAN_SP_CINH_SIZE 0x10000 +#define CONFIG_SYS_BMAN_CENA_BASE CONFIG_SYS_BMAN_MEM_BASE +#define CONFIG_SYS_BMAN_CENA_SIZE (CONFIG_SYS_BMAN_MEM_SIZE >> 1) +#define CONFIG_SYS_BMAN_CINH_BASE (CONFIG_SYS_BMAN_MEM_BASE + \ + CONFIG_SYS_BMAN_CENA_SIZE) +#define CONFIG_SYS_BMAN_CINH_SIZE (CONFIG_SYS_BMAN_MEM_SIZE >> 1) +#define CONFIG_SYS_BMAN_SWP_ISDR_REG 0x3E80 +#define CONFIG_SYS_QMAN_NUM_PORTALS 10 +#define CONFIG_SYS_QMAN_MEM_BASE 0x500000000 +#define CONFIG_SYS_QMAN_MEM_PHYS (0xf00000000ull + \ + CONFIG_SYS_QMAN_MEM_BASE) +#define CONFIG_SYS_QMAN_MEM_SIZE 0x08000000 +#define CONFIG_SYS_QMAN_SP_CENA_SIZE 0x10000 +#define CONFIG_SYS_QMAN_SP_CINH_SIZE 0x10000 +#define CONFIG_SYS_QMAN_CENA_BASE CONFIG_SYS_QMAN_MEM_BASE +#define CONFIG_SYS_QMAN_CENA_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1) +#define CONFIG_SYS_QMAN_CINH_BASE (CONFIG_SYS_QMAN_MEM_BASE + \ + CONFIG_SYS_QMAN_CENA_SIZE) +#define CONFIG_SYS_QMAN_CINH_SIZE (CONFIG_SYS_QMAN_MEM_SIZE >> 1) +#define CONFIG_SYS_QMAN_SWP_ISDR_REG 0x3680 +#define CONFIG_SYS_FSL_TIMER_ADDR 0x02b00000#define I2C1_BASE_ADDR (CONFIG_SYS_IMMR + 0x01180000)
arch/powerpc/cpu/mpc85xx/cpu_init.c +2 -1
@@ -26,6 +26,7 @@#ifdef CONFIG_FSL_CORENET #include <asm/fsl_portals.h> #include <asm/fsl_liodn.h> +#include <fsl_qbman.h> #endif #include <fsl_usb.h> #include <hwconfig.h>
@@ -804,7 +805,7 @@ int cpu_init_r(void)#ifdef CONFIG_FSL_CORENET set_liodns ();#ifdef CONFIG_SYS_DPAA_QBMAN -setup_portals (); +setup_qbman_portals ();#endif #endif
arch/powerpc/cpu/mpc85xx/fdt.c +1 -0
@@ -15,6 +15,7 @@#include <asm/io.h> #include <asm/fsl_fdt.h> #include <asm/fsl_portals.h> +#include <fsl_qbman.h> #include <hwconfig.h> #ifdef CONFIG_FSL_ESDHC #include <fsl_esdhc.h>
arch/powerpc/cpu/mpc85xx/portals.c +0 -281
290 lines not on this page · raw message
arch/powerpc/include/asm/fsl_liodn.h +3 -2
@@ -8,6 +8,7 @@#define _FSL_LIODN_H_#include <asm/types.h> +#include <fsl_qbman.h> struct srio_liodn_id_table {u32 id[2 ];
@@ -128,12 +129,12 @@ extern void fdt_fixup_liodn(void *blob); CONFIG_SYS_MPC85xx_TDM_OFFSET)#define SET_QMAN_LIODN (liodn) \ - SET_LIODN_ENTRY_1("fsl,qman", liodn, offsetof(ccsr_qman_t, liodnr) + \ + SET_LIODN_ENTRY_1("fsl,qman", liodn, offsetof(struct ccsr_qman, liodnr) + \ CONFIG_SYS_FSL_QMAN_OFFSET, \ CONFIG_SYS_FSL_QMAN_OFFSET)#define SET_BMAN_LIODN (liodn) \ - SET_LIODN_ENTRY_1("fsl,bman", liodn, offsetof(ccsr_bman_t, liodnr) + \ + SET_LIODN_ENTRY_1("fsl,bman", liodn, offsetof(struct ccsr_bman, liodnr) + \ CONFIG_SYS_FSL_BMAN_OFFSET, \ CONFIG_SYS_FSL_BMAN_OFFSET)
arch/powerpc/include/asm/fsl_portals.h +0 -4
@@ -41,10 +41,6 @@ struct qportal_info {extern int get_dpaa_liodn (enum fsl_dpaa_dev dpaa_dev,u32 *liodns,int liodn_offset); -extern void setup_portals (void ); -extern void fdt_fixup_qportals (void *blob); -extern void fdt_fixup_bportals (void *blob); -extern struct qportal_info qp_info[];extern void fdt_portal (void *blob,const char *compat,const char *container,u64 addr,u32 size);
arch/powerpc/include/asm/immap_85xx.h +0 -60
66 lines not on this page · raw message
board/freescale/common/Makefile +2 -0
@@ -74,6 +74,8 @@ obj-$(CONFIG_TARGET_P5040DS) += p_corenet/ obj-$(CONFIG_LAYERSCAPE_NS_ACCESS) += ns_access.o +obj-$(CONFIG_SYS_DPAA_QBMAN) += portals.o + ifdef CONFIG_SECURE_BOOT obj-$(CONFIG_CMD_ESBC_VALIDATE) += fsl_validate.o cmd_esbc_validate.o endif
board/freescale/common/portals.c new file +312 -0
312 lines not on this page · raw message
include/configs/ls1043a_common.h +2 -0
@@ -201,6 +201,8 @@#endif #endif +#define CONFIG_SYS_DPAA_QBMAN /* Support Q/Bman */ +/* FMan ucode */ #ifndef SPL_NO_FMAN #define CONFIG_SYS_DPAA_FMAN
include/fsl_qbman.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 1/1 board/freescale: Share qbman init between archs
Quoted 7 lines · Roy Pledge
From: Ahmed Mansour <[email protected]>
This patch adds changes necessary to move functionality present in PowerPC folders with ARM architectures that have DPAA1 QBMan hardware
- Created new
board/freescale/common/portals.cto house shared device tree fixups for DPAA1 devices with ARM and PowerPC cores
I don't think using board/freescale/common/portals.c is the best solution. QBMan is a SoC feature, not Freescale board specific. Please consider to move it to somewhere common.
Quoted 34 lines
- Added new header file to top includes directory to allow files in both architectures to grab the function prototypes
- Portinhibit_portals()from PowerPC to ARM. This function is used in setup to disable interrupts on all QMan and BMan portals. It is needed because the interrupts are enabled by default for all portals including unused/uninitialised portals. When the kernel attempts to go to deep sleep the unused portals prevent it from doing soSigned-off-by Ahmed Mansour <[email protected]>Signed-off-by Roy Pledge <[email protected]>--- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 7 + arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 15 + .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 3 + .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 29 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 3 +- arch/powerpc/cpu/mpc85xx/fdt.c | 1 + arch/powerpc/cpu/mpc85xx/portals.c | 281 ------------------- arch/powerpc/include/asm/fsl_liodn.h | 5 +- arch/powerpc/include/asm/fsl_portals.h | 4 - arch/powerpc/include/asm/immap_85xx.h | 60 ---- board/freescale/common/Makefile | 2 + board/freescale/common/portals.c | 312 +++++++++++++++++++++ include/configs/ls1043a_common.h | 2 + include/fsl_qbman.h | 75 +++++ 14 files changed, 451 insertions(+), 348 deletions(-)create mode 100644
board/freescale/common/portals.ccreate mode 100644include/fsl_qbman.harch/arm/cpu/armv8/fsl-layerscape/cpu.c +0
-0
arch/arm/cpu/armv8/fsl-layerscape/cpu.c line 32
Quoted 7 lines
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +4
-0@@ -26,6 +26,10 @@#ifdef CONFIG_SYS_FSL_DDR #include <fsl_ddr.h> #endif +#include <fsl_immap.h> +#ifdef CONFIG_SYS_DPAA_QBMAN +#include <fsl_qbman.h> +#endif
Do not use ifdef if you can avoid it.
<snip>
include/configs/ls1043a_common.h line 205
Quoted 10 lines
include/configs/ls1043a_common.h +2
-0@@ -201,6 +201,8 @@#endif #endif +#define CONFIG_SYS_DPAA_QBMAN /* Support Q/Bman */ +
It's better to move this option to Kconfig.
York
PATCH 1/1 board/freescale: Share qbman init between archs
Quoted 11 lines · york sun
Quoted 7 lines · Roy Pledge
From: Ahmed Mansour <[email protected]>
This patch adds changes necessary to move functionality present in PowerPC folders with ARM architectures that have DPAA1 QBMan hardware
- Created new
board/freescale/common/portals.cto house shared device tree fixups for DPAA1 devices with ARM and PowerPC coresI don't think using
board/freescale/common/portals.cis the best solution. QBMan is a SoC feature, not Freescale board specific. Please consider to move it to somewhere common.
Do you have a suggestion? We choose this location as the fman support is in this directory as well. There doesn't seem to be a good place to share SoC specific drivers other than perhaps drivers/soc but there is very little in that directory right now.
Quoted 54 lines
Quoted 35 lines
- Added new header file to top includes directory to allow files in both architectures to grab the function prototypes
- Portinhibit_portals()from PowerPC to ARM. This function is used in setup to disable interrupts on all QMan and BMan portals. It is needed because the interrupts are enabled by default for all portals including unused/uninitialised portals. When the kernel attempts to go to deep sleep the unused portals prevent it from doing soSigned-off-by Ahmed Mansour <[email protected]>Signed-off-by Roy Pledge <[email protected]>--- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 7 + arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 15 + .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 3 + .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 29 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 3 +- arch/powerpc/cpu/mpc85xx/fdt.c | 1 + arch/powerpc/cpu/mpc85xx/portals.c | 281 ------------------- arch/powerpc/include/asm/fsl_liodn.h | 5 +- arch/powerpc/include/asm/fsl_portals.h | 4 - arch/powerpc/include/asm/immap_85xx.h | 60 ---- board/freescale/common/Makefile | 2 + board/freescale/common/portals.c | 312 +++++++++++++++++++++ include/configs/ls1043a_common.h | 2 + include/fsl_qbman.h | 75 +++++ 14 files changed, 451 insertions(+), 348 deletions(-)create mode 100644
board/freescale/common/portals.ccreate mode 100644include/fsl_qbman.harch/arm/cpu/armv8/fsl-layerscape/cpu.c +0
-0arch/arm/cpu/armv8/fsl-layerscape/cpu.c line 32
Quoted 7 lines
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +4
-0@@ -26,6 +26,10 @@#ifdef CONFIG_SYS_FSL_DDR #include <fsl_ddr.h> #endif +#include <fsl_immap.h> +#ifdef CONFIG_SYS_DPAA_QBMAN +#include <fsl_qbman.h> +#endif Do not use ifdef if you can avoid it.
<snip>
Quoted 8 lines
include/configs/ls1043a_common.h +0
-0@@ -201,6 +201,8 @@#endif #endif
Quoted 3 lines
include/configs/ls1043a_common.h line 205
Quoted 2 lines
include/configs/ls1043a_common.h +2
-0+#define CONFIG_SYS_DPAA_QBMAN /* Support Q/Bman */ +It's better to move this option to
Kconfig.
Again we copied what was done for FMan here
Quoted 3 lines
York
PATCH 1/1 board/freescale: Share qbman init between archs
Quoted 9 lines · Roy Pledge
Quoted 8 lines · york sun
Quoted 7 lines · Roy Pledge
From: Ahmed Mansour <[email protected]>
This patch adds changes necessary to move functionality present in PowerPC folders with ARM architectures that have DPAA1 QBMan hardware
- Created new
board/freescale/common/portals.cto house shared device tree fixups for DPAA1 devices with ARM and PowerPC cores
Quoted 7 lines
Quoted 3 lines
I don't think using
board/freescale/common/portals.cis the best solution. QBMan is a SoC feature, not Freescale board specific. Please consider to move it to somewhere common.Do you have a suggestion? We choose this location as the fman support is in this directory as well. There doesn't seem to be a good place to share SoC specific drivers other than perhaps
drivers/socbut there is very little in that directory right now.
How about drivers/misc? We have IFC driver there.
Quoted 54 lines
Quoted 54 lines
Quoted 35 lines
- Added new header file to top includes directory to allow files in both architectures to grab the function prototypes
- Portinhibit_portals()from PowerPC to ARM. This function is used in setup to disable interrupts on all QMan and BMan portals. It is needed because the interrupts are enabled by default for all portals including unused/uninitialised portals. When the kernel attempts to go to deep sleep the unused portals prevent it from doing soSigned-off-by Ahmed Mansour <[email protected]>Signed-off-by Roy Pledge <[email protected]>--- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 7 + arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 15 + .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 3 + .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 29 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 3 +- arch/powerpc/cpu/mpc85xx/fdt.c | 1 + arch/powerpc/cpu/mpc85xx/portals.c | 281 ------------------- arch/powerpc/include/asm/fsl_liodn.h | 5 +- arch/powerpc/include/asm/fsl_portals.h | 4 - arch/powerpc/include/asm/immap_85xx.h | 60 ---- board/freescale/common/Makefile | 2 + board/freescale/common/portals.c | 312 +++++++++++++++++++++ include/configs/ls1043a_common.h | 2 + include/fsl_qbman.h | 75 +++++ 14 files changed, 451 insertions(+), 348 deletions(-)create mode 100644
board/freescale/common/portals.ccreate mode 100644include/fsl_qbman.harch/arm/cpu/armv8/fsl-layerscape/cpu.c +0
-0arch/arm/cpu/armv8/fsl-layerscape/cpu.c line 32
Quoted 7 lines
arch/arm/cpu/armv8/fsl-layerscape/cpu.c +4
-0@@ -26,6 +26,10 @@#ifdef CONFIG_SYS_FSL_DDR #include <fsl_ddr.h> #endif +#include <fsl_immap.h> +#ifdef CONFIG_SYS_DPAA_QBMAN +#include <fsl_qbman.h> +#endif Do not use ifdef if you can avoid it.
<snip>
Quoted 8 lines
include/configs/ls1043a_common.h +0
-0@@ -201,6 +201,8 @@#endif #endif
Quoted 4 lines
Quoted 3 lines
include/configs/ls1043a_common.h line 205
Quoted 2 lines
include/configs/ls1043a_common.h +2
-0+#define CONFIG_SYS_DPAA_QBMAN /* Support Q/Bman */ +It's better to move this option to
Kconfig.Again we copied what was done for FMan here
We are moving config options to Kconfig.
York
PATCH 1/1 board/freescale: Share qbman init between archs
In reply to Roy PledgeQuoted 33 lines · Roy Pledge
From: Ahmed Mansour <[email protected]>
This patch adds changes necessary to move functionality present in PowerPC folders with ARM architectures that have DPAA1 QBMan hardware
- Created new
board/freescale/common/portals.cto house shared device tree fixups for DPAA1 devices with ARM and PowerPC cores
- Added new header file to top includes directory to allow files in both architectures to grab the function prototypes
- Portinhibit_portals()from PowerPC to ARM. This function is used in setup to disable interrupts on all QMan and BMan portals. It is needed because the interrupts are enabled by default for all portals including unused/uninitialised portals. When the kernel attempts to go to deep sleep the unused portals prevent it from doing soSigned-off-by Ahmed Mansour <[email protected]>Signed-off-by Roy Pledge <[email protected]>--- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 7 + arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 15 + .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c | 3 + .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 29 ++ arch/powerpc/cpu/mpc85xx/cpu_init.c | 3 +- arch/powerpc/cpu/mpc85xx/fdt.c | 1 + arch/powerpc/cpu/mpc85xx/portals.c | 281 ------------------- arch/powerpc/include/asm/fsl_liodn.h | 5 +- arch/powerpc/include/asm/fsl_portals.h | 4 - arch/powerpc/include/asm/immap_85xx.h | 60 ---- board/freescale/common/Makefile | 2 + board/freescale/common/portals.c | 312 +++++++++++++++++++++ include/configs/ls1043a_common.h | 2 + include/fsl_qbman.h | 75 +++++ 14 files changed, 451 insertions(+), 348 deletions(-)
Quoted 3 lines
create mode 100644
board/freescale/common/portals.ccreate mode 100644include/fsl_qbman.h
Roy,
Compiling all 85xx found two issues. One is setup_portals(), called by P1023RDB and Cyrus boards directly. The other issue is the board/freescale/common is not compiled for other than Freescale boards for obvious reason. However, several boards have 85xx SoCs with QBMan portal. They are kmlion1,Cyrus_P5040,Cyrus_P5020,kmcoge4. Please check how to make them happy.
York