Skip to content

Commit cca2b80

Browse files
shimodaymartinkpetersen
authored andcommitted
scsi: ufs: renesas: Refactor 0x10ad/0x10af PHY settings
Extract specific PHY setting of the 0x10a[df] registers into a new function. Signed-off-by: Yoshihiro Shimoda <[email protected]> Signed-off-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/110eafd1ee24f9db0285a5e2bca224e35962268a.1741179611.git.geert+renesas@glider.be Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 855bde8 commit cca2b80

File tree

1 file changed

+14
-23
lines changed

1 file changed

+14
-23
lines changed

drivers/ufs/host/ufs-renesas.c

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ static void ufs_renesas_indirect_poll(struct ufs_hba *hba, u32 gpio, u32 addr,
135135
ufs_renesas_write(hba, 0xf0, 0);
136136
}
137137

138+
static void ufs_renesas_write_phy_10ad_10af(struct ufs_hba *hba,
139+
u32 data_10ad, u32 data_10af)
140+
{
141+
ufs_renesas_write_phy(hba, 0x10ae, 0x0001);
142+
ufs_renesas_write_phy(hba, 0x10ad, data_10ad);
143+
ufs_renesas_write_phy(hba, 0x10af, data_10af);
144+
ufs_renesas_write_phy(hba, 0x10b6, 0x0001);
145+
ufs_renesas_write_phy(hba, 0x10ae, 0x0000);
146+
}
147+
138148
static void ufs_renesas_pre_init(struct ufs_hba *hba)
139149
{
140150
u32 timer_val;
@@ -209,29 +219,10 @@ static void ufs_renesas_pre_init(struct ufs_hba *hba)
209219
ufs_renesas_write_phy(hba, 0x4000, 0x0000);
210220
ufs_renesas_write_phy(hba, 0x4001, 0x0000);
211221

212-
ufs_renesas_write_phy(hba, 0x10ae, 0x0001);
213-
ufs_renesas_write_phy(hba, 0x10ad, 0x0000);
214-
ufs_renesas_write_phy(hba, 0x10af, 0x0001);
215-
ufs_renesas_write_phy(hba, 0x10b6, 0x0001);
216-
ufs_renesas_write_phy(hba, 0x10ae, 0x0000);
217-
218-
ufs_renesas_write_phy(hba, 0x10ae, 0x0001);
219-
ufs_renesas_write_phy(hba, 0x10ad, 0x0000);
220-
ufs_renesas_write_phy(hba, 0x10af, 0x0002);
221-
ufs_renesas_write_phy(hba, 0x10b6, 0x0001);
222-
ufs_renesas_write_phy(hba, 0x10ae, 0x0000);
223-
224-
ufs_renesas_write_phy(hba, 0x10ae, 0x0001);
225-
ufs_renesas_write_phy(hba, 0x10ad, 0x0080);
226-
ufs_renesas_write_phy(hba, 0x10af, 0x0000);
227-
ufs_renesas_write_phy(hba, 0x10b6, 0x0001);
228-
ufs_renesas_write_phy(hba, 0x10ae, 0x0000);
229-
230-
ufs_renesas_write_phy(hba, 0x10ae, 0x0001);
231-
ufs_renesas_write_phy(hba, 0x10ad, 0x0080);
232-
ufs_renesas_write_phy(hba, 0x10af, 0x001a);
233-
ufs_renesas_write_phy(hba, 0x10b6, 0x0001);
234-
ufs_renesas_write_phy(hba, 0x10ae, 0x0000);
222+
ufs_renesas_write_phy_10ad_10af(hba, 0x0000, 0x0001);
223+
ufs_renesas_write_phy_10ad_10af(hba, 0x0000, 0x0002);
224+
ufs_renesas_write_phy_10ad_10af(hba, 0x0080, 0x0000);
225+
ufs_renesas_write_phy_10ad_10af(hba, 0x0080, 0x001a);
235226

236227
ufs_renesas_indirect_write(hba, 7, 0x70, 0x0016);
237228
ufs_renesas_indirect_write(hba, 7, 0x71, 0x0016);

0 commit comments

Comments
 (0)