\documentclass[aspectratio=169,obeyspaces,spaces,hyphens,dvipsnames]{beamer}
\usepackage{minted}
\usepackage{newunicodechar}
\usepackage{hyperref}

\mode<presentation>
\usetheme{Bootlin}

%%\newcommand{\codehack}[1]{{\usebeamercolor[fg]{code} {\tt #1}}}


\title{SD/eMMC: new speed modes and their support in Linux}
\authors{Gregory CLEMENT}
\email{gregory@bootlin.com}
\slidesurl{http://bootlin.com/pub/conferences/2017/elce/clement-sd-mmc-high-speed-support-in-linux}
\conference{Embedded Linux Conference Europe 2017}

\begin{document}

\begin{frame}{\insertconference}
  \fontsize{19}{19}\selectfont
  SD/eMMC: new speed modes and\\
   their support in Linux
  \begin{columns}
    \column{0.6\textwidth}
    \fontsize{15}{15}\selectfont
    Gregory CLEMENT \\
    Bootlin
    \normalsize
    {\em \insertemail}
    \column{0.4\textwidth}
    \includegraphics[width=0.8\textwidth]{common/logo-square.pdf}\\
  \end{columns}
\end{frame}

\begin{frame}{Gregory CLEMENT}
  \begin{columns}
    \column{0.6\textwidth}
    \begin{itemize}
    \item Embedded Linux engineer and trainer at Bootlin
      \begin{itemize}
      \item Embedded Linux {\bf expertise}
      \item {\bf Development}, consulting and training
      \item Strong open-source focus
      \end{itemize}
    \item Open-source contributor
      \begin{itemize}
      \item Contributing to {\bf kernel support} for the Armada 370,
        375, 38x, 39x and Armada XP ARM SoCs and Armada 3700, 7K/8K
        ARM64 SoCs from Marvell.
      \item Co-maintainer of mvebu sub-architecture (SoCs from Marvell
        Engineering Business Unit)
      \item Living near {\bf Lyon}, France
      \end{itemize}

    \end{itemize}
    \column{0.4\textwidth}
    \includegraphics[width=\textwidth]{common/logo-square.pdf}\\
  \end{columns}
\end{frame}

\begin{frame}{\textbf{SD card} and \textbf{eMMC}}
  \begin{columns}
    \column{0.7\textwidth}
    \textbf{SD card} and \textbf{eMMC} have common point:
    \begin{itemize}
    \item Both come from \textbf{MMC} (\emph{MultiMediaCards}).
    \item Increase their bandwidth as new versions of the
      standards were released
      \begin{itemize}
      \item Now they can reach more than 400MB/s in theory
      \end{itemize}
      \item Supported in Linux though the \textbf{mmc subystem}
    \end{itemize}
    \column{0.3\textwidth}
    \includegraphics[width=\textwidth]{MMC_SD_eMMC.jpg}\\
    \null\vfill
    {\fontsize{5}{6}\selectfont Photographies from Wikipedia, credit:\\}
    {\fontsize{5}{6}\selectfont MMC: Pixelk - CC BY 1.0\\}
    {\fontsize{5}{6}\selectfont SD Card: Adryan R. Villanueva - CC BY-SA 4.0\\}
    {\fontsize{5}{6}\selectfont eMMC: Toniperis - CC BY-SA 4.0\\}
  \end{columns}
\end{frame}


\begin{frame}{Overview of this talk}
  \begin{itemize}
  \item Presentation of \textbf{SD Card} and \textbf{eMMC}
  \item Initial support in Linux
  \item The new speed modes
  \item State of the support for these new speed modes in Linux
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{SD card}}
  \begin{itemize}
  \item \textbf{SD} stands for \emph{Secure Digital}
    \begin{itemize}
    \item \emph{``Secure`` for copyright content}
    \end{itemize}
  \item Introduced in 1999
  \item \textbf{MMC} extension
  \item Standardized by \textbf{SDA} (\emph{SD Association} created in 2000)
  \end{itemize}
%MMC created in 1997
\end{frame}

\begin{frame}{\textbf{SD card} - Hardware}
  \begin{itemize}
  \item Flash chip + small micro-controller in a card
  \item 9 pins: \code{CLK}, \code{CMD}, \code{DAT0-3}, \code{VDD}, \code{VSS1-2}
  \item SPI mode compatibility
    \begin{itemize}
    \item \code{DAT3} -> \code{CS}, \code{CMD} -> \code{DI}, \code{DAT0} -> \code{DO}
    \end{itemize}
  \item In initial release 25MHz clock
  \end{itemize}
  % MMC created in 1997
\end{frame}

\begin{frame}{\textbf{SD card} - Protocol}
  SD Bus protocol
  \begin{itemize}
  \item Command and data bit stream
  \item Command and response on CMD line
  \item Data on the data lines
  \item Basic transaction command/response
  \item Some operations can have data token
  \item All communication initiated by the host
  \item Data transfer in block with CRC
  \item Multiple data block: always stop by a host command
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{SD card} vs \textbf{MMC}}
  \begin{itemize}
  \item Initial version: 1 data line for \textbf{MMC} vs 4 for \textbf{SD card}
  \item Nowadays \textbf{MMC} can go up to 8 data lines
  \item No DRM in \textbf{MMC}
  \item Command set diverged
  \item Both have SPI compatibility mode
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{eMMC}}
  \begin{itemize}
  \item other \textbf{MMC} extension from \textbf{MMCA} and \textbf{JDEC}
  \item \textbf{eMMC} stands for \emph{embedded} MultiMedia Card
  \item Mentioned in the \textbf{MMC} spec v4.1 in 2007
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{eMMC} - Hardware}
  \begin{itemize}
  \item Flash chip + small micro-controller in BGA chip
  \item Pinout:
    \begin{itemize}
    \item Since 4.1, 14 pins: \code{CLK}, \code{CMD}, \code{DAT0-7}, \code{VccQ}, \code{VssQ}, \code{Vcc}, \code{Vss}
    \item With 4.4 version, one more pin: \code{RST_n} (Reset)
    \item With 5.0 version, one more pin: \code{DS} (Data Strobe)
    \end{itemize}
  \item No more SPI mode compatibility since 4.3
  \item In initial release: 52 MHz clock
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{eMMC} - Protocol}
  Bus protocol same than the SD bus protocol (both came from \textbf{MMC})
  \begin{itemize}
  \item Command, response on \code{CMD} line
  \item Data on the data lines
  \item Basic transaction command/response
  \item Some operation can have data token
  \item All communication initiate by the host
  \item Data transfer in block with CRC
  \item Multiple data blocks: always stop by a host command
  \end{itemize}
\end{frame}

\begin{frame}{\textbf{eMMC} vs \textbf{MMC card}}
  Both defined by the same specification but there still differences:
  \begin{itemize}
  \item \textbf{eMMC} BGA chip soldered to a board
  \item \textbf{MMC card} removable part
  \item Dedicated feature for \textbf{eMMC} such as partitioning, device information
  \item \textbf{eMMC} widely used whereas the {MMC card} are hard to find
  \end{itemize}
\end{frame}

\begin{frame}{Support in Linux - History}
  \begin{itemize}
  \item \textbf{MMC} Framework added in 2004 with \textbf{2.6.9} by \textbf{Russell King}
  \item \textbf{SD card} Support added in 2005 with \textbf{2.6.14} by \textbf{Pierre Ossman} (who became MMC maintainer in 2006)
  \item \textbf{SDHCI} (Secure Digital Host Controller Interface)
    added with \textbf{2.6.17} in 2006
  \item High Speed mode (clock up to 52MHz) for \textbf{MMC} added with \textbf{2.6.20}
  \item High Speed mode for \textbf{SD Card} added in the same release
  \item \textbf{SDIO} extension support with \textbf{2.6.24} in 2007
  \end{itemize}
\end{frame}

\begin{frame}{Support in Linux}
  \begin{itemize}
  \item Code located in \code{drivers/mmc} and headers in \code{include/linux/mmc/}
  \item Currently maintained by \textbf{Ulf Hansson} since 2014
  \item Code separated in two parts:
    \begin{itemize}
    \item \code{core}: protocol for \textbf{MMC/eMMC} and \textbf{SD
        Card} as well as common functions for the framework
    \item \code{host}: support for the controllers      \begin{itemize}
      \item \code{host/sdhci*} for the controller based on \textbf{SDHCI} maintained by \textbf{Adrian Hunter}
      \item \textbf{SPI mode} supported in \code{host/mmc_spi.c} but currently without maintainer
      \end{itemize}
    \end{itemize}
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - High Speed}
  \begin{itemize}
  \item Maximum clock from 26MHz to 52MHz for \textbf{MMC}
  \item Maximum clock from 25MHz to 50MHz for \textbf{SD Card}
  \item Introduce the speed mode selection sequence using \code{CMD6}
  \item Introduce since \textbf{SD v2} and \textbf{MMC v4}
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{UHS-I} 1/2}
  \begin{itemize}
  \item Introduced with \textbf{SD 3.01} (2010)
  \item New speed modes (name are base on the bandwidth):
    \begin{itemize}
    \item \textbf{SDR12} (max bandwidth: 12MB/s)
    \item \textbf{SDR25} (max bandwidth: 25MB/s)
    \item \textbf{SDR50} (max bandwidth: 50MB/s)
    \item \textbf{SDR104} (max bandwidth: 104MB/s)
    \item \textbf{DDR50} (max bandwidth: 50MB/s)
    \end{itemize}
  \item All these new modes under 1.8V compared to the 3.3V for
    \textbf{DS} (Default Speed 25MHz) and \textbf{HS} (High Speed at
    50MHz)
  \item New step in the switch sequence: modifying the voltage
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{UHS-I} 2/2}
  \begin{itemize}
  \item \textbf{SDR12}: simple data rate with clock at 25MHz (with 4 lines)
  \item \textbf{SDR25}: simple data rate with clock at 50MHz (with 4 lines)
  \item \textbf{SDR50}: simple data rate with clock at 100MHz (with 4
    lines)
  \item \textbf{SDR104}: simple data rate with clock at 208MHz (with 4
    lines).\\
    For this speed mode tuning (\code{CMD19}) is required
  \item \textbf{DDR50}: double data rate with clock at 50MHz. Data
    sample on each front of the clock
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{DDR} mode for \textbf{eMMC}}
  \begin{itemize}
  \item Introduced with \textbf{MMC 4.4} (2009)
  \item Up to 52MHz (as high Speed mode)
  \item Configured with \code{CMD6} but with different arguments than \textbf{SD Card}
  \item Can be used at 3V
  \item At host controller level, same configuration used than for \textbf{DDR50}
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{HS-200}}
  \begin{itemize}
  \item Introduced with \textbf{MMC 4.5} (2011)
  \item Up to 200MHz at single data rate
  \item Tuning command (\textbf{CMD21}) can be used to find optimal data sampling.
  \item Must be used at 1.8V or 1.2V
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{HS-400}}
  \begin{itemize}
  \item Introduced with \textbf{MMC 5.0} (2013)
  \item Up to 200MHz at dual data rate
  \item New \code{DS} (Data Strobe) line: used during \code{DATA out} and \code{CRC response}
  \item Tuning command (\textbf{CMD21}) can be used to find optimal data sampling.
  \item Must be used at 1.8V or 1.2V
  \item With \textbf{MMC 5.1} (2014), \textbf{Enhanced Strobe} added: strobe also provided during \code{CMD Response}
  \end{itemize}
\end{frame}

\begin{frame}{Speed mode improvement - \textbf{UHS-II}}
  \begin{itemize}
  \item Introduced with \textbf{SD 4.1} (2013)
  \item Completely new mode
  \item New set of signal:  \code{RCLK+}, \code{RCLK-}, \code{D0+},\code{D0-},\code{D1+},\code{D1-}, \code{VSS3-5}, \code{VDD1-2}
  \item 2 data lanes (\code{D0}, \code{D1}) using 2 differential signals
  \item \code{RCLK}: 26 to 52 MHZ
  \item Data x15 or x30 depending of the mode, up to 312MB/s
  \item Completely different protocol: exchange of packet messages on both way
  \item Each packet have header and payload data
  \item At transaction layer possibility to encapsulate SD packet
  \item At lower level still needed to be able to use the new protocol
  \item With \textbf{SD 6.0} (2017): \textbf{UHS-III} (624 MB/s)
  \end{itemize}
\end{frame}

\begin{frame}{New speed Support in Linux - History}
  \begin{itemize}
  \item \textbf{DDR 50 mode} added with \textbf{2.6.37} in 2010
  \item \textbf{UHS-I} added with \textbf{3.0} in 2011
  \item \textbf{HS200} added with \textbf{3.10} in 2012
  \item \textbf{HS400} added with \textbf{3.16} in 2014
  \item \textbf{HS400 retuning} added with \textbf{4.2} in 2015
  \item \textbf{HS400es} (Enhanced Strobe) added with \textbf{4.8} in 2016
  \end{itemize}
\end{frame}

\begin{frame}{Current support in Linux}
  \begin{itemize}
  \item Signal voltage switching needed for most of the new speed mode
    \begin{itemize}
    \item Supported by the framework in \code{core.c}
    \item Make use of the regulator framework
    \end{itemize}
  \item Tuning used by \textbf{eMMC} and \textbf{SD Card}
    \begin{itemize}
    \item Function present in the core
    \item But implemented at controller driver level
    \end{itemize}
\item Switching sequence handled by the core but most of the steps can
  be customized for the host controller.
  \end{itemize}
\end{frame}

\begin{frame}{Missing part and future challenge in Linux}
  \begin{itemize}
  \item \textbf{eMMC} speed mode support quite complete, most of the
    development now at driver level and specific to each controller.
  \item \textbf{SD Card}: no support at all for \textbf{UHS-II} (and
    \textbf{UHS III}), adding this new protocol would be a big task.
  \end{itemize}
\end{frame}

\questionslide

\end{document}
