All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates
@ 2012-08-27  5:07 Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 1/3] ata: pata_arasan: Add clk_{un}prepare() support Viresh Kumar
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Viresh Kumar @ 2012-08-27  5:07 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

From: Viresh Kumar <viresh.kumar@linaro.com>

Jeff,

This patchset contains updates for pata_arasan and ahci_platform drivers. I have
updated it as per earlier discussions for following patchset:
"clk: Add non CONFIG_HAVE_CLK routines"

It is used by SPEAr13xx V1 for which is:
http://comments.gmane.org/gmane.linux.ports.arm.kernel/163042

V2->V3:
- Updated "ata/ahci_platform: Add clock framework support" as per latest patch
  for dummy clk APIs applied by Andrew Morton
- Dropped two patches, already got applied.

V1->V2:
- Removed covering #ifdef CONFIG_HAVE_CLK, #endifs around clk code in
ahci_platform.

Viresh Kumar (3):
  ata: pata_arasan: Add clk_{un}prepare() support
  ata: pata_arasan: add Device Tree probing capability
  ata/ahci_platform: Add clock framework support

 .../devicetree/bindings/ata/pata-arasan.txt        | 17 +++++++
 drivers/ata/ahci.h                                 |  2 +
 drivers/ata/ahci_platform.c                        | 57 +++++++++++++++++++---
 drivers/ata/pata_arasan_cf.c                       | 14 +++++-
 4 files changed, 81 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/pata-arasan.txt

-- 
1.7.12.rc2.18.g61b472e



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

* [PATCH V3 Resend 1/3] ata: pata_arasan: Add clk_{un}prepare() support
  2012-08-27  5:07 [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates Viresh Kumar
@ 2012-08-27  5:07 ` Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 2/3] ata: pata_arasan: add Device Tree probing capability Viresh Kumar
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2012-08-27  5:07 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

From: Viresh Kumar <viresh.kumar@linaro.com>

clk_{un}prepare is mandatory for platforms using common clock framework. Since
this driver is used by SPEAr platform, which supports common clock framework,
add clk_{un}prepare() support for it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.com>
---
 drivers/ata/pata_arasan_cf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index bfaa5cb..d82c6dc 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -310,7 +310,7 @@ static int cf_init(struct arasan_cf_dev *acdev)
 	unsigned long flags;
 	int ret = 0;
 
-	ret = clk_enable(acdev->clk);
+	ret = clk_prepare_enable(acdev->clk);
 	if (ret) {
 		dev_dbg(acdev->host->dev, "clock enable failed");
 		return ret;
@@ -340,7 +340,7 @@ static void cf_exit(struct arasan_cf_dev *acdev)
 	writel(readl(acdev->vbase + OP_MODE) & ~CFHOST_ENB,
 			acdev->vbase + OP_MODE);
 	spin_unlock_irqrestore(&acdev->host->lock, flags);
-	clk_disable(acdev->clk);
+	clk_disable_unprepare(acdev->clk);
 }
 
 static void dma_callback(void *dev)
-- 
1.7.12.rc2.18.g61b472e



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

* [PATCH V3 Resend 2/3] ata: pata_arasan: add Device Tree probing capability
  2012-08-27  5:07 [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 1/3] ata: pata_arasan: Add clk_{un}prepare() support Viresh Kumar
@ 2012-08-27  5:07 ` Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 3/3] ata/ahci_platform: Add clock framework support Viresh Kumar
  2012-09-27 10:59 ` [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates viresh kumar
  3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2012-08-27  5:07 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

From: Viresh Kumar <viresh.kumar@linaro.com>

SPEAr platforms now support DT and so must convert all drivers to support DT.
This patch adds DT probing support for Arasan Compact Flash controller and
updates its documentation too.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.com>
---
 Documentation/devicetree/bindings/ata/pata-arasan.txt | 17 +++++++++++++++++
 drivers/ata/pata_arasan_cf.c                          | 10 ++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/ata/pata-arasan.txt

diff --git a/Documentation/devicetree/bindings/ata/pata-arasan.txt b/Documentation/devicetree/bindings/ata/pata-arasan.txt
new file mode 100644
index 0000000..95ec7f8
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/pata-arasan.txt
@@ -0,0 +1,17 @@
+* ARASAN PATA COMPACT FLASH CONTROLLER
+
+Required properties:
+- compatible: "arasan,cf-spear1340"
+- reg: Address range of the CF registers
+- interrupt-parent: Should be the phandle for the interrupt controller
+  that services interrupts for this device
+- interrupt: Should contain the CF interrupt number
+
+Example:
+
+	cf@fc000000 {
+		compatible = "arasan,cf-spear1340";
+		reg = <0xfc000000 0x1000>;
+		interrupt-parent = <&vic1>;
+		interrupts = <12>;
+	};
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
index d82c6dc..26201eb 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -31,6 +31,7 @@
 #include <linux/kernel.h>
 #include <linux/libata.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/pata_arasan_cf_data.h>
 #include <linux/platform_device.h>
 #include <linux/pm.h>
@@ -935,6 +936,14 @@ static int arasan_cf_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(arasan_cf_pm_ops, arasan_cf_suspend, arasan_cf_resume);
 
+#ifdef CONFIG_OF
+static const struct of_device_id arasan_cf_id_table[] = {
+	{ .compatible = "arasan,cf-spear1340" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, arasan_cf_id_table);
+#endif
+
 static struct platform_driver arasan_cf_driver = {
 	.probe		= arasan_cf_probe,
 	.remove		= __devexit_p(arasan_cf_remove),
@@ -942,6 +951,7 @@ static struct platform_driver arasan_cf_driver = {
 		.name	= DRIVER_NAME,
 		.owner	= THIS_MODULE,
 		.pm	= &arasan_cf_pm_ops,
+		.of_match_table = of_match_ptr(arasan_cf_id_table),
 	},
 };
 
-- 
1.7.12.rc2.18.g61b472e



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

* [PATCH V3 Resend 3/3] ata/ahci_platform: Add clock framework support
  2012-08-27  5:07 [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 1/3] ata: pata_arasan: Add clk_{un}prepare() support Viresh Kumar
  2012-08-27  5:07 ` [PATCH V3 Resend 2/3] ata: pata_arasan: add Device Tree probing capability Viresh Kumar
@ 2012-08-27  5:07 ` Viresh Kumar
  2012-09-27 10:59 ` [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates viresh kumar
  3 siblings, 0 replies; 7+ messages in thread
From: Viresh Kumar @ 2012-08-27  5:07 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

From: Viresh Kumar <viresh.kumar@linaro.com>

On many architectures, drivers are supposed to prepare/unprepare &
enable/disable functional clock of device. This patch adds clock support for
ahci_platform.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.com>
---
 drivers/ata/ahci.h          |  2 ++
 drivers/ata/ahci_platform.c | 57 +++++++++++++++++++++++++++++++++++++++------
 2 files changed, 52 insertions(+), 7 deletions(-)

diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 57eb1c2..838a262 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -35,6 +35,7 @@
 #ifndef _AHCI_H
 #define _AHCI_H
 
+#include <linux/clk.h>
 #include <linux/libata.h>
 
 /* Enclosure Management Control */
@@ -302,6 +303,7 @@ struct ahci_host_priv {
 	u32 			em_loc; /* enclosure management location */
 	u32			em_buf_sz;	/* EM buffer size in byte */
 	u32			em_msg_type;	/* EM message type */
+	struct clk		*clk;		/* Only for platforms supporting clk */
 };
 
 extern int ahci_ignore_sss;
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 09728e0..90c2eb9 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -12,6 +12,7 @@
  * any later version.
  */
 
+#include <linux/clk.h>
 #include <linux/kernel.h>
 #include <linux/gfp.h>
 #include <linux/module.h>
@@ -118,6 +119,17 @@ static int __init ahci_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	hpriv->clk = clk_get(dev, NULL);
+	if (IS_ERR(hpriv->clk)) {
+		dev_err(dev, "can't get clock\n");
+	} else {
+		rc = clk_prepare_enable(hpriv->clk);
+		if (rc) {
+			dev_err(dev, "clock prepare enable failed");
+			goto free_clk;
+		}
+	}
+
 	/*
 	 * Some platforms might need to prepare for mmio region access,
 	 * which could be done in the following init call. So, the mmio
@@ -127,7 +139,7 @@ static int __init ahci_probe(struct platform_device *pdev)
 	if (pdata && pdata->init) {
 		rc = pdata->init(dev, hpriv->mmio);
 		if (rc)
-			return rc;
+			goto disable_unprepare_clk;
 	}
 
 	ahci_save_initial_config(dev, hpriv,
@@ -153,7 +165,7 @@ static int __init ahci_probe(struct platform_device *pdev)
 	host = ata_host_alloc_pinfo(dev, ppi, n_ports);
 	if (!host) {
 		rc = -ENOMEM;
-		goto err0;
+		goto pdata_exit;
 	}
 
 	host->private_data = hpriv;
@@ -183,7 +195,7 @@ static int __init ahci_probe(struct platform_device *pdev)
 
 	rc = ahci_reset_controller(host);
 	if (rc)
-		goto err0;
+		goto pdata_exit;
 
 	ahci_init_controller(host);
 	ahci_print_info(host, "platform");
@@ -191,12 +203,18 @@ static int __init ahci_probe(struct platform_device *pdev)
 	rc = ata_host_activate(host, irq, ahci_interrupt, IRQF_SHARED,
 			       &ahci_platform_sht);
 	if (rc)
-		goto err0;
+		goto pdata_exit;
 
 	return 0;
-err0:
+pdata_exit:
 	if (pdata && pdata->exit)
 		pdata->exit(dev);
+disable_unprepare_clk:
+	if (!IS_ERR(hpriv->clk))
+		clk_disable_unprepare(hpriv->clk);
+free_clk:
+	if (!IS_ERR(hpriv->clk))
+		clk_put(hpriv->clk);
 	return rc;
 }
 
@@ -205,12 +223,18 @@ static int __devexit ahci_remove(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct ahci_platform_data *pdata = dev_get_platdata(dev);
 	struct ata_host *host = dev_get_drvdata(dev);
+	struct ahci_host_priv *hpriv = host->private_data;
 
 	ata_host_detach(host);
 
 	if (pdata && pdata->exit)
 		pdata->exit(dev);
 
+	if (!IS_ERR(hpriv->clk)) {
+		clk_disable_unprepare(hpriv->clk);
+		clk_put(hpriv->clk);
+	}
+
 	return 0;
 }
 
@@ -245,6 +269,10 @@ static int ahci_suspend(struct device *dev)
 
 	if (pdata && pdata->suspend)
 		return pdata->suspend(dev);
+
+	if (!IS_ERR(hpriv->clk))
+		clk_disable_unprepare(hpriv->clk);
+
 	return 0;
 }
 
@@ -252,18 +280,27 @@ static int ahci_resume(struct device *dev)
 {
 	struct ahci_platform_data *pdata = dev_get_platdata(dev);
 	struct ata_host *host = dev_get_drvdata(dev);
+	struct ahci_host_priv *hpriv = host->private_data;
 	int rc;
 
+	if (!IS_ERR(hpriv->clk)) {
+		rc = clk_prepare_enable(hpriv->clk);
+		if (rc) {
+			dev_err(dev, "clock prepare enable failed");
+			return rc;
+		}
+	}
+
 	if (pdata && pdata->resume) {
 		rc = pdata->resume(dev);
 		if (rc)
-			return rc;
+			goto disable_unprepare_clk;
 	}
 
 	if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
 		rc = ahci_reset_controller(host);
 		if (rc)
-			return rc;
+			goto disable_unprepare_clk;
 
 		ahci_init_controller(host);
 	}
@@ -271,6 +308,12 @@ static int ahci_resume(struct device *dev)
 	ata_host_resume(host);
 
 	return 0;
+
+disable_unprepare_clk:
+	if (!IS_ERR(hpriv->clk))
+		clk_disable_unprepare(hpriv->clk);
+
+	return rc;
 }
 #endif
 
-- 
1.7.12.rc2.18.g61b472e



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

* Re: [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates
  2012-08-27  5:07 [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates Viresh Kumar
                   ` (2 preceding siblings ...)
  2012-08-27  5:07 ` [PATCH V3 Resend 3/3] ata/ahci_platform: Add clock framework support Viresh Kumar
@ 2012-09-27 10:59 ` viresh kumar
  2012-09-28  4:25   ` viresh kumar
  3 siblings, 1 reply; 7+ messages in thread
From: viresh kumar @ 2012-09-27 10:59 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

On Mon, Aug 27, 2012 at 10:37 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> From: Viresh Kumar <viresh.kumar@linaro.com>
> This patchset contains updates for pata_arasan and ahci_platform drivers. I have
> updated it as per earlier discussions for following patchset:
> "clk: Add non CONFIG_HAVE_CLK routines"

Hi Jeff,

Can you please apply these patches?

--
viresh

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

* Re: [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates
  2012-09-27 10:59 ` [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates viresh kumar
@ 2012-09-28  4:25   ` viresh kumar
  2012-10-02  2:46     ` Jeff Garzik
  0 siblings, 1 reply; 7+ messages in thread
From: viresh kumar @ 2012-09-28  4:25 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

On Thu, Sep 27, 2012 at 4:29 PM, viresh kumar <viresh.kumar@linaro.org> wrote:
> On Mon, Aug 27, 2012 at 10:37 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> From: Viresh Kumar <viresh.kumar@linaro.com>
>> This patchset contains updates for pata_arasan and ahci_platform drivers. I have
>> updated it as per earlier discussions for following patchset:
>> "clk: Add non CONFIG_HAVE_CLK routines"
>
> Hi Jeff,
>
> Can you please apply these patches?

So sorry to ping you.... They are already pushed on 27th August...

Thanks.

viresh

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

* Re: [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates
  2012-09-28  4:25   ` viresh kumar
@ 2012-10-02  2:46     ` Jeff Garzik
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2012-10-02  2:46 UTC (permalink / raw)
  To: viresh kumar
  Cc: linux-ide, sshtylyov, spear-devel, viresh.linux, Viresh Kumar

On 09/28/2012 12:25 AM, viresh kumar wrote:
> On Thu, Sep 27, 2012 at 4:29 PM, viresh kumar <viresh.kumar@linaro.org> wrote:
>> On Mon, Aug 27, 2012 at 10:37 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>>> From: Viresh Kumar <viresh.kumar@linaro.com>
>>> This patchset contains updates for pata_arasan and ahci_platform drivers. I have
>>> updated it as per earlier discussions for following patchset:
>>> "clk: Add non CONFIG_HAVE_CLK routines"
>>
>> Hi Jeff,
>>
>> Can you please apply these patches?
>
> So sorry to ping you.... They are already pushed on 27th August...

Yes, they have been in linux-next for well over a month...

	Jeff





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

end of thread, other threads:[~2012-10-02  2:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-27  5:07 [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates Viresh Kumar
2012-08-27  5:07 ` [PATCH V3 Resend 1/3] ata: pata_arasan: Add clk_{un}prepare() support Viresh Kumar
2012-08-27  5:07 ` [PATCH V3 Resend 2/3] ata: pata_arasan: add Device Tree probing capability Viresh Kumar
2012-08-27  5:07 ` [PATCH V3 Resend 3/3] ata/ahci_platform: Add clock framework support Viresh Kumar
2012-09-27 10:59 ` [PATCH V3 Resend 0/3] ata: pata_arasan and ahci_platform updates viresh kumar
2012-09-28  4:25   ` viresh kumar
2012-10-02  2:46     ` Jeff Garzik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.