static int simple_sd_ioctl_get_driving(struct msdc_ioctl *msdc_ctl) { void __iomem *base; /* unsigned int l_value; */ struct msdc_host *host; if(!msdc_ctl) return -EINVAL; if((msdc_ctl->host_num < 0) || (msdc_ctl->host_num >= HOST_MAX_NUM)){ pr_err("invalid host num: %d\n", msdc_ctl->host_num); return -EINVAL; }else if (msdc_ctl->host_num == 0){ #ifndef CFG_DEV_MSDC0 pr_err("host%d is not config\n", msdc_ctl->host_num); return -EINVAL; #endif } else if (msdc_ctl->host_num == 1) { #ifndef CFG_DEV_MSDC1 pr_err("host%d is not config\n", msdc_ctl->host_num); return -EINVAL; #endif } else if (msdc_ctl->host_num == 2) { #ifndef CFG_DEV_MSDC2 pr_err("host%d is not config\n", msdc_ctl->host_num); return -EINVAL; #endif } else if (msdc_ctl->host_num == 3) { #ifndef CFG_DEV_MSDC3 pr_err("host%d is not config\n", msdc_ctl->host_num); return -EINVAL; #endif } else if (msdc_ctl->host_num == 4) { #ifndef CFG_DEV_MSDC4 pr_err("host%d is not config\n", msdc_ctl->host_num); return -EINVAL; #endif }else { pr_err("invalid host num: %d\n", msdc_ctl->host_num); return -EINVAL; } host = mtk_msdc_host[msdc_ctl->host_num]; BUG_ON(!host); base = host->base; #ifndef FPGA_PLATFORM enable_clock(MT_CG_PERI_MSDC30_0 + host->id, "SD"); msdc_get_driving(mtk_msdc_host[msdc_ctl->host_num], msdc_ctl); #if DEBUG_MMC_IOCTL pr_debug("read: clk driving is 0x%x\n", msdc_ctl->clk_pu_driving); pr_debug("read: cmd driving is 0x%x\n", msdc_ctl->cmd_pu_driving); pr_debug("read: dat driving is 0x%x\n", msdc_ctl->dat_pu_driving); pr_debug("read: rst driving is 0x%x\n", msdc_ctl->rst_pu_driving); pr_debug("read: ds driving is 0x%x\n", msdc_ctl->ds_pu_driving); #endif #endif return 0; }
static int simple_sd_ioctl_get_driving(struct msdc_ioctl* msdc_ctl) { void __iomem *base; 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(msdc_cg_clk_id[msdc_ctl->host_num], "SD"); msdc_get_driving(mtk_msdc_host[msdc_ctl->host_num], msdc_ctl); #if DEBUG_MMC_IOCTL printk("read: clk driving is 0x%x\n", msdc_ctl->clk_pu_driving); printk("read: cmd driving is 0x%x\n", msdc_ctl->cmd_pu_driving); printk("read: dat driving is 0x%x\n", msdc_ctl->dat_pu_driving); printk("read: rst driving is 0x%x\n", msdc_ctl->rst_pu_driving); printk("read: ds driving is 0x%x\n", msdc_ctl->ds_pu_driving); #endif #endif return 0; }