History log of /fuchsia/zircon/system/dev/block/sdmmc/sdio.c
Revision Date Author Comments
# eea209fa 13-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Do a soft reset before probing

On Vim2 Basic, very rarely during netboot, the CMD5(one of the init commands)on
sdio fails with no response and we fail to probe. To fix the issue, this changeset adds
a soft reset along with the hardware reset, before we probe. This changeset also adds a
sdmmc_request_helper which retries the request if the request fails.

Test: Prior to this change, on VIM2 basic, I have noted that
the sdio probe failed intermittently only during netboot. I have made sure that
when such an error occured, soft reset fixed the issue.

Change-Id: I2745bf674840c6ac7bf13312d092efae0eff7376


# 6f12bca8 14-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio]Perform tuning when setting ultra high speed

Currently on VIM2, at times, the wifi chipset does not run all the way.
This is mainly being attributed to power issues. Although not related,
switching to ultra-high speed in sdio is disabled as a safety measure
until the wifi stack is more stable. This changeset adds tuning
procedure when switching to ultra-high speed. Tuning procedure helps
determine any read delays required and the right frequency when the
ultra-high speed is re-enabled.

Test: On vim2, enabled ultra high speed and verified the wifi functionality.

Change-Id: I32f0dbafbcdde32c7d220e38a1c43fc57e492284


# d9f46c2a 10-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio]Disable ultra-high speed for now.

The wifi functionality seems to be flaky sometimes. There is a
difference in the firmware output for success and failure cases and most
likely has nothing to do with the ultra-high speed. Although there is no
direct evidence, this changeset disables ultra-high speed for now and
can be reenabled once things are stable.

Test: Build.Verified that the wifi functionality works the sameway with
this disabled.

Change-Id: Ib7c513a0d7cac65e1972fe697f0b1672acc07550


# 0d63d40e 11-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Publish max transfer size for pio mode

Currently, the low level controller driver publishes the max transfer size depending
on whether it supports DMA. For ex: the aml-sd-emmc driver publishes to
sdio, the max_transfer_size as "4096 * 512" if the hw supports dma or "1024" if the
hardware does not support dma. With SDIO, the upper level driver can choose
whether or not it wants to use dma. In the case where dma is supported
by the host, but the upper layer does not want it, we refer to max_transfer_size of
dma mode and we end up feeding the controller with more than what it can
submit in one command. This changeset always publishes the max_transfer_size of pio
mode. When sdio sees that the upper layer does not want to use dma, it
uses the max_transfer_size of pio mode to submit the request.

Test: On vim2, Added a test function to submit a large read and saw that the right
max size was picked up. Prior to this change, the calculation of num_blocks is wrong
and hence the command fails when it reaches the controller.

ZX-2598 #Done

Change-Id: Ibd9461812b4a1c7be9c393a117780eeffa83dcd6


# 46813018 10-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Remove get_oob_irq proto op from sdmmc and sdio protocols

Recent changes in platform bus, allows configuration of gpio pins from child
drivers and not just the board drivers. The handling of the oob irq is moved
to the wifi driver where it belongs. This changeset removes the unnecessary
protocol from sdmmc and sdhci as it is no longer needed.

Test: fx full-build.

Change-Id: Iac2f84e83c92ff05087093e9b753e9dac56a5f5e


# 3869bba7 10-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Remove unnecessary comment

multi-block support is re-enabled, but I forgot to remove the comment.
This changeset removes the comment.

Test: Local build

Change-Id: I9baadf2e9583bbcfdf3cba885bcbc0fe17b4191c


# 087753ab 29-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio]Fix multiblock support and re-enable it

When submitting a multiblock CMD53, the config register in the
controller should be updated to reflect the new block length.
This changeset also fixes how the multiblk command is submitted
in PIO mode.

Test: Modified the block size of sdio fn0 to be 8 and read 16 bytes of data
on vim2 with both dma and pio mode. Prior to this change the read fails.
More testing is in progress

Change-Id: Iefce824d547de88bebd468f1d16c5f2177bfb194


# 75ed0157 28-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Resolve crash when calling get_sdio_oob_irq

This changeset passes the correct protocol op while calling the
controller driver function.

Test: On vim2, Without this change, I see a crash when I call
sdio_get_oob_irq_host. With this change, I no longer see the crash and
the handle gets created succesfully.

Change-Id: I4789c6f1fa104b9f9877b018e4e1f67e350bed25


# 6eec09af 28-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Restrict the request sizes in pio mode to be 4-byte aligned

amlogic controller uses 2 512-byte buffers in mmio region for
transfering data in PIO mode. From amlogic documentation, these buffers
are 32 bit accessible. Copying byte by byte, looks like it succeeds but
the actual data does not get copied. For this reason, the request sizes
should be a multiple of 4 in PIO mode. For now, the restriction is also
added to dma transfers in sdio_rw_data. The reason for this is that, although
the upper layer wants to use dma, the astro board does not support dma yet,
and request is converted to PIO mode. Along with that, this change also
removes the unnecessary cache ops as the mmio region is mapped with
uncached policy.

Test: Tested that sdio probe was successful on vim2. Tested 16 byte read
with and without dma locally in my sdio code.

ZX-2548 #comment:Fix the write failures in PIO mode.

Change-Id: I7f4b0e93dc6ebb446692d23a9add6b7c1b27abf0


# 989ee4e8 13-Jun-2018 David Moore <davemoore@google.com>

[syscalls] Change vmar_... calls

- Create zx_vm_option_t type
- Change ZX_VM_FLAG_... to ZX_VM_... and make them new type.
- Change int32_t flags parameters to zx_vm_option_t options
- Make the options parameter be second.

- Modify vmar_..._old functions to keep other repos working.
Once they've all been updated these functions will go away.

ZX-2264
Test:CQ

Change-Id: I1faf4cc4e1e4dabf3d8ef680e398d83a545b0f09


# 9a647a80 28-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Use single byte command for shorter transfers

Use CMD52 for transfers that are less than 4 bytes. The
CMD53 uses ping pong buffers in aml-sd-emmc controller in the case of PIO mode.
From amlogic documentation it feels to me that the register space should be accessed
4 bytes at a time. So lets use multiple CMD52 instead of CMD53 for transfers less than
size 4 to avoid complications and controller errors. Otherwise, the write silently succeeds
but it does not write the actual data.

Test: Tested that the block size is written correctly on vim2 after the
change. Prior to this, the block sizes are wrong.

Change-Id: Ie8fa0bd38b2f2a3354e197eceafafcd13cd00a1f


# 91ea9f9d 20-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Disable multi block transfers for now

When sending multi block transfers, the transfers fail with CRC errors.
This changeset disables mbs while I am debugging the issue, and keeps
the wifi work going.

Test: Tested that a failed read succeeds when using single block
transfer on vim2.

Change-Id: I430c9fd8796bba650ddf4152aaf6c121157f708b


# d0cabdfe 13-Aug-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Use sdio_rw_direct command whenever possible

When using sdio_io_rw_extended command with single byte reads, the broadcomm
chipset does not complete the read request and does not raise an interrupt.
Neither does it fail the command with an error. This changeset uses the
sdio_rw_direct command for 1-byte reads to avoid this situation.

Test: Run brcmfmac driver on vim2. The driver made more progress. The
reading of the func1 misc register is not stuck anymore.

Change-Id: If38a6b9d3ee6d0b0d6f0f4fc4dfd6babe8553521


# 609cc892 16-Jul-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio]Add UHS support

This changeset adds support for ultra high speed for sdio.
Astro fails the read commands when frequency is more than 25Mhz,
mostly related to the PORT issues on it, which needs further investigation.

Test: Tested SDIO probing on Vim2 and Astro.

Change-Id: Ibb6cb4f79203ea76b300c3f0ea6fe06f772bcad5


# 518fbd95 29-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Add more protocol ops

This changeset adds proto ops for getting hw info and current blk size of sdio
device. I had to do some refactoring to make the data structures more
secure to use in the upper layers.

Test: sdio test on vim2 using the apis

Change-Id: If439f263b1a3cd8c90a975782b33f57c20d80af2


# 8c987f9c 29-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Add dma support for data I/O

This changeset adds dma support for data requests. Depending on whether
the controller supports dma, we either pass on or map the vmo.

Test: SDIO probe using dma on vim2

Change-Id: Ic08d0e1ff586109eddb96478fd5f6411118e4b9f


# 38f8753e 26-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Enable sdio on vim2 and astro

Now that all the changes to publish a sdio device are checked in,
This changeset enables sdio on vim2 and astro.

Test: Tested with a test bind driver that binds to the device published
by sdmmc layer on vim2 and astro

Change-Id: I271bb37233e0655438d9b722f92bb9d8c16706de


# 52e725bb 25-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Publish sdio child device

During the sdmmc bind function we add a block device. After the probe
is done when we know the device is an SDIO, we remove the block device
and an SDIO device with manufacturer id and product id as the props for
the upper layer to bind.

Test: SDIO probe on VIM2, astro. Wrote a basic test driver and ensured that published
device is able to bind to it.

Change-Id: I3fc14a9975ccc2e36ca040965d8c48d7b9439b3f


# 793b789f 21-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio] Add SDIO protocol

SDIO protocol provides read/write and other control functions for upper layers.
I will be using the protocol and publishing the sdio device in a future changeset.
This changeset also does not use DMA for data transfers. I will be adding that
in a separate changeset.

Test: SDIO probe on Estelle and VIM.

Change-Id: I1c895e642a4cf20b1be227a46256f8d34d1d578e


# 522cbc50 08-Jun-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][sdio]Add support for core sdio

This changeset probes and initializes the sdio functions. It also
implements the rw commands(CMD52 and CMD53) for control/IO operations
on SDIO

Change-Id: I8585c064602cae6256acc3074371d887aa014252