mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Subsystems (4)
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Re-sending as these patches did not make it to the lists due to issues with my 'git send-email'
This series mainly cleans up all instances of hardcoding's in the driver based on pdev->id. This is cleanup leading to the DT adaptation of omap_hsmmc driver.
v2 mainly has some minor changes to get rid of a debug print which was still using host->id and getting rid of 'id' field entirely from omap_hsmmc_host struct.
The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP boards.
regards,
Rajendra
Balaji T K (3):
mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA
channels
mmc: omap_hsmmc: remove unused .set_sleep function
mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove
host->id based hardcoding
Rajendra Nayak (3):
mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply
arch/arm/plat-omap/include/plat/mmc.h | 2 - drivers/mmc/host/omap_hsmmc.c | 175 +++------------------------------ 2 files changed, 16 insertions(+), 161 deletions(-)
PATCH v2 1/6 mmc: omap_hsmmc: use platform_get_resource_byname for tx/rx DMA channels
From: Balaji T K <[email protected]>
Git rid of hardcoded tx/rx DMA channels based on pdev->id and use platform_get_resource_byname() to retrieve them instead.
--- drivers/mmc/host/omap_hsmmc.c | 35 +++++++++++------------------------ 1 files changed, 11 insertions(+), 24 deletions(-)
drivers/mmc/host/omap_hsmmc.c +11 -24
@@ -1977,32 +1977,19 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev)omap_hsmmc_conf_bus_power (host); -/* Select DMA lines */ -switch (host->id) { -case OMAP_MMC1_DEVID : - host->dma_line_tx =OMAP24XX_DMA_MMC1_TX ; - host->dma_line_rx =OMAP24XX_DMA_MMC1_RX ; -break ; -case OMAP_MMC2_DEVID : - host->dma_line_tx =OMAP24XX_DMA_MMC2_TX ; - host->dma_line_rx =OMAP24XX_DMA_MMC2_RX ; -break ; -case OMAP_MMC3_DEVID : - host->dma_line_tx =OMAP34XX_DMA_MMC3_TX ; - host->dma_line_rx =OMAP34XX_DMA_MMC3_RX ; -break ; -case OMAP_MMC4_DEVID : - host->dma_line_tx =OMAP44XX_DMA_MMC4_TX ; - host->dma_line_rx =OMAP44XX_DMA_MMC4_RX ; -break ; -case OMAP_MMC5_DEVID : - host->dma_line_tx =OMAP44XX_DMA_MMC5_TX ; - host->dma_line_rx =OMAP44XX_DMA_MMC5_RX ; -break ; -default : -dev_err (mmc_dev (host->mmc),"Invalid MMC id\n" ); + res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"tx" ); +if (!res) { +dev_err (mmc_dev (host->mmc),"cannot get DMA TX channel\n" ); + goto err_irq; + } + host->dma_line_tx = res->start; + + res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"rx" ); +if (!res) { +dev_err (mmc_dev (host->mmc),"cannot get DMA RX channel\n" ); goto err_irq; } + host->dma_line_rx = res->start;/* Request IRQ for MMC operations */ ret = request_irq(host->irq, omap_hsmmc_irq, 0,
Signature · 1 line
1.7.1
PATCH v2 2/6 mmc: omap_hsmmc: remove unused .set_sleep function
In reply to Rajendra NayakFrom: Balaji T K <[email protected]>
set_sleep seems to be unused in omap_hsmmc driver. so get rid of it.
--- arch/arm/plat-omap/include/plat/mmc.h | 2 - drivers/mmc/host/omap_hsmmc.c | 60 --------------------------------- 2 files changed, 0 insertions(+), 62 deletions(-)
arch/arm/plat-omap/include/plat/mmc.h +0 -2
@@ -137,8 +137,6 @@ struct omap_mmc_platform_data {int (*set_power)(struct device *dev,int slot,int power_on,int vdd);int (*get_ro)(struct device *dev,int slot); -int (*set_sleep)(struct device *dev,int slot,int sleep, -int vdd,int cardsleep);void (*remux)(struct device *dev,int slot,int power_on);/* Call back before enabling / disabling regulators */ void (*before_set_reg)(struct device *dev, int slot,
drivers/mmc/host/omap_hsmmc.c +0 -60
93 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v2 3/6 mmc: omap_hsmmc: Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag to remove host->id based hardcoding
In reply to Rajendra NayakFrom: Balaji T K <[email protected]>
Use OMAP_HSMMC_SUPPORTS_DUAL_VOLT flag instead of host->id for identifying SD bus voltage capabilities.
--- drivers/mmc/host/omap_hsmmc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -1
@@ -650,7 +650,7 @@ static int omap_hsmmc_context_restore(struct omap_hsmmc_host *host)OMAP_HSMMC_WRITE (host->base,SYSCONFIG ,OMAP_HSMMC_READ (host->base,SYSCONFIG ) |AUTOIDLE ); -if (host->id ==OMAP_MMC1_DEVID ) { +if (host->pdata->controller_flags &OMAP_HSMMC_SUPPORTS_DUAL_VOLT ) {if (host->power_mode !=MMC_POWER_OFF && (1 << ios->vdd) <=MMC_VDD_23_24 ) hctl =SDVS18 ;
Signature · 1 line
1.7.1
PATCH v2 4/6 mmc: omap_hsmmc: Get rid of omap_hsmmc_1_set_power function
In reply to Rajendra NayakUse omap_hsmmc_235_set_poweri() (now renamed as omap_hsmmc_set_power()) for MMC1 instance as well and get rid of omap_hsmmc_1_set_power() completely.omap_hsmmc_235_set_power() seems to implemented as a superset of omap_hsmmc_1_set_power() with additonal functionality implemented based on additional checks and hence should just work for MMC1 as well.
--- drivers/mmc/host/omap_hsmmc.c | 30 +++--------------------------- 1 files changed, 3 insertions(+), 27 deletions(-)
drivers/mmc/host/omap_hsmmc.c +3 -27
@@ -241,28 +241,7 @@ static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)#ifdef CONFIG_REGULATOR -static int omap_hsmmc_1_set_power (struct device *dev,int slot,int power_on, -int vdd) -{ -struct omap_hsmmc_host *host = -platform_get_drvdata (to_platform_device (dev)); -int ret; - -if (mmc_slot (host).before_set_reg) -mmc_slot (host).before_set_reg (dev, slot, power_on, vdd); - -if (power_on) - ret =mmc_regulator_set_ocr (host->mmc, host->vcc, vdd); -else - ret =mmc_regulator_set_ocr (host->mmc, host->vcc,0 ); - -if (mmc_slot (host).after_set_reg) -mmc_slot (host).after_set_reg (dev, slot, power_on, vdd); - -return ret; -} - -static int omap_hsmmc_235_set_power (struct device *dev,int slot,int power_on, +static int omap_hsmmc_set_power (struct device *dev,int slot,int power_on,int vdd) { struct omap_hsmmc_host *host =
@@ -332,14 +311,11 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)switch (host->id) {case OMAP_MMC1_DEVID : -/* On-chip level shifting via PBIAS0/PBIAS1 */ -mmc_slot (host).set_power = omap_hsmmc_1_set_power; -break ;case OMAP_MMC2_DEVID :case OMAP_MMC3_DEVID :case OMAP_MMC5_DEVID : -/* Off-chip level shifting, or none */ -mmc_slot (host).set_power = omap_hsmmc_235_set_power; +/* On-chip level shifting via PBIAS0/PBIAS1 */ +mmc_slot (host).set_power = omap_hsmmc_set_power;break ;case OMAP_MMC4_DEVID :mmc_slot (host).set_power = omap_hsmmc_4_set_power;
Signature · 1 line
1.7.1
PATCH v2 5/6 mmc: omap_hsmmc: Get rid of omap_hsmmc_4_set_power function
In reply to Rajendra NayakNow that omap_hsmmc_set_power() already has a check to return 0 if !host->vcc, it seems like it can be used even on MMC4 instead of the dummy omap_hsmmc_4_set_power().
This also helps get rid of all the host->id based check to populate the right function for on-chip/external level shifting and use omap_hsmmc_set_power() for all MMC modules.
--- drivers/mmc/host/omap_hsmmc.c | 21 +-------------------- 1 files changed, 1 insertions(+), 20 deletions(-)
drivers/mmc/host/omap_hsmmc.c +1 -20
@@ -297,32 +297,13 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,return ret; } -static int omap_hsmmc_4_set_power (struct device *dev,int slot,int power_on, -int vdd) -{ -return 0 ; -} -static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) {struct regulator *reg;int ret =0 ;int ocr_value =0 ; -switch (host->id) { -case OMAP_MMC1_DEVID : -case OMAP_MMC2_DEVID : -case OMAP_MMC3_DEVID : -case OMAP_MMC5_DEVID : -/* On-chip level shifting via PBIAS0/PBIAS1 */ -mmc_slot (host).set_power = omap_hsmmc_set_power; -break ; -case OMAP_MMC4_DEVID : -mmc_slot (host).set_power = omap_hsmmc_4_set_power; -default : -pr_err ("MMC%d configuration not supported!\n" , host->id); -return -EINVAL ; - } +mmc_slot (host).set_power = omap_hsmmc_set_power; reg =regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {
Signature · 1 line
1.7.1
PATCH v2 6/6 mmc: omap_hsmmc: Don't expect MMC1 to always have vmmc supply
In reply to Rajendra NayakMMC1 is not the only instance that can be used/wired for SD. So remove this assumption from the driver.
Now that all the mmc id based usage is removed, get rid of all the DEVID defines and also the 'id' field from the omap_hsmmc_host structure.
--- drivers/mmc/host/omap_hsmmc.c | 31 ++----------------------------- 1 files changed, 2 insertions(+), 29 deletions(-)
drivers/mmc/host/omap_hsmmc.c +2 -29
@@ -106,17 +106,6 @@#define SOFTRESET (1 << 1)#define RESETDONE (1 << 0) -/* -* FIXME: Most likely all the data using these _DEVID defines should come -* from the platform_data, or implemented in controller and slot specific -* functions. -*/ -#define OMAP_MMC1_DEVID 0 -#define OMAP_MMC2_DEVID 1 -#define OMAP_MMC3_DEVID 2 -#define OMAP_MMC4_DEVID 3 -#define OMAP_MMC5_DEVID 4 -#define MMC_AUTOSUSPEND_DELAY 100#define MMC_TIMEOUT_MS 20#define OMAP_MMC_MIN_CLOCK 400000
@@ -164,7 +153,6 @@ struct omap_hsmmc_host {void __iomem *base;resource_size_t mapbase;spinlock_t irq_lock;/* Prevent races with irq handler */ -unsigned int id;unsigned int dma_len;unsigned int dma_sg_idx;unsigned char bus_mode;
@@ -300,7 +288,6 @@ static int omap_hsmmc_set_power(struct device *dev, int slot, int power_on,static int omap_hsmmc_reg_get (struct omap_hsmmc_host *host) {struct regulator *reg; -int ret =0 ;int ocr_value =0 ;mmc_slot (host).set_power = omap_hsmmc_set_power;
@@ -308,15 +295,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) reg =regulator_get (host->dev,"vmmc" );if (IS_ERR (reg)) {dev_dbg (host->dev,"vmmc regulator missing\n" ); -/* -* HACK: until fixed.c regulator is usable, -* we don't require a main regulator -* for MMC2 or MMC3 -*/ -if (host->id ==OMAP_MMC1_DEVID ) { - ret =PTR_ERR (reg); - goto err; - } }else { host->vcc = reg; ocr_value =mmc_regulator_get_ocrmask (reg);
@@ -324,8 +302,8 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)mmc_slot (host).ocr_mask = ocr_value; }else {if (!(mmc_slot (host).ocr_mask & ocr_value)) { -pr_err ("MMC%d ocrmask %x is not supported\n" , - host->id,mmc_slot (host).ocr_mask); +pr_err ("MMC ocrmask %x is not supported\n" , +mmc_slot (host).ocr_mask);mmc_slot (host).ocr_mask =0 ;return -EINVAL ; }
@@ -358,10 +336,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host) }return 0 ; - -err: -mmc_slot (host).set_power =NULL ; -return ret; }static void omap_hsmmc_reg_put (struct omap_hsmmc_host *host)
@@ -1791,7 +1765,6 @@ static int __init omap_hsmmc_probe(struct platform_device *pdev) host->dev->dma_mask = &pdata->dma_mask; host->dma_ch =-1 ; host->irq = irq; - host->id = pdev->id; host->slot_id =0 ; host->mapbase = res->start; host->base =ioremap (host->mapbase,SZ_4K );
Signature · 1 line
1.7.1
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
In reply to Rajendra NayakChris,
Quoted 7 lines · Rajendra Nayak
Re-sending as these patches did not make it to the lists due to issues with my 'git send-email'
This series mainly cleans up all instances of hardcoding's in the driver based on
pdev->id. This is cleanup leading to the DT adaptation ofomap_hsmmcdriver.
Quoted 6 lines
v2 mainly has some minor changes to get rid of a debug print which was still using
host->idand getting rid of 'id' field entirely fromomap_hsmmc_hoststruct.The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP boards.
This series is reviewed/tested and acked by Balaji and Venkat. Care to pull this in for 3.4?
I have one other cleanup patch on top of this series to make all remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.
These patches are cleanups leading to the DT conversion of omap_hsmmc driver.
regards,
Rajendra
[1] http://marc.info/?l=linux-mmc&m=132999677405098&w=3
Quoted 20 lines
regards,
RajendraBalaji T K (3):
mmc:omap_hsmmc: useplatform_get_resource_bynamefor tx/rx DMA
channels
mmc:omap_hsmmc: remove unused .set_sleep function
mmc:omap_hsmmc: UseOMAP_HSMMC_SUPPORTS_DUAL_VOLTflag to removehost->id based hardcodingRajendra Nayak (3):
mmc:omap_hsmmc: Get rid ofomap_hsmmc_1_set_powerfunction
mmc:omap_hsmmc: Get rid ofomap_hsmmc_4_set_powerfunction
mmc:omap_hsmmc: Don't expect MMC1 to always have vmmc supplyarch/arm/plat-omap/include/plat/mmc.h | 2 - drivers/mmc/host/omap_hsmmc.c | 175 +++------------------------------ 2 files changed, 16 insertions(+), 161 deletions(-)
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Quoted 20 lines · Rajendra Nayak
Chris,
Quoted 7 lines · Rajendra Nayak
Re-sending as these patches did not make it to the lists due to issues with my 'git send-email'
This series mainly cleans up all instances of hardcoding's in the driver based on
pdev->id. This is cleanup leading to the DT adaptation ofomap_hsmmcdriver.Quoted 6 lines
v2 mainly has some minor changes to get rid of a debug print which was still using
host->idand getting rid of 'id' field entirely fromomap_hsmmc_hoststruct.The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP boards.
This series is reviewed/tested and acked by Balaji and Venkat. Care to pull this in for 3.4?
Quoted 6 lines
I have one other cleanup patch on top of this series to make all remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.These patches are cleanups leading to the DT conversion of
omap_hsmmcdriver.
Chris, Ping. I am basing my DT support patches on top of these cleanups. Would be great if you can have a look and pull them in.
Quoted 27 lines
regards,
Rajendra[1] http://marc.info/?l=linux-mmc&m=132999677405098&w=3
Quoted 20 lines
regards,
RajendraBalaji T K (3):
mmc:omap_hsmmc: useplatform_get_resource_bynamefor tx/rx DMA channels
mmc:omap_hsmmc: remove unused .set_sleep function
mmc:omap_hsmmc: UseOMAP_HSMMC_SUPPORTS_DUAL_VOLTflag to removehost->idbased hardcodingRajendra Nayak (3):
mmc:omap_hsmmc: Get rid ofomap_hsmmc_1_set_powerfunction
mmc:omap_hsmmc: Get rid ofomap_hsmmc_4_set_powerfunction
mmc:omap_hsmmc: Don't expect MMC1 to always have vmmc supply
arch/arm/plat-omap/include/plat/mmc.h| 2 -drivers/mmc/host/omap_hsmmc.c| 175 +++------------------------------2 files changed, 16 insertions(+), 161 deletions(-)
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Quoted 26 lines · Rajendra Nayak
Quoted 25 lines · Rajendra Nayak
Chris,
Quoted 7 lines · Rajendra Nayak
Re-sending as these patches did not make it to the lists due to issues with my 'git send-email'
This series mainly cleans up all instances of hardcoding's in the driver based on
pdev->id. This is cleanup leading to the DT adaptation ofomap_hsmmcdriver.Quoted 7 lines
v2 mainly has some minor changes to get rid of a debug print which was still using
host->idand getting rid of 'id' field entirely fromomap_hsmmc_hoststruct.The series is tested on OMAP4SDP, OMAP4panda, OMAP3beagle and OMAP2430SDP
boards.This series is reviewed/tested and acked by Balaji and Venkat. Care to pull this in for 3.4?
I have one other cleanup patch on top of this series to make all remaining pr_* prints in the driver to dev_* [1].
It would be great if you could pick that up as well.
Quoted 5 lines
Quoted 2 lines
These patches are cleanups leading to the DT conversion of
omap_hsmmcdriver.Chris, Ping. I am basing my DT support patches on top of these cleanups. Would be great if you can have a look and pull them in.
Chris, just realized the last two requests from me to get this merged weren't addressed to you directly, but instead you were copied. Resending with you in 'To', hope this lands in your inbox :)
regards,
Rajendra
Quoted 29 lines
Quoted 28 lines
regards,
Rajendra[1] http://marc.info/?l=linux-mmc&m=132999677405098&w=3
Quoted 20 lines
regards,
RajendraBalaji T K (3):
mmc:omap_hsmmc: useplatform_get_resource_bynamefor tx/rx DMA channels
mmc:omap_hsmmc: remove unused .set_sleep function
mmc:omap_hsmmc: UseOMAP_HSMMC_SUPPORTS_DUAL_VOLTflag to removehost->idbased hardcodingRajendra Nayak (3):
mmc:omap_hsmmc: Get rid ofomap_hsmmc_1_set_powerfunction
mmc:omap_hsmmc: Get rid ofomap_hsmmc_4_set_powerfunction
mmc:omap_hsmmc: Don't expect MMC1 to always have vmmc supply
arch/arm/plat-omap/include/plat/mmc.h| 2 -drivers/mmc/host/omap_hsmmc.c| 175 +++------------------------------2 files changed, 16 insertions(+), 161 deletions(-)
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Hi Rajendra,
Quoted 6 lines · Rajendra Nayak
Quoted 2 lines
Chris, Ping. I am basing my DT support patches on top of these cleanups. Would be great if you can have a look and pull them in.
Chris, just realized the last two requests from me to get this merged weren't addressed to you directly, but instead you were copied. Resending with you in 'To', hope this lands in your inbox :)
Sorry for the delay, thanks for the ping; I've pushed these to mmc-next for 3.4 now.
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Quoted 6 lines · Chris Ball
Hi Rajendra,
Quoted 3 lines · Rajendra Nayak
Quoted 2 lines
Chris, Ping. I am basing my DT support patches on top of these cleanups. Would be great if you can have a look and pull them in.
Quoted 6 lines
Quoted 3 lines
Chris, just realized the last two requests from me to get this merged weren't addressed to you directly, but instead you were copied. Resending with you in 'To', hope this lands in your inbox :)
Sorry for the delay, thanks for the ping; I've pushed these to mmc-next for 3.4 now.
Great, thanks Chris.
Quoted 4 lines
Thanks,
- Chris.
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
In reply to Chris BallHi Chris,
Quoted 6 lines · Chris Ball
Hi Rajendra,
Quoted 3 lines · Rajendra Nayak
Quoted 2 lines
Chris, Ping. I am basing my DT support patches on top of these cleanups. Would be great if you can have a look and pull them in.
Quoted 6 lines
Quoted 3 lines
Chris, just realized the last two requests from me to get this merged weren't addressed to you directly, but instead you were copied. Resending with you in 'To', hope this lands in your inbox :)
Sorry for the delay, thanks for the ping; I've pushed these to mmc-next for 3.4 now.
There's just one other cleanup patch here [1] to convert all pr_* prints in the driver to dev_*. Would be great if you can pick that as well.
Thanks,
Rajendra
[1] http://marc.info/?l=linux-mmc&m=132999677405098&w=3
Quoted 4 lines
Thanks,
- Chris.
v2 cover mmc: omap_hsmmc: Clean up use/abuse of pdev->id
Hi,
Quoted 7 lines · Rajendra Nayak
There's just one other cleanup patch here [1] to convert all pr_* prints in the driver to dev_*. Would be great if you can pick that as well.
Thanks,
Rajendra
Thanks, I've pushed this to mmc-next for 3.4 now too.
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child