Blackfin BF54x NAND Flash Controller driver
Subsystems (2)
PATCH 1/1 Blackfin BF54x NAND Flash Controller driver
This is the driver for latest Blackfin BF54x nand flash controller
- use nand_chip and mtd_info common nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
--- drivers/mtd/nand/Kconfig | 18 + drivers/mtd/nand/Makefile | 1 + drivers/mtd/nand/bf54x_nand.c | 796 ++++++++++++++++++++++++++++++++ include/asm-blackfin/mach-bf548/dma.h | 1 + include/asm-blackfin/mach-bf548/nand.h | 47 ++ 5 files changed, 863 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/bf54x_nand.c create mode 100644 include/asm-blackfin/mach-bf548/nand.h
drivers/mtd/nand/Kconfig +18 -0
@@ -131,6 +131,24 @@ config MTD_NAND_AU1550 This enables the driver for the NAND flash controller on the AMD/Alchemy 1550 SOC. +config MTD_NAND_BF54X + tristate "NAND Flash support for Blackfin BF54X SoC DSP" + depends on BF54x && MTD_NAND + help + This enables the NAND flash controller on the BF54X SoC DPSs + + No board specific support is done by this driver, each board + must advertise a platform_device for the driver to attach. + +config MTD_NAND_BF54X_HWECC + bool "BF54X NAND Hardware ECC" + depends on MTD_NAND_BF54X + help + Enable the use of the BF54X's internal ECC generator when + using NAND. Early versions of the chip have had problems with + incorrect ECC generation, and if using these, the default of + software ECC is preferable. + config MTD_NAND_RTC_FROM4 tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)" depends on SH_SOLUTION_ENGINE
drivers/mtd/nand/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_NAND_TOTO) += toto.o obj-$(CONFIG_MTD_NAND_AUTCPU12) += autcpu12.o obj-$(CONFIG_MTD_NAND_EDB7312) += edb7312.o obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o +obj-$(CONFIG_MTD_NAND_BF54X) += bf54x_nand.o obj-$(CONFIG_MTD_NAND_PPCHAMELEONEVB) += ppchameleonevb.o obj-$(CONFIG_MTD_NAND_S3C2410) += s3c2410.o obj-$(CONFIG_MTD_NAND_DISKONCHIP) += diskonchip.o
drivers/mtd/nand/bf54x_nand.c new file +796 -0
796 lines not on this page · raw message
include/asm-blackfin/mach-bf548/dma.h +1 -0
@@ -55,6 +55,7 @@#define CH_SPORT3_RX 20#define CH_SPORT3_TX 21#define CH_SDH 22 +#define CH_NFC 22#define CH_SPI2 23#define CH_MEM_STREAM0_DEST 24
include/asm-blackfin/mach-bf548/nand.h new file +47 -0
47 lines not on this page · raw message
Signature · 1 line
1.5.2
Hi, Bryan!
Quoted 7 lines · Bryan Wu
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
Looks great!
Will this driver also work for the new BF52x series of the Blackfin Series? (Or is it planned to make it work for... anytime soon.)
Thank you!
Signature · 10 lines
Clemens Koller __________________________________ R&D Imaging Devices Anagramm GmbH Rupert-Mayer-Straße 45/1 Linhof Werksgelände D-81379 München Tel.089-741518-50 Fax 089-741518-19 http://www.anagramm-technology.com
Quoted 9 lines · Clemens Koller
Quoted 7 lines · Bryan Wu
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
Quoted 4 lines
Looks great!
Will this driver also work for the new BF52x series of the Blackfin Series? (Or is it planned to make it work for... anytime soon.)
the order for porting of new chips is:
u-boot -> core kernel -> peripherals
we generally dont bother looking at peripherals until the earlier stuff is done -mike
drivers/mtd/nand/bf54x_nand.c line 706
Quoted 5 lines · Bryan Wu
drivers/mtd/nand/bf54x_nand.c new file +5
-0+if (hardware_ecc) { +if (plat->page_size ==NFC_PG_SIZE_256 ) { + chip->ecc.bytes =3 ; + chip->ecc.size =256 ; + }else if (mtd->writesize ==NFC_PG_SIZE_512 ) {
Comparing against plat->page_size in one case, but mtd->writesize in the other? And elsewhere it seems plat->page_size is treated as a boolean, indicating only 256-byte vs. 512-byte pages (you don't support 2KiB or other page sizes at all?)
Signature · 1 line
dwmw2
Quoted 9 lines · David Woodhouse
drivers/mtd/nand/bf54x_nand.c line 706
Quoted 5 lines · Bryan Wu
drivers/mtd/nand/bf54x_nand.c new file +5
-0+if (hardware_ecc) { +if (plat->page_size ==NFC_PG_SIZE_256 ) { + chip->ecc.bytes =3 ; + chip->ecc.size =256 ; + }else if (mtd->writesize ==NFC_PG_SIZE_512 ) {Comparing against
plat->page_sizein one case, butmtd->writesizein the other?
This is a typo in development. I will fix it ASAP. -:)
Quoted 4 lines
And elsewhere it seems
plat->page_sizeis treated as a boolean, indicating only 256-byte vs. 512-byte pages (you don't support 2KiB or other page sizes at all?)
When enabled hardware ECC, NFC of BF54x supports 256 and 512 bytes page size ECC.
it's maybe little confusing with the NAND chip's pagesize. When NAND chip is 2KiB or other page size, this driver can use multiple 256/512 pages to do hardware ECC. And it's handled by the driver software here.
-Bryan Wu
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 132
Quoted 5 lines · Bryan Wu
drivers/mtd/nand/Kconfig +2
-0@@ -131,6 +131,24 @@ config MTD_NAND_AU1550 +config MTD_NAND_BF54X + tristate "NAND Flash support for Blackfin BF54X SoC DSP"
i'd just describe it as "Blackfin on-chip NAND" rather than sticking in exact part numbers as i imagine we can extend it down the line
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 138
Quoted 1 line
drivers/mtd/nand/Kconfig +1
-0+ This enables the NAND flash controller on the BF54X SoC DPSs
"BF54X SoC DPSs" -> "BF54x SoC DSPs"
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 141
Quoted 2 lines
drivers/mtd/nand/Kconfig +2
-0+ No board specific support is done by this driver, each board + must advertise a platform_device for the driver to attach.
should mention the module name when built as a module
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 150
Quoted 8 lines
drivers/mtd/nand/Kconfig +8
-0+config MTD_NAND_BF54X_HWECC + bool "BF54X NAND Hardware ECC" + depends on MTD_NAND_BF54X + help + Enable the use of the BF54X's internal ECC generator when + using NAND. Early versions of the chip have had problems with + incorrect ECC generation, and if using these, the default of + software ECC is preferable.
rather than advertising this, i'd just keep it in the driver ... presumably there are anomaly #'s for when the ECC is wrong, so we can make the code depend on those
-mike
Quoted 10 lines · Mike Frysinger
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 132
Quoted 5 lines · Bryan Wu
drivers/mtd/nand/Kconfig +2
-0@@ -131,6 +131,24 @@ config MTD_NAND_AU1550 +config MTD_NAND_BF54X + tristate "NAND Flash support for Blackfin BF54X SoC DSP"i'd just describe it as "Blackfin on-chip NAND" rather than sticking in exact part numbers as i imagine we can extend it down the line
Quoted 9 lines
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 138
Quoted 1 line
drivers/mtd/nand/Kconfig +1
-0+ This enables the NAND flash controller on the BF54X SoC DPSs"BF54X SoC DPSs" -> "BF54x SoC DSPs"
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 141
Quoted 2 lines
drivers/mtd/nand/Kconfig +2
-0+ No board specific support is done by this driver, each board + must advertise a platform_device for the driver to attach.should mention the module name when built as a module
I will get rid of this BF54X and use BF5XX for (BF54x and BF52x and future processor)
Quoted 9 lines
drivers/mtd/nand/Kconfig config MTD_NAND_AU1550 · line 150
Quoted 8 lines
drivers/mtd/nand/Kconfig +8
-0+config MTD_NAND_BF54X_HWECC + bool "BF54X NAND Hardware ECC" + depends on MTD_NAND_BF54X + help + Enable the use of the BF54X's internal ECC generator when + using NAND. Early versions of the chip have had problems with + incorrect ECC generation, and if using these, the default of + software ECC is preferable.
Quoted 4 lines
rather than advertising this, i'd just keep it in the driver ... presumably there are anomaly #'s for when the ECC is wrong, so we can make the code depend on those
-mike
This option is quite common in the NAND driver. If there are anomaly #'s, code can still depend on those by using hardware_ecc varible. This option is very useful when someone need software_ecc.
Thanks
- Bryan Wu
Quoted 11 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs...
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.
drivers/mtd/nand/bf54x_nand.c line 76
Quoted 3 lines
drivers/mtd/nand/bf54x_nand.c new file +3
-0+#endif + +unsigned short bfin_nfc_pin_req[] = {P_NAND_CE ,P_NAND_RB ,0 };
static. Please review whole patch for this.
drivers/mtd/nand/bf54x_nand.c line 134
Quoted 13 lines
drivers/mtd/nand/bf54x_nand.c new file +13
-0+/* +* bf54x_nand_hwcontrol +* +* Issue command and address cycles to the chip +*/ +static void bf54x_nand_hwcontrol (struct mtd_info *mtd,int cmd, +unsigned int ctrl) +{ +if (cmd ==NAND_CMD_NONE ) +return ; + +while (bfin_read_NFC_STAT () &WB_FULL ) +continue ;
cpu_relax(). Please check the whole patch for this too.
Quoted 14 lines
drivers/mtd/nand/bf54x_nand.c new file +11
-0+if (ctrl &NAND_CLE ) +bfin_write_NFC_CMD (cmd); +else +bfin_write_NFC_ADDR (cmd); +SSYNC (); +} + +/*---------------------------------------------------------------------------- +* ECC functions +* +* These allow the bf54x to use the controller's ECC
drivers/mtd/nand/bf54x_nand.c line 171
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+* generator block to ECC the data as it passes through +*/ +static inline int count_bits (uint32_t byte) +{ +int res =0 ; + +for (; byte; byte >>=1 ) + res += byte &0x01 ; +return res; +}
delete this, use hweight32() at its callsites.
drivers/mtd/nand/bf54x_nand.c line 253
Quoted 4 lines
drivers/mtd/nand/bf54x_nand.c new file +4
-0+ +static int bf54x_nand_correct_data (struct mtd_info *mtd,u_char *dat, +u_char *read_ecc,u_char *calc_ecc) +{struct bf54x_nand_info *info =mtd_to_nand_info (mtd);
missing newline
drivers/mtd/nand/bf54x_nand.c line 257
Quoted 4 lines
drivers/mtd/nand/bf54x_nand.c new file +4
-0+struct bf54x_nand_platform *plat = info->platform; +unsigned short page_size = (plat->page_size ?512 :256 ); + +int ret;
extraneous newline
Quoted 13 lines
drivers/mtd/nand/bf54x_nand.c new file +13
-0+ ret =bf54x_nand_correct_data_256 (mtd, dat, read_ecc, calc_ecc); + +/* If page size is 512, correct second 256 bytes */ +if (page_size ==512 ) { + dat +=256 ; + read_ecc +=8 ; + calc_ecc +=8 ; + ret =bf54x_nand_correct_data_256 (mtd, dat, read_ecc, calc_ecc); + } + +return ret; +} +
drivers/mtd/nand/bf54x_nand.c line 281
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+static void bf54x_nand_enable_hwecc (struct mtd_info *mtd,int mode) +{ +/* +* This register must be written before each page is +* transferred to generate the correct ECC register +* values. +*/ +return ; + +}
comment doesn't match code.
extraneous newline
drivers/mtd/nand/bf54x_nand.c line 320
Quoted 4 lines
drivers/mtd/nand/bf54x_nand.c new file +4
-0+ +/*---------------------------------------------------------------------------- +* PIO mode for buffer writing and reading +*/
remove the ------------------------------ thingy. (whole patch)
drivers/mtd/nand/bf54x_nand.c line 332
Quoted 12 lines
drivers/mtd/nand/bf54x_nand.c new file +12
-0+static void bf54x_nand_read_buf (struct mtd_info *mtd,uint8_t *buf,int len) +{ +int i; +unsigned short val; + +/* +* Data reads are requested by first writing to NFC_DATA_RD +* and then reading back from NFC_READ. +*/ +for (i =0 ; i < len; i++) { +while (bfin_read_NFC_STAT () &WB_FULL ) +continue ;
cpu_relax()
Quoted 23 lines
drivers/mtd/nand/bf54x_nand.c new file +23
-0+/* Contents do not matter */ +bfin_write_NFC_DATA_RD (0x0000 ); +SSYNC (); + +while ((bfin_read_NFC_IRQSTAT () &RD_RDY ) !=RD_RDY ) +continue ; + + buf[i] =bfin_read_NFC_READ (); + + val =bfin_read_NFC_IRQSTAT (); + val |=RD_RDY ; +bfin_write_NFC_IRQSTAT (val); +SSYNC (); + } +} + +static uint8_t bf54x_nand_read_byte (struct mtd_info *mtd) +{ +uint8_t val; + +bf54x_nand_read_buf (mtd, &val,1 ); + +return val;
drivers/mtd/nand/bf54x_nand.c line 366
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+} + +static void bf54x_nand_write_buf (struct mtd_info *mtd, +const uint8_t *buf,int len) +{ +int i; + +for (i =0 ; i < len; i++) { +while (bfin_read_NFC_STAT () &WB_FULL ) +continue ;
dittoes
Quoted 4 lines
drivers/mtd/nand/bf54x_nand.c new file +4
-0+bfin_write_NFC_DATA_WR (buf[i]); +SSYNC (); + } +}
drivers/mtd/nand/bf54x_nand.c line 409
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +7
-0+ +/*---------------------------------------------------------------------------- +* DMA functions for buffer writing and reading +*/ +static irqreturn_t bf54x_nand_dma_irq (int irq,void *dev_id) +{ +struct bf54x_nand_info *info = (struct bf54x_nand_info *) dev_id;
unneeded and undesirable cast of void*
Quoted 15 lines
drivers/mtd/nand/bf54x_nand.c new file +15
-0+ +clear_dma_irqstat (CH_NFC ); +disable_dma (CH_NFC ); +complete (&info->dma_completion); + +return IRQ_HANDLED ; +} + +static int bf54x_nand_dma_rw (struct mtd_info *mtd, +uint8_t *buf,int is_read) +{ +struct bf54x_nand_info *info =mtd_to_nand_info (mtd); +struct bf54x_nand_platform *plat = info->platform; +unsigned short page_size = (plat->page_size ?512 :256 ); +unsigned short val;
drivers/mtd/nand/bf54x_nand.c line 434
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+ +dev_dbg (info->device," mtd->%p, buf->%p, len %d, is_read %d\n" , + mtd, buf, is_read); + +if (is_read) +invalidate_dcache_range ((unsigned int )buf, + (unsigned int )(buf + page_size)); +else +flush_dcache_range ((unsigned int )buf, + (unsigned int )(buf + page_size));
I'd have though that the MM tricks here need a comment so readers know what's going on?
Quoted 35 lines
drivers/mtd/nand/bf54x_nand.c new file +32
-0+bfin_write_NFC_RST (0x1 ); +SSYNC (); + +disable_dma (CH_NFC ); +clear_dma_irqstat (CH_NFC ); + +/* setup DMA register with Blackfin DMA API */ +set_dma_config (CH_NFC ,0x0 ); +set_dma_start_addr (CH_NFC , (unsigned long ) buf); +set_dma_x_count (CH_NFC , (page_size >>2 )); +set_dma_x_modify (CH_NFC ,4 ); + +/* setup write or read operation */ + val =DI_EN |WDSIZE_32 ; +if (is_read) + val |=WNR ; +set_dma_config (CH_NFC , val); +enable_dma (CH_NFC ); + +/* Start PAGE read/write operation */ +if (is_read) +bfin_write_NFC_PGCTL (0x1 ); +else +bfin_write_NFC_PGCTL (0x2 ); +wait_for_completion (&info->dma_completion); + +return 0 ; +} + +/* +* BF54X NFC hardware initialization +* - pin mux setup
drivers/mtd/nand/bf54x_nand.c line 542
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+* - clear interrupt status +*/ +static int bf54x_nand_hw_init (struct bf54x_nand_info *info) +{ +int err =0 ; +unsigned short val; +struct bf54x_nand_platform *plat = info->platform; + +if (!info) +return -EINVAL ;
can this happen?
Quoted 20 lines
drivers/mtd/nand/bf54x_nand.c new file +20
-0+/* setup NFC_CTL register */ +dev_info (info->device, +"page_size=%d, data_width=%d, wr_dly=%d, rd_dly=%d\n" , + (plat->page_size ?512 :256 ), + (plat->data_width ?16 :8 ), + plat->wr_dly, plat->rd_dly); + + val = (plat->page_size <<NFC_PG_SIZE_OFFSET ) | + (plat->data_width <<NFC_NWIDTH_OFFSET ) | + (plat->rd_dly <<NFC_RDDLY_OFFSET ) | + (plat->rd_dly <<NFC_WRDLY_OFFSET ); +dev_dbg (info->device,"NFC_CTL is 0x%04x\n" , val); + +bfin_write_NFC_CTL (val); +SSYNC (); + +/* clear interrupt status */ +bfin_write_NFC_IRQMASK (0x0 ); +SSYNC (); + val =bfin_read_NFC_IRQSTAT ();
drivers/mtd/nand/bf54x_nand.c line 573
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+bfin_write_NFC_IRQSTAT (val); +SSYNC (); + +if (peripheral_request_list (bfin_nfc_pin_req,DRV_NAME )) { + printk(KERN_ERR DRV_NAME + ": Requesting Peripherals failed\n"); +return -EFAULT ; + } + +
extraneous newline
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +8
-0+/* DMA initialization */ +if (bf54x_nand_dma_init (info)) { + err = -ENXIO ; + } + +return err; +} +
drivers/mtd/nand/bf54x_nand.c line 607
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +9
-0+static int bf54x_nand_remove (struct platform_device *pdev) +{ +struct bf54x_nand_info *info =to_nand_info (pdev); +struct mtd_info *mtd =NULL ; + +platform_set_drvdata (pdev,NULL ); + +if (!info) +return 0 ;
can this happen?
Quoted 29 lines
drivers/mtd/nand/bf54x_nand.c new file +29
-0+/* first thing we need to do is release all our mtds +* and their partitions, then go through freeing the +* resources used +*/ + mtd = &info->mtd; +if (mtd) { +nand_release (mtd); +kfree (mtd); + } + +peripheral_free_list (bfin_nfc_pin_req); + +/* free the common resources */ +kfree (info); + +return 0 ; +} + +/* +* bf54x_nand_probe +* +* called by device layer when it finds a device matching +* one our driver can handled. This code checks to see if +* it can allocate all necessary resources then calls the +* nand layer to look for devices +*/ +static int bf54x_nand_probe (struct platform_device *pdev) +{ +struct bf54x_nand_platform *plat =to_nand_plat (pdev);
drivers/mtd/nand/bf54x_nand.c line 647
Quoted 10 lines
drivers/mtd/nand/bf54x_nand.c new file +10
-0+struct bf54x_nand_info *info =NULL ; +struct nand_chip *chip =NULL ; +struct mtd_info *mtd =NULL ; +int err =0 ; + +dev_dbg (&pdev->dev,"(%p)\n" , pdev); + +if (!plat) { +dev_err (&pdev->dev,"no platform specific information\n" ); + goto exit_error;
and can this?
Quoted 99 lines
drivers/mtd/nand/bf54x_nand.c new file +99
-0+ } + + info =kzalloc (sizeof (*info),GFP_KERNEL ); +if (info ==NULL ) { +dev_err (&pdev->dev,"no memory for flash info\n" ); + err = -ENOMEM ; + goto exit_error; + } + +platform_set_drvdata (pdev, info); + +spin_lock_init (&info->controller.lock); +init_waitqueue_head (&info->controller.wq); + + info->device = &pdev->dev; + info->platform = plat; + +/* initialise chip data struct */ + chip = &info->chip; + +if (plat->data_width) + chip->options |=NAND_BUSWIDTH_16 ; + + chip->options |=NAND_CACHEPRG |NAND_SKIP_BBTSCAN ; + + chip->read_buf = (plat->data_width) ? + bf54x_nand_read_buf16 : bf54x_nand_read_buf; + chip->write_buf = (plat->data_width) ? + bf54x_nand_write_buf16 : bf54x_nand_write_buf; + + chip->read_byte = bf54x_nand_read_byte; + + chip->cmd_ctrl = bf54x_nand_hwcontrol; + chip->dev_ready = bf54x_nand_devready; + + chip->priv = &info->mtd; + chip->controller = &info->controller; + + chip->IO_ADDR_R = (void __iomem *)NFC_READ ; + chip->IO_ADDR_W = (void __iomem *)NFC_DATA_WR ; + + chip->chip_delay =0 ; + +/* initialise mtd info data struct */ + mtd = &info->mtd; + mtd->priv = chip; + mtd->owner =THIS_MODULE ; + +/* initialise the hardware */ + err =bf54x_nand_hw_init (info); +if (err !=0 ) + goto exit_error; + +/* setup hardware ECC data struct */ +if (hardware_ecc) { +if (plat->page_size ==NFC_PG_SIZE_256 ) { + chip->ecc.bytes =3 ; + chip->ecc.size =256 ; + }else if (mtd->writesize ==NFC_PG_SIZE_512 ) { + chip->ecc.bytes =6 ; + chip->ecc.size =512 ; + } + + chip->read_buf = bf54x_nand_dma_read_buf; + chip->write_buf = bf54x_nand_dma_write_buf; + chip->ecc.calculate = bf54x_nand_calculate_ecc; + chip->ecc.correct = bf54x_nand_correct_data; + chip->ecc.mode =NAND_ECC_HW ; + chip->ecc.hwctl = bf54x_nand_enable_hwecc; + }else { + chip->ecc.mode =NAND_ECC_SOFT ; + } + +/* scan hardware nand chip and setup mtd info data struct */ +if (nand_scan (mtd,1 )) { + err = -ENXIO ; + goto exit_error; + } + +/* add NAND partition */ +bf54x_nand_add_partition (info); + +dev_dbg (&pdev->dev,"initialised ok\n" ); +return 0 ; + +exit_error: +bf54x_nand_remove (pdev); + +if (err ==0 ) + err = -EINVAL ; +return err; +} + +if (info) +bf54x_nand_hw_init (info); + +return 0 ; +} +
Quoted 9 lines · Andrew Morton
Quoted 8 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
Quoted 5 lines
Quoted 3 lines
...
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.
that isnt static so checkpatch.pl wouldnt have caught it ... it should be static though of course and then checkpatch.pl would have thrown a static init 0 warning :)
-mike
Quoted 12 lines · Mike Frysinger
Quoted 11 lines · Andrew Morton
Quoted 10 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs...
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.that isnt static so checkpatch.pl wouldnt have caught it ... it should be static though of course and then checkpatch.pl would have thrown a static init 0 warning :)
Actually, it would caught by checkpatch.pl even without static.
Andrew, I think I sent out the try#2 version of this patch which fixed these checkpatch.pl issues. But I will continue do some cleanup as you point out.
Thanks
-Bryan Wu
Quoted 15 lines · Bryan Wu
Quoted 14 lines · Mike Frysinger
Quoted 13 lines · Andrew Morton
Quoted 11 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs...
+int
hardware_ecc= 0;
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
scripts/checkpatch.pl, please.that isnt static so checkpatch.pl wouldnt have caught it ... it should be static though of course and then checkpatch.pl would have thrown a static init 0 warning :)
Actually, it would caught by checkpatch.pl even without static.
it doesnt for me, but maybe i'm just using an older version -mike
Quoted 18 lines · Mike Frysinger
Quoted 17 lines · Bryan Wu
Quoted 16 lines · Mike Frysinger
Quoted 14 lines · Andrew Morton
Quoted 11 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs...
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
that isnt static so checkpatch.pl wouldnt have caught it ... it should be static though of course and then checkpatch.pl would have thrown a static init 0 warning :)
Actually, it would caught by checkpatch.pl even without static.
it doesnt for me, but maybe i'm just using an older version -mike
Yes, should use the latest git-tree checkpatch.pl
Thanks
-Bryan
Quoted 10 lines · On Thu, 13 Sep 2007 04:45:13 -0400 "Mike Frysinger" <[email protected]>…
Quoted 9 lines · Andrew Morton
Quoted 8 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
...
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.that isnt static so checkpatch.pl wouldnt have caught it ...
box:/usr/src/25> perl scripts/checkpatch.pl ~/x
ERROR: do not initialise externals to 0 or NULL
#186: FILE: drivers/mtd/nand/bf54x_nand.c:73:
+int hardware_ecc = 0;
Quoted 1 line
it should be static though of course
good point.
Quoted 3 lines
and then checkpatch.pl would have thrown a
static init 0 warning :)
-mike
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Mon, 03 Sep 2007 15:25:23 +0800 Bryan Wu <[email protected]> wrote:
This is the driver for latest Blackfin BF54x nand flash controller
- use
nand_chipandmtd_infocommon nand driver interface
- provide both PIO and dma operation
- compiled with ezkit bf548 configuration
- use hardware 1-bit ECC
- tested with YAFFS2 and can mount YAFFS2 filesystem as rootfs
Quoted 6 lines
Quoted 3 lines
...
+int
hardware_ecc= 0;
scripts/checkpatch.pl, please.
Things are fixed in the try#3 version of the driver, which will be sent out soon.
Quoted 6 lines
drivers/mtd/nand/bf54x_nand.c line 76
Quoted 3 lines
drivers/mtd/nand/bf54x_nand.c new file +3
-0+#endif + +unsigned short bfin_nfc_pin_req[] = {P_NAND_CE ,P_NAND_RB ,0 };static. Please review whole patch for this.
[!snip!]
Quoted 16 lines
Quoted 16 lines
drivers/mtd/nand/bf54x_nand.c new file +16
-0+ +/* +* bf54x_nand_probe +* +* called by device layer when it finds a device matching +* one our driver can handled. This code checks to see if +* it can allocate all necessary resources then calls the +* nand layer to look for devices +*/ +static int bf54x_nand_probe (struct platform_device *pdev) +{ +struct bf54x_nand_platform *plat =to_nand_plat (pdev); +struct bf54x_nand_info *info =NULL ; +struct nand_chip *chip =NULL ; +struct mtd_info *mtd =NULL ; +int err =0 ;
Quoted 9 lines
drivers/mtd/nand/bf54x_nand.c line 647
Quoted 6 lines
drivers/mtd/nand/bf54x_nand.c new file +6
-0+ +dev_dbg (&pdev->dev,"(%p)\n" , pdev); + +if (!plat) { +dev_err (&pdev->dev,"no platform specific information\n" ); + goto exit_error;and can this?
Try to prevent board configuration missing the bf54x_nand_platform information.
Quoted 8 lines
drivers/mtd/nand/bf54x_nand.c line 655
Quoted 8 lines
drivers/mtd/nand/bf54x_nand.c new file +8
-0+ } + + info =kzalloc (sizeof (*info),GFP_KERNEL ); +if (info ==NULL ) { +dev_err (&pdev->dev,"no memory for flash info\n" ); + err = -ENOMEM ; + goto exit_error; + }
Thanks
-Bryan Wu