diff options
author | Chen-Yu Tsai <wens@csie.org> | 2014-11-06 23:15:47 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-11-17 03:20:37 -0500 |
commit | 0b04ddf8638ca5652b1f7ab7794beb363942407d (patch) | |
tree | 49e9e17006614ade242878406d396f475ef83870 /drivers/dma/sun6i-dma.c | |
parent | 25a37c2f12351ada1e42d0663480a182f4e301db (diff) |
dmaengine: sun6i: Add support for Allwinner A23 (sun8i) variant
The A23 SoC has the same dma engine as the A31 (sun6i), with a
reduced amount of endpoints and physical channels. Add the proper
config data and compatible string to support it.
A slight difference in sun8i is an undocumented register needs
to be toggled for dma to function.
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/sun6i-dma.c')
-rw-r--r-- | drivers/dma/sun6i-dma.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 531abbf68a9d..f9f8f4d9915f 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c | |||
@@ -43,6 +43,12 @@ | |||
43 | #define DMA_STAT 0x30 | 43 | #define DMA_STAT 0x30 |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * sun8i specific registers | ||
47 | */ | ||
48 | #define SUN8I_DMA_GATE 0x20 | ||
49 | #define SUN8I_DMA_GATE_ENABLE 0x4 | ||
50 | |||
51 | /* | ||
46 | * Channels specific registers | 52 | * Channels specific registers |
47 | */ | 53 | */ |
48 | #define DMA_CHAN_ENABLE 0x00 | 54 | #define DMA_CHAN_ENABLE 0x00 |
@@ -878,8 +884,20 @@ static struct sun6i_dma_config sun6i_a31_dma_cfg = { | |||
878 | .nr_max_vchans = 53, | 884 | .nr_max_vchans = 53, |
879 | }; | 885 | }; |
880 | 886 | ||
887 | /* | ||
888 | * The A23 only has 8 physical channels, a maximum DRQ port id of 24, | ||
889 | * and a total of 37 usable source and destination endpoints. | ||
890 | */ | ||
891 | |||
892 | static struct sun6i_dma_config sun8i_a23_dma_cfg = { | ||
893 | .nr_max_channels = 8, | ||
894 | .nr_max_requests = 24, | ||
895 | .nr_max_vchans = 37, | ||
896 | }; | ||
897 | |||
881 | static struct of_device_id sun6i_dma_match[] = { | 898 | static struct of_device_id sun6i_dma_match[] = { |
882 | { .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg }, | 899 | { .compatible = "allwinner,sun6i-a31-dma", .data = &sun6i_a31_dma_cfg }, |
900 | { .compatible = "allwinner,sun8i-a23-dma", .data = &sun8i_a23_dma_cfg }, | ||
883 | { /* sentinel */ } | 901 | { /* sentinel */ } |
884 | }; | 902 | }; |
885 | 903 | ||
@@ -1007,6 +1025,15 @@ static int sun6i_dma_probe(struct platform_device *pdev) | |||
1007 | goto err_dma_unregister; | 1025 | goto err_dma_unregister; |
1008 | } | 1026 | } |
1009 | 1027 | ||
1028 | /* | ||
1029 | * sun8i variant requires us to toggle a dma gating register, | ||
1030 | * as seen in Allwinner's SDK. This register is not documented | ||
1031 | * in the A23 user manual. | ||
1032 | */ | ||
1033 | if (of_device_is_compatible(pdev->dev.of_node, | ||
1034 | "allwinner,sun8i-a23-dma")) | ||
1035 | writel(SUN8I_DMA_GATE_ENABLE, sdc->base + SUN8I_DMA_GATE); | ||
1036 | |||
1010 | return 0; | 1037 | return 0; |
1011 | 1038 | ||
1012 | err_dma_unregister: | 1039 | err_dma_unregister: |