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"
17 DECLARE_GLOBAL_DATA_PTR;
19 static void uniphier_setup_xirq(void)
21 const void *fdt = gd->fdt_blob;
22 int soc_node, aidet_node;
24 unsigned long aidet_base;
27 soc_node = fdt_path_offset(fdt, "/soc");
31 aidet_node = fdt_subnode_offset_namelen(fdt, soc_node, "aidet", 5);
35 val = fdt_getprop(fdt, aidet_node, "reg", NULL);
39 aidet_base = fdt32_to_cpu(*val);
41 tmp = readl(aidet_base + 8); /* AIDET DETCONFR2 */
42 tmp |= 0x00ff0000; /* Set XIRQ0-7 low active */
43 writel(tmp, aidet_base + 8);
45 tmp = readl(0x55000090); /* IRQCTL */
47 writel(tmp, 0x55000090);
50 static void uniphier_nand_pin_init(bool cs2)
52 #ifdef CONFIG_NAND_DENALI
53 if (uniphier_pin_init(cs2 ? "nand2cs_grp" : "nand_grp"))
54 pr_err("failed to init NAND pins\n");
62 switch (uniphier_get_soc_type()) {
63 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
64 case SOC_UNIPHIER_SLD3:
65 uniphier_nand_pin_init(true);
67 uniphier_ld4_clk_init();
70 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
71 case SOC_UNIPHIER_LD4:
72 uniphier_nand_pin_init(true);
74 uniphier_ld4_clk_init();
77 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
78 case SOC_UNIPHIER_PRO4:
79 uniphier_nand_pin_init(false);
81 uniphier_pro4_clk_init();
84 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
85 case SOC_UNIPHIER_SLD8:
86 uniphier_nand_pin_init(true);
88 uniphier_ld4_clk_init();
91 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
92 case SOC_UNIPHIER_PRO5:
93 uniphier_nand_pin_init(true);
95 uniphier_pro5_clk_init();
98 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
99 case SOC_UNIPHIER_PXS2:
100 uniphier_nand_pin_init(true);
102 uniphier_pxs2_clk_init();
105 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
106 case SOC_UNIPHIER_LD6B:
107 uniphier_nand_pin_init(true);
109 uniphier_pxs2_clk_init();
112 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
113 case SOC_UNIPHIER_LD11:
114 uniphier_nand_pin_init(false);
115 uniphier_ld20_pin_init();
117 uniphier_ld11_clk_init();
120 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
121 case SOC_UNIPHIER_LD20:
122 uniphier_nand_pin_init(false);
123 uniphier_ld20_pin_init();
125 uniphier_ld20_clk_init();
133 uniphier_setup_xirq();
137 support_card_late_init();
142 uniphier_smp_kick_all_cpus();