diff options
author | Viresh Kumar <viresh.kumar@st.com> | 2011-05-16 00:10:10 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-05-20 02:43:07 -0400 |
commit | 43c640157d4366a3ea9ba01f903ea892f46376ee (patch) | |
tree | 810fde5e02141f59575305e3fa1606b0a57e6d5f /drivers/spi | |
parent | c6e7b8cb11632a3b3968c6f64e179c7619eb70c0 (diff) |
spi/amba-pl022: work in polling or interrupt mode if pl022_dma_probe fails
If pl022_dma_probe fails, we can try to transfer data in polling or interrupt
mode. Also, set platform_info->enable_dma to 0, so that no other code tries to
use dma.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/amba-pl022.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index 8a2b88aee373..6a9e58dd36c7 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -1060,7 +1060,7 @@ static int __init pl022_dma_probe(struct pl022 *pl022) | |||
1060 | pl022->master_info->dma_filter, | 1060 | pl022->master_info->dma_filter, |
1061 | pl022->master_info->dma_rx_param); | 1061 | pl022->master_info->dma_rx_param); |
1062 | if (!pl022->dma_rx_channel) { | 1062 | if (!pl022->dma_rx_channel) { |
1063 | dev_err(&pl022->adev->dev, "no RX DMA channel!\n"); | 1063 | dev_dbg(&pl022->adev->dev, "no RX DMA channel!\n"); |
1064 | goto err_no_rxchan; | 1064 | goto err_no_rxchan; |
1065 | } | 1065 | } |
1066 | 1066 | ||
@@ -1068,13 +1068,13 @@ static int __init pl022_dma_probe(struct pl022 *pl022) | |||
1068 | pl022->master_info->dma_filter, | 1068 | pl022->master_info->dma_filter, |
1069 | pl022->master_info->dma_tx_param); | 1069 | pl022->master_info->dma_tx_param); |
1070 | if (!pl022->dma_tx_channel) { | 1070 | if (!pl022->dma_tx_channel) { |
1071 | dev_err(&pl022->adev->dev, "no TX DMA channel!\n"); | 1071 | dev_dbg(&pl022->adev->dev, "no TX DMA channel!\n"); |
1072 | goto err_no_txchan; | 1072 | goto err_no_txchan; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); | 1075 | pl022->dummypage = kmalloc(PAGE_SIZE, GFP_KERNEL); |
1076 | if (!pl022->dummypage) { | 1076 | if (!pl022->dummypage) { |
1077 | dev_err(&pl022->adev->dev, "no DMA dummypage!\n"); | 1077 | dev_dbg(&pl022->adev->dev, "no DMA dummypage!\n"); |
1078 | goto err_no_dummypage; | 1078 | goto err_no_dummypage; |
1079 | } | 1079 | } |
1080 | 1080 | ||
@@ -1090,6 +1090,8 @@ err_no_txchan: | |||
1090 | dma_release_channel(pl022->dma_rx_channel); | 1090 | dma_release_channel(pl022->dma_rx_channel); |
1091 | pl022->dma_rx_channel = NULL; | 1091 | pl022->dma_rx_channel = NULL; |
1092 | err_no_rxchan: | 1092 | err_no_rxchan: |
1093 | dev_err(&pl022->adev->dev, | ||
1094 | "Failed to work in dma mode, work without dma!\n"); | ||
1093 | return -ENODEV; | 1095 | return -ENODEV; |
1094 | } | 1096 | } |
1095 | 1097 | ||
@@ -2115,7 +2117,7 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2115 | if (platform_info->enable_dma) { | 2117 | if (platform_info->enable_dma) { |
2116 | status = pl022_dma_probe(pl022); | 2118 | status = pl022_dma_probe(pl022); |
2117 | if (status != 0) | 2119 | if (status != 0) |
2118 | goto err_no_dma; | 2120 | platform_info->enable_dma = 0; |
2119 | } | 2121 | } |
2120 | 2122 | ||
2121 | /* Initialize and start queue */ | 2123 | /* Initialize and start queue */ |
@@ -2151,7 +2153,6 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) | |||
2151 | err_init_queue: | 2153 | err_init_queue: |
2152 | destroy_queue(pl022); | 2154 | destroy_queue(pl022); |
2153 | pl022_dma_remove(pl022); | 2155 | pl022_dma_remove(pl022); |
2154 | err_no_dma: | ||
2155 | free_irq(adev->irq[0], pl022); | 2156 | free_irq(adev->irq[0], pl022); |
2156 | err_no_irq: | 2157 | err_no_irq: |
2157 | clk_put(pl022->clk); | 2158 | clk_put(pl022->clk); |