diff options
author | Rameshwar Prasad Sahu <rsahu@apm.com> | 2015-07-21 09:14:39 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2015-08-20 02:27:11 -0400 |
commit | 89079493437701551938652003eb75b328425c66 (patch) | |
tree | c344bee96ef68ed7581624f7f3974029fb11f3e0 /drivers/dma/xgene-dma.c | |
parent | b93edcdd037f713e9b62cc76fb2064282af01aec (diff) |
dmaengine: xgene-dma: Add ACPI support for X-Gene DMA engine driver
This patch adds ACPI support for the APM X-Gene DMA engine driver.
Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/xgene-dma.c')
-rw-r--r-- | drivers/dma/xgene-dma.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/dma/xgene-dma.c b/drivers/dma/xgene-dma.c index fe87a634b145..d1c8809a0810 100644 --- a/drivers/dma/xgene-dma.c +++ b/drivers/dma/xgene-dma.c | |||
@@ -21,6 +21,7 @@ | |||
21 | * NOTE: PM support is currently not available. | 21 | * NOTE: PM support is currently not available. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <linux/acpi.h> | ||
24 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | #include <linux/dma-mapping.h> | 27 | #include <linux/dma-mapping.h> |
@@ -1940,16 +1941,18 @@ static int xgene_dma_probe(struct platform_device *pdev) | |||
1940 | return ret; | 1941 | return ret; |
1941 | 1942 | ||
1942 | pdma->clk = devm_clk_get(&pdev->dev, NULL); | 1943 | pdma->clk = devm_clk_get(&pdev->dev, NULL); |
1943 | if (IS_ERR(pdma->clk)) { | 1944 | if (IS_ERR(pdma->clk) && !ACPI_COMPANION(&pdev->dev)) { |
1944 | dev_err(&pdev->dev, "Failed to get clk\n"); | 1945 | dev_err(&pdev->dev, "Failed to get clk\n"); |
1945 | return PTR_ERR(pdma->clk); | 1946 | return PTR_ERR(pdma->clk); |
1946 | } | 1947 | } |
1947 | 1948 | ||
1948 | /* Enable clk before accessing registers */ | 1949 | /* Enable clk before accessing registers */ |
1949 | ret = clk_prepare_enable(pdma->clk); | 1950 | if (!IS_ERR(pdma->clk)) { |
1950 | if (ret) { | 1951 | ret = clk_prepare_enable(pdma->clk); |
1951 | dev_err(&pdev->dev, "Failed to enable clk %d\n", ret); | 1952 | if (ret) { |
1952 | return ret; | 1953 | dev_err(&pdev->dev, "Failed to enable clk %d\n", ret); |
1954 | return ret; | ||
1955 | } | ||
1953 | } | 1956 | } |
1954 | 1957 | ||
1955 | /* Remove DMA RAM out of shutdown */ | 1958 | /* Remove DMA RAM out of shutdown */ |
@@ -1994,7 +1997,8 @@ err_request_irq: | |||
1994 | 1997 | ||
1995 | err_dma_mask: | 1998 | err_dma_mask: |
1996 | err_clk_enable: | 1999 | err_clk_enable: |
1997 | clk_disable_unprepare(pdma->clk); | 2000 | if (!IS_ERR(pdma->clk)) |
2001 | clk_disable_unprepare(pdma->clk); | ||
1998 | 2002 | ||
1999 | return ret; | 2003 | return ret; |
2000 | } | 2004 | } |
@@ -2018,11 +2022,20 @@ static int xgene_dma_remove(struct platform_device *pdev) | |||
2018 | xgene_dma_delete_chan_rings(chan); | 2022 | xgene_dma_delete_chan_rings(chan); |
2019 | } | 2023 | } |
2020 | 2024 | ||
2021 | clk_disable_unprepare(pdma->clk); | 2025 | if (!IS_ERR(pdma->clk)) |
2026 | clk_disable_unprepare(pdma->clk); | ||
2022 | 2027 | ||
2023 | return 0; | 2028 | return 0; |
2024 | } | 2029 | } |
2025 | 2030 | ||
2031 | #ifdef CONFIG_ACPI | ||
2032 | static const struct acpi_device_id xgene_dma_acpi_match_ptr[] = { | ||
2033 | {"APMC0D43", 0}, | ||
2034 | {}, | ||
2035 | }; | ||
2036 | MODULE_DEVICE_TABLE(acpi, xgene_dma_acpi_match_ptr); | ||
2037 | #endif | ||
2038 | |||
2026 | static const struct of_device_id xgene_dma_of_match_ptr[] = { | 2039 | static const struct of_device_id xgene_dma_of_match_ptr[] = { |
2027 | {.compatible = "apm,xgene-storm-dma",}, | 2040 | {.compatible = "apm,xgene-storm-dma",}, |
2028 | {}, | 2041 | {}, |
@@ -2035,6 +2048,7 @@ static struct platform_driver xgene_dma_driver = { | |||
2035 | .driver = { | 2048 | .driver = { |
2036 | .name = "X-Gene-DMA", | 2049 | .name = "X-Gene-DMA", |
2037 | .of_match_table = xgene_dma_of_match_ptr, | 2050 | .of_match_table = xgene_dma_of_match_ptr, |
2051 | .acpi_match_table = ACPI_PTR(xgene_dma_acpi_match_ptr), | ||
2038 | }, | 2052 | }, |
2039 | }; | 2053 | }; |
2040 | 2054 | ||