splash: Introduce default_splash_locations
[oweals/u-boot.git] / arch / arm / mach-uniphier / board_early_init_f.c
1 /*
2  * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <libfdt.h>
9 #include <linux/io.h>
10
11 #include "init.h"
12 #include "micro-support-card.h"
13 #include "soc-info.h"
14
15 DECLARE_GLOBAL_DATA_PTR;
16
17 static void uniphier_setup_xirq(void)
18 {
19         const void *fdt = gd->fdt_blob;
20         int soc_node, aidet_node;
21         const u32 *val;
22         unsigned long aidet_base;
23         u32 tmp;
24
25         soc_node = fdt_path_offset(fdt, "/soc");
26         if (soc_node < 0)
27                 return;
28
29         aidet_node = fdt_subnode_offset_namelen(fdt, soc_node, "aidet", 5);
30         if (aidet_node < 0)
31                 return;
32
33         val = fdt_getprop(fdt, aidet_node, "reg", NULL);
34         if (!val)
35                 return;
36
37         aidet_base = fdt32_to_cpu(*val);
38
39         tmp = readl(aidet_base + 8);    /* AIDET DETCONFR2 */
40         tmp |= 0x00ff0000;              /* Set XIRQ0-7 low active */
41         writel(tmp, aidet_base + 8);
42
43         tmp = readl(0x55000090);        /* IRQCTL */
44         tmp |= 0x000000ff;
45         writel(tmp, 0x55000090);
46 }
47
48 int board_early_init_f(void)
49 {
50         led_puts("U0");
51
52         switch (uniphier_get_soc_type()) {
53 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
54         case SOC_UNIPHIER_SLD3:
55                 uniphier_sld3_pin_init();
56                 led_puts("U1");
57                 uniphier_ld4_clk_init();
58                 break;
59 #endif
60 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
61         case SOC_UNIPHIER_LD4:
62                 uniphier_ld4_pin_init();
63                 led_puts("U1");
64                 uniphier_ld4_clk_init();
65                 break;
66 #endif
67 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
68         case SOC_UNIPHIER_PRO4:
69                 uniphier_pro4_pin_init();
70                 led_puts("U1");
71                 uniphier_pro4_clk_init();
72                 break;
73 #endif
74 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
75         case SOC_UNIPHIER_SLD8:
76                 uniphier_sld8_pin_init();
77                 led_puts("U1");
78                 uniphier_ld4_clk_init();
79                 break;
80 #endif
81 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
82         case SOC_UNIPHIER_PRO5:
83                 uniphier_pro5_pin_init();
84                 led_puts("U1");
85                 uniphier_pro5_clk_init();
86                 break;
87 #endif
88 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
89         case SOC_UNIPHIER_PXS2:
90                 uniphier_pxs2_pin_init();
91                 led_puts("U1");
92                 uniphier_pxs2_clk_init();
93                 break;
94 #endif
95 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
96         case SOC_UNIPHIER_LD6B:
97                 uniphier_ld6b_pin_init();
98                 led_puts("U1");
99                 uniphier_pxs2_clk_init();
100                 break;
101 #endif
102 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
103         case SOC_UNIPHIER_LD11:
104                 uniphier_ld20_pin_init();
105                 led_puts("U1");
106                 uniphier_ld11_clk_init();
107                 break;
108 #endif
109 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
110         case SOC_UNIPHIER_LD20:
111                 uniphier_ld20_pin_init();
112                 led_puts("U1");
113                 uniphier_ld20_clk_init();
114                 cci500_init(2);
115                 break;
116 #endif
117         default:
118                 break;
119         }
120
121         uniphier_setup_xirq();
122
123         led_puts("U2");
124
125         return 0;
126 }