blob: 4f9cd6e722c15ecbbda2c33efaac45c76fb618f4 [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,
Masahiro Yamada266111c2017-01-15 14:59:08 +090043 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090044#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090045#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
Masahiro Yamada266111c2017-01-15 14:59:08 +090046 {
Masahiro Yamada31649052017-01-21 18:05:26 +090047 .soc_id = UNIPHIER_PRO4_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090048 .sbc_init = uniphier_sbc_init_savepin,
Masahiro Yamada266111c2017-01-15 14:59:08 +090049 .pll_init = uniphier_pro4_pll_init,
50 .clk_init = uniphier_pro4_clk_init,
51 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090052#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090053#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
Masahiro Yamada266111c2017-01-15 14:59:08 +090054 {
Masahiro Yamada31649052017-01-21 18:05:26 +090055 .soc_id = UNIPHIER_SLD8_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090056 .sbc_init = uniphier_ld4_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090057 .pll_init = uniphier_ld4_pll_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090058 },
Masahiro Yamada75f16f82015-09-22 00:27:39 +090059#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090060#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
Masahiro Yamada266111c2017-01-15 14:59:08 +090061 {
Masahiro Yamada31649052017-01-21 18:05:26 +090062 .soc_id = UNIPHIER_PRO5_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090063 .sbc_init = uniphier_sbc_init_savepin,
Masahiro Yamada266111c2017-01-15 14:59:08 +090064 .clk_init = uniphier_pro5_clk_init,
65 },
Masahiro Yamadad5167d52015-09-22 00:27:40 +090066#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090067#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
Masahiro Yamada266111c2017-01-15 14:59:08 +090068 {
Masahiro Yamada31649052017-01-21 18:05:26 +090069 .soc_id = UNIPHIER_PXS2_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090070 .sbc_init = uniphier_pxs2_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090071 .clk_init = uniphier_pxs2_clk_init,
72 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090073#endif
Masahiro Yamada53c59ae2016-03-18 16:41:43 +090074#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
Masahiro Yamada266111c2017-01-15 14:59:08 +090075 {
Masahiro Yamada31649052017-01-21 18:05:26 +090076 .soc_id = UNIPHIER_LD6B_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090077 .sbc_init = uniphier_pxs2_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090078 .clk_init = uniphier_pxs2_clk_init,
79 },
Masahiro Yamada1fe65d32015-09-22 00:27:41 +090080#endif
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090081#if defined(CONFIG_ARCH_UNIPHIER_LD11)
Masahiro Yamada266111c2017-01-15 14:59:08 +090082 {
Masahiro Yamada31649052017-01-21 18:05:26 +090083 .soc_id = UNIPHIER_LD11_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090084 .sbc_init = uniphier_ld11_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090085 .pll_init = uniphier_ld11_pll_init,
86 .clk_init = uniphier_ld11_clk_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090087 },
Masahiro Yamada8bbbcbd2016-05-24 21:14:01 +090088#endif
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090089#if defined(CONFIG_ARCH_UNIPHIER_LD20)
Masahiro Yamada266111c2017-01-15 14:59:08 +090090 {
Masahiro Yamada31649052017-01-21 18:05:26 +090091 .soc_id = UNIPHIER_LD20_ID,
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +090092 .sbc_init = uniphier_ld11_sbc_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090093 .pll_init = uniphier_ld20_pll_init,
Masahiro Yamadab3b1bb72017-02-17 16:17:22 +090094 .clk_init = uniphier_ld20_clk_init,
Masahiro Yamada266111c2017-01-15 14:59:08 +090095 .misc_init = uniphier_ld20_misc_init,
96 },
Masahiro Yamada063eb1e2016-04-21 14:43:18 +090097#endif
Masahiro Yamada133b1262017-01-21 18:05:31 +090098#if defined(CONFIG_ARCH_UNIPHIER_PXS3)
99 {
100 .soc_id = UNIPHIER_PXS3_ID,
Masahiro Yamada133b1262017-01-21 18:05:31 +0900101 .sbc_init = uniphier_pxs2_sbc_init,
102 .pll_init = uniphier_pxs3_pll_init,
Masahiro Yamada8e0a4502017-05-15 14:26:33 +0900103 .clk_init = uniphier_pxs3_clk_init,
Masahiro Yamada133b1262017-01-21 18:05:31 +0900104 },
105#endif
Masahiro Yamada266111c2017-01-15 14:59:08 +0900106};
Masahiro Yamada1b818982017-01-21 18:05:27 +0900107UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
Masahiro Yamada266111c2017-01-15 14:59:08 +0900108
109int board_init(void)
110{
Masahiro Yamadaf17e5982017-01-21 18:05:21 +0900111 const struct uniphier_initdata *initdata;
Masahiro Yamada266111c2017-01-15 14:59:08 +0900112
113 led_puts("U0");
114
Masahiro Yamada1b818982017-01-21 18:05:27 +0900115 initdata = uniphier_get_initdata();
Masahiro Yamada266111c2017-01-15 14:59:08 +0900116 if (!initdata) {
Masahiro Yamada1b818982017-01-21 18:05:27 +0900117 pr_err("unsupported SoC\n");
Masahiro Yamada266111c2017-01-15 14:59:08 +0900118 return -EINVAL;
119 }
120
Masahiro Yamada0cc46ad2017-01-15 14:59:10 +0900121 initdata->sbc_init();
122
123 support_card_init();
124
125 led_puts("U0");
126
Masahiro Yamada266111c2017-01-15 14:59:08 +0900127 if (initdata->pll_init)
128 initdata->pll_init();
Masahiro Yamada24802562016-06-29 19:39:03 +0900129
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900130 led_puts("U1");
Masahiro Yamadac04368f2015-02-27 02:26:51 +0900131
Masahiro Yamada266111c2017-01-15 14:59:08 +0900132 if (initdata->clk_init)
133 initdata->clk_init();
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900134
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900135 led_puts("U2");
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900136
Masahiro Yamada266111c2017-01-15 14:59:08 +0900137 if (initdata->misc_init)
138 initdata->misc_init();
139
Masahiro Yamada285ceed2017-08-26 17:58:03 +0900140 led_puts("U3");
Masahiro Yamada266111c2017-01-15 14:59:08 +0900141
Masahiro Yamada266111c2017-01-15 14:59:08 +0900142 support_card_late_init();
143
Masahiro Yamadaee53ea72020-02-14 20:54:40 +0900144 led_puts("U4");
145
146 uniphier_nand_reset_assert();
147
Masahiro Yamadae59ed192016-09-14 01:06:08 +0900148 led_puts("Uboo");
149
Masahiro Yamada1f3d9c72015-02-05 14:42:54 +0900150 return 0;
151}