SlideShare a Scribd company logo
1 of 26
Outline
0 Storage Devices on mobile platform
(smart phones, tablets etc.)
0 RAM
0 Internal Storage Devices
0 External Storage Devices
0 What is Flash Memory ?
0 Kernel storage driver overview
(http://lxr.free-
electrons.com/source/drivers/mmc/ )
0 mmc device driver overview
0 Top view diagram
0 block diagram and Internal diagram
0 SD and SPI protocol
0 Mmc driver different Layers
0 Important functions to look
for
0 Tuning procedure
0 SD Hot-plug
0 Sdhci controller role in Data
transfer
0 SDMMC device registration
0 Sdhci probe()
0 How to configure/enable
SDHCI support
Note: To understand the few terms in this presentation, please refer
to Introduction to Kernel & Device Drivers PPT
(http://www.slideshare.net/rampalliraj/kernel-device-drivers): It
covers what is Kernel, what is a Module and what is device driver .
Storage Devices on Mobile Platforms
0 Mobile Platforms will have mainly Three storage devices for applications/users to
store the Data
0 RAM (Random Access Memory): also known as main memory and primary memory.
0 Internal Storage device (Non-removable device)
0 External Storage device (Removable device)
0 RAM is Volatile memory i.e. data present in this device will be lost when power is
removed/off.
0 Internal Storage Device: Mobile devices will have a built-in non-volatile memory
called internal storage.
0 External Storage Device: Android devices may support removable non-volatile
memory called external storage devices.
0 Example: Look at Memory & Storage specification of smartphone mobile.
RAM: 2GB
Internal Storage:
16GB
External storage:
upto 128GB
Snapshot taken from Flipkart Samsung j5-6 mobile spec.
What is Flash Memory ?
0 Flash Memory is a non-volatile, solid state storage device i.e. keeps
its data without power.
0 Flash Memory is being used in wide range of devices. Examples are
0 Internal storage devices (eMMC or UFS)
0 USB sticks and SD Memory Cards
0 Digital audio players
0 Flash memory offers very high speed access to data.
0 Advantage: Flash memory, when packaged in a "memory card", is
very resilient to damage, unlike many other storage devices. It can
withstand extremes of temperature, being immersed in water or
being accidentally dropped [2].
0 Disadvantage: It has a limited number of read/write cycles which
limits its useful life span.
Internal Storage Device
0 Internal Storage mostly holds the android operating
system so that the android device is able to access
input and output devices.
0 System memory (see image)
0 It is also called as Device Memory (internal memory).
0 Go to settings page and select Storage option and you will
see the internal storage capacity of your device.
0 It also stores the applications or data that user saves in
it.
0 The data stored in internal storage can be accesses
much faster than the data present in external storage
device.
0 Internal storage device is directly connected to the
mother board where as the external device connected
through a hardware interface.
0 Disadvantage: If device fails to boot then all the data
present in the internal storage device may be lost.
Internal Storage Devices
0 Following are the storage devices which are mainly used for
main storage devices on mobile platforms
0 eMMC: embedded Multi-Media Controller, refers to a package
consisting of both flash memory and a flash memory controller
integrated on the same silicon die.
0 UFS: Universal Flash Storage (UFS) is a flash storage like eMMC
device with higher data rates compared to it.
0 SATA: Serial ATA is a computer bus interface that connects host
bus adapters to mass storage devices such as hard disk drives,
optical drives, and solid-state drives.
0 Will cover Linux Kernel eMMC (MMC storage)device drivers
in this presentation.
External Storage Device
0 Android devices may support
the capability of adding more
external storage via removable
cards like SD memory cards.
0 SD card: Secure Digital (SD) is
a non-volatile memory card
format developed by the SD
Card Association (SDA) for use
in portable devices.
0 Advantage: External storage
devices are portal i.e. data can
be easily moved from one
location to other location.
0 These storage devices are
used for data backup
0 Disadvantage: Data transfer
rate is slow compared to
internal storage devices.
SD card details found in
settings->storage android
How to identify SD card’s class?
Preferable card: class 10 or UHS-I cards
Class
Minimum
Serial Data
Writing
Speed
Symbol on
SD card
Class 2 2MB/s
Class 4 4MB/s
Class 6 6MB/s
Class 10 10MB/s
UHS Speed
Class 1 (U1)
10MB/s
SD Memory card architecture
Card Info
registers
Usage
CID Card identification number
RCA Relative card address published by
the card during card identification
process.
DSR Driver stage register
CSD Max data transfer rate and defines
data format, error correction type,
maximum data access/transfer time,
Maximum read/write block length.
SCR SD configuration register
OCR Operation condition reg
SSR SD status register
CSR Card status register
SD and SPI protocol
SPI Protocol SD Protocol
Design simple Complex
Loss of performance: 1bit mode Wide bus option. Supports 1bit and 4bit
modes.
Card identification and addressing
methods replaced by the h/w chip select
CS signal
Its own Card Identification process
No broadcast commands Available
Uses only 7 pins
DAT1 and DAT2 are not used
DAT3 used as CS
DAT0 data transfer
CLK line
DataIn line (Host to card line)
9 pins model:
DAT0-DAT3 lines for data transfer
CLK line – clock line
CMD line – command line
3 Power lines – supply voltage lines
Storage Device Driver for
eMMC and SD devices
0 Storage Device Driver ($kernel/drivers/mmc) is common
for eMMC devices (internal storage device) and for SD
memory cards (external storage device).
0 eMMC and SD are block devices i.e. mmc device driver
communicates with these devices in the form of blocks of
data (512 bytes)
0 Character device is one with which the driver communicates
by sending/receiving single characters (bytes), eg:
0 mmc drivers receives the block requests from generic block
layer (upper layer)
mmc Device Driver Top View
Kernel
Space
User Space
Virtual File System Layer
Generic Block Layer
mmc device driver
Hardware
devices
eMMC device SD memory card
User applications
mmc Device Driver block diagram
Kernel
Space
Virtual File System Layer
Generic Block Layer
Hardware
devices
eMMC device SD memory card
mmc device driver
mmc Block/Queue driver
mmc core driver
mmc host driver
SDHCI Host driver
/mmc/card/block.c
/mmc/card/queue.c
/mmc/core/core.c
/mmc/core/mmc.c
/mmc/core/sd.c
/mmc/host/sdhci.c
mmc device driver overview
0 mmc queue receives block read/write/erase
requests from the generic core block layer
0 mmc queue driver picks up one request from its
queue and assign it to mmc block driver
0 mmc block driver analyze the type of request and
forwards the request to mmc core driver.
0 mmc core driver has the protocol implementation
for eMMC/SD devices detection, enumeration and
data transfers to communicated with the actual
Hardware device.
0 mmc core driver receives the request from block
driver, prepares a mmc_request and forwards it to
the mmc host driver.
0 mmc host driver initiates the transfer to device by
programming Hardware controller registers.
0 Once the request get processed by the hardware
controller, an interrupt gets generated .
0 mmc host driver receives request complete
interrupt, analyzes it and pass the response to block
driver. This process continues for all block requests.
mmc Queue driver
(queue.c)
mmc core driver
(core.c, mmc.c, sd.c)
mmc host (controller)
driver
SDHCI Host driver
sdhci.c
mmc Block driver
(block.c)
mmc queue layer
(/drivers/mmc/card/queue.c)
0 Important functions:
0 mmc_init_queue()
0 initializes the device queue
0 Creates and run the kernel thread (mmc_queue_thread)
“mmcqd” to fetch block I/O requests from core block
layer and pass it mmc block layer.
0 mmc_queue_thread()
0 Fetch block I/O requests using blk_fetch_request()
0 Pass the request to mmc block layer using callback
issue_fn() -> redirects to -> mmc_blk_issue_rq() in
mmc block driver
mmc block layer (/drivers/mmc/card/block.c)
0 Important functions: 1) mmc_blk_probe()
0 Calls the mmc_queue_initialize() to initialize mmc queue.
0 Allocates the block devices (eMMC and SD card) and its partitions.
0 Initializes the mmc_blk_data (md) structure with required function callbacks for
I/O requests, assigns MAJOR/MINOR info.
md->queue.issue_fn = mmc_blk_issue_rq; md->disk->major =
MMC_BLOCK_MAJOR; md->disk->first_minor = devidx * perdev_minors;
0 2) mmc_blk_issue_rq() – receives block I/O request from mmc queue thread
from mmc queue driver. If I/O request type is ERASE then it calls
mmc_blk_issue_discard_rq(). If I/O request is READ/WRITE then calls
mmc_blk_issue_rw_rq()
0 2A) mmc_blk_issue_rw_rq() – prepares mmc block request and responsible
for followings: Sets data block size to 512 (FIXED)
0 Retrieve block count information using blk_rq_sectors()
0 Assigns appropriate command flags and data flags
0 Sets the timeout for a Data command using mmc_set_data_timeout() function
(defined in mmc core driver)
0 Assign the mmc block request to mmc core driver by calling mmc_start_req()
function.
mmc core layer
(/drivers/mmc/core/*)
0 It Implements all SD/eMMC-dependent functionality, entire
communication protocol is implemented in this layer.
0 Receives request in mmc_start_req() from mmc block layer
0 Before starting this new request, it checks for any ongoing
request. Holds this new request until the ongoing request is
processed.
0 It calls mmc host layer function sdhci_request() to program the
command and its dependant parameters in the mmc controller
register for initiating the command transfer.
(/drivers/mmc/host/sdhci.c)
mmc host layer (drivers/mmc/host/*)
0 It implements the driver for most known platform controllers and
is platform dependent.
0 Important functions:
0 sdhci_add_host() : adds the sdhci host controller with the driver model.
It initializes the sdhci h/w controller and enables sdhci interrupts.
0 sdhci_request(): It initiates the data transfer of received request by
programming the command details in the corresponding h/w register.
0 Sets the SW timer to ensure that there is no infinite wait for the transfer
complete interrupt
0 Prepares the data and sets SDMA or ADMA mode
0 sdhci_irq(): It receives the transfer complete interrupt and analyzes it
for any errors. It sends the response of the transfer to block layer.
0 sdhci_execute_tuning(): Tuning procedure: It is required for reliable data
transfers when interface freq is more than 50MHz. It determines the TAP value by
issuing CMD19.
0 Controller issues CMD19 (SD/SDIO) or CMD21(eMMC) to get card’s tuning block at the
current tap value X. Compares with its tuning block
0 If matches - Tuning is passed for the tap value X
0 Else - Tuning is not passed for the tap value X, try next tap X+1
SD Host controller role @Data Transfer
0 Data location of system memory  DMA_SYSTEM_ADDR (If DMA supported)
0 Set Block size  BLOCK_SIZE
0 Set Block count  BLOCK_COUNT
0 Set argument value  ARGUMENT
0 Set TRANSFER_MODE value, determines
0 Single/Multi-Block transfer
0 Block count enabled ?
0 Data transfer direction
0 ACMD12(eMMC/SD) or CMD52(SDIO) enabled ?
0 DMA enabled ?
0 Set COMMAND  execution started
0 Wait for CMD complete Interrupt
0 Write 1 to the CMD_COMPLETE in Normal status Interrupt Register
0 Based on Read/Write CMD, the associated Registers/Interrupts enabled
0 Wait for Buffer Read Ready or Buffer Write Ready Interrupt
0 Clear Buffer Read Ready Status or Buffer Write Ready Status
0 Wait for TRANSFER_COMPLETE Interrupt
0 Clear TRANSFER_COMPLETE Status
Mmc driver features
0 Host-Device interface is reliable when FREQ limits upto 50MHz
0 SD: High speed (HS) SD cards, class 4 cards
0 eMMC: eMMC devices with versions 4.41 or below
0 Tuning procedure is required when host-device interface runs at more
than 50MHz.
0 SD: Ultra High Speed (UHS) SD cards, and class 10 SD cards.
0 eMMC: eMMC devices with versions 4.5 or more supports tuning
0 Mmc driver supports SD hot-plug feature, so that SD card can be inserted
into already running device without powering of the device.
0 MMC driver supports voltage switching feature, if SD cards of type 10 or
UHS-I inserted then voltage switching is invoked to switch voltage from
3.3 V to 1.8V for power optimization.
0 UHS SD cards runs at 1.8V
0 Clock gating is enabled: If there are no transactions on eMMC/SD interface
then clock supply will be off, to save the power of the device.
SDMMC devices registration
0 Device registration requires both device name and driver name should
match
0 Device registration is done in board-<board-name>-sdhci.c
0 platform_device_register(&tegra_sdhci_device3); /* eMMC */
platform_device_register(&tegra_sdhci_device2); /* SD/SDIO */
platform_device_register(&tegra_sdhci_device0); /* SDIO/SD */
0 Platform_device Structure:
static struct platform_device tegra_sdhci_deviceX = {
.name = "sdhci-tegra",
.id = X, /* X = 0 or 1 or 2 or 3 */
.resource = sdhci_resourceX,
.num_resources = ARRAY_SIZE(sdhci_resourceX),
.dev = { .platform_data = &tegra_sdhci_platform_data3, },
};
0 As part of device enumeration, we use discovery method to identify
whether the device is eMMC or SD or SDIO.
SDHCI probe()
Probe() is called when device is recognized by the platform
Driver’s init function gives kernel a list of devices it is able to
service, along with a pointer to a probe function. Kernel then calls
the driver’s probe function one for each device.
0 probe function starts the per-device initialization:
0 initializing hardware, allocating resources, and
0 registering the device with the kernel as a block device.
0 Kernel/drivers/mmc/host/sdhic-tegra.c  sdhci_tegra_probe()
0 Host controller initialization at
kernel/drivers/mmc/host/sdhci.c  sdhci_add_host()
0 Device initialization starts in
kernel/drivers/mmc/core/core.c  mmc_rescan()
0 Starts execution when Host detects the device.
0 mmc_attach_sdio()  sdio.c [core driver]
0 mmc_attach_sd()  sd.c [core driver]
0 mmc_attach_mmc()  mmc.c [core driver]
How to enable SDHCI controller:
MMC/SD Card support Configuration
0 Configure below variables for mmc devices (eMMC
and SD devices share same sdhci controller)
0 MMC
0 MMC_SDHCI
0 MMC_SDHCI_PLTFM
0 Optional
0 MMC_DEBUG
0 MMC_BLOCK
0 drivers/mmc/Kconfig
Conclusion
0 eMMC device is used for internal storage on mobile platforms
0 SD device (external SD cards) is used for external storage on
mobile platforms
0 eMMC device and SD device both uses same driver on Linux
platform. Pointer to this driver is
http://lxr.free-electrons.com/source/drivers/mmc/
0 eMMC and SD devices registers with block layer as a block devices.
0 Mmc driver sub-divided into three layers block (or queue)
subsystem, core layer and host layer.
0 eMMC and SD uses SD protocol for communication.
0 Sdhci host controller communicates with eMMC and SD devices.
0 Class 10 or UHS-I type SD cards are preferable for high data rates.
References
1. Wikipedia:
https://en.wikipedia.org/wiki/Secure_Digital
2. TEACH-ICT – The very best KS3, GCSE and A Level
Computer Science resources.
3. SAMSUNG Galaxy J5 - 6 (New 2016 Edition)(Black,
16 GB) Specification snapshot from flipkart.com
4. SD Specifications Part A2 SD Host Controller
Standard Specification Version 3.0
5. JEDEC STANDARD EMBEDDED MULTI-MEDIA CARD
(e•MMC), ELECTRICAL STANDARD (4.5 device)
THANK YOU 
Have a look at
My PPTs:
http://www.slideshare.net/rampalliraj/
My Blog: http://practicepeople.blogspot.in/

More Related Content

What's hot

Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedAdrian Huang
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Linaro
 
Linux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKBLinux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKBshimosawa
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLinaro
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Linaro
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugginglibfetion
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in LinuxAdrian Huang
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdfAdrian Huang
 
Physical Memory Models.pdf
Physical Memory Models.pdfPhysical Memory Models.pdf
Physical Memory Models.pdfAdrian Huang
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver艾鍗科技
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequenceHoucheng Lin
 
BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE Linaro
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)Linaro
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardAnne Nicolas
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtAnne Nicolas
 

What's hot (20)

Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
Memory model
Memory modelMemory model
Memory model
 
Linux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKBLinux Kernel Booting Process (2) - For NLKB
Linux Kernel Booting Process (2) - For NLKB
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
 
semaphore & mutex.pdf
semaphore & mutex.pdfsemaphore & mutex.pdf
semaphore & mutex.pdf
 
Physical Memory Models.pdf
Physical Memory Models.pdfPhysical Memory Models.pdf
Physical Memory Models.pdf
 
用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver用Raspberry Pi 學Linux I2C Driver
用Raspberry Pi 學Linux I2C Driver
 
Uboot startup sequence
Uboot startup sequenceUboot startup sequence
Uboot startup sequence
 
BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE BUD17-400: Secure Data Path with OPTEE
BUD17-400: Secure Data Path with OPTEE
 
Linux dma engine
Linux dma engineLinux dma engine
Linux dma engine
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 

Similar to Linux Kernel MMC Storage driver Overview

建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card艾鍗科技
 
Introduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides pptIntroduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides pptOsama Yousaf
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersProfessorLance
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersProfessorLance
 
Basicarchitecturememory
BasicarchitecturememoryBasicarchitecturememory
BasicarchitecturememoryAditya Narang
 
ESXi on Dell internal dual SD module
ESXi on Dell internal dual SD moduleESXi on Dell internal dual SD module
ESXi on Dell internal dual SD moduleDavid Pasek
 
Android Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsAndroid Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsMoe Tanabian
 
Microprocessors evolution introduction to microprocessor
Microprocessors  evolution introduction to microprocessorMicroprocessors  evolution introduction to microprocessor
Microprocessors evolution introduction to microprocessorVijay Kumar
 
11 & 12
11 & 1211 & 12
11 & 12vonnej
 
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculation
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculationICT: Computer Hardware Services - Lesson 2 perform mesuration and calculation
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculationJe-Jireh Silva
 
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Ron Munitz
 
Проведение криминалистической экспертизы и анализа руткит-программ на примере...
Проведение криминалистической экспертизы и анализа руткит-программ на примере...Проведение криминалистической экспертизы и анализа руткит-программ на примере...
Проведение криминалистической экспертизы и анализа руткит-программ на примере...Alex Matrosov
 
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...Positive Hack Days
 
SCOSTA (Smart Card Operating System for Transport Applications)
SCOSTA (Smart Card Operating System for Transport Applications)SCOSTA (Smart Card Operating System for Transport Applications)
SCOSTA (Smart Card Operating System for Transport Applications)ALOK GUPTA
 
Grade11_Q1_W8_PerformMensuration_final.pdf
Grade11_Q1_W8_PerformMensuration_final.pdfGrade11_Q1_W8_PerformMensuration_final.pdf
Grade11_Q1_W8_PerformMensuration_final.pdfVictor Sinangote
 
Microcomputer & RAM Model
Microcomputer & RAM ModelMicrocomputer & RAM Model
Microcomputer & RAM ModelGaurav Bisht
 

Similar to Linux Kernel MMC Storage driver Overview (20)

建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card
 
Introduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides pptIntroduction to Computer Hardware slides ppt
Introduction to Computer Hardware slides ppt
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
 
Comp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answersComp 129 final exam 100% correct answers
Comp 129 final exam 100% correct answers
 
Internal memory
Internal memoryInternal memory
Internal memory
 
Basicarchitecturememory
BasicarchitecturememoryBasicarchitecturememory
Basicarchitecturememory
 
ESXi on Dell internal dual SD module
ESXi on Dell internal dual SD moduleESXi on Dell internal dual SD module
ESXi on Dell internal dual SD module
 
Android Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android AppsAndroid Forensics: Exploring Android Internals and Android Apps
Android Forensics: Exploring Android Internals and Android Apps
 
Nickcelle
NickcelleNickcelle
Nickcelle
 
Microprocessors evolution introduction to microprocessor
Microprocessors  evolution introduction to microprocessorMicroprocessors  evolution introduction to microprocessor
Microprocessors evolution introduction to microprocessor
 
I/O Management
I/O ManagementI/O Management
I/O Management
 
11 & 12
11 & 1211 & 12
11 & 12
 
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculation
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculationICT: Computer Hardware Services - Lesson 2 perform mesuration and calculation
ICT: Computer Hardware Services - Lesson 2 perform mesuration and calculation
 
What is CANopen? | ElmoMC
What is CANopen? | ElmoMCWhat is CANopen? | ElmoMC
What is CANopen? | ElmoMC
 
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
 
Проведение криминалистической экспертизы и анализа руткит-программ на примере...
Проведение криминалистической экспертизы и анализа руткит-программ на примере...Проведение криминалистической экспертизы и анализа руткит-программ на примере...
Проведение криминалистической экспертизы и анализа руткит-программ на примере...
 
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...
Positive Hack Days. Матросов. Мастер-класс: Проведение криминалистической экс...
 
SCOSTA (Smart Card Operating System for Transport Applications)
SCOSTA (Smart Card Operating System for Transport Applications)SCOSTA (Smart Card Operating System for Transport Applications)
SCOSTA (Smart Card Operating System for Transport Applications)
 
Grade11_Q1_W8_PerformMensuration_final.pdf
Grade11_Q1_W8_PerformMensuration_final.pdfGrade11_Q1_W8_PerformMensuration_final.pdf
Grade11_Q1_W8_PerformMensuration_final.pdf
 
Microcomputer & RAM Model
Microcomputer & RAM ModelMicrocomputer & RAM Model
Microcomputer & RAM Model
 

More from RajKumar Rampelli

Writing Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxWriting Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxRajKumar Rampelli
 
Introduction to Python - Running Notes
Introduction to Python - Running NotesIntroduction to Python - Running Notes
Introduction to Python - Running NotesRajKumar Rampelli
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2RajKumar Rampelli
 
Learn python – for beginners
Learn python – for beginnersLearn python – for beginners
Learn python – for beginnersRajKumar Rampelli
 
Introduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversIntroduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversRajKumar Rampelli
 
System Booting Process overview
System Booting Process overviewSystem Booting Process overview
System Booting Process overviewRajKumar Rampelli
 
Network security and cryptography
Network security and cryptographyNetwork security and cryptography
Network security and cryptographyRajKumar Rampelli
 
Tasklet vs work queues (Deferrable functions in linux)
Tasklet vs work queues (Deferrable functions in linux)Tasklet vs work queues (Deferrable functions in linux)
Tasklet vs work queues (Deferrable functions in linux)RajKumar Rampelli
 

More from RajKumar Rampelli (15)

Writing Character driver (loadable module) in linux
Writing Character driver (loadable module) in linuxWriting Character driver (loadable module) in linux
Writing Character driver (loadable module) in linux
 
Introduction to Python - Running Notes
Introduction to Python - Running NotesIntroduction to Python - Running Notes
Introduction to Python - Running Notes
 
Learn python - for beginners - part-2
Learn python - for beginners - part-2Learn python - for beginners - part-2
Learn python - for beginners - part-2
 
Learn python – for beginners
Learn python – for beginnersLearn python – for beginners
Learn python – for beginners
 
Linux watchdog timer
Linux watchdog timerLinux watchdog timer
Linux watchdog timer
 
Linux Kernel I/O Schedulers
Linux Kernel I/O SchedulersLinux Kernel I/O Schedulers
Linux Kernel I/O Schedulers
 
Linux GIT commands
Linux GIT commandsLinux GIT commands
Linux GIT commands
 
Introduction to Kernel and Device Drivers
Introduction to Kernel and Device DriversIntroduction to Kernel and Device Drivers
Introduction to Kernel and Device Drivers
 
System Booting Process overview
System Booting Process overviewSystem Booting Process overview
System Booting Process overview
 
Network security and cryptography
Network security and cryptographyNetwork security and cryptography
Network security and cryptography
 
Tasklet vs work queues (Deferrable functions in linux)
Tasklet vs work queues (Deferrable functions in linux)Tasklet vs work queues (Deferrable functions in linux)
Tasklet vs work queues (Deferrable functions in linux)
 
Sql injection attack
Sql injection attackSql injection attack
Sql injection attack
 
Turing awards seminar
Turing awards seminarTuring awards seminar
Turing awards seminar
 
Higher education importance
Higher education importanceHigher education importance
Higher education importance
 
C compilation process
C compilation processC compilation process
C compilation process
 

Recently uploaded

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 

Recently uploaded (20)

Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 

Linux Kernel MMC Storage driver Overview

  • 1.
  • 2. Outline 0 Storage Devices on mobile platform (smart phones, tablets etc.) 0 RAM 0 Internal Storage Devices 0 External Storage Devices 0 What is Flash Memory ? 0 Kernel storage driver overview (http://lxr.free- electrons.com/source/drivers/mmc/ ) 0 mmc device driver overview 0 Top view diagram 0 block diagram and Internal diagram 0 SD and SPI protocol 0 Mmc driver different Layers 0 Important functions to look for 0 Tuning procedure 0 SD Hot-plug 0 Sdhci controller role in Data transfer 0 SDMMC device registration 0 Sdhci probe() 0 How to configure/enable SDHCI support Note: To understand the few terms in this presentation, please refer to Introduction to Kernel & Device Drivers PPT (http://www.slideshare.net/rampalliraj/kernel-device-drivers): It covers what is Kernel, what is a Module and what is device driver .
  • 3. Storage Devices on Mobile Platforms 0 Mobile Platforms will have mainly Three storage devices for applications/users to store the Data 0 RAM (Random Access Memory): also known as main memory and primary memory. 0 Internal Storage device (Non-removable device) 0 External Storage device (Removable device) 0 RAM is Volatile memory i.e. data present in this device will be lost when power is removed/off. 0 Internal Storage Device: Mobile devices will have a built-in non-volatile memory called internal storage. 0 External Storage Device: Android devices may support removable non-volatile memory called external storage devices. 0 Example: Look at Memory & Storage specification of smartphone mobile. RAM: 2GB Internal Storage: 16GB External storage: upto 128GB Snapshot taken from Flipkart Samsung j5-6 mobile spec.
  • 4. What is Flash Memory ? 0 Flash Memory is a non-volatile, solid state storage device i.e. keeps its data without power. 0 Flash Memory is being used in wide range of devices. Examples are 0 Internal storage devices (eMMC or UFS) 0 USB sticks and SD Memory Cards 0 Digital audio players 0 Flash memory offers very high speed access to data. 0 Advantage: Flash memory, when packaged in a "memory card", is very resilient to damage, unlike many other storage devices. It can withstand extremes of temperature, being immersed in water or being accidentally dropped [2]. 0 Disadvantage: It has a limited number of read/write cycles which limits its useful life span.
  • 5. Internal Storage Device 0 Internal Storage mostly holds the android operating system so that the android device is able to access input and output devices. 0 System memory (see image) 0 It is also called as Device Memory (internal memory). 0 Go to settings page and select Storage option and you will see the internal storage capacity of your device. 0 It also stores the applications or data that user saves in it. 0 The data stored in internal storage can be accesses much faster than the data present in external storage device. 0 Internal storage device is directly connected to the mother board where as the external device connected through a hardware interface. 0 Disadvantage: If device fails to boot then all the data present in the internal storage device may be lost.
  • 6. Internal Storage Devices 0 Following are the storage devices which are mainly used for main storage devices on mobile platforms 0 eMMC: embedded Multi-Media Controller, refers to a package consisting of both flash memory and a flash memory controller integrated on the same silicon die. 0 UFS: Universal Flash Storage (UFS) is a flash storage like eMMC device with higher data rates compared to it. 0 SATA: Serial ATA is a computer bus interface that connects host bus adapters to mass storage devices such as hard disk drives, optical drives, and solid-state drives. 0 Will cover Linux Kernel eMMC (MMC storage)device drivers in this presentation.
  • 7. External Storage Device 0 Android devices may support the capability of adding more external storage via removable cards like SD memory cards. 0 SD card: Secure Digital (SD) is a non-volatile memory card format developed by the SD Card Association (SDA) for use in portable devices. 0 Advantage: External storage devices are portal i.e. data can be easily moved from one location to other location. 0 These storage devices are used for data backup 0 Disadvantage: Data transfer rate is slow compared to internal storage devices. SD card details found in settings->storage android
  • 8. How to identify SD card’s class? Preferable card: class 10 or UHS-I cards Class Minimum Serial Data Writing Speed Symbol on SD card Class 2 2MB/s Class 4 4MB/s Class 6 6MB/s Class 10 10MB/s UHS Speed Class 1 (U1) 10MB/s
  • 9. SD Memory card architecture Card Info registers Usage CID Card identification number RCA Relative card address published by the card during card identification process. DSR Driver stage register CSD Max data transfer rate and defines data format, error correction type, maximum data access/transfer time, Maximum read/write block length. SCR SD configuration register OCR Operation condition reg SSR SD status register CSR Card status register
  • 10. SD and SPI protocol SPI Protocol SD Protocol Design simple Complex Loss of performance: 1bit mode Wide bus option. Supports 1bit and 4bit modes. Card identification and addressing methods replaced by the h/w chip select CS signal Its own Card Identification process No broadcast commands Available Uses only 7 pins DAT1 and DAT2 are not used DAT3 used as CS DAT0 data transfer CLK line DataIn line (Host to card line) 9 pins model: DAT0-DAT3 lines for data transfer CLK line – clock line CMD line – command line 3 Power lines – supply voltage lines
  • 11. Storage Device Driver for eMMC and SD devices 0 Storage Device Driver ($kernel/drivers/mmc) is common for eMMC devices (internal storage device) and for SD memory cards (external storage device). 0 eMMC and SD are block devices i.e. mmc device driver communicates with these devices in the form of blocks of data (512 bytes) 0 Character device is one with which the driver communicates by sending/receiving single characters (bytes), eg: 0 mmc drivers receives the block requests from generic block layer (upper layer)
  • 12. mmc Device Driver Top View Kernel Space User Space Virtual File System Layer Generic Block Layer mmc device driver Hardware devices eMMC device SD memory card User applications
  • 13. mmc Device Driver block diagram Kernel Space Virtual File System Layer Generic Block Layer Hardware devices eMMC device SD memory card mmc device driver mmc Block/Queue driver mmc core driver mmc host driver SDHCI Host driver /mmc/card/block.c /mmc/card/queue.c /mmc/core/core.c /mmc/core/mmc.c /mmc/core/sd.c /mmc/host/sdhci.c
  • 14. mmc device driver overview 0 mmc queue receives block read/write/erase requests from the generic core block layer 0 mmc queue driver picks up one request from its queue and assign it to mmc block driver 0 mmc block driver analyze the type of request and forwards the request to mmc core driver. 0 mmc core driver has the protocol implementation for eMMC/SD devices detection, enumeration and data transfers to communicated with the actual Hardware device. 0 mmc core driver receives the request from block driver, prepares a mmc_request and forwards it to the mmc host driver. 0 mmc host driver initiates the transfer to device by programming Hardware controller registers. 0 Once the request get processed by the hardware controller, an interrupt gets generated . 0 mmc host driver receives request complete interrupt, analyzes it and pass the response to block driver. This process continues for all block requests. mmc Queue driver (queue.c) mmc core driver (core.c, mmc.c, sd.c) mmc host (controller) driver SDHCI Host driver sdhci.c mmc Block driver (block.c)
  • 15. mmc queue layer (/drivers/mmc/card/queue.c) 0 Important functions: 0 mmc_init_queue() 0 initializes the device queue 0 Creates and run the kernel thread (mmc_queue_thread) “mmcqd” to fetch block I/O requests from core block layer and pass it mmc block layer. 0 mmc_queue_thread() 0 Fetch block I/O requests using blk_fetch_request() 0 Pass the request to mmc block layer using callback issue_fn() -> redirects to -> mmc_blk_issue_rq() in mmc block driver
  • 16. mmc block layer (/drivers/mmc/card/block.c) 0 Important functions: 1) mmc_blk_probe() 0 Calls the mmc_queue_initialize() to initialize mmc queue. 0 Allocates the block devices (eMMC and SD card) and its partitions. 0 Initializes the mmc_blk_data (md) structure with required function callbacks for I/O requests, assigns MAJOR/MINOR info. md->queue.issue_fn = mmc_blk_issue_rq; md->disk->major = MMC_BLOCK_MAJOR; md->disk->first_minor = devidx * perdev_minors; 0 2) mmc_blk_issue_rq() – receives block I/O request from mmc queue thread from mmc queue driver. If I/O request type is ERASE then it calls mmc_blk_issue_discard_rq(). If I/O request is READ/WRITE then calls mmc_blk_issue_rw_rq() 0 2A) mmc_blk_issue_rw_rq() – prepares mmc block request and responsible for followings: Sets data block size to 512 (FIXED) 0 Retrieve block count information using blk_rq_sectors() 0 Assigns appropriate command flags and data flags 0 Sets the timeout for a Data command using mmc_set_data_timeout() function (defined in mmc core driver) 0 Assign the mmc block request to mmc core driver by calling mmc_start_req() function.
  • 17. mmc core layer (/drivers/mmc/core/*) 0 It Implements all SD/eMMC-dependent functionality, entire communication protocol is implemented in this layer. 0 Receives request in mmc_start_req() from mmc block layer 0 Before starting this new request, it checks for any ongoing request. Holds this new request until the ongoing request is processed. 0 It calls mmc host layer function sdhci_request() to program the command and its dependant parameters in the mmc controller register for initiating the command transfer. (/drivers/mmc/host/sdhci.c)
  • 18. mmc host layer (drivers/mmc/host/*) 0 It implements the driver for most known platform controllers and is platform dependent. 0 Important functions: 0 sdhci_add_host() : adds the sdhci host controller with the driver model. It initializes the sdhci h/w controller and enables sdhci interrupts. 0 sdhci_request(): It initiates the data transfer of received request by programming the command details in the corresponding h/w register. 0 Sets the SW timer to ensure that there is no infinite wait for the transfer complete interrupt 0 Prepares the data and sets SDMA or ADMA mode 0 sdhci_irq(): It receives the transfer complete interrupt and analyzes it for any errors. It sends the response of the transfer to block layer. 0 sdhci_execute_tuning(): Tuning procedure: It is required for reliable data transfers when interface freq is more than 50MHz. It determines the TAP value by issuing CMD19. 0 Controller issues CMD19 (SD/SDIO) or CMD21(eMMC) to get card’s tuning block at the current tap value X. Compares with its tuning block 0 If matches - Tuning is passed for the tap value X 0 Else - Tuning is not passed for the tap value X, try next tap X+1
  • 19. SD Host controller role @Data Transfer 0 Data location of system memory  DMA_SYSTEM_ADDR (If DMA supported) 0 Set Block size  BLOCK_SIZE 0 Set Block count  BLOCK_COUNT 0 Set argument value  ARGUMENT 0 Set TRANSFER_MODE value, determines 0 Single/Multi-Block transfer 0 Block count enabled ? 0 Data transfer direction 0 ACMD12(eMMC/SD) or CMD52(SDIO) enabled ? 0 DMA enabled ? 0 Set COMMAND  execution started 0 Wait for CMD complete Interrupt 0 Write 1 to the CMD_COMPLETE in Normal status Interrupt Register 0 Based on Read/Write CMD, the associated Registers/Interrupts enabled 0 Wait for Buffer Read Ready or Buffer Write Ready Interrupt 0 Clear Buffer Read Ready Status or Buffer Write Ready Status 0 Wait for TRANSFER_COMPLETE Interrupt 0 Clear TRANSFER_COMPLETE Status
  • 20. Mmc driver features 0 Host-Device interface is reliable when FREQ limits upto 50MHz 0 SD: High speed (HS) SD cards, class 4 cards 0 eMMC: eMMC devices with versions 4.41 or below 0 Tuning procedure is required when host-device interface runs at more than 50MHz. 0 SD: Ultra High Speed (UHS) SD cards, and class 10 SD cards. 0 eMMC: eMMC devices with versions 4.5 or more supports tuning 0 Mmc driver supports SD hot-plug feature, so that SD card can be inserted into already running device without powering of the device. 0 MMC driver supports voltage switching feature, if SD cards of type 10 or UHS-I inserted then voltage switching is invoked to switch voltage from 3.3 V to 1.8V for power optimization. 0 UHS SD cards runs at 1.8V 0 Clock gating is enabled: If there are no transactions on eMMC/SD interface then clock supply will be off, to save the power of the device.
  • 21. SDMMC devices registration 0 Device registration requires both device name and driver name should match 0 Device registration is done in board-<board-name>-sdhci.c 0 platform_device_register(&tegra_sdhci_device3); /* eMMC */ platform_device_register(&tegra_sdhci_device2); /* SD/SDIO */ platform_device_register(&tegra_sdhci_device0); /* SDIO/SD */ 0 Platform_device Structure: static struct platform_device tegra_sdhci_deviceX = { .name = "sdhci-tegra", .id = X, /* X = 0 or 1 or 2 or 3 */ .resource = sdhci_resourceX, .num_resources = ARRAY_SIZE(sdhci_resourceX), .dev = { .platform_data = &tegra_sdhci_platform_data3, }, }; 0 As part of device enumeration, we use discovery method to identify whether the device is eMMC or SD or SDIO.
  • 22. SDHCI probe() Probe() is called when device is recognized by the platform Driver’s init function gives kernel a list of devices it is able to service, along with a pointer to a probe function. Kernel then calls the driver’s probe function one for each device. 0 probe function starts the per-device initialization: 0 initializing hardware, allocating resources, and 0 registering the device with the kernel as a block device. 0 Kernel/drivers/mmc/host/sdhic-tegra.c  sdhci_tegra_probe() 0 Host controller initialization at kernel/drivers/mmc/host/sdhci.c  sdhci_add_host() 0 Device initialization starts in kernel/drivers/mmc/core/core.c  mmc_rescan() 0 Starts execution when Host detects the device. 0 mmc_attach_sdio()  sdio.c [core driver] 0 mmc_attach_sd()  sd.c [core driver] 0 mmc_attach_mmc()  mmc.c [core driver]
  • 23. How to enable SDHCI controller: MMC/SD Card support Configuration 0 Configure below variables for mmc devices (eMMC and SD devices share same sdhci controller) 0 MMC 0 MMC_SDHCI 0 MMC_SDHCI_PLTFM 0 Optional 0 MMC_DEBUG 0 MMC_BLOCK 0 drivers/mmc/Kconfig
  • 24. Conclusion 0 eMMC device is used for internal storage on mobile platforms 0 SD device (external SD cards) is used for external storage on mobile platforms 0 eMMC device and SD device both uses same driver on Linux platform. Pointer to this driver is http://lxr.free-electrons.com/source/drivers/mmc/ 0 eMMC and SD devices registers with block layer as a block devices. 0 Mmc driver sub-divided into three layers block (or queue) subsystem, core layer and host layer. 0 eMMC and SD uses SD protocol for communication. 0 Sdhci host controller communicates with eMMC and SD devices. 0 Class 10 or UHS-I type SD cards are preferable for high data rates.
  • 25. References 1. Wikipedia: https://en.wikipedia.org/wiki/Secure_Digital 2. TEACH-ICT – The very best KS3, GCSE and A Level Computer Science resources. 3. SAMSUNG Galaxy J5 - 6 (New 2016 Edition)(Black, 16 GB) Specification snapshot from flipkart.com 4. SD Specifications Part A2 SD Host Controller Standard Specification Version 3.0 5. JEDEC STANDARD EMBEDDED MULTI-MEDIA CARD (e•MMC), ELECTRICAL STANDARD (4.5 device)
  • 26. THANK YOU  Have a look at My PPTs: http://www.slideshare.net/rampalliraj/ My Blog: http://practicepeople.blogspot.in/

Editor's Notes

  1. Platform devices represent devices that are usually integrated into a given chip and therefore are always there. The platform-specific initialization code statically initializes such arrays of platform devices and then registers them in a row using platform_register. Therefore there is no need for sophisticated probing. Instead, the string contained in platform_device.name is compared platform_driver.driver.name and a match is assumed if they are equal.
  2. MMC support selects the generic Secure Digital Host Controller Interface. If you have a controller with this interface, say Y or M here. Selects the common helper functions support for SD host controller based platform and OF drivers Selects the Tegra SD/MMC controller.  If you have a Tegra platform with SD or MMC devices, say Y or M here.