aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dw/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/dw/platform.c')
-rw-r--r--drivers/dma/dw/platform.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/drivers/dma/dw/platform.c b/drivers/dma/dw/platform.c
index 860c9acf3fef..d50077e48187 100644
--- a/drivers/dma/dw/platform.c
+++ b/drivers/dma/dw/platform.c
@@ -178,10 +178,17 @@ static int dw_probe(struct platform_device *pdev)
178 178
179 chip->dev = dev; 179 chip->dev = dev;
180 180
181 err = dw_dma_probe(chip, pdata); 181 chip->clk = devm_clk_get(chip->dev, "hclk");
182 if (IS_ERR(chip->clk))
183 return PTR_ERR(chip->clk);
184 err = clk_prepare_enable(chip->clk);
182 if (err) 185 if (err)
183 return err; 186 return err;
184 187
188 err = dw_dma_probe(chip, pdata);
189 if (err)
190 goto err_dw_dma_probe;
191
185 platform_set_drvdata(pdev, chip); 192 platform_set_drvdata(pdev, chip);
186 193
187 if (pdev->dev.of_node) { 194 if (pdev->dev.of_node) {
@@ -196,6 +203,10 @@ static int dw_probe(struct platform_device *pdev)
196 dw_dma_acpi_controller_register(chip->dw); 203 dw_dma_acpi_controller_register(chip->dw);
197 204
198 return 0; 205 return 0;
206
207err_dw_dma_probe:
208 clk_disable_unprepare(chip->clk);
209 return err;
199} 210}
200 211
201static int dw_remove(struct platform_device *pdev) 212static int dw_remove(struct platform_device *pdev)
@@ -205,7 +216,10 @@ static int dw_remove(struct platform_device *pdev)
205 if (pdev->dev.of_node) 216 if (pdev->dev.of_node)
206 of_dma_controller_free(pdev->dev.of_node); 217 of_dma_controller_free(pdev->dev.of_node);
207 218
208 return dw_dma_remove(chip); 219 dw_dma_remove(chip);
220 clk_disable_unprepare(chip->clk);
221
222 return 0;
209} 223}
210 224
211static void dw_shutdown(struct platform_device *pdev) 225static void dw_shutdown(struct platform_device *pdev)
@@ -213,6 +227,7 @@ static void dw_shutdown(struct platform_device *pdev)
213 struct dw_dma_chip *chip = platform_get_drvdata(pdev); 227 struct dw_dma_chip *chip = platform_get_drvdata(pdev);
214 228
215 dw_dma_shutdown(chip); 229 dw_dma_shutdown(chip);
230 clk_disable_unprepare(chip->clk);
216} 231}
217 232
218#ifdef CONFIG_OF 233#ifdef CONFIG_OF
@@ -238,7 +253,10 @@ static int dw_suspend_late(struct device *dev)
238 struct platform_device *pdev = to_platform_device(dev); 253 struct platform_device *pdev = to_platform_device(dev);
239 struct dw_dma_chip *chip = platform_get_drvdata(pdev); 254 struct dw_dma_chip *chip = platform_get_drvdata(pdev);
240 255
241 return dw_dma_suspend(chip); 256 dw_dma_suspend(chip);
257 clk_disable_unprepare(chip->clk);
258
259 return 0;
242} 260}
243 261
244static int dw_resume_early(struct device *dev) 262static int dw_resume_early(struct device *dev)
@@ -246,6 +264,7 @@ static int dw_resume_early(struct device *dev)
246 struct platform_device *pdev = to_platform_device(dev); 264 struct platform_device *pdev = to_platform_device(dev);
247 struct dw_dma_chip *chip = platform_get_drvdata(pdev); 265 struct dw_dma_chip *chip = platform_get_drvdata(pdev);
248 266
267 clk_prepare_enable(chip->clk);
249 return dw_dma_resume(chip); 268 return dw_dma_resume(chip);
250} 269}
251 270