--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
-@@ -810,3 +810,5 @@ config MMC_MTK
+@@ -786,3 +786,5 @@ config MMC_MTK
If you have a machine with a integrated SD/MMC card reader, say Y or M here.
This is needed if support for any SD/SDIO/MMC devices is required.
If unsure, say N.
+
--- /dev/null
+++ b/drivers/mmc/host/mtk-mmc/sd.c
-@@ -0,0 +1,3060 @@
+@@ -0,0 +1,3067 @@
+/* Copyright Statement:
+ *
+ * This software/firmware and related documentation ("MediaTek Software") are
+ .dat_drv = 4,
+ .data_pins = 4,
+ .data_offset = 0,
-+ .flags = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
++ .flags = MSDC_SYS_SUSPEND | MSDC_CD_PIN_EN | MSDC_REMOVABLE | MSDC_HIGHSPEED,
+// .flags = MSDC_SYS_SUSPEND | MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE,
+};
+
+ host->mrq = mrq;
+
+ if (msdc_do_request(mmc,mrq)) {
-+ if(host->hw->flags & MSDC_REMOVABLE && mrq->data && mrq->data->error) {
-+ //msdc_tune_request(mmc,mrq);
++ if(host->hw->flags & MSDC_REMOVABLE && ralink_soc == MT762X_SOC_MT7621AT && mrq->data && mrq->data->error) {
++ msdc_tune_request(mmc,mrq);
+ }
+ }
+
+ int ret, irq;
+
+ pdev->dev.platform_data = &msdc0_hw;
++
++ if (of_property_read_bool(pdev->dev.of_node, "mtk,wp-en"))
++ msdc0_hw.flags |= MSDC_WP_PIN_EN;
+
+ /* Allocate MMC host for this device */
+ mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev);
+ spin_lock_init(&host->lock);
+ msdc_init_hw(host);
+
-+ ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host);
++ if (ralink_soc == MT762X_SOC_MT7621AT)
++ ret = request_irq((unsigned int)irq, msdc_irq, 0, dev_name(&pdev->dev), host);
++ else
++ ret = request_irq((unsigned int)irq, msdc_irq, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), host);
++
+ if (ret) goto release;
+ // mt65xx_irq_unmask(irq); /* --- by chhung */
+