Commit 65e0b598 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.infradead.org/mtd-2.6

* git://git.infradead.org/mtd-2.6:
  mtd: pxa3xx: fix build error when CONFIG_MTD_PARTITIONS is not defined
  mtd: mxc_nand: configure pages per block for v2 controller
  mtd: OneNAND: Fix loop hang when DMA error at Samsung SoCs
  mtd: OneNAND: Fix 2KiB pagesize handling at Samsung SoCs
  mtd: Blackfin NFC: fix invalid free in remove()
  mtd: Blackfin NFC: fix build error after nand_scan_ident() change
  mxc_nand: Do not do byte accesses to the NFC buffer.
parents d7a4b63b 99d38964
...@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info) ...@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
static int __devexit bf5xx_nand_remove(struct platform_device *pdev) static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
{ {
struct bf5xx_nand_info *info = to_nand_info(pdev); struct bf5xx_nand_info *info = to_nand_info(pdev);
struct mtd_info *mtd = NULL;
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
...@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev) ...@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
* and their partitions, then go through freeing the * and their partitions, then go through freeing the
* resources used * resources used
*/ */
mtd = &info->mtd; nand_release(&info->mtd);
if (mtd) {
nand_release(mtd);
kfree(mtd);
}
peripheral_free_list(bfin_nfc_pin_req); peripheral_free_list(bfin_nfc_pin_req);
bf5xx_nand_dma_remove(info); bf5xx_nand_dma_remove(info);
...@@ -710,7 +705,7 @@ static int bf5xx_nand_scan(struct mtd_info *mtd) ...@@ -710,7 +705,7 @@ static int bf5xx_nand_scan(struct mtd_info *mtd)
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
int ret; int ret;
ret = nand_scan_ident(mtd, 1); ret = nand_scan_ident(mtd, 1, NULL);
if (ret) if (ret)
return ret; return ret;
......
...@@ -67,7 +67,9 @@ ...@@ -67,7 +67,9 @@
#define NFC_V1_V2_CONFIG1_BIG (1 << 5) #define NFC_V1_V2_CONFIG1_BIG (1 << 5)
#define NFC_V1_V2_CONFIG1_RST (1 << 6) #define NFC_V1_V2_CONFIG1_RST (1 << 6)
#define NFC_V1_V2_CONFIG1_CE (1 << 7) #define NFC_V1_V2_CONFIG1_CE (1 << 7)
#define NFC_V1_V2_CONFIG1_ONE_CYCLE (1 << 8) #define NFC_V2_CONFIG1_ONE_CYCLE (1 << 8)
#define NFC_V2_CONFIG1_PPB(x) (((x) & 0x3) << 9)
#define NFC_V2_CONFIG1_FP_INT (1 << 11)
#define NFC_V1_V2_CONFIG2_INT (1 << 15) #define NFC_V1_V2_CONFIG2_INT (1 << 15)
...@@ -402,16 +404,16 @@ static void send_read_id_v1_v2(struct mxc_nand_host *host) ...@@ -402,16 +404,16 @@ static void send_read_id_v1_v2(struct mxc_nand_host *host)
/* Wait for operation to complete */ /* Wait for operation to complete */
wait_op_done(host, true); wait_op_done(host, true);
memcpy(host->data_buf, host->main_area0, 16);
if (this->options & NAND_BUSWIDTH_16) { if (this->options & NAND_BUSWIDTH_16) {
void __iomem *main_buf = host->main_area0;
/* compress the ID info */ /* compress the ID info */
writeb(readb(main_buf + 2), main_buf + 1); host->data_buf[1] = host->data_buf[2];
writeb(readb(main_buf + 4), main_buf + 2); host->data_buf[2] = host->data_buf[4];
writeb(readb(main_buf + 6), main_buf + 3); host->data_buf[3] = host->data_buf[6];
writeb(readb(main_buf + 8), main_buf + 4); host->data_buf[4] = host->data_buf[8];
writeb(readb(main_buf + 10), main_buf + 5); host->data_buf[5] = host->data_buf[10];
} }
memcpy(host->data_buf, host->main_area0, 16);
} }
static uint16_t get_dev_status_v3(struct mxc_nand_host *host) static uint16_t get_dev_status_v3(struct mxc_nand_host *host)
...@@ -729,27 +731,30 @@ static void preset_v1_v2(struct mtd_info *mtd) ...@@ -729,27 +731,30 @@ static void preset_v1_v2(struct mtd_info *mtd)
{ {
struct nand_chip *nand_chip = mtd->priv; struct nand_chip *nand_chip = mtd->priv;
struct mxc_nand_host *host = nand_chip->priv; struct mxc_nand_host *host = nand_chip->priv;
uint16_t tmp; uint16_t config1 = 0;
/* enable interrupt, disable spare enable */ if (nand_chip->ecc.mode == NAND_ECC_HW)
tmp = readw(NFC_V1_V2_CONFIG1); config1 |= NFC_V1_V2_CONFIG1_ECC_EN;
tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK;
tmp &= ~NFC_V1_V2_CONFIG1_SP_EN; if (nfc_is_v21())
if (nand_chip->ecc.mode == NAND_ECC_HW) { config1 |= NFC_V2_CONFIG1_FP_INT;
tmp |= NFC_V1_V2_CONFIG1_ECC_EN;
} else { if (!cpu_is_mx21())
tmp &= ~NFC_V1_V2_CONFIG1_ECC_EN; config1 |= NFC_V1_V2_CONFIG1_INT_MSK;
}
if (nfc_is_v21() && mtd->writesize) { if (nfc_is_v21() && mtd->writesize) {
uint16_t pages_per_block = mtd->erasesize / mtd->writesize;
host->eccsize = get_eccsize(mtd); host->eccsize = get_eccsize(mtd);
if (host->eccsize == 4) if (host->eccsize == 4)
tmp |= NFC_V2_CONFIG1_ECC_MODE_4; config1 |= NFC_V2_CONFIG1_ECC_MODE_4;
config1 |= NFC_V2_CONFIG1_PPB(ffs(pages_per_block) - 6);
} else { } else {
host->eccsize = 1; host->eccsize = 1;
} }
writew(tmp, NFC_V1_V2_CONFIG1); writew(config1, NFC_V1_V2_CONFIG1);
/* preset operation */ /* preset operation */
/* Unlock the internal RAM Buffer */ /* Unlock the internal RAM Buffer */
......
...@@ -1320,6 +1320,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) ...@@ -1320,6 +1320,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
goto fail_free_irq; goto fail_free_irq;
} }
#ifdef CONFIG_MTD_PARTITIONS
if (mtd_has_cmdlinepart()) { if (mtd_has_cmdlinepart()) {
static const char *probes[] = { "cmdlinepart", NULL }; static const char *probes[] = { "cmdlinepart", NULL };
struct mtd_partition *parts; struct mtd_partition *parts;
...@@ -1332,6 +1333,9 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) ...@@ -1332,6 +1333,9 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
} }
return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts); return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts);
#else
return 0;
#endif
fail_free_irq: fail_free_irq:
free_irq(irq, info); free_irq(irq, info);
...@@ -1364,7 +1368,9 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) ...@@ -1364,7 +1368,9 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
del_mtd_device(mtd); del_mtd_device(mtd);
#ifdef CONFIG_MTD_PARTITIONS
del_mtd_partitions(mtd); del_mtd_partitions(mtd);
#endif
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq >= 0) if (irq >= 0)
free_irq(irq, info); free_irq(irq, info);
......
...@@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction) ...@@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
do { do {
status = readl(base + S5PC110_DMA_TRANS_STATUS); status = readl(base + S5PC110_DMA_TRANS_STATUS);
if (status & S5PC110_DMA_TRANS_STATUS_TE) {
writel(S5PC110_DMA_TRANS_CMD_TEC,
base + S5PC110_DMA_TRANS_CMD);
return -EIO;
}
} while (!(status & S5PC110_DMA_TRANS_STATUS_TD)); } while (!(status & S5PC110_DMA_TRANS_STATUS_TD));
if (status & S5PC110_DMA_TRANS_STATUS_TE) {
writel(S5PC110_DMA_TRANS_CMD_TEC, base + S5PC110_DMA_TRANS_CMD);
writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
return -EIO;
}
writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD); writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
return 0; return 0;
...@@ -571,13 +570,12 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, ...@@ -571,13 +570,12 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
unsigned char *buffer, int offset, size_t count) unsigned char *buffer, int offset, size_t count)
{ {
struct onenand_chip *this = mtd->priv; struct onenand_chip *this = mtd->priv;
void __iomem *bufferram;
void __iomem *p; void __iomem *p;
void *buf = (void *) buffer; void *buf = (void *) buffer;
dma_addr_t dma_src, dma_dst; dma_addr_t dma_src, dma_dst;
int err; int err;
p = bufferram = this->base + area; p = this->base + area;
if (ONENAND_CURRENT_BUFFERRAM(this)) { if (ONENAND_CURRENT_BUFFERRAM(this)) {
if (area == ONENAND_DATARAM) if (area == ONENAND_DATARAM)
p += this->writesize; p += this->writesize;
...@@ -621,7 +619,7 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, ...@@ -621,7 +619,7 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area,
normal: normal:
if (count != mtd->writesize) { if (count != mtd->writesize) {
/* Copy the bufferram to memory to prevent unaligned access */ /* Copy the bufferram to memory to prevent unaligned access */
memcpy(this->page_buf, bufferram, mtd->writesize); memcpy(this->page_buf, p, mtd->writesize);
p = this->page_buf + offset; p = this->page_buf + offset;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment