LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [U-Boot] [PATCH 1/2] 83xx: Replace CONFIG_MPC83XX with CONFIG_MPC83xx
From: Kim Phillips @ 2009-05-26 23:38 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-dev, Peter Tyser, u-boot
In-Reply-To: <20090524201327.CB44C832E416@gemini.denx.de>

On Sun, 24 May 2009 22:13:27 +0200
Wolfgang Denk <wd@denx.de> wrote:

> Dear Peter,
> 
> In message <1243192952.703.7.camel@ptyser-laptop> you wrote:
> >
> > > CodingStyle Ch.12 suggests that it's the other fsl arches that are in
> > > violation here, not 83XX:
> 
> Agreed...
> 
> > Either way is fine with me, as long as things are consistent.  It looked
> > like most Freescale CPUs in U-Boot as well as Linux used the lowercase
> > convention for CONFIG_<cpu type> so I thought:
> > a. Most likely someone made a conscious decision to use lowercase

I can understand it in comments and quotes, just not in constants in
the code.

> > b. It'd be much easier to change just 83xx than all other arches:)

that's not a good reason to do it this way though.

> > If others would prefer standardizing on uppercase, I can submit new
> > patches for 85xx, 5xxx, 86xx, etc.  This would be still be inconsistent
> > with Linux though, which is a bit annoying.
> 
> It seems Linux uses 8?xx with very few exceptions (CONFIG_SND_VIA82XX*
> and CONFIG_EDAC_MPC85XX), so let's do the same here.

so linux is inconsistent too.

I'm a fan of a more self-consistent CONFIG_MPC85XX_MDS over mixed-case
names like linux' CONFIG_MPC85xx_MDS.

I wonder if the linux ppc guys would accept a
s/CONFIG_MPC8?xx/CONFIG_MPC8?XX/g rename patch for linux...

Kim

^ permalink raw reply

* Re: [GIT PULL] fsldma driver fixes
From: Dan Williams @ 2009-05-26 23:59 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev Development, Ira Snyder, lkml
In-Reply-To: <2a27d3730905220347s59dbd152kc69c8399693ae307@mail.gmail.com>

On Fri, May 22, 2009 at 3:47 AM, Li Yang <leoli@freescale.com> wrote:
> Hi Dan,
>
> Here are fixes for Freescale DMA engine driver.
>
> Thanks,
> - Leo
>
>
> The following changes since commit 5805977e63a36ad56594a623f3bd2bebcb7db2=
33:
> =A0Linus Torvalds (1):
> =A0 =A0 =A0 =A0Merge branch 'for-linus' of git://git.kernel.org/.../jbarn=
es/drm-2.6
>
> are available in the git repository at:
>
> =A0git://git.kernel.org/pub/scm/linux/kernel/git/leo/fsl-soc.git fsldma
>
> Ira Snyder (4):
> =A0 =A0 =A0fsldma: fix "DMA halt timeout!" errors
> =A0 =A0 =A0fsldma: fix infinite loop on multi-descriptor DMA chain comple=
tion
> =A0 =A0 =A0fsldma: snooping is not enabled for last entry in descriptor c=
hain
> =A0 =A0 =A0fsldma: fix memory leak on error path in fsl_dma_prep_memcpy()
>
> Li Yang (1):
> =A0 =A0 =A0fsldma: update mailling list address in MAINTAINERS
>
> Roel Kluin (1):
> =A0 =A0 =A0fsldma: fix check on potential fdev->chan[] overflow
>

Pulled, thanks.  These all look like 2.6.30 candidates, right?  I'll
send these upstream in the next few days as I have not heard back from
Kumar on taking fsldma patches through his tree [1].

Thanks,
Dan

[1]: http://marc.info/?l=3Dlinux-kernel&m=3D124225089507475&w=3D2

^ permalink raw reply

* [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Jon Smirl @ 2009-05-27  0:25 UTC (permalink / raw)
  To: grant.likely, linuxppc-dev, alsa-devel, broonie, timur

The function signature for spin_event_timeout() has changed in version V9.
Adjust the mpc5200 AC97 driver to use the new function.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
---
 sound/soc/fsl/mpc5200_psc_ac97.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 9f2df15..bab80ac 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -31,13 +31,13 @@ static struct psc_dma *psc_dma;
 
 static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 {
-	int rc;
+	int status;
 	unsigned int val;
 
 	/* Wait for command send status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status= spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (rdy)\n");
 		return -ENODEV;
 	}
@@ -45,9 +45,9 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 	out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24));
 
 	/* Wait for the answer */
-	spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_DATA_VAL), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_DATA_VAL), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 read (val) %x\n",
 				in_be16(&psc_dma->psc_regs->sr_csr.status));
 		return -ENODEV;
@@ -66,12 +66,12 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 static void psc_ac97_write(struct snd_ac97 *ac97,
 				unsigned short reg, unsigned short val)
 {
-	int rc;
+	int status;
 
 	/* Wait for command status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (write)\n");
 		return;
 	}
@@ -82,24 +82,22 @@ static void psc_ac97_write(struct snd_ac97 *ac97,
 
 static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	out_be32(&regs->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
-	spin_event_timeout(0, 3, 0, rc);
+	spin_event_timeout(0, 3, 0);
 	out_be32(&regs->sicr, psc_dma->sicr);
 }
 
 static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	/* Do a cold reset */
 	out_8(&regs->op1, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 10, 0, rc);
+	spin_event_timeout(0, 10, 0);
 	out_8(&regs->op0, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 50, 0, rc);
+	spin_event_timeout(0, 50, 0);
 	psc_ac97_warm_reset(ac97);
 }
 

^ permalink raw reply related

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Timur Tabi @ 2009-05-27  0:38 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <20090527002530.16740.62502.stgit@terra>

On Tue, May 26, 2009 at 7:25 PM, Jon Smirl <jonsmirl@gmail.com> wrote:

> - =A0 =A0 =A0 spin_event_timeout(0, 10, 0, rc);
> + =A0 =A0 =A0 spin_event_timeout(0, 10, 0);
> =A0 =A0 =A0 =A0out_8(&regs->op0, MPC52xx_PSC_OP_RES);
> - =A0 =A0 =A0 spin_event_timeout(0, 50, 0, rc);
> + =A0 =A0 =A0 spin_event_timeout(0, 50, 0);

Jon, I'm still hoping you'll explain why you're not using udelay() here.

--=20
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Jon Smirl @ 2009-05-27  0:44 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <ed82fe3e0905261738u655f6f5at2351341a0a5e50d5@mail.gmail.com>

On Tue, May 26, 2009 at 8:38 PM, Timur Tabi <timur@freescale.com> wrote:
> On Tue, May 26, 2009 at 7:25 PM, Jon Smirl <jonsmirl@gmail.com> wrote:
>
>> - =A0 =A0 =A0 spin_event_timeout(0, 10, 0, rc);
>> + =A0 =A0 =A0 spin_event_timeout(0, 10, 0);
>> =A0 =A0 =A0 =A0out_8(&regs->op0, MPC52xx_PSC_OP_RES);
>> - =A0 =A0 =A0 spin_event_timeout(0, 50, 0, rc);
>> + =A0 =A0 =A0 spin_event_timeout(0, 50, 0);
>
> Jon, I'm still hoping you'll explain why you're not using udelay() here.

Because Grant didn't want me doing udelay(50) just to delay things in
order to give the AC97 controller time to initialize. Your function
lets me loop on cpu_relax() for 50us.

I have to delay 50us because ALSA tries to access the hardware
immediately after the function returns.

>
> --
> Timur Tabi
> Linux kernel developer at Freescale
>



--=20
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Timur Tabi @ 2009-05-27  0:53 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <9e4733910905261744j3589ace8wd427ef8a5998eccf@mail.gmail.com>

On Tue, May 26, 2009 at 7:44 PM, Jon Smirl <jonsmirl@gmail.com> wrote:

> Because Grant didn't want me doing udelay(50) just to delay things in
> order to give the AC97 controller time to initialize. Your function
> lets me loop on cpu_relax() for 50us.

But udelay() calls HMT_low(), which is like cpu_relax().

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Jon Smirl @ 2009-05-27  1:01 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <ed82fe3e0905261753v1cb9c901i3b66cd903e4adda6@mail.gmail.com>

On Tue, May 26, 2009 at 8:53 PM, Timur Tabi <timur@freescale.com> wrote:
> On Tue, May 26, 2009 at 7:44 PM, Jon Smirl <jonsmirl@gmail.com> wrote:
>
>> Because Grant didn't want me doing udelay(50) just to delay things in
>> order to give the AC97 controller time to initialize. Your function
>> lets me loop on cpu_relax() for 50us.
>
> But udelay() calls HMT_low(), which is like cpu_relax().

Then why did you need to make your routine that calls cpu_relax()?

I don't know what goes on in the guts of HMT_low() and cpu_relax(),
when you guys decide which one I should use let me know and I can
adjust the patch.

The hardware needs a minimum 50us pause. It doesn't matter if the
pause is more than that. If the CPU has something to keep it busy for
a few milliseconds that's fine.

> --
> Timur Tabi
> Linux kernel developer at Freescale
>

-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [PATCH] Display processor virtualization resource allocations in lparcfg
From: Michael Ellerman @ 2009-05-27  1:14 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: linuxppc-dev
In-Reply-To: <4A1C2E10.9020109@austin.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

On Tue, 2009-05-26 at 12:59 -0500, Nathan Fontenot wrote:
> This patch updates the output from /proc/ppc64/lparcfg to display the
> processor virtualization resource allocations for a shared processor
> partition.

> @@ -267,6 +281,28 @@
>  	seq_printf(m, "capped=%d\n", ppp_data.capped);
>  	seq_printf(m, "unallocated_capacity=%lld\n",
>  		   ppp_data.unallocated_entitlement);
> +
> +	/* The last bits of information returned from h_get_ppp are only
> +	 * valid if the ibm,partition-performance-parameters-level
> +	 * property is >= 1.
> +	 */
> +	root = of_find_node_by_path("/");
> +	if (root) {
> +		perf_level = of_get_property(root,
> +				"ibm,partition-performance-parameters-level",
> +					     NULL);

What if there is no such property?

> +		if (*perf_level >= 1) {
> +			seq_printf(m,
> +			    "physical_procs_allocated_to_virtualization=%d\n",
> +				   ppp_data.phys_platform_procs);
> +			seq_printf(m, "max_proc_capacity_available=%d\n",
> +				   ppp_data.max_proc_cap_avail);
> +			seq_printf(m, "entitled_proc_capacity_available=%d\n",
> +				   ppp_data.entitled_proc_cap_avail);
> +		}
> +
> +		of_node_put(root);
> +	}

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* [PATCH] net/ucc_geth: allow to set mac address on running device
From: Kevin Hao @ 2009-05-27  1:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, leoli, netdev

Inspired by the patch for 8139too (bda6a15a).

Currently we can't set mac address on a running ucc_geth device.
But this is needed when you use this device as a bonding slave in
bonding device in balance-alb mode. So add this feature for ucc_geth
device.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
 drivers/net/ucc_geth.c |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 9dd16c9..3c595d7 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3339,6 +3339,37 @@ static void ucc_netpoll(struct net_device *dev)
 }
 #endif /* CONFIG_NET_POLL_CONTROLLER */
 
+static int ucc_geth_set_mac_addr(struct net_device *dev, void *p)
+{
+	struct ucc_geth_private *ugeth = netdev_priv(dev);
+	struct sockaddr *addr = p;
+
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EADDRNOTAVAIL;
+
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+	/*
+	 * If device is not running, we will set mac addr register
+	 * when opening the device.
+	 */
+	if (!netif_running(dev))
+		return 0;
+
+	spin_lock_irq(&ugeth->lock);
+	init_mac_station_addr_regs(dev->dev_addr[0],
+				   dev->dev_addr[1],
+				   dev->dev_addr[2],
+				   dev->dev_addr[3],
+				   dev->dev_addr[4],
+				   dev->dev_addr[5],
+				   &ugeth->ug_regs->macstnaddr1,
+				   &ugeth->ug_regs->macstnaddr2);
+	spin_unlock_irq(&ugeth->lock);
+
+	return 0;
+}
+
 /* Called when something needs to use the ethernet device */
 /* Returns 0 for success. */
 static int ucc_geth_open(struct net_device *dev)
@@ -3515,7 +3546,7 @@ static const struct net_device_ops ucc_geth_netdev_ops = {
 	.ndo_stop		= ucc_geth_close,
 	.ndo_start_xmit		= ucc_geth_start_xmit,
 	.ndo_validate_addr	= eth_validate_addr,
-	.ndo_set_mac_address	= eth_mac_addr,
+	.ndo_set_mac_address	= ucc_geth_set_mac_addr,
 	.ndo_change_mtu		= eth_change_mtu,
 	.ndo_set_multicast_list	= ucc_geth_set_multi,
 	.ndo_tx_timeout		= ucc_geth_timeout,
-- 
1.6.0.4.771.gef3b3

^ permalink raw reply related

* [PATCH net] gianfar: fix babbling rx error event bug
From: Xiaotian Feng @ 2009-05-27  1:52 UTC (permalink / raw)
  To: galak, davem, netdev; +Cc: linuxppc-dev, linux-kernel

Gianfar interrupt handler uses IEVENT_ERR_MASK to check and handle errors.
Babbling RX error (IEVENT_BABR) should be included in IEVENT_ERROR_MASK.
Otherwise if BABR is raised, it never gets handled nor cleared, and an
interrupt storm results. This has been observed to happen on sending a
burst of ethernet frames to a gianfar based board.

Signed-off-by: Xiaotian Feng <xiaotian.feng@windriver.com>
---
 drivers/net/gianfar.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 0642d52..cf35296 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -259,7 +259,7 @@ extern const char gfar_driver_version[];
 (IEVENT_RXC | IEVENT_BSY | IEVENT_EBERR | IEVENT_MSRO | \
  IEVENT_BABT | IEVENT_TXC | IEVENT_TXE | IEVENT_LC \
  | IEVENT_CRL | IEVENT_XFUN | IEVENT_DPE | IEVENT_PERR \
- | IEVENT_MAG)
+ | IEVENT_MAG | IEVENT_BABR)
 
 #define IMASK_INIT_CLEAR	0x00000000
 #define IMASK_BABR              0x80000000
-- 
1.5.5.1

^ permalink raw reply related

* [PATCH] powerpc/85xx: add nor flash partitions for mpc8569mds
From: Kevin Hao @ 2009-05-27  2:05 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Haiying Wang

Add 4 partitions in nor flash. Also fix nor flash
bank width bug.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
---
 arch/powerpc/boot/dts/mpc8569mds.dts |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8569mds.dts b/arch/powerpc/boot/dts/mpc8569mds.dts
index 39c2927..1f98990 100644
--- a/arch/powerpc/boot/dts/mpc8569mds.dts
+++ b/arch/powerpc/boot/dts/mpc8569mds.dts
@@ -70,8 +70,30 @@
 			#size-cells = <1>;
 			compatible = "cfi-flash";
 			reg = <0x0 0x0 0x02000000>;
-			bank-width = <2>;
+			bank-width = <1>;
 			device-width = <1>;
+			partition@0 {
+				label = "ramdisk";
+				reg = <0x00000000 0x01c00000>;
+			};
+			partition@1c00000 {
+				label = "kernel";
+				reg = <0x01c00000 0x002e0000>;
+			};
+			partiton@1ee0000 {
+				label = "dtb";
+				reg = <0x01ee0000 0x00020000>;
+			};
+			partition@1f00000 {
+				label = "firmware";
+				reg = <0x01f00000 0x00080000>;
+				read-only;
+			};
+			partition@1f80000 {
+				label = "u-boot";
+				reg = <0x01f80000 0x00080000>;
+				read-only;
+			};
 		};
 
 		bcsr@1,0 {
-- 
1.6.0.4.771.gef3b3

^ permalink raw reply related

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Timur Tabi @ 2009-05-27  3:12 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <9e4733910905261801p130f50afie2c50d5723192d44@mail.gmail.com>

On Tue, May 26, 2009 at 8:01 PM, Jon Smirl <jonsmirl@gmail.com> wrote:

> Then why did you need to make your routine that calls cpu_relax()?

That gets called only if delay == 0.  udelay(0) is a no-op, so if the
caller specifies no delay, then I need to manually call cpu_relax().

> I don't know what goes on in the guts of HMT_low() and cpu_relax(),
> when you guys decide which one I should use let me know and I can
> adjust the patch.

Grant, I don't see any reason why "udelay(50)" is unacceptable.

-- 
Timur Tabi
Linux kernel developer at Freescale

^ permalink raw reply

* Re: [PATCH net] gianfar: fix babbling rx error event bug
From: David Miller @ 2009-05-27  3:48 UTC (permalink / raw)
  To: Xiaotian.Feng; +Cc: netdev, linux-kernel, linuxppc-dev
In-Reply-To: <1243389156-1668-1-git-send-email-Xiaotian.Feng@windriver.com>

From: Xiaotian Feng <Xiaotian.Feng@windriver.com>
Date: Wed, 27 May 2009 09:52:36 +0800

> Gianfar interrupt handler uses IEVENT_ERR_MASK to check and handle errors.
> Babbling RX error (IEVENT_BABR) should be included in IEVENT_ERROR_MASK.
> Otherwise if BABR is raised, it never gets handled nor cleared, and an
> interrupt storm results. This has been observed to happen on sending a
> burst of ethernet frames to a gianfar based board.
> 
> Signed-off-by: Xiaotian Feng <xiaotian.feng@windriver.com>

Patch applied, thanks.

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Grant Likely @ 2009-05-27  3:48 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel, Timur Tabi, broonie
In-Reply-To: <9e4733910905261744j3589ace8wd427ef8a5998eccf@mail.gmail.com>

On Tue, May 26, 2009 at 6:44 PM, Jon Smirl <jonsmirl@gmail.com> wrote:
> On Tue, May 26, 2009 at 8:38 PM, Timur Tabi <timur@freescale.com> wrote:
>> On Tue, May 26, 2009 at 7:25 PM, Jon Smirl <jonsmirl@gmail.com> wrote:
>>
>>> - =A0 =A0 =A0 spin_event_timeout(0, 10, 0, rc);
>>> + =A0 =A0 =A0 spin_event_timeout(0, 10, 0);
>>> =A0 =A0 =A0 =A0out_8(&regs->op0, MPC52xx_PSC_OP_RES);
>>> - =A0 =A0 =A0 spin_event_timeout(0, 50, 0, rc);
>>> + =A0 =A0 =A0 spin_event_timeout(0, 50, 0);
>>
>> Jon, I'm still hoping you'll explain why you're not using udelay() here.
>
> Because Grant didn't want me doing udelay(50) just to delay things in
> order to give the AC97 controller time to initialize. Your function
> lets me loop on cpu_relax() for 50us.

No, you misunderstand.  My issue is that udelay is far too coarse
grained for what you want.  ie. If your are using udelay(1) in your
loop, and your event changes state in 1.01us, then you're still going
to burn a full 2us of time.  If you can loop over cpu_relax() instead,
then less time will get burned.

For a hard 50us delay, with no early exit condition, udelay() is the
correct function.

HOWEVER; I'm distrustful of *any* spins, and would rather see sleeps
instead of spins wherever possible.  There are two reasons for this:

First, udelay just burns time, and if the delay is too large, then the
it is wasting time that could be used for something else.  That being
said, it needs to be balanced with the context switch overhead.  If
the udelay() is less than double the context switch time, then the
overhead is greater than the time spent spinning.

Second, udelay() with IRQs disabled cause unbounded latencies.  Even
if it is less efficient, I'd rather see mutexes+msleep() than
spin_lock_irqsave()+udelay().  Of course, this only works in
non-atomic contexts.  If the code is atomic, then you have no choice.

There is no blanket rule here; but as the time delay requirement gets
larger, the greater the benefit to overall system responsiveness by
using sleep instead of delay.  I'm not going to make a hard statement
about how it should be done right now.  It's a fiddly area and it can
be tweaked after the driver is merged.

However, Timur is absolutely right.  A spin without an early exit
condition should simply be a udelay().

> I have to delay 50us because ALSA tries to access the hardware
> immediately after the function returns.

Does the code run in atomic context?

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [PATCH] net/ucc_geth: allow to set mac address on running device
From: David Miller @ 2009-05-27  3:49 UTC (permalink / raw)
  To: kexin.hao; +Cc: linuxppc-dev, leoli, linux-kernel, netdev
In-Reply-To: <1243388936.13410.4.camel@kevin>

From: Kevin Hao <kexin.hao@windriver.com>
Date: Wed, 27 May 2009 09:48:56 +0800

> Inspired by the patch for 8139too (bda6a15a).
> 
> Currently we can't set mac address on a running ucc_geth device.
> But this is needed when you use this device as a bonding slave in
> bonding device in balance-alb mode. So add this feature for ucc_geth
> device.
> 
> Signed-off-by: Kevin Hao <kexin.hao@windriver.com>

Applied to net-next-2.6, thanks.

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Grant Likely @ 2009-05-27  3:49 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel, broonie
In-Reply-To: <ed82fe3e0905262012r58f8a750lab9cb1bf3b9a989@mail.gmail.com>

On Tue, May 26, 2009 at 9:12 PM, Timur Tabi <timur@freescale.com> wrote:
> On Tue, May 26, 2009 at 8:01 PM, Jon Smirl <jonsmirl@gmail.com> wrote:
>
>> Then why did you need to make your routine that calls cpu_relax()?
>
> That gets called only if delay =3D=3D 0. =A0udelay(0) is a no-op, so if t=
he
> caller specifies no delay, then I need to manually call cpu_relax().
>
>> I don't know what goes on in the guts of HMT_low() and cpu_relax(),
>> when you guys decide which one I should use let me know and I can
>> adjust the patch.
>
> Grant, I don't see any reason why "udelay(50)" is unacceptable.

It's not.  See my last email.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* Re: [alsa-devel] [PATCH] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Grant Likely @ 2009-05-27  4:00 UTC (permalink / raw)
  To: Jon Smirl; +Cc: linuxppc-dev, alsa-devel, Timur Tabi, broonie
In-Reply-To: <fa686aa40905262048ma2d5e12s907c489974343280@mail.gmail.com>

On Tue, May 26, 2009 at 9:48 PM, Grant Likely <grant.likely@secretlab.ca> w=
rote:
> First, udelay just burns time, and if the delay is too large, then the
> it is wasting time that could be used for something else. =A0That being
> said, it needs to be balanced with the context switch overhead. =A0If
> the udelay() is less than double the context switch time, then the
> overhead is greater than the time spent spinning.

BTW, lmbench lat_ctx test case tells me that context switch latency is
measured somewhere around 30 to 60 us for user space processes
sleeping on a file descriptor.  That will be lower for kernel threads
since there is no syscall overhead to account for.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH V2] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Jon Smirl @ 2009-05-27  4:30 UTC (permalink / raw)
  To: grant.likely, linuxppc-dev, alsa-devel, broonie, timur

The function signature for spin_event_timeout() has changed in version V9.
Adjust the mpc5200 AC97 driver to use the new function.
v2 - switch back to udelay() for fixed timeouts.

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
---
 sound/soc/fsl/mpc5200_psc_ac97.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 9f2df15..4342b51 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -31,13 +31,13 @@ static struct psc_dma *psc_dma;
 
 static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 {
-	int rc;
+	int status;
 	unsigned int val;
 
 	/* Wait for command send status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status= spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (rdy)\n");
 		return -ENODEV;
 	}
@@ -45,9 +45,9 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 	out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24));
 
 	/* Wait for the answer */
-	spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_DATA_VAL), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_DATA_VAL), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 read (val) %x\n",
 				in_be16(&psc_dma->psc_regs->sr_csr.status));
 		return -ENODEV;
@@ -66,12 +66,12 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 static void psc_ac97_write(struct snd_ac97 *ac97,
 				unsigned short reg, unsigned short val)
 {
-	int rc;
+	int status;
 
 	/* Wait for command status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (write)\n");
 		return;
 	}
@@ -82,24 +82,22 @@ static void psc_ac97_write(struct snd_ac97 *ac97,
 
 static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	out_be32(&regs->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
-	spin_event_timeout(0, 3, 0, rc);
+	udelay(3);
 	out_be32(&regs->sicr, psc_dma->sicr);
 }
 
 static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	/* Do a cold reset */
 	out_8(&regs->op1, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 10, 0, rc);
+	udelay(10);
 	out_8(&regs->op0, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 50, 0, rc);
+	udelat(50);
 	psc_ac97_warm_reset(ac97);
 }
 

^ permalink raw reply related

* Re: [PATCH] net/ucc_geth: allow to set mac address on running device
From: David Miller @ 2009-05-27  4:42 UTC (permalink / raw)
  To: kexin.hao; +Cc: linuxppc-dev, leoli, linux-kernel, netdev
In-Reply-To: <1243388936.13410.4.camel@kevin>

From: Kevin Hao <kexin.hao@windriver.com>
Date: Wed, 27 May 2009 09:48:56 +0800

> Inspired by the patch for 8139too (bda6a15a).
> 
> Currently we can't set mac address on a running ucc_geth device.
> But this is needed when you use this device as a bonding slave in
> bonding device in balance-alb mode. So add this feature for ucc_geth
> device.
> 
> Signed-off-by: Kevin Hao <kexin.hao@windriver.com>

I applied this patch already, there is no need to post it again.

^ permalink raw reply

* [PATCH V3] Modify mpc5200 AC97 driver to use V9 of spin_event_timeout()
From: Jon Smirl @ 2009-05-27  5:06 UTC (permalink / raw)
  To: grant.likely, linuxppc-dev, alsa-devel, broonie, timur

The function signature for spin_event_timeout() has changed in version V9.
Adjust the mpc5200 AC97 driver to use the new function.
v2 - switch back to udelay() for fixed timeouts.
v3 - forgot about driver being market broken, fix typo

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
---
 sound/soc/fsl/mpc5200_psc_ac97.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 9f2df15..794a247 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -31,13 +31,13 @@ static struct psc_dma *psc_dma;
 
 static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 {
-	int rc;
+	int status;
 	unsigned int val;
 
 	/* Wait for command send status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (rdy)\n");
 		return -ENODEV;
 	}
@@ -45,9 +45,9 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 	out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24));
 
 	/* Wait for the answer */
-	spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_DATA_VAL), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout((in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_DATA_VAL), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 read (val) %x\n",
 				in_be16(&psc_dma->psc_regs->sr_csr.status));
 		return -ENODEV;
@@ -66,12 +66,12 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 static void psc_ac97_write(struct snd_ac97 *ac97,
 				unsigned short reg, unsigned short val)
 {
-	int rc;
+	int status;
 
 	/* Wait for command status zero = ready */
-	spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
-				MPC52xx_PSC_SR_CMDSEND), 100, 0, rc);
-	if (rc == 0) {
+	status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
+				MPC52xx_PSC_SR_CMDSEND), 100, 0);
+	if (status == 0) {
 		pr_err("timeout on ac97 bus (write)\n");
 		return;
 	}
@@ -82,24 +82,22 @@ static void psc_ac97_write(struct snd_ac97 *ac97,
 
 static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	out_be32(&regs->sicr, psc_dma->sicr | MPC52xx_PSC_SICR_AWR);
-	spin_event_timeout(0, 3, 0, rc);
+	udelay(3);
 	out_be32(&regs->sicr, psc_dma->sicr);
 }
 
 static void psc_ac97_cold_reset(struct snd_ac97 *ac97)
 {
-	int rc;
 	struct mpc52xx_psc __iomem *regs = psc_dma->psc_regs;
 
 	/* Do a cold reset */
 	out_8(&regs->op1, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 10, 0, rc);
+	udelay(10);
 	out_8(&regs->op0, MPC52xx_PSC_OP_RES);
-	spin_event_timeout(0, 50, 0, rc);
+	udelay(50);
 	psc_ac97_warm_reset(ac97);
 }
 

^ permalink raw reply related

* Net: ucc_geth ethernet driver optimization space
From: Liu Dave-R63238 @ 2009-05-27  5:08 UTC (permalink / raw)
  To: netdev; +Cc: linuxppc-dev, linux-kernel

Guys,

The ucc_geth ethernet driver have dozens of strong sync read/write
operation, such as in_be32/16/8, out_be32/16/8.

all of them is sync read/write, it is very expensive for performance.

For the critical patch, we can remove some unnecessary in_be(x),
out_be(x) with normal memory operation, and keep some necessary
memory barrier.

eg: BD access in the interrupt handler and start_xmit.

The BD operation only need the memory barrier between length/buffer
and status.

struct buffer descriptor {
	u16 status;
	u16 length;
	u32 buffer;
} __attribute__ ((packed));

struct buffer descriptor *BD;

BD->length =3D xxxx;
BD->buffer =3D yyyy;
wmb();
BD->status =3D zzzz;

For powerpc, eieio is enough for 60x, mbar 1 is enough for e500.
Of couse, also need the memory clobber to avoid the compiler
reorder between them.

Thanks, Dave

^ permalink raw reply

* [git pull] Please pull powerpc.git merge branch
From: Benjamin Herrenschmidt @ 2009-05-27  6:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev list, Andrew Morton, Linux Kernel list

Hi Linus

And here's the rest of the fixes I was talking about. Hopefully that
should bring back all non-coherent DMA platforms into proper working
conditions. It's a bit invasive so late in the process but it's been
reasonably well tested for a few days.

The following changes since commit cd86a536c81e9300d984327517548ca0652eebf9:
  Linus Torvalds (1):
        Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/.../tip/linux-2.6-tip

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Benjamin Herrenschmidt (4):
      Revert "powerpc: Rework dma-noncoherent to use generic vmalloc layer"
      powerpc: Move dma-noncoherent.c from arch/powerpc/lib to arch/powerpc/mm
      powerpc: Minor cleanups of kernel virt address space definitions
      powerpc: Fix up dma_alloc_coherent() on platforms without cache coherency.

 arch/powerpc/Kconfig                     |   12 +
 arch/powerpc/include/asm/dma-mapping.h   |    6 +-
 arch/powerpc/include/asm/fixmap.h        |    4 +-
 arch/powerpc/include/asm/pgtable-ppc32.h |   26 ++-
 arch/powerpc/kernel/dma.c                |    2 +-
 arch/powerpc/lib/Makefile                |    1 -
 arch/powerpc/lib/dma-noncoherent.c       |  237 ------------------
 arch/powerpc/mm/Makefile                 |    1 +
 arch/powerpc/mm/dma-noncoherent.c        |  400 ++++++++++++++++++++++++++++++
 arch/powerpc/mm/init_32.c                |    8 +-
 arch/powerpc/mm/mem.c                    |   17 ++
 arch/powerpc/mm/pgtable_32.c             |    2 -
 12 files changed, 463 insertions(+), 253 deletions(-)
 delete mode 100644 arch/powerpc/lib/dma-noncoherent.c
 create mode 100644 arch/powerpc/mm/dma-noncoherent.c

^ permalink raw reply

* Re: Net: ucc_geth ethernet driver optimization space
From: Joakim Tjernlund @ 2009-05-27  6:49 UTC (permalink / raw)
  To: Liu Dave-R63238
  Cc: linuxppc-dev, netdev, linux-kernel,
	linuxppc-dev-bounces+joakim.tjernlund=transmode.se
In-Reply-To: <D7CCA83BB0796C49BC0BB53B6AB1208934920A@zch01exm21.fsl.freescale.net>



linuxppc-dev-bounces+joakim.tjernlund=transmode.se@ozlabs.org wrote on 27/05/2009 07:08:07:
>
> Guys,
>
> The ucc_geth ethernet driver have dozens of strong sync read/write
> operation, such as in_be32/16/8, out_be32/16/8.
>
> all of them is sync read/write, it is very expensive for performance.
>
> For the critical patch, we can remove some unnecessary in_be(x),
> out_be(x) with normal memory operation, and keep some necessary
> memory barrier.
>
> eg: BD access in the interrupt handler and start_xmit.
>
> The BD operation only need the memory barrier between length/buffer
> and status.
>
> struct buffer descriptor {
>    u16 status;
>    u16 length;
>    u32 buffer;
> } __attribute__ ((packed));
>
> struct buffer descriptor *BD;
>
> BD->length = xxxx;
> BD->buffer = yyyy;
> wmb();
> BD->status = zzzz;
>
> For powerpc, eieio is enough for 60x, mbar 1 is enough for e500.
> Of couse, also need the memory clobber to avoid the compiler
> reorder between them.
>
> Thanks, Dave

Yes, pretty please :)

You might want to combine status and length into one U32 though:
BD->buffer = yyyy;
wmb();
BD->stat_len = zzzz << 16 | xxxx;

  Jocke

^ permalink raw reply

* Re: [U-Boot] [PATCH 1/2] 83xx: Replace CONFIG_MPC83XX with CONFIG_MPC83xx
From: Stefan Roese @ 2009-05-27  7:08 UTC (permalink / raw)
  To: u-boot; +Cc: linuxppc-dev, Wolfgang Denk, Peter Tyser
In-Reply-To: <20090526183834.76345105.kim.phillips@freescale.com>

On Wednesday 27 May 2009 01:38:34 Kim Phillips wrote:
> > > If others would prefer standardizing on uppercase, I can submit new
> > > patches for 85xx, 5xxx, 86xx, etc.  This would be still be inconsistent
> > > with Linux though, which is a bit annoying.
> >
> > It seems Linux uses 8?xx with very few exceptions (CONFIG_SND_VIA82XX*
> > and CONFIG_EDAC_MPC85XX), so let's do the same here.
>
> so linux is inconsistent too.
>
> I'm a fan of a more self-consistent CONFIG_MPC85XX_MDS over mixed-case
> names like linux' CONFIG_MPC85xx_MDS.
>
> I wonder if the linux ppc guys would accept a
> s/CONFIG_MPC8?xx/CONFIG_MPC8?XX/g rename patch for linux...

Just to add my 0.02$ as well, I prefer the lower case version CONFIG_8?xx. 
It's used for 4xx this way as well in Linux and U-Boot. Perhaps I'm just used 
to reading it this way...

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de
=====================================================================

^ permalink raw reply

* Re: [GIT PULL] fsldma driver fixes
From: Li Yang @ 2009-05-27  8:24 UTC (permalink / raw)
  To: Dan Williams; +Cc: linuxppc-dev Development, lkml, Ira Snyder
In-Reply-To: <e9c3a7c20905261659v5d785df3w646efd4cbba2e6dd@mail.gmail.com>

On Wed, May 27, 2009 at 7:59 AM, Dan Williams <dan.j.williams@intel.com> wr=
ote:
> On Fri, May 22, 2009 at 3:47 AM, Li Yang <leoli@freescale.com> wrote:
>> Hi Dan,
>>
>> Here are fixes for Freescale DMA engine driver.
>>
>> Thanks,
>> - Leo
>>
>>
>> The following changes since commit 5805977e63a36ad56594a623f3bd2bebcb7db=
233:
>> =C2=A0Linus Torvalds (1):
>> =C2=A0 =C2=A0 =C2=A0 =C2=A0Merge branch 'for-linus' of git://git.kernel.=
org/.../jbarnes/drm-2.6
>>
>> are available in the git repository at:
>>
>> =C2=A0git://git.kernel.org/pub/scm/linux/kernel/git/leo/fsl-soc.git fsld=
ma
>>
>> Ira Snyder (4):
>> =C2=A0 =C2=A0 =C2=A0fsldma: fix "DMA halt timeout!" errors
>> =C2=A0 =C2=A0 =C2=A0fsldma: fix infinite loop on multi-descriptor DMA ch=
ain completion
>> =C2=A0 =C2=A0 =C2=A0fsldma: snooping is not enabled for last entry in de=
scriptor chain
>> =C2=A0 =C2=A0 =C2=A0fsldma: fix memory leak on error path in fsl_dma_pre=
p_memcpy()
>>
>> Li Yang (1):
>> =C2=A0 =C2=A0 =C2=A0fsldma: update mailling list address in MAINTAINERS
>>
>> Roel Kluin (1):
>> =C2=A0 =C2=A0 =C2=A0fsldma: fix check on potential fdev->chan[] overflow
>>
>
> Pulled, thanks. =C2=A0These all look like 2.6.30 candidates, right?

Yes, they are pure fixes.

- Leo

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox