Skip to contentSkip to conversation

ppc4xx [Resubmit] [PATCH] CPU PPC440x5 on Virtex5 FX (new version)

U-Boot-Users In review Ricardo Ribalda Delgado 6 participants 25 messages Jul 14, 2008 – Jul 30, 2008

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

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs
-interrupts.c divided in uic.c and interrupts.c -xilinx_irq.c for xilinx interrupt controller

 cpu/ppc4xx/Makefile         |   15 +++-
 cpu/ppc4xx/cpu.c            |    4 +
 cpu/ppc4xx/interrupts.c     |  178 ++++++---------------------------
 cpu/ppc4xx/speed.c          |    6 +-
 cpu/ppc4xx/uic.c            |  238 +++++++++++++++++++++++++++++++++++++++++++
 cpu/ppc4xx/xilinx_irq.c     |  113 ++++++++++++++++++++
 include/asm-ppc/interrupt.h |   50 +++++++++
 include/asm-ppc/processor.h |    2 +
 8 files changed, 456 insertions(+), 150 deletions(-)
 create mode 100644 cpu/ppc4xx/uic.c
 create mode 100644 cpu/ppc4xx/xilinx_irq.c
 create mode 100644 include/asm-ppc/interrupt.h
cpu/ppc4xx/Makefile +14 -1
index 800bb41..b006127 100644
@@ -35,10 +35,14 @@ SOBJS	+= kgdb.o
 COBJS	:= 40x_spd_sdram.o
 COBJS	+= 44x_spd_ddr.o
 COBJS	+= 44x_spd_ddr2.o
-COBJS	+= 4xx_enet.o
+ifndef CONFIG_XILINX_440
+COBJS   += 4xx_enet.o
+endif
 COBJS	+= 4xx_pci.o
 COBJS	+= 4xx_pcie.o
+ifndef CONFIG_XILINX_440
 COBJS	+= 4xx_uart.o
+endif
 COBJS	+= bedbug_405.o
 COBJS	+= commproc.o
 COBJS	+= cpu.o
@@ -47,11 +51,20 @@ COBJS	+= denali_data_eye.o
 COBJS	+= denali_spd_ddr2.o
 COBJS	+= ecc.o
 COBJS	+= fdt.o
+ifndef CONFIG_XILINX_440
 COBJS	+= gpio.o
+endif
 COBJS	+= i2c.o
 COBJS	+= interrupts.o
+ifndef CONFIG_XILINX_440
+COBJS	+= uic.o
+else
+COBJS	+= xilinx_irq.o
+endif
 COBJS	+= iop480_uart.o
+ifndef CONFIG_XILINX_440
 COBJS	+= miiphy.o
+endif
 COBJS	+= ndfc.o
 COBJS	+= sdram.o
 COBJS	+= speed.o
cpu/ppc4xx/cpu.c +4 -0
index ef32bc6..2b9b364 100644
@@ -541,6 +541,10 @@ int checkcpu (void)
 		puts("GX Rev. A");
 		strcpy(addstr, "No Security support");
 		break;
+	
+	case PVR_VIRTEX5:
+		puts(" VIRTEX5");
+		break;
 
 	default:
 		printf (" UNKNOWN (PVR=%08x)", pvr);
cpu/ppc4xx/interrupts.c +30 -148

245 lines not on this page · raw message

cpu/ppc4xx/speed.c +5 -1
index b86b6de..d21bd82 100644
@@ -416,7 +416,8 @@ ulong get_PCI_freq (void)
 	return sys_info.freqPCI;
 }
 
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)
+#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) \
+	&& !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -449,6 +450,8 @@ void get_sys_info (sys_info_t * sysInfo)
 	sysInfo->freqUART = sysInfo->freqPLB;
 }
 #else
+
+#if !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -535,6 +538,7 @@ void get_sys_info (sys_info_t * sysInfo)
 }
 
 #endif
+#endif /* CONFIG_XILINX_440 */
 
 #if defined(CONFIG_YUCCA)
 unsigned long determine_sysper(void)
cpu/ppc4xx/uic.c new file +238 -0

238 lines not on this page · raw message

cpu/ppc4xx/xilinx_irq.c new file +113 -0

113 lines not on this page · raw message

include/asm-ppc/interrupt.h new file +50 -0

50 lines not on this page · raw message

include/asm-ppc/processor.h +2 -0
index 6e134c3..5501244 100644
@@ -839,6 +839,8 @@
 #define PVR_86xx	0x80040000
 #define PVR_86xx_REV1	(PVR_86xx | 0x0010)
 
+#define PVR_VIRTEX5     0x7ff21912
+
 /*
  * For the 8xx processors, all of them report the same PVR family for
  * the PowerPC core. The various versions of these processors must be
Signature · 1 line
1.5.6.2
#1 lore raw

[U-Boot-Users] ppc4xx: [PATCH] [Resubmit] ML507 Board Support

---
Support for the ML507 Board by Xilinx

 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   44 +++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130 ++++++++++++++++++++++++++++++++++++++
 board/xilinx/ml507/xparameters.h |   34 ++++++++++
 include/configs/ml507.h          |  107 +++++++++++++++++++++++++++++++
 11 files changed, 456 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..260a84b 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
 	sbc8240		MPC8240
 	sbc405		PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+	ml507 		PPC440x5
+
 Stefan Roese <[email protected]>
 
 	P3M7448		MPC7448
MAKEALL +1 -0
index a256e9a..5463a58 100755
@@ -239,6 +239,7 @@ LIST_4xx="		\
 	yosemite	\
 	yucca		\
 	zeus		\
+	ml507		\
 "
 
 #########################################################################
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:	unconfig
 ml300_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +58 -0

58 lines not on this page · raw message

board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +44 -0

44 lines not on this page · raw message

board/xilinx/ml507/ml507.c new file +46 -0

46 lines not on this page · raw message

board/xilinx/ml507/u-boot.lds new file +130 -0

130 lines not on this page · raw message

board/xilinx/ml507/xparameters.h new file +34 -0
new file mode 100644
index 0000000..1c41eb5
@@ -0,0 +1,34 @@
+/*   
+    (C) Copyright 2008
+    Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+    This work has been supported by: QTechnology  http://qtec.com/
+    based on xparameters-ml507.h by Xilinx
+
+    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 XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR 	0x00000000
+#define XPAR_INTC_0_BASEADDR 		0x81800000
+#define XPAR_UARTLITE_0_BASEADDR 	0x84000000
+#define XPAR_RS232_UART_1_BASEADDR 	0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR 	0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR 	0x81c00000
+#define XPAR_PLB_CLOCK_FREQ_HZ 		100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ 	400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 	13
+
+#endif
include/configs/ml507.h new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
1.5.6.2
#2 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Added Flash Support

---
 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   47 ++++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130 ++++++++++++++++++++++++++++++++++++++
 board/xilinx/ml507/xparameters.h |   35 ++++++++++
 include/configs/ml507.h          |  116 +++++++++++++++++++++++++++++++++
 11 files changed, 469 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..06e78bf 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board, eeprom_simul, adt7460
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
 	sbc8240		MPC8240
 	sbc405		PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+	ml507 		PPC440x5
+
 Stefan Roese <[email protected]>
 
 	P3M7448		MPC7448
MAKEALL +1 -0
index a256e9a..5463a58 100755
@@ -239,6 +239,7 @@ LIST_4xx="		\
 	yosemite	\
 	yucca		\
 	zeus		\
+	ml507		\
 "
 
 #########################################################################
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:	unconfig
 ml300_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +58 -0

58 lines not on this page · raw message

board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +47 -0

47 lines not on this page · raw message

board/xilinx/ml507/ml507.c new file +46 -0

46 lines not on this page · raw message

board/xilinx/ml507/u-boot.lds new file +130 -0

130 lines not on this page · raw message

board/xilinx/ml507/xparameters.h new file +35 -0
new file mode 100644
index 0000000..8d938f9
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * based on xparameters-ml507.h by Xilinx
+ *
+ * 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 XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR 	0x00000000
+#define XPAR_INTC_0_BASEADDR 		0x81800000
+#define XPAR_UARTLITE_0_BASEADDR 	0x84000000
+#define XPAR_RS232_UART_1_BASEADDR 	0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR 	0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR 	0x81c00000
+#define XPAR_FLASH_MEM0_BASEADDR 	0xFC000000
+#define XPAR_PLB_CLOCK_FREQ_HZ 		100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ 	400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 	13
+
+#endif
include/configs/ml507.h new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
1.5.6.2
#3 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Quoted 3 lines · Ricardo Ribalda Delgado

Added Flash Support

Please add a small board description in the commit text.

Quoted 259 lines
---
 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   47 ++++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130
++++++++++++++++++++++++++++++++++++++ board/xilinx/ml507/xparameters.h |  
35 ++++++++++
 include/configs/ml507.h          |  116 +++++++++++++++++++++++++++++++++
 11 files changed, 469 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..06e78bf 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board, eeprom_simul, adt7460
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
 	sbc8240		MPC8240
 	sbc405		PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+	ml507 		PPC440x5
+
 Stefan Roese <[email protected]>
 
 	P3M7448		MPC7448
MAKEALL +1 -0
index a256e9a..5463a58 100755
@@ -239,6 +239,7 @@ LIST_4xx="		\
 	yosemite	\
 	yucca		\
 	zeus		\
+	ml507		\
 "
 
 #########################################################################
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:	unconfig
 ml300_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +58 -0
new file mode 100644
index 0000000..b9bd737
@@ -0,0 +1,58 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk
+ifneq ($(OBJTREE),$(SRCTREE))
+endif
+
+INCS		:=
+CFLAGS		+= $(INCS)
+HOST_CFLAGS	+= $(INCS)
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS	= $(BOARD).o \
+
+SOBJS	= init.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $^
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +47 -0
new file mode 100644
index 0000000..6510646
@@ -0,0 +1,47 @@
+/*
+ *  (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <ppc_asm.tmpl>
+#include <config.h>
+#include <asm-ppc/mmu.h>
+
+.section .bootpg,"ax"
+.globl tlbtab
+
+tlbtab:
+tlbtab_start
+	/* SDRAM */
+tlbentry(XPAR_DDR2_SDRAM_MEM_BASEADDR, SZ_256M, CFG_SDRAM_BASE, 0,
+	 AC_R | AC_W | AC_X | SA_G | SA_I)
+	/* UART */
+tlbentry(XPAR_UARTLITE_0_BASEADDR, SZ_64K, XPAR_UARTLITE_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* PIC */
+tlbentry(XPAR_INTC_0_BASEADDR, SZ_64K, XPAR_INTC_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* I2C */
+tlbentry(XPAR_IIC_EEPROM_BASEADDR, SZ_64K, XPAR_IIC_EEPROM_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* Net */
+tlbentry(XPAR_LLTEMAC_0_BASEADDR, SZ_64K, XPAR_LLTEMAC_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/*Flash*/
+tlbentry(XPAR_FLASH_MEM0_BASEADDR, SZ_256M, XPAR_FLASH_MEM0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+tlbtab_end
board/xilinx/ml507/ml507.c new file +27 -0
new file mode 100644
index 0000000..6d78dd6
@@ -0,0 +1,46 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <config.h>
+#include <common.h>
+#include <asm/processor.h>
+
+int board_pre_init(void)
+{
+	return 0;
+}
+

board/xilinx/ml507/ml507.c line 37

Quoted 10 lines
board/xilinx/ml507/ml507.c new file +10 -0
+int checkboard(void)
+{
+	puts ("ML507 Board\n");
+	return 0;
+}
+
+phys_size_t initdram(int board_type)
+{
+	return 256 * 1024 * 1024;
+}

How about at least defining this SDRAM size in the board header and using it here:

board_foo.h:
#define CFG_MBYTES_SDRAM 256

board_foo.c

	return CFG_MBYTES_SDRAM << 20;
Quoted 290 lines
board/xilinx/ml507/ml507.c new file +9 -0
+
+void get_sys_info(sys_info_t * sysInfo)
+{
+	sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ;
+	sysInfo->freqPLB = XPAR_PLB_CLOCK_FREQ_HZ;
+	sysInfo->freqPCI = 0;
+
+	return;
+}
board/xilinx/ml507/u-boot.lds new file +130 -0
new file mode 100644
index 0000000..ef2bdc3
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ * 2008:
+ * Modified by: Ricardo Ribalda Delgado ricardo.ribalda at uam.es
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+OUTPUT_ARCH(powerpc)
+ENTRY(_start_440)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .rel.text      : { *(.rel.text)		}
+  .rela.text     : { *(.rela.text)	}
+  .rel.data      : { *(.rel.data)		}
+  .rela.data     : { *(.rela.data)	}
+  .rel.rodata    : { *(.rel.rodata)	}
+  .rela.rodata   : { *(.rela.rodata)	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .init          : { *(.init)	}
+  .plt : { *(.plt) }
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
(quoted diff) +0 -0

b/board/xilinx/ml507/xparameters.h new file mode 100644 index 0000000..8d938f9

board/xilinx/ml507/xparameters.h new file +35 -0
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * based on xparameters-ml507.h by Xilinx
+ *
+ * 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 XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR 	0x00000000
+#define XPAR_INTC_0_BASEADDR 		0x81800000
+#define XPAR_UARTLITE_0_BASEADDR 	0x84000000
+#define XPAR_RS232_UART_1_BASEADDR 	0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR 	0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR 	0x81c00000
+#define XPAR_FLASH_MEM0_BASEADDR 	0xFC000000
+#define XPAR_PLB_CLOCK_FREQ_HZ 		100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ 	400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 	13
+
+#endif
include/configs/ml507.h new file +87 -0
new file mode 100644
index 0000000..293ae65
@@ -0,0 +1,116 @@
+/*
+ * (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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 __CONFIG_H
+#define __CONFIG_H
+
+/*
+#define DEBUG
+#define ET_DEBUG
+*/
+ /*CPU*/
+#define CONFIG_XILINX_ML507	1
+#define CONFIG_XILINX_440	1
+#define CONFIG_440		1
+#define CONFIG_4xx		1
+#include "../board/xilinx/ml507/xparameters.h"
+
+/*Mem Map*/
+#define CFG_SDRAM_BASE		0x0
+#define CFG_MONITOR_BASE	0x04000000
+#define CFG_MONITOR_LEN		(192*1024)
+#define CFG_MALLOC_LEN		(128*1024)
+#define CFG_ISRAM_BASE		XPAR_XPS_BRAM_IF_CNTLR_1_BASEADDR
+
+/*Uart*/
+#define CONFIG_XILINX_UARTLITE
+#define CONFIG_BAUDRATE		9600
+#define CFG_BAUDRATE_TABLE	{9600}
+#define CONFIG_SERIAL_BASE	XPAR_UARTLITE_0_BASEADDR
+
+/*Cmd*/
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_IRQ
+#define CONFIG_CMD_REGINFO
+#undef CONFIG_CMD_I2C
+#undef CONFIG_CMD_DTT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_PING
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_EEPROM
+#undef CONFIG_CMD_IMLS
+
+/*Env*/
+#define	CFG_ENV_IS_NOWHERE
+#define	CFG_ENV_SIZE		0x200
+#define CFG_ENV_OFFSET 		0x100
+
+/*Misc*/
+#define CONFIG_BOOTDELAY	5		/* autoboot after 5 seconds     */
+#define CFG_LONGHELP				/* undef to save memory         */
+#define CFG_PROMPT		"board:/# "	/* Monitor Command Prompt       */
+#if defined(CONFIG_CMD_KGDB)
+#define CFG_CBSIZE		1024		/* Console I/O Buffer Size      */
+#else
+#define CFG_CBSIZE		256		/* Console I/O Buffer Size      */
+#endif
+#define CFG_PBSIZE		(CFG_CBSIZE+sizeof(CFG_PROMPT)+16)
+#define CFG_MAXARGS		16		/* max number of command args   */
+#define CFG_BARGSIZE		CFG_CBSIZE	/* Boot Argument Buffer Size */
+#define CFG_MEMTEST_START	0x0400000	/* memtest works on           */
+#define CFG_MEMTEST_END		0x0C00000	/* 4 ... 12 MB in DRAM        */
+#define CFG_LOAD_ADDR		0x400000	/* default load address       */
+#define CFG_EXTBDINFO		1		/* To use extended board_into (bd_t) */
+#define CFG_HZ			1000		/* decrementer freq: 1 ms ticks */
+#define CONFIG_CMDLINE_EDITING			/* add command line history     */
+#define CONFIG_AUTO_COMPLETE			/* add autocompletion support   */
+#define CONFIG_LOOPW				/* enable loopw command         */
+#define CONFIG_MX_CYCLIC			/* enable mdc/mwc commands      */
+#define CONFIG_ZERO_BOOTDELAY_CHECK		/* check for keypress on bootdelay==0

*/ +#define CONFIG_VERSION_VARIABLE /* include version env variable */

include/configs/ml507.h new file +10 -0
+#define CFG_CONSOLE_INFO_QUIET			/* don't print console @ startup */
+#define CFG_HUSH_PARSER				/* Use the HUSH parser          */
+#define	CFG_PROMPT_HUSH_PS2	"> "
+#define CONFIG_LOADS_ECHO			/* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE			/* allow baudrate change        */
+#define CFG_BOOTMAPSZ		(8 << 20)	/* Initial Memory map for Linux */
+#define CONFIG_PREBOOT		"echo U-Boot is up and runnining;"
+
+/*Stack*/
+#define CFG_INIT_RAM_ADDR	0x800000	/* Initial RAM address    */

include/configs/ml507.h line 108

Quoted 10 lines
include/configs/ml507.h new file +10 -0
+#define CFG_INIT_RAM_END	0x2000		/* End of used area in RAM  */
+#define CFG_GBL_DATA_SIZE	128		/* num bytes initial data   */
+#define CFG_GBL_DATA_OFFSET	(CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
+/*Speed*/
+#define CONFIG_SYS_CLK_FREQ	400000000
+
+/*Flash*/
+#define	CFG_FLASH_BASE		XPAR_FLASH_MEM0_BASEADDR
+#define	CFG_FLASH_SIZE		(32*1024*1024)

Why do you need this define? Is it really used?

include/configs/ml507.h line 116

Quoted 8 lines
include/configs/ml507.h new file +8 -0
+#define	CFG_FLASH_CFI		1
+#define	CFG_FLASH_CFI_DRIVER	1
+#define	CFG_FLASH_EMPTY_INFO	1
+#define	CFG_MAX_FLASH_BANKS	1
+#define	CFG_MAX_FLASH_SECT	128
+#define	CFG_FLASH_PROTECTION
+
+#endif						/* __CONFIG_H */

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#4 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Quoted 11 lines · In message <[email protected]> you wrote:

board/xilinx/ml507/ml507.c line 37

Quoted 5 lines
board/xilinx/ml507/ml507.c new file +4 -0
+phys_size_t initdram(int board_type)
+{
+	return 256 * 1024 * 1024;
+}

How about at least defining this SDRAM size in the board header and using it here:

board_foo.h:
#define CFG_MBYTES_SDRAM 256

No. All boards, especially all PowerPC boards, should use dynamic memory size detection.

There is no reason to hard-wire the size.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
All these theories, diverse as they are, have two things  in  common:
they explain the observed facts, and they are completeley and utterly
wrong.                       - Terry Pratchett, _The Light Fantastic_
#5 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Quoted 9 lines · Wolfgang Denk
Quoted 8 lines · In message <[email protected]> you wrote:

board/xilinx/ml507/ml507.c line 37

Quoted 4 lines
board/xilinx/ml507/ml507.c new file +4 -0
+phys_size_t initdram(int board_type)
+{
+	return 256 * 1024 * 1024;
+}

How about at least defining this SDRAM size in the board header and using it here:

Quoted 5 lines
Quoted 2 lines

board_foo.h:
#define CFG_MBYTES_SDRAM 256

No. All boards, especially all PowerPC boards, should use dynamic memory size detection.

You are probably referring to calling get_ram_size() instead of just returning the configured fixed value. But what do we gain here. get_ram_size() also needs the ram-size as parameter. Not sure if this is an improvement on such fixed systems.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#6 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 2 lines

#define CFG_MBYTES_SDRAM 256

No. All boards, especially all PowerPC boards, should use dynamic memory size detection.

You are probably referring to calling get_ram_size() instead of just returning the configured fixed value. But what do we gain here. get_ram_size() also needs the ram-size as parameter. Not sure if this is an improvement on such fixed systems.

It just needs a maximum possible size.

One major advantage is for example that get_ram_size() verifies that RAM is actually working, and of expected size. It is a very efficient test to make sure your hardware is actually working.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I can call spirits from the vasty deep."
"Why so can I, or so can any man; but will they come when you do call
for them?"          - Shakespeare, 1 King Henry IV, Act III, Scene I.
#7 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Hi Wolfgang,

Quoted 6 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 1 line

#define CFG_MBYTES_SDRAM 256

No. All boards, especially all PowerPC boards, should use dynamic memory size detection.

Quoted 6 lines
Quoted 4 lines

You are probably referring to calling get_ram_size() instead of just returning the configured fixed value. But what do we gain here. get_ram_size() also needs the ram-size as parameter. Not sure if this is an improvement on such fixed systems.

It just needs a maximum possible size.

OK, this would be the 256 MB from above again.

Quoted 3 lines

One major advantage is for example that get_ram_size() verifies that RAM is actually working, and of expected size. It is a very efficient test to make sure your hardware is actually working.

But what exactly should happen if such a board with only one possible memory size configuration detects ram_size != configured ram_size?

OK, this small check is an improvement over no check at all. Is it acceptable that I add this get_ram_size() with an additional patch? This would safe me from resetting my "next" branch or reverting patches.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#8 lore raw

PATCH 1/1 ppc4xx: ml507: Use of get_ram_size in board ml507

-Change suggested by WD

---
 board/xilinx/ml507/ml507.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
board/xilinx/ml507/ml507.c +3 -2
index e95d2af..d499303 100644
@@ -27,13 +27,14 @@ int board_pre_init(void)
 
 int checkboard(void)
 {
-	puts ("ML507 Board\n");
+	puts("ML507 Board\n");
 	return 0;
 }
 
 phys_size_t initdram(int board_type)
 {
-	return CFG_SDRAM_SIZE_MB * 1024 * 1024;
+	return get_ram_size(XPAR_DDR2_SDRAM_MEM_BASEADDR,
+			    CFG_SDRAM_SIZE_MB * 1024 * 1024);
 }
 
 void get_sys_info(sys_info_t * sysInfo)
Signature · 1 line
1.5.6.3
#9 lore raw

[U-Boot-Users] unassigned-patches/16: [PATCH] ppc4xx: ml507: Use of get_ram_size in board ml507

-Change suggested by WD

---
Added to GNATS database as unassigned-patches/16

Quoted 5 lines
Responsible:    patch-coord
Message-Id:     <[email protected]>
In-Reply-To:    <[email protected]>
References:     <[email protected]>
Patch-Date:     Tue Jul 29 17:16:10 +0200 2008
---
 board/xilinx/ml507/ml507.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
board/xilinx/ml507/ml507.c +3 -2
index e95d2af..d499303 100644
@@ -27,13 +27,14 @@ int board_pre_init(void)
 
 int checkboard(void)
 {
-	puts ("ML507 Board\n");
+	puts("ML507 Board\n");
 	return 0;
 }
 
 phys_size_t initdram(int board_type)
 {
-	return CFG_SDRAM_SIZE_MB * 1024 * 1024;
+	return get_ram_size(XPAR_DDR2_SDRAM_MEM_BASEADDR,
+			    CFG_SDRAM_SIZE_MB * 1024 * 1024);
 }
 
 void get_sys_info(sys_info_t * sysInfo)
Signature · 1 line
1.5.6.3
#10 lore raw

PATCH 1/1 ppc4xx: ml507: Use of get_ram_size in board ml507

In reply to Ricardo Ribalda Delgado
Quoted 3 lines · Ricardo Ribalda Delgado

-Change suggested by WD

Applied to next branch of u-boot-ppc4xx repository.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#11 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

In reply to Stefan Roese

Hi all

I have just prepared, tested and sent a patch.

Best regards

Quoted 38 lines · Stefan Roese

Hi Wolfgang,

Quoted 6 lines · Wolfgang Denk
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines
Quoted 1 line

#define CFG_MBYTES_SDRAM 256

No. All boards, especially all PowerPC boards, should use dynamic memory size detection.

Quoted 6 lines
Quoted 4 lines

You are probably referring to calling get_ram_size() instead of just returning the configured fixed value. But what do we gain here. get_ram_size() also needs the ram-size as parameter. Not sure if this is an improvement on such fixed systems.

It just needs a maximum possible size.

OK, this would be the 256 MB from above again.

Quoted 3 lines

One major advantage is for example that get_ram_size() verifies that RAM is actually working, and of expected size. It is a very efficient test to make sure your hardware is actually working.

But what exactly should happen if such a board with only one possible memory size configuration detects ram_size != configured ram_size?

OK, this small check is an improvement over no check at all. Is it acceptable that I add this get_ram_size() with an additional patch? This would safe me from resetting my "next" branch or reverting patches.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#12 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

In reply to Ricardo Ribalda Delgado
Quoted 60 lines

Added Flash Support

---
 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   47 ++++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130 ++++++++++++++++++++++++++++++++++++++
 board/xilinx/ml507/xparameters.h |   35 ++++++++++
 include/configs/ml507.h          |  116 +++++++++++++++++++++++++++++++++
 11 files changed, 469 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..06e78bf 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board, eeprom_simul, adt7460
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
 	sbc8240		MPC8240
 	sbc405		PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+	ml507 		PPC440x5
+
 Stefan Roese <[email protected]>
 
 	P3M7448		MPC7448
MAKEALL +0 -0
index a256e9a..5463a58 100755

MAKEALL LIST_4xx=" \ · line 243

Quoted 5 lines
MAKEALL +1 -0
@@ -239,6 +239,7 @@ LIST_4xx="		\
 	yosemite	\
 	yucca		\
 	zeus		\
+	ml507		\
 "

keep list sorted

Quoted 45 lines
MAKEALL +0 -0
 #########################################################################
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:	unconfig
 ml300_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +24 -0
new file mode 100644
index 0000000..b9bd737
@@ -0,0 +1,58 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk

board/xilinx/ml507/Makefile line 34

Quoted 10 lines
board/xilinx/ml507/Makefile new file +10 -0
+ifneq ($(OBJTREE),$(SRCTREE))
+endif
+
+INCS		:=
+CFLAGS		+= $(INCS)
+HOST_CFLAGS	+= $(INCS)
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS	= $(BOARD).o \

why is back-slash here?

Quoted 80 lines
board/xilinx/ml507/Makefile new file +23 -0
+SOBJS	= init.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $^
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +21 -0
new file mode 100644
index 0000000..6510646
@@ -0,0 +1,47 @@
+/*
+ *  (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <ppc_asm.tmpl>
+#include <config.h>

board/xilinx/ml507/init.S line 31

Quoted 10 lines
board/xilinx/ml507/init.S new file +10 -0
+#include <asm-ppc/mmu.h>
+
+.section .bootpg,"ax"
+.globl tlbtab
+
+tlbtab:
+tlbtab_start
+	/* SDRAM */
+tlbentry(XPAR_DDR2_SDRAM_MEM_BASEADDR, SZ_256M, CFG_SDRAM_BASE, 0,
+	 AC_R | AC_W | AC_X | SA_G | SA_I)

you have "\t\ " here

Quoted 49 lines
board/xilinx/ml507/init.S new file +16 -0
+	/* UART */
+tlbentry(XPAR_UARTLITE_0_BASEADDR, SZ_64K, XPAR_UARTLITE_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* PIC */
+tlbentry(XPAR_INTC_0_BASEADDR, SZ_64K, XPAR_INTC_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* I2C */
+tlbentry(XPAR_IIC_EEPROM_BASEADDR, SZ_64K, XPAR_IIC_EEPROM_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/* Net */
+tlbentry(XPAR_LLTEMAC_0_BASEADDR, SZ_64K, XPAR_LLTEMAC_0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+	/*Flash*/
+tlbentry(XPAR_FLASH_MEM0_BASEADDR, SZ_256M, XPAR_FLASH_MEM0_BASEADDR, 0,
+	 AC_R | AC_W | SA_G | SA_I)
+tlbtab_end
board/xilinx/ml507/ml507.c new file +27 -0
new file mode 100644
index 0000000..6d78dd6
@@ -0,0 +1,46 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <config.h>
+#include <common.h>
+#include <asm/processor.h>
+
+int board_pre_init(void)
+{
+	return 0;
+}
+

board/xilinx/ml507/ml507.c line 37

Quoted 10 lines
board/xilinx/ml507/ml507.c new file +10 -0
+int checkboard(void)
+{
+	puts ("ML507 Board\n");
+	return 0;
+}
+
+phys_size_t initdram(int board_type)
+{
+	return 256 * 1024 * 1024;
+}

the same as SR.

Quoted 159 lines
board/xilinx/ml507/ml507.c new file +8 -0
+void get_sys_info(sys_info_t * sysInfo)
+{
+	sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ;
+	sysInfo->freqPLB = XPAR_PLB_CLOCK_FREQ_HZ;
+	sysInfo->freqPCI = 0;
+
+	return;
+}
board/xilinx/ml507/u-boot.lds new file +130 -0
new file mode 100644
index 0000000..ef2bdc3
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ * 2008:
+ * Modified by: Ricardo Ribalda Delgado ricardo.ribalda at uam.es
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+OUTPUT_ARCH(powerpc)
+ENTRY(_start_440)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .rel.text      : { *(.rel.text)		}
+  .rela.text     : { *(.rela.text)	}
+  .rel.data      : { *(.rel.data)		}
+  .rela.data     : { *(.rela.data)	}
+  .rel.rodata    : { *(.rel.rodata)	}
+  .rela.rodata   : { *(.rela.rodata)	}
+  .rel.got       : { *(.rel.got)		}
+  .rela.got      : { *(.rela.got)		}
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.bss       : { *(.rel.bss)		}
+  .rela.bss      : { *(.rela.bss)		}
+  .rel.plt       : { *(.rel.plt)		}
+  .rela.plt      : { *(.rela.plt)		}
+  .init          : { *(.init)	}
+  .plt : { *(.plt) }
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
board/xilinx/ml507/xparameters.h new file +9 -0
new file mode 100644
index 0000000..8d938f9
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * based on xparameters-ml507.h by Xilinx
+ *
+ * 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

board/xilinx/ml507/xparameters.h line 19

Quoted 10 lines
board/xilinx/ml507/xparameters.h new file +10 -0
+ * (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/>.
+*/

I am not lawyer but IMHO you can't change license from generated file. You can add your copyright.

Quoted 46 lines
board/xilinx/ml507/xparameters.h new file +15 -0
+#ifndef XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR 	0x00000000
+#define XPAR_INTC_0_BASEADDR 		0x81800000
+#define XPAR_UARTLITE_0_BASEADDR 	0x84000000
+#define XPAR_RS232_UART_1_BASEADDR 	0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR 	0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR 	0x81c00000
+#define XPAR_FLASH_MEM0_BASEADDR 	0xFC000000
+#define XPAR_PLB_CLOCK_FREQ_HZ 		100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ 	400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 	13
+
+#endif
include/configs/ml507.h new file +25 -0
new file mode 100644
index 0000000..293ae65
@@ -0,0 +1,116 @@
+/*
+ * (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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 __CONFIG_H
+#define __CONFIG_H
+
+/*
+#define DEBUG
+#define ET_DEBUG
+*/
+ /*CPU*/

include/configs/ml507.h line 35

Quoted 10 lines
include/configs/ml507.h new file +10 -0
+#define CONFIG_XILINX_ML507	1
+#define CONFIG_XILINX_440	1
+#define CONFIG_440		1
+#define CONFIG_4xx		1
+#include "../board/xilinx/ml507/xparameters.h"
+
+/*Mem Map*/
+#define CFG_SDRAM_BASE		0x0
+#define CFG_MONITOR_BASE	0x04000000
+#define CFG_MONITOR_LEN		(192*1024)

better (192 * 1024) and for other defines too.

Quoted 36 lines
include/configs/ml507.h new file +36 -0
+#define CFG_MALLOC_LEN		(128*1024)
+#define CFG_ISRAM_BASE		XPAR_XPS_BRAM_IF_CNTLR_1_BASEADDR
+
+/*Uart*/
+#define CONFIG_XILINX_UARTLITE
+#define CONFIG_BAUDRATE		9600
+#define CFG_BAUDRATE_TABLE	{9600}
+#define CONFIG_SERIAL_BASE	XPAR_UARTLITE_0_BASEADDR
+
+/*Cmd*/
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_IRQ
+#define CONFIG_CMD_REGINFO
+#undef CONFIG_CMD_I2C
+#undef CONFIG_CMD_DTT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_PING
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_EEPROM
+#undef CONFIG_CMD_IMLS
+
+/*Env*/
+#define	CFG_ENV_IS_NOWHERE
+#define	CFG_ENV_SIZE		0x200
+#define CFG_ENV_OFFSET 		0x100
+
+/*Misc*/
+#define CONFIG_BOOTDELAY	5		/* autoboot after 5 seconds     */
+#define CFG_LONGHELP				/* undef to save memory         */
+#define CFG_PROMPT		"board:/# "	/* Monitor Command Prompt       */
+#if defined(CONFIG_CMD_KGDB)
+#define CFG_CBSIZE		1024		/* Console I/O Buffer Size      */

include/configs/ml507.h line 81

Quoted 10 lines
include/configs/ml507.h new file +10 -0
+#else
+#define CFG_CBSIZE		256		/* Console I/O Buffer Size      */
+#endif
+#define CFG_PBSIZE		(CFG_CBSIZE+sizeof(CFG_PROMPT)+16)
+#define CFG_MAXARGS		16		/* max number of command args   */
+#define CFG_BARGSIZE		CFG_CBSIZE	/* Boot Argument Buffer Size */
+#define CFG_MEMTEST_START	0x0400000	/* memtest works on           */
+#define CFG_MEMTEST_END		0x0C00000	/* 4 ... 12 MB in DRAM        */
+#define CFG_LOAD_ADDR		0x400000	/* default load address       */
+#define CFG_EXTBDINFO		1		/* To use extended board_into (bd_t) */

please check 80 char on line.

Quoted 35 lines
include/configs/ml507.h new file +35 -0
+#define CFG_HZ			1000		/* decrementer freq: 1 ms ticks */
+#define CONFIG_CMDLINE_EDITING			/* add command line history     */
+#define CONFIG_AUTO_COMPLETE			/* add autocompletion support   */
+#define CONFIG_LOOPW				/* enable loopw command         */
+#define CONFIG_MX_CYCLIC			/* enable mdc/mwc commands      */
+#define CONFIG_ZERO_BOOTDELAY_CHECK		/* check for keypress on bootdelay==0 */
+#define CONFIG_VERSION_VARIABLE			/* include version env variable */
+#define CFG_CONSOLE_INFO_QUIET			/* don't print console @ startup */
+#define CFG_HUSH_PARSER				/* Use the HUSH parser          */
+#define	CFG_PROMPT_HUSH_PS2	"> "
+#define CONFIG_LOADS_ECHO			/* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE			/* allow baudrate change        */
+#define CFG_BOOTMAPSZ		(8 << 20)	/* Initial Memory map for Linux */
+#define CONFIG_PREBOOT		"echo U-Boot is up and runnining;"
+
+/*Stack*/
+#define CFG_INIT_RAM_ADDR	0x800000	/* Initial RAM address    */
+#define CFG_INIT_RAM_END	0x2000		/* End of used area in RAM  */
+#define CFG_GBL_DATA_SIZE	128		/* num bytes initial data   */
+#define CFG_GBL_DATA_OFFSET	(CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET	CFG_GBL_DATA_OFFSET
+/*Speed*/
+#define CONFIG_SYS_CLK_FREQ	400000000
+
+/*Flash*/
+#define	CFG_FLASH_BASE		XPAR_FLASH_MEM0_BASEADDR
+#define	CFG_FLASH_SIZE		(32*1024*1024)
+#define	CFG_FLASH_CFI		1
+#define	CFG_FLASH_CFI_DRIVER	1
+#define	CFG_FLASH_EMPTY_INFO	1
+#define	CFG_MAX_FLASH_BANKS	1
+#define	CFG_MAX_FLASH_SECT	128
+#define	CFG_FLASH_PROTECTION
+
+#endif						/* __CONFIG_H */
#13 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support

Hi Michal

Thanks for your comments.
I am with you in all off them, expect for the xparameters.h. It is
completely different to the generated file by edk. I am just using their naming and they don't have the copyright of that names. Why I have use their names? It is very convenient for the final user. He will just have to replace the xparameters.h file with the generated file by edk.

Best regards

Quoted 599 lines · Michal Simek
Quoted 60 lines

Added Flash Support

---
 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   47 ++++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130 ++++++++++++++++++++++++++++++++++++++
 board/xilinx/ml507/xparameters.h |   35 ++++++++++
 include/configs/ml507.h          |  116 +++++++++++++++++++++++++++++++++
 11 files changed, 469 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..06e78bf 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board, eeprom_simul, adt7460
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
      sbc8240         MPC8240
      sbc405          PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+     ml507           PPC440x5
+
 Stefan Roese <[email protected]>
 
      P3M7448         MPC7448
MAKEALL +0 -0
index a256e9a..5463a58 100755

MAKEALL LIST_4xx=" \ · line 243

Quoted 5 lines
MAKEALL +1 -0
@@ -239,6 +239,7 @@ LIST_4xx="                \
      yosemite        \
      yucca           \
      zeus            \
+     ml507           \
 "

keep list sorted

Quoted 45 lines
MAKEALL +0 -0
 #########################################################################
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:     unconfig
 ml300_config:        unconfig
      @$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:        unconfig
+     @$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:       unconfig
      @$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +24 -0
new file mode 100644
index 0000000..b9bd737
@@ -0,0 +1,58 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+include $(TOPDIR)/config.mk

board/xilinx/ml507/Makefile line 34

Quoted 10 lines
board/xilinx/ml507/Makefile new file +10 -0
+ifneq ($(OBJTREE),$(SRCTREE))
+endif
+
+INCS         :=
+CFLAGS               += $(INCS)
+HOST_CFLAGS  += $(INCS)
+
+LIB  = $(obj)lib$(BOARD).a
+
+COBJS        = $(BOARD).o \

why is back-slash here?

Quoted 80 lines
board/xilinx/ml507/Makefile new file +23 -0
+SOBJS        = init.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS        := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):      $(OBJS) $(SOBJS)
+     $(AR) $(ARFLAGS) $@ $^
+
+clean:
+     rm -f $(SOBJS) $(OBJS)
+
+distclean:   clean
+     rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +21 -0
new file mode 100644
index 0000000..6510646
@@ -0,0 +1,47 @@
+/*
+ *  (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <ppc_asm.tmpl>
+#include <config.h>

board/xilinx/ml507/init.S line 31

Quoted 10 lines
board/xilinx/ml507/init.S new file +10 -0
+#include <asm-ppc/mmu.h>
+
+.section .bootpg,"ax"
+.globl tlbtab
+
+tlbtab:
+tlbtab_start
+     /* SDRAM */
+tlbentry(XPAR_DDR2_SDRAM_MEM_BASEADDR, SZ_256M, CFG_SDRAM_BASE, 0,
+      AC_R | AC_W | AC_X | SA_G | SA_I)

you have "\t\ " here

Quoted 49 lines
board/xilinx/ml507/init.S new file +16 -0
+     /* UART */
+tlbentry(XPAR_UARTLITE_0_BASEADDR, SZ_64K, XPAR_UARTLITE_0_BASEADDR, 0,
+      AC_R | AC_W | SA_G | SA_I)
+     /* PIC */
+tlbentry(XPAR_INTC_0_BASEADDR, SZ_64K, XPAR_INTC_0_BASEADDR, 0,
+      AC_R | AC_W | SA_G | SA_I)
+     /* I2C */
+tlbentry(XPAR_IIC_EEPROM_BASEADDR, SZ_64K, XPAR_IIC_EEPROM_BASEADDR, 0,
+      AC_R | AC_W | SA_G | SA_I)
+     /* Net */
+tlbentry(XPAR_LLTEMAC_0_BASEADDR, SZ_64K, XPAR_LLTEMAC_0_BASEADDR, 0,
+      AC_R | AC_W | SA_G | SA_I)
+     /*Flash*/
+tlbentry(XPAR_FLASH_MEM0_BASEADDR, SZ_256M, XPAR_FLASH_MEM0_BASEADDR, 0,
+      AC_R | AC_W | SA_G | SA_I)
+tlbtab_end
board/xilinx/ml507/ml507.c new file +27 -0
new file mode 100644
index 0000000..6d78dd6
@@ -0,0 +1,46 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.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/>.
+*/
+
+#include <config.h>
+#include <common.h>
+#include <asm/processor.h>
+
+int board_pre_init(void)
+{
+     return 0;
+}
+

board/xilinx/ml507/ml507.c line 37

Quoted 10 lines
board/xilinx/ml507/ml507.c new file +10 -0
+int checkboard(void)
+{
+     puts ("ML507 Board\n");
+     return 0;
+}
+
+phys_size_t initdram(int board_type)
+{
+     return 256 * 1024 * 1024;
+}

the same as SR.

Quoted 159 lines
board/xilinx/ml507/ml507.c new file +8 -0
+void get_sys_info(sys_info_t * sysInfo)
+{
+     sysInfo->freqProcessor = XPAR_CORE_CLOCK_FREQ_HZ;
+     sysInfo->freqPLB = XPAR_PLB_CLOCK_FREQ_HZ;
+     sysInfo->freqPCI = 0;
+
+     return;
+}
board/xilinx/ml507/u-boot.lds new file +130 -0
new file mode 100644
index 0000000..ef2bdc3
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ * 2008:
+ * Modified by: Ricardo Ribalda Delgado ricardo.ribalda at uam.es
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+OUTPUT_ARCH(powerpc)
+ENTRY(_start_440)
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp : { *(.interp) }
+  .hash          : { *(.hash)                }
+  .dynsym        : { *(.dynsym)              }
+  .dynstr        : { *(.dynstr)              }
+  .rel.text      : { *(.rel.text)            }
+  .rela.text     : { *(.rela.text)   }
+  .rel.data      : { *(.rel.data)            }
+  .rela.data     : { *(.rela.data)   }
+  .rel.rodata    : { *(.rel.rodata)  }
+  .rela.rodata   : { *(.rela.rodata) }
+  .rel.got       : { *(.rel.got)             }
+  .rela.got      : { *(.rela.got)            }
+  .rel.ctors     : { *(.rel.ctors)   }
+  .rela.ctors    : { *(.rela.ctors)  }
+  .rel.dtors     : { *(.rel.dtors)   }
+  .rela.dtors    : { *(.rela.dtors)  }
+  .rel.bss       : { *(.rel.bss)             }
+  .rela.bss      : { *(.rela.bss)            }
+  .rel.plt       : { *(.rel.plt)             }
+  .rela.plt      : { *(.rela.plt)            }
+  .init          : { *(.init)        }
+  .plt : { *(.plt) }
+  .text      :
+  {
+    *(.text)
+    *(.fixup)
+    *(.got1)
+  }
+  _etext = .;
+  PROVIDE (etext = .);
+  .rodata    :
+  {
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x00FF) & 0xFFFFFF00;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
+  __fixup_entries = (. - _FIXUP_TABLE_)>>2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(256);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(256);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss (NOLOAD)       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+  _end = . ;
+  PROVIDE (end = .);
+}
board/xilinx/ml507/xparameters.h new file +9 -0
new file mode 100644
index 0000000..8d938f9
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * based on xparameters-ml507.h by Xilinx
+ *
+ * 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

board/xilinx/ml507/xparameters.h line 19

Quoted 10 lines
board/xilinx/ml507/xparameters.h new file +10 -0
+ * (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/>.
+*/

I am not lawyer but IMHO you can't change license from generated file. You can add your copyright.

Quoted 46 lines
board/xilinx/ml507/xparameters.h new file +15 -0
+#ifndef XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR         0x00000000
+#define XPAR_INTC_0_BASEADDR                 0x81800000
+#define XPAR_UARTLITE_0_BASEADDR     0x84000000
+#define XPAR_RS232_UART_1_BASEADDR   0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR     0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR      0x81c00000
+#define XPAR_FLASH_MEM0_BASEADDR     0xFC000000
+#define XPAR_PLB_CLOCK_FREQ_HZ               100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ      400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS        13
+
+#endif
include/configs/ml507.h new file +25 -0
new file mode 100644
index 0000000..293ae65
@@ -0,0 +1,116 @@
+/*
+ * (C) Copyright 2008
+ *  Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ *  This work has been supported by: QTechnology  http://qtec.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 __CONFIG_H
+#define __CONFIG_H
+
+/*
+#define DEBUG
+#define ET_DEBUG
+*/
+ /*CPU*/

include/configs/ml507.h line 35

Quoted 10 lines
include/configs/ml507.h new file +10 -0
+#define CONFIG_XILINX_ML507  1
+#define CONFIG_XILINX_440    1
+#define CONFIG_440           1
+#define CONFIG_4xx           1
+#include "../board/xilinx/ml507/xparameters.h"
+
+/*Mem Map*/
+#define CFG_SDRAM_BASE               0x0
+#define CFG_MONITOR_BASE     0x04000000
+#define CFG_MONITOR_LEN              (192*1024)

better (192 * 1024) and for other defines too.

Quoted 36 lines
include/configs/ml507.h new file +36 -0
+#define CFG_MALLOC_LEN               (128*1024)
+#define CFG_ISRAM_BASE               XPAR_XPS_BRAM_IF_CNTLR_1_BASEADDR
+
+/*Uart*/
+#define CONFIG_XILINX_UARTLITE
+#define CONFIG_BAUDRATE              9600
+#define CFG_BAUDRATE_TABLE   {9600}
+#define CONFIG_SERIAL_BASE   XPAR_UARTLITE_0_BASEADDR
+
+/*Cmd*/
+#include <config_cmd_default.h>
+#define CONFIG_CMD_ASKENV
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DIAG
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_IRQ
+#define CONFIG_CMD_REGINFO
+#undef CONFIG_CMD_I2C
+#undef CONFIG_CMD_DTT
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_PING
+#undef CONFIG_CMD_DHCP
+#undef CONFIG_CMD_EEPROM
+#undef CONFIG_CMD_IMLS
+
+/*Env*/
+#define      CFG_ENV_IS_NOWHERE
+#define      CFG_ENV_SIZE            0x200
+#define CFG_ENV_OFFSET               0x100
+
+/*Misc*/
+#define CONFIG_BOOTDELAY     5               /* autoboot after 5 seconds     */
+#define CFG_LONGHELP                         /* undef to save memory         */
+#define CFG_PROMPT           "board:/# "     /* Monitor Command Prompt       */
+#if defined(CONFIG_CMD_KGDB)
+#define CFG_CBSIZE           1024            /* Console I/O Buffer Size      */

include/configs/ml507.h line 81

Quoted 10 lines
include/configs/ml507.h new file +10 -0
+#else
+#define CFG_CBSIZE           256             /* Console I/O Buffer Size      */
+#endif
+#define CFG_PBSIZE           (CFG_CBSIZE+sizeof(CFG_PROMPT)+16)
+#define CFG_MAXARGS          16              /* max number of command args   */
+#define CFG_BARGSIZE         CFG_CBSIZE      /* Boot Argument Buffer Size */
+#define CFG_MEMTEST_START    0x0400000       /* memtest works on           */
+#define CFG_MEMTEST_END              0x0C00000       /* 4 ... 12 MB in DRAM        */
+#define CFG_LOAD_ADDR                0x400000        /* default load address       */
+#define CFG_EXTBDINFO                1               /* To use extended board_into (bd_t) */

please check 80 char on line.

Quoted 35 lines
include/configs/ml507.h new file +35 -0
+#define CFG_HZ                       1000            /* decrementer freq: 1 ms ticks */
+#define CONFIG_CMDLINE_EDITING                       /* add command line history     */
+#define CONFIG_AUTO_COMPLETE                 /* add autocompletion support   */
+#define CONFIG_LOOPW                         /* enable loopw command         */
+#define CONFIG_MX_CYCLIC                     /* enable mdc/mwc commands      */
+#define CONFIG_ZERO_BOOTDELAY_CHECK          /* check for keypress on bootdelay==0 */
+#define CONFIG_VERSION_VARIABLE                      /* include version env variable */
+#define CFG_CONSOLE_INFO_QUIET                       /* don't print console @ startup */
+#define CFG_HUSH_PARSER                              /* Use the HUSH parser          */
+#define      CFG_PROMPT_HUSH_PS2     "> "
+#define CONFIG_LOADS_ECHO                    /* echo on for serial download  */
+#define CFG_LOADS_BAUD_CHANGE                        /* allow baudrate change        */
+#define CFG_BOOTMAPSZ                (8 << 20)       /* Initial Memory map for Linux */
+#define CONFIG_PREBOOT               "echo U-Boot is up and runnining;"
+
+/*Stack*/
+#define CFG_INIT_RAM_ADDR    0x800000        /* Initial RAM address    */
+#define CFG_INIT_RAM_END     0x2000          /* End of used area in RAM  */
+#define CFG_GBL_DATA_SIZE    128             /* num bytes initial data   */
+#define CFG_GBL_DATA_OFFSET  (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+#define CFG_INIT_SP_OFFSET   CFG_GBL_DATA_OFFSET
+/*Speed*/
+#define CONFIG_SYS_CLK_FREQ  400000000
+
+/*Flash*/
+#define      CFG_FLASH_BASE          XPAR_FLASH_MEM0_BASEADDR
+#define      CFG_FLASH_SIZE          (32*1024*1024)
+#define      CFG_FLASH_CFI           1
+#define      CFG_FLASH_CFI_DRIVER    1
+#define      CFG_FLASH_EMPTY_INFO    1
+#define      CFG_MAX_FLASH_BANKS     1
+#define      CFG_MAX_FLASH_SECT      128
+#define      CFG_FLASH_PROTECTION
+
+#endif                                               /* __CONFIG_H */
Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#14 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support (Resubmit)

In reply to Michal Simek

The Xilinx ML507 Board is a Virtex 5 prototyping board that includes,
among others:
-Virtex 5 FX FPGA (With a ppc440x5 in it)
-256MB of SDRAM2
-32MB of Flash
-I2C Eeprom
-System ACE chip
-Serial ATA connectors
-RS232 Level Conversors
-Ethernet Transceiver

This patch gives support to a standard design produced by EDK for this
board: ppc440, uartlite, xilinx_int and flash

- Includes Changes propossed by Stefan Roese and Michal Simek

---
 CREDITS                          |    5 ++
 MAINTAINERS                      |    4 +
 MAKEALL                          |    1 +
 Makefile                         |    3 +
 board/xilinx/ml507/Makefile      |   58 +++++++++++++++++
 board/xilinx/ml507/config.mk     |   24 +++++++
 board/xilinx/ml507/init.S        |   47 ++++++++++++++
 board/xilinx/ml507/ml507.c       |   46 +++++++++++++
 board/xilinx/ml507/u-boot.lds    |  130 ++++++++++++++++++++++++++++++++++++++
 board/xilinx/ml507/xparameters.h |   34 ++++++++++
 include/configs/ml507.h          |  116 +++++++++++++++++++++++++++++++++
 11 files changed, 468 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/ml507/Makefile
 create mode 100644 board/xilinx/ml507/config.mk
 create mode 100644 board/xilinx/ml507/init.S
 create mode 100644 board/xilinx/ml507/ml507.c
 create mode 100644 board/xilinx/ml507/u-boot.lds
 create mode 100644 board/xilinx/ml507/xparameters.h
 create mode 100644 include/configs/ml507.h
CREDITS +5 -0
index 3b6e57d..06e78bf 100644
@@ -399,6 +399,11 @@ N: Stelian Pop
 E: stelian.pop at leadtechdesign.com
 D: Atmel AT91CAP9ADK support
 
+N: Ricardo Ribalda Delgado
+E: ricardo.ribalda at uam.es
+D: PPC440x5 (Virtex5), ML507 Board, eeprom_simul, adt7460
+W: http://www.ii.uam.es/~rribalda
+
 N: Stefan Roese
 E: sr at denx.de
 D: AMCC PPC4xx Support
MAINTAINERS +4 -0
index b667c8e..75b5b02 100644
@@ -311,6 +311,10 @@ Daniel Poirot <[email protected]>
 	sbc8240		MPC8240
 	sbc405		PPC405GP
 
+Ricardo Ribalda <[email protected]>
+
+	ml507 		PPC440x5
+
 Stefan Roese <[email protected]>
 
 	P3M7448		MPC7448
MAKEALL +1 -0
index a256e9a..098578d 100755
@@ -208,6 +208,7 @@ LIST_4xx="		\
 	MIP405T		\
 	ML2		\
 	ml300		\
+	ml507		\
 	ocotea		\
 	OCRTC		\
 	ORSG		\
Makefile +3 -0
index 10a3e06..40029e6 100644
@@ -1336,6 +1336,9 @@ ML2_config:	unconfig
 ml300_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml300 xilinx
 
+ml507_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ml507 xilinx
+
 ocotea_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx ocotea amcc
 
board/xilinx/ml507/Makefile new file +58 -0

58 lines not on this page · raw message

board/xilinx/ml507/config.mk new file +24 -0
new file mode 100644
index 0000000..35c52ad
@@ -0,0 +1,24 @@
+#
+# (C) Copyright 2000
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+TEXT_BASE = 0x04000000
board/xilinx/ml507/init.S new file +47 -0

47 lines not on this page · raw message

board/xilinx/ml507/ml507.c new file +46 -0

46 lines not on this page · raw message

board/xilinx/ml507/u-boot.lds new file +130 -0

130 lines not on this page · raw message

board/xilinx/ml507/xparameters.h new file +34 -0
new file mode 100644
index 0000000..1542e84
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * based on xparameters-ml507.h by Xilinx
+ *
+ * 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 XPARAMETER_H
+#define XPARAMETER_H
+
+#define XPAR_DDR2_SDRAM_MEM_BASEADDR 	0x00000000
+#define XPAR_INTC_0_BASEADDR 		0x81800000
+#define XPAR_UARTLITE_0_BASEADDR 	0x84000000
+#define XPAR_IIC_EEPROM_BASEADDR 	0x81600000
+#define XPAR_LLTEMAC_0_BASEADDR 	0x81c00000
+#define XPAR_FLASH_MEM0_BASEADDR 	0xFC000000
+#define XPAR_PLB_CLOCK_FREQ_HZ 		100000000
+#define XPAR_CORE_CLOCK_FREQ_HZ 	400000000
+#define XPAR_INTC_MAX_NUM_INTR_INPUTS 	13
+
+#endif
include/configs/ml507.h new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
1.5.6.2
#15 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support (Resubmit)

Quoted 11 lines · Ricardo Ribalda Delgado

The Xilinx ML507 Board is a Virtex 5 prototyping board that includes,
among others:
-Virtex 5 FX FPGA (With a ppc440x5 in it)
-256MB of SDRAM2
-32MB of Flash
-I2C Eeprom
-System ACE chip
-Serial ATA connectors
-RS232 Level Conversors
-Ethernet Transceiver

Quoted 4 lines

This patch gives support to a standard design produced by EDK for this
board: ppc440, uartlite, xilinx_int and flash

- Includes Changes propossed by Stefan Roese and Michal Simek

Applied to next branch of u-boot-ppc4xx after some minor cleanups.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#16 lore raw

[U-Boot-Users] ppc4xx: [PATCH] ML507 Board Support (Resubmit)

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 5 lines

This patch gives support to a standard design produced by EDK for this
board: ppc440, uartlite, xilinx_int and flash

- Includes Changes propossed by Stefan Roese and Michal Simek

Applied to next branch of u-boot-ppc4xx after some minor cleanups.

I still object against using a fixed memory configuration without testing. This should be avoided.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It seems intuitively obvious to me, which  means  that  it  might  be
wrong.                                                 -- Chris Torek
#17 lore raw
In reply to Ricardo Ribalda Delgado

Please do not use this yet. I have found problems running MAKEALL.

I try to fix then and resubmit

Quoted 800 lines · Ricardo Ribalda Delgado

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

(quoted diff) +0 -2
-interrupts.c divided in uic.c and interrupts.c
-xilinx_irq.c for xilinx interrupt controller
 
 cpu/ppc4xx/Makefile         |   15 +++-
 cpu/ppc4xx/cpu.c            |    4 +
 cpu/ppc4xx/interrupts.c     |  178 ++++++---------------------------
 cpu/ppc4xx/speed.c          |    6 +-
 cpu/ppc4xx/uic.c            |  238 +++++++++++++++++++++++++++++++++++++++++++
 cpu/ppc4xx/xilinx_irq.c     |  113 ++++++++++++++++++++
 include/asm-ppc/interrupt.h |   50 +++++++++
 include/asm-ppc/processor.h |    2 +
 8 files changed, 456 insertions(+), 150 deletions(-)
 create mode 100644 cpu/ppc4xx/uic.c
 create mode 100644 cpu/ppc4xx/xilinx_irq.c
 create mode 100644 include/asm-ppc/interrupt.h
cpu/ppc4xx/Makefile +14 -1
index 800bb41..b006127 100644
@@ -35,10 +35,14 @@ SOBJS       += kgdb.o
 COBJS  := 40x_spd_sdram.o
 COBJS  += 44x_spd_ddr.o
 COBJS  += 44x_spd_ddr2.o
-COBJS  += 4xx_enet.o
+ifndef CONFIG_XILINX_440
+COBJS   += 4xx_enet.o
+endif
 COBJS  += 4xx_pci.o
 COBJS  += 4xx_pcie.o
+ifndef CONFIG_XILINX_440
 COBJS  += 4xx_uart.o
+endif
 COBJS  += bedbug_405.o
 COBJS  += commproc.o
 COBJS  += cpu.o
@@ -47,11 +51,20 @@ COBJS       += denali_data_eye.o
 COBJS  += denali_spd_ddr2.o
 COBJS  += ecc.o
 COBJS  += fdt.o
+ifndef CONFIG_XILINX_440
 COBJS  += gpio.o
+endif
 COBJS  += i2c.o
 COBJS  += interrupts.o
+ifndef CONFIG_XILINX_440
+COBJS  += uic.o
+else
+COBJS  += xilinx_irq.o
+endif
 COBJS  += iop480_uart.o
+ifndef CONFIG_XILINX_440
 COBJS  += miiphy.o
+endif
 COBJS  += ndfc.o
 COBJS  += sdram.o
 COBJS  += speed.o
cpu/ppc4xx/cpu.c +4 -0
index ef32bc6..2b9b364 100644
@@ -541,6 +541,10 @@ int checkcpu (void)
               puts("GX Rev. A");
               strcpy(addstr, "No Security support");
               break;
+
+       case PVR_VIRTEX5:
+               puts(" VIRTEX5");
+               break;
 
       default:
               printf (" UNKNOWN (PVR=%08x)", pvr);
cpu/ppc4xx/interrupts.c +30 -148
index 8215dc6..58d1d81 100644
@@ -8,6 +8,10 @@
 * (C) Copyright 2003 (440GX port)
 * Travis B. Sawyer, Sandburst Corporation, tsawyer at sandburst.com
 *
+ * (C) Copyright 2008 (PPC440X05 port for Virtex 5 FX)
+ * Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * Work supported by Qtechnology (htpp://qtec.com)
+ *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
@@ -31,23 +35,11 @@
 #include <watchdog.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/interrupt.h>
 #include <ppc4xx.h>
 #include <ppc_asm.tmpl>
 #include <commproc.h>
 
-#if (UIC_MAX > 3)
-#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
-                        UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI) | \
-                        UIC_MASK(VECNUM_UIC3CI) | UIC_MASK(VECNUM_UIC3NCI))
-#elif (UIC_MAX > 2)
-#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
-                        UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI))
-#elif (UIC_MAX > 1)
-#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI))
-#else
-#define UICB0_ALL      0
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -58,11 +50,7 @@ struct       irq_action {
       void *arg;
       int count;
 };
-
-static struct irq_action irq_vecs[UIC_MAX * 32];
-
-u32 get_dcr(u16);
-void set_dcr(u16, u32);
+static struct irq_action irq_vecs[IRQ_MAX];
 
 #if defined(CONFIG_440)
 
@@ -103,7 +91,7 @@ int interrupt_init_cpu (unsigned *decrementer_count)
       /*
        * Mark all irqs as free
        */
-       for (vec = 0; vec < (UIC_MAX * 32); vec++) {
+       for (vec = 0; vec < IRQ_MAX; vec++) {
               irq_vecs[vec].handler = NULL;
               irq_vecs[vec].arg = NULL;
               irq_vecs[vec].count = 0;
@@ -147,110 +135,36 @@ int interrupt_init_cpu (unsigned *decrementer_count)
        */
       set_evpr(0x00000000);
 
-#if (UIC_MAX > 1)
-       /* Install the UIC1 handlers */
-       irq_install_handler(VECNUM_UIC1NCI, (void *)(void *)external_interrupt, 0);
-       irq_install_handler(VECNUM_UIC1CI, (void *)(void *)external_interrupt, 0);
-#endif
-#if (UIC_MAX > 2)
-       irq_install_handler(VECNUM_UIC2NCI, (void *)(void *)external_interrupt, 0);
-       irq_install_handler(VECNUM_UIC2CI, (void *)(void *)external_interrupt, 0);
-#endif
-#if (UIC_MAX > 3)
-       irq_install_handler(VECNUM_UIC3NCI, (void *)(void *)external_interrupt, 0);
-       irq_install_handler(VECNUM_UIC3CI, (void *)(void *)external_interrupt, 0);
-#endif
+       /*
+        *Call uic or xilinx_irq pic_enable
+        */
+       pic_enable();
 
       return (0);
 }
 
-/* Handler for UIC interrupt */
-static void uic_interrupt(u32 uic_base, int vec_base)
+void timer_interrupt_cpu(struct pt_regs *regs)
 {
-       u32 uic_msr;
-       u32 msr_shift;
-       int vec;
-
-       /*
-        * Read masked interrupt status register to determine interrupt source
-        */
-       uic_msr = get_dcr(uic_base + UIC_MSR);
-       msr_shift = uic_msr;
-       vec = vec_base;
-
-       while (msr_shift != 0) {
-               if (msr_shift & 0x80000000) {
-                       /*
-                        * Increment irq counter (for debug purpose only)
-                        */
-                       irq_vecs[vec].count++;
-
-                       if (irq_vecs[vec].handler != NULL) {
-                               /* call isr */
-                               (*irq_vecs[vec].handler)(irq_vecs[vec].arg);
-                       } else {
-                               set_dcr(uic_base + UIC_ER,
-                                       get_dcr(uic_base + UIC_ER) & ~UIC_MASK(vec));
-                               printf("Masking bogus interrupt vector %d"
-                                      " (UIC_BASE=0x%x)\n", vec, uic_base);
-                       }
-
-                       /*
-                        * After servicing the interrupt, we have to remove the
-                        * status indicator
-                        */
-                       set_dcr(uic_base + UIC_SR, UIC_MASK(vec));
-               }
-
-               /*
-                * Shift msr to next position and increment vector
-                */
-               msr_shift <<= 1;
-               vec++;
-       }
+       /* nothing to do here */
+       return;
 }
 
-/*
- * Handle external interrupts
- */
-void external_interrupt(struct pt_regs *regs)
+void interrupt_run_handler(int vec)
 {
-       u32 uic_msr;
-
-       /*
-        * Read masked interrupt status register to determine interrupt source
-        */
-       uic_msr = mfdcr(uic0msr);
-
-#if (UIC_MAX > 1)
-       if ((UIC_MASK(VECNUM_UIC1CI) & uic_msr) ||
-           (UIC_MASK(VECNUM_UIC1NCI) & uic_msr))
-               uic_interrupt(UIC1_DCR_BASE, 32);
-#endif
-
-#if (UIC_MAX > 2)
-       if ((UIC_MASK(VECNUM_UIC2CI) & uic_msr) ||
-           (UIC_MASK(VECNUM_UIC2NCI) & uic_msr))
-               uic_interrupt(UIC2_DCR_BASE, 64);
-#endif
-
-#if (UIC_MAX > 3)
-       if ((UIC_MASK(VECNUM_UIC3CI) & uic_msr) ||
-           (UIC_MASK(VECNUM_UIC3NCI) & uic_msr))
-               uic_interrupt(UIC3_DCR_BASE, 96);
-#endif
-
-       if (uic_msr & ~(UICB0_ALL))
-               uic_interrupt(UIC0_DCR_BASE, 0);
-
-       mtdcr(uic0sr, uic_msr);
+       irq_vecs[vec].count++;
+
+       if (irq_vecs[vec].handler != NULL) {
+               /* call isr */
+               (*irq_vecs[vec].handler) (irq_vecs[vec].arg);
+       } else {
+               pic_irq_disable(vec);
+               printf("Masking bogus interrupt vector %d\n", vec);
+       }
 
+       pic_irq_ack(vec);
       return;
 }
 
-/*
- * Install and free a interrupt handler.
- */
 void irq_install_handler(int vec, interrupt_handler_t * handler, void *arg)
 {
       /*
@@ -263,51 +177,19 @@ void irq_install_handler(int vec, interrupt_handler_t * handler, void *arg)
       irq_vecs[vec].handler = handler;
       irq_vecs[vec].arg = arg;
 
-       if ((vec >= 0) && (vec < 32))
-               mtdcr(uicer, mfdcr(uicer) | UIC_MASK(vec));
-#if (UIC_MAX > 1)
-       else if ((vec >= 32) && (vec < 64))
-               mtdcr(uic1er, mfdcr(uic1er) | UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 2)
-       else if ((vec >= 64) && (vec < 96))
-               mtdcr(uic2er, mfdcr(uic2er) | UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 3)
-       else if (vec >= 96)
-               mtdcr(uic3er, mfdcr(uic3er) | UIC_MASK(vec));
-#endif
-
-       debug("Install interrupt for vector %d ==> %p\n", vec, handler);
+       pic_irq_enable(vec);
+       return;
 }
 
-void irq_free_handler (int vec)
+void irq_free_handler(int vec)
 {
       debug("Free interrupt for vector %d ==> %p\n",
             vec, irq_vecs[vec].handler);
 
-       if ((vec >= 0) && (vec < 32))
-               mtdcr(uicer, mfdcr(uicer) & ~UIC_MASK(vec));
-#if (UIC_MAX > 1)
-       else if ((vec >= 32) && (vec < 64))
-               mtdcr(uic1er, mfdcr(uic1er) & ~UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 2)
-       else if ((vec >= 64) && (vec < 96))
-               mtdcr(uic2er, mfdcr(uic2er) & ~UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 3)
-       else if (vec >= 96)
-               mtdcr(uic3er, mfdcr(uic3er) & ~UIC_MASK(vec));
-#endif
+       pic_irq_disable(vec);
 
       irq_vecs[vec].handler = NULL;
       irq_vecs[vec].arg = NULL;
-}
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
-       /* nothing to do here */
       return;
 }
 
@@ -319,7 +201,7 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
       printf ("Interrupt-Information:\n");
       printf ("Nr  Routine   Arg       Count\n");
 
-       for (vec = 0; vec < (UIC_MAX * 32); vec++) {
+       for (vec = 0; vec < IRQ_MAX; vec++) {
               if (irq_vecs[vec].handler != NULL) {
                       printf ("%02d  %08lx  %08lx  %d\n",
                               vec,
cpu/ppc4xx/speed.c +5 -1
index b86b6de..d21bd82 100644
@@ -416,7 +416,8 @@ ulong get_PCI_freq (void)
       return sys_info.freqPCI;
 }
 
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)
+#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) \
+       && !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
       unsigned long strp0;
@@ -449,6 +450,8 @@ void get_sys_info (sys_info_t * sysInfo)
       sysInfo->freqUART = sysInfo->freqPLB;
 }
 #else
+
+#if !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
       unsigned long strp0;
@@ -535,6 +538,7 @@ void get_sys_info (sys_info_t * sysInfo)
 }
 
 #endif
+#endif /* CONFIG_XILINX_440 */
 
 #if defined(CONFIG_YUCCA)
 unsigned long determine_sysper(void)
cpu/ppc4xx/uic.c new file +238 -0
new file mode 100644
index 0000000..92350dc
@@ -0,0 +1,238 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * (C) Copyright 2002 (440 port)
+ * Scott McNutt, Artesyn Communication Producs, smcnutt at artsyncp.com
+ *
+ * (C) Copyright 2003 (440GX port)
+ * Travis B. Sawyer, Sandburst Corporation, tsawyer at sandburst.com
+ *
+ * (C) Copyright 2008 (PPC440X05 port for Virtex 5 FX)
+ * Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * Work supported by Qtechnology (htpp://qtec.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <watchdog.h>
+#include <command.h>
+#include <asm/processor.h>
+#include <asm/interrupt.h>
+#include <ppc4xx.h>
+#include <ppc_asm.tmpl>
+#include <commproc.h>
+
+#if (UIC_MAX > 3)
+#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
+                        UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI) | \
+                        UIC_MASK(VECNUM_UIC3CI) | UIC_MASK(VECNUM_UIC3NCI))
+#elif (UIC_MAX > 2)
+#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
+                        UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI))
+#elif (UIC_MAX > 1)
+#define UICB0_ALL      (UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI))
+#else
+#define UICB0_ALL      0
+#endif
+
+#if (UIC_MAX > 1) && !defined(CONFIG_440GX)
+static void uic_cascade_interrupt(void *para);
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void pic_enable()
+{
+       int vec;
+
+#if !defined (CONFIG_440_VIRTEX5)
+
+#if (UIC_MAX > 1)
+       /* Install the UIC1 handlers */
+       irq_install_handler(VECNUM_UIC1NCI, (void *)(void *)external_interrupt,
+                           0);
+       irq_install_handler(VECNUM_UIC1CI, (void *)(void *)external_interrupt,
+                           0);
+#endif
+#if (UIC_MAX > 2)
+       irq_install_handler(VECNUM_UIC2NCI, (void *)(void *)external_interrupt,
+                           0);
+       irq_install_handler(VECNUM_UIC2CI, (void *)(void *)external_interrupt,
+                           0);
+#endif
+#if (UIC_MAX > 3)
+       irq_install_handler(VECNUM_UIC3NCI, (void *)(void *)external_interrupt,
+                           0);
+       irq_install_handler(VECNUM_UIC3CI, (void *)(void *)external_interrupt,
+                           0);
+#endif
+#else                          /* !defined(CONFIG_440GX) */
+       /* Take the GX out of compatibility mode
+        * Travis Sawyer, 9 Mar 2004
+        * NOTE: 440gx user manual inconsistency here
+        *       Compatibility mode and Ethernet Clock select are not
+        *       correct in the manual
+        */
+       mfsdr(sdr_mfr, val);
+       val &= ~0x10000000;
+       mtsdr(sdr_mfr, val);
+
+       /* Enable UIC interrupts via UIC Base Enable Register */
+       mtdcr(uicb0sr, UICB0_ALL);
+       mtdcr(uicb0er, 0x54000000);
+       /* None are critical */
+       mtdcr(uicb0cr, 0);
+#endif                         /* !defined(CONFIG_440GX) */
+
+}
+
+#if (UIC_MAX > 1) && !defined(CONFIG_440GX)
+static void uic_cascade_interrupt(void *para)
+{
+       external_interrupt(para);
+}
+#endif
+
+/* Handler for UIC interrupt */
+static void uic_interrupt(u32 uic_base, int vec_base)
+{
+       u32 uic_msr;
+       u32 msr_shift;
+       int vec;
+
+       /*
+        * Read masked interrupt status register to determine interrupt source
+        */
+       uic_msr = get_dcr(uic_base + UIC_MSR);
+       msr_shift = uic_msr;
+       vec = vec_base;
+
+       while (msr_shift != 0) {
+               if (msr_shift & 0x80000000)
+                       interrupt_run_handler(vec);
+               /*
+                * Shift msr to next position and increment vector
+                */
+               msr_shift <<= 1;
+               vec++;
+       }
+}
+
+/*
+ * Handle external interrupts
+ */
+void external_interrupt(struct pt_regs *regs)
+{
+       u32 uic_msr;
+
+       /*
+        * Read masked interrupt status register to determine interrupt source
+        */
+       uic_msr = mfdcr(uic0msr);
+
+#if (UIC_MAX > 1)
+       if ((UIC_MASK(VECNUM_UIC1CI) & uic_msr) ||
+           (UIC_MASK(VECNUM_UIC1NCI) & uic_msr))
+               uic_interrupt(UIC1_DCR_BASE, 32);
+#endif
+
+#if (UIC_MAX > 2)
+       if ((UIC_MASK(VECNUM_UIC2CI) & uic_msr) ||
+           (UIC_MASK(VECNUM_UIC2NCI) & uic_msr))
+               uic_interrupt(UIC2_DCR_BASE, 64);
+#endif
+
+#if (UIC_MAX > 3)
+       if ((UIC_MASK(VECNUM_UIC3CI) & uic_msr) ||
+           (UIC_MASK(VECNUM_UIC3NCI) & uic_msr))
+               uic_interrupt(UIC3_DCR_BASE, 96);
+#endif
+
+       if (uic_msr & ~(UICB0_ALL))
+               uic_interrupt(UIC0_DCR_BASE, 0);
+
+       mtdcr(uic0sr, uic_msr);
+
+       return;
+}
+
+void pic_irq_ack(int vec)
+{
+
+       if ((vec >= 0) && (vec < 32))
+               mtdcr(uicsr, UIC_MASK(vec));
+#if (UIC_MAX > 1)
+       else if ((vec >= 32) && (vec < 64))
+               mtdcr(uic1sr, UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+       else if ((vec >= 64) && (vec < 96))
+               mtdcr(uic2sr, UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+       else if (vec >= 96)
+               mtdcr(uic3sr, UIC_MASK(vec));
+#endif
+}
+
+/*
+ * Install and free a interrupt handler.
+ */
+void pic_irq_enable(int vec, interrupt_handler_t * handler, void *arg)
+{
+
+       if ((vec >= 0) && (vec < 32))
+               mtdcr(uicer, mfdcr(uicer) | UIC_MASK(vec));
+#if (UIC_MAX > 1)
+       else if ((vec >= 32) && (vec < 64))
+               mtdcr(uic1er, mfdcr(uic1er) | UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+       else if ((vec >= 64) && (vec < 96))
+               mtdcr(uic2er, mfdcr(uic2er) | UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+       else if (vec >= 96)
+               mtdcr(uic3er, mfdcr(uic3er) | UIC_MASK(vec));
+#endif
+
+       debug("Install interrupt for vector %d ==> %p\n", vec, handler);
+}
+
+void pic_irq_disable(int vec)
+{
+
+       if ((vec >= 0) && (vec < 32))
+               mtdcr(uicer, mfdcr(uicer) & ~UIC_MASK(vec));
+#if (UIC_MAX > 1)
+       else if ((vec >= 32) && (vec < 64))
+               mtdcr(uic1er, mfdcr(uic1er) & ~UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+       else if ((vec >= 64) && (vec < 96))
+               mtdcr(uic2er, mfdcr(uic2er) & ~UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+       else if (vec >= 96)
+               mtdcr(uic3er, mfdcr(uic3er) & ~UIC_MASK(vec));
+#endif
+
+}
cpu/ppc4xx/xilinx_irq.c new file +113 -0
new file mode 100644
index 0000000..ff10a08
@@ -0,0 +1,113 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: Q-Technology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software Engineering-wd at denx.de
+ * 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/>.
+*/
+#include <common.h>
+#include <watchdog.h>
+#include <command.h>
+#include <asm/processor.h>
+#include <asm/interrupt.h>
+#include <ppc4xx.h>
+#include <ppc_asm.tmpl>
+#include <commproc.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define intc XPAR_INTC_0_BASEADDR
+#define ISR (u32*)(intc+(0*4)) /* Interrupt Status Register */
+#define IPR (u32*)(intc+(1*4)) /* Interrupt Pending Register */
+#define IER (u32*)(intc+(2*4)) /* Interrupt Enable Register */
+#define IAR (u32*)(intc+(3*4)) /* Interrupt Acknowledge Register */
+#define SIE (u32*)(intc+(4*4)) /* Set Interrupt Enable bits */
+#define CIE (u32*)(intc+(5*4)) /* Clear Interrupt Enable bits */
+#define IVR (u32*)(intc+(6*4)) /* Interrupt Vector Register */
+#define MER (u32*)(intc+(7*4)) /* Master Enable Register */
+
+#define IRQ_MASK(irq) (1<<(irq&0x1f))
+
+void pic_enable(void)
+{
+
+       printf("Xilinx PIC at 0x%8x\n", intc);
+
+       /*
+        * Disable all external interrupts until they are
+        * explicitly requested.
+        */
+       out_be32(IER, 0);
+
+       /* Acknowledge any pending interrupts just in case. */
+       out_be32(IAR, ~(u32) 0);
+
+       /* Turn on the Master Enable. */
+       out_be32(MER, 0x3UL);
+
+       return;
+
+}
+
+int xilinx_pic_irq_get(void)
+{
+       u32 irq;
+       irq = in_be32(IVR);
+
+       /* If no interrupt is pending then all bits of the IVR are set to 1. As
+        * the IVR is as many bits wide as numbers of inputs are available.
+        * Therefore, if all bits of the IVR are set to one, its content will
+        * be bigger than XPAR_INTC_MAX_NUM_INTR_INPUTS.
+        */
+       if (irq >= XPAR_INTC_MAX_NUM_INTR_INPUTS)
+               irq = -1;       /* report no pending interrupt. */
+
+       debug("get_irq: %d\n", irq);
+       return (irq);
+}
+
+void pic_irq_enable(unsigned int irq)
+{
+       unsigned long mask = IRQ_MASK(irq);
+       debug("enable: %d\n", irq);
+       out_be32(SIE, mask);
+}
+
+void pic_irq_disable(unsigned int irq)
+{
+       unsigned long mask = IRQ_MASK(irq);
+       debug("disable: %d\n", irq);
+       out_be32(CIE, mask);
+}
+
+void pic_irq_ack(unsigned int irq)
+{
+       unsigned long mask = IRQ_MASK(irq);
+       debug("ack: %d\n", irq);
+       out_be32(IAR, mask);
+}
+
+void external_interrupt(struct pt_regs *regs)
+{
+       int irq;
+
+       irq = xilinx_pic_irq_get();
+       if (irq < 0)
+               return;
+
+       interrupt_run_handler(irq);
+
+       return;
+}
include/asm-ppc/interrupt.h new file +50 -0
new file mode 100644
index 0000000..5217e66
@@ -0,0 +1,50 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: Q-Technology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software Engineering-wd at denx.de
+ *
+ * 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 INTERRUPT_H
+#define INTERRUPT_H
+
+#if defined(CONFIG_440SPE) || \
+    defined(CONFIG_460EX) || defined(CONFIG_460GT)
+#define UIC_MAX                4
+#elif defined(CONFIG_440GX) || \
+    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) || \
+    defined(CONFIG_405EX)
+#define UIC_MAX                3
+#elif defined(CONFIG_440GP) || defined(CONFIG_440SP) || \
+    defined(CONFIG_440EP) || defined(CONFIG_440GR)
+#define UIC_MAX                2
+#else
+#define UIC_MAX                1
+#endif
+
+#if defined(CONFIG_440_VIRTEX5)
+#define IRQ_MAX XPAR_INTC_MAX_NUM_INTR_INPUTS
+#else
+#define IRQ_MAX UIC_MAX * 32
+#endif
+
+void pic_enable(void);
+void pic_irq_enable(unsigned int irq);
+void pic_irq_disable(unsigned int irq);
+void pic_irq_ack(unsigned int irq);
+void external_interrupt(struct pt_regs *regs);
+void interrupt_run_handler(int vec);
+
+#endif
include/asm-ppc/processor.h +2 -1
index 6e134c3..5501244 100644
@@ -839,6 +839,8 @@
 #define PVR_86xx       0x80040000
 #define PVR_86xx_REV1  (PVR_86xx | 0x0010)
 
+#define PVR_VIRTEX5     0x7ff21912
+
 /*
 * For the 8xx processors, all of them report the same PVR family for
 * the PowerPC core. The various versions of these processors must be
--

1.5.6.2

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#18 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (new version)

In reply to Ricardo Ribalda Delgado

Previous patch did not compile on some boards

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

-interrupts.c divided in uic.c and interrupts.c

-xilinx_irq.c for xilinx interrupt controller

 cpu/ppc4xx/Makefile         |   13 +++
 cpu/ppc4xx/cpu.c            |    8 ++
 cpu/ppc4xx/interrupts.c     |  178 ++++++------------------------------
 cpu/ppc4xx/speed.c          |    6 +-
 cpu/ppc4xx/uic.c            |  210 +++++++++++++++++++++++++++++++++++++++++++
 cpu/ppc4xx/xilinx_irq.c     |  111 +++++++++++++++++++++++
 include/asm-ppc/interrupt.h |   37 ++++++++
 include/asm-ppc/processor.h |    2 +
 8 files changed, 416 insertions(+), 149 deletions(-)
 create mode 100644 cpu/ppc4xx/uic.c
 create mode 100644 cpu/ppc4xx/xilinx_irq.c
 create mode 100644 include/asm-ppc/interrupt.h
cpu/ppc4xx/Makefile +13 -0
index 800bb41..9d918c9 100644
@@ -35,10 +35,14 @@ SOBJS	+= kgdb.o
 COBJS	:= 40x_spd_sdram.o
 COBJS	+= 44x_spd_ddr.o
 COBJS	+= 44x_spd_ddr2.o
+ifndef CONFIG_XILINX_440
 COBJS	+= 4xx_enet.o
+endif
 COBJS	+= 4xx_pci.o
 COBJS	+= 4xx_pcie.o
+ifndef CONFIG_XILINX_440
 COBJS	+= 4xx_uart.o
+endif
 COBJS	+= bedbug_405.o
 COBJS	+= commproc.o
 COBJS	+= cpu.o
@@ -47,11 +51,20 @@ COBJS	+= denali_data_eye.o
 COBJS	+= denali_spd_ddr2.o
 COBJS	+= ecc.o
 COBJS	+= fdt.o
+ifndef CONFIG_XILINX_440
 COBJS	+= gpio.o
+endif
 COBJS	+= i2c.o
 COBJS	+= interrupts.o
+ifndef CONFIG_XILINX_440
+COBJS	+= uic.o
+else
+COBJS	+= xilinx_irq.o
+endif
 COBJS	+= iop480_uart.o
+ifndef CONFIG_XILINX_440
 COBJS	+= miiphy.o
+endif
 COBJS	+= ndfc.o
 COBJS	+= sdram.o
 COBJS	+= speed.o
cpu/ppc4xx/cpu.c +8 -0
index ef32bc6..775ed01 100644
@@ -279,7 +279,11 @@ int checkcpu (void)
 
 	get_sys_info(&sys_info);
 
+#if defined(CONFIG_XILINX_440)
+	puts("IBM PowerPC 4");
+#else
 	puts("AMCC PowerPC 4");
+#endif
 
 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
     defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
@@ -541,6 +545,10 @@ int checkcpu (void)
 		puts("GX Rev. A");
 		strcpy(addstr, "No Security support");
 		break;
+	
+	case PVR_VIRTEX5:
+		puts(" VIRTEX5");
+		break;
 
 	default:
 		printf (" UNKNOWN (PVR=%08x)", pvr);
cpu/ppc4xx/interrupts.c +30 -148

245 lines not on this page · raw message

cpu/ppc4xx/speed.c +5 -1
index b86b6de..d21bd82 100644
@@ -416,7 +416,8 @@ ulong get_PCI_freq (void)
 	return sys_info.freqPCI;
 }
 
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)
+#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) \
+	&& !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -449,6 +450,8 @@ void get_sys_info (sys_info_t * sysInfo)
 	sysInfo->freqUART = sysInfo->freqPLB;
 }
 #else
+
+#if !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -535,6 +538,7 @@ void get_sys_info (sys_info_t * sysInfo)
 }
 
 #endif
+#endif /* CONFIG_XILINX_440 */
 
 #if defined(CONFIG_YUCCA)
 unsigned long determine_sysper(void)
cpu/ppc4xx/uic.c new file +210 -0

210 lines not on this page · raw message

cpu/ppc4xx/xilinx_irq.c new file +111 -0

111 lines not on this page · raw message

include/asm-ppc/interrupt.h new file +37 -0
new file mode 100644
index 0000000..6c84a84
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software [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 INTERRUPT_H
+#define INTERRUPT_H
+
+
+#if defined(CONFIG_440_VIRTEX5)
+#define IRQ_MAX XPAR_INTC_MAX_NUM_INTR_INPUTS
+#else
+#define IRQ_MAX UIC_MAX * 32
+#endif
+
+void pic_enable(void);
+void pic_irq_enable(unsigned int irq);
+void pic_irq_disable(unsigned int irq);
+void pic_irq_ack(unsigned int irq);
+void external_interrupt(struct pt_regs *regs);
+void interrupt_run_handler(int vec);
+
+#endif
include/asm-ppc/processor.h +2 -0
index 6e134c3..5501244 100644
@@ -839,6 +839,8 @@
 #define PVR_86xx	0x80040000
 #define PVR_86xx_REV1	(PVR_86xx | 0x0010)
 
+#define PVR_VIRTEX5     0x7ff21912
+
 /*
  * For the 8xx processors, all of them report the same PVR family for
  * the PowerPC core. The various versions of these processors must be
Signature · 1 line
1.5.6.2
#19 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (new version)

Review

Quoted 11 lines · Ricardo Ribalda Delgado

Previous patch did not compile on some boards

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

(quoted diff) +0 -2
-interrupts.c divided in uic.c and interrupts.c
 
-xilinx_irq.c for xilinx interrupt controller

Hmmm..... My feeling here is that you have the stuff above the triple-dash and the stuff below the triple-dash swapped.

Stuff above is official Log Message.
Stuff below is commentary.

jdl

#20 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (newversion)

HI Jon

Jou are completely right. Lets wait for more comments, and if there is no other I will resubmit.

Best regards

Quoted 24 lines · Jon Loeliger

Review

Quoted 12 lines · Ricardo Ribalda Delgado

Previous patch did not compile on some boards

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

(quoted diff) +0 -2
-interrupts.c divided in uic.c and interrupts.c
 
-xilinx_irq.c for xilinx interrupt controller

Hmmm..... My feeling here is that you have the stuff above the triple-dash and the stuff below the triple-dash swapped.

Stuff above is official Log Message.
Stuff below is commentary.

jdl

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#21 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (new version)

In reply to Ricardo Ribalda Delgado

Review

Quoted 11 lines · Ricardo Ribalda Delgado

Previous patch did not compile on some boards

---
-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

(quoted diff) +0 -2
-interrupts.c divided in uic.c and interrupts.c
 
-xilinx_irq.c for xilinx interrupt controller

Jon already commented about the swapped commit text/comments issue. Apart from that please find some more comments below:

Quoted 41 lines
 cpu/ppc4xx/Makefile         |   13 +++
 cpu/ppc4xx/cpu.c            |    8 ++
 cpu/ppc4xx/interrupts.c     |  178 ++++++------------------------------
 cpu/ppc4xx/speed.c          |    6 +-
 cpu/ppc4xx/uic.c            |  210
+++++++++++++++++++++++++++++++++++++++++++ cpu/ppc4xx/xilinx_irq.c     | 
111 +++++++++++++++++++++++
 include/asm-ppc/interrupt.h |   37 ++++++++
 include/asm-ppc/processor.h |    2 +
 8 files changed, 416 insertions(+), 149 deletions(-)
 create mode 100644 cpu/ppc4xx/uic.c
 create mode 100644 cpu/ppc4xx/xilinx_irq.c
 create mode 100644 include/asm-ppc/interrupt.h
cpu/ppc4xx/Makefile +6 -0
index 800bb41..9d918c9 100644
@@ -35,10 +35,14 @@ SOBJS	+= kgdb.o
 COBJS	:= 40x_spd_sdram.o
 COBJS	+= 44x_spd_ddr.o
 COBJS	+= 44x_spd_ddr2.o
+ifndef CONFIG_XILINX_440
 COBJS	+= 4xx_enet.o
+endif
 COBJS	+= 4xx_pci.o
 COBJS	+= 4xx_pcie.o
+ifndef CONFIG_XILINX_440
 COBJS	+= 4xx_uart.o
+endif
 COBJS	+= bedbug_405.o
 COBJS	+= commproc.o
 COBJS	+= cpu.o
@@ -47,11 +51,20 @@ COBJS	+= denali_data_eye.o
 COBJS	+= denali_spd_ddr2.o
 COBJS	+= ecc.o
 COBJS	+= fdt.o
+ifndef CONFIG_XILINX_440
 COBJS	+= gpio.o
+endif
 COBJS	+= i2c.o

cpu/ppc4xx/Makefile COBJS += denali_data_eye.o · line 67

Quoted 10 lines
cpu/ppc4xx/Makefile +7 -0
 COBJS	+= interrupts.o
+ifndef CONFIG_XILINX_440
+COBJS	+= uic.o
+else
+COBJS	+= xilinx_irq.o
+endif
 COBJS	+= iop480_uart.o
+ifndef CONFIG_XILINX_440
 COBJS	+= miiphy.o
+endif

Even though we usually sort the files alphabetically, these multiple "ifndef's" look very ugly. Perhaps we should change this here to a single "ifndef" with all the non-Xilinx files in it.

Quoted 20 lines
cpu/ppc4xx/Makefile +0 -0
 COBJS	+= ndfc.o
 COBJS	+= sdram.o
 COBJS	+= speed.o
cpu/ppc4xx/cpu.c +4 -0
index ef32bc6..775ed01 100644
@@ -279,7 +279,11 @@ int checkcpu (void)
 
 	get_sys_info(&sys_info);
 
+#if defined(CONFIG_XILINX_440)
+	puts("IBM PowerPC 4");
+#else
 	puts("AMCC PowerPC 4");
+#endif
 
 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
     defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \

cpu/ppc4xx/cpu.c int checkcpu (void) · line 551

Quoted 7 lines
cpu/ppc4xx/cpu.c +4 -0
@@ -541,6 +545,10 @@ int checkcpu (void)
 		puts("GX Rev. A");
 		strcpy(addstr, "No Security support");
 		break;
+
+	case PVR_VIRTEX5:
+		puts(" VIRTEX5");
+		break;

Is the CPU really a VIRTEX5 or a PPC440 variant? I think the latter. Perhaps something like "PPC440x5"?

Quoted 371 lines
cpu/ppc4xx/cpu.c +0 -0
 	default:
 		printf (" UNKNOWN (PVR=%08x)", pvr);
cpu/ppc4xx/interrupts.c +7 -22
index 8215dc6..58d1d81 100644
@@ -8,6 +8,10 @@
  * (C) Copyright 2003 (440GX port)
  * Travis B. Sawyer, Sandburst Corporation, tsawyer at sandburst.com
  *
+ * (C) Copyright 2008 (PPC440X05 port for Virtex 5 FX)
+ * Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * Work supported by Qtechnology (htpp://qtec.com)
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
@@ -31,23 +35,11 @@
 #include <watchdog.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/interrupt.h>
 #include <ppc4xx.h>
 #include <ppc_asm.tmpl>
 #include <commproc.h>
 
-#if (UIC_MAX > 3)
-#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
-			 UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI) | \
-			 UIC_MASK(VECNUM_UIC3CI) | UIC_MASK(VECNUM_UIC3NCI))
-#elif (UIC_MAX > 2)
-#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
-			 UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI))
-#elif (UIC_MAX > 1)
-#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI))
-#else
-#define UICB0_ALL	0
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -58,11 +50,7 @@ struct	irq_action {
 	void *arg;
 	int count;
 };
-
-static struct irq_action irq_vecs[UIC_MAX * 32];
-
-u32 get_dcr(u16);
-void set_dcr(u16, u32);
+static struct irq_action irq_vecs[IRQ_MAX];
 
 #if defined(CONFIG_440)
 
@@ -103,7 +91,7 @@ int interrupt_init_cpu (unsigned *decrementer_count)
 	/*
 	 * Mark all irqs as free
 	 */
-	for (vec = 0; vec < (UIC_MAX * 32); vec++) {
+	for (vec = 0; vec < IRQ_MAX; vec++) {
 		irq_vecs[vec].handler = NULL;
 		irq_vecs[vec].arg = NULL;
 		irq_vecs[vec].count = 0;
@@ -147,110 +135,36 @@ int interrupt_init_cpu (unsigned *decrementer_count)
 	 */
 	set_evpr(0x00000000);
 
-#if (UIC_MAX > 1)
-	/* Install the UIC1 handlers */
-	irq_install_handler(VECNUM_UIC1NCI, (void *)(void *)external_interrupt,

0); - irq_install_handler(VECNUM_UIC1CI, (void *)(void
*)external_interrupt, 0); -#endif

cpu/ppc4xx/interrupts.c +0 -2
-#if (UIC_MAX > 2)
-	irq_install_handler(VECNUM_UIC2NCI, (void *)(void *)external_interrupt,

0); - irq_install_handler(VECNUM_UIC2CI, (void *)(void
*)external_interrupt, 0); -#endif

cpu/ppc4xx/interrupts.c +0 -2
-#if (UIC_MAX > 3)
-	irq_install_handler(VECNUM_UIC3NCI, (void *)(void *)external_interrupt,

0); - irq_install_handler(VECNUM_UIC3CI, (void *)(void
*)external_interrupt, 0); -#endif

cpu/ppc4xx/interrupts.c +18 -79
+	/*
+	 *Call uic or xilinx_irq pic_enable
+	 */
+	pic_enable();
 
 	return (0);
 }
 
-/* Handler for UIC interrupt */
-static void uic_interrupt(u32 uic_base, int vec_base)
+void timer_interrupt_cpu(struct pt_regs *regs)
 {
-	u32 uic_msr;
-	u32 msr_shift;
-	int vec;
-
-	/*
-	 * Read masked interrupt status register to determine interrupt source
-	 */
-	uic_msr = get_dcr(uic_base + UIC_MSR);
-	msr_shift = uic_msr;
-	vec = vec_base;
-
-	while (msr_shift != 0) {
-		if (msr_shift & 0x80000000) {
-			/*
-			 * Increment irq counter (for debug purpose only)
-			 */
-			irq_vecs[vec].count++;
-
-			if (irq_vecs[vec].handler != NULL) {
-				/* call isr */
-				(*irq_vecs[vec].handler)(irq_vecs[vec].arg);
-			} else {
-				set_dcr(uic_base + UIC_ER,
-					get_dcr(uic_base + UIC_ER) & ~UIC_MASK(vec));
-				printf("Masking bogus interrupt vector %d"
-				       " (UIC_BASE=0x%x)\n", vec, uic_base);
-			}
-
-			/*
-			 * After servicing the interrupt, we have to remove the
-			 * status indicator
-			 */
-			set_dcr(uic_base + UIC_SR, UIC_MASK(vec));
-		}
-
-		/*
-		 * Shift msr to next position and increment vector
-		 */
-		msr_shift <<= 1;
-		vec++;
-	}
+	/* nothing to do here */
+	return;
 }
 
-/*
- * Handle external interrupts
- */
-void external_interrupt(struct pt_regs *regs)
+void interrupt_run_handler(int vec)
 {
-	u32 uic_msr;
-
-	/*
-	 * Read masked interrupt status register to determine interrupt source
-	 */
-	uic_msr = mfdcr(uic0msr);
-
-#if (UIC_MAX > 1)
-	if ((UIC_MASK(VECNUM_UIC1CI) & uic_msr) ||
-	    (UIC_MASK(VECNUM_UIC1NCI) & uic_msr))
-		uic_interrupt(UIC1_DCR_BASE, 32);
-#endif
-
-#if (UIC_MAX > 2)
-	if ((UIC_MASK(VECNUM_UIC2CI) & uic_msr) ||
-	    (UIC_MASK(VECNUM_UIC2NCI) & uic_msr))
-		uic_interrupt(UIC2_DCR_BASE, 64);
-#endif
-
-#if (UIC_MAX > 3)
-	if ((UIC_MASK(VECNUM_UIC3CI) & uic_msr) ||
-	    (UIC_MASK(VECNUM_UIC3NCI) & uic_msr))
-		uic_interrupt(UIC3_DCR_BASE, 96);
-#endif
-
-	if (uic_msr & ~(UICB0_ALL))
-		uic_interrupt(UIC0_DCR_BASE, 0);
-
-	mtdcr(uic0sr, uic_msr);
+	irq_vecs[vec].count++;
+
+	if (irq_vecs[vec].handler != NULL) {
+		/* call isr */
+		(*irq_vecs[vec].handler) (irq_vecs[vec].arg);
+	} else {
+		pic_irq_disable(vec);
+		printf("Masking bogus interrupt vector %d\n", vec);
+	}
 
+	pic_irq_ack(vec);
 	return;
 }
 
-/*
- * Install and free a interrupt handler.
- */
 void irq_install_handler(int vec, interrupt_handler_t * handler, void

*arg) {

cpu/ppc4xx/interrupts.c +5 -37
 	/*
@@ -263,51 +177,19 @@ void irq_install_handler(int vec, interrupt_handler_t
 * handler, void *arg) irq_vecs[vec].handler = handler;
 	irq_vecs[vec].arg = arg;
 
-	if ((vec >= 0) && (vec < 32))
-		mtdcr(uicer, mfdcr(uicer) | UIC_MASK(vec));
-#if (UIC_MAX > 1)
-	else if ((vec >= 32) && (vec < 64))
-		mtdcr(uic1er, mfdcr(uic1er) | UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 2)
-	else if ((vec >= 64) && (vec < 96))
-		mtdcr(uic2er, mfdcr(uic2er) | UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 3)
-	else if (vec >= 96)
-		mtdcr(uic3er, mfdcr(uic3er) | UIC_MASK(vec));
-#endif
-
-	debug("Install interrupt for vector %d ==> %p\n", vec, handler);
+	pic_irq_enable(vec);
+	return;
 }
 
-void irq_free_handler (int vec)
+void irq_free_handler(int vec)
 {
 	debug("Free interrupt for vector %d ==> %p\n",
 	      vec, irq_vecs[vec].handler);
 
-	if ((vec >= 0) && (vec < 32))
-		mtdcr(uicer, mfdcr(uicer) & ~UIC_MASK(vec));
-#if (UIC_MAX > 1)
-	else if ((vec >= 32) && (vec < 64))
-		mtdcr(uic1er, mfdcr(uic1er) & ~UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 2)
-	else if ((vec >= 64) && (vec < 96))
-		mtdcr(uic2er, mfdcr(uic2er) & ~UIC_MASK(vec));
-#endif
-#if (UIC_MAX > 3)
-	else if (vec >= 96)
-		mtdcr(uic3er, mfdcr(uic3er) & ~UIC_MASK(vec));
-#endif
+	pic_irq_disable(vec);
 
 	irq_vecs[vec].handler = NULL;
 	irq_vecs[vec].arg = NULL;
-}
-
-void timer_interrupt_cpu (struct pt_regs *regs)
-{
-	/* nothing to do here */
 	return;
 }
 
@@ -319,7 +201,7 @@ int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc,
 char *argv[]) printf ("Interrupt-Information:\n");
 	printf ("Nr  Routine   Arg       Count\n");
 
-	for (vec = 0; vec < (UIC_MAX * 32); vec++) {
+	for (vec = 0; vec < IRQ_MAX; vec++) {
 		if (irq_vecs[vec].handler != NULL) {
 			printf ("%02d  %08lx  %08lx  %d\n",
 				vec,
cpu/ppc4xx/speed.c +0 -1
index b86b6de..d21bd82 100644
@@ -416,7 +416,8 @@ ulong get_PCI_freq (void)
 	return sys_info.freqPCI;
 }
 
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) &&

!defined(CONFIG_440SPE) +#elif !defined(CONFIG_440GX) &&
!defined(CONFIG_440SP) && !defined(CONFIG_440SPE) \ + &&
!defined(CONFIG_XILINX_440)
void get_sys_info (sys_info_t * sysInfo)
{

cpu/ppc4xx/speed.c +3 -0
 	unsigned long strp0;
@@ -449,6 +450,8 @@ void get_sys_info (sys_info_t * sysInfo)
 	sysInfo->freqUART = sysInfo->freqPLB;
 }
 #else
+
+#if !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -535,6 +538,7 @@ void get_sys_info (sys_info_t * sysInfo)
 }
 
 #endif
+#endif /* CONFIG_XILINX_440 */
 
 #if defined(CONFIG_YUCCA)
 unsigned long determine_sysper(void)
cpu/ppc4xx/uic.c new file +75 -0
new file mode 100644
index 0000000..102b67a
@@ -0,0 +1,210 @@
+/*
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * (C) Copyright 2002 (440 port)
+ * Scott McNutt, Artesyn Communication Producs, smcnutt at artsyncp.com
+ *
+ * (C) Copyright 2003 (440GX port)
+ * Travis B. Sawyer, Sandburst Corporation, tsawyer at sandburst.com
+ *
+ * (C) Copyright 2008 (PPC440X05 port for Virtex 5 FX)
+ * Ricardo Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * Work supported by Qtechnology (htpp://qtec.com)
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <watchdog.h>
+#include <command.h>
+#include <asm/processor.h>
+#include <asm/interrupt.h>
+#include <ppc4xx.h>
+#include <ppc_asm.tmpl>
+#include <commproc.h>
+
+#if (UIC_MAX > 3)
+#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
+			 UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI) | \
+			 UIC_MASK(VECNUM_UIC3CI) | UIC_MASK(VECNUM_UIC3NCI))
+#elif (UIC_MAX > 2)
+#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI) | \
+			 UIC_MASK(VECNUM_UIC2CI) | UIC_MASK(VECNUM_UIC2NCI))
+#elif (UIC_MAX > 1)
+#define UICB0_ALL	(UIC_MASK(VECNUM_UIC1CI) | UIC_MASK(VECNUM_UIC1NCI))
+#else
+#define UICB0_ALL	0
+#endif
+
+u32 get_dcr(u16);
+
+DECLARE_GLOBAL_DATA_PTR;
+
+void pic_enable(void)
+{
+
+#if (UIC_MAX > 1)
+	/* Install the UIC1 handlers */
+	irq_install_handler(VECNUM_UIC1NCI, (void *)(void *)external_interrupt,
+			    0);
+	irq_install_handler(VECNUM_UIC1CI, (void *)(void *)external_interrupt,
+			    0);
+#endif
+#if (UIC_MAX > 2)
+	irq_install_handler(VECNUM_UIC2NCI, (void *)(void *)external_interrupt,
+			    0);
+	irq_install_handler(VECNUM_UIC2CI, (void *)(void *)external_interrupt,
+			    0);
+#endif

cpu/ppc4xx/uic.c line 85

Quoted 10 lines
cpu/ppc4xx/uic.c new file +10 -0
+#if (UIC_MAX > 3)
+	irq_install_handler(VECNUM_UIC3NCI, (void *)(void *)external_interrupt,
+			    0);
+	irq_install_handler(VECNUM_UIC3CI, (void *)(void *)external_interrupt,
+			    0);
+#endif
+
+}
+
+

Nitpick: Only one empty line please.

Quoted 150 lines
cpu/ppc4xx/uic.c new file +125 -0
+/* Handler for UIC interrupt */
+static void uic_interrupt(u32 uic_base, int vec_base)
+{
+	u32 uic_msr;
+	u32 msr_shift;
+	int vec;
+
+	/*
+	 * Read masked interrupt status register to determine interrupt source
+	 */
+	uic_msr = get_dcr(uic_base + UIC_MSR);
+	msr_shift = uic_msr;
+	vec = vec_base;
+
+	while (msr_shift != 0) {
+		if (msr_shift & 0x80000000)
+			interrupt_run_handler(vec);
+		/*
+		 * Shift msr to next position and increment vector
+		 */
+		msr_shift <<= 1;
+		vec++;
+	}
+}
+
+/*
+ * Handle external interrupts
+ */
+void external_interrupt(struct pt_regs *regs)
+{
+	u32 uic_msr;
+
+	/*
+	 * Read masked interrupt status register to determine interrupt source
+	 */
+	uic_msr = mfdcr(uic0msr);
+
+#if (UIC_MAX > 1)
+	if ((UIC_MASK(VECNUM_UIC1CI) & uic_msr) ||
+	    (UIC_MASK(VECNUM_UIC1NCI) & uic_msr))
+		uic_interrupt(UIC1_DCR_BASE, 32);
+#endif
+
+#if (UIC_MAX > 2)
+	if ((UIC_MASK(VECNUM_UIC2CI) & uic_msr) ||
+	    (UIC_MASK(VECNUM_UIC2NCI) & uic_msr))
+		uic_interrupt(UIC2_DCR_BASE, 64);
+#endif
+
+#if (UIC_MAX > 3)
+	if ((UIC_MASK(VECNUM_UIC3CI) & uic_msr) ||
+	    (UIC_MASK(VECNUM_UIC3NCI) & uic_msr))
+		uic_interrupt(UIC3_DCR_BASE, 96);
+#endif
+
+	if (uic_msr & ~(UICB0_ALL))
+		uic_interrupt(UIC0_DCR_BASE, 0);
+
+	mtdcr(uic0sr, uic_msr);
+
+	return;
+}
+
+void pic_irq_ack(unsigned int vec)
+{
+
+	if ((vec >= 0) && (vec < 32))
+		mtdcr(uicsr, UIC_MASK(vec));
+#if (UIC_MAX > 1)
+	else if ((vec >= 32) && (vec < 64))
+		mtdcr(uic1sr, UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+	else if ((vec >= 64) && (vec < 96))
+		mtdcr(uic2sr, UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+	else if (vec >= 96)
+		mtdcr(uic3sr, UIC_MASK(vec));
+#endif
+}
+
+/*
+ * Install and free a interrupt handler.
+ */
+void pic_irq_enable(unsigned int vec)
+{
+
+	if ((vec >= 0) && (vec < 32))
+		mtdcr(uicer, mfdcr(uicer) | UIC_MASK(vec));
+#if (UIC_MAX > 1)
+	else if ((vec >= 32) && (vec < 64))
+		mtdcr(uic1er, mfdcr(uic1er) | UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+	else if ((vec >= 64) && (vec < 96))
+		mtdcr(uic2er, mfdcr(uic2er) | UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+	else if (vec >= 96)
+		mtdcr(uic3er, mfdcr(uic3er) | UIC_MASK(vec));
+#endif
+
+	debug("Install interrupt for vector %d ==> %p\n", vec, handler);
+}
+
+void pic_irq_disable(unsigned int vec)
+{
+
+	if ((vec >= 0) && (vec < 32))
+		mtdcr(uicer, mfdcr(uicer) & ~UIC_MASK(vec));
+#if (UIC_MAX > 1)
+	else if ((vec >= 32) && (vec < 64))
+		mtdcr(uic1er, mfdcr(uic1er) & ~UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 2)
+	else if ((vec >= 64) && (vec < 96))
+		mtdcr(uic2er, mfdcr(uic2er) & ~UIC_MASK(vec));
+#endif
+#if (UIC_MAX > 3)
+	else if (vec >= 96)
+		mtdcr(uic3er, mfdcr(uic3er) & ~UIC_MASK(vec));
+#endif
+
+}
cpu/ppc4xx/xilinx_irq.c new file +5 -0
new file mode 100644
index 0000000..f2dbcc8
@@ -0,0 +1,111 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software

Engineering-wd at denx.de + * 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/>.

cpu/ppc4xx/xilinx_irq.c new file +2 -0
+*/
+#include <common.h>

cpu/ppc4xx/xilinx_irq.c line 29

Quoted 10 lines
cpu/ppc4xx/xilinx_irq.c new file +10 -0
+#include <watchdog.h>
+#include <command.h>
+#include <asm/processor.h>
+#include <asm/interrupt.h>
+#include <ppc4xx.h>
+#include <ppc_asm.tmpl>
+#include <commproc.h>
+#include <asm/io.h>
+
+DECLARE_GLOBAL_DATA_PTR;

Do you really need this in this file?

cpu/ppc4xx/xilinx_irq.c line 39

Quoted 10 lines
cpu/ppc4xx/xilinx_irq.c new file +10 -0
+
+#define intc XPAR_INTC_0_BASEADDR
+#define ISR (u32*)(intc+(0*4))	/* Interrupt Status Register */
+#define IPR (u32*)(intc+(1*4))	/* Interrupt Pending Register */
+#define IER (u32*)(intc+(2*4))	/* Interrupt Enable Register */
+#define IAR (u32*)(intc+(3*4))	/* Interrupt Acknowledge Register */
+#define SIE (u32*)(intc+(4*4))	/* Set Interrupt Enable bits */
+#define CIE (u32*)(intc+(5*4))	/* Clear Interrupt Enable bits */
+#define IVR (u32*)(intc+(6*4))	/* Interrupt Vector Register */
+#define MER (u32*)(intc+(7*4))	/* Master Enable Register */

Don't put the casts into the defines. They belong in the code.

Quoted 1 line

+#define IRQ_MASK(irq) (1<<(irq&0x1f))

Conding-style: Missing spaces.

cpu/ppc4xx/xilinx_irq.c

Quoted 3 lines
cpu/ppc4xx/xilinx_irq.c new file +3 -0
+void pic_enable(void)
+{
+	printf("Xilinx PIC at 0x%8x\n", intc);

You probably what a debug() here.

cpu/ppc4xx/xilinx_irq.c line 54

Quoted 9 lines
cpu/ppc4xx/xilinx_irq.c new file +9 -0
+
+	/*
+	 * Disable all external interrupts until they are
+	 * explicitly requested.
+	 */
+	out_be32(IER, 0);
+
+	/* Acknowledge any pending interrupts just in case. */
+	out_be32(IAR, ~(u32) 0);

I personally prefer to use 0xffffffff here.

Quoted 19 lines
cpu/ppc4xx/xilinx_irq.c new file +19 -0
+	/* Turn on the Master Enable. */
+	out_be32(MER, 0x3UL);
+
+	return;
+}
+
+int xilinx_pic_irq_get(void)
+{
+	u32 irq;
+	irq = in_be32(IVR);
+
+	/* If no interrupt is pending then all bits of the IVR are set to 1. As
+	 * the IVR is as many bits wide as numbers of inputs are available.
+	 * Therefore, if all bits of the IVR are set to one, its content will
+	 * be bigger than XPAR_INTC_MAX_NUM_INTR_INPUTS.
+	 */
+	if (irq >= XPAR_INTC_MAX_NUM_INTR_INPUTS)
+		irq = -1;	/* report no pending interrupt. */
+

cpu/ppc4xx/xilinx_irq.c line 84

Quoted 10 lines
cpu/ppc4xx/xilinx_irq.c new file +10 -0
+	debug("get_irq: %d\n", irq);
+	return (irq);
+}
+
+void pic_irq_enable(unsigned int irq)
+{
+	unsigned long mask = IRQ_MASK(irq);
+	debug("enable: %d\n", irq);
+	out_be32(SIE, mask);
+}

I suggest you decide for one type here and not use "unsigned int" and "unsigned long". I use u32 now if possible. This is for the whole file.

Quoted 51 lines
cpu/ppc4xx/xilinx_irq.c new file +27 -0
+
+void pic_irq_disable(unsigned int irq)
+{
+	unsigned long mask = IRQ_MASK(irq);
+	debug("disable: %d\n", irq);
+	out_be32(CIE, mask);
+}
+
+void pic_irq_ack(unsigned int irq)
+{
+	unsigned long mask = IRQ_MASK(irq);
+	debug("ack: %d\n", irq);
+	out_be32(IAR, mask);
+}
+
+void external_interrupt(struct pt_regs *regs)
+{
+	int irq;
+
+	irq = xilinx_pic_irq_get();
+	if (irq < 0)
+		return;
+
+	interrupt_run_handler(irq);
+
+	return;
+}
include/asm-ppc/interrupt.h new file +5 -0
new file mode 100644
index 0000000..6c84a84
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software

Engineering-wd at denx.de + *
+ * 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/>.

include/asm-ppc/interrupt.h line 28

Quoted 10 lines
include/asm-ppc/interrupt.h new file +10 -0
+*/
+#ifndef INTERRUPT_H
+#define INTERRUPT_H
+
+
+#if defined(CONFIG_440_VIRTEX5)
+#define IRQ_MAX XPAR_INTC_MAX_NUM_INTR_INPUTS
+#else
+#define IRQ_MAX UIC_MAX * 32
+#endif

Please move those defines into some interrupt controller specific headers. For uic version this is include/asm-ppc/ppc4xx-uic.h.

Quoted 14 lines
include/asm-ppc/interrupt.h new file +9 -0
+
+void pic_enable(void);
+void pic_irq_enable(unsigned int irq);
+void pic_irq_disable(unsigned int irq);
+void pic_irq_ack(unsigned int irq);
+void external_interrupt(struct pt_regs *regs);
+void interrupt_run_handler(int vec);
+
+#endif
include/asm-ppc/processor.h +0 -0
index 6e134c3..5501244 100644

include/asm-ppc/processor.h line 846

Quoted 8 lines
include/asm-ppc/processor.h +2 -0
@@ -839,6 +839,8 @@
 #define PVR_86xx	0x80040000
 #define PVR_86xx_REV1	(PVR_86xx | 0x0010)
 
+#define PVR_VIRTEX5     0x7ff21912
+
 /*
  * For the 8xx processors, all of them report the same PVR family for
  * the PowerPC core. The various versions of these processors must be

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#22 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (new version)

Hello Stefan

Thanks for your comments.

Quoted 3 lines · Stefan Roese

Even though we usually sort the files alphabetically, these multiple "ifndef's" look very ugly. Perhaps we should change this here to a single "ifndef" with all the non-Xilinx files in it.

OK, done

Quoted 3 lines

Is the CPU really a VIRTEX5 or a PPC440 variant? I think the latter. Perhaps something like "PPC440x5"?

The CPU is a PPC440x5 by IBM designed for the Virtex5, I think that is more descriptive Virtex5 than just x5. What do you thing about:

      puts ("x5 VIRTEX5");
Quoted 2 lines

Nitpick: Only one empty line please.

:) Sorry, done

Quoted 2 lines

Do you really need this in this file?

Yes, is the external interrupt handler of the CPU, it is needed for other elemments like the ethernet and the i2c.

Quoted 1 line

Don't put the casts into the defines. They belong in the code.

Done

Quoted 1 line

Conding-style: Missing spaces.

Done

Quoted 2 lines

You probably what a debug() here.

I liked the printf :) but I have changed it to a debug

Quoted 2 lines

I personally prefer to use 0xffffffff here.

OK

Quoted 2 lines

I suggest you decide for one type here and not use "unsigned int" and "unsigned long". I use u32 now if possible. This is for the whole file.

Done

Quoted 3 lines

Please move those defines into some interrupt controller specific headers. For uic version this is include/asm-ppc/ppc4xx-uic.h.

Done

Quoted 9 lines

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

Signature · 2 lines
Ricardo Ribalda
http://www.eps.uam.es/~rribalda/
#23 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (resubmit)

In reply to Stefan Roese

-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

-interrupts.c divided in uic.c and interrupts.c

-xilinx_irq.c for xilinx interrupt controller

-Include modifications propossed by Stefan Roese

---
 cpu/ppc4xx/Makefile          |   13 ++-
 cpu/ppc4xx/cpu.c             |    8 ++
 cpu/ppc4xx/interrupts.c      |  178 ++++++-----------------------------
 cpu/ppc4xx/speed.c           |    6 +-
 cpu/ppc4xx/uic.c             |  209 ++++++++++++++++++++++++++++++++++++++++++
 cpu/ppc4xx/xilinx_irq.c      |  100 ++++++++++++++++++++
 include/asm-ppc/interrupt.h  |   36 +++++++
 include/asm-ppc/ppc4xx-uic.h |    2 +
 include/asm-ppc/processor.h  |    2 +
 include/asm-ppc/xilinx_irq.h |   36 +++++++
 include/ppc4xx.h             |    2 +
 11 files changed, 439 insertions(+), 153 deletions(-)
 create mode 100644 cpu/ppc4xx/uic.c
 create mode 100644 cpu/ppc4xx/xilinx_irq.c
 create mode 100644 include/asm-ppc/interrupt.h
 create mode 100644 include/asm-ppc/xilinx_irq.h
cpu/ppc4xx/Makefile +9 -4
index 800bb41..c773400 100644
@@ -35,10 +35,8 @@ SOBJS	+= kgdb.o
 COBJS	:= 40x_spd_sdram.o
 COBJS	+= 44x_spd_ddr.o
 COBJS	+= 44x_spd_ddr2.o
-COBJS	+= 4xx_enet.o
 COBJS	+= 4xx_pci.o
 COBJS	+= 4xx_pcie.o
-COBJS	+= 4xx_uart.o
 COBJS	+= bedbug_405.o
 COBJS	+= commproc.o
 COBJS	+= cpu.o
@@ -47,11 +45,9 @@ COBJS	+= denali_data_eye.o
 COBJS	+= denali_spd_ddr2.o
 COBJS	+= ecc.o
 COBJS	+= fdt.o
-COBJS	+= gpio.o
 COBJS	+= i2c.o
 COBJS	+= interrupts.o
 COBJS	+= iop480_uart.o
-COBJS	+= miiphy.o
 COBJS	+= ndfc.o
 COBJS	+= sdram.o
 COBJS	+= speed.o
@@ -60,6 +56,15 @@ COBJS	+= traps.o
 COBJS	+= usb.o
 COBJS	+= usb_ohci.o
 COBJS	+= usbdev.o
+ifndef CONFIG_XILINX_440
+COBJS	+= 4xx_enet.o
+COBJS	+= 4xx_uart.o
+COBJS	+= gpio.o
+COBJS	+= miiphy.o
+COBJS	+= uic.o
+else
+COBJS	+= xilinx_irq.o
+endif
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/ppc4xx/cpu.c +8 -0
index ef32bc6..eb1d4f0 100644
@@ -279,7 +279,11 @@ int checkcpu (void)
 
 	get_sys_info(&sys_info);
 
+#if defined(CONFIG_XILINX_440)
+	puts("IBM PowerPC 4");
+#else
 	puts("AMCC PowerPC 4");
+#endif
 
 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
     defined(CONFIG_405EP) || defined(CONFIG_405EZ) || \
@@ -541,6 +545,10 @@ int checkcpu (void)
 		puts("GX Rev. A");
 		strcpy(addstr, "No Security support");
 		break;
+	
+	case PVR_VIRTEX5:
+		puts("x5 VIRTEX5");
+		break;
 
 	default:
 		printf (" UNKNOWN (PVR=%08x)", pvr);
cpu/ppc4xx/interrupts.c +30 -148

245 lines not on this page · raw message

cpu/ppc4xx/speed.c +5 -1
index b86b6de..d21bd82 100644
@@ -416,7 +416,8 @@ ulong get_PCI_freq (void)
 	return sys_info.freqPCI;
 }
 
-#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE)
+#elif !defined(CONFIG_440GX) && !defined(CONFIG_440SP) && !defined(CONFIG_440SPE) \
+	&& !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -449,6 +450,8 @@ void get_sys_info (sys_info_t * sysInfo)
 	sysInfo->freqUART = sysInfo->freqPLB;
 }
 #else
+
+#if !defined(CONFIG_XILINX_440)
 void get_sys_info (sys_info_t * sysInfo)
 {
 	unsigned long strp0;
@@ -535,6 +538,7 @@ void get_sys_info (sys_info_t * sysInfo)
 }
 
 #endif
+#endif /* CONFIG_XILINX_440 */
 
 #if defined(CONFIG_YUCCA)
 unsigned long determine_sysper(void)
cpu/ppc4xx/uic.c new file +209 -0

209 lines not on this page · raw message

cpu/ppc4xx/xilinx_irq.c new file +100 -0

100 lines not on this page · raw message

include/asm-ppc/interrupt.h new file +36 -0
new file mode 100644
index 0000000..792836b
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software [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 INTERRUPT_H
+#define INTERRUPT_H
+
+#if defined(CONFIG_XILINX_440)
+#include <asm/xilinx_irq.h>
+#else
+#include <asm/ppc4xx-uic.h>
+#endif
+
+void pic_enable(void);
+void pic_irq_enable(unsigned int irq);
+void pic_irq_disable(unsigned int irq);
+void pic_irq_ack(unsigned int irq);
+void external_interrupt(struct pt_regs *regs);
+void interrupt_run_handler(int vec);
+
+#endif
include/asm-ppc/ppc4xx-uic.h +2 -0
index d50c363..c908d42 100644
@@ -43,6 +43,8 @@
 #define UIC_MAX		1
 #endif
 
+#define IRQ_MAX UIC_MAX * 32
+
 /*
  * UIC register
  */
include/asm-ppc/processor.h +2 -0
index 6e134c3..5501244 100644
@@ -839,6 +839,8 @@
 #define PVR_86xx	0x80040000
 #define PVR_86xx_REV1	(PVR_86xx | 0x0010)
 
+#define PVR_VIRTEX5     0x7ff21912
+
 /*
  * For the 8xx processors, all of them report the same PVR family for
  * the PowerPC core. The various versions of these processors must be
include/asm-ppc/xilinx_irq.h new file +36 -0
new file mode 100644
index 0000000..ddccc75
@@ -0,0 +1,36 @@
+/*
+ * (C) Copyright 2008
+ * Ricado Ribalda-Universidad Autonoma de Madrid-ricardo.ribalda at uam.es
+ * This work has been supported by: QTechnology  http://qtec.com/
+ * Based on interrupts.c Wolfgang Denk-DENX Software Engineering-wd at denx.de
+ * 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 XILINX_IRQ_H
+#define XILINX_IRQ_H
+
+#define intc XPAR_INTC_0_BASEADDR
+#define ISR (intc+(0*4))	/* Interrupt Status Register */
+#define IPR (intc+(1*4))	/* Interrupt Pending Register */
+#define IER (intc+(2*4))	/* Interrupt Enable Register */
+#define IAR (intc+(3*4))	/* Interrupt Acknowledge Register */
+#define SIE (intc+(4*4))	/* Set Interrupt Enable bits */
+#define CIE (intc+(5*4))	/* Clear Interrupt Enable bits */
+#define IVR (intc+(6*4))	/* Interrupt Vector Register */
+#define MER (intc+(7*4))	/* Master Enable Register */
+
+#define IRQ_MASK(irq) (1<<(irq&0x1f))
+
+#define IRQ_MAX XPAR_INTC_MAX_NUM_INTR_INPUTS
+
+#endif
include/ppc4xx.h +2 -0
index d593b07..5a6b855 100644
@@ -54,7 +54,9 @@
 
 #include <asm/ppc4xx-sdram.h>
 #include <asm/ppc4xx-ebc.h>
+#if !defined(CONFIG_XILINX_440)
 #include <asm/ppc4xx-uic.h>
+#endif
 
 /*
  * Macro for generating register field mnemonics
Signature · 1 line
1.5.6.2
#24 lore raw

[U-Boot-Users] ppc4xx: [PATCH] CPU PPC440x5 on Virtex5 FX (resubmit)

Review

Quoted 8 lines · Ricardo Ribalda Delgado

-This patchs gives support for the embbedded ppc440 on the Virtex5 FPGAs

(quoted diff) +0 -3
-interrupts.c divided in uic.c and interrupts.c
 
-xilinx_irq.c for xilinx interrupt controller
 
-Include modifications propossed by  Stefan Roese

Applied to next branch of u-boot-ppc4xx after some minor cleanups.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================