All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Yao Yuan <yao.yuan-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
Cc: "wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org"
	<wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	"mark.rutland-5wv7dgnIgG8@public.gmane.org"
	<mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	"shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org"
	<shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
	"linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v2 1/2] i2c: add DMA support for freescale i2c driver
Date: Thu, 6 Mar 2014 12:57:42 +0100	[thread overview]
Message-ID: <201403061257.42755.marex@denx.de> (raw)
In-Reply-To: <50e0997786a0459eb08c9d92813253f9-AZ66ij2kwaZYLYlmg7qx2OO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>

On Thursday, March 06, 2014 at 06:02:03 AM, Yao Yuan wrote:
> On Thu, March 06, 2014 at 12:44:14 PM, Marek Vasut wrote:
> > On Thursday, March 06, 2014 at 05:36:14 AM, Yao Yuan wrote:
> > > On Thu, March 06, 2014 at 11:23:50 AM, Marek Vasut wrote:
> > > > On Wednesday, March 05, 2014 at 07:52:31 AM, Yuan Yao wrote:
> > > > > Add dma support for i2c. This function depend on DMA driver.
> > > > > You can turn on it by write both the dmas and dma-name properties
> > > > > in dts node.
> > > > > 
> > > > > Signed-off-by: Yuan Yao <yao.yuan-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > > > > ---
> > > > 
> > > > [...]
> > > > 
> > > > > @@ -601,6 +826,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	void __iomem *base;
> > > > >  	int irq, ret;
> > > > >  	u32 bitrate;
> > > > > 
> > > > > +	u32 phy_addr;
> > > > > 
> > > > >  	dev_dbg(&pdev->dev, "<%s>\n", __func__);
> > > > > 
> > > > > @@ -611,6 +837,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	}
> > > > >  	
> > > > >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > > 
> > > > > +	phy_addr = res->start;
> > > > 
> > > > Uh ... Shawn, I really think I am lost here. Don't you need to map
> > > > this memory before you can use it for DMA ? The DMA mapping function
> > > > should give you the physical address and is the right way to go
> > > > about this instead of pulling the address from here, no ?
> > > > 
> > > > I might be wrong here, I am rather uncertain, so please help me out.
> > > > Thanks!
> > > 
> > > Hi, Marek, Thanks for your suggestion.
> > > Here you can review the code in include/linux/ioport.h The
> > > resource->start describes the entity on the CPU bus as a starting
> > > physical address. So I thinks it can used for dma directly.
> > 
> > This doesn't feel right for some reason. If this is a register area, you
> > should
> > ioremap() it. If it's a memory area you do DMA to/from, you need to make
> > sure you correctly flush/invalidate caches and properly handle the
> > effects the write buffer might have. But I have a feeling you actually do
> > DMA to/from register space here ?
> 
> Yes, It's a register area. But I don't know why I should ioremap() it? It's
> a bus address and DMA can use it directly. Is there some problem for my
> understanding ?

I am not too sure here, thus I am poking someone who can clearly answer this.

Best regards,
Marek Vasut

WARNING: multiple messages have this Message-ID (diff)
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] i2c: add DMA support for freescale i2c driver
Date: Thu, 6 Mar 2014 12:57:42 +0100	[thread overview]
Message-ID: <201403061257.42755.marex@denx.de> (raw)
In-Reply-To: <50e0997786a0459eb08c9d92813253f9@BL2PR03MB338.namprd03.prod.outlook.com>

On Thursday, March 06, 2014 at 06:02:03 AM, Yao Yuan wrote:
> On Thu, March 06, 2014 at 12:44:14 PM, Marek Vasut wrote:
> > On Thursday, March 06, 2014 at 05:36:14 AM, Yao Yuan wrote:
> > > On Thu, March 06, 2014 at 11:23:50 AM, Marek Vasut wrote:
> > > > On Wednesday, March 05, 2014 at 07:52:31 AM, Yuan Yao wrote:
> > > > > Add dma support for i2c. This function depend on DMA driver.
> > > > > You can turn on it by write both the dmas and dma-name properties
> > > > > in dts node.
> > > > > 
> > > > > Signed-off-by: Yuan Yao <yao.yuan@freescale.com>
> > > > > ---
> > > > 
> > > > [...]
> > > > 
> > > > > @@ -601,6 +826,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	void __iomem *base;
> > > > >  	int irq, ret;
> > > > >  	u32 bitrate;
> > > > > 
> > > > > +	u32 phy_addr;
> > > > > 
> > > > >  	dev_dbg(&pdev->dev, "<%s>\n", __func__);
> > > > > 
> > > > > @@ -611,6 +837,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	}
> > > > >  	
> > > > >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > > 
> > > > > +	phy_addr = res->start;
> > > > 
> > > > Uh ... Shawn, I really think I am lost here. Don't you need to map
> > > > this memory before you can use it for DMA ? The DMA mapping function
> > > > should give you the physical address and is the right way to go
> > > > about this instead of pulling the address from here, no ?
> > > > 
> > > > I might be wrong here, I am rather uncertain, so please help me out.
> > > > Thanks!
> > > 
> > > Hi, Marek, Thanks for your suggestion.
> > > Here you can review the code in include/linux/ioport.h The
> > > resource->start describes the entity on the CPU bus as a starting
> > > physical address. So I thinks it can used for dma directly.
> > 
> > This doesn't feel right for some reason. If this is a register area, you
> > should
> > ioremap() it. If it's a memory area you do DMA to/from, you need to make
> > sure you correctly flush/invalidate caches and properly handle the
> > effects the write buffer might have. But I have a feeling you actually do
> > DMA to/from register space here ?
> 
> Yes, It's a register area. But I don't know why I should ioremap() it? It's
> a bus address and DMA can use it directly. Is there some problem for my
> understanding ?

I am not too sure here, thus I am poking someone who can clearly answer this.

Best regards,
Marek Vasut

WARNING: multiple messages have this Message-ID (diff)
From: Marek Vasut <marex@denx.de>
To: Yao Yuan <yao.yuan@freescale.com>
Cc: "wsa@the-dreams.de" <wsa@the-dreams.de>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"shawn.guo@linaro.org" <shawn.guo@linaro.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] i2c: add DMA support for freescale i2c driver
Date: Thu, 6 Mar 2014 12:57:42 +0100	[thread overview]
Message-ID: <201403061257.42755.marex@denx.de> (raw)
In-Reply-To: <50e0997786a0459eb08c9d92813253f9@BL2PR03MB338.namprd03.prod.outlook.com>

On Thursday, March 06, 2014 at 06:02:03 AM, Yao Yuan wrote:
> On Thu, March 06, 2014 at 12:44:14 PM, Marek Vasut wrote:
> > On Thursday, March 06, 2014 at 05:36:14 AM, Yao Yuan wrote:
> > > On Thu, March 06, 2014 at 11:23:50 AM, Marek Vasut wrote:
> > > > On Wednesday, March 05, 2014 at 07:52:31 AM, Yuan Yao wrote:
> > > > > Add dma support for i2c. This function depend on DMA driver.
> > > > > You can turn on it by write both the dmas and dma-name properties
> > > > > in dts node.
> > > > > 
> > > > > Signed-off-by: Yuan Yao <yao.yuan@freescale.com>
> > > > > ---
> > > > 
> > > > [...]
> > > > 
> > > > > @@ -601,6 +826,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	void __iomem *base;
> > > > >  	int irq, ret;
> > > > >  	u32 bitrate;
> > > > > 
> > > > > +	u32 phy_addr;
> > > > > 
> > > > >  	dev_dbg(&pdev->dev, "<%s>\n", __func__);
> > > > > 
> > > > > @@ -611,6 +837,7 @@ static int i2c_imx_probe(struct
> > > > > platform_device
> > > > 
> > > > *pdev)
> > > > 
> > > > >  	}
> > > > >  	
> > > > >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > > 
> > > > > +	phy_addr = res->start;
> > > > 
> > > > Uh ... Shawn, I really think I am lost here. Don't you need to map
> > > > this memory before you can use it for DMA ? The DMA mapping function
> > > > should give you the physical address and is the right way to go
> > > > about this instead of pulling the address from here, no ?
> > > > 
> > > > I might be wrong here, I am rather uncertain, so please help me out.
> > > > Thanks!
> > > 
> > > Hi, Marek, Thanks for your suggestion.
> > > Here you can review the code in include/linux/ioport.h The
> > > resource->start describes the entity on the CPU bus as a starting
> > > physical address. So I thinks it can used for dma directly.
> > 
> > This doesn't feel right for some reason. If this is a register area, you
> > should
> > ioremap() it. If it's a memory area you do DMA to/from, you need to make
> > sure you correctly flush/invalidate caches and properly handle the
> > effects the write buffer might have. But I have a feeling you actually do
> > DMA to/from register space here ?
> 
> Yes, It's a register area. But I don't know why I should ioremap() it? It's
> a bus address and DMA can use it directly. Is there some problem for my
> understanding ?

I am not too sure here, thus I am poking someone who can clearly answer this.

Best regards,
Marek Vasut

  parent reply	other threads:[~2014-03-06 11:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05  6:52 [PATCH v2 0/2] i2c: add DMA support for freescale i2c driver Yuan Yao
2014-03-05  6:52 ` Yuan Yao
2014-03-05  6:52 ` Yuan Yao
2014-03-05  6:52 ` [PATCH v2 1/2] " Yuan Yao
2014-03-05  6:52   ` Yuan Yao
2014-03-05  6:52   ` Yuan Yao
     [not found]   ` <1394002352-8380-2-git-send-email-yao.yuan-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2014-03-06  2:39     ` Marek Vasut
2014-03-06  2:39       ` Marek Vasut
2014-03-06  2:39       ` Marek Vasut
     [not found]       ` <201403060339.45611.marex-ynQEQJNshbs@public.gmane.org>
2014-03-06  4:36         ` Yao Yuan
2014-03-06  4:36           ` Yao Yuan
2014-03-06  4:36           ` Yao Yuan
     [not found]           ` <1c0c5f2ce69849d4bf482601ac431da6-AZ66ij2kwaZYLYlmg7qx2OO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-03-06  4:41             ` Marek Vasut
2014-03-06  4:41               ` Marek Vasut
2014-03-06  4:41               ` Marek Vasut
     [not found]               ` <201403060541.21665.marex-ynQEQJNshbs@public.gmane.org>
2014-03-06  5:02                 ` Yao Yuan
2014-03-06  5:02                   ` Yao Yuan
2014-03-06  5:02                   ` Yao Yuan
     [not found]                   ` <50e0997786a0459eb08c9d92813253f9-AZ66ij2kwaZYLYlmg7qx2OO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-03-06 11:57                     ` Marek Vasut [this message]
2014-03-06 11:57                       ` Marek Vasut
2014-03-06 11:57                       ` Marek Vasut
     [not found]                       ` <201403061257.42755.marex-ynQEQJNshbs@public.gmane.org>
2014-03-06 13:55                         ` 答复: " Yao Yuan
2014-03-06 13:55                           ` Yao Yuan
2014-03-06 13:55                           ` Yao Yuan
2014-03-10  2:00                         ` Shawn Guo
2014-03-10  2:00                           ` Shawn Guo
2014-03-10  2:00                           ` Shawn Guo
     [not found]                           ` <20140310020051.GA15218-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2014-03-11  5:27                             ` Yao Yuan
2014-03-11  5:27                               ` Yao Yuan
2014-03-11  5:27                               ` Yao Yuan
     [not found]                               ` <1d35d91fd0f1414587edf47ab03e20ae-AZ66ij2kwaZYLYlmg7qx2OO6mTEJWrR4XA4E9RH9d+qIuWR1G4zioA@public.gmane.org>
2014-03-11 10:40                                 ` Marek Vasut
2014-03-11 10:40                                   ` Marek Vasut
2014-03-11 10:40                                   ` Marek Vasut
2014-03-05  6:52 ` [PATCH v2 2/2] Documentation:add " Yuan Yao
2014-03-05  6:52   ` Yuan Yao
2014-03-05  6:52   ` Yuan Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201403061257.42755.marex@denx.de \
    --to=marex-ynqeqjnshbs@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    --cc=yao.yuan-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.