From: Patrice Chotard <patrice.chot...@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.chot...@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 | 87 ++++++++++++++++++++++++++++++
 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, 233 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

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 0ed36cd..56a017c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -892,6 +892,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
@@ -965,6 +972,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 4b8bf80..986e15d 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.chot...@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.chot...@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..ff7d252
--- /dev/null
+++ b/arch/arm/include/asm/arch-stih410/syscfg.h
@@ -0,0 +1,87 @@
+/*
+ * Configuration/Status Registers for STiH410 SoC
+ *
+ * (C) Copyright 2017 Patrice Chotard <patrice.chot...@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 */
+
+/*
+ * STIH410 System Configuration "accessors"
+ */
+#define STIH410_SYSCFG(x)                                              \
+       (                                                               \
+               ((x) < 1000)                                            \
+               ? STIH410_SYSCONF0_BASE + ((x)-0)*0x4   \
+               :                                                       \
+               ((x) < 2000)                                            \
+               ? STIH410_SYSCONF1_BASE + ((x)-1000)*0x4        \
+               :                                                       \
+               ((x) < 3000)                                            \
+               ? STIH410_SYSCONF2_BASE + ((x)-2000)*0x4        \
+               :                                                       \
+               ((x) < 4000)                                            \
+               ? STIH410_SYSCONF3_BASE + ((x)-3000)*0x4        \
+               :                                                       \
+               ((x) < 5000)                                            \
+               ? STIH410_SYSCONF4_BASE + ((x)-4000)*0x4        \
+               :                                                       \
+               ((x) < 6000)                                            \
+               ? STIH410_SYSCONF5_BASE + ((x)-5000)*0x4        \
+               :                                                       \
+               STIH410_SYSCONF6_BASE + ((x)-6000)*0x4  \
+       )
+
+/*
+ * if ('flag')
+ *     set bit 'bit' in variable 'reg'
+ * else
+ *     clear bit 'bit' in variable 'reg'
+ */
+#define SET_SYSCONF_BIT(reg, flag, bit)                        \
+       do {                                            \
+               if (flag) {                             \
+                       /* set bit 'bit' */             \
+                       reg |= (1ul<<(bit));            \
+               } else {                                \
+                       /* clear bit 'bit' */           \
+                       reg &= ~(1ul<<(bit));           \
+               }                                       \
+       } while (0)
+
+
+/*
+ * if ('flag')
+ *     set bits 'lsb:msb' to 'yes' in variable 'reg'
+ * else
+ *     set bits 'lsb:msb' to 'no' in variable 'reg'
+ *
+ * Note: 'msb' must be >= 'lsb'.
+ */
+#define SET_SYSCONF_BITS(reg, flag, lsb, msb, yes, no) \
+       do {                                            \
+               const unsigned long _mask =             \
+                       (1ul<<((msb)-(lsb)+1))-1ul;     \
+               /* clear all bits in 'lsb':'msb' */     \
+               reg &= ~(_mask<<(lsb));                 \
+               if (flag) {                             \
+                       /* set 'yes' in lsb:msb */      \
+                       reg |= ((yes)<<(lsb));          \
+               } else {                                \
+                       /* set 'no' in lsb:msb */       \
+                       reg |= ((no)<<(lsb));           \
+               }                                       \
+       } while (0)
+
+#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.chot...@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..bf79b29
--- /dev/null
+++ b/arch/arm/mach-sti/cpu.c
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2017 Patrice Chotard <patrice.chot...@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 = readl(STIH410_SYSCONF4_BASE);
+
+       SET_SYSCONF_BIT(sysconf, 0, 0);
+       writel(sysconf, STIH410_SYSCONF4_BASE);
+}
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.chot...@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);
+}
-- 
1.9.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to