diff mbox series

[4/5] scsi: ufs: renesas: Refactoring specific PHY settings of 0x10a[df]

Message ID 20240708120931.1703956-5-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series scsi: ufs: renesas: Refactor code for other UFS controller | expand

Commit Message

Yoshihiro Shimoda July 8, 2024, 12:09 p.m. UTC
Refactoring specific PHY setting of 0x10a[df] into a new function.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/ufs/host/ufs-renesas.c | 37 +++++++++++++---------------------
 1 file changed, 14 insertions(+), 23 deletions(-)
diff mbox series

Patch

diff --git a/drivers/ufs/host/ufs-renesas.c b/drivers/ufs/host/ufs-renesas.c
index 9b855606a9fb..abe33b0c64db 100644
--- a/drivers/ufs/host/ufs-renesas.c
+++ b/drivers/ufs/host/ufs-renesas.c
@@ -191,6 +191,16 @@  static void ufs_renesas_param_indirect_poll(struct ufs_hba *hba, u32 gpio,
 	ufs_renesas_param_write(hba, 0xf0, 0);
 }
 
+static void ufs_renesas_param_write_phy_10ad_10af(struct ufs_hba *hba,
+						  u32 data_10ad, u32 data_10af)
+{
+	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0001);
+	ufs_renesas_param_write_phy(hba, 0x10ad, data_10ad);
+	ufs_renesas_param_write_phy(hba, 0x10af, data_10af);
+	ufs_renesas_param_write_phy(hba, 0x10b6, 0x0001);
+	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0000);
+}
+
 static void ufs_renesas_pre_init(struct ufs_hba *hba)
 {
 	u32 timer_val;
@@ -266,29 +276,10 @@  static void ufs_renesas_pre_init(struct ufs_hba *hba)
 	ufs_renesas_param_write_phy(hba, 0x4000, 0x0000);
 	ufs_renesas_param_write_phy(hba, 0x4001, 0x0000);
 
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ad, 0x0000);
-	ufs_renesas_param_write_phy(hba, 0x10af, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10b6, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0000);
-
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ad, 0x0000);
-	ufs_renesas_param_write_phy(hba, 0x10af, 0x0002);
-	ufs_renesas_param_write_phy(hba, 0x10b6, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0000);
-
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ad, 0x0080);
-	ufs_renesas_param_write_phy(hba, 0x10af, 0x0000);
-	ufs_renesas_param_write_phy(hba, 0x10b6, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0000);
-
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ad, 0x0080);
-	ufs_renesas_param_write_phy(hba, 0x10af, 0x001a);
-	ufs_renesas_param_write_phy(hba, 0x10b6, 0x0001);
-	ufs_renesas_param_write_phy(hba, 0x10ae, 0x0000);
+	ufs_renesas_param_write_phy_10ad_10af(hba, 0x0000, 0x0001);
+	ufs_renesas_param_write_phy_10ad_10af(hba, 0x0000, 0x0002);
+	ufs_renesas_param_write_phy_10ad_10af(hba, 0x0080, 0x0000);
+	ufs_renesas_param_write_phy_10ad_10af(hba, 0x0080, 0x001a);
 
 	ufs_renesas_param_indirect_write(hba, 7, 0x70, 0x0016);
 	ufs_renesas_param_indirect_write(hba, 7, 0x71, 0x0016);