static int simple_sd_ioctl_get_driving(struct msdc_ioctl* msdc_ctl) { u32 base; // unsigned int l_value; if (msdc_ctl->host_num == 0){ #ifndef CFG_DEV_MSDC0 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 1) { #ifndef CFG_DEV_MSDC1 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 2) { #ifndef CFG_DEV_MSDC2 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 3) { #ifndef CFG_DEV_MSDC3 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 4) { #ifndef CFG_DEV_MSDC4 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } base = mtk_msdc_host[msdc_ctl->host_num]->base; #ifndef FPGA_PLATFORM enable_clock(MT_CG_PERI_MSDC30_0 + mtk_msdc_host[msdc_ctl->host_num]->id, "SD"); #endif //sdr_get_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, l_value); msdc_ctl->clk_pu_driving = (msdc_dump_padctl0(msdc_ctl->host_num) & 0x7); //sdr_get_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, l_value); //msdc_ctl->clk_pu_driving = l_value; //sdr_get_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, l_value); //msdc_ctl->cmd_pd_driving = l_value; //sdr_get_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, l_value); msdc_ctl->cmd_pu_driving = (msdc_dump_padctl1(msdc_ctl->host_num) & 0x7); //sdr_get_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, l_value); //msdc_ctl->dat_pd_driving = l_value; //sdr_get_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, l_value); msdc_ctl->dat_pu_driving = (msdc_dump_padctl2(msdc_ctl->host_num) & 0x7); #if DEBUG_MMC_IOCTL //printk("read: clk pull down driving is 0x%x\n", msdc_ctl->clk_pd_driving); printk("read: clk driving is 0x%x\n", msdc_ctl->clk_pu_driving); //printk("read: cmd pull down driving is 0x%x\n", msdc_ctl->cmd_pd_driving); printk("read: cmd driving is 0x%x\n", msdc_ctl->cmd_pu_driving); //printk("read: dat pull down driving is 0x%x\n", msdc_ctl->dat_pd_driving); printk("read: dat driving is 0x%x\n", msdc_ctl->dat_pu_driving); #endif return 0; }
static int simple_sd_ioctl_set_driving(struct msdc_ioctl* msdc_ctl) { u32 base; struct msdc_host *host; #if DEBUG_MMC_IOCTL unsigned int l_value; #endif if (msdc_ctl->host_num == 0){ #ifndef CFG_DEV_MSDC0 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 1) { #ifndef CFG_DEV_MSDC1 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 2) { #ifndef CFG_DEV_MSDC2 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 3) { #ifndef CFG_DEV_MSDC3 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } else if (msdc_ctl->host_num == 4) { #ifndef CFG_DEV_MSDC4 printk("host%d is not config\n", msdc_ctl->host_num); return -1; #endif } base = mtk_msdc_host[msdc_ctl->host_num]->base; #ifndef FPGA_PLATFORM enable_clock(15 + mtk_msdc_host[msdc_ctl->host_num]->id, "SD"); #endif #if DEBUG_MMC_IOCTL //printk("set: clk pull down driving is 0x%x\n", msdc_ctl->clk_pd_driving); printk("set: clk driving is 0x%x\n", msdc_ctl->clk_pu_driving); //printk("set: cmd pull down driving is 0x%x\n", msdc_ctl->cmd_pd_driving); printk("set: cmd driving is 0x%x\n", msdc_ctl->cmd_pu_driving); //printk("set: dat pull down driving is 0x%x\n", msdc_ctl->dat_pd_driving); printk("set: dat driving is 0x%x\n", msdc_ctl->dat_pu_driving); #endif #ifdef FPGA_PLATFORM sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, msdc_ctl->clk_pd_driving); sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, msdc_ctl->clk_pu_driving); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, msdc_ctl->cmd_pd_driving); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, msdc_ctl->cmd_pu_driving); sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, msdc_ctl->dat_pd_driving); sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, msdc_ctl->dat_pu_driving); #else host = mtk_msdc_host[msdc_ctl->host_num]; host->hw->clk_drv = msdc_ctl->clk_pu_driving; host->hw->cmd_drv = msdc_ctl->cmd_pu_driving; host->hw->dat_drv = msdc_ctl->dat_pu_driving; host->hw->clk_drv_sd_18 = msdc_ctl->clk_pu_driving; host->hw->cmd_drv_sd_18 = msdc_ctl->cmd_pu_driving; host->hw->dat_drv_sd_18 = msdc_ctl->dat_pu_driving; msdc_set_driving(host,host->hw,0); #endif #if DEBUG_MMC_IOCTL l_value = 0; //sdr_get_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, l_value); //printk("read: clk pull down driving is 0x%x\n", l_value); l_value = (msdc_dump_padctl0(msdc_ctl->host_num) & 0x7); //sdr_get_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, l_value); printk("read: clk driving is 0x%x\n", l_value); l_value = (msdc_dump_padctl1(msdc_ctl->host_num) & 0x7);; //sdr_get_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, l_value); printk("read: cmd driving is 0x%x\n", l_value); //l_value = 0; //sdr_get_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, l_value); //printk("read: cmd pull up driving is 0x%x\n", l_value); l_value = (msdc_dump_padctl2(msdc_ctl->host_num) & 0x7);; //sdr_get_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, l_value); printk("read: dat driving is 0x%x\n", l_value); //l_value = 0; //sdr_get_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, l_value); //printk("read: dat pull up driving is 0x%x\n", l_value); #endif return 0; }