linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/2] Add ACPI support to IPROC SDHCI
@ 2018-08-05  7:52 Srinath Mannam
  2018-08-05  7:52 ` [PATCH v4 1/2] mmc: sdhci-pltfm: Convert DT properties to generic device properties Srinath Mannam
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Srinath Mannam @ 2018-08-05  7:52 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter, Ray Jui, Scott Branden, vikram.prakash
  Cc: bcm-kernel-feedback-list, linux-mmc, linux-kernel, Srinath Mannam

This patch series adds
  - Feature to get generic device properties in the
    place of DT properties.
  - ACPI support to IPROC SDHCI varients

This patch series is based off v4.18-rc3

Changes from v3:
  - Replaced separate device tree and ACPI get match data APIs
    with single device_get_match_data API.

Changes from v2:
  - Added patch "Convert DT properties to generic device properties"
    given by Adrian Hunter to this patch series because
    "Add ACPI support to IPROC SDHCI" patch is depends on this.

Changes from v1:
  - Removed sdhci_iproc_data array change and add directly
    into of and acpi id tables.
  - Add a change to get match data directly.
  - Removed clock-frequency property read change.
  - Used sdhci_get_property to get properties.
  - Verified with patch given by Adrian Hunter
    mmc: sdhci-pltfm: Convert DT properties to generic device properties

Adrian Hunter (1):
  mmc: sdhci-pltfm: Convert DT properties to generic device properties

Srinath Mannam (1):
  mmc: host: iproc: Add ACPI support to IPROC SDHCI

 drivers/mmc/host/Kconfig       |  1 +
 drivers/mmc/host/sdhci-iproc.c | 59 ++++++++++++++++++++++++------------
 drivers/mmc/host/sdhci-pltfm.c | 68 +++++++++++++++++++++++++-----------------
 drivers/mmc/host/sdhci-pltfm.h |  7 ++++-
 4 files changed, 87 insertions(+), 48 deletions(-)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v4 1/2] mmc: sdhci-pltfm: Convert DT properties to generic device properties
  2018-08-05  7:52 [PATCH v4 0/2] Add ACPI support to IPROC SDHCI Srinath Mannam
@ 2018-08-05  7:52 ` Srinath Mannam
  2018-08-05  7:52 ` [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI Srinath Mannam
  2018-08-22  9:48 ` [PATCH v4 0/2] " Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Srinath Mannam @ 2018-08-05  7:52 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter, Ray Jui, Scott Branden, vikram.prakash
  Cc: bcm-kernel-feedback-list, linux-mmc, linux-kernel

From: Adrian Hunter <adrian.hunter@intel.com>

Convert DT properties to generic device properties
so that drivers can get properties from DT or ACPI.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Srinath Mannam <srinath.mannam@broadcom.com>
---
 drivers/mmc/host/sdhci-pltfm.c | 68 +++++++++++++++++++++++++-----------------
 drivers/mmc/host/sdhci-pltfm.h |  7 ++++-
 2 files changed, 46 insertions(+), 29 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index 02bea61..b231c9a 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -30,6 +30,7 @@
 
 #include <linux/err.h>
 #include <linux/module.h>
+#include <linux/property.h>
 #include <linux/of.h>
 #ifdef CONFIG_PPC
 #include <asm/machdep.h>
@@ -51,11 +52,10 @@ static const struct sdhci_ops sdhci_pltfm_ops = {
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
 };
 
-#ifdef CONFIG_OF
-static bool sdhci_of_wp_inverted(struct device_node *np)
+static bool sdhci_wp_inverted(struct device *dev)
 {
-	if (of_get_property(np, "sdhci,wp-inverted", NULL) ||
-	    of_get_property(np, "wp-inverted", NULL))
+	if (device_property_present(dev, "sdhci,wp-inverted") ||
+	    device_property_present(dev, "wp-inverted"))
 		return true;
 
 	/* Old device trees don't have the wp-inverted property. */
@@ -66,52 +66,64 @@ static bool sdhci_of_wp_inverted(struct device_node *np)
 #endif /* CONFIG_PPC */
 }
 
-void sdhci_get_of_property(struct platform_device *pdev)
+#ifdef CONFIG_OF
+static void sdhci_get_compatibility(struct platform_device *pdev)
 {
+	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct device_node *np = pdev->dev.of_node;
+
+	if (!np)
+		return;
+
+	if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
+		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
+
+	if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
+	    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
+	    of_device_is_compatible(np, "fsl,t4240-esdhc") ||
+	    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
+		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+}
+#else
+void sdhci_get_compatibility(struct platform_device *pdev) {}
+#endif /* CONFIG_OF */
+
+void sdhci_get_property(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
 	struct sdhci_host *host = platform_get_drvdata(pdev);
 	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
 	u32 bus_width;
 
-	if (of_get_property(np, "sdhci,auto-cmd12", NULL))
+	if (device_property_present(dev, "sdhci,auto-cmd12"))
 		host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
 
-	if (of_get_property(np, "sdhci,1-bit-only", NULL) ||
-	    (of_property_read_u32(np, "bus-width", &bus_width) == 0 &&
+	if (device_property_present(dev, "sdhci,1-bit-only") ||
+	    (device_property_read_u32(dev, "bus-width", &bus_width) == 0 &&
 	    bus_width == 1))
 		host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA;
 
-	if (sdhci_of_wp_inverted(np))
+	if (sdhci_wp_inverted(dev))
 		host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
 
-	if (of_get_property(np, "broken-cd", NULL))
+	if (device_property_present(dev, "broken-cd"))
 		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
-	if (of_get_property(np, "no-1-8-v", NULL))
+	if (device_property_present(dev, "no-1-8-v"))
 		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 
-	if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
-		host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
-
-	if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
-	    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
-	    of_device_is_compatible(np, "fsl,t4240-esdhc") ||
-	    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
-		host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
+	sdhci_get_compatibility(pdev);
 
-	of_property_read_u32(np, "clock-frequency", &pltfm_host->clock);
+	device_property_read_u32(dev, "clock-frequency", &pltfm_host->clock);
 
-	if (of_find_property(np, "keep-power-in-suspend", NULL))
+	if (device_property_present(dev, "keep-power-in-suspend"))
 		host->mmc->pm_caps |= MMC_PM_KEEP_POWER;
 
-	if (of_property_read_bool(np, "wakeup-source") ||
-	    of_property_read_bool(np, "enable-sdio-wakeup")) /* legacy */
+	if (device_property_read_bool(dev, "wakeup-source") ||
+	    device_property_read_bool(dev, "enable-sdio-wakeup")) /* legacy */
 		host->mmc->pm_caps |= MMC_PM_WAKE_SDIO_IRQ;
 }
-#else
-void sdhci_get_of_property(struct platform_device *pdev) {}
-#endif /* CONFIG_OF */
-EXPORT_SYMBOL_GPL(sdhci_get_of_property);
+EXPORT_SYMBOL_GPL(sdhci_get_property);
 
 struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 				    const struct sdhci_pltfm_data *pdata,
@@ -184,7 +196,7 @@ int sdhci_pltfm_register(struct platform_device *pdev,
 	if (IS_ERR(host))
 		return PTR_ERR(host);
 
-	sdhci_get_of_property(pdev);
+	sdhci_get_property(pdev);
 
 	ret = sdhci_add_host(host);
 	if (ret)
diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h
index 1e91fb1..6109987 100644
--- a/drivers/mmc/host/sdhci-pltfm.h
+++ b/drivers/mmc/host/sdhci-pltfm.h
@@ -90,7 +90,12 @@ static inline void sdhci_be32bs_writeb(struct sdhci_host *host, u8 val, int reg)
 }
 #endif /* CONFIG_MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER */
 
-extern void sdhci_get_of_property(struct platform_device *pdev);
+void sdhci_get_property(struct platform_device *pdev);
+
+static inline void sdhci_get_of_property(struct platform_device *pdev)
+{
+	return sdhci_get_property(pdev);
+}
 
 extern struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 					  const struct sdhci_pltfm_data *pdata,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI
  2018-08-05  7:52 [PATCH v4 0/2] Add ACPI support to IPROC SDHCI Srinath Mannam
  2018-08-05  7:52 ` [PATCH v4 1/2] mmc: sdhci-pltfm: Convert DT properties to generic device properties Srinath Mannam
@ 2018-08-05  7:52 ` Srinath Mannam
  2018-08-06  6:43   ` Hunter, Adrian
  2018-08-22  9:48 ` [PATCH v4 0/2] " Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Srinath Mannam @ 2018-08-05  7:52 UTC (permalink / raw)
  To: Ulf Hansson, Adrian Hunter, Ray Jui, Scott Branden, vikram.prakash
  Cc: bcm-kernel-feedback-list, linux-mmc, linux-kernel, Srinath Mannam

Add ACPI support to all IPROC SDHCI varients

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
---
 drivers/mmc/host/Kconfig       |  1 +
 drivers/mmc/host/sdhci-iproc.c | 59 ++++++++++++++++++++++++++++--------------
 2 files changed, 41 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 0581c19..bc6702e 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -334,6 +334,7 @@ config MMC_SDHCI_IPROC
 	tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
 	depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST
 	depends on MMC_SDHCI_PLTFM
+	depends on OF || ACPI
 	default ARCH_BCM_IPROC
 	select MMC_SDHCI_IO_ACCESSORS
 	help
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
index d0e83db..0db9905 100644
--- a/drivers/mmc/host/sdhci-iproc.c
+++ b/drivers/mmc/host/sdhci-iproc.c
@@ -15,6 +15,7 @@
  * iProc SDHCI platform driver
  */
 
+#include <linux/acpi.h>
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/mmc/host.h>
@@ -162,9 +163,19 @@ static void sdhci_iproc_writeb(struct sdhci_host *host, u8 val, int reg)
 	sdhci_iproc_writel(host, newval, reg & ~3);
 }
 
+static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host)
+{
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+
+	if (pltfm_host->clk)
+		return sdhci_pltfm_clk_get_max_clock(host);
+	else
+		return pltfm_host->clock;
+}
+
 static const struct sdhci_ops sdhci_iproc_ops = {
 	.set_clock = sdhci_set_clock,
-	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
+	.get_max_clock = sdhci_iproc_get_max_clock,
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
@@ -178,7 +189,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
 	.write_w = sdhci_iproc_writew,
 	.write_b = sdhci_iproc_writeb,
 	.set_clock = sdhci_set_clock,
-	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
+	.get_max_clock = sdhci_iproc_get_max_clock,
 	.set_bus_width = sdhci_set_bus_width,
 	.reset = sdhci_reset,
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
@@ -256,19 +267,25 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
 
+static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
+	{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
+	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
+
 static int sdhci_iproc_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
-	const struct sdhci_iproc_data *iproc_data;
+	struct device *dev = &pdev->dev;
+	const struct sdhci_iproc_data *iproc_data = NULL;
 	struct sdhci_host *host;
 	struct sdhci_iproc_host *iproc_host;
 	struct sdhci_pltfm_host *pltfm_host;
 	int ret;
 
-	match = of_match_device(sdhci_iproc_of_match, &pdev->dev);
-	if (!match)
-		return -EINVAL;
-	iproc_data = match->data;
+	iproc_data = device_get_match_data(dev);
+	if (!iproc_data)
+		return -ENODEV;
 
 	host = sdhci_pltfm_init(pdev, iproc_data->pdata, sizeof(*iproc_host));
 	if (IS_ERR(host))
@@ -280,19 +297,21 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 	iproc_host->data = iproc_data;
 
 	mmc_of_parse(host->mmc);
-	sdhci_get_of_property(pdev);
+	sdhci_get_property(pdev);
 
 	host->mmc->caps |= iproc_host->data->mmc_caps;
 
-	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(pltfm_host->clk)) {
-		ret = PTR_ERR(pltfm_host->clk);
-		goto err;
-	}
-	ret = clk_prepare_enable(pltfm_host->clk);
-	if (ret) {
-		dev_err(&pdev->dev, "failed to enable host clk\n");
-		goto err;
+	if (dev->of_node) {
+		pltfm_host->clk = devm_clk_get(dev, NULL);
+		if (IS_ERR(pltfm_host->clk)) {
+			ret = PTR_ERR(pltfm_host->clk);
+			goto err;
+		}
+		ret = clk_prepare_enable(pltfm_host->clk);
+		if (ret) {
+			dev_err(dev, "failed to enable host clk\n");
+			goto err;
+		}
 	}
 
 	if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) {
@@ -307,7 +326,8 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
 	return 0;
 
 err_clk:
-	clk_disable_unprepare(pltfm_host->clk);
+	if (dev->of_node)
+		clk_disable_unprepare(pltfm_host->clk);
 err:
 	sdhci_pltfm_free(pdev);
 	return ret;
@@ -317,6 +337,7 @@ static struct platform_driver sdhci_iproc_driver = {
 	.driver = {
 		.name = "sdhci-iproc",
 		.of_match_table = sdhci_iproc_of_match,
+		.acpi_match_table = ACPI_PTR(sdhci_iproc_acpi_ids),
 		.pm = &sdhci_pltfm_pmops,
 	},
 	.probe = sdhci_iproc_probe,
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI
  2018-08-05  7:52 ` [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI Srinath Mannam
@ 2018-08-06  6:43   ` Hunter, Adrian
  2018-08-14 12:43     ` Srinath Mannam
  0 siblings, 1 reply; 6+ messages in thread
From: Hunter, Adrian @ 2018-08-06  6:43 UTC (permalink / raw)
  To: Srinath Mannam, Ulf Hansson, Ray Jui, Scott Branden, vikram.prakash
  Cc: bcm-kernel-feedback-list, linux-mmc, linux-kernel

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> -----Original Message-----
> From: Srinath Mannam [mailto:srinath.mannam@broadcom.com]
> Sent: Sunday, August 5, 2018 10:53 AM
> To: Ulf Hansson <ulf.hansson@linaro.org>; Hunter, Adrian
> <adrian.hunter@intel.com>; Ray Jui <rjui@broadcom.com>; Scott Branden
> <sbranden@broadcom.com>; vikram.prakash@broadcom.com
> Cc: bcm-kernel-feedback-list@broadcom.com; linux-mmc@vger.kernel.org;
> linux-kernel@vger.kernel.org; Srinath Mannam
> <srinath.mannam@broadcom.com>
> Subject: [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI
> 
> Add ACPI support to all IPROC SDHCI varients
> 
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> Reviewed-by: Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> ---
>  drivers/mmc/host/Kconfig       |  1 +
>  drivers/mmc/host/sdhci-iproc.c | 59 ++++++++++++++++++++++++++++----
> ----------
>  2 files changed, 41 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index
> 0581c19..bc6702e 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -334,6 +334,7 @@ config MMC_SDHCI_IPROC
>  	tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
>  	depends on ARCH_BCM2835 || ARCH_BCM_IPROC ||
> COMPILE_TEST
>  	depends on MMC_SDHCI_PLTFM
> +	depends on OF || ACPI
>  	default ARCH_BCM_IPROC
>  	select MMC_SDHCI_IO_ACCESSORS
>  	help
> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
> index d0e83db..0db9905 100644
> --- a/drivers/mmc/host/sdhci-iproc.c
> +++ b/drivers/mmc/host/sdhci-iproc.c
> @@ -15,6 +15,7 @@
>   * iProc SDHCI platform driver
>   */
> 
> +#include <linux/acpi.h>
>  #include <linux/delay.h>
>  #include <linux/module.h>
>  #include <linux/mmc/host.h>
> @@ -162,9 +163,19 @@ static void sdhci_iproc_writeb(struct sdhci_host
> *host, u8 val, int reg)
>  	sdhci_iproc_writel(host, newval, reg & ~3);  }
> 
> +static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host)
> +{
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +
> +	if (pltfm_host->clk)
> +		return sdhci_pltfm_clk_get_max_clock(host);
> +	else
> +		return pltfm_host->clock;
> +}
> +
>  static const struct sdhci_ops sdhci_iproc_ops = {
>  	.set_clock = sdhci_set_clock,
> -	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
> +	.get_max_clock = sdhci_iproc_get_max_clock,
>  	.set_bus_width = sdhci_set_bus_width,
>  	.reset = sdhci_reset,
>  	.set_uhs_signaling = sdhci_set_uhs_signaling, @@ -178,7 +189,7 @@
> static const struct sdhci_ops sdhci_iproc_32only_ops = {
>  	.write_w = sdhci_iproc_writew,
>  	.write_b = sdhci_iproc_writeb,
>  	.set_clock = sdhci_set_clock,
> -	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
> +	.get_max_clock = sdhci_iproc_get_max_clock,
>  	.set_bus_width = sdhci_set_bus_width,
>  	.reset = sdhci_reset,
>  	.set_uhs_signaling = sdhci_set_uhs_signaling, @@ -256,19 +267,25
> @@ static const struct of_device_id sdhci_iproc_of_match[] = {  };
> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
> 
> +static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
> +	{ .id = "BRCM5871", .driver_data =
> (kernel_ulong_t)&iproc_cygnus_data },
> +	{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
> +	{ /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
> +
>  static int sdhci_iproc_probe(struct platform_device *pdev)  {
> -	const struct of_device_id *match;
> -	const struct sdhci_iproc_data *iproc_data;
> +	struct device *dev = &pdev->dev;
> +	const struct sdhci_iproc_data *iproc_data = NULL;
>  	struct sdhci_host *host;
>  	struct sdhci_iproc_host *iproc_host;
>  	struct sdhci_pltfm_host *pltfm_host;
>  	int ret;
> 
> -	match = of_match_device(sdhci_iproc_of_match, &pdev->dev);
> -	if (!match)
> -		return -EINVAL;
> -	iproc_data = match->data;
> +	iproc_data = device_get_match_data(dev);
> +	if (!iproc_data)
> +		return -ENODEV;
> 
>  	host = sdhci_pltfm_init(pdev, iproc_data->pdata,
> sizeof(*iproc_host));
>  	if (IS_ERR(host))
> @@ -280,19 +297,21 @@ static int sdhci_iproc_probe(struct platform_device
> *pdev)
>  	iproc_host->data = iproc_data;
> 
>  	mmc_of_parse(host->mmc);
> -	sdhci_get_of_property(pdev);
> +	sdhci_get_property(pdev);
> 
>  	host->mmc->caps |= iproc_host->data->mmc_caps;
> 
> -	pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(pltfm_host->clk)) {
> -		ret = PTR_ERR(pltfm_host->clk);
> -		goto err;
> -	}
> -	ret = clk_prepare_enable(pltfm_host->clk);
> -	if (ret) {
> -		dev_err(&pdev->dev, "failed to enable host clk\n");
> -		goto err;
> +	if (dev->of_node) {
> +		pltfm_host->clk = devm_clk_get(dev, NULL);
> +		if (IS_ERR(pltfm_host->clk)) {
> +			ret = PTR_ERR(pltfm_host->clk);
> +			goto err;
> +		}
> +		ret = clk_prepare_enable(pltfm_host->clk);
> +		if (ret) {
> +			dev_err(dev, "failed to enable host clk\n");
> +			goto err;
> +		}
>  	}
> 
>  	if (iproc_host->data->pdata->quirks &
> SDHCI_QUIRK_MISSING_CAPS) { @@ -307,7 +326,8 @@ static int
> sdhci_iproc_probe(struct platform_device *pdev)
>  	return 0;
> 
>  err_clk:
> -	clk_disable_unprepare(pltfm_host->clk);
> +	if (dev->of_node)
> +		clk_disable_unprepare(pltfm_host->clk);
>  err:
>  	sdhci_pltfm_free(pdev);
>  	return ret;
> @@ -317,6 +337,7 @@ static struct platform_driver sdhci_iproc_driver = {
>  	.driver = {
>  		.name = "sdhci-iproc",
>  		.of_match_table = sdhci_iproc_of_match,
> +		.acpi_match_table = ACPI_PTR(sdhci_iproc_acpi_ids),
>  		.pm = &sdhci_pltfm_pmops,
>  	},
>  	.probe = sdhci_iproc_probe,
> --
> 2.7.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI
  2018-08-06  6:43   ` Hunter, Adrian
@ 2018-08-14 12:43     ` Srinath Mannam
  0 siblings, 0 replies; 6+ messages in thread
From: Srinath Mannam @ 2018-08-14 12:43 UTC (permalink / raw)
  To: Hunter, Adrian
  Cc: Ulf Hansson, Ray Jui, Scott Branden, vikram.prakash,
	bcm-kernel-feedback-list, linux-mmc, linux-kernel

Hi Ulf Hansson,

Please kindly provide your inputs.

Regards,
Srinath.

On Mon, Aug 6, 2018 at 12:13 PM, Hunter, Adrian <adrian.hunter@intel.com> wrote:
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> -----Original Message-----
>> From: Srinath Mannam [mailto:srinath.mannam@broadcom.com]
>> Sent: Sunday, August 5, 2018 10:53 AM
>> To: Ulf Hansson <ulf.hansson@linaro.org>; Hunter, Adrian
>> <adrian.hunter@intel.com>; Ray Jui <rjui@broadcom.com>; Scott Branden
>> <sbranden@broadcom.com>; vikram.prakash@broadcom.com
>> Cc: bcm-kernel-feedback-list@broadcom.com; linux-mmc@vger.kernel.org;
>> linux-kernel@vger.kernel.org; Srinath Mannam
>> <srinath.mannam@broadcom.com>
>> Subject: [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI
>>
>> Add ACPI support to all IPROC SDHCI varients
>>
>> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
>> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
>> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
>> Reviewed-by: Vladimir Olovyannikov
>> <vladimir.olovyannikov@broadcom.com>
>> ---
>>  drivers/mmc/host/Kconfig       |  1 +
>>  drivers/mmc/host/sdhci-iproc.c | 59 ++++++++++++++++++++++++++++----
>> ----------
>>  2 files changed, 41 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index
>> 0581c19..bc6702e 100644
>> --- a/drivers/mmc/host/Kconfig
>> +++ b/drivers/mmc/host/Kconfig
>> @@ -334,6 +334,7 @@ config MMC_SDHCI_IPROC
>>       tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
>>       depends on ARCH_BCM2835 || ARCH_BCM_IPROC ||
>> COMPILE_TEST
>>       depends on MMC_SDHCI_PLTFM
>> +     depends on OF || ACPI
>>       default ARCH_BCM_IPROC
>>       select MMC_SDHCI_IO_ACCESSORS
>>       help
>> diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
>> index d0e83db..0db9905 100644
>> --- a/drivers/mmc/host/sdhci-iproc.c
>> +++ b/drivers/mmc/host/sdhci-iproc.c
>> @@ -15,6 +15,7 @@
>>   * iProc SDHCI platform driver
>>   */
>>
>> +#include <linux/acpi.h>
>>  #include <linux/delay.h>
>>  #include <linux/module.h>
>>  #include <linux/mmc/host.h>
>> @@ -162,9 +163,19 @@ static void sdhci_iproc_writeb(struct sdhci_host
>> *host, u8 val, int reg)
>>       sdhci_iproc_writel(host, newval, reg & ~3);  }
>>
>> +static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host)
>> +{
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +
>> +     if (pltfm_host->clk)
>> +             return sdhci_pltfm_clk_get_max_clock(host);
>> +     else
>> +             return pltfm_host->clock;
>> +}
>> +
>>  static const struct sdhci_ops sdhci_iproc_ops = {
>>       .set_clock = sdhci_set_clock,
>> -     .get_max_clock = sdhci_pltfm_clk_get_max_clock,
>> +     .get_max_clock = sdhci_iproc_get_max_clock,
>>       .set_bus_width = sdhci_set_bus_width,
>>       .reset = sdhci_reset,
>>       .set_uhs_signaling = sdhci_set_uhs_signaling, @@ -178,7 +189,7 @@
>> static const struct sdhci_ops sdhci_iproc_32only_ops = {
>>       .write_w = sdhci_iproc_writew,
>>       .write_b = sdhci_iproc_writeb,
>>       .set_clock = sdhci_set_clock,
>> -     .get_max_clock = sdhci_pltfm_clk_get_max_clock,
>> +     .get_max_clock = sdhci_iproc_get_max_clock,
>>       .set_bus_width = sdhci_set_bus_width,
>>       .reset = sdhci_reset,
>>       .set_uhs_signaling = sdhci_set_uhs_signaling, @@ -256,19 +267,25
>> @@ static const struct of_device_id sdhci_iproc_of_match[] = {  };
>> MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
>>
>> +static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
>> +     { .id = "BRCM5871", .driver_data =
>> (kernel_ulong_t)&iproc_cygnus_data },
>> +     { .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
>> +     { /* sentinel */ }
>> +};
>> +MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
>> +
>>  static int sdhci_iproc_probe(struct platform_device *pdev)  {
>> -     const struct of_device_id *match;
>> -     const struct sdhci_iproc_data *iproc_data;
>> +     struct device *dev = &pdev->dev;
>> +     const struct sdhci_iproc_data *iproc_data = NULL;
>>       struct sdhci_host *host;
>>       struct sdhci_iproc_host *iproc_host;
>>       struct sdhci_pltfm_host *pltfm_host;
>>       int ret;
>>
>> -     match = of_match_device(sdhci_iproc_of_match, &pdev->dev);
>> -     if (!match)
>> -             return -EINVAL;
>> -     iproc_data = match->data;
>> +     iproc_data = device_get_match_data(dev);
>> +     if (!iproc_data)
>> +             return -ENODEV;
>>
>>       host = sdhci_pltfm_init(pdev, iproc_data->pdata,
>> sizeof(*iproc_host));
>>       if (IS_ERR(host))
>> @@ -280,19 +297,21 @@ static int sdhci_iproc_probe(struct platform_device
>> *pdev)
>>       iproc_host->data = iproc_data;
>>
>>       mmc_of_parse(host->mmc);
>> -     sdhci_get_of_property(pdev);
>> +     sdhci_get_property(pdev);
>>
>>       host->mmc->caps |= iproc_host->data->mmc_caps;
>>
>> -     pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
>> -     if (IS_ERR(pltfm_host->clk)) {
>> -             ret = PTR_ERR(pltfm_host->clk);
>> -             goto err;
>> -     }
>> -     ret = clk_prepare_enable(pltfm_host->clk);
>> -     if (ret) {
>> -             dev_err(&pdev->dev, "failed to enable host clk\n");
>> -             goto err;
>> +     if (dev->of_node) {
>> +             pltfm_host->clk = devm_clk_get(dev, NULL);
>> +             if (IS_ERR(pltfm_host->clk)) {
>> +                     ret = PTR_ERR(pltfm_host->clk);
>> +                     goto err;
>> +             }
>> +             ret = clk_prepare_enable(pltfm_host->clk);
>> +             if (ret) {
>> +                     dev_err(dev, "failed to enable host clk\n");
>> +                     goto err;
>> +             }
>>       }
>>
>>       if (iproc_host->data->pdata->quirks &
>> SDHCI_QUIRK_MISSING_CAPS) { @@ -307,7 +326,8 @@ static int
>> sdhci_iproc_probe(struct platform_device *pdev)
>>       return 0;
>>
>>  err_clk:
>> -     clk_disable_unprepare(pltfm_host->clk);
>> +     if (dev->of_node)
>> +             clk_disable_unprepare(pltfm_host->clk);
>>  err:
>>       sdhci_pltfm_free(pdev);
>>       return ret;
>> @@ -317,6 +337,7 @@ static struct platform_driver sdhci_iproc_driver = {
>>       .driver = {
>>               .name = "sdhci-iproc",
>>               .of_match_table = sdhci_iproc_of_match,
>> +             .acpi_match_table = ACPI_PTR(sdhci_iproc_acpi_ids),
>>               .pm = &sdhci_pltfm_pmops,
>>       },
>>       .probe = sdhci_iproc_probe,
>> --
>> 2.7.4
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v4 0/2] Add ACPI support to IPROC SDHCI
  2018-08-05  7:52 [PATCH v4 0/2] Add ACPI support to IPROC SDHCI Srinath Mannam
  2018-08-05  7:52 ` [PATCH v4 1/2] mmc: sdhci-pltfm: Convert DT properties to generic device properties Srinath Mannam
  2018-08-05  7:52 ` [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI Srinath Mannam
@ 2018-08-22  9:48 ` Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2018-08-22  9:48 UTC (permalink / raw)
  To: Srinath Mannam
  Cc: Adrian Hunter, Ray Jui, Scott Branden, vikram.prakash,
	BCM Kernel Feedback, linux-mmc, Linux Kernel Mailing List

On 5 August 2018 at 09:52, Srinath Mannam <srinath.mannam@broadcom.com> wrote:
> This patch series adds
>   - Feature to get generic device properties in the
>     place of DT properties.
>   - ACPI support to IPROC SDHCI varients
>
> This patch series is based off v4.18-rc3
>
> Changes from v3:
>   - Replaced separate device tree and ACPI get match data APIs
>     with single device_get_match_data API.
>
> Changes from v2:
>   - Added patch "Convert DT properties to generic device properties"
>     given by Adrian Hunter to this patch series because
>     "Add ACPI support to IPROC SDHCI" patch is depends on this.
>
> Changes from v1:
>   - Removed sdhci_iproc_data array change and add directly
>     into of and acpi id tables.
>   - Add a change to get match data directly.
>   - Removed clock-frequency property read change.
>   - Used sdhci_get_property to get properties.
>   - Verified with patch given by Adrian Hunter
>     mmc: sdhci-pltfm: Convert DT properties to generic device properties
>
> Adrian Hunter (1):
>   mmc: sdhci-pltfm: Convert DT properties to generic device properties
>
> Srinath Mannam (1):
>   mmc: host: iproc: Add ACPI support to IPROC SDHCI
>
>  drivers/mmc/host/Kconfig       |  1 +
>  drivers/mmc/host/sdhci-iproc.c | 59 ++++++++++++++++++++++++------------
>  drivers/mmc/host/sdhci-pltfm.c | 68 +++++++++++++++++++++++++-----------------
>  drivers/mmc/host/sdhci-pltfm.h |  7 ++++-
>  4 files changed, 87 insertions(+), 48 deletions(-)
>
> --
> 2.7.4
>

Thanks, queued for v4.20!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-22  9:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-05  7:52 [PATCH v4 0/2] Add ACPI support to IPROC SDHCI Srinath Mannam
2018-08-05  7:52 ` [PATCH v4 1/2] mmc: sdhci-pltfm: Convert DT properties to generic device properties Srinath Mannam
2018-08-05  7:52 ` [PATCH v4 2/2] mmc: host: iproc: Add ACPI support to IPROC SDHCI Srinath Mannam
2018-08-06  6:43   ` Hunter, Adrian
2018-08-14 12:43     ` Srinath Mannam
2018-08-22  9:48 ` [PATCH v4 0/2] " Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).