arm: zynq: ps7* consolidation
Subsystems (3)
v2 cover arm: zynq: ps7* consolidation
Hi,
this series is trying to cleanup ps7_init* file that we don't need to have the same copy of the same functions in different locations. This work is done based on solution from Topic.nl for miami boards where format was changed a little bit to save one word in config data segment.
At the same time older method of simply copying files to particular folder is still working.
Please test this in your board to make sure I didn't break anything. I have tested it on zybo/zc702/zc706.
Thanks,
Michal
Changes in v2:
- Fix indentation by using tabs instead of spaces
- Add own opcode for write operation
- Change commit message (was Convert EMIT_WRITE to EMIT_MASKWRITE) - requested by Mike
Michal Simek (9):
arm: zynq: Add missing ps7_post_config declaration
arm: zynq: Enable debug uart on zc706
arm: zynq: Remove ps7_debug code
arm: zynq: Move ps7_* to separate file
arm: zynq: Get rid of ps7_reset_apu() for syzygy board
arm: zynq: Move common ps7_init* initialization to arch code
arm: zynq: Add ps7GetSiliconVersion() to ps7_spl_init
arm: zynq: Add support for EMIT_WRITE operation
arm: zynq: Convert all board to use arch ps7_init code
arch/arm/mach-zynq/Makefile | 2 +- arch/arm/mach-zynq/include/mach/ps7_init_gpl.h | 48 ++++ arch/arm/mach-zynq/include/mach/sys_proto.h | 3 - .../arm/mach-zynq/ps7_spl_init.c | 37 ++- arch/arm/mach-zynq/spl.c | 18 +- .../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c | 138 +--------- .../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h | 81 ------ board/topic/zynq/Makefile | 2 +- board/topic/zynq/ps7_init_gpl.h | 34 --- board/topic/zynq/zynq-topic-miami/ps7_init_gpl.c | 2 +- .../topic/zynq/zynq-topic-miamilite/ps7_init_gpl.c | 2 +- .../topic/zynq/zynq-topic-miamiplus/ps7_init_gpl.c | 2 +- board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 285 +------------------- board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h | 117 --------- board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c | 289 +------------------- board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h | 117 --------- board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 285 +------------------- board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h | 117 --------- board/xilinx/zynq/zynq-zed/ps7_init_gpl.c | 285 +------------------- board/xilinx/zynq/zynq-zed/ps7_init_gpl.h | 117 --------- board/xilinx/zynq/zynq-zybo/ps7_init_gpl.c | 292 +-------------------- board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h | 98 ------- configs/zynq_zc706_defconfig | 5 + 23 files changed, 100 insertions(+), 2276 deletions(-) create mode 100644 arch/arm/mach-zynq/include/mach/ps7_init_gpl.h rename board/topic/zynq/ps7_init_common.c => arch/arm/mach-zynq/ps7_spl_init.c (76%) delete mode 100644 board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h delete mode 100644 board/topic/zynq/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zed/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h
Signature · 1 line
1.9.1
PATCH v2 1/9 arm: zynq: Add missing ps7_post_config declaration
Add missing declaration to header.
Warning log:arch/arm/mach-zynq/spl.c:94:12: warning: symbol 'ps7_post_config' was not declared. Should it be static?
---
Changes in v2: None
arch/arm/mach-zynq/include/mach/sys_proto.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-zynq/include/mach/sys_proto.h +1 -0
@@ -22,5 +22,6 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr);/* Driver extern functions */ extern void ps7_init (void ); +int ps7_post_config (void );#endif /* _SYS_PROTO_H_ */
Signature · 1 line
1.9.1
PATCH v2 2/9 arm: zynq: Enable debug uart on zc706
In reply to Michal SimekEnable debug uart by default.
---
Changes in v2: None
configs/zynq_zc706_defconfig | 5 +++++ 1 file changed, 5 insertions(+)
configs/zynq_zc706_defconfig +5 -0
@@ -3,6 +3,7 @@ CONFIG_SYS_CONFIG_NAME="zynq_zc70x" CONFIG_ARCH_ZYNQ=y CONFIG_SYS_TEXT_BASE=0x4000000 CONFIG_DEFAULT_DEVICE_TREE="zynq-zc706" +CONFIG_DEBUG_UART=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y CONFIG_FIT_VERBOSE=y
@@ -51,6 +52,10 @@ CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_WINBOND=y CONFIG_ZYNQ_GEM=y +CONFIG_DEBUG_UART_ZYNQ=y +CONFIG_DEBUG_UART_BASE=0xe0001000 +CONFIG_DEBUG_UART_CLOCK=50000000 +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ZYNQ_SERIAL=y CONFIG_ZYNQ_QSPI=y CONFIG_USB=y
Signature · 1 line
1.9.1
PATCH v2 3/9 arm: zynq: Remove ps7_debug code
In reply to Michal SimekSPL is not calling this code that's why it is dead code and can be removed.
---
Changes in v2: None
.../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c | 10 -- .../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h | 1 - board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 112 -------------------- board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h | 1 - board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c | 112 -------------------- board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h | 1 - board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 112 -------------------- board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h | 1 - board/xilinx/zynq/zynq-zed/ps7_init_gpl.c | 112 -------------------- board/xilinx/zynq/zynq-zed/ps7_init_gpl.h | 1 - board/xilinx/zynq/zynq-zybo/ps7_init_gpl.c | 114 --------------------- board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h | 1 - 12 files changed, 578 deletions(-)
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c +0 -10
@@ -255,12 +255,6 @@ unsigned long ps7_post_config_3_0[] = { EMIT_EXIT(), }; -unsigned long ps7_debug_3_0[] = { -EMIT_WRITE (0XF8898FB0 ,0xC5ACCE55U ), -EMIT_WRITE (0XF8899FB0 ,0xC5ACCE55U ), -EMIT_WRITE (0XF8809FB0 ,0xC5ACCE55U ), -EMIT_EXIT (), -};unsigned long ps7_reset_apu_3_0[] = {EMIT_MASKWRITE (0xF8000244 ,0x00000022U ,0x00000022U ),
@@ -353,10 +347,6 @@ int ps7_post_config(void)return ps7_config (ps7_post_config_3_0); } -int ps7_debug (void ) -{ -return ps7_config (ps7_debug_3_0); -}int ps7_reset_apu (void ) {
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h +0 -1
@@ -69,7 +69,6 @@ extern "C" {int ps7_config (unsigned long *);int ps7_init (void );int ps7_post_config (void ); -int ps7_debug (void );void perf_start_clock (void );void perf_disable_clock (void );
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c +0 -112
136 lines not on this page · raw message
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h +0 -1
@@ -104,7 +104,6 @@ extern unsigned long * ps7_peripherals_init_data;int ps7_config (unsigned long *);int ps7_init ();int ps7_post_config (); -int ps7_debug ();char *getPS7MessageInfo (unsigned key);void perf_start_clock (void );
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c +0 -112
136 lines not on this page · raw message
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h +0 -1
@@ -104,7 +104,6 @@ extern unsigned long * ps7_peripherals_init_data;int ps7_config (unsigned long *);int ps7_init ();int ps7_post_config (); -int ps7_debug ();char *getPS7MessageInfo (unsigned key);void perf_start_clock (void );
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +0 -112
136 lines not on this page · raw message
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h +0 -1
@@ -104,7 +104,6 @@ extern unsigned long * ps7_peripherals_init_data;int ps7_config (unsigned long *);int ps7_init ();int ps7_post_config (); -int ps7_debug ();char *getPS7MessageInfo (unsigned key);void perf_start_clock (void );
board/xilinx/zynq/zynq-zed/ps7_init_gpl.c +0 -112
136 lines not on this page · raw message
board/xilinx/zynq/zynq-zed/ps7_init_gpl.h +0 -1
@@ -104,7 +104,6 @@ extern unsigned long * ps7_peripherals_init_data;int ps7_config (unsigned long *);int ps7_init ();int ps7_post_config (); -int ps7_debug ();char *getPS7MessageInfo (unsigned key);void perf_start_clock (void );
board/xilinx/zynq/zynq-zybo/ps7_init_gpl.c +0 -114
138 lines not on this page · raw message
board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h +0 -1
@@ -85,7 +85,6 @@ extern unsigned long *ps7_peripherals_init_data;int ps7_config (unsigned long *);int ps7_init (void );int ps7_post_config (void ); -int ps7_debug (void );char *getPS7MessageInfo (unsigned key);void perf_start_clock (void );
Signature · 1 line
1.9.1
PATCH v2 4/9 arm: zynq: Move ps7_* to separate file
In reply to Michal SimekExtract ps7_* from spl code to prepare for extension. And also return value.
---
Changes in v2: None
arch/arm/mach-zynq/Makefile | 2 +- arch/arm/mach-zynq/include/mach/ps7_init_gpl.h | 14 +++++++++++++ arch/arm/mach-zynq/include/mach/sys_proto.h | 4 ---- arch/arm/mach-zynq/ps7_spl_init.c | 27 ++++++++++++++++++++++++++ arch/arm/mach-zynq/spl.c | 18 +---------------- 5 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 arch/arm/mach-zynq/include/mach/ps7_init_gpl.h create mode 100644 arch/arm/mach-zynq/ps7_spl_init.c
arch/arm/mach-zynq/Makefile +1 -1
@@ -15,4 +15,4 @@ obj-y += slcr.o obj-y += clk.o obj-y += lowlevel_init.o AFLAGS_lowlevel_init.o := -mfpu=neon -obj-$(CONFIG_SPL_BUILD) += spl.o +obj-$(CONFIG_SPL_BUILD) += spl.o ps7_spl_init.o
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h new file +14 -0
@@ -0,0 +1,14 @@ +/* +* (c) Copyright 2010-2017 Xilinx, Inc. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _ASM_ARCH_PS7_INIT_GPL_H +#define _ASM_ARCH_PS7_INIT_GPL_H + +/* Called by spl.c */ +int ps7_init (void ); +int ps7_post_config (void ); + +#endif /* _ASM_ARCH_PS7_INIT_GPL_H */
arch/arm/mach-zynq/include/mach/sys_proto.h +0 -4
@@ -20,8 +20,4 @@ extern unsigned int zynq_get_silicon_version(void);int zynq_board_read_rom_ethaddr (unsigned char *ethaddr); -/* Driver extern functions */ -extern void ps7_init (void ); -int ps7_post_config (void ); -#endif /* _SYS_PROTO_H_ */
arch/arm/mach-zynq/ps7_spl_init.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* (c) Copyright 2010-2017 Xilinx, Inc. All rights reserved. +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <asm/io.h> +#include <asm/spl.h> +#include <asm/arch/ps7_init_gpl.h> + +__weak int ps7_init (void ) +{ +/* +* This function is overridden by the one in +* board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. +*/ +return 0 ; +} + +__weak int ps7_post_config (void ) +{ +/* +* This function is overridden by the one in +* board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. +*/ +return 0 ; +}
arch/arm/mach-zynq/spl.c +1 -17
@@ -11,6 +11,7 @@#include <asm/spl.h> #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> +#include <asm/arch/ps7_init_gpl.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -83,23 +84,6 @@ int spl_start_uboot(void) }#endif -__weak void ps7_init (void ) -{ -/* -* This function is overridden by the one in -* board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. -*/ -} - -__weak int ps7_post_config (void ) -{ -/* -* This function is overridden by the one in -* board/xilinx/zynq/(platform)/ps7_init_gpl.c, if it exists. -*/ -return 0 ; -} -void spl_board_prepare_for_boot (void ) {ps7_post_config ();
Signature · 1 line
1.9.1
PATCH v2 5/9 arm: zynq: Get rid of ps7_reset_apu() for syzygy board
In reply to Michal SimekThere is no reason to call separate function.
---
Changes in v2: None
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c +1 -7
@@ -347,17 +347,11 @@ int ps7_post_config(void)return ps7_config (ps7_post_config_3_0); } - -int ps7_reset_apu (void ) -{ -return ps7_config (ps7_reset_apu_3_0); -} -int ps7_init (void ) {int ret; - ret =ps7_reset_apu (); + ret =ps7_config (ps7_reset_apu_3_0);if (ret !=PS7_INIT_SUCCESS )return ret;
Signature · 1 line
1.9.1
PATCH v2 6/9 arm: zynq: Move common ps7_init* initialization to arch code
In reply to Michal SimekThis patch is based on work done in topic board where the first address word also storing operation which should be done. This is reducing size of configuration data.
This patch is not breaking an option to copy default ps7_init_gpl* files from hdf file but it is doing preparation for ps7_init* consolidation.
The patch is also marking ps7_config as weak function.
---
Changes in v2:
- Fix indentation by using tabs instead of spaces
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h | 28 ++++- arch/arm/mach-zynq/ps7_spl_init.c | 109 +++++++++++++++++++ board/topic/zynq/Makefile | 2 +- board/topic/zynq/ps7_init_common.c | 117 --------------------- board/topic/zynq/ps7_init_gpl.h | 34 ------ board/topic/zynq/zynq-topic-miami/ps7_init_gpl.c | 2 +- .../topic/zynq/zynq-topic-miamilite/ps7_init_gpl.c | 2 +- .../topic/zynq/zynq-topic-miamiplus/ps7_init_gpl.c | 2 +- 8 files changed, 140 insertions(+), 156 deletions(-) delete mode 100644 board/topic/zynq/ps7_init_common.c delete mode 100644 board/topic/zynq/ps7_init_gpl.h
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h +27 -1
@@ -1,5 +1,6 @@/* -* (c) Copyright 2010-2017 Xilinx, Inc. All rights reserved. +* (c) Copyright 2010-2014 Xilinx, Inc. All rights reserved. +* (c) Copyright 2016 Topic Embedded Products. * * SPDX-License-Identifier: GPL-2.0+ */
@@ -7,8 +8,33 @@#ifndef _ASM_ARCH_PS7_INIT_GPL_H#define _ASM_ARCH_PS7_INIT_GPL_H +/* Opcode exit is 0 all the time */ +#define OPCODE_EXIT 0U +#define OPCODE_MASKWRITE 0U +#define OPCODE_MASKPOLL 1U +#define OPCODE_MASKDELAY 2U +#define OPCODE_ADDRESS_MASK (~3U) + +/* Sentinel */ +#define EMIT_EXIT () OPCODE_EXIT +/* Opcode is in lower 2 bits of address, address is always 4-byte aligned */ +#define EMIT_MASKWRITE (addr, mask, val) OPCODE_MASKWRITE | addr, mask, val +#define EMIT_MASKPOLL (addr, mask) OPCODE_MASKPOLL | addr, mask +#define EMIT_MASKDELAY (addr, mask) OPCODE_MASKDELAY | addr, mask + +/* Returns codes of ps7_init* */ +#define PS7_INIT_SUCCESS (0) +#define PS7_INIT_CORRUPT (1) +#define PS7_INIT_TIMEOUT (2) +#define PS7_POLL_FAILED_DDR_INIT (3) +#define PS7_POLL_FAILED_DMA (4) +#define PS7_POLL_FAILED_PLL (5) +/* Called by spl.c */ int ps7_init (void );int ps7_post_config (void ); +/* Defined in ps7_init_common.c */ +int ps7_config (unsigned long *ps7_config_init); +#endif /* _ASM_ARCH_PS7_INIT_GPL_H */
arch/arm/mach-zynq/ps7_spl_init.c +109 -0
117 lines not on this page · raw message
board/topic/zynq/Makefile +1 -1
@@ -7,4 +7,4 @@ obj-y := board.o # Remove quotes hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) -obj-$(CONFIG_SPL_BUILD) += $(hw-platform-y)/ps7_init_gpl.o ps7_init_common.o +obj-$(CONFIG_SPL_BUILD) += $(hw-platform-y)/ps7_init_gpl.o
board/topic/zynq/ps7_init_common.c deleted +0 -117
117 lines not on this page · raw message
board/topic/zynq/ps7_init_gpl.h deleted +0 -34
@@ -1,34 +0,0 @@ -/* -* (c) Copyright 2010-2014 Xilinx, Inc. All rights reserved. -* (c) Copyright 2016 Topic Embedded Products. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#define OPCODE_EXIT 0U -#define OPCODE_MASKWRITE 0U -#define OPCODE_MASKPOLL 1U -#define OPCODE_MASKDELAY 2U -#define OPCODE_ADDRESS_MASK (~3U) - -/* Sentinel */ -#define EMIT_EXIT () OPCODE_EXIT -/* Opcode is in lower 2 bits of address, address is always 4-byte aligned */ -#define EMIT_MASKWRITE (addr, mask, val) OPCODE_MASKWRITE | addr, mask, val -#define EMIT_MASKPOLL (addr, mask) OPCODE_MASKPOLL | addr, mask -#define EMIT_MASKDELAY (addr, mask) OPCODE_MASKDELAY | addr, mask - -/* Returns codes of ps7_init* */ -#define PS7_INIT_SUCCESS (0) -#define PS7_INIT_CORRUPT (1) -#define PS7_INIT_TIMEOUT (2) -#define PS7_POLL_FAILED_DDR_INIT (3) -#define PS7_POLL_FAILED_DMA (4) -#define PS7_POLL_FAILED_PLL (5) - -/* Called by spl.c */ -int ps7_init (void ); -int ps7_post_config (void ); - -/* Defined in ps7_init_common.c */ -int ps7_config (unsigned long *ps7_config_init);
board/topic/zynq/zynq-topic-miami/ps7_init_gpl.c +1 -1
@@ -5,7 +5,7 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include "../ps7_init_gpl.h" +#include <asm/arch/ps7_init_gpl.h> static unsigned long ps7_pll_init_data_3_0[] = {EMIT_MASKWRITE (0XF8000008 ,0x0000FFFFU ,0x0000DF0DU ),
board/topic/zynq/zynq-topic-miamilite/ps7_init_gpl.c +1 -1
@@ -5,7 +5,7 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include "../ps7_init_gpl.h" +#include <asm/arch/ps7_init_gpl.h> static unsigned long ps7_pll_init_data_3_0[] = {EMIT_MASKWRITE (0xF8000008 ,0x0000FFFFU ,0x0000DF0DU ),
board/topic/zynq/zynq-topic-miamiplus/ps7_init_gpl.c +1 -1
@@ -5,7 +5,7 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include "../ps7_init_gpl.h" +#include <asm/arch/ps7_init_gpl.h> static unsigned long ps7_pll_init_data_3_0[] = {EMIT_MASKWRITE (0XF8000008 ,0x0000FFFFU ,0x0000DF0DU ),
Signature · 1 line
1.9.1
PATCH v2 7/9 arm: zynq: Add ps7GetSiliconVersion() to ps7_spl_init
In reply to Michal SimekUnfortunately camelcase is coming from ps7_init* format.
---
Changes in v2: None
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h | 6 ++++++ arch/arm/mach-zynq/ps7_spl_init.c | 6 ++++++ 2 files changed, 12 insertions(+)
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h +6 -0
@@ -30,6 +30,10 @@#define PS7_POLL_FAILED_DMA (4)#define PS7_POLL_FAILED_PLL (5) +#define PCW_SILICON_VERSION_1 0 +#define PCW_SILICON_VERSION_2 1 +#define PCW_SILICON_VERSION_3 2 +/* Called by spl.c */ int ps7_init (void );int ps7_post_config (void );
@@ -37,4 +41,6 @@ int ps7_post_config(void);/* Defined in ps7_init_common.c */ int ps7_config (unsigned long *ps7_config_init); +unsigned long ps7GetSiliconVersion (void ); +#endif /* _ASM_ARCH_PS7_INIT_GPL_H */
arch/arm/mach-zynq/ps7_spl_init.c +6 -0
@@ -7,6 +7,7 @@#include <asm/io.h> #include <asm/spl.h> +#include <asm/arch/sys_proto.h> #include <asm/arch/ps7_init_gpl.h> __weak int ps7_init (void )
@@ -134,3 +135,8 @@ int __weak ps7_config(unsigned long *ps7_config_init) ptr += numargs; } } + +unsigned long __weak __maybe_unused ps7GetSiliconVersion (void ) +{ +return zynq_get_silicon_version (); +}
Signature · 1 line
1.9.1
PATCH v2 8/9 arm: zynq: Add support for EMIT_WRITE operation
In reply to Michal SimekAdd proper support for EMIT_WRITE operation which is write only. Do not use EMIT_MASKWRITE which is read-modify-write.
---
Changes in v2:
- Add own opcode for write operation
- Change commit message (was Convert EMIT_WRITE to EMIT_MASKWRITE) - requested by Mike
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h | 2 ++ arch/arm/mach-zynq/ps7_spl_init.c | 6 ++++++ 2 files changed, 8 insertions(+)
arch/arm/mach-zynq/include/mach/ps7_init_gpl.h +2 -0
@@ -13,6 +13,7 @@#define OPCODE_MASKWRITE 0U#define OPCODE_MASKPOLL 1U#define OPCODE_MASKDELAY 2U +#define OPCODE_WRITE 3U#define OPCODE_ADDRESS_MASK (~3U)/* Sentinel */
@@ -21,6 +22,7 @@#define EMIT_MASKWRITE (addr, mask, val) OPCODE_MASKWRITE | addr, mask, val#define EMIT_MASKPOLL (addr, mask) OPCODE_MASKPOLL | addr, mask#define EMIT_MASKDELAY (addr, mask) OPCODE_MASKDELAY | addr, mask +#define EMIT_WRITE (addr, val) OPCODE_WRITE | addr, val/* Returns codes of ps7_init* */ #define PS7_INIT_SUCCESS (0)
arch/arm/mach-zynq/ps7_spl_init.c +6 -0
@@ -108,6 +108,12 @@ int __weak ps7_config(unsigned long *ps7_config_init)iowrite ((ioread (addr) & ~mask) | (val & mask), addr);break ; +case OPCODE_WRITE : + numargs =2 ; + val = ptr[1 ]; +iowrite (val, addr); +break ; +case OPCODE_MASKPOLL : numargs =2 ; mask = ptr[1 ];
Signature · 1 line
1.9.1
PATCH v2 9/9 arm: zynq: Convert all board to use arch ps7_init code
In reply to Michal SimekUse generic implementation. It will also reduce config data size for converted boards.
---
Changes in v2: None
.../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c | 120 +------------- .../opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h | 80 --------- board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c | 173 +------------------- board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h | 116 -------------- board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c | 177 +------------------- board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h | 116 -------------- board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c | 173 +------------------- board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h | 116 -------------- board/xilinx/zynq/zynq-zed/ps7_init_gpl.c | 173 +------------------- board/xilinx/zynq/zynq-zed/ps7_init_gpl.h | 116 -------------- board/xilinx/zynq/zynq-zybo/ps7_init_gpl.c | 178 +-------------------- board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h | 97 ----------- 12 files changed, 6 insertions(+), 1629 deletions(-) delete mode 100644 board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zed/ps7_init_gpl.h delete mode 100644 board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.c +1 -119
@@ -5,8 +5,7 @@* SPDX-License-Identifier: GPL-2.0+ *****************************************************************************/ -#include "ps7_init_gpl.h" -#include "asm/io.h" +#include <asm/arch/ps7_init_gpl.h> unsigned long ps7_pll_init_data_3_0[] = {EMIT_WRITE (0XF8000008 ,0x0000DF0DU ),
@@ -255,92 +254,11 @@ unsigned long ps7_post_config_3_0[] = { EMIT_EXIT(), }; -unsigned long ps7_reset_apu_3_0[] = {EMIT_MASKWRITE (0xF8000244 ,0x00000022U ,0x00000022U ),EMIT_EXIT (), }; -#define PS7_MASK_POLL_TIME 100000000 - -static inline void iowrite (unsigned long val,unsigned long addr) -{ -__raw_writel (val, addr); -} - -static inline unsigned long ioread (unsigned long addr) -{ -return __raw_readl (addr); -} - -int ps7_config (unsigned long *ps7_config_init) -{ -unsigned long *ptr = ps7_config_init; - -unsigned long opcode;/* current instruction .. */ -unsigned long args[16 ];/* no opcode has so many args ... */ -int numargs;/* number of arguments of this instruction */ -int j;/* general purpose index */ - -unsigned long addr; -unsigned long val, mask; - -int finish =-1 ;/* loop while this is negative ! */ -int i =0 ;/* Timeout variable */ - -while (finish <0 ) { - numargs = ptr[0 ] &0xF ; - opcode = ptr[0 ] >>4 ; - -for (j =0 ; j < numargs; j++) - args[j] = ptr[j +1 ]; - ptr += numargs +1 ; - -switch (opcode) { -case OPCODE_EXIT : - finish =PS7_INIT_SUCCESS ; -break ; - -case OPCODE_WRITE : - addr = args[0 ]; - val = args[1 ]; -iowrite (val, addr); -break ; - -case OPCODE_MASKWRITE : - addr = args[0 ]; - mask = args[1 ]; - val = args[2 ]; -iowrite ((val & mask) | (ioread (addr) & ~mask) , addr); -break ; - -case OPCODE_MASKPOLL : - addr = args[0 ]; - mask = args[1 ]; - i =0 ; -while (!(ioread (addr) & mask)) { -if (i ==PS7_MASK_POLL_TIME ) { - finish =PS7_INIT_TIMEOUT ; -break ; - } - i++; - } -break ; -case OPCODE_MASKDELAY : - addr = args[0 ]; - mask = args[1 ]; -int delay =get_number_of_cycles_for_delay (mask); -perf_reset_and_start_timer (); -while (ioread (addr) < delay) - ; -break ; -default : - finish =PS7_INIT_CORRUPT ; -break ; - } - } -return finish; -}int ps7_post_config (void ) {
@@ -377,39 +295,3 @@ int ps7_init(void)return PS7_INIT_SUCCESS ; } -/* For delay calculation using global timer */ - -/* start timer */ -void perf_start_clock (void ) -{ -iowrite ((1 <<0 ) |/* Timer Enable */ - (1 <<3 ) |/* Auto-increment */ - (0 <<8 ),/* Pre-scale */ -SCU_GLOBAL_TIMER_CONTROL ); -} - -/* stop timer and reset timer count regs */ -void perf_reset_clock (void ) -{ -perf_disable_clock (); -iowrite (0 ,SCU_GLOBAL_TIMER_COUNT_L32 ); -iowrite (0 ,SCU_GLOBAL_TIMER_COUNT_U32 ); -} - -/* Compute mask for given delay in miliseconds*/ -int get_number_of_cycles_for_delay (unsigned int delay) -{ -return APU_FREQ * delay / (2 *1000 ); -} - -/* stop timer */ -void perf_disable_clock (void ) -{ -iowrite (0 ,SCU_GLOBAL_TIMER_CONTROL ); -} - -void perf_reset_and_start_timer (void ) -{ -perf_reset_clock (); -perf_start_clock (); -}
board/opalkelly/zynq/zynq-syzygy-hub/ps7_init_gpl.h deleted +0 -80
80 lines not on this page · raw message
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.c +1 -172
188 lines not on this page · raw message
board/xilinx/zynq/zynq-microzed/ps7_init_gpl.h deleted +0 -116
116 lines not on this page · raw message
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.c +1 -176
192 lines not on this page · raw message
board/xilinx/zynq/zynq-zc702/ps7_init_gpl.h deleted +0 -116
116 lines not on this page · raw message
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.c +1 -172
188 lines not on this page · raw message
board/xilinx/zynq/zynq-zc706/ps7_init_gpl.h deleted +0 -116
116 lines not on this page · raw message
board/xilinx/zynq/zynq-zed/ps7_init_gpl.c +1 -172
188 lines not on this page · raw message
board/xilinx/zynq/zynq-zed/ps7_init_gpl.h deleted +0 -116
116 lines not on this page · raw message
board/xilinx/zynq/zynq-zybo/ps7_init_gpl.c +1 -177
193 lines not on this page · raw message
board/xilinx/zynq/zynq-zybo/ps7_init_gpl.h deleted +0 -97
97 lines not on this page · raw message
Signature · 1 line
1.9.1