Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote branch 'qi-kernel/jz-2.6.34' into jz-2.6.34

  • Loading branch information...
commit 401472a707eb2a8005cd60e665e2a2fc9fe43269 2 parents 56dbbbd + d2d5cee
@mthuurne authored
View
0  include/linux/mmc/jz4740_mmc.h → ...mips/include/asm/mach-jz4740/jz4740_mmc.h
File renamed without changes
View
3  arch/mips/jz4740/board-qi_lb60.c
@@ -29,7 +29,8 @@
#include <linux/power_supply.h>
#include <linux/power/jz4740-battery.h>
#include <linux/power/gpio-charger.h>
-#include <linux/mmc/jz4740_mmc.h>
+
+#include <asm/mach-jz4740/jz4740_mmc.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
View
2  arch/mips/jz4740/clock.c
@@ -997,7 +997,7 @@ struct clk *clk_get(struct device *dev, const char *name)
if (strcmp(clk->name, name) == 0)
return clk;
}
- return ERR_PTR(-ENOENT);
+ return ERR_PTR(-ENXIO);
}
EXPORT_SYMBOL_GPL(clk_get);
View
2  arch/mips/jz4740/pwm.c
@@ -49,7 +49,7 @@ struct pwm_device *pwm_request(int id, const char *label)
struct pwm_device *pwm;
if (id < 2 || id > 7 || !jz4740_pwm_clk)
- return ERR_PTR(-ENOENT);
+ return ERR_PTR(-ENODEV);
mutex_lock(&jz4740_pwm_mutex);
View
402 drivers/mmc/host/jz4740_mmc.c
@@ -22,9 +22,6 @@
#include <linux/delay.h>
#include <linux/scatterlist.h>
#include <linux/clk.h>
-#include <linux/mmc/jz4740_mmc.h>
-
-#include <linux/completion.h>
#include <linux/bitops.h>
#include <linux/gpio.h>
@@ -32,6 +29,7 @@
#include <asm/cacheflush.h>
#include <linux/dma-mapping.h>
+#include <asm/mach-jz4740/jz4740_mmc.h>
#define JZ_REG_MMC_STRPCL 0x00
#define JZ_REG_MMC_STATUS 0x04
@@ -105,6 +103,13 @@
#define JZ_MMC_CLK_RATE 24000000
+enum jz4740_mmc_state {
+ JZ4740_MMC_STATE_READ_RESPONSE,
+ JZ4740_MMC_STATE_TRANSFER_DATA,
+ JZ4740_MMC_STATE_SEND_STOP,
+ JZ4740_MMC_STATE_DONE,
+};
+
struct jz4740_mmc_host {
struct mmc_host *mmc;
struct platform_device *pdev;
@@ -121,7 +126,6 @@ struct jz4740_mmc_host {
unsigned long waiting;
- int max_clock;
uint32_t cmdat;
uint16_t irq_mask;
@@ -129,7 +133,8 @@ struct jz4740_mmc_host {
spinlock_t lock;
struct timer_list timeout_timer;
- struct completion completion;
+ struct sg_mapping_iter miter;
+ enum jz4740_mmc_state state;
};
static void jz4740_mmc_set_irq_enabled(struct jz4740_mmc_host *host,
@@ -161,22 +166,24 @@ static void jz4740_mmc_clock_enable(struct jz4740_mmc_host *host,
static void jz4740_mmc_clock_disable(struct jz4740_mmc_host *host)
{
uint32_t status;
+ unsigned int timeout = 1000;
writew(JZ_MMC_STRPCL_CLOCK_STOP, host->base + JZ_REG_MMC_STRPCL);
do {
status = readl(host->base + JZ_REG_MMC_STATUS);
- } while (status & JZ_MMC_STATUS_CLK_EN);
+ } while (status & JZ_MMC_STATUS_CLK_EN && --timeout);
}
static void jz4740_mmc_reset(struct jz4740_mmc_host *host)
{
uint32_t status;
+ unsigned int timeout = 1000;
writew(JZ_MMC_STRPCL_RESET, host->base + JZ_REG_MMC_STRPCL);
udelay(10);
do {
status = readl(host->base + JZ_REG_MMC_STATUS);
- } while (status & JZ_MMC_STATUS_IS_RESETTING);
+ } while (status & JZ_MMC_STATUS_IS_RESETTING && --timeout);
}
static void jz4740_mmc_request_done(struct jz4740_mmc_host *host)
@@ -188,7 +195,7 @@ static void jz4740_mmc_request_done(struct jz4740_mmc_host *host)
mmc_request_done(host->mmc, req);
}
-static unsigned int jz4740_mmc_wait_irq(struct jz4740_mmc_host *host,
+static unsigned int jz4740_mmc_poll_irq(struct jz4740_mmc_host *host,
unsigned int irq)
{
unsigned int timeout = 1000;
@@ -199,35 +206,49 @@ static unsigned int jz4740_mmc_wait_irq(struct jz4740_mmc_host *host,
} while (!(status & irq) && --timeout);
if (timeout == 0) {
- INIT_COMPLETION(host->completion);
+ set_bit(0, &host->waiting);
+ mod_timer(&host->timeout_timer, jiffies + 5*HZ);
jz4740_mmc_set_irq_enabled(host, irq, true);
- timeout = wait_for_completion_timeout(&host->completion, HZ);
+ return true;
}
- return timeout;
+ return false;
}
-static void jz4740_mmc_write_data(struct jz4740_mmc_host *host,
+static void jz4740_mmc_transfer_check_state(struct jz4740_mmc_host *host,
struct mmc_data *data)
{
- struct sg_mapping_iter miter;
- uint32_t *buf;
int status;
- unsigned int timeout;
+
+ status = readl(host->base + JZ_REG_MMC_STATUS);
+ if (status & JZ_MMC_STATUS_WRITE_ERROR_MASK) {
+ if (status & (JZ_MMC_STATUS_TIMEOUT_WRITE)) {
+ host->req->cmd->error = -ETIMEDOUT;
+ data->error = -ETIMEDOUT;
+ } else {
+ host->req->cmd->error = -EIO;
+ data->error = -EIO;
+ }
+ }
+}
+
+static bool jz4740_mmc_write_data(struct jz4740_mmc_host *host,
+ struct mmc_data *data)
+{
+ struct sg_mapping_iter *miter = &host->miter;
+ uint32_t *buf;
+ bool timeout;
size_t i, j;
- sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG);
- while (sg_miter_next(&miter)) {
- buf = miter.addr;
- i = miter.length / 4;
- j = i >> 3;
+ while (sg_miter_next(miter)) {
+ buf = miter->addr;
+ i = miter->length / 4;
+ j = i / 8;
i = i & 0x7;
while (j) {
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
- if (unlikely(timeout == 0)) {
- sg_miter_stop(&miter);
- goto err_timeout;
- }
+ timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
+ if (unlikely(timeout))
+ goto poll_timeout;
writel(buf[0], host->base + JZ_REG_MMC_TXFIFO);
writel(buf[1], host->base + JZ_REG_MMC_TXFIFO);
@@ -241,11 +262,9 @@ static void jz4740_mmc_write_data(struct jz4740_mmc_host *host,
--j;
}
if (unlikely(i)) {
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
- if (unlikely(timeout == 0)) {
- sg_miter_stop(&miter);
- goto err_timeout;
- }
+ timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_TXFIFO_WR_REQ);
+ if (unlikely(timeout))
+ goto poll_timeout;
while (i) {
writel(*buf, host->base + JZ_REG_MMC_TXFIFO);
@@ -253,57 +272,39 @@ static void jz4740_mmc_write_data(struct jz4740_mmc_host *host,
--i;
}
}
- data->bytes_xfered += miter.length;
+ data->bytes_xfered += miter->length;
}
- sg_miter_stop(&miter);
+ sg_miter_stop(miter);
- status = readl(host->base + JZ_REG_MMC_STATUS);
- if (status & JZ_MMC_STATUS_WRITE_ERROR_MASK) {
- if (status & (JZ_MMC_STATUS_TIMEOUT_WRITE)) {
- host->req->cmd->error = -ETIMEDOUT;
- data->error = -ETIMEDOUT;
- } else {
- host->req->cmd->error = -EIO;
- data->error = -EIO;
- }
- return;
- }
-
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_DATA_TRAN_DONE);
- if (unlikely(timeout == 0))
- goto err_timeout;
-
- writew(JZ_MMC_IRQ_DATA_TRAN_DONE, host->base + JZ_REG_MMC_IREG);
+ return false;
- return;
+poll_timeout:
+ miter->consumed = (void *)buf - miter->addr;
+ data->bytes_xfered += miter->consumed;
+ sg_miter_stop(miter);
-err_timeout:
- host->req->cmd->error = -ETIMEDOUT;
- data->error = -ETIMEDOUT;
+ return true;
}
-static void jz4740_mmc_read_data(struct jz4740_mmc_host *host,
+static bool jz4740_mmc_read_data(struct jz4740_mmc_host *host,
struct mmc_data *data)
{
- struct sg_mapping_iter miter;
+ struct sg_mapping_iter *miter = &host->miter;
uint32_t *buf;
uint32_t d;
- uint16_t status = 0;
+ uint16_t status;
size_t i, j;
unsigned int timeout;
- sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG);
- while (sg_miter_next(&miter)) {
- buf = miter.addr;
- i = miter.length;
- j = i >> 5;
+ while (sg_miter_next(miter)) {
+ buf = miter->addr;
+ i = miter->length;
+ j = i / 32;
i = i & 0x1f;
while (j) {
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_RXFIFO_RD_REQ);
- if (unlikely(timeout == 0)) {
- sg_miter_stop(&miter);
- goto err_timeout;
- }
+ timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_RXFIFO_RD_REQ);
+ if (unlikely(timeout))
+ goto poll_timeout;
buf[0] = readl(host->base + JZ_REG_MMC_RXFIFO);
buf[1] = readl(host->base + JZ_REG_MMC_RXFIFO);
@@ -318,50 +319,45 @@ static void jz4740_mmc_read_data(struct jz4740_mmc_host *host,
--j;
}
- while (i >= 4) {
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_RXFIFO_RD_REQ);
- if (unlikely(timeout == 0)) {
- sg_miter_stop(&miter);
- goto err_timeout;
- }
+ if (unlikely(i)) {
+ timeout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_RXFIFO_RD_REQ);
+ if (unlikely(timeout))
+ goto poll_timeout;
- *buf++ = readl(host->base + JZ_REG_MMC_RXFIFO);
- i -= 4;
- }
- if (unlikely(i > 0)) {
- d = readl(host->base + JZ_REG_MMC_RXFIFO);
- memcpy(buf, &d, i);
+ while (i >= 4) {
+ *buf++ = readl(host->base + JZ_REG_MMC_RXFIFO);
+ i -= 4;
+ }
+ if (unlikely(i > 0)) {
+ d = readl(host->base + JZ_REG_MMC_RXFIFO);
+ memcpy(buf, &d, i);
+ }
}
- data->bytes_xfered += miter.length;
-
- /* This can go away once MIPS implements flush_kernel_dcache_page */
- flush_dcache_page(miter.page);
- }
- sg_miter_stop(&miter);
+ data->bytes_xfered += miter->length;
- status = readl(host->base + JZ_REG_MMC_STATUS);
- if (status & JZ_MMC_STATUS_READ_ERROR_MASK) {
- if (status & JZ_MMC_STATUS_TIMEOUT_READ) {
- host->req->cmd->error = -ETIMEDOUT;
- data->error = -ETIMEDOUT;
- } else {
- host->req->cmd->error = -EIO;
- data->error = -EIO;
- }
- return;
+ /* This can go away once MIPS implements
+ * flush_kernel_dcache_page */
+ flush_dcache_page(miter->page);
}
+ sg_miter_stop(miter);
/* For whatever reason there is sometime one word more in the fifo then
* requested */
- while ((status & JZ_MMC_STATUS_DATA_FIFO_EMPTY) == 0 && --timeout) {
+ timeout = 1000;
+ status = readl(host->base + JZ_REG_MMC_STATUS);
+ while (!(status & JZ_MMC_STATUS_DATA_FIFO_EMPTY) && --timeout) {
d = readl(host->base + JZ_REG_MMC_RXFIFO);
status = readl(host->base + JZ_REG_MMC_STATUS);
}
- return;
-err_timeout:
- host->req->cmd->error = -ETIMEDOUT;
- data->error = -ETIMEDOUT;
+ return false;
+
+poll_timeout:
+ miter->consumed = (void *)buf - miter->addr;
+ data->bytes_xfered += miter->consumed;
+ sg_miter_stop(miter);
+
+ return true;
}
static void jz4740_mmc_timeout(unsigned long data)
@@ -387,7 +383,8 @@ static void jz4740_mmc_read_response(struct jz4740_mmc_host *host,
tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
for (i = 0; i < 4; ++i) {
cmd->resp[i] = tmp << 24;
- cmd->resp[i] |= readw(host->base + JZ_REG_MMC_RESP_FIFO) << 8;
+ tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
+ cmd->resp[i] |= tmp << 8;
tmp = readw(host->base + JZ_REG_MMC_RESP_FIFO);
cmd->resp[i] |= tmp >> 8;
}
@@ -444,40 +441,78 @@ static void jz4740_mmc_send_command(struct jz4740_mmc_host *host,
jz4740_mmc_clock_enable(host, 1);
}
+static void jz_mmc_prepare_data_transfer(struct jz4740_mmc_host *host)
+{
+ struct mmc_command *cmd = host->req->cmd;
+ struct mmc_data *data = cmd->data;
+ int direction;
+
+ if (cmd->data->flags & MMC_DATA_READ)
+ direction = SG_MITER_TO_SG;
+ else
+ direction = SG_MITER_FROM_SG;
+
+ sg_miter_start(&host->miter, data->sg, data->sg_len, direction);
+}
+
static irqreturn_t jz_mmc_irq_worker(int irq, void *devid)
{
struct jz4740_mmc_host *host = (struct jz4740_mmc_host *)devid;
struct mmc_command *cmd = host->req->cmd;
struct mmc_request *req = host->req;
- unsigned int timeout;
+ bool timedout = false;
if (cmd->error)
- goto done;
+ host->state = JZ4740_MMC_STATE_DONE;
- if (cmd->flags & MMC_RSP_PRESENT)
- jz4740_mmc_read_response(host, cmd);
+ switch (host->state) {
+ case JZ4740_MMC_STATE_READ_RESPONSE:
+ if (cmd->flags & MMC_RSP_PRESENT)
+ jz4740_mmc_read_response(host, cmd);
- if (cmd->data) {
+ if (!cmd->data)
+ break;
+
+ jz_mmc_prepare_data_transfer(host);
+
+ case JZ4740_MMC_STATE_TRANSFER_DATA:
if (cmd->data->flags & MMC_DATA_READ)
- jz4740_mmc_read_data(host, cmd->data);
+ timedout = jz4740_mmc_read_data(host, cmd->data);
else
- jz4740_mmc_write_data(host, cmd->data);
- }
+ timedout = jz4740_mmc_write_data(host, cmd->data);
- if (req->stop) {
- jz4740_mmc_send_command(host, req->stop);
+ if (unlikely(timedout)) {
+ host->state = JZ4740_MMC_STATE_TRANSFER_DATA;
+ break;
+ }
- timeout = jz4740_mmc_wait_irq(host, JZ_MMC_IRQ_PRG_DONE);
- writew(JZ_MMC_IRQ_PRG_DONE, host->base + JZ_REG_MMC_IREG);
+ jz4740_mmc_transfer_check_state(host, cmd->data);
- if (unlikely(timeout == 0))
- req->stop->error = -ETIMEDOUT;
- }
+ timedout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_DATA_TRAN_DONE);
+ if (unlikely(timedout)) {
+ host->state = JZ4740_MMC_STATE_SEND_STOP;
+ break;
+ }
+ writew(JZ_MMC_IRQ_DATA_TRAN_DONE, host->base + JZ_REG_MMC_IREG);
+ case JZ4740_MMC_STATE_SEND_STOP:
+ if (!req->stop)
+ break;
-done:
- jz4740_mmc_request_done(host);
+ jz4740_mmc_send_command(host, req->stop);
+
+ timedout = jz4740_mmc_poll_irq(host, JZ_MMC_IRQ_PRG_DONE);
+ if (timedout) {
+ host->state = JZ4740_MMC_STATE_DONE;
+ break;
+ }
+ case JZ4740_MMC_STATE_DONE:
+ break;
+ }
+
+ if (!timedout)
+ jz4740_mmc_request_done(host);
return IRQ_HANDLED;
}
@@ -486,7 +521,6 @@ static irqreturn_t jz_mmc_irq(int irq, void *devid)
{
struct jz4740_mmc_host *host = devid;
uint16_t irq_reg, status, tmp;
- irqreturn_t ret = IRQ_HANDLED;
irq_reg = readw(host->base + JZ_REG_MMC_IREG);
@@ -502,13 +536,10 @@ static irqreturn_t jz_mmc_irq(int irq, void *devid)
if (irq_reg & JZ_MMC_IRQ_SDIO) {
writew(JZ_MMC_IRQ_SDIO, host->base + JZ_REG_MMC_IREG);
mmc_signal_sdio_irq(host->mmc);
+ irq_reg &= ~JZ_MMC_IRQ_SDIO;
}
- if (!host->req || !host->cmd)
- goto handled;
-
- if (irq_reg & JZ_MMC_IRQ_END_CMD_RES) {
-
+ if (host->req && host->cmd && irq_reg) {
if (test_and_clear_bit(0, &host->waiting)) {
del_timer(&host->timeout_timer);
@@ -526,19 +557,14 @@ static irqreturn_t jz_mmc_irq(int irq, void *devid)
host->cmd->data->error = -EIO;
}
- ret = IRQ_WAKE_THREAD;
- }
+ jz4740_mmc_set_irq_enabled(host, irq_reg, false);
+ writew(irq_reg, host->base + JZ_REG_MMC_IREG);
- jz4740_mmc_set_irq_enabled(host, JZ_MMC_IRQ_END_CMD_RES, false);
- writew(JZ_MMC_IRQ_END_CMD_RES, host->base + JZ_REG_MMC_IREG);
- } else {
- complete(&host->completion);
- jz4740_mmc_set_irq_enabled(host, irq_reg, false);
- writew(irq_reg, host->base + JZ_REG_MMC_IREG);
+ return IRQ_WAKE_THREAD;
+ }
}
-handled:
- return ret;
+ return IRQ_HANDLED;
}
static int jz4740_mmc_set_clock_rate(struct jz4740_mmc_host *host, int rate)
@@ -571,6 +597,7 @@ static void jz4740_mmc_request(struct mmc_host *mmc, struct mmc_request *req)
writew(JZ_MMC_IRQ_END_CMD_RES, host->base + JZ_REG_MMC_IREG);
jz4740_mmc_set_irq_enabled(host, JZ_MMC_IRQ_END_CMD_RES, true);
+ host->state = JZ4740_MMC_STATE_READ_RESPONSE;
set_bit(0, &host->waiting);
mod_timer(&host->timeout_timer, jiffies + 5*HZ);
jz4740_mmc_send_command(host, req->cmd);
@@ -637,7 +664,7 @@ static irqreturn_t jz4740_mmc_card_detect_irq(int irq, void *devid)
{
struct jz4740_mmc_host *host = devid;
- mmc_detect_change(host->mmc, HZ / 3);
+ mmc_detect_change(host->mmc, HZ / 2);
return IRQ_HANDLED;
}
@@ -665,6 +692,28 @@ static const struct jz_gpio_bulk_request jz4740_mmc_pins[] = {
JZ_GPIO_BULK_PIN(MSC_DATA3),
};
+static int __devinit jz4740_mmc_request_gpio(struct device *dev, int gpio,
+ const char *name, bool output, int value)
+{
+ int ret;
+
+ if (!gpio_is_valid(gpio))
+ return 0;
+
+ ret = gpio_request(gpio, name);
+ if (ret) {
+ dev_err(dev, "Failed to request %s gpio: %d\n", name, ret);
+ return ret;
+ }
+
+ if (output)
+ gpio_direction_output(gpio, value);
+ else
+ gpio_direction_input(gpio);
+
+ return 0;
+}
+
static int __devinit jz4740_mmc_request_gpios(struct platform_device *pdev)
{
int ret;
@@ -673,32 +722,20 @@ static int __devinit jz4740_mmc_request_gpios(struct platform_device *pdev)
if (!pdata)
return 0;
- if (gpio_is_valid(pdata->gpio_card_detect)) {
- ret = gpio_request(pdata->gpio_card_detect, "MMC detect change");
- if (ret) {
- dev_err(&pdev->dev, "Failed to request detect change gpio\n");
- goto err;
- }
- gpio_direction_input(pdata->gpio_card_detect);
- }
+ ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_card_detect,
+ "MMC detect change", false, 0);
+ if (ret)
+ goto err;
- if (gpio_is_valid(pdata->gpio_read_only)) {
- ret = gpio_request(pdata->gpio_read_only, "MMC read only");
- if (ret) {
- dev_err(&pdev->dev, "Failed to request read only gpio: %d\n", ret);
- goto err_free_gpio_card_detect;
- }
- gpio_direction_input(pdata->gpio_read_only);
- }
+ ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_read_only,
+ "MMC read only", false, 0);
+ if (ret)
+ goto err_free_gpio_card_detect;
- if (gpio_is_valid(pdata->gpio_power)) {
- ret = gpio_request(pdata->gpio_power, "MMC power");
- if (ret) {
- dev_err(&pdev->dev, "Failed to request power gpio: %d\n", ret);
- goto err_free_gpio_read_only;
- }
- gpio_direction_output(pdata->gpio_power, pdata->power_active_low);
- }
+ ret = jz4740_mmc_request_gpio(&pdev->dev, pdata->gpio_power,
+ "MMC read only", true, pdata->power_active_low);
+ if (ret)
+ goto err_free_gpio_read_only;
return 0;
@@ -712,6 +749,29 @@ static int __devinit jz4740_mmc_request_gpios(struct platform_device *pdev)
return ret;
}
+static int __devinit jz4740_mmc_request_cd_irq(struct platform_device *pdev,
+ struct jz4740_mmc_host *host)
+{
+ int ret;
+ struct jz4740_mmc_platform_data *pdata = pdev->dev.platform_data;
+
+ if (gpio_is_valid(pdata->gpio_card_detect))
+ return 0;
+
+ host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
+
+ if (host->card_detect_irq < 0) {
+ dev_warn(&pdev->dev, "Failed to get card detect irq\n");
+ return 0;
+ }
+ return request_irq(host->card_detect_irq, jz4740_mmc_card_detect_irq,
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+ "MMC card detect", host);
+
+
+ return ret;
+}
+
static void jz4740_mmc_free_gpios(struct platform_device *pdev)
{
struct jz4740_mmc_platform_data *pdata = pdev->dev.platform_data;
@@ -762,9 +822,9 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev)
}
host->clk = clk_get(&pdev->dev, "mmc");
- if (!host->clk) {
- ret = -ENOENT;
- dev_err(&pdev->dev, "Failed to get mmc clock\n");
+ if (IS_ERR(host->clk)) {
+ ret = PTR_ERR(host->clk);
+ dev_err(&pdev->dev, "Failed to get mmc clock: %d\n", ret);
goto err_free_host;
}
@@ -817,24 +877,13 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev)
host->mmc = mmc;
host->pdev = pdev;
- host->max_clock = JZ_MMC_CLK_RATE;
spin_lock_init(&host->lock);
host->irq_mask = 0xffff;
- host->card_detect_irq = gpio_to_irq(pdata->gpio_card_detect);
-
- if (host->card_detect_irq < 0) {
- dev_warn(&pdev->dev, "Failed to get irq for card detect gpio\n");
- } else {
- ret = request_irq(host->card_detect_irq,
- jz4740_mmc_card_detect_irq,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- "MMC card detect", host);
-
- if (ret) {
- dev_err(&pdev->dev, "Failed to request card detect irq");
- goto err_free_gpios;
- }
+ ret = jz4740_mmc_request_cd_irq(pdev, host);
+ if (ret) {
+ dev_err(&pdev->dev, "Failed to request card detect irq\n");
+ goto err_free_gpios;
}
ret = request_threaded_irq(host->irq, jz_mmc_irq, jz_mmc_irq_worker,
@@ -848,7 +897,6 @@ static int __devinit jz4740_mmc_probe(struct platform_device* pdev)
jz4740_mmc_clock_disable(host);
setup_timer(&host->timeout_timer, jz4740_mmc_timeout,
(unsigned long)host);
- init_completion(&host->completion);
platform_set_drvdata(pdev, host);
ret = mmc_add_host(mmc);
View
2  drivers/mtd/nand/jz4740_nand.c
@@ -317,7 +317,7 @@ static int __devinit jz_nand_probe(struct platform_device *pdev)
nand->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!nand->mem) {
dev_err(&pdev->dev, "Failed to get platform mmio memory\n");
- ret = -ENOENT;
+ ret = -ENXIO;
goto err_free;
}
View
6 drivers/rtc/rtc-jz4740.c
@@ -227,14 +227,14 @@ static int __devinit jz4740_rtc_probe(struct platform_device *pdev)
rtc->irq = platform_get_irq(pdev, 0);
if (rtc->irq < 0) {
- ret = -ENOENT;
- dev_err(&pdev->dev, "Failed to get platform irq\n");
+ ret = rtc->irq;
+ dev_err(&pdev->dev, "Failed to get platform irq: %d\n", ret);
goto err_free;
}
rtc->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!rtc->mem) {
- ret = -ENOENT;
+ ret = -ENXIO;
dev_err(&pdev->dev, "Failed to get platform mmio memory\n");
goto err_free;
}
View
2  drivers/usb/host/ohci-jz4740.c
@@ -144,7 +144,7 @@ static __devinit int jz4740_ohci_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev, "Failed to get platform resource\n");
- return -ENOENT;
+ return -ENXIO;
}
irq = platform_get_irq(pdev, 0);
View
4 drivers/video/jz4740_fb.c
@@ -523,13 +523,13 @@ static int __devinit jzfb_probe(struct platform_device *pdev)
if (!pdata) {
dev_err(&pdev->dev, "Missing platform data\n");
- return -ENOENT;
+ return -ENXIO;
}
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(&pdev->dev, "Failed to get register memory resource\n");
- return -ENOENT;
+ return -ENXIO;
}
mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
Please sign in to comment.
Something went wrong with that request. Please try again.