Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: rtsx: add to support new card reader rts5264

in order to support rts5264 in rtsx_pcr add the id in and
determine whether the device is rts5264 to call rts5264
functions and do rts5264 workflows or set rts5264 registers

Signed-off-by: Ricky Wu <ricky_wu@realtek.com>
Link: https://lore.kernel.org/r/20231208032145.2143580-3-ricky_wu@realtek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ricky Wu and committed by
Greg Kroah-Hartman
6a511c9b c27dfca4

+26 -5
+25 -5
drivers/misc/cardreader/rtsx_pcr.c
··· 26 26 #include "rtsx_pcr.h" 27 27 #include "rts5261.h" 28 28 #include "rts5228.h" 29 + #include "rts5264.h" 29 30 30 31 static bool msi_en = true; 31 32 module_param(msi_en, bool, S_IRUGO | S_IWUSR); ··· 55 54 { PCI_DEVICE(0x10EC, 0x5260), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 56 55 { PCI_DEVICE(0x10EC, 0x5261), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 57 56 { PCI_DEVICE(0x10EC, 0x5228), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 57 + { PCI_DEVICE(0x10EC, 0x5264), PCI_CLASS_OTHERS << 16, 0xFF0000 }, 58 58 { 0, } 59 59 }; 60 60 ··· 716 714 if (PCI_PID(pcr) == PID_5228) 717 715 return rts5228_pci_switch_clock(pcr, card_clock, 718 716 ssc_depth, initial_mode, double_clk, vpclk); 717 + if (PCI_PID(pcr) == PID_5264) 718 + return rts5264_pci_switch_clock(pcr, card_clock, 719 + ssc_depth, initial_mode, double_clk, vpclk); 719 720 720 721 if (initial_mode) { 721 722 /* We use 250k(around) here, in initial stage */ ··· 992 987 993 988 int_reg &= (pcr->bier | 0x7FFFFF); 994 989 995 - if (int_reg & SD_OC_INT) 990 + if ((int_reg & SD_OC_INT) || 991 + ((int_reg & SD_OVP_INT) && (PCI_PID(pcr) == PID_5264))) 996 992 rtsx_pci_process_ocp_interrupt(pcr); 997 993 998 994 if (int_reg & SD_INT) { ··· 1165 1159 { 1166 1160 u16 val; 1167 1161 1168 - if ((PCI_PID(pcr) != PID_525A) && (PCI_PID(pcr) != PID_5260)) { 1162 + if ((PCI_PID(pcr) != PID_525A) && 1163 + (PCI_PID(pcr) != PID_5260) && 1164 + (PCI_PID(pcr) != PID_5264)) { 1169 1165 rtsx_pci_read_phy_register(pcr, 0x01, &val); 1170 1166 val |= 1<<9; 1171 1167 rtsx_pci_write_phy_register(pcr, 0x01, val); ··· 1183 1175 { 1184 1176 u16 val; 1185 1177 1186 - if ((PCI_PID(pcr) != PID_525A) && (PCI_PID(pcr) != PID_5260)) { 1178 + if ((PCI_PID(pcr) != PID_525A) && 1179 + (PCI_PID(pcr) != PID_5260) && 1180 + (PCI_PID(pcr) != PID_5264)) { 1187 1181 rtsx_pci_read_phy_register(pcr, 0x01, &val); 1188 1182 val &= ~(1<<9); 1189 1183 rtsx_pci_write_phy_register(pcr, 0x01, val); ··· 1236 1226 rtsx_pci_enable_bus_int(pcr); 1237 1227 1238 1228 /* Power on SSC */ 1239 - if (PCI_PID(pcr) == PID_5261) { 1229 + if ((PCI_PID(pcr) == PID_5261) || (PCI_PID(pcr) == PID_5264)) { 1240 1230 /* Gating real mcu clock */ 1241 1231 err = rtsx_pci_write_register(pcr, RTS5261_FW_CFG1, 1242 1232 RTS5261_MCU_CLOCK_GATING, 0); ··· 1280 1270 else if (PCI_PID(pcr) == PID_5228) 1281 1271 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL2, 0xFF, 1282 1272 RTS5228_SSC_DEPTH_2M); 1273 + else if (is_version(pcr, 0x5264, IC_VER_A)) 1274 + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL1, SSC_RSTB, 0); 1275 + else if (PCI_PID(pcr) == PID_5264) 1276 + rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL2, 0xFF, 1277 + RTS5264_SSC_DEPTH_2M); 1283 1278 else 1284 1279 rtsx_pci_add_cmd(pcr, WRITE_REG_CMD, SSC_CTL2, 0xFF, 0x12); 1285 1280 ··· 1320 1305 case PID_5260: 1321 1306 case PID_5261: 1322 1307 case PID_5228: 1308 + case PID_5264: 1323 1309 rtsx_pci_write_register(pcr, PM_CLK_FORCE_CTL, 1, 1); 1324 1310 break; 1325 1311 default: ··· 1419 1403 1420 1404 case 0x5228: 1421 1405 rts5228_init_params(pcr); 1406 + break; 1407 + 1408 + case 0x5264: 1409 + rts5264_init_params(pcr); 1422 1410 break; 1423 1411 } 1424 1412 ··· 1564 1544 pcr->pci = pcidev; 1565 1545 dev_set_drvdata(&pcidev->dev, handle); 1566 1546 1567 - if (CHK_PCI_PID(pcr, 0x525A)) 1547 + if ((CHK_PCI_PID(pcr, 0x525A)) || (CHK_PCI_PID(pcr, 0x5264))) 1568 1548 bar = 1; 1569 1549 len = pci_resource_len(pcidev, bar); 1570 1550 base = pci_resource_start(pcidev, bar);
+1
drivers/misc/cardreader/rtsx_pcr.h
··· 74 74 void rts5260_init_params(struct rtsx_pcr *pcr); 75 75 void rts5261_init_params(struct rtsx_pcr *pcr); 76 76 void rts5228_init_params(struct rtsx_pcr *pcr); 77 + void rts5264_init_params(struct rtsx_pcr *pcr); 77 78 78 79 static inline u8 map_sd_drive(int idx) 79 80 {