diff options
author | Saeed Bishara <saeed@marvell.com> | 2009-12-06 11:26:18 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-12-17 00:56:46 -0500 |
commit | c77a2f4e6b76c9094182dfa653ece4243f6df80c (patch) | |
tree | b9fc60fc6f2870eb8cdad46a6fec1b8ace2d83b8 /drivers/ata/sata_mv.c | |
parent | d7b0c143693bcbf391d2be235e150b97bfd8f9ba (diff) |
sata_mv: support clkdev framework
Signed-off-by: Saeed Bishara <saeed@marvell.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r-- | drivers/ata/sata_mv.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index bbeaf3a776c9..b625b3614989 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/dmapool.h> | 59 | #include <linux/dmapool.h> |
60 | #include <linux/dma-mapping.h> | 60 | #include <linux/dma-mapping.h> |
61 | #include <linux/device.h> | 61 | #include <linux/device.h> |
62 | #include <linux/clk.h> | ||
62 | #include <linux/platform_device.h> | 63 | #include <linux/platform_device.h> |
63 | #include <linux/ata_platform.h> | 64 | #include <linux/ata_platform.h> |
64 | #include <linux/mbus.h> | 65 | #include <linux/mbus.h> |
@@ -548,6 +549,10 @@ struct mv_host_priv { | |||
548 | u32 irq_cause_offset; | 549 | u32 irq_cause_offset; |
549 | u32 irq_mask_offset; | 550 | u32 irq_mask_offset; |
550 | u32 unmask_all_irqs; | 551 | u32 unmask_all_irqs; |
552 | |||
553 | #if defined(CONFIG_HAVE_CLK) | ||
554 | struct clk *clk; | ||
555 | #endif | ||
551 | /* | 556 | /* |
552 | * These consistent DMA memory pools give us guaranteed | 557 | * These consistent DMA memory pools give us guaranteed |
553 | * alignment for hardware-accessed data structures, | 558 | * alignment for hardware-accessed data structures, |
@@ -4041,6 +4046,14 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4041 | resource_size(res)); | 4046 | resource_size(res)); |
4042 | hpriv->base -= SATAHC0_REG_BASE; | 4047 | hpriv->base -= SATAHC0_REG_BASE; |
4043 | 4048 | ||
4049 | #if defined(CONFIG_HAVE_CLK) | ||
4050 | hpriv->clk = clk_get(&pdev->dev, NULL); | ||
4051 | if (IS_ERR(hpriv->clk)) | ||
4052 | dev_notice(&pdev->dev, "cannot get clkdev\n"); | ||
4053 | else | ||
4054 | clk_enable(hpriv->clk); | ||
4055 | #endif | ||
4056 | |||
4044 | /* | 4057 | /* |
4045 | * (Re-)program MBUS remapping windows if we are asked to. | 4058 | * (Re-)program MBUS remapping windows if we are asked to. |
4046 | */ | 4059 | */ |
@@ -4049,12 +4062,12 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4049 | 4062 | ||
4050 | rc = mv_create_dma_pools(hpriv, &pdev->dev); | 4063 | rc = mv_create_dma_pools(hpriv, &pdev->dev); |
4051 | if (rc) | 4064 | if (rc) |
4052 | return rc; | 4065 | goto err; |
4053 | 4066 | ||
4054 | /* initialize adapter */ | 4067 | /* initialize adapter */ |
4055 | rc = mv_init_host(host, chip_soc); | 4068 | rc = mv_init_host(host, chip_soc); |
4056 | if (rc) | 4069 | if (rc) |
4057 | return rc; | 4070 | goto err; |
4058 | 4071 | ||
4059 | dev_printk(KERN_INFO, &pdev->dev, | 4072 | dev_printk(KERN_INFO, &pdev->dev, |
4060 | "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, | 4073 | "slots %u ports %d\n", (unsigned)MV_MAX_Q_DEPTH, |
@@ -4062,6 +4075,15 @@ static int mv_platform_probe(struct platform_device *pdev) | |||
4062 | 4075 | ||
4063 | return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, | 4076 | return ata_host_activate(host, platform_get_irq(pdev, 0), mv_interrupt, |
4064 | IRQF_SHARED, &mv6_sht); | 4077 | IRQF_SHARED, &mv6_sht); |
4078 | err: | ||
4079 | #if defined(CONFIG_HAVE_CLK) | ||
4080 | if (!IS_ERR(hpriv->clk)) { | ||
4081 | clk_disable(hpriv->clk); | ||
4082 | clk_put(hpriv->clk); | ||
4083 | } | ||
4084 | #endif | ||
4085 | |||
4086 | return rc; | ||
4065 | } | 4087 | } |
4066 | 4088 | ||
4067 | /* | 4089 | /* |
@@ -4076,8 +4098,17 @@ static int __devexit mv_platform_remove(struct platform_device *pdev) | |||
4076 | { | 4098 | { |
4077 | struct device *dev = &pdev->dev; | 4099 | struct device *dev = &pdev->dev; |
4078 | struct ata_host *host = dev_get_drvdata(dev); | 4100 | struct ata_host *host = dev_get_drvdata(dev); |
4079 | 4101 | #if defined(CONFIG_HAVE_CLK) | |
4102 | struct mv_host_priv *hpriv = host->private_data; | ||
4103 | #endif | ||
4080 | ata_host_detach(host); | 4104 | ata_host_detach(host); |
4105 | |||
4106 | #if defined(CONFIG_HAVE_CLK) | ||
4107 | if (!IS_ERR(hpriv->clk)) { | ||
4108 | clk_disable(hpriv->clk); | ||
4109 | clk_put(hpriv->clk); | ||
4110 | } | ||
4111 | #endif | ||
4081 | return 0; | 4112 | return 0; |
4082 | } | 4113 | } |
4083 | 4114 | ||