blob: 7535f915286d430451abe4409b020839d5807871 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +09002/*
Masahiro Yamadae59ed192016-09-14 01:06:08 +09003 * Copyright (C) 2012-2015 Panasonic Corporation
4 * Copyright (C) 2015-2016 Socionext Inc.
5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +09006 */
7
Masahiro Yamada7b9fc452017-11-29 15:01:22 +09008#include <linux/errno.h>
Masahiro Yamada24802562016-06-29 19:39:03 +09009#include <linux/io.h>
Masahiro Yamada7b9fc452017-11-29 15:01:22 +090010#include <linux/printk.h>
Masahiro Yamada24802562016-06-29 19:39:03 +090011
Masahiro Yamadaefdf3402016-01-09 01:51:13 +090012#include "init.h"
13#include "micro-support-card.h"
14#include "soc-info.h"
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +090015
Masahiro Yamada266111c2017-01-15 14:59:08 +090016#ifdef CONFIG_ARCH_UNIPHIER_LD20
17static void uniphier_ld20_misc_init(void)
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +090018{
Masahiro Yamada266111c2017-01-15 14:59:08 +090019 /* ES1 errata: increase VDD09 supply to suppress VBO noise */
20 if (uniphier_get_soc_revision() == 1) {
21 writel(0x00000003, 0x6184e004);
22 writel(0x00000100, 0x6184e040);
23 writel(0x0000b500, 0x6184e024);
24 writel(0x00000001, 0x6184e000);
25 }
Masahiro Yamada266111c2017-01-15 14:59:08 +090026}
27#endif
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +090028
Masahiro Yamada266111c2017-01-15 14:59:08 +090029struct uniphier_initdata {
Masahiro Yamada31649052017-01-21 18:05:26 +090030 unsigned int soc_id;
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090031 void (*sbc_init)(void);
Masahiro Yamada266111c2017-01-15 14:59:08 +090032 void (*pll_init)(void);
33 void (*clk_init)(void);
34 void (*misc_init)(void);
35};
36
Masahiro Yamadaf17e5982017-01-21 18:05:21 +090037static const struct uniphier_initdata uniphier_initdata[] = {
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090038#if defined(CONFIG_ARCH_UNIPHIER_LD4)
Masahiro Yamada266111c2017-01-15 14:59:08 +090039 {
Masahiro Yamada31649052017-01-21 18:05:26 +090040 .soc_id = UNIPHIER_LD4_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090041 .sbc_init = uniphier_ld4_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090042 .pll_init = uniphier_ld4_pll_init,
43 .clk_init = uniphier_ld4_clk_init,
44 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090045#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090046#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada266111c2017-01-15 14:59:08 +090047 {
Masahiro Yamada31649052017-01-21 18:05:26 +090048 .soc_id = UNIPHIER_PRO4_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090049 .sbc_init = uniphier_sbc_init_savepin,
Masahiro Yamada266111c2017-01-15 14:59:08 +090050 .pll_init = uniphier_pro4_pll_init,
51 .clk_init = uniphier_pro4_clk_init,
52 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090053#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090054#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada266111c2017-01-15 14:59:08 +090055 {
Masahiro Yamada31649052017-01-21 18:05:26 +090056 .soc_id = UNIPHIER_SLD8_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090057 .sbc_init = uniphier_ld4_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090058 .pll_init = uniphier_ld4_pll_init,
59 .clk_init = uniphier_ld4_clk_init,
60 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090061#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090062#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada266111c2017-01-15 14:59:08 +090063 {
Masahiro Yamada31649052017-01-21 18:05:26 +090064 .soc_id = UNIPHIER_PRO5_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090065 .sbc_init = uniphier_sbc_init_savepin,
Masahiro Yamada266111c2017-01-15 14:59:08 +090066 .clk_init = uniphier_pro5_clk_init,
67 },
Masahiro Yamadad5167d52015-09-22 00:27:40 +090068#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090069#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada266111c2017-01-15 14:59:08 +090070 {
Masahiro Yamada31649052017-01-21 18:05:26 +090071 .soc_id = UNIPHIER_PXS2_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090072 .sbc_init = uniphier_pxs2_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090073 .clk_init = uniphier_pxs2_clk_init,
74 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090075#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090076#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada266111c2017-01-15 14:59:08 +090077 {
Masahiro Yamada31649052017-01-21 18:05:26 +090078 .soc_id = UNIPHIER_LD6B_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090079 .sbc_init = uniphier_pxs2_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090080 .clk_init = uniphier_pxs2_clk_init,
81 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090082#endif
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090083#if defined(CONFIG_ARCH_UNIPHIER_LD11)
Masahiro Yamada266111c2017-01-15 14:59:08 +090084 {
Masahiro Yamada31649052017-01-21 18:05:26 +090085 .soc_id = UNIPHIER_LD11_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090086 .sbc_init = uniphier_ld11_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090087 .pll_init = uniphier_ld11_pll_init,
88 .clk_init = uniphier_ld11_clk_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090089 },
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090090#endif
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090091#if defined(CONFIG_ARCH_UNIPHIER_LD20)
Masahiro Yamada266111c2017-01-15 14:59:08 +090092 {
Masahiro Yamada31649052017-01-21 18:05:26 +090093 .soc_id = UNIPHIER_LD20_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090094 .sbc_init = uniphier_ld11_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090095 .pll_init = uniphier_ld20_pll_init,
Masahiro Yamadab3b1bb72017-02-17 16:17:22 +090096 .clk_init = uniphier_ld20_clk_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090097 .misc_init = uniphier_ld20_misc_init,
98 },
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090099#endif
Masahiro Yamada133b1262017-01-21 18:05:31 +0900100#if defined(CONFIG_ARCH_UNIPHIER_PXS3)
101 {
102 .soc_id = UNIPHIER_PXS3_ID,
Masahiro Yamada133b1262017-01-21 18:05:31 +0900103 .sbc_init = uniphier_pxs2_sbc_init,
104 .pll_init = uniphier_pxs3_pll_init,
Masahiro Yamada8e0a4502017-05-15 14:26:33 +0900105 .clk_init = uniphier_pxs3_clk_init,
Masahiro Yamada133b1262017-01-21 18:05:31 +0900106 },
107#endif
Masahiro Yamada266111c2017-01-15 14:59:08 +0900108};
Masahiro Yamada1b818982017-01-21 18:05:27 +0900109UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
Masahiro Yamada266111c2017-01-15 14:59:08 +0900110
111int board_init(void)
112{
Masahiro Yamadaf17e5982017-01-21 18:05:21 +0900113 const struct uniphier_initdata *initdata;
Masahiro Yamada266111c2017-01-15 14:59:08 +0900114
115 led_puts("U0");
116
Masahiro Yamada1b818982017-01-21 18:05:27 +0900117 initdata = uniphier_get_initdata();
Masahiro Yamada266111c2017-01-15 14:59:08 +0900118 if (!initdata) {
Masahiro Yamada1b818982017-01-21 18:05:27 +0900119 pr_err("unsupported SoC\n");
Masahiro Yamada266111c2017-01-15 14:59:08 +0900120 return -EINVAL;
121 }
122
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +0900123 initdata->sbc_init();
124
125 support_card_init();
126
127 led_puts("U0");
128
Masahiro Yamada266111c2017-01-15 14:59:08 +0900129 if (initdata->pll_init)
130 initdata->pll_init();
Masahiro Yamada24802562016-06-29 19:39:03 +0900131
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900132 led_puts("U1");
Masahiro Yamadac04368f2015-02-27 02:26:51 +0900133
Masahiro Yamada266111c2017-01-15 14:59:08 +0900134 if (initdata->clk_init)
135 initdata->clk_init();
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900136
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900137 led_puts("U2");
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900138
Masahiro Yamada266111c2017-01-15 14:59:08 +0900139 if (initdata->misc_init)
140 initdata->misc_init();
141
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900142 led_puts("U3");
Masahiro Yamada266111c2017-01-15 14:59:08 +0900143
Masahiro Yamada266111c2017-01-15 14:59:08 +0900144 support_card_late_init();
145
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900146 led_puts("Uboo");
147
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +0900148 return 0;
149}