]>
Commit | Line | Data |
---|---|---|
84ccd791 | 1 | /* |
b2916712 MY |
2 | * Copyright (C) 2012-2015 Panasonic Corporation |
3 | * Copyright (C) 2015-2016 Socionext Inc. | |
4 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> | |
84ccd791 MY |
5 | * |
6 | * SPDX-License-Identifier: GPL-2.0+ | |
7 | */ | |
8 | ||
ac389b07 | 9 | #include <linux/errno.h> |
e64a6b11 | 10 | #include <linux/io.h> |
ac389b07 | 11 | #include <linux/printk.h> |
e64a6b11 | 12 | |
107b3fb4 MY |
13 | #include "init.h" |
14 | #include "micro-support-card.h" | |
15 | #include "soc-info.h" | |
84ccd791 | 16 | |
b61664e2 MY |
17 | #ifdef CONFIG_ARCH_UNIPHIER_LD20 |
18 | static void uniphier_ld20_misc_init(void) | |
84ccd791 | 19 | { |
b61664e2 MY |
20 | /* ES1 errata: increase VDD09 supply to suppress VBO noise */ |
21 | if (uniphier_get_soc_revision() == 1) { | |
22 | writel(0x00000003, 0x6184e004); | |
23 | writel(0x00000100, 0x6184e040); | |
24 | writel(0x0000b500, 0x6184e024); | |
25 | writel(0x00000001, 0x6184e000); | |
26 | } | |
b61664e2 MY |
27 | } |
28 | #endif | |
29 | ||
30 | struct uniphier_initdata { | |
e27d6c7d | 31 | unsigned int soc_id; |
26b09c02 | 32 | void (*sbc_init)(void); |
b61664e2 MY |
33 | void (*pll_init)(void); |
34 | void (*clk_init)(void); | |
35 | void (*misc_init)(void); | |
36 | }; | |
84ccd791 | 37 | |
7a37bd64 | 38 | static const struct uniphier_initdata uniphier_initdata[] = { |
ea65c980 | 39 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
b61664e2 | 40 | { |
e27d6c7d | 41 | .soc_id = UNIPHIER_LD4_ID, |
26b09c02 | 42 | .sbc_init = uniphier_ld4_sbc_init, |
b61664e2 MY |
43 | .pll_init = uniphier_ld4_pll_init, |
44 | .clk_init = uniphier_ld4_clk_init, | |
45 | }, | |
323d1f9d | 46 | #endif |
ea65c980 | 47 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
b61664e2 | 48 | { |
e27d6c7d | 49 | .soc_id = UNIPHIER_PRO4_ID, |
26b09c02 | 50 | .sbc_init = uniphier_sbc_init_savepin, |
b61664e2 MY |
51 | .pll_init = uniphier_pro4_pll_init, |
52 | .clk_init = uniphier_pro4_clk_init, | |
53 | }, | |
323d1f9d | 54 | #endif |
ea65c980 | 55 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
b61664e2 | 56 | { |
e27d6c7d | 57 | .soc_id = UNIPHIER_SLD8_ID, |
26b09c02 | 58 | .sbc_init = uniphier_ld4_sbc_init, |
b61664e2 MY |
59 | .pll_init = uniphier_ld4_pll_init, |
60 | .clk_init = uniphier_ld4_clk_init, | |
61 | }, | |
28f40d4a | 62 | #endif |
ea65c980 | 63 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
b61664e2 | 64 | { |
e27d6c7d | 65 | .soc_id = UNIPHIER_PRO5_ID, |
26b09c02 | 66 | .sbc_init = uniphier_sbc_init_savepin, |
b61664e2 MY |
67 | .clk_init = uniphier_pro5_clk_init, |
68 | }, | |
019df879 | 69 | #endif |
ea65c980 | 70 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
b61664e2 | 71 | { |
e27d6c7d | 72 | .soc_id = UNIPHIER_PXS2_ID, |
26b09c02 | 73 | .sbc_init = uniphier_pxs2_sbc_init, |
b61664e2 MY |
74 | .clk_init = uniphier_pxs2_clk_init, |
75 | }, | |
019df879 | 76 | #endif |
ea65c980 | 77 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
b61664e2 | 78 | { |
e27d6c7d | 79 | .soc_id = UNIPHIER_LD6B_ID, |
26b09c02 | 80 | .sbc_init = uniphier_pxs2_sbc_init, |
b61664e2 MY |
81 | .clk_init = uniphier_pxs2_clk_init, |
82 | }, | |
9d0c2ceb | 83 | #endif |
667dbcd0 | 84 | #if defined(CONFIG_ARCH_UNIPHIER_LD11) |
b61664e2 | 85 | { |
e27d6c7d | 86 | .soc_id = UNIPHIER_LD11_ID, |
26b09c02 | 87 | .sbc_init = uniphier_ld11_sbc_init, |
b61664e2 MY |
88 | .pll_init = uniphier_ld11_pll_init, |
89 | .clk_init = uniphier_ld11_clk_init, | |
b61664e2 | 90 | }, |
667dbcd0 | 91 | #endif |
9d0c2ceb | 92 | #if defined(CONFIG_ARCH_UNIPHIER_LD20) |
b61664e2 | 93 | { |
e27d6c7d | 94 | .soc_id = UNIPHIER_LD20_ID, |
26b09c02 | 95 | .sbc_init = uniphier_ld11_sbc_init, |
b61664e2 | 96 | .pll_init = uniphier_ld20_pll_init, |
c21f5854 | 97 | .clk_init = uniphier_ld20_clk_init, |
b61664e2 MY |
98 | .misc_init = uniphier_ld20_misc_init, |
99 | }, | |
323d1f9d | 100 | #endif |
2c2ab3d4 MY |
101 | #if defined(CONFIG_ARCH_UNIPHIER_PXS3) |
102 | { | |
103 | .soc_id = UNIPHIER_PXS3_ID, | |
2c2ab3d4 MY |
104 | .sbc_init = uniphier_pxs2_sbc_init, |
105 | .pll_init = uniphier_pxs3_pll_init, | |
81afa9c9 | 106 | .clk_init = uniphier_pxs3_clk_init, |
2c2ab3d4 MY |
107 | }, |
108 | #endif | |
b61664e2 | 109 | }; |
ee8ef5af | 110 | UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata) |
b61664e2 MY |
111 | |
112 | int board_init(void) | |
113 | { | |
7a37bd64 | 114 | const struct uniphier_initdata *initdata; |
b61664e2 MY |
115 | |
116 | led_puts("U0"); | |
117 | ||
ee8ef5af | 118 | initdata = uniphier_get_initdata(); |
b61664e2 | 119 | if (!initdata) { |
ee8ef5af | 120 | pr_err("unsupported SoC\n"); |
b61664e2 MY |
121 | return -EINVAL; |
122 | } | |
123 | ||
26b09c02 MY |
124 | initdata->sbc_init(); |
125 | ||
126 | support_card_init(); | |
127 | ||
128 | led_puts("U0"); | |
129 | ||
b61664e2 MY |
130 | if (initdata->pll_init) |
131 | initdata->pll_init(); | |
e64a6b11 | 132 | |
e0daca7d | 133 | led_puts("U1"); |
198a97a6 | 134 | |
b61664e2 MY |
135 | if (initdata->clk_init) |
136 | initdata->clk_init(); | |
b2916712 | 137 | |
e0daca7d | 138 | led_puts("U2"); |
b2916712 | 139 | |
b61664e2 MY |
140 | if (initdata->misc_init) |
141 | initdata->misc_init(); | |
142 | ||
e0daca7d | 143 | led_puts("U3"); |
b61664e2 | 144 | |
b61664e2 MY |
145 | support_card_late_init(); |
146 | ||
b2916712 MY |
147 | led_puts("Uboo"); |
148 | ||
84ccd791 MY |
149 | return 0; |
150 | } |