summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/devices/Makefile1
-rw-r--r--drivers/mtd/devices/tegra_nand.c1
-rw-r--r--drivers/mtd/maps/Makefile1
-rw-r--r--drivers/mtd/maps/tegra_nor.c87
4 files changed, 78 insertions, 12 deletions
diff --git a/drivers/mtd/devices/Makefile b/drivers/mtd/devices/Makefile
index 67345a00a5ab..b9337a4f0c06 100644
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -18,4 +18,5 @@ obj-$(CONFIG_MTD_BLOCK2MTD) += block2mtd.o
obj-$(CONFIG_MTD_DATAFLASH) += mtd_dataflash.o
obj-$(CONFIG_MTD_M25P80) += m25p80.o
obj-$(CONFIG_MTD_SST25L) += sst25l.o
+CFLAGS_tegra_nand.o = -Werror
obj-$(CONFIG_MTD_NAND_TEGRA) += tegra_nand.o
diff --git a/drivers/mtd/devices/tegra_nand.c b/drivers/mtd/devices/tegra_nand.c
index 92cd70f2fd46..6034f0b2f239 100644
--- a/drivers/mtd/devices/tegra_nand.c
+++ b/drivers/mtd/devices/tegra_nand.c
@@ -1654,7 +1654,6 @@ static int __devinit tegra_nand_probe(struct platform_device *pdev)
if (plat->wp_gpio) {
gpio_request(plat->wp_gpio, "nand_wp");
- tegra_gpio_enable(plat->wp_gpio);
gpio_direction_output(plat->wp_gpio, 1);
}
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index bb5eef14a367..dbc68e0e87cb 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -60,4 +60,5 @@ obj-$(CONFIG_MTD_GPIO_ADDR) += gpio-addr-flash.o
obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o
obj-$(CONFIG_MTD_LATCH_ADDR) += latch-addr-flash.o
obj-$(CONFIG_MTD_LANTIQ) += lantiq-flash.o
+CFLAGS_tegra_nor.o = -Werror
obj-$(CONFIG_MTD_NOR_TEGRA) += tegra_nor.o
diff --git a/drivers/mtd/maps/tegra_nor.c b/drivers/mtd/maps/tegra_nor.c
index 505a2591f884..41adb1e40382 100644
--- a/drivers/mtd/maps/tegra_nor.c
+++ b/drivers/mtd/maps/tegra_nor.c
@@ -1,9 +1,5 @@
/*
- * drivers/mtd/maps/tegra_nor.c
- *
- * MTD mapping driver for the internal SNOR controller in Tegra SoCs
- *
- * Copyright (C) 2009 - 2012 NVIDIA Corporation
+ * Copyright (C) 2009-2012, NVIDIA Corporation. All rights reserved.
*
* Author:
* Raghavendra VK <rvk@nvidia.com>
@@ -21,6 +17,11 @@
* 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * drivers/mtd/maps/tegra_nor.c
+ *
+ * MTD mapping driver for the internal SNOR controller in Tegra SoCs
+ *
*/
#include <linux/platform_device.h>
@@ -139,7 +140,7 @@ static inline void snor_tegra_writel(struct tegra_nor_info *tnor,
#define DRV_NAME "tegra-nor"
-static const char * const part_probes[] = { "cmdlinepart", NULL };
+static const char *part_probes[] = { "cmdlinepart", NULL };
static int wait_for_dma_completion(struct tegra_nor_info *info)
{
@@ -160,6 +161,7 @@ static void tegra_flash_dma(struct map_info *map,
u32 copy_to = (u32)to;
struct tegra_nor_info *c =
container_of(map, struct tegra_nor_info, map);
+ struct tegra_nor_chip_parms *chip_parm = &c->plat->chip_parms;
unsigned int bytes_remaining = len;
snor_config = c->init_config;
@@ -174,9 +176,52 @@ static void tegra_flash_dma(struct map_info *map,
* controller register only after all parameters are set.
*/
/* SNOR CONFIGURATION SETUP */
- snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(1);
- /* 8 word page */
- snor_config |= TEGRA_SNOR_CONFIG_PAGE_SZ(2);
+ switch(chip_parm->ReadMode)
+ {
+ case NorReadMode_Async:
+ snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(0);
+ break;
+
+ case NorReadMode_Page:
+ switch(chip_parm->PageLength)
+ {
+ case NorPageLength_Unsupported :
+ snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(0);
+ break;
+
+ case NorPageLength_4Word :
+ snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(1);
+ snor_config |= TEGRA_SNOR_CONFIG_PAGE_SZ(1);
+ break;
+
+ case NorPageLength_8Word :
+ snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(1);
+ snor_config |= TEGRA_SNOR_CONFIG_PAGE_SZ(2);
+ break;
+ }
+ break;
+
+ case NorReadMode_Burst:
+ snor_config |= TEGRA_SNOR_CONFIG_DEVICE_MODE(2);
+ switch(chip_parm->BurstLength)
+ {
+ case NorBurstLength_CntBurst :
+ snor_config |= TEGRA_SNOR_CONFIG_BURST_LEN(0);
+ break;
+ case NorBurstLength_8Word :
+ snor_config |= TEGRA_SNOR_CONFIG_BURST_LEN(1);
+ break;
+
+ case NorBurstLength_16Word :
+ snor_config |= TEGRA_SNOR_CONFIG_BURST_LEN(2);
+ break;
+
+ case NorBurstLength_32Word :
+ snor_config |= TEGRA_SNOR_CONFIG_BURST_LEN(3);
+ break;
+ }
+ break;
+ }
snor_config |= TEGRA_SNOR_CONFIG_MST_ENB;
/* SNOR DMA CONFIGURATION SETUP */
/* NOR -> AHB */
@@ -273,8 +318,28 @@ static int tegra_snor_controller_init(struct tegra_nor_info *info)
default:
return -EINVAL;
}
- config |= TEGRA_SNOR_CONFIG_BURST_LEN(0);
- config &= ~TEGRA_SNOR_CONFIG_MUX_MODE;
+ switch (chip_parm->MuxMode)
+ {
+ case NorMuxMode_ADNonMux:
+ config &= ~TEGRA_SNOR_CONFIG_MUX_MODE;
+ break;
+ case NorMuxMode_ADMux:
+ config |= TEGRA_SNOR_CONFIG_MUX_MODE;
+ break;
+ default:
+ return -EINVAL;
+ }
+ switch (chip_parm->ReadyActive)
+ {
+ case NorReadyActive_WithData:
+ config &= ~TEGRA_SNOR_CONFIG_RDY_ACTIVE;
+ break;
+ case NorReadyActive_BeforeData:
+ config |= TEGRA_SNOR_CONFIG_RDY_ACTIVE;
+ break;
+ default:
+ return -EINVAL;
+ }
snor_tegra_writel(info, config, TEGRA_SNOR_CONFIG_REG);
info->init_config = config;