Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
84054481
Commit
84054481
authored
Mar 12, 2019
by
Vinod Koul
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'topic/imx' into for-linus
parents
79074168
ceaf5226
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
drivers/dma/imx-dma.c
drivers/dma/imx-dma.c
+3
-5
drivers/dma/imx-sdma.c
drivers/dma/imx-sdma.c
+15
-7
No files found.
drivers/dma/imx-dma.c
View file @
84054481
...
@@ -278,14 +278,14 @@ static int imxdma_hw_chain(struct imxdma_channel *imxdmac)
...
@@ -278,14 +278,14 @@ static int imxdma_hw_chain(struct imxdma_channel *imxdmac)
/*
/*
* imxdma_sg_next - prepare next chunk for scatter-gather DMA emulation
* imxdma_sg_next - prepare next chunk for scatter-gather DMA emulation
*/
*/
static
inline
int
imxdma_sg_next
(
struct
imxdma_desc
*
d
)
static
inline
void
imxdma_sg_next
(
struct
imxdma_desc
*
d
)
{
{
struct
imxdma_channel
*
imxdmac
=
to_imxdma_chan
(
d
->
desc
.
chan
);
struct
imxdma_channel
*
imxdmac
=
to_imxdma_chan
(
d
->
desc
.
chan
);
struct
imxdma_engine
*
imxdma
=
imxdmac
->
imxdma
;
struct
imxdma_engine
*
imxdma
=
imxdmac
->
imxdma
;
struct
scatterlist
*
sg
=
d
->
sg
;
struct
scatterlist
*
sg
=
d
->
sg
;
unsigned
long
now
;
size_t
now
;
now
=
min
(
d
->
len
,
sg_dma_len
(
sg
));
now
=
min
_t
(
size_t
,
d
->
len
,
sg_dma_len
(
sg
));
if
(
d
->
len
!=
IMX_DMA_LENGTH_LOOP
)
if
(
d
->
len
!=
IMX_DMA_LENGTH_LOOP
)
d
->
len
-=
now
;
d
->
len
-=
now
;
...
@@ -303,8 +303,6 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
...
@@ -303,8 +303,6 @@ static inline int imxdma_sg_next(struct imxdma_desc *d)
imx_dmav1_readl
(
imxdma
,
DMA_DAR
(
imxdmac
->
channel
)),
imx_dmav1_readl
(
imxdma
,
DMA_DAR
(
imxdmac
->
channel
)),
imx_dmav1_readl
(
imxdma
,
DMA_SAR
(
imxdmac
->
channel
)),
imx_dmav1_readl
(
imxdma
,
DMA_SAR
(
imxdmac
->
channel
)),
imx_dmav1_readl
(
imxdma
,
DMA_CNTR
(
imxdmac
->
channel
)));
imx_dmav1_readl
(
imxdma
,
DMA_CNTR
(
imxdmac
->
channel
)));
return
now
;
}
}
static
void
imxdma_enable_hw
(
struct
imxdma_desc
*
d
)
static
void
imxdma_enable_hw
(
struct
imxdma_desc
*
d
)
...
...
drivers/dma/imx-sdma.c
View file @
84054481
...
@@ -377,6 +377,7 @@ struct sdma_channel {
...
@@ -377,6 +377,7 @@ struct sdma_channel {
unsigned
long
watermark_level
;
unsigned
long
watermark_level
;
u32
shp_addr
,
per_addr
;
u32
shp_addr
,
per_addr
;
enum
dma_status
status
;
enum
dma_status
status
;
bool
context_loaded
;
struct
imx_dma_data
data
;
struct
imx_dma_data
data
;
struct
work_struct
terminate_worker
;
struct
work_struct
terminate_worker
;
};
};
...
@@ -682,7 +683,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
...
@@ -682,7 +683,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
int
ret
;
int
ret
;
unsigned
long
flags
;
unsigned
long
flags
;
buf_virt
=
dma_alloc_coherent
(
NULL
,
size
,
&
buf_phys
,
GFP_KERNEL
);
buf_virt
=
dma_alloc_coherent
(
sdma
->
dev
,
size
,
&
buf_phys
,
GFP_KERNEL
);
if
(
!
buf_virt
)
{
if
(
!
buf_virt
)
{
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -701,7 +702,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
...
@@ -701,7 +702,7 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
spin_unlock_irqrestore
(
&
sdma
->
channel_0_lock
,
flags
);
spin_unlock_irqrestore
(
&
sdma
->
channel_0_lock
,
flags
);
dma_free_coherent
(
NULL
,
size
,
buf_virt
,
buf_phys
);
dma_free_coherent
(
sdma
->
dev
,
size
,
buf_virt
,
buf_phys
);
return
ret
;
return
ret
;
}
}
...
@@ -975,6 +976,9 @@ static int sdma_load_context(struct sdma_channel *sdmac)
...
@@ -975,6 +976,9 @@ static int sdma_load_context(struct sdma_channel *sdmac)
int
ret
;
int
ret
;
unsigned
long
flags
;
unsigned
long
flags
;
if
(
sdmac
->
context_loaded
)
return
0
;
if
(
sdmac
->
direction
==
DMA_DEV_TO_MEM
)
if
(
sdmac
->
direction
==
DMA_DEV_TO_MEM
)
load_address
=
sdmac
->
pc_from_device
;
load_address
=
sdmac
->
pc_from_device
;
else
if
(
sdmac
->
direction
==
DMA_DEV_TO_DEV
)
else
if
(
sdmac
->
direction
==
DMA_DEV_TO_DEV
)
...
@@ -1017,6 +1021,8 @@ static int sdma_load_context(struct sdma_channel *sdmac)
...
@@ -1017,6 +1021,8 @@ static int sdma_load_context(struct sdma_channel *sdmac)
spin_unlock_irqrestore
(
&
sdma
->
channel_0_lock
,
flags
);
spin_unlock_irqrestore
(
&
sdma
->
channel_0_lock
,
flags
);
sdmac
->
context_loaded
=
true
;
return
ret
;
return
ret
;
}
}
...
@@ -1056,6 +1062,7 @@ static void sdma_channel_terminate_work(struct work_struct *work)
...
@@ -1056,6 +1062,7 @@ static void sdma_channel_terminate_work(struct work_struct *work)
sdmac
->
desc
=
NULL
;
sdmac
->
desc
=
NULL
;
spin_unlock_irqrestore
(
&
sdmac
->
vc
.
lock
,
flags
);
spin_unlock_irqrestore
(
&
sdmac
->
vc
.
lock
,
flags
);
vchan_dma_desc_free_list
(
&
sdmac
->
vc
,
&
head
);
vchan_dma_desc_free_list
(
&
sdmac
->
vc
,
&
head
);
sdmac
->
context_loaded
=
false
;
}
}
static
int
sdma_disable_channel_async
(
struct
dma_chan
*
chan
)
static
int
sdma_disable_channel_async
(
struct
dma_chan
*
chan
)
...
@@ -1187,7 +1194,7 @@ static int sdma_request_channel0(struct sdma_engine *sdma)
...
@@ -1187,7 +1194,7 @@ static int sdma_request_channel0(struct sdma_engine *sdma)
{
{
int
ret
=
-
EBUSY
;
int
ret
=
-
EBUSY
;
sdma
->
bd0
=
dma_zalloc_coherent
(
NULL
,
PAGE_SIZE
,
&
sdma
->
bd0_phys
,
sdma
->
bd0
=
dma_zalloc_coherent
(
sdma
->
dev
,
PAGE_SIZE
,
&
sdma
->
bd0_phys
,
GFP_NOWAIT
);
GFP_NOWAIT
);
if
(
!
sdma
->
bd0
)
{
if
(
!
sdma
->
bd0
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
...
@@ -1210,8 +1217,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc)
...
@@ -1210,8 +1217,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc)
u32
bd_size
=
desc
->
num_bd
*
sizeof
(
struct
sdma_buffer_descriptor
);
u32
bd_size
=
desc
->
num_bd
*
sizeof
(
struct
sdma_buffer_descriptor
);
int
ret
=
0
;
int
ret
=
0
;
desc
->
bd
=
dma_zalloc_coherent
(
NULL
,
bd_size
,
&
desc
->
bd_phys
,
desc
->
bd
=
dma_zalloc_coherent
(
desc
->
sdmac
->
sdma
->
dev
,
bd_size
,
GFP_NOWAIT
);
&
desc
->
bd_phys
,
GFP_NOWAIT
);
if
(
!
desc
->
bd
)
{
if
(
!
desc
->
bd
)
{
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
goto
out
;
...
@@ -1224,7 +1231,8 @@ static void sdma_free_bd(struct sdma_desc *desc)
...
@@ -1224,7 +1231,8 @@ static void sdma_free_bd(struct sdma_desc *desc)
{
{
u32
bd_size
=
desc
->
num_bd
*
sizeof
(
struct
sdma_buffer_descriptor
);
u32
bd_size
=
desc
->
num_bd
*
sizeof
(
struct
sdma_buffer_descriptor
);
dma_free_coherent
(
NULL
,
bd_size
,
desc
->
bd
,
desc
->
bd_phys
);
dma_free_coherent
(
desc
->
sdmac
->
sdma
->
dev
,
bd_size
,
desc
->
bd
,
desc
->
bd_phys
);
}
}
static
void
sdma_desc_free
(
struct
virt_dma_desc
*
vd
)
static
void
sdma_desc_free
(
struct
virt_dma_desc
*
vd
)
...
@@ -1850,7 +1858,7 @@ static int sdma_init(struct sdma_engine *sdma)
...
@@ -1850,7 +1858,7 @@ static int sdma_init(struct sdma_engine *sdma)
/* Be sure SDMA has not started yet */
/* Be sure SDMA has not started yet */
writel_relaxed
(
0
,
sdma
->
regs
+
SDMA_H_C0PTR
);
writel_relaxed
(
0
,
sdma
->
regs
+
SDMA_H_C0PTR
);
sdma
->
channel_control
=
dma_alloc_coherent
(
NULL
,
sdma
->
channel_control
=
dma_alloc_coherent
(
sdma
->
dev
,
MAX_DMA_CHANNELS
*
sizeof
(
struct
sdma_channel_control
)
+
MAX_DMA_CHANNELS
*
sizeof
(
struct
sdma_channel_control
)
+
sizeof
(
struct
sdma_context_data
),
sizeof
(
struct
sdma_context_data
),
&
ccb_phys
,
GFP_KERNEL
);
&
ccb_phys
,
GFP_KERNEL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment