2008-09-11 15:25:09 +00:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief GPMC specific NAND devices
|
|
|
|
*
|
2010-07-22 03:00:13 +00:00
|
|
|
* FileName: arch/arm/boards/omap/devices-gpmc-nand.c
|
2008-09-11 15:25:09 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* (C) Copyright 2006-2008
|
|
|
|
* Texas Instruments, <www.ti.com>
|
|
|
|
* Nishanth Menon <x0nishan@ti.com>
|
|
|
|
*
|
|
|
|
* 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>
|
|
|
|
#include <console.h>
|
|
|
|
#include <init.h>
|
|
|
|
#include <driver.h>
|
|
|
|
#include <clock.h>
|
2011-09-22 17:02:57 +00:00
|
|
|
#include <io.h>
|
2008-09-11 15:25:09 +00:00
|
|
|
|
2009-10-22 12:21:25 +00:00
|
|
|
#include <mach/silicon.h>
|
|
|
|
#include <mach/gpmc.h>
|
|
|
|
#include <mach/gpmc_nand.h>
|
2008-09-11 15:25:09 +00:00
|
|
|
|
|
|
|
#define GPMC_CONF1_VALx8 0x00000800
|
|
|
|
#define GPMC_CONF1_VALx16 0x00001800
|
|
|
|
|
|
|
|
/** NAND platform specific settings settings */
|
|
|
|
static struct gpmc_nand_platform_data nand_plat = {
|
2010-07-05 10:32:14 +00:00
|
|
|
.cs = 0,
|
2008-09-11 15:25:09 +00:00
|
|
|
.max_timeout = MSECOND,
|
|
|
|
.wait_mon_pin = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief gpmc_generic_nand_devices_init - init generic nand device
|
|
|
|
*
|
|
|
|
* @return success/fail based on device funtion
|
|
|
|
*/
|
2011-03-30 21:56:58 +00:00
|
|
|
int gpmc_generic_nand_devices_init(int cs, int width,
|
2012-03-15 12:49:26 +00:00
|
|
|
enum gpmc_ecc_mode eccmode, struct gpmc_config *nand_cfg)
|
2008-09-11 15:25:09 +00:00
|
|
|
{
|
2010-07-05 10:32:14 +00:00
|
|
|
nand_plat.cs = cs;
|
|
|
|
|
|
|
|
if (width == 16)
|
2012-03-15 12:49:26 +00:00
|
|
|
nand_cfg->cfg[0] = GPMC_CONF1_VALx16;
|
2010-07-05 10:32:14 +00:00
|
|
|
else
|
2012-03-15 12:49:26 +00:00
|
|
|
nand_cfg->cfg[0] = GPMC_CONF1_VALx8;
|
2010-07-05 10:32:14 +00:00
|
|
|
|
|
|
|
nand_plat.device_width = width;
|
2011-03-30 21:56:58 +00:00
|
|
|
nand_plat.ecc_mode = eccmode;
|
2012-03-15 12:49:26 +00:00
|
|
|
nand_plat.priv = nand_cfg;
|
2010-07-05 10:32:14 +00:00
|
|
|
|
2008-09-11 15:25:09 +00:00
|
|
|
/* Configure GPMC CS before register */
|
2012-03-15 12:49:26 +00:00
|
|
|
gpmc_cs_config(nand_plat.cs, nand_cfg);
|
2011-07-22 22:57:31 +00:00
|
|
|
|
|
|
|
add_generic_device("gpmc_nand", -1, NULL, OMAP_GPMC_BASE, 1024 * 4,
|
|
|
|
IORESOURCE_MEM, &nand_plat);
|
|
|
|
|
|
|
|
return 0;
|
2008-09-11 15:25:09 +00:00
|
|
|
}
|