diff mbox series

[U-Boot,05/14] arm: socfpga: Move Stratix10 and Agilexsystem manager common code

Message ID 1557467688-73706-6-git-send-email-ley.foon.tan@intel.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series Add Intel Agilex SoC support | expand

Commit Message

Ley Foon Tan May 10, 2019, 5:54 a.m. UTC
Move Stratix10 and Agilex system manager common code to system_manager.h.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 .../include/mach/system_manager.h             | 47 +++++++++++++++++++
 .../include/mach/system_manager_s10.h         | 46 ------------------
 2 files changed, 47 insertions(+), 46 deletions(-)

Comments

Marek Vasut May 10, 2019, 11:59 a.m. UTC | #1
On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> Move Stratix10 and Agilex system manager common code to system_manager.h.
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>

This becomes quite a bit of ifdeffery . Why don't you have the
system_manager.h include system_manager_$soc.h like e.g. here?

http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
Ley Foon Tan May 14, 2019, 5:47 a.m. UTC | #2
On Fri, May 10, 2019 at 8:17 PM Marek Vasut <marex@denx.de> wrote:
>
> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> > Move Stratix10 and Agilex system manager common code to system_manager.h.
> >
> > Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>
> This becomes quite a bit of ifdeffery . Why don't you have the
> system_manager.h include system_manager_$soc.h like e.g. here?
>
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
>
> --
> Best regards,
> Marek Vasut
We already have similar thing for Gen5. A10 and S10 includes. But, S10
and Agilex share some common defines/functions.
I can move S10 and Agilex common code to a separate file and include
in their header file.

Regards
Ley Foon
Marek Vasut May 14, 2019, noon UTC | #3
On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> On Fri, May 10, 2019 at 8:17 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
>>> Move Stratix10 and Agilex system manager common code to system_manager.h.
>>>
>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>>
>> This becomes quite a bit of ifdeffery . Why don't you have the
>> system_manager.h include system_manager_$soc.h like e.g. here?
>>
>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
>>
>> --
>> Best regards,
>> Marek Vasut
> We already have similar thing for Gen5. A10 and S10 includes. But, S10
> and Agilex share some common defines/functions.
> I can move S10 and Agilex common code to a separate file and include
> in their header file.

I think that'd improve the code .
Ley Foon Tan May 14, 2019, 1:52 p.m. UTC | #4
On Tue, May 14, 2019 at 9:47 PM Marek Vasut <marex@denx.de> wrote:
>
> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> > On Fri, May 10, 2019 at 8:17 PM Marek Vasut <marex@denx.de> wrote:
> >>
> >> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> >>> Move Stratix10 and Agilex system manager common code to system_manager.h.
> >>>
> >>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> >>
> >> This becomes quite a bit of ifdeffery . Why don't you have the
> >> system_manager.h include system_manager_$soc.h like e.g. here?
> >>
> >> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
> >>
> >> --
> >> Best regards,
> >> Marek Vasut
> > We already have similar thing for Gen5. A10 and S10 includes. But, S10
> > and Agilex share some common defines/functions.
> > I can move S10 and Agilex common code to a separate file and include
> > in their header file.
>
> I think that'd improve the code .
>
I am plan to use filename system_manager_s10_agilex_common.h, or you
have better filename suggestion? :)

Regards
Ley Foon
Marek Vasut May 14, 2019, 1:55 p.m. UTC | #5
On 5/14/19 3:52 PM, Ley Foon Tan wrote:
> On Tue, May 14, 2019 at 9:47 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
>>> On Fri, May 10, 2019 at 8:17 PM Marek Vasut <marex@denx.de> wrote:
>>>>
>>>> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
>>>>> Move Stratix10 and Agilex system manager common code to system_manager.h.
>>>>>
>>>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>>>>
>>>> This becomes quite a bit of ifdeffery . Why don't you have the
>>>> system_manager.h include system_manager_$soc.h like e.g. here?
>>>>
>>>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
>>>>
>>>> --
>>>> Best regards,
>>>> Marek Vasut
>>> We already have similar thing for Gen5. A10 and S10 includes. But, S10
>>> and Agilex share some common defines/functions.
>>> I can move S10 and Agilex common code to a separate file and include
>>> in their header file.
>>
>> I think that'd improve the code .
>>
> I am plan to use filename system_manager_s10_agilex_common.h, or you
> have better filename suggestion? :)

Whatever looks consistent is fine.
Ley Foon Tan May 14, 2019, 1:56 p.m. UTC | #6
On Tue, May 14, 2019 at 9:55 PM Marek Vasut <marex@denx.de> wrote:
>
> On 5/14/19 3:52 PM, Ley Foon Tan wrote:
> > On Tue, May 14, 2019 at 9:47 PM Marek Vasut <marex@denx.de> wrote:
> >>
> >> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> >>> On Fri, May 10, 2019 at 8:17 PM Marek Vasut <marex@denx.de> wrote:
> >>>>
> >>>> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> >>>>> Move Stratix10 and Agilex system manager common code to system_manager.h.
> >>>>>
> >>>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> >>>>
> >>>> This becomes quite a bit of ifdeffery . Why don't you have the
> >>>> system_manager.h include system_manager_$soc.h like e.g. here?
> >>>>
> >>>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
> >>>>
> >>>> --
> >>>> Best regards,
> >>>> Marek Vasut
> >>> We already have similar thing for Gen5. A10 and S10 includes. But, S10
> >>> and Agilex share some common defines/functions.
> >>> I can move S10 and Agilex common code to a separate file and include
> >>> in their header file.
> >>
> >> I think that'd improve the code .
> >>
> > I am plan to use filename system_manager_s10_agilex_common.h, or you
> > have better filename suggestion? :)
>
> Whatever looks consistent is fine.
>
> --
Noted.

Thanks.

Regards
Ley Foon
diff mbox series

Patch

diff --git a/arch/arm/mach-socfpga/include/mach/system_manager.h b/arch/arm/mach-socfpga/include/mach/system_manager.h
index 7e76df74b7..171b79e238 100644
--- a/arch/arm/mach-socfpga/include/mach/system_manager.h
+++ b/arch/arm/mach-socfpga/include/mach/system_manager.h
@@ -8,6 +8,53 @@ 
 
 #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
 #include <asm/arch/system_manager_s10.h>
+
+void sysmgr_pinmux_init(void);
+void populate_sysmgr_fpgaintf_module(void);
+void populate_sysmgr_pinmux(void);
+void sysmgr_pinmux_table_sel(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_ctrl(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len);
+void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len);
+
+#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
+#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
+#define SYSMGR_ECC_OCRAM_EN	BIT(0)
+#define SYSMGR_ECC_OCRAM_SERR	BIT(3)
+#define SYSMGR_ECC_OCRAM_DERR	BIT(4)
+#define SYSMGR_FPGAINTF_USEFPGA	0x1
+
+#define SYSMGR_FPGAINTF_NAND	BIT(4)
+#define SYSMGR_FPGAINTF_SDMMC	BIT(8)
+#define SYSMGR_FPGAINTF_SPIM0	BIT(16)
+#define SYSMGR_FPGAINTF_SPIM1	BIT(24)
+#define SYSMGR_FPGAINTF_EMAC0	BIT(0)
+#define SYSMGR_FPGAINTF_EMAC1	BIT(8)
+#define SYSMGR_FPGAINTF_EMAC2	BIT(16)
+
+#define SYSMGR_SDMMC_SMPLSEL_SHIFT	4
+#define SYSMGR_SDMMC_DRVSEL_SHIFT	0
+
+/* EMAC Group Bit definitions */
+#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII	0x0
+#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII		0x1
+#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII		0x2
+
+#define SYSMGR_EMACGRP_CTRL_PHYSEL0_LSB			0
+#define SYSMGR_EMACGRP_CTRL_PHYSEL1_LSB			2
+#define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK			0x3
+
+#define SYSMGR_NOC_H2F_MSK		0x00000001
+#define SYSMGR_NOC_LWH2F_MSK		0x00000010
+#define SYSMGR_HMC_CLK_STATUS_MSK	0x00000001
+
+#define SYSMGR_DMA_IRQ_NS		0xFF000000
+#define SYSMGR_DMA_MGR_NS		0x00010000
+
+#define SYSMGR_DMAPERIPH_ALL_NS		0xFFFFFFFF
+
+#define SYSMGR_WDDBG_PAUSE_ALL_CPU	0x0F0F0F0F
+
 #else
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
diff --git a/arch/arm/mach-socfpga/include/mach/system_manager_s10.h b/arch/arm/mach-socfpga/include/mach/system_manager_s10.h
index 297f9e1999..e80cb7aa7b 100644
--- a/arch/arm/mach-socfpga/include/mach/system_manager_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/system_manager_s10.h
@@ -7,14 +7,6 @@ 
 #ifndef	_SYSTEM_MANAGER_S10_
 #define	_SYSTEM_MANAGER_S10_
 
-void sysmgr_pinmux_init(void);
-void populate_sysmgr_fpgaintf_module(void);
-void populate_sysmgr_pinmux(void);
-void sysmgr_pinmux_table_sel(const u32 **table, unsigned int *table_len);
-void sysmgr_pinmux_table_ctrl(const u32 **table, unsigned int *table_len);
-void sysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len);
-void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len);
-
 struct socfpga_system_manager {
 	/* System Manager Module */
 	u32	siliconid1;			/* 0x00 */
@@ -135,42 +127,4 @@  struct socfpga_system_manager {
 
 };
 
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
-#define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO	BIT(1)
-#define SYSMGR_ECC_OCRAM_EN	BIT(0)
-#define SYSMGR_ECC_OCRAM_SERR	BIT(3)
-#define SYSMGR_ECC_OCRAM_DERR	BIT(4)
-#define SYSMGR_FPGAINTF_USEFPGA	0x1
-
-#define SYSMGR_FPGAINTF_NAND	BIT(4)
-#define SYSMGR_FPGAINTF_SDMMC	BIT(8)
-#define SYSMGR_FPGAINTF_SPIM0	BIT(16)
-#define SYSMGR_FPGAINTF_SPIM1	BIT(24)
-#define SYSMGR_FPGAINTF_EMAC0	BIT(0)
-#define SYSMGR_FPGAINTF_EMAC1	BIT(8)
-#define SYSMGR_FPGAINTF_EMAC2	BIT(16)
-
-#define SYSMGR_SDMMC_SMPLSEL_SHIFT	4
-#define SYSMGR_SDMMC_DRVSEL_SHIFT	0
-
-/* EMAC Group Bit definitions */
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_GMII_MII	0x0
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RGMII		0x1
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_ENUM_RMII		0x2
-
-#define SYSMGR_EMACGRP_CTRL_PHYSEL0_LSB			0
-#define SYSMGR_EMACGRP_CTRL_PHYSEL1_LSB			2
-#define SYSMGR_EMACGRP_CTRL_PHYSEL_MASK			0x3
-
-#define SYSMGR_NOC_H2F_MSK		0x00000001
-#define SYSMGR_NOC_LWH2F_MSK		0x00000010
-#define SYSMGR_HMC_CLK_STATUS_MSK	0x00000001
-
-#define SYSMGR_DMA_IRQ_NS		0xFF000000
-#define SYSMGR_DMA_MGR_NS		0x00010000
-
-#define SYSMGR_DMAPERIPH_ALL_NS		0xFFFFFFFF
-
-#define SYSMGR_WDDBG_PAUSE_ALL_CPU	0x0F0F0F0F
-
 #endif /* _SYSTEM_MANAGER_S10_ */