Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3385419imu; Mon, 28 Jan 2019 04:04:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN4NyU+zQsHQfKJLp3haBTdkTi7l1VO/MV7c6GBpti8PSWPMlZEz/yFquFOCNvGdp1X6rumF X-Received: by 2002:a62:6b8a:: with SMTP id g132mr21819155pfc.201.1548677065247; Mon, 28 Jan 2019 04:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548677065; cv=none; d=google.com; s=arc-20160816; b=CbixrDTRCgDKOYbM3NjmytcP6+EFDnKHj1hhE4Mg729OqGBKOnv/xsK3iNeUyBuPEC fOoQ+FmV9Yli3cr7jUF+z0ip8vMloNbktzEKQMaDm0eUV0emX+pME4EmIN0qGgSxgUrm o+ruD53pkIkuzzONmi1x8/aJ7+FTGo5fTJrBbEMWUv0asuTH+OmLWLc2oDyxvM8lEXJJ alh5KKUiP/QWlamIJuZ45idPxJmMPnYmScadFjy54PhEQEHdAkLzeoB9YOKdJlZU0XZj a5+jgAp3GQz0A5J4cplXzV9AWBEW36pGz0FuWa8Fa9uJMFbK5RrquSnJnLGsICvAX9H8 vxKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZI2rJhuRCzGYru6LjGYY0vfB1SqN0M1XOhW5Tz6Lk7A=; b=kLokpy8rIuREo9qYaSXZKDAKG8VqiwWuYFgFpRkj13FliVEsoPf1HYZyLBKCUif35h xReJTL+1sWGTC/DXBIT8RVhlzd5dsVIC44ET1lxGJtsJVFQvOT5Rq+uq4f7Fbyvfm4s5 M6o4SvqJrCQdvRDg+GNpNgHMSOt7qT/spZzA6dea58IaJILRjkD5xs0dlJTY206ZDspd IGvoOIEF/+kXJo+HGguG69qT51ch7BJo9wJdKX1iU3g2lCeI0QAr5QovxG3tZYzqtSa0 dhNqcTtKp9bgFhVWDRVKeHGGE4BSDnPfc9d6oY7HH1JiIldvSM1qJ72MOF8VcoiNyvSt KpiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TY/k+Lo2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j21si19493pfn.277.2019.01.28.04.04.09; Mon, 28 Jan 2019 04:04:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="TY/k+Lo2"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726979AbfA1MDg (ORCPT + 99 others); Mon, 28 Jan 2019 07:03:36 -0500 Received: from mail-ua1-f67.google.com ([209.85.222.67]:42942 "EHLO mail-ua1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726798AbfA1MDf (ORCPT ); Mon, 28 Jan 2019 07:03:35 -0500 Received: by mail-ua1-f67.google.com with SMTP id d21so5481008uap.9 for ; Mon, 28 Jan 2019 04:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZI2rJhuRCzGYru6LjGYY0vfB1SqN0M1XOhW5Tz6Lk7A=; b=TY/k+Lo2IT512g2KVK6WNcKuxdLu7t6HKvs5zFdh5aIuPIbX5hufcmX6gnggjMU2mc 3EDo31d+L8eaBno1DclQucQSHfkN+YYV4Ni4Ii0pvyKVs8wtx228ZO8CHU3IJvLuxUCe ytoXK7ROGSMn5j7m8gc7NyPDN5TnbnBVxZvB8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZI2rJhuRCzGYru6LjGYY0vfB1SqN0M1XOhW5Tz6Lk7A=; b=VmhBnopiAUo7sIk/XuN1CLUdwc3WiYP85GET3MOVjokOO9o5+UiQUuqsg2YEiSj2dV qXjE3FqbCAPCiYE9lX7l3hAXx7vTRUvjnH8y59TeqhJF8AwBIk6xE/SerTrRNkdVCvF0 Oi4cGxehk3Iuatqhup2js9t/UMC5goLodrOiOsuiSoGtvv3P4tYiRMaPY6Pkw1vHTrm9 oI/MOxF2gAwI6ehInHTX6EG+M3sHFcipaujsIE9HYBrAIki9XiYFM/lB7wa32O1nfTu9 l46lz9tFXAIwRXsuiei49NBrEo00U86yuC+oYl5eQDJMYK59RC+NRHtS9S7DSfJgVmQX dT1g== X-Gm-Message-State: AJcUukcHPkrgdenkmhUBmm0dlNuC9rHnGY5HpYtlTvc5wB+EN+CdCO3g a2hZUiCI7xyvtr2blr/R5482C4Phc3Ws8Mfgf+U3dg== X-Received: by 2002:ab0:3484:: with SMTP id c4mr8936571uar.39.1548677014331; Mon, 28 Jan 2019 04:03:34 -0800 (PST) MIME-Version: 1.0 References: <20190125200927.21045-1-paul@crapouillou.net> In-Reply-To: <20190125200927.21045-1-paul@crapouillou.net> From: Ulf Hansson Date: Mon, 28 Jan 2019 13:02:58 +0100 Message-ID: Subject: Re: [PATCH 1/3] mmc: jz4740: Remove platform data and use standard APIs To: Paul Cercueil Cc: Rob Herring , Mark Rutland , Ralf Baechle , Paul Burton , James Hogan , Linus Walleij , DTML , linux-mips@vger.kernel.org, Linux Kernel Mailing List , "linux-mmc@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 25 Jan 2019 at 21:09, Paul Cercueil wrote: > > Drop the custom code to get the 'cd' and 'wp' GPIOs. The driver now > calls mmc_of_parse() which will init these from devicetree or > device properties. > > Also drop the custom code to get the 'power' GPIO. The MMC core > provides us with the means to power the MMC card through an external > regulator. > > Signed-off-by: Paul Cercueil Applied for next, thanks! Should I also pick up the other two MIPS patches or you want to funnel those through the MIPS soc tree? Kind regards Uffe > --- > drivers/mmc/host/jz4740_mmc.c | 71 +++++++++---------------------------------- > 1 file changed, 14 insertions(+), 57 deletions(-) > > diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c > index 33215d66afa2..e41c7230815f 100644 > --- a/drivers/mmc/host/jz4740_mmc.c > +++ b/drivers/mmc/host/jz4740_mmc.c > @@ -21,7 +21,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -36,7 +35,6 @@ > #include > > #include > -#include > > #define JZ_REG_MMC_STRPCL 0x00 > #define JZ_REG_MMC_STATUS 0x04 > @@ -148,9 +146,7 @@ enum jz4780_cookie { > struct jz4740_mmc_host { > struct mmc_host *mmc; > struct platform_device *pdev; > - struct jz4740_mmc_platform_data *pdata; > struct clk *clk; > - struct gpio_desc *power; > > enum jz4740_mmc_version version; > > @@ -894,16 +890,16 @@ static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) > switch (ios->power_mode) { > case MMC_POWER_UP: > jz4740_mmc_reset(host); > - if (host->power) > - gpiod_set_value(host->power, 1); > + if (!IS_ERR(mmc->supply.vmmc)) > + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); > host->cmdat |= JZ_MMC_CMDAT_INIT; > clk_prepare_enable(host->clk); > break; > case MMC_POWER_ON: > break; > default: > - if (host->power) > - gpiod_set_value(host->power, 0); > + if (!IS_ERR(mmc->supply.vmmc)) > + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); > clk_disable_unprepare(host->clk); > break; > } > @@ -936,38 +932,6 @@ static const struct mmc_host_ops jz4740_mmc_ops = { > .enable_sdio_irq = jz4740_mmc_enable_sdio_irq, > }; > > -static int jz4740_mmc_request_gpios(struct jz4740_mmc_host *host, > - struct mmc_host *mmc, > - struct platform_device *pdev) > -{ > - struct jz4740_mmc_platform_data *pdata = dev_get_platdata(&pdev->dev); > - int ret = 0; > - > - if (!pdata) > - return 0; > - > - if (!pdata->card_detect_active_low) > - mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; > - if (!pdata->read_only_active_low) > - mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; > - > - /* > - * Get optional card detect and write protect GPIOs, > - * only back out on probe deferral. > - */ > - ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL); > - if (ret == -EPROBE_DEFER) > - return ret; > - > - ret = mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); > - if (ret == -EPROBE_DEFER) > - return ret; > - > - host->power = devm_gpiod_get_optional(&pdev->dev, "power", > - GPIOD_OUT_HIGH); > - return PTR_ERR_OR_ZERO(host->power); > -} > - > static const struct of_device_id jz4740_mmc_of_match[] = { > { .compatible = "ingenic,jz4740-mmc", .data = (void *) JZ_MMC_JZ4740 }, > { .compatible = "ingenic,jz4725b-mmc", .data = (void *)JZ_MMC_JZ4725B }, > @@ -982,9 +946,6 @@ static int jz4740_mmc_probe(struct platform_device* pdev) > struct mmc_host *mmc; > struct jz4740_mmc_host *host; > const struct of_device_id *match; > - struct jz4740_mmc_platform_data *pdata; > - > - pdata = dev_get_platdata(&pdev->dev); > > mmc = mmc_alloc_host(sizeof(struct jz4740_mmc_host), &pdev->dev); > if (!mmc) { > @@ -993,29 +954,25 @@ static int jz4740_mmc_probe(struct platform_device* pdev) > } > > host = mmc_priv(mmc); > - host->pdata = pdata; > > match = of_match_device(jz4740_mmc_of_match, &pdev->dev); > if (match) { > host->version = (enum jz4740_mmc_version)match->data; > - ret = mmc_of_parse(mmc); > - if (ret) { > - if (ret != -EPROBE_DEFER) > - dev_err(&pdev->dev, > - "could not parse of data: %d\n", ret); > - goto err_free_host; > - } > } else { > /* JZ4740 should be the only one using legacy probe */ > host->version = JZ_MMC_JZ4740; > - mmc->caps |= MMC_CAP_SDIO_IRQ; > - if (!(pdata && pdata->data_1bit)) > - mmc->caps |= MMC_CAP_4_BIT_DATA; > - ret = jz4740_mmc_request_gpios(host, mmc, pdev); > - if (ret) > - goto err_free_host; > } > > + ret = mmc_of_parse(mmc); > + if (ret) { > + if (ret != -EPROBE_DEFER) > + dev_err(&pdev->dev, > + "could not parse device properties: %d\n", ret); > + goto err_free_host; > + } > + > + mmc_regulator_get_supply(mmc); > + > host->irq = platform_get_irq(pdev, 0); > if (host->irq < 0) { > ret = host->irq; > -- > 2.11.0 >