aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/crc-ccitt.h7
-rw-r--r--include/linux/mfd/axp20x.h5
-rw-r--r--include/linux/mfd/cros_ec.h4
-rw-r--r--include/linux/mfd/cros_ec_commands.h17
-rw-r--r--include/linux/mfd/rave-sp.h60
-rw-r--r--include/linux/rtsx_common.h (renamed from include/linux/mfd/rtsx_common.h)0
-rw-r--r--include/linux/rtsx_pci.h (renamed from include/linux/mfd/rtsx_pci.h)236
-rw-r--r--include/linux/rtsx_usb.h (renamed from include/linux/mfd/rtsx_usb.h)0
-rw-r--r--include/linux/serdev.h1
9 files changed, 320 insertions, 10 deletions
diff --git a/include/linux/crc-ccitt.h b/include/linux/crc-ccitt.h
index cd4f420231ba..72c92c396bb8 100644
--- a/include/linux/crc-ccitt.h
+++ b/include/linux/crc-ccitt.h
@@ -5,12 +5,19 @@
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7extern u16 const crc_ccitt_table[256]; 7extern u16 const crc_ccitt_table[256];
8extern u16 const crc_ccitt_false_table[256];
8 9
9extern u16 crc_ccitt(u16 crc, const u8 *buffer, size_t len); 10extern u16 crc_ccitt(u16 crc, const u8 *buffer, size_t len);
11extern u16 crc_ccitt_false(u16 crc, const u8 *buffer, size_t len);
10 12
11static inline u16 crc_ccitt_byte(u16 crc, const u8 c) 13static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
12{ 14{
13 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; 15 return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
14} 16}
15 17
18static inline u16 crc_ccitt_false_byte(u16 crc, const u8 c)
19{
20 return (crc << 8) ^ crc_ccitt_false_table[(crc >> 8) ^ c];
21}
22
16#endif /* _LINUX_CRC_CCITT_H */ 23#endif /* _LINUX_CRC_CCITT_H */
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 78dc85365c4f..080798f17ece 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -645,11 +645,6 @@ struct axp20x_dev {
645 const struct regmap_irq_chip *regmap_irq_chip; 645 const struct regmap_irq_chip *regmap_irq_chip;
646}; 646};
647 647
648struct axp288_extcon_pdata {
649 /* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
650 struct gpio_desc *gpio_mux_cntl;
651};
652
653/* generic helper function for reading 9-16 bit wide regs */ 648/* generic helper function for reading 9-16 bit wide regs */
654static inline int axp20x_read_variable_width(struct regmap *regmap, 649static inline int axp20x_read_variable_width(struct regmap *regmap,
655 unsigned int reg, unsigned int width) 650 unsigned int reg, unsigned int width)
diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h
index 4e887ba22635..c61535979b8f 100644
--- a/include/linux/mfd/cros_ec.h
+++ b/include/linux/mfd/cros_ec.h
@@ -322,6 +322,10 @@ extern struct attribute_group cros_ec_attr_group;
322extern struct attribute_group cros_ec_lightbar_attr_group; 322extern struct attribute_group cros_ec_lightbar_attr_group;
323extern struct attribute_group cros_ec_vbc_attr_group; 323extern struct attribute_group cros_ec_vbc_attr_group;
324 324
325/* debugfs stuff */
326int cros_ec_debugfs_init(struct cros_ec_dev *ec);
327void cros_ec_debugfs_remove(struct cros_ec_dev *ec);
328
325/* ACPI GPE handler */ 329/* ACPI GPE handler */
326#ifdef CONFIG_ACPI 330#ifdef CONFIG_ACPI
327 331
diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 2b16e95b9bb8..a83f6498b95e 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -2904,16 +2904,33 @@ enum usb_pd_control_mux {
2904 USB_PD_CTRL_MUX_AUTO = 5, 2904 USB_PD_CTRL_MUX_AUTO = 5,
2905}; 2905};
2906 2906
2907enum usb_pd_control_swap {
2908 USB_PD_CTRL_SWAP_NONE = 0,
2909 USB_PD_CTRL_SWAP_DATA = 1,
2910 USB_PD_CTRL_SWAP_POWER = 2,
2911 USB_PD_CTRL_SWAP_VCONN = 3,
2912 USB_PD_CTRL_SWAP_COUNT
2913};
2914
2907struct ec_params_usb_pd_control { 2915struct ec_params_usb_pd_control {
2908 uint8_t port; 2916 uint8_t port;
2909 uint8_t role; 2917 uint8_t role;
2910 uint8_t mux; 2918 uint8_t mux;
2919 uint8_t swap;
2911} __packed; 2920} __packed;
2912 2921
2913#define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ 2922#define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */
2914#define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ 2923#define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */
2915#define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */ 2924#define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */
2916 2925
2926#define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */
2927#define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */
2928#define PD_CTRL_RESP_ROLE_VCONN BIT(2) /* Vconn status */
2929#define PD_CTRL_RESP_ROLE_DR_POWER BIT(3) /* Partner is dualrole power */
2930#define PD_CTRL_RESP_ROLE_DR_DATA BIT(4) /* Partner is dualrole data */
2931#define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */
2932#define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */
2933
2917struct ec_response_usb_pd_control_v1 { 2934struct ec_response_usb_pd_control_v1 {
2918 uint8_t enabled; 2935 uint8_t enabled;
2919 uint8_t role; 2936 uint8_t role;
diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h
new file mode 100644
index 000000000000..796fb9794c9e
--- /dev/null
+++ b/include/linux/mfd/rave-sp.h
@@ -0,0 +1,60 @@
1/* SPDX-License-Identifier: GPL-2.0+ */
2
3/*
4 * Core definitions for RAVE SP MFD driver.
5 *
6 * Copyright (C) 2017 Zodiac Inflight Innovations
7 */
8
9#ifndef _LINUX_RAVE_SP_H_
10#define _LINUX_RAVE_SP_H_
11
12#include <linux/notifier.h>
13
14enum rave_sp_command {
15 RAVE_SP_CMD_GET_FIRMWARE_VERSION = 0x20,
16 RAVE_SP_CMD_GET_BOOTLOADER_VERSION = 0x21,
17 RAVE_SP_CMD_BOOT_SOURCE = 0x26,
18 RAVE_SP_CMD_GET_BOARD_COPPER_REV = 0x2B,
19 RAVE_SP_CMD_GET_GPIO_STATE = 0x2F,
20
21 RAVE_SP_CMD_STATUS = 0xA0,
22 RAVE_SP_CMD_SW_WDT = 0xA1,
23 RAVE_SP_CMD_PET_WDT = 0xA2,
24 RAVE_SP_CMD_RESET = 0xA7,
25 RAVE_SP_CMD_RESET_REASON = 0xA8,
26
27 RAVE_SP_CMD_REQ_COPPER_REV = 0xB6,
28 RAVE_SP_CMD_GET_I2C_DEVICE_STATUS = 0xBA,
29 RAVE_SP_CMD_GET_SP_SILICON_REV = 0xB9,
30 RAVE_SP_CMD_CONTROL_EVENTS = 0xBB,
31
32 RAVE_SP_EVNT_BASE = 0xE0,
33};
34
35struct rave_sp;
36
37static inline unsigned long rave_sp_action_pack(u8 event, u8 value)
38{
39 return ((unsigned long)value << 8) | event;
40}
41
42static inline u8 rave_sp_action_unpack_event(unsigned long action)
43{
44 return action;
45}
46
47static inline u8 rave_sp_action_unpack_value(unsigned long action)
48{
49 return action >> 8;
50}
51
52int rave_sp_exec(struct rave_sp *sp,
53 void *__data, size_t data_size,
54 void *reply_data, size_t reply_data_size);
55
56struct device;
57int devm_rave_sp_register_event_notifier(struct device *dev,
58 struct notifier_block *nb);
59
60#endif /* _LINUX_RAVE_SP_H_ */
diff --git a/include/linux/mfd/rtsx_common.h b/include/linux/rtsx_common.h
index 443176ee1ab0..443176ee1ab0 100644
--- a/include/linux/mfd/rtsx_common.h
+++ b/include/linux/rtsx_common.h
diff --git a/include/linux/mfd/rtsx_pci.h b/include/linux/rtsx_pci.h
index a2a1318a3d0c..a44670e1c537 100644
--- a/include/linux/mfd/rtsx_pci.h
+++ b/include/linux/rtsx_pci.h
@@ -24,7 +24,7 @@
24 24
25#include <linux/sched.h> 25#include <linux/sched.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/mfd/rtsx_common.h> 27#include <linux/rtsx_common.h>
28 28
29#define MAX_RW_REG_CNT 1024 29#define MAX_RW_REG_CNT 1024
30 30
@@ -203,6 +203,7 @@
203#define SD_DDR_MODE 0x04 203#define SD_DDR_MODE 0x04
204#define SD_30_MODE 0x08 204#define SD_30_MODE 0x08
205#define SD_CLK_DIVIDE_MASK 0xC0 205#define SD_CLK_DIVIDE_MASK 0xC0
206#define SD_MODE_SELECT_MASK 0x0C
206#define SD_CFG2 0xFDA1 207#define SD_CFG2 0xFDA1
207#define SD_CALCULATE_CRC7 0x00 208#define SD_CALCULATE_CRC7 0x00
208#define SD_NO_CALCULATE_CRC7 0x80 209#define SD_NO_CALCULATE_CRC7 0x80
@@ -226,6 +227,7 @@
226#define SD_RSP_TYPE_R6 0x01 227#define SD_RSP_TYPE_R6 0x01
227#define SD_RSP_TYPE_R7 0x01 228#define SD_RSP_TYPE_R7 0x01
228#define SD_CFG3 0xFDA2 229#define SD_CFG3 0xFDA2
230#define SD30_CLK_END_EN 0x10
229#define SD_RSP_80CLK_TIMEOUT_EN 0x01 231#define SD_RSP_80CLK_TIMEOUT_EN 0x01
230 232
231#define SD_STAT1 0xFDA3 233#define SD_STAT1 0xFDA3
@@ -309,6 +311,12 @@
309 311
310#define SD_DATA_STATE 0xFDB6 312#define SD_DATA_STATE 0xFDB6
311#define SD_DATA_IDLE 0x80 313#define SD_DATA_IDLE 0x80
314#define REG_SD_STOP_SDCLK_CFG 0xFDB8
315#define SD30_CLK_STOP_CFG_EN 0x04
316#define SD30_CLK_STOP_CFG1 0x02
317#define SD30_CLK_STOP_CFG0 0x01
318#define REG_PRE_RW_MODE 0xFD70
319#define EN_INFINITE_MODE 0x01
312 320
313#define SRCTL 0xFC13 321#define SRCTL 0xFC13
314 322
@@ -434,6 +442,7 @@
434#define CARD_CLK_EN 0xFD69 442#define CARD_CLK_EN 0xFD69
435#define SD_CLK_EN 0x04 443#define SD_CLK_EN 0x04
436#define MS_CLK_EN 0x08 444#define MS_CLK_EN 0x08
445#define SD40_CLK_EN 0x10
437#define SDIO_CTRL 0xFD6B 446#define SDIO_CTRL 0xFD6B
438#define CD_PAD_CTL 0xFD73 447#define CD_PAD_CTL 0xFD73
439#define CD_DISABLE_MASK 0x07 448#define CD_DISABLE_MASK 0x07
@@ -453,8 +462,8 @@
453#define FPDCTL 0xFC00 462#define FPDCTL 0xFC00
454#define SSC_POWER_DOWN 0x01 463#define SSC_POWER_DOWN 0x01
455#define SD_OC_POWER_DOWN 0x02 464#define SD_OC_POWER_DOWN 0x02
456#define ALL_POWER_DOWN 0x07 465#define ALL_POWER_DOWN 0x03
457#define OC_POWER_DOWN 0x06 466#define OC_POWER_DOWN 0x02
458#define PDINFO 0xFC01 467#define PDINFO 0xFC01
459 468
460#define CLK_CTL 0xFC02 469#define CLK_CTL 0xFC02
@@ -490,6 +499,9 @@
490 499
491#define FPGA_PULL_CTL 0xFC1D 500#define FPGA_PULL_CTL 0xFC1D
492#define OLT_LED_CTL 0xFC1E 501#define OLT_LED_CTL 0xFC1E
502#define LED_SHINE_MASK 0x08
503#define LED_SHINE_EN 0x08
504#define LED_SHINE_DISABLE 0x00
493#define GPIO_CTL 0xFC1F 505#define GPIO_CTL 0xFC1F
494 506
495#define LDO_CTL 0xFC1E 507#define LDO_CTL 0xFC1E
@@ -511,7 +523,11 @@
511#define BPP_LDO_ON 0x00 523#define BPP_LDO_ON 0x00
512#define BPP_LDO_SUSPEND 0x02 524#define BPP_LDO_SUSPEND 0x02
513#define BPP_LDO_OFF 0x03 525#define BPP_LDO_OFF 0x03
526#define EFUSE_CTL 0xFC30
527#define EFUSE_ADD 0xFC31
514#define SYS_VER 0xFC32 528#define SYS_VER 0xFC32
529#define EFUSE_DATAL 0xFC34
530#define EFUSE_DATAH 0xFC35
515 531
516#define CARD_PULL_CTL1 0xFD60 532#define CARD_PULL_CTL1 0xFD60
517#define CARD_PULL_CTL2 0xFD61 533#define CARD_PULL_CTL2 0xFD61
@@ -553,6 +569,9 @@
553#define RBBC1 0xFE2F 569#define RBBC1 0xFE2F
554#define RBDAT 0xFE30 570#define RBDAT 0xFE30
555#define RBCTL 0xFE34 571#define RBCTL 0xFE34
572#define U_AUTO_DMA_EN_MASK 0x20
573#define U_AUTO_DMA_DISABLE 0x00
574#define RB_FLUSH 0x80
556#define CFGADDR0 0xFE35 575#define CFGADDR0 0xFE35
557#define CFGADDR1 0xFE36 576#define CFGADDR1 0xFE36
558#define CFGDATA0 0xFE37 577#define CFGDATA0 0xFE37
@@ -581,6 +600,8 @@
581#define LTR_LATENCY_MODE_HW 0 600#define LTR_LATENCY_MODE_HW 0
582#define LTR_LATENCY_MODE_SW BIT(6) 601#define LTR_LATENCY_MODE_SW BIT(6)
583#define OBFF_CFG 0xFE4C 602#define OBFF_CFG 0xFE4C
603#define OBFF_EN_MASK 0x03
604#define OBFF_DISABLE 0x00
584 605
585#define CDRESUMECTL 0xFE52 606#define CDRESUMECTL 0xFE52
586#define WAKE_SEL_CTL 0xFE54 607#define WAKE_SEL_CTL 0xFE54
@@ -595,6 +616,7 @@
595#define FORCE_ASPM_L0_EN 0x01 616#define FORCE_ASPM_L0_EN 0x01
596#define FORCE_ASPM_NO_ASPM 0x00 617#define FORCE_ASPM_NO_ASPM 0x00
597#define PM_CLK_FORCE_CTL 0xFE58 618#define PM_CLK_FORCE_CTL 0xFE58
619#define CLK_PM_EN 0x01
598#define FUNC_FORCE_CTL 0xFE59 620#define FUNC_FORCE_CTL 0xFE59
599#define FUNC_FORCE_UPME_XMT_DBG 0x02 621#define FUNC_FORCE_UPME_XMT_DBG 0x02
600#define PERST_GLITCH_WIDTH 0xFE5C 622#define PERST_GLITCH_WIDTH 0xFE5C
@@ -620,14 +642,23 @@
620#define LDO_PWR_SEL 0xFE78 642#define LDO_PWR_SEL 0xFE78
621 643
622#define L1SUB_CONFIG1 0xFE8D 644#define L1SUB_CONFIG1 0xFE8D
645#define AUX_CLK_ACTIVE_SEL_MASK 0x01
646#define MAC_CKSW_DONE 0x00
623#define L1SUB_CONFIG2 0xFE8E 647#define L1SUB_CONFIG2 0xFE8E
624#define L1SUB_AUTO_CFG 0x02 648#define L1SUB_AUTO_CFG 0x02
625#define L1SUB_CONFIG3 0xFE8F 649#define L1SUB_CONFIG3 0xFE8F
626#define L1OFF_MBIAS2_EN_5250 BIT(7) 650#define L1OFF_MBIAS2_EN_5250 BIT(7)
627 651
628#define DUMMY_REG_RESET_0 0xFE90 652#define DUMMY_REG_RESET_0 0xFE90
653#define IC_VERSION_MASK 0x0F
629 654
655#define REG_VREF 0xFE97
656#define PWD_SUSPND_EN 0x10
657#define RTS5260_DMA_RST_CTL_0 0xFEBF
658#define RTS5260_DMA_RST 0x80
659#define RTS5260_ADMA3_RST 0x40
630#define AUTOLOAD_CFG_BASE 0xFF00 660#define AUTOLOAD_CFG_BASE 0xFF00
661#define RELINK_TIME_MASK 0x01
631#define PETXCFG 0xFF03 662#define PETXCFG 0xFF03
632#define FORCE_CLKREQ_DELINK_MASK BIT(7) 663#define FORCE_CLKREQ_DELINK_MASK BIT(7)
633#define FORCE_CLKREQ_LOW 0x80 664#define FORCE_CLKREQ_LOW 0x80
@@ -667,15 +698,24 @@
667#define LDO_DV18_CFG 0xFF70 698#define LDO_DV18_CFG 0xFF70
668#define LDO_DV18_SR_MASK 0xC0 699#define LDO_DV18_SR_MASK 0xC0
669#define LDO_DV18_SR_DF 0x40 700#define LDO_DV18_SR_DF 0x40
701#define DV331812_MASK 0x70
702#define DV331812_33 0x70
703#define DV331812_17 0x30
670 704
671#define LDO_CONFIG2 0xFF71 705#define LDO_CONFIG2 0xFF71
672#define LDO_D3318_MASK 0x07 706#define LDO_D3318_MASK 0x07
673#define LDO_D3318_33V 0x07 707#define LDO_D3318_33V 0x07
674#define LDO_D3318_18V 0x02 708#define LDO_D3318_18V 0x02
709#define DV331812_VDD1 0x04
710#define DV331812_POWERON 0x08
711#define DV331812_POWEROFF 0x00
675 712
676#define LDO_VCC_CFG0 0xFF72 713#define LDO_VCC_CFG0 0xFF72
677#define LDO_VCC_LMTVTH_MASK 0x30 714#define LDO_VCC_LMTVTH_MASK 0x30
678#define LDO_VCC_LMTVTH_2A 0x10 715#define LDO_VCC_LMTVTH_2A 0x10
716/*RTS5260*/
717#define RTS5260_DVCC_TUNE_MASK 0x70
718#define RTS5260_DVCC_33 0x70
679 719
680#define LDO_VCC_CFG1 0xFF73 720#define LDO_VCC_CFG1 0xFF73
681#define LDO_VCC_REF_TUNE_MASK 0x30 721#define LDO_VCC_REF_TUNE_MASK 0x30
@@ -684,6 +724,10 @@
684#define LDO_VCC_1V8 0x04 724#define LDO_VCC_1V8 0x04
685#define LDO_VCC_3V3 0x07 725#define LDO_VCC_3V3 0x07
686#define LDO_VCC_LMT_EN 0x08 726#define LDO_VCC_LMT_EN 0x08
727/*RTS5260*/
728#define LDO_POW_SDVDD1_MASK 0x08
729#define LDO_POW_SDVDD1_ON 0x08
730#define LDO_POW_SDVDD1_OFF 0x00
687 731
688#define LDO_VIO_CFG 0xFF75 732#define LDO_VIO_CFG 0xFF75
689#define LDO_VIO_SR_MASK 0xC0 733#define LDO_VIO_SR_MASK 0xC0
@@ -711,6 +755,160 @@
711#define SD_VIO_LDO_1V8 0x40 755#define SD_VIO_LDO_1V8 0x40
712#define SD_VIO_LDO_3V3 0x70 756#define SD_VIO_LDO_3V3 0x70
713 757
758#define RTS5260_AUTOLOAD_CFG4 0xFF7F
759#define RTS5260_MIMO_DISABLE 0x8A
760
761#define RTS5260_REG_GPIO_CTL0 0xFC1A
762#define RTS5260_REG_GPIO_MASK 0x01
763#define RTS5260_REG_GPIO_ON 0x01
764#define RTS5260_REG_GPIO_OFF 0x00
765
766#define PWR_GLOBAL_CTRL 0xF200
767#define PCIE_L1_2_EN 0x0C
768#define PCIE_L1_1_EN 0x0A
769#define PCIE_L1_0_EN 0x09
770#define PWR_FE_CTL 0xF201
771#define PCIE_L1_2_PD_FE_EN 0x0C
772#define PCIE_L1_1_PD_FE_EN 0x0A
773#define PCIE_L1_0_PD_FE_EN 0x09
774#define CFG_PCIE_APHY_OFF_0 0xF204
775#define CFG_PCIE_APHY_OFF_0_DEFAULT 0xBF
776#define CFG_PCIE_APHY_OFF_1 0xF205
777#define CFG_PCIE_APHY_OFF_1_DEFAULT 0xFF
778#define CFG_PCIE_APHY_OFF_2 0xF206
779#define CFG_PCIE_APHY_OFF_2_DEFAULT 0x01
780#define CFG_PCIE_APHY_OFF_3 0xF207
781#define CFG_PCIE_APHY_OFF_3_DEFAULT 0x00
782#define CFG_L1_0_PCIE_MAC_RET_VALUE 0xF20C
783#define CFG_L1_0_PCIE_DPHY_RET_VALUE 0xF20E
784#define CFG_L1_0_SYS_RET_VALUE 0xF210
785#define CFG_L1_0_CRC_MISC_RET_VALUE 0xF212
786#define CFG_L1_0_CRC_SD30_RET_VALUE 0xF214
787#define CFG_L1_0_CRC_SD40_RET_VALUE 0xF216
788#define CFG_LP_FPWM_VALUE 0xF219
789#define CFG_LP_FPWM_VALUE_DEFAULT 0x18
790#define PWC_CDR 0xF253
791#define PWC_CDR_DEFAULT 0x03
792#define CFG_L1_0_RET_VALUE_DEFAULT 0x1B
793#define CFG_L1_0_CRC_MISC_RET_VALUE_DEFAULT 0x0C
794
795/* OCPCTL */
796#define SD_DETECT_EN 0x08
797#define SD_OCP_INT_EN 0x04
798#define SD_OCP_INT_CLR 0x02
799#define SD_OC_CLR 0x01
800
801#define SDVIO_DETECT_EN (1 << 7)
802#define SDVIO_OCP_INT_EN (1 << 6)
803#define SDVIO_OCP_INT_CLR (1 << 5)
804#define SDVIO_OC_CLR (1 << 4)
805
806/* OCPSTAT */
807#define SD_OCP_DETECT 0x08
808#define SD_OC_NOW 0x04
809#define SD_OC_EVER 0x02
810
811#define SDVIO_OC_NOW (1 << 6)
812#define SDVIO_OC_EVER (1 << 5)
813
814#define REG_OCPCTL 0xFD6A
815#define REG_OCPSTAT 0xFD6E
816#define REG_OCPGLITCH 0xFD6C
817#define REG_OCPPARA1 0xFD6B
818#define REG_OCPPARA2 0xFD6D
819
820/* rts5260 DV3318 OCP-related registers */
821#define REG_DV3318_OCPCTL 0xFD89
822#define DV3318_OCP_TIME_MASK 0xF0
823#define DV3318_DETECT_EN 0x08
824#define DV3318_OCP_INT_EN 0x04
825#define DV3318_OCP_INT_CLR 0x02
826#define DV3318_OCP_CLR 0x01
827
828#define REG_DV3318_OCPSTAT 0xFD8A
829#define DV3318_OCP_GlITCH_TIME_MASK 0xF0
830#define DV3318_OCP_DETECT 0x08
831#define DV3318_OCP_NOW 0x04
832#define DV3318_OCP_EVER 0x02
833
834#define SD_OCP_GLITCH_MASK 0x0F
835
836/* OCPPARA1 */
837#define SDVIO_OCP_TIME_60 0x00
838#define SDVIO_OCP_TIME_100 0x10
839#define SDVIO_OCP_TIME_200 0x20
840#define SDVIO_OCP_TIME_400 0x30
841#define SDVIO_OCP_TIME_600 0x40
842#define SDVIO_OCP_TIME_800 0x50
843#define SDVIO_OCP_TIME_1100 0x60
844#define SDVIO_OCP_TIME_MASK 0x70
845
846#define SD_OCP_TIME_60 0x00
847#define SD_OCP_TIME_100 0x01
848#define SD_OCP_TIME_200 0x02
849#define SD_OCP_TIME_400 0x03
850#define SD_OCP_TIME_600 0x04
851#define SD_OCP_TIME_800 0x05
852#define SD_OCP_TIME_1100 0x06
853#define SD_OCP_TIME_MASK 0x07
854
855/* OCPPARA2 */
856#define SDVIO_OCP_THD_190 0x00
857#define SDVIO_OCP_THD_250 0x10
858#define SDVIO_OCP_THD_320 0x20
859#define SDVIO_OCP_THD_380 0x30
860#define SDVIO_OCP_THD_440 0x40
861#define SDVIO_OCP_THD_500 0x50
862#define SDVIO_OCP_THD_570 0x60
863#define SDVIO_OCP_THD_630 0x70
864#define SDVIO_OCP_THD_MASK 0x70
865
866#define SD_OCP_THD_450 0x00
867#define SD_OCP_THD_550 0x01
868#define SD_OCP_THD_650 0x02
869#define SD_OCP_THD_750 0x03
870#define SD_OCP_THD_850 0x04
871#define SD_OCP_THD_950 0x05
872#define SD_OCP_THD_1050 0x06
873#define SD_OCP_THD_1150 0x07
874#define SD_OCP_THD_MASK 0x07
875
876#define SDVIO_OCP_GLITCH_MASK 0xF0
877#define SDVIO_OCP_GLITCH_NONE 0x00
878#define SDVIO_OCP_GLITCH_50U 0x10
879#define SDVIO_OCP_GLITCH_100U 0x20
880#define SDVIO_OCP_GLITCH_200U 0x30
881#define SDVIO_OCP_GLITCH_600U 0x40
882#define SDVIO_OCP_GLITCH_800U 0x50
883#define SDVIO_OCP_GLITCH_1M 0x60
884#define SDVIO_OCP_GLITCH_2M 0x70
885#define SDVIO_OCP_GLITCH_3M 0x80
886#define SDVIO_OCP_GLITCH_4M 0x90
887#define SDVIO_OCP_GLIVCH_5M 0xA0
888#define SDVIO_OCP_GLITCH_6M 0xB0
889#define SDVIO_OCP_GLITCH_7M 0xC0
890#define SDVIO_OCP_GLITCH_8M 0xD0
891#define SDVIO_OCP_GLITCH_9M 0xE0
892#define SDVIO_OCP_GLITCH_10M 0xF0
893
894#define SD_OCP_GLITCH_MASK 0x0F
895#define SD_OCP_GLITCH_NONE 0x00
896#define SD_OCP_GLITCH_50U 0x01
897#define SD_OCP_GLITCH_100U 0x02
898#define SD_OCP_GLITCH_200U 0x03
899#define SD_OCP_GLITCH_600U 0x04
900#define SD_OCP_GLITCH_800U 0x05
901#define SD_OCP_GLITCH_1M 0x06
902#define SD_OCP_GLITCH_2M 0x07
903#define SD_OCP_GLITCH_3M 0x08
904#define SD_OCP_GLITCH_4M 0x09
905#define SD_OCP_GLIVCH_5M 0x0A
906#define SD_OCP_GLITCH_6M 0x0B
907#define SD_OCP_GLITCH_7M 0x0C
908#define SD_OCP_GLITCH_8M 0x0D
909#define SD_OCP_GLITCH_9M 0x0E
910#define SD_OCP_GLITCH_10M 0x0F
911
714/* Phy register */ 912/* Phy register */
715#define PHY_PCR 0x00 913#define PHY_PCR 0x00
716#define PHY_PCR_FORCE_CODE 0xB000 914#define PHY_PCR_FORCE_CODE 0xB000
@@ -857,6 +1055,7 @@
857 1055
858#define PCR_ASPM_SETTING_REG1 0x160 1056#define PCR_ASPM_SETTING_REG1 0x160
859#define PCR_ASPM_SETTING_REG2 0x168 1057#define PCR_ASPM_SETTING_REG2 0x168
1058#define PCR_ASPM_SETTING_5260 0x178
860 1059
861#define PCR_SETTING_REG1 0x724 1060#define PCR_SETTING_REG1 0x724
862#define PCR_SETTING_REG2 0x814 1061#define PCR_SETTING_REG2 0x814
@@ -890,6 +1089,7 @@ struct pcr_ops {
890 int (*conv_clk_and_div_n)(int clk, int dir); 1089 int (*conv_clk_and_div_n)(int clk, int dir);
891 void (*fetch_vendor_settings)(struct rtsx_pcr *pcr); 1090 void (*fetch_vendor_settings)(struct rtsx_pcr *pcr);
892 void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state); 1091 void (*force_power_down)(struct rtsx_pcr *pcr, u8 pm_state);
1092 void (*stop_cmd)(struct rtsx_pcr *pcr);
893 1093
894 void (*set_aspm)(struct rtsx_pcr *pcr, bool enable); 1094 void (*set_aspm)(struct rtsx_pcr *pcr, bool enable);
895 int (*set_ltr_latency)(struct rtsx_pcr *pcr, u32 latency); 1095 int (*set_ltr_latency)(struct rtsx_pcr *pcr, u32 latency);
@@ -897,6 +1097,12 @@ struct pcr_ops {
897 void (*set_l1off_cfg_sub_d0)(struct rtsx_pcr *pcr, int active); 1097 void (*set_l1off_cfg_sub_d0)(struct rtsx_pcr *pcr, int active);
898 void (*full_on)(struct rtsx_pcr *pcr); 1098 void (*full_on)(struct rtsx_pcr *pcr);
899 void (*power_saving)(struct rtsx_pcr *pcr); 1099 void (*power_saving)(struct rtsx_pcr *pcr);
1100 void (*enable_ocp)(struct rtsx_pcr *pcr);
1101 void (*disable_ocp)(struct rtsx_pcr *pcr);
1102 void (*init_ocp)(struct rtsx_pcr *pcr);
1103 void (*process_ocp)(struct rtsx_pcr *pcr);
1104 int (*get_ocpstat)(struct rtsx_pcr *pcr, u8 *val);
1105 void (*clear_ocpstat)(struct rtsx_pcr *pcr);
900}; 1106};
901 1107
902enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; 1108enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN};
@@ -935,6 +1141,9 @@ enum dev_aspm_mode {
935 * @l1_snooze_delay: l1 snooze delay 1141 * @l1_snooze_delay: l1 snooze delay
936 * @ltr_l1off_sspwrgate: ltr l1off sspwrgate 1142 * @ltr_l1off_sspwrgate: ltr l1off sspwrgate
937 * @ltr_l1off_snooze_sspwrgate: ltr l1off snooze sspwrgate 1143 * @ltr_l1off_snooze_sspwrgate: ltr l1off snooze sspwrgate
1144 * @ocp_en: enable ocp flag
1145 * @sd_400mA_ocp_thd: 400mA ocp thd
1146 * @sd_800mA_ocp_thd: 800mA ocp thd
938 */ 1147 */
939struct rtsx_cr_option { 1148struct rtsx_cr_option {
940 u32 dev_flags; 1149 u32 dev_flags;
@@ -949,6 +1158,19 @@ struct rtsx_cr_option {
949 u32 l1_snooze_delay; 1158 u32 l1_snooze_delay;
950 u8 ltr_l1off_sspwrgate; 1159 u8 ltr_l1off_sspwrgate;
951 u8 ltr_l1off_snooze_sspwrgate; 1160 u8 ltr_l1off_snooze_sspwrgate;
1161 bool ocp_en;
1162 u8 sd_400mA_ocp_thd;
1163 u8 sd_800mA_ocp_thd;
1164};
1165
1166/*
1167 * struct rtsx_hw_param - card reader hardware param
1168 * @interrupt_en: indicate which interrutp enable
1169 * @ocp_glitch: ocp glitch time
1170 */
1171struct rtsx_hw_param {
1172 u32 interrupt_en;
1173 u8 ocp_glitch;
952}; 1174};
953 1175
954#define rtsx_set_dev_flag(cr, flag) \ 1176#define rtsx_set_dev_flag(cr, flag) \
@@ -963,6 +1185,7 @@ struct rtsx_pcr {
963 unsigned int id; 1185 unsigned int id;
964 int pcie_cap; 1186 int pcie_cap;
965 struct rtsx_cr_option option; 1187 struct rtsx_cr_option option;
1188 struct rtsx_hw_param hw_param;
966 1189
967 /* pci resources */ 1190 /* pci resources */
968 unsigned long addr; 1191 unsigned long addr;
@@ -1042,12 +1265,15 @@ struct rtsx_pcr {
1042 struct rtsx_slot *slots; 1265 struct rtsx_slot *slots;
1043 1266
1044 u8 dma_error_count; 1267 u8 dma_error_count;
1268 u8 ocp_stat;
1269 u8 ocp_stat2;
1045}; 1270};
1046 1271
1047#define PID_524A 0x524A 1272#define PID_524A 0x524A
1048#define PID_5249 0x5249 1273#define PID_5249 0x5249
1049#define PID_5250 0x5250 1274#define PID_5250 0x5250
1050#define PID_525A 0x525A 1275#define PID_525A 0x525A
1276#define PID_5260 0x5260
1051 1277
1052#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid)) 1278#define CHK_PCI_PID(pcr, pid) ((pcr)->pci->device == (pid))
1053#define PCI_VID(pcr) ((pcr)->pci->vendor) 1279#define PCI_VID(pcr) ((pcr)->pci->vendor)
diff --git a/include/linux/mfd/rtsx_usb.h b/include/linux/rtsx_usb.h
index c446e4fd6b5c..c446e4fd6b5c 100644
--- a/include/linux/mfd/rtsx_usb.h
+++ b/include/linux/rtsx_usb.h
diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index e69402d4a8ae..9929063bd45d 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -193,6 +193,7 @@ static inline int serdev_controller_receive_buf(struct serdev_controller *ctrl,
193 193
194int serdev_device_open(struct serdev_device *); 194int serdev_device_open(struct serdev_device *);
195void serdev_device_close(struct serdev_device *); 195void serdev_device_close(struct serdev_device *);
196int devm_serdev_device_open(struct device *, struct serdev_device *);
196unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int); 197unsigned int serdev_device_set_baudrate(struct serdev_device *, unsigned int);
197void serdev_device_set_flow_control(struct serdev_device *, bool); 198void serdev_device_set_flow_control(struct serdev_device *, bool);
198int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t); 199int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_t);