2 * Copyright (C) 2012-2015 Panasonic Corporation
3 * Copyright (C) 2015-2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
6 * SPDX-License-Identifier: GPL-2.0+
14 #include "micro-support-card.h"
18 DECLARE_GLOBAL_DATA_PTR;
20 static void uniphier_setup_xirq(void)
22 const void *fdt = gd->fdt_blob;
23 int soc_node, aidet_node;
25 unsigned long aidet_base;
28 soc_node = fdt_path_offset(fdt, "/soc");
32 aidet_node = fdt_subnode_offset_namelen(fdt, soc_node, "aidet", 5);
36 val = fdt_getprop(fdt, aidet_node, "reg", NULL);
40 aidet_base = fdt32_to_cpu(*val);
42 tmp = readl(aidet_base + 8); /* AIDET DETCONFR2 */
43 tmp |= 0x00ff0000; /* Set XIRQ0-7 low active */
44 writel(tmp, aidet_base + 8);
46 tmp = readl(0x55000090); /* IRQCTL */
48 writel(tmp, 0x55000090);
51 #ifdef CONFIG_ARCH_UNIPHIER_LD11
52 static void uniphier_ld11_misc_init(void)
54 sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
56 sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
61 #ifdef CONFIG_ARCH_UNIPHIER_LD20
62 static void uniphier_ld20_misc_init(void)
64 sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
66 sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
69 /* ES1 errata: increase VDD09 supply to suppress VBO noise */
70 if (uniphier_get_soc_revision() == 1) {
71 writel(0x00000003, 0x6184e004);
72 writel(0x00000100, 0x6184e040);
73 writel(0x0000b500, 0x6184e024);
74 writel(0x00000001, 0x6184e000);
76 #ifdef CONFIG_ARMV8_MULTIENTRY
82 struct uniphier_initdata {
85 void (*sbc_init)(void);
86 void (*pll_init)(void);
87 void (*clk_init)(void);
88 void (*misc_init)(void);
91 static const struct uniphier_initdata uniphier_initdata[] = {
92 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
94 .soc_id = UNIPHIER_SLD3_ID,
96 .sbc_init = uniphier_sbc_init_admulti,
97 .pll_init = uniphier_sld3_pll_init,
98 .clk_init = uniphier_ld4_clk_init,
101 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
103 .soc_id = UNIPHIER_LD4_ID,
105 .sbc_init = uniphier_ld4_sbc_init,
106 .pll_init = uniphier_ld4_pll_init,
107 .clk_init = uniphier_ld4_clk_init,
110 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
112 .soc_id = UNIPHIER_PRO4_ID,
114 .sbc_init = uniphier_sbc_init_savepin,
115 .pll_init = uniphier_pro4_pll_init,
116 .clk_init = uniphier_pro4_clk_init,
119 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
121 .soc_id = UNIPHIER_SLD8_ID,
123 .sbc_init = uniphier_ld4_sbc_init,
124 .pll_init = uniphier_ld4_pll_init,
125 .clk_init = uniphier_ld4_clk_init,
128 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
130 .soc_id = UNIPHIER_PRO5_ID,
132 .sbc_init = uniphier_sbc_init_savepin,
133 .clk_init = uniphier_pro5_clk_init,
136 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
138 .soc_id = UNIPHIER_PXS2_ID,
140 .sbc_init = uniphier_pxs2_sbc_init,
141 .clk_init = uniphier_pxs2_clk_init,
144 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
146 .soc_id = UNIPHIER_LD6B_ID,
148 .sbc_init = uniphier_pxs2_sbc_init,
149 .clk_init = uniphier_pxs2_clk_init,
152 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
154 .soc_id = UNIPHIER_LD11_ID,
156 .sbc_init = uniphier_ld11_sbc_init,
157 .pll_init = uniphier_ld11_pll_init,
158 .clk_init = uniphier_ld11_clk_init,
159 .misc_init = uniphier_ld11_misc_init,
162 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
164 .soc_id = UNIPHIER_LD20_ID,
166 .sbc_init = uniphier_ld11_sbc_init,
167 .pll_init = uniphier_ld20_pll_init,
168 .clk_init = uniphier_ld20_clk_init,
169 .misc_init = uniphier_ld20_misc_init,
172 #if defined(CONFIG_ARCH_UNIPHIER_PXS3)
174 .soc_id = UNIPHIER_PXS3_ID,
176 .sbc_init = uniphier_pxs2_sbc_init,
177 .pll_init = uniphier_pxs3_pll_init,
178 .clk_init = uniphier_pxs3_clk_init,
182 UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
186 const struct uniphier_initdata *initdata;
191 initdata = uniphier_get_initdata();
193 pr_err("unsupported SoC\n");
197 initdata->sbc_init();
203 if (IS_ENABLED(CONFIG_NAND_DENALI)) {
204 ret = uniphier_pin_init(initdata->nand_2cs ?
205 "nand2cs_grp" : "nand_grp");
207 pr_err("failed to init NAND pins\n");
212 if (initdata->pll_init)
213 initdata->pll_init();
217 if (initdata->clk_init)
218 initdata->clk_init();
222 if (initdata->misc_init)
223 initdata->misc_init();
227 uniphier_setup_xirq();
231 support_card_late_init();
235 #ifdef CONFIG_ARMV8_MULTIENTRY
236 uniphier_smp_kick_all_cpus();