Skip to contentSkip to conversation

STXXTC Nand support.

PATCH DENX Support System 1 participant 1 message Mar 31, 2006

lore
Share & tools
lore
#0 lore raw

Hello list,

inside the automatic U-Boot patch tracking system a new ticket [DNX#2006033142000838] was created:

<snip>

Quoted 90 lines

Hi Wolfgang.

The following patch supports the NAND present
on the Silicon Turnkey's XTc board.

The patch is against the testing-NAND branch
of u-boot.

----------8< CHANGELOG 8<------------------

* Support NAND on STXXTC

----------8< patch 8<----------------------

board/stxxtc/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= lib$(BOARD).a
 
-OBJS	= $(BOARD).o oftree.o
+OBJS	= $(BOARD).o oftree.o nand.o
 
 $(LIB):	.depend $(OBJS)
 	$(AR) crv $@ $(OBJS)
board/stxxtc/nand.c new file +63 -0
@@ -0,0 +1,78 @@
+/*
+ * (C) Copyright 2000-2004
+ * Pantelis Antoniou, pantelis.antoniou at gmail.com
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ * (C) Copyright 2005
+ * Dan Malek, Embedded Edge, LLC, dan at embeddededge.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>
+
+#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+
+#include <nand.h>
+
+static void stxxtc_nand_hwcontrol(struct mtd_info *mtd, int cmd)
+{
+	struct nand_chip *this = mtd->priv;
+	ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
+	volatile immap_t *imap = (volatile immap_t *)CFG_IMMR;
+
+	switch (cmd) {
+		case NAND_CTL_SETNCE:
+			imap->im_ioport.iop_padat &= ~(1 << (15 - 7));
+			break;
+		case NAND_CTL_CLRNCE:
+			imap->im_ioport.iop_padat |=  (1 << (15 - 7));
+			break;
+		case NAND_CTL_SETALE:
+			imap->im_ioport.iop_pcdat |=  (1 << (15 - 15));
+			break;
+		case NAND_CTL_CLRALE:
+			imap->im_ioport.iop_pcdat &= ~(1 << (15 - 15));
+			break;
+		case NAND_CTL_SETCLE:
+			imap->im_cpm.cp_pbdat |=  (1 << (31 - 23));
+			break;
+		case NAND_CTL_CLRCLE:
+			imap->im_cpm.cp_pbdat &= ~(1 << (31 - 23));
+			break;
+	}
+}
+
+/*
+ *	chip R/B detection
+ */

board/stxxtc/nand.c line 73

Quoted 10 lines
board/stxxtc/nand.c new file +10 -0
+static int stxxtc_nand_ready(struct mtd_info *mtd)
+{
+	volatile immap_t *imap = (volatile immap_t *)CFG_IMMR;
+	return !!(imap->im_ioport.iop_padat & (1 << (15 - 6)));
+}
+
+void board_nand_init(struct nand_chip *nand)
+{
+	nand->options = NAND_SAMSUNG_LP_OPTIONS;
+	nand->eccmode = NAND_ECC_SOFT;

</snip>

Your U-Boot support team