diff mbox series

[v2,5/7] mmc: add UHS-II related definitions in headers

Message ID 20220118124355.167552-6-jasonlai.genesyslogic@gmail.com
State New
Headers show
Series [v2,1/7] mmc: core: Cleanup printing of speed mode at card insertion | expand

Commit Message

Lai Jason Jan. 18, 2022, 12:43 p.m. UTC
From: Jason Lai <jason.lai@genesyslogic.com.tw>

All LINK layer messages, registers and SD-TRAN command packet described in
'Part 1 UHS-II Addendum Ver 1.01' are defined in include/linux/mmc/sd_uhs2.h

drivers/mmc/core/sd_uhs2.h contains exported function prototype.

Signed-off-by: Jason Lai <jason.lai@genesyslogic.com.tw>
---
 include/linux/mmc/card.h | 30 ++++++++++++++++++++++++++++-
 include/linux/mmc/core.h |  1 +
 include/linux/mmc/host.h | 41 ++++++++++++++++++++++++++++++++++++++--
 3 files changed, 69 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 82b07eac1..ee9fbeadb 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -212,7 +212,35 @@  struct sd_ext_reg {
 
 struct sd_uhs2_config {
 	u32			node_id;
-	/* TODO: Extend with more register configs. */
+
+	u32			dap;
+	u32			gap;
+	u32			n_fcu;
+	u32			maxblk_len;
+	u8			n_lanes;
+	u8			dadr_len;
+	u8			app_type;
+	u8			phy_minor_rev;
+	u8			phy_major_rev;
+	u8			can_hibernate;
+	u8			n_lss_sync;
+	u8			n_lss_dir;
+	u8			link_minor_rev;
+	u8			link_major_rev;
+	u8			dev_type;
+	u8			n_data_gap;
+
+	u32			n_fcu_set;
+	u32			maxblk_len_set;
+	u8			n_lanes_set;
+	u8			speed_range_set;
+	u8			n_lss_sync_set;
+	u8			n_lss_dir_set;
+	u8			n_data_gap_set;
+	u8			pwrctrl_mode_set;
+	u8			max_retry_set;
+
+	u8			cfg_complete;
 };
 
 struct sdio_cccr {
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index ab19245e9..c85d5aeb7 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -2,6 +2,7 @@ 
 /*
  *  linux/include/linux/mmc/core.h
  */
+
 #ifndef LINUX_MMC_CORE_H
 #define LINUX_MMC_CORE_H
 
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 69f8c8a8f..640c4bc81 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -96,7 +96,37 @@  struct mmc_clk_phase_map {
 };
 
 struct sd_uhs2_caps {
-	/* TODO: Add UHS-II capabilities for the host. */
+	int			flags;
+#define MMC_UHS2_SUPPORT	(1 << 0)
+#define MMC_UHS2_INITIALIZED	(1 << 1)
+#define MMC_UHS2_2L_HD		(1 << 2)
+#define MMC_UHS2_APP_CMD	(1 << 3)
+#define MMC_UHS2_SPEED_B	(1 << 4)
+#define MMC_SUPPORT_ADMA3	(1 << 5)
+
+	u32	dap;
+	u32	gap;
+	u32	maxblk_len;
+	u32	n_fcu;
+	u8	n_lanes;
+	u8	addr64;
+	u8	card_type;
+	u8	phy_rev;
+	u8	speed_range;
+	u8	can_hibernate;
+	u8	n_lss_sync;
+	u8	n_lss_dir;
+	u8	link_rev;
+	u8	host_type;
+	u8	n_data_gap;
+
+	u32	maxblk_len_set;
+	u32	n_fcu_set;
+	u8	n_lanes_set;
+	u8	n_lss_sync_set;
+	u8	n_lss_dir_set;
+	u8	n_data_gap_set;
+	u8	max_retry_set;
 };
 
 struct mmc_host;
@@ -145,7 +175,6 @@  struct mmc_host_ops {
 	 */
 	int	(*uhs2_set_ios)(struct mmc_host *host, struct mmc_ios *ios);
 
-
 	/*
 	 * Return values for the get_ro callback should be:
 	 *   0 for a read/write card
@@ -210,6 +239,14 @@  struct mmc_host_ops {
 
 	/* Initialize an SD express card, mandatory for MMC_CAP2_SD_EXP. */
 	int	(*init_sd_express)(struct mmc_host *host, struct mmc_ios *ios);
+
+	/* UHS2 interfaces */
+	/*
+	 * Every host controller can assign its own actions to set up their
+	 * controller.
+	 */
+	int	(*uhs2_host_operation)(struct mmc_host *host,
+				       enum uhs2_action act);
 };
 
 struct mmc_cqe_ops {