Commit Graph

177 Commits

Author SHA1 Message Date
Bhanusree Pola f54a740176 staging: mt7621-mmc: Prefer using BIT macro
Use BIT(x) instead of (1<<x), reported by checkpatch.pl.

Signed-off-by: Bhanusree Pola <bhanusreemahesh@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19 11:18:00 +01:00
YueHaibing db42646990 staging: mt7621-mmc: Remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-19 11:14:14 +01:00
George Hilliard 9a41352614 staging: Mediatek: Use individual config flags in Makefile
These drivers can be useful on other MT76xx SoCs, which have compatible
peripherals.  The drivers were selectable in Kconfig, but they were
quietly excluded from the build because the SOC_MT7621 chip was not
selected.  So, make the Makefiles use the same flags as Kconfig for
these drivers.

mt7621-dma and mt7621-dts are left alone because they truly do require
that SoC.

I have personally confirmed that the mt7621-spi driver works on the
MT7688, which was what prompted this change.

Cc: linux-kernel@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: NeilBrown <neil@brown.name>
Cc: sergio.paracuellos@gmail.com
Signed-off-by: George Hilliard <thirtythreeforty@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-18 11:01:02 +01:00
Jona Crasselt 215852f4b8 staging: mt7621-mmc: Correct spelling mistakes in comments
Changed "avaiable" to "available" and "interupt" to "interrupt".

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 18:11:58 +01:00
Jona Crasselt 012c5e8d81 mt7621-mmc: char * array declaration might be better as static const
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Jona Crasselt 515ba7e7f0 mt7621-mmc: return statement in void function unnecessary
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Jona Crasselt 43c978a16e mt7621-mmc: Alignment should match open parenthesis
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Jona Crasselt 71fbc63016 mt7621-mmc: Removed unnecessary blank lines
Issue reported by checkpatch.pl.

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Jona Crasselt 641e96e03a mt7621-mmc: Fix some coding style issues
Fix some comment-related issues reported by checkpatch.pl:
- Block comments use * on subsequent lines
- Block comments use a trailing */ on a separate line

Signed-off-by: Jona Crasselt <jona.crasselt@fau.de>
Signed-off-by: Felix Windsheimer <felix.windsheimer@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-20 16:32:13 +01:00
Nishad Kamdar e894075934 staging: mt7621-mmc: Fix incompletely removed #if 0 block in sd.c
Commit 2a54e3259e ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
does not completely remove an #if 0 block in sd.c. This causes the function
msdc_select_clksrc() which was eariler not compiled, to be compiled.
That causes an error - MSDC_CLKSRC_REG is not defined.

This patch completely removes the #if 0 block

Reported-by: NeilBrown <neil@brown.name>
Fixes: 2a54e3259e ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:57:41 +01:00
NeilBrown d17f5ff771 staging: mt7621-mmc: fix compile warnging: cmd_buf
cmd_buf is only used when MT6575_SD_DEBUG is defined.
So only declare it in that case.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:55:39 +01:00
NeilBrown a6bf882022 staging: mt7621-mmc: add missing header.
<linux/interrupt.h> is sometimes included by other include files,
and sometimes not, depending on config, particularly CONFIG_HIGHMEM.

So include it explicitly rather than relying on implicit inclusion.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:55:39 +01:00
NeilBrown 84519a4b0f staging: mt7621-mmc: set correct dma mask.
Since commit f8c55dc6e8 ("MIPS: use generic dma noncoherent ops for
simple noncoherent platforms") changed MIPS dma handling, the mmc
driver fails because it doesn't have a dma mask is set.

So set the correct dma mask.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:55:39 +01:00
Nícolas F. R. A. Prado 4e32a39881 staging: mt7621-mmc: Add blank line after declaration
Correct the following warning from checkpatch.pl:

WARNING: Missing a blank line after declarations
+		struct msdc_host *host = mmc_priv(mmc);
+		msdc_pm(state, (void *)host);

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@protonmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-07 12:27:33 +01:00
Nishad Kamdar 370a1b573d staging: mt7621-mmc: Use BIT macro instead of explicit shifting in dbg.h
Replace explicit shifting with BIT macro in dbg.h.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-14 13:30:34 +02:00
Nishad Kamdar 23f5fb5d87 staging: mt7621-mmc: Fix lines over 80 characters in dbg.h
This patch fixes lines over 80 characters in dbg.h.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-14 13:30:33 +02:00
Nishad Kamdar 01378deb37 staging: mt7621-mmc: Fix lines over 80 characters in dbg.c
This patch fixes lines over 80 characters in dbg.c.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-14 13:30:33 +02:00
Jaakko Tyynismaa 6b8b5fa2af staging: mt7621-mmc: Add blank line after declaration
Add blank line after declaration.
Reported by checkpatch.

Signed-off-by: Jaakko Tyynismaa <jaakko.tyynismaa@hotmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 15:13:24 +02:00
Nishad Kamdar ecfbc770df staging: mt7621-mmc: Remove #if 0 blocks in dbg.h
This patch removes #if 0 code blocks and usages of
functions defined in the #if 0 blocks in dbg.h.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 15:13:24 +02:00
Nishad Kamdar c668906916 staging: mt7621-mmc: Remove #if 0 blocks in dbg.c
This patch removes #if 0 code blocks and usages of
functions defined in the #if 0 blocks in dbg.c

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 15:13:24 +02:00
Nishad Kamdar 2a54e3259e staging: mt7621-mmc: Remove #if 0 blocks in sd.c
This patch removes #if 0 code blocks and usages of
functions defined in the #if 0 blocks in sd.c.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-09 15:13:24 +02:00
Nishad Kamdar ee607b8fb5 staging: mt7621-mmc: Remove unused single statement macros
This patch removes unused single statement macros in sd.c

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02 15:16:20 -07:00
Nishad Kamdar afa163e3f8 staging: mt7621-mmc: Remove single statement macro msdc_irq_restore()
This patch removes the macro msdc_irq_restore() and replaces its
usage with call to the function called in the macro definition.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02 15:16:20 -07:00
Dafna Hirschfeld 7b6e286c39 staging: mt7621-mmc: replace `printk` with preferred API
Replace calls to `printk` with `dev_info` and `pr_err`
Issues found with checkpatch.pl

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02 14:53:18 -07:00
Dafna Hirschfeld ffa8ed13d9 staging: mt7621-mmc: Fix comparison to NULL
Replace comparisons of a variable 'x' to NULL with
either 'x' or '!x'.
Issues found with checkpatch.pl

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02 14:53:18 -07:00
Dafna Hirschfeld f259e47af3 staging: mt7621-mmc: remove unnecessary braces from 'if' statements
Remove unnecessary braces from one line 'if' statements.
Issues found with checkpatch.pl

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-02 14:53:18 -07:00
Nishad Kamdar 5f1a9140dd staging: mt7621-mmc: Delete IRQ_MSG() and its users
This patch removes IRQ_MSG() and its users as currently it is a no-op.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-20 12:28:02 +02:00
Nishad Kamdar bc554d1e94 staging: mt7621-mmc: Fix debug macro ERR_MSG and its usages
Replace all usages of ERR_MSG with with dev_<level> without __func__
or __LINE__ or current->comm and current->pid. Remove the do {}
while(0) loop for the single statement macro. Delete commented
ERR_MSG() usage. Drop ERR_MSG from dbg.h. Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-10 17:04:21 +02:00
Nishad Kamdar 72536ea687 staging: mt7621-mmc: Delete N_MSG() and all its users
This patch removes N_MSG() and all its users since it is a no-op.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-10 17:02:52 +02:00
Nishad Kamdar 13c7a0ecdf staging: mt7621-mmc: Remove macro INIT_MSG and its usages
Removed all usages of INIT_MSG and dropped it from dbg.h.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:35:51 +02:00
Sumit Pundir b9e50d0cfd staging: mt7621-mmc: place a check for sscanf
Placed a check for the return value of sscanf. -EINVAL is returned if
the value is anything other than expected. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:31:59 +02:00
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