aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/omap-onenand.c
diff options
context:
space:
mode:
authorKyungmin Park <kyungmin.park@samsung.com>2005-09-03 02:07:19 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-11-06 15:19:37 -0500
commit52b0eea73de05df33c51ca652e288a3ba1bba03b (patch)
tree6ddb928b70458a0137481e434cea416e41ca4bb8 /drivers/mtd/onenand/omap-onenand.c
parentcd5f6346bc28a41375412b49b290d22ee4e4bbe8 (diff)
[PATCH] OneNAND: Sync. Burst Read support
Add OneNAND Sync. Burst Read support Tested with OMAP platform Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'drivers/mtd/onenand/omap-onenand.c')
-rw-r--r--drivers/mtd/onenand/omap-onenand.c66
1 files changed, 64 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/omap-onenand.c b/drivers/mtd/onenand/omap-onenand.c
index 56e1aec6b835..7c89549f7f58 100644
--- a/drivers/mtd/onenand/omap-onenand.c
+++ b/drivers/mtd/onenand/omap-onenand.c
@@ -25,9 +25,10 @@
25#include <asm/arch/hardware.h> 25#include <asm/arch/hardware.h>
26#include <asm/arch/tc.h> 26#include <asm/arch/tc.h>
27#include <asm/sizes.h> 27#include <asm/sizes.h>
28#include <asm/mach-types.h>
28 29
29#define OMAP_ONENAND_FLASH_START1 OMAP_CS2A_PHYS 30#define OMAP_ONENAND_FLASH_START1 OMAP_CS2A_PHYS
30#define OMAP_ONENAND_FLASH_START2 OMAP_CS0_PHYS 31#define OMAP_ONENAND_FLASH_START2 omap_cs3_phys()
31/* 32/*
32 * MTD structure for OMAP board 33 * MTD structure for OMAP board
33 */ 34 */
@@ -68,10 +69,66 @@ static struct mtd_partition static_partition[] = {
68 }, 69 },
69}; 70};
70 71
71const char *part_probes[] = { "cmdlinepart", NULL, }; 72static const char *part_probes[] = { "cmdlinepart", NULL, };
72 73
73#endif 74#endif
74 75
76#ifdef CONFIG_MTD_ONENAND_SYNC_READ
77static unsigned int omap_emifs_cs;
78
79static void omap_find_emifs_cs(unsigned int addr)
80{
81 /* Check CS3 */
82 if (OMAP_EMIFS_CONFIG_REG & OMAP_EMIFS_CONFIG_BM && addr == 0x0) {
83 omap_emifs_cs = 3;
84 } else {
85 omap_emifs_cs = (addr >> 26);
86 }
87}
88
89/**
90 * omap_onenand_mmcontrol - Control OMAP EMIFS
91 */
92static void omap_onenand_mmcontrol(struct mtd_info *mtd, int sync_read)
93{
94 struct onenand_chip *this = mtd->priv;
95 static unsigned long omap_emifs_ccs, omap_emifs_acs;
96 static unsigned long onenand_sys_cfg1;
97 int config, emifs_ccs, emifs_acs;
98
99 if (sync_read) {
100 /*
101 * Note: BRL and RDWST is equal
102 */
103 omap_emifs_ccs = EMIFS_CCS(omap_emifs_cs);
104 omap_emifs_acs = EMIFS_ACS(omap_emifs_cs);
105
106 emifs_ccs = 0x41141;
107 emifs_acs = 0x1;
108
109 /* OneNAND System Configuration 1 */
110 onenand_sys_cfg1 = this->read_word(this->base + ONENAND_REG_SYS_CFG1);
111 config = (onenand_sys_cfg1
112 & ~(0x3f << ONENAND_SYS_CFG1_BL_SHIFT))
113 | ONENAND_SYS_CFG1_SYNC_READ
114 | ONENAND_SYS_CFG1_BRL_4
115 | ONENAND_SYS_CFG1_BL_8;
116 } else {
117 emifs_ccs = omap_emifs_ccs;
118 emifs_acs = omap_emifs_acs;
119 config = onenand_sys_cfg1;
120 }
121
122 this->write_word(config, this->base + ONENAND_REG_SYS_CFG1);
123 EMIFS_CCS(omap_emifs_cs) = emifs_ccs;
124 EMIFS_ACS(omap_emifs_cs) = emifs_acs;
125}
126#else
127#define omap_find_emifs_cs(x) do { } while (0)
128#define omap_onenand_mmcontrol NULL
129#endif
130
131
75/* Scan to find existance of the device at base. 132/* Scan to find existance of the device at base.
76 This also allocates oob and data internal buffers */ 133 This also allocates oob and data internal buffers */
77static char onenand_name[] = "onenand"; 134static char onenand_name[] = "onenand";
@@ -102,14 +159,19 @@ static int __init omap_onenand_init (void)
102 159
103 /* Link the private data with the MTD structure */ 160 /* Link the private data with the MTD structure */
104 omap_onenand_mtd->priv = this; 161 omap_onenand_mtd->priv = this;
162 this->mmcontrol = omap_onenand_mmcontrol;
105 163
106 /* try the first address */ 164 /* try the first address */
107 this->base = ioremap(OMAP_ONENAND_FLASH_START1, SZ_128K); 165 this->base = ioremap(OMAP_ONENAND_FLASH_START1, SZ_128K);
166 omap_find_emifs_cs(OMAP_ONENAND_FLASH_START1);
167
108 omap_onenand_mtd->name = onenand_name; 168 omap_onenand_mtd->name = onenand_name;
109 if (onenand_scan(omap_onenand_mtd, 1)){ 169 if (onenand_scan(omap_onenand_mtd, 1)){
110 /* try the second address */ 170 /* try the second address */
111 iounmap(this->base); 171 iounmap(this->base);
112 this->base = ioremap(OMAP_ONENAND_FLASH_START2, SZ_128K); 172 this->base = ioremap(OMAP_ONENAND_FLASH_START2, SZ_128K);
173 omap_find_emifs_cs(OMAP_ONENAND_FLASH_START2);
174
113 if (onenand_scan(omap_onenand_mtd, 1)) { 175 if (onenand_scan(omap_onenand_mtd, 1)) {
114 iounmap(this->base); 176 iounmap(this->base);
115 err = -ENXIO; 177 err = -ENXIO;