| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* Driver for Realtek PCI-Express card reader |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 6 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 7 | | - * Free Software Foundation; either version 2, or (at your option) any |
|---|
| 8 | | - * later version. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 11 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 13 | | - * General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 16 | | - * with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | 5 | * |
|---|
| 18 | 6 | * Author: |
|---|
| 19 | 7 | * Wei WANG <wei_wang@realsil.com.cn> |
|---|
| .. | .. |
|---|
| 30 | 18 | #define RTS522A_PM_CTRL3 0xFF7E |
|---|
| 31 | 19 | |
|---|
| 32 | 20 | #define RTS524A_PME_FORCE_CTL 0xFF78 |
|---|
| 21 | +#define REG_EFUSE_BYPASS 0x08 |
|---|
| 22 | +#define REG_EFUSE_POR 0x04 |
|---|
| 23 | +#define REG_EFUSE_POWER_MASK 0x03 |
|---|
| 24 | +#define REG_EFUSE_POWERON 0x03 |
|---|
| 25 | +#define REG_EFUSE_POWEROFF 0x00 |
|---|
| 26 | +#define RTS5250_CLK_CFG3 0xFF79 |
|---|
| 27 | +#define RTS525A_CFG_MEM_PD 0xF0 |
|---|
| 33 | 28 | #define RTS524A_PM_CTRL3 0xFF7E |
|---|
| 29 | +#define RTS525A_BIOS_CFG 0xFF2D |
|---|
| 30 | +#define RTS525A_LOAD_BIOS_FLAG 0x01 |
|---|
| 31 | +#define RTS525A_CLEAR_BIOS_FLAG 0x00 |
|---|
| 32 | + |
|---|
| 33 | +#define RTS525A_EFUSE_CTL 0xFC32 |
|---|
| 34 | +#define REG_EFUSE_ENABLE 0x80 |
|---|
| 35 | +#define REG_EFUSE_MODE 0x40 |
|---|
| 36 | +#define RTS525A_EFUSE_ADD 0xFC33 |
|---|
| 37 | +#define REG_EFUSE_ADD_MASK 0x3F |
|---|
| 38 | +#define RTS525A_EFUSE_DATA 0xFC35 |
|---|
| 34 | 39 | |
|---|
| 35 | 40 | #define LTR_ACTIVE_LATENCY_DEF 0x883C |
|---|
| 36 | 41 | #define LTR_IDLE_LATENCY_DEF 0x892C |
|---|
| .. | .. |
|---|
| 41 | 46 | #define LTR_L1OFF_SNOOZE_SSPWRGATE_5249_DEF 0xAC |
|---|
| 42 | 47 | #define LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF 0xF8 |
|---|
| 43 | 48 | #define CMD_TIMEOUT_DEF 100 |
|---|
| 44 | | -#define ASPM_MASK_NEG 0xFC |
|---|
| 45 | 49 | #define MASK_8_BIT_DEF 0xFF |
|---|
| 46 | 50 | |
|---|
| 47 | 51 | #define SSC_CLOCK_STABLE_WAIT 130 |
|---|
| 52 | + |
|---|
| 53 | +#define RTS524A_OCP_THD_800 0x04 |
|---|
| 54 | +#define RTS525A_OCP_THD_800 0x05 |
|---|
| 55 | +#define RTS522A_OCP_THD_800 0x06 |
|---|
| 56 | + |
|---|
| 48 | 57 | |
|---|
| 49 | 58 | int __rtsx_pci_write_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 val); |
|---|
| 50 | 59 | int __rtsx_pci_read_phy_register(struct rtsx_pcr *pcr, u8 addr, u16 *val); |
|---|
| .. | .. |
|---|
| 60 | 69 | void rts525a_init_params(struct rtsx_pcr *pcr); |
|---|
| 61 | 70 | void rtl8411b_init_params(struct rtsx_pcr *pcr); |
|---|
| 62 | 71 | void rts5260_init_params(struct rtsx_pcr *pcr); |
|---|
| 72 | +void rts5261_init_params(struct rtsx_pcr *pcr); |
|---|
| 73 | +void rts5228_init_params(struct rtsx_pcr *pcr); |
|---|
| 63 | 74 | |
|---|
| 64 | 75 | static inline u8 map_sd_drive(int idx) |
|---|
| 65 | 76 | { |
|---|
| .. | .. |
|---|
| 77 | 88 | #define rts5209_vendor_setting1_valid(reg) (!((reg) & 0x80)) |
|---|
| 78 | 89 | #define rts5209_vendor_setting2_valid(reg) ((reg) & 0x80) |
|---|
| 79 | 90 | |
|---|
| 91 | +#define rtsx_check_mmc_support(reg) ((reg) & 0x10) |
|---|
| 92 | +#define rtsx_reg_to_rtd3(reg) ((reg) & 0x02) |
|---|
| 80 | 93 | #define rtsx_reg_to_aspm(reg) (((reg) >> 28) & 0x03) |
|---|
| 81 | 94 | #define rtsx_reg_to_sd30_drive_sel_1v8(reg) (((reg) >> 26) & 0x03) |
|---|
| 82 | 95 | #define rtsx_reg_to_sd30_drive_sel_3v3(reg) (((reg) >> 5) & 0x03) |
|---|
| .. | .. |
|---|
| 107 | 120 | void rtsx_pci_enable_ocp(struct rtsx_pcr *pcr); |
|---|
| 108 | 121 | int rtsx_pci_get_ocpstat(struct rtsx_pcr *pcr, u8 *val); |
|---|
| 109 | 122 | void rtsx_pci_clear_ocpstat(struct rtsx_pcr *pcr); |
|---|
| 123 | +void rtsx_pci_enable_oobs_polling(struct rtsx_pcr *pcr); |
|---|
| 124 | +void rtsx_pci_disable_oobs_polling(struct rtsx_pcr *pcr); |
|---|
| 110 | 125 | int rtsx_sd_power_off_card3v3(struct rtsx_pcr *pcr); |
|---|
| 111 | 126 | int rtsx_ms_power_off_card3v3(struct rtsx_pcr *pcr); |
|---|
| 112 | 127 | |
|---|