Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp619497imm; Thu, 5 Jul 2018 06:14:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcGAAh5MkxqXc5STm0fl+FasJafbMzqNiqxxY01/YMNCDEp81B0I4CbuTWJ172iSUAUzNcz X-Received: by 2002:a62:6a01:: with SMTP id f1-v6mr6428193pfc.156.1530796489053; Thu, 05 Jul 2018 06:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796489; cv=none; d=google.com; s=arc-20160816; b=ejzqfXzElDk9CAS/GruALR2pVIBsGJ9VKDLm2zUHNq9dEmVIbJY8rOGfZzY7xekbTc 6Tp/5u2mDPOAPelv7kAzg6zsZug8CBE1hWdCBwIBSYHJUNFwaMNtBJhaEPy/5zZfMbVT 3R/gPmyvIRB8NHTDDA1oWT+PSiHHcwMEoEH2zNbPFMLRkhX8vgflIM+uELg8BsHbZc78 6qAxgk+ZoKUmQGjdZsj8qZgulmPD3VMTxvc1JVRMHAZu267QChnJTpWHfEYBjFGtPBV/ UIecN0W8N3+X0PVHFR6wNv060PU9+YIlvcAwQZdNJC6Hub1ncOiU/vPjDyplOdbx4u7C xN7g== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=G9ypjRlhk5P7unrQUJ1g9vImFuZ/3zYOrtYHJHB/8Is=; b=YHJiMK6F+9G+QiBU6A4hUxow+CU3VW+FuOCjBXsELTBOZITzfCBnDh7rn2v00o3kq3 9BgBSf8J/86Dz6NFf61+J7UN3UZsTWJcbiUFgphpMoyjS068euIIKP7mzb4SJZXN9vq2 mH+OrBy2Ane1Y9iuurb2KIQ/75D0jP8iZhvQyVd/rf9K83mVWEQ6YshWv565v9r2EcRc glbFYZM/S7lh+N54+IAtrKor3RQjj7RKayVfzqwb1WPBmITUcnlyxxJ/vdTV/K/SVXsO EeTp8tLCQC5pguxHzqX2O5BSNw2HRc0vtHopYsPJqEY4E+KicYwdpJ0eiOnNEBLdMmIN Q9hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fokn1aIH; 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 t66-v6si5401240pgt.538.2018.07.05.06.14.33; Thu, 05 Jul 2018 06:14:49 -0700 (PDT) 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=Fokn1aIH; 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 S1754613AbeGENNo (ORCPT + 99 others); Thu, 5 Jul 2018 09:13:44 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:46777 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754417AbeGENNj (ORCPT ); Thu, 5 Jul 2018 09:13:39 -0400 Received: by mail-io0-f194.google.com with SMTP id p7-v6so7671639ioh.13 for ; Thu, 05 Jul 2018 06:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=G9ypjRlhk5P7unrQUJ1g9vImFuZ/3zYOrtYHJHB/8Is=; b=Fokn1aIHzwm4rOwtCvcSiCKFVSYD91nRqdnxNS3Fl4gtu4jd2rJrA3hV3Ee0xgGZFn Xn/JYP8mhOfLrvFCuyAt0HdE7udZo27tSJDuqaFw/9RSudNCC+5dwq0NI9MW3vZ8jCS0 1ytveoXUXaAFVCpddwphGqYtM0/LZ+GGXELng= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=G9ypjRlhk5P7unrQUJ1g9vImFuZ/3zYOrtYHJHB/8Is=; b=llzhndoSwegBsPF9hra/6CcyfJp0J1spuJ5W3yCkksHIUK+8p6Fy3rW6KrhgvS7zDo 3Fa8Z2KLGYv8RmrBdd7docNWHqqG+mIq7zTkxTwj9aNCq7QvT7Oun9CDvo042CsxKgB6 dyggE742hEpC+9MpMHrAOGjHIr8jIZxAyPBFNJhPnuTd9ifvr/Bg1dugVEIQ0BXmav2J pWYHu2/CYtXFy7U+bbu5eeX9XlO2WQokyM1jRWaOXn2jP3voO41WZD3q+GiMKduCZygo coeuDLJ+zBbRwd0l8HllGe2zbL7i4eVxrGrbE/s1rTl3gQlm7Zgk/bk1A3/eVPP6ROIl QV6A== X-Gm-Message-State: AOUpUlGrGzqra1HmKM35iV0f4htAQbsKhKKURo5gAnQQVg6HLzHsZtXu aKuwKV3EnLgpXMP7xxrCyafwBrK/y0VdciSvYa8YHw== X-Received: by 2002:a6b:c997:: with SMTP id z145-v6mr5032715iof.266.1530796418993; Thu, 05 Jul 2018 06:13:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:818f:0:0:0:0:0 with HTTP; Thu, 5 Jul 2018 06:13:38 -0700 (PDT) In-Reply-To: <20180704174524.5f6d50fb@xhacker.debian> References: <20180704174524.5f6d50fb@xhacker.debian> From: Ulf Hansson Date: Thu, 5 Jul 2018 15:13:38 +0200 Message-ID: Subject: Re: [PATCH] mmc: sdhci-of-dwcmshc: add SDHCI OF Synopsys DWC MSHC dirver To: Jisheng Zhang Cc: Rob Herring , Mark Rutland , Adrian Hunter , "linux-mmc@vger.kernel.org" , devicetree@vger.kernel.org, Linux Kernel Mailing List , Linux ARM , Prabu Thangamuthu , Manjunath M B 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 4 July 2018 at 11:45, Jisheng Zhang wrote: > Add a driver for SDHCI OF Synopsys DesignWare Cores Mobile Storage > Host Controller. > > Signed-off-by: Jisheng Zhang > --- > .../bindings/mmc/sdhci-of-dwcmshc.txt | 20 +++ Please split DT docs into separate patches. Ehh, just make checkpatch not to complain, then I am happy with this patch! Kind regards Uffe > drivers/mmc/host/Kconfig | 10 ++ > drivers/mmc/host/Makefile | 1 + > drivers/mmc/host/sdhci-of-dwcmshc.c | 117 ++++++++++++++++++ > 4 files changed, 148 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > create mode 100644 drivers/mmc/host/sdhci-of-dwcmshc.c > > diff --git a/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > new file mode 100644 > index 000000000000..ee4253b33be2 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/sdhci-of-dwcmshc.txt > @@ -0,0 +1,20 @@ > +* Synopsys DesignWare Cores Mobile Storage Host Controller > + > +Required properties: > +- compatible: should be one of the following: > + "snps,dwcmshc-sdhci" > +- reg: offset and length of the register set for the device. > +- interrupts: a single interrupt specifier. > +- clocks: Array of clocks required for SDHCI; requires at least one for > + core clock. > +- clock-names: Array of names corresponding to clocks property; shall be > + "core" for core clock and "bus" for optional bus clock. > + > +Example: > + sdhci2: sdhci@aa0000 { > + compatible = "snps,dwcmshc-sdhci"; > + reg = <0xaa0000 0x1000>; > + interrupts = ; > + clocks = <&emmcclk>; > + bus-width = <8>; > + } > diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig > index 0581c199c996..23beb9ec6dbf 100644 > --- a/drivers/mmc/host/Kconfig > +++ b/drivers/mmc/host/Kconfig > @@ -176,6 +176,16 @@ config MMC_SDHCI_OF_HLWD > > If unsure, say N. > > +config MMC_SDHCI_OF_DWCMSHC > + tristate "SDHCI OF support for the Synopsys DWC MSHC" > + depends on MMC_SDHCI_PLTFM > + depends on OF > + depends on COMMON_CLK > + help > + This selects Synopsys DesignWare Cores Mobile Storage Controller. > + If you have a controller with this interface, say Y or M here. > + If unsure, say N. > + > config MMC_SDHCI_CADENCE > tristate "SDHCI support for the Cadence SD/SDIO/eMMC controller" > depends on MMC_SDHCI_PLTFM > diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile > index 85dc1322c3de..a18fbba1b97e 100644 > --- a/drivers/mmc/host/Makefile > +++ b/drivers/mmc/host/Makefile > @@ -82,6 +82,7 @@ obj-$(CONFIG_MMC_SDHCI_OF_ARASAN) += sdhci-of-arasan.o > obj-$(CONFIG_MMC_SDHCI_OF_AT91) += sdhci-of-at91.o > obj-$(CONFIG_MMC_SDHCI_OF_ESDHC) += sdhci-of-esdhc.o > obj-$(CONFIG_MMC_SDHCI_OF_HLWD) += sdhci-of-hlwd.o > +obj-$(CONFIG_MMC_SDHCI_OF_DWCMSHC) += sdhci-of-dwcmshc.o > obj-$(CONFIG_MMC_SDHCI_BCM_KONA) += sdhci-bcm-kona.o > obj-$(CONFIG_MMC_SDHCI_IPROC) += sdhci-iproc.o > obj-$(CONFIG_MMC_SDHCI_MSM) += sdhci-msm.o > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c > new file mode 100644 > index 000000000000..93b613cd7c33 > --- /dev/null > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c > @@ -0,0 +1,117 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Driver for Synopsys DesignWare Cores Mobile Storage Host Controller > + * > + * Copyright (C) 2018 Synaptics Incorporated > + * > + * Author: Jisheng Zhang > + */ > + > +#include > +#include > +#include > + > +#include "sdhci-pltfm.h" > + > +struct dwcmshc_priv { > + /* bus clock */ > + struct clk *bus_clk; > +}; > + > +static const struct sdhci_ops sdhci_dwcmshc_ops = { > + .set_clock = sdhci_set_clock, > + .set_bus_width = sdhci_set_bus_width, > + .set_uhs_signaling = sdhci_set_uhs_signaling, > + .get_max_clock = sdhci_pltfm_clk_get_max_clock, > + .reset = sdhci_reset, > +}; > + > +static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = { > + .ops = &sdhci_dwcmshc_ops, > + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, > +}; > + > +static int dwcmshc_probe(struct platform_device *pdev) > +{ > + struct sdhci_pltfm_host *pltfm_host; > + struct sdhci_host *host; > + struct dwcmshc_priv *priv; > + int err; > + > + host = sdhci_pltfm_init(pdev, &sdhci_dwcmshc_pdata, > + sizeof(struct dwcmshc_priv)); > + if (IS_ERR(host)) > + return PTR_ERR(host); > + > + pltfm_host = sdhci_priv(host); > + priv = sdhci_pltfm_priv(pltfm_host); > + > + pltfm_host->clk = devm_clk_get(&pdev->dev, "core"); > + if (IS_ERR(pltfm_host->clk)) { > + err = PTR_ERR(pltfm_host->clk); > + dev_err(&pdev->dev, "failed to get core clk: %d\n", err); > + goto free_pltfm; > + } > + err = clk_prepare_enable(pltfm_host->clk); > + if (err) > + goto free_pltfm; > + > + priv->bus_clk = devm_clk_get(&pdev->dev, "bus"); > + if (!IS_ERR(priv->bus_clk)) > + clk_prepare_enable(priv->bus_clk); > + > + err = mmc_of_parse(host->mmc); > + if (err) > + goto err_clk; > + > + sdhci_get_of_property(pdev); > + > + err = sdhci_add_host(host); > + if (err) > + goto err_clk; > + > + return 0; > + > +err_clk: > + clk_disable_unprepare(pltfm_host->clk); > + clk_disable_unprepare(priv->bus_clk); > +free_pltfm: > + sdhci_pltfm_free(pdev); > + return err; > +} > + > +static int dwcmshc_remove(struct platform_device *pdev) > +{ > + struct sdhci_host *host = platform_get_drvdata(pdev); > + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > + struct dwcmshc_priv *priv = sdhci_pltfm_priv(pltfm_host); > + > + sdhci_remove_host(host, 0); > + > + clk_disable_unprepare(pltfm_host->clk); > + clk_disable_unprepare(priv->bus_clk); > + > + sdhci_pltfm_free(pdev); > + > + return 0; > +} > + > +static const struct of_device_id sdhci_dwcmshc_dt_ids[] = { > + { .compatible = "snps,dwcmshc-sdhci" }, > + {} > +}; > +MODULE_DEVICE_TABLE(of, sdhci_dwcmshc_dt_ids); > + > +static struct platform_driver sdhci_dwcmshc_driver = { > + .driver = { > + .name = "sdhci-dwcmshc", > + .of_match_table = sdhci_dwcmshc_dt_ids, > + }, > + .probe = dwcmshc_probe, > + .remove = dwcmshc_remove, > +}; > +module_platform_driver(sdhci_dwcmshc_driver); > + > +MODULE_DESCRIPTION("SDHCI platform driver for Synopsys DWC MSHC"); > +MODULE_AUTHOR("Jisheng Zhang "); > +MODULE_LICENSE("GPL v2"); > -- > 2.18.0 >