Skip to contentSkip to conversation

armv7: Add CPLD support via IFC to the ls1021a-iot board.

PATCH Superseded Mateus Lima Alves 3 participants 8 messages Jan 13 – Jan 28 Char and misc drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 armv7: Add CPLD support via IFC to the ls1021a-iot board.

This patch adds CPLD support via IFC to the ls1021a-iot board.

---
Changes since v1:
Reselected CONFIG_CMD_MII in file configs/ls1021aiot_sdcard_defconfig.

---
 board/freescale/ls1021aiot/ls1021aiot.c |  5 ++++
 configs/ls1021aiot_sdcard_defconfig     |  1 +
 drivers/misc/Kconfig                    |  6 ++++-
 include/configs/ls1021aiot.h            | 34 +++++++++++++++++++++++++
 4 files changed, 45 insertions(+), 1 deletion(-)
board/freescale/ls1021aiot/ls1021aiot.c +5 -0
index 4eff0a3fee0..52a3c3abdb4 100644
@@ -21,6 +21,7 @@
 #include <asm/sections.h>
 #include <fsl_csu.h>
 #include <fsl_immap.h>
+#include <fsl_ifc.h>
 #include <netdev.h>
 #include <fsl_mdio.h>
 #include <tsec.h>
@@ -120,6 +121,10 @@ int board_early_init_f(void)
 
 #endif
 
+#ifdef CONFIG_FSL_IFC
+	init_early_memctl_regs();
+#endif
+
 	arch_soc_init();
 
 	return 0;
configs/ls1021aiot_sdcard_defconfig +1 -0
index 6b32150e408..78b81c1895e 100644
@@ -106,3 +106,4 @@ CONFIG_FSL_QSPI=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
+CONFIG_FSL_IFC=y
drivers/misc/Kconfig +5 -1
index dde773ab6b1..229a50f266f 100644
@@ -694,7 +694,11 @@ config ESM_PMIC
 	  typically to reboot the board in error condition.
 
 config FSL_IFC
-	bool
+	bool "Freescale Integrated Flash Controller"
+	help
+	  This driver is for the Integrated Flash Controller(IFC) module
+	  available in Freescale SoCs. This controller allows to handle
+	  devices such as NOR, NAND, FPGA and ASIC etc.
 
 config SL28CPLD
 	bool "Enable Kontron sl28cpld multi-function driver"
include/configs/ls1021aiot.h +34 -0
index 971a393817a..59acf00b8e5 100644
@@ -44,6 +44,40 @@
 #define CFG_SYS_DDR_SDRAM_BASE	0x80000000UL
 #define CFG_SYS_SDRAM_BASE		CFG_SYS_DDR_SDRAM_BASE
 
+/* CPLD */
+
+#define CFG_SYS_CPLD_BASE              0x7fb00000
+#define CPLD_BASE_PHYS                 CFG_SYS_CPLD_BASE
+
+#define CFG_SYS_FPGA_CSPR_EXT          (0x0)
+#define CFG_SYS_FPGA_CSPR              (CSPR_PHYS_ADDR(CPLD_BASE_PHYS) | \
+                                        CSPR_PORT_SIZE_8 | \
+                                        CSPR_MSEL_GPCM | \
+                                        CSPR_V)
+#define CFG_SYS_FPGA_AMASK             IFC_AMASK(64 * 1024)
+#define CFG_SYS_FPGA_CSOR              (CSOR_NOR_ADM_SHIFT(4) | \
+                                        CSOR_NOR_NOR_MODE_AVD_NOR | \
+                                        CSOR_NOR_TRHZ_80)
+
+/* CPLD Timing parameters for IFC GPCM */
+#define CFG_SYS_FPGA_FTIM0             (FTIM0_GPCM_TACSE(0xf) | \
+                                        FTIM0_GPCM_TEADC(0xf) | \
+                                        FTIM0_GPCM_TEAHC(0xf))
+#define CFG_SYS_FPGA_FTIM1             (FTIM1_GPCM_TACO(0xff) | \
+                                        FTIM1_GPCM_TRAD(0x3f))
+#define CFG_SYS_FPGA_FTIM2             (FTIM2_GPCM_TCS(0xf) | \
+                                        FTIM2_GPCM_TCH(0xf) | \
+                                        FTIM2_GPCM_TWP(0xff))
+#define CFG_SYS_FPGA_FTIM3             0x0
+#define CFG_SYS_CSPR0_EXT              CFG_SYS_FPGA_CSPR_EXT
+#define CFG_SYS_CSPR0                  CFG_SYS_FPGA_CSPR
+#define CFG_SYS_AMASK0                 CFG_SYS_FPGA_AMASK
+#define CFG_SYS_CSOR0                  CFG_SYS_FPGA_CSOR
+#define CFG_SYS_CS0_FTIM0              CFG_SYS_FPGA_FTIM0
+#define CFG_SYS_CS0_FTIM1              CFG_SYS_FPGA_FTIM1
+#define CFG_SYS_CS0_FTIM2              CFG_SYS_FPGA_FTIM2
+#define CFG_SYS_CS0_FTIM3              CFG_SYS_FPGA_FTIM3
+
 /*
  * Serial Port
  */
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or directory
16 | #include <asm/ppc.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o] Error 1 make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Regards
Peng

#2 lore raw
Quoted 20 lines · Peng Fan
Quoted 3 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or directory
16 | #include <asm/ppc.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o] Error 1 make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o
Quoted 7 lines

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the patch on other targets.
In fact, this driver was not being used by any target (neither ARM nor PPC) and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

For now, I am thinking of submitting a v3 of the patch adding an explicit dependency on ARM, something like:

+ depends on ARM

This way we would avoid building the driver for PPC targets. What do you think about this approach?

Thanks again for the report and the feedback.

BR,
Mateus

#3 lore raw
Quoted 43 lines · Mateus Lima
Quoted 20 lines · Peng Fan
Quoted 3 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or directory
16 | #include <asm/ppc.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o] Error 1 make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o
Quoted 7 lines

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the patch on other targets.
In fact, this driver was not being used by any target (neither ARM nor PPC) and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

For now, I am thinking of submitting a v3 of the patch adding an explicit dependency on ARM, something like:

+ depends on ARM

Quoted 8 lines

This way we would avoid building the driver for PPC targets. What do you think about this approach?

Thanks again for the report and the feedback.

BR,
Mateus

Hi Peng,

I have just run a pipeline in the U-Boot Azure DevOps environment and all targets were built successfully. Please take a look:

https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12700&view=results

Could you please let me know what you did differently that caused the build to fail?

BR,
Mateus

#4 lore raw
In reply to Mateus Lima
Quoted 38 lines · Mateus Lima
Quoted 20 lines · Peng Fan
Quoted 3 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or directory
16 | #include <asm/ppc.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o] Error 1 make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o
Quoted 7 lines

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the patch on other targets.
In fact, this driver was not being used by any target (neither ARM nor PPC) and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

Quoted 7 lines

For now, I am thinking of submitting a v3 of the patch adding an explicit dependency on ARM, something like:

+ depends on ARM

This way we would avoid building the driver for PPC targets. What do you think about this approach?

It should be ok.

Thanks,
Peng

Quoted 5 lines

Thanks again for the report and the feedback.

BR,
Mateus

#5 lore raw
Quoted 42 lines · Peng Fan
Quoted 41 lines · Mateus Lima
Quoted 20 lines · Peng Fan
Quoted 3 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or directory
16 | #include <asm/ppc.h>

      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o] Error 1 make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o
Quoted 7 lines

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the patch on other targets.
In fact, this driver was not being used by any target (neither ARM nor PPC) and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

For now, I am thinking of submitting a v3 of the patch adding an explicit dependency on ARM, something like:

Quoted 6 lines
Quoted 4 lines

+ depends on ARM

This way we would avoid building the driver for PPC targets. What do you think about this approach?

It should be ok.

This has lead to:
WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

For example on P1010RDB-PB_SPIFLASH.

Signature · 1 line
Tom
#6 lore raw
Quoted 66 lines · Tom Rini
Quoted 6 lines · Peng Fan
Quoted 5 lines · Mateus Lima
Quoted 3 lines · Peng Fan
Quoted 2 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or

directory

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
   16 | #include <asm/ppc.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o]

Error 1

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the

patch on

Quoted 2 lines
Quoted 2 lines

other targets.
In fact, this driver was not being used by any target (neither ARM nor

PPC)

Quoted 5 lines
Quoted 5 lines

and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

For now, I am thinking of submitting a v3 of the patch adding an

explicit

Quoted 8 lines
Quoted 6 lines

dependency on ARM, something like:

+ depends on ARM

This way we would avoid building the driver for PPC targets. What do you think about this approach?

It should be ok.

This has lead to:
WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

Quoted 5 lines

For example on P1010RDB-PB_SPIFLASH.

--
Tom

Hi Tom,

Yes, I noticed that this warning is appearing now, and before this patch, neither this flag nor fsl_ifc were properly used for compiling PPC targets. Now that I've added more information about this option, it's being considered again during compilation.

But in this thread, I commented to Peng Fan that it was possible to build for PPC targets, meaning we wouldn't need to restrict this to ARM targets, but I don't know what setup was used to crash the mentioned PPC target, but in the U-Boot Azure DevOps environment, all targets were built successfully.

https://dev.azure.com/u-boot/u-boot/_build/results?buildId=12700&view=results

We can use patch v2 in this case, or could Peng Fan please show me how he made his build break? Is it a different environment?

BR,
Mateus

#7 lore raw
Quoted 68 lines · Mateus Lima
Quoted 66 lines · Tom Rini
Quoted 6 lines · Peng Fan
Quoted 5 lines · Mateus Lima
Quoted 3 lines · Peng Fan
Quoted 2 lines · Mateus Lima Alves

This patch adds CPLD support via IFC to the ls1021a-iot board.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 1 line

CI report build failure.

CC drivers/video/hitachi-tx10d07vm0baa.o
In file included from drivers/misc/fsl_ifc.c:8:
include/fsl_ifc.h:16:10: fatal error: asm/ppc.h: No such file or

directory

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
   16 | #include <asm/ppc.h>
      |          ^~~~~~~~~~~

compilation terminated.
make[3]: *** [scripts/Makefile.build:271: drivers/misc/fsl_ifc.o]

Error 1

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

make[2]: *** [scripts/Makefile.build:492: drivers/misc] Error 2 make[2]: *** Waiting for unfinished jobs....

  CC      drivers/rtc/ht1380.o
  CC      drivers/video/hitachi_tx18d42vm_lcd.o
  CC      drivers/rtc/i2c_rtc_emul.o

make[1]: *** [Makefile:2191: drivers] Error 2
make: *** [Makefile:362: __build_one_by_one] Error 2 Cleaning up project directory and file based variables

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

Regards
Peng

Hi Peng,

Thank you for the test, and apologies for not having validated the

patch on

Quoted 2 lines
Quoted 2 lines

other targets.
In fact, this driver was not being used by any target (neither ARM nor

PPC)

Quoted 5 lines
Quoted 5 lines

and after this patch it became enabled again. However, PPC targets fail when trying to include the asm/ppc.h header, which is not available for some reason.

For now, I am thinking of submitting a v3 of the patch adding an

explicit

Quoted 8 lines
Quoted 6 lines

dependency on ARM, something like:

+ depends on ARM

This way we would avoid building the driver for PPC targets. What do you think about this approach?

It should be ok.

This has lead to:
WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

WARNING: unmet direct dependencies detected for FSL_IFC
Depends on [n]: ARM [=n]
Selected by [y]:
- ARCH_P1010 [=y] && PPC [=y] && MPC85xx [=y]

Quoted 8 lines
Quoted 5 lines

For example on P1010RDB-PB_SPIFLASH.

--
Tom

Hi Tom,

Yes, I noticed that this warning is appearing now, and before this patch,

I'm not sure what you mean by this. This change introduced the warning.

Signature · 1 line
Tom