Skip to content

Commit 959e9f2

Browse files
masahir0yBoris Brezillon
authored andcommitted
mtd: nand: denali: remove unneeded find_valid_banks()
The function find_valid_banks() issues the Read ID (0x90) command, then compares the first byte (Manufacturer ID) of each bank with the one of bank0. This is equivalent to what nand_scan_ident() does. The number of chips is detected there, so this is unneeded. What is worse for find_valid_banks() is that, if multiple chips are connected to INTEL_CE4100 platform, it crashes the kernel by BUG(). This is what we should avoid. This function is just harmful and unneeded. Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Boris Brezillon <[email protected]>
1 parent b21ff82 commit 959e9f2

File tree

2 files changed

+0
-48
lines changed

2 files changed

+0
-48
lines changed

drivers/mtd/nand/denali.c

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -337,51 +337,6 @@ static void get_samsung_nand_para(struct denali_nand_info *denali,
337337
}
338338
}
339339

340-
/*
341-
* determines how many NAND chips are connected to the controller. Note for
342-
* Intel CE4100 devices we don't support more than one device.
343-
*/
344-
static void find_valid_banks(struct denali_nand_info *denali)
345-
{
346-
uint32_t id[denali->max_banks];
347-
int i;
348-
349-
denali->total_used_banks = 1;
350-
for (i = 0; i < denali->max_banks; i++) {
351-
index_addr(denali, MODE_11 | (i << 24) | 0, 0x90);
352-
index_addr(denali, MODE_11 | (i << 24) | 1, 0);
353-
index_addr_read_data(denali, MODE_11 | (i << 24) | 2, &id[i]);
354-
355-
dev_dbg(denali->dev,
356-
"Return 1st ID for bank[%d]: %x\n", i, id[i]);
357-
358-
if (i == 0) {
359-
if (!(id[i] & 0x0ff))
360-
break; /* WTF? */
361-
} else {
362-
if ((id[i] & 0x0ff) == (id[0] & 0x0ff))
363-
denali->total_used_banks++;
364-
else
365-
break;
366-
}
367-
}
368-
369-
if (denali->platform == INTEL_CE4100) {
370-
/*
371-
* Platform limitations of the CE4100 device limit
372-
* users to a single chip solution for NAND.
373-
* Multichip support is not enabled.
374-
*/
375-
if (denali->total_used_banks != 1) {
376-
dev_err(denali->dev,
377-
"Sorry, Intel CE4100 only supports a single NAND device.\n");
378-
BUG();
379-
}
380-
}
381-
dev_dbg(denali->dev,
382-
"denali->total_used_banks: %d\n", denali->total_used_banks);
383-
}
384-
385340
/*
386341
* Use the configuration feature register to determine the maximum number of
387342
* banks that the hardware supports.
@@ -439,8 +394,6 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali)
439394
ioread32(denali->flash_reg + RDWR_EN_HI_CNT),
440395
ioread32(denali->flash_reg + CS_SETUP_CNT));
441396

442-
find_valid_banks(denali);
443-
444397
/*
445398
* If the user specified to override the default timings
446399
* with a specific ONFI mode, we apply those changes here.

drivers/mtd/nand/denali.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ struct denali_nand_info {
326326
int platform;
327327
struct nand_buf buf;
328328
struct device *dev;
329-
int total_used_banks;
330329
int page;
331330
void __iomem *flash_reg; /* Register Interface */
332331
void __iomem *flash_mem; /* Host Data/Command Interface */

0 commit comments

Comments
 (0)