Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MMC U-Boot Custodian Tree
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
U-Boot
Custodians
MMC U-Boot Custodian Tree
Commits
0670adb2
Commit
0670adb2
authored
5 years ago
by
mingming lee
Committed by
Tom Rini
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
clk: mediatek: add configurable pcw_chg_reg/ibits/fmin to mtk_pll
Add configurable pcw_chg_reg/ibits/fmin to mtk_pll to support mt8512
parent
f62168d3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/clk/mediatek/clk-mtk.c
+17
-8
17 additions, 8 deletions
drivers/clk/mediatek/clk-mtk.c
drivers/clk/mediatek/clk-mtk.h
+3
-0
3 additions, 0 deletions
drivers/clk/mediatek/clk-mtk.h
with
20 additions
and
8 deletions
drivers/clk/mediatek/clk-mtk.c
+
17
−
8
View file @
0670adb2
...
...
@@ -95,11 +95,13 @@ static unsigned long __mtk_pll_recalc_rate(const struct mtk_pll_data *pll,
{
int
pcwbits
=
pll
->
pcwbits
;
int
pcwfbits
;
int
ibits
;
u64
vco
;
u8
c
=
0
;
/* The fractional part of the PLL divider. */
pcwfbits
=
pcwbits
>
INTEGER_BITS
?
pcwbits
-
INTEGER_BITS
:
0
;
ibits
=
pll
->
pcwibits
?
pll
->
pcwibits
:
INTEGER_BITS
;
pcwfbits
=
pcwbits
>
ibits
?
pcwbits
-
ibits
:
0
;
vco
=
(
u64
)
fin
*
pcw
;
...
...
@@ -124,7 +126,7 @@ static void mtk_pll_set_rate_regs(struct clk *clk, u32 pcw, int postdiv)
{
struct
mtk_clk_priv
*
priv
=
dev_get_priv
(
clk
->
dev
);
const
struct
mtk_pll_data
*
pll
=
&
priv
->
tree
->
plls
[
clk
->
id
];
u32
val
;
u32
val
,
chg
;
/* set postdiv */
val
=
readl
(
priv
->
base
+
pll
->
pd_reg
);
...
...
@@ -140,11 +142,16 @@ static void mtk_pll_set_rate_regs(struct clk *clk, u32 pcw, int postdiv)
/* set pcw */
val
&=
~
GENMASK
(
pll
->
pcw_shift
+
pll
->
pcwbits
-
1
,
pll
->
pcw_shift
);
val
|=
pcw
<<
pll
->
pcw_shift
;
val
&=
~
CON1_PCW_CHG
;
writel
(
val
,
priv
->
base
+
pll
->
pcw_reg
);
val
|=
CON1_PCW_CHG
;
writel
(
val
,
priv
->
base
+
pll
->
pcw_reg
);
if
(
pll
->
pcw_chg_reg
)
{
chg
=
readl
(
priv
->
base
+
pll
->
pcw_chg_reg
);
chg
|=
CON1_PCW_CHG
;
writel
(
val
,
priv
->
base
+
pll
->
pcw_reg
);
writel
(
chg
,
priv
->
base
+
pll
->
pcw_chg_reg
);
}
else
{
val
|=
CON1_PCW_CHG
;
writel
(
val
,
priv
->
base
+
pll
->
pcw_reg
);
}
udelay
(
20
);
}
...
...
@@ -161,8 +168,9 @@ static void mtk_pll_calc_values(struct clk *clk, u32 *pcw, u32 *postdiv,
{
struct
mtk_clk_priv
*
priv
=
dev_get_priv
(
clk
->
dev
);
const
struct
mtk_pll_data
*
pll
=
&
priv
->
tree
->
plls
[
clk
->
id
];
unsigned
long
fmin
=
1000
*
MHZ
;
unsigned
long
fmin
=
pll
->
fmin
?
pll
->
fmin
:
1000
*
MHZ
;
u64
_pcw
;
int
ibits
;
u32
val
;
if
(
freq
>
pll
->
fmax
)
...
...
@@ -175,7 +183,8 @@ static void mtk_pll_calc_values(struct clk *clk, u32 *pcw, u32 *postdiv,
}
/* _pcw = freq * postdiv / xtal_rate * 2^pcwfbits */
_pcw
=
((
u64
)
freq
<<
val
)
<<
(
pll
->
pcwbits
-
INTEGER_BITS
);
ibits
=
pll
->
pcwibits
?
pll
->
pcwibits
:
INTEGER_BITS
;
_pcw
=
((
u64
)
freq
<<
val
)
<<
(
pll
->
pcwbits
-
ibits
);
do_div
(
_pcw
,
priv
->
tree
->
xtal2_rate
);
*
pcw
=
(
u32
)
_pcw
;
...
...
This diff is collapsed.
Click to expand it.
drivers/clk/mediatek/clk-mtk.h
+
3
−
0
View file @
0670adb2
...
...
@@ -37,9 +37,12 @@ struct mtk_pll_data {
u32
flags
;
u32
rst_bar_mask
;
u64
fmax
;
u64
fmin
;
int
pcwbits
;
int
pcwibits
;
u32
pcw_reg
;
int
pcw_shift
;
u32
pcw_chg_reg
;
};
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment