Skip to contentSkip to conversation

ARM: Add Altera SOCFPGA Cyclone5

PATCH Superseded dinguyen at altera.com 4 participants 7 messages Oct 2, 2012 – Oct 3, 2012

Subsystems (2)

v5 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

From: Dinh Nguyen <[email protected]>

Add minimal support for Altera's SOCFPGA Cyclone 5 hardware.

----
V4 of this patch was applied on top of trini/WIP/spl-improvements v6, now that spl-improvements are mainlined, resend the patch on top of that.

Based on v2012.10-rc2

---
 MAINTAINERS                                        |    5 +
 arch/arm/cpu/armv7/socfpga/Makefile                |   51 +++++
 arch/arm/cpu/armv7/socfpga/config.mk               |   16 ++
 arch/arm/cpu/armv7/socfpga/lowlevel_init.S         |   77 +++++++
 arch/arm/cpu/armv7/socfpga/misc.c                  |   54 +++++
 arch/arm/cpu/armv7/socfpga/spl.c                   |   48 ++++
 arch/arm/cpu/armv7/socfpga/timer.c                 |  105 +++++++++
 arch/arm/cpu/armv7/socfpga/u-boot-spl.lds          |   60 +++++
 arch/arm/include/asm/arch-socfpga/reset_manager.h  |   37 +++
 .../include/asm/arch-socfpga/socfpga_base_addrs.h  |   27 +++
 arch/arm/include/asm/arch-socfpga/spl.h            |   26 +++
 arch/arm/include/asm/arch-socfpga/timer.h          |   29 +++
 board/altera/socfpga_cyclone5/Makefile             |   50 +++++
 board/altera/socfpga_cyclone5/socfpga_cyclone5.c   |   85 +++++++
 boards.cfg                                         |    1 +
 include/common.h                                   |    2 +-
 include/configs/socfpga_cyclone5.h                 |  236 ++++++++++++++++++++
 17 files changed, 908 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/socfpga/Makefile
 create mode 100644 arch/arm/cpu/armv7/socfpga/config.mk
 create mode 100644 arch/arm/cpu/armv7/socfpga/lowlevel_init.S
 create mode 100644 arch/arm/cpu/armv7/socfpga/misc.c
 create mode 100644 arch/arm/cpu/armv7/socfpga/spl.c
 create mode 100644 arch/arm/cpu/armv7/socfpga/timer.c
 create mode 100644 arch/arm/cpu/armv7/socfpga/u-boot-spl.lds
 create mode 100644 arch/arm/include/asm/arch-socfpga/reset_manager.h
 create mode 100644 arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h
 create mode 100644 arch/arm/include/asm/arch-socfpga/spl.h
 create mode 100644 arch/arm/include/asm/arch-socfpga/timer.h
 create mode 100644 board/altera/socfpga_cyclone5/Makefile
 create mode 100644 board/altera/socfpga_cyclone5/socfpga_cyclone5.c
 create mode 100644 include/configs/socfpga_cyclone5.h
MAINTAINERS +5 -0
index aa54fe1..ee8cfb0 100644
@@ -777,6 +777,11 @@ Nagendra T S  <[email protected]>
 
    am3517_crane    ARM ARMV7 (AM35x SoC)
 
+Dinh Nguyen <[email protected]>
+Chin Liang See <[email protected]>
+
+	socfpga		socfpga_cyclone5
+
 Sandeep Paulraj <[email protected]>
 
 	davinci_dm355evm	ARM926EJS
arch/arm/cpu/armv7/socfpga/Makefile new file +51 -0

51 lines not on this page · raw message

arch/arm/cpu/armv7/socfpga/config.mk new file +16 -0
new file mode 100644
index 0000000..b72ed1e
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed "as is" WITHOUT ANY WARRANTY of any
+# kind, whether express or implied; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+ifndef CONFIG_SPL_BUILD
+ALL-y	+= $(obj)u-boot.img
+endif
arch/arm/cpu/armv7/socfpga/lowlevel_init.S new file +77 -0

77 lines not on this page · raw message

arch/arm/cpu/armv7/socfpga/misc.c new file +54 -0

54 lines not on this page · raw message

arch/arm/cpu/armv7/socfpga/spl.c new file +48 -0

48 lines not on this page · raw message

arch/arm/cpu/armv7/socfpga/timer.c new file +105 -0

105 lines not on this page · raw message

arch/arm/cpu/armv7/socfpga/u-boot-spl.lds new file +60 -0

60 lines not on this page · raw message

arch/arm/include/asm/arch-socfpga/reset_manager.h new file +37 -0
new file mode 100644
index 0000000..d9d2c1c
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (C) 2012 Altera Corporation <www.altera.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef	_RESET_MANAGER_H_
+#define	_RESET_MANAGER_H_
+
+void reset_cpu(ulong addr);
+void reset_deassert_peripherals_handoff(void);
+
+struct socfpga_reset_manager {
+	u32	padding1;
+	u32	ctrl;
+	u32	padding2;
+	u32	padding3;
+	u32	mpu_mod_reset;
+	u32	per_mod_reset;
+	u32	per2_mod_reset;
+	u32	brg_mod_reset;
+};
+
+#define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1
+
+#endif /* _RESET_MANAGER_H_ */
arch/arm/include/asm/arch-socfpga/socfpga_base_addrs.h new file +27 -0
new file mode 100644
index 0000000..f353eb2
@@ -0,0 +1,27 @@
+/*
+ *  Copyright (C) 2012 Altera Corporation <www.altera.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SOCFPGA_BASE_ADDRS_H_
+#define _SOCFPGA_BASE_ADDRS_H_
+
+#define SOCFPGA_L3REGS_ADDRESS 0xff800000
+#define SOCFPGA_UART0_ADDRESS 0xffc02000
+#define SOCFPGA_UART1_ADDRESS 0xffc03000
+#define SOCFPGA_OSC1TIMER0_ADDRESS 0xffd00000
+#define SOCFPGA_RSTMGR_ADDRESS 0xffd05000
+
+#endif /* _SOCFPGA_BASE_ADDRS_H_ */
arch/arm/include/asm/arch-socfpga/spl.h new file +26 -0
new file mode 100644
index 0000000..c2014c5
@@ -0,0 +1,26 @@
+/*
+ *  Copyright (C) 2012 Pavel Machek <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SOCFPGA_SPL_H_
+#define _SOCFPGA_SPL_H_
+
+/* Symbols from linker script */
+extern void __malloc_start, __malloc_end, __stack_start;
+
+#define BOOT_DEVICE_RAM 1
+
+#endif
arch/arm/include/asm/arch-socfpga/timer.h new file +29 -0
new file mode 100644
index 0000000..830c94a
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 2012 Altera Corporation <www.altera.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _SOCFPGA_TIMER_H_
+#define _SOCFPGA_TIMER_H_
+
+struct socfpga_timer {
+	u32	load_val;
+	u32	curr_val;
+	u32	ctrl;
+	u32	eoi;
+	u32	int_stat;
+};
+
+#endif
board/altera/socfpga_cyclone5/Makefile new file +50 -0

50 lines not on this page · raw message

board/altera/socfpga_cyclone5/socfpga_cyclone5.c new file +85 -0

85 lines not on this page · raw message

boards.cfg +1 -0
index f789539..2388cee 100644
@@ -272,6 +272,7 @@ ventana                      arm         armv7:arm720t ventana           nvidia
 whistler                     arm         armv7:arm720t whistler          nvidia         tegra20
 u8500_href                   arm         armv7       u8500               st-ericsson    u8500
 snowball                     arm         armv7       snowball               st-ericsson    u8500
+socfpga_cyclone5             arm         armv7       socfpga_cyclone5    altera		    socfpga
 actux1_4_16                  arm         ixp         actux1              -              -           actux1:FLASH2X2
 actux1_4_32                  arm         ixp         actux1              -              -           actux1:FLASH2X2,RAM_32MB
 actux1_8_16                  arm         ixp         actux1              -              -           actux1:FLASH1X8
include/common.h +1 -1
index a7fb05e..ce9abaa 100644
@@ -582,7 +582,7 @@ int	checkicache   (void);
 int	checkdcache   (void);
 void	upmconfig     (unsigned int, unsigned int *, unsigned int);
 ulong	get_tbclk     (void);
-void	reset_cpu     (ulong addr);
+void	reset_cpu     (ulong addr) __attribute__((noreturn));
 #if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup(void *blob, bd_t *bd);
 #ifdef CONFIG_PCI
include/configs/socfpga_cyclone5.h new file +236 -0

236 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

Quoted 4 lines · dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add minimal support for Altera's SOCFPGA Cyclone 5 hardware.

Quoted 8 lines

Albert, as I had promised that if they rebased on my SPL series and since it was close to after the merge window closed they could get this in, please take this for the next pull request (assuming you have no comments), thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121002/82592be5/attachment.pgp>
#2 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

Hi Tom,

Quoted 15 lines · Tom Rini
Quoted 4 lines · dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add minimal support for Altera's SOCFPGA Cyclone 5 hardware.

Quoted 8 lines
Quoted 6 lines

Albert, as I had promised that if they rebased on my SPL series and since it was close to after the merge window closed they could get this in, please take this for the next pull request (assuming you have no comments), thanks!

gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) gives:

albert at lilith:~/src/u-boot-arm$ LANG=C ./MAKEALL socfpga_cyclone5
Configuring for socfpga_cyclone5 board...
socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'do' socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'while'
make[2]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/socfpga_cyclone5.o] Error 1 make[1]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/libsocfpga_cyclone5.o] Error 2
make: *** [spl/u-boot-spl.bin] Error 2
arm-linux-gnueabi-size: './u-boot': No such file
spl.c: In function 'board_init_f':
spl.c:45:38: warning: taking address of expression of type 'void' [enabled by default] socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'do' socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'while'
make[2]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/socfpga_cyclone5.o] Error 1 make[1]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/libsocfpga_cyclone5.o] Error 2 make[1]: *** Waiting for unfinished jobs....
make: *** [spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs....

--------------------- SUMMARY ---------------------------- Boards compiled: 1
Boards with errors: 1 ( socfpga_cyclone5 )
----------------------------------------------------------

Seems there is an issue with the patch.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

Hi!

Quoted 20 lines
Quoted 13 lines
Quoted 4 lines

From: Dinh Nguyen <[email protected]>

Add minimal support for Altera's SOCFPGA Cyclone 5 hardware.

Quoted 8 lines
Quoted 6 lines

Albert, as I had promised that if they rebased on my SPL series and since it was close to after the merge window closed they could get this in, please take this for the next pull request (assuming you have no comments), thanks!

Quoted 8 lines

gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) gives:

albert at lilith:~/src/u-boot-arm$ LANG=C ./MAKEALL socfpga_cyclone5 Configuring for socfpga_cyclone5 board... socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'do' socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'while' make[2]: ***

Quoted 1 line
Quoted 1 line

[/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/soc

I tried:

pavel at amd:~/mainline-altera/u-boot$ LANG=C CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL socfpga_cyclone5 Configuring for socfpga_cyclone5 board...
text data bss dec hex
filename
160875 3584 213264 377723 5c37b ./u-boot
1918 152 52 2122 84a
./spl/u-boot-spl

--------------------- SUMMARY ---------------------------- Boards compiled: 1
----------------------------------------------------------
pavel at amd:~/mainline-altera/u-boot$

pavel at amd:~/mainline-altera/u-boot$ arm-linux-gnueabi-gcc --version arm-linux-gnueabi-gcc (Debian 4.3.5-4) 4.3.5
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Quoted 4 lines

make: *** [spl/u-boot-spl.bin] Error 2
arm-linux-gnueabi-size: './u-boot': No such file
spl.c: In function 'board_init_f':
spl.c:45:38: warning: taking address of expression of type 'void' [enabled by default]

Guilty as charged. We did not want to specify type of stack and malloc pools. Patch below should fix it.

Quoted 4 lines

socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'do' socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'while'
make[2]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/socfpga_cyclone5.o] Error 1 make[1]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/libsocfpga_cyclone5.o] Error 2

But this one is a mystery. Offending lines are:

#include <netdev.h>

DECLARE_GLOBAL_DATA_PTR;

[line 26:] void show_boot_progress(int progress)

{
        debug("Boot reached stage %d\n", progress);
}

Do we need direct include asm/global_data.h for DECLARE_GLOBAL_DATA_PTR? Is something funny going on with debug()? Is show_boot_progress() a macro in your build? Would it be enough to check out current u-boot-arm to reproduce?

Thanks,

Pavel

arch/arm/include/asm/arch-socfpga/spl.h +1 -1
index c2014c5..efd0c06 100644
@@ -19,7 +19,7 @@
 #define _SOCFPGA_SPL_H_
 
 /* Symbols from linker script */
-extern void __malloc_start, __malloc_end, __stack_start;
+extern char __malloc_start, __malloc_end, __stack_start;
 
 #define BOOT_DEVICE_RAM 1
 
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

Hi!

Quoted 7 lines

But this one is a mystery. Offending lines are:

#include <netdev.h>

DECLARE_GLOBAL_DATA_PTR;

[line 26:] void show_boot_progress(int progress)

Quoted 8 lines
{
        debug("Boot reached stage %d\n", progress);
}

Do we need direct include asm/global_data.h for DECLARE_GLOBAL_DATA_PTR? Is something funny going on with debug()? Is show_boot_progress() a macro in your build? Would it be enough to check out current u-boot-arm to reproduce?

show_boot_progress() became a macro (for SPL build only, in the tree I can see). We can add an ifdef, but perhaps we should just delete the function...

Thanks,
Pavel

arch/arm/include/asm/arch-socfpga/spl.h +1 -1
index c2014c5..efd0c06 100644
@@ -19,7 +19,7 @@
 #define _SOCFPGA_SPL_H_
 
 /* Symbols from linker script */
-extern void __malloc_start, __malloc_end, __stack_start;
+extern char __malloc_start, __malloc_end, __stack_start;
 
 #define BOOT_DEVICE_RAM 1
 
board/altera/socfpga_cyclone5/socfpga_cyclone5.c +0 -5
index 858ab3c..7725be1 100644
@@ -23,11 +23,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void show_boot_progress(int progress)
-{
-	debug("Boot reached stage %d\n", progress);
-}
-
 /*
  * Print CPU information
  */
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#5 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

Hi Pavel,

Quoted 18 lines · Pavel Machek

Hi!

Quoted 7 lines

But this one is a mystery. Offending lines are:

#include <netdev.h>

DECLARE_GLOBAL_DATA_PTR;

[line 26:] void show_boot_progress(int progress)

Quoted 8 lines
{
        debug("Boot reached stage %d\n", progress);
}

Do we need direct include asm/global_data.h for DECLARE_GLOBAL_DATA_PTR? Is something funny going on with debug()? Is show_boot_progress() a macro in your build? Would it be enough to check out current u-boot-arm to reproduce?

Quoted 7 lines

show_boot_progress() became a macro (for SPL build only, in the tree I can see). We can add an ifdef, but perhaps we should just delete the function...

Thanks,

Can you post a proper V6 patch with history updated?

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH v5 1/1 ARM: Add Altera SOCFPGA Cyclone5

In reply to Albert ARIBAUD

Hi!

Quoted 7 lines

albert at lilith:~/src/u-boot-arm$ LANG=C ./MAKEALL socfpga_cyclone5
Configuring for socfpga_cyclone5 board...
socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'do' socfpga_cyclone5.c:26:6: error: expected identifier or '(' before 'while'
make[2]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/socfpga_cyclone5.o] Error 1 make[1]: *** [/home/albert/src/u-boot-arm/spl/board/altera/socfpga_cyclone5/libsocfpga_cyclone5.o] Error 2
make: *** [spl/u-boot-spl.bin] Error 2

Wiki may need update. http://www.denx.de/wiki/U-Boot/CustodianGitTrees
says:

ARM trees also form a hierarchy, with the u-boot-arm tree 'above',

    	       	      		      	  ~~~~~~~~~~

but this gives me

http://git.denx.de/?p=u-boot-arm.git;a=summary

and

projects /
403 Forbidden - No such project

.

I tried pulling

git fetch git://git.denx.de/u-boot-arm.git HEAD:arm

and that seems to work.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html