diff mbox

[U-Boot,v2,1/7] arm: Add support for STMicroelectronics STiH410 soc

Message ID 1486055625-10095-2-git-send-email-patrice.chotard@st.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Patrice CHOTARD Feb. 2, 2017, 5:13 p.m. UTC
From: Patrice Chotard <patrice.chotard@st.com>

The STiH410 is an advanced multi-HD AVC processor with 3D
graphics acceleration and 1.5-GHz ARM Cortex-A9 SMP CPU
part of the stih407 family.

It has wide connectivity including USB 3.0, PCI-e, SATA
and gigabit ethernet.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
---
 arch/arm/Kconfig                           |  9 ++++++
 arch/arm/Makefile                          |  1 +
 arch/arm/include/asm/arch-stih410/gpio.h   | 20 +++++++++++++
 arch/arm/include/asm/arch-stih410/sti.h    | 14 +++++++++
 arch/arm/include/asm/arch-stih410/syscfg.h | 20 +++++++++++++
 arch/arm/mach-sti/Kconfig                  | 31 ++++++++++++++++++++
 arch/arm/mach-sti/Makefile                 |  8 +++++
 arch/arm/mach-sti/cpu.c                    | 16 ++++++++++
 arch/arm/mach-sti/timer.c                  | 47 ++++++++++++++++++++++++++++++
 9 files changed, 166 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-stih410/gpio.h
 create mode 100644 arch/arm/include/asm/arch-stih410/sti.h
 create mode 100644 arch/arm/include/asm/arch-stih410/syscfg.h
 create mode 100644 arch/arm/mach-sti/Kconfig
 create mode 100644 arch/arm/mach-sti/Makefile
 create mode 100644 arch/arm/mach-sti/cpu.c
 create mode 100644 arch/arm/mach-sti/timer.c

Comments

Tom Rini Feb. 5, 2017, 10:27 p.m. UTC | #1
On Thu, Feb 02, 2017 at 06:13:39PM +0100, patrice.chotard@st.com wrote:

> From: Patrice Chotard <patrice.chotard@st.com>
> 
> The STiH410 is an advanced multi-HD AVC processor with 3D
> graphics acceleration and 1.5-GHz ARM Cortex-A9 SMP CPU
> part of the stih407 family.
> 
> It has wide connectivity including USB 3.0, PCI-e, SATA
> and gigabit ethernet.
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>

You should add a top-level entry to MAINTAINERS as well for the mach-
and arch- entires (and later any generic dtsi files), thanks!
Patrice CHOTARD Feb. 6, 2017, 8:28 a.m. UTC | #2
02/05/2017 11:27 PM, Tom Rini wrote:
> On Thu, Feb 02, 2017 at 06:13:39PM +0100, patrice.chotard@st.com wrote:
>
>> From: Patrice Chotard <patrice.chotard@st.com>
>>
>> The STiH410 is an advanced multi-HD AVC processor with 3D
>> graphics acceleration and 1.5-GHz ARM Cortex-A9 SMP CPU
>> part of the stih407 family.
>>
>> It has wide connectivity including USB 3.0, PCI-e, SATA
>> and gigabit ethernet.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
>
> You should add a top-level entry to MAINTAINERS as well for the mach-
> and arch- entires (and later any generic dtsi files), thanks!
>
Hi Tom

Ok i will fix that

Thanks
diff mbox

Patch

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0229800..4aa5eb9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -982,6 +982,13 @@  config STM32
 	select DM
 	select DM_SERIAL
 
+config ARCH_STI
+	bool "Support STMicrolectronics SoCs"
+	select CPU_V7
+	help
+	  Support for STMicroelectronics STiH407/10 SoC family.
+	  This SoC is used on Linaro 96Board STiH410-B2260
+
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
 	select OF_CONTROL
@@ -1060,6 +1067,8 @@  source "arch/arm/mach-snapdragon/Kconfig"
 
 source "arch/arm/mach-socfpga/Kconfig"
 
+source "arch/arm/mach-sti/Kconfig"
+
 source "arch/arm/mach-stm32/Kconfig"
 
 source "arch/arm/mach-tegra/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 0d94700..116f661 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -71,6 +71,7 @@  machine-$(CONFIG_ARCH_SNAPDRAGON)	+= snapdragon
 machine-$(CONFIG_ARCH_SOCFPGA)		+= socfpga
 machine-$(CONFIG_ARCH_RMOBILE)		+= rmobile
 machine-$(CONFIG_ARCH_ROCKCHIP)		+= rockchip
+machine-$(CONFIG_ARCH_STI)		+= sti
 machine-$(CONFIG_STM32)			+= stm32
 machine-$(CONFIG_TEGRA)			+= tegra
 machine-$(CONFIG_ARCH_UNIPHIER)		+= uniphier
diff --git a/arch/arm/include/asm/arch-stih410/gpio.h b/arch/arm/include/asm/arch-stih410/gpio.h
new file mode 100644
index 0000000..977b3f8
--- /dev/null
+++ b/arch/arm/include/asm/arch-stih410/gpio.h
@@ -0,0 +1,20 @@ 
+/*
+ * pins definition for STiH410-B2260
+ *
+ * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _STI_GPIO_H_
+#define _STI_GPIO_H_
+
+struct sti_pin_desc {
+	unsigned char bank;
+	unsigned char pin;
+	unsigned char alt;
+	int dir;
+};
+
+#endif /* _STI_GPIO_H_ */
+
diff --git a/arch/arm/include/asm/arch-stih410/sti.h b/arch/arm/include/asm/arch-stih410/sti.h
new file mode 100644
index 0000000..d35c4f0
--- /dev/null
+++ b/arch/arm/include/asm/arch-stih410/sti.h
@@ -0,0 +1,14 @@ 
+/*
+ * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _STI_H_
+#define _STI_H_
+
+/* A9_GLOBAL_TIMER_BASE */
+#define STI_A9_CONFIG_BASE			0x08760000
+#define STI_A9_GLOBAL_TIMER_BASE		(STI_A9_CONFIG_BASE + 0x0200)
+
+#endif /* _STI_H_ */
diff --git a/arch/arm/include/asm/arch-stih410/syscfg.h b/arch/arm/include/asm/arch-stih410/syscfg.h
new file mode 100644
index 0000000..e027d74
--- /dev/null
+++ b/arch/arm/include/asm/arch-stih410/syscfg.h
@@ -0,0 +1,20 @@ 
+/*
+ * Configuration/Status Registers for STiH410 SoC
+ *
+ * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _STI_SYSCFG_H_
+#define _STI_SYSCFG_H_
+
+#define STIH410_SYSCONF0_BASE		0x09620000 /* 0-999 */
+#define STIH410_SYSCONF1_BASE		0x09280000 /* 1000-1999 */
+#define STIH410_SYSCONF2_BASE		0x09290000 /* 2000-2999 */
+#define STIH410_SYSCONF3_BASE		0x092a0000 /* 3000-3999 */
+#define STIH410_SYSCONF4_BASE		0x09600000 /* 4000-4999 */
+#define STIH410_SYSCONF5_BASE		0x092b0000 /* 5000-5999 */
+#define STIH410_SYSCONF6_BASE		0x092c0000 /* 6000-6999 */
+
+#endif /* _STI_SYSCFG_ */
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
new file mode 100644
index 0000000..67a3b24
--- /dev/null
+++ b/arch/arm/mach-sti/Kconfig
@@ -0,0 +1,31 @@ 
+if ARCH_STI
+
+config SYS_SOC
+	default "stih410"
+
+choice
+	prompt "STiH410 board select"
+
+config TARGET_STIH410_B2260
+	bool "96Boards STiH410-B2260"
+	help
+	  Support for 96Board STiH410-B2260 based on STMicrolectronics
+	  STiH410 soc. This board complies with 96Board Open Platform
+	  Specifications. Features:
+	  - 1GB DDR
+	  - On-Board USB combo WiFi/Bluetooth RTL8723BU
+	    with PCB soldered antenna
+	  - Ethernet 1000-BaseT
+	  - Sata
+	  - HDMI
+	  - 2 x USB2 type A
+	  - micro USB2 type AB
+	  - SD card slot
+	  - High speed connector (SD/I2C/USB interfaces)
+	  - Slow speed connector (UART/I2C/GPIO/SPI/PCM interfaces)
+
+endchoice
+
+source "board/st/stih410-b2260/Kconfig"
+
+endif
diff --git a/arch/arm/mach-sti/Makefile b/arch/arm/mach-sti/Makefile
new file mode 100644
index 0000000..a97101d
--- /dev/null
+++ b/arch/arm/mach-sti/Makefile
@@ -0,0 +1,8 @@ 
+#
+# (C) Copyright 2017
+# Patrice Chotard, <patrice.chotard@st.com>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y += cpu.o timer.o
diff --git a/arch/arm/mach-sti/cpu.c b/arch/arm/mach-sti/cpu.c
new file mode 100644
index 0000000..e8c3fd2
--- /dev/null
+++ b/arch/arm/mach-sti/cpu.c
@@ -0,0 +1,16 @@ 
+/*
+ * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <asm/arch/syscfg.h>
+#include <asm/io.h>
+
+void reset_cpu(ulong addr)
+{
+	unsigned long *sysconf;
+
+	sysconf = (unsigned long *)STIH410_SYSCONF4_BASE;
+	generic_clear_bit(0, sysconf);
+}
diff --git a/arch/arm/mach-sti/timer.c b/arch/arm/mach-sti/timer.c
new file mode 100644
index 0000000..cf4511f
--- /dev/null
+++ b/arch/arm/mach-sti/timer.c
@@ -0,0 +1,47 @@ 
+/*
+ * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/sti.h>
+#include <asm/arch-armv7/globaltimer.h>
+
+static struct globaltimer * const global_timer =
+	(struct globaltimer *)STI_A9_GLOBAL_TIMER_BASE;
+
+static u64 get_cpu_global_timer(void)
+{
+	u32 low, high;
+	u64 timer;
+
+	u32 old = readl(&global_timer->cnt_h);
+	while (1) {
+		low = readl(&global_timer->cnt_l);
+		high = readl(&global_timer->cnt_h);
+		if (old == high)
+			break;
+		else
+			old = high;
+	}
+	timer = high;
+	return (u64)((timer << 32) | low);
+}
+
+int timer_init(void)
+{
+	writel(0x01, &global_timer->ctl);
+	return 0;
+}
+
+unsigned long long get_ticks(void)
+{
+	return get_cpu_global_timer();
+}
+
+ulong get_tbclk(void)
+{
+	return (ulong)(CONFIG_SYS_HZ_CLOCK >> 1);
+}