lkml.org 
[lkml]   [2017]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5/9] Revert "mmc: dw_mmc: change the array of slots"
    Date
    This reverts commit b23475faed77f6a9016013c8db6b4707466e74a8.

    The Mellanox BlueField SoC requires multiple slot dw-mmc support.

    Signed-off-by: Liming Sun <lsun@mellanox.com>
    ---
    drivers/mmc/host/dw_mmc.c | 21 ++++++++++++---------
    drivers/mmc/host/dw_mmc.h | 4 +++-
    2 files changed, 15 insertions(+), 10 deletions(-)

    diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
    index a4356d6..d11b8d7 100644
    --- a/drivers/mmc/host/dw_mmc.c
    +++ b/drivers/mmc/host/dw_mmc.c
    @@ -2582,7 +2582,8 @@ static void dw_mci_cmd_interrupt(struct dw_mci *host, u32 status)

    static void dw_mci_handle_cd(struct dw_mci *host)
    {
    - struct dw_mci_slot *slot = host->slot;
    + int i = 0;
    + struct dw_mci_slot *slot = host->slot[i];

    if (slot->mmc->ops->card_event)
    slot->mmc->ops->card_event(slot->mmc);
    @@ -2594,7 +2595,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id)
    {
    struct dw_mci *host = dev_id;
    u32 pending;
    - struct dw_mci_slot *slot = host->slot;
    + int i = 0;
    + struct dw_mci_slot *slot = host->slot[i];

    pending = mci_readl(host, MINTSTS); /* read-only mask reg */

    @@ -2726,7 +2728,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
    slot->sdio_id = host->sdio_id0 + id;
    slot->mmc = mmc;
    slot->host = host;
    - host->slot = slot;
    + host->slot[id] = slot;

    mmc->ops = &dw_mci_ops;
    if (device_property_read_u32_array(host->dev, "clock-freq-min-max",
    @@ -2826,7 +2828,7 @@ static void dw_mci_cleanup_slot(struct dw_mci_slot *slot, unsigned int id)
    {
    /* Debugfs stuff is cleaned up by mmc core */
    mmc_remove_host(slot->mmc);
    - slot->host->slot = NULL;
    + slot->host->slot[id] = NULL;
    mmc_free_host(slot->mmc);
    }

    @@ -3041,13 +3043,14 @@ static void dw_mci_enable_cd(struct dw_mci *host)
    {
    unsigned long irqflags;
    u32 temp;
    + int i = 0;
    struct dw_mci_slot *slot;

    /*
    * No need for CD if all slots have a non-error GPIO
    * as well as broken card detection is found.
    */
    - slot = host->slot;
    + slot = host->slot[i];
    if (slot->mmc->caps & MMC_CAP_NEEDS_POLL)
    return;

    @@ -3278,8 +3281,8 @@ void dw_mci_remove(struct dw_mci *host)
    int i = 0;

    dev_dbg(host->dev, "remove slot %d\n", i);
    - if (host->slot)
    - dw_mci_cleanup_slot(host->slot, i);
    + if (host->slot[i])
    + dw_mci_cleanup_slot(host->slot[i], i);

    mci_writel(host, RINTSTS, 0xFFFFFFFF);
    mci_writel(host, INTMASK, 0); /* disable all mmc interrupt first */
    @@ -3322,9 +3325,9 @@ int dw_mci_runtime_suspend(struct device *dev)

    int dw_mci_runtime_resume(struct device *dev)
    {
    - int ret = 0;
    + int i = 0, ret = 0;
    struct dw_mci *host = dev_get_drvdata(dev);
    - struct dw_mci_slot *slot = host->slot;
    + struct dw_mci_slot *slot = host->slot[i];

    if (host->cur_slot &&
    (mmc_can_gpio_cd(host->cur_slot->mmc) ||
    diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
    index 20a956e..e62cafc 100644
    --- a/drivers/mmc/host/dw_mmc.h
    +++ b/drivers/mmc/host/dw_mmc.h
    @@ -20,6 +20,8 @@
    #include <linux/reset.h>
    #include <linux/interrupt.h>

    +#define MAX_MCI_SLOTS 2
    +
    enum dw_mci_state {
    STATE_IDLE = 0,
    STATE_SENDING_CMD,
    @@ -214,7 +216,7 @@ struct dw_mci {
    void *priv;
    struct clk *biu_clk;
    struct clk *ciu_clk;
    - struct dw_mci_slot *slot;
    + struct dw_mci_slot *slot[MAX_MCI_SLOTS];

    /* FIFO push and pull */
    int fifo_depth;
    --
    1.8.3.1
    \
     
     \ /
      Last update: 2017-10-06 21:24    [W:2.999 / U:0.124 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site