summaryrefslogtreecommitdiff
path: root/drivers/staging/mt7621-mmc
AgeCommit message (Collapse)Author
2018-05-06staging: mt7621-mmc: Remove unused field abort from msdc_hostChristian Lütke-Stetzkamp
The field abort of msdc_host is only set, but never read, so it can be removed. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Fix error number assignmentChristian Lütke-Stetzkamp
Currently the value that data->error is set to is converted to an unsigned int, but it is a usual error number, so it should be negative. 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-06staging: mt7621-mmc: Remove unused variable dma_xfer from msdc_hostChristian Lütke-Stetzkamp
The field dma_xfer of the struct msdc_host is not used anymore, remove it. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove non-DMA transfer codeChristian Lütke-Stetzkamp
Currently the driver is capable of DMA and non-DMA transfer. But the option to choose non-DMA transfer has already been removed. Now remove also the code for the non-DMA transfer. 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-06staging: mt7621-mmc: Remove unused global dma_sizeChristian Lütke-Stetzkamp
The global variable dma_size was previously used to select DMA or non-DMA transfer mode based on the size of the data that should be transferred. This option was removed preivously, so the variable is not used any more and can be removed. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove transfer mode setting variableChristian Lütke-Stetzkamp
Currently the transfer mode can be chosen between DMA, a size dependent mode and non-DMA by writing to a proc file. The upstream driver mtk-sd uses DMA all times. The previous patch removed the ability to set that option. Now the remaining uses of the transfer mode setting variable are cleaned up, because it cannot be changed any more. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove transfer mode setting from procChristian Lütke-Stetzkamp
Currently the transfer mode can be chosen between DMA, a size dependent mode and non-DMA by writing to a proc file. The upstream driver mtk-sd uses DMA all times. There is no apparent reason why somebody would like to change the transfer mode and the position of the setting in the debug part of the driver also indicates, that the option was used for debugging purposes. So it is removed to clean up the driver and bring it more in line with the upstream one. 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-06staging: mt7621-mmc: Remove unused static msdc_regsChristian Lütke-Stetzkamp
The static variable msdc_regs is set once, but never used, so remove 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-06staging: mt7621-mmc: Replace macro sdr_get_field with functionChristian Lütke-Stetzkamp
Currently sdr_get_field is a macro, to bring the code in line with the upstream driver mtk-sd, it is changed to a function. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Replace macro sdr_set_field with functionChristian Lütke-Stetzkamp
Currently sdr_set_field is a macro, to bring the code in line with the upstream driver mtk-sd, it is changed to a function. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove function uffsChristian Lütke-Stetzkamp
The function uffs that is implemented by this driver returns the same values as the kernel function ffs. So the uffs function is removed and the calls to it are replaced with calls to ffs. 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-06staging: mt7621-mmc: Remove unused macros sdr_{read,write}16Christian Lütke-Stetzkamp
The sdr_{read,write}16 macros are never used and does not provide any information about the device, so they are 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-06staging: mt7621-mmc: Remove unused macro msdc_init_gpd_exChristian Lütke-Stetzkamp
The macro msdc_init_gpd_ex is never used and does not provied any information about the hardware, so it is 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-06staging: mt7621-mmc: Remove unused field clk_drv from msdc_hwChristian Lütke-Stetzkamp
The field clk_drv of msdc_hw is set to a constant and only used once, replace that position with the constant and remove the unused field. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove unused field cmd_drv from msdc_hwChristian Lütke-Stetzkamp
The field cmd_drv of msdc_hw is set to a constant and only used once, replace that position with the constant and remove the unused field. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove unused field dat_drv from msdc_hwChristian Lütke-Stetzkamp
The field dat_drv of msdc_hw is set to a constant and only used once, replace that position with the constant and remove the unused field. 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-06staging: mt7621-mmc: Remove unused field data_edge from msdc_hwChristian Lütke-Stetzkamp
The field data_edge of msdc_hw is set to a constant and only used once, replace that position with the constant and remove the unused field. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Remove unused field cmd_edge from msdc_hwChristian Lütke-Stetzkamp
The field cmd_edge of msdc_hw is set to a constant and only used once, replace that position with the constant and remove the unused field. Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-06staging: mt7621-mmc: Fix typo in function parametersChristian Lütke-Stetzkamp
The type pm_message does not exist in the kernel, the correct type is pm_message_t, so the type of the parameter is corrected. Fixes: 9673d9f6f44b ("staging: mt7621-mmc: Refactor suspend, resume") 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-25staging: mt7621-mmc: Fix calculation typo in msdc_init_gpd_bdChristian Lütke-Stetzkamp
When refactoring the function msdc_init_gpd_bd, an error in the calculation of the bd.next address was introduced. The offset has to be added to the base address, not multiplied. Fixes: 8f2395586cf0 ("staging: mt7621-mmc: Refactor msdc_init_gpd_bd") Reported-by: NeilBrown <neil@brown.name> Signed-off-by: Christian Lütke-Stetzkamp <christian@lkamp.de> Tested-by: NeilBrown <neil@brown.name> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-25staging: mt7621-mmc: Remove unused card_workqueue from msdc_hostChristian Lütke-Stetzkamp
The card_workqueue field of msdc_host is already if 0'd out and there are no references to it in the code (not even in unused code), so remove 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-25staging: mt7621-mmc: Remove old references to taskletChristian Lütke-Stetzkamp
In the current code there are '#if 0' out references on using a tasklet instead of delayed_work. Removing these improves readability. 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-25staging: mt7621-mmc: Add annotations about held locksChristian Lütke-Stetzkamp
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-25staging: mt7621-mmc: Correct datatypes for io and sanitize io accessChristian Lütke-Stetzkamp
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-25staging: mt7621-mmc: Replace dma dir with mmc_get_dma_dirChristian Lütke-Stetzkamp
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-25staging: mt7621-mmc: Fix dma_map_sg may map to fewer entriesChristian Lütke-Stetzkamp
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-25staging: mt7621-mmc: Remove multiple assignmentsChristian Lütke-Stetzkamp
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-25staging: mt7621-mmc: Fix dereference before check in msdc_drv_pmChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field dma_addr of msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field cmd_rsp_done of msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field cmd_r1b_done in msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field dma_left_size of msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621:mmc: Remove unused field reserved from msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field starttime from msdc_hostChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Change default transfer mode to DMAChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Refactor msdc_init_gpd_bdChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field xfersz from msdc_dmaChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove flags from msdc_dmaChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused fields from msdc_dmaChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Start cleanup of msdc_dma_configChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused function msdc_dma_dumpChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field burstsz from msdc_dmaChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field data_offset from msdc_hwChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Relax cpu while waiting for stable clockChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove code for not existent configChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Refactor and rename msdc_reset to msdc_reset_hwChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove power callbacks from msdc_hwChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Fix null pointer deref if ext sdio irq enabledChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field disable_cd_eirqChristian Lütke-Stetzkamp
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-23staging: mt7621-mmc: Remove unused field enable_cd_eirq from msdc_hwChristian Lütke-Stetzkamp
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>