Commit Graph

146 Commits

Author SHA1 Message Date
Nishad Kamdar 910ca496b8 staging: mt7621-mmc: Use BIT macro instead of explicit shifting in board.h
Replace explicit shifting with BIT macro in board.h.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-29 10:08:02 +02:00
Sergej Perschin b3cd051dc3 staging: mt7621-mmc: Fix printk() facility level
The patch fixes the following issue:
WARNING: printk() should include KERN_<LEVEL> facility level

Signed-off-by: Sergej Perschin <ser.perschin@gmail.com>
Signed-off-by: Marcel Budoj <marcel.budoj@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-06 17:32:24 +02:00
Christian Lütke-Stetzkamp 370713270e staging: mt7621-mmc: Find response of SD_APP_OP_COND by default
The response type of the SD_APP_OP_COND command is correctly
determined using the mmc_resp_type macro, because the only use of that
opcode, mmc_send_app_op_cond, correctly places MMC_RSP_R3 in cmd.flags.

So there is no need to treat that opcode separately.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp c3f28802a1 staging: mt7621-mmc: Find response of MMC_SEND_OP_COND by default
The response type of the MMC_SEND_OP_COND command is correctly
determined using the mmc_resp_type macro, because the only use of that
opcode, mmc_send_op_cond, correctly places MMC_RSP_R3 in cmd.flags.

So there is no need to treat that opcode separately.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 256e086636 staging: mt7621-mmc: Factor out from msdc_command_start()
Currently msdc_command_start does multiple things and is hard to read,
so factor out the finding of the response type.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 38ee87eaad staging: mt7621-mmc: Remove unused argument from msdc_do_command
The argument tune of msdc_do_command is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 008f3853de staging: mt7621-mmc: Remove unused macro is_card_present
The macro is_card_present is unused and also a duplicate of a macro in
mmc, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 2de186940b staging: mt7621-mmc: Remove unused define MAX_PHY_SGMTS
The define MAX_PHY_SGMTS is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 4bd8897a7d staging: mt7621-mmc: Remove unused enum msdc_mode
The enum msdc_mode is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp ed940e7547 staging: mt7621-mmc: Remove unused define IRQ_SDC
The define IRQ_SDC is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp a76187ffa5 staging: mt7621-mmc: Remove unused define RALINK_MSDC_BASE
The define RALINK_MSDC_BASE is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:05 +09:00
Christian Lütke-Stetzkamp 2dfc73d5bb staging: mt7621-mmc: Cleanup source of base address for io
Currently the base address for all io operations is hidden behind a
macro, REG_ADD. This macro uses the symbol "base" as the base address
and all functions set base = host->base. This is hard to read, so the
whole wrapping is removed and host->base is directly inserted in the
io access.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp 8a5b9f049b staging: mt7621-mmc: Remove MSDC_MODE_* defines
The MSDC_MODE_* defines are all never used and do not contain any
information about the device, so remove them.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp 6aab8b5308 staging: mt7621-mmc: Remove unused variable from msdc_tune_request
The variable cmd in the function msdc_tune_request is set but never
used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp a98c143734 staging: mt7621-mmc: Remove unused macro MAX_BD_PER_GPD
The macro MAX_BD_PER_GPD is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp 6a1636fa11 staging: mt7621-mmc: Remove unused macro msdc_retry
The macro msdc_retry is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp e327df5e88 staging: mt7621-mmc: Make msdc_clr_fifo a function and relax cpu
In the current code, msdc_clr_fifo is a macro and just busy waits for
a limited amount of time for the fifo clear to finish. That is not
correct, the programming manual hits, that the user should wait until
the bit is cleared by hardware and not a limited amount of time.

So the code is changed to a function, that also relaxes the cpu while
busy waiting.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp 41015d06e6 staging: mt7621-mmc: Remove unnecessary BUG_ON() in msdc_dma_setup
The BUG_ON() removed by this patch is just a duplicate of a prior
BUG_ON() statement. There the condition is just clearer, it checks
weather sglen > MAX_BD_NUM and MAX_BD_NUM is equal MAX_BD_PER_GPD. So
this statement can be safely removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp d812c6a9bb staging: mt7621-mmc: Remove variable num form msdc_dma_setup
The variable num in msdc_dma_setup is only used for a BUG_ON
statement, so it can be removed by inlining the condition.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp fe219842d6 staging: mt7621-mmc: Remove unused field sglen from msdc_dma
The field sglen from struct msdc_dma is once set and never read, so
remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp acbd652b03 staging: mt7621-mmc: Remove unused field sg from msdc_dma
The field sg from struct msdc_dma is once set and never read, so
remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:04 +09:00
Christian Lütke-Stetzkamp 8cfba8ac75 staging: mt7621-mmc: Refactor dma setup process
Current code uses two functions for dma setup, msdc_dma_config and
msdc_dma_setup. By now msdc_dma_setup is nearly empty and mainly calls
msdc_dma_config, so the later one can be inline into the first
one. While doing this there is also some refactoring done.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 1668d5fc7b staging: mt7621-mmc: Remove unused field mode from msdc_dma
The field mode of struct msdc_dma has no remaining use, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp f3e1b5766c staging: mt7621-mmc: Remove DMA basic mode code
The driver currently only uses DMA linked mode and the upstream
driver does the same, so remove the basic mode code.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp b9ec4b8378 staging: mt7621-mmc: Remove register debugging structures
Current code has structures for all the registers of the device, but
these are never used and there are also masks for all of them, so
these structures do not contain any useful information.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 9705766bfb staging: mt7621-mmc: Remove unused macro sdr_write8
The macro sdr_write8 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 85e25ffc99 staging: mt7621-mmc: Remove unused macro sdr_read8
The macro sdr_read8 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp e988d35a62 staging: mt7621-mmc: Replace sdr_read32 with readl
The current code uses a macro (sdr_read32) for reading from hardware,
but it is only a readl, so replace it to get nearer to upstream code.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 8fbcf12087 staging: mt7621-mmc: Replace sdr_write32 with writel
The current code uses a macro (sdr_write32) for writing to hardware,
but it is only a writel with switched arguments, so replace it to get
nearer to upstream code.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 09cb808cfd staging: mt7621-mmc: Remove unused macro msdc_rxfifocnt
The macro msdc_rxfifocnt is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp 98336f9924 staging: mt7621-mmc: Remove unused macro msdc_txfifocnt
The macro msdc_txfifocnt is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:03 +09:00
Christian Lütke-Stetzkamp dbed911180 staging: mt7621-mmc: Remove unused macro msdc_fifo_read32
The macro msdc_fifo_read32 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:02 +09:00
Christian Lütke-Stetzkamp bbe95e2421 staging: mt7621-mmc: Remove unused macro msdc_fifo_write32
The macro msdc_fifo_write32 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:02 +09:00
Christian Lütke-Stetzkamp 12c3ab44fa staging: mt7621-mmc: Remove unused macro msdc_fifo_read8
The macro msdc_fifo_read8 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:02 +09:00
Christian Lütke-Stetzkamp 73384e5275 staging: mt7621-mmc: Remove unused macro msdc_fifo_write8
The macro msdc_fifo_write8 is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:02 +09:00
Christian Lütke-Stetzkamp 2e477f9ee5 staging: mt7621-mmc: Remove unused variable in msdc_command_resp
The variable resp in msdc_command_resp is once set and never read,
delete it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-28 21:48:02 +09:00
Sankalp Negi a5a5b283a2 staging: mt7621-mmc: Fix line size exceeding 80 columns
This patch fixes checkpatch.pl warning and check:
WARNING: line over 80 characters
CHECK: Alignment should match open parenthesis

Signed-off-by: Sankalp Negi <sankalpnegi2310@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-01 10:52:48 +02:00
Colin Ian King e709e7fe49 staging: mt7621-mmc: fix spelling mistake: "Illgal" -> "Illegal"
Trivial fix to another spelling mistake in N_MSG message text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-25 18:44:13 +02:00
Colin Ian King dbbfae6af1 staging: mt7621-mmc: fix spelling mistake: "Eanable" -> "Enable"
Trivial fix to spelling mistake in N_MSG message text

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-20 14:44:12 +02:00
Christian Lütke-Stetzkamp b06b46059b staging: mt7621-mmc: Remove unused barrier macros
The current code has some barrier macros in it, which are already '#if
0' out, so just remove them.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp f18898631a staging: mt7621-mmc: Cleanup includes
This commit cleans the includes in the sd.c file. Those which are not
needed are removed, the remaining ones are sorted alphabetically.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp 47b7bae694 staging: mt7621-mmc: Remove unused macro HOST_MAX_NUM
The macro HOST_MAX_NUM is never used, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp a0381e2e28 staging: mt7621-mmc: Always use linked DMA mode
Current code uses linked DMA mode only when there is more than one
entry in the scatterlist. But the overhead of the linked DMA is very
small, so the code is easier when only using linked DMA and this is
also the way, the upstream driver mtk-sd handles it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp 759c05d317 staging: mt7621-mmc: Change return value of msdc_dma_config to void
The msdc_dma_config function currently returns always 0. Remove the
return and change to void.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp 37c6325b58 staging: mt7621-mmc: Don't disables DMA
Current code disables the DMA after the transfer. That only changes
the transfer mode to non-DMA and does not save any power. This is not
necessary any more, because now DMA transfer is always used. The macro
for disabling DMA transfer is also removed, because it is not used any
more.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp 32a966cb00 staging: mt7621-mmc: Inline function msdc_set_blknum
The function msdc_set_blknum consists of one (real) line of code and
is only called once, so inline it makes the code shorter and more
readable.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp 96a9789306 staging: mt7621-mmc: Remove initialisation in msdc_dma_config
Current code initialises the variable sg at the beginning of the
msdc_dma_config function. This is not necessary, because the variable
is assigned by the for_each_sg macro later on.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:07 -07:00
Christian Lütke-Stetzkamp f71774ac8a staging: mt7621-mmc: Remove redundant check for card status
Current code checks the card status at the beginning of
msdc_ops_request. This is not necessary because mmc core always checks
the card status before calling this operation.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:06 -07:00
Christian Lütke-Stetzkamp eafda89222 staging: mt7621-mmc: Do not BUG() if mrq set in msdc_ops_request
Currently the code BUG()'s, if host->mrq is set at the beginning of
msdc_ops_request. This shoould normally not happen, but it is not that
critical, because the critical sections are protected by a spin lock
and in the worst case, some commands to the card are lost, so it is
sufficient to just WARN_ON().

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:06 -07:00
Christian Lütke-Stetzkamp ec7375d1f5 staging: mt7621-mmc: Remove unused sdio irq code
Currently the code for the sdio irq is never used, because the flags
for it (MSDC_(EXT_)SDIO_IRQ) are never set. So the whole code for it
can be removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06 19:08:06 -07:00