Hello. On 22-07-2011 14:46, Arnaud Patard (Rtp) wrote:
Add basic support for pata on iMX. It has been tested only on imx51. SDMA support will probably be added later so this version supports only PIO.
v2: - enable only when needed IORDY - use dev_get_drvdata
Shouldn't this be under --- tearline?
Signed-off-by: Arnaud Patard<arnaud.patard@xxxxxxxxxxx>
[...]
Index: linux-2.6-submit/drivers/ata/pata_imx.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linux-2.6-submit/drivers/ata/pata_imx.c 2011-07-22 12:46:29.000000000 +0200 @@ -0,0 +1,260 @@
[...]
+static int __devinit pata_imx_probe(struct platform_device *pdev) +{ + struct ata_host *host; + struct ata_port *ap; + struct pata_imx_priv *priv; + int irq = 0; + struct resource *io_res; + struct resource *irq_res; + + io_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (io_res == NULL) + return -EINVAL; + + irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (irq_res == NULL) + return -EINVAL; + irq = irq_res->start;
Using platfrom_get_irq() would have been somewhat simpler -- you don't need 'irq_res' at all...
+free_priv: + if (priv->clk) + clk_disable(priv->clk);
Need to call clk_put() also...
+ kfree(priv); + return -ENOMEM; +} + +static int __devexit pata_imx_remove(struct platform_device *pdev) +{ + struct ata_host *host = dev_get_drvdata(&pdev->dev); + struct pata_imx_priv *priv = host->private_data; + + ata_host_detach(host); + + __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); + + if (priv->clk) + clk_disable(priv->clk);
Same here...
+#ifdef CONFIG_PM +static int pata_imx_suspend(struct device *dev) +{ + struct ata_host *host = dev_get_drvdata(dev); + struct pata_imx_priv *priv = host->private_data; + int ret; + + ret = ata_host_suspend(host, PMSG_SUSPEND); + if (!ret) + __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN); + + if (priv->clk) + clk_disable(priv->clk); + + return ret; +} + +static int pata_imx_resume(struct device *dev) +{ + struct ata_host *host = dev_get_drvdata(dev); + struct pata_imx_priv *priv = host->private_data; + + if (priv->clk) + clk_enable(priv->clk); + + __raw_writel(PATA_IMX_ATA_CTRL_FIFO_RST_B | + PATA_IMX_ATA_CTRL_ATA_RST_B, + priv->host_regs + PATA_IMX_ATA_CONTROL);
This will disable IORDY. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html