Further support for the kmp204x architecture
v2 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
Changes in v2:
- change bootcounter implementation to use generic driver
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 | 128 ++++++++++++----------------- 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 | 21 ++++- include/configs/kmp204x.h | 7 +- 11 files changed, 340 insertions(+), 83 deletions(-) create mode 100644 board/keymile/kmp204x/qrio.c
Signature · 1 line
1.8.0.1
PATCH v2 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
---
Changes in v2:
- change bootcounter implementation to use generic driver
board/keymile/kmp204x/kmp204x.c | 20 -------------------- include/configs/km/kmp204x-common.h | 6 ++++-- 2 files changed, 4 insertions(+), 22 deletions(-)
board/keymile/kmp204x/kmp204x.c +0 -20
@@ -133,26 +133,6 @@ void qrio_prstcfg(u8 bit, u8 mode)out_be32 (qrio_base +PRSTCFG_OFF , prstcfg); } - -#define BOOTCOUNT_OFF 0x12 - -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); -} - -ulong bootcount_load (void ) -{ -u8 val; -void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE ; - val =in_8 (qrio_base +BOOTCOUNT_OFF ); -return val; -} -#define NUM_SRDS_BANKS 2#define PHY_RST 15
include/configs/km/kmp204x-common.h +4 -2
@@ -149,8 +149,6 @@ unsigned long get_board_sys_clk(unsigned long dummy);#define CONFIG_KM_KERNEL_ADDR 0x1000000/* max kernel size 15.5Mbytes */ #define CONFIG_KM_FDT_ADDR 0x1F80000/* max dtb size 0.5Mbytes */ -#define CONFIG_BOOTCOUNT_LIMIT -/* * Local Bus Definitions */
@@ -207,6 +205,10 @@ unsigned long get_board_sys_clk(unsigned long dummy);#define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_QRIO_BR_PRELIM/* QRIO Base Address */ #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_QRIO_OR_PRELIM/* QRIO Options */ +/* bootcounter in QRIO */ +#define CONFIG_BOOTCOUNT_LIMIT +#define CONFIG_SYS_BOOTCOUNT_ADDR (CONFIG_SYS_QRIO_BASE + 0x20) +#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_BOARD_EARLY_INIT_R /* call board_early_init_r function */ #define CONFIG_MISC_INIT_R
Signature · 1 line
1.8.0.1
PATCH v2 1/9 kmp204x: support for QRIO1 bootcounter
Quoted 5 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
- make use of the QRIO1 32bit register at
0x20as bootcounter register
- check forBOOTCOUNT_MAGICpattern when before bootcounter value is read
Quoted 8 lines
Signed-off-by Rainer Boschung <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2:
- change bootcounter implementation to use generic driver
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 2/9 kmp204x: introduce QRIO GPIO functions
In reply to Valentin LongchampThe 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).
---
Changes in v2: None
board/keymile/kmp204x/Makefile | 2 +- board/keymile/kmp204x/kmp204x.c | 56 --------------- board/keymile/kmp204x/kmp204x.h | 10 +++ board/keymile/kmp204x/qrio.c | 147 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 158 insertions(+), 57 deletions(-) create mode 100644 board/keymile/kmp204x/qrio.c
board/keymile/kmp204x/Makefile +1 -1
@@ -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 -56
62 lines not on this page · raw message
board/keymile/kmp204x/kmp204x.h +10 -0
@@ -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
PATCH v2 2/9 kmp204x: introduce QRIO GPIO functions
Quoted 10 lines · Valentin Longchamp
The QRIO GPIO functions can be of general interest. They are thus added to a
qrio.cand their prototype are available fromkmp204x.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 <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 3/9 kmp204x: I2C deblocking for I2C-bus1 added
In reply to Valentin LongchampFrom: 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!
---
Changes in v2: None
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
@@ -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 NUM_SRDS_BANKS 2#define PHY_RST 15
include/configs/km/kmp204x-common.h +10 -0
@@ -211,6 +211,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
@@ -266,7 +267,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 */
@@ -279,6 +283,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
PATCH v2 3/9 kmp204x: I2C deblocking for I2C-bus1 added
Quoted 3 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
-uses common deblocking algorithm from
../common/common.c
I don't see any algorithm in the common.c file.
Quoted 25 lines
-supports deblocking of of I2C-bus1 by means of QRIO GPIO
- SCL1 =GPIO_A16
- SDA1 =GPIO_A17QRIO 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 <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
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 +0
-0@@ -33,12 +33,51 @@ int checkboard(void)return 0 ; }
board/keymile/kmp204x/kmp204x.c int checkboard(void) · line 43
Quoted 10 lines
board/keymile/kmp204x/kmp204x.c +8
-2-/* 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 +*/ +
I failed to understand these comments as well. Are these comments copy-n-paste?
York
PATCH v2 3/9 kmp204x: I2C deblocking for I2C-bus1 added
Quoted 6 lines · York Sun
Quoted 3 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
-uses common deblocking algorithm from
../common/common.cI don't see any algorithm in the
common.cfile.
The file is board/keymile/common/common.c, where the i2c_make_abort() and the i2c_write_start_seq() functions are defined. I guess that's what Rainer means with "algorithm".
I agree that the relative path for the file is not very fortunate and that's why you have not found the functions.
Quoted 26 lines
Quoted 26 lines
-supports deblocking of of I2C-bus1 by means of QRIO GPIO
- SCL1 =GPIO_A16
- SDA1 =GPIO_A17QRIO 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 <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
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 +0
-0@@ -33,12 +33,51 @@ int checkboard(void)return 0 ; }
Quoted 13 lines
board/keymile/kmp204x/kmp204x.c int checkboard(void) · line 43
Quoted 10 lines
board/keymile/kmp204x/kmp204x.c +8
-2-/* 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 +*/ +I failed to understand these comments as well. Are these comments copy-n-paste?
I will let Rainer answer this as he has written this comment. But I don't think it's copy-n-paste. It's maybe not very clear for people who don't know the hardware.
Valentin
Boschung
PATCH v2 3/9 kmp204x: I2C deblocking for I2C-bus1 added
Quoted 10 lines · Valentin Longchamp
Quoted 6 lines · York Sun
Quoted 3 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
-uses common deblocking algorithm from
../common/common.cI don't see any algorithm in the
common.cfile.The file is
board/keymile/common/common.c, where thei2c_make_abort()and thei2c_write_start_seq()functions are defined. I guess that's what Rainer means with "algorithm".
That is what I meant. I will add a more precise comment.
Quoted 44 lines
I agree that the relative path for the file is not very fortunate and that's why you have not found the functions.
Quoted 26 lines
Quoted 26 lines
-supports deblocking of of I2C-bus1 by means of QRIO GPIO
- SCL1 =GPIO_A16
- SDA1 =GPIO_A17QRIO 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 <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
board/keymile/kmp204x/kmp204x.c | 53 ++++++++++++++++++++++++++++++++++--- include/configs/km/kmp204x-common.h | 10 +++++++ 2 files changed, 60 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/board/keymile/kmp204x/kmp204x.cindex bbb2453..8d6eecb 100644board/keymile/kmp204x/kmp204x.c +0
-0@@ -33,12 +33,51 @@ int checkboard(void)return 0 ; }Quoted 14 lines
board/keymile/kmp204x/kmp204x.c int checkboard(void) · line 45
Quoted 11 lines
board/keymile/kmp204x/kmp204x.c +9
-1-/* TODO: implement the I2C deblocking function */ -inti2c_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 */ +I failed to understand these comments as well. Are these comments copy-n-paste?
Quoted 1 line
I will let Rainer answer this as he has written this comment. But I don't think it's copy-n-paste. It's maybe not very clear for people who don't know the hardware.
No the comment isn't copy-n-paste. The GPIO just drives low states, for a high states the pin is not driven (= GPIO configured as input), it is pull-up by a resistor. I will try to clarify this comment.
Quoted 2 lines
Valentin
Rainer
PATCH v2 3/9 kmp204x: I2C deblocking for I2C-bus1 added
Quoted 5 lines · Rainer
Quoted 4 lines · Valentin Longchamp
Quoted 3 lines · York Sun
Quoted 2 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
-uses common deblocking algorithm from
../common/common.cI don't see any algorithm in the
common.cfile.The file is
board/keymile/common/common.c, where thei2c_make_abort()and thei2c_write_start_seq()functions are defined. I guess that's what Rainer means with "algorithm".That is what I meant. I will add a more precise comment.
Quoted 1 line
Please send v3 for this patch only, or an incremental patch. I will swap/squash the patch.
York
PATCH v3 3/9 kmp204x: I2C deblocking support
In reply to Valentin LongchampFrom: Rainer Boschung <[email protected]>
This patch adds support for using some GPIOs that are connected to the I2C bus to force the bus lines state and perform some bus deblocking sequences.
The KM common deblocking algorithm from board/keymile/common/common.c is used. The GPIO lines used for deblocking the I2C bus are some external GPIOs provided by the QRIO CPLD:
- SCL = GPIOA_20
- SDA = GPIOA_21
The QRIO GPIOs act in an open-drain-like manner, for 0 the line is driven low and for 1 the GPIO is set as input and the line gets pulled-up.
---
Changes in v3:
- rewrite the commit message and and the comments for more clarity
- fix the GPIO numbers that where not correct
Changes in v2: None
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
@@ -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 board/keymile/common/common.c +* 2 dedicated QRIO GPIOs externally pull the SCL and SDA lines +* For I2C only the low state is activly driven and high state is pulled-up +* by a resistor. Therefore the deblock GPIOs are used +* -> as an active output to drive a low state +* -> as an open-drain input to have a pulled-up high state +*/ + +/* QRIO GPIOs used for deblocking */ +#define DEBLOCK_PORT1 GPIO_A +#define DEBLOCK_SCL1 20 +#define DEBLOCK_SDA1 21 + +/* 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 NUM_SRDS_BANKS 2#define PHY_RST 15
include/configs/km/kmp204x-common.h +10 -0
@@ -211,6 +211,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
@@ -266,7 +267,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 */
@@ -279,6 +283,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
PATCH v3 3/9 kmp204x: I2C deblocking support
Quoted 43 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
This patch adds support for using some GPIOs that are connected to the I2C bus to force the bus lines state and perform some bus deblocking sequences.
The KM common deblocking algorithm from
board/keymile/common/common.cis used. The GPIO lines used for deblocking the I2C bus are some external GPIOs provided by the QRIO CPLD:
- SCL =GPIOA_20
- SDA =GPIOA_21The QRIO GPIOs act in an open-drain-like manner, for 0 the line is driven low and for 1 the GPIO is set as input and the line gets pulled-up.
Signed-off-by Rainer Boschung <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v3:
- rewrite the commit message and and the comments for more clarity
- fix the GPIO numbers that where not correctChanges in v2: None
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 +2
-2@@ -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 board/keymile/common/common.c +* 2 dedicated QRIO GPIOs externally pull the SCL and SDA lines
board/keymile/kmp204x/kmp204x.c int checkboard(void) · line 47
Quoted 10 lines
board/keymile/kmp204x/kmp204x.c +10
-0+* For I2C only the low state is activly driven and high state is pulled-up +* by a resistor. Therefore the deblock GPIOs are used +* -> as an active output to drive a low state +* -> as an open-drain input to have a pulled-up high state +*/ + +/* QRIO GPIOs used for deblocking */ +#define DEBLOCK_PORT1 GPIO_A +#define DEBLOCK_SCL1 20 +#define DEBLOCK_SDA1 21
You changed these macros but didn't change those below. This causes compiling errors. Please fix it and compile before sending v4.
board/keymile/kmp204x/kmp204x.c int checkboard(void) · line 58
Quoted 11 lines
board/keymile/kmp204x/kmp204x.c +11
-0+ +/* 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 ); +}
York
PATCH v4 3/9 kmp204x: I2C deblocking support
From: Rainer Boschung <[email protected]>
This patch adds support for using some GPIOs that are connected to the I2C bus to force the bus lines state and perform some bus deblocking sequences.
The KM common deblocking algorithm from board/keymile/common/common.c is used. The GPIO lines used for deblocking the I2C bus are some external GPIOs provided by the QRIO CPLD:
- SCL = GPIOA_20
- SDA = GPIOA_21
The QRIO GPIOs act in an open-drain-like manner, for 0 the line is driven low and for 1 the GPIO is set as input and the line gets pulled-up.
---
Changes in v4:
- fix usage of the #define names that got wrong in the merge process
Changes in v3:
- rewrite the commit message and and the comments for more clarity
- fix the GPIO numbers that where not correct
Changes in v2: None
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
@@ -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 board/keymile/common/common.c +* 2 dedicated QRIO GPIOs externally pull the SCL and SDA lines +* For I2C only the low state is activly driven and high state is pulled-up +* by a resistor. Therefore the deblock GPIOs are used +* -> as an active output to drive a low state +* -> as an open-drain input to have a pulled-up high state +*/ + +/* QRIO GPIOs used for deblocking */ +#define DEBLOCK_PORT1 GPIO_A +#define DEBLOCK_SCL1 20 +#define DEBLOCK_SDA1 21 + +/* 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 (DEBLOCK_PORT1 ,DEBLOCK_SCL1 ); +qrio_gpio_direction_input (DEBLOCK_PORT1 ,DEBLOCK_SDA1 ); + +qrio_set_gpio (DEBLOCK_PORT1 ,DEBLOCK_SCL1 ,0 ); +qrio_set_gpio (DEBLOCK_PORT1 ,DEBLOCK_SDA1 ,0 ); +} + +void set_sda (int state) +{ +qrio_set_opendrain_gpio (DEBLOCK_PORT1 ,DEBLOCK_SDA1 , state); +} + +void set_scl (int state) +{ +qrio_set_opendrain_gpio (DEBLOCK_PORT1 ,DEBLOCK_SCL1 , state); +} + +int get_sda (void ) +{ +return qrio_get_gpio (DEBLOCK_PORT1 ,DEBLOCK_SDA1 ); +} + +int get_scl (void ) { -return 1 ; +return qrio_get_gpio (DEBLOCK_PORT1 ,DEBLOCK_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 NUM_SRDS_BANKS 2#define PHY_RST 15
include/configs/km/kmp204x-common.h +10 -0
@@ -211,6 +211,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
@@ -266,7 +267,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 */
@@ -279,6 +283,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
PATCH v4 3/9 kmp204x: I2C deblocking support
Quoted 21 lines · Valentin Longchamp
From: Rainer Boschung <[email protected]>
This patch adds support for using some GPIOs that are connected to the I2C bus to force the bus lines state and perform some bus deblocking sequences.
The KM common deblocking algorithm from
board/keymile/common/common.cis used. The GPIO lines used for deblocking the I2C bus are some external GPIOs provided by the QRIO CPLD:
- SCL =GPIOA_20
- SDA =GPIOA_21The QRIO GPIOs act in an open-drain-like manner, for 0 the line is driven low and for 1 the GPIO is set as input and the line gets pulled-up.
Signed-off-by Rainer Boschung <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>---
Quoted 9 lines
Changes in v4:
- fix usage of the #define names that got wrong in the merge processChanges in v3:
- rewrite the commit message and and the comments for more clarity
- fix the GPIO numbers that where not correctChanges in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 4/9 kmp204x: implement workaround for A-006559
In reply to Valentin LongchampAccording 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.
---
Changes in v2: None
board/keymile/kmp204x/pbi.cfg | 10 ++++++++++ 1 file changed, 10 insertions(+)
board/keymile/kmp204x/pbi.cfg +10 -0
@@ -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
PATCH v2 4/9 kmp204x: implement workaround for A-006559
Quoted 11 lines · 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.
Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 5/9 kmp204x: add support for the kmcoge4 board
In reply to Valentin LongchampThe 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.
---
Changes in v2: None
boards.cfg | 1 + include/configs/kmp204x.h | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-)
boards.cfg +1 -0
@@ -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
@@ -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
PATCH v2 5/9 kmp204x: add support for the kmcoge4 board
Quoted 9 lines · 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.
Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 6/9 kmp204x: update I2C field of RCW
In reply to Valentin LongchampOn 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].
---
Changes in v2: None
board/keymile/kmp204x/rcw_kmp204x.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
board/keymile/kmp204x/rcw_kmp204x.cfg +1 -1
@@ -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
PATCH v2 6/9 kmp204x: update I2C field of RCW
Quoted 11 lines · 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].
Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 7/9 KM: add the KM_UBI_PART_BOOT_OPTS #define
In reply to Valentin LongchampThis 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.
---
Changes in v2: None
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
@@ -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
@@ -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
PATCH v2 7/9 KM: add the KM_UBI_PART_BOOT_OPTS #define
Quoted 8 lines · 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.
Quoted 8 lines
The UBI cmd line option now looks like this "ubi.mtd=ubi0,2048" on this platform.
Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 8/9 kmp204x: enable support for SPANSION SPI NOR
In reply to Valentin LongchampThe new prototype and the final series was moved from Micron to Spansion to have a better reset sequence that is easier to support.
---
Changes in v2: None
include/configs/km/kmp204x-common.h | 1 + 1 file changed, 1 insertion(+)
include/configs/km/kmp204x-common.h +1 -0
@@ -303,6 +303,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
PATCH v2 8/9 kmp204x: enable support for SPANSION SPI NOR
Quoted 8 lines · 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.
Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York
PATCH v2 9/9 kmp204x: initial support for PCIe FPGA configuration
In reply to Valentin LongchampThe 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).
---
Changes in v2: None
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
@@ -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
PATCH v2 9/9 kmp204x: initial support for PCIe FPGA configuration
Quoted 6 lines · 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.
Quoted 8 lines
The used mechanism is taken from the
km_kirkwooddesign and adapted to the kmp204x case (slightly different HW and PCIe configuration).Signed-off-by Valentin Longchamp <[email protected]>---
Changes in v2: None
Applied to u-boot-mpc85xx master branch.
York