forked from Minki/linux
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 <yamada.masahiro@socionext.com> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
This commit is contained in:
parent
b21ff825d6
commit
959e9f2ae9
@ -337,51 +337,6 @@ static void get_samsung_nand_para(struct denali_nand_info *denali,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* determines how many NAND chips are connected to the controller. Note for
|
||||
* Intel CE4100 devices we don't support more than one device.
|
||||
*/
|
||||
static void find_valid_banks(struct denali_nand_info *denali)
|
||||
{
|
||||
uint32_t id[denali->max_banks];
|
||||
int i;
|
||||
|
||||
denali->total_used_banks = 1;
|
||||
for (i = 0; i < denali->max_banks; i++) {
|
||||
index_addr(denali, MODE_11 | (i << 24) | 0, 0x90);
|
||||
index_addr(denali, MODE_11 | (i << 24) | 1, 0);
|
||||
index_addr_read_data(denali, MODE_11 | (i << 24) | 2, &id[i]);
|
||||
|
||||
dev_dbg(denali->dev,
|
||||
"Return 1st ID for bank[%d]: %x\n", i, id[i]);
|
||||
|
||||
if (i == 0) {
|
||||
if (!(id[i] & 0x0ff))
|
||||
break; /* WTF? */
|
||||
} else {
|
||||
if ((id[i] & 0x0ff) == (id[0] & 0x0ff))
|
||||
denali->total_used_banks++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (denali->platform == INTEL_CE4100) {
|
||||
/*
|
||||
* Platform limitations of the CE4100 device limit
|
||||
* users to a single chip solution for NAND.
|
||||
* Multichip support is not enabled.
|
||||
*/
|
||||
if (denali->total_used_banks != 1) {
|
||||
dev_err(denali->dev,
|
||||
"Sorry, Intel CE4100 only supports a single NAND device.\n");
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
dev_dbg(denali->dev,
|
||||
"denali->total_used_banks: %d\n", denali->total_used_banks);
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the configuration feature register to determine the maximum number of
|
||||
* banks that the hardware supports.
|
||||
@ -439,8 +394,6 @@ static uint16_t denali_nand_timing_set(struct denali_nand_info *denali)
|
||||
ioread32(denali->flash_reg + RDWR_EN_HI_CNT),
|
||||
ioread32(denali->flash_reg + CS_SETUP_CNT));
|
||||
|
||||
find_valid_banks(denali);
|
||||
|
||||
/*
|
||||
* If the user specified to override the default timings
|
||||
* with a specific ONFI mode, we apply those changes here.
|
||||
|
@ -326,7 +326,6 @@ struct denali_nand_info {
|
||||
int platform;
|
||||
struct nand_buf buf;
|
||||
struct device *dev;
|
||||
int total_used_banks;
|
||||
int page;
|
||||
void __iomem *flash_reg; /* Register Interface */
|
||||
void __iomem *flash_mem; /* Host Data/Command Interface */
|
||||
|
Loading…
Reference in New Issue
Block a user