diff options
author | Bob Johnston <bjohnston@nvidia.com> | 2012-08-16 10:52:14 -0400 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-08-28 18:11:35 -0700 |
commit | e3d92859c4351847a98e48746fb19d12fac16c6d (patch) | |
tree | 695595408d56b52c34f46d11270f38be19bb624f /drivers/mtd | |
parent | 1fecf8089ef4bc65e92f341684b3c541eecd5eab (diff) |
E1853 BRINGUP Linux Snor: Micron Support
Expanding NOR functionality to work with ADMUX and Burst mode for Micron
Support in E1853.
Bug 989919
Bug 966833
- Adding fields for picking MUX vs NONMUX and picking Async, Paging,
Burst mode for reads
- Added run time decision between them
- 1853 specific settings for Async NOR
- 1852 specific settings for NOR
- 1853 NOR timings changed
Reviewed-on: http://git-master/r/122286
(cherry picked from commit a242e7194c7de559d22fe5b275a8782086f10e50)
Change-Id: I79de1d52d4c7199c83b380c2fa6d8cae6b35f09d
Signed-off-by: Bob Johnston <BJohnston@nvidia.com>
Reviewed-on: http://git-master/r/124946
Tested-by: Bob Johnston <bjohnston@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/tegra_nor.c | 85 |
1 files changed, 75 insertions, 10 deletions
diff --git a/drivers/mtd/maps/tegra_nor.c b/drivers/mtd/maps/tegra_nor.c index 5e66daf6fb6a..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> @@ -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; |