Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
db0e7018
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db0e7018
编写于
7月 28, 2014
作者:
V
Vinod Koul
浏览文件
操作
浏览文件
下载
差异文件
Merge commit 'renesas-rcar-audmapp-for-v3.17' into for-linus
上级
8e8805d5
caf18c27
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
113 addition
and
30 deletion
+113
-30
Documentation/devicetree/bindings/dma/rcar-audmapp.txt
Documentation/devicetree/bindings/dma/rcar-audmapp.txt
+29
-0
drivers/dma/sh/rcar-audmapp.c
drivers/dma/sh/rcar-audmapp.c
+84
-30
未找到文件。
Documentation/devicetree/bindings/dma/rcar-audmapp.txt
0 → 100644
浏览文件 @
db0e7018
* R-Car Audio DMAC peri peri Device Tree bindings
Required properties:
- compatible: should be "renesas,rcar-audmapp"
- #dma-cells: should be <1>, see "dmas" property below
Example:
audmapp: audio-dma-pp@0xec740000 {
compatible = "renesas,rcar-audmapp";
#dma-cells = <1>;
reg = <0 0xec740000 0 0x200>;
};
* DMA client
Required properties:
- dmas: a list of <[DMA multiplexer phandle] [SRS/DRS value]> pairs,
where SRS/DRS values are fixed handles, specified in the SoC
manual as the value that would be written into the PDMACHCR.
- dma-names: a list of DMA channel names, one per "dmas" entry
Example:
dmas = <&audmapp 0x2d00
&audmapp 0x3700>;
dma-names = "src0_ssiu0",
"dvc0_ssiu0";
drivers/dma/sh/rcar-audmapp.c
浏览文件 @
db0e7018
...
...
@@ -22,6 +22,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/dmaengine.h>
#include <linux/of_dma.h>
#include <linux/platform_data/dma-rcar-audmapp.h>
#include <linux/platform_device.h>
#include <linux/shdma-base.h>
...
...
@@ -45,8 +46,9 @@
struct
audmapp_chan
{
struct
shdma_chan
shdma_chan
;
struct
audmapp_slave_config
*
config
;
void
__iomem
*
base
;
dma_addr_t
slave_addr
;
u32
chcr
;
};
struct
audmapp_device
{
...
...
@@ -56,7 +58,16 @@ struct audmapp_device {
void
__iomem
*
chan_reg
;
};
struct
audmapp_desc
{
struct
shdma_desc
shdma_desc
;
dma_addr_t
src
;
dma_addr_t
dst
;
};
#define to_shdma_chan(c) container_of(c, struct shdma_chan, dma_chan)
#define to_chan(chan) container_of(chan, struct audmapp_chan, shdma_chan)
#define to_desc(sdesc) container_of(sdesc, struct audmapp_desc, shdma_desc)
#define to_dev(chan) container_of(chan->shdma_chan.dma_chan.device, \
struct audmapp_device, shdma_dev.dma_dev)
...
...
@@ -90,70 +101,82 @@ static void audmapp_halt(struct shdma_chan *schan)
}
static
void
audmapp_start_xfer
(
struct
shdma_chan
*
schan
,
struct
shdma_desc
*
sde
cs
)
struct
shdma_desc
*
sde
sc
)
{
struct
audmapp_chan
*
auchan
=
to_chan
(
schan
);
struct
audmapp_device
*
audev
=
to_dev
(
auchan
);
struct
audmapp_
slave_config
*
cfg
=
auchan
->
config
;
struct
audmapp_
desc
*
desc
=
to_desc
(
sdesc
)
;
struct
device
*
dev
=
audev
->
dev
;
u32
chcr
=
cfg
->
chcr
|
PDMACHCR_DE
;
u32
chcr
=
auchan
->
chcr
|
PDMACHCR_DE
;
dev_dbg
(
dev
,
"src/dst/chcr = %pad/%pad/%x
\n
"
,
&
cfg
->
src
,
&
cfg
->
dst
,
cfg
->
chcr
);
dev_dbg
(
dev
,
"src/dst/chcr = %pad/%pad/%
08
x
\n
"
,
&
desc
->
src
,
&
desc
->
dst
,
chcr
);
audmapp_write
(
auchan
,
cfg
->
src
,
PDMASAR
);
audmapp_write
(
auchan
,
cfg
->
dst
,
PDMADAR
);
audmapp_write
(
auchan
,
desc
->
src
,
PDMASAR
);
audmapp_write
(
auchan
,
desc
->
dst
,
PDMADAR
);
audmapp_write
(
auchan
,
chcr
,
PDMACHCR
);
}
static
struct
audmapp_slave_config
*
audmapp_find_slave
(
struct
audmapp_chan
*
auchan
,
int
slave_id
)
static
void
audmapp_get_config
(
struct
audmapp_chan
*
auchan
,
int
slave_id
,
u32
*
chcr
,
dma_addr_t
*
dst
)
{
struct
audmapp_device
*
audev
=
to_dev
(
auchan
);
struct
audmapp_pdata
*
pdata
=
audev
->
pdata
;
struct
audmapp_slave_config
*
cfg
;
int
i
;
*
chcr
=
0
;
*
dst
=
0
;
if
(
!
pdata
)
{
/* DT */
*
chcr
=
((
u32
)
slave_id
)
<<
16
;
auchan
->
shdma_chan
.
slave_id
=
(
slave_id
)
>>
8
;
return
;
}
/* non-DT */
if
(
slave_id
>=
AUDMAPP_SLAVE_NUMBER
)
return
NULL
;
return
;
for
(
i
=
0
,
cfg
=
pdata
->
slave
;
i
<
pdata
->
slave_num
;
i
++
,
cfg
++
)
if
(
cfg
->
slave_id
==
slave_id
)
return
cfg
;
return
NULL
;
if
(
cfg
->
slave_id
==
slave_id
)
{
*
chcr
=
cfg
->
chcr
;
*
dst
=
cfg
->
dst
;
break
;
}
}
static
int
audmapp_set_slave
(
struct
shdma_chan
*
schan
,
int
slave_id
,
dma_addr_t
slave_addr
,
bool
try
)
{
struct
audmapp_chan
*
auchan
=
to_chan
(
schan
);
struct
audmapp_slave_config
*
cfg
=
audmapp_find_slave
(
auchan
,
slave_id
);
u32
chcr
;
dma_addr_t
dst
;
audmapp_get_config
(
auchan
,
slave_id
,
&
chcr
,
&
dst
);
if
(
!
cfg
)
return
-
ENODEV
;
if
(
try
)
return
0
;
auchan
->
config
=
cfg
;
auchan
->
chcr
=
chcr
;
auchan
->
slave_addr
=
slave_addr
?
:
dst
;
return
0
;
}
static
int
audmapp_desc_setup
(
struct
shdma_chan
*
schan
,
struct
shdma_desc
*
sde
cs
,
struct
shdma_desc
*
sde
sc
,
dma_addr_t
src
,
dma_addr_t
dst
,
size_t
*
len
)
{
struct
audmapp_chan
*
auchan
=
to_chan
(
schan
);
struct
audmapp_slave_config
*
cfg
=
auchan
->
config
;
if
(
!
cfg
)
return
-
ENODEV
;
struct
audmapp_desc
*
desc
=
to_desc
(
sdesc
);
if
(
*
len
>
(
size_t
)
AUDMAPP_LEN_MAX
)
*
len
=
(
size_t
)
AUDMAPP_LEN_MAX
;
desc
->
src
=
src
;
desc
->
dst
=
dst
;
return
0
;
}
...
...
@@ -164,7 +187,9 @@ static void audmapp_setup_xfer(struct shdma_chan *schan,
static
dma_addr_t
audmapp_slave_addr
(
struct
shdma_chan
*
schan
)
{
return
0
;
/* always fixed address */
struct
audmapp_chan
*
auchan
=
to_chan
(
schan
);
return
auchan
->
slave_addr
;
}
static
bool
audmapp_channel_busy
(
struct
shdma_chan
*
schan
)
...
...
@@ -183,7 +208,7 @@ static bool audmapp_desc_completed(struct shdma_chan *schan,
static
struct
shdma_desc
*
audmapp_embedded_desc
(
void
*
buf
,
int
i
)
{
return
&
((
struct
shdma_desc
*
)
buf
)[
i
]
;
return
&
((
struct
audmapp_desc
*
)
buf
)[
i
].
shdma_desc
;
}
static
const
struct
shdma_ops
audmapp_shdma_ops
=
{
...
...
@@ -234,16 +259,39 @@ static void audmapp_chan_remove(struct audmapp_device *audev)
dma_dev
->
chancnt
=
0
;
}
static
struct
dma_chan
*
audmapp_of_xlate
(
struct
of_phandle_args
*
dma_spec
,
struct
of_dma
*
ofdma
)
{
dma_cap_mask_t
mask
;
struct
dma_chan
*
chan
;
u32
chcr
=
dma_spec
->
args
[
0
];
if
(
dma_spec
->
args_count
!=
1
)
return
NULL
;
dma_cap_zero
(
mask
);
dma_cap_set
(
DMA_SLAVE
,
mask
);
chan
=
dma_request_channel
(
mask
,
shdma_chan_filter
,
NULL
);
if
(
chan
)
to_shdma_chan
(
chan
)
->
hw_req
=
chcr
;
return
chan
;
}
static
int
audmapp_probe
(
struct
platform_device
*
pdev
)
{
struct
audmapp_pdata
*
pdata
=
pdev
->
dev
.
platform_data
;
struct
device_node
*
np
=
pdev
->
dev
.
of_node
;
struct
audmapp_device
*
audev
;
struct
shdma_dev
*
sdev
;
struct
dma_device
*
dma_dev
;
struct
resource
*
res
;
int
err
,
i
;
if
(
!
pdata
)
if
(
np
)
of_dma_controller_register
(
np
,
audmapp_of_xlate
,
pdev
);
else
if
(
!
pdata
)
return
-
ENODEV
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
...
...
@@ -260,7 +308,7 @@ static int audmapp_probe(struct platform_device *pdev)
sdev
=
&
audev
->
shdma_dev
;
sdev
->
ops
=
&
audmapp_shdma_ops
;
sdev
->
desc_size
=
sizeof
(
struct
shdma
_desc
);
sdev
->
desc_size
=
sizeof
(
struct
audmapp
_desc
);
dma_dev
=
&
sdev
->
dma_dev
;
dma_dev
->
copy_align
=
LOG2_DEFAULT_XFER_SIZE
;
...
...
@@ -305,12 +353,18 @@ static int audmapp_remove(struct platform_device *pdev)
return
0
;
}
static
const
struct
of_device_id
audmapp_of_match
[]
=
{
{
.
compatible
=
"renesas,rcar-audmapp"
,
},
{},
};
static
struct
platform_driver
audmapp_driver
=
{
.
probe
=
audmapp_probe
,
.
remove
=
audmapp_remove
,
.
driver
=
{
.
owner
=
THIS_MODULE
,
.
name
=
"rcar-audmapp-engine"
,
.
of_match_table
=
audmapp_of_match
,
},
};
module_platform_driver
(
audmapp_driver
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录