From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from co1outboundpool.messaging.microsoft.com (co1ehsobe006.messaging.microsoft.com [216.32.180.189]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "MSIT Machine Auth CA 2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id EEEBA2C00B1 for ; Tue, 12 Nov 2013 18:06:02 +1100 (EST) Message-ID: <5281D347.3020903@freescale.com> Date: Tue, 12 Nov 2013 15:05:43 +0800 From: Hongbo Zhang MIME-Version: 1.0 To: Dan Williams Subject: Re: [PATCH v11 3/3] DMA: Freescale: update driver to support 8-channel DMA engine References: <1380188023-3936-1-git-send-email-hongbo.zhang@freescale.com> <1380188023-3936-4-git-send-email-hongbo.zhang@freescale.com> <525F7C18.3010409@freescale.com> <5278587F.7090500@freescale.com> <52809F67.20901@freescale.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, ian.campbell@citrix.com, pawel.moll@arm.com, Stephen Warren , "Koul, Vinod" , Linux Kernel Mailing List , rob.herring@calxeda.com, dmaengine@vger.kernel.org, linuxppc-dev List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 11/12/2013 08:09 AM, Dan Williams wrote: > On Mon, Nov 11, 2013 at 1:12 AM, Hongbo Zhang > wrote: >>>>>> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c >>>>>> index 49e8fbd..16a9a48 100644 >>>>>> --- a/drivers/dma/fsldma.c >>>>>> +++ b/drivers/dma/fsldma.c >>>>>> @@ -1261,7 +1261,9 @@ static int fsl_dma_chan_probe(struct >>>>>> fsldma_device >>>>>> *fdev, >>>>>> WARN_ON(fdev->feature != chan->feature); >>>>>> chan->dev = fdev->dev; >>>>>> - chan->id = ((res.start - 0x100) & 0xfff) >> 7; >>>>>> + chan->id = (res.start & 0xfff) < 0x300 ? >>>>>> + ((res.start - 0x100) & 0xfff) >> 7 : >>>>>> + ((res.start - 0x200) & 0xfff) >> 7; >>>>>> if (chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) { >>> Isn't it a bit fragile to have this based on the resource address? >>> Can't device tree tell you the channel id directly by an index into >>> the "dma0: dma@100300" node? >> >> Yes, both this way and putting a "cell-index" into device tree work. >> This won't be fragile, because the resource address should always be defined >> correctly, otherwise even if we can tell a channel id by "cell-index" but >> with wrong resource address, nothing will work. >> This piece of code only doesn't seem as neat as using "cell-index", but we >> prefer the style that let the device tree describes as true as what hardware >> really has. This doesn't mean "cell-index" isn't acceptable, if it is >> necessary and unavoidable, we can send another patch to add it, but >> currently there is no need and we don't have to do this. >> > I'm pointing it out because we just had a bug fix to another driver > motivated by the fact that resource addresses may move from one > implementation to another, whereas the cell index provided by device > tree is static. Just a note, no need to fix it now. Get it, and will remember it, thank you Dan. > -- > Dan > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hongbo Zhang Subject: Re: [PATCH v11 3/3] DMA: Freescale: update driver to support 8-channel DMA engine Date: Tue, 12 Nov 2013 15:05:43 +0800 Message-ID: <5281D347.3020903@freescale.com> References: <1380188023-3936-1-git-send-email-hongbo.zhang@freescale.com> <1380188023-3936-4-git-send-email-hongbo.zhang@freescale.com> <525F7C18.3010409@freescale.com> <5278587F.7090500@freescale.com> <52809F67.20901@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Dan Williams Cc: "Koul, Vinod" , rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org, pawel.moll-5wv7dgnIgG8@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, Stephen Warren , ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linuxppc-dev , Linux Kernel Mailing List , dmaengine-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org On 11/12/2013 08:09 AM, Dan Williams wrote: > On Mon, Nov 11, 2013 at 1:12 AM, Hongbo Zhang > wrote: >>>>>> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c >>>>>> index 49e8fbd..16a9a48 100644 >>>>>> --- a/drivers/dma/fsldma.c >>>>>> +++ b/drivers/dma/fsldma.c >>>>>> @@ -1261,7 +1261,9 @@ static int fsl_dma_chan_probe(struct >>>>>> fsldma_device >>>>>> *fdev, >>>>>> WARN_ON(fdev->feature != chan->feature); >>>>>> chan->dev = fdev->dev; >>>>>> - chan->id = ((res.start - 0x100) & 0xfff) >> 7; >>>>>> + chan->id = (res.start & 0xfff) < 0x300 ? >>>>>> + ((res.start - 0x100) & 0xfff) >> 7 : >>>>>> + ((res.start - 0x200) & 0xfff) >> 7; >>>>>> if (chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) { >>> Isn't it a bit fragile to have this based on the resource address? >>> Can't device tree tell you the channel id directly by an index into >>> the "dma0: dma@100300" node? >> >> Yes, both this way and putting a "cell-index" into device tree work. >> This won't be fragile, because the resource address should always be defined >> correctly, otherwise even if we can tell a channel id by "cell-index" but >> with wrong resource address, nothing will work. >> This piece of code only doesn't seem as neat as using "cell-index", but we >> prefer the style that let the device tree describes as true as what hardware >> really has. This doesn't mean "cell-index" isn't acceptable, if it is >> necessary and unavoidable, we can send another patch to add it, but >> currently there is no need and we don't have to do this. >> > I'm pointing it out because we just had a bug fix to another driver > motivated by the fact that resource addresses may move from one > implementation to another, whereas the cell index provided by device > tree is static. Just a note, no need to fix it now. Get it, and will remember it, thank you Dan. > -- > Dan > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755566Ab3KLHGP (ORCPT ); Tue, 12 Nov 2013 02:06:15 -0500 Received: from co1ehsobe003.messaging.microsoft.com ([216.32.180.186]:19807 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755515Ab3KLHF6 (ORCPT ); Tue, 12 Nov 2013 02:05:58 -0500 X-Forefront-Antispam-Report: CIP:70.37.183.190;KIP:(null);UIP:(null);IPV:NLI;H:mail.freescale.net;RD:none;EFVD:NLI X-SpamScore: -4 X-BigFish: VS-4(z579ehzbb2dI98dI9371I1432Izz1f42h2148h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h1d1ah1d2ah1fc6hzz1de098h8275bh1de097hz2dh2a8h839h947hd25he5bhf0ah1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh162dh1631h1758h1765h18e1h190ch1946h19b4h19c3h1ad9h1b0ah1b2fh2222h224fh1fb3h1d0ch1d2eh1d3fh1dfeh1dffh1f5fh1fe8h1ff5h209eh1155h) Message-ID: <5281D347.3020903@freescale.com> Date: Tue, 12 Nov 2013 15:05:43 +0800 From: Hongbo Zhang User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Dan Williams CC: "Koul, Vinod" , , , , Stephen Warren , , , linuxppc-dev , Linux Kernel Mailing List , Subject: Re: [PATCH v11 3/3] DMA: Freescale: update driver to support 8-channel DMA engine References: <1380188023-3936-1-git-send-email-hongbo.zhang@freescale.com> <1380188023-3936-4-git-send-email-hongbo.zhang@freescale.com> <525F7C18.3010409@freescale.com> <5278587F.7090500@freescale.com> <52809F67.20901@freescale.com> In-Reply-To: Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/12/2013 08:09 AM, Dan Williams wrote: > On Mon, Nov 11, 2013 at 1:12 AM, Hongbo Zhang > wrote: >>>>>> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c >>>>>> index 49e8fbd..16a9a48 100644 >>>>>> --- a/drivers/dma/fsldma.c >>>>>> +++ b/drivers/dma/fsldma.c >>>>>> @@ -1261,7 +1261,9 @@ static int fsl_dma_chan_probe(struct >>>>>> fsldma_device >>>>>> *fdev, >>>>>> WARN_ON(fdev->feature != chan->feature); >>>>>> chan->dev = fdev->dev; >>>>>> - chan->id = ((res.start - 0x100) & 0xfff) >> 7; >>>>>> + chan->id = (res.start & 0xfff) < 0x300 ? >>>>>> + ((res.start - 0x100) & 0xfff) >> 7 : >>>>>> + ((res.start - 0x200) & 0xfff) >> 7; >>>>>> if (chan->id >= FSL_DMA_MAX_CHANS_PER_DEVICE) { >>> Isn't it a bit fragile to have this based on the resource address? >>> Can't device tree tell you the channel id directly by an index into >>> the "dma0: dma@100300" node? >> >> Yes, both this way and putting a "cell-index" into device tree work. >> This won't be fragile, because the resource address should always be defined >> correctly, otherwise even if we can tell a channel id by "cell-index" but >> with wrong resource address, nothing will work. >> This piece of code only doesn't seem as neat as using "cell-index", but we >> prefer the style that let the device tree describes as true as what hardware >> really has. This doesn't mean "cell-index" isn't acceptable, if it is >> necessary and unavoidable, we can send another patch to add it, but >> currently there is no need and we don't have to do this. >> > I'm pointing it out because we just had a bug fix to another driver > motivated by the fact that resource addresses may move from one > implementation to another, whereas the cell index provided by device > tree is static. Just a note, no need to fix it now. Get it, and will remember it, thank you Dan. > -- > Dan >