⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ifx_nand.c

📁 基于mips CPU
💻 C
字号:
/*
 * NAND Flash Driver for INCA-IP development board.
 *
 * Copyright (c) 2003  Wolfgang Denk <wd@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
 *
 * ########################################################################
 *
 *  ifx_nand.c
 *
 *  Description:
 *    device driver of NAND controller of INCA-IP chip
 *  Author:
 *    Winder Sung
 *  Created:
 *    20 NOV 2005
 *  History & Modification Tag:
 *  ___________________________________________________________________________
 *  |  Tag   |                  Comments                   | Modifier & Time  |
 *  |--------+---------------------------------------------+------------------|
 *  |  0.0   | First version of this driver and the tag is |    Winder Sung   |
 *  |        | implied.                                    |    20 NOV 2005   |
 *  ---------------------------------------------------------------------------
 *
 */ 
#include <common.h>
#include "ifx_nand.h"
#include <linux/mtd/nand.h>

/* Initialize hardware to support NAND device */
void incaip_hwinit (void) 
{
	/* Initialize port 1.16 for the NAND enable */
	*INCA_IP_Ports_P1_ALTSEL |= (1 << 16);	/* P1.16 set to GPIO */
	*INCA_IP_Ports_P1_DIR    |= (1 << 16);	/* P1.16 direction output */
	*INCA_IP_Ports_P1_OUT    |= (1 << 16);	/* Chipselect is at high */

	/* Initialize port 1.17 for Ready/Busy pin */
	*INCA_IP_Ports_P1_ALTSEL |= (1 << 17);	/* P1.17 set to GPIO */
	*INCA_IP_Ports_P1_DIR    &= ~(1 << 17);	/* P1.17 direction input*/
	
	/* Initialize register EBU_ADDSEL1 for CS0 */
	*INCA_IP_EBU_EBU_ADDSEL1 &= 0xBE0000F1;

	/* EBU_BUSCON1 */
	*INCA_IP_EBU_EBU_BUSCON1 = 0x4000D7FF;
}

/*
 * ####################################
 *           Global Function
 * ####################################
 */


/*
 * ####################################
 *           Init/Cleanup API
 * ####################################
 */

extern struct nand_chip nand_dev_desc[];

unsigned long nand_init(void)
{
    /*
     *  Configure hardware
     */
    incaip_hwinit();
    return nand_probe(CFG_NAND_BASE);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -