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 static void uniphier_nand_pin_init(bool cs2
)
53 #ifdef CONFIG_NAND_DENALI
54 if (uniphier_pin_init(cs2
? "nand2cs_grp" : "nand_grp"))
55 pr_err("failed to init NAND pins\n");
63 switch (uniphier_get_soc_type()) {
64 #if defined(CONFIG_ARCH_UNIPHIER_SLD3)
65 case SOC_UNIPHIER_SLD3
:
66 uniphier_nand_pin_init(true);
68 uniphier_sld3_pll_init();
69 uniphier_ld4_clk_init();
72 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
73 case SOC_UNIPHIER_LD4
:
74 uniphier_nand_pin_init(true);
76 uniphier_ld4_pll_init();
77 uniphier_ld4_clk_init();
80 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
81 case SOC_UNIPHIER_PRO4
:
82 uniphier_nand_pin_init(false);
84 uniphier_pro4_pll_init();
85 uniphier_pro4_clk_init();
88 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
89 case SOC_UNIPHIER_SLD8
:
90 uniphier_nand_pin_init(true);
92 uniphier_ld4_pll_init();
93 uniphier_ld4_clk_init();
96 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
97 case SOC_UNIPHIER_PRO5
:
98 uniphier_nand_pin_init(true);
100 uniphier_pro5_clk_init();
103 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
104 case SOC_UNIPHIER_PXS2
:
105 uniphier_nand_pin_init(true);
107 uniphier_pxs2_clk_init();
110 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
111 case SOC_UNIPHIER_LD6B
:
112 uniphier_nand_pin_init(true);
114 uniphier_pxs2_clk_init();
117 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
118 case SOC_UNIPHIER_LD11
:
119 uniphier_nand_pin_init(false);
120 sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
122 sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
125 uniphier_ld11_clk_init();
128 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
129 case SOC_UNIPHIER_LD20
:
130 uniphier_nand_pin_init(false);
131 sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
133 sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */
136 uniphier_ld20_clk_init();
144 uniphier_setup_xirq();
148 support_card_late_init();
153 uniphier_smp_kick_all_cpus();