1
0
Fork 0
Commit Graph

174 Commits (579b9239c1f38665b21e8d0e6ee83ecc96dbd6bb)

Author SHA1 Message Date
Christian Lütke-Stetzkamp 884c06af72 staging: mt7621-mmc: Add annotations about held locks
The functions msdc_command_resp and msdc_do_request are always called
with the host->lock lock held. By adding annotations, sparse is
informed about that.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:36:20 +02:00
Christian Lütke-Stetzkamp 0b78f05d51 staging: mt7621-mmc: Correct datatypes for io and sanitize io access
Current code discard the address space information on the base address
of the mmc controller, that causes sparse warnings. It uses the raw
read write function, that is correct for the mips architecture (little
endian), but for portability the non-raw function should be used. Also
the clear/set bit macros do direct memory access, that is also correct
for mips, but not portable.

So the type of the base address is changed to void __iomem *, that is
the type returned by the ioremap function. The set/clear bit macros
are changed to functions, that use the portable read and write
functions. The use of the raw access functions is changed to use the
non-raw ones.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:36:19 +02:00
Christian Lütke-Stetzkamp 78f350830e staging: mt7621-mmc: Replace dma dir with mmc_get_dma_dir
Currently the dma direction is manually determined by the read status,
there is a more portable function for it, mmc_get_dma_dir, use it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:36:19 +02:00
Christian Lütke-Stetzkamp c302214c9d staging: mt7621-mmc: Fix dma_map_sg may map to fewer entries
The dma_map_sg function may merge several sglist entries into one, the
return value has to be saved to consider that. The data->sg_count
field is the position, where it should be saved, like it is done in
other mmc host drivers. Also the count of mapped entries is needed for
the dma setup.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:36:19 +02:00
Christian Lütke-Stetzkamp 05e41c96a6 staging: mt7621-mmc: Remove multiple assignments
Fix checkpatch: multiple assignments should be avoided, to improve
readability.
It aslo moves the second assignment out of the if/else block, that is
valid, because drv_mode is of type msdc_mode, an enum with only those
three elements, so one of the if/ else if statements is always
taken. And the second assignment can happen after the conditions.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Reviewed-by: NeilBrown <neil@brown.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25 15:36:19 +02:00
Christian Lütke-Stetzkamp afcc0ca1c8 staging: mt7621-mmc: Fix dereference before check in msdc_drv_pm
In the msdc_drv_pm function the variable mmc is dereferenced before
checked. Reordering fixes that.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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-04-25 15:36:19 +02:00
Christian Lütke-Stetzkamp 7860778b17 staging: mt7621-mmc: Remove unused field dma_addr of msdc_host
The dma_addr field of msdc_host 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-04-23 15:37:57 +02:00
Christian Lütke-Stetzkamp c8f203a6f0 staging: mt7621-mmc: Remove unused field cmd_rsp_done of msdc_host
The cmd_rsp_done field of msdc_host 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-04-23 15:37:57 +02:00
Christian Lütke-Stetzkamp 5045adc1c8 staging: mt7621-mmc: Remove unused field cmd_r1b_done in msdc_host
The field cmd_r1b_done in msdc_host is unused, so remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:57 +02:00
Christian Lütke-Stetzkamp 095fbc1d4e staging: mt7621-mmc: Remove unused field dma_left_size of msdc_host
The dma_left_size field of msdc_host is never used, remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:55 +02:00
Christian Lütke-Stetzkamp c89f0ec952 staging: mt7621:mmc: Remove unused field reserved from msdc_host
The reserved field of msdc_host is never used and msdc_host is also
never exposed to hardware, so remove that field.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:55 +02:00
Christian Lütke-Stetzkamp ed4ba29e02 staging: mt7621-mmc: Remove unused field starttime from msdc_host
The starttime field of msdc_host is never used, remove it.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:55 +02:00
Christian Lütke-Stetzkamp 8cfb4937af staging: mt7621-mmc: Change default transfer mode to DMA
The current default transfer is to use DMA or not depending on the
size of the data. The upstream driver mtk-sd uses DMA all times,
change the standard mode here to DMA for testing, if there are any
performance problems with DMA for small data sizes. If not, the option
for transfer mode should be removed in the future,

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:55 +02:00
Christian Lütke-Stetzkamp 8f2395586c staging: mt7621-mmc: Refactor msdc_init_gpd_bd
The msdc_init_gpd_bd function is currently hard to read, because of
old, commented out code and a while loop, where a for loop is much
easier to read. Refactor it to make the code more readable.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:54 +02:00
Christian Lütke-Stetzkamp 134cca657d staging: mt7621-mmc: Remove unused field xfersz from msdc_dma
The xfersz field of msdc_dma is only set to host->xfer_size and this
is also available at the (few) positions, where dma.xfersz is used, so
it is removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp 6fdbd49bee staging: mt7621-mmc: Remove flags from msdc_dma
The flags of msdc_dma are set to a constant value, so block and dword
padding are disabled and checksum is enabled. By removing the field
the code is easier to read and the difference to the mtk-sd driver is
smaller.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp 4e7fd0f3e0 staging: mt7621-mmc: Remove unused fields from msdc_dma
The fields used_gpd|bd in struct msdc_dma are only set and reset, but
never used, so remove them. The other removed fields are never used,
so they were removed either.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp 71b0621e21 staging: mt7621-mmc: Start cleanup of msdc_dma_config
Currently the msdc_dma_config function has some variables, that are
not needed, uses the macro msdc_init_bd that is only used here and
does not use the for_each_sg iterator. That last fact could cause a
bug if the scatterlist is chained.

The function is changed to remove these things, but none of the
changes should change the behavior of it (despite the case of a linked
scatterlist).

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp f4516eb54c staging: mt7621-mmc: Remove unused function msdc_dma_dump
The msdc_dma_dump function is disabled by a preprocessor macro, was
only used in the msdc_dma_setup function. The code also contains no
information about the device, it only dumps some memory for debug.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp 75744bc711 staging: mt7621-mmc: Remove unused field burstsz from msdc_dma
The burstsz field in msdc_dma is set to a constant value and later
only used two times, using the constant directly in that places allows
to remove the field and improves readability.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp ab71f5d73f staging: mt7621-mmc: Remove unused field data_offset from msdc_hw
The data_offset field in msdc_hw 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-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp d1eade674e staging: mt7621-mmc: Relax cpu while waiting for stable clock
Current code just busy waits with nop for clock becoming stable,
relaxing the cpu here improves readability and portability and also
removes a unnecessary difference with the mtk-sd driver.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp f3698ccbd0 staging: mt7621-mmc: Remove code for not existent config
The MT7621|7628_FPGA config flags are non existent in the tree, so
code guarded by this flags can be removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:49 +02:00
Christian Lütke-Stetzkamp a7e7c2619f staging: mt7621-mmc: Refactor and rename msdc_reset to msdc_reset_hw
In the current code the hardware reset is realised via a macro and
does only wait for a certain ammount of time for the controller to
come out of reset state, but it should wait until it IS out of reset
state. So it is refactored to improve this, it is also changed from a
macro to a function and renamed to msdc_reset_hw to match the mtk-sd
driver.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp aae92e8cea staging: mt7621-mmc: Remove power callbacks from msdc_hw
The ext_power_on|off fields of msdc_hw are never set, and only once
checked for not being zero, so they can just be removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp c65f33aaaa staging: mt7621-mmc: Fix null pointer deref if ext sdio irq enabled
The enable|disable_sdio_irq() fields of msdc_hw are never set, so when
they are called, they are null pointer. In case of the
MSDC_EXT_SDIO_IRQ flag set in msdc0_hw, this happens. But because
these fields are never set, they can simply be removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp e254adf415 staging: mt7621-mmc: Remove unused field disable_cd_eirq
The disable_cd_eirq() field of msdc_hw is never set and only once
checked for being non zero, so it is deleted.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp ce16cb8df4 staging: mt7621-mmc: Remove unused field enable_cd_eirq from msdc_hw
The enable_cd_eirq() field of msdc_hw is never set and only once
checked for not being zero, so it is removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp 4c02a65fb2 staging: mt7621-mmc: Remove unused field get_cd_status from msdc_hw
The get_cd_status() field of msdc_hw is never set and there is only
one check for it being non zero, so it is deleted.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp d1a0db1eb3 staging: mt7621-mmc: Remove unused code from board.h
The board.h file contins lot of never used code, to clean up the
driver, this code is removed.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:37:48 +02:00
Christian Lütke-Stetzkamp f89ce734cb staging: mt7621-mmc: Remove redundant opcode check
The opcode check in msdc_command_start is redundant in case of
MMC_SET_RELATIVE_ADDR, this is 3 like SD_SEND_RELATIVE_ADDR, so the
second check can be removed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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-04-23 15:36:31 +02:00
Christian Lütke-Stetzkamp 0e0836625b staging: mt7621-mmc: Fix: copy_from_user() returns a positive value
copy_from_user() returns a positive value in case of an error, to fix
this the check is turned around, also a better return value is chosen.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
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-04-23 15:36:31 +02:00
Christian Lütke-Stetzkamp 2436c3156e staging: mt7621-mmc: Fix debug file world writable
Currently the debug file in proc fs is world writable, remove the
access for other.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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-04-23 15:36:31 +02:00
Christian Lütke-Stetzkamp e1b8ebd25d staging: mt7621-mmc: Remove error message in debug
If the debug file in proc fs is not successfully created current code
prints an error message, this is removed. de is also not an error
pointer, so the IS_ERR() call leads to a static checker warning. The
unused return value of the msdc_debug_proc_init function is also removed.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
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-04-23 15:36:31 +02:00
Christian Lütke-Stetzkamp 997ae819a8 staging: mt7621-mmc: Remove constant flag MSDC_HIGHSPEED
The MSDC_HIGHSPEED flag is always set and never unset, remove it to
clean up the code.

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-04-23 15:36:28 +02:00
Christian Lütke-Stetzkamp bda8a65f1b staging: mt7621-mmc: Remove unused functions
The functions msdc_eirq_cd and msdc_eirq_sdio are defined but never
used, so they are removed. This also fixes two compiler warnings:

drivers/staging/mt7621-mmc/sd.c:517:13: warning: ‘msdc_eirq_cd’ defined but
not used [-Wunused-function]
 static void msdc_eirq_cd(void *data)
             ^~~~~~~~~~~~
drivers/staging/mt7621-mmc/sd.c:507:13: warning: ‘msdc_eirq_sdio’ defined but
not used [-Wunused-function]
 static void msdc_eirq_sdio(void *data)

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-04-23 15:36:28 +02:00
Christian Lütke-Stetzkamp 09a2e08949 staging: mt7621-mmc: Remove unused global: msdc_6575_host
The mt6575_host variable is never used, only set and
exported. Removing it for code cleanup.

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-04-23 15:36:28 +02:00
Christian Lütke-Stetzkamp e8f5f1c53d staging: mt7621-mmc: Remove constant flag
The MSDC_SYS_SUSPEND flag is always set and is never unset. Removing
it cleans up the code.

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-04-23 15:36:28 +02:00
Christian Lütke-Stetzkamp c53c6e7fac staging: mt7621-mmc: Fix power management by removing old api
The mmc_suspend|resume_host functions have been decrepated in the
3.11 [1] release and were completely removed in 3.13 [2]. Removing the
calls to this functions as it was done for other mmc host drivers
before the old api was removed (eg. [3]) fixes compile errors in this
driver while CONFIG_PM is enabled.

The rest of the removed code is simply dead, the MSDC_SYS_SUSPEND flag
is always set and will be removed in a later patch.

[1] commit 986892ca78 ("mmc: core: Initiate suspend|resume from mmc bus instead of mmc host")
[2] commit 3c0d22e818 ("mmc: core: Remove deprecated mmc_suspend|resume_host APIs")
[3] commit 1e63d48542 ("mmc: au1xmmc: Move away from using deprecated APIs")

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-04-23 15:36:28 +02:00
Christian Lütke-Stetzkamp bfd9337061 staging: mt7621-mmc: Remove duplicate defines
Remove defines that are both in board.h and sd.c from sd.c, this file
already includes board.h

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp 5ac2eb2917 staging: mt7621-mmc: Fix requesting of irq
The request of the irq line is not correctly handled by the current
code, platform_get_irq may fail and if the irq is requested via
devm_request_irq, its release is automatically done.

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp 9270784105 staging: mt7621-mmc: Fix dma_alloc_coherent should get device as first param
The dma_alloc_coherent (and also dma_free_coherent) should get the
device, the dma memory is allocated for as the first parameter.

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp a03a683999 staging: mt7621-mmc: Remove dead codepath from probe function
The probe function contains lots of code, that is never used, because
the fields it checks for in the msdc_hw structure are never
initialized. Removing them should be safe.

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp 5e5c114d54 staging: mt7621-mmc: Fix different caps for different devices
Current code saves the need for polling in a global variable, that
leeds to problems, when the driver should handle multiple devices with
different capabilities. By looking up the capability in the mmc_host
capabilities, they now have per device scope.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp c13b45c555 staging: mt7621-mmc: Remove unnecessary field from struct msdc_hw
Remove the unnecessary field data_pins from msdc_hw, later this
information should be taken from the device tree.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp eafd4cc4c4 staging: mt7621-mmc: Remove unnecessary setting of dev.platform_data
In the probe function, pdev->dev.platform_data is set to &msdc0_hw,
but the only get access to that is also in the probe function. So that
assignment is removed. The msdc0_hw structure is still available to the
driver as part of the msdc_host structure.

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp 36ff37c6ca staging: mt7621-mmc: Fix bug on dma_alloc_coherent fail
In case of dma_alloc_coherent failing the current code just called
BUG_ON. By adding error handling for that case this can be avoided.
This also fixes a memory leek in case of a fail later on in the probe
function.

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-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp d6e9e06861 staging: mt7621-mmc: Fix unmatched release_mem_regin
Current code calls release_mem_regin on driver remove without
requesting it explicit first. The region is only requested via
devm_ioremap_resource and that releases it automatically. Removing the
release_mem_region calls fixes this.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:03 +02:00
Christian Lütke-Stetzkamp fb922724b0 staging: mt7621-mmc: Remove code checking for old kernel versions
Remove code, that is checking for old kernel versions, leaving only
the case for current versions.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp 5ac36d9c96 staging: mt7621-mmc: Fix memory leek in case of error in probe
If the base address is not successfully obtained in the probe
function, then the mmc_host struct is not freed. Adding an exit for
that case fixes the bug.

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp 9673d9f6f4 staging: mt7621-mmc: Refactor suspend, resume
Refactor msdc_drv_{suspend, resume} by adding a new function
msdc_drv_pm, that cleans up the code and removes double code.

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp d364f14bbe staging: mt7621-mmc: Cleanup function mt_msdc_init
Cleanup the mt_msdc_init function, remove excceding printk.

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp d3c8faef70 staging: mt7621-mmc: Remove unused datastructures
Remove unused datastructures and comments referring to their former use.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp b734735fca staging: mt7621-mmc: Remove code for different soc types
Remove code that is intended for soc other then the mt7621 because
this driver is only for that soc. This also removes some conditions.
However the remaining code is also at the wrong place, it just selects
the mode of the pins, this is a job for pinctl not for the sdxc driver.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp b1619236e8 staging: mt7621-mmc: Remove code guarded by nonexistent config option
Remove a piece of code that is guarded by a config option, that is
nonexistent, the function it calls is also nonexistent.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp a8bba47eb8 staging: mt7621-mmc: Replace seq_printf with seq_puts where possible
Replace seq_printf with seq_puts when the string is const.
Fix checkpatch warning: PREFER_SEQ_PUTS

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp fcbae9ce56 staging: mt7621-mmc: Remove redundant driver owner assignment
Remove the owner assignment form the platform driver as
platform_driver_register() already initializes the owner.

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp e2031e730a staging: mt7621-mmc: Fix style of braces
Fix checkpatch errors, warnings, checks about braces:
BRACES, ELSE_AFTER_BRACE, OPEN_BRACE

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp ba3979bd01 staging: mt7621-mmc: Remove global initialise to 0
Fix checkpatch error: GLOBAL_INITIALISERS

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp 178c153dbb staging: mt7621-mmc: Fix trailing statements
Fix checkpatch error: TRAILING_STATEMENTS

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp b0318579c4 staging: mt7621-mmc: Remove unnecessary typedefs
Fixes checkpatch warning: NEW_TYPEDEFS

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp 791e509cd0 staging: mt7621-mmc: Fix Pointer Location
Fix checkpatch error: POINTER_LOCATION

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-04-23 15:34:02 +02:00
Christian Lütke-Stetzkamp 63a97a70b1 staging: mt7621-mmc: Fix spacing
Fixes checkpatch errors, warnings, checks:
SPACING, LEADING_SPACE, LINE_SPACING

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp b21f5195b4 staging: mt7621-mmc: Fix indent for sd.c
This fixes the indentaions in the file sd.c

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 53f4bdca59 staging: mt7621-mmc: Fix indent for mt6575_sd.h
This fixes the indentaions in the file mt7621_sd.h

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 30b96bd684 staging: mt7621-mmc: Fix indent for dbg.h
This fixes the indentaions in the file dbg.h

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-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp c23d25f3a6 staging: mt7621-mmc: Fix indent for board.h
This fixes the indentaions in the file board.h

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-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp cbb45abdd5 staging: mt7621-mmc: Fix indent for dbg.c
This fixes the indentaions in the file dbg.c

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 190f5e6bf8 staging: mt7621-mmc: Remove whitespace errors in sd.c
The whitespace errors in the file sd.c are fixed by using the
cleanfile script. Indentations with whitespaces are not changed
in this patch.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 4e78dcf760 staging: mt7621-mmc: Remove whitespace errors in mt6575_sd.h
The whitespace errors in the file mt6575_sd.h are fixed by using the
cleanfile script. Indentations with whitespaces are not changed
in this patch.

Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 0d8029a048 staging: mt7621-mmc: Remove whitespace errors in dbg.h
The whitespace errors in the file dbg.h are fixed by using the
cleanfile script. Indentations with whitespaces are not changed
in this patch.

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-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 0494c89c0a staging: mt7621-mmc: Remove whitespace errors in dbg.c
The whitespace errors in the file dbg.c are fixed by using the
cleanfile script. Indentations with whitespaces are not changed
in this patch.

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-04-23 15:34:01 +02:00
Christian Lütke-Stetzkamp 5b55dedd24 staging: mt7621-mmc: Remove whitespace errors in board.h
The whitespace errors in the file board.h are fixed by using the
cleanfile script. Indentations with whitespaces are not changed
in this patch.

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-04-23 15:34:01 +02:00
John Crispin 8b634a9c76 staging: mt7621-mmc: MIPS: ralink: add sdhci for mt7620a SoC
NeilBrown:
  Added range-check on pdev->id before assigning ot
    host->id

  of_dma_configure() sets a default ->dma_mask of
  DMA_BIT_MASK(32), claiming devices can DMA from
  the full 32bit address space.
  The mtk-mmc driver does not support access to
  highmem pages, so it is really limited to the
  bottom 512M (actually 448M due to 64M of IO space).
  Setting ->dma_mask to NULL causes mmc_setup_queue()
  to fall-back to using BLK_BOUNCE_HIGH to tell the
  block layer to use a bounce-buffer for any highmem
  pages requiring IO.

Signed-off-by: John Crispin <blogic@openwrt.org>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-19 19:56:02 +01:00