Skip to contentSkip to conversation

misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG

PATCH Superseded [email protected] 2 participants 4 messages Jun 4, 2021 – Jun 7, 2021 Char and misc drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG

From: Ricky Wu <[email protected]>

Divide Realtek Card Reader Group into two different modes
ASPM_MODE_CFG: 8411 5209 5227 5229 5249 5250 Change back to use original way to control aspm
ASPM_MODE_REG: 5227A 524A 5250A 5260 5261 5228 Keep the new way to control aspm

---
 drivers/misc/cardreader/rtl8411.c  |  1 +
 drivers/misc/cardreader/rts5209.c  |  1 +
 drivers/misc/cardreader/rts5227.c  |  2 ++
 drivers/misc/cardreader/rts5228.c  |  1 +
 drivers/misc/cardreader/rts5229.c  |  1 +
 drivers/misc/cardreader/rts5249.c  |  3 ++
 drivers/misc/cardreader/rts5260.c  |  1 +
 drivers/misc/cardreader/rts5261.c  |  1 +
 drivers/misc/cardreader/rtsx_pcr.c | 44 +++++++++++++++++++++---------
 include/linux/rtsx_pci.h           |  3 ++
 10 files changed, 45 insertions(+), 13 deletions(-)
drivers/misc/cardreader/rtl8411.c +1 -0
index a07674ed0596..4c5621b17a6f 100644
@@ -468,6 +468,7 @@ static void rtl8411_init_common_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_CFG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(23, 7, 14);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(4, 3, 10);
 	pcr->ic_version = rtl8411_get_ic_version(pcr);
drivers/misc/cardreader/rts5209.c +1 -0
index 39a6a7ecc32e..29f5414072bf 100644
@@ -255,6 +255,7 @@ void rts5209_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_CFG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 16);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
 
drivers/misc/cardreader/rts5227.c +2 -0
index 8200af22b529..4bcfbc9afbac 100644
@@ -358,6 +358,7 @@ void rts5227_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_CFG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 7, 7);
 
@@ -483,6 +484,7 @@ void rts522a_init_params(struct rtsx_pcr *pcr)
 
 	rts5227_init_params(pcr);
 	pcr->ops = &rts522a_pcr_ops;
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
 	pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
 
drivers/misc/cardreader/rts5228.c +1 -0
index 781a86def59a..ffc128278613 100644
@@ -718,6 +718,7 @@ void rts5228_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(28, 27, 11);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
 
drivers/misc/cardreader/rts5229.c +1 -0
index 89e6f124ca5c..c748eaf1ec1f 100644
@@ -246,6 +246,7 @@ void rts5229_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = DRIVER_TYPE_D;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_CFG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 15);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(30, 6, 6);
 
drivers/misc/cardreader/rts5249.c +3 -0
index b2676e7f5027..53f3a1f45c4a 100644
@@ -566,6 +566,7 @@ void rts5249_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_CFG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
 
@@ -729,6 +730,7 @@ static const struct pcr_ops rts524a_pcr_ops = {
 void rts524a_init_params(struct rtsx_pcr *pcr)
 {
 	rts5249_init_params(pcr);
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
 	pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
 	pcr->option.ltr_l1off_snooze_sspwrgate =
@@ -845,6 +847,7 @@ static const struct pcr_ops rts525a_pcr_ops = {
 void rts525a_init_params(struct rtsx_pcr *pcr)
 {
 	rts5249_init_params(pcr);
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11);
 	pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
 	pcr->option.ltr_l1off_snooze_sspwrgate =
drivers/misc/cardreader/rts5260.c +1 -0
index 080a7d67a8e1..9b42b20a3e5a 100644
@@ -628,6 +628,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
 	pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
 
drivers/misc/cardreader/rts5261.c +1 -0
index 6c64dade8e1a..1fd4e0e50730 100644
@@ -783,6 +783,7 @@ void rts5261_init_params(struct rtsx_pcr *pcr)
 	pcr->sd30_drive_sel_1v8 = 0x00;
 	pcr->sd30_drive_sel_3v3 = 0x00;
 	pcr->aspm_en = ASPM_L1_EN;
+	pcr->aspm_mode = ASPM_MODE_REG;
 	pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 27, 11);
 	pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
 
drivers/misc/cardreader/rtsx_pcr.c +31 -13

80 lines not on this page · raw message

include/linux/rtsx_pci.h +3 -0
index 6f155f99aa16..6c16837ee235 100644
@@ -1234,6 +1234,9 @@ struct rtsx_pcr {
 	u8				card_drive_sel;
 #define ASPM_L1_EN			0x02
 	u8				aspm_en;
+#define ASPM_MODE_CFG		0x01
+#define ASPM_MODE_REG		0x02
+	u8				aspm_mode;
 	bool				aspm_enabled;
 
 #define PCR_MS_PMOS			(1 << 0)
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 5 lines · On Fri, Jun 04, 2021 at 10:42:11PM +0800, [email protected] wrote:

From: Ricky Wu <[email protected]>

Divide Realtek Card Reader Group into two different modes
ASPM_MODE_CFG: 8411 5209 5227 5229 5249 5250 Change back to use original way to control aspm

What is "aspm"?

include/linux/rtsx_pci.h struct rtsx_pcr { · line 1239

Quoted 3 lines
include/linux/rtsx_pci.h +3 -0
+#define ASPM_MODE_CFG		0x01
+#define ASPM_MODE_REG		0x02
+	u8				aspm_mode;

Why not use an enum?

thanks,

greg k-h

author
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 4, 2021 10:48 PM
To: Ricky WU
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG

Quoted 9 lines
Quoted 5 lines · On Fri, Jun 04, 2021 at 10:42:11PM +0800, [email protected] wrote:

From: Ricky Wu <[email protected]>

Divide Realtek Card Reader Group into two different modes
ASPM_MODE_CFG: 8411 5209 5227 5229 5249 5250 Change back to use original way to control aspm

What is "aspm"?

Active State Power Management (ASPM)
rtsx_comm_set_aspm: ASPM control function for our driver
to make sure not enter power saving in process of init and card_detcct

Quoted 6 lines

include/linux/rtsx_pci.h struct rtsx_pcr { · line 1239

Quoted 3 lines
include/linux/rtsx_pci.h +3 -0
+#define ASPM_MODE_CFG		0x01
+#define ASPM_MODE_REG		0x02
+	u8				aspm_mode;

Why not use an enum?

It is ok, we can have a V2 to use enum

Quoted 4 lines

thanks,

greg k-h
------Please consider the environment before printing this e-mail.

maintainer
#3 lore raw
Quoted 14 lines · Ricky WU
Quoted 14 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Friday, June 4, 2021 10:48 PM
To: Ricky WU
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG

Quoted 2 lines · On Fri, Jun 04, 2021 at 10:42:11PM +0800, [email protected] wrote:

From: Ricky Wu <[email protected]>

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

Divide Realtek Card Reader Group into two different modes
ASPM_MODE_CFG: 8411 5209 5227 5229 5249 5250 Change back to use original way to control aspm

What is "aspm"?

Active State Power Management (ASPM)

Great, please spell it out in the changelog text when you resubmit this.

Quoted 2 lines

rtsx_comm_set_aspm: ASPM control function for our driver
to make sure not enter power saving in process of init and card_detcct

Ok, can you please say all of this in the changelog text?

Quoted 8 lines
Quoted 6 lines

include/linux/rtsx_pci.h struct rtsx_pcr { · line 1239

Quoted 3 lines
include/linux/rtsx_pci.h +3 -0
+#define ASPM_MODE_CFG		0x01
+#define ASPM_MODE_REG		0x02
+	u8				aspm_mode;

Why not use an enum?

It is ok, we can have a V2 to use enum

Please do so.

thanks,

greg k-h