Skip to contentSkip to conversation

Further support for the kmp204x architecture

PATCH Superseded Valentin Longchamp 2 participants 12 messages Jan 13, 2014 – Jan 14, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Further support for the kmp204x architecture

This patch series refines the support for the kmp204x designs. The main additions are:
- further support of the QRIO CPLD (bootcounter and GPIO)
- support of the new kmcoge4 board based on kmp204x
- support of I2C deblocking
- support for FPGA configuration (PCIe FPGA)
- various fixes and smaller enhancements

Rainer Boschung (2):
kmp204x: support for QRIO1 bootcounter
kmp204x: I2C deblocking for I2C-bus1 added

Valentin Longchamp (7):
kmp204x: introduce QRIO GPIO functions
kmp204x: implement workaround for A-006559
kmp204x: add support for the kmcoge4 board
kmp204x: update I2C field of RCW
KM: add the KM_UBI_PART_BOOT_OPTS #define
kmp204x: enable support for SPANSION SPI NOR
kmp204x: initial support for PCIe FPGA configuration

 board/keymile/kmp204x/Makefile        |   2 +-
 board/keymile/kmp204x/kmp204x.c       | 124 ++++++++++++++--------------
 board/keymile/kmp204x/kmp204x.h       |  10 +++
 board/keymile/kmp204x/pbi.cfg         |  10 +++
 board/keymile/kmp204x/pci.c           |  85 ++++++++++++++++++++
 board/keymile/kmp204x/qrio.c          | 147 ++++++++++++++++++++++++++++++++++
 board/keymile/kmp204x/rcw_kmp204x.cfg |   2 +-
 boards.cfg                            |   1 +
 include/configs/km/keymile-common.h   |  10 ++-
 include/configs/km/kmp204x-common.h   |  15 ++++
 include/configs/kmp204x.h             |   7 +-
 11 files changed, 345 insertions(+), 68 deletions(-)
 create mode 100644 board/keymile/kmp204x/qrio.c
Signature · 1 line
1.8.0.1
#1 lore raw

PATCH 1/9 kmp204x: support for QRIO1 bootcounter

From: Rainer Boschung <[email protected]>

- make use of the QRIO1 32bit register at 0x20 as bootcounter register
- check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read

---

 board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
board/keymile/kmp204x/kmp204x.c +9 -6
index f02642a..b41929a 100644
@@ -134,22 +134,25 @@ void qrio_prstcfg(u8 bit, u8 mode)
 }
 
 
-#define BOOTCOUNT_OFF	0x12
+#define BOOTCOUNT_OFF	0x20
 
 void bootcount_store(ulong counter)
 {
-	u8 val;
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
 
-	val = (counter <= 255) ? (u8)counter : 255;
-	out_8(qrio_base + BOOTCOUNT_OFF, val);
+	out_be32(qrio_base + BOOTCOUNT_OFF, counter);
 }
 
 ulong bootcount_load(void)
 {
-	u8 val;
+	u32 val;
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-	val = in_8(qrio_base + BOOTCOUNT_OFF);
+	val = in_be32(qrio_base + BOOTCOUNT_OFF + 4);
+
+	if (val == BOOTCOUNT_MAGIC)
+		val = in_be32(qrio_base + BOOTCOUNT_OFF);
+	else
+		val = 0;
 	return val;
 }
 
Signature · 1 line
1.8.0.1
#2 lore raw

PATCH 1/9 kmp204x: support for QRIO1 bootcounter

Hi Valentin,

Quoted 38 lines · Valentin Longchamp

From: Rainer Boschung <[email protected]>

- make use of the QRIO1 32bit register at 0x20 as bootcounter register
- check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read

---

 board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
board/keymile/kmp204x/kmp204x.c +3 -5
index f02642a..b41929a 100644
@@ -134,22 +134,25 @@ void qrio_prstcfg(u8 bit, u8 mode)
 }
 
 
-#define BOOTCOUNT_OFF	0x12
+#define BOOTCOUNT_OFF	0x20
 
 void bootcount_store(ulong counter)
 {
-	u8 val;
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
 
-	val = (counter <= 255) ? (u8)counter : 255;
-	out_8(qrio_base + BOOTCOUNT_OFF, val);
+	out_be32(qrio_base + BOOTCOUNT_OFF, counter);
 }
 
 ulong bootcount_load(void)
 {
-	u8 val;
+	u32 val;

board/keymile/kmp204x/kmp204x.c void qrio_prstcfg(u8 bit, u8 mode) · line 157

Quoted 10 lines
board/keymile/kmp204x/kmp204x.c +6 -1
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-	val = in_8(qrio_base + BOOTCOUNT_OFF);
+	val = in_be32(qrio_base + BOOTCOUNT_OFF + 4);
+
+	if (val == BOOTCOUNT_MAGIC)
+		val = in_be32(qrio_base + BOOTCOUNT_OFF);
+	else
+		val = 0;
 	return val;
 }

Can't you just use the common bootcount driver (drivers/bootcount/bootcount.c) instead? Should be easy. Just define this in your config header:

#define CONFIG_BOOTCOUNT_LIMIT
#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_QRIO_BASE + 0x20)

Thanks,
Stefan

#3 lore raw

PATCH 1/9 kmp204x: support for QRIO1 bootcounter

Hi Stefan,

Quoted 56 lines · Stefan Roese

Hi Valentin,

Quoted 38 lines · Valentin Longchamp

From: Rainer Boschung <[email protected]>

- make use of the QRIO1 32bit register at 0x20 as bootcounter register
- check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read

---

 board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
board/keymile/kmp204x/kmp204x.c +3 -5
index f02642a..b41929a 100644
@@ -134,22 +134,25 @@ void qrio_prstcfg(u8 bit, u8 mode)
 }
 
 
-#define BOOTCOUNT_OFF	0x12
+#define BOOTCOUNT_OFF	0x20
 
 void bootcount_store(ulong counter)
 {
-	u8 val;
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
 
-	val = (counter <= 255) ? (u8)counter : 255;
-	out_8(qrio_base + BOOTCOUNT_OFF, val);
+	out_be32(qrio_base + BOOTCOUNT_OFF, counter);
 }
 
 ulong bootcount_load(void)
 {
-	u8 val;
+	u32 val;

board/keymile/kmp204x/kmp204x.c void qrio_prstcfg(u8 bit, u8 mode) · line 157

Quoted 10 lines
board/keymile/kmp204x/kmp204x.c +6 -1
 	void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-	val = in_8(qrio_base + BOOTCOUNT_OFF);
+	val = in_be32(qrio_base + BOOTCOUNT_OFF + 4);
+
+	if (val == BOOTCOUNT_MAGIC)
+		val = in_be32(qrio_base + BOOTCOUNT_OFF);
+	else
+		val = 0;
 	return val;
 }

Can't you just use the common bootcount driver (drivers/bootcount/bootcount.c) instead? Should be easy. Just define this in your config header:

Quoted 2 lines

#define CONFIG_BOOTCOUNT_LIMIT
#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_QRIO_BASE + 0x20)

Thanks for the input, I will use this.

Best regards

Valentin

#4 lore raw

PATCH 2/9 kmp204x: introduce QRIO GPIO functions

In reply to Valentin Longchamp

The QRIO GPIO functions can be of general interest. They are thus added to a qrio.c and their prototype are available from kmp204x.h. The QRIO prst function are also included in this file, as well as the functions required for the I2C deblocking support (open-drain).

---

 board/keymile/kmp204x/Makefile  |   2 +-
 board/keymile/kmp204x/kmp204x.c |  57 ----------------
 board/keymile/kmp204x/kmp204x.h |  10 +++
 board/keymile/kmp204x/qrio.c    | 147 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 158 insertions(+), 58 deletions(-)
 create mode 100644 board/keymile/kmp204x/qrio.c
board/keymile/kmp204x/Makefile +1 -1
index 3e69ee2..c57ca08 100644
@@ -8,5 +8,5 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-y	:= kmp204x.o ddr.o eth.o tlb.o pci.o law.o \
+obj-y	:= kmp204x.o ddr.o eth.o tlb.o pci.o law.o qrio.o \
 	../common/common.o ../common/ivm.o
board/keymile/kmp204x/kmp204x.c +0 -57

63 lines not on this page · raw message

board/keymile/kmp204x/kmp204x.h +10 -0
index b6ba672..0267596 100644
@@ -5,6 +5,16 @@
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
+/* QRIO GPIO ports */
+#define GPIO_A			0x40
+#define GPIO_B			0x60
+
+int qrio_get_gpio(u8 port_off, u8 gpio_nr);
+void qrio_set_opendrain_gpio(u8 port_off, u8 gpio_nr, u8 val);
+void qrio_set_gpio(u8 port_off, u8 gpio_nr, bool value);
+void qrio_gpio_direction_output(u8 port_off, u8 gpio_nr, bool value);
+void qrio_gpio_direction_input(u8 port_off, u8 gpio_nr);
+
 #define PRSTCFG_POWUP_UNIT_CORE_RST	0x0
 #define PRSTCFG_POWUP_UNIT_RST		0x1
 #define PRSTCFG_POWUP_RST		0x3
board/keymile/kmp204x/qrio.c new file +147 -0

147 lines not on this page · raw message

Signature · 1 line
1.8.0.1
#5 lore raw

PATCH 3/9 kmp204x: I2C deblocking for I2C-bus1 added

In reply to Valentin Longchamp

From: Rainer Boschung <[email protected]>

-uses common deblocking algorithm from ../common/common.c -supports deblocking of of I2C-bus1 by means of QRIO GPIO
- SCL1 = GPIO_A16
- SDA1 = GPIO_A17

QRIO GPIOs act in an open-drain-like manner, for 0 GPIO drives low and for 1 the GPIO is an input and must be pulled up externaly!

---

 board/keymile/kmp204x/kmp204x.c     | 53 ++++++++++++++++++++++++++++++++++---
 include/configs/km/kmp204x-common.h | 10 +++++++
 2 files changed, 60 insertions(+), 3 deletions(-)
board/keymile/kmp204x/kmp204x.c +50 -3
index dae5378..141d7ee 100644
@@ -33,12 +33,51 @@ int checkboard(void)
 	return 0;
 }
 
-/* TODO: implement the I2C deblocking function */
-int i2c_make_abort(void)
+/* I2C deblocking uses the algorithm defined in ../common/common.c, which
+ * makes use of 2 QRIO GPIOs to act on the SCL and SDA signals of an I2C bus.
+ * According to the standard I2C IOs must not drive HI-Levels, so the
+ * QRIO GPIOs are used in open-drain fashion:
+ *  -> 0 GPIO configured as output that drives low
+ *  -> 1 GPIO configured as input pull-up ties high
+ */
+
+/* GPIOs used for deblocking I2C bus 1 */
+#define DBLK_PORT1	GPIO_A
+#define DBLK_SCL1	16
+#define DBLK_SDA1	17
+
+/* By default deblock GPIOs are floating */
+static void i2c_deblock_gpio_cfg(void)
+{
+	/* set I2C bus 1 deblocking GPIOs input, but 0 value for open drain */
+	qrio_gpio_direction_input(DBLK_PORT1, DBLK_SCL1);
+	qrio_gpio_direction_input(DBLK_PORT1, DBLK_SDA1);
+
+	qrio_set_gpio(DBLK_PORT1, DBLK_SCL1, 0);
+	qrio_set_gpio(DBLK_PORT1, DBLK_SDA1, 0);
+}
+
+void set_sda(int state)
+{
+	qrio_set_opendrain_gpio(DBLK_PORT1, DBLK_SDA1, state);
+}
+
+void set_scl(int state)
+{
+	qrio_set_opendrain_gpio(DBLK_PORT1, DBLK_SCL1, state);
+}
+
+int get_sda(void)
+{
+	return qrio_get_gpio(DBLK_PORT1, DBLK_SDA1);
+}
+
+int get_scl(void)
 {
-	return 1;
+	return qrio_get_gpio(DBLK_PORT1, DBLK_SCL1);
 }
 
+
 #define ZL30158_RST	8
 #define ZL30343_RST	9
 
@@ -77,6 +116,14 @@ unsigned long get_board_sys_clk(unsigned long dummy)
 	return 66666666;
 }
 
+int misc_init_f(void)
+{
+	/* configure QRIO pis for i2c deblocking */
+	i2c_deblock_gpio_cfg();
+
+	return 0;
+}
+
 #define BOOTCOUNT_OFF	0x20
 
 void bootcount_store(ulong counter)
include/configs/km/kmp204x-common.h +10 -0
index 50330cc..b4242e5 100644
@@ -209,6 +209,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_BOARD_EARLY_INIT_R	/* call board_early_init_r function */
+#define CONFIG_MISC_INIT_F
 #define CONFIG_MISC_INIT_R
 #define CONFIG_LAST_STAGE_INIT
 
@@ -264,7 +265,10 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_FIT_VERBOSE	/* enable fit_format_{error,warning}() */
 
 /* I2C */
+
 #define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_SYS_I2C_SPEED		100000 /* deblocking */
 #define CONFIG_SYS_NUM_I2C_BUSES	3
 #define CONFIG_SYS_I2C_MAX_HOPS		1
 #define CONFIG_SYS_I2C_FSL		/* Use FSL I2C driver */
@@ -277,6 +281,12 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 					{0, {{I2C_MUX_PCA9547, 0x70, 1 } } }, \
 					{0, {{I2C_MUX_PCA9547, 0x70, 2 } } }, \
 				}
+#ifndef __ASSEMBLY__
+void set_sda(int state);
+void set_scl(int state);
+int get_sda(void);
+int get_scl(void);
+#endif
 
 #define CONFIG_KM_IVM_BUS		1	/* I2C1 (Mux-Port 1)*/
 
Signature · 1 line
1.8.0.1
#6 lore raw

PATCH 4/9 kmp204x: implement workaround for A-006559

In reply to Valentin Longchamp

According to the errata, some bits of an undocumented register in the DCSR must be set for every core in order to avoid a possible data or instruction corruption.

This is required for the 2.0 revision of the P2041 that should be used as soon as available in our design.

---

 board/keymile/kmp204x/pbi.cfg | 10 ++++++++++
 1 file changed, 10 insertions(+)
board/keymile/kmp204x/pbi.cfg +10 -0
index f38dcf9..9af8bd5 100644
@@ -8,6 +8,16 @@
 #
 
 #PBI commands
+#Workaround for A-006559 needed for rev 2.0 of P2041 silicon
+#Freescale's errarta sheet suggests it may be done with PBI
+09000010 00000000
+09000014 00000000
+09000018 81d00000
+09021008 0000f000
+09021028 0000f000
+09021048 0000f000
+09021068 0000f000
+09000018 00000000
 #Initialize CPC1 as 1MB SRAM
 09010000 00200400
 09138000 00000000
Signature · 1 line
1.8.0.1
#7 lore raw

PATCH 5/9 kmp204x: add support for the kmcoge4 board

In reply to Valentin Longchamp

The kmcoge4 board is the product board derived from the kmlion1 prototype. The main difference between the 2 boards is that the kmcoge4 does not configure the Local Bus controller for LCS2.

---

 boards.cfg                | 1 +
 include/configs/kmp204x.h | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
boards.cfg +1 -0
index d177f82..4198ccf 100644
@@ -991,6 +991,7 @@ Active  powerpc     mpc85xx        -           gdsys           p1022
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_TRAILBLAZER           controlcenterd:TRAILBLAZER,SPIFLASH                                                                                               Dirk Eibach <[email protected]>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_TRAILBLAZER_DEVELOP   controlcenterd:TRAILBLAZER,SPIFLASH,DEVELOP                                                                                       Dirk Eibach <[email protected]>
 Active  powerpc     mpc85xx        -           keymile         kmp204x             kmlion1                              kmp204x:KMLION1                                                                                                                   Valentin Longchamp <[email protected]>
+Active  powerpc     mpc85xx        -           keymile         kmp204x             kmcoge4                              kmp204x:KMCOGE4                                                                                                                   Valentin Longchamp <[email protected]>
 Active  powerpc     mpc85xx        -           stx             stxgp3              stxgp3                               -                                                                                                                                 Dan Malek <[email protected]>
 Active  powerpc     mpc85xx        -           stx             stxssa              stxssa                               stxssa                                                                                                                            Dan Malek <[email protected]>
 Active  powerpc     mpc85xx        -           stx             stxssa              stxssa_4M                            stxssa:STXSSA_4M                                                                                                                  Dan Malek <[email protected]>
include/configs/kmp204x.h +6 -1
index 4158c8d..8bb3571 100644
@@ -13,6 +13,11 @@
 #define CONFIG_HOSTNAME		kmlion1
 #define CONFIG_KM_BOARD_NAME	"kmlion1"
 
+/* KMCOGE4 */
+#elif defined(CONFIG_KMCOGE4)
+#define CONFIG_HOSTNAME		kmcoge4
+#define CONFIG_KM_BOARD_NAME	"kmcoge4"
+
 #else
 #error ("Board not supported")
 #endif
@@ -42,6 +47,7 @@
 #define CONFIG_SYS_BR2_PRELIM  CONFIG_SYS_LBAPP1_BR_PRELIM
 /* Local bus app1 Options */
 #define CONFIG_SYS_OR2_PRELIM  CONFIG_SYS_LBAPP1_OR_PRELIM
+#endif
 
 /* App2 Local bus */
 #define CONFIG_SYS_LBAPP2_BASE		0xE0000000
@@ -63,6 +69,5 @@
 #define CONFIG_SYS_BR3_PRELIM  CONFIG_SYS_LBAPP2_BR_PRELIM
 /* Local bus app2 Options */
 #define CONFIG_SYS_OR3_PRELIM  CONFIG_SYS_LBAPP2_OR_PRELIM
-#endif
 
 #endif	/* __CONFIG_H */
Signature · 1 line
1.8.0.1
#8 lore raw

PATCH 6/9 kmp204x: update I2C field of RCW

In reply to Valentin Longchamp

On the previous HW revision (now unsupported), there was a need for external DMA signals and thus the I2C3/4 signals were used DMA1_DONE/ACK/REQ.

These signals now are configured as GPIO[16:19].

---

 board/keymile/kmp204x/rcw_kmp204x.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/keymile/kmp204x/rcw_kmp204x.cfg +1 -1
index f2b7fe3..2d4c48c 100644
@@ -7,5 +7,5 @@ aa55aa55 010e0100
 #64 bytes RCW data
 14600000 00000000 28200000 00000000
 148E70CF CFC02000 58000000 41000000
-00000000 00000000 00000000 F4428002
+00000000 00000000 00000000 F0428002
 00000000 00000000 00000000 00000000
Signature · 1 line
1.8.0.1
#9 lore raw

PATCH 7/9 KM: add the KM_UBI_PART_BOOT_OPTS #define

In reply to Valentin Longchamp

This define can be used if the ubi boot partition (defined for all Keymile boards with KM_UBI_PARTITION_NAME_BOOT #define to ubi0) needs some additionnal boot options.

This is the case for the kmp204x boards since u-boot does not support NAND Flash subpage accesses on this platform, an additionnal argument that defines the VID offstet must be given to the kernel.

The UBI cmd line option now looks like this "ubi.mtd=ubi0,2048" on this platform.

---

 include/configs/km/keymile-common.h | 10 ++++++++--
 include/configs/km/kmp204x-common.h |  4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)
include/configs/km/keymile-common.h +8 -2
index 2a15ad4..a4e0f7c 100644
@@ -99,11 +99,16 @@
 #define CONFIG_KM_UBI_PARTITION_NAME_BOOT	"ubi0"
 #endif /* CONFIG_KM_UBI_PARTITION_NAME_BOOT */
 
+#ifndef CONFIG_KM_UBI_PART_BOOT_OPTS
+#define CONFIG_KM_UBI_PART_BOOT_OPTS		""
+#endif /* CONFIG_KM_UBI_PART_BOOT_OPTS */
+
 #ifndef CONFIG_KM_UBI_PARTITION_NAME_APP
 /* one flash chip only called boot */
 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
 # define CONFIG_KM_UBI_LINUX_MTD					\
-	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT
+	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT			\
+	CONFIG_KM_UBI_PART_BOOT_OPTS
 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
 	"ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME_BOOT "\0"
 #else /* CONFIG_KM_UBI_PARTITION_NAME_APP */
@@ -111,7 +116,8 @@
 /* boot: CONFIG_KM_UBI_PARTITION_NAME_BOOT */
 /* app:  CONFIG_KM_UBI_PARTITION_NAME_APP */
 # define CONFIG_KM_UBI_LINUX_MTD					\
-	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT " "		\
+	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_BOOT			\
+	CONFIG_KM_UBI_PART_BOOT_OPTS " "				\
 	"ubi.mtd=" CONFIG_KM_UBI_PARTITION_NAME_APP
 # define CONFIG_KM_DEV_ENV_FLASH_BOOT_UBI				\
 	"ubiattach=if test ${boot_bank} -eq 0; then; "			\
include/configs/km/kmp204x-common.h +4 -0
index b4242e5..935aa7e 100644
@@ -15,6 +15,10 @@
 
 #define CONFIG_KM_DEF_NETDEV	"netdev=eth0\0"
 
+/* an additionnal option is required for UBI as subpage access is
+ * supported in u-boot */
+#define CONFIG_KM_UBI_PART_BOOT_OPTS		",2048"
+
 #define CONFIG_NAND_ECC_BCH
 
 /* common KM defines */
Signature · 1 line
1.8.0.1
#10 lore raw

PATCH 8/9 kmp204x: enable support for SPANSION SPI NOR

In reply to Valentin Longchamp

The new prototype and the final series was moved from Micron to Spansion to have a better reset sequence that is easier to support.

---

 include/configs/km/kmp204x-common.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/km/kmp204x-common.h +1 -0
index 935aa7e..f0e7d15 100644
@@ -301,6 +301,7 @@ int get_scl(void);
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_BAR	/* 4 byte-addressing */
 #define CONFIG_SPI_FLASH_STMICRO
+#define CONFIG_SPI_FLASH_SPANSION
 #define CONFIG_CMD_SF
 #define CONFIG_SF_DEFAULT_SPEED         20000000
 #define CONFIG_SF_DEFAULT_MODE          0
Signature · 1 line
1.8.0.1
#11 lore raw

PATCH 9/9 kmp204x: initial support for PCIe FPGA configuration

In reply to Valentin Longchamp

The PEXHC PCIe configuration mechanism ensures that the FPGA get configured at power-up. Since all the PCIe devices should be configured when the kernel start, u-boot has to take care that the FPGA gets configured also in other reset scenarios, mostly because of possible configuration change.

The used mechanism is taken from the km_kirkwood design and adapted to the kmp204x case (slightly different HW and PCIe configuration).

---

 board/keymile/kmp204x/kmp204x.c |  7 +++-
 board/keymile/kmp204x/pci.c     | 85 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)
board/keymile/kmp204x/kmp204x.c +6 -1
index 141d7ee..4814efb 100644
@@ -101,6 +101,7 @@ int board_early_init_f(void)
 
 int board_early_init_r(void)
 {
+	int ret = 0;
 	/* Flush d-cache and invalidate i-cache of any FLASH data */
 	flush_dcache();
 	invalidate_icache();
@@ -108,7 +109,11 @@ int board_early_init_r(void)
 	set_liodns();
 	setup_portals();
 
-	return 0;
+	ret = trigger_fpga_config();
+	if (ret)
+		printf("error triggering PCIe FPGA config\n");
+
+	return ret;
 }
 
 unsigned long get_board_sys_clk(unsigned long dummy)
board/keymile/kmp204x/pci.c +85 -0

103 lines not on this page · raw message

Signature · 1 line
1.8.0.1