Commit a3a2773c authored by Bernard Blackham's avatar Bernard Blackham Committed by Kevin Hilman

MMC: DaVinci: make checkpatch.pl compliant

Make davinci-mmc mostly scripts/checkpatch.pl compliant.
Signed-off-by: default avatarBernard Blackham <bernard@largestprime.net>
Signed-off-by: default avatarKevin Hilman <khilman@mvista.com>
parent 4fa9b14c
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
...@@ -41,11 +40,11 @@ ...@@ -41,11 +40,11 @@
#include <linux/mmc/host.h> #include <linux/mmc/host.h>
#include <linux/mmc/card.h> #include <linux/mmc/card.h>
#include <linux/mmc/mmc.h> #include <linux/mmc/mmc.h>
#include <asm/io.h> #include <linux/io.h>
#include <asm/irq.h> #include <linux/irq.h>
#include <asm/hardware.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <asm/hardware.h>
#include <asm/arch/irqs.h> #include <asm/arch/irqs.h>
#include <asm/arch/hardware.h> #include <asm/arch/hardware.h>
...@@ -68,8 +67,8 @@ extern void davinci_clean_channel(int ch_no); ...@@ -68,8 +67,8 @@ extern void davinci_clean_channel(int ch_no);
#define MULTIPILER_TO_HZ 1 #define MULTIPILER_TO_HZ 1
struct device mmc_dev; struct device mmc_dev;
struct clk *mmc_clkp = NULL; struct clk *mmc_clkp;
mmcsd_config_def mmcsd_cfg = { struct mmcsd_config_def mmcsd_cfg = {
/* read write thresholds (in bytes) can be any power of 2 from 2 to 64 */ /* read write thresholds (in bytes) can be any power of 2 from 2 to 64 */
32, 32,
/* To use the DMA or not-- 1- Use DMA, 0-Interrupt mode */ /* To use the DMA or not-- 1- Use DMA, 0-Interrupt mode */
...@@ -78,28 +77,28 @@ mmcsd_config_def mmcsd_cfg = { ...@@ -78,28 +77,28 @@ mmcsd_config_def mmcsd_cfg = {
1 1
}; };
volatile mmcsd_regs_base *mmcsd_regs; volatile struct mmcsd_regs_base *mmcsd_regs;
static unsigned int mmc_input_clk = 0; static unsigned int mmc_input_clk;
/* Used to identify whether card being used currently by linux core or not */ /* Used to identify whether card being used currently by linux core or not */
static unsigned int is_card_busy = 0; static unsigned int is_card_busy;
/* used to identify whether card probe(detection) is currently in progress */ /* used to identify whether card probe(detection) is currently in progress */
static unsigned int is_card_detect_progress = 0; static unsigned int is_card_detect_progress;
/* used to identify whether core is icurrently initilizing the card or not */ /* used to identify whether core is icurrently initilizing the card or not */
static unsigned int is_init_progress = 0; static unsigned int is_init_progress;
/* used to identify whether core request has been queue up or /* used to identify whether core request has been queue up or
* not because request has come when card detection/probe was in progress * not because request has come when card detection/probe was in progress
*/ */
static unsigned int is_req_queued_up = 0; static unsigned int is_req_queued_up;
/* data struture to queue one request */ /* data struture to queue one request */
static struct mmc_host *que_mmc_host = NULL; static struct mmc_host *que_mmc_host;
/* data structure to queue one request */ /* data structure to queue one request */
static struct mmc_request *que_mmc_request = NULL; static struct mmc_request *que_mmc_request;
/* tells whether card is initizlzed or not */ /* tells whether card is initizlzed or not */
static unsigned int is_card_initialized = 0; static unsigned int is_card_initialized;
static unsigned int new_card_state = 0; /* tells current state of card */ static unsigned int new_card_state; /* tells current state of card */
static unsigned int is_card_removed = 0; static unsigned int is_card_removed;
static DEFINE_SPINLOCK(mmc_lock); static DEFINE_SPINLOCK(mmc_lock);
...@@ -113,9 +112,8 @@ static inline void wait_on_data(void) ...@@ -113,9 +112,8 @@ static inline void wait_on_data(void)
cnt--; cnt--;
udelay(1); udelay(1);
} }
if (!cnt) { if (!cnt)
dev_warn(&mmc_dev, "ERROR: TOUT waiting for BUSY\n"); dev_warn(&mmc_dev, "ERROR: TOUT waiting for BUSY\n");
}
} }
static void mmc_davinci_start_command(struct mmc_davinci_host *host, static void mmc_davinci_start_command(struct mmc_davinci_host *host,
...@@ -427,9 +425,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host) ...@@ -427,9 +425,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host)
enum dma_event_q queue_no = EVENTQ_0; enum dma_event_q queue_no = EVENTQ_0;
/* Acquire master DMA write channel */ /* Acquire master DMA write channel */
if ((r = davinci_request_dma(DAVINCI_DMA_MMCTXEVT, "MMC_WRITE", r = davinci_request_dma(DAVINCI_DMA_MMCTXEVT, "MMC_WRITE",
mmc_davinci_dma_cb, host, &edma_chan_num, &tcc, mmc_davinci_dma_cb, host, &edma_chan_num, &tcc, queue_no);
queue_no)) != 0) { if (r != 0) {
dev_warn(&mmc_dev, dev_warn(&mmc_dev,
"MMC: davinci_request_dma() failed with %d\n", "MMC: davinci_request_dma() failed with %d\n",
r); r);
...@@ -437,9 +435,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host) ...@@ -437,9 +435,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host)
} }
/* Acquire master DMA read channel */ /* Acquire master DMA read channel */
if ((r = davinci_request_dma(DAVINCI_DMA_MMCRXEVT, "MMC_READ", r = davinci_request_dma(DAVINCI_DMA_MMCRXEVT, "MMC_READ",
mmc_davinci_dma_cb, host, &edma_chan_num, &tcc, mmc_davinci_dma_cb, host, &edma_chan_num, &tcc, queue_no);
queue_no)) != 0) { if (r != 0) {
dev_warn(&mmc_dev, dev_warn(&mmc_dev,
"MMC: davinci_request_dma() failed with %d\n", "MMC: davinci_request_dma() failed with %d\n",
r); r);
...@@ -454,9 +452,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host) ...@@ -454,9 +452,9 @@ static int davinci_acquire_dma_channels(struct mmc_davinci_host *host)
/* Create a DMA slave read channel /* Create a DMA slave read channel
* (assuming max segments handled is 2) */ * (assuming max segments handled is 2) */
sync_dev = DAVINCI_DMA_MMCRXEVT; sync_dev = DAVINCI_DMA_MMCRXEVT;
if ((r = davinci_request_dma(DAVINCI_EDMA_PARAM_ANY, "LINK", r = davinci_request_dma(DAVINCI_EDMA_PARAM_ANY, "LINK", NULL, NULL,
NULL, NULL, &edma_chan_num, &sync_dev, &edma_chan_num, &sync_dev, queue_no);
queue_no)) != 0) { if (r != 0) {
dev_warn(&mmc_dev, dev_warn(&mmc_dev,
"MMC: davinci_request_dma() failed with %d\n", r); "MMC: davinci_request_dma() failed with %d\n", r);
goto free_master_read; goto free_master_read;
...@@ -490,8 +488,6 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, ...@@ -490,8 +488,6 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host,
enum sync_dimension sync_mode; enum sync_dimension sync_mode;
edmacc_paramentry_regs temp; edmacc_paramentry_regs temp;
int edma_chan_num; int edma_chan_num;
static unsigned int option_read = 0;
static unsigned int option_write = 0;
struct mmc_data *data = host->data; struct mmc_data *data = host->data;
struct scatterlist *sg = &data->sg[0]; struct scatterlist *sg = &data->sg[0];
unsigned int count; unsigned int count;
...@@ -502,9 +498,8 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, ...@@ -502,9 +498,8 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host,
frame = data->blksz; frame = data->blksz;
count = sg_dma_len(sg); count = sg_dma_len(sg);
if ((data->blocks == 1) && (count > data->blksz)) { if ((data->blocks == 1) && (count > data->blksz))
count = frame; count = frame;
}
if (count % 32 == 0) { if (count % 32 == 0) {
acnt = 4; acnt = 4;
...@@ -569,18 +564,18 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, ...@@ -569,18 +564,18 @@ static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host,
davinci_get_dma_params(sync_dev, &temp); davinci_get_dma_params(sync_dev, &temp);
if (sync_dev == DAVINCI_DMA_MMCTXEVT) { if (sync_dev == DAVINCI_DMA_MMCTXEVT) {
if (option_write == 0) { if (host->option_write == 0) {
option_write = temp.opt; host->option_write = temp.opt;
} else { } else {
temp.opt = option_write; temp.opt = host->option_write;
davinci_set_dma_params(sync_dev, &temp); davinci_set_dma_params(sync_dev, &temp);
} }
} }
if (sync_dev == DAVINCI_DMA_MMCRXEVT) { if (sync_dev == DAVINCI_DMA_MMCRXEVT) {
if (option_read == 0) { if (host->option_read == 0) {
option_read = temp.opt; host->option_read = temp.opt;
} else { } else {
temp.opt = option_read; temp.opt = host->option_read;
davinci_set_dma_params(sync_dev, &temp); davinci_set_dma_params(sync_dev, &temp);
} }
} }
...@@ -717,9 +712,8 @@ static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host) ...@@ -717,9 +712,8 @@ static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host)
sg = host->data->sg + host->sg_idx; sg = host->data->sg + host->sg_idx;
host->buffer_bytes_left = sg->length; host->buffer_bytes_left = sg->length;
host->buffer = sg_virt(sg); host->buffer = sg_virt(sg);
if (host->buffer_bytes_left > host->bytes_left) { if (host->buffer_bytes_left > host->bytes_left)
host->buffer_bytes_left = host->bytes_left; host->buffer_bytes_left = host->bytes_left;
}
} }
static void mmc_davinci_request(struct mmc_host *mmc, struct mmc_request *req) static void mmc_davinci_request(struct mmc_host *mmc, struct mmc_request *req)
...@@ -814,9 +808,8 @@ static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) ...@@ -814,9 +808,8 @@ static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
mmcsd_regs->mmc_arghl = 0x0; mmcsd_regs->mmc_arghl = 0x0;
mmcsd_regs->mmc_cmd = 0x4000; mmcsd_regs->mmc_cmd = 0x4000;
status = 0; status = 0;
while (!(status & (MMCSD_EVENT_EOFCMD))) { while (!(status & (MMCSD_EVENT_EOFCMD)))
status = mmcsd_regs->mmc_st0; status = mmcsd_regs->mmc_st0;
}
} }
} }
...@@ -834,9 +827,9 @@ mmc_davinci_xfer_done(struct mmc_davinci_host *host, struct mmc_data *data) ...@@ -834,9 +827,9 @@ mmc_davinci_xfer_done(struct mmc_davinci_host *host, struct mmc_data *data)
davinci_abort_dma(host); davinci_abort_dma(host);
dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_len, dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_len,
(data-> (data->flags & MMC_DATA_WRITE)
flags & MMC_DATA_WRITE) ? DMA_TO_DEVICE : ? DMA_TO_DEVICE
DMA_FROM_DEVICE); : DMA_FROM_DEVICE);
} }
if (data->error == -ETIMEDOUT) { if (data->error == -ETIMEDOUT) {
...@@ -926,7 +919,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -926,7 +919,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
mmc_davinci_cmd_done(host, host->cmd); mmc_davinci_cmd_done(host, host->cmd);
} }
dev_dbg(&mmc_dev, dev_dbg(&mmc_dev,
"From code segment excuted when card removed\n"); "From code segment executed "
"when card removed\n");
return IRQ_HANDLED; return IRQ_HANDLED;
} }
} }
...@@ -954,11 +948,11 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -954,11 +948,11 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
if (host->do_dma == 1) { if (host->do_dma == 1) {
end_transfer = 1; end_transfer = 1;
} else { } else {
/* if datasize<32 no RX ints are generated */ /* if datasize < 32 no RX ints
if (host->bytes_left > 0) { * are generated */
davinci_fifo_data_trans if (host->bytes_left > 0)
(host); davinci_fifo_data_trans(
} host);
end_transfer = 1; end_transfer = 1;
} }
} else { } else {
...@@ -978,19 +972,20 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -978,19 +972,20 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
spin_unlock_irqrestore(&mmc_lock, spin_unlock_irqrestore(&mmc_lock,
flags); flags);
dev_dbg(&mmc_dev, dev_dbg(&mmc_dev,
"MMCSD: Data timeout, CMD%d and status is %x\r\n", "MMCSD: Data timeout, "
"CMD%d and status is %x\r\n",
host->cmd->opcode, status); host->cmd->opcode, status);
if (host->cmd) { if (host->cmd)
host->cmd->error = host->cmd->error =
-ETIMEDOUT; -ETIMEDOUT;
}
end_transfer = 1; end_transfer = 1;
} }
} }
if (status & MMCSD_EVENT_ERROR_DATACRC) { if (status & MMCSD_EVENT_ERROR_DATACRC) {
/* DAT line portion is diabled and in reset state */ /* DAT line portion is disabled
* and in reset state */
mmcsd_regs->mmc_ctl = mmcsd_regs->mmc_ctl =
mmcsd_regs->mmc_ctl | (1 << 1); mmcsd_regs->mmc_ctl | (1 << 1);
udelay(10); udelay(10);
...@@ -1001,7 +996,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -1001,7 +996,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
if (host->data) { if (host->data) {
host->data->error = -EILSEQ; host->data->error = -EILSEQ;
dev_dbg(&mmc_dev, dev_dbg(&mmc_dev,
"MMCSD: Data CRC error, bytes left %d\r\n", "MMCSD: Data CRC error, "
"bytes left %d\r\n",
host->bytes_left); host->bytes_left);
end_transfer = 1; end_transfer = 1;
} else { } else {
...@@ -1044,10 +1040,10 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -1044,10 +1040,10 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
/* Command CRC error */ /* Command CRC error */
dev_dbg(&mmc_dev, "Command CRC error\r\n"); dev_dbg(&mmc_dev, "Command CRC error\r\n");
if (host->cmd) { if (host->cmd) {
/* Ignore CMD CRC errors during high speed operation */ /* Ignore CMD CRC errors during
if (host->mmc->ios.clock <= 25000000) { * high speed operation */
if (host->mmc->ios.clock <= 25000000)
host->cmd->error = -EILSEQ; host->cmd->error = -EILSEQ;
}
end_command = 1; end_command = 1;
} }
} }
...@@ -1061,7 +1057,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id) ...@@ -1061,7 +1057,8 @@ static irqreturn_t mmc_davinci_irq(int irq, void *dev_id)
status = mmcsd_regs->mmc_st0; status = mmcsd_regs->mmc_st0;
if (status != 0) { if (status != 0) {
dev_dbg(&mmc_dev, dev_dbg(&mmc_dev,
"Status is %x at end of ISR when host->data is NULL", "Status is %x at end of ISR "
"when host->data is NULL\n",
status); status);
status = 0; status = 0;
...@@ -1269,8 +1266,8 @@ static int davinci_mmcsd_probe(struct platform_device *pdev) ...@@ -1269,8 +1266,8 @@ static int davinci_mmcsd_probe(struct platform_device *pdev)
goto out; goto out;
} }
mmcsd_regs = mmcsd_regs = (volatile struct mmcsd_regs_base *)
(volatile mmcsd_regs_base *)IO_ADDRESS(MMCSD_REGS_BASE_ADDR); IO_ADDRESS(MMCSD_REGS_BASE_ADDR);
init_mmcsd_host(); init_mmcsd_host();
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* Register Overlay Structure * Register Overlay Structure
\**************************************************************************/ \**************************************************************************/
typedef struct { struct mmcsd_regs_base {
unsigned short mmc_ctl; unsigned short mmc_ctl;
unsigned char rsvd0[2]; unsigned char rsvd0[2];
unsigned short mmc_clk; unsigned short mmc_clk;
...@@ -92,7 +92,7 @@ typedef struct { ...@@ -92,7 +92,7 @@ typedef struct {
unsigned short sdio_st; unsigned short sdio_st;
unsigned char rsvd20[2]; unsigned char rsvd20[2];
unsigned short mmc_fifo_ctl; unsigned short mmc_fifo_ctl;
} mmcsd_regs_base; };
/* /*
* Command types * Command types
...@@ -103,13 +103,12 @@ typedef struct { ...@@ -103,13 +103,12 @@ typedef struct {
#define DAVINCI_MMC_CMDTYPE_ADTC 3 #define DAVINCI_MMC_CMDTYPE_ADTC 3
#define EDMA_MAX_LOGICAL_CHA_ALLOWED 1 #define EDMA_MAX_LOGICAL_CHA_ALLOWED 1
typedef struct { struct edma_ch_mmcsd {
unsigned char cnt_chanel; unsigned char cnt_chanel;
unsigned int chanel_num[EDMA_MAX_LOGICAL_CHA_ALLOWED]; unsigned int chanel_num[EDMA_MAX_LOGICAL_CHA_ALLOWED];
} edma_ch_mmcsd; };
struct mmc_davinci_host { struct mmc_davinci_host {
int initialized; int initialized;
int suspended; int suspended;
struct mmc_request *req; struct mmc_request *req;
...@@ -142,21 +141,25 @@ struct mmc_davinci_host { ...@@ -142,21 +141,25 @@ struct mmc_davinci_host {
unsigned char sd_support; unsigned char sd_support;
edma_ch_mmcsd edma_ch_details; struct edma_ch_mmcsd edma_ch_details;
unsigned int sg_len; unsigned int sg_len;
int sg_idx; int sg_idx;
unsigned int buffer_bytes_left; unsigned int buffer_bytes_left;
unsigned int dma_len; unsigned int dma_len;
int dma_state; int dma_state;
unsigned int option_read;
unsigned int option_write;
}; };
typedef struct {
struct mmcsd_config_def {
unsigned short rw_threshold; unsigned short rw_threshold;
unsigned short use_dma; unsigned short use_dma;
unsigned short use_4bit_mode; unsigned short use_4bit_mode;
} mmcsd_config_def; };
typedef enum { enum mmcsdevent {
MMCSD_EVENT_EOFCMD = (1 << 2), MMCSD_EVENT_EOFCMD = (1 << 2),
MMCSD_EVENT_READ = (1 << 10), MMCSD_EVENT_READ = (1 << 10),
MMCSD_EVENT_WRITE = (1 << 9), MMCSD_EVENT_WRITE = (1 << 9),
...@@ -166,14 +169,7 @@ typedef enum { ...@@ -166,14 +169,7 @@ typedef enum {
MMCSD_EVENT_ERROR_DATATIMEOUT = (1 << 3), MMCSD_EVENT_ERROR_DATATIMEOUT = (1 << 3),
MMCSD_EVENT_CARD_EXITBUSY = (1 << 1), MMCSD_EVENT_CARD_EXITBUSY = (1 << 1),
MMCSD_EVENT_BLOCK_XFERRED = (1 << 0) MMCSD_EVENT_BLOCK_XFERRED = (1 << 0)
} mmcsdevent; };
#define MMCSD_EVENT_TIMEOUT_ERROR \
(MMCSD_EVENT_ERROR_DATATIMEOUT | MMCSD_EVENT_ERROR_CMDTIMEOUT )
#define MMCSD_EVENT_CRC_ERROR \
(MMCSD_EVENT_ERROR_DATACRC | MMCSD_EVENT_ERROR_CMDCRC)
#define MMCSD_EVENT_ERROR \
(MMCSD_EVENT_TIMEOUT_ERROR | MMCSD_EVENT_CRC_ERROR)
static void init_mmcsd_host(void); static void init_mmcsd_host(void);
......
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