@@ -258,25 +258,6 @@ static void pxa3xx_nand_set_timing(struct pxa3xx_nand_info *info,
258
258
nand_writel (info , NDTR1CS0 , ndtr1 );
259
259
}
260
260
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
-
280
261
static void pxa3xx_set_datasize (struct pxa3xx_nand_info * info )
281
262
{
282
263
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)
414
395
nand_writel (info , NDCR , ndcr | int_mask );
415
396
}
416
397
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
-
446
398
static void handle_data_pio (struct pxa3xx_nand_info * info )
447
399
{
448
400
switch (info -> state ) {
@@ -778,33 +730,6 @@ static int pxa3xx_nand_waitfunc(struct mtd_info *mtd, struct nand_chip *this)
778
730
return 0 ;
779
731
}
780
732
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
-
808
733
static int pxa3xx_nand_config_flash (struct pxa3xx_nand_info * info ,
809
734
const struct pxa3xx_nand_flash * f )
810
735
{
@@ -857,7 +782,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info)
857
782
858
783
page_per_block = ndcr & NDCR_PG_PER_BLK ? 64 : 32 ;
859
784
info -> page_size = ndcr & NDCR_PAGE_SZ ? 2048 : 512 ;
860
- /* set info fields needed to __readid */
785
+ /* set info fields needed to read id */
861
786
info -> read_id_bytes = (info -> page_size == 2048 ) ? 4 : 2 ;
862
787
info -> reg_ndcr = ndcr ;
863
788
info -> cmdset = & default_cmdset ;
0 commit comments