Loading drivers/staging/mt7621-mmc/dbg.c +18 −7 Original line number Diff line number Diff line Loading @@ -194,7 +194,8 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) block = sizes / 512; if (block >= 99) { printk("cmd53 error blocks\n"); while (1); while (1) ; } cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; } Loading Loading @@ -264,11 +265,14 @@ static ssize_t msdc_debug_proc_write(struct file *file, int id, zone; int mode, size; if (count == 0)return -1; if (count > 255)count = 255; if (count == 0) return -1; if (count > 255) count = 255; ret = copy_from_user(cmd_buf, buf, count); if (ret < 0)return -1; if (ret < 0) return -1; cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); Loading @@ -276,7 +280,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); if (cmd == SD_TOOL_ZONE) { id = p1; zone = p2; zone &= 0x3ff; id = p1; zone = p2; zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; Loading @@ -289,7 +295,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { id = p1 >> 4; mode = (p1 & 0xf); size = p2; id = p1 >> 4; mode = (p1 & 0xf); size = p2; if (id >= 0 && id <= 3) { drv_mode[id] = mode; dma_size[id] = p2; Loading @@ -310,7 +318,10 @@ static ssize_t msdc_debug_proc_write(struct file *file, gpt_enable = 1; } sdio_pro_enable = 1; if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; sdio_pro_time = p2; } else if (p1 == 0) { /* todo */ Loading drivers/staging/mt7621-mmc/dbg.h +2 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ while (1); \ while (1) \ ; \ } \ } while (0) #endif /* end of +++ */ Loading drivers/staging/mt7621-mmc/sd.c +26 −13 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ static int msdc_rsp[] = { do { \ int backup = cnt; \ while (retry) { \ if (!(expr)) break; \ if (!(expr)) \ break; \ if (cnt-- == 0) { \ retry--; mdelay(1); cnt = backup; \ } \ Loading Loading @@ -694,7 +695,8 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); /* wait clock stable */ while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)); while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)) ; host->sclk = sclk; host->mclk = hz; Loading Loading @@ -1245,7 +1247,8 @@ static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) N_MSG(FIO, " PIO Read<%d>bytes", size); sdr_clr_bits(MSDC_INTEN, wints); if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); return data->error; } Loading Loading @@ -1300,7 +1303,8 @@ static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) end: data->bytes_xfered += size; N_MSG(FIO, " PIO Write<%d>bytes", size); if (data->error) ERR_MSG("write pio data->error<%d>", data->error); if (data->error) ERR_MSG("write pio data->error<%d>", data->error); sdr_clr_bits(MSDC_INTEN, wints); return data->error; Loading Loading @@ -1340,7 +1344,8 @@ static void msdc_dma_stop(struct msdc_host *host) //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) ; //dsb(); /* --- by chhung */ sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ Loading Loading @@ -1733,9 +1738,12 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) #endif #endif /* end of --- */ if (mrq->cmd->error) host->error = 0x001; if (mrq->data && mrq->data->error) host->error |= 0x010; if (mrq->stop && mrq->stop->error) host->error |= 0x100; if (mrq->cmd->error) host->error = 0x001; if (mrq->data && mrq->data->error) host->error |= 0x010; if (mrq->stop && mrq->stop->error) host->error |= 0x100; //if (host->error) ERR_MSG("host->error<%d>", host->error); Loading Loading @@ -1868,7 +1876,8 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) result = msdc_do_request(mmc, mrq); sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, dcrc); /* RO */ if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, sdr_read32(MSDC_DAT_RDDLY0), sdr_read32(MSDC_DAT_RDDLY1), cur_dsmpl); Loading Loading @@ -2063,7 +2072,8 @@ static int msdc_check_busy(struct mmc_host *mmc, struct msdc_host *host) do { err = msdc_get_card_status(mmc, host, &status); if (err) return err; if (err) return err; /* need cmd12? */ ERR_MSG("cmd<13> resp<0x%x>", status); } while (R1_CURRENT_STATE(status) == 7); Loading Loading @@ -2755,7 +2765,8 @@ static int msdc_drv_probe(struct platform_device *pdev) /* Allocate MMC host for this device */ mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); if (!mmc) return -ENOMEM; if (!mmc) return -ENOMEM; hw = (struct msdc_hw *)pdev->dev.platform_data; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); Loading Loading @@ -2854,7 +2865,8 @@ static int msdc_drv_probe(struct platform_device *pdev) else ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host); if (ret) goto release; if (ret) goto release; // mt65xx_irq_unmask(irq); /* --- by chhung */ if (hw->flags & MSDC_CD_PIN_EN) { /* not set for sdio */ Loading @@ -2879,7 +2891,8 @@ static int msdc_drv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); ret = mmc_add_host(mmc); if (ret) goto free_irq; if (ret) goto free_irq; /* Config card detection pin and enable interrupts */ if (hw->flags & MSDC_CD_PIN_EN) { /* set for card */ Loading Loading
drivers/staging/mt7621-mmc/dbg.c +18 −7 Original line number Diff line number Diff line Loading @@ -194,7 +194,8 @@ void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks) block = sizes / 512; if (block >= 99) { printk("cmd53 error blocks\n"); while (1); while (1) ; } cmd = bRx ? &result->cmd53_rx_blk[block] : &result->cmd53_tx_blk[block]; } Loading Loading @@ -264,11 +265,14 @@ static ssize_t msdc_debug_proc_write(struct file *file, int id, zone; int mode, size; if (count == 0)return -1; if (count > 255)count = 255; if (count == 0) return -1; if (count > 255) count = 255; ret = copy_from_user(cmd_buf, buf, count); if (ret < 0)return -1; if (ret < 0) return -1; cmd_buf[count] = '\0'; printk("msdc Write %s\n", cmd_buf); Loading @@ -276,7 +280,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, sscanf(cmd_buf, "%x %x %x", &cmd, &p1, &p2); if (cmd == SD_TOOL_ZONE) { id = p1; zone = p2; zone &= 0x3ff; id = p1; zone = p2; zone &= 0x3ff; printk("msdc host_id<%d> zone<0x%.8x>\n", id, zone); if (id >= 0 && id <= 3) { sd_debug_zone[id] = zone; Loading @@ -289,7 +295,9 @@ static ssize_t msdc_debug_proc_write(struct file *file, printk("msdc host_id error when set debug zone\n"); } } else if (cmd == SD_TOOL_DMA_SIZE) { id = p1 >> 4; mode = (p1 & 0xf); size = p2; id = p1 >> 4; mode = (p1 & 0xf); size = p2; if (id >= 0 && id <= 3) { drv_mode[id] = mode; dma_size[id] = p2; Loading @@ -310,7 +318,10 @@ static ssize_t msdc_debug_proc_write(struct file *file, gpt_enable = 1; } sdio_pro_enable = 1; if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; if (p2 == 0) p2 = 1; if (p2 >= 30) p2 = 30; sdio_pro_time = p2; } else if (p1 == 0) { /* todo */ Loading
drivers/staging/mt7621-mmc/dbg.h +2 −1 Original line number Diff line number Diff line Loading @@ -105,7 +105,8 @@ extern unsigned int sd_debug_zone[4]; do { \ if (x) { \ printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \ while (1); \ while (1) \ ; \ } \ } while (0) #endif /* end of +++ */ Loading
drivers/staging/mt7621-mmc/sd.c +26 −13 Original line number Diff line number Diff line Loading @@ -263,7 +263,8 @@ static int msdc_rsp[] = { do { \ int backup = cnt; \ while (retry) { \ if (!(expr)) break; \ if (!(expr)) \ break; \ if (cnt-- == 0) { \ retry--; mdelay(1); cnt = backup; \ } \ Loading Loading @@ -694,7 +695,8 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz) sdr_set_field(MSDC_CFG, MSDC_CFG_CKDIV, div); /* wait clock stable */ while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)); while (!(sdr_read32(MSDC_CFG) & MSDC_CFG_CKSTB)) ; host->sclk = sclk; host->mclk = hz; Loading Loading @@ -1245,7 +1247,8 @@ static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) N_MSG(FIO, " PIO Read<%d>bytes", size); sdr_clr_bits(MSDC_INTEN, wints); if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); if (data->error) ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); return data->error; } Loading Loading @@ -1300,7 +1303,8 @@ static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) end: data->bytes_xfered += size; N_MSG(FIO, " PIO Write<%d>bytes", size); if (data->error) ERR_MSG("write pio data->error<%d>", data->error); if (data->error) ERR_MSG("write pio data->error<%d>", data->error); sdr_clr_bits(MSDC_INTEN, wints); return data->error; Loading Loading @@ -1340,7 +1344,8 @@ static void msdc_dma_stop(struct msdc_host *host) //while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); sdr_set_field(MSDC_DMA_CTRL, MSDC_DMA_CTRL_STOP, 1); while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS); while (sdr_read32(MSDC_DMA_CFG) & MSDC_DMA_CFG_STS) ; //dsb(); /* --- by chhung */ sdr_clr_bits(MSDC_INTEN, wints); /* Not just xfer_comp */ Loading Loading @@ -1733,9 +1738,12 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) #endif #endif /* end of --- */ if (mrq->cmd->error) host->error = 0x001; if (mrq->data && mrq->data->error) host->error |= 0x010; if (mrq->stop && mrq->stop->error) host->error |= 0x100; if (mrq->cmd->error) host->error = 0x001; if (mrq->data && mrq->data->error) host->error |= 0x010; if (mrq->stop && mrq->stop->error) host->error |= 0x100; //if (host->error) ERR_MSG("host->error<%d>", host->error); Loading Loading @@ -1868,7 +1876,8 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) result = msdc_do_request(mmc, mrq); sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, dcrc); /* RO */ if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", (result == 0 && dcrc == 0) ? "PASS" : "FAIL", dcrc, sdr_read32(MSDC_DAT_RDDLY0), sdr_read32(MSDC_DAT_RDDLY1), cur_dsmpl); Loading Loading @@ -2063,7 +2072,8 @@ static int msdc_check_busy(struct mmc_host *mmc, struct msdc_host *host) do { err = msdc_get_card_status(mmc, host, &status); if (err) return err; if (err) return err; /* need cmd12? */ ERR_MSG("cmd<13> resp<0x%x>", status); } while (R1_CURRENT_STATE(status) == 7); Loading Loading @@ -2755,7 +2765,8 @@ static int msdc_drv_probe(struct platform_device *pdev) /* Allocate MMC host for this device */ mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); if (!mmc) return -ENOMEM; if (!mmc) return -ENOMEM; hw = (struct msdc_hw *)pdev->dev.platform_data; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); Loading Loading @@ -2854,7 +2865,8 @@ static int msdc_drv_probe(struct platform_device *pdev) else ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host); if (ret) goto release; if (ret) goto release; // mt65xx_irq_unmask(irq); /* --- by chhung */ if (hw->flags & MSDC_CD_PIN_EN) { /* not set for sdio */ Loading @@ -2879,7 +2891,8 @@ static int msdc_drv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); ret = mmc_add_host(mmc); if (ret) goto free_irq; if (ret) goto free_irq; /* Config card detection pin and enable interrupts */ if (hw->flags & MSDC_CD_PIN_EN) { /* set for card */ Loading