Skip to contentSkip to conversation

arm: socfpga: Add initial support for Altera's SOCFPGA HW

PATCH New Pavel Machek 4 participants 5 messages Jul 18, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 arm: socfpga: Add initial support for Altera's SOCFPGA HW

From: Dinh Nguyen <[email protected]>

Adding core definitions for Altera's SOCFPGA ARM platform.

---
Changes from V3: merged into single patch (it is now small enough), moved dts pieces around (thanks to Thomas Petazzoni), removed clock support (not neccessary with u-boot, needs to be redone).

 MAINTAINERS                                      |    5 +
 arch/arm/Kconfig                                 |   19 +++
 arch/arm/Makefile                                |    1 +
 arch/arm/boot/dts/socfpga.dtsi                   |  141 ++++++++++++++++++++++
 arch/arm/boot/dts/socfpga_cyclone5.dts           |   40 ++++++
 arch/arm/configs/socfpga_defconfig               |   83 +++++++++++++
 arch/arm/mach-socfpga/Makefile                   |    5 +
 arch/arm/mach-socfpga/Makefile.boot              |    1 +
 arch/arm/mach-socfpga/common.h                   |   23 ++++
 arch/arm/mach-socfpga/include/mach/debug-macro.S |   16 +++
 arch/arm/mach-socfpga/include/mach/timex.h       |   19 +++
 arch/arm/mach-socfpga/include/mach/uncompress.h  |    9 ++
 arch/arm/mach-socfpga/socfpga.c                  |   61 ++++++++++
MAINTAINERS +5 -0
index 03df1d1..d819c9c 100644
@@ -1103,6 +1103,11 @@ S:	Supported
 F:	arch/arm/mach-shmobile/
 F:	drivers/sh/
 
+ARM/SOCFPGA ARCHITECTURE
+M:	Dinh Nguyen <[email protected]>
+S:	Maintained
+F:	arch/arm/mach-socfpga/
+
 ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
 M:	Lennert Buytenhek <[email protected]>
 L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
arch/arm/Kconfig +19 -0
index 57eb6ef..b9f5fc9 100644
@@ -250,6 +250,25 @@ choice
 	prompt "ARM system type"
 	default ARCH_VERSATILE
 
+config ARCH_SOCFPGA
+	bool "Altera SOCFPGA family"
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CLKDEV_LOOKUP
+	select COMMON_CLK
+	select CPU_V7
+	select DW_APB_TIMER
+	select DW_APB_TIMER_OF
+	select GENERIC_CLOCKEVENTS
+	select GPIO_PL061 if GPIOLIB
+	select HAVE_ARM_SCU
+	select SPARSE_IRQ
+	select USE_OF
+	help
+	  This enables support for Altera SOCFPGA Cyclone V platform
+
 config ARCH_INTEGRATOR
 	bool "ARM Ltd. Integrator family"
 	select ARM_AMBA
arch/arm/Makefile +1 -0
index 0298b00..1fe5702 100644
@@ -193,6 +193,7 @@ machine-$(CONFIG_MACH_SPEAR310)		:= spear3xx
 machine-$(CONFIG_MACH_SPEAR320)		:= spear3xx
 machine-$(CONFIG_MACH_SPEAR600)		:= spear6xx
 machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
+machine-$(CONFIG_ARCH_SOCFPGA) 	:= socfpga
 
 # Platform directory name.  This list is sorted alphanumerically
 # by CONFIG_* macro name.
arch/arm/boot/dts/socfpga.dtsi new file +141 -0

141 lines not on this page · raw message

arch/arm/boot/dts/socfpga_cyclone5.dts new file +40 -0
new file mode 100644
index 0000000..683d035
@@ -0,0 +1,40 @@
+/*
+ *  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/>.
+ */
+
+/dts-v1/;
+/include/ "socfpga.dtsi"
+
+/ {
+	model = "Altera SOCFPGA Cyclone V";
+	compatible = "altr,socfpga-cyclone5";
+
+	aliases {
+		ethernet0 = &gmac0;
+		serial0 = &uart0;
+		serial1 = &uart1;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,57600";
+	};
+
+	memory {
+		name = "memory";
+		device_type = "memory";
+		reg = <0x0 0x10000000>; /* 256MB */
+	};
+};
arch/arm/configs/socfpga_defconfig new file +83 -0

83 lines not on this page · raw message

arch/arm/mach-socfpga/Makefile new file +5 -0
new file mode 100644
index 0000000..4fb9324
@@ -0,0 +1,5 @@
+#
+# Makefile for the linux kernel.
+#
+
+obj-y					:= socfpga.o
arch/arm/mach-socfpga/Makefile.boot new file +1 -0
new file mode 100644
index 0000000..dae9661
@@ -0,0 +1 @@
+zreladdr-y	:= 0x00008000
arch/arm/mach-socfpga/common.h new file +23 -0
new file mode 100644
index 0000000..ba90e7a
@@ -0,0 +1,23 @@
+/*
+ *  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 __MACH_SOCFPGA_COMMON_H
+#define __MACH_SOCFPGA_COMMON_H
+
+extern struct sys_timer dw_apb_timer;
+
+#endif
arch/arm/mach-socfpga/include/mach/debug-macro.S new file +16 -0
new file mode 100644
index 0000000..d6f26d2
@@ -0,0 +1,16 @@
+/*
+ *  Copyright (C) 1994-1999 Russell King
+ *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+		.macro	addruart, rp, rv, tmp
+		mov	\rp, #DEBUG_LL_UART_OFFSET
+		orr	\rp, \rp, #0x00c00000
+		orr	\rv, \rp, #0xfe000000	@ virtual base
+		orr	\rp, \rp, #0xff000000	@ physical base
+		.endm
+
arch/arm/mach-socfpga/include/mach/timex.h new file +19 -0
new file mode 100644
index 0000000..43df435
@@ -0,0 +1,19 @@
+/*
+ *  Copyright (C) 2003 ARM Limited
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#define CLOCK_TICK_RATE		(50000000 / 16)
arch/arm/mach-socfpga/include/mach/uncompress.h new file +9 -0
new file mode 100644
index 0000000..bbe20e6
@@ -0,0 +1,9 @@
+#ifndef __MACH_UNCOMPRESS_H
+#define __MACH_UNCOMPRESS_H
+
+#define putc(c)
+#define flush()
+#define arch_decomp_setup()
+#define arch_decomp_wdog()
+
+#endif
arch/arm/mach-socfpga/socfpga.c new file +61 -0

61 lines not on this page · raw message

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

PATCH v4 1/1 arm: socfpga: Add initial support for Altera's SOCFPGA HW

Quoted 9 lines · Pavel Machek

From: Dinh Nguyen <[email protected]>

Adding core definitions for Altera's SOCFPGA ARM platform.

Quoted 4 lines

---
Changes from V3: merged into single patch (it is now small enough), moved dts pieces around (thanks to Thomas Petazzoni), removed clock support (not neccessary with u-boot, needs to be redone).

Looks good, I'll apply it to the next/newsoc branch for 3.6 when I get the ok from Dinh. I'm not quite sure in what way you work together, but the patch lists only him in the MAINTAINERS file, so I'm making sure I'm not sidestepping him when I take the patch from you instead.

There are two small details I noticed. You can either send a replacement patch or fixups on top of this one.

arch/arm/boot/dts/socfpga.dtsi line 126

Quoted 8 lines
arch/arm/boot/dts/socfpga.dtsi new file +8 -0
+		gmac0: stmmac at ff700000 {
+			compatible = "st,spear600-gmac";
+			reg = <0xff700000 0x2000>;
+			interrupts = <0 115 4>;
+			interrupt-names = "macirq";
+			mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
+			phy-mode = "gmii";
+		};

We've just discussed the stmmac driver in the spear1340 update series. My understanding is that there are multiple variants of this that we may need to distintinguish. I think it's better if you make the compatible string something that does not reference the spear600 specific variant, unless you are certain that it is in fact completely identical to that one.

Ideally you would have the version of the stmmac macro encoded in there, in addition to a name identifying altera as the company who added this one, ordered from most specific to least specific.

For instance, this could be

	compatible = "altr,socfpga-stmmac", "st,stmmac-v12.3.45", "st,stmmac";

Looking at the driver, it seems that this should actually not be called stmmac in the devicetree but rather dwmac, so better make it

	compatible = "altr,socfpga-stmmac", "snps,dwmac-4.567", "snps,dwmac";

arch/arm/mach-socfpga/common.h line 7

Quoted 13 lines
arch/arm/mach-socfpga/common.h new file +7 -0
new file mode 100644
index 0000000..ba90e7a
@@ -0,0 +1,23 @@
+
+#ifndef __MACH_SOCFPGA_COMMON_H
+#define __MACH_SOCFPGA_COMMON_H
+
+extern struct sys_timer dw_apb_timer;
+
+#endif

This header file is rather pointless when it is located in arch/arm/mach-socfpga where the driver cannot see it, so there is no guarantee that you actually use the same type in the declaration and the definition. I think it's better to also drop this header file and move the declaration into include/linux/dw_apb_timer.h

Arnd

#2 lore raw

PATCH v4 1/1 arm: socfpga: Add initial support for Altera's SOCFPGA HW

Hi Arnd,

Quoted 15 lines · Arnd Bergmann
Quoted 9 lines · Pavel Machek

From: Dinh Nguyen <[email protected]>

Adding core definitions for Altera's SOCFPGA ARM platform.

Quoted 4 lines

---
Changes from V3: merged into single patch (it is now small enough), moved dts pieces around (thanks to Thomas Petazzoni), removed clock support (not neccessary with u-boot, needs to be redone).

Quoted 6 lines

Looks good, I'll apply it to the next/newsoc branch for 3.6 when I get the ok from Dinh. I'm not quite sure in what way you work together, but the patch lists only him in the MAINTAINERS file, so I'm making sure I'm not sidestepping him when I take the patch from you instead.

I'll send you a fresh V4 today with yours and Thomas's recommended changes to the clk file.

Quoted 27 lines

There are two small details I noticed. You can either send a replacement patch or fixups on top of this one.

arch/arm/boot/dts/socfpga.dtsi

Quoted 6 lines
arch/arm/boot/dts/socfpga.dtsi new file +6 -0
+             gmac0: stmmac at ff700000 {
+                     compatible = "st,spear600-gmac";
+                     reg = <0xff700000 0x2000>;
+                     interrupts = <0 115 4>;
+                     interrupt-names = "macirq";
+                     mac-address = [00 00 00 00 00 00];/* Filled in by

U-Boot */

Review

Quoted 2 lines
(quoted diff) +2 -0
+                     phy-mode = "gmii";
+             };

We've just discussed the stmmac driver in the spear1340 update series. My understanding is that there are multiple variants of this that we may need to distintinguish. I think it's better if you make the compatible string something that does not reference the spear600 specific variant, unless you are certain that it is in fact completely identical to that one.

Ideally you would have the version of the stmmac macro encoded in there, in addition to a name identifying altera as the company who added this one, ordered from most specific to least specific.

For instance, this could be

Quoted 9 lines
        compatible = "altr,socfpga-stmmac", "st,stmmac-v12.3.45",

"st,stmmac";

Looking at the driver, it seems that this should actually not be called stmmac in the devicetree but rather dwmac, so better make it

        compatible = "altr,socfpga-stmmac", "snps,dwmac-4.567",

"snps,dwmac";

I'll figure out what we have. thanks for the comment.

Quoted 23 lines

Review

Quoted 2 lines
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/common.h

arch/arm/mach-socfpga/common.h line 7

Quoted 12 lines

new file mode 100644
index 0000000..ba90e7a

arch/arm/mach-socfpga/common.h new file +7 -0
@@ -0,0 +1,23 @@
+
+#ifndef __MACH_SOCFPGA_COMMON_H
+#define __MACH_SOCFPGA_COMMON_H
+
+extern struct sys_timer dw_apb_timer;
+
+#endif

This header file is rather pointless when it is located in arch/arm/mach-socfpga where the driver cannot see it, so there is no guarantee that you actually use the same type in the declaration and the definition. I think it's better to also drop this header file and move the declaration into include/linux/dw_apb_timer.h

Quoted 2 lines

Arnd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120718/cb436b56/attachment-0001.html>

#3 lore raw

PATCH v4 1/1 arm: socfpga: Add initial support for Altera's SOCFPGA HW

In reply to Arnd Bergmann
Quoted 29 lines · Arnd Bergmann
Quoted 4 lines · Pavel Machek

From: Dinh Nguyen <[email protected]>

Adding core definitions for Altera's SOCFPGA ARM platform.

There are two small details I noticed. You can either send a replacement patch or fixups on top of this one.

arch/arm/boot/dts/socfpga.dtsi line 126

Quoted 8 lines
arch/arm/boot/dts/socfpga.dtsi new file +8 -0
+		gmac0: stmmac at ff700000 {
+			compatible = "st,spear600-gmac";
+			reg = <0xff700000 0x2000>;
+			interrupts = <0 115 4>;
+			interrupt-names = "macirq";
+			mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
+			phy-mode = "gmii";
+		};

We've just discussed the stmmac driver in the spear1340 update series. My understanding is that there are multiple variants of this that we may need to distintinguish. I think it's better if you make the compatible string something that does not reference the spear600 specific variant, unless you are certain that it is in fact completely identical to that one.

Ideally you would have the version of the stmmac macro encoded in there, in addition to a name identifying altera as the company who added this one, ordered from most specific to least specific.

Quoted 9 lines

For instance, this could be

	compatible = "altr,socfpga-stmmac", "st,stmmac-v12.3.45", "st,stmmac";

Looking at the driver, it seems that this should actually not be called stmmac in the devicetree but rather dwmac, so better make it

	compatible = "altr,socfpga-stmmac", "snps,dwmac-4.567", "snps,dwmac";

Is there already work to update the bindings to reflect this change in stmmac driver? Or could I help with setting up some patches for it?

Dinh

#4 lore raw

PATCH v4 1/1 arm: socfpga: Add initial support for Altera's SOCFPGA HW

Quoted 4 lines · Dinh.Nguyen
Quoted 4 lines

For instance, this could be

      compatible = "altr,socfpga-stmmac", "st,stmmac-v12.3.45", "st,stmmac";
Quoted 8 lines
Quoted 5 lines

Looking at the driver, it seems that this should actually not be called stmmac in the devicetree but rather dwmac, so better make it

      compatible = "altr,socfpga-stmmac", "snps,dwmac-4.567", "snps,dwmac";

Is there already work to update the bindings to reflect this change in stmmac driver? Or could I help with setting up some patches for it?

Please send a patch to update the bindings and the driver to the netdev mailing list.

Arnd