socfpga: Adding System Manager driver
authorChin Liang See <clsee@altera.com>
Wed, 11 Sep 2013 16:24:48 +0000 (11:24 -0500)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Mon, 7 Oct 2013 17:32:21 +0000 (19:32 +0200)
Adding System Manager driver which will configure the
pin mux for real hardware Cyclone V development kit
(not Virtual Platform)

Signed-off-by: Chin Liang See <clsee@altera.com>
Reviewed-by: Pavel Machek <pavel@denx.de>
Acked-by: Dinh Nguyen <dinguyen@altera.com>
Cc: Wolfgang Denk <wd@denx.de>
CC: Pavel Machek <pavel@denx.de>
Cc: Dinh Nguyen <dinguyen@altera.com>
Cc: Tom Rini <trini@ti.com>
Cc: Albert Aribaud <albert.u.boot@aribaud.net>
arch/arm/cpu/armv7/socfpga/Makefile
arch/arm/cpu/armv7/socfpga/spl.c
arch/arm/cpu/armv7/socfpga/system_manager.c [new file with mode: 0644]
arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
arch/arm/include/asm/arch-socfpga/system_manager.h [new file with mode: 0644]
board/altera/socfpga/Makefile
include/configs/socfpga_cyclone5.h

index 5024fc55e275d6f11e12830b3cdc5eea4b5704ef..0859e443d8169e313e8cfdeeb389aeb7cfe0c529 100644 (file)
@@ -13,7 +13,7 @@ include $(TOPDIR)/config.mk
 LIB    =  $(obj)lib$(SOC).o
 
 SOBJS  := lowlevel_init.o
-COBJS-y        := misc.o timer.o reset_manager.o
+COBJS-y        := misc.o timer.o reset_manager.o system_manager.o
 COBJS-$(CONFIG_SPL_BUILD) += spl.o
 
 COBJS  := $(COBJS-y)
index 2b9be28c214d51df101c089278ea5c44ae48e55f..74bceab183aac5702e747d5cd163e1fe6d63bb6b 100644 (file)
@@ -12,6 +12,7 @@
 #include <image.h>
 #include <asm/arch/reset_manager.h>
 #include <spl.h>
+#include <asm/arch/system_manager.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -25,6 +26,11 @@ u32 spl_boot_device(void)
  */
 void spl_board_init(void)
 {
+#ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET
+       /* configure the pin muxing through system manager */
+       sysmgr_pinmux_init();
+#endif /* CONFIG_SOCFPGA_VIRTUAL_TARGET */
+
        /* de-assert reset for peripherals and bridges based on handoff */
        reset_deassert_peripherals_handoff();
 
diff --git a/arch/arm/cpu/armv7/socfpga/system_manager.c b/arch/arm/cpu/armv7/socfpga/system_manager.c
new file mode 100644 (file)
index 0000000..d96521b
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ *  Copyright (C) 2013 Altera Corporation <www.altera.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/system_manager.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Configure all the pin muxes
+ */
+void sysmgr_pinmux_init(void)
+{
+       unsigned long offset = CONFIG_SYSMGR_PINMUXGRP_OFFSET;
+
+       const unsigned long *pval = sys_mgr_init_table;
+       unsigned long i;
+
+       for (i = 0; i < ARRAY_SIZE(sys_mgr_init_table);
+               i++, offset += sizeof(unsigned long)) {
+               writel(*pval++, (SOCFPGA_SYSMGR_ADDRESS + offset));
+       }
+}
index 1182a133fb3e4caff3c52af2193c43b61db5d9da..50c4ebd849e53d5acccf8569e9c2fe3104f3c48c 100644 (file)
@@ -12,5 +12,6 @@
 #define SOCFPGA_UART1_ADDRESS 0xffc03000
 #define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000
 #define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
+#define SOCFPGA_SYSMGR_ADDRESS 0xffd08000
 
 #endif /* _SOCFPGA_BASE_ADDRS_H_ */
diff --git a/arch/arm/include/asm/arch-socfpga/system_manager.h b/arch/arm/include/asm/arch-socfpga/system_manager.h
new file mode 100644 (file)
index 0000000..d965d25
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ *  Copyright (C) 2013 Altera Corporation <www.altera.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef        _SYSTEM_MANAGER_H_
+#define        _SYSTEM_MANAGER_H_
+
+#ifndef __ASSEMBLY__
+
+void sysmgr_pinmux_init(void);
+
+/* declaration for handoff table type */
+extern unsigned long sys_mgr_init_table[CONFIG_HPS_PINMUX_NUM];
+
+#endif
+
+
+#define CONFIG_SYSMGR_PINMUXGRP_OFFSET (0x400)
+
+#endif /* _SYSTEM_MANAGER_H_ */
index 101fc7c71c18207bfd2430290aeb51aaf4576912..9dc45a94563809f17ff2e478eb3d75ffb30aeb8d 100644 (file)
@@ -10,8 +10,10 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(BOARD).o
 
-COBJS  := socfpga_cyclone5.o
+COBJS-y        := socfpga_cyclone5.o
+COBJS-$(CONFIG_SPL_BUILD) += pinmux_config.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 
index 06aeba61dd2dd32da524df63c66f8b32cc3ec503..346ca72327afdb3d630e809f8beed0e26fb85027 100644 (file)
@@ -7,6 +7,7 @@
 #define __CONFIG_H
 
 #include <asm/arch/socfpga_base_addrs.h>
+#include "../../board/altera/socfpga/pinmux_config.h"
 
 /*
  * High level configuration