mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-04 18:41:03 +00:00
6ae3900a86
This header was renamed to rawnand.h in Linux. The following is the corresponding commit in Linux. commit d4092d76a4a4e57b65910899948a83cc8646c5a5 Author: Boris Brezillon <boris.brezillon@free-electrons.com> Date: Fri Aug 4 17:29:10 2017 +0200 mtd: nand: Rename nand.h into rawnand.h We are planning to share more code between different NAND based devices (SPI NAND, OneNAND and raw NANDs), but before doing that we need to move the existing include/linux/mtd/nand.h file into include/linux/mtd/rawnand.h so we can later create a nand.h header containing all common structure and function prototypes. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
57 lines
1.5 KiB
C
57 lines
1.5 KiB
C
/*
|
|
* (C) Copyright 2011
|
|
* Texas Instruments, <www.ti.com>
|
|
*
|
|
* Author :
|
|
* Tom Rini <trini@ti.com>
|
|
*
|
|
* Initial Code from:
|
|
* Richard Woodruff <r-woodruff2@ti.com>
|
|
* Jian Zhang <jzhang@ti.com>
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <jffs2/load_kernel.h>
|
|
#include <linux/mtd/rawnand.h>
|
|
#include <linux/mtd/omap_gpmc.h>
|
|
#include <asm/io.h>
|
|
#include <asm/arch/sys_proto.h>
|
|
#include <asm/arch/mem.h>
|
|
|
|
/*
|
|
* Many boards will want to know the results of the NAND_CMD_READID command
|
|
* in order to decide what to do about DDR initialization. This function
|
|
* allows us to do that very early and to pass those results back to the
|
|
* board so it can make whatever decisions need to be made.
|
|
*/
|
|
int identify_nand_chip(int *mfr, int *id)
|
|
{
|
|
int loops = 1000;
|
|
|
|
/* Make sure that we have setup GPMC for NAND correctly. */
|
|
set_gpmc_cs0(MTD_DEV_TYPE_NAND);
|
|
|
|
sdelay(2000);
|
|
|
|
/* Issue a RESET and then READID */
|
|
writeb(NAND_CMD_RESET, &gpmc_cfg->cs[0].nand_cmd);
|
|
writeb(NAND_CMD_STATUS, &gpmc_cfg->cs[0].nand_cmd);
|
|
while ((readl(&gpmc_cfg->cs[0].nand_dat) & NAND_STATUS_READY)
|
|
!= NAND_STATUS_READY) {
|
|
sdelay(100);
|
|
if (--loops == 0)
|
|
return 1;
|
|
}
|
|
writeb(NAND_CMD_READID, &gpmc_cfg->cs[0].nand_cmd);
|
|
|
|
/* Set the address to read to 0x0 */
|
|
writeb(0x0, &gpmc_cfg->cs[0].nand_adr);
|
|
|
|
/* Read off the manufacturer and device id. */
|
|
*mfr = readb(&gpmc_cfg->cs[0].nand_dat);
|
|
*id = readb(&gpmc_cfg->cs[0].nand_dat);
|
|
|
|
return 0;
|
|
}
|