Skip to contentSkip to conversation

powerpc/p1021: Add P1021MDS board support

PATCH New Haiying Wang 2 participants 4 messages Aug 16, 2010 – Aug 17, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 4/7 powerpc/p1021: Add P1021MDS board support

This patch supports P1021MDS NAND boot with the following features:
* Boot from NAND flash with SRAM BOOT support.(No NOR flash on this board)
* SPD DDR Initialization

---
 MAKEALL                                       |    1 +
 Makefile                                      |    4 +
 board/freescale/p1021mds/Makefile             |   38 ++
 board/freescale/p1021mds/bcsr.c               |   22 +
 board/freescale/p1021mds/bcsr.h               |   18 +
 board/freescale/p1021mds/config.mk            |   24 ++
 board/freescale/p1021mds/ddr.c                |  148 +++++++
 board/freescale/p1021mds/law.c                |   24 ++
 board/freescale/p1021mds/p1021mds.c           |  122 ++++++
 board/freescale/p1021mds/pci.c                |   91 +++++
 board/freescale/p1021mds/tlb.c                |   72 ++++
 include/configs/P1021MDS.h                    |  536 +++++++++++++++++++++++++
 nand_spl/board/freescale/p1021mds/Makefile    |  117 ++++++
 nand_spl/board/freescale/p1021mds/nand_boot.c |   59 +++
 14 files changed, 1276 insertions(+), 0 deletions(-)
 create mode 100644 board/freescale/p1021mds/Makefile
 create mode 100644 board/freescale/p1021mds/bcsr.c
 create mode 100644 board/freescale/p1021mds/bcsr.h
 create mode 100644 board/freescale/p1021mds/config.mk
 create mode 100644 board/freescale/p1021mds/ddr.c
 create mode 100644 board/freescale/p1021mds/law.c
 create mode 100644 board/freescale/p1021mds/p1021mds.c
 create mode 100644 board/freescale/p1021mds/pci.c
 create mode 100644 board/freescale/p1021mds/tlb.c
 create mode 100644 include/configs/P1021MDS.h
 create mode 100644 nand_spl/board/freescale/p1021mds/Makefile
 create mode 100644 nand_spl/board/freescale/p1021mds/nand_boot.c
MAKEALL +1 -0
index b34ae33..f14c955 100755
@@ -428,6 +428,7 @@ LIST_85xx="		\
 	P2020RDB_NAND	\
 	P2020RDB_SDCARD	\
 	P2020RDB_SPIFLASH	\
+	P1021MDS_NAND	\
 	P4080DS		\
 	PM854		\
 	PM856		\
Makefile +4 -0
index b1d92b7..7bfa733 100644
@@ -1809,6 +1809,10 @@ P2020RDB_SDCARD_config \
 P2020RDB_SPIFLASH_config:	unconfig
 	@$(MKCONFIG) -n $@ -t $@ P1_P2_RDB powerpc mpc85xx p1_p2_rdb freescale
 
+P1021MDS_config \
+P1021MDS_NAND_config:		unconfig
+	@$(MKCONFIG) -n $@ -t $@ P1021MDS powerpc mpc85xx p1021mds freescale
+
 sbc8540_config \
 sbc8540_33_config \
 sbc8540_66_config:	unconfig
board/freescale/p1021mds/Makefile new file +38 -0
new file mode 100644
index 0000000..bb744f0
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2010 Freescale Semiconductor, Inc.
+# 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.
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+
+COBJS-y	+= $(BOARD).o
+COBJS-y	+= bcsr.o
+COBJS-y	+= law.o
+COBJS-y	+= tlb.o
+COBJS-y	+= pci.o
+
+SRCS	:= $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y))
+SOBJS	:= $(addprefix $(obj),$(SOBJS-y))
+
+$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+	rm -f $(OBJS) $(SOBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/freescale/p1021mds/bcsr.c new file +22 -0
new file mode 100644
index 0000000..6daf690
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *
+ */
+
+#include <common.h>
+#include <asm/io.h>
+
+#include "bcsr.h"
+
+#define BCSR11_ENET_MICRST      0x20
+
+void reset_p1021mds_micrel_phy(void)
+{
+	clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);
+	setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);
+}
board/freescale/p1021mds/bcsr.h new file +18 -0
new file mode 100644
index 0000000..f3e47d4
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __BCSR_H_
+#define __BCSR_H_
+
+#include <common.h>
+
+/*BCSR Utils functions*/
+void reset_p1021mds_micrel_phy(void);
+#endif  /* __BCSR_H_ */
board/freescale/p1021mds/config.mk new file +24 -0
new file mode 100644
index 0000000..b2019d3
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2010 Freescale Semiconductor, Inc.
+#
+# 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.
+#
+# p1021mds board
+#
+
+ifdef SRAM_BOOT
+TEXT_BASE := 0xf8f81000
+PAD_TO := 0xf8f8c000
+endif
+
+ifndef NAND_SPL
+ifeq ($(CONFIG_MK_NAND), y)
+ifndef SRAM_BOOT
+TEXT_BASE = $(CONFIG_RAMBOOT_TEXT_BASE)
+LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+endif
+endif
+endif
board/freescale/p1021mds/ddr.c new file +148 -0

148 lines not on this page · raw message

board/freescale/p1021mds/law.c new file +24 -0
new file mode 100644
index 0000000..bb9d92e
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *
+ */
+
+#include <common.h>
+#include <asm/fsl_law.h>
+#include <asm/mmu.h>
+
+struct law_entry law_table[] = {
+	SET_LAW(CONFIG_SYS_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_LBC),
+	SET_LAW(CONFIG_SYS_BCSR_BASE_PHYS, LAW_SIZE_256K, LAW_TRGT_IF_LBC),
+};
+
+int num_law_entries = ARRAY_SIZE(law_table);
board/freescale/p1021mds/p1021mds.c new file +122 -0

122 lines not on this page · raw message

board/freescale/p1021mds/pci.c new file +91 -0

91 lines not on this page · raw message

board/freescale/p1021mds/tlb.c new file +72 -0

72 lines not on this page · raw message

include/configs/P1021MDS.h new file +536 -0

536 lines not on this page · raw message

nand_spl/board/freescale/p1021mds/Makefile new file +117 -0

117 lines not on this page · raw message

nand_spl/board/freescale/p1021mds/nand_boot.c new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
1.7.0
#1 lore raw

PATCH 4/7 powerpc/p1021: Add P1021MDS board support

Dear Haiying Wang,

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

This patch supports P1021MDS NAND boot with the following features:
* Boot from NAND flash with SRAM BOOT support.(No NOR flash on this board)
* SPD DDR Initialization

Quoted 16 lines
---
 MAKEALL                                       |    1 +
 Makefile                                      |    4 +
 board/freescale/p1021mds/Makefile             |   38 ++
 board/freescale/p1021mds/bcsr.c               |   22 +
 board/freescale/p1021mds/bcsr.h               |   18 +
 board/freescale/p1021mds/config.mk            |   24 ++
 board/freescale/p1021mds/ddr.c                |  148 +++++++
 board/freescale/p1021mds/law.c                |   24 ++
 board/freescale/p1021mds/p1021mds.c           |  122 ++++++
 board/freescale/p1021mds/pci.c                |   91 +++++
 board/freescale/p1021mds/tlb.c                |   72 ++++
 include/configs/P1021MDS.h                    |  536 +++++++++++++++++++++++++
 nand_spl/board/freescale/p1021mds/Makefile    |  117 ++++++
 nand_spl/board/freescale/p1021mds/nand_boot.c |   59 +++
 14 files changed, 1276 insertions(+), 0 deletions(-)

Entry to MAINTAINERS missing.

Additions of boards to Makefile are not allowed any more, please configure in boards.cfg instead.

board/freescale/p1021mds/bcsr.c line 21

Quoted 4 lines
board/freescale/p1021mds/bcsr.c new file +4 -0
+void reset_p1021mds_micrel_phy(void)
+{
+	clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);
+	setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);

Are you sure the reset pulse is long enough?

Quoted 14 lines
board/freescale/p1021mds/bcsr.h new file +8 -0
new file mode 100644
index 0000000..f3e47d4
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *

board/freescale/p1021mds/bcsr.h line 18

Quoted 10 lines
board/freescale/p1021mds/bcsr.h new file +10 -0
+ */
+
+#ifndef __BCSR_H_
+#define __BCSR_H_
+
+#include <common.h>
+
+/*BCSR Utils functions*/
+void reset_p1021mds_micrel_phy(void);
+#endif  /* __BCSR_H_ */

Please avoid adding a new header file just for this single prototype.

Why do you need a separate one anyway? Why cannot you implement this in reset_phy() ?

Quoted 5 lines
nand_spl/board/freescale/p1021mds/Makefile new file +0 -0
new file mode 100644
index 0000000..2e88d72

...

Quoted 1 line

+ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin

Line too long. Please check and fix globally.

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 is more rational to sacrifice one life than six.
	-- Spock, "The Galileo Seven", stardate 2822.3
#2 lore raw

PATCH 4/7 powerpc/p1021: Add P1021MDS board support

Quoted 15 lines · Wolfgang Denk
Quoted 15 lines
board/freescale/p1021mds/bcsr.h new file +12 -0
@@ -0,0 +1,18 @@
+/*
+ * Copyright (C) 2010 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __BCSR_H_
+#define __BCSR_H_
Quoted 8 lines

board/freescale/p1021mds/bcsr.h line 18

Quoted 6 lines
board/freescale/p1021mds/bcsr.h new file +6 -0
+
+#include <common.h>
+
+/*BCSR Utils functions*/
+void reset_p1021mds_micrel_phy(void);
+#endif  /* __BCSR_H_ */

Please avoid adding a new header file just for this single prototype.

This was copied from mpc8568mds/mpc8569mds. If it is not allowed anymore, I can remove it.

Quoted 1 line

Why do you need a separate one anyway?

Because it is p1021mds board specific reset routine.

Quoted 3 lines

Why cannot you implement this
in reset_phy() ?

reset_phy() is a one time reset and called after eth_initialize(). But the board designer told me to reset phy for each UEC port before initializing it, otherwise the phy can not work properly.

Haiying

#3 lore raw

PATCH 4/7 powerpc/p1021: Add P1021MDS board support

Dear Haiying Wang,

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

Please avoid adding a new header file just for this single prototype.

This was copied from mpc8568mds/mpc8569mds. If it is not allowed anymore, I can remove it.

Please do.

Ideally provide a cleanup patch for mpc8569mds as well.

Quoted 2 lines
Quoted 1 line

Why do you need a separate one anyway?

Because it is p1021mds board specific reset routine.

Yes, what is the problem> We have support for board specific code here, don't we?

Quoted 5 lines
Quoted 2 lines

Why cannot you implement this
in reset_phy() ?

reset_phy() is a one time reset and called after eth_initialize(). But the board designer told me to reset phy for each UEC port before initializing it, otherwise the phy can not work properly.

Inded this needs to be reworked. Please wait a few days, there might be a patch coming.

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
"We shall reach greater and greater platitudes of achievement."
- Richard J. Daley