diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2007-12-10 21:23:45 -0500 |
---|---|---|
committer | Kyungmin Park <kyungmin.park@samsung.com> | 2008-01-29 03:11:38 -0500 |
commit | e71f04fc9234b14636887ceb5862755f1690642c (patch) | |
tree | 9bb52ea8a5115dc6e43b9486c2ac93b7de0c1e4f /drivers | |
parent | b21b72cf33bb212414c1d967850e261b795befa4 (diff) |
[MTD] [OneNAND] Get correct density from device ID
Use the higher bits for other purpose.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index c79bc2ef3f50..cf8009329999 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -170,6 +170,18 @@ static int onenand_buffer_address(int dataram1, int sectors, int count) | |||
170 | } | 170 | } |
171 | 171 | ||
172 | /** | 172 | /** |
173 | * onenand_get_density - [DEFAULT] Get OneNAND density | ||
174 | * @param dev_id OneNAND device ID | ||
175 | * | ||
176 | * Get OneNAND density from device ID | ||
177 | */ | ||
178 | static inline int onenand_get_density(int dev_id) | ||
179 | { | ||
180 | int density = dev_id >> ONENAND_DEVICE_DENSITY_SHIFT; | ||
181 | return (density & ONENAND_DEVICE_DENSITY_MASK); | ||
182 | } | ||
183 | |||
184 | /** | ||
173 | * onenand_command - [DEFAULT] Send command to OneNAND device | 185 | * onenand_command - [DEFAULT] Send command to OneNAND device |
174 | * @param mtd MTD device structure | 186 | * @param mtd MTD device structure |
175 | * @param cmd the command to be sent | 187 | * @param cmd the command to be sent |
@@ -2146,7 +2158,7 @@ static int onenand_otp_walk(struct mtd_info *mtd, loff_t from, size_t len, | |||
2146 | 2158 | ||
2147 | *retlen = 0; | 2159 | *retlen = 0; |
2148 | 2160 | ||
2149 | density = this->device_id >> ONENAND_DEVICE_DENSITY_SHIFT; | 2161 | density = onenand_get_density(this->device_id); |
2150 | if (density < ONENAND_DEVICE_DENSITY_512Mb) | 2162 | if (density < ONENAND_DEVICE_DENSITY_512Mb) |
2151 | otp_pages = 20; | 2163 | otp_pages = 20; |
2152 | else | 2164 | else |
@@ -2337,7 +2349,7 @@ static void onenand_check_features(struct mtd_info *mtd) | |||
2337 | unsigned int density, process; | 2349 | unsigned int density, process; |
2338 | 2350 | ||
2339 | /* Lock scheme depends on density and process */ | 2351 | /* Lock scheme depends on density and process */ |
2340 | density = this->device_id >> ONENAND_DEVICE_DENSITY_SHIFT; | 2352 | density = onenand_get_density(this->device_id); |
2341 | process = this->version_id >> ONENAND_VERSION_PROCESS_SHIFT; | 2353 | process = this->version_id >> ONENAND_VERSION_PROCESS_SHIFT; |
2342 | 2354 | ||
2343 | /* Lock scheme */ | 2355 | /* Lock scheme */ |
@@ -2386,7 +2398,7 @@ static void onenand_print_device_info(int device, int version) | |||
2386 | vcc = device & ONENAND_DEVICE_VCC_MASK; | 2398 | vcc = device & ONENAND_DEVICE_VCC_MASK; |
2387 | demuxed = device & ONENAND_DEVICE_IS_DEMUX; | 2399 | demuxed = device & ONENAND_DEVICE_IS_DEMUX; |
2388 | ddp = device & ONENAND_DEVICE_IS_DDP; | 2400 | ddp = device & ONENAND_DEVICE_IS_DDP; |
2389 | density = device >> ONENAND_DEVICE_DENSITY_SHIFT; | 2401 | density = onenand_get_density(device); |
2390 | printk(KERN_INFO "%sOneNAND%s %dMB %sV 16-bit (0x%02x)\n", | 2402 | printk(KERN_INFO "%sOneNAND%s %dMB %sV 16-bit (0x%02x)\n", |
2391 | demuxed ? "" : "Muxed ", | 2403 | demuxed ? "" : "Muxed ", |
2392 | ddp ? "(DDP)" : "", | 2404 | ddp ? "(DDP)" : "", |
@@ -2478,7 +2490,7 @@ static int onenand_probe(struct mtd_info *mtd) | |||
2478 | this->device_id = dev_id; | 2490 | this->device_id = dev_id; |
2479 | this->version_id = ver_id; | 2491 | this->version_id = ver_id; |
2480 | 2492 | ||
2481 | density = dev_id >> ONENAND_DEVICE_DENSITY_SHIFT; | 2493 | density = onenand_get_density(dev_id); |
2482 | this->chipsize = (16 << density) << 20; | 2494 | this->chipsize = (16 << density) << 20; |
2483 | /* Set density mask. it is used for DDP */ | 2495 | /* Set density mask. it is used for DDP */ |
2484 | if (ONENAND_IS_DDP(this)) | 2496 | if (ONENAND_IS_DDP(this)) |