summaryrefslogtreecommitdiff
path: root/include/linux/rtsx_usb.h
diff options
context:
space:
mode:
authorRicky Wu <ricky_wu@realtek.com>2025-08-12 11:08:11 +0800
committerUlf Hansson <ulf.hansson@linaro.org>2025-08-19 14:34:15 +0200
commitd2e6fb2c31a07f34e5e7533df11431cb0d2ecf9f (patch)
tree13c965d7ec7d8c7efcd02b229d6e17569399a6e6 /include/linux/rtsx_usb.h
parentb65e630a55a490a0269ab1e4a282af975848064c (diff)
misc: rtsx: usb card reader: add OCP support
This patch adds support for Over Current Protection (OCP) to the Realtek USB card reader driver. The OCP mechanism protects the hardware by detecting and handling current overload conditions. This implementation includes: - Register configurations to enable OCP monitoring. - Handling of OCP interrupt events and associated error reporting. - Card power management changes in response to OCP triggers. This enhancement improves the robustness of the driver when operating in environments where electrical anomalies may occur, particularly with SD and MS card interfaces. Signed-off-by: Ricky Wu <ricky_wu@realtek.com> Link: https://lore.kernel.org/r/20250812030811.2426112-1-ricky_wu@realtek.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'include/linux/rtsx_usb.h')
-rw-r--r--include/linux/rtsx_usb.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/rtsx_usb.h b/include/linux/rtsx_usb.h
index f267a06c6b1e..276b509c03e3 100644
--- a/include/linux/rtsx_usb.h
+++ b/include/linux/rtsx_usb.h
@@ -99,6 +99,17 @@ extern int rtsx_usb_card_exclusive_check(struct rtsx_ucr *ucr, int card);
#define CD_MASK (SD_CD | MS_CD | XD_CD)
#define SD_WP 0x08
+/* OCPCTL */
+#define MS_OCP_DETECT_EN 0x08
+#define MS_OCP_INT_EN 0x04
+#define MS_OCP_INT_CLR 0x02
+#define MS_OCP_CLEAR 0x01
+
+/* OCPSTAT */
+#define MS_OCP_DETECT 0x80
+#define MS_OCP_NOW 0x02
+#define MS_OCP_EVER 0x01
+
/* reader command field offset & parameters */
#define READ_REG_CMD 0
#define WRITE_REG_CMD 1