Skip to content

Commit 38caf7f

Browse files
Lei WenDavid Woodhouse
authored andcommitted
mtd: pxa3xx_nand: discard wait_for_event,write_cmd,__readid function
Since we have rework the irq process, we don't need additional delay in wait_for_event. Also write_cmd and __readid is also discarded for the same reason. Signed-off-by: Lei Wen <[email protected]> Signed-off-by: Haojian Zhuang <[email protected]> Acked-by: Eric Miao <[email protected]> Signed-off-by: David Woodhouse <[email protected]>
1 parent f8155a4 commit 38caf7f

File tree

1 file changed

+1
-76
lines changed

1 file changed

+1
-76
lines changed

drivers/mtd/nand/pxa3xx_nand.c

Lines changed: 1 addition & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -258,25 +258,6 @@ static void pxa3xx_nand_set_timing(struct pxa3xx_nand_info *info,
258258
nand_writel(info, NDTR1CS0, ndtr1);
259259
}
260260

261-
#define WAIT_EVENT_TIMEOUT 10
262-
263-
static int wait_for_event(struct pxa3xx_nand_info *info, uint32_t event)
264-
{
265-
int timeout = WAIT_EVENT_TIMEOUT;
266-
uint32_t ndsr;
267-
268-
while (timeout--) {
269-
ndsr = nand_readl(info, NDSR) & NDSR_MASK;
270-
if (ndsr & event) {
271-
nand_writel(info, NDSR, ndsr);
272-
return 0;
273-
}
274-
udelay(10);
275-
}
276-
277-
return -ETIMEDOUT;
278-
}
279-
280261
static void pxa3xx_set_datasize(struct pxa3xx_nand_info *info)
281262
{
282263
int oob_enable = info->reg_ndcr & NDCR_SPARE_EN;
@@ -414,35 +395,6 @@ static void disable_int(struct pxa3xx_nand_info *info, uint32_t int_mask)
414395
nand_writel(info, NDCR, ndcr | int_mask);
415396
}
416397

417-
/* NOTE: it is a must to set ND_RUN firstly, then write command buffer
418-
* otherwise, it does not work
419-
*/
420-
static int write_cmd(struct pxa3xx_nand_info *info)
421-
{
422-
uint32_t ndcr;
423-
424-
/* clear status bits and run */
425-
nand_writel(info, NDSR, NDSR_MASK);
426-
427-
ndcr = info->reg_ndcr;
428-
429-
ndcr |= info->use_ecc ? NDCR_ECC_EN : 0;
430-
ndcr |= info->use_dma ? NDCR_DMA_EN : 0;
431-
ndcr |= NDCR_ND_RUN;
432-
433-
nand_writel(info, NDCR, ndcr);
434-
435-
if (wait_for_event(info, NDSR_WRCMDREQ)) {
436-
printk(KERN_ERR "timed out writing command\n");
437-
return -ETIMEDOUT;
438-
}
439-
440-
nand_writel(info, NDCB0, info->ndcb0);
441-
nand_writel(info, NDCB0, info->ndcb1);
442-
nand_writel(info, NDCB0, info->ndcb2);
443-
return 0;
444-
}
445-
446398
static void handle_data_pio(struct pxa3xx_nand_info *info)
447399
{
448400
switch (info->state) {
@@ -778,33 +730,6 @@ static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
778730
return 0;
779731
}
780732

781-
static int __readid(struct pxa3xx_nand_info *info, uint32_t *id)
782-
{
783-
const struct pxa3xx_nand_cmdset *cmdset = info->cmdset;
784-
uint32_t ndcr;
785-
uint8_t id_buff[8];
786-
787-
prepare_other_cmd(info, cmdset->read_id);
788-
789-
/* Send command */
790-
if (write_cmd(info))
791-
goto fail_timeout;
792-
793-
/* Wait for CMDDM(command done successfully) */
794-
if (wait_for_event(info, NDSR_RDDREQ))
795-
goto fail_timeout;
796-
797-
__raw_readsl(info->mmio_base + NDDB, id_buff, 2);
798-
*id = id_buff[0] | (id_buff[1] << 8);
799-
return 0;
800-
801-
fail_timeout:
802-
ndcr = nand_readl(info, NDCR);
803-
nand_writel(info, NDCR, ndcr & ~NDCR_ND_RUN);
804-
udelay(10);
805-
return -ETIMEDOUT;
806-
}
807-
808733
static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info,
809734
const struct pxa3xx_nand_flash *f)
810735
{
@@ -857,7 +782,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info)
857782

858783
page_per_block = ndcr & NDCR_PG_PER_BLK ? 64 : 32;
859784
info->page_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512;
860-
/* set info fields needed to __readid */
785+
/* set info fields needed to read id */
861786
info->read_id_bytes = (info->page_size == 2048) ? 4 : 2;
862787
info->reg_ndcr = ndcr;
863788
info->cmdset = &default_cmdset;

0 commit comments

Comments
 (0)