Message ID | 1376163305-5591-15-git-send-email-ezequiel.garcia@free-electrons.com |
---|---|
State | Superseded |
Headers | show |
On Sat, Aug 10, 2013 at 04:35:04PM -0300, Ezequiel Garcia wrote: > Devices with 4 KiB pages (plus OOB data) can be detected, so we increase > the data buffer size. A better solution would be to allocate a buffer > depending on the detected page size, but that's not possible given > we need the buffer prior to the device detection. Another possibility (for future work, maybe) is that you allocate a smaller buffer that fits what you need for "device detection" (I presume it's just for ONFI parameter page commands?), then reallocate the buffer between nand_scan_ident() and nand_scan_tail() according to page size. There are some other similar buffers throughout NAND that use a fixed NAND_MAX_OOBSIZE and NAND_MAX_PAGESIZE. > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> > Tested-by: Daniel Mack <zonque@gmail.com> ... Brian
On Sat, Aug 10, 2013 at 08:30:45PM -0700, Brian Norris wrote: > On Sat, Aug 10, 2013 at 04:35:04PM -0300, Ezequiel Garcia wrote: > > Devices with 4 KiB pages (plus OOB data) can be detected, so we increase > > the data buffer size. A better solution would be to allocate a buffer > > depending on the detected page size, but that's not possible given > > we need the buffer prior to the device detection. > > Another possibility (for future work, maybe) is that you allocate a > smaller buffer that fits what you need for "device detection" (I presume > it's just for ONFI parameter page commands?), then reallocate the buffer > between nand_scan_ident() and nand_scan_tail() according to page size. > There are some other similar buffers throughout NAND that use a fixed > NAND_MAX_OOBSIZE and NAND_MAX_PAGESIZE. > That sounds better. I spent a considerable amount of time trying to find a better solution. I'll drop this one from the next version and I'll re-work following your idea. Thanks,
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 3c1d061..49c4f92 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -906,7 +906,7 @@ static int pxa3xx_nand_detect_config(struct pxa3xx_nand_info *info) * is: 2048 + 64 = 2112 bytes, allocate a page here for both the * data buffer and the DMA descriptor */ -#define MAX_BUFF_SIZE PAGE_SIZE +#define MAX_BUFF_SIZE (PAGE_SIZE*2) #ifdef ARCH_HAS_DMA static int pxa3xx_nand_init_buff(struct pxa3xx_nand_info *info)