* [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture
@ 2014-01-13 16:29 Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
` (8 more replies)
0 siblings, 9 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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
--
1.8.0.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-14 6:58 ` Stefan Roese
2014-01-13 16:29 ` [U-Boot] [PATCH 2/9] kmp204x: introduce QRIO GPIO functions Valentin Longchamp
` (7 subsequent siblings)
8 siblings, 1 reply; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
From: Rainer Boschung <rainer.boschung@keymile.com>
- make use of the QRIO1 32bit register at 0x20 as bootcounter register
- check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read
Signed-off-by: Rainer Boschung <rainer.boschung@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index f02642a..b41929a 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -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;
}
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 2/9] kmp204x: introduce QRIO GPIO functions
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 3/9] kmp204x: I2C deblocking for I2C-bus1 added Valentin Longchamp
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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).
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
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
diff --git a/board/keymile/kmp204x/Makefile b/board/keymile/kmp204x/Makefile
index 3e69ee2..c57ca08 100644
--- a/board/keymile/kmp204x/Makefile
+++ b/board/keymile/kmp204x/Makefile
@@ -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
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index b41929a..dae5378 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -77,63 +77,6 @@ unsigned long get_board_sys_clk(unsigned long dummy)
return 66666666;
}
-#define WDMASK_OFF 0x16
-
-static void qrio_wdmask(u8 bit, bool wden)
-{
- u16 wdmask;
- void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-
- wdmask = in_be16(qrio_base + WDMASK_OFF);
-
- if (wden)
- wdmask |= (1 << bit);
- else
- wdmask &= ~(1 << bit);
-
- out_be16(qrio_base + WDMASK_OFF, wdmask);
-}
-
-#define PRST_OFF 0x1a
-
-void qrio_prst(u8 bit, bool en, bool wden)
-{
- u16 prst;
- void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-
- qrio_wdmask(bit, wden);
-
- prst = in_be16(qrio_base + PRST_OFF);
-
- if (en)
- prst &= ~(1 << bit);
- else
- prst |= (1 << bit);
-
- out_be16(qrio_base + PRST_OFF, prst);
-}
-
-#define PRSTCFG_OFF 0x1c
-
-void qrio_prstcfg(u8 bit, u8 mode)
-{
- u32 prstcfg;
- u8 i;
- void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
-
- prstcfg = in_be32(qrio_base + PRSTCFG_OFF);
-
- for (i = 0; i < 2; i++) {
- if (mode & (1<<i))
- set_bit(2*bit+i, &prstcfg);
- else
- clear_bit(2*bit+i, &prstcfg);
- }
-
- out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
-}
-
-
#define BOOTCOUNT_OFF 0x20
void bootcount_store(ulong counter)
diff --git a/board/keymile/kmp204x/kmp204x.h b/board/keymile/kmp204x/kmp204x.h
index b6ba672..0267596 100644
--- a/board/keymile/kmp204x/kmp204x.h
+++ b/board/keymile/kmp204x/kmp204x.h
@@ -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
diff --git a/board/keymile/kmp204x/qrio.c b/board/keymile/kmp204x/qrio.c
new file mode 100644
index 0000000..e6b3521
--- /dev/null
+++ b/board/keymile/kmp204x/qrio.c
@@ -0,0 +1,147 @@
+/*
+ * (C) Copyright 2013 Keymile AG
+ * Valentin Longchamp <valentin.longchamp@keymile.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+
+#include "../common/common.h"
+#include "kmp204x.h"
+
+/* QRIO GPIO register offsets */
+#define DIRECT_OFF 0x18
+#define GPRT_OFF 0x1c
+
+int qrio_get_gpio(u8 port_off, u8 gpio_nr)
+{
+ u32 gprt;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ gprt = in_be32(qrio_base + port_off + GPRT_OFF);
+
+ return (gprt >> gpio_nr) & 1U;
+}
+
+void qrio_set_gpio(u8 port_off, u8 gpio_nr, bool value)
+{
+ u32 gprt, mask;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ mask = 1U << gpio_nr;
+
+ gprt = in_be32(qrio_base + port_off + GPRT_OFF);
+ if (value)
+ gprt |= mask;
+ else
+ gprt &= ~mask;
+
+ out_be32(qrio_base + port_off + GPRT_OFF, gprt);
+}
+
+void qrio_gpio_direction_output(u8 port_off, u8 gpio_nr, bool value)
+{
+ u32 direct, mask;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ mask = 1U << gpio_nr;
+
+ direct = in_be32(qrio_base + port_off + DIRECT_OFF);
+ direct |= mask;
+ out_be32(qrio_base + port_off + DIRECT_OFF, direct);
+
+ qrio_set_gpio(port_off, gpio_nr, value);
+}
+
+void qrio_gpio_direction_input(u8 port_off, u8 gpio_nr)
+{
+ u32 direct, mask;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ mask = 1U << gpio_nr;
+
+ direct = in_be32(qrio_base + port_off + DIRECT_OFF);
+ direct &= ~mask;
+ out_be32(qrio_base + port_off + DIRECT_OFF, direct);
+}
+
+void qrio_set_opendrain_gpio(u8 port_off, u8 gpio_nr, u8 val)
+{
+ u32 direct, mask;
+
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ mask = 1U << gpio_nr;
+
+ direct = in_be32(qrio_base + port_off + DIRECT_OFF);
+ if (val == 0)
+ /* set to output -> GPIO drives low */
+ direct |= mask;
+ else
+ /* set to input -> GPIO floating */
+ direct &= ~mask;
+
+ out_be32(qrio_base + port_off + DIRECT_OFF, direct);
+}
+
+#define WDMASK_OFF 0x16
+
+static void qrio_wdmask(u8 bit, bool wden)
+{
+ u16 wdmask;
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ wdmask = in_be16(qrio_base + WDMASK_OFF);
+
+ if (wden)
+ wdmask |= (1 << bit);
+ else
+ wdmask &= ~(1 << bit);
+
+ out_be16(qrio_base + WDMASK_OFF, wdmask);
+}
+
+#define PRST_OFF 0x1a
+
+void qrio_prst(u8 bit, bool en, bool wden)
+{
+ u16 prst;
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ qrio_wdmask(bit, wden);
+
+ prst = in_be16(qrio_base + PRST_OFF);
+
+ if (en)
+ prst &= ~(1 << bit);
+ else
+ prst |= (1 << bit);
+
+ out_be16(qrio_base + PRST_OFF, prst);
+}
+
+#define PRSTCFG_OFF 0x1c
+
+void qrio_prstcfg(u8 bit, u8 mode)
+{
+ u32 prstcfg;
+ u8 i;
+ void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE;
+
+ prstcfg = in_be32(qrio_base + PRSTCFG_OFF);
+
+ for (i = 0; i < 2; i++) {
+ if (mode & (1<<i))
+ set_bit(2*bit+i, &prstcfg);
+ else
+ clear_bit(2*bit+i, &prstcfg);
+ }
+
+ out_be32(qrio_base + PRSTCFG_OFF, prstcfg);
+}
+
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 3/9] kmp204x: I2C deblocking for I2C-bus1 added
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 2/9] kmp204x: introduce QRIO GPIO functions Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 4/9] kmp204x: implement workaround for A-006559 Valentin Longchamp
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
From: Rainer Boschung <rainer.boschung@keymile.com>
-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!
Signed-off-by: Rainer Boschung <rainer.boschung@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
board/keymile/kmp204x/kmp204x.c | 53 ++++++++++++++++++++++++++++++++++---
include/configs/km/kmp204x-common.h | 10 +++++++
2 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index dae5378..141d7ee 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -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)
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 50330cc..b4242e5 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -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)*/
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 4/9] kmp204x: implement workaround for A-006559
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (2 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 3/9] kmp204x: I2C deblocking for I2C-bus1 added Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 5/9] kmp204x: add support for the kmcoge4 board Valentin Longchamp
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
board/keymile/kmp204x/pbi.cfg | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/board/keymile/kmp204x/pbi.cfg b/board/keymile/kmp204x/pbi.cfg
index f38dcf9..9af8bd5 100644
--- a/board/keymile/kmp204x/pbi.cfg
+++ b/board/keymile/kmp204x/pbi.cfg
@@ -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
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 5/9] kmp204x: add support for the kmcoge4 board
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (3 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 4/9] kmp204x: implement workaround for A-006559 Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 6/9] kmp204x: update I2C field of RCW Valentin Longchamp
` (3 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
boards.cfg | 1 +
include/configs/kmp204x.h | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/boards.cfg b/boards.cfg
index d177f82..4198ccf 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -991,6 +991,7 @@ Active powerpc mpc85xx - gdsys p1022
Active powerpc mpc85xx - gdsys p1022 controlcenterd_TRAILBLAZER controlcenterd:TRAILBLAZER,SPIFLASH Dirk Eibach <eibach@gdsys.de>
Active powerpc mpc85xx - gdsys p1022 controlcenterd_TRAILBLAZER_DEVELOP controlcenterd:TRAILBLAZER,SPIFLASH,DEVELOP Dirk Eibach <eibach@gdsys.de>
Active powerpc mpc85xx - keymile kmp204x kmlion1 kmp204x:KMLION1 Valentin Longchamp <valentin.longchamp@keymile.com>
+Active powerpc mpc85xx - keymile kmp204x kmcoge4 kmp204x:KMCOGE4 Valentin Longchamp <valentin.longchamp@keymile.com>
Active powerpc mpc85xx - stx stxgp3 stxgp3 - Dan Malek <dan@embeddedalley.com>
Active powerpc mpc85xx - stx stxssa stxssa stxssa Dan Malek <dan@embeddedalley.com>
Active powerpc mpc85xx - stx stxssa stxssa_4M stxssa:STXSSA_4M Dan Malek <dan@embeddedalley.com>
diff --git a/include/configs/kmp204x.h b/include/configs/kmp204x.h
index 4158c8d..8bb3571 100644
--- a/include/configs/kmp204x.h
+++ b/include/configs/kmp204x.h
@@ -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 */
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 6/9] kmp204x: update I2C field of RCW
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (4 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 5/9] kmp204x: add support for the kmcoge4 board Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 7/9] KM: add the KM_UBI_PART_BOOT_OPTS #define Valentin Longchamp
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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].
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
board/keymile/kmp204x/rcw_kmp204x.cfg | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/keymile/kmp204x/rcw_kmp204x.cfg b/board/keymile/kmp204x/rcw_kmp204x.cfg
index f2b7fe3..2d4c48c 100644
--- a/board/keymile/kmp204x/rcw_kmp204x.cfg
+++ b/board/keymile/kmp204x/rcw_kmp204x.cfg
@@ -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
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 7/9] KM: add the KM_UBI_PART_BOOT_OPTS #define
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (5 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 6/9] kmp204x: update I2C field of RCW Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 8/9] kmp204x: enable support for SPANSION SPI NOR Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 9/9] kmp204x: initial support for PCIe FPGA configuration Valentin Longchamp
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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.
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
include/configs/km/keymile-common.h | 10 ++++++++--
include/configs/km/kmp204x-common.h | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h
index 2a15ad4..a4e0f7c 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -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; " \
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index b4242e5..935aa7e 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -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 */
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 8/9] kmp204x: enable support for SPANSION SPI NOR
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (6 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 7/9] KM: add the KM_UBI_PART_BOOT_OPTS #define Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 9/9] kmp204x: initial support for PCIe FPGA configuration Valentin Longchamp
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
The new prototype and the final series was moved from Micron to Spansion
to have a better reset sequence that is easier to support.
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
include/configs/km/kmp204x-common.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/configs/km/kmp204x-common.h b/include/configs/km/kmp204x-common.h
index 935aa7e..f0e7d15 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -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
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 9/9] kmp204x: initial support for PCIe FPGA configuration
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
` (7 preceding siblings ...)
2014-01-13 16:29 ` [U-Boot] [PATCH 8/9] kmp204x: enable support for SPANSION SPI NOR Valentin Longchamp
@ 2014-01-13 16:29 ` Valentin Longchamp
8 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-13 16:29 UTC (permalink / raw)
To: u-boot
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).
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
board/keymile/kmp204x/kmp204x.c | 7 +++-
board/keymile/kmp204x/pci.c | 85 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 91 insertions(+), 1 deletion(-)
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 141d7ee..4814efb 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -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)
diff --git a/board/keymile/kmp204x/pci.c b/board/keymile/kmp204x/pci.c
index ec20c8a..a484eb5 100644
--- a/board/keymile/kmp204x/pci.c
+++ b/board/keymile/kmp204x/pci.c
@@ -14,18 +14,103 @@
#include <libfdt.h>
#include <fdt_support.h>
#include <asm/fsl_serdes.h>
+#include <asm/errno.h>
#include "kmp204x.h"
+#define PROM_SEL_L 11
+/* control the PROM_SEL_L signal*/
+static void toggle_fpga_eeprom_bus(bool cpu_own)
+{
+ qrio_gpio_direction_output(GPIO_A, PROM_SEL_L, !cpu_own);
+}
+
+#define CONF_SEL_L 10
+#define FPGA_PROG_L 19
+#define FPGA_DONE 18
+#define FPGA_INIT_L 17
+
+int trigger_fpga_config(void)
+{
+ int ret = 0, init_l;
+ /* approx 10ms */
+ u32 timeout = 10000;
+
+ /* make sure the FPGA_can access the EEPROM */
+ toggle_fpga_eeprom_bus(false);
+
+ /* assert CONF_SEL_L to be able to drive FPGA_PROG_L */
+ qrio_gpio_direction_output(GPIO_A, CONF_SEL_L, 0);
+
+ /* trigger the config start */
+ qrio_gpio_direction_output(GPIO_A, FPGA_PROG_L, 0);
+
+ /* small delay for INIT_L line */
+ udelay(10);
+
+ /* wait for FPGA_INIT to be asserted */
+ do {
+ init_l = qrio_get_gpio(GPIO_A, FPGA_INIT_L);
+ if (timeout-- == 0) {
+ printf("FPGA_INIT timeout\n");
+ ret = -EFAULT;
+ break;
+ }
+ udelay(10);
+ } while (init_l);
+
+ /* deassert FPGA_PROG, config should start */
+ qrio_set_gpio(GPIO_A, FPGA_PROG_L, 1);
+
+ return ret;
+}
+
+/* poll the FPGA_DONE signal and give the EEPROM back to the QorIQ */
+static int wait_for_fpga_config(void)
+{
+ int ret = 0, done;
+ /* approx 5 s */
+ u32 timeout = 500000;
+
+ printf("PCIe FPGA config:");
+ do {
+ done = qrio_get_gpio(GPIO_A, FPGA_DONE);
+ if (timeout-- == 0) {
+ printf(" FPGA_DONE timeout\n");
+ ret = -EFAULT;
+ goto err_out;
+ }
+ udelay(10);
+ } while (!done);
+
+ printf(" done\n");
+
+err_out:
+ /* deactive CONF_SEL and give the CPU conf EEPROM access */
+ qrio_set_gpio(GPIO_A, CONF_SEL_L, 1);
+ toggle_fpga_eeprom_bus(true);
+
+ return ret;
+}
+
#define PCIE_SW_RST 14
+#define PEXHC_SW_RST 13
#define HOOPER_SW_RST 12
void pci_init_board(void)
{
+ /* first wait for the PCIe FPGA to be configured
+ * it has been triggered earlier in board_early_init_r */
+ int ret = wait_for_fpga_config();
+ if (ret)
+ printf("error finishing PCIe FPGA config\n");
+
qrio_prst(PCIE_SW_RST, false, false);
+ qrio_prst(PEXHC_SW_RST, false, false);
qrio_prst(HOOPER_SW_RST, false, false);
/* Hooper is not direcly PCIe capable */
mdelay(50);
+
fsl_pcie_init_board(0);
}
--
1.8.0.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
@ 2014-01-14 6:58 ` Stefan Roese
2014-01-14 8:29 ` Valentin Longchamp
0 siblings, 1 reply; 12+ messages in thread
From: Stefan Roese @ 2014-01-14 6:58 UTC (permalink / raw)
To: u-boot
Hi Valentin,
On 13.01.2014 17:29, Valentin Longchamp wrote:
> From: Rainer Boschung <rainer.boschung@keymile.com>
>
> - make use of the QRIO1 32bit register at 0x20 as bootcounter register
> - check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read
>
> Signed-off-by: Rainer Boschung <rainer.boschung@keymile.com>
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
>
> board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
> index f02642a..b41929a 100644
> --- a/board/keymile/kmp204x/kmp204x.c
> +++ b/board/keymile/kmp204x/kmp204x.c
> @@ -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;
> }
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter
2014-01-14 6:58 ` Stefan Roese
@ 2014-01-14 8:29 ` Valentin Longchamp
0 siblings, 0 replies; 12+ messages in thread
From: Valentin Longchamp @ 2014-01-14 8:29 UTC (permalink / raw)
To: u-boot
Hi Stefan,
On 01/14/2014 07:58 AM, Stefan Roese wrote:
> Hi Valentin,
>
> On 13.01.2014 17:29, Valentin Longchamp wrote:
>> From: Rainer Boschung <rainer.boschung@keymile.com>
>>
>> - make use of the QRIO1 32bit register at 0x20 as bootcounter register
>> - check for BOOTCOUNT_MAGIC pattern when before bootcounter value is read
>>
>> Signed-off-by: Rainer Boschung <rainer.boschung@keymile.com>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
>> Acked-by: Valentin Longchamp <valentin.longchamp@keymile.com>
>> ---
>>
>> board/keymile/kmp204x/kmp204x.c | 15 +++++++++------
>> 1 file changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
>> index f02642a..b41929a 100644
>> --- a/board/keymile/kmp204x/kmp204x.c
>> +++ b/board/keymile/kmp204x/kmp204x.c
>> @@ -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;
>> }
>
> 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 for the input, I will use this.
Best regards
Valentin
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-01-14 8:29 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 16:29 [U-Boot] [PATCH 0/9] Further support for the kmp204x architecture Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 1/9] kmp204x: support for QRIO1 bootcounter Valentin Longchamp
2014-01-14 6:58 ` Stefan Roese
2014-01-14 8:29 ` Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 2/9] kmp204x: introduce QRIO GPIO functions Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 3/9] kmp204x: I2C deblocking for I2C-bus1 added Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 4/9] kmp204x: implement workaround for A-006559 Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 5/9] kmp204x: add support for the kmcoge4 board Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 6/9] kmp204x: update I2C field of RCW Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 7/9] KM: add the KM_UBI_PART_BOOT_OPTS #define Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 8/9] kmp204x: enable support for SPANSION SPI NOR Valentin Longchamp
2014-01-13 16:29 ` [U-Boot] [PATCH 9/9] kmp204x: initial support for PCIe FPGA configuration Valentin Longchamp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox