I'm trying with SD. I load the modules: 

# modprobe mmc_core
# modprobe mmc_block
# modprobe davinci_mmc. 

As soon as I insert a card, I get repeated messages "mmcblk0: p1" on the
console. 'dmesg' also shows: 'mmcblk0: mmc0:0f07 SD01G 1006080KiB'.
Apparently, the card is recognized correctly. 

After that, I'm trying to mount the partition by first creating devices
nodes (major comes from 'cat /proc/partitions"): 

# mknod /dev/mmcblk0 b 254 0 
# mknod /dev/mmcblk0p1 b 254 1 
# mount /dev/mmcblk0p1 /mnt/mmc -t vfat
mount: mounting /dev/mmcblk0p1 on /mnt/mmc failed
# 

However, sometimes this succeeds and no error is returned. But then I
get a lot of read errors from the card if I try to do a simple 'ls
/mnt/mmc'. I haven't figured out when and why this happens... I compiled
vfat support into the kernel.

By the way, I haven't applied the latest patches yet. 

Hope this helps.

Best regards,
Sander

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Bernard Blackham
Sent: Monday, October 29, 2007 3:29 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; davinci-linux-open-source@linux.davincidsp.com;
Bernard Blackham
Subject: [PATCH 1/4] davinci_mmc: make checkpatch.pl compliant

Make davinci-mmc mostly scripts/checkpatch.pl compliant.

Signed-off-by: Bernard Blackham <[EMAIL PROTECTED]>

 davinci_mmc.c |  117
++++++++++++++++++++++++++++------------------------------
 davinci_mmc.h |   30 ++++++--------
 2 files changed, 70 insertions(+), 77 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c
b/drivers/mmc/host/davinci_mmc.c
index e988370..cb6878f 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -30,7 +30,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/tty.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -41,11 +40,11 @@ #include <linux/clk.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/card.h>
 #include <linux/mmc/mmc.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/hardware.h>
+#include <linux/io.h>
+#include <linux/irq.h>
 #include <linux/delay.h>
 #include <linux/dma-mapping.h>
+#include <asm/hardware.h>
 #include <asm/arch/irqs.h>
 #include <asm/arch/hardware.h>
 
@@ -68,8 +67,8 @@ #define TCINTEN                       (0x1<<20)
 #define MULTIPILER_TO_HZ 1
 
 struct device mmc_dev;
-struct clk *mmc_clkp = NULL;
-mmcsd_config_def mmcsd_cfg = {
+struct clk *mmc_clkp;
+struct mmcsd_config_def mmcsd_cfg = {
 /* read write thresholds (in bytes) can be any power of 2 from 2 to 64
*/
        32,
 /* To use the DMA or not-- 1- Use DMA, 0-Interrupt mode */
@@ -78,28 +77,28 @@ mmcsd_config_def mmcsd_cfg = {
        1
 };
 
-volatile mmcsd_regs_base *mmcsd_regs;
-static unsigned int mmc_input_clk = 0;
+volatile struct mmcsd_regs_base *mmcsd_regs;
+static unsigned int mmc_input_clk;
 
 /* 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 */
-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 */
-static unsigned int is_init_progress = 0;
+static unsigned int is_init_progress;
 /* used to identify whether core request has been queue up or
  * 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 */
-static struct mmc_host *que_mmc_host = NULL;
+static struct mmc_host *que_mmc_host;
 /* 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 */
-static unsigned int is_card_initialized = 0;
-static unsigned int new_card_state = 0;        /* tells current state
of card */
-static unsigned int is_card_removed = 0;
+static unsigned int is_card_initialized;
+static unsigned int new_card_state;    /* tells current state of card
*/
+static unsigned int is_card_removed;
 
 static DEFINE_SPINLOCK(mmc_lock);
 
@@ -113,9 +112,8 @@ static inline void wait_on_data(void)
                cnt--;
                udelay(1);
        }
-       if (!cnt) {
+       if (!cnt)
                dev_warn(&mmc_dev, "ERROR: TOUT waiting for BUSY\n");
-       }
 }
 
 static void mmc_davinci_start_command(struct mmc_davinci_host *host,
@@ -427,9 +425,9 @@ static int davinci_acquire_dma_channels(
        enum dma_event_q queue_no = EVENTQ_0;
 
        /* Acquire master DMA write channel */
-       if ((r = davinci_request_dma(DAVINCI_DMA_MMCTXEVT, "MMC_WRITE",
-                       mmc_davinci_dma_cb, host, &edma_chan_num, &tcc,
-                       queue_no)) != 0) {
+       r = davinci_request_dma(DAVINCI_DMA_MMCTXEVT, "MMC_WRITE",
+               mmc_davinci_dma_cb, host, &edma_chan_num, &tcc,
queue_no);
+       if (r != 0) {
                dev_warn(&mmc_dev,
                                "MMC: davinci_request_dma() failed with
%d\n",
                                r);
@@ -437,9 +435,9 @@ static int davinci_acquire_dma_channels(
        }
 
        /* Acquire master DMA read channel */
-       if ((r = davinci_request_dma(DAVINCI_DMA_MMCRXEVT, "MMC_READ",
-                       mmc_davinci_dma_cb, host, &edma_chan_num, &tcc,
-                       queue_no)) != 0) {
+       r = davinci_request_dma(DAVINCI_DMA_MMCRXEVT, "MMC_READ",
+               mmc_davinci_dma_cb, host, &edma_chan_num, &tcc,
queue_no);
+       if (r != 0) {
                dev_warn(&mmc_dev,
                                "MMC: davinci_request_dma() failed with
%d\n",
                                r);
@@ -451,12 +449,12 @@ static int davinci_acquire_dma_channels(
        /* currently data Writes are done using single block mode,
         * so no DMA slave write channel is required for now */
 
-       /* Create a DMA slave read channel 
+       /* Create a DMA slave read channel
         * (assuming max segments handled is 2) */
        sync_dev = DAVINCI_DMA_MMCRXEVT;
-       if ((r = davinci_request_dma(DAVINCI_EDMA_PARAM_ANY, "LINK",
-                       NULL, NULL, &edma_chan_num, &sync_dev,
-                       queue_no)) != 0) {
+       r = davinci_request_dma(DAVINCI_EDMA_PARAM_ANY, "LINK", NULL,
NULL,
+               &edma_chan_num, &sync_dev, queue_no);
+       if (r != 0) {
                dev_warn(&mmc_dev,
                        "MMC: davinci_request_dma() failed with %d\n",
r);
                goto free_master_read;
@@ -490,8 +488,6 @@ static int mmc_davinci_send_dma_request(
        enum sync_dimension sync_mode;
        edmacc_paramentry_regs temp;
        int edma_chan_num;
-       static unsigned int option_read = 0;
-       static unsigned int option_write = 0;
        struct mmc_data *data = host->data;
        struct scatterlist *sg = &data->sg[0];
        unsigned int count;
@@ -502,9 +498,8 @@ #define MAX_C_CNT           64000
        frame = data->blksz;
        count = sg_dma_len(sg);
 
-       if ((data->blocks == 1) && (count > data->blksz)) {
+       if ((data->blocks == 1) && (count > data->blksz))
                count = frame;
-       }
 
        if (count % 32 == 0) {
                acnt = 4;
@@ -569,18 +564,18 @@ #define MAX_C_CNT         64000
 
        davinci_get_dma_params(sync_dev, &temp);
        if (sync_dev == DAVINCI_DMA_MMCTXEVT) {
-               if (option_write == 0) {
-                       option_write = temp.opt;
+               if (host->option_write == 0) {
+                       host->option_write = temp.opt;
                } else {
-                       temp.opt = option_write;
+                       temp.opt = host->option_write;
                        davinci_set_dma_params(sync_dev, &temp);
                }
        }
        if (sync_dev == DAVINCI_DMA_MMCRXEVT) {
-               if (option_read == 0) {
-                       option_read = temp.opt;
+               if (host->option_read == 0) {
+                       host->option_read = temp.opt;
                } else {
-                       temp.opt = option_read;
+                       temp.opt = host->option_read;
                        davinci_set_dma_params(sync_dev, &temp);
                }
        }
@@ -717,9 +712,8 @@ static void mmc_davinci_sg_to_buf(struct
        sg = host->data->sg + host->sg_idx;
        host->buffer_bytes_left = sg->length;
        host->buffer = page_address(sg->page) + sg->offset;
-       if (host->buffer_bytes_left > host->bytes_left) {
+       if (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)
@@ -814,9 +808,8 @@ static void mmc_davinci_set_ios(struct m
                mmcsd_regs->mmc_arghl = 0x0;
                mmcsd_regs->mmc_cmd = 0x4000;
                status = 0;
-               while (!(status & (MMCSD_EVENT_EOFCMD))) {
+               while (!(status & (MMCSD_EVENT_EOFCMD)))
                        status = mmcsd_regs->mmc_st0;
-               }
        }
 }
 
@@ -926,7 +919,8 @@ static irqreturn_t mmc_davinci_irq(int i
                                        mmc_davinci_cmd_done(host,
host->cmd);
                                }
                                dev_dbg(&mmc_dev,
-                                       "From code segment excuted when
card removed\n");
+                                       "From code segment executed "
+                                       "when card removed\n");
                                return IRQ_HANDLED;
                        }
                }
@@ -954,11 +948,11 @@ static irqreturn_t mmc_davinci_irq(int i
                                        if (host->do_dma == 1) {
                                                end_transfer = 1;
                                        } else {
-                                               /* if datasize<32 no RX
ints are generated */
-                                               if (host->bytes_left >
0) {
-
davinci_fifo_data_trans
-                                                           (host);
-                                               }
+                                               /* if datasize < 32 no
RX ints
+                                                * are generated */
+                                               if (host->bytes_left >
0)
+
davinci_fifo_data_trans(
+                                                               host);
                                                end_transfer = 1;
                                        }
                                } else {
@@ -978,19 +972,20 @@ static irqreturn_t mmc_davinci_irq(int i
 
spin_unlock_irqrestore(&mmc_lock,
                                                flags);
                                        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);
 
-                                       if (host->cmd) {
+                                       if (host->cmd)
                                                host->cmd->error |=
                                                    MMC_ERR_TIMEOUT;
-                                       }
                                        end_transfer = 1;
                                }
                        }
 
                        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 | (1 << 1);
                                udelay(10);
@@ -1001,7 +996,8 @@ static irqreturn_t mmc_davinci_irq(int i
                                if (host->data) {
                                        host->data->error |=
MMC_ERR_BADCRC;
                                        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);
                                        end_transfer = 1;
                                } else {
@@ -1044,11 +1040,11 @@ static irqreturn_t mmc_davinci_irq(int i
                                /* Command CRC error */
                                dev_dbg(&mmc_dev, "Command CRC
error\r\n");
                                if (host->cmd) {
-                                       /* Ignore CMD CRC errors during
high speed operation */
-                                       if (host->mmc->ios.clock <=
25000000) {
+                                       /* Ignore CMD CRC errors during
+                                        * high speed operation */
+                                       if (host->mmc->ios.clock <=
25000000)
                                                host->cmd->error |=
                                                    MMC_ERR_BADCRC;
-                                       }
                                        end_command = 1;
                                }
                        }
@@ -1062,7 +1058,8 @@ static irqreturn_t mmc_davinci_irq(int i
                                status = mmcsd_regs->mmc_st0;
                                if (status != 0) {
                                        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",
                                                status);
                                        status = 0;
 
@@ -1270,8 +1267,8 @@ static int davinci_mmcsd_probe(struct pl
                goto out;
        }
 
-       mmcsd_regs =
-               (volatile mmcsd_regs_base
*)IO_ADDRESS(MMCSD_REGS_BASE_ADDR);
+       mmcsd_regs = (volatile struct mmcsd_regs_base *)
+               IO_ADDRESS(MMCSD_REGS_BASE_ADDR);
 
        init_mmcsd_host();
 
diff --git a/drivers/mmc/host/davinci_mmc.h
b/drivers/mmc/host/davinci_mmc.h
index 5840ccf..953bf33 100644
--- a/drivers/mmc/host/davinci_mmc.h
+++ b/drivers/mmc/host/davinci_mmc.h
@@ -40,7 +40,7 @@ #define DAVINCI_MMC_H_
 * Register Overlay Structure
 
\***********************************************************************
***/
 
-typedef struct {
+struct mmcsd_regs_base {
        unsigned short mmc_ctl;
        unsigned char rsvd0[2];
        unsigned short mmc_clk;
@@ -92,7 +92,7 @@ typedef struct {
        unsigned short sdio_st;
        unsigned char rsvd20[2];
        unsigned short mmc_fifo_ctl;
-} mmcsd_regs_base;
+};
 
 /*
  * Command types
@@ -103,13 +103,12 @@ #define DAVINCI_MMC_CMDTYPE_AC    2
 #define DAVINCI_MMC_CMDTYPE_ADTC       3
 #define EDMA_MAX_LOGICAL_CHA_ALLOWED 1
 
-typedef struct {
+struct edma_ch_mmcsd {
        unsigned char cnt_chanel;
        unsigned int chanel_num[EDMA_MAX_LOGICAL_CHA_ALLOWED];
-} edma_ch_mmcsd;
+};
 
 struct mmc_davinci_host {
-
        int initialized;
        int suspended;
        struct mmc_request *req;
@@ -142,21 +141,25 @@ #define DAVINCI_MMC_DATADIR_WRITE 2
 
        unsigned char sd_support;
 
-       edma_ch_mmcsd edma_ch_details;
+       struct edma_ch_mmcsd edma_ch_details;
 
        unsigned int sg_len;
        int sg_idx;
        unsigned int buffer_bytes_left;
        unsigned int dma_len;
        int dma_state;
+
+       unsigned int option_read;
+       unsigned int option_write;
 };
-typedef struct {
+
+struct mmcsd_config_def {
        unsigned short rw_threshold;
        unsigned short use_dma;
        unsigned short use_4bit_mode;
-} mmcsd_config_def;
+};
 
-typedef enum {
+enum mmcsdevent {
        MMCSD_EVENT_EOFCMD = (1 << 2),
        MMCSD_EVENT_READ = (1 << 10),
        MMCSD_EVENT_WRITE = (1 << 9),
@@ -166,14 +169,7 @@ typedef enum {
        MMCSD_EVENT_ERROR_DATATIMEOUT = (1 << 3),
        MMCSD_EVENT_CARD_EXITBUSY = (1 << 1),
        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);
 
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
  
--------------------------------------------------------

 
CONFIDENTIALITY NOTICE - This e-mail transmission, and any documents, files or 
previous e-mail messages attached to it may contain information that is 
confidential or legally privileged. If you are not the intended recipient, or a 
person responsible for delivering it to the intended recipient, you are hereby 
notified that you must not read this transmission and that any disclosure, 
copying, printing, distribution or use of any of the information contained in 
or attached to this transmission is STRICTLY PROHIBITED. If you have received 
this transmission in error, please immediately notify Sander Huijsen by 
telephone or [EMAIL PROTECTED] and delete the original transmission and its 
attachments without reading or saving in any manner.
_______________________________________________
Davinci-linux-open-source mailing list
Davinci-linux-open-source@linux.davincidsp.com
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to