git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
mmc
/
pxamci.c
diff --git
a/drivers/mmc/pxamci.c
b/drivers/mmc/pxamci.c
index
285d7d0
..
6073d99
100644
(file)
--- a/
drivers/mmc/pxamci.c
+++ b/
drivers/mmc/pxamci.c
@@
-16,7
+16,6
@@
* 1 and 3 byte data transfers not supported
* max block length up to 1023
*/
* 1 and 3 byte data transfers not supported
* max block length up to 1023
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/ioport.h>
@@
-37,12
+36,6
@@
#include "pxamci.h"
#include "pxamci.h"
-#ifdef CONFIG_MMC_DEBUG
-#define DBG(x...) printk(KERN_DEBUG x)
-#else
-#define DBG(x...) do { } while (0)
-#endif
-
#define DRIVER_NAME "pxa2xx-mci"
#define NR_SG 1
#define DRIVER_NAME "pxa2xx-mci"
#define NR_SG 1
@@
-71,11
+64,6
@@
struct pxamci_host {
unsigned int dma_dir;
};
unsigned int dma_dir;
};
-static inline unsigned int ns_to_clocks(unsigned int ns)
-{
- return (ns * (CLOCKRATE / 1000000) + 999) / 1000;
-}
-
static void pxamci_stop_clock(struct pxamci_host *host)
{
if (readl(host->base + MMC_STAT) & STAT_CLK_EN) {
static void pxamci_stop_clock(struct pxamci_host *host)
{
if (readl(host->base + MMC_STAT) & STAT_CLK_EN) {
@@
-119,6
+107,7
@@
static void pxamci_disable_irq(struct pxamci_host *host, unsigned int mask)
static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
{
unsigned int nob = data->blocks;
static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
{
unsigned int nob = data->blocks;
+ unsigned long long clks;
unsigned int timeout;
u32 dcmd;
int i;
unsigned int timeout;
u32 dcmd;
int i;
@@
-129,9
+118,11
@@
static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data)
nob = 0xffff;
writel(nob, host->base + MMC_NOB);
nob = 0xffff;
writel(nob, host->base + MMC_NOB);
- writel(
1 << data->blksz_bits
, host->base + MMC_BLKLEN);
+ writel(
data->blksz
, host->base + MMC_BLKLEN);
- timeout = ns_to_clocks(data->timeout_ns) + data->timeout_clks;
+ clks = (unsigned long long)data->timeout_ns * CLOCKRATE;
+ do_div(clks, 1000000000UL);
+ timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt);
writel((timeout + 255) / 256, host->base + MMC_RDTO);
if (data->flags & MMC_DATA_READ) {
writel((timeout + 255) / 256, host->base + MMC_RDTO);
if (data->flags & MMC_DATA_READ) {
@@
-180,7
+171,7
@@
static void pxamci_start_cmd(struct pxamci_host *host, struct mmc_command *cmd,
#define RSP_TYPE(x) ((x) & ~(MMC_RSP_BUSY|MMC_RSP_OPCODE))
switch (RSP_TYPE(mmc_resp_type(cmd))) {
#define RSP_TYPE(x) ((x) & ~(MMC_RSP_BUSY|MMC_RSP_OPCODE))
switch (RSP_TYPE(mmc_resp_type(cmd))) {
- case RSP_TYPE(MMC_RSP_R1): /* r1, r1b, r6 */
+ case RSP_TYPE(MMC_RSP_R1): /* r1, r1b, r6
, r7
*/
cmdat |= CMDAT_RESP_SHORT;
break;
case RSP_TYPE(MMC_RSP_R3):
cmdat |= CMDAT_RESP_SHORT;
break;
case RSP_TYPE(MMC_RSP_R3):
@@
-206,7
+197,6
@@
static void pxamci_start_cmd(struct pxamci_host *host, struct mmc_command *cmd,
static void pxamci_finish_request(struct pxamci_host *host, struct mmc_request *mrq)
{
static void pxamci_finish_request(struct pxamci_host *host, struct mmc_request *mrq)
{
- DBG("PXAMCI: request done\n");
host->mrq = NULL;
host->cmd = NULL;
host->data = NULL;
host->mrq = NULL;
host->cmd = NULL;
host->data = NULL;
@@
-252,7
+242,7
@@
static int pxamci_cmd_done(struct pxamci_host *host, unsigned int stat)
if ((cmd->resp[0] & 0x80000000) == 0)
cmd->error = MMC_ERR_BADCRC;
} else {
if ((cmd->resp[0] & 0x80000000) == 0)
cmd->error = MMC_ERR_BADCRC;
} else {
-
DBG
("ignoring CRC from command %d - *risky*\n",cmd->opcode);
+
pr_debug
("ignoring CRC from command %d - *risky*\n",cmd->opcode);
}
#else
cmd->error = MMC_ERR_BADCRC;
}
#else
cmd->error = MMC_ERR_BADCRC;
@@
-292,14
+282,14
@@
static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
* data blocks as being in error.
*/
if (data->error == MMC_ERR_NONE)
* data blocks as being in error.
*/
if (data->error == MMC_ERR_NONE)
- data->bytes_xfered = data->blocks
<< data->blksz_bits
;
+ data->bytes_xfered = data->blocks
* data->blksz
;
else
data->bytes_xfered = 0;
pxamci_disable_irq(host, DATA_TRAN_DONE);
host->data = NULL;
else
data->bytes_xfered = 0;
pxamci_disable_irq(host, DATA_TRAN_DONE);
host->data = NULL;
- if (host->mrq->stop
&& data->error == MMC_ERR_NONE
) {
+ if (host->mrq->stop) {
pxamci_stop_clock(host);
pxamci_start_cmd(host, host->mrq->stop, 0);
} else {
pxamci_stop_clock(host);
pxamci_start_cmd(host, host->mrq->stop, 0);
} else {
@@
-309,7
+299,7
@@
static int pxamci_data_done(struct pxamci_host *host, unsigned int stat)
return 1;
}
return 1;
}
-static irqreturn_t pxamci_irq(int irq, void *devid
, struct pt_regs *regs
)
+static irqreturn_t pxamci_irq(int irq, void *devid)
{
struct pxamci_host *host = devid;
unsigned int ireg;
{
struct pxamci_host *host = devid;
unsigned int ireg;
@@
-317,12
+307,10
@@
static irqreturn_t pxamci_irq(int irq, void *devid, struct pt_regs *regs)
ireg = readl(host->base + MMC_I_REG);
ireg = readl(host->base + MMC_I_REG);
- DBG("PXAMCI: irq %08x\n", ireg);
-
if (ireg) {
unsigned stat = readl(host->base + MMC_STAT);
if (ireg) {
unsigned stat = readl(host->base + MMC_STAT);
-
DBG("PXAMCI: stat %08x\n"
, stat);
+
pr_debug("PXAMCI: irq %08x stat %08x\n", ireg
, stat);
if (ireg & END_CMD_RES)
handled |= pxamci_cmd_done(host, stat);
if (ireg & END_CMD_RES)
handled |= pxamci_cmd_done(host, stat);
@@
-367,7
+355,7
@@
static int pxamci_get_ro(struct mmc_host *mmc)
struct pxamci_host *host = mmc_priv(mmc);
if (host->pdata && host->pdata->get_ro)
struct pxamci_host *host = mmc_priv(mmc);
if (host->pdata && host->pdata->get_ro)
- return host->pdata->get_ro(mmc
->dev
);
+ return host->pdata->get_ro(mmc
_dev(mmc)
);
/* Host doesn't support read only detection so assume writeable */
return 0;
}
/* Host doesn't support read only detection so assume writeable */
return 0;
}
@@
-376,10
+364,6
@@
static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct pxamci_host *host = mmc_priv(mmc);
{
struct pxamci_host *host = mmc_priv(mmc);
- DBG("pxamci_set_ios: clock %u power %u vdd %u.%02u\n",
- ios->clock, ios->power_mode, ios->vdd / 100,
- ios->vdd % 100);
-
if (ios->clock) {
unsigned int clk = CLOCKRATE / ios->clock;
if (CLOCKRATE / clk > ios->clock)
if (ios->clock) {
unsigned int clk = CLOCKRATE / ios->clock;
if (CLOCKRATE / clk > ios->clock)
@@
-399,29
+383,29
@@
static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->power_mode = ios->power_mode;
if (host->pdata && host->pdata->setpower)
host->power_mode = ios->power_mode;
if (host->pdata && host->pdata->setpower)
- host->pdata->setpower(mmc
->dev
, ios->vdd);
+ host->pdata->setpower(mmc
_dev(mmc)
, ios->vdd);
if (ios->power_mode == MMC_POWER_ON)
host->cmdat |= CMDAT_INIT;
}
if (ios->power_mode == MMC_POWER_ON)
host->cmdat |= CMDAT_INIT;
}
-
DBG("pxamci_set_ios
: clkrt = %x cmdat = %x\n",
- host->clkrt, host->cmdat);
+
pr_debug("PXAMCI
: clkrt = %x cmdat = %x\n",
+
host->clkrt, host->cmdat);
}
}
-static struct mmc_host_ops pxamci_ops = {
+static
const
struct mmc_host_ops pxamci_ops = {
.request = pxamci_request,
.get_ro = pxamci_get_ro,
.set_ios = pxamci_set_ios,
};
.request = pxamci_request,
.get_ro = pxamci_get_ro,
.set_ios = pxamci_set_ios,
};
-static void pxamci_dma_irq(int dma, void *devid
, struct pt_regs *regs
)
+static void pxamci_dma_irq(int dma, void *devid)
{
printk(KERN_ERR "DMA%d: IRQ???\n", dma);
DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
}
{
printk(KERN_ERR "DMA%d: IRQ???\n", dma);
DCSR(dma) = DCSR_STARTINTR|DCSR_ENDINTR|DCSR_BUSERR;
}
-static irqreturn_t pxamci_detect_irq(int irq, void *devid
, struct pt_regs *regs
)
+static irqreturn_t pxamci_detect_irq(int irq, void *devid)
{
struct pxamci_host *host = mmc_priv(devid);
{
struct pxamci_host *host = mmc_priv(devid);
@@
-438,7
+422,7
@@
static int pxamci_probe(struct platform_device *pdev)
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
- if (!r || irq
== NO_IRQ
)
+ if (!r || irq
< 0
)
return -ENXIO;
r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);
return -ENXIO;
r = request_mem_region(r->start, SZ_4K, DRIVER_NAME);