diff options
author | Masahiro Yamada | 2019-07-10 20:07:38 +0900 |
---|---|---|
committer | Masahiro Yamada | 2019-07-10 22:41:58 +0900 |
commit | 539d6e0dbc9634cbf0e14a383d2907e6e462558a (patch) | |
tree | 4608fa3b804f12c9aa3abacf29095377a63c6b38 | |
parent | f7f390576d063f9fc6c2a00792acd835a75c88aa (diff) |
ARM: uniphier: make boot_is_swapped() code optional
The planned new SoC does not have SBC (System Bus Controller) block.
Make boot_is_swapped() an optional hook.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r-- | arch/arm/mach-uniphier/boot-device/boot-device.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-uniphier/sbc/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-uniphier/sbc/sbc-boot.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-uniphier/sbc/sbc-regs.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-uniphier/sbc/sbc.c | 2 |
5 files changed, 30 insertions, 12 deletions
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.c b/arch/arm/mach-uniphier/boot-device/boot-device.c index 59302150b89..3c2e7b660f3 100644 --- a/arch/arm/mach-uniphier/boot-device/boot-device.c +++ b/arch/arm/mach-uniphier/boot-device/boot-device.c @@ -23,6 +23,7 @@ struct uniphier_boot_device_info { const unsigned int *boot_device_count; int (*boot_device_is_usb)(u32 pinmon); unsigned int (*boot_device_fixup)(unsigned int mode); + int (*boot_is_swapped)(void); bool have_internal_stm; }; @@ -33,6 +34,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_sel_shift = 1, .boot_device_table = uniphier_ld4_boot_device_table, .boot_device_count = &uniphier_ld4_boot_device_count, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = true, }, #endif @@ -42,6 +44,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_sel_shift = 1, .boot_device_table = uniphier_ld4_boot_device_table, .boot_device_count = &uniphier_ld4_boot_device_count, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = false, }, #endif @@ -51,6 +54,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_sel_shift = 1, .boot_device_table = uniphier_ld4_boot_device_table, .boot_device_count = &uniphier_ld4_boot_device_count, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = true, }, #endif @@ -60,6 +64,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_sel_shift = 1, .boot_device_table = uniphier_pro5_boot_device_table, .boot_device_count = &uniphier_pro5_boot_device_count, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = false, }, #endif @@ -71,6 +76,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_count = &uniphier_pxs2_boot_device_count, .boot_device_is_usb = uniphier_pxs2_boot_device_is_usb, .boot_device_fixup = uniphier_pxs2_boot_device_fixup, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = false, }, #endif @@ -82,6 +88,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_count = &uniphier_pxs2_boot_device_count, .boot_device_is_usb = uniphier_pxs2_boot_device_is_usb, .boot_device_fixup = uniphier_pxs2_boot_device_fixup, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = true, /* STM on A-chip */ }, #endif @@ -92,6 +99,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_table = uniphier_ld11_boot_device_table, .boot_device_count = &uniphier_ld11_boot_device_count, .boot_device_is_usb = uniphier_ld11_boot_device_is_usb, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = true, }, #endif @@ -102,6 +110,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_table = uniphier_ld11_boot_device_table, .boot_device_count = &uniphier_ld11_boot_device_count, .boot_device_is_usb = uniphier_ld20_boot_device_is_usb, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = true, }, #endif @@ -112,6 +121,7 @@ static const struct uniphier_boot_device_info uniphier_boot_device_info[] = { .boot_device_table = uniphier_pxs3_boot_device_table, .boot_device_count = &uniphier_pxs3_boot_device_count, .boot_device_is_usb = uniphier_pxs3_boot_device_is_usb, + .boot_is_swapped = uniphier_sbc_boot_is_swapped, .have_internal_stm = false, }, #endif @@ -125,7 +135,7 @@ static unsigned int __uniphier_boot_device_raw( u32 pinmon; unsigned int boot_sel; - if (boot_is_swapped()) + if (info->boot_is_swapped && info->boot_is_swapped()) return BOOT_DEVICE_NOR; pinmon = readl(SG_PINMON0); @@ -208,7 +218,9 @@ static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) printf("STB Micon: %s\n", uniphier_boot_from_backend() ? "OFF" : "ON"); - printf("Boot Swap: %s\n", boot_is_swapped() ? "ON" : "OFF"); + if (info->boot_is_swapped) + printf("Boot Swap: %s\n", + info->boot_is_swapped() ? "ON" : "OFF"); pinmon = readl(SG_PINMON0); diff --git a/arch/arm/mach-uniphier/sbc/Makefile b/arch/arm/mach-uniphier/sbc/Makefile index 4efdd419f04..6c698a39225 100644 --- a/arch/arm/mach-uniphier/sbc/Makefile +++ b/arch/arm/mach-uniphier/sbc/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ -obj- += dummy.o +obj-y += sbc-boot.o ifndef CONFIG_SPL_BUILD obj-y += sbc.o diff --git a/arch/arm/mach-uniphier/sbc/sbc-boot.c b/arch/arm/mach-uniphier/sbc/sbc-boot.c new file mode 100644 index 00000000000..ec22b453e0f --- /dev/null +++ b/arch/arm/mach-uniphier/sbc/sbc-boot.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright (C) 2011-2014 Panasonic Corporation +// Copyright (C) 2015-2019 Socionext Inc. + +#include <linux/io.h> + +#include "sbc-regs.h" + +int uniphier_sbc_boot_is_swapped(void) +{ + return !(readl(SBBASE0) & SBBASE_BANK_ENABLE); +} diff --git a/arch/arm/mach-uniphier/sbc/sbc-regs.h b/arch/arm/mach-uniphier/sbc/sbc-regs.h index e866816472b..1e9618653f2 100644 --- a/arch/arm/mach-uniphier/sbc/sbc-regs.h +++ b/arch/arm/mach-uniphier/sbc/sbc-regs.h @@ -76,14 +76,7 @@ #define PC0CTRL 0x598000c0 -#ifndef __ASSEMBLY__ -#include <linux/io.h> -static inline int boot_is_swapped(void) -{ - return !(readl(SBBASE0) & SBBASE_BANK_ENABLE); -} -#endif - +int uniphier_sbc_boot_is_swapped(void); int uniphier_sbc_is_enabled(void); #endif /* ARCH_SBC_REGS_H */ diff --git a/arch/arm/mach-uniphier/sbc/sbc.c b/arch/arm/mach-uniphier/sbc/sbc.c index 6cf8cf2af80..af8d6f4f9dc 100644 --- a/arch/arm/mach-uniphier/sbc/sbc.c +++ b/arch/arm/mach-uniphier/sbc/sbc.c @@ -64,7 +64,7 @@ static void __uniphier_sbc_init(int savepin) writel(SBCTRL2_ADMULTIPLX_MEM_VALUE, SBCTRL12); } - if (boot_is_swapped()) { + if (uniphier_sbc_boot_is_swapped()) { /* * Boot Swap On: boot from external NOR/SRAM * 0x42000000-0x43ffffff is a mirror of 0x40000000-0x41ffffff. |