summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/gpmi-nfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand/gpmi-nfc')
-rw-r--r--drivers/mtd/nand/gpmi-nfc/Makefile1
-rw-r--r--drivers/mtd/nand/gpmi-nfc/gpmi-nfc-main.c65
-rw-r--r--drivers/mtd/nand/gpmi-nfc/gpmi-nfc-mil.c41
-rw-r--r--drivers/mtd/nand/gpmi-nfc/gpmi-nfc.h8
4 files changed, 26 insertions, 89 deletions
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 */