From: DENX Support System Date: Fri, 31 Mar 2006 23:50:34 +0200 Subject: [U-Boot-Users] Re: [DNX#2006033142000838] [PATCH] STXXTC Nand support. Message-ID: <1143841834.630826.520561748@castor.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello list, inside the automatic U-Boot patch tracking system a new ticket [DNX#2006033142000838] was created: > 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<---------------------- > --- a/board/stxxtc/Makefile > +++ b/board/stxxtc/Makefile > @@ -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) > --- /dev/null > +++ b/board/stxxtc/nand.c > @@ -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 > + > +#if (CONFIG_COMMANDS & CFG_CMD_NAND) > + > +#include > + > +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 > + */ > +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; Your U-Boot support team