* [PATCH 1/6] ata: i.MX PATA: Use devm_clk_get
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-04 9:25 ` [PATCH 2/6] ata: i.MX PATA: cleanup error path Sascha Hauer
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
To make the error path a bit simpler.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/ata/pata_imx.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index 4084944..af893dd 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -112,7 +112,7 @@ static int pata_imx_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
- priv->clk = clk_get(&pdev->dev, NULL);
+ priv->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(priv->clk)) {
dev_err(&pdev->dev, "Failed to get clock\n");
return PTR_ERR(priv->clk);
@@ -163,7 +163,7 @@ static int pata_imx_probe(struct platform_device *pdev)
free_priv:
clk_disable_unprepare(priv->clk);
- clk_put(priv->clk);
+
return -ENOMEM;
}
@@ -177,7 +177,6 @@ static int pata_imx_remove(struct platform_device *pdev)
__raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN);
clk_disable_unprepare(priv->clk);
- clk_put(priv->clk);
return 0;
}
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] ata: i.MX PATA: cleanup error path
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
2013-04-04 9:25 ` [PATCH 1/6] ata: i.MX PATA: Use devm_clk_get Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-04 9:25 ` [PATCH 3/6] ata: i.MX PATA: use void __iomem * for regs Sascha Hauer
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
- rename free_priv label to 'err' since priv is allocated with devm_*
and not freed here.
- add missing 'goto err' in case ata_host_activate fails
- add 'ret' variable to return correct error value instead of hardcoded
-ENOMEM in error case.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/ata/pata_imx.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index af893dd..f243496 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -98,6 +98,7 @@ static int pata_imx_probe(struct platform_device *pdev)
struct pata_imx_priv *priv;
int irq = 0;
struct resource *io_res;
+ int ret;
io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (io_res == NULL)
@@ -121,8 +122,10 @@ static int pata_imx_probe(struct platform_device *pdev)
clk_prepare_enable(priv->clk);
host = ata_host_alloc(&pdev->dev, 1);
- if (!host)
- goto free_priv;
+ if (!host) {
+ ret = -ENOMEM;
+ goto err;
+ }
host->private_data = priv;
ap = host->ports[0];
@@ -135,7 +138,8 @@ static int pata_imx_probe(struct platform_device *pdev)
resource_size(io_res));
if (!priv->host_regs) {
dev_err(&pdev->dev, "failed to map IO/CTL base\n");
- goto free_priv;
+ ret = -EBUSY;
+ goto err;
}
ap->ioaddr.cmd_addr = priv->host_regs + PATA_IMX_DRIVE_DATA;
@@ -158,13 +162,17 @@ static int pata_imx_probe(struct platform_device *pdev)
priv->host_regs + PATA_IMX_ATA_INT_EN);
/* activate */
- return ata_host_activate(host, irq, ata_sff_interrupt, 0,
+ ret = ata_host_activate(host, irq, ata_sff_interrupt, 0,
&pata_imx_sht);
-free_priv:
+ if (ret)
+ goto err;
+
+ return 0;
+err:
clk_disable_unprepare(priv->clk);
- return -ENOMEM;
+ return ret;
}
static int pata_imx_remove(struct platform_device *pdev)
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] ata: i.MX PATA: use void __iomem * for regs
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
2013-04-04 9:25 ` [PATCH 1/6] ata: i.MX PATA: Use devm_clk_get Sascha Hauer
2013-04-04 9:25 ` [PATCH 2/6] ata: i.MX PATA: cleanup error path Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-04 9:25 ` [PATCH 4/6] ata: i.MX PATA: add devicetree support Sascha Hauer
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
regs is returned from ioremap, so add a __iomem. Also, make it
void * instead of u8 *.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/ata/pata_imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index f243496..adbb01d 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -37,7 +37,7 @@
struct pata_imx_priv {
struct clk *clk;
/* timings/interrupt/control regs */
- u8 *host_regs;
+ void __iomem *host_regs;
u32 ata_ctl;
};
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] ata: i.MX PATA: add devicetree support
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
` (2 preceding siblings ...)
2013-04-04 9:25 ` [PATCH 3/6] ata: i.MX PATA: use void __iomem * for regs Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-11 23:38 ` Jeff Garzik
2013-04-04 9:25 ` [PATCH 5/6] ARM: i.MX5: Add PATA and SRTC clocks Sascha Hauer
` (2 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
Not much to do here, only the compatible entries have to be added.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Documentation/devicetree/bindings/ata/imx-pata.txt | 17 +++++++++++++++++
drivers/ata/pata_imx.c | 9 +++++++++
2 files changed, 26 insertions(+)
create mode 100644 Documentation/devicetree/bindings/ata/imx-pata.txt
diff --git a/Documentation/devicetree/bindings/ata/imx-pata.txt b/Documentation/devicetree/bindings/ata/imx-pata.txt
new file mode 100644
index 0000000..e38d734
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/imx-pata.txt
@@ -0,0 +1,17 @@
+* Freescale i.MX PATA Controller
+
+Required properties:
+- compatible: "fsl,imx27-pata"
+- reg: Address range of the PATA Controller
+- interrupts: The interrupt of the PATA Controller
+- clocks: the clocks for the PATA Controller
+
+Example:
+
+ pata: pata at 83fe0000 {
+ compatible = "fsl,imx51-pata", "fsl,imx27-pata";
+ reg = <0x83fe0000 0x4000>;
+ interrupts = <70>;
+ clocks = <&clks 161>;
+ status = "disabled";
+ };
diff --git a/drivers/ata/pata_imx.c b/drivers/ata/pata_imx.c
index adbb01d..aa3d166 100644
--- a/drivers/ata/pata_imx.c
+++ b/drivers/ata/pata_imx.c
@@ -230,11 +230,20 @@ static const struct dev_pm_ops pata_imx_pm_ops = {
};
#endif
+static const struct of_device_id imx_pata_dt_ids[] = {
+ {
+ .compatible = "fsl,imx27-pata",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct platform_driver pata_imx_driver = {
.probe = pata_imx_probe,
.remove = pata_imx_remove,
.driver = {
.name = DRV_NAME,
+ .of_match_table = imx_pata_dt_ids,
.owner = THIS_MODULE,
#ifdef CONFIG_PM
.pm = &pata_imx_pm_ops,
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] ARM: i.MX5: Add PATA and SRTC clocks
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
` (3 preceding siblings ...)
2013-04-04 9:25 ` [PATCH 4/6] ata: i.MX PATA: add devicetree support Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-04 13:13 ` Shawn Guo
2013-04-04 9:25 ` [PATCH 6/6] ARM: i.MX51: Add PATA support Sascha Hauer
2013-04-09 7:41 ` [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
6 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
This adds the clock gates and the binding documentation
for PATA and SRTC.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Documentation/devicetree/bindings/clock/imx5-clock.txt | 2 ++
arch/arm/mach-imx/clk-imx51-imx53.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/clock/imx5-clock.txt b/Documentation/devicetree/bindings/clock/imx5-clock.txt
index 2a0c904..da5eb30 100644
--- a/Documentation/devicetree/bindings/clock/imx5-clock.txt
+++ b/Documentation/devicetree/bindings/clock/imx5-clock.txt
@@ -172,6 +172,8 @@ clocks and IDs.
can1_serial_gate 157
can1_ipg_gate 158
owire_gate 159
+ srtc_gate 160
+ pata_gate 161
Examples (for mx53):
diff --git a/arch/arm/mach-imx/clk-imx51-imx53.c b/arch/arm/mach-imx/clk-imx51-imx53.c
index 0f39f8c..026a819 100644
--- a/arch/arm/mach-imx/clk-imx51-imx53.c
+++ b/arch/arm/mach-imx/clk-imx51-imx53.c
@@ -83,7 +83,7 @@ enum imx5_clks {
ssi2_root_gate, ssi3_root_gate, ssi_ext1_gate, ssi_ext2_gate,
epit1_ipg_gate, epit1_hf_gate, epit2_ipg_gate, epit2_hf_gate,
can_sel, can1_serial_gate, can1_ipg_gate,
- owire_gate,
+ owire_gate, srtc_gate, pata_gate,
clk_max
};
@@ -235,6 +235,8 @@ static void __init mx5_clocks_common_init(unsigned long rate_ckil,
clk[epit2_ipg_gate] = imx_clk_gate2("epit2_ipg_gate", "ipg", MXC_CCM_CCGR2, 6);
clk[epit2_hf_gate] = imx_clk_gate2("epit2_hf_gate", "per_root", MXC_CCM_CCGR2, 8);
clk[owire_gate] = imx_clk_gate2("owire_gate", "per_root", MXC_CCM_CCGR2, 22);
+ clk[srtc_gate] = imx_clk_gate2("srtc_gate", "per_root", MXC_CCM_CCGR4, 28);
+ clk[pata_gate] = imx_clk_gate2("pata_gate", "ipg", MXC_CCM_CCGR4, 0);
for (i = 0; i < ARRAY_SIZE(clk); i++)
if (IS_ERR(clk[i]))
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] ARM: i.MX51: Add PATA support
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
` (4 preceding siblings ...)
2013-04-04 9:25 ` [PATCH 5/6] ARM: i.MX5: Add PATA and SRTC clocks Sascha Hauer
@ 2013-04-04 9:25 ` Sascha Hauer
2013-04-09 7:41 ` [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-04-04 9:25 UTC (permalink / raw)
To: linux-arm-kernel
This adds the PATA device and the pinctrl group for to the i.MX51 dts.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boot/dts/imx51.dtsi | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index fcf035b..cc54f0d 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -411,6 +411,42 @@
};
};
+ pata {
+ pinctrl_pata_1: patagrp-1 {
+ fsl,pins = <
+ MX51_PAD_NANDF_WE_B__PATA_DIOW 0x2004
+ MX51_PAD_NANDF_RE_B__PATA_DIOR 0x2004
+ MX51_PAD_NANDF_ALE__PATA_BUFFER_EN 0x2004
+ MX51_PAD_NANDF_CLE__PATA_RESET_B 0x2004
+ MX51_PAD_NANDF_WP_B__PATA_DMACK 0x2004
+ MX51_PAD_NANDF_RB0__PATA_DMARQ 0x2004
+ MX51_PAD_NANDF_RB1__PATA_IORDY 0x2004
+ MX51_PAD_GPIO_NAND__PATA_INTRQ 0x2004
+ MX51_PAD_NANDF_CS2__PATA_CS_0 0x2004
+ MX51_PAD_NANDF_CS3__PATA_CS_1 0x2004
+ MX51_PAD_NANDF_CS4__PATA_DA_0 0x2004
+ MX51_PAD_NANDF_CS5__PATA_DA_1 0x2004
+ MX51_PAD_NANDF_CS6__PATA_DA_2 0x2004
+ MX51_PAD_NANDF_D15__PATA_DATA15 0x2004
+ MX51_PAD_NANDF_D14__PATA_DATA14 0x2004
+ MX51_PAD_NANDF_D13__PATA_DATA13 0x2004
+ MX51_PAD_NANDF_D12__PATA_DATA12 0x2004
+ MX51_PAD_NANDF_D11__PATA_DATA11 0x2004
+ MX51_PAD_NANDF_D10__PATA_DATA10 0x2004
+ MX51_PAD_NANDF_D9__PATA_DATA9 0x2004
+ MX51_PAD_NANDF_D8__PATA_DATA8 0x2004
+ MX51_PAD_NANDF_D7__PATA_DATA7 0x2004
+ MX51_PAD_NANDF_D6__PATA_DATA6 0x2004
+ MX51_PAD_NANDF_D5__PATA_DATA5 0x2004
+ MX51_PAD_NANDF_D4__PATA_DATA4 0x2004
+ MX51_PAD_NANDF_D3__PATA_DATA3 0x2004
+ MX51_PAD_NANDF_D2__PATA_DATA2 0x2004
+ MX51_PAD_NANDF_D1__PATA_DATA1 0x2004
+ MX51_PAD_NANDF_D0__PATA_DATA0 0x2004
+ >;
+ };
+ };
+
uart1 {
pinctrl_uart1_1: uart1grp-1 {
fsl,pins = <
@@ -591,6 +627,14 @@
status = "disabled";
};
+ pata: pata@83fe0000 {
+ compatible = "fsl,imx51-pata", "fsl,imx27-pata";
+ reg = <0x83fe0000 0x4000>;
+ interrupts = <70>;
+ clocks = <&clks 161>;
+ status = "disabled";
+ };
+
ssi3: ssi at 83fe8000 {
compatible = "fsl,imx51-ssi", "fsl,imx21-ssi";
reg = <0x83fe8000 0x4000>;
--
1.8.2.rc2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] i.MX PATA cleanup and i.MX51 support
2013-04-04 9:25 [PATCH] i.MX PATA cleanup and i.MX51 support Sascha Hauer
` (5 preceding siblings ...)
2013-04-04 9:25 ` [PATCH 6/6] ARM: i.MX51: Add PATA support Sascha Hauer
@ 2013-04-09 7:41 ` Sascha Hauer
6 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2013-04-09 7:41 UTC (permalink / raw)
To: linux-arm-kernel
Hi Jeff,
Any comments to this series? Can you queue 1-4 for the next merge
window?
Sascha
On Thu, Apr 04, 2013 at 11:25:03AM +0200, Sascha Hauer wrote:
> The following contains some cleanup and devicetree support for the
> i.MX PATA driver. Also i.MX51 PATA support is added.
>
> The first four patches should go via the ata tree, the others through
> arm-soc, they do not depend on each other.
>
> Sascha
>
> ----------------------------------------------------------------
> Sascha Hauer (6):
> ata: i.MX PATA: Use devm_clk_get
> ata: i.MX PATA: cleanup error path
> ata: i.MX PATA: use void __iomem * for regs
> ata: i.MX PATA: add devicetree support
> ARM: i.MX5: Add PATA and SRTC clocks
> ARM: i.MX51: Add PATA support
>
> Documentation/devicetree/bindings/ata/imx-pata.txt | 17 +++++++++
> .../devicetree/bindings/clock/imx5-clock.txt | 2 +
> arch/arm/boot/dts/imx51.dtsi | 44 ++++++++++++++++++++++
> arch/arm/mach-imx/clk-imx51-imx53.c | 4 +-
> drivers/ata/pata_imx.c | 36 +++++++++++++-----
> 5 files changed, 92 insertions(+), 11 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/ata/imx-pata.txt
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 10+ messages in thread