mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-06 13:14:27 +00:00
83d290c56f
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
56 lines
1.5 KiB
C
56 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* (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>
|
|
*/
|
|
|
|
#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;
|
|
}
|