Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On 03/03/2017 08:38 PM, Sergio Prado wrote: > On Fri, Mar 03, 2017 at 11:14:29AM +0900, Jaehoon Chung wrote: >> On 03/02/2017 10:18 AM, Sergio Prado wrote: >>> Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device >>> tree. >>> >>> Signed-off-by: Sergio Prado>>> --- >>> drivers/mmc/host/s3cmci.c | 298 >>> -- >>> drivers/mmc/host/s3cmci.h | 3 +- >>> 2 files changed, 158 insertions(+), 143 deletions(-) >>> >>> diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c >>> index 7a173f8c455b..d066dbdb957c 100644 >>> --- a/drivers/mmc/host/s3cmci.c >>> +++ b/drivers/mmc/host/s3cmci.c >>> @@ -24,6 +24,10 @@ >>> #include >>> #include >>> #include >>> +#include >>> +#include >>> +#include >>> +#include >>> >>> #include >>> #include >>> @@ -128,6 +132,22 @@ enum dbg_channels { >>> dbg_conf = (1 << 8), >>> }; >>> >>> +struct s3cmci_variant_data { >>> + int s3c2440_compatible; >>> +}; >> >> I didn't understand why this structure needs. >> >> Before this patch, >> host->is2440; >> >> After this patch, >> host->variant->s3c2440_compatible; >> >> Just add the one pointer for checking s3c2400 compatible.. >> Is it really meaningful? >> (I didn't read the previous comments fully.) > > Although just a pointer would be enought, having a structure makes it > more flexible to extend it in the future. If you will add the other members in this structure, it's ok. But if it's only for compatible, i don't agree this. Best Regards, Jaehoon Chung > > Best regards, > > Sergio Prado > > >
Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On 03/03/2017 08:38 PM, Sergio Prado wrote: > On Fri, Mar 03, 2017 at 11:14:29AM +0900, Jaehoon Chung wrote: >> On 03/02/2017 10:18 AM, Sergio Prado wrote: >>> Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device >>> tree. >>> >>> Signed-off-by: Sergio Prado >>> --- >>> drivers/mmc/host/s3cmci.c | 298 >>> -- >>> drivers/mmc/host/s3cmci.h | 3 +- >>> 2 files changed, 158 insertions(+), 143 deletions(-) >>> >>> diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c >>> index 7a173f8c455b..d066dbdb957c 100644 >>> --- a/drivers/mmc/host/s3cmci.c >>> +++ b/drivers/mmc/host/s3cmci.c >>> @@ -24,6 +24,10 @@ >>> #include >>> #include >>> #include >>> +#include >>> +#include >>> +#include >>> +#include >>> >>> #include >>> #include >>> @@ -128,6 +132,22 @@ enum dbg_channels { >>> dbg_conf = (1 << 8), >>> }; >>> >>> +struct s3cmci_variant_data { >>> + int s3c2440_compatible; >>> +}; >> >> I didn't understand why this structure needs. >> >> Before this patch, >> host->is2440; >> >> After this patch, >> host->variant->s3c2440_compatible; >> >> Just add the one pointer for checking s3c2400 compatible.. >> Is it really meaningful? >> (I didn't read the previous comments fully.) > > Although just a pointer would be enought, having a structure makes it > more flexible to extend it in the future. If you will add the other members in this structure, it's ok. But if it's only for compatible, i don't agree this. Best Regards, Jaehoon Chung > > Best regards, > > Sergio Prado > > >
Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On Fri, Mar 03, 2017 at 11:14:29AM +0900, Jaehoon Chung wrote: > On 03/02/2017 10:18 AM, Sergio Prado wrote: > > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > > tree. > > > > Signed-off-by: Sergio Prado> > --- > > drivers/mmc/host/s3cmci.c | 298 > > -- > > drivers/mmc/host/s3cmci.h | 3 +- > > 2 files changed, 158 insertions(+), 143 deletions(-) > > > > diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c > > index 7a173f8c455b..d066dbdb957c 100644 > > --- a/drivers/mmc/host/s3cmci.c > > +++ b/drivers/mmc/host/s3cmci.c > > @@ -24,6 +24,10 @@ > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > > > #include > > #include > > @@ -128,6 +132,22 @@ enum dbg_channels { > > dbg_conf = (1 << 8), > > }; > > > > +struct s3cmci_variant_data { > > + int s3c2440_compatible; > > +}; > > I didn't understand why this structure needs. > > Before this patch, > host->is2440; > > After this patch, > host->variant->s3c2440_compatible; > > Just add the one pointer for checking s3c2400 compatible.. > Is it really meaningful? > (I didn't read the previous comments fully.) Although just a pointer would be enought, having a structure makes it more flexible to extend it in the future. Best regards, Sergio Prado
Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On Fri, Mar 03, 2017 at 11:14:29AM +0900, Jaehoon Chung wrote: > On 03/02/2017 10:18 AM, Sergio Prado wrote: > > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > > tree. > > > > Signed-off-by: Sergio Prado > > --- > > drivers/mmc/host/s3cmci.c | 298 > > -- > > drivers/mmc/host/s3cmci.h | 3 +- > > 2 files changed, 158 insertions(+), 143 deletions(-) > > > > diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c > > index 7a173f8c455b..d066dbdb957c 100644 > > --- a/drivers/mmc/host/s3cmci.c > > +++ b/drivers/mmc/host/s3cmci.c > > @@ -24,6 +24,10 @@ > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > > > #include > > #include > > @@ -128,6 +132,22 @@ enum dbg_channels { > > dbg_conf = (1 << 8), > > }; > > > > +struct s3cmci_variant_data { > > + int s3c2440_compatible; > > +}; > > I didn't understand why this structure needs. > > Before this patch, > host->is2440; > > After this patch, > host->variant->s3c2440_compatible; > > Just add the one pointer for checking s3c2400 compatible.. > Is it really meaningful? > (I didn't read the previous comments fully.) Although just a pointer would be enought, having a structure makes it more flexible to extend it in the future. Best regards, Sergio Prado
Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On 03/02/2017 10:18 AM, Sergio Prado wrote: > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > tree. > > Signed-off-by: Sergio Prado> --- > drivers/mmc/host/s3cmci.c | 298 > -- > drivers/mmc/host/s3cmci.h | 3 +- > 2 files changed, 158 insertions(+), 143 deletions(-) > > diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c > index 7a173f8c455b..d066dbdb957c 100644 > --- a/drivers/mmc/host/s3cmci.c > +++ b/drivers/mmc/host/s3cmci.c > @@ -24,6 +24,10 @@ > #include > #include > #include > +#include > +#include > +#include > +#include > > #include > #include > @@ -128,6 +132,22 @@ enum dbg_channels { > dbg_conf = (1 << 8), > }; > > +struct s3cmci_variant_data { > + int s3c2440_compatible; > +}; I didn't understand why this structure needs. Before this patch, host->is2440; After this patch, host->variant->s3c2440_compatible; Just add the one pointer for checking s3c2400 compatible.. Is it really meaningful? (I didn't read the previous comments fully.) Best Regards, Jaehoon Chung > + > +static const struct s3cmci_variant_data s3c2410_s3cmci_variant_data = { > + .s3c2440_compatible = 0, > +}; > + > +static const struct s3cmci_variant_data s3c2412_s3cmci_variant_data = { > + .s3c2440_compatible = 1, > +}; > + > +static const struct s3cmci_variant_data s3c2440_s3cmci_variant_data = { > + .s3c2440_compatible = 1, > +}; > + > static const int dbgmap_err = dbg_fail; > static const int dbgmap_info = dbg_info | dbg_conf; > static const int dbgmap_debug = dbg_err | dbg_debug; > @@ -731,7 +751,7 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) > goto clear_status_bits; > > /* Check for FIFO failure */ > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) { > dbg(host, dbg_err, "FIFO failure\n"); > host->mrq->data->error = -EILSEQ; > @@ -807,21 +827,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) > > } > > -/* > - * ISR for the CardDetect Pin > -*/ > - > -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) > -{ > - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; > - > - dbg(host, dbg_irq, "card detect\n"); > - > - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); > - > - return IRQ_HANDLED; > -} > - > static void s3cmci_dma_done_callback(void *arg) > { > struct s3cmci_host *host = arg; > @@ -913,7 +918,7 @@ static void finalize_request(struct s3cmci_host *host) > if (s3cmci_host_usedma(host)) > dmaengine_terminate_all(host->dma); > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > /* Clear failure register and reset fifo. */ > writel(S3C2440_SDIFSTA_FIFORESET | > S3C2440_SDIFSTA_FIFOFAIL, > @@ -1026,7 +1031,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, > struct mmc_data *data) > dcon |= S3C2410_SDIDCON_XFER_RXSTART; > } > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > dcon |= S3C2440_SDIDCON_DS_WORD; > dcon |= S3C2440_SDIDCON_DATSTART; > } > @@ -1045,7 +1050,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, > struct mmc_data *data) > > /* write TIMER register */ > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > writel(0x007F, host->base + S3C2410_SDITIMER); > } else { > writel(0x, host->base + S3C2410_SDITIMER); > @@ -1177,19 +1182,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) > s3cmci_enable_irq(host, true); > } > > -static int s3cmci_card_present(struct mmc_host *mmc) > -{ > - struct s3cmci_host *host = mmc_priv(mmc); > - struct s3c24xx_mci_pdata *pdata = host->pdata; > - int ret; > - > - if (pdata->no_detect) > - return -ENOSYS; > - > - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; > - return ret ^ pdata->detect_invert; > -} > - > static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) > { > struct s3cmci_host *host = mmc_priv(mmc); > @@ -1198,7 +1190,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct > mmc_request *mrq) > host->cmd_is_stop = 0; > host->mrq = mrq; > > - if (s3cmci_card_present(mmc) == 0) { > + if (mmc_gpio_get_cd(mmc) == 0) { > dbg(host, dbg_err, "%s: no medium present\n", __func__); > host->mrq->cmd->error = -ENOMEDIUM; > mmc_request_done(mmc, mrq); > @@ -1242,22 +1234,24 @@ static void s3cmci_set_ios(struct mmc_host *mmc, > struct mmc_ios *ios) > case MMC_POWER_ON: > case MMC_POWER_UP: >
Re: [PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
On 03/02/2017 10:18 AM, Sergio Prado wrote: > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > tree. > > Signed-off-by: Sergio Prado > --- > drivers/mmc/host/s3cmci.c | 298 > -- > drivers/mmc/host/s3cmci.h | 3 +- > 2 files changed, 158 insertions(+), 143 deletions(-) > > diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c > index 7a173f8c455b..d066dbdb957c 100644 > --- a/drivers/mmc/host/s3cmci.c > +++ b/drivers/mmc/host/s3cmci.c > @@ -24,6 +24,10 @@ > #include > #include > #include > +#include > +#include > +#include > +#include > > #include > #include > @@ -128,6 +132,22 @@ enum dbg_channels { > dbg_conf = (1 << 8), > }; > > +struct s3cmci_variant_data { > + int s3c2440_compatible; > +}; I didn't understand why this structure needs. Before this patch, host->is2440; After this patch, host->variant->s3c2440_compatible; Just add the one pointer for checking s3c2400 compatible.. Is it really meaningful? (I didn't read the previous comments fully.) Best Regards, Jaehoon Chung > + > +static const struct s3cmci_variant_data s3c2410_s3cmci_variant_data = { > + .s3c2440_compatible = 0, > +}; > + > +static const struct s3cmci_variant_data s3c2412_s3cmci_variant_data = { > + .s3c2440_compatible = 1, > +}; > + > +static const struct s3cmci_variant_data s3c2440_s3cmci_variant_data = { > + .s3c2440_compatible = 1, > +}; > + > static const int dbgmap_err = dbg_fail; > static const int dbgmap_info = dbg_info | dbg_conf; > static const int dbgmap_debug = dbg_err | dbg_debug; > @@ -731,7 +751,7 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) > goto clear_status_bits; > > /* Check for FIFO failure */ > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) { > dbg(host, dbg_err, "FIFO failure\n"); > host->mrq->data->error = -EILSEQ; > @@ -807,21 +827,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) > > } > > -/* > - * ISR for the CardDetect Pin > -*/ > - > -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) > -{ > - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; > - > - dbg(host, dbg_irq, "card detect\n"); > - > - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); > - > - return IRQ_HANDLED; > -} > - > static void s3cmci_dma_done_callback(void *arg) > { > struct s3cmci_host *host = arg; > @@ -913,7 +918,7 @@ static void finalize_request(struct s3cmci_host *host) > if (s3cmci_host_usedma(host)) > dmaengine_terminate_all(host->dma); > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > /* Clear failure register and reset fifo. */ > writel(S3C2440_SDIFSTA_FIFORESET | > S3C2440_SDIFSTA_FIFOFAIL, > @@ -1026,7 +1031,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, > struct mmc_data *data) > dcon |= S3C2410_SDIDCON_XFER_RXSTART; > } > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > dcon |= S3C2440_SDIDCON_DS_WORD; > dcon |= S3C2440_SDIDCON_DATSTART; > } > @@ -1045,7 +1050,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, > struct mmc_data *data) > > /* write TIMER register */ > > - if (host->is2440) { > + if (host->variant->s3c2440_compatible) { > writel(0x007F, host->base + S3C2410_SDITIMER); > } else { > writel(0x, host->base + S3C2410_SDITIMER); > @@ -1177,19 +1182,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) > s3cmci_enable_irq(host, true); > } > > -static int s3cmci_card_present(struct mmc_host *mmc) > -{ > - struct s3cmci_host *host = mmc_priv(mmc); > - struct s3c24xx_mci_pdata *pdata = host->pdata; > - int ret; > - > - if (pdata->no_detect) > - return -ENOSYS; > - > - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; > - return ret ^ pdata->detect_invert; > -} > - > static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) > { > struct s3cmci_host *host = mmc_priv(mmc); > @@ -1198,7 +1190,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct > mmc_request *mrq) > host->cmd_is_stop = 0; > host->mrq = mrq; > > - if (s3cmci_card_present(mmc) == 0) { > + if (mmc_gpio_get_cd(mmc) == 0) { > dbg(host, dbg_err, "%s: no medium present\n", __func__); > host->mrq->cmd->error = -ENOMEDIUM; > mmc_request_done(mmc, mrq); > @@ -1242,22 +1234,24 @@ static void s3cmci_set_ios(struct mmc_host *mmc, > struct mmc_ios *ios) > case MMC_POWER_ON: > case MMC_POWER_UP: > /* Configure GPE5...GPE10
[PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device tree. Signed-off-by: Sergio Prado--- drivers/mmc/host/s3cmci.c | 298 -- drivers/mmc/host/s3cmci.h | 3 +- 2 files changed, 158 insertions(+), 143 deletions(-) diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 7a173f8c455b..d066dbdb957c 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c @@ -24,6 +24,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -128,6 +132,22 @@ enum dbg_channels { dbg_conf = (1 << 8), }; +struct s3cmci_variant_data { + int s3c2440_compatible; +}; + +static const struct s3cmci_variant_data s3c2410_s3cmci_variant_data = { + .s3c2440_compatible = 0, +}; + +static const struct s3cmci_variant_data s3c2412_s3cmci_variant_data = { + .s3c2440_compatible = 1, +}; + +static const struct s3cmci_variant_data s3c2440_s3cmci_variant_data = { + .s3c2440_compatible = 1, +}; + static const int dbgmap_err = dbg_fail; static const int dbgmap_info = dbg_info | dbg_conf; static const int dbgmap_debug = dbg_err | dbg_debug; @@ -731,7 +751,7 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) goto clear_status_bits; /* Check for FIFO failure */ - if (host->is2440) { + if (host->variant->s3c2440_compatible) { if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) { dbg(host, dbg_err, "FIFO failure\n"); host->mrq->data->error = -EILSEQ; @@ -807,21 +827,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) } -/* - * ISR for the CardDetect Pin -*/ - -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) -{ - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; - - dbg(host, dbg_irq, "card detect\n"); - - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); - - return IRQ_HANDLED; -} - static void s3cmci_dma_done_callback(void *arg) { struct s3cmci_host *host = arg; @@ -913,7 +918,7 @@ static void finalize_request(struct s3cmci_host *host) if (s3cmci_host_usedma(host)) dmaengine_terminate_all(host->dma); - if (host->is2440) { + if (host->variant->s3c2440_compatible) { /* Clear failure register and reset fifo. */ writel(S3C2440_SDIFSTA_FIFORESET | S3C2440_SDIFSTA_FIFOFAIL, @@ -1026,7 +1031,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) dcon |= S3C2410_SDIDCON_XFER_RXSTART; } - if (host->is2440) { + if (host->variant->s3c2440_compatible) { dcon |= S3C2440_SDIDCON_DS_WORD; dcon |= S3C2440_SDIDCON_DATSTART; } @@ -1045,7 +1050,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) /* write TIMER register */ - if (host->is2440) { + if (host->variant->s3c2440_compatible) { writel(0x007F, host->base + S3C2410_SDITIMER); } else { writel(0x, host->base + S3C2410_SDITIMER); @@ -1177,19 +1182,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) s3cmci_enable_irq(host, true); } -static int s3cmci_card_present(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_detect) - return -ENOSYS; - - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; - return ret ^ pdata->detect_invert; -} - static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1198,7 +1190,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) host->cmd_is_stop = 0; host->mrq = mrq; - if (s3cmci_card_present(mmc) == 0) { + if (mmc_gpio_get_cd(mmc) == 0) { dbg(host, dbg_err, "%s: no medium present\n", __func__); host->mrq->cmd->error = -ENOMEDIUM; mmc_request_done(mmc, mrq); @@ -1242,22 +1234,24 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_ON: case MMC_POWER_UP: /* Configure GPE5...GPE10 pins in SD mode */ - s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), - S3C_GPIO_PULL_NONE); + if (!host->pdev->dev.of_node) + s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), + S3C_GPIO_PULL_NONE); if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); -
[PATCH v4 2/2] mmc: host: s3cmci: allow probing from device tree
Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device tree. Signed-off-by: Sergio Prado --- drivers/mmc/host/s3cmci.c | 298 -- drivers/mmc/host/s3cmci.h | 3 +- 2 files changed, 158 insertions(+), 143 deletions(-) diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 7a173f8c455b..d066dbdb957c 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c @@ -24,6 +24,10 @@ #include #include #include +#include +#include +#include +#include #include #include @@ -128,6 +132,22 @@ enum dbg_channels { dbg_conf = (1 << 8), }; +struct s3cmci_variant_data { + int s3c2440_compatible; +}; + +static const struct s3cmci_variant_data s3c2410_s3cmci_variant_data = { + .s3c2440_compatible = 0, +}; + +static const struct s3cmci_variant_data s3c2412_s3cmci_variant_data = { + .s3c2440_compatible = 1, +}; + +static const struct s3cmci_variant_data s3c2440_s3cmci_variant_data = { + .s3c2440_compatible = 1, +}; + static const int dbgmap_err = dbg_fail; static const int dbgmap_info = dbg_info | dbg_conf; static const int dbgmap_debug = dbg_err | dbg_debug; @@ -731,7 +751,7 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) goto clear_status_bits; /* Check for FIFO failure */ - if (host->is2440) { + if (host->variant->s3c2440_compatible) { if (mci_fsta & S3C2440_SDIFSTA_FIFOFAIL) { dbg(host, dbg_err, "FIFO failure\n"); host->mrq->data->error = -EILSEQ; @@ -807,21 +827,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) } -/* - * ISR for the CardDetect Pin -*/ - -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) -{ - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; - - dbg(host, dbg_irq, "card detect\n"); - - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); - - return IRQ_HANDLED; -} - static void s3cmci_dma_done_callback(void *arg) { struct s3cmci_host *host = arg; @@ -913,7 +918,7 @@ static void finalize_request(struct s3cmci_host *host) if (s3cmci_host_usedma(host)) dmaengine_terminate_all(host->dma); - if (host->is2440) { + if (host->variant->s3c2440_compatible) { /* Clear failure register and reset fifo. */ writel(S3C2440_SDIFSTA_FIFORESET | S3C2440_SDIFSTA_FIFOFAIL, @@ -1026,7 +1031,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) dcon |= S3C2410_SDIDCON_XFER_RXSTART; } - if (host->is2440) { + if (host->variant->s3c2440_compatible) { dcon |= S3C2440_SDIDCON_DS_WORD; dcon |= S3C2440_SDIDCON_DATSTART; } @@ -1045,7 +1050,7 @@ static int s3cmci_setup_data(struct s3cmci_host *host, struct mmc_data *data) /* write TIMER register */ - if (host->is2440) { + if (host->variant->s3c2440_compatible) { writel(0x007F, host->base + S3C2410_SDITIMER); } else { writel(0x, host->base + S3C2410_SDITIMER); @@ -1177,19 +1182,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) s3cmci_enable_irq(host, true); } -static int s3cmci_card_present(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_detect) - return -ENOSYS; - - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; - return ret ^ pdata->detect_invert; -} - static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1198,7 +1190,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) host->cmd_is_stop = 0; host->mrq = mrq; - if (s3cmci_card_present(mmc) == 0) { + if (mmc_gpio_get_cd(mmc) == 0) { dbg(host, dbg_err, "%s: no medium present\n", __func__); host->mrq->cmd->error = -ENOMEDIUM; mmc_request_done(mmc, mrq); @@ -1242,22 +1234,24 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_ON: case MMC_POWER_UP: /* Configure GPE5...GPE10 pins in SD mode */ - s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), - S3C_GPIO_PULL_NONE); + if (!host->pdev->dev.of_node) + s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), + S3C_GPIO_PULL_NONE); if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); - if (!host->is2440) +