]> git.baikalelectronics.ru Git - kernel.git/commit
mmc: dw_mmc: don't hard code fifo depth, fix usage
authorJames Hogan <james.hogan@imgtec.com>
Fri, 24 Jun 2011 12:57:18 +0000 (13:57 +0100)
committerChris Ball <cjb@laptop.org>
Wed, 20 Jul 2011 21:20:59 +0000 (17:20 -0400)
commit86f49395fae4681e38d73ae929ea6a72a1a16b5c
tree15d9f279e07948eb0649bafa0c14d9a785afda0a
parentc621fc2ac59d2913dad1eea4552f5a753b2983da
mmc: dw_mmc: don't hard code fifo depth, fix usage

The FIFO_DEPTH hardware configuration parameter can be found from the
power-on value of RX_WMark in the FIFOTH register. This is used to
initialise the watermarks, but when calculating the number of free fifo
spaces a preprocessor definition is used which is hard coded to 32.

Fix reading the value out of FIFOTH (the default value in the RX_WMark
field is FIFO_DEPTH-1 not FIFO_DEPTH). Allow the fifo depth to be
overriden by platform data (since a bootloader may have changed FIFOTH
making auto-detection unreliable). Store the fifo_depth for later use.
Also fix the calculation to find the number of free bytes in the fifo to
include the fifo depth in the left shift by the data shift, since the
fifo depth is measured in fifo items not bytes.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Acked-by: Will Newton <will.newton@imgtec.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h
include/linux/mmc/dw_mmc.h