[PATCH] media: atomisp: fix spelling mistake: "diregard" -> "disregard"
From: Colin Ian King Trivial fix to spelling mistake in ia_css_print message text Signed-off-by: Colin Ian King --- .../css2400/css_2401_csi2p_system/host/csi_rx_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h index 9c0cb4a63862..4fa74e7a96e6 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h @@ -202,7 +202,7 @@ static inline void csi_rx_be_ctrl_dump_state( ia_css_print("CSI RX BE STATE Controller %d PEC ID %d custom pec 0x%x \n", ID, i, state->pec[i]); } #endif - ia_css_print("CSI RX BE STATE Controller %d Global LUT diregard reg 0x%x \n", ID, state->global_lut_disregard_reg); + ia_css_print("CSI RX BE STATE Controller %d Global LUT disregard reg 0x%x \n", ID, state->global_lut_disregard_reg); ia_css_print("CSI RX BE STATE Controller %d packet stall reg 0x%x \n", ID, state->packet_status_stall); /* * Get the values of the register-set per -- 2.17.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/30] staging: mt7621-mmc: Remove transfer mode setting variable
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 --- drivers/staging/mt7621-mmc/dbg.c | 15 --- drivers/staging/mt7621-mmc/dbg.h | 1 - drivers/staging/mt7621-mmc/sd.c | 7 +-- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 8f38484c8dbb..163c061b440c 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -66,13 +66,6 @@ u32 dma_size[4] = { 512 }; -enum msdc_mode drv_mode[4] = { - MODE_DMA, /* using DMA always */ - MODE_DMA, - MODE_DMA, - MODE_DMA -}; - #if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) @@ -235,14 +228,6 @@ static int msdc_debug_proc_read(struct seq_file *s, void *p) seq_printf(s, "-> MSDC[2] Zone: 0x%.8x\n", sd_debug_zone[2]); seq_printf(s, "-> MSDC[3] Zone: 0x%.8x\n", sd_debug_zone[3]); - seq_puts(s, "Index<1> + ID:4|Mode:4 + DMA_SIZE\n"); - seq_puts(s, "-> 0)PIO 1)DMA 2)SIZE\n"); - seq_puts(s, "-> echo 1 22 0x200 >msdc_bebug -> host[2] size mode, dma when >= 512\n"); - seq_printf(s, "-> MSDC[0] mode<%d> size<%d>\n", drv_mode[0], dma_size[0]); - seq_printf(s, "-> MSDC[1] mode<%d> size<%d>\n", drv_mode[1], dma_size[1]); - seq_printf(s, "-> MSDC[2] mode<%d> size<%d>\n", drv_mode[2], dma_size[2]); - seq_printf(s, "-> MSDC[3] mode<%d> size<%d>\n", drv_mode[3], dma_size[3]); - seq_puts(s, "Index<3> + SDIO_PROFILE + TIME\n"); seq_puts(s, "-> echo 3 1 0x1E >msdc_bebug -> enable sdio_profile, 30s\n"); seq_printf(s, "-> SDIO_PROFILE<%d> TIME<%ds>\n", sdio_pro_enable, sdio_pro_time); diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 6f00fcdaba32..9412d73f33a8 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -79,7 +79,6 @@ enum msdc_mode { MODE_SIZE_DEP = 2, }; -extern enum msdc_mode drv_mode[4]; extern u32 dma_size[4]; /* Debug message event */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index ddd0b301fef3..c1640689aded 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1374,12 +1374,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) host->blksz = data->blksz; /* deside the transfer mode */ - if (drv_mode[host->id] == MODE_PIO) - host->dma_xfer = 0; - else if (drv_mode[host->id] == MODE_DMA) - host->dma_xfer = 1; - else if (drv_mode[host->id] == MODE_SIZE_DEP) - host->dma_xfer = ((host->xfer_size >= dma_size[host->id]) ? 1 : 0); + host->dma_xfer = 1; dma = host->dma_xfer; if (read) { -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index a2dce54e386c..c9f0180f3220 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1091,7 +1091,7 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) void __iomem *base = host->base; //u32 i, j, num, bdlen, arg, xfersz; u32 j, num; - struct scatterlist *sg = dma->sg; + struct scatterlist *sg; struct gpd *gpd; struct bd *bd; -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index d92234a96551..ddac4ce6457b 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -60,13 +60,6 @@ #endif #define IRQ_SDC22 /*FIXME*/ -#if 0 /* --- by chhung */ -#define isb() __asm__ __volatile__ ("" : : : "memory") -#define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \ - : : "r" (0) : "memory") -#define dmb() __asm__ __volatile__ ("" : : : "memory") -#endif /* end of --- */ - #define DRV_NAME"mtk-sd" #if defined(CONFIG_SOC_MT7620) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/30] staging: mt7621-mmc: Remove unused field abort from msdc_host
The field abort of msdc_host is only set, but never read, so it can be removed. Signed-off-by: Christian Lütke-Stetzkamp --- drivers/staging/mt7621-mmc/mt6575_sd.h | 2 -- drivers/staging/mt7621-mmc/sd.c| 2 -- 2 files changed, 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index aa7e9c250e02..33fa59a019ec 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -926,8 +926,6 @@ struct msdc_host { u32 timeout_ns; /* data timeout ns */ u32 timeout_clks; /* data timeout clks */ - atomic_tabort; /* abort transfer */ - int irq;/* host interrupt */ struct delayed_work card_delaywork; diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 0da9ff5b2f50..614e6a72a50a 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1207,7 +1207,6 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) BUG_ON(mrq == NULL); host->error = 0; - atomic_set(&host->abort, 0); cmd = mrq->cmd; data = mrq->cmd->data; @@ -2020,7 +2019,6 @@ static irqreturn_t msdc_irq(int irq, void *dev_id) msdc_reset_hw(host); msdc_clr_fifo(); msdc_clr_int(); - atomic_set(&host->abort, 1); /* For PIO mode exit */ if (intsts & MSDC_INT_DATTMO) { IRQ_MSG("XXX CMD<%d> MSDC_INT_DATTMO", host->mrq->cmd->opcode); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/30] staging: mt7621-mmc: Next cleanups
Here are the next cleanups for the mt7621-mmc driver. It contains the removal of some unused things, the removal of the non DMA code and always using linked DMA mode together with some minor cleanups. Christian Lütke-Stetzkamp (30): staging: mt7621-mmc: Fix typo in function parameters staging: mt7621-mmc: Remove unused field cmd_edge from msdc_hw staging: mt7621-mmc: Remove unused field data_edge from msdc_hw staging: mt7621-mmc: Remove unused field dat_drv from msdc_hw staging: mt7621-mmc: Remove unused field cmd_drv from msdc_hw staging: mt7621-mmc: Remove unused field clk_drv from msdc_hw staging: mt7621-mmc: Remove unused macro msdc_init_gpd_ex staging: mt7621-mmc: Remove unused macros sdr_{read,write}16 staging: mt7621-mmc: Remove function uffs staging: mt7621-mmc: Replace macro sdr_set_field with function staging: mt7621-mmc: Replace macro sdr_get_field with function staging: mt7621-mmc: Remove unused static msdc_regs staging: mt7621-mmc: Remove transfer mode setting from proc staging: mt7621-mmc: Remove transfer mode setting variable staging: mt7621-mmc: Remove unused global dma_size staging: mt7621-mmc: Remove non-DMA transfer code staging: mt7621-mmc: Remove unused variable dma_xfer from msdc_host staging: mt7621-mmc: Fix error number assignment staging: mt7621-mmc: Remove unused field abort from msdc_host staging: mt7621-mmc: Remove unused sdio irq code staging: mt7621-mmc: Do not BUG() if mrq set in msdc_ops_request staging: mt7621-mmc: Remove redundant check for card status staging: mt7621-mmc: Remove initialisation in msdc_dma_config staging: mt7621-mmc: Inline function msdc_set_blknum staging: mt7621-mmc: Don't disables DMA staging: mt7621-mmc: Change return value of msdc_dma_config to void staging: mt7621-mmc: Always use linked DMA mode staging: mt7621-mmc: Remove unused macro HOST_MAX_NUM staging: mt7621-mmc: Cleanup includes staging: mt7621-mmc: Remove unused barrier macros drivers/staging/mt7621-mmc/board.h | 7 - drivers/staging/mt7621-mmc/dbg.c | 38 --- drivers/staging/mt7621-mmc/dbg.h | 3 - drivers/staging/mt7621-mmc/mt6575_sd.h | 60 + drivers/staging/mt7621-mmc/sd.c| 479 ++--- 5 files changed, 96 insertions(+), 491 deletions(-) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index c9f0180f3220..00c862b02419 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1182,14 +1182,6 @@ static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, msdc_dma_config(host, dma); } -/* set block number before send command */ -static void msdc_set_blknum(struct msdc_host *host, u32 blknum) -{ - void __iomem *base = host->base; - - sdr_write32(SDC_BLK_NUM, blknum); -} - static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) __must_hold(&host->lock) { @@ -1239,7 +1231,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) } } - msdc_set_blknum(host, data->blocks); + sdr_write32(SDC_BLK_NUM, data->blocks); //msdc_clr_fifo(); /* no need */ msdc_dma_on(); /* enable DMA mode first!! */ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/30] staging: mt7621-mmc: Replace macro sdr_set_field with function
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 --- drivers/staging/mt7621-mmc/mt6575_sd.h | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 5a50b6a47469..90b4ee6b396b 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -971,13 +971,15 @@ static inline void sdr_clr_bits(void __iomem *reg, u32 bs) writel(val, reg); } -#define sdr_set_field(reg, field, val) \ -do { \ - volatile unsigned int tv = sdr_read32(reg); \ - tv &= ~(field); \ - tv |= ((val) << (ffs((unsigned int)field) - 1));\ - sdr_write32(reg, tv); \ -} while (0) +static inline void sdr_set_field(void __iomem *reg, u32 field, u32 val) +{ + unsigned int tv = readl(reg); + + tv &= ~field; + tv |= ((val) << (ffs((unsigned int)field) - 1)); + writel(tv, reg); +} + #define sdr_get_field(reg, field, val) \ do { \ volatile unsigned int tv = sdr_read32(reg); \ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/30] staging: mt7621-mmc: Remove unused global dma_size
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 --- drivers/staging/mt7621-mmc/dbg.c | 8 drivers/staging/mt7621-mmc/dbg.h | 2 -- 2 files changed, 10 deletions(-) diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 163c061b440c..d897b1216348 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -58,14 +58,6 @@ unsigned int sd_debug_zone[4] = { 0 }; -/* mode select */ -u32 dma_size[4] = { - 512, - 512, - 512, - 512 -}; - #if defined(MT6575_SD_DEBUG) /* for driver profile */ #define TICKS_ONE_MS (13000) diff --git a/drivers/staging/mt7621-mmc/dbg.h b/drivers/staging/mt7621-mmc/dbg.h index 9412d73f33a8..5a25a69b00c9 100644 --- a/drivers/staging/mt7621-mmc/dbg.h +++ b/drivers/staging/mt7621-mmc/dbg.h @@ -79,8 +79,6 @@ enum msdc_mode { MODE_SIZE_DEP = 2, }; -extern u32 dma_size[4]; - /* Debug message event */ #define DBG_EVT_NONE(0) /* No event */ #define DBG_EVT_DMA (1 << 0) /* DMA related event */ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 706eab4e1237..2da079238966 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -104,8 +104,6 @@ #define DRV_NAME"mtk-sd" -#define HOST_MAX_NUM(1) /* +/- by chhung */ - #if defined(CONFIG_SOC_MT7620) #define HOST_MAX_MCLK (4800) /* +/- by chhung */ #elif defined(CONFIG_SOC_MT7621) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/30] staging: mt7621-mmc: Remove unused variable dma_xfer from msdc_host
The field dma_xfer of the struct msdc_host is not used anymore, remove it. Signed-off-by: Christian Lütke-Stetzkamp --- drivers/staging/mt7621-mmc/mt6575_sd.h | 1 - drivers/staging/mt7621-mmc/sd.c| 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 195c7333f77d..aa7e9c250e02 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -922,7 +922,6 @@ struct msdc_host { struct msdc_dma dma;/* dma channel */ u32 dma_xfer_size; /* dma transfer size in bytes */ - int dma_xfer; /* dma transfer mode */ u32 timeout_ns; /* data timeout ns */ u32 timeout_clks; /* data timeout clks */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 95b5db80250a..44d75f3f2c3e 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -603,7 +603,7 @@ static void msdc_abort_data(struct msdc_host *host) void __iomem *base = host->base; struct mmc_command *stop = host->mrq->stop; - ERR_MSG("Need to Abort. dma<%d>", host->dma_xfer); + ERR_MSG("Need to Abort."); msdc_reset_hw(host); msdc_clr_fifo(); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 29/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 51 +++-- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 2da079238966..d92234a96551 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -34,31 +34,21 @@ */ #include -#include -#include +#include +#include #include -#include -#include -#include #include -#include -#include -#include -#include + #include -#include -#include #include #include #include -#include -/* +++ by chhung */ -#include -#include -#include -#include -#include +#include + +#include "board.h" +#include "dbg.h" +#include "mt6575_sd.h" //#define IRQ_SDC 14 //MT7620 /*FIXME*/ #ifdef CONFIG_SOC_MT7621 @@ -70,31 +60,6 @@ #endif #define IRQ_SDC22 /*FIXME*/ -#include -/* end of +++ */ - -#include - -#if 0 /* --- by chhung */ -#include -#include -#include -#include -#include -//#include -//#include -//#include -#include -// #include -#endif /* end of --- */ - -#include "mt6575_sd.h" -#include "dbg.h" - -/* +++ by chhung */ -#include "board.h" -/* end of +++ */ - #if 0 /* --- by chhung */ #define isb() __asm__ __volatile__ ("" : : : "memory") #define dsb() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 4" \ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/30] staging: mt7621-mmc: Replace macro sdr_get_field with function
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 --- drivers/staging/mt7621-mmc/mt6575_sd.h | 10 +- drivers/staging/mt7621-mmc/sd.c| 14 -- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 90b4ee6b396b..195c7333f77d 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -980,10 +980,10 @@ static inline void sdr_set_field(void __iomem *reg, u32 field, u32 val) writel(tv, reg); } -#define sdr_get_field(reg, field, val) \ -do { \ - volatile unsigned int tv = sdr_read32(reg); \ - val = ((tv & (field)) >> (ffs((unsigned int)field) - 1)); \ -} while (0) +static inline void sdr_get_field(void __iomem *reg, u32 field, u32 *val) +{ + unsigned int tv = readl(reg); + *val = ((tv & field) >> (ffs((unsigned int)field) - 1)); +} #endif diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 00dacf8c9625..f4da48a5772b 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1577,8 +1577,8 @@ static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) ==*/ // save the previous tune result - sdr_get_field(MSDC_IOCON,MSDC_IOCON_RSPL,orig_rsmpl); - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, orig_rrdly); + sdr_get_field(MSDC_IOCON,MSDC_IOCON_RSPL,&orig_rsmpl); + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, &orig_rrdly); rrdly = 0; do { @@ -1640,7 +1640,7 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) int result = -1; u32 skip = 1; - sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, &orig_dsmpl); /* Tune Method 2. */ sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); @@ -1664,7 +1664,9 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) } result = msdc_do_request(mmc, mrq); - sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, dcrc); /* RO */ + sdr_get_field(SDC_DCRC_STS, + SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, + &dcrc); /* RO */ if (!ddr) dcrc &= ~SDC_DCRC_STS_NEG; ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", @@ -1751,8 +1753,8 @@ static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) // MSDC_IOCON_DDR50CKD need to check. [Fix me] - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, orig_wrrdly); - sdr_get_field(MSDC_IOCON,MSDC_IOCON_DSPL,orig_dsmpl); + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, &orig_wrrdly); + sdr_get_field(MSDC_IOCON,MSDC_IOCON_DSPL,&orig_dsmpl); /* Tune Method 2. just DAT0 */ sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/30] staging: mt7621-mmc: Remove unused field clk_drv from msdc_hw
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 --- drivers/staging/mt7621-mmc/board.h | 1 - drivers/staging/mt7621-mmc/sd.c| 6 ++ 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index 4c8499891c2f..7e0c469a444d 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -54,7 +54,6 @@ struct msdc_hw { unsigned char clk_src; /* host clock source */ - unsigned char clk_drv; /* clock pad driving */ unsigned long flags;/* hardware capability flags */ /* config gpio pull mode */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 6c901ac83e2f..e94b2bafa8eb 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -177,7 +177,6 @@ void msdc_clk_status(int *status) /* +++ by chhung */ struct msdc_hw msdc0_hw = { .clk_src= 0, - .clk_drv= 4, .flags = MSDC_CD_PIN_EN | MSDC_REMOVABLE, // .flags = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, }; @@ -2371,7 +2370,6 @@ static void msdc_enable_cd_irq(struct msdc_host *host, int enable) static void msdc_init_hw(struct msdc_host *host) { void __iomem *base = host->base; - struct msdc_hw *hw = host->hw; #ifdef MT6575_SD_DEBUG msdc_reg[host->id] = (struct msdc_regs *)host->base; @@ -2441,8 +2439,8 @@ static void msdc_init_hw(struct msdc_host *host) #if 1 /* set clk, cmd, dat pad driving */ - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, hw->clk_drv); - sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, hw->clk_drv); + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 4); + sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 4); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 4); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 4); sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 4); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/30] staging: mt7621-mmc: Remove unused field data_edge from msdc_hw
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 --- drivers/staging/mt7621-mmc/board.h | 1 - drivers/staging/mt7621-mmc/sd.c| 7 +++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index af192a8205b0..22edbb8bbc31 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -54,7 +54,6 @@ struct msdc_hw { unsigned char clk_src; /* host clock source */ - unsigned char data_edge;/* data latch edge */ unsigned char clk_drv; /* clock pad driving */ unsigned char cmd_drv; /* command pad driving */ unsigned char dat_drv; /* data pad driving */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index f4c33f02e75e..9dba15edc812 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -177,7 +177,6 @@ void msdc_clk_status(int *status) /* +++ by chhung */ struct msdc_hw msdc0_hw = { .clk_src= 0, - .data_edge = MSDC_SMPL_FALLING, .clk_drv= 4, .cmd_drv= 4, .dat_drv= 4, @@ -2027,7 +2026,6 @@ static void msdc_set_buswidth(struct msdc_host *host, u32 width) static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct msdc_host *host = mmc_priv(mmc); - struct msdc_hw *hw = host->hw; void __iomem *base = host->base; u32 ddr = 0; @@ -2073,10 +2071,11 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (host->mclk != ios->clock) { if (ios->clock > 2500) { //if (!(host->hw->flags & MSDC_REMOVABLE)) { - INIT_MSG("SD data latch edge<%d>", hw->data_edge); + INIT_MSG("SD data latch edge<%d>", MSDC_SMPL_FALLING); sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, MSDC_SMPL_FALLING); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, hw->data_edge); + sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, + MSDC_SMPL_FALLING); //} /* for tuning debug */ } else { /* default value */ sdr_write32(MSDC_IOCON, 0x); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/30] staging: mt7621-mmc: Remove unused field cmd_drv from msdc_hw
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 --- drivers/staging/mt7621-mmc/board.h | 1 - drivers/staging/mt7621-mmc/sd.c| 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index a2ad8237cf13..4c8499891c2f 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -55,7 +55,6 @@ struct msdc_hw { unsigned char clk_src; /* host clock source */ unsigned char clk_drv; /* clock pad driving */ - unsigned char cmd_drv; /* command pad driving */ unsigned long flags;/* hardware capability flags */ /* config gpio pull mode */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 0daf06f3c4a9..6c901ac83e2f 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -178,7 +178,6 @@ void msdc_clk_status(int *status) struct msdc_hw msdc0_hw = { .clk_src= 0, .clk_drv= 4, - .cmd_drv= 4, .flags = MSDC_CD_PIN_EN | MSDC_REMOVABLE, // .flags = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, }; @@ -2444,8 +2443,8 @@ static void msdc_init_hw(struct msdc_host *host) /* set clk, cmd, dat pad driving */ sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, hw->clk_drv); sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, hw->clk_drv); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, hw->cmd_drv); - sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, hw->cmd_drv); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, 4); + sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, 4); sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 4); sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 4); #else -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/30] staging: mt7621-mmc: Remove unused field cmd_edge from msdc_hw
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 --- drivers/staging/mt7621-mmc/board.h | 1 - drivers/staging/mt7621-mmc/sd.c| 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index 544d736e2dad..af192a8205b0 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -54,7 +54,6 @@ struct msdc_hw { unsigned char clk_src; /* host clock source */ - unsigned char cmd_edge; /* command latch edge */ unsigned char data_edge;/* data latch edge */ unsigned char clk_drv; /* clock pad driving */ unsigned char cmd_drv; /* command pad driving */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index b78f68016190..f4c33f02e75e 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -177,7 +177,6 @@ void msdc_clk_status(int *status) /* +++ by chhung */ struct msdc_hw msdc0_hw = { .clk_src= 0, - .cmd_edge = MSDC_SMPL_FALLING, .data_edge = MSDC_SMPL_FALLING, .clk_drv= 4, .cmd_drv= 4, @@ -2075,7 +2074,8 @@ static void msdc_ops_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (ios->clock > 2500) { //if (!(host->hw->flags & MSDC_REMOVABLE)) { INIT_MSG("SD data latch edge<%d>", hw->data_edge); - sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, hw->cmd_edge); + sdr_set_field(MSDC_IOCON, MSDC_IOCON_RSPL, + MSDC_SMPL_FALLING); sdr_set_field(MSDC_IOCON, MSDC_IOCON_DSPL, hw->data_edge); //} /* for tuning debug */ } else { /* default value */ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/30] staging: mt7621-mmc: Remove unused static msdc_regs
The static variable msdc_regs is set once, but never used, so remove it. Signed-off-by: Christian Lütke-Stetzkamp --- drivers/staging/mt7621-mmc/sd.c | 8 1 file changed, 8 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index f4da48a5772b..ddd0b301fef3 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -142,10 +142,6 @@ #define MAX_SGMT_SZ (MAX_DMA_CNT) #define MAX_REQ_SZ (MAX_SGMT_SZ * 8) -#ifdef MT6575_SD_DEBUG -static struct msdc_regs *msdc_reg[HOST_MAX_NUM]; -#endif - static int cd_active_low = 1; //= @@ -2364,10 +2360,6 @@ static void msdc_init_hw(struct msdc_host *host) { void __iomem *base = host->base; -#ifdef MT6575_SD_DEBUG - msdc_reg[host->id] = (struct msdc_regs *)host->base; -#endif - /* Power on */ #if 0 /* --- by chhung */ msdc_vcore_on(host); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index b51a4b156605..706eab4e1237 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1169,10 +1169,7 @@ static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, dma->sg = sg; dma->sglen = sglen; - if (sglen == 1 && sg_dma_len(sg) <= MAX_DMA_CNT) - dma->mode = MSDC_MODE_DMA_BASIC; - else - dma->mode = MSDC_MODE_DMA_DESC; + dma->mode = MSDC_MODE_DMA_DESC; N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, host->xfer_size); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 0d1eed2a7964..b51a4b156605 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1085,7 +1085,7 @@ static u8 msdc_dma_calcs(u8 *buf, u32 len) } /* gpd bd setup + dma registers */ -static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) +static void msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) { void __iomem *base = host->base; //u32 i, j, num, bdlen, arg, xfersz; @@ -1159,7 +1159,6 @@ static int msdc_dma_config(struct msdc_host *host, struct msdc_dma *dma) N_MSG(DMA, "DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); N_MSG(DMA, "DMA_SA = 0x%x", sdr_read32(MSDC_DMA_SA)); - return 0; } static void msdc_dma_setup(struct msdc_host *host, struct msdc_dma *dma, -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/30] staging: mt7621-mmc: Remove unused macro msdc_init_gpd_ex
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 --- drivers/staging/mt7621-mmc/sd.c | 9 - 1 file changed, 9 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index e94b2bafa8eb..00dacf8c9625 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -195,15 +195,6 @@ static int msdc_rsp[] = { 7, /* RESP_R1b */ }; -/* For Inhanced DMA */ -#define msdc_init_gpd_ex(_gpd, extlen, cmd, arg, blknum) \ - do {\ - ((struct gpd *)_gpd)->extlen = extlen; \ - ((struct gpd *)_gpd)->cmd= cmd; \ - ((struct gpd *)_gpd)->arg= arg; \ - ((struct gpd *)_gpd)->blknum = blknum; \ - } while (0) - #define msdc_txfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_TXCNT) >> 16) #define msdc_rxfifocnt() ((sdr_read32(MSDC_FIFOCS) & MSDC_FIFOCS_RXCNT) >> 0) #define msdc_fifo_write32(v) sdr_write32(MSDC_TXDATA, (v)) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/30] staging: mt7621-mmc: Remove unused macros sdr_{read, write}16
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 --- drivers/staging/mt7621-mmc/mt6575_sd.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index b77f8412ae2c..62e6beefa3db 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -980,10 +980,8 @@ static inline unsigned int uffs(unsigned int x) } #define sdr_read8(reg)readb(reg) -#define sdr_read16(reg) readw(reg) #define sdr_read32(reg) readl(reg) #define sdr_write8(reg, val) writeb(val, reg) -#define sdr_write16(reg, val) writew(val, reg) #define sdr_write32(reg, val) writel(val, reg) static inline void sdr_set_bits(void __iomem *reg, u32 bs) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 7a6101e62891..7549ef40ac17 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1716,10 +1716,7 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) u32 ticks = 0, opcode = 0, sizes = 0, bRx = 0; #endif /* end of --- */ - if (host->mrq) { - ERR_MSG("XXX host->mrq<0x%.8x>", (int)host->mrq); - BUG(); - } + WARN_ON(host->mrq); if (!is_card_present(host) || host->power_mode == MMC_POWER_OFF) { ERR_MSG("cmd<%d> card<%d> power<%d>", mrq->cmd->opcode, is_card_present(host), host->power_mode); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/30] staging: mt7621-mmc: Fix error number assignment
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 --- drivers/staging/mt7621-mmc/sd.c | 29 +++-- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 44d75f3f2c3e..0da9ff5b2f50 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -891,7 +891,7 @@ static unsigned int msdc_command_start(struct msdc_host *host, if (time_after(jiffies, tmo)) { ERR_MSG("XXX cmd_busy timeout: before CMD<%d>", opcode); - cmd->error = (unsigned int)-ETIMEDOUT; + cmd->error = -ETIMEDOUT; msdc_reset_hw(host); goto end; } @@ -902,7 +902,7 @@ static unsigned int msdc_command_start(struct msdc_host *host, break; if (time_after(jiffies, tmo)) { ERR_MSG("XXX sdc_busy timeout: before CMD<%d>", opcode); - cmd->error = (unsigned int)-ETIMEDOUT; + cmd->error = -ETIMEDOUT; msdc_reset_hw(host); goto end; } @@ -945,7 +945,7 @@ static unsigned int msdc_command_resp(struct msdc_host *host, spin_unlock(&host->lock); if (!wait_for_completion_timeout(&host->cmd_done, 10 * timeout)) { ERR_MSG("XXX CMD<%d> wait_for_completion timeout ARG<0x%.8x>", opcode, cmd->arg); - cmd->error = (unsigned int)-ETIMEDOUT; + cmd->error = -ETIMEDOUT; msdc_reset_hw(host); } spin_lock(&host->lock); @@ -994,7 +994,7 @@ static unsigned int msdc_command_resp(struct msdc_host *host, return cmd->error; /* memory card CRC */ - if (host->hw->flags & MSDC_REMOVABLE && cmd->error == (unsigned int)(-EIO)) { + if (host->hw->flags & MSDC_REMOVABLE && cmd->error == -EIO) { if (sdr_read32(SDC_CMD) & 0x1800) { /* check if has data phase */ msdc_abort_data(host); } else { @@ -1272,7 +1272,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) ERR_MSG("DMA_CA = 0x%x", sdr_read32(MSDC_DMA_CA)); ERR_MSG("DMA_CTRL = 0x%x", sdr_read32(MSDC_DMA_CTRL)); ERR_MSG("DMA_CFG = 0x%x", sdr_read32(MSDC_DMA_CFG)); - data->error = (unsigned int)-ETIMEDOUT; + data->error = -ETIMEDOUT; msdc_reset_hw(host); msdc_clr_fifo(); @@ -1409,7 +1409,7 @@ static int msdc_tune_cmdrsp(struct msdc_host *host, struct mmc_command *cmd) if (result == 0) return 0; - if (result != (unsigned int)(-EIO)) { + if (result != -EIO) { ERR_MSG("TUNE_CMD<%d> Error<%d> not -EIO", cmd->opcode, result); return result; } @@ -1482,7 +1482,8 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct mmc_request *mrq) goto done; } else { /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != 0 && mrq->data->error != (unsigned int)(-EIO)) { + if (mrq->data->error != 0 && + mrq->data->error != -EIO) { ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", result, mrq->cmd->error, mrq->data->error); goto done; @@ -1606,7 +1607,7 @@ static int msdc_tune_bwrite(struct mmc_host *mmc, struct mmc_request *mrq) goto done; } else { /* there is a case: command timeout, and data phase not processed */ - if (mrq->data->error != (unsigned int)(-EIO)) { + if (mrq->data->error != -EIO) { ERR_MSG("TUNE_READ: result<0x%x> cmd_error<%d> data_error<%d>", result, mrq->cmd->error, mrq->data->error); goto done; @@ -1689,7 +1690,7 @@ static int msdc_tune_request(struct mmc_ho
[PATCH 13/30] staging: mt7621-mmc: Remove transfer mode setting from proc
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 --- drivers/staging/mt7621-mmc/dbg.c | 15 --- 1 file changed, 15 deletions(-) diff --git a/drivers/staging/mt7621-mmc/dbg.c b/drivers/staging/mt7621-mmc/dbg.c index 0d6e21557d8f..8f38484c8dbb 100644 --- a/drivers/staging/mt7621-mmc/dbg.c +++ b/drivers/staging/mt7621-mmc/dbg.c @@ -286,21 +286,6 @@ static ssize_t msdc_debug_proc_write(struct file *file, } else { printk("msdc host_id error when set debug zone\n"); } - } else if (cmd == SD_TOOL_DMA_SIZE) { - id = p1 >> 4; - mode = (p1 & 0xf); - size = p2; - if (id >= 0 && id <= 3) { - drv_mode[id] = mode; - dma_size[id] = p2; - } else if (id == 4) { - drv_mode[0] = drv_mode[1] = mode; - drv_mode[2] = drv_mode[3] = mode; - dma_size[0] = dma_size[1] = p2; - dma_size[2] = dma_size[3] = p2; - } else { - printk("msdc host_id error when select mode\n"); - } } else if (cmd == SD_TOOL_SDIO_PROFILE) { if (p1 == 1) { /* enable profile */ if (gpt_enable == 0) { -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/30] 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 --- drivers/staging/mt7621-mmc/board.h | 2 -- drivers/staging/mt7621-mmc/sd.c| 25 - 2 files changed, 27 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index 7e0c469a444d..a7d82f321b00 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -39,8 +39,6 @@ #define MSDC_CD_PIN_EN (1 << 0) /* card detection pin is wired */ #define MSDC_WP_PIN_EN (1 << 1) /* write protection pin is wired */ #define MSDC_RST_PIN_EN (1 << 2) /* emmc reset pin is wired */ -#define MSDC_SDIO_IRQ (1 << 3) /* use internal sdio irq (bus) */ -#define MSDC_EXT_SDIO_IRQ (1 << 4) /* use external sdio irq */ #define MSDC_REMOVABLE (1 << 5) /* removable slot*/ #define MSDC_SMPL_RISING(0) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 614e6a72a50a..7a6101e62891 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1942,33 +1942,11 @@ static int msdc_ops_get_cd(struct mmc_host *mmc) return present; } -/* ops.enable_sdio_irq */ -static void msdc_ops_enable_sdio_irq(struct mmc_host *mmc, int enable) -{ - struct msdc_host *host = mmc_priv(mmc); - struct msdc_hw *hw = host->hw; - void __iomem *base = host->base; - u32 tmp; - - if (hw->flags & MSDC_EXT_SDIO_IRQ) { /* yes for sdio */ - } else { - ERR_MSG("XXX "); /* so never enter here */ - tmp = sdr_read32(SDC_CFG); - /* FIXME. Need to interrupt gap detection */ - if (enable) - tmp |= (SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - else - tmp &= ~(SDC_CFG_SDIOIDE | SDC_CFG_SDIOINTWKUP); - sdr_write32(SDC_CFG, tmp); - } -} - static struct mmc_host_ops mt_msdc_ops = { .request = msdc_ops_request, .set_ios = msdc_ops_set_ios, .get_ro = msdc_ops_get_ro, .get_cd = msdc_ops_get_cd, - .enable_sdio_irq = msdc_ops_enable_sdio_irq, }; /*--*/ @@ -2330,9 +2308,6 @@ static int msdc_drv_probe(struct platform_device *pdev) //TODO: read this as bus-width from dt (via mmc_of_parse) mmc->caps |= MMC_CAP_4_BIT_DATA; - if ((hw->flags & MSDC_SDIO_IRQ) || (hw->flags & MSDC_EXT_SDIO_IRQ)) - mmc->caps |= MMC_CAP_SDIO_IRQ; /* yes for sdio */ - cd_active_low = !of_property_read_bool(pdev->dev.of_node, "mediatek,cd-high"); if (of_property_read_bool(pdev->dev.of_node, "mediatek,cd-poll")) -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 00c862b02419..0d1eed2a7964 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -199,7 +199,6 @@ static int msdc_rsp[] = { #define msdc_fifo_read8()sdr_read8(MSDC_RXDATA) #define msdc_dma_on()sdr_clr_bits(MSDC_CFG, MSDC_CFG_PIO) -#define msdc_dma_off() sdr_set_bits(MSDC_CFG, MSDC_CFG_PIO) #define msdc_retry(expr, retry, cnt) \ do {\ @@ -1282,7 +1281,6 @@ static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) done: if (data != NULL) { host->data = NULL; - msdc_dma_off(); dma_unmap_sg(mmc_dev(mmc), data->sg, data->sg_len, mmc_get_dma_dir(data)); host->blksz = 0; -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: sm750fb: add drm development branch details
The sm750 driver in staging has no future as new framebuffer driver will not be added to fbdev anymore. A drm driver is being prepared, and the details added to the TODO file. This sm750fb driver will be removed as soon as the drm driver is ready. Also, remove my old email. Cc: dri-de...@lists.freedesktop.org Signed-off-by: Sudip Mukherjee --- drivers/staging/sm750fb/TODO | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/sm750fb/TODO b/drivers/staging/sm750fb/TODO index f710ab1..aeb2df3 100644 --- a/drivers/staging/sm750fb/TODO +++ b/drivers/staging/sm750fb/TODO @@ -9,8 +9,11 @@ TODO: - must be ported to the atomic kms framework in the drm subsystem (which will give you a basic fbdev driver for free) +Note: +- This driver will be removed from staging after the drm driver is ready +- The drm driver is getting ready at https://gitlab.com/sudipm/sm750/tree/sm750 + Please send any patches to Greg Kroah-Hartman Sudip Mukherjee Teddy Wang - Sudip Mukherjee -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/30] 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 --- drivers/staging/mt7621-mmc/sd.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 7549ef40ac17..a2dce54e386c 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1718,20 +1718,6 @@ static void msdc_ops_request(struct mmc_host *mmc, struct mmc_request *mrq) WARN_ON(host->mrq); - if (!is_card_present(host) || host->power_mode == MMC_POWER_OFF) { - ERR_MSG("cmd<%d> card<%d> power<%d>", mrq->cmd->opcode, is_card_present(host), host->power_mode); - mrq->cmd->error = -ENOMEDIUM; - -#if 1 - mrq->done(mrq); // call done directly. -#else - mrq->cmd->retries = 0; // please don't retry. - mmc_request_done(mmc, mrq); -#endif - - return; - } - /* start to process */ spin_lock(&host->lock); #if 0 /* --- by chhung */ -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/30] staging: mt7621-mmc: Fix typo in function parameters
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 --- drivers/staging/mt7621-mmc/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index a003f8324088..b78f68016190 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -2689,7 +2689,7 @@ static int msdc_drv_remove(struct platform_device *pdev) /* Fix me: Power Flow */ #ifdef CONFIG_PM -static void msdc_drv_pm(struct platform_device *pdev, pm_message state) +static void msdc_drv_pm(struct platform_device *pdev, pm_message_t state) { struct mmc_host *mmc = platform_get_drvdata(pdev); if (mmc) { -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/30] staging: mt7621-mmc: Remove non-DMA transfer code
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 --- drivers/staging/mt7621-mmc/sd.c | 261 ++-- 1 file changed, 36 insertions(+), 225 deletions(-) diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index c1640689aded..95b5db80250a 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -1032,145 +1032,6 @@ static unsigned int msdc_do_command(struct msdc_host *host, return cmd->error; } -/* The abort condition when PIO read/write - tmo: -*/ -static int msdc_pio_abort(struct msdc_host *host, struct mmc_data *data, unsigned long tmo) -{ - int ret = 0; - void __iomem *base = host->base; - - if (atomic_read(&host->abort)) - ret = 1; - - if (time_after(jiffies, tmo)) { - data->error = (unsigned int)-ETIMEDOUT; - ERR_MSG("XXX PIO Data Timeout: CMD<%d>", host->mrq->cmd->opcode); - ret = 1; - } - - if (ret) { - msdc_reset_hw(host); - msdc_clr_fifo(); - msdc_clr_int(); - ERR_MSG("msdc pio find abort"); - } - return ret; -} - -/* - Need to add a timeout, or WDT timeout, system reboot. -*/ -// pio mode data read/write -static int msdc_pio_read(struct msdc_host *host, struct mmc_data *data) -{ - struct scatterlist *sg = data->sg; - void __iomem *base = host->base; - u32 num = data->sg_len; - u32 *ptr; - u8 *u8ptr; - u32 left = 0; - u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; - unsigned long tmo = jiffies + DAT_TIMEOUT; - - sdr_set_bits(MSDC_INTEN, wints); - while (num) { - left = sg_dma_len(sg); - ptr = sg_virt(sg); - while (left) { - if ((left >= MSDC_FIFO_THD) && (msdc_rxfifocnt() >= MSDC_FIFO_THD)) { - count = MSDC_FIFO_THD >> 2; - do { - *ptr++ = msdc_fifo_read32(); - } while (--count); - left -= MSDC_FIFO_THD; - } else if ((left < MSDC_FIFO_THD) && msdc_rxfifocnt() >= left) { - while (left > 3) { - *ptr++ = msdc_fifo_read32(); - left -= 4; - } - - u8ptr = (u8 *)ptr; - while (left) { - *u8ptr++ = msdc_fifo_read8(); - left--; - } - } - - if (msdc_pio_abort(host, data, tmo)) - goto end; - } - size += sg_dma_len(sg); - sg = sg_next(sg); num--; - } -end: - data->bytes_xfered += size; - N_MSG(FIO, "PIO Read<%d>bytes", size); - - sdr_clr_bits(MSDC_INTEN, wints); - if (data->error) - ERR_MSG("read pio data->error<%d> left<%d> size<%d>", data->error, left, size); - return data->error; -} - -/* please make sure won't using PIO when size >= 512 - which means, memory card block read/write won't using pio - then don't need to handle the CMD12 when data error. -*/ -static int msdc_pio_write(struct msdc_host *host, struct mmc_data *data) -{ - void __iomem *base = host->base; - struct scatterlist *sg = data->sg; - u32 num = data->sg_len; - u32 *ptr; - u8 *u8ptr; - u32 left; - u32 count, size = 0; - u32 wints = MSDC_INTEN_DATTMO | MSDC_INTEN_DATCRCERR; - unsigned long tmo = jiffies + DAT_TIMEOUT; - - sdr_set_bits(MSDC_INTEN, wints); - while (num) { - left = sg_dma_len(sg); - ptr = sg_virt(sg); - - while (left) { - if (left >= MSDC_FIFO_SZ && msdc_txfifocnt() == 0) { - count = MSDC_FIFO_SZ >> 2; - do { - msdc_fifo_write32(*ptr); ptr++; - } while (--count); - left -= MSDC_FIFO_SZ; - } else if (left < MSDC_FIFO_SZ && msdc_txfifocnt() == 0) { - while (left > 3) { - msdc_fifo_write32(*ptr); ptr++; - left -= 4; - } - - u8ptr = (u8 *)ptr; - while (left) { -
[PATCH 04/30] staging: mt7621-mmc: Remove unused field dat_drv from msdc_hw
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 --- drivers/staging/mt7621-mmc/board.h | 1 - drivers/staging/mt7621-mmc/sd.c| 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/mt7621-mmc/board.h b/drivers/staging/mt7621-mmc/board.h index 22edbb8bbc31..a2ad8237cf13 100644 --- a/drivers/staging/mt7621-mmc/board.h +++ b/drivers/staging/mt7621-mmc/board.h @@ -56,7 +56,6 @@ struct msdc_hw { unsigned char clk_src; /* host clock source */ unsigned char clk_drv; /* clock pad driving */ unsigned char cmd_drv; /* command pad driving */ - unsigned char dat_drv; /* data pad driving */ unsigned long flags;/* hardware capability flags */ /* config gpio pull mode */ diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c index 9dba15edc812..0daf06f3c4a9 100644 --- a/drivers/staging/mt7621-mmc/sd.c +++ b/drivers/staging/mt7621-mmc/sd.c @@ -179,7 +179,6 @@ struct msdc_hw msdc0_hw = { .clk_src= 0, .clk_drv= 4, .cmd_drv= 4, - .dat_drv= 4, .flags = MSDC_CD_PIN_EN | MSDC_REMOVABLE, // .flags = MSDC_WP_PIN_EN | MSDC_CD_PIN_EN | MSDC_REMOVABLE, }; @@ -2447,8 +2446,8 @@ static void msdc_init_hw(struct msdc_host *host) sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, hw->clk_drv); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVN, hw->cmd_drv); sdr_set_field(MSDC_PAD_CTL1, MSDC_PAD_CTL1_CMDDRVP, hw->cmd_drv); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, hw->dat_drv); - sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, hw->dat_drv); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVN, 4); + sdr_set_field(MSDC_PAD_CTL2, MSDC_PAD_CTL2_DATDRVP, 4); #else sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVN, 0); sdr_set_field(MSDC_PAD_CTL0, MSDC_PAD_CTL0_CLKDRVP, 0); -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/30] staging: mt7621-mmc: Remove function uffs
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 --- drivers/staging/mt7621-mmc/mt6575_sd.h | 33 ++--- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h b/drivers/staging/mt7621-mmc/mt6575_sd.h index 62e6beefa3db..5a50b6a47469 100644 --- a/drivers/staging/mt7621-mmc/mt6575_sd.h +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h @@ -950,35 +950,6 @@ struct msdc_host { u32 app_cmd_arg; }; -static inline unsigned int uffs(unsigned int x) -{ - unsigned int r = 1; - - if (!x) - return 0; - if (!(x & 0x)) { - x >>= 16; - r += 16; - } - if (!(x & 0xff)) { - x >>= 8; - r += 8; - } - if (!(x & 0xf)) { - x >>= 4; - r += 4; - } - if (!(x & 3)) { - x >>= 2; - r += 2; - } - if (!(x & 1)) { - x >>= 1; - r += 1; - } - return r; -} - #define sdr_read8(reg)readb(reg) #define sdr_read32(reg) readl(reg) #define sdr_write8(reg, val) writeb(val, reg) @@ -1004,13 +975,13 @@ static inline void sdr_clr_bits(void __iomem *reg, u32 bs) do { \ volatile unsigned int tv = sdr_read32(reg); \ tv &= ~(field); \ - tv |= ((val) << (uffs((unsigned int)field) - 1)); \ + tv |= ((val) << (ffs((unsigned int)field) - 1));\ sdr_write32(reg, tv); \ } while (0) #define sdr_get_field(reg, field, val) \ do { \ volatile unsigned int tv = sdr_read32(reg); \ - val = ((tv & (field)) >> (uffs((unsigned int)field) - 1)); \ + val = ((tv & (field)) >> (ffs((unsigned int)field) - 1)); \ } while (0) #endif -- 2.16.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/10] staging: ks7010: next cleanups
On Fri, Apr 27, 2018 at 04:05:54PM +0200, Sergio Paracuellos wrote: > Cleanups continues with this patch series. Main changes are > related with MIB where some preprocessor stuff has been change > in favour of an enumeration and some helper functions to increase > code readability has been included. Other changes are minor > cleanups in different part of code. > > Sergio Paracuellos (10): > staging: ks7010: clean SME_MIC_FAILURE_REQUEST case in > hostif_sme_execute > staging: ks7010: convert MIB preprocessor defs into an enum > staging: ks7010: conver MIB attributes preprocessor defs into an enum > staging: ks7010: change some casts from uint8_t to u8 in ks_hostif > header > staging: ks7010: change parameter types and reorder them in > hostif_mib_set_request > staging: ks7010: add new helpers to achieve mib set request and > simplify code > staging: ks7010: use ether_addr_copy in get_current_ap > staging: ks7010: move two preprocessor definitions to ks_wlan.h > staging: ks7010: avoid two long lines in hostif_sme_mode_setup > staging: ks7010: remove non sense comments in ks_hostif.c source file > > drivers/staging/ks7010/ks_hostif.c | 320 > +-- > drivers/staging/ks7010/ks_hostif.h | 175 --- > drivers/staging/ks7010/ks_wlan.h | 3 + > drivers/staging/ks7010/ks_wlan_net.c | 4 +- > 4 files changed, 275 insertions(+), 227 deletions(-) I now have 31+ emails from you in my to-review queue. These are multiple series of patches, yet I have no idea what order they are in at all. Please make it easy on me, make it obvious what to do, and what to apply in what order. I'm dropping all of your emails now, please resend everything I have not applied, in a _SINGLE_ patch series so I can handle it properly. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/10] cleanupas continue
On Sat, Apr 28, 2018 at 12:34:36PM +0200, Sergio Paracuellos wrote: > The following patch series continue with driver cleanups. This series > starts focusing in ks_hostif.c file which really needs refactors. > Some functions have been refactor as well as some style stuff > has been fixed. Please put the subsystem: driver: in your 00/XX email subject line, otherwise it sometimes gets lost in my filters... And on it's own, it really doesn't make any sense, right? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv
On Sat, Apr 28, 2018 at 04:04:25PM +, Dilger, Andreas wrote: > On Apr 27, 2018, at 17:45, Wenwen Wang wrote: > > [PATCH] staging: luster: llite: fix potential missing-check bug when > > copying lumv > > (typo) s/luster/lustre/ > > > In ll_dir_ioctl(), the object lumv3 is firstly copied from the user space > > using Its address, i.e., lumv1 = &lumv3. If the lmm_magic field of lumv3 is > > LOV_USER_MAGIV_V3, lumv3 will be modified by the second copy from the user > > (typo) s/MAGIV/MAGIC/ > > > space. The second copy is necessary, because the two versions (i.e., > > lov_user_md_v1 and lov_user_md_v3) have different data formats and lengths. > > However, given that the user data resides in the user space, a malicious > > user-space process can race to change the data between the two copies. By > > doing so, the attacker can provide a data with an inconsistent version, > > e.g., v1 version + v3 data. This can lead to logical errors in the > > following execution in ll_dir_setstripe(), which performs different actions > > according to the version specified by the field lmm_magic. > > This isn't a serious bug in the end. The LOV_USER_MAGIC_V3 check just copies > a bit more data from userspace (the lmm_pool field). It would be more of a > problem if the reverse was possible (copy smaller V1 buffer, but change the > magic to LOV_USER_MAGIC_V3 afterward), but this isn't possible since the > second > copy is not done if there is a V1 magic. If the user changes from V3 magic > to V1 in a racy manner it means less data will be used than copied, which > is harmless. > > > This patch rechecks the version field lmm_magic in the second copy. If the > > version is not as expected, i.e., LOV_USER_MAGIC_V3, an error code will be > > returned: -EINVAL. > > This isn't a bad idea in any case, since it verifies the data copied from > userspace is still valid. So you agree with this patch? Or do not? confused, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: mt7621-eth: fix line over 80 char / extra line in mtk_set_link_ksettings()
On Thu, Apr 26, 2018 at 09:29:09PM -0300, Jefferson Capovilla wrote: > Fix 'line over 80 characters' issue found by checkpatch.pl script in > mtk_set_link_ksettings(). > Fix extra line before end of function. That is two different things, please break this up into two different emails and send them as a patch series. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] [v4] staging: wlan-ng: prism2sta: fixed indent coding style issues.
On Sat, Apr 28, 2018 at 08:26:29PM +, Efstratios Gavas wrote: > Fixed format/style issues found with checkpatch. No code changes. > Corrected alignment of variables after open parenthesis and line breaks. > Checkpatch now returns clean except for "line over 80 char" warnings. > > Signed-off-by: Efstratios Gavas > --- > v2(unlabled): changed title info > v3: improved changlog description > v4: corrected patch versioning > --- > drivers/staging/wlan-ng/prism2sta.c | 52 > + > 1 file changed, 24 insertions(+), 28 deletions(-) I see 2 different emails here again :( I don't know what you are doing that causes this, but you should try to fix it up... v5? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: luster: llite: fix a potential missing-check bug when copying lumv
On Sun, Apr 29, 2018 at 8:20 AM, Greg Kroah-Hartman wrote: > On Sat, Apr 28, 2018 at 04:04:25PM +, Dilger, Andreas wrote: >> On Apr 27, 2018, at 17:45, Wenwen Wang wrote: >> > [PATCH] staging: luster: llite: fix potential missing-check bug when >> > copying lumv >> >> (typo) s/luster/lustre/ >> >> > In ll_dir_ioctl(), the object lumv3 is firstly copied from the user space >> > using Its address, i.e., lumv1 = &lumv3. If the lmm_magic field of lumv3 is >> > LOV_USER_MAGIV_V3, lumv3 will be modified by the second copy from the user >> >> (typo) s/MAGIV/MAGIC/ >> >> > space. The second copy is necessary, because the two versions (i.e., >> > lov_user_md_v1 and lov_user_md_v3) have different data formats and lengths. >> > However, given that the user data resides in the user space, a malicious >> > user-space process can race to change the data between the two copies. By >> > doing so, the attacker can provide a data with an inconsistent version, >> > e.g., v1 version + v3 data. This can lead to logical errors in the >> > following execution in ll_dir_setstripe(), which performs different actions >> > according to the version specified by the field lmm_magic. >> >> This isn't a serious bug in the end. The LOV_USER_MAGIC_V3 check just copies >> a bit more data from userspace (the lmm_pool field). It would be more of a >> problem if the reverse was possible (copy smaller V1 buffer, but change the >> magic to LOV_USER_MAGIC_V3 afterward), but this isn't possible since the >> second >> copy is not done if there is a V1 magic. If the user changes from V3 magic >> to V1 in a racy manner it means less data will be used than copied, which >> is harmless. >> >> > This patch rechecks the version field lmm_magic in the second copy. If the >> > version is not as expected, i.e., LOV_USER_MAGIC_V3, an error code will be >> > returned: -EINVAL. >> >> This isn't a bad idea in any case, since it verifies the data copied from >> userspace is still valid. > > So you agree with this patch? Or do not? > > confused, > > greg k-h It is worth fixing this bug, since it offers an opportunity for adversaries to provide inconsistent user data. In addition to the unwanted version LOV_USER_MAGIC_V1, a malicious user can also use the version LMV_USER_MAGIC, which is also unexpected but allowed in the function ll_dir_setstripe(). These inconsistent data can cause potential logical errors in the following execution. Hence it is necessary to re-verify the data copied from userspace. Thanks! Wenwen ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 09/30] staging: mt7621-mmc: Remove function uffs
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > 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. This difference is that uffs receives and returns an "unsigned int". Maybe not a significant difference, but worth mentioning that you noticed it and reasoned that it wasn't significant. > @@ -1004,13 +975,13 @@ static inline void sdr_clr_bits(void __iomem *reg, u32 > bs) > do { \ > volatile unsigned int tv = sdr_read32(reg); \ > tv &= ~(field); \ > - tv |= ((val) << (uffs((unsigned int)field) - 1)); \ > + tv |= ((val) << (ffs((unsigned int)field) - 1));\ Given that ffs() takes an "int", it is odd to cast "field" to an unsigned int to pass it. "field" is always a constant int, so no cast is needed. Thanks, NeilBrown > sdr_write32(reg, tv); \ > } while (0) > #define sdr_get_field(reg, field, val) > \ > do { \ > volatile unsigned int tv = sdr_read32(reg); \ > - val = ((tv & (field)) >> (uffs((unsigned int)field) - 1)); \ > + val = ((tv & (field)) >> (ffs((unsigned int)field) - 1)); \ > } while (0) > > #endif > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 11/30] staging: mt7621-mmc: Replace macro sdr_get_field with function
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > 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 > --- > drivers/staging/mt7621-mmc/mt6575_sd.h | 10 +- > drivers/staging/mt7621-mmc/sd.c| 14 -- > 2 files changed, 13 insertions(+), 11 deletions(-) > > diff --git a/drivers/staging/mt7621-mmc/mt6575_sd.h > b/drivers/staging/mt7621-mmc/mt6575_sd.h > index 90b4ee6b396b..195c7333f77d 100644 > --- a/drivers/staging/mt7621-mmc/mt6575_sd.h > +++ b/drivers/staging/mt7621-mmc/mt6575_sd.h > @@ -980,10 +980,10 @@ static inline void sdr_set_field(void __iomem *reg, u32 > field, u32 val) > writel(tv, reg); > } > > -#define sdr_get_field(reg, field, val) > \ > -do { \ > - volatile unsigned int tv = sdr_read32(reg); \ > - val = ((tv & (field)) >> (ffs((unsigned int)field) - 1)); \ > -} while (0) > +static inline void sdr_get_field(void __iomem *reg, u32 field, u32 *val) > +{ > + unsigned int tv = readl(reg); > + *val = ((tv & field) >> (ffs((unsigned int)field) - 1)); > +} Converting this to a function it good, but it should return val rather than set *val. > > #endif > diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c > index 00dacf8c9625..f4da48a5772b 100644 > --- a/drivers/staging/mt7621-mmc/sd.c > +++ b/drivers/staging/mt7621-mmc/sd.c > @@ -1577,8 +1577,8 @@ static int msdc_tune_cmdrsp(struct msdc_host *host, > struct mmc_command *cmd) > ==*/ > > // save the previous tune result > - sdr_get_field(MSDC_IOCON,MSDC_IOCON_RSPL,orig_rsmpl); > - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, orig_rrdly); > + sdr_get_field(MSDC_IOCON,MSDC_IOCON_RSPL,&orig_rsmpl); > + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY, &orig_rrdly); So this becomes > + orig_rsmpl = sdr_get_field(MSDC_IOCON,MSDC_IOCON_RSPL); > + orig_rrdly = sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_CMDRRDLY); which is much easier to understand at first glance. Thanks, NeilBrown > > rrdly = 0; > do { > @@ -1640,7 +1640,7 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct > mmc_request *mrq) > int result = -1; > u32 skip = 1; > > - sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, orig_dsmpl); > + sdr_get_field(MSDC_IOCON, MSDC_IOCON_DSPL, &orig_dsmpl); > > /* Tune Method 2. */ > sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); > @@ -1664,7 +1664,9 @@ static int msdc_tune_bread(struct mmc_host *mmc, struct > mmc_request *mrq) > } > result = msdc_do_request(mmc, mrq); > > - sdr_get_field(SDC_DCRC_STS, SDC_DCRC_STS_POS | > SDC_DCRC_STS_NEG, dcrc); /* RO */ > + sdr_get_field(SDC_DCRC_STS, > + SDC_DCRC_STS_POS | SDC_DCRC_STS_NEG, > + &dcrc); /* RO */ > if (!ddr) > dcrc &= ~SDC_DCRC_STS_NEG; > ERR_MSG("TUNE_BREAD<%s> dcrc<0x%x> > DATRDDLY0/1<0x%x><0x%x> dsmpl<0x%x>", > @@ -1751,8 +1753,8 @@ static int msdc_tune_bwrite(struct mmc_host *mmc, > struct mmc_request *mrq) > > // MSDC_IOCON_DDR50CKD need to check. [Fix me] > > - sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, orig_wrrdly); > - sdr_get_field(MSDC_IOCON,MSDC_IOCON_DSPL,orig_dsmpl); > + sdr_get_field(MSDC_PAD_TUNE, MSDC_PAD_TUNE_DATWRDLY, &orig_wrrdly); > + sdr_get_field(MSDC_IOCON,MSDC_IOCON_DSPL,&orig_dsmpl); > > /* Tune Method 2. just DAT0 */ > sdr_set_field(MSDC_IOCON, MSDC_IOCON_DDLSEL, 1); > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 23/30] staging: mt7621-mmc: Remove initialisation in msdc_dma_config
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > 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. But it isn't only used by the for_each_sg macro. switch (dma->mode) { case MSDC_MODE_DMA_BASIC: BUG_ON(host->xfer_size > 65535); BUG_ON(dma->sglen != 1); sdr_write32(MSDC_DMA_SA, PHYSADDR(sg_dma_address(sg))); This now references an uninitialized variable, as do several other places. Maybe you could move the initialization into the MSDC_MODE_DMA_BASIC case. Thanks, NeilBrown > > Signed-off-by: Christian Lütke-Stetzkamp > --- > drivers/staging/mt7621-mmc/sd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c > index a2dce54e386c..c9f0180f3220 100644 > --- a/drivers/staging/mt7621-mmc/sd.c > +++ b/drivers/staging/mt7621-mmc/sd.c > @@ -1091,7 +1091,7 @@ static int msdc_dma_config(struct msdc_host *host, > struct msdc_dma *dma) > void __iomem *base = host->base; > //u32 i, j, num, bdlen, arg, xfersz; > u32 j, num; > - struct scatterlist *sg = dma->sg; > + struct scatterlist *sg; > struct gpd *gpd; > struct bd *bd; > > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 24/30] staging: mt7621-mmc: Inline function msdc_set_blknum
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > 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 > --- > drivers/staging/mt7621-mmc/sd.c | 10 +- > 1 file changed, 1 insertion(+), 9 deletions(-) > > diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c > index c9f0180f3220..00c862b02419 100644 > --- a/drivers/staging/mt7621-mmc/sd.c > +++ b/drivers/staging/mt7621-mmc/sd.c > @@ -1182,14 +1182,6 @@ static void msdc_dma_setup(struct msdc_host *host, > struct msdc_dma *dma, > msdc_dma_config(host, dma); > } > > -/* set block number before send command */ > -static void msdc_set_blknum(struct msdc_host *host, u32 blknum) > -{ > - void __iomem *base = host->base; > - > - sdr_write32(SDC_BLK_NUM, blknum); > -} > - This change is correct, but the reason isn't obvious. In mt6575_sd.h are: #define SDC_BLK_NUM REG_ADDR(SDC_BLK_NUM) #define REG_ADDR(x) (base + OFFSET_##x) So the above becomes sdr_write32((base + OFFSET_SDC_BLK_NUM), blknum); so the base is important. msdc_do_request() starts with void __iomem *base = host->base; and never changes host. So that "base" that is used in the new code is the same as the "base" used in the old code. Ugh.. what a horrible way to write code! Thanks, NeilBrown > static int msdc_do_request(struct mmc_host *mmc, struct mmc_request *mrq) > __must_hold(&host->lock) > { > @@ -1239,7 +1231,7 @@ static int msdc_do_request(struct mmc_host *mmc, struct > mmc_request *mrq) > } > } > > - msdc_set_blknum(host, data->blocks); > + sdr_write32(SDC_BLK_NUM, data->blocks); > //msdc_clr_fifo(); /* no need */ > > msdc_dma_on(); /* enable DMA mode first!! */ > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 27/30] staging: mt7621-mmc: Always use linked DMA mode
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > 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 > --- > drivers/staging/mt7621-mmc/sd.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c > index b51a4b156605..706eab4e1237 100644 > --- a/drivers/staging/mt7621-mmc/sd.c > +++ b/drivers/staging/mt7621-mmc/sd.c > @@ -1169,10 +1169,7 @@ static void msdc_dma_setup(struct msdc_host *host, > struct msdc_dma *dma, > dma->sg = sg; > dma->sglen = sglen; > > - if (sglen == 1 && sg_dma_len(sg) <= MAX_DMA_CNT) > - dma->mode = MSDC_MODE_DMA_BASIC; > - else > - dma->mode = MSDC_MODE_DMA_DESC; > + dma->mode = MSDC_MODE_DMA_DESC; So now you can remove the MSDC_MODE_DMA_BASIC code, and remove the switch statement which chooses it, and the name itself. Lots of good cleanups happening here, thanks. NeilBrown > > N_MSG(DMA, "DMA mode<%d> sglen<%d> xfersz<%d>", dma->mode, dma->sglen, > host->xfer_size); > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/30] staging: mt7621-mmc: Next cleanups
On Sun, Apr 29 2018, Christian Lütke-Stetzkamp wrote: > Here are the next cleanups for the mt7621-mmc driver. It contains the > removal of some unused things, the removal of the non DMA code and > always using linked DMA mode together with some minor cleanups. Thanks for these. As mentioned separately I found one bug, but the relevant code becomes inactive and can now be removed. I'm happy for this to go in as-is with a couple of fix-ups to come in the next batch. I've tested and I can still access my sd card with no apparent issues. Reviewed-by: NeilBrown Thanks, NeilBrown > > Christian Lütke-Stetzkamp (30): > staging: mt7621-mmc: Fix typo in function parameters > staging: mt7621-mmc: Remove unused field cmd_edge from msdc_hw > staging: mt7621-mmc: Remove unused field data_edge from msdc_hw > staging: mt7621-mmc: Remove unused field dat_drv from msdc_hw > staging: mt7621-mmc: Remove unused field cmd_drv from msdc_hw > staging: mt7621-mmc: Remove unused field clk_drv from msdc_hw > staging: mt7621-mmc: Remove unused macro msdc_init_gpd_ex > staging: mt7621-mmc: Remove unused macros sdr_{read,write}16 > staging: mt7621-mmc: Remove function uffs > staging: mt7621-mmc: Replace macro sdr_set_field with function > staging: mt7621-mmc: Replace macro sdr_get_field with function > staging: mt7621-mmc: Remove unused static msdc_regs > staging: mt7621-mmc: Remove transfer mode setting from proc > staging: mt7621-mmc: Remove transfer mode setting variable > staging: mt7621-mmc: Remove unused global dma_size > staging: mt7621-mmc: Remove non-DMA transfer code > staging: mt7621-mmc: Remove unused variable dma_xfer from msdc_host > staging: mt7621-mmc: Fix error number assignment > staging: mt7621-mmc: Remove unused field abort from msdc_host > staging: mt7621-mmc: Remove unused sdio irq code > staging: mt7621-mmc: Do not BUG() if mrq set in msdc_ops_request > staging: mt7621-mmc: Remove redundant check for card status > staging: mt7621-mmc: Remove initialisation in msdc_dma_config > staging: mt7621-mmc: Inline function msdc_set_blknum > staging: mt7621-mmc: Don't disables DMA > staging: mt7621-mmc: Change return value of msdc_dma_config to void > staging: mt7621-mmc: Always use linked DMA mode > staging: mt7621-mmc: Remove unused macro HOST_MAX_NUM > staging: mt7621-mmc: Cleanup includes > staging: mt7621-mmc: Remove unused barrier macros > > drivers/staging/mt7621-mmc/board.h | 7 - > drivers/staging/mt7621-mmc/dbg.c | 38 --- > drivers/staging/mt7621-mmc/dbg.h | 3 - > drivers/staging/mt7621-mmc/mt6575_sd.h | 60 + > drivers/staging/mt7621-mmc/sd.c| 479 > ++--- > 5 files changed, 96 insertions(+), 491 deletions(-) > > -- > 2.16.1 signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel