Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3436476imu; Mon, 28 Jan 2019 04:58:57 -0800 (PST) X-Google-Smtp-Source: ALg8bN5laMXNK1uDQ+OSEaCAESbbVB+tWb0qWz8nl6m4FUFgXfIUROpA237Ga5vH0sCHg/SIm10j X-Received: by 2002:a63:4d0e:: with SMTP id a14mr19913210pgb.408.1548680337063; Mon, 28 Jan 2019 04:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548680337; cv=none; d=google.com; s=arc-20160816; b=HI42o/TtN/QAmxwA2roSHIQHqaQEr0Yg+yqLy7F+kIy9fFTJNEBxWtzFLq3qeANLJ/ TRG18AJehVG2Dm7Z+GvXQQ/X8plcKNHYOjc2i96QjcT/TTe1d3YsgO6ZeNBoJUm+9Ak+ bpfsoAVDwRkaJqx11Q7dkqSwSj0n+sY1OKJ7QU6+8gBrkr6+Gty3TPaDO+sdI4uiqjvK 6UqWimj7sM2J3BzBWVMvIKZHC9TZBkHUy6muXOjYlq8bNTk+ku46aVylt2zlMQGazxbb aguEX6VUt59GDKCoVFGQ+9Vzglpo8Ajcq577B9HZ/mC/et04KFRtD/0egbFtMLk+eQA3 FWXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=RbmYErF/pq7+kSxpPmh0eNdtHkh8mAfzRGe8tgKGoxE=; b=lMbrvYiIjcMktIAmS4NsHzw5doZtcualcLSA6QSuzDr19Btu2iQEf5CSSIByKEuIGy iILrkHOHI2o/Ze9kCxbXwQEzxFNVCYn1q+GG7KnwJcYAQsSPt02PeAItqHoX1g56twBp w/jPWzhx48c12BunWzNL+PLjQJR9idLTtraVQxq/VAvjW+UvhVdSlt+65S0beWZAliWx NzjZ4C1/KlxZApj5Lx1ujS223nU/vOd+Bg7QE8u2uX0RmFC5I+aNQJmDAJ0DVr0AD291 0iw5FP+dwNVUGWlfTaatV68MTyWSTHlXuqNo/Po7kiSnlesmlKnH4mcKh2Nx/Dzx9XUs bLew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=UH4cRTRR; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e69si32059402pfg.137.2019.01.28.04.58.41; Mon, 28 Jan 2019 04:58:57 -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=fail header.i=@crapouillou.net header.s=mail header.b=UH4cRTRR; 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=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbfA1M6a (ORCPT + 99 others); Mon, 28 Jan 2019 07:58:30 -0500 Received: from outils.crapouillou.net ([89.234.176.41]:39362 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbfA1M6a (ORCPT ); Mon, 28 Jan 2019 07:58:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1548680307; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RbmYErF/pq7+kSxpPmh0eNdtHkh8mAfzRGe8tgKGoxE=; b=UH4cRTRRSnjErmi1Uh237WBz6ZYQkQLRNoKQ0+AI5z1l1zGsXjNQ8yZ8VipfeI/PQGIUoZ 52M6pMW7iDfQYxjKqAYnoue9WyWHfpr/q0oenP5FLgdXHSwmvnlDvzsH+DzE3if1Xq14Yc 033sQ9vTxiyLtYpBKBEzz3OmgFaemFw= Date: Mon, 28 Jan 2019 09:58:13 -0300 From: Paul Cercueil Subject: Re: [PATCH 1/3] mmc: jz4740: Remove platform data and use standard APIs To: Ulf Hansson 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" Message-Id: <1548680293.3021.0@crapouillou.net> In-Reply-To: References: <20190125200927.21045-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Le lun. 28 janv. 2019 =E0 9:02, Ulf Hansson a=20 =E9crit : > On Fri, 25 Jan 2019 at 21:09, Paul Cercueil =20 > wrote: >>=20 >> 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. >>=20 >> 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. >>=20 >> Signed-off-by: Paul Cercueil >=20 > Applied for next, thanks! >=20 > Should I also pick up the other two MIPS patches or you want to funnel > those through the MIPS soc tree? I'd prefer through the MIPS tree, then I can still push some other=20 patches on top of these in the 5.1 dev window. >> --- >> drivers/mmc/host/jz4740_mmc.c | 71=20 >> +++++++++---------------------------------- >> 1 file changed, 14 insertions(+), 57 deletions(-) >>=20 >> diff --git a/drivers/mmc/host/jz4740_mmc.c=20 >> 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 >>=20 >> #include >> -#include >>=20 >> #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; >>=20 >> enum jz4740_mmc_version version; >>=20 >> @@ -894,16 +890,16 @@ static void jz4740_mmc_set_ios(struct=20 >> 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,=20 >> mmc->supply.vmmc, ios->vdd); >> host->cmdat |=3D 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,=20 >> mmc->supply.vmmc, 0); >> clk_disable_unprepare(host->clk); >> break; >> } >> @@ -936,38 +932,6 @@ static const struct mmc_host_ops=20 >> jz4740_mmc_ops =3D { >> .enable_sdio_irq =3D jz4740_mmc_enable_sdio_irq, >> }; >>=20 >> -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 =3D=20 >> dev_get_platdata(&pdev->dev); >> - int ret =3D 0; >> - >> - if (!pdata) >> - return 0; >> - >> - if (!pdata->card_detect_active_low) >> - mmc->caps2 |=3D MMC_CAP2_CD_ACTIVE_HIGH; >> - if (!pdata->read_only_active_low) >> - mmc->caps2 |=3D MMC_CAP2_RO_ACTIVE_HIGH; >> - >> - /* >> - * Get optional card detect and write protect GPIOs, >> - * only back out on probe deferral. >> - */ >> - ret =3D mmc_gpiod_request_cd(mmc, "cd", 0, false, 0, NULL); >> - if (ret =3D=3D -EPROBE_DEFER) >> - return ret; >> - >> - ret =3D mmc_gpiod_request_ro(mmc, "wp", 0, false, 0, NULL); >> - if (ret =3D=3D -EPROBE_DEFER) >> - return ret; >> - >> - host->power =3D 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[] =3D { >> { .compatible =3D "ingenic,jz4740-mmc", .data =3D (void *)=20 >> JZ_MMC_JZ4740 }, >> { .compatible =3D "ingenic,jz4725b-mmc", .data =3D (void=20 >> *)JZ_MMC_JZ4725B }, >> @@ -982,9 +946,6 @@ static int jz4740_mmc_probe(struct=20 >> 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 =3D dev_get_platdata(&pdev->dev); >>=20 >> mmc =3D mmc_alloc_host(sizeof(struct jz4740_mmc_host),=20 >> &pdev->dev); >> if (!mmc) { >> @@ -993,29 +954,25 @@ static int jz4740_mmc_probe(struct=20 >> platform_device* pdev) >> } >>=20 >> host =3D mmc_priv(mmc); >> - host->pdata =3D pdata; >>=20 >> match =3D of_match_device(jz4740_mmc_of_match, &pdev->dev); >> if (match) { >> host->version =3D (enum=20 >> jz4740_mmc_version)match->data; >> - ret =3D mmc_of_parse(mmc); >> - if (ret) { >> - if (ret !=3D -EPROBE_DEFER) >> - dev_err(&pdev->dev, >> - "could not parse of data:=20 >> %d\n", ret); >> - goto err_free_host; >> - } >> } else { >> /* JZ4740 should be the only one using legacy probe=20 >> */ >> host->version =3D JZ_MMC_JZ4740; >> - mmc->caps |=3D MMC_CAP_SDIO_IRQ; >> - if (!(pdata && pdata->data_1bit)) >> - mmc->caps |=3D MMC_CAP_4_BIT_DATA; >> - ret =3D jz4740_mmc_request_gpios(host, mmc, pdev); >> - if (ret) >> - goto err_free_host; >> } >>=20 >> + ret =3D mmc_of_parse(mmc); >> + if (ret) { >> + if (ret !=3D -EPROBE_DEFER) >> + dev_err(&pdev->dev, >> + "could not parse device properties:=20 >> %d\n", ret); >> + goto err_free_host; >> + } >> + >> + mmc_regulator_get_supply(mmc); >> + >> host->irq =3D platform_get_irq(pdev, 0); >> if (host->irq < 0) { >> ret =3D host->irq; >> -- >> 2.11.0 >>=20 =