Skip to content

Commit 101bd90

Browse files
Ricky WUgregkh
authored andcommitted
misc: rtsx: judge ASPM Mode to set PETXCFG Reg
ASPM Mode is ASPM_MODE_CFG need to judge the value of clkreq_0 to set HIGH or LOW, if the ASPM Mode is ASPM_MODE_REG always set to HIGH during the initialization. Cc: [email protected] Signed-off-by: Ricky Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent adb9743 commit 101bd90

File tree

6 files changed

+6
-58
lines changed

6 files changed

+6
-58
lines changed

drivers/misc/cardreader/rts5227.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static int rts5227_extra_init_hw(struct rtsx_pcr *pcr)
195195
}
196196
}
197197

198-
if (option->force_clkreq_0)
198+
if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
199199
rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, PETXCFG,
200200
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
201201
else

drivers/misc/cardreader/rts5228.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -435,17 +435,10 @@ static void rts5228_init_from_cfg(struct rtsx_pcr *pcr)
435435
option->ltr_enabled = false;
436436
}
437437
}
438-
439-
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
440-
| PM_L1_1_EN | PM_L1_2_EN))
441-
option->force_clkreq_0 = false;
442-
else
443-
option->force_clkreq_0 = true;
444438
}
445439

446440
static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
447441
{
448-
struct rtsx_cr_option *option = &pcr->option;
449442

450443
rtsx_pci_write_register(pcr, RTS5228_AUTOLOAD_CFG1,
451444
CD_RESUME_EN_MASK, CD_RESUME_EN_MASK);
@@ -476,17 +469,6 @@ static int rts5228_extra_init_hw(struct rtsx_pcr *pcr)
476469
else
477470
rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
478471

479-
/*
480-
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
481-
* to drive low, and we forcibly request clock.
482-
*/
483-
if (option->force_clkreq_0)
484-
rtsx_pci_write_register(pcr, PETXCFG,
485-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
486-
else
487-
rtsx_pci_write_register(pcr, PETXCFG,
488-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
489-
490472
rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
491473

492474
if (pcr->rtd3_en) {

drivers/misc/cardreader/rts5249.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,11 @@ static int rts5249_extra_init_hw(struct rtsx_pcr *pcr)
327327
}
328328
}
329329

330-
331330
/*
332331
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
333332
* to drive low, and we forcibly request clock.
334333
*/
335-
if (option->force_clkreq_0)
334+
if (option->force_clkreq_0 && pcr->aspm_mode == ASPM_MODE_CFG)
336335
rtsx_pci_write_register(pcr, PETXCFG,
337336
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
338337
else

drivers/misc/cardreader/rts5260.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -517,17 +517,10 @@ static void rts5260_init_from_cfg(struct rtsx_pcr *pcr)
517517
option->ltr_enabled = false;
518518
}
519519
}
520-
521-
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
522-
| PM_L1_1_EN | PM_L1_2_EN))
523-
option->force_clkreq_0 = false;
524-
else
525-
option->force_clkreq_0 = true;
526520
}
527521

528522
static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
529523
{
530-
struct rtsx_cr_option *option = &pcr->option;
531524

532525
/* Set mcu_cnt to 7 to ensure data can be sampled properly */
533526
rtsx_pci_write_register(pcr, 0xFC03, 0x7F, 0x07);
@@ -546,17 +539,6 @@ static int rts5260_extra_init_hw(struct rtsx_pcr *pcr)
546539

547540
rts5260_init_hw(pcr);
548541

549-
/*
550-
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
551-
* to drive low, and we forcibly request clock.
552-
*/
553-
if (option->force_clkreq_0)
554-
rtsx_pci_write_register(pcr, PETXCFG,
555-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
556-
else
557-
rtsx_pci_write_register(pcr, PETXCFG,
558-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
559-
560542
rtsx_pci_write_register(pcr, pcr->reg_pm_ctrl3, 0x10, 0x00);
561543

562544
return 0;

drivers/misc/cardreader/rts5261.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,10 @@ static void rts5261_init_from_cfg(struct rtsx_pcr *pcr)
498498
option->ltr_enabled = false;
499499
}
500500
}
501-
502-
if (rtsx_check_dev_flag(pcr, ASPM_L1_1_EN | ASPM_L1_2_EN
503-
| PM_L1_1_EN | PM_L1_2_EN))
504-
option->force_clkreq_0 = false;
505-
else
506-
option->force_clkreq_0 = true;
507501
}
508502

509503
static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
510504
{
511-
struct rtsx_cr_option *option = &pcr->option;
512505
u32 val;
513506

514507
rtsx_pci_write_register(pcr, RTS5261_AUTOLOAD_CFG1,
@@ -554,17 +547,6 @@ static int rts5261_extra_init_hw(struct rtsx_pcr *pcr)
554547
else
555548
rtsx_pci_write_register(pcr, PETXCFG, 0x30, 0x00);
556549

557-
/*
558-
* If u_force_clkreq_0 is enabled, CLKREQ# PIN will be forced
559-
* to drive low, and we forcibly request clock.
560-
*/
561-
if (option->force_clkreq_0)
562-
rtsx_pci_write_register(pcr, PETXCFG,
563-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_LOW);
564-
else
565-
rtsx_pci_write_register(pcr, PETXCFG,
566-
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
567-
568550
rtsx_pci_write_register(pcr, PWD_SUSPEND_EN, 0xFF, 0xFB);
569551

570552
if (pcr->rtd3_en) {

drivers/misc/cardreader/rtsx_pcr.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,8 +1326,11 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
13261326
return err;
13271327
}
13281328

1329-
if (pcr->aspm_mode == ASPM_MODE_REG)
1329+
if (pcr->aspm_mode == ASPM_MODE_REG) {
13301330
rtsx_pci_write_register(pcr, ASPM_FORCE_CTL, 0x30, 0x30);
1331+
rtsx_pci_write_register(pcr, PETXCFG,
1332+
FORCE_CLKREQ_DELINK_MASK, FORCE_CLKREQ_HIGH);
1333+
}
13311334

13321335
/* No CD interrupt if probing driver with card inserted.
13331336
* So we need to initialize pcr->card_exist here.

0 commit comments

Comments
 (0)