Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | 4e5d28d | 2015-09-22 00:27:31 +0900 | [diff] [blame] | 2 | * Copyright (C) 2012-2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Masahiro Yamada | 2480256 | 2016-06-29 19:39:03 +0900 | [diff] [blame] | 7 | #include <common.h> |
| 8 | #include <libfdt.h> |
| 9 | #include <linux/io.h> |
| 10 | |
Masahiro Yamada | efdf340 | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 11 | #include "init.h" |
| 12 | #include "micro-support-card.h" |
| 13 | #include "soc-info.h" |
Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 14 | |
Masahiro Yamada | 2480256 | 2016-06-29 19:39:03 +0900 | [diff] [blame] | 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | static void uniphier_setup_xirq(void) |
| 18 | { |
| 19 | const void *fdt = gd->fdt_blob; |
| 20 | int soc_node, aidet_node; |
| 21 | const u32 *val; |
| 22 | unsigned long aidet_base; |
| 23 | u32 tmp; |
| 24 | |
| 25 | soc_node = fdt_path_offset(fdt, "/soc"); |
| 26 | if (soc_node < 0) |
| 27 | return; |
| 28 | |
| 29 | aidet_node = fdt_subnode_offset_namelen(fdt, soc_node, "aidet", 5); |
| 30 | if (aidet_node < 0) |
| 31 | return; |
| 32 | |
| 33 | val = fdt_getprop(fdt, aidet_node, "reg", NULL); |
| 34 | if (!val) |
| 35 | return; |
| 36 | |
| 37 | aidet_base = fdt32_to_cpu(*val); |
| 38 | |
| 39 | tmp = readl(aidet_base + 8); /* AIDET DETCONFR2 */ |
| 40 | tmp |= 0x00ff0000; /* Set XIRQ0-7 low active */ |
| 41 | writel(tmp, aidet_base + 8); |
| 42 | |
| 43 | tmp = readl(0x55000090); /* IRQCTL */ |
| 44 | tmp |= 0x000000ff; |
| 45 | writel(tmp, 0x55000090); |
| 46 | } |
| 47 | |
Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 48 | int board_early_init_f(void) |
| 49 | { |
Masahiro Yamada | 4e5d28d | 2015-09-22 00:27:31 +0900 | [diff] [blame] | 50 | led_puts("U0"); |
Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 51 | |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 52 | switch (uniphier_get_soc_type()) { |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 53 | #if defined(CONFIG_ARCH_UNIPHIER_SLD3) |
| 54 | case SOC_UNIPHIER_SLD3: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 55 | uniphier_sld3_pin_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 56 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 57 | uniphier_ld4_clk_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 58 | break; |
| 59 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 60 | #if defined(CONFIG_ARCH_UNIPHIER_LD4) |
| 61 | case SOC_UNIPHIER_LD4: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 62 | uniphier_ld4_pin_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 63 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 64 | uniphier_ld4_clk_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 65 | break; |
| 66 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 67 | #if defined(CONFIG_ARCH_UNIPHIER_PRO4) |
| 68 | case SOC_UNIPHIER_PRO4: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 69 | uniphier_pro4_pin_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 70 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 71 | uniphier_pro4_clk_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 72 | break; |
| 73 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 74 | #if defined(CONFIG_ARCH_UNIPHIER_SLD8) |
| 75 | case SOC_UNIPHIER_SLD8: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 76 | uniphier_sld8_pin_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 77 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 78 | uniphier_ld4_clk_init(); |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 79 | break; |
| 80 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 81 | #if defined(CONFIG_ARCH_UNIPHIER_PRO5) |
| 82 | case SOC_UNIPHIER_PRO5: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 83 | uniphier_pro5_pin_init(); |
Masahiro Yamada | d5167d5 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 84 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 85 | uniphier_pro5_clk_init(); |
Masahiro Yamada | d5167d5 | 2015-09-22 00:27:40 +0900 | [diff] [blame] | 86 | break; |
| 87 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 88 | #if defined(CONFIG_ARCH_UNIPHIER_PXS2) |
| 89 | case SOC_UNIPHIER_PXS2: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 90 | uniphier_pxs2_pin_init(); |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 91 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 92 | uniphier_pxs2_clk_init(); |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 93 | break; |
| 94 | #endif |
Masahiro Yamada | 53c59ae | 2016-03-18 16:41:43 +0900 | [diff] [blame] | 95 | #if defined(CONFIG_ARCH_UNIPHIER_LD6B) |
| 96 | case SOC_UNIPHIER_LD6B: |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 97 | uniphier_ld6b_pin_init(); |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 98 | led_puts("U1"); |
Masahiro Yamada | 9890569 | 2016-03-30 20:17:02 +0900 | [diff] [blame] | 99 | uniphier_pxs2_clk_init(); |
Masahiro Yamada | 1fe65d3 | 2015-09-22 00:27:41 +0900 | [diff] [blame] | 100 | break; |
| 101 | #endif |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 102 | #if defined(CONFIG_ARCH_UNIPHIER_LD11) |
| 103 | case SOC_UNIPHIER_LD11: |
| 104 | uniphier_ld20_pin_init(); |
| 105 | led_puts("U1"); |
| 106 | uniphier_ld11_clk_init(); |
| 107 | break; |
| 108 | #endif |
Masahiro Yamada | 063eb1e | 2016-04-21 14:43:18 +0900 | [diff] [blame] | 109 | #if defined(CONFIG_ARCH_UNIPHIER_LD20) |
| 110 | case SOC_UNIPHIER_LD20: |
| 111 | uniphier_ld20_pin_init(); |
| 112 | led_puts("U1"); |
| 113 | uniphier_ld20_clk_init(); |
| 114 | cci500_init(2); |
| 115 | break; |
| 116 | #endif |
Masahiro Yamada | 75f16f8 | 2015-09-22 00:27:39 +0900 | [diff] [blame] | 117 | default: |
| 118 | break; |
| 119 | } |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 120 | |
Masahiro Yamada | 2480256 | 2016-06-29 19:39:03 +0900 | [diff] [blame] | 121 | uniphier_setup_xirq(); |
| 122 | |
Masahiro Yamada | 4e5d28d | 2015-09-22 00:27:31 +0900 | [diff] [blame] | 123 | led_puts("U2"); |
Masahiro Yamada | c04368f | 2015-02-27 02:26:51 +0900 | [diff] [blame] | 124 | |
Masahiro Yamada | 1f3d9c7 | 2015-02-05 14:42:54 +0900 | [diff] [blame] | 125 | return 0; |
| 126 | } |