diff mbox

[2/8] mmc: omap: Fix DMA configuration to not rely on device id

Message ID 20131118184723.GR10317@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren Nov. 18, 2013, 6:47 p.m. UTC
* Tony Lindgren <tony@atomide.com> [131113 18:36]:
> We are wrongly relying on device id for the DMA configuration
> which can lead to wrong DMA channel being selected.
> 
> Fix the issue by using the standard resources like we should.
> 
> Cc: Chris Ball <cjb@laptop.org>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> 
> If this looks OK, I'd like to merge this as a fix via arm-soc tree
> along with the other patches in this series as my later patches
> depend on patches in this series.

Looks like we need sig initialized in this patch to avoid some
uninitialized warnings.

Regards,

Tony


From: Tony Lindgren <tony@atomide.com>
Date: Thu, 14 Nov 2013 15:25:06 -0800
Subject: [PATCH] mmc: omap: Fix DMA configuration to not rely on device id

We are wrongly relying on device id for the DMA configuration
which can lead to wrong DMA channel being selected.

Fix the issue by using the standard resources like we should.

Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Chris Ball Nov. 26, 2013, 11:33 p.m. UTC | #1
Hi Tony,

On Mon, Nov 18 2013, Tony Lindgren wrote:
> We are wrongly relying on device id for the DMA configuration
> which can lead to wrong DMA channel being selected.
>
> Fix the issue by using the standard resources like we should.
>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Tony Lindgren <tony@atomide.com>

Feel free to merge via your tree:

Acked-by: Chris Ball <cjb@laptop.org>

- Chris.
Tony Lindgren Nov. 26, 2013, 11:52 p.m. UTC | #2
* Chris Ball <cjb@laptop.org> [131126 15:35]:
> Hi Tony,
> 
> On Mon, Nov 18 2013, Tony Lindgren wrote:
> > We are wrongly relying on device id for the DMA configuration
> > which can lead to wrong DMA channel being selected.
> >
> > Fix the issue by using the standard resources like we should.
> >
> > Cc: Chris Ball <cjb@laptop.org>
> > Cc: linux-mmc@vger.kernel.org
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Feel free to merge via your tree:
> 
> Acked-by: Chris Ball <cjb@laptop.org>

OK thanks will merge both mmc fixes.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jarkko Nikula Nov. 27, 2013, 8:57 p.m. UTC | #3
Hi Chris

On Tue, 26 Nov 2013 18:33:50 -0500
Chris Ball <cjb@laptop.org> wrote:

> Hi Tony,
> 
> On Mon, Nov 18 2013, Tony Lindgren wrote:
> > We are wrongly relying on device id for the DMA configuration
> > which can lead to wrong DMA channel being selected.
> >
> > Fix the issue by using the standard resources like we should.
> >
> > Cc: Chris Ball <cjb@laptop.org>
> > Cc: linux-mmc@vger.kernel.org
> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> Feel free to merge via your tree:
> 
> Acked-by: Chris Ball <cjb@laptop.org>
> 
Can you enlighten me what's the proper way to get patches to mmc since
I cannot figure out working methodology from MAINTAINERS file?

I happened to notice that Tony had this similar patch in linux-omap
list I sent first time already September to you and linux-mmc (sorry
linux-omap folks, I didn't want to spam multiple lists):

http://www.spinics.net/lists/linux-mmc/msg22137.html

After that I've resend the set a few times including a fix to
user triggable NULL pointer dereference:

http://www.spinics.net/lists/linux-mmc/msg22610.html

I'm fine if mmc patches should go through other subsystems but at least
it should be documented in MAINTAINERS file.
Tony Lindgren Nov. 27, 2013, 9:37 p.m. UTC | #4
* Jarkko Nikula <jarkko.nikula@bitmer.com> [131127 12:55]:
> Hi Chris
> 
> On Tue, 26 Nov 2013 18:33:50 -0500
> Chris Ball <cjb@laptop.org> wrote:
> 
> > Hi Tony,
> > 
> > On Mon, Nov 18 2013, Tony Lindgren wrote:
> > > We are wrongly relying on device id for the DMA configuration
> > > which can lead to wrong DMA channel being selected.
> > >
> > > Fix the issue by using the standard resources like we should.
> > >
> > > Cc: Chris Ball <cjb@laptop.org>
> > > Cc: linux-mmc@vger.kernel.org
> > > Signed-off-by: Tony Lindgren <tony@atomide.com>
> > 
> > Feel free to merge via your tree:
> > 
> > Acked-by: Chris Ball <cjb@laptop.org>
> > 
> Can you enlighten me what's the proper way to get patches to mmc since
> I cannot figure out working methodology from MAINTAINERS file?
> 
> I happened to notice that Tony had this similar patch in linux-omap
> list I sent first time already September to you and linux-mmc (sorry
> linux-omap folks, I didn't want to spam multiple lists):
> 
> http://www.spinics.net/lists/linux-mmc/msg22137.html
> 
> After that I've resend the set a few times including a fix to
> user triggable NULL pointer dereference:
> 
> http://www.spinics.net/lists/linux-mmc/msg22610.html
> 
> I'm fine if mmc patches should go through other subsystems but at least
> it should be documented in MAINTAINERS file.

Bummer, sounds like some duplicate work could have been avoided :(
I suggest resend to Chris and linux-mmc one more time as Chris should
pick up the MMC patches in general.

I've been just trying to get things working in general for v3.13-rc
series for omaps with device tree based booting and patching all over
the place. This is to make it easy for us to just drop the legacy
platform based booting for v3.14 while keeping things working.

Chris, as far as I'm concerned, Aaro and Jarkko are good people to
review and ack the drivers/mmc/omap.c patches, so adding Aaro to
Cc as well.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ball Nov. 27, 2013, 9:47 p.m. UTC | #5
Hi,

On Wed, Nov 27 2013, Jarkko Nikula wrote:
> Can you enlighten me what's the proper way to get patches to mmc since
> I cannot figure out working methodology from MAINTAINERS file?

Sorry about this, Jarkko.

Since I don't have omap.c hardware, I'm generally going to wait for
a Tested-by/Acked-by from someone else on patches like these.  We
actually have a maintainer already listed for the driver, Jarkko
Lavinen <jarkko.lavinen@nokia.com>.

So, maybe the MAINTAINERS section for drivers/mmc/host/omap.c needs
an update?  Feel free to send me patches to it.  Either way, I'll
start treating Aaro and Jarkko (Nikula) as maintainers for this
driver.

Thanks!

- Chris.
Tony Lindgren Nov. 27, 2013, 9:59 p.m. UTC | #6
* Chris Ball <cjb@laptop.org> [131127 13:48]:
> Hi,
> 
> On Wed, Nov 27 2013, Jarkko Nikula wrote:
> > Can you enlighten me what's the proper way to get patches to mmc since
> > I cannot figure out working methodology from MAINTAINERS file?
> 
> Sorry about this, Jarkko.
> 
> Since I don't have omap.c hardware, I'm generally going to wait for
> a Tested-by/Acked-by from someone else on patches like these.  We
> actually have a maintainer already listed for the driver, Jarkko
> Lavinen <jarkko.lavinen@nokia.com>.
> 
> So, maybe the MAINTAINERS section for drivers/mmc/host/omap.c needs
> an update?  Feel free to send me patches to it.  Either way, I'll
> start treating Aaro and Jarkko (Nikula) as maintainers for this
> driver.

Hmm looks like here's a reasonably recent update that we've missed
from Jarkko Lavinen to update his email address:

http://lkml.org/lkml/2013/10/4/142

I've updated Jarkko Lavinen's address in this mail, we should
probably also patch the MAINTAINERS file for that, and then see if
Aaro and Jarkko Nikula are interested to be listed there as well.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jarkko Nikula Nov. 28, 2013, 4:13 p.m. UTC | #7
Hi

On 11/27/2013 11:59 PM, Tony Lindgren wrote:
> * Chris Ball <cjb@laptop.org> [131127 13:48]:
>> Hi,
>>
>> On Wed, Nov 27 2013, Jarkko Nikula wrote:
>>> Can you enlighten me what's the proper way to get patches to mmc since
>>> I cannot figure out working methodology from MAINTAINERS file?
>>
>> Sorry about this, Jarkko.
>>
>> Since I don't have omap.c hardware, I'm generally going to wait for
>> a Tested-by/Acked-by from someone else on patches like these.  We
>> actually have a maintainer already listed for the driver, Jarkko
>> Lavinen <jarkko.lavinen@nokia.com>.
>>
>> So, maybe the MAINTAINERS section for drivers/mmc/host/omap.c needs
>> an update?  Feel free to send me patches to it.  Either way, I'll
>> start treating Aaro and Jarkko (Nikula) as maintainers for this
>> driver.
> 
Oh, I see. I even didn't check ./scripts/get_maintainer.pl nor check
MAINTAINERS file further than main MMC entry as I knew Jarkko L. is not
working anymore for Nokia. Sorry, we should have noticed that.

> Hmm looks like here's a reasonably recent update that we've missed
> from Jarkko Lavinen to update his email address:
> 
> http://lkml.org/lkml/2013/10/4/142
> 
> I've updated Jarkko Lavinen's address in this mail, we should
> probably also patch the MAINTAINERS file for that, and then see if
> Aaro and Jarkko Nikula are interested to be listed there as well.
> 
I can volunteer. Not that I know much about mmc but I like to keep my
legacy hw still running :-)
Jarkko Nikula Nov. 28, 2013, 5:02 p.m. UTC | #8
Hi

On 11/27/2013 11:37 PM, Tony Lindgren wrote:
> * Jarkko Nikula <jarkko.nikula@bitmer.com> [131127 12:55]:
> Bummer, sounds like some duplicate work could have been avoided :(
> I suggest resend to Chris and linux-mmc one more time as Chris should
> pick up the MMC patches in general.
> 
Before that should Chris merge your 2 patches in order to avoid couple
trivial merge conflicts with my set when linux-omap and mmc are merged?
Tony Lindgren Nov. 29, 2013, 4:34 p.m. UTC | #9
* Jarkko Nikula <jarkko.nikula@bitmer.com> [131128 09:03]:
> Hi
> 
> On 11/27/2013 11:37 PM, Tony Lindgren wrote:
> > * Jarkko Nikula <jarkko.nikula@bitmer.com> [131127 12:55]:
> > Bummer, sounds like some duplicate work could have been avoided :(
> > I suggest resend to Chris and linux-mmc one more time as Chris should
> > pick up the MMC patches in general.
> > 
> Before that should Chris merge your 2 patches in order to avoid couple
> trivial merge conflicts with my set when linux-omap and mmc are merged?

Those are already queued to arm-soc/fixes branch and should hit the
mainline tree within next few days, hopefully before -rc2 so it's probably
to wait for that for that for further fixes.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Nov. 29, 2013, 5:13 p.m. UTC | #10
* Jarkko Nikula <jarkko.nikula@bitmer.com> [131128 08:14]:
> Hi
> 
> On 11/27/2013 11:59 PM, Tony Lindgren wrote:
> > * Chris Ball <cjb@laptop.org> [131127 13:48]:
> >> Hi,
> >>
> >> On Wed, Nov 27 2013, Jarkko Nikula wrote:
> >>> Can you enlighten me what's the proper way to get patches to mmc since
> >>> I cannot figure out working methodology from MAINTAINERS file?
> >>
> >> Sorry about this, Jarkko.
> >>
> >> Since I don't have omap.c hardware, I'm generally going to wait for
> >> a Tested-by/Acked-by from someone else on patches like these.  We
> >> actually have a maintainer already listed for the driver, Jarkko
> >> Lavinen <jarkko.lavinen@nokia.com>.
> >>
> >> So, maybe the MAINTAINERS section for drivers/mmc/host/omap.c needs
> >> an update?  Feel free to send me patches to it.  Either way, I'll
> >> start treating Aaro and Jarkko (Nikula) as maintainers for this
> >> driver.
> > 
> Oh, I see. I even didn't check ./scripts/get_maintainer.pl nor check
> MAINTAINERS file further than main MMC entry as I knew Jarkko L. is not
> working anymore for Nokia. Sorry, we should have noticed that.
> 
> > Hmm looks like here's a reasonably recent update that we've missed
> > from Jarkko Lavinen to update his email address:
> > 
> > http://lkml.org/lkml/2013/10/4/142
> > 
> > I've updated Jarkko Lavinen's address in this mail, we should
> > probably also patch the MAINTAINERS file for that, and then see if
> > Aaro and Jarkko Nikula are interested to be listed there as well.
> > 
> I can volunteer. Not that I know much about mmc but I like to keep my
> legacy hw still running :-)

Sounds good to me, good to hear :)

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -90,17 +90,6 @@ 
 #define OMAP_MMC_CMDTYPE_AC	2
 #define OMAP_MMC_CMDTYPE_ADTC	3
 
-#define OMAP_DMA_MMC_TX		21
-#define OMAP_DMA_MMC_RX		22
-#define OMAP_DMA_MMC2_TX	54
-#define OMAP_DMA_MMC2_RX	55
-
-#define OMAP24XX_DMA_MMC2_TX	47
-#define OMAP24XX_DMA_MMC2_RX	48
-#define OMAP24XX_DMA_MMC1_TX	61
-#define OMAP24XX_DMA_MMC1_RX	62
-
-
 #define DRIVER_NAME "mmci-omap"
 
 /* Specifies how often in millisecs to poll for card status changes
@@ -1331,7 +1320,7 @@  static int mmc_omap_probe(struct platform_device *pdev)
 	struct mmc_omap_host *host = NULL;
 	struct resource *res;
 	dma_cap_mask_t mask;
-	unsigned sig;
+	unsigned sig = 0;
 	int i, ret = 0;
 	int irq;
 
@@ -1408,19 +1397,20 @@  static int mmc_omap_probe(struct platform_device *pdev)
 	host->dma_tx_burst = -1;
 	host->dma_rx_burst = -1;
 
-	if (mmc_omap2())
-		sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX;
-	else
-		sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX;
-	host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
+	if (res)
+		sig = res->start;
+	host->dma_tx = dma_request_slave_channel_compat(mask,
+				omap_dma_filter_fn, &sig, &pdev->dev, "tx");
 	if (!host->dma_tx)
 		dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n",
 			sig);
-	if (mmc_omap2())
-		sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX;
-	else
-		sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX;
-	host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig);
+
+	res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx");
+	if (res)
+		sig = res->start;
+	host->dma_rx = dma_request_slave_channel_compat(mask,
+				omap_dma_filter_fn, &sig, &pdev->dev, "rx");
 	if (!host->dma_rx)
 		dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n",
 			sig);