arm: mvebu: a38x: Cleanup serdes/DDR training
Subsystems (3)
cover arm: mvebu: a38x: Cleanup serdes/DDR training
The a38x serdes init and DDR training code was imported more or less as-is from Marvell's code with formatting cleanup changes. This is a first pass at cleaning up the code itself.
The topology data for several boards that are not supported by mainline U-Boot are removed. Also removed is a mechanism in the drivers themselves for changing the board-specified configuration based on values loaded from an on-board EEPROM. This belongs in the board file instead of the driver, and is not needed for the db-88f6820-gp development board, so is completely removed.
Kevin Smith (3):
arm: mvebu: a38x: Remove unsupported topologies
arm: mvebu: a38x: Add const to some function calls
arm: mvebu: a38x: serdes specification cleanup
arch/arm/mach-mvebu/serdes/a38x/Makefile | 1 - arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 13 +- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 2 +- .../serdes/a38x/high_speed_env_spec-38x.c | 1 - .../mach-mvebu/serdes/a38x/high_speed_env_spec.c | 103 +- .../mach-mvebu/serdes/a38x/high_speed_env_spec.h | 8 +- .../serdes/a38x/high_speed_topology_spec-38x.c | 1009 -------------------- .../serdes/a38x/high_speed_topology_spec.h | 124 --- arch/arm/mach-mvebu/serdes/a38x/seq_exec.c | 1 - arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c | 151 --- arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 2 - board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 17 + drivers/ddr/marvell/a38x/ddr3_a38x.h | 5 - drivers/ddr/marvell/a38x/ddr3_init.c | 72 -- 14 files changed, 65 insertions(+), 1444 deletions(-) delete mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c delete mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h
Signature · 1 line
2.4.6
PATCH 1/3 arm: mvebu: a38x: Remove unsupported topologies
A lot of extra configuration information was left over in the Marvell serdes and DDR3 initialization code for boards that U-boot does not support. Remove this extra config information, and the concept of fixing up board topologies with information loaded from an EEPROM. If this needs to be done, it should be handled in the board file, not in core code.
--- arch/arm/mach-mvebu/serdes/a38x/Makefile | 1 - .../serdes/a38x/high_speed_env_spec-38x.c | 1 - .../mach-mvebu/serdes/a38x/high_speed_env_spec.c | 26 - .../serdes/a38x/high_speed_topology_spec-38x.c | 1009 -------------------- .../serdes/a38x/high_speed_topology_spec.h | 124 --- arch/arm/mach-mvebu/serdes/a38x/seq_exec.c | 1 - arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c | 151 --- arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h | 2 - board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 16 + drivers/ddr/marvell/a38x/ddr3_a38x.h | 5 - drivers/ddr/marvell/a38x/ddr3_init.c | 72 -- 11 files changed, 16 insertions(+), 1392 deletions(-) delete mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c delete mode 100644 arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h
arch/arm/mach-mvebu/serdes/a38x/Makefile +0 -1
@@ -5,6 +5,5 @@ obj-$(CONFIG_SPL_BUILD) = ctrl_pex.o obj-$(CONFIG_SPL_BUILD) += high_speed_env_spec.o obj-$(CONFIG_SPL_BUILD) += high_speed_env_spec-38x.o -obj-$(CONFIG_SPL_BUILD) += high_speed_topology_spec-38x.o obj-$(CONFIG_SPL_BUILD) += seq_exec.o obj-$(CONFIG_SPL_BUILD) += sys_env_lib.o
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec-38x.c +0 -1
@@ -5,7 +5,6 @@*/ #include <common.h> -#include <i2c.h> #include <spl.h> #include <asm/io.h> #include <asm/arch/cpu.h>
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +0 -26
@@ -5,14 +5,12 @@*/ #include <common.h> -#include <i2c.h> #include <spl.h> #include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/arch/soc.h> #include "high_speed_env_spec.h" -#include "high_speed_topology_spec.h" #include "sys_env_lib.h" #include "ctrl_pex.h"
@@ -1364,27 +1362,6 @@ enum serdes_seq serdes_type_and_speed_to_speed_seq(enum serdes_type serdes_type,return seq_id; } -/* -* This is the weak default function for the Marvell evaluation or -* development boarrds. Like the DB-88F6820-GP and others. -* Custom boards should define this function in their board -* code (board directory). And overwrite this default function -* with this custom specific code. -*/ -__weak int hws_board_topology_load (struct serdes_map *serdes_map_array) -{ -u32 board_id =mv_board_id_get (); -u32 board_id_index =mv_board_id_index_get (board_id); - -DEBUG_INIT_FULL_S ("\n### hws_board_topology_load ###\n" ); -/* getting board topology according to the board id */ -DEBUG_INIT_FULL_S ("Getting board topology according to the board id\n" ); - -CHECK_STATUS (load_topology_func_arr[board_id_index] (serdes_map_array)); - -return MV_OK ; -} -void print_topology_details (struct serdes_map *serdes_map_array) {u32 lane_num;
@@ -1448,9 +1425,6 @@ int serdes_phy_config(void)return MV_FAIL ; } -/* I2C init */ -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); -/* Board topology load */ DEBUG_INIT_FULL_S ("ctrl_high_speed_serdes_phy_config: Loading board topology..\n" );
arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec-38x.c deleted +0 -1009
1,009 lines not on this page · raw message
arch/arm/mach-mvebu/serdes/a38x/high_speed_topology_spec.h deleted +0 -124
124 lines not on this page · raw message
arch/arm/mach-mvebu/serdes/a38x/seq_exec.c +0 -1
@@ -5,7 +5,6 @@*/ #include <common.h> -#include <i2c.h> #include <spl.h> #include <asm/io.h> #include <asm/arch/cpu.h>
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.c +0 -151
160 lines not on this page · raw message
arch/arm/mach-mvebu/serdes/a38x/sys_env_lib.h +0 -2
@@ -364,8 +364,6 @@ u8 sys_env_device_rev_get(void);u32 sys_env_device_id_get (void );u16 sys_env_model_get (void );struct dlb_config *sys_env_dlb_config_ptr_get (void ); -u32 sys_env_get_topology_update_info ( -struct topology_update_info *topology_update_info);u32 sys_env_get_cs_ena_from_reg (void );#endif /* _SYS_ENV_LIB_H */
board/Marvell/db-88f6820-gp/db-88f6820-gp.c +16 -0
@@ -13,6 +13,7 @@#include <asm/arch/soc.h> #include "../drivers/ddr/marvell/a38x/ddr3_a38x_topology.h" +#include <../serdes/a38x/high_speed_env_spec.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -55,6 +56,21 @@ static struct marvell_io_exp io_exp[] = { { 0x21, 3, 0xC0 } /* Output Data, register#1 */ }; +static struct serdes_map board_serdes_map[] = { + {PEX0 ,SERDES_SPEED_5_GBPS ,PEX_ROOT_COMPLEX_X1 ,0 ,0 }, + {SATA0 ,SERDES_SPEED_3_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 }, + {SATA1 ,SERDES_SPEED_3_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 }, + {SATA3 ,SERDES_SPEED_3_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 }, + {SATA2 ,SERDES_SPEED_3_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 }, + {USB3_HOST1 ,SERDES_SPEED_5_GBPS ,SERDES_DEFAULT_MODE ,0 ,0 } +}; + +int hws_board_topology_load (struct serdes_map *serdes_map_array) +{ +memcpy (serdes_map_array, board_serdes_map,sizeof (board_serdes_map)); +return 0 ; +} +/* * Define the DDR layout / topology here in the board file. This will * be used by the DDR3 init code in the SPL U-Boot version to configure
drivers/ddr/marvell/a38x/ddr3_a38x.h +0 -5
@@ -12,11 +12,6 @@#include "ddr3_hws_hw_training_def.h" -/* Allow topolgy update from board TWSI device*/ -#if !defined(CONFIG_CUSTOMER_BOARD_SUPPORT ) -#define MV_DDR_TOPOLOGY_UPDATE_FROM_TWSI -#endif -#define ECC_SUPPORT /* right now, we're not supporting this in mainline */
drivers/ddr/marvell/a38x/ddr3_init.c +0 -72
96 lines not on this page · raw message
Signature · 1 line
2.4.6
PATCH 1/3 arm: mvebu: a38x: Remove unsupported topologies
Quoted 11 lines · Kevin Smith
A lot of extra configuration information was left over in the Marvell serdes and DDR3 initialization code for boards that U-boot does not support. Remove this extra config information, and the concept of fixing up board topologies with information loaded from an EEPROM. If this needs to be done, it should be handled in the board file, not in core code.
Signed-off-by Kevin Smith <[email protected]>Cc Stefan Roese <[email protected]>Cc Dirk Eibach <[email protected]>Cc Luka Perkov <[email protected]>
Thanks Kevin for working on this. For all 3 patches:
Thanks,
Stefan
Luka Perkov
AppliedPATCH 1/3 arm: mvebu: a38x: Remove unsupported topologies
Quoted 8 lines · Stefan Roese
Quoted 7 lines · Kevin Smith
A lot of extra configuration information was left over in the Marvell serdes and DDR3 initialization code for boards that U-boot does not support. Remove this extra config information, and the concept of fixing up board topologies with information loaded from an EEPROM. If this needs to be done, it should be handled in the board file, not in core code.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Kevin Smith <[email protected]>Cc Stefan Roese <[email protected]>Cc Dirk Eibach <[email protected]>Cc Luka Perkov <[email protected]>Thanks Kevin for working on this. For all 3 patches:
Acked-by Stefan Roese <[email protected]>
Thank you! Applied in marvell/master.
Regards,
Luka
PATCH 2/3 arm: mvebu: a38x: Add const to some function calls
In reply to Kevin SmithFunctions that do not modify the pointer passed should declare it as const.
--- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 2 +- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 2 +- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c | 6 +++--- arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c +1 -1
@@ -13,7 +13,7 @@#include "ctrl_pex.h" #include "sys_env_lib.h" -int hws_pex_config (struct serdes_map *serdes_map) +int hws_pex_config (const struct serdes_map *serdes_map) {u32 pex_idx, tmp, next_busno, first_busno, temp_pex_reg, temp_reg, addr, dev_id, ctrl_mode;
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h +1 -1
@@ -78,7 +78,7 @@#define PEX_STATUS_AND_COMMAND 0x004#define PXSAC_MABORT BIT(29)/* Recieved Master Abort */ -int hws_pex_config (struct serdes_map *serdes_map); +int hws_pex_config (const struct serdes_map *serdes_map);int pex_local_bus_num_set (u32 pex_if,u32 bus_num);int pex_local_dev_num_set (u32 pex_if,u32 dev_num);u32 pex_config_read (u32 pex_if,u32 bus,u32 dev,u32 func,u32 reg_off);
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +3 -3
@@ -1362,7 +1362,7 @@ enum serdes_seq serdes_type_and_speed_to_speed_seq(enum serdes_type serdes_type,return seq_id; } -void print_topology_details (struct serdes_map *serdes_map_array) +void print_topology_details (const struct serdes_map *serdes_map_array) {u32 lane_num;
@@ -1462,7 +1462,7 @@ int serdes_polarity_config(u32 serdes_num, int is_rx)return MV_OK ; } -int hws_power_up_serdes_lanes (struct serdes_map *serdes_config_map) +int hws_power_up_serdes_lanes (const struct serdes_map *serdes_config_map) {u32 serdes_id, serdes_lane_num;enum ref_clock ref_clock;
@@ -2145,7 +2145,7 @@ int hws_ref_clock_set(u32 serdes_num, enum serdes_type serdes_type,* RETURNS: MV_OK - for success * MV_BAD_PARAM - for fail */ -int hws_pex_tx_config_seq (struct serdes_map *serdes_map) +int hws_pex_tx_config_seq (const struct serdes_map *serdes_map) {enum serdes_mode serdes_mode;u32 serdes_lane_id, serdes_lane_hw_num;
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h +2 -2
@@ -220,7 +220,7 @@ enum serdes_seq serdes_type_and_speed_to_speed_seq(enum serdes_type serdes_type, enum serdes_speed baud_rate);int hws_serdes_seq_init (void );int hws_serdes_seq_db_init (void ); -int hws_power_up_serdes_lanes (struct serdes_map *serdes_config_map); +int hws_power_up_serdes_lanes (const struct serdes_map *serdes_config_map);int hws_ctrl_high_speed_serdes_phy_config (void ); int serdes_power_up_ctrl(u32 serdes_num, int serdes_power_up, enum serdes_type serdes_type,
@@ -244,7 +244,7 @@ u32 hws_serdes_get_ref_clock_val(enum serdes_type serdes_type);u32 hws_serdes_get_max_lane (void );int hws_get_ext_base_addr (u32 serdes_num,u32 base_addr,u32 unit_base_offset,u32 *unit_base_reg,u32 *unit_offset); -int hws_pex_tx_config_seq (struct serdes_map *serdes_map); +int hws_pex_tx_config_seq (const struct serdes_map *serdes_map);u32 hws_get_physical_serdes_num (u32 serdes_num);int hws_is_serdes_active (u8 lane_num);
Signature · 1 line
2.4.6
PATCH 3/3 arm: mvebu: a38x: serdes specification cleanup
In reply to Kevin SmithInstead of allocating space in the driver for the serdes specification table, just allow the board file to set a pointer to it. Also, allow the board to only specify the lanes that are used instead of including unused lanes.
--- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c | 13 ++-- arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h | 2 +- .../mach-mvebu/serdes/a38x/high_speed_env_spec.c | 77 +++++++++++----------- .../mach-mvebu/serdes/a38x/high_speed_env_spec.h | 8 +-- board/Marvell/db-88f6820-gp/db-88f6820-gp.c | 5 +- 5 files changed, 51 insertions(+), 54 deletions(-)
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c +6 -7
@@ -13,17 +13,16 @@#include "ctrl_pex.h" #include "sys_env_lib.h" -int hws_pex_config (const struct serdes_map *serdes_map) +int hws_pex_config (const struct serdes_map *serdes_map,u8 count) {u32 pex_idx, tmp, next_busno, first_busno, temp_pex_reg, temp_reg, addr, dev_id, ctrl_mode;enum serdes_type serdes_type; -u32 idx, max_lane_num; +u32 idx;DEBUG_INIT_FULL_S ("\n### hws_pex_config ###\n" ); - max_lane_num =hws_serdes_get_max_lane (); -for (idx =0 ; idx < max_lane_num; idx++) { +for (idx =0 ; idx < count; idx++) { serdes_type = serdes_map[idx].serdes_type;/* configuration for PEX only */ if ((serdes_type != PEX0) && (serdes_type != PEX1) &&
@@ -47,7 +46,7 @@ int hws_pex_config(const struct serdes_map *serdes_map) tmp =reg_read (SOC_CTRL_REG ); tmp &= ~0x03 ; -for (idx =0 ; idx < max_lane_num; idx++) { +for (idx =0 ; idx < count; idx++) { serdes_type = serdes_map[idx].serdes_type; if ((serdes_type != PEX0) && ((serdes_map[idx].serdes_mode == PEX_ROOT_COMPLEX_X4) ||
@@ -81,7 +80,7 @@ int hws_pex_config(const struct serdes_map *serdes_map) next_busno =0 ;mdelay (150 ); -for (idx =0 ; idx < max_lane_num; idx++) { +for (idx =0 ; idx < count; idx++) { serdes_type = serdes_map[idx].serdes_type;DEBUG_INIT_FULL_S (" serdes_type=0x" );DEBUG_INIT_FULL_D (serdes_type,8 );
@@ -191,7 +190,7 @@ int hws_pex_config(const struct serdes_map *serdes_map)/* Update pex DEVICE ID */ ctrl_mode =sys_env_model_get (); -for (idx =0 ; idx < max_lane_num; idx++) { +for (idx =0 ; idx < count; idx++) { serdes_type = serdes_map[idx].serdes_type;/* configuration for PEX only */ if ((serdes_type != PEX0) && (serdes_type != PEX1) &&
arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.h +1 -1
@@ -78,7 +78,7 @@#define PEX_STATUS_AND_COMMAND 0x004#define PXSAC_MABORT BIT(29)/* Recieved Master Abort */ -int hws_pex_config (const struct serdes_map *serdes_map); +int hws_pex_config (const struct serdes_map *serdes_map,u8 count);int pex_local_bus_num_set (u32 pex_if,u32 bus_num);int pex_local_dev_num_set (u32 pex_if,u32 dev_num);u32 pex_config_read (u32 pex_if,u32 bus,u32 dev,u32 func,u32 reg_off);
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c +37 -40
203 lines not on this page · raw message
arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h +4 -4
@@ -215,12 +215,12 @@ extern u8 selectors_serdes_rev2_map[LAST_SERDES_TYPE][MAX_SERDES_LANES];u8 hws_ctrl_serdes_rev_get (void );int mv_update_serdes_select_phy_mode_seq (void ); -int hws_board_topology_load (struct serdes_map *serdes_map_array); +int hws_board_topology_load (struct serdes_map **serdes_map,u8 *count);enum serdes_seq serdes_type_and_speed_to_speed_seq (enum serdes_type serdes_type,enum serdes_speed baud_rate);int hws_serdes_seq_init (void );int hws_serdes_seq_db_init (void ); -int hws_power_up_serdes_lanes (const struct serdes_map *serdes_config_map); +int hws_power_up_serdes_lanes (struct serdes_map *serdes_map,u8 count);int hws_ctrl_high_speed_serdes_phy_config (void ); int serdes_power_up_ctrl(u32 serdes_num, int serdes_power_up, enum serdes_type serdes_type,
@@ -237,14 +237,14 @@ int hws_serdes_pex_ref_clock_get(enum serdes_type serdes_type, enum ref_clock *ref_clock);int hws_ref_clock_set (u32 serdes_num,enum serdes_type serdes_type,enum ref_clock ref_clock); -int hws_update_serdes_phy_selectors (struct serdes_map *serdes_config_map); +int hws_update_serdes_phy_selectors (struct serdes_map *serdes_map,u8 count);u32 hws_serdes_get_phy_selector_val (int serdes_num,enum serdes_type serdes_type);u32 hws_serdes_get_ref_clock_val (enum serdes_type serdes_type);u32 hws_serdes_get_max_lane (void );int hws_get_ext_base_addr (u32 serdes_num,u32 base_addr,u32 unit_base_offset,u32 *unit_base_reg,u32 *unit_offset); -int hws_pex_tx_config_seq (const struct serdes_map *serdes_map); +int hws_pex_tx_config_seq (const struct serdes_map *serdes_map,u8 count);u32 hws_get_physical_serdes_num (u32 serdes_num);int hws_is_serdes_active (u8 lane_num);
board/Marvell/db-88f6820-gp/db-88f6820-gp.c +3 -2
@@ -65,9 +65,10 @@ static struct serdes_map board_serdes_map[] = { {USB3_HOST1, SERDES_SPEED_5_GBPS, SERDES_DEFAULT_MODE, 0, 0} }; -int hws_board_topology_load (struct serdes_map *serdes_map_array) +int hws_board_topology_load (struct serdes_map **serdes_map_array,u8 *count) { -memcpy (serdes_map_array, board_serdes_map,sizeof (board_serdes_map)); + *serdes_map_array = board_serdes_map; + *count =ARRAY_SIZE (board_serdes_map);return 0 ; }
Signature · 1 line
2.4.6