Linux Sdio bus driver (i)

Source: Internet
Author: User

Sdio Card

Sdio card is in the SD memory card interface developed on the basis of the interface, SDIO interface compatible with the previous SD memory card, and can be connected to the Sdio interface device, currently based on the SDIO protocol Spec,sdio interface supports the total class of devices have Bluetooth, network cards, TV cards and so on.

SDIO protocol is an upgrade of the SD Card protocol evolution, many places have retained the SD card read and write protocol, while the SDIO protocol added on the SD card protocol CMD52 and CMD53 commands. Because of this, an important difference between the Sdio and SD card specifications is that the low-speed standard is increased, and the target application of low-speed cards is to support low-speed I/O capabilities with minimal hardware. Low speed cards support applications like modems, barcode scanners, and GPS receivers. High-speed card support network card, TV cards and "combination" card, etc., the combination card refers to the memory +sdio.

Another important difference between the Sdio and the SD card spec is the addition of low-speed standards. The Sdio card requires only SPI and 1-bit SD transfer mode. The target application for low speed cards is to support low-speed I/O capabilities with minimal hardware overhead, and low-speed cards support applications such as modems, bar scanners, and GPS receivers. Full speed and 4BIT operation are mandatory for both the card memory and the SDIO portion of the combo card.

In the SDIO device of the non-combination card, its maximum speed must reach only 25M, and the maximum speed of the card is the same as the highest speed of the SD card, higher than 25M.

Sdio Bus

similar to the SDIO bus and USB bus, the Sdio bus also has two ends, one end being the host side, the other end being the device side, and the host-device is designed to simplify device design. All communication starts with the host side issuing the command. On the device side, you can communicate with the host as long as you can solve the command of the stream host.

The host of the SDIO can connect multiple device, as shown in:

This is the same as the SD bus, which has the following several signals

1. CLK signal: The clock signal of the host to the device.

2. CMD signal: Two-way signal for transmitting commands and reactions.

3. DAT0-DAT3 signal: Four data cable for transmission.

4. VDD signal: power supply signal.

5. VSS1,VSS2: Power ground signal.

In the Sdio bus definition, the DAT1 signal line is multiplexed into a middle wire break. The DAT0 is used to transmit data in the Sdio 1BIT mode, and DAT1 is used as a wire break. In the 4BIT mode of Sdio, DAT0-DAT3 is used to transmit data, where DAT1 is used as medium break.

Sdio command:

The Sdio bus is the host side initiating the request, and then the device side responds to the request. Where the request and the response will be data information.

1. Command: The commands used to start the transfer are sent from the host side to the device side. Where commands are routed through the CMD signal line.

2. Response: The response is the command that the device returns as the host, as a response to a command. is also through

The CMD line is transmitted.

3. Data: It is transmitted in two directions. Can be set to 1-wire mode or set to 4-wire mode. The data is transmitted through the DAT0-DAT3 signal line.

Sdio each operation is initiated by the host on the cmd line a cmd, for some cmd,device need to return response, some do not need.

For a read command, the host first sends a command to the device, and then the device returns a handshake signal, and when the host receives a handshake signal for the response, it places the data on a 4-bit data line, which is followed by the CRC check code while the data is being transmitted. When the entire read transfer is complete, the host sends a command again notifying the device that the device will return a response.

For a write command, first the host sends a command to the device, and then the device returns a handshake signal, when the host receives a handshake signal from the response, the data is placed on a 4-bit data line, and the data is transferred along with the CRC check code. When the entire write transfer is complete, the host sends a command again notifying the device that the device will return a response.

Registers for Sdio:

the Sdio card's device driver 80% task is to operate the relevant registers on the SDIO card. Sdio cards are allowed to have up to 7 functions (function), which corresponds to their function number (0~7), each function corresponds to a 128K byte size register, this is shown in the figure below. The function number is 1~7, not 0, because feature 0 does not represent the true function, but represents the CIA register, the common I/O area, which records some of the basic information and features of the Sdio card and can rewrite the registers. Where address 0X1000~0X17FFF is the CIS region of Sdio card, is the basic information area, Common information Structure. Read and pair the SDIO device when initializing.

The detailed partitions of these registers have their corresponding functions, which need to be studied carefully during the development process, which are described in detail in the spec of the agreement, and are not in Russell.

CMD52 command:

Sdio devices are compatible with SD memory cards, all command and response are fully compatible with the SD card, and some new command and response are added. For example, initializing the SD memory card uses ACMD41, while the Sdio card device is initialized with a CMD5 notification to device.

But the most important difference is that the Sdio card has more CMD52 and CMD53 commands than the SD memory card, which makes it easy to access an address register for a feature.

The CMD52 command is the abbreviation for the Io_rw_direct command, and its command format is as follows

First the first bit is 0, indicating that it is the starting bit, the second is the transmission direction, here is 1, the direction for the host to the device devices, the next 6 is the command number, here is the 110100b, in decimal notation for the name of 52,cmd52 is also derived from this. followed by a read-write flag.

then the function number of the operation. That's functionnumber. If 0 is indicated as the CCCR Register group.

followed by the register address, with 17 indication, because the function register has a 128K address, 17 bits can be addressed.

Come down again. The 8-bit write data or staff bits means that if the current write operation is the data, otherwise 8 bits is the fill bit. No meaning.

The last 7 bits are CRC check codes. The last one for the end bit 0.

For CMD52 the response is 48 bits, the command format is as follows:

In summary, CMD52 is sent from host to device, and it must have the response returned by the device. CMD52 does not need to occupy the DAT line, read and write data is transmitted through CMD52 or response. Each time CMD52 can only read or write a byte.

CMD53 command:

CMD52 can read and write only one byte at a time, because CMD53 is extended to read and write, CMD53 allows to read or write multiple bytes or blocks at a time. The CMD53 command format is as follows:

The first bit is 1, is the start bit, then is a direction bit, always 1, represents the direction for the host to device devices, and then 6 is the command number, here is the 110101b, the name in decimal notation is 53,cmd53.

Then there is a 1-bit read-write flag. Next is the 3-bit function number, which is the same as the CMD52. Blockmode if 1 represents a block transfer mode, otherwise the byte transfer mode.

OP code for the operation bit, if it is 0, represents the data to the fixed position read and write, if 1 represents a geological increment read and write. For example, the address 0 is fixed read and write 16 bytes, equivalent to 16 read and write address 0, and the address 0 increment read and write 16 bytes, equivalent to read and write 0~15 address data.

Then there is a 17-bit address register, which can be addressed to a 128K byte address, then a 9-bit read-write count, and for byte reads, the read-write size is this count, and for blocks read and write, the size of the read and write is counted multiplied by the size of the block.

The next 7 bits are the CRC checksum code. The last one is 1.

When a read-write operation is a block operation, the size of the block can be set by setting the relevant registers in the FBR.

Unlike the CMD52 command, CMD53 does not return the command, here to determine whether device devices read and write completed is required to drive inside their own judgment, there are generally 2 methods, 1. Set the corresponding read and write interrupt. If device devices are read-write, an interrupt is sent to the host device. 2.HOST devices actively query device device whether read and write completed, you can use the cmd command whether there is a return to determine whether the device read and write completed.


Linux Sdio bus driver (i)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.