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
bbd4b28b
Commit
bbd4b28b
authored
Sep 30, 2018
by
Andy Gross
Browse files
Options
Browse Files
Download
Plain Diff
Merge tag 'qcom-geni-immutable-for-mark-brown' into drivers-for-4.20-final
Immutable branch for QCOM Geni patches
parents
5b394b2d
969fc78c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
26 deletions
+28
-26
drivers/soc/qcom/qcom-geni-se.c
drivers/soc/qcom/qcom-geni-se.c
+24
-17
include/linux/qcom-geni-se.h
include/linux/qcom-geni-se.h
+4
-9
No files found.
drivers/soc/qcom/qcom-geni-se.c
View file @
bbd4b28b
...
...
@@ -513,7 +513,7 @@ EXPORT_SYMBOL(geni_se_resources_on);
*/
int
geni_se_clk_tbl_get
(
struct
geni_se
*
se
,
unsigned
long
**
tbl
)
{
unsigned
long
freq
=
0
;
long
freq
=
0
;
int
i
;
if
(
se
->
clk_perf_tbl
)
{
...
...
@@ -529,7 +529,7 @@ int geni_se_clk_tbl_get(struct geni_se *se, unsigned long **tbl)
for
(
i
=
0
;
i
<
MAX_CLK_PERF_LEVEL
;
i
++
)
{
freq
=
clk_round_rate
(
se
->
clk
,
freq
+
1
);
if
(
!
freq
||
freq
==
se
->
clk_perf_tbl
[
i
-
1
])
if
(
freq
<=
0
||
freq
==
se
->
clk_perf_tbl
[
i
-
1
])
break
;
se
->
clk_perf_tbl
[
i
]
=
freq
;
}
...
...
@@ -544,16 +544,17 @@ EXPORT_SYMBOL(geni_se_clk_tbl_get);
* @se: Pointer to the concerned serial engine.
* @req_freq: Requested clock frequency.
* @index: Index of the resultant frequency in the table.
* @res_freq: Resultant frequency which matches or is closer to the
* requested frequency.
* @res_freq: Resultant frequency of the source clock.
* @exact: Flag to indicate exact multiple requirement of the requested
* frequency.
*
* This function is called by the protocol drivers to determine the matching
* or exact multiple of the requested frequency, as provided by the serial
* engine clock in order to meet the performance requirements. If there is
* no matching or exact multiple of the requested frequency found, then it
* selects the closest floor frequency, if exact flag is not set.
* This function is called by the protocol drivers to determine the best match
* of the requested frequency as provided by the serial engine clock in order
* to meet the performance requirements.
*
* If we return success:
* - if @exact is true then @res_freq / <an_integer> == @req_freq
* - if @exact is false then @res_freq / <an_integer> <= @req_freq
*
* Return: 0 on success, standard Linux error codes on failure.
*/
...
...
@@ -564,6 +565,9 @@ int geni_se_clk_freq_match(struct geni_se *se, unsigned long req_freq,
unsigned
long
*
tbl
;
int
num_clk_levels
;
int
i
;
unsigned
long
best_delta
;
unsigned
long
new_delta
;
unsigned
int
divider
;
num_clk_levels
=
geni_se_clk_tbl_get
(
se
,
&
tbl
);
if
(
num_clk_levels
<
0
)
...
...
@@ -572,18 +576,21 @@ int geni_se_clk_freq_match(struct geni_se *se, unsigned long req_freq,
if
(
num_clk_levels
==
0
)
return
-
EINVAL
;
*
res_freq
=
0
;
best_delta
=
ULONG_MAX
;
for
(
i
=
0
;
i
<
num_clk_levels
;
i
++
)
{
if
(
!
(
tbl
[
i
]
%
req_freq
))
{
divider
=
DIV_ROUND_UP
(
tbl
[
i
],
req_freq
);
new_delta
=
req_freq
-
tbl
[
i
]
/
divider
;
if
(
new_delta
<
best_delta
)
{
/* We have a new best! */
*
index
=
i
;
*
res_freq
=
tbl
[
i
];
return
0
;
}
if
(
!
(
*
res_freq
)
||
((
tbl
[
i
]
>
*
res_freq
)
&&
(
tbl
[
i
]
<
req_freq
)))
{
*
index
=
i
;
*
res_freq
=
tbl
[
i
];
/* If the new best is exact then we're done */
if
(
new_delta
==
0
)
return
0
;
/* Record how close we got */
best_delta
=
new_delta
;
}
}
...
...
include/linux/qcom-geni-se.h
View file @
bbd4b28b
...
...
@@ -225,19 +225,14 @@ struct geni_se {
#define HW_VER_MINOR_SHFT 16
#define HW_VER_STEP_MASK GENMASK(15, 0)
#define GENI_SE_VERSION_MAJOR(ver) ((ver & HW_VER_MAJOR_MASK) >> HW_VER_MAJOR_SHFT)
#define GENI_SE_VERSION_MINOR(ver) ((ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT)
#define GENI_SE_VERSION_STEP(ver) (ver & HW_VER_STEP_MASK)
#if IS_ENABLED(CONFIG_QCOM_GENI_SE)
u32
geni_se_get_qup_hw_version
(
struct
geni_se
*
se
);
#define geni_se_get_wrapper_version(se, major, minor, step) do { \
u32 ver; \
\
ver = geni_se_get_qup_hw_version(se); \
major = (ver & HW_VER_MAJOR_MASK) >> HW_VER_MAJOR_SHFT; \
minor = (ver & HW_VER_MINOR_MASK) >> HW_VER_MINOR_SHFT; \
step = version & HW_VER_STEP_MASK; \
} while (0)
/**
* geni_se_read_proto() - Read the protocol configured for a serial engine
* @se: Pointer to the concerned serial engine.
...
...
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