aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier
diff options
context:
space:
mode:
authorMasahiro Yamada2019-07-10 20:07:37 +0900
committerMasahiro Yamada2019-07-10 22:41:57 +0900
commitf7f390576d063f9fc6c2a00792acd835a75c88aa (patch)
tree6ca10d44183b3348eb2ed52f5f27b207c06492d7 /arch/arm/mach-uniphier
parent92d6524b4f19cac08dd47f656bce59a7db6d3c47 (diff)
ARM: uniphier: check DT to determine whether to initialize SBC
If CONFIG_MICRO_SUPPORT_CARD is enabled, U-Boot initialize SBC (System Bus Controller), which may not be really necessary. Check the "socionext,uniphier-system-bus" node in DT run-time. If and only if it is found and its "status" property is okay, initialize the SBC block. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier')
-rw-r--r--arch/arm/mach-uniphier/Makefile3
-rw-r--r--arch/arm/mach-uniphier/sbc/Makefile4
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-ld11.c3
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-ld4.c3
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-pxs2.c3
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc-regs.h2
-rw-r--r--arch/arm/mach-uniphier/sbc/sbc.c16
7 files changed, 33 insertions, 1 deletions
diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile
index d0c39d42737..caa79d1e53e 100644
--- a/arch/arm/mach-uniphier/Makefile
+++ b/arch/arm/mach-uniphier/Makefile
@@ -18,13 +18,14 @@ ifndef CONFIG_SYSRESET
obj-y += reset.o
endif
-obj-$(CONFIG_MICRO_SUPPORT_CARD) += sbc/ micro-support-card.o
+obj-$(CONFIG_MICRO_SUPPORT_CARD) += micro-support-card.o
obj-y += pinctrl-glue.o
obj-$(CONFIG_MMC) += mmc-first-dev.o
obj-y += fdt-fixup.o
endif
+obj-y += sbc/
obj-y += soc-info.o
obj-y += boot-device/
obj-y += clk/
diff --git a/arch/arm/mach-uniphier/sbc/Makefile b/arch/arm/mach-uniphier/sbc/Makefile
index 912e05a725d..4efdd419f04 100644
--- a/arch/arm/mach-uniphier/sbc/Makefile
+++ b/arch/arm/mach-uniphier/sbc/Makefile
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: GPL-2.0+
+obj- += dummy.o
+
+ifndef CONFIG_SPL_BUILD
obj-y += sbc.o
obj-$(CONFIG_ARCH_UNIPHIER_LD4) += sbc-ld4.o
@@ -9,3 +12,4 @@ obj-$(CONFIG_ARCH_UNIPHIER_LD6B) += sbc-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD11) += sbc-ld11.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += sbc-ld11.o
obj-$(CONFIG_ARCH_UNIPHIER_PXS3) += sbc-pxs2.o
+endif
diff --git a/arch/arm/mach-uniphier/sbc/sbc-ld11.c b/arch/arm/mach-uniphier/sbc/sbc-ld11.c
index 44d8a1e3bd9..21972ac9494 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-ld11.c
+++ b/arch/arm/mach-uniphier/sbc/sbc-ld11.c
@@ -12,6 +12,9 @@
void uniphier_ld11_sbc_init(void)
{
+ if (!uniphier_sbc_is_enabled())
+ return;
+
uniphier_sbc_init_savepin();
/* necessary for ROM boot ?? */
diff --git a/arch/arm/mach-uniphier/sbc/sbc-ld4.c b/arch/arm/mach-uniphier/sbc/sbc-ld4.c
index d08b571e23c..72e9743c8f8 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-ld4.c
+++ b/arch/arm/mach-uniphier/sbc/sbc-ld4.c
@@ -13,6 +13,9 @@ void uniphier_ld4_sbc_init(void)
{
u32 tmp;
+ if (!uniphier_sbc_is_enabled())
+ return;
+
uniphier_sbc_init_savepin();
/* system bus output enable */
diff --git a/arch/arm/mach-uniphier/sbc/sbc-pxs2.c b/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
index 8c167ef0698..3275f22ce96 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
+++ b/arch/arm/mach-uniphier/sbc/sbc-pxs2.c
@@ -10,6 +10,9 @@
void uniphier_pxs2_sbc_init(void)
{
+ if (!uniphier_sbc_is_enabled())
+ return;
+
uniphier_sbc_init_savepin();
/* necessary for ROM boot ?? */
diff --git a/arch/arm/mach-uniphier/sbc/sbc-regs.h b/arch/arm/mach-uniphier/sbc/sbc-regs.h
index 853015acbca..e866816472b 100644
--- a/arch/arm/mach-uniphier/sbc/sbc-regs.h
+++ b/arch/arm/mach-uniphier/sbc/sbc-regs.h
@@ -84,4 +84,6 @@ static inline int boot_is_swapped(void)
}
#endif
+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 df01e5c01d5..6cf8cf2af80 100644
--- a/arch/arm/mach-uniphier/sbc/sbc.c
+++ b/arch/arm/mach-uniphier/sbc/sbc.c
@@ -5,7 +5,9 @@
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*/
+#include <common.h>
#include <linux/io.h>
+#include <asm/global_data.h>
#include "../init.h"
#include "sbc-regs.h"
@@ -31,6 +33,20 @@
#define SBCTRL2_SAVEPIN_MEM_VALUE 0x34000009
#define SBCTRL4_SAVEPIN_MEM_VALUE 0x02110210
+int uniphier_sbc_is_enabled(void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ const void *fdt = gd->fdt_blob;
+ int offset;
+
+ offset = fdt_node_offset_by_compatible(fdt, 0,
+ "socionext,uniphier-system-bus");
+ if (offset < 0)
+ return 0;
+
+ return fdtdec_get_is_enabled(fdt, offset);
+}
+
static void __uniphier_sbc_init(int savepin)
{
/*