]> git.sur5r.net Git - u-boot/blob - arch/arm/mach-uniphier/board_init.c
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
[u-boot] / arch / arm / mach-uniphier / board_init.c
1 /*
2  * Copyright (C) 2012-2015 Panasonic Corporation
3  * Copyright (C) 2015-2016 Socionext Inc.
4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <linux/errno.h>
10 #include <linux/io.h>
11 #include <linux/printk.h>
12
13 #include "init.h"
14 #include "micro-support-card.h"
15 #include "soc-info.h"
16
17 #ifdef CONFIG_ARCH_UNIPHIER_LD20
18 static void uniphier_ld20_misc_init(void)
19 {
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         }
27 }
28 #endif
29
30 struct uniphier_initdata {
31         unsigned int soc_id;
32         void (*sbc_init)(void);
33         void (*pll_init)(void);
34         void (*clk_init)(void);
35         void (*misc_init)(void);
36 };
37
38 static const struct uniphier_initdata uniphier_initdata[] = {
39 #if defined(CONFIG_ARCH_UNIPHIER_LD4)
40         {
41                 .soc_id = UNIPHIER_LD4_ID,
42                 .sbc_init = uniphier_ld4_sbc_init,
43                 .pll_init = uniphier_ld4_pll_init,
44                 .clk_init = uniphier_ld4_clk_init,
45         },
46 #endif
47 #if defined(CONFIG_ARCH_UNIPHIER_PRO4)
48         {
49                 .soc_id = UNIPHIER_PRO4_ID,
50                 .sbc_init = uniphier_sbc_init_savepin,
51                 .pll_init = uniphier_pro4_pll_init,
52                 .clk_init = uniphier_pro4_clk_init,
53         },
54 #endif
55 #if defined(CONFIG_ARCH_UNIPHIER_SLD8)
56         {
57                 .soc_id = UNIPHIER_SLD8_ID,
58                 .sbc_init = uniphier_ld4_sbc_init,
59                 .pll_init = uniphier_ld4_pll_init,
60                 .clk_init = uniphier_ld4_clk_init,
61         },
62 #endif
63 #if defined(CONFIG_ARCH_UNIPHIER_PRO5)
64         {
65                 .soc_id = UNIPHIER_PRO5_ID,
66                 .sbc_init = uniphier_sbc_init_savepin,
67                 .clk_init = uniphier_pro5_clk_init,
68         },
69 #endif
70 #if defined(CONFIG_ARCH_UNIPHIER_PXS2)
71         {
72                 .soc_id = UNIPHIER_PXS2_ID,
73                 .sbc_init = uniphier_pxs2_sbc_init,
74                 .clk_init = uniphier_pxs2_clk_init,
75         },
76 #endif
77 #if defined(CONFIG_ARCH_UNIPHIER_LD6B)
78         {
79                 .soc_id = UNIPHIER_LD6B_ID,
80                 .sbc_init = uniphier_pxs2_sbc_init,
81                 .clk_init = uniphier_pxs2_clk_init,
82         },
83 #endif
84 #if defined(CONFIG_ARCH_UNIPHIER_LD11)
85         {
86                 .soc_id = UNIPHIER_LD11_ID,
87                 .sbc_init = uniphier_ld11_sbc_init,
88                 .pll_init = uniphier_ld11_pll_init,
89                 .clk_init = uniphier_ld11_clk_init,
90         },
91 #endif
92 #if defined(CONFIG_ARCH_UNIPHIER_LD20)
93         {
94                 .soc_id = UNIPHIER_LD20_ID,
95                 .sbc_init = uniphier_ld11_sbc_init,
96                 .pll_init = uniphier_ld20_pll_init,
97                 .clk_init = uniphier_ld20_clk_init,
98                 .misc_init = uniphier_ld20_misc_init,
99         },
100 #endif
101 #if defined(CONFIG_ARCH_UNIPHIER_PXS3)
102         {
103                 .soc_id = UNIPHIER_PXS3_ID,
104                 .sbc_init = uniphier_pxs2_sbc_init,
105                 .pll_init = uniphier_pxs3_pll_init,
106                 .clk_init = uniphier_pxs3_clk_init,
107         },
108 #endif
109 };
110 UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
111
112 int board_init(void)
113 {
114         const struct uniphier_initdata *initdata;
115
116         led_puts("U0");
117
118         initdata = uniphier_get_initdata();
119         if (!initdata) {
120                 pr_err("unsupported SoC\n");
121                 return -EINVAL;
122         }
123
124         initdata->sbc_init();
125
126         support_card_init();
127
128         led_puts("U0");
129
130         if (initdata->pll_init)
131                 initdata->pll_init();
132
133         led_puts("U1");
134
135         if (initdata->clk_init)
136                 initdata->clk_init();
137
138         led_puts("U2");
139
140         if (initdata->misc_init)
141                 initdata->misc_init();
142
143         led_puts("U3");
144
145         support_card_late_init();
146
147         led_puts("Uboo");
148
149         return 0;
150 }