drivers/misc/cardreader/rts5264.c
Source file repositories/reference/linux-study-clean/drivers/misc/cardreader/rts5264.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/cardreader/rts5264.c- Extension
.c- Size
- 29779 bytes
- Lines
- 973
- Domain
- Driver Families
- Bucket
- drivers/misc
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/delay.hlinux/rtsx_pci.hrts5264.hrtsx_pcr.h
Detected Declarations
function Copyrightfunction rts5264_fill_drivingfunction rts5264_force_power_downfunction rts5264_enable_auto_blinkfunction rts5264_disable_auto_blinkfunction rts5264_turn_on_ledfunction rts5264_turn_off_ledfunction rts5264_sd_set_sample_push_timing_sd30function rts5264_card_power_onfunction rts5264_switch_output_voltagefunction rts5264_stop_cmdfunction rts5264_card_before_power_offfunction rts5264_card_power_offfunction rts5264_enable_ocpfunction rts5264_disable_ocpfunction rts5264_init_ocpfunction rts5264_get_ocpstat2function rts5264_get_ovpstatfunction rts5264_clear_ocpstatfunction rts5264_process_ocpfunction rts5264_init_from_hwfunction rts5264_init_from_cfgfunction rts5264_extra_init_hwfunction rts5264_optimize_phyfunction rts5264_enable_aspmfunction rts5264_disable_aspmfunction rts5264_set_aspmfunction rts5264_set_l1off_cfg_sub_d0function double_ssc_depthfunction rts5264_pci_switch_clockfunction rts5264_init_params
Annotated Snippet
if (efuse_len == 0) {
rtsx_pci_write_register(pcr, RTS5264_FW_CFG_INFO2, 0x0F, 0x0F);
rtsx_pci_write_register(pcr, 0xFF14, 0xFF, 0x79);
rtsx_pci_write_register(pcr, 0xFF15, 0xFF, 0xFF);
rtsx_pci_write_register(pcr, 0xFF16, 0xFF, 0x3D);
rtsx_pci_write_register(pcr, 0xFF17, 0xFF, 0xFE);
rtsx_pci_write_register(pcr, 0xFF18, 0xFF, 0x5B);
rtsx_pci_write_register(pcr, 0xFF19, 0xFF, 0xFF);
rtsx_pci_write_register(pcr, 0xFF1A, 0xFF, 0x3E);
rtsx_pci_write_register(pcr, 0xFF1B, 0xFF, 0xFE);
rtsx_pci_write_register(pcr, 0xFF1C, 0xFF, 0x00);
rtsx_pci_write_register(pcr, 0xFF1D, 0xFF, 0xFF);
rtsx_pci_write_register(pcr, 0xFF1E, 0xFF, 0x3F);
rtsx_pci_write_register(pcr, 0xFF1F, 0xFF, 0xFE);
rtsx_pci_write_register(pcr, 0xFF20, 0xFF, 0x81);
rtsx_pci_write_register(pcr, 0xFF21, 0xFF, 0xFF);
rtsx_pci_write_register(pcr, 0xFF22, 0xFF, 0x3C);
rtsx_pci_write_register(pcr, 0xFF23, 0xFF, 0xFE);
}
rtsx_pci_write_register(pcr, 0xFF24, 0xFF, 0x79);
rtsx_pci_write_register(pcr, 0xFF25, 0xFF, 0x5B);
rtsx_pci_write_register(pcr, 0xFF26, 0xFF, 0x00);
rtsx_pci_write_register(pcr, 0xFF27, 0xFF, 0x40);
rtsx_pci_write_register(pcr, 0xFF28, 0xFF, (u8)phy_val);
rtsx_pci_write_register(pcr, 0xFF29, 0xFF, (u8)(phy_val >> 8));
rtsx_pci_write_register(pcr, 0xFF2A, 0xFF, 0x19);
rtsx_pci_write_register(pcr, 0xFF2B, 0xFF, 0x40);
rtsx_pci_write_register(pcr, 0xFF2C, 0xFF, 0x20);
rtsx_pci_write_register(pcr, 0xFF2D, 0xFF, 0xDA);
rtsx_pci_write_register(pcr, 0xFF2E, 0xFF, 0x0A);
rtsx_pci_write_register(pcr, 0xFF2F, 0xFF, 0x40);
rtsx_pci_write_register(pcr, 0xFF30, 0xFF, 0x20);
rtsx_pci_write_register(pcr, 0xFF31, 0xFF, 0xD2);
rtsx_pci_write_register(pcr, 0xFF32, 0xFF, 0x0A);
rtsx_pci_write_register(pcr, 0xFF33, 0xFF, 0x40);
} else {
rtsx_pci_write_register(pcr, AUTOLOAD_CFG_BASE, 0x80, 0x80);
}
if (efuse_valid == 2 || efuse_valid == 3) {
if (valid == 3) {
/* Bypass efuse */
setting_reg1 = PCR_SETTING_REG1;
setting_reg2 = PCR_SETTING_REG2;
} else {
/* Use efuse data */
setting_reg1 = PCR_SETTING_REG4;
setting_reg2 = PCR_SETTING_REG5;
}
} else if (efuse_valid == 0) {
// default
setting_reg1 = PCR_SETTING_REG1;
setting_reg2 = PCR_SETTING_REG2;
} else {
return;
}
pci_read_config_dword(pdev, setting_reg2, &lval2);
pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", setting_reg2, lval2);
if (!rts5264_vendor_setting_valid(lval2)) {
pcr_dbg(pcr, "skip fetch vendor setting\n");
return;
}
pcr->rtd3_en = rts5264_reg_to_rtd3(lval2);
if (rts5264_reg_check_reverse_socket(lval2)) {
if (is_version_higher_than(pcr, PID_5264, RTS5264_IC_VER_B))
pcr->option.sd_cd_reverse_en = 1;
else
pcr->flags |= PCR_REVERSE_SOCKET;
}
if (rts5264_reg_check_wp_reverse(lval2) &&
is_version_higher_than(pcr, PID_5264, RTS5264_IC_VER_B))
pcr->option.sd_wp_reverse_en = 1;
pci_read_config_dword(pdev, setting_reg1, &lval1);
pcr_dbg(pcr, "Cfg 0x%x: 0x%x\n", setting_reg1, lval1);
pcr->aspm_en = rts5264_reg_to_aspm(lval1);
pcr->sd30_drive_sel_1v8 = rts5264_reg_to_sd30_drive_sel_1v8(lval1);
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/rtsx_pci.h`, `rts5264.h`, `rtsx_pcr.h`.
- Detected declarations: `function Copyright`, `function rts5264_fill_driving`, `function rts5264_force_power_down`, `function rts5264_enable_auto_blink`, `function rts5264_disable_auto_blink`, `function rts5264_turn_on_led`, `function rts5264_turn_off_led`, `function rts5264_sd_set_sample_push_timing_sd30`, `function rts5264_card_power_on`, `function rts5264_switch_output_voltage`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.