diff options
author | Guodong Xu <guodong.xu@linaro.org> | 2013-09-15 19:11:43 +0800 |
---|---|---|
committer | Guodong Xu <guodong.xu@linaro.org> | 2013-09-15 19:11:43 +0800 |
commit | 32f13804d89d110a3c6593aa716964dcf041da56 (patch) | |
tree | 3eff3ef30544c606b96e11afd6159c33d3c7a7a5 | |
parent | 1349191eb42e5990ef756504b33b2a02af287fea (diff) | |
parent | 5ad0551387cf8d08df83e78135a1c49b56ccd414 (diff) |
Merge commit 'tracking-hilt-s40-dma-0910' into integration-hilt-lsk-androidintegration-hilt-lsk-android-0915
* commit 'tracking-hilt-s40-dma-0910':
hs_defconfig: add AMBA_PL08X and module support
hs: hi3716.dtsi: add dmac node
dma: amba-pl08x: dt support
-rw-r--r-- | arch/arm/boot/dts/hi3716-dkb.dts | 4 | ||||
-rw-r--r-- | arch/arm/boot/dts/hi3716.dtsi | 24 | ||||
-rw-r--r-- | arch/arm/configs/hs_defconfig | 6 | ||||
-rw-r--r-- | drivers/dma/amba-pl08x.c | 31 |
4 files changed, 59 insertions, 6 deletions
diff --git a/arch/arm/boot/dts/hi3716-dkb.dts b/arch/arm/boot/dts/hi3716-dkb.dts index 91beec5f236f..86fae4a783aa 100644 --- a/arch/arm/boot/dts/hi3716-dkb.dts +++ b/arch/arm/boot/dts/hi3716-dkb.dts @@ -51,6 +51,10 @@ uart0: uart@f8b00000 { status = "okay"; }; + + dmac: dmac@f9870000 { + status = "okay"; + }; }; }; }; diff --git a/arch/arm/boot/dts/hi3716.dtsi b/arch/arm/boot/dts/hi3716.dtsi index 5eea43c055f5..591d4316749c 100644 --- a/arch/arm/boot/dts/hi3716.dtsi +++ b/arch/arm/boot/dts/hi3716.dtsi @@ -131,6 +131,19 @@ clock-names = "apb_pclk"; status = "disabled"; }; + + dmac: dmac@f9870000 { + compatible = "arm,pl080", "arm,primecell"; + arm,primecell-periphid = <0x00041080>; + reg = <0xf9870000 0x1000>; + #dma-cells = <1>; + dma-channels = <8>; + dma-requests = <16>; + clocks = <&clk_dmac>; + clock-names = "apb_pclk"; + interrupts = <0 30 4>; + status = "disabled"; + }; }; clocks { @@ -219,6 +232,17 @@ clock-output-names = "sfc"; }; + + clk_dmac: clk_dmac { + compatible = "hisilicon,hi3716-clk-gate"; + #clock-cells = <0>; + clocks = <&bpll 3>; + + /* offset, enable, reset */ + gate-reg = <0xa4 0 4>; + + clock-output-names = "dmac"; + }; }; local_timer@f8a00600 { diff --git a/arch/arm/configs/hs_defconfig b/arch/arm/configs/hs_defconfig index d8ca78d01f1e..badb9ce92dea 100644 --- a/arch/arm/configs/hs_defconfig +++ b/arch/arm/configs/hs_defconfig @@ -28,7 +28,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" CONFIG_LOCALVERSION="" -CONFIG_LOCALVERSION_AUTO=y +# CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_LZMA=y CONFIG_HAVE_KERNEL_XZ=y @@ -178,7 +178,7 @@ CONFIG_HAVE_GENERIC_DMA_COHERENT=y CONFIG_SLABINFO=y CONFIG_RT_MUTEXES=y CONFIG_BASE_SMALL=0 -# CONFIG_MODULES is not set +CONFIG_MODULES=y CONFIG_STOP_MACHINE=y CONFIG_BLOCK=y CONFIG_LBDAF=y @@ -1653,7 +1653,7 @@ CONFIG_DMADEVICES=y # # DMA Devices # -# CONFIG_AMBA_PL08X is not set +CONFIG_AMBA_PL08X=y # CONFIG_DW_DMAC is not set # CONFIG_TIMB_DMA is not set CONFIG_PL330_DMA=y diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 8bad254a498d..089d6a7b4732 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -83,6 +83,7 @@ #include <linux/pm_runtime.h> #include <linux/seq_file.h> #include <linux/slab.h> +#include <linux/of.h> #include <linux/amba/pl080.h> #include "dmaengine.h" @@ -1718,8 +1719,10 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x, chan->signal = -1; if (slave) { - chan->cd = &pl08x->pd->slave_channels[i]; - pl08x_dma_slave_init(chan); + if (pl08x->pd->slave_channels) { + chan->cd = &pl08x->pd->slave_channels[i]; + pl08x_dma_slave_init(chan); + } } else { chan->cd = &pl08x->pd->memcpy_channel; chan->name = kasprintf(GFP_KERNEL, "memcpy%d", i); @@ -1841,6 +1844,25 @@ static inline void init_pl08x_debugfs(struct pl08x_driver_data *pl08x) { } #endif +static struct pl08x_platform_data *pl08x_get_pdata(struct device *dev) +{ + struct pl08x_platform_data *pd; + struct device_node *np = dev->of_node; + + pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + if (!pd) + return NULL; + of_property_read_u32(np, "dma-requests", &pd->num_slave_channels); + + pd->memcpy_channel.cctl_memcpy = + (PL080_BSIZE_16 << PL080_CONTROL_SB_SIZE_SHIFT | + PL080_BSIZE_16 << PL080_CONTROL_DB_SIZE_SHIFT | + PL080_WIDTH_32BIT << PL080_CONTROL_SWIDTH_SHIFT | + PL080_WIDTH_32BIT << PL080_CONTROL_DWIDTH_SHIFT | + PL080_CONTROL_PROT_BUFF | PL080_CONTROL_PROT_CACHE | + PL080_CONTROL_PROT_SYS); + return pd; +} static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) { @@ -1883,7 +1905,10 @@ static int pl08x_probe(struct amba_device *adev, const struct amba_id *id) pl08x->slave.device_control = pl08x_control; /* Get the platform data */ - pl08x->pd = dev_get_platdata(&adev->dev); + if ((&adev->dev)->of_node) + pl08x->pd = pl08x_get_pdata(&adev->dev); + else + pl08x->pd = dev_get_platdata(&adev->dev); if (!pl08x->pd) { dev_err(&adev->dev, "no platform data supplied\n"); ret = -EINVAL; |