diff options
author | Ian Wisbon <ian.wisbon@timesys.com> | 2011-02-14 16:41:03 -0500 |
---|---|---|
committer | Ian Wisbon <ian.wisbon@timesys.com> | 2011-02-14 16:41:03 -0500 |
commit | 8a83780a187ba1961380814eaf9c503043345d12 (patch) | |
tree | 80f5d89cca49330e137688c72fb10c9f42dc5663 /drivers/mtd | |
parent | 14a4057959f8ee0a2249eb2abd64fd6b1f571d98 (diff) |
Digi Release Code from del-5.6/main2.6.31-digi-201102141643
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0002.c | 11 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_util.c | 4 | ||||
-rw-r--r-- | drivers/mtd/nand/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nfc/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c | 65 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c | 41 | ||||
-rw-r--r-- | drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/mxc_nd2.c | 47 | ||||
-rw-r--r-- | drivers/mtd/nand/ndfc.c | 4 | ||||
-rw-r--r-- | drivers/mtd/ofpart.c | 21 | ||||
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 1 |
11 files changed, 52 insertions, 153 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c index 61ea833e0908..94bb61e19047 100644 --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -282,16 +282,6 @@ static void fixup_s29gl032n_sectors(struct mtd_info *mtd, void *param) } } -static void fixup_M29W128G_write_buffer(struct mtd_info *mtd, void *param) -{ - struct map_info *map = mtd->priv; - struct cfi_private *cfi = map->fldrv_priv; - if (cfi->cfiq->BufWriteTimeoutTyp) { - pr_warning("Don't use write buffer on ST flash M29W128G\n"); - cfi->cfiq->BufWriteTimeoutTyp = 0; - } -} - static struct cfi_fixup cfi_fixup_table[] = { { CFI_MFR_ATMEL, CFI_ID_ANY, fixup_convert_atmel_pri, NULL }, #ifdef AMD_BOOTLOC_BUG @@ -308,7 +298,6 @@ static struct cfi_fixup cfi_fixup_table[] = { { CFI_MFR_AMD, 0x1301, fixup_s29gl064n_sectors, NULL, }, { CFI_MFR_AMD, 0x1a00, fixup_s29gl032n_sectors, NULL, }, { CFI_MFR_AMD, 0x1a01, fixup_s29gl032n_sectors, NULL, }, - { CFI_MFR_ST, 0x227E, fixup_M29W128G_write_buffer, NULL, }, #if !FORCE_WORD_WRITE { CFI_MFR_ANY, CFI_ID_ANY, fixup_use_write_buffers, NULL, }, #endif diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c index 34d40e25d312..c5a84fda5410 100644 --- a/drivers/mtd/chips/cfi_util.c +++ b/drivers/mtd/chips/cfi_util.c @@ -81,6 +81,10 @@ void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map, { cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL); + /* M29W128G flashes require an additional reset command + when exit qry mode */ + if ((cfi->mfr == CFI_MFR_ST) && (cfi->id == 0x227E || cfi->id == 0x7E)) + cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); } EXPORT_SYMBOL_GPL(cfi_qry_mode_off); diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig index 1a85f6d5543b..3fe91622b400 100644 --- a/drivers/mtd/nand/Kconfig +++ b/drivers/mtd/nand/Kconfig @@ -436,7 +436,7 @@ config MXC_NAND_LOW_LEVEL_ERASE config MTD_NAND_GPMI_NFC tristate "GPMI NAND Flash Controller driver" - depends on MTD_NAND && (ARCH_MX23 || ARCH_MX28 || ARCH_MX50) + depends on MTD_NAND && (ARCH_MX23 || ARCH_MX28) help Enables NAND Flash support. diff --git a/drivers/mtd/nand/gpmi-nfc/Makefile b/drivers/mtd/nand/gpmi-nfc/Makefile index 9df1b6454e90..e3d5660735b6 100644 --- a/drivers/mtd/nand/gpmi-nfc/Makefile +++ b/drivers/mtd/nand/gpmi-nfc/Makefile @@ -4,7 +4,6 @@ gpmi-nfc-objs += gpmi-nfc-event-reporting.o gpmi-nfc-objs += gpmi-nfc-hal-common.o gpmi-nfc-objs += gpmi-nfc-hal-v0.o gpmi-nfc-objs += gpmi-nfc-hal-v1.o -gpmi-nfc-objs += gpmi-nfc-hal-v2.o gpmi-nfc-objs += gpmi-nfc-rom-common.o gpmi-nfc-objs += gpmi-nfc-rom-v0.o gpmi-nfc-objs += gpmi-nfc-rom-v1.o diff --git a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c index 54df1f084509..0143f1c358ff 100644 --- a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c +++ b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c @@ -42,12 +42,8 @@ static struct gpmi_nfc_timing safe_timing = { */ static struct nfc_hal *(nfc_hals[]) = { - /* i.mx23 */ &gpmi_nfc_hal_v0, - /* i.mx28 */ &gpmi_nfc_hal_v1, - /* i.mx50 */ - &gpmi_nfc_hal_v2, }; /* @@ -1255,54 +1251,40 @@ static void release_register_block(struct gpmi_nfc_data *this, * @resource_name: The name of the resource. * @interrupt_handler: A pointer to the function that will handle interrupts * from this interrupt number. - * @lno: A pointer to a variable that will receive the acquired - * interrupt number(low part). - * @hno: A pointer to a variable that will receive the acquired - * interrupt number(high part). + * @interrupt_number: A pointer to a variable that will receive the acquired + * interrupt number. */ static int acquire_interrupt( struct gpmi_nfc_data *this, const char *resource_name, - irq_handler_t interrupt_handler, int *lno, int *hno) + irq_handler_t interrupt_handler, int *interrupt_number) { struct platform_device *pdev = this->pdev; struct device *dev = this->dev; int error = 0; - struct resource *r; int i; /* Attempt to get information about the given resource. */ - r = platform_get_resource_byname(pdev, IORESOURCE_IRQ, resource_name); + i = platform_get_irq_byname(pdev, resource_name); - if (!r) { + if (i < 0) { dev_err(dev, "Can't get resource information for '%s'\n", resource_name); return -ENXIO; } /* Attempt to own the interrupt. */ - for (i = r->start; i <= r->end; i++) { - error = request_irq(i, interrupt_handler, 0, - resource_name, this); - - if (error) { - dev_err(dev, "Can't own %s\n", resource_name); - /* Free all the irq's we've already acquired. */ + error = request_irq(i, interrupt_handler, 0, resource_name, this); - while ((i - r->start) >= 0) { - free_irq(i, this); - i--; - } - - return -EIO; - } + if (error) { + dev_err(dev, "Can't own %s\n", resource_name); + return -EIO; } /* If control arrives here, everything went fine. */ - *lno = r->start; - *hno = r->end; + *interrupt_number = i; return 0; @@ -1314,12 +1296,9 @@ static int acquire_interrupt( * @this: Per-device data. * @interrupt_number: The interrupt number. */ -static void release_interrupt(struct gpmi_nfc_data *this, - int low_interrupt_number, int high_interrupt_number) +static void release_interrupt(struct gpmi_nfc_data *this, int interrupt_number) { - int i; - for (i = low_interrupt_number; i <= high_interrupt_number; i++) - free_irq(i, this); + free_irq(interrupt_number, this); } /** @@ -1488,9 +1467,7 @@ static int acquire_resources(struct gpmi_nfc_data *this) error = acquire_interrupt(this, GPMI_NFC_BCH_INTERRUPT_RES_NAME, - gpmi_nfc_bch_isr, - &(resources->bch_low_interrupt), - &(resources->bch_high_interrupt)); + gpmi_nfc_bch_isr, &(resources->bch_interrupt)); if (error) goto exit_bch_interrupt; @@ -1508,9 +1485,7 @@ static int acquire_resources(struct gpmi_nfc_data *this) error = acquire_interrupt(this, GPMI_NFC_DMA_INTERRUPT_RES_NAME, - gpmi_nfc_dma_isr, - &(resources->dma_low_interrupt), - &(resources->dma_high_interrupt)); + gpmi_nfc_dma_isr, &(resources->dma_interrupt)); if (error) goto exit_dma_interrupt; @@ -1529,14 +1504,12 @@ static int acquire_resources(struct gpmi_nfc_data *this) /* Control arrives here if something went wrong. */ exit_clock: - release_interrupt(this, - resources->dma_low_interrupt, resources->dma_high_interrupt); + release_interrupt(this, resources->dma_interrupt); exit_dma_interrupt: release_dma_channels(this, resources->dma_low_channel, resources->dma_high_channel); exit_dma_channels: - release_interrupt(this, - resources->bch_low_interrupt, resources->bch_high_interrupt); + release_interrupt(this, resources->bch_interrupt); exit_bch_interrupt: release_register_block(this, resources->bch_regs); exit_bch_regs: @@ -1559,12 +1532,10 @@ static void release_resources(struct gpmi_nfc_data *this) release_clock(this, resources->clock); release_register_block(this, resources->gpmi_regs); release_register_block(this, resources->bch_regs); - release_interrupt(this, - resources->bch_low_interrupt, resources->bch_low_interrupt); + release_interrupt(this, resources->bch_interrupt); release_dma_channels(this, resources->dma_low_channel, resources->dma_high_channel); - release_interrupt(this, - resources->dma_low_interrupt, resources->dma_high_interrupt); + release_interrupt(this, resources->dma_interrupt); } /** diff --git a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c index 50ba771853a4..34505b8e6546 100644 --- a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c +++ b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c @@ -172,8 +172,8 @@ static int mil_incoming_buffer_dma_begin(struct gpmi_nfc_data *this, * If we can, we want to use the caller's buffer directly for DMA. Check * if the system will let us map them. */ - if (map_io_buffers && virt_addr_valid(destination) && - !((int)destination & 0x3) && 0) + + if (map_io_buffers && virt_addr_valid(destination)) destination_phys = dma_map_single(dev, (void *) destination, length, DMA_FROM_DEVICE); @@ -385,7 +385,6 @@ static void mil_select_chip(struct mtd_info *mtd, int chip) gpmi_nfc_add_event("< mil_select_chip", -1); } else if ((mil->current_chip >= 0) && (chip < 0)) { gpmi_nfc_add_event("> mil_select_chip", 1); - gpmi_nfc_add_event("> not disable clk", 1); clk_disable(clock); nfc->end(this); gpmi_nfc_stop_event_trace("< mil_select_chip"); @@ -422,6 +421,7 @@ static void mil_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) gpmi_nfc_add_event("> mil_read_buf", 1); /* Set up DMA. */ + error = mil_incoming_buffer_dma_begin(this, buf, len, mil->payload_virt, mil->payload_phys, nfc_geo->payload_size_in_bytes, @@ -1413,12 +1413,6 @@ static int mil_set_geometry(struct gpmi_nfc_data *this) struct nfc_geometry *nfc_geo = &this->nfc_geometry; struct mil *mil = &this->mil; - - /* Free the memory for read ID case */ - if (mil->page_buffer_virt && virt_addr_valid(mil->page_buffer_virt)) - dma_free_coherent(dev, nfc_geo->payload_size_in_bytes, - mil->page_buffer_virt, mil->page_buffer_phys); - /* Set up the various layers of geometry, in this specific order. */ if (mil_set_physical_geometry(this)) @@ -2505,27 +2499,8 @@ int gpmi_nfc_mil_init(struct gpmi_nfc_data *this) dma_alloc_coherent(dev, MIL_COMMAND_BUFFER_SIZE, &mil->cmd_phys, GFP_DMA); - if (!mil->cmd_virt) { - error = -ENOMEM; + if (!mil->cmd_virt) goto exit_cmd_allocation; - } - - - /* Allocate buf read ID case */ - this->nfc_geometry.payload_size_in_bytes = 1024; - mil->page_buffer_virt = - dma_alloc_coherent(dev, - this->nfc_geometry.payload_size_in_bytes, - &mil->page_buffer_phys, GFP_DMA); - - if (!mil->page_buffer_virt) { - error = -ENOMEM; - goto exit_buf_allocation; - } - - /* Slice up the page buffer. */ - mil->payload_virt = mil->page_buffer_virt; - mil->payload_phys = mil->page_buffer_phys; /* * Ask the NAND Flash system to scan for chips. @@ -2574,14 +2549,8 @@ int gpmi_nfc_mil_init(struct gpmi_nfc_data *this) exit_partitions: nand_release(&mil->mtd); exit_nand_scan: - dma_free_coherent(dev, - this->nfc_geometry.payload_size_in_bytes, - mil->page_buffer_virt, mil->page_buffer_phys); - mil->page_buffer_virt = 0; - mil->page_buffer_phys = ~0; -exit_buf_allocation: dma_free_coherent(dev, MIL_COMMAND_BUFFER_SIZE, - mil->cmd_virt, mil->cmd_phys); + mil->cmd_virt, mil->cmd_phys); mil->cmd_virt = 0; mil->cmd_phys = ~0; exit_cmd_allocation: diff --git a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h index 9b0074532917..6f14b73dd93d 100644 --- a/drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h +++ b/drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h @@ -44,6 +44,7 @@ #include <mach/system.h> #include <mach/dmaengine.h> +#include <mach/device.h> #include <mach/clock.h> /* Driver header files. */ @@ -85,12 +86,10 @@ struct resources { void *gpmi_regs; void *bch_regs; - unsigned int bch_low_interrupt; - unsigned int bch_high_interrupt; + unsigned int bch_interrupt; unsigned int dma_low_channel; unsigned int dma_high_channel; - unsigned int dma_low_interrupt; - unsigned int dma_high_interrupt; + unsigned int dma_interrupt; struct clk *clock; }; @@ -626,7 +625,6 @@ extern int gpmi_nfc_compute_hardware_timing(struct gpmi_nfc_data *this, extern struct nfc_hal gpmi_nfc_hal_v0; extern struct nfc_hal gpmi_nfc_hal_v1; -extern struct nfc_hal gpmi_nfc_hal_v2; /* Boot ROM Helper Common Services */ diff --git a/drivers/mtd/nand/mxc_nd2.c b/drivers/mtd/nand/mxc_nd2.c index 80533ac42e9c..5ace73501cbb 100644 --- a/drivers/mtd/nand/mxc_nd2.c +++ b/drivers/mtd/nand/mxc_nd2.c @@ -32,7 +32,6 @@ /* Global address Variables */ static void __iomem *nfc_axi_base, *nfc_ip_base; -static int nfc_irq; struct mxc_mtd_s { struct mtd_info mtd; @@ -40,7 +39,6 @@ struct mxc_mtd_s { struct mtd_partition *parts; struct device *dev; int disable_bi_swap; /* disable bi swap */ - int clk_active; }; static struct mxc_mtd_s *mxc_nand_data; @@ -842,30 +840,6 @@ static int mxc_nand_verify_buf(struct mtd_info *mtd, const u_char * buf, } /*! - * This function will enable NFC clock - * - */ -static inline void mxc_nand_clk_enable(void) -{ - if (!mxc_nand_data->clk_active) { - clk_enable(nfc_clk); - mxc_nand_data->clk_active = 1; - } -} - -/*! - * This function will disable NFC clock - * - */ -static inline void mxc_nand_clk_disable(void) -{ - if (mxc_nand_data->clk_active) { - clk_disable(nfc_clk); - mxc_nand_data->clk_active = 0; - } -} - -/*! * This function is used by upper layer for select and deselect of the NAND * chip * @@ -878,14 +852,13 @@ static void mxc_nand_select_chip(struct mtd_info *mtd, int chip) switch (chip) { case -1: /* Disable the NFC clock */ - mxc_nand_clk_disable(); - + clk_disable(nfc_clk); break; - case 0 ... NFC_GET_MAXCHIP_SP(): + case 0 ... 7: /* Enable the NFC clock */ - mxc_nand_clk_enable(); - NFC_SET_NFC_ACTIVE_CS(chip); + clk_enable(nfc_clk); + NFC_SET_NFC_ACTIVE_CS(chip); break; default: @@ -1257,10 +1230,9 @@ static int mxc_get_resources(struct platform_device *pdev) error = -ENXIO; goto out_2; } - nfc_irq = r->start; init_waitqueue_head(&irq_waitq); - error = request_irq(nfc_irq, mxc_nfc_irq, 0, "mxc_nd", NULL); + error = request_irq(r->start, mxc_nfc_irq, 0, "mxc_nd", NULL); if (error) goto out_3; @@ -1526,7 +1498,6 @@ static int __init mxcnd_probe(struct platform_device *pdev) nfc_clk = clk_get(&pdev->dev, "nfc_clk"); clk_enable(nfc_clk); - mxc_nand_data->clk_active = 1; if (hardware_ecc) { this->ecc.read_page = mxc_nand_read_page; @@ -1622,13 +1593,13 @@ static int __exit mxcnd_remove(struct platform_device *pdev) manage_sysfs_files(false); mxc_free_buf(); - mxc_nand_clk_disable(); + clk_disable(nfc_clk); clk_put(nfc_clk); platform_set_drvdata(pdev, NULL); if (mxc_nand_data) { nand_release(mtd); - free_irq(nfc_irq, NULL); + free_irq(MXC_INT_NANDFC, NULL); kfree(mxc_nand_data); } @@ -1653,7 +1624,7 @@ static int mxcnd_suspend(struct platform_device *pdev, pm_message_t state) DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND2 : NAND suspend\n"); /* Disable the NFC clock */ - mxc_nand_clk_disable(); + clk_disable(nfc_clk); return 0; } @@ -1672,7 +1643,7 @@ static int mxcnd_resume(struct platform_device *pdev) DEBUG(MTD_DEBUG_LEVEL0, "MXC_ND2 : NAND resume\n"); /* Enable the NFC clock */ - mxc_nand_clk_enable(); + clk_enable(nfc_clk); return 0; } diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 89bf85af642c..40b5658bdbe6 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -102,8 +102,8 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd, wmb(); ecc = in_be32(ndfc->ndfcbase + NDFC_ECC); /* The NDFC uses Smart Media (SMC) bytes order */ - ecc_code[0] = p[2]; - ecc_code[1] = p[1]; + ecc_code[0] = p[1]; + ecc_code[1] = p[2]; ecc_code[2] = p[3]; return 0; diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c index 3e164f0c9295..62d6a78c4eee 100644 --- a/drivers/mtd/ofpart.c +++ b/drivers/mtd/ofpart.c @@ -46,21 +46,12 @@ int __devinit of_mtd_parse_partitions(struct device *dev, const u32 *reg; int len; - /* check if this is a partition node */ - partname = of_get_property(pp, "name", &len); - if (strcmp(partname, "partition") != 0) { + reg = of_get_property(pp, "reg", &len); + if (!reg) { nr_parts--; continue; } - reg = of_get_property(pp, "reg", &len); - if (!reg || (len != 2 * sizeof(u32))) { - of_node_put(pp); - dev_err(dev, "Invalid 'reg' on %s\n", node->full_name); - kfree(*pparts); - *pparts = NULL; - return -EINVAL; - } (*pparts)[i].offset = reg[0]; (*pparts)[i].size = reg[1]; @@ -75,6 +66,14 @@ int __devinit of_mtd_parse_partitions(struct device *dev, i++; } + if (!i) { + of_node_put(pp); + dev_err(dev, "No valid partition found on %s\n", node->full_name); + kfree(*pparts); + *pparts = NULL; + return -EINVAL; + } + return nr_parts; } EXPORT_SYMBOL(of_mtd_parse_partitions); diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index f237ddbb2713..111ea41c4ecd 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -853,7 +853,6 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd, break; } - req.name[req.name_len] = '\0'; err = verify_mkvol_req(ubi, &req); if (err) break; |