Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1777840ybl; Thu, 9 Jan 2020 01:15:55 -0800 (PST) X-Google-Smtp-Source: APXvYqw652/jPzC3hHW5aeKKp+4+V9lNzbC7o/kon/SrjztTNIUfdKe8obdc1RJBlIrXAmRR6Ska X-Received: by 2002:aca:d6c8:: with SMTP id n191mr2460616oig.103.1578561355258; Thu, 09 Jan 2020 01:15:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578561355; cv=none; d=google.com; s=arc-20160816; b=wBCvYoHnX7fYjDcUhrABrrulDhZEMQrNx5FMiLtZPuHEE0f27UDuI6BKTNRYvQqfDU Ew2G6xhQ1eDEz6QbMK8JN5kNJ9Yz6vcOkXWAGqmmtPbIrTzOzlSd+QH6ak1njHt75IAH K27+tVgdjq8vnHDJnAUwy64HhwcbHiBXuHCh1Qx2QWHs1A4QZDL0xWaU/dVN+1fN5Ytm Y7hxG11hac3Q4RWeWIQm3cxjlJhJ7jjjESjmzWowfCnhZZb9HgVc/YVbybfKfpHOmhzL J0kcexq6+zJX5L12X6mF6MXzSXRW8pxKu4l6XnDpcsNcpZFL3RqndKgHWqKMBBq3YxdR j84w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DqDsLNhtHSIHGhQiEDBjDopbKzdEsy6WnRJA/WOwF8s=; b=TGXLL9Jwf3G+ZP7w4B5f8NeRIr4//edkb19x0e3jJ2tUxm80lX9U8HnI7L9G0E3UeJ cYxaGpdxudgnGMsbsLzgOaxzJgzAOI4vIbN2aA+6XSfcnGm0yB4Rw8KtQpeBgrc0vBS6 eMad7yCg67k7P++qwS8zmftdqHOPLASD0O32m1gA/z7nJw1TBFdrZ8wZHVG+9WecAAq/ NaXJhtYtgGyXnJ1yq5Jh9yDcpzfKQrWE9TdU71BbuOwKkUYjpPTRw3gExtKJJ+fPV5BT bA5GTYXQJ0Ejz/lBAC+qTsuVHbIckDR/G5yUXr253vK7A9sA6b9JKxIy3uVGNcmFT1Xp VXaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bfNqxbwL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m8si3311408oim.180.2020.01.09.01.15.41; Thu, 09 Jan 2020 01:15:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bfNqxbwL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729202AbgAIJNo (ORCPT + 99 others); Thu, 9 Jan 2020 04:13:44 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36572 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728793AbgAIJNn (ORCPT ); Thu, 9 Jan 2020 04:13:43 -0500 Received: by mail-pf1-f196.google.com with SMTP id x184so3087121pfb.3; Thu, 09 Jan 2020 01:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DqDsLNhtHSIHGhQiEDBjDopbKzdEsy6WnRJA/WOwF8s=; b=bfNqxbwLulwnB7ovW01Fbc47QgGlS8+7gNV1zqUpls8dXgz19q34q9gHAclH2c2Wkd /dZRyFL7cYMnY+KzhzYiLPNKDNL5raDykS+u72AVOOcl6OFjF70kx1WzXzSAEH94ZgFY HwOVjsreGST3zsDthQ5LAfn+w6KJLD5Gl3TB5OQkahQ8cRx4xDt8tJULcD3St2niH8H/ uYF+KsRsPapftuse32xeMzDiMNlHL6N7JmXU9G7cPmL1gqlI5Te5vtHA6mcTNq3Tbtpg P6oIrkvpr+zl3oqi0UFFcGGh7e6DdMqX0h+f/wi8Bmj6bZHHO8DMO4NVwNhp57g+gds6 WzIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DqDsLNhtHSIHGhQiEDBjDopbKzdEsy6WnRJA/WOwF8s=; b=A/O0tqhKS8LyQDZfWYNJDEcicNlbqgJpjsrpxnAAru/f6QYRJxAuuEnw52jLdLibIp yLFNRHZFIu9pmaiBxAyR7jGhNdgS0hoKZ6SrZsnhvof8nr/WfTTwtQ9qqZm+8Fbc59u1 0seFuU6sQ397ZI6/DhiwsviGv8Sinf8CizGsx1XPc3CaEPjlgoMlXJthizhTI69VAUft tfH6HKJXziUof6blNauzvd6JrIo/sKm0K9tZbiuSvIyTmTz2DcXpQAZ/3OZzawg2rqpo RsQ125YSmsHBUsd2+7MuQuyuNWK22ia/Q/Ukuy1UmwDtFgh1kNnuGNMOYeuQksJSdPVi WM+A== X-Gm-Message-State: APjAAAW48yPqC28qi6ezV8MjIVWQzPNupT3rrV9Iyr+SPcfPJelwdNzg ctqxyVqRLymzVkQAxIHYrW4= X-Received: by 2002:a62:7c54:: with SMTP id x81mr9812667pfc.180.1578561222602; Thu, 09 Jan 2020 01:13:42 -0800 (PST) Received: from gli-arch.genesyslogic.com.tw ([122.146.30.3]) by smtp.gmail.com with ESMTPSA id m3sm6707916pfh.116.2020.01.09.01.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2020 01:13:42 -0800 (PST) From: Ben Chuang To: adrian.hunter@intel.com, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, greg.tu@genesyslogic.com.tw, ben.chuang@genesyslogic.com.tw, Ben Chuang Subject: [RFC PATCH v2 1/6] mmc: Add UHS-II support in public headers Date: Thu, 9 Jan 2020 17:14:04 +0800 Message-Id: <085ce316d536fef5d19184f0f2b71c478fe3a709.1578560282.git.benchuanggli@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Chuang Add UHS-II support in public headers Signed-off-by: Ben Chuang --- include/linux/mmc/card.h | 1 + include/linux/mmc/core.h | 6 ++++++ include/linux/mmc/host.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index cf3780a6ccc4..988f46638317 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -180,6 +180,7 @@ struct sd_switch_caps { #define SD_SET_CURRENT_LIMIT_400 1 #define SD_SET_CURRENT_LIMIT_600 2 #define SD_SET_CURRENT_LIMIT_800 3 +#define SD_SET_CURRENT_LIMIT_1000 4 #define SD_SET_CURRENT_NO_CHANGE (-1) #define SD_MAX_CURRENT_200 (1 << SD_SET_CURRENT_LIMIT_200) diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index b7ba8810a3b5..cd294a1c31c6 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -7,6 +7,7 @@ #include #include +#include struct mmc_data; struct mmc_request; @@ -112,6 +113,11 @@ struct mmc_command { struct mmc_data *data; /* data segment associated with cmd */ struct mmc_request *mrq; /* associated request */ + + struct uhs2_command *uhs2_cmd; /* UHS2 command */ + u8 *uhs2_resp; /* UHS2 native cmd resp */ + u8 uhs2_resp_len; /* UHS2 native cmd resp len */ + u8 uhs2_tmode0_flag; /* UHS2 transfer mode flag */ }; struct mmc_data { diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index ba703384bea0..3d6a7c9b534f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -15,10 +15,12 @@ #include #include #include +#include struct mmc_ios { unsigned int clock; /* clock rate */ unsigned short vdd; + unsigned short vdd2; /* UHS2 VDD2 power supply */ unsigned int power_delay_ms; /* waiting for stable power */ /* vdd stores the bit number of the selected voltage range from below. */ @@ -60,6 +62,7 @@ struct mmc_ios { #define MMC_TIMING_MMC_DDR52 8 #define MMC_TIMING_MMC_HS200 9 #define MMC_TIMING_MMC_HS400 10 +#define MMC_TIMING_UHS2 11 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ @@ -169,6 +172,11 @@ struct mmc_host_ops { */ int (*multi_io_quirk)(struct mmc_card *card, unsigned int direction, int blk_size); + /* UHS2 interfaces */ + int (*uhs2_detect_init)(struct mmc_host *host); + int (*uhs2_set_reg)(struct mmc_host *host, enum uhs2_act act); + void (*uhs2_disable_clk)(struct mmc_host *host); + void (*uhs2_enable_clk)(struct mmc_host *host); }; struct mmc_cqe_ops { @@ -261,6 +269,7 @@ struct mmc_pwrseq; struct mmc_supply { struct regulator *vmmc; /* Card power supply */ + struct regulator *vmmc2; /* UHS2 VDD2 power supply */ struct regulator *vqmmc; /* Optional Vccq supply */ }; @@ -281,12 +290,14 @@ struct mmc_host { u32 ocr_avail_sdio; /* SDIO-specific OCR */ u32 ocr_avail_sd; /* SD-specific OCR */ u32 ocr_avail_mmc; /* MMC-specific OCR */ + u32 ocr_avail_uhs2; /* UHS2-specific OCR */ #ifdef CONFIG_PM_SLEEP struct notifier_block pm_notify; #endif u32 max_current_330; u32 max_current_300; u32 max_current_180; + u32 max_current_180_vdd2; /* UHS2 vdd2 max curt. */ #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ @@ -305,6 +316,7 @@ struct mmc_host { #define MMC_VDD_33_34 0x00200000 /* VDD voltage 3.3 ~ 3.4 */ #define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */ #define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */ +#define MMC_VDD2_165_195 0x00000080 /* UHS2 VDD2 1.65 ~ 1.95 */ u32 caps; /* Host capabilities */ @@ -336,6 +348,7 @@ struct mmc_host { #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */ +#define MMC_CAP_UHS2 (1 << 26) /* Host supports UHS2 mode */ #define MMC_CAP_DONE_COMPLETE (1 << 27) /* RW reqs can be completed within mmc_request_done() */ #define MMC_CAP_CD_WAKE (1 << 28) /* Enable card detect wake */ #define MMC_CAP_CMD_DURING_TFR (1 << 29) /* Commands during data transfer */ @@ -374,6 +387,17 @@ struct mmc_host { mmc_pm_flag_t pm_caps; /* supported pm features */ + struct uhs2_host_caps uhs2_caps; /* UHS2 host capabilities */ + struct uhs2_card_prop uhs2_dev_prop; /* UHS2 device properties */ + u32 group_desc; /* UHS2 property */ + 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) + /* host specific block data */ unsigned int max_seg_size; /* see blk_queue_max_segment_size */ unsigned short max_segs; /* see blk_queue_max_segments */ @@ -566,6 +590,12 @@ static inline int mmc_card_uhs(struct mmc_card *card) card->host->ios.timing <= MMC_TIMING_UHS_DDR50; } +static inline bool mmc_card_uhs2(struct mmc_card *card) +{ + return (card->host->flags & MMC_UHS2_SUPPORT) && + (card->host->flags & MMC_UHS2_INITIALIZED); +} + void mmc_retune_timer_stop(struct mmc_host *host); static inline void mmc_retune_needed(struct mmc_host *host) -- 2.24.1