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