aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/micro-support-card.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 20:07:36 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 22:41:56 +0900
commit92d6524b4f19cac08dd47f656bce59a7db6d3c47 (patch)
tree7e69ddc6d96a0984945ff6cf78b3262f5cff23f4 /arch/arm/mach-uniphier/micro-support-card.c
parent9a2f0e5ccd8749e9cdb27c4f4edf07dd44ff36b7 (diff)
downloadu-boot-92d6524b4f19cac08dd47f656bce59a7db6d3c47.zip
u-boot-92d6524b4f19cac08dd47f656bce59a7db6d3c47.tar.gz
u-boot-92d6524b4f19cac08dd47f656bce59a7db6d3c47.tar.bz2
ARM: uniphier: check DT to determine whether to use support card
If CONFIG_MICRO_SUPPORT_CARD is enabled, U-Boot tries to get access to the devices on the support card, which may not actually exist. Check the DT and search for the on-board devices run-time. If the nodes are not found in DT, then disable the code. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/micro-support-card.c')
-rw-r--r--arch/arm/mach-uniphier/micro-support-card.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/micro-support-card.c b/arch/arm/mach-uniphier/micro-support-card.c
index 1be5685..4687901 100644
--- a/arch/arm/mach-uniphier/micro-support-card.c
+++ b/arch/arm/mach-uniphier/micro-support-card.c
@@ -18,6 +18,25 @@
#define MICRO_SUPPORT_CARD_RESET ((MICRO_SUPPORT_CARD_BASE) + 0xd0034)
#define MICRO_SUPPORT_CARD_REVISION ((MICRO_SUPPORT_CARD_BASE) + 0xd00E0)
+static bool support_card_found;
+
+static void support_card_detect(void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ const void *fdt = gd->fdt_blob;
+ int offset;
+
+ offset = fdt_node_offset_by_compatible(fdt, 0, "smsc,lan9118");
+ if (offset < 0)
+ return;
+
+ offset = fdt_node_offset_by_compatible(fdt, 0, "ns16550a");
+ if (offset < 0)
+ return;
+
+ support_card_found = true;
+}
+
/*
* 0: reset deassert, 1: reset
*
@@ -51,6 +70,11 @@ static int support_card_show_revision(void)
void support_card_init(void)
{
+ support_card_detect();
+
+ if (!support_card_found)
+ return;
+
support_card_reset();
/*
* After power on, we need to keep the LAN controller in reset state
@@ -67,6 +91,9 @@ void support_card_init(void)
int board_eth_init(bd_t *bis)
{
+ if (!support_card_found)
+ return 0;
+
return smc911x_initialize(0, SMC911X_BASE);
}
#endif
@@ -161,6 +188,9 @@ static void detect_num_flash_banks(void)
void support_card_late_init(void)
{
+ if (!support_card_found)
+ return;
+
detect_num_flash_banks();
}
@@ -221,6 +251,9 @@ void led_puts(const char *s)
int i;
u32 val = 0;
+ if (!support_card_found)
+ return;
+
if (!s)
return;