OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [drivers/] [mmc/] [host/] [mmc_ocores.c] - Diff between revs 75 and 76

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 75 Rev 76
Line 56... Line 56...
        struct tasklet_struct finish_cmd;
        struct tasklet_struct finish_cmd;
        struct {
        struct {
                unsigned int normal_int_status;
                unsigned int normal_int_status;
                unsigned int error_int_status;
                unsigned int error_int_status;
        } registers;
        } registers;
 
        int clock;
};
};
 
 
struct ocores_host *oc_host;
struct ocores_host *oc_host;
 
 
static void ocores_tasklet_finish_cmd(unsigned long param);
static void ocores_tasklet_finish_cmd(unsigned long param);
Line 128... Line 129...
 
 
        printk(KERN_ALERT "%s: cmd_arg = %08x\n", __FUNCTION__, cmd_arg);
        printk(KERN_ALERT "%s: cmd_arg = %08x\n", __FUNCTION__, cmd_arg);
        printk(KERN_ALERT "%s: cmd_command   = %08x\n", __FUNCTION__, cmd_command);
        printk(KERN_ALERT "%s: cmd_command   = %08x\n", __FUNCTION__, cmd_command);
        oc_host=host;
        oc_host=host;
 
 
        //XXX:Remove after uppdated bitfil with Timeout
 
        /*if (cmd->opcode == 8  || cmd->opcode ==  5 )
 
        {
 
                host->mrq->cmd->error = -ETIMEDOUT;
 
                mmc_request_done(host->mmc, host->mrq);
 
        }
 
        else
 
        {
 
                CMD_IRQ_ON (host,(ECC|EEI));
 
                writel(cmd_command, host->base + SD_COMMAND);
 
                wmb();
 
                writel(cmd_arg, host->base + SD_ARG);
 
        }*/
 
        CMD_IRQ_ON (host,(ECC|EEI));
        CMD_IRQ_ON (host,(ECC|EEI));
        writel(cmd_command, host->base + SD_COMMAND);
        writel(cmd_command, host->base + SD_COMMAND);
        wmb();
        wmb();
        writel(cmd_arg, host->base + SD_ARG);
        writel(cmd_arg, host->base + SD_ARG);
}
}
Line 212... Line 201...
        //Set clock divider and timeout registers
        //Set clock divider and timeout registers
        printk(KERN_ALERT "%s: host->base = %p\n", __FUNCTION__, host->base);
        printk(KERN_ALERT "%s: host->base = %p\n", __FUNCTION__, host->base);
        if (ios->clock == 0) {
        if (ios->clock == 0) {
                //ocores_mci_write (host, SD_SOFTWARE_RST, SD_DISABLE);
                //ocores_mci_write (host, SD_SOFTWARE_RST, SD_DISABLE);
        }
        }
        else
        else if (ios->clock != host->clock)
        {
        {
 
                host->clock = ios->clock;
                writel(SD_DISABLE, host->base + SD_SOFTWARE_RST);
                writel(SD_DISABLE, host->base + SD_SOFTWARE_RST);
                clk_div = ((SYS_CLK / ios->clock)-2 )/ 2;
                clk_div = ((SYS_CLK / ios->clock)-2 )/ 2;
                cmd_timeout = ((SYS_CLK/ios->clock) * 512);
                cmd_timeout = ((SYS_CLK/ios->clock) * 512);
 
 
                printk(KERN_ALERT " clk_div = 0x%02x\n", clk_div);
                printk(KERN_ALERT " clk_div = 0x%02x\n", clk_div);
Line 274... Line 264...
        struct mmc_host *mmc;
        struct mmc_host *mmc;
        struct ocores_host *host = NULL;
        struct ocores_host *host = NULL;
        struct resource *r;
        struct resource *r;
        int ret;
        int ret;
 
 
 
 
        printk(KERN_ALERT "%s: enter\n", __FUNCTION__);
        printk(KERN_ALERT "%s: enter\n", __FUNCTION__);
 
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
 
        printk(KERN_ALERT "%s: resource %x, %x\n", __FUNCTION__, r->start, r->end);
        printk(KERN_ALERT "%s: resource %x, %x\n", __FUNCTION__, r->start, r->end);
Line 307... Line 298...
        mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
        mmc->max_seg_size = mmc->max_blk_count * mmc->max_blk_size;
        mmc->max_req_size = mmc->max_seg_size;
        mmc->max_req_size = mmc->max_seg_size;
        mmc->max_phys_segs = mmc->max_hw_segs;
        mmc->max_phys_segs = mmc->max_hw_segs;
 
 
        host = mmc_priv(mmc);
        host = mmc_priv(mmc);
 
 
 
         /*XXX:  */
 
        host->clock = 0;
 
 
        host->mmc = mmc;
        host->mmc = mmc;
        host->cmdat = 0;
        host->cmdat = 0;
        host->registers.normal_int_status =0;
        host->registers.normal_int_status =0;
 
 
 
 
Line 395... Line 390...
                case (CIE  ):
                case (CIE  ):
                        pr_debug("Index problem with the received or sent data\n");
                        pr_debug("Index problem with the received or sent data\n");
                        host->mrq->cmd->error = -EILSEQ;
                        host->mrq->cmd->error = -EILSEQ;
                        break;
                        break;
                }
                }
 
 
 
                mmc_request_done(host->mmc, host->mrq);
        }
        }
        else
        else
        {
        {
                if ( mmc_resp_type(host->mrq->cmd) == MMC_RSP_R2      )   //Long response
                if ( mmc_resp_type(host->mrq->cmd) == MMC_RSP_R2      )   //Long response
                {
                {
Line 408... Line 405...
                        host->mrq->cmd->resp[3]  =  readl(host->base + SD_RESP1);
                        host->mrq->cmd->resp[3]  =  readl(host->base + SD_RESP1);
                        host->mrq->cmd->resp[2]  =  0xaaaaaaaa;
                        host->mrq->cmd->resp[2]  =  0xaaaaaaaa;
                        host->mrq->cmd->resp[1]  =  0xbbbbbbbb;
                        host->mrq->cmd->resp[1]  =  0xbbbbbbbb;
                        host->mrq->cmd->resp[0]  =  0;
                        host->mrq->cmd->resp[0]  =  0;
                        mmc_request_done(host->mmc, host->mrq);
                        mmc_request_done(host->mmc, host->mrq);
 
 
                        }
                        }
                        else {
                        else {
                                host->word_cnt+=1;
                                host->word_cnt+=1;
                                switch(host->word_cnt-1)
                                switch(host->word_cnt-1)
                                {
                                {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.