summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-01-22 22:07:48 (GMT)
committerTom Rini <trini@konsulko.com>2017-01-22 22:07:48 (GMT)
commit0c9e85f67cd86d2d7a3424ea3ebff0e6db7a3915 (patch)
tree1ac6999d2934173b7575540b310fda3147aaf67a /arch/arm/mach-uniphier
parentafdf09ac260f7ec245c85b94a5de5f92af06bc25 (diff)
parent2c2ab3d495a1a9fbfcec58f469255595a86e3aad (diff)
downloadu-boot-0c9e85f67cd86d2d7a3424ea3ebff0e6db7a3915.tar.xz
Merge branch 'master' of git://git.denx.de/u-boot-uniphier
- Allow to disable SPL (mainly for ATF) - Refactor SoC init code - Update DRAM settings - Add PXs3 SoC support (DT, pinctrl driver, SoC code)
Diffstat (limited to 'arch/arm/mach-uniphier')
-rw-r--r--arch/arm/mach-uniphier/Kconfig54
-rw-r--r--arch/arm/mach-uniphier/Makefile4
-rw-r--r--arch/arm/mach-uniphier/arm32/psci.c12
-rw-r--r--arch/arm/mach-uniphier/arm64/Makefile5
-rw-r--r--arch/arm/mach-uniphier/board_init.c57
-rw-r--r--arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.c9
-rw-r--r--arch/arm/mach-uniphier/boot-mode/boot-mode.c32
-rw-r--r--arch/arm/mach-uniphier/boot-mode/cmd_pinmon.c20
-rw-r--r--arch/arm/mach-uniphier/boot-mode/spl_board.c6
-rw-r--r--arch/arm/mach-uniphier/clk/Makefile1
-rw-r--r--arch/arm/mach-uniphier/clk/dpll-ld4.c2
-rw-r--r--arch/arm/mach-uniphier/clk/dpll-pro4.c2
-rw-r--r--arch/arm/mach-uniphier/clk/dpll-sld8.c2
-rw-r--r--arch/arm/mach-uniphier/clk/pll-base-ld20.c3
-rw-r--r--arch/arm/mach-uniphier/clk/pll-ld4.c2
-rw-r--r--arch/arm/mach-uniphier/clk/pll-pro4.c2
-rw-r--r--arch/arm/mach-uniphier/clk/pll-pxs3.c7
-rw-r--r--arch/arm/mach-uniphier/cpu-info.c76
-rw-r--r--arch/arm/mach-uniphier/cpu_info.c73
-rw-r--r--arch/arm/mach-uniphier/debug-uart/debug-uart.c20
-rw-r--r--arch/arm/mach-uniphier/dram/cmd_ddrphy.c10
-rw-r--r--arch/arm/mach-uniphier/dram/ddrphy-ld4.c2
-rw-r--r--arch/arm/mach-uniphier/dram/ddrphy-training.c2
-rw-r--r--arch/arm/mach-uniphier/dram/umc-ld11.c1
-rw-r--r--arch/arm/mach-uniphier/dram/umc-ld20.c7
-rw-r--r--arch/arm/mach-uniphier/dram/umc-ld4.c2
-rw-r--r--arch/arm/mach-uniphier/dram/umc-pro4.c2
-rw-r--r--arch/arm/mach-uniphier/dram/umc-pxs2.c5
-rw-r--r--arch/arm/mach-uniphier/dram/umc-sld8.c2
-rw-r--r--arch/arm/mach-uniphier/dram_init.c4
-rw-r--r--arch/arm/mach-uniphier/init.h1
-rw-r--r--arch/arm/mach-uniphier/memconf.c2
-rw-r--r--arch/arm/mach-uniphier/pinctrl-glue.c2
-rw-r--r--arch/arm/mach-uniphier/sbc/Makefile1
-rw-r--r--arch/arm/mach-uniphier/sg-regs.h16
-rw-r--r--arch/arm/mach-uniphier/soc-info.c35
-rw-r--r--arch/arm/mach-uniphier/soc-info.h106
-rw-r--r--arch/arm/mach-uniphier/soc_info.c84
-rw-r--r--arch/arm/mach-uniphier/spl_board_init.c38
39 files changed, 324 insertions, 387 deletions
diff --git a/arch/arm/mach-uniphier/Kconfig b/arch/arm/mach-uniphier/Kconfig
index aa3909a..cd9ba6b 100644
--- a/arch/arm/mach-uniphier/Kconfig
+++ b/arch/arm/mach-uniphier/Kconfig
@@ -13,66 +13,86 @@ config ARCH_UNIPHIER_32BIT
config ARCH_UNIPHIER_64BIT
bool
select ARM64
- select SPL_SEPARATE_BSS
- select ARMV8_MULTIENTRY
- select ARMV8_SPIN_TABLE
+ select SPL_SEPARATE_BSS if SPL
+ select ARMV8_MULTIENTRY if SPL
+ select ARMV8_SPIN_TABLE if SPL
choice
prompt "UniPhier SoC select"
default ARCH_UNIPHIER_PRO4
config ARCH_UNIPHIER_SLD3
- bool "UniPhier PH1-sLD3 SoC"
+ bool "UniPhier sLD3 SoC"
select ARCH_UNIPHIER_32BIT
config ARCH_UNIPHIER_LD4_SLD8
- bool "UniPhier PH1-LD4/PH1-sLD8 SoC"
+ bool "UniPhier LD4/sLD8 SoCs"
select ARCH_UNIPHIER_32BIT
config ARCH_UNIPHIER_PRO4
- bool "UniPhier PH1-Pro4 SoC"
+ bool "UniPhier Pro4 SoC"
select ARCH_UNIPHIER_32BIT
config ARCH_UNIPHIER_PRO5_PXS2_LD6B
- bool "UniPhier PH1-Pro5/ProXstream2/PH1-LD6b SoC"
+ bool "UniPhier Pro5/PXs2/LD6b SoCs"
select ARCH_UNIPHIER_32BIT
-config ARCH_UNIPHIER_LD11
- bool "UniPhier PH1-LD11 SoC"
+config ARCH_UNIPHIER_LD11_SINGLE
+ bool "UniPhier LD11 SoC"
select ARCH_UNIPHIER_64BIT
-config ARCH_UNIPHIER_LD20
- bool "UniPhier PH1-LD20 SoC"
+config ARCH_UNIPHIER_LD20_SINGLE
+ bool "UniPhier LD20 SoC"
+ select ARCH_UNIPHIER_64BIT
+
+config ARCH_UNIPHIER_V8_MULTI
+ bool "UniPhier V8 SoCs"
+ depends on !SPL
select ARCH_UNIPHIER_64BIT
- select OF_BOARD_SETUP
endchoice
config ARCH_UNIPHIER_LD4
- bool "Enable UniPhier PH1-LD4 SoC support"
+ bool "Enable UniPhier LD4 SoC support"
depends on ARCH_UNIPHIER_LD4_SLD8
default y
config ARCH_UNIPHIER_SLD8
- bool "Enable UniPhier PH1-sLD8 SoC support"
+ bool "Enable UniPhier sLD8 SoC support"
depends on ARCH_UNIPHIER_LD4_SLD8
default y
config ARCH_UNIPHIER_PRO5
- bool "Enable UniPhier PH1-Pro5 SoC support"
+ bool "Enable UniPhier Pro5 SoC support"
depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
default y
config ARCH_UNIPHIER_PXS2
- bool "Enable UniPhier ProXstream2 SoC support"
+ bool "Enable UniPhier Pxs2 SoC support"
depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
default y
config ARCH_UNIPHIER_LD6B
- bool "Enable UniPhier PH1-LD6b SoC support"
+ bool "Enable UniPhier LD6b SoC support"
depends on ARCH_UNIPHIER_PRO5_PXS2_LD6B
default y
+config ARCH_UNIPHIER_LD11
+ bool "Enable UniPhier LD11 SoC support" if ARCH_UNIPHIER_V8_MULTI
+ depends on ARCH_UNIPHIER_LD11_SINGLE || ARCH_UNIPHIER_V8_MULTI
+ default y
+
+config ARCH_UNIPHIER_LD20
+ bool "Enable UniPhier LD20 SoC support" if ARCH_UNIPHIER_V8_MULTI
+ depends on ARCH_UNIPHIER_LD20_SINGLE || ARCH_UNIPHIER_V8_MULTI
+ select OF_BOARD_SETUP
+ default y
+
+config ARCH_UNIPHIER_PXS3
+ bool "Enable UniPhier PXs3 SoC support"
+ depends on ARCH_UNIPHIER_V8_MULTI
+ default y
+
config CACHE_UNIPHIER
bool "Enable the UniPhier L2 cache controller"
depends on ARCH_UNIPHIER_32BIT
diff --git a/arch/arm/mach-uniphier/Makefile b/arch/arm/mach-uniphier/Makefile
index ab2c6dc..abfdccc 100644
--- a/arch/arm/mach-uniphier/Makefile
+++ b/arch/arm/mach-uniphier/Makefile
@@ -10,7 +10,7 @@ obj-y += bcu/
else
-obj-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o
+obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
obj-y += dram_init.o
obj-y += board_init.o
obj-$(CONFIG_BOARD_LATE_INIT) += board_late_init.o
@@ -22,7 +22,7 @@ obj-y += pinctrl-glue.o
endif
obj-y += boards.o
-obj-y += soc_info.o
+obj-y += soc-info.o
obj-y += boot-mode/
obj-y += clk/
obj-y += dram/
diff --git a/arch/arm/mach-uniphier/arm32/psci.c b/arch/arm/mach-uniphier/arm32/psci.c
index e668265..65a468d 100644
--- a/arch/arm/mach-uniphier/arm32/psci.c
+++ b/arch/arm/mach-uniphier/arm32/psci.c
@@ -28,13 +28,13 @@ u32 uniphier_smp_booted[CONFIG_ARMV7_PSCI_NR_CPUS];
static int uniphier_get_nr_cpus(void)
{
- switch (uniphier_get_soc_type()) {
- case SOC_UNIPHIER_SLD3:
- case SOC_UNIPHIER_PRO4:
- case SOC_UNIPHIER_PRO5:
+ switch (uniphier_get_soc_id()) {
+ case UNIPHIER_SLD3_ID:
+ case UNIPHIER_PRO4_ID:
+ case UNIPHIER_PRO5_ID:
return 2;
- case SOC_UNIPHIER_PXS2:
- case SOC_UNIPHIER_LD6B:
+ case UNIPHIER_PXS2_ID:
+ case UNIPHIER_LD6B_ID:
return 4;
default:
return 1;
diff --git a/arch/arm/mach-uniphier/arm64/Makefile b/arch/arm/mach-uniphier/arm64/Makefile
index 5ed030a..eb34c20 100644
--- a/arch/arm/mach-uniphier/arm64/Makefile
+++ b/arch/arm/mach-uniphier/arm64/Makefile
@@ -5,6 +5,9 @@
ifdef CONFIG_SPL_BUILD
obj-y += timer.o
else
-obj-y += mem_map.o smp.o smp_kick_cpus.o
+obj-y += mem_map.o
+ifdef CONFIG_ARMV8_MULTIENTRY
+obj-y += smp.o smp_kick_cpus.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += arm-cci500.o
endif
+endif
diff --git a/arch/arm/mach-uniphier/board_init.c b/arch/arm/mach-uniphier/board_init.c
index 93330b0..e89a4c5 100644
--- a/arch/arm/mach-uniphier/board_init.c
+++ b/arch/arm/mach-uniphier/board_init.c
@@ -73,13 +73,14 @@ static void uniphier_ld20_misc_init(void)
writel(0x0000b500, 0x6184e024);
writel(0x00000001, 0x6184e000);
}
-
+#ifdef CONFIG_ARMV8_MULTIENTRY
cci500_init(2);
+#endif
}
#endif
struct uniphier_initdata {
- enum uniphier_soc_id soc_id;
+ unsigned int soc_id;
bool nand_2cs;
void (*sbc_init)(void);
void (*pll_init)(void);
@@ -87,10 +88,10 @@ struct uniphier_initdata {
void (*misc_init)(void);
};
-struct uniphier_initdata uniphier_initdata[] = {
+static const struct uniphier_initdata uniphier_initdata[] = {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
{
- .soc_id = SOC_UNIPHIER_SLD3,
+ .soc_id = UNIPHIER_SLD3_ID,
.nand_2cs = true,
.sbc_init = uniphier_sbc_init_admulti,
.pll_init = uniphier_sld3_pll_init,
@@ -99,7 +100,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4)
{
- .soc_id = SOC_UNIPHIER_LD4,
+ .soc_id = UNIPHIER_LD4_ID,
.nand_2cs = true,
.sbc_init = uniphier_ld4_sbc_init,
.pll_init = uniphier_ld4_pll_init,
@@ -108,7 +109,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
{
- .soc_id = SOC_UNIPHIER_PRO4,
+ .soc_id = UNIPHIER_PRO4_ID,
.nand_2cs = false,
.sbc_init = uniphier_sbc_init_savepin,
.pll_init = uniphier_pro4_pll_init,
@@ -117,7 +118,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
{
- .soc_id = SOC_UNIPHIER_SLD8,
+ .soc_id = UNIPHIER_SLD8_ID,
.nand_2cs = true,
.sbc_init = uniphier_ld4_sbc_init,
.pll_init = uniphier_ld4_pll_init,
@@ -126,7 +127,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
{
- .soc_id = SOC_UNIPHIER_PRO5,
+ .soc_id = UNIPHIER_PRO5_ID,
.nand_2cs = true,
.sbc_init = uniphier_sbc_init_savepin,
.clk_init = uniphier_pro5_clk_init,
@@ -134,7 +135,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
{
- .soc_id = SOC_UNIPHIER_PXS2,
+ .soc_id = UNIPHIER_PXS2_ID,
.nand_2cs = true,
.sbc_init = uniphier_pxs2_sbc_init,
.clk_init = uniphier_pxs2_clk_init,
@@ -142,7 +143,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
{
- .soc_id = SOC_UNIPHIER_LD6B,
+ .soc_id = UNIPHIER_LD6B_ID,
.nand_2cs = true,
.sbc_init = uniphier_pxs2_sbc_init,
.clk_init = uniphier_pxs2_clk_init,
@@ -150,7 +151,7 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11)
{
- .soc_id = SOC_UNIPHIER_LD11,
+ .soc_id = UNIPHIER_LD11_ID,
.nand_2cs = false,
.sbc_init = uniphier_ld11_sbc_init,
.pll_init = uniphier_ld11_pll_init,
@@ -160,40 +161,34 @@ struct uniphier_initdata uniphier_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20)
{
- .soc_id = SOC_UNIPHIER_LD20,
+ .soc_id = UNIPHIER_LD20_ID,
.nand_2cs = false,
.sbc_init = uniphier_ld11_sbc_init,
.pll_init = uniphier_ld20_pll_init,
.misc_init = uniphier_ld20_misc_init,
},
#endif
+#if defined(CONFIG_ARCH_UNIPHIER_PXS3)
+ {
+ .soc_id = UNIPHIER_PXS3_ID,
+ .nand_2cs = false,
+ .sbc_init = uniphier_pxs2_sbc_init,
+ .pll_init = uniphier_pxs3_pll_init,
+ },
+#endif
};
-
-static struct uniphier_initdata *uniphier_get_initdata(
- enum uniphier_soc_id soc_id)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(uniphier_initdata); i++) {
- if (uniphier_initdata[i].soc_id == soc_id)
- return &uniphier_initdata[i];
- }
-
- return NULL;
-}
+UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_initdata, uniphier_initdata)
int board_init(void)
{
- struct uniphier_initdata *initdata;
- enum uniphier_soc_id soc_id;
+ const struct uniphier_initdata *initdata;
int ret;
led_puts("U0");
- soc_id = uniphier_get_soc_type();
- initdata = uniphier_get_initdata(soc_id);
+ initdata = uniphier_get_initdata();
if (!initdata) {
- pr_err("unsupported board\n");
+ pr_err("unsupported SoC\n");
return -EINVAL;
}
@@ -235,7 +230,7 @@ int board_init(void)
led_puts("U6");
-#ifdef CONFIG_ARM64
+#ifdef CONFIG_ARMV8_MULTIENTRY
uniphier_smp_kick_all_cpus();
#endif
diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.c b/arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.c
index 24255a0..2992fd7 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode-ld20.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2016 Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2016-2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -57,14 +58,14 @@ u32 uniphier_ld20_boot_device(void)
int boot_mode;
u32 usb_boot_mask;
- switch (uniphier_get_soc_type()) {
+ switch (uniphier_get_soc_id()) {
#if defined(CONFIG_ARCH_UNIPHIER_LD11)
- case SOC_UNIPHIER_LD11:
+ case UNIPHIER_LD11_ID:
usb_boot_mask = 0x00000080;
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20)
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD20_ID:
usb_boot_mask = 0x00000780;
break;
#endif
diff --git a/arch/arm/mach-uniphier/boot-mode/boot-mode.c b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
index 1d53140..a552770 100644
--- a/arch/arm/mach-uniphier/boot-mode/boot-mode.c
+++ b/arch/arm/mach-uniphier/boot-mode/boot-mode.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <mmc.h>
#include <spl.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include "../sbc/sbc-regs.h"
#include "../soc-info.h"
@@ -18,30 +18,30 @@ u32 spl_boot_device_raw(void)
if (boot_is_swapped())
return BOOT_DEVICE_NOR;
- switch (uniphier_get_soc_type()) {
+ switch (uniphier_get_soc_id()) {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
- case SOC_UNIPHIER_SLD3:
+ case UNIPHIER_SLD3_ID:
return uniphier_sld3_boot_device();
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4) || defined(CONFIG_ARCH_UNIPHIER_PRO4) || \
defined(CONFIG_ARCH_UNIPHIER_SLD8)
- case SOC_UNIPHIER_LD4:
- case SOC_UNIPHIER_PRO4:
- case SOC_UNIPHIER_SLD8:
+ case UNIPHIER_LD4_ID:
+ case UNIPHIER_PRO4_ID:
+ case UNIPHIER_SLD8_ID:
return uniphier_ld4_boot_device();
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
- case SOC_UNIPHIER_PRO5:
+ case UNIPHIER_PRO5_ID:
return uniphier_pro5_boot_device();
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2) || defined(CONFIG_ARCH_UNIPHIER_LD6B)
- case SOC_UNIPHIER_PXS2:
- case SOC_UNIPHIER_LD6B:
+ case UNIPHIER_PXS2_ID:
+ case UNIPHIER_LD6B_ID:
return uniphier_pxs2_boot_device();
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20)
- case SOC_UNIPHIER_LD11:
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD11_ID:
+ case UNIPHIER_LD20_ID:
return uniphier_ld20_boot_device();
#endif
default:
@@ -55,17 +55,17 @@ u32 spl_boot_device(void)
mode = spl_boot_device_raw();
- switch (uniphier_get_soc_type()) {
+ switch (uniphier_get_soc_id()) {
#if defined(CONFIG_ARCH_UNIPHIER_PXS2) || defined(CONFIG_ARCH_UNIPHIER_LD6B)
- case SOC_UNIPHIER_PXS2:
- case SOC_UNIPHIER_LD6B:
+ case UNIPHIER_PXS2_ID:
+ case UNIPHIER_LD6B_ID:
if (mode == BOOT_DEVICE_USB)
mode = BOOT_DEVICE_NOR;
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20)
- case SOC_UNIPHIER_LD11:
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD11_ID:
+ case UNIPHIER_LD20_ID:
if (mode == BOOT_DEVICE_MMC1 || mode == BOOT_DEVICE_USB)
mode = BOOT_DEVICE_BOARD;
break;
diff --git a/arch/arm/mach-uniphier/boot-mode/cmd_pinmon.c b/arch/arm/mach-uniphier/boot-mode/cmd_pinmon.c
index a8ee382..670d4f6 100644
--- a/arch/arm/mach-uniphier/boot-mode/cmd_pinmon.c
+++ b/arch/arm/mach-uniphier/boot-mode/cmd_pinmon.c
@@ -14,34 +14,34 @@ static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
printf("Boot Swap: %s\n\n", boot_is_swapped() ? "ON" : "OFF");
- switch (uniphier_get_soc_type()) {
+ switch (uniphier_get_soc_id()) {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
- case SOC_UNIPHIER_SLD3:
+ case UNIPHIER_SLD3_ID:
uniphier_sld3_boot_mode_show();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4) || defined(CONFIG_ARCH_UNIPHIER_PRO4) || \
defined(CONFIG_ARCH_UNIPHIER_SLD8)
- case SOC_UNIPHIER_LD4:
- case SOC_UNIPHIER_PRO4:
- case SOC_UNIPHIER_SLD8:
+ case UNIPHIER_LD4_ID:
+ case UNIPHIER_PRO4_ID:
+ case UNIPHIER_SLD8_ID:
uniphier_ld4_boot_mode_show();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
- case SOC_UNIPHIER_PRO5:
+ case UNIPHIER_PRO5_ID:
uniphier_pro5_boot_mode_show();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2) || defined(CONFIG_ARCH_UNIPHIER_LD6B)
- case SOC_UNIPHIER_PXS2:
- case SOC_UNIPHIER_LD6B:
+ case UNIPHIER_PXS2_ID:
+ case UNIPHIER_LD6B_ID:
uniphier_pxs2_boot_mode_show();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20)
- case SOC_UNIPHIER_LD11:
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD11_ID:
+ case UNIPHIER_LD20_ID:
uniphier_ld20_boot_mode_show();
break;
#endif
diff --git a/arch/arm/mach-uniphier/boot-mode/spl_board.c b/arch/arm/mach-uniphier/boot-mode/spl_board.c
index a6b6686..0aac924 100644
--- a/arch/arm/mach-uniphier/boot-mode/spl_board.c
+++ b/arch/arm/mach-uniphier/boot-mode/spl_board.c
@@ -40,11 +40,11 @@ int uniphier_rom_get_mmc_funcptr(int (**send_cmd)(u32, u32),
{
const struct uniphier_romfunc_table *table;
- switch (uniphier_get_soc_type()) {
- case SOC_UNIPHIER_LD11:
+ switch (uniphier_get_soc_id()) {
+ case UNIPHIER_LD11_ID:
table = &uniphier_ld11_romfunc_table;
break;
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD20_ID:
table = &uniphier_ld20_romfunc_table;
break;
default:
diff --git a/arch/arm/mach-uniphier/clk/Makefile b/arch/arm/mach-uniphier/clk/Makefile
index 37df04b..43df670 100644
--- a/arch/arm/mach-uniphier/clk/Makefile
+++ b/arch/arm/mach-uniphier/clk/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_ARCH_UNIPHIER_PXS2) += clk-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD6B) += clk-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD11) += clk-ld11.o pll-ld11.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += pll-ld20.o
+obj-$(CONFIG_ARCH_UNIPHIER_PXS3) += pll-pxs3.o
endif
diff --git a/arch/arm/mach-uniphier/clk/dpll-ld4.c b/arch/arm/mach-uniphier/clk/dpll-ld4.c
index a40b30d..56361ff 100644
--- a/arch/arm/mach-uniphier/clk/dpll-ld4.c
+++ b/arch/arm/mach-uniphier/clk/dpll-ld4.c
@@ -6,7 +6,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/dpll-pro4.c b/arch/arm/mach-uniphier/clk/dpll-pro4.c
index 3ac48d6..d6b6262 100644
--- a/arch/arm/mach-uniphier/clk/dpll-pro4.c
+++ b/arch/arm/mach-uniphier/clk/dpll-pro4.c
@@ -6,7 +6,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/dpll-sld8.c b/arch/arm/mach-uniphier/clk/dpll-sld8.c
index 7faa5e8..4a0010b 100644
--- a/arch/arm/mach-uniphier/clk/dpll-sld8.c
+++ b/arch/arm/mach-uniphier/clk/dpll-sld8.c
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <common.h>
+#include <linux/delay.h>
#include <linux/io.h>
#include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/pll-base-ld20.c b/arch/arm/mach-uniphier/clk/pll-base-ld20.c
index caa631d..c66f083 100644
--- a/arch/arm/mach-uniphier/clk/pll-base-ld20.c
+++ b/arch/arm/mach-uniphier/clk/pll-base-ld20.c
@@ -5,8 +5,9 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <common.h>
#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
diff --git a/arch/arm/mach-uniphier/clk/pll-ld4.c b/arch/arm/mach-uniphier/clk/pll-ld4.c
index 13257e4..55ac0ae 100644
--- a/arch/arm/mach-uniphier/clk/pll-ld4.c
+++ b/arch/arm/mach-uniphier/clk/pll-ld4.c
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <common.h>
+#include <linux/delay.h>
#include <linux/io.h>
#include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/pll-pro4.c b/arch/arm/mach-uniphier/clk/pll-pro4.c
index cdd1fd4..e4d1f72 100644
--- a/arch/arm/mach-uniphier/clk/pll-pro4.c
+++ b/arch/arm/mach-uniphier/clk/pll-pro4.c
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <common.h>
+#include <linux/delay.h>
#include <linux/io.h>
#include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/pll-pxs3.c b/arch/arm/mach-uniphier/clk/pll-pxs3.c
new file mode 100644
index 0000000..e29d9d0
--- /dev/null
+++ b/arch/arm/mach-uniphier/clk/pll-pxs3.c
@@ -0,0 +1,7 @@
+/*
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+void uniphier_pxs3_pll_init(void)
+{
+}
diff --git a/arch/arm/mach-uniphier/cpu-info.c b/arch/arm/mach-uniphier/cpu-info.c
new file mode 100644
index 0000000..94dce7c
--- /dev/null
+++ b/arch/arm/mach-uniphier/cpu-info.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2013-2014 Panasonic Corporation
+ * Copyright (C) 2015-2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <linux/errno.h>
+#include <linux/io.h>
+
+#include "soc-info.h"
+
+int print_cpuinfo(void)
+{
+ unsigned int id, model, rev, required_model = 1, required_rev = 1;
+
+ id = uniphier_get_soc_id();
+ model = uniphier_get_soc_model();
+ rev = uniphier_get_soc_revision();
+
+ puts("CPU: ");
+
+ switch (id) {
+ case UNIPHIER_SLD3_ID:
+ puts("sLD3 (MN2WS0220)");
+ required_model = 2;
+ break;
+ case UNIPHIER_LD4_ID:
+ puts("LD4 (MN2WS0250)");
+ required_rev = 2;
+ break;
+ case UNIPHIER_PRO4_ID:
+ puts("Pro4 (MN2WS0230)");
+ break;
+ case UNIPHIER_SLD8_ID:
+ puts("sLD8 (MN2WS0270)");
+ break;
+ case UNIPHIER_PRO5_ID:
+ puts("Pro5 (MN2WS0300)");
+ break;
+ case UNIPHIER_PXS2_ID:
+ puts("PXs2 (MN2WS0310)");
+ break;
+ case UNIPHIER_LD6B_ID:
+ puts("LD6b (MN2WS0320)");
+ break;
+ case UNIPHIER_LD11_ID:
+ puts("LD11 (SC1405AP1)");
+ break;
+ case UNIPHIER_LD20_ID:
+ puts("LD20 (SC1401AJ1)");
+ break;
+ case UNIPHIER_PXS3_ID:
+ puts("PXs3");
+ break;
+ default:
+ printf("Unknown Processor ID (0x%x)\n", id);
+ return -ENOTSUPP;
+ }
+
+ printf(" model %d (revision %d)\n", model, rev);
+
+ if (model < required_model) {
+ printf("Only model %d or newer is supported.\n",
+ required_model);
+ return -ENOTSUPP;
+ } else if (rev < required_rev) {
+ printf("Only revision %d or newer is supported.\n",
+ required_rev);
+ return -ENOTSUPP;
+ }
+
+ return 0;
+}
diff --git a/arch/arm/mach-uniphier/cpu_info.c b/arch/arm/mach-uniphier/cpu_info.c
deleted file mode 100644
index 6ad4c76..0000000
--- a/arch/arm/mach-uniphier/cpu_info.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2013-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <linux/io.h>
-
-#include "sg-regs.h"
-
-int print_cpuinfo(void)
-{
- u32 revision, type, model, rev, required_model = 1, required_rev = 1;
-
- revision = readl(SG_REVISION);
- type = (revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT;
- model = (revision & SG_REVISION_MODEL_MASK) >> SG_REVISION_MODEL_SHIFT;
- rev = (revision & SG_REVISION_REV_MASK) >> SG_REVISION_REV_SHIFT;
-
- puts("CPU: ");
-
- switch (type) {
- case 0x25:
- puts("PH1-sLD3 (MN2WS0220)");
- required_model = 2;
- break;
- case 0x26:
- puts("PH1-LD4 (MN2WS0250)");
- required_rev = 2;
- break;
- case 0x28:
- puts("PH1-Pro4 (MN2WS0230)");
- break;
- case 0x29:
- puts("PH1-sLD8 (MN2WS0270)");
- break;
- case 0x2A:
- puts("PH1-Pro5 (MN2WS0300)");
- break;
- case 0x2E:
- puts("ProXstream2 (MN2WS0310)");
- break;
- case 0x2F:
- puts("PH1-LD6b (MN2WS0320)");
- break;
- case 0x31:
- puts("PH1-LD11 (SC1405AP1)");
- break;
- case 0x32:
- puts("PH1-LD20 (SC1401AJ1)");
- break;
- default:
- printf("Unknown Processor ID (0x%x)\n", revision);
- return -1;
- }
-
- printf(" model %d", model);
-
- printf(" (rev. %d)\n", rev);
-
- if (model < required_model) {
- printf("Sorry, this model is not supported.\n");
- printf("Required model is %d.", required_model);
- return -1;
- } else if (rev < required_rev) {
- printf("Sorry, this revision is not supported.\n");
- printf("Required revision is %d.", required_rev);
- return -1;
- }
-
- return 0;
-}
diff --git a/arch/arm/mach-uniphier/debug-uart/debug-uart.c b/arch/arm/mach-uniphier/debug-uart/debug-uart.c
index d884785..72a514d 100644
--- a/arch/arm/mach-uniphier/debug-uart/debug-uart.c
+++ b/arch/arm/mach-uniphier/debug-uart/debug-uart.c
@@ -32,45 +32,45 @@ void _debug_uart_init(void)
void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
unsigned int divisor;
- switch (uniphier_get_soc_type()) {
+ switch (uniphier_get_soc_id()) {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
- case SOC_UNIPHIER_SLD3:
+ case UNIPHIER_SLD3_ID:
divisor = uniphier_sld3_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4)
- case SOC_UNIPHIER_LD4:
+ case UNIPHIER_LD4_ID:
divisor = uniphier_ld4_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
- case SOC_UNIPHIER_PRO4:
+ case UNIPHIER_PRO4_ID:
divisor = uniphier_pro4_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
- case SOC_UNIPHIER_SLD8:
+ case UNIPHIER_SLD8_ID:
divisor = uniphier_sld8_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
- case SOC_UNIPHIER_PRO5:
+ case UNIPHIER_PRO5_ID:
divisor = uniphier_pro5_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
- case SOC_UNIPHIER_PXS2:
+ case UNIPHIER_PXS2_ID:
divisor = uniphier_pxs2_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
- case SOC_UNIPHIER_LD6B:
+ case UNIPHIER_LD6B_ID:
divisor = uniphier_ld6b_debug_uart_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11) || defined(CONFIG_ARCH_UNIPHIER_LD20)
- case SOC_UNIPHIER_LD11:
- case SOC_UNIPHIER_LD20:
+ case UNIPHIER_LD11_ID:
+ case UNIPHIER_LD20_ID:
divisor = uniphier_ld20_debug_uart_init();
break;
#endif
diff --git a/arch/arm/mach-uniphier/dram/cmd_ddrphy.c b/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
index 9730330..d6d9db3 100644
--- a/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
+++ b/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
@@ -245,17 +245,17 @@ static int do_ddr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *cmd = argv[1];
const struct phy_param *phy_param;
- switch (uniphier_get_soc_type()) {
- case SOC_UNIPHIER_LD4:
+ switch (uniphier_get_soc_id()) {
+ case UNIPHIER_LD4_ID:
phy_param = uniphier_ld4_phy_param;
break;
- case SOC_UNIPHIER_PRO4:
+ case UNIPHIER_PRO4_ID:
phy_param = uniphier_pro4_phy_param;
break;
- case SOC_UNIPHIER_SLD8:
+ case UNIPHIER_SLD8_ID:
phy_param = uniphier_sld8_phy_param;
break;
- case SOC_UNIPHIER_LD11:
+ case UNIPHIER_LD11_ID:
phy_param = uniphier_ld11_phy_param;
break;
default:
diff --git a/arch/arm/mach-uniphier/dram/ddrphy-ld4.c b/arch/arm/mach-uniphier/dram/ddrphy-ld4.c
index 620668e..c20730d 100644
--- a/arch/arm/mach-uniphier/dram/ddrphy-ld4.c
+++ b/arch/arm/mach-uniphier/dram/ddrphy-ld4.c
@@ -6,7 +6,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include "ddrphy-init.h"
diff --git a/arch/arm/mach-uniphier/dram/ddrphy-training.c b/arch/arm/mach-uniphier/dram/ddrphy-training.c
index 005ca18..fa29a43 100644
--- a/arch/arm/mach-uniphier/dram/ddrphy-training.c
+++ b/arch/arm/mach-uniphier/dram/ddrphy-training.c
@@ -6,7 +6,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include "ddrphy-init.h"
diff --git a/arch/arm/mach-uniphier/dram/umc-ld11.c b/arch/arm/mach-uniphier/dram/umc-ld11.c
index 7dab00c..97a9fef 100644
--- a/arch/arm/mach-uniphier/dram/umc-ld11.c
+++ b/arch/arm/mach-uniphier/dram/umc-ld11.c
@@ -271,6 +271,7 @@ static void ddrphy_shift_rof_hws(void __iomem *phy_base, const int pos_shift[][2
rdqnsd = clamp(rdqnsd + ddrphy_hpstep(neg_shift[block][byte], dx, phy_base),
0U, 0xffU);
lcdlr1 = (lcdlr1 & ~(0xffff << 8)) | (rdqsd << 8) | (rdqnsd << 16);
+ writel(lcdlr1, phy_base + PHY_DXLCDLR1(dx));
readl(phy_base + PHY_DXLCDLR1(dx)); /* relax */
}
}
diff --git a/arch/arm/mach-uniphier/dram/umc-ld20.c b/arch/arm/mach-uniphier/dram/umc-ld20.c
index ecbe101..61f62ae 100644
--- a/arch/arm/mach-uniphier/dram/umc-ld20.c
+++ b/arch/arm/mach-uniphier/dram/umc-ld20.c
@@ -1,14 +1,15 @@
/*
* Copyright (C) 2016 Socionext Inc.
*
- * based on commit 5e1cb0f1caeabc6c99469dd997cb6b4f46834443 of Diag
+ * based on commit 1f6feb76e7f9753f51955444e422486521f9b3a3 of Diag
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <linux/bitops.h>
-#include <linux/err.h>
+#include <linux/compat.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/processor.h>
@@ -581,7 +582,7 @@ static int umc_dc_init(void __iomem *dc_base, unsigned int freq,
writel(umc_memconf0a[freq_e][size_e], dc_base + UMC_MEMCONF0A);
writel(umc_memconf0b[freq_e][size_e], dc_base + UMC_MEMCONF0B);
writel(umc_memconfch[freq_e][size_e], dc_base + UMC_MEMCONFCH);
- writel(0x00000008, dc_base + UMC_MEMMAPSET);
+ writel(0x00000000, dc_base + UMC_MEMMAPSET);
writel(umc_cmdctla[freq_e], dc_base + UMC_CMDCTLA);
writel(umc_cmdctlb[freq_e], dc_base + UMC_CMDCTLB);
diff --git a/arch/arm/mach-uniphier/dram/umc-ld4.c b/arch/arm/mach-uniphier/dram/umc-ld4.c
index 90e7f2d..06aa054 100644
--- a/arch/arm/mach-uniphier/dram/umc-ld4.c
+++ b/arch/arm/mach-uniphier/dram/umc-ld4.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/processor.h>
diff --git a/arch/arm/mach-uniphier/dram/umc-pro4.c b/arch/arm/mach-uniphier/dram/umc-pro4.c
index 5447fa9..740247a 100644
--- a/arch/arm/mach-uniphier/dram/umc-pro4.c
+++ b/arch/arm/mach-uniphier/dram/umc-pro4.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/processor.h>
diff --git a/arch/arm/mach-uniphier/dram/umc-pxs2.c b/arch/arm/mach-uniphier/dram/umc-pxs2.c
index b4da3d2..9aeda64 100644
--- a/arch/arm/mach-uniphier/dram/umc-pxs2.c
+++ b/arch/arm/mach-uniphier/dram/umc-pxs2.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2015-2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* based on commit 21b6e480f92ccc38fe0502e3116411d6509d3bf2 of Diag by:
* Copyright (C) 2015 Socionext Inc.
@@ -8,7 +9,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/processor.h>
diff --git a/arch/arm/mach-uniphier/dram/umc-sld8.c b/arch/arm/mach-uniphier/dram/umc-sld8.c
index 61369f1..a0c2871 100644
--- a/arch/arm/mach-uniphier/dram/umc-sld8.c
+++ b/arch/arm/mach-uniphier/dram/umc-sld8.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
#include <asm/processor.h>
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
index 489366c..2cf5f36 100644
--- a/arch/arm/mach-uniphier/dram_init.c
+++ b/arch/arm/mach-uniphier/dram_init.c
@@ -7,7 +7,7 @@
#include <common.h>
#include <libfdt.h>
#include <fdtdec.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include "init.h"
#include "soc-info.h"
@@ -97,7 +97,7 @@ int ft_board_setup(void *fdt, bd_t *bd)
const unsigned long rsv_size = 64;
int ch, ret;
- if (uniphier_get_soc_type() != SOC_UNIPHIER_LD20)
+ if (uniphier_get_soc_id() != UNIPHIER_LD20_ID)
return 0;
param = uniphier_get_board_param();
diff --git a/arch/arm/mach-uniphier/init.h b/arch/arm/mach-uniphier/init.h
index d207806..3aeb5b1 100644
--- a/arch/arm/mach-uniphier/init.h
+++ b/arch/arm/mach-uniphier/init.h
@@ -112,6 +112,7 @@ void uniphier_ld4_pll_init(void);
void uniphier_pro4_pll_init(void);
void uniphier_ld11_pll_init(void);
void uniphier_ld20_pll_init(void);
+void uniphier_pxs3_pll_init(void);
void uniphier_ld4_clk_init(void);
void uniphier_pro4_clk_init(void);
diff --git a/arch/arm/mach-uniphier/memconf.c b/arch/arm/mach-uniphier/memconf.c
index 205ccf1..dcfc645 100644
--- a/arch/arm/mach-uniphier/memconf.c
+++ b/arch/arm/mach-uniphier/memconf.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <linux/err.h>
+#include <linux/errno.h>
#include <linux/io.h>
#include <linux/sizes.h>
diff --git a/arch/arm/mach-uniphier/pinctrl-glue.c b/arch/arm/mach-uniphier/pinctrl-glue.c
index 48549e3..c52c6a6 100644
--- a/arch/arm/mach-uniphier/pinctrl-glue.c
+++ b/arch/arm/mach-uniphier/pinctrl-glue.c
@@ -5,7 +5,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <linux/err.h>
+#include <linux/errno.h>
#include <dm/device.h>
#include <dm/pinctrl.h>
#include <dm/uclass.h>
diff --git a/arch/arm/mach-uniphier/sbc/Makefile b/arch/arm/mach-uniphier/sbc/Makefile
index b85b1fe..fe9d85a 100644
--- a/arch/arm/mach-uniphier/sbc/Makefile
+++ b/arch/arm/mach-uniphier/sbc/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_ARCH_UNIPHIER_PXS2) += sbc-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD6B) += sbc-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD11) += sbc-ld11.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += sbc-ld11.o
+obj-$(CONFIG_ARCH_UNIPHIER_PXS3) += sbc-pxs2.o
diff --git a/arch/arm/mach-uniphier/sg-regs.h b/arch/arm/mach-uniphier/sg-regs.h
index a179d61..4d7e6f7 100644
--- a/arch/arm/mach-uniphier/sg-regs.h
+++ b/arch/arm/mach-uniphier/sg-regs.h
@@ -1,13 +1,15 @@
/*
* UniPhier SG (SoC Glue) block registers
*
- * Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2011-2015 Copyright (C) 2011-2015 Panasonic Corporation
+ * Copyright (C) 2016-2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
-#ifndef ARCH_SG_REGS_H
-#define ARCH_SG_REGS_H
+#ifndef UNIPHIER_SG_REGS_H
+#define UNIPHIER_SG_REGS_H
/* Base Address */
#define SG_CTRL_BASE 0x5f800000
@@ -15,12 +17,6 @@
/* Revision */
#define SG_REVISION (SG_CTRL_BASE | 0x0000)
-#define SG_REVISION_TYPE_SHIFT 16
-#define SG_REVISION_TYPE_MASK (0xff << SG_REVISION_TYPE_SHIFT)
-#define SG_REVISION_MODEL_SHIFT 8
-#define SG_REVISION_MODEL_MASK (0x3 << SG_REVISION_MODEL_SHIFT)
-#define SG_REVISION_REV_SHIFT 0
-#define SG_REVISION_REV_MASK (0x1f << SG_REVISION_REV_SHIFT)
/* Memory Configuration */
#define SG_MEMCONF (SG_CTRL_BASE | 0x0400)
@@ -140,4 +136,4 @@ static inline void sg_set_iectrl_range(unsigned min, unsigned max)
#endif /* __ASSEMBLY__ */
-#endif /* ARCH_SG_REGS_H */
+#endif /* UNIPHIER_SG_REGS_H */
diff --git a/arch/arm/mach-uniphier/soc-info.c b/arch/arm/mach-uniphier/soc-info.c
new file mode 100644
index 0000000..baf1be6
--- /dev/null
+++ b/arch/arm/mach-uniphier/soc-info.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <linux/io.h>
+#include <linux/types.h>
+
+#include "sg-regs.h"
+#include "soc-info.h"
+
+static unsigned int __uniphier_get_revision_field(unsigned int mask,
+ unsigned int shift)
+{
+ u32 revision = readl(SG_REVISION);
+
+ return (revision >> shift) & mask;
+}
+
+unsigned int uniphier_get_soc_id(void)
+{
+ return __uniphier_get_revision_field(0xff, 16);
+}
+
+unsigned int uniphier_get_soc_model(void)
+{
+ return __uniphier_get_revision_field(0x3, 8);
+}
+
+unsigned int uniphier_get_soc_revision(void)
+{
+ return __uniphier_get_revision_field(0x1f, 0);
+}
diff --git a/arch/arm/mach-uniphier/soc-info.h b/arch/arm/mach-uniphier/soc-info.h
index d9b38b3..0473252 100644
--- a/arch/arm/mach-uniphier/soc-info.h
+++ b/arch/arm/mach-uniphier/soc-info.h
@@ -1,76 +1,44 @@
/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
+ * Copyright (C) 2017 Socionext Inc.
+ * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
-#ifndef __MACH_SOC_INFO_H__
-#define __MACH_SOC_INFO_H__
-
-enum uniphier_soc_id {
- SOC_UNIPHIER_SLD3,
- SOC_UNIPHIER_LD4,
- SOC_UNIPHIER_PRO4,
- SOC_UNIPHIER_SLD8,
- SOC_UNIPHIER_PRO5,
- SOC_UNIPHIER_PXS2,
- SOC_UNIPHIER_LD6B,
- SOC_UNIPHIER_LD11,
- SOC_UNIPHIER_LD20,
- SOC_UNIPHIER_UNKNOWN,
-};
-
-#define UNIPHIER_NR_ENABLED_SOCS \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_SLD3) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_LD4) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_PRO4) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_SLD8) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_PRO5) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_PXS2) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_LD6B) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_LD11) + \
- IS_ENABLED(CONFIG_ARCH_UNIPHIER_LD20)
-
-#define UNIPHIER_MULTI_SOC ((UNIPHIER_NR_ENABLED_SOCS) > 1)
-
-#if UNIPHIER_MULTI_SOC
-enum uniphier_soc_id uniphier_get_soc_type(void);
-#else
-static inline enum uniphier_soc_id uniphier_get_soc_type(void)
-{
-#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
- return SOC_UNIPHIER_SLD3;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD4)
- return SOC_UNIPHIER_LD4;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
- return SOC_UNIPHIER_PRO4;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
- return SOC_UNIPHIER_SLD8;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
- return SOC_UNIPHIER_PRO5;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
- return SOC_UNIPHIER_PXS2;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
- return SOC_UNIPHIER_LD6B;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD11)
- return SOC_UNIPHIER_LD11;
-#endif
-#if defined(CONFIG_ARCH_UNIPHIER_LD20)
- return SOC_UNIPHIER_LD20;
-#endif
-
- return SOC_UNIPHIER_UNKNOWN;
+#ifndef __UNIPHIER_SOC_INFO_H__
+#define __UNIPHIER_SOC_INFO_H__
+
+#include <linux/kernel.h>
+#include <linux/stddef.h>
+
+#define UNIPHIER_SLD3_ID 0x25
+#define UNIPHIER_LD4_ID 0x26
+#define UNIPHIER_PRO4_ID 0x28
+#define UNIPHIER_SLD8_ID 0x29
+#define UNIPHIER_PRO5_ID 0x2a
+#define UNIPHIER_PXS2_ID 0x2e
+#define UNIPHIER_LD6B_ID 0x2f
+#define UNIPHIER_LD11_ID 0x31
+#define UNIPHIER_LD20_ID 0x32
+#define UNIPHIER_PXS3_ID 0x35
+
+unsigned int uniphier_get_soc_id(void);
+unsigned int uniphier_get_soc_model(void);
+unsigned int uniphier_get_soc_revision(void);
+
+#define UNIPHIER_DEFINE_SOCDATA_FUNC(__func_name, __table) \
+static typeof(&__table[0]) __func_name(void) \
+{ \
+ unsigned int soc_id; \
+ int i; \
+ \
+ soc_id = uniphier_get_soc_id(); \
+ for (i = 0; i < ARRAY_SIZE(__table); i++) { \
+ if (__table[i].soc_id == soc_id) \
+ return &__table[i]; \
+ } \
+ \
+ return NULL; \
}
-#endif
-
-int uniphier_get_soc_model(void);
-int uniphier_get_soc_revision(void);
-#endif /* __MACH_SOC_INFO_H__ */
+#endif /* __UNIPHIER_SOC_INFO_H__ */
diff --git a/arch/arm/mach-uniphier/soc_info.c b/arch/arm/mach-uniphier/soc_info.c
deleted file mode 100644
index 046104b..0000000
--- a/arch/arm/mach-uniphier/soc_info.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <linux/io.h>
-#include <linux/types.h>
-
-#include "sg-regs.h"
-#include "soc-info.h"
-
-#if UNIPHIER_MULTI_SOC
-enum uniphier_soc_id uniphier_get_soc_type(void)
-{
- u32 revision = readl(SG_REVISION);
- enum uniphier_soc_id ret;
-
- switch ((revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT) {
-#ifdef CONFIG_ARCH_UNIPHIER_SLD3
- case 0x25:
- ret = SOC_UNIPHIER_SLD3;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_LD4
- case 0x26:
- ret = SOC_UNIPHIER_LD4;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_PRO4
- case 0x28:
- ret = SOC_UNIPHIER_PRO4;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_SLD8
- case 0x29:
- ret = SOC_UNIPHIER_SLD8;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_PRO5
- case 0x2A:
- ret = SOC_UNIPHIER_PRO5;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_PXS2
- case 0x2E:
- ret = SOC_UNIPHIER_PXS2;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_LD6B
- case 0x2F:
- ret = SOC_UNIPHIER_LD6B;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_LD11
- case 0x31:
- ret = SOC_UNIPHIER_LD11;
- break;
-#endif
-#ifdef CONFIG_ARCH_UNIPHIER_LD20
- case 0x32:
- ret = SOC_UNIPHIER_LD20;
- break;
-#endif
- default:
- ret = SOC_UNIPHIER_UNKNOWN;
- break;
- }
-
- return ret;
-}
-#endif
-
-int uniphier_get_soc_model(void)
-{
- return (readl(SG_REVISION) & SG_REVISION_MODEL_MASK) >>
- SG_REVISION_MODEL_SHIFT;
-}
-
-int uniphier_get_soc_revision(void)
-{
- return (readl(SG_REVISION) & SG_REVISION_REV_MASK) >>
- SG_REVISION_REV_SHIFT;
-}
diff --git a/arch/arm/mach-uniphier/spl_board_init.c b/arch/arm/mach-uniphier/spl_board_init.c
index f4e1cb9..da749a3 100644
--- a/arch/arm/mach-uniphier/spl_board_init.c
+++ b/arch/arm/mach-uniphier/spl_board_init.c
@@ -14,7 +14,7 @@
#include "soc-info.h"
struct uniphier_spl_initdata {
- enum uniphier_soc_id soc_id;
+ unsigned int soc_id;
void (*bcu_init)(const struct uniphier_board_data *bd);
void (*early_clk_init)(void);
int (*dpll_init)(const struct uniphier_board_data *bd);
@@ -26,7 +26,7 @@ struct uniphier_spl_initdata {
static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
{
- .soc_id = SOC_UNIPHIER_SLD3,
+ .soc_id = UNIPHIER_SLD3_ID,
.bcu_init = uniphier_sld3_bcu_init,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_sld3_dpll_init,
@@ -37,7 +37,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4)
{
- .soc_id = SOC_UNIPHIER_LD4,
+ .soc_id = UNIPHIER_LD4_ID,
.bcu_init = uniphier_ld4_bcu_init,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_ld4_dpll_init,
@@ -48,7 +48,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
{
- .soc_id = SOC_UNIPHIER_PRO4,
+ .soc_id = UNIPHIER_PRO4_ID,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_pro4_dpll_init,
.memconf_init = uniphier_memconf_2ch_init,
@@ -58,7 +58,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
{
- .soc_id = SOC_UNIPHIER_SLD8,
+ .soc_id = UNIPHIER_SLD8_ID,
.bcu_init = uniphier_ld4_bcu_init,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_sld8_dpll_init,
@@ -69,7 +69,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
{
- .soc_id = SOC_UNIPHIER_PRO5,
+ .soc_id = UNIPHIER_PRO5_ID,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_pro5_dpll_init,
.memconf_init = uniphier_memconf_2ch_init,
@@ -79,7 +79,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
{
- .soc_id = SOC_UNIPHIER_PXS2,
+ .soc_id = UNIPHIER_PXS2_ID,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_pxs2_dpll_init,
.memconf_init = uniphier_memconf_3ch_init,
@@ -89,7 +89,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
{
- .soc_id = SOC_UNIPHIER_LD6B,
+ .soc_id = UNIPHIER_LD6B_ID,
.early_clk_init = uniphier_sld3_early_clk_init,
.dpll_init = uniphier_pxs2_dpll_init,
.memconf_init = uniphier_memconf_3ch_init,
@@ -99,7 +99,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11)
{
- .soc_id = SOC_UNIPHIER_LD11,
+ .soc_id = UNIPHIER_LD11_ID,
.early_clk_init = uniphier_ld11_early_clk_init,
.dpll_init = uniphier_ld11_dpll_init,
.memconf_init = uniphier_memconf_2ch_init,
@@ -109,7 +109,7 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20)
{
- .soc_id = SOC_UNIPHIER_LD20,
+ .soc_id = UNIPHIER_LD20_ID,
.early_clk_init = uniphier_ld11_early_clk_init,
.dpll_init = uniphier_ld20_dpll_init,
.memconf_init = uniphier_memconf_3ch_init,
@@ -118,25 +118,12 @@ static const struct uniphier_spl_initdata uniphier_spl_initdata[] = {
},
#endif
};
-
-static const struct uniphier_spl_initdata *uniphier_get_spl_initdata(
- enum uniphier_soc_id soc_id)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(uniphier_spl_initdata); i++) {
- if (uniphier_spl_initdata[i].soc_id == soc_id)
- return &uniphier_spl_initdata[i];
- }
-
- return NULL;
-}
+UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_spl_initdata, uniphier_spl_initdata)
void spl_board_init(void)
{
const struct uniphier_board_data *bd;
const struct uniphier_spl_initdata *initdata;
- enum uniphier_soc_id soc_id;
int ret;
#ifdef CONFIG_DEBUG_UART
@@ -147,8 +134,7 @@ void spl_board_init(void)
if (!bd)
hang();
- soc_id = uniphier_get_soc_type();
- initdata = uniphier_get_spl_initdata(soc_id);
+ initdata = uniphier_get_spl_initdata();
if (!initdata)
hang();