LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2] mtd/nand : workaround for Freescale FCM to support large-page Nand chip
From: Artem Bityutskiy @ 2011-08-15 16:24 UTC (permalink / raw)
  To: Scott Wood; +Cc: dwmw2, b35362, linux-mtd, linuxppc-dev
In-Reply-To: <4E494520.7050509@freescale.com>

On Mon, 2011-08-15 at 11:11 -0500, Scott Wood wrote:
> On 08/15/2011 10:59 AM, Artem Bityutskiy wrote:
> > On Tue, 2011-07-12 at 12:48 +0800, b35362@freescale.com wrote:
> >> +	/*
> >> +	 * Hack for supporting the flash chip whose writesize is
> >> +	 * larger than 2K bytes.
> >> +	 */
> >> +	if (mtd->writesize > 2048) {
> >> +		elbc_fcm_ctrl->subpage_shift = ffs(mtd->writesize >> 11) - 1;
> >> +		elbc_fcm_ctrl->subpage_mask =
> >> +			(1 << elbc_fcm_ctrl->subpage_shift) - 1;
> >> +		/*
> >> +		 * Rewrite mtd->writesize, mtd->oobsize, chip->page_shift
> >> +		 * and chip->pagemask.
> >> +		 */
> >> +		mtd->writesize = 2048;
> >> +		mtd->oobsize = 64;
> >> +		chip->page_shift = ffs(mtd->writesize) - 1;
> >> +		chip->pagemask = (chip->chipsize >> chip->page_shift) - 1;
> >> +	}
> > 
> > So basically if the flash has 4KiB NAND pages, you are considering it as
> > a flash with 2KiB NAND pages. But surely this will work only if the
> > underlying flash has NOP 2 at least. Or even, if you consider that JFFS2
> > and YAFFS want to write to OOB, you need NOP 4 (2 ECC writes and 2
> > writes from YAFFS/JFFS2) ? So this won't work for NOP1 flashes?
> 
> Right.  The set of chips that work with this controller is still larger
> with this than without this.
> 
> It looks like NOP1 tends to be MLC -- you probably wouldn't want to use
> MLC with this controller anyway as it only does 1-bit ECC.
> 
> > Isn't it an ugly hack?
> 
> Less ugly than some other approaches that were considered. :-)
> 
> But yes, it's a hack (even says so in the comment).  The other option is
> "it doesn't work".

Could there be at least a fat comment that NANDs with 4KiB pages have to
be at least NOP4? And probably NANDs with 8KiB pages and larger should
simply be rejected?

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply

* Re: [PATCH 8/9] arch/powerpc/sysdev/ehv_pic.c: add missing kfree
From: Tabi Timur-B04825 @ 2011-08-15 22:55 UTC (permalink / raw)
  To: Julia Lawall, Benjamin Herrenschmidt, Kumar Gala
  Cc: Paul Mackerras, kernel-janitors@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
In-Reply-To: <1312802283-9107-8-git-send-email-julia@diku.dk>

On Mon, Aug 8, 2011 at 7:18 AM, Julia Lawall <julia@diku.dk> wrote:

> diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.=
c
> index af1a5df..b6731e4 100644
> --- a/arch/powerpc/sysdev/ehv_pic.c
> +++ b/arch/powerpc/sysdev/ehv_pic.c
> @@ -280,6 +280,7 @@ void __init ehv_pic_init(void)
>
> =A0 =A0 =A0 =A0if (!ehv_pic->irqhost) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0of_node_put(np);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 kfree(ehv_pic);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return;
> =A0 =A0 =A0 =A0}

Although the fix is correct, I think there is another bug in this
function.  'np' is not released when the function finishes
successfully.   I've looked at other functions that use
irq_alloc_host(), and most of them do the same thing: they don't call
of_node_put() on the device node pointer.  The only exception I've
found is mpc5121_ads_cpld_pic_init().

Ben, Kumar: am I missing something?  irq_alloc_host() calls of_node_get():

	host->of_node =3D of_node_get(of_node);

so doesn't that mean that the caller of irq_alloc_host() should
release the device node pointer?

--=20
Timur Tabi
Linux kernel developer at Freescale=

^ permalink raw reply

* [PATCH] mtd/physmap_of: Don't add disabled flash devices
From: Chunhe Lan @ 2011-08-16  9:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: kumar.gala, linuxppc-dev, scottwood, akpm, dwmw2, Chunhe Lan

Flash(cfi-flash, jedec-flash, and so on) nodes with the
property status="disabled" are not usable and so avoid
adding "disabled" flash devices with the system.

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 drivers/mtd/maps/physmap_of.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index d251d1d..812e6dc 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -219,6 +219,9 @@ static int __devinit of_flash_probe(struct platform_device *dev)
 	struct mtd_info **mtd_list = NULL;
 	resource_size_t res_size;
 
+	if (!of_device_is_available(dp))
+		return -ENODEV;
+
 	match = of_match_device(of_flash_match, &dev->dev);
 	if (!match)
 		return -EINVAL;
-- 
1.5.6.5

^ permalink raw reply related

* [PATCH] mtd/nand: Don't add disabled nand flash devices
From: Chunhe Lan @ 2011-08-16  9:27 UTC (permalink / raw)
  To: linux-mtd; +Cc: kumar.gala, linuxppc-dev, scottwood, akpm, dwmw2, Chunhe Lan

Nand flash nodes with the property status="disabled" are not
usable and so avoid adding "disabled" nand flash devices with
the system.

Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
---
 drivers/mtd/nand/fsl_elbc_nand.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 33d8aad..8212c12 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -1,6 +1,6 @@
 /* Freescale Enhanced Local Bus Controller NAND driver
  *
- * Copyright © 2006-2007, 2010 Freescale Semiconductor
+ * Copyright © 2006-2007, 2010-2011 Freescale Semiconductor
  *
  * Authors: Nick Spence <nick.spence@freescale.com>,
  *          Scott Wood <scottwood@freescale.com>
@@ -849,6 +849,9 @@ static int __devinit fsl_elbc_nand_probe(struct platform_device *pdev)
 	struct device *dev;
 	struct device_node *node = pdev->dev.of_node;
 
+	if (!of_device_is_available(node))
+		return -ENODEV;
+
 	if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
 		return -ENODEV;
 	lbc = fsl_lbc_ctrl_dev->regs;
-- 
1.5.6.5

^ permalink raw reply related

* Re: [PATCH] mtd-utils: fix corrupt cleanmarker with flash_erase -j command
From: Artem Bityutskiy @ 2011-08-16 15:06 UTC (permalink / raw)
  To: b35362; +Cc: linuxppc-dev, dwmw2, linux-mtd, linuxppc-dev
In-Reply-To: <1312350638-25566-1-git-send-email-b35362@freescale.com>

On Wed, 2011-08-03 at 13:50 +0800, b35362@freescale.com wrote:
> From: Liu Shuo <b35362@freescale.com>
> 
> Flash_erase -j should fill discrete freeoob areas with required bytes
> of JFFS2 cleanmarker in jffs2_check_nand_cleanmarker(). Not just fill
> the first freeoob area.
> 
> Signed-off-by: Liu Shuo <b35362@freescale.com>
> Signed-off-by: Li Yang <leoli@freescale.com>

...

>  	/*
>  	 * Process user arguments
> @@ -197,15 +198,40 @@ int main(int argc, char *argv[])
>  			if (ioctl(fd, MEMGETOOBSEL, &oobinfo) != 0)
>  				return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device);
>  
> +			cleanmarker.totlen = cpu_to_je32(8);
>  			/* Check for autoplacement */
>  			if (oobinfo.useecc == MTD_NANDECC_AUTOPLACE) {
> +				struct nand_ecclayout_user ecclayout;
>  				/* Get the position of the free bytes */
> -				if (!oobinfo.oobfree[0][1])
> +				if (ioctl(fd, ECCGETLAYOUT, &ecclayout) != 0)
> +					return sys_errmsg("%s: unable to get NAND ecclayout", mtd_device);
> +

Hmm, shouldn't we instead make MTD_OOB_AUTO be available for userspace
via an ioctl instead and make flash_eraseall use it instead?

-- 
Best Regards,
Artem Bityutskiy

^ permalink raw reply

* Re: [PATCH] mtd-utils: fix corrupt cleanmarker with flash_erase -j command
From: Brian Norris @ 2011-08-16 19:42 UTC (permalink / raw)
  To: dedekind1; +Cc: b35362, linuxppc-dev, linuxppc-dev, linux-mtd, dwmw2
In-Reply-To: <1313507201.2679.2.camel@sauron>

On Tue, Aug 16, 2011 at 8:06 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Wed, 2011-08-03 at 13:50 +0800, b35362@freescale.com wrote:
>> From: Liu Shuo <b35362@freescale.com>
>>
>> Flash_erase -j should fill discrete freeoob areas with required bytes
>> of JFFS2 cleanmarker in jffs2_check_nand_cleanmarker(). Not just fill
>> the first freeoob area.
>
> Hmm, shouldn't we instead make MTD_OOB_AUTO be available for userspace
> via an ioctl instead and make flash_eraseall use it instead?

`nandwrite -o' does a similar thing, where it uses MEMGETOOBSEL to
find open spaces in OOB. Both MEMGETOOBSEL and ECCGETLAYOUT have been
declared obsolete. Plus, the code that uses any of these is somewhat
complicated and duplicated, so I agree that new code probably should
use some form of the internal MTD_OOB_AUTO.

Perhaps this can just be integrated into the new ioctl I'm writing as
a "mode" choice? See the thread:
http://lists.infradead.org/pipermail/linux-mtd/2011-August/037316.html

Brian

^ permalink raw reply

* Re: [PATCH] mtd/physmap_of: Don't add disabled flash devices
From: Scott Wood @ 2011-08-16 21:44 UTC (permalink / raw)
  To: Chunhe Lan; +Cc: dwmw2, kumar.gala, linux-mtd, akpm, linuxppc-dev
In-Reply-To: <1313486750-15211-1-git-send-email-Chunhe.Lan@freescale.com>

On 08/16/2011 04:25 AM, Chunhe Lan wrote:
> Flash(cfi-flash, jedec-flash, and so on) nodes with the
> property status="disabled" are not usable and so avoid
> adding "disabled" flash devices with the system.
> 
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  drivers/mtd/maps/physmap_of.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
> index d251d1d..812e6dc 100644
> --- a/drivers/mtd/maps/physmap_of.c
> +++ b/drivers/mtd/maps/physmap_of.c
> @@ -219,6 +219,9 @@ static int __devinit of_flash_probe(struct platform_device *dev)
>  	struct mtd_info **mtd_list = NULL;
>  	resource_size_t res_size;
>  
> +	if (!of_device_is_available(dp))
> +		return -ENODEV;
> +
>  	match = of_match_device(of_flash_match, &dev->dev);
>  	if (!match)
>  		return -EINVAL;

Are you actually seeing unavailable devices get probed?  I thought the
upper layers were supposed to prevent that.

-Scott

^ permalink raw reply

* Re: [PATCH] mtd/nand: Don't add disabled nand flash devices
From: Scott Wood @ 2011-08-16 21:46 UTC (permalink / raw)
  To: Chunhe Lan; +Cc: dwmw2, kumar.gala, linux-mtd, akpm, linuxppc-dev
In-Reply-To: <1313486855-15233-1-git-send-email-Chunhe.Lan@freescale.com>

On 08/16/2011 04:27 AM, Chunhe Lan wrote:
> Nand flash nodes with the property status=3D"disabled" are not
> usable and so avoid adding "disabled" nand flash devices with
> the system.
>=20
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> ---
>  drivers/mtd/nand/fsl_elbc_nand.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>=20
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_el=
bc_nand.c
> index 33d8aad..8212c12 100644
> --- a/drivers/mtd/nand/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
> @@ -1,6 +1,6 @@
>  /* Freescale Enhanced Local Bus Controller NAND driver
>   *
> - * Copyright =C2=A9 2006-2007, 2010 Freescale Semiconductor
> + * Copyright =C2=A9 2006-2007, 2010-2011 Freescale Semiconductor
>   *
>   * Authors: Nick Spence <nick.spence@freescale.com>,
>   *          Scott Wood <scottwood@freescale.com>
> @@ -849,6 +849,9 @@ static int __devinit fsl_elbc_nand_probe(struct pla=
tform_device *pdev)
>  	struct device *dev;
>  	struct device_node *node =3D pdev->dev.of_node;
> =20
> +	if (!of_device_is_available(node))
> +		return -ENODEV;
> +
>  	if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
>  		return -ENODEV;
>  	lbc =3D fsl_lbc_ctrl_dev->regs;

Same comment as the other patch -- unavailable devices should already
not be getting probed.  Also, this subject line makes it sound like this
is a NAND subsystem change rather than a change in one specific driver.

-Scott

^ permalink raw reply

* [PATCH] ASoC: claim the IRQ when the fsl_ssi device is probed, not opened
From: Timur Tabi @ 2011-08-16 22:35 UTC (permalink / raw)
  To: alsa-devel, linuxppc-dev, broonie, lrg

The PowerPC Freescale SSI driver is claiming the IRQ when the IRQ when
the device is opened, which means that the /proc/interrupts entry for
the SSI exists only during playback or capture.  This also meant that
the user won't know that the IRQ number is wrong until he tries to use
the device.  Instead, we should claim the IRQ when the device is probed.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/configs/mpc85xx_defconfig     |    1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index fcd85d2..a3467bf 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -139,6 +139,7 @@ CONFIG_SND=y
 CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
+CONFIG_SND_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 908c941..9693f6e 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -140,6 +140,7 @@ CONFIG_SND=y
 CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
+CONFIG_SND_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
-- 
1.7.4.4

^ permalink raw reply related

* [PATCH] powerpc/85xx: enable the audio drivers in the defconfigs
From: Timur Tabi @ 2011-08-16 22:36 UTC (permalink / raw)
  To: kumar.gala, linuxppc-dev

Enable the audio drivers in the non-corenet 85xx defconfigs so that audio
is enabled on the Freescale P1022DS reference board.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 sound/soc/fsl/fsl_ssi.c |   61 ++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index d48afea..06ac2b9 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -289,16 +289,6 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 	 */
 	if (!ssi_private->playback && !ssi_private->capture) {
 		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
-		int ret;
-
-		/* The 'name' should not have any slashes in it. */
-		ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0,
-				  ssi_private->name, ssi_private);
-		if (ret < 0) {
-			dev_err(substream->pcm->card->dev,
-				"could not claim irq %u\n", ssi_private->irq);
-			return ret;
-		}
 
 		/*
 		 * Section 16.5 of the MPC8610 reference manual says that the
@@ -522,15 +512,12 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
 	ssi_private->second_stream = NULL;
 
 	/*
-	 * If this is the last active substream, disable the SSI and release
-	 * the IRQ.
+	 * If this is the last active substream, disable the SSI.
 	 */
 	if (!ssi_private->playback && !ssi_private->capture) {
 		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
 
 		clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
-
-		free_irq(ssi_private->irq, ssi_private);
 	}
 }
 
@@ -675,17 +662,30 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	ret = of_address_to_resource(np, 0, &res);
 	if (ret) {
 		dev_err(&pdev->dev, "could not determine device resources\n");
-		kfree(ssi_private);
-		return ret;
+		goto error_kmalloc;
 	}
 	ssi_private->ssi = of_iomap(np, 0);
 	if (!ssi_private->ssi) {
 		dev_err(&pdev->dev, "could not map device resources\n");
-		kfree(ssi_private);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto error_kmalloc;
 	}
 	ssi_private->ssi_phys = res.start;
+
 	ssi_private->irq = irq_of_parse_and_map(np, 0);
+	if (ssi_private->irq == NO_IRQ) {
+		dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
+		ret = -ENXIO;
+		goto error_iomap;
+	}
+
+	/* The 'name' should not have any slashes in it. */
+	ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
+			  ssi_private);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "could not claim irq %u\n", ssi_private->irq);
+		goto error_irqmap;
+	}
 
 	/* Are the RX and the TX clocks locked? */
 	if (of_find_property(np, "fsl,ssi-asynchronous", NULL))
@@ -711,7 +711,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "could not create sysfs %s file\n",
 			ssi_private->dev_attr.attr.name);
-		goto error;
+		goto error_irq;
 	}
 
 	/* Register with ASoC */
@@ -720,7 +720,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	ret = snd_soc_register_dai(&pdev->dev, &ssi_private->cpu_dai_drv);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
-		goto error;
+		goto error_dev;
 	}
 
 	/* Trigger the machine driver's probe function.  The platform driver
@@ -741,18 +741,28 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	if (IS_ERR(ssi_private->pdev)) {
 		ret = PTR_ERR(ssi_private->pdev);
 		dev_err(&pdev->dev, "failed to register platform: %d\n", ret);
-		goto error;
+		goto error_dai;
 	}
 
 	return 0;
 
-error:
+error_dai:
 	snd_soc_unregister_dai(&pdev->dev);
+
+error_dev:
 	dev_set_drvdata(&pdev->dev, NULL);
-	if (dev_attr)
-		device_remove_file(&pdev->dev, dev_attr);
+	device_remove_file(&pdev->dev, dev_attr);
+
+error_irq:
+	free_irq(ssi_private->irq, ssi_private);
+
+error_irqmap:
 	irq_dispose_mapping(ssi_private->irq);
+
+error_iomap:
 	iounmap(ssi_private->ssi);
+
+error_kmalloc:
 	kfree(ssi_private);
 
 	return ret;
@@ -766,6 +776,9 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 	snd_soc_unregister_dai(&pdev->dev);
 	device_remove_file(&pdev->dev, &ssi_private->dev_attr);
 
+	free_irq(ssi_private->irq, ssi_private);
+	irq_dispose_mapping(ssi_private->irq);
+
 	kfree(ssi_private);
 	dev_set_drvdata(&pdev->dev, NULL);
 
-- 
1.7.4.4

^ permalink raw reply related

* Re: [PATCH] powerpc/85xx: enable the audio drivers in the defconfigs
From: Tabi Timur-B04825 @ 2011-08-16 22:40 UTC (permalink / raw)
  To: Tabi Timur-B04825; +Cc: linuxppc-dev@ozlabs.org, Gala Kumar-B11780
In-Reply-To: <1313534167-6698-1-git-send-email-timur@freescale.com>

Timur Tabi wrote:
> Enable the audio drivers in the non-corenet 85xx defconfigs so that audio
> is enabled on the Freescale P1022DS reference board.
>
> Signed-off-by: Timur Tabi<timur@freescale.com>

Ugh, somehow I got my patches criss-crossed.  Ignore this, please.  I'll=20
post a V2 in just a minute.=

^ permalink raw reply

* Re: [PATCH] ASoC: claim the IRQ when the fsl_ssi device is probed, not opened
From: Tabi Timur-B04825 @ 2011-08-16 22:41 UTC (permalink / raw)
  To: Tabi Timur-B04825
  Cc: linuxppc-dev@ozlabs.org, alsa-devel@alsa-project.org,
	broonie@opensource.wolfsonmicro.com, lrg@ti.com
In-Reply-To: <1313534150-6642-1-git-send-email-timur@freescale.com>

Timur Tabi wrote:
> The PowerPC Freescale SSI driver is claiming the IRQ when the IRQ when
> the device is opened, which means that the /proc/interrupts entry for
> the SSI exists only during playback or capture.  This also meant that
> the user won't know that the IRQ number is wrong until he tries to use
> the device.  Instead, we should claim the IRQ when the device is probed.
>
> Signed-off-by: Timur Tabi<timur@freescale.com>

Ugh, somehow I got my patches criss-crossed.  Ignore this, please.  I'll=20
post a V2 in just a minute.=

^ permalink raw reply

* [PATCH] [v2] powerpc/85xx: enable the audio drivers in the defconfigs
From: Timur Tabi @ 2011-08-16 22:44 UTC (permalink / raw)
  To: kumar.gala, linuxppc-dev

Enable the audio drivers in the non-corenet 85xx defconfigs so that audio
is enabled on the Freescale P1022DS reference board.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/configs/mpc85xx_defconfig     |    1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index fcd85d2..a3467bf 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -139,6 +139,7 @@ CONFIG_SND=y
 CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
+CONFIG_SND_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index 908c941..9693f6e 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -140,6 +140,7 @@ CONFIG_SND=y
 CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
+CONFIG_SND_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
-- 
1.7.4.4

^ permalink raw reply related

* [PATCH] [v2] ASoC: claim the IRQ when the fsl_ssi device is probed, not opened
From: Timur Tabi @ 2011-08-16 22:47 UTC (permalink / raw)
  To: broonie, lrg, linuxppc-dev, alsa-devel

The PowerPC Freescale SSI driver is claiming the IRQ when the IRQ when
the device is opened, which means that the /proc/interrupts entry for
the SSI exists only during playback or capture.  This also meant that
the user won't know that the IRQ number is wrong until he tries to use
the device.  Instead, we should claim the IRQ when the device is probed.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 sound/soc/fsl/fsl_ssi.c |   61 ++++++++++++++++++++++++++++------------------
 1 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index d48afea..06ac2b9 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -289,16 +289,6 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 	 */
 	if (!ssi_private->playback && !ssi_private->capture) {
 		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
-		int ret;
-
-		/* The 'name' should not have any slashes in it. */
-		ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0,
-				  ssi_private->name, ssi_private);
-		if (ret < 0) {
-			dev_err(substream->pcm->card->dev,
-				"could not claim irq %u\n", ssi_private->irq);
-			return ret;
-		}
 
 		/*
 		 * Section 16.5 of the MPC8610 reference manual says that the
@@ -522,15 +512,12 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
 	ssi_private->second_stream = NULL;
 
 	/*
-	 * If this is the last active substream, disable the SSI and release
-	 * the IRQ.
+	 * If this is the last active substream, disable the SSI.
 	 */
 	if (!ssi_private->playback && !ssi_private->capture) {
 		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
 
 		clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
-
-		free_irq(ssi_private->irq, ssi_private);
 	}
 }
 
@@ -675,17 +662,30 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	ret = of_address_to_resource(np, 0, &res);
 	if (ret) {
 		dev_err(&pdev->dev, "could not determine device resources\n");
-		kfree(ssi_private);
-		return ret;
+		goto error_kmalloc;
 	}
 	ssi_private->ssi = of_iomap(np, 0);
 	if (!ssi_private->ssi) {
 		dev_err(&pdev->dev, "could not map device resources\n");
-		kfree(ssi_private);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto error_kmalloc;
 	}
 	ssi_private->ssi_phys = res.start;
+
 	ssi_private->irq = irq_of_parse_and_map(np, 0);
+	if (ssi_private->irq == NO_IRQ) {
+		dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
+		ret = -ENXIO;
+		goto error_iomap;
+	}
+
+	/* The 'name' should not have any slashes in it. */
+	ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
+			  ssi_private);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "could not claim irq %u\n", ssi_private->irq);
+		goto error_irqmap;
+	}
 
 	/* Are the RX and the TX clocks locked? */
 	if (of_find_property(np, "fsl,ssi-asynchronous", NULL))
@@ -711,7 +711,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	if (ret) {
 		dev_err(&pdev->dev, "could not create sysfs %s file\n",
 			ssi_private->dev_attr.attr.name);
-		goto error;
+		goto error_irq;
 	}
 
 	/* Register with ASoC */
@@ -720,7 +720,7 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	ret = snd_soc_register_dai(&pdev->dev, &ssi_private->cpu_dai_drv);
 	if (ret) {
 		dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
-		goto error;
+		goto error_dev;
 	}
 
 	/* Trigger the machine driver's probe function.  The platform driver
@@ -741,18 +741,28 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	if (IS_ERR(ssi_private->pdev)) {
 		ret = PTR_ERR(ssi_private->pdev);
 		dev_err(&pdev->dev, "failed to register platform: %d\n", ret);
-		goto error;
+		goto error_dai;
 	}
 
 	return 0;
 
-error:
+error_dai:
 	snd_soc_unregister_dai(&pdev->dev);
+
+error_dev:
 	dev_set_drvdata(&pdev->dev, NULL);
-	if (dev_attr)
-		device_remove_file(&pdev->dev, dev_attr);
+	device_remove_file(&pdev->dev, dev_attr);
+
+error_irq:
+	free_irq(ssi_private->irq, ssi_private);
+
+error_irqmap:
 	irq_dispose_mapping(ssi_private->irq);
+
+error_iomap:
 	iounmap(ssi_private->ssi);
+
+error_kmalloc:
 	kfree(ssi_private);
 
 	return ret;
@@ -766,6 +776,9 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 	snd_soc_unregister_dai(&pdev->dev);
 	device_remove_file(&pdev->dev, &ssi_private->dev_attr);
 
+	free_irq(ssi_private->irq, ssi_private);
+	irq_dispose_mapping(ssi_private->irq);
+
 	kfree(ssi_private);
 	dev_set_drvdata(&pdev->dev, NULL);
 
-- 
1.7.4.4

^ permalink raw reply related

* Re: [PATCH] RapidIO: Add mport driver for Tsi721 bridge
From: Andrew Morton @ 2011-08-16 23:01 UTC (permalink / raw)
  To: Alexandre Bounine; +Cc: Chul Kim, linux-kernel, linuxppc-dev
In-Reply-To: <1313178334-6964-1-git-send-email-alexandre.bounine@idt.com>

On Fri, 12 Aug 2011 15:45:34 -0400
Alexandre Bounine <alexandre.bounine@idt.com> wrote:

> Add RapidIO mport driver for IDT TSI721 PCI Express-to-SRIO bridge device.
> The driver provides full set of callback functions defined for mport devices
> in RapidIO subsystem. It also is compatible with current version of RIONET
> driver (Ethernet over RapidIO messaging services).
> 
> This patch is applicable to kernel versions starting from 2.6.39.

What a huge driver.

>
> ...
>
> --- /dev/null
> +++ b/drivers/rapidio/devices/Kconfig
> @@ -0,0 +1,10 @@
> +#
> +# RapidIO master port configuration
> +#
> +
> +config RAPIDIO_TSI721
> +	bool "IDT Tsi721 PCI Express SRIO Controller support"
> +	depends on RAPIDIO && PCI && PCIEPORTBUS

The dependency on PCI is redundant - PCIEPORTBUS already depends on
PCI.  Doesn't matter much though.

> +	default "n"
> +	---help---
> +	  Include support for IDT Tsi721 PCI Express Serial RapidIO controller.
>
> ...
>
> +static int tsi721_maint_dma(struct tsi721_device *priv, u32 sys_size,
> +			u16 destid, u8 hopcount, u32 offset, int len,
> +			u32 *data, int do_wr)
> +{
> +	struct tsi721_dma_desc *bd_ptr;
> +	u32 rd_count, swr_ptr, ch_stat;
> +	int i, err = 0;
> +	u32 op = do_wr ? MAINT_WR : MAINT_RD;
> +
> +	if (offset > (RIO_MAINT_SPACE_SZ - len) || (len != sizeof(u32)))
> +		return -EINVAL;
> +
> +	bd_ptr = priv->bdma[TSI721_DMACH_MAINT].bd_base;
> +
> +	rd_count = ioread32(
> +			priv->regs + TSI721_DMAC_DRDCNT(TSI721_DMACH_MAINT));
> +
> +	/* Initialize DMA descriptor */
> +	bd_ptr[0].type_id = cpu_to_le32((DTYPE2 << 29) | (op << 19) | destid);
> +	bd_ptr[0].bcount = cpu_to_le32((sys_size << 26) | 0x04);
> +	bd_ptr[0].raddr_lo = cpu_to_le32((hopcount << 24) | offset);
> +	bd_ptr[0].raddr_hi = 0;
> +	if (do_wr)
> +		bd_ptr[0].data[0] = cpu_to_be32p(data);
> +	else
> +		bd_ptr[0].data[0] = 0xffffffff;
> +
> +	mb();
> +
> +	/* Start DMA operation */
> +	iowrite32(rd_count + 2,
> +		priv->regs + TSI721_DMAC_DWRCNT(TSI721_DMACH_MAINT));
> +	(void)ioread32(priv->regs + TSI721_DMAC_DWRCNT(TSI721_DMACH_MAINT));
> +	i = 0;
> +
> +	/* Wait until DMA transfer is finished */
> +	while ((ch_stat = ioread32(priv->regs +
> +		TSI721_DMAC_STS(TSI721_DMACH_MAINT))) & TSI721_DMAC_STS_RUN) {
> +		udelay(10);
> +		i++;
> +		if (i >= 5000000) {
> +			dev_dbg(&priv->pdev->dev,
> +				"%s : DMA[%d] read timeout ch_status=%x\n",
> +				__func__, TSI721_DMACH_MAINT, ch_stat);
> +			if (!do_wr)
> +				*data = 0xffffffff;
> +			err = -EFAULT;
> +			goto err_out;
> +		}
> +	}

Fifty seconds!?!?

EFAULT seems an inappropriate errno.

> +	if (ch_stat & TSI721_DMAC_STS_ABORT) {
> +		/* If DMA operation aborted due to error,
> +		 * reinitialize DMA channel
> +		 */
> +		dev_dbg(&priv->pdev->dev, "%s : DMA ABORT ch_stat=%x\n",
> +			__func__, ch_stat);
> +		dev_dbg(&priv->pdev->dev, "OP=%d : destid=%x hc=%x off=%x\n",
> +			do_wr ? MAINT_WR : MAINT_RD, destid, hopcount, offset);
> +		iowrite32(TSI721_DMAC_INT_ALL,
> +			priv->regs + TSI721_DMAC_INT(TSI721_DMACH_MAINT));
> +		iowrite32(TSI721_DMAC_CTL_INIT,
> +			priv->regs + TSI721_DMAC_CTL(TSI721_DMACH_MAINT));
> +		udelay(10);
> +		iowrite32(0, priv->regs +
> +				TSI721_DMAC_DWRCNT(TSI721_DMACH_MAINT));
> +		udelay(1);
> +		if (!do_wr)
> +			*data = 0xffffffff;
> +		err = -EFAULT;
> +		goto err_out;
> +	}
> +
> +	if (!do_wr)
> +		*data = be32_to_cpu(bd_ptr[0].data[0]);
> +
> +	/*
> +	 * Update descriptor status FIFO RD pointer.
> +	 * NOTE: Skipping check and clear FIFO entries because we are waiting
> +	 * for transfer to be completed.
> +	 */
> +	swr_ptr = ioread32(priv->regs + TSI721_DMAC_DSWP(TSI721_DMACH_MAINT));
> +	iowrite32(swr_ptr, priv->regs + TSI721_DMAC_DSRP(TSI721_DMACH_MAINT));
> +err_out:
> +
> +	return err;
> +}
>
> ...
>
> +static int
> +tsi721_pw_handler(struct rio_mport *mport)
> +{
> +	struct tsi721_device *priv = mport->priv;
> +	u32 pw_stat;
> +	u32 pw_buf[TSI721_RIO_PW_MSG_SIZE/sizeof(u32)];
> +
> +
> +	pw_stat = ioread32(priv->regs + TSI721_RIO_PW_RX_STAT);
> +
> +	if (pw_stat & TSI721_RIO_PW_RX_STAT_PW_VAL) {
> +		pw_buf[0] = ioread32(priv->regs + TSI721_RIO_PW_RX_CAPT(0));
> +		pw_buf[1] = ioread32(priv->regs + TSI721_RIO_PW_RX_CAPT(1));
> +		pw_buf[2] = ioread32(priv->regs + TSI721_RIO_PW_RX_CAPT(2));
> +		pw_buf[3] = ioread32(priv->regs + TSI721_RIO_PW_RX_CAPT(3));
> +
> +		/* Queue PW message (if there is room in FIFO),
> +		 * otherwise discard it.
> +		 */
> +		spin_lock(&priv->pw_fifo_lock);
> +		if (kfifo_avail(&priv->pw_fifo) >= TSI721_RIO_PW_MSG_SIZE)
> +			kfifo_in(&priv->pw_fifo, pw_buf,
> +						TSI721_RIO_PW_MSG_SIZE);
> +		else
> +			priv->pw_discard_count++;
> +		spin_unlock(&priv->pw_fifo_lock);
> +	}
> +
> +	/* Clear pending PW interrupts */
> +	iowrite32(TSI721_RIO_PW_RX_STAT_PW_DISC | TSI721_RIO_PW_RX_STAT_PW_VAL,
> +		  priv->regs + TSI721_RIO_PW_RX_STAT);
> +
> +	schedule_work(&priv->pw_work);

I see scheduled work being done, but no flush_scheduled_work() or
similar.  This is often a bug, leading to code being executed after
device shutdown or even after rmmod.

> +	return 0;
> +}
> +
> +static void tsi721_pw_dpc(struct work_struct *work)
> +{
> +	struct tsi721_device *priv = container_of(work, struct tsi721_device,
> +						    pw_work);
> +	unsigned long flags;
> +	u32 msg_buffer[RIO_PW_MSG_SIZE/sizeof(u32)]; /* Use full size PW message
> +							buffer for RIO layer */
> +
> +	/*
> +	 * Process port-write messages
> +	 */
> +	spin_lock_irqsave(&priv->pw_fifo_lock, flags);
> +	while (kfifo_out(&priv->pw_fifo, (unsigned char *)msg_buffer,
> +			 TSI721_RIO_PW_MSG_SIZE)) {
> +		/* Process one message */
> +		spin_unlock_irqrestore(&priv->pw_fifo_lock, flags);
> +#ifdef DEBUG_PW
> +		{
> +		u32 i;
> +		pr_debug("%s : Port-Write Message:", __func__);
> +		for (i = 0; i < RIO_PW_MSG_SIZE/sizeof(u32); ) {
> +			pr_debug("0x%02x: %08x %08x %08x %08x", i*4,
> +				msg_buffer[i], msg_buffer[i + 1],
> +				msg_buffer[i + 2], msg_buffer[i + 3]);
> +			i += 4;
> +		}
> +		pr_debug("\n");
> +		}
> +#endif
> +		/* Pass the port-write message to RIO core for processing */
> +		rio_inb_pwrite_handler((union rio_pw_msg *)msg_buffer);
> +		spin_lock_irqsave(&priv->pw_fifo_lock, flags);
> +	}
> +	spin_unlock_irqrestore(&priv->pw_fifo_lock, flags);
> +}

The lock handling in this function is pretty ugly-looking.  Is it correct?

>
> ...
>
> +static void tsi721_db_dpc(struct work_struct *work)
> +{
> +	struct tsi721_device *priv = container_of(work, struct tsi721_device,
> +						    idb_work);
> +	struct rio_mport *mport;
> +	struct rio_dbell *dbell;
> +	int found = 0;
> +	u32 wr_ptr, rd_ptr;
> +	u64 *idb_entry;
> +	u32 regval;
> +	union {
> +		u64 msg;
> +		u8  bytes[8];
> +	} idb;
> +
> +	/*
> +	 * Process queued inbound doorbells
> +	 */
> +	mport = priv->mport;
> +
> +	wr_ptr = ioread32(priv->regs + TSI721_IDQ_WP(IDB_QUEUE));
> +	rd_ptr = ioread32(priv->regs + TSI721_IDQ_RP(IDB_QUEUE));
> +
> +	while (wr_ptr != rd_ptr) {
> +		idb_entry = (u64 *)(priv->idb_base +
> +					(TSI721_IDB_ENTRY_SIZE * rd_ptr));
> +		rd_ptr++;
> +		idb.msg = *idb_entry;

Is this code correct on both little-endian and big-endian hardware?

> +		*idb_entry = 0;
> +
> +		/* Process one doorbell */
> +		list_for_each_entry(dbell, &mport->dbells, node) {
> +			if ((dbell->res->start <= DBELL_INF(idb.bytes)) &&
> +			    (dbell->res->end >= DBELL_INF(idb.bytes))) {
> +				found = 1;
> +				break;
> +			}
> +		}
> +
> +		if (found) {
> +			dbell->dinb(mport, dbell->dev_id, DBELL_SID(idb.bytes),
> +				    DBELL_TID(idb.bytes), DBELL_INF(idb.bytes));
> +		} else {
> +			dev_dbg(&priv->pdev->dev,
> +				"spurious inb doorbell, sid %2.2x tid %2.2x"
> +				" info %4.4x\n", DBELL_SID(idb.bytes),
> +				DBELL_TID(idb.bytes), DBELL_INF(idb.bytes));
> +		}
> +	}
> +
> +	iowrite32(rd_ptr & (IDB_QSIZE - 1),
> +		priv->regs + TSI721_IDQ_RP(IDB_QUEUE));
> +
> +	/* Re-enable IDB interrupts */
> +	regval = ioread32(priv->regs + TSI721_SR_CHINTE(IDB_QUEUE));
> +	regval |= TSI721_SR_CHINT_IDBQRCV;
> +	iowrite32(regval,
> +		priv->regs + TSI721_SR_CHINTE(IDB_QUEUE));
> +}
> +
>
> ...
>
> +static void tsi721_interrupts_init(struct tsi721_device *priv)
> +{
> +	u32 intr;
> +
> +	/* Enable IDB interrupts */
> +	iowrite32(TSI721_SR_CHINT_ALL,
> +		priv->regs + TSI721_SR_CHINT(IDB_QUEUE));
> +	iowrite32(TSI721_SR_CHINT_IDBQRCV,
> +		priv->regs + TSI721_SR_CHINTE(IDB_QUEUE));
> +	iowrite32(TSI721_INT_SR2PC_CHAN(IDB_QUEUE),
> +		priv->regs + TSI721_DEV_CHAN_INTE);
> +
> +	/* Enable SRIO MAC interrupts */
> +	iowrite32(TSI721_RIO_EM_DEV_INT_EN_INT,
> +		priv->regs + TSI721_RIO_EM_DEV_INT_EN);
> +
> +	if (priv->flags & TSI721_USING_MSIX)
> +		intr = TSI721_DEV_INT_SRIO;
> +	else
> +		intr = TSI721_DEV_INT_SR2PC_CH | TSI721_DEV_INT_SRIO |
> +			TSI721_DEV_INT_SMSG_CH;
> +
> +	iowrite32(intr, priv->regs + TSI721_DEV_INTE);
> +	(void)ioread32(priv->regs + TSI721_DEV_INTE);

Why include all of these void casts, btw?

> +}
> +
> +/**
> + * tsi721_request_msix - register interrupt service for MSI-X mode.
> + * @mport: RapidIO master port structure
> + *
> + * Registers MSI-X interrupt service routines for interrupts that are active
> + * immediately after mport initialization. Messaging interrupt service routines
> + * should be registered during corresponding open requests.
> + */
> +static int tsi721_request_msix(struct rio_mport *mport)
> +{
> +	struct tsi721_device *priv = mport->priv;
> +	int err = 0;
> +
> +	err = request_irq(priv->msix[TSI721_VECT_IDB].vector,
> +			tsi721_sr2pc_ch_msix, 0,
> +			priv->msix[TSI721_VECT_IDB].irq_name, (void *)mport);
> +	if (err)
> +		goto out;
> +
> +	err = request_irq(priv->msix[TSI721_VECT_PWRX].vector,
> +			tsi721_srio_msix, 0,
> +			priv->msix[TSI721_VECT_PWRX].irq_name, (void *)mport);

Did we leak the first IRQ here?

> +out:
> +	return err;
> +}
> +
>
> ...
>
> +static int tsi721_enable_msix(struct tsi721_device *priv)
> +{
> +	struct msix_entry entries[TSI721_VECT_MAX];
> +	int err;
> +	int i;
> +
> +	entries[TSI721_VECT_IDB].entry = TSI721_MSIX_SR2PC_IDBQ_RCV(IDB_QUEUE);
> +	entries[TSI721_VECT_PWRX].entry = TSI721_MSIX_SRIO_MAC_INT;
> +
> +	/*
> +	 * Initialize MSI-X entries for Messaging Engine:
> +	 * this driver supports four RIO mailboxes (inbound and outbound)
> +	 * NOTE: Inbound message MBOX 0...4 use IB channels 4...7. Therefore
> +	 * offset +4 is added to IB MBOX number.
> +	 */
> +	for (i = 0; i < RIO_MAX_MBOX; i++) {
> +		entries[TSI721_VECT_IMB0_RCV + i].entry =
> +					TSI721_MSIX_IMSG_DQ_RCV(i + 4);
> +		entries[TSI721_VECT_IMB0_INT + i].entry =
> +					TSI721_MSIX_IMSG_INT(i + 4);
> +		entries[TSI721_VECT_OMB0_DONE + i].entry =
> +					TSI721_MSIX_OMSG_DONE(i);
> +		entries[TSI721_VECT_OMB0_INT + i].entry =
> +					TSI721_MSIX_OMSG_INT(i);
> +	}
> +
> +	err = pci_enable_msix(priv->pdev, entries, ARRAY_SIZE(entries));
> +	if (err) {
> +		if (err > 0)
> +			dev_info(&priv->pdev->dev,
> +				 "Only %d MSI-X vectors available, "
> +				 "not using MSI-X\n", err);
> +		return err;
> +	}
> +
> +	/*
> +	 * Copy MSI-X vector information into tsi721 private structure
> +	 */
> +	priv->msix[TSI721_VECT_IDB].vector = entries[TSI721_VECT_IDB].vector;
> +	snprintf(priv->msix[TSI721_VECT_IDB].irq_name, IRQ_DEVICE_NAME_MAX,
> +		 DRV_NAME "-idb@pci:%s", pci_name(priv->pdev));
> +	priv->msix[TSI721_VECT_PWRX].vector = entries[TSI721_VECT_PWRX].vector;
> +	snprintf(priv->msix[TSI721_VECT_PWRX].irq_name, IRQ_DEVICE_NAME_MAX,
> +		 DRV_NAME "-pwrx@pci:%s", pci_name(priv->pdev));
> +
> +	for (i = 0; i < RIO_MAX_MBOX; i++) {
> +		priv->msix[TSI721_VECT_IMB0_RCV + i].vector =
> +				entries[TSI721_VECT_IMB0_RCV + i].vector;
> +		snprintf(priv->msix[TSI721_VECT_IMB0_RCV + i].irq_name,
> +			 IRQ_DEVICE_NAME_MAX, DRV_NAME "-imbr%d@pci:%s",
> +			 i, pci_name(priv->pdev));
> +
> +		priv->msix[TSI721_VECT_IMB0_INT + i].vector =
> +				entries[TSI721_VECT_IMB0_INT + i].vector;
> +		snprintf(priv->msix[TSI721_VECT_IMB0_INT + i].irq_name,
> +			 IRQ_DEVICE_NAME_MAX, DRV_NAME "-imbi%d@pci:%s",
> +			 i, pci_name(priv->pdev));
> +
> +		priv->msix[TSI721_VECT_OMB0_DONE + i].vector =
> +				entries[TSI721_VECT_OMB0_DONE + i].vector;
> +		snprintf(priv->msix[TSI721_VECT_OMB0_DONE + i].irq_name,
> +			 IRQ_DEVICE_NAME_MAX, DRV_NAME "-ombd%d@pci:%s",
> +			 i, pci_name(priv->pdev));
> +
> +		priv->msix[TSI721_VECT_OMB0_INT + i].vector =
> +				entries[TSI721_VECT_OMB0_INT + i].vector;
> +		snprintf(priv->msix[TSI721_VECT_OMB0_INT + i].irq_name,
> +			 IRQ_DEVICE_NAME_MAX, DRV_NAME "-ombi%d@pci:%s",
> +			 i, pci_name(priv->pdev));
> +	}

Did we need a dependency on CONFIG_PCI_MSI?

> +	return 0;
> +}
> +
>
> ...
>
> +static int tsi721_bdma_ch_init(struct tsi721_device *priv, int chnum)
> +{
> +	struct tsi721_dma_desc *bd_ptr;
> +	u64		*sts_ptr;
> +	dma_addr_t	bd_phys, sts_phys;
> +	int		sts_size;
> +	int		bd_num = priv->bdma[chnum].bd_num;
> +
> +	dev_dbg(&priv->pdev->dev, "Init Block DMA Engine, CH%d\n", chnum);
> +
> +	/*
> +	 * Initialize DMA channel for maintenance requests
> +	 */
> +
> +	/* Allocate space for DMA descriptors */
> +	bd_ptr = dma_alloc_coherent(&priv->pdev->dev,
> +					bd_num * sizeof(struct tsi721_dma_desc),
> +					&bd_phys, GFP_KERNEL);
> +	if (!bd_ptr)
> +		return -ENOMEM;
> +
> +	priv->bdma[chnum].bd_phys = bd_phys;
> +	priv->bdma[chnum].bd_base = bd_ptr;
> +
> +	memset(bd_ptr, 0, bd_num * sizeof(struct tsi721_dma_desc));

There it is again.  Perhaps we need a dma_zalloc_coherent().

> +	dev_dbg(&priv->pdev->dev, "DMA descriptors @ %p (phys = %llx)\n",
> +		bd_ptr, (unsigned long long)bd_phys);
> +
> +	/* Allocate space for descriptor status FIFO */
> +	sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ?
> +					bd_num : TSI721_DMA_MINSTSSZ;
> +	sts_size = roundup_pow_of_two(sts_size);
> +	sts_ptr = dma_alloc_coherent(&priv->pdev->dev,
> +				     sts_size * sizeof(struct tsi721_dma_sts),
> +				     &sts_phys, GFP_KERNEL);
> +	if (!sts_ptr) {
> +		/* Free space allocated for DMA descriptors */
> +		dma_free_coherent(&priv->pdev->dev,
> +				  bd_num * sizeof(struct tsi721_dma_desc),
> +				  bd_ptr, bd_phys);
> +		priv->bdma[chnum].bd_base = NULL;
> +		return -ENOMEM;
> +	}
> +
> +	priv->bdma[chnum].sts_phys = sts_phys;
> +	priv->bdma[chnum].sts_base = sts_ptr;
> +	priv->bdma[chnum].sts_size = sts_size;
> +
> +	memset(sts_ptr, 0, sts_size);

and again.

> +	dev_dbg(&priv->pdev->dev,
> +		"desc status FIFO @ %p (phys = %llx) size=0x%x\n",
> +		sts_ptr, (unsigned long long)sts_phys, sts_size);
> +
> +	/* Initialize DMA descriptors ring */
> +	bd_ptr[bd_num - 1].type_id = cpu_to_le32(DTYPE3 << 29);
> +	bd_ptr[bd_num - 1].next_lo = cpu_to_le32((u64)bd_phys &
> +						 TSI721_DMAC_DPTRL_MASK);
> +	bd_ptr[bd_num - 1].next_hi = cpu_to_le32((u64)bd_phys >> 32);
> +
> +	/* Setup DMA descriptor pointers */
> +	iowrite32(((u64)bd_phys >> 32),
> +		priv->regs + TSI721_DMAC_DPTRH(chnum));
> +	iowrite32(((u64)bd_phys & TSI721_DMAC_DPTRL_MASK),
> +		priv->regs + TSI721_DMAC_DPTRL(chnum));
> +
> +	/* Setup descriptor status FIFO */
> +	iowrite32(((u64)sts_phys >> 32),
> +		priv->regs + TSI721_DMAC_DSBH(chnum));
> +	iowrite32(((u64)sts_phys & TSI721_DMAC_DSBL_MASK),
> +		priv->regs + TSI721_DMAC_DSBL(chnum));
> +	iowrite32(TSI721_DMAC_DSSZ_SIZE(sts_size),
> +		priv->regs + TSI721_DMAC_DSSZ(chnum));
> +
> +	/* Clear interrupt bits */
> +	iowrite32(TSI721_DMAC_INT_ALL,
> +		priv->regs + TSI721_DMAC_INT(chnum));
> +
> +	(void)ioread32(priv->regs + TSI721_DMAC_INT(chnum));
> +
> +	/* Toggle DMA channel initialization */
> +	iowrite32(TSI721_DMAC_CTL_INIT,	priv->regs + TSI721_DMAC_CTL(chnum));
> +	(void)ioread32(priv->regs + TSI721_DMAC_CTL(chnum));
> +	udelay(10);
> +
> +	return 0;
> +}
> +
>
> ...
>
> +struct tsi721_dma_desc {
> +	__le32 type_id;
> +
> +#define TSI721_DMAD_DEVID	0x0000ffff
> +#define TSI721_DMAD_CRF		0x00010000
> +#define TSI721_DMAD_PRIO	0x00060000
> +#define TSI721_DMAD_RTYPE	0x00780000
> +#define TSI721_DMAD_IOF		0x08000000
> +#define TSI721_DMAD_DTYPE	0xe0000000
> +
> +	__le32 bcount;
> +
> +#define TSI721_DMAD_BCOUNT1	0x03ffffff /* if DTYPE == 1 */
> +#define TSI721_DMAD_BCOUNT2	0x0000000f /* if DTYPE == 2 */
> +#define TSI721_DMAD_TT		0x0c000000
> +#define TSI721_DMAD_RADDR0	0xc0000000
> +
> +	union {
> +		__le32 raddr_lo;	   /* if DTYPE == (1 || 2) */
> +		__le32 next_lo;		   /* if DTYPE == 3 */
> +	};
> +
> +#define TSI721_DMAD_CFGOFF	0x00ffffff
> +#define TSI721_DMAD_HOPCNT	0xff000000
> +
> +	union {
> +		__le32 raddr_hi;	   /* if DTYPE == (1 || 2) */
> +		__le32 next_hi;		   /* if DTYPE == 3 */
> +	};
> +
> +	union {
> +		struct {		   /* if DTYPE == 1 */
> +			__le32 bufptr_lo;
> +			__le32 bufptr_hi;
> +			__le32 s_dist;
> +			__le32 s_size;
> +		} t1;
> +		__le32 data[4];		   /* if DTYPE == 2 */
> +		u32    reserved[4];	   /* if DTYPE == 3 */
> +	};
> +} __attribute__((aligned(32)));

We have the __aligned helper for this.  (more below)

>
> ...
>

^ permalink raw reply

* Re: [PATCH] [v2] ASoC: claim the IRQ when the fsl_ssi device is probed, not opened
From: Mark Brown @ 2011-08-17  1:04 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev, alsa-devel, lrg
In-Reply-To: <1313534865-7795-1-git-send-email-timur@freescale.com>

On Tue, Aug 16, 2011 at 06:47:45PM -0400, Timur Tabi wrote:
> The PowerPC Freescale SSI driver is claiming the IRQ when the IRQ when
> the device is opened, which means that the /proc/interrupts entry for
> the SSI exists only during playback or capture.  This also meant that
> the user won't know that the IRQ number is wrong until he tries to use
> the device.  Instead, we should claim the IRQ when the device is probed.

Applied, thanks.

^ permalink raw reply

* [PATCH v13 3/6] flexcan: Fix up fsl-flexcan device tree binding.
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	Robin Holt, Scott Wood, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

This patch cleans up the documentation of the device-tree binding for
the Flexcan devices on Freescale's PowerPC and ARM cores. Extra
properties are not used by the driver so we are removing them.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>,
Acked-by: Wolfgang Grandegger <wg@grandegger.com>,
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: socketcan-core@lists.berlios.de,
Cc: netdev@vger.kernel.org,
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: devicetree-discuss@lists.ozlabs.org
---
 .../devicetree/bindings/net/can/fsl-flexcan.txt    |   61 ++++----------------
 arch/powerpc/boot/dts/p1010rdb.dts                 |   10 +---
 arch/powerpc/boot/dts/p1010si.dtsi                 |   10 +--
 3 files changed, 17 insertions(+), 64 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 1a729f0..8dfb98b 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -1,61 +1,22 @@
-CAN Device Tree Bindings
-------------------------
-2011 Freescale Semiconductor, Inc.
+Flexcan CAN contoller on Freescale's ARM and PowerPC system-on-a-chip (SOC).
 
-fsl,flexcan-v1.0 nodes
------------------------
-In addition to the required compatible-, reg- and interrupt-properties, you can
-also specify which clock source shall be used for the controller.
+Required properties:
 
-CPI Clock- Can Protocol Interface Clock
-	This CLK_SRC bit of CTRL(control register) selects the clock source to
-	the CAN Protocol Interface(CPI) to be either the peripheral clock
-	(driven by the PLL) or the crystal oscillator clock. The selected clock
-	is the one fed to the prescaler to generate the Serial Clock (Sclock).
-	The PRESDIV field of CTRL(control register) controls a prescaler that
-	generates the Serial Clock (Sclock), whose period defines the
-	time quantum used to compose the CAN waveform.
+- compatible : Should be "fsl,<processor>-flexcan"
 
-Can Engine Clock Source
-	There are two sources for CAN clock
-	- Platform Clock  It represents the bus clock
-	- Oscillator Clock
+  An implementation should also claim any of the following compatibles
+  that it is fully backwards compatible with:
 
-	Peripheral Clock (PLL)
-	--------------
-		     |
-		    ---------		      -------------
-		    |       |CPI Clock	      | Prescaler |       Sclock
-		    |       |---------------->| (1.. 256) |------------>
-		    ---------		      -------------
-                     |  |
-	--------------  ---------------------CLK_SRC
-	Oscillator Clock
+  - fsl,p1010-flexcan
 
-- fsl,flexcan-clock-source : CAN Engine Clock Source.This property selects
-			     the peripheral clock. PLL clock is fed to the
-			     prescaler to generate the Serial Clock (Sclock).
-			     Valid values are "oscillator" and "platform"
-			     "oscillator": CAN engine clock source is oscillator clock.
-			     "platform" The CAN engine clock source is the bus clock
-		             (platform clock).
+- reg : Offset and length of the register set for this device
+- interrupts : Interrupt tuple for this device
 
-- fsl,flexcan-clock-divider : for the reference and system clock, an additional
-			      clock divider can be specified.
-- clock-frequency: frequency required to calculate the bitrate for FlexCAN.
+Example:
 
-Note:
-	- v1.0 of flexcan-v1.0 represent the IP block version for P1010 SOC.
-	- P1010 does not have oscillator as the Clock Source.So the default
-	  Clock Source is platform clock.
-Examples:
-
-	can0@1c000 {
-		compatible = "fsl,flexcan-v1.0";
+	can@1c000 {
+		compatible = "fsl,p1010-flexcan";
 		reg = <0x1c000 0x1000>;
 		interrupts = <48 0x2>;
 		interrupt-parent = <&mpic>;
-		fsl,flexcan-clock-source = "platform";
-		fsl,flexcan-clock-divider = <2>;
-		clock-frequency = <fixed by u-boot>;
 	};
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
index 6b33b73..d6c669c 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dts
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -23,6 +23,8 @@
 		ethernet2 = &enet2;
 		pci0 = &pci0;
 		pci1 = &pci1;
+		can0 = &can0;
+		can1 = &can1;
 	};
 
 	memory {
@@ -169,14 +171,6 @@
 			};
 		};
 
-		can0@1c000 {
-			fsl,flexcan-clock-source = "platform";
-		};
-
-		can1@1d000 {
-			fsl,flexcan-clock-source = "platform";
-		};
-
 		usb@22000 {
 			phy_type = "utmi";
 		};
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
index 7f51104..cabe0a4 100644
--- a/arch/powerpc/boot/dts/p1010si.dtsi
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -140,20 +140,18 @@
 			interrupt-parent = <&mpic>;
 		};
 
-		can0@1c000 {
-			compatible = "fsl,flexcan-v1.0";
+		can0: can@1c000 {
+			compatible = "fsl,p1010-flexcan";
 			reg = <0x1c000 0x1000>;
 			interrupts = <48 0x2>;
 			interrupt-parent = <&mpic>;
-			fsl,flexcan-clock-divider = <2>;
 		};
 
-		can1@1d000 {
-			compatible = "fsl,flexcan-v1.0";
+		can1: can@1d000 {
+			compatible = "fsl,p1010-flexcan";
 			reg = <0x1d000 0x1000>;
 			interrupts = <61 0x2>;
 			interrupt-parent = <&mpic>;
-			fsl,flexcan-clock-divider = <2>;
 		};
 
 		L2: l2-cache-controller@20000 {
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v13 4/6] flexcan: Add of_match to platform_device definition.
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	Robin Holt, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

On powerpc, the OpenFirmware devices are not matched without specifying
an of_match array.  Introduce that array as that is used for matching
on the Freescale P1010 processor.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: devicetree-discuss@lists.ozlabs.org
---
 drivers/net/can/flexcan.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 68cbe52..cc1e0a7 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -1027,8 +1027,19 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct of_device_id flexcan_of_match[] = {
+	{
+		.compatible = "fsl,p1010-flexcan",
+	},
+	{},
+};
+
 static struct platform_driver flexcan_driver = {
-	.driver.name = DRV_NAME,
+	.driver = {
+		.name = DRV_NAME,
+		.owner = THIS_MODULE,
+		.of_match_table = flexcan_of_match,
+	},
 	.probe = flexcan_probe,
 	.remove = __devexit_p(flexcan_remove),
 };
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v13 5/6] flexcan: Prefer device tree clock frequency if available.
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: socketcan-core, netdev, devicetree-discuss, U Bhaskar-B22300,
	Robin Holt, Scott Wood, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

If our CAN device's device tree node has a clock-frequency property,
then use that value for the can devices clock frequency.  If not, fall
back to asking the platform/mach code for the clock frequency associated
with the flexcan device.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>,
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: socketcan-core@lists.berlios.de,
Cc: netdev@vger.kernel.org,
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: devicetree-discuss@lists.ozlabs.org
---
 .../devicetree/bindings/net/can/fsl-flexcan.txt    |    2 +
 drivers/net/can/flexcan.c                          |   34 ++++++++++++++-----
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index 8dfb98b..1ad80d5 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -11,6 +11,7 @@ Required properties:
 
 - reg : Offset and length of the register set for this device
 - interrupts : Interrupt tuple for this device
+- clock-frequency : The oscillator frequency driving the flexcan device
 
 Example:
 
@@ -19,4 +20,5 @@ Example:
 		reg = <0x1c000 0x1000>;
 		interrupts = <48 0x2>;
 		interrupt-parent = <&mpic>;
+		clock-frequency = <200000000>; // filled in by bootloader
 	};
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index cc1e0a7..e023379 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -33,6 +33,7 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #define DRV_NAME			"flexcan"
@@ -925,16 +926,29 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	struct net_device *dev;
 	struct flexcan_priv *priv;
 	struct resource *mem;
-	struct clk *clk;
+	struct clk *clk = NULL;
 	void __iomem *base;
 	resource_size_t mem_size;
 	int err, irq;
+	u32 clock_freq = 0;
+
+	if (pdev->dev.of_node) {
+		const u32 *clock_freq_p;
 
-	clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(clk)) {
-		dev_err(&pdev->dev, "no clock defined\n");
-		err = PTR_ERR(clk);
-		goto failed_clock;
+		clock_freq_p = of_get_property(pdev->dev.of_node,
+						"clock-frequency", NULL);
+		if (clock_freq_p)
+			clock_freq = *clock_freq_p;
+	}
+
+	if (!clock_freq) {
+		clk = clk_get(&pdev->dev, NULL);
+		if (IS_ERR(clk)) {
+			dev_err(&pdev->dev, "no clock defined\n");
+			err = PTR_ERR(clk);
+			goto failed_clock;
+		}
+		clock_freq = clk_get_rate(clk);
 	}
 
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -967,7 +981,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
 	dev->flags |= IFF_ECHO; /* we support local echo in hardware */
 
 	priv = netdev_priv(dev);
-	priv->can.clock.freq = clk_get_rate(clk);
+	priv->can.clock.freq = clock_freq;
 	priv->can.bittiming_const = &flexcan_bittiming_const;
 	priv->can.do_set_mode = flexcan_set_mode;
 	priv->can.do_get_berr_counter = flexcan_get_berr_counter;
@@ -1002,7 +1016,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
  failed_map:
 	release_mem_region(mem->start, mem_size);
  failed_get:
-	clk_put(clk);
+	if (clk)
+		clk_put(clk);
  failed_clock:
 	return err;
 }
@@ -1020,7 +1035,8 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(mem->start, resource_size(mem));
 
-	clk_put(priv->clk);
+	if (priv->clk)
+		clk_put(priv->clk);
 
 	free_candev(dev);
 
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v13 0/6] flexcan: Add support for powerpc flexcan (freescale p1010)
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: socketcan-core, netdev, PPC list, Robin Holt

David,

The following set of patches have been reviewed by the above parties and
all comments have been integrated.  Although the patches stray from the
drivers/net/can directory, the diversions are related to changes for
the flexcan driver.

The patch set is based upon your net-next-2.6 tree's commit 6c37e46.

Could you please queue these up for the next appropriate push to Linus'
tree?

Thanks,
Robin Holt

^ permalink raw reply

* [PATCH v13 1/6] flexcan: Remove #include <mach/clock.h>
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

powerpc does not have a mach-####/clock.h.  When testing, I found neither
arm nor powerpc needed the mach/clock.h at all so I removed it.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
---
 drivers/net/can/flexcan.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 1767811..586b2cd 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -35,8 +35,6 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 
-#include <mach/clock.h>
-
 #define DRV_NAME			"flexcan"
 
 /* 8 for RX fifo and 2 error handling */
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v13 2/6] flexcan: Abstract off read/write for big/little endian.
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

Make flexcan driver handle register reads in the appropriate endianess.
This was a basic search and replace and then define some inlines.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de
Cc: netdev@vger.kernel.org
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
---
 drivers/net/can/flexcan.c |  140 ++++++++++++++++++++++++++------------------
 1 files changed, 83 insertions(+), 57 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 586b2cd..68cbe52 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -190,6 +190,31 @@ static struct can_bittiming_const flexcan_bittiming_const = {
 };
 
 /*
+ * Abstract off the read/write for arm versus ppc.
+ */
+#if defined(__BIG_ENDIAN)
+static inline u32 flexcan_read(void __iomem *addr)
+{
+	return in_be32(addr);
+}
+
+static inline void flexcan_write(u32 val, void __iomem *addr)
+{
+	out_be32(addr, val);
+}
+#else
+static inline u32 flexcan_read(void __iomem *addr)
+{
+	return readl(addr);
+}
+
+static inline void flexcan_write(u32 val, void __iomem *addr)
+{
+	writel(val, addr);
+}
+#endif
+
+/*
  * Swtich transceiver on or off
  */
 static void flexcan_transceiver_switch(const struct flexcan_priv *priv, int on)
@@ -210,9 +235,9 @@ static inline void flexcan_chip_enable(struct flexcan_priv *priv)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg &= ~FLEXCAN_MCR_MDIS;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	udelay(10);
 }
@@ -222,9 +247,9 @@ static inline void flexcan_chip_disable(struct flexcan_priv *priv)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_MDIS;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 }
 
 static int flexcan_get_berr_counter(const struct net_device *dev,
@@ -232,7 +257,7 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
 {
 	const struct flexcan_priv *priv = netdev_priv(dev);
 	struct flexcan_regs __iomem *regs = priv->base;
-	u32 reg = readl(&regs->ecr);
+	u32 reg = flexcan_read(&regs->ecr);
 
 	bec->txerr = (reg >> 0) & 0xff;
 	bec->rxerr = (reg >> 8) & 0xff;
@@ -266,15 +291,15 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (cf->can_dlc > 0) {
 		u32 data = be32_to_cpup((__be32 *)&cf->data[0]);
-		writel(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[0]);
+		flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[0]);
 	}
 	if (cf->can_dlc > 3) {
 		u32 data = be32_to_cpup((__be32 *)&cf->data[4]);
-		writel(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
+		flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
 	}
 
-	writel(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
-	writel(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
+	flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
+	flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
 
 	kfree_skb(skb);
 
@@ -462,8 +487,8 @@ static void flexcan_read_fifo(const struct net_device *dev,
 	struct flexcan_mb __iomem *mb = &regs->cantxfg[0];
 	u32 reg_ctrl, reg_id;
 
-	reg_ctrl = readl(&mb->can_ctrl);
-	reg_id = readl(&mb->can_id);
+	reg_ctrl = flexcan_read(&mb->can_ctrl);
+	reg_id = flexcan_read(&mb->can_id);
 	if (reg_ctrl & FLEXCAN_MB_CNT_IDE)
 		cf->can_id = ((reg_id >> 0) & CAN_EFF_MASK) | CAN_EFF_FLAG;
 	else
@@ -473,12 +498,12 @@ static void flexcan_read_fifo(const struct net_device *dev,
 		cf->can_id |= CAN_RTR_FLAG;
 	cf->can_dlc = get_can_dlc((reg_ctrl >> 16) & 0xf);
 
-	*(__be32 *)(cf->data + 0) = cpu_to_be32(readl(&mb->data[0]));
-	*(__be32 *)(cf->data + 4) = cpu_to_be32(readl(&mb->data[1]));
+	*(__be32 *)(cf->data + 0) = cpu_to_be32(flexcan_read(&mb->data[0]));
+	*(__be32 *)(cf->data + 4) = cpu_to_be32(flexcan_read(&mb->data[1]));
 
 	/* mark as read */
-	writel(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
-	readl(&regs->timer);
+	flexcan_write(FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->iflag1);
+	flexcan_read(&regs->timer);
 }
 
 static int flexcan_read_frame(struct net_device *dev)
@@ -514,17 +539,17 @@ static int flexcan_poll(struct napi_struct *napi, int quota)
 	 * The error bits are cleared on read,
 	 * use saved value from irq handler.
 	 */
-	reg_esr = readl(&regs->esr) | priv->reg_esr;
+	reg_esr = flexcan_read(&regs->esr) | priv->reg_esr;
 
 	/* handle state changes */
 	work_done += flexcan_poll_state(dev, reg_esr);
 
 	/* handle RX-FIFO */
-	reg_iflag1 = readl(&regs->iflag1);
+	reg_iflag1 = flexcan_read(&regs->iflag1);
 	while (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_AVAILABLE &&
 	       work_done < quota) {
 		work_done += flexcan_read_frame(dev);
-		reg_iflag1 = readl(&regs->iflag1);
+		reg_iflag1 = flexcan_read(&regs->iflag1);
 	}
 
 	/* report bus errors */
@@ -534,8 +559,8 @@ static int flexcan_poll(struct napi_struct *napi, int quota)
 	if (work_done < quota) {
 		napi_complete(napi);
 		/* enable IRQs */
-		writel(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
-		writel(priv->reg_ctrl_default, &regs->ctrl);
+		flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
+		flexcan_write(priv->reg_ctrl_default, &regs->ctrl);
 	}
 
 	return work_done;
@@ -549,9 +574,9 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg_iflag1, reg_esr;
 
-	reg_iflag1 = readl(&regs->iflag1);
-	reg_esr = readl(&regs->esr);
-	writel(FLEXCAN_ESR_ERR_INT, &regs->esr);	/* ACK err IRQ */
+	reg_iflag1 = flexcan_read(&regs->iflag1);
+	reg_esr = flexcan_read(&regs->esr);
+	flexcan_write(FLEXCAN_ESR_ERR_INT, &regs->esr);	/* ACK err IRQ */
 
 	/*
 	 * schedule NAPI in case of:
@@ -567,16 +592,16 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 		 * save them for later use.
 		 */
 		priv->reg_esr = reg_esr & FLEXCAN_ESR_ERR_BUS;
-		writel(FLEXCAN_IFLAG_DEFAULT & ~FLEXCAN_IFLAG_RX_FIFO_AVAILABLE,
-		       &regs->imask1);
-		writel(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
+		flexcan_write(FLEXCAN_IFLAG_DEFAULT &
+			~FLEXCAN_IFLAG_RX_FIFO_AVAILABLE, &regs->imask1);
+		flexcan_write(priv->reg_ctrl_default & ~FLEXCAN_CTRL_ERR_ALL,
 		       &regs->ctrl);
 		napi_schedule(&priv->napi);
 	}
 
 	/* FIFO overflow */
 	if (reg_iflag1 & FLEXCAN_IFLAG_RX_FIFO_OVERFLOW) {
-		writel(FLEXCAN_IFLAG_RX_FIFO_OVERFLOW, &regs->iflag1);
+		flexcan_write(FLEXCAN_IFLAG_RX_FIFO_OVERFLOW, &regs->iflag1);
 		dev->stats.rx_over_errors++;
 		dev->stats.rx_errors++;
 	}
@@ -585,7 +610,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
 	if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
 		/* tx_bytes is incremented in flexcan_start_xmit */
 		stats->tx_packets++;
-		writel((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
+		flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
 		netif_wake_queue(dev);
 	}
 
@@ -599,7 +624,7 @@ static void flexcan_set_bittiming(struct net_device *dev)
 	struct flexcan_regs __iomem *regs = priv->base;
 	u32 reg;
 
-	reg = readl(&regs->ctrl);
+	reg = flexcan_read(&regs->ctrl);
 	reg &= ~(FLEXCAN_CTRL_PRESDIV(0xff) |
 		 FLEXCAN_CTRL_RJW(0x3) |
 		 FLEXCAN_CTRL_PSEG1(0x7) |
@@ -623,11 +648,11 @@ static void flexcan_set_bittiming(struct net_device *dev)
 		reg |= FLEXCAN_CTRL_SMP;
 
 	dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg);
-	writel(reg, &regs->ctrl);
+	flexcan_write(reg, &regs->ctrl);
 
 	/* print chip status */
 	dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
-		readl(&regs->mcr), readl(&regs->ctrl));
+		flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
 }
 
 /*
@@ -648,10 +673,10 @@ static int flexcan_chip_start(struct net_device *dev)
 	flexcan_chip_enable(priv);
 
 	/* soft reset */
-	writel(FLEXCAN_MCR_SOFTRST, &regs->mcr);
+	flexcan_write(FLEXCAN_MCR_SOFTRST, &regs->mcr);
 	udelay(10);
 
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	if (reg_mcr & FLEXCAN_MCR_SOFTRST) {
 		dev_err(dev->dev.parent,
 			"Failed to softreset can module (mcr=0x%08x)\n",
@@ -673,12 +698,12 @@ static int flexcan_chip_start(struct net_device *dev)
 	 * choose format C
 	 *
 	 */
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
 		FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
 		FLEXCAN_MCR_IDAM_C;
 	dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
-	writel(reg_mcr, &regs->mcr);
+	flexcan_write(reg_mcr, &regs->mcr);
 
 	/*
 	 * CTRL
@@ -696,7 +721,7 @@ static int flexcan_chip_start(struct net_device *dev)
 	 * (FLEXCAN_CTRL_ERR_MSK), too. Otherwise we don't get any
 	 * warning or bus passive interrupts.
 	 */
-	reg_ctrl = readl(&regs->ctrl);
+	reg_ctrl = flexcan_read(&regs->ctrl);
 	reg_ctrl &= ~FLEXCAN_CTRL_TSYN;
 	reg_ctrl |= FLEXCAN_CTRL_BOFF_REC | FLEXCAN_CTRL_LBUF |
 		FLEXCAN_CTRL_ERR_STATE | FLEXCAN_CTRL_ERR_MSK;
@@ -704,38 +729,39 @@ static int flexcan_chip_start(struct net_device *dev)
 	/* save for later use */
 	priv->reg_ctrl_default = reg_ctrl;
 	dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
-	writel(reg_ctrl, &regs->ctrl);
+	flexcan_write(reg_ctrl, &regs->ctrl);
 
 	for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
-		writel(0, &regs->cantxfg[i].can_ctrl);
-		writel(0, &regs->cantxfg[i].can_id);
-		writel(0, &regs->cantxfg[i].data[0]);
-		writel(0, &regs->cantxfg[i].data[1]);
+		flexcan_write(0, &regs->cantxfg[i].can_ctrl);
+		flexcan_write(0, &regs->cantxfg[i].can_id);
+		flexcan_write(0, &regs->cantxfg[i].data[0]);
+		flexcan_write(0, &regs->cantxfg[i].data[1]);
 
 		/* put MB into rx queue */
-		writel(FLEXCAN_MB_CNT_CODE(0x4), &regs->cantxfg[i].can_ctrl);
+		flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
+			&regs->cantxfg[i].can_ctrl);
 	}
 
 	/* acceptance mask/acceptance code (accept everything) */
-	writel(0x0, &regs->rxgmask);
-	writel(0x0, &regs->rx14mask);
-	writel(0x0, &regs->rx15mask);
+	flexcan_write(0x0, &regs->rxgmask);
+	flexcan_write(0x0, &regs->rx14mask);
+	flexcan_write(0x0, &regs->rx15mask);
 
 	flexcan_transceiver_switch(priv, 1);
 
 	/* synchronize with the can bus */
-	reg_mcr = readl(&regs->mcr);
+	reg_mcr = flexcan_read(&regs->mcr);
 	reg_mcr &= ~FLEXCAN_MCR_HALT;
-	writel(reg_mcr, &regs->mcr);
+	flexcan_write(reg_mcr, &regs->mcr);
 
 	priv->can.state = CAN_STATE_ERROR_ACTIVE;
 
 	/* enable FIFO interrupts */
-	writel(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
+	flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
 
 	/* print chip status */
 	dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n",
-		__func__, readl(&regs->mcr), readl(&regs->ctrl));
+		__func__, flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
 
 	return 0;
 
@@ -757,12 +783,12 @@ static void flexcan_chip_stop(struct net_device *dev)
 	u32 reg;
 
 	/* Disable all interrupts */
-	writel(0, &regs->imask1);
+	flexcan_write(0, &regs->imask1);
 
 	/* Disable + halt module */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_MDIS | FLEXCAN_MCR_HALT;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	flexcan_transceiver_switch(priv, 0);
 	priv->can.state = CAN_STATE_STOPPED;
@@ -854,24 +880,24 @@ static int __devinit register_flexcandev(struct net_device *dev)
 
 	/* select "bus clock", chip must be disabled */
 	flexcan_chip_disable(priv);
-	reg = readl(&regs->ctrl);
+	reg = flexcan_read(&regs->ctrl);
 	reg |= FLEXCAN_CTRL_CLK_SRC;
-	writel(reg, &regs->ctrl);
+	flexcan_write(reg, &regs->ctrl);
 
 	flexcan_chip_enable(priv);
 
 	/* set freeze, halt and activate FIFO, restrict register access */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT |
 		FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV;
-	writel(reg, &regs->mcr);
+	flexcan_write(reg, &regs->mcr);
 
 	/*
 	 * Currently we only support newer versions of this core
 	 * featuring a RX FIFO. Older cores found on some Coldfire
 	 * derivates are not yet supported.
 	 */
-	reg = readl(&regs->mcr);
+	reg = flexcan_read(&regs->mcr);
 	if (!(reg & FLEXCAN_MCR_FEN)) {
 		dev_err(dev->dev.parent,
 			"Could not enable RX FIFO, unsupported core\n");
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH v13 6/6] flexcan: Add flexcan device support for p1010rdb.
From: Robin Holt @ 2011-08-17  3:32 UTC (permalink / raw)
  To: Robin Holt, David S. Miller, Kumar Gala, Wolfgang Grandegger,
	Marc Kleine-Budde, U Bhaskar-B22300
  Cc: netdev, U Bhaskar-B22300, socketcan-core, Robin Holt, PPC list
In-Reply-To: <1313551944-28603-1-git-send-email-holt@sgi.com>

Allow the p1010 processor to select the flexcan network driver.

Signed-off-by: Robin Holt <holt@sgi.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>,
Acked-by: Wolfgang Grandegger <wg@grandegger.com>,
Cc: U Bhaskar-B22300 <B22300@freescale.com>
Cc: socketcan-core@lists.berlios.de,
Cc: netdev@vger.kernel.org,
Cc: PPC list <linuxppc-dev@lists.ozlabs.org>
Cc: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/Kconfig |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6926b61..47682b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -656,6 +656,8 @@ config SBUS
 
 config FSL_SOC
 	bool
+	select HAVE_CAN_FLEXCAN if NET && CAN
+	select PPC_CLOCK if CAN_FLEXCAN
 
 config FSL_PCI
  	bool
-- 
1.7.2.1

^ permalink raw reply related

* [PATCH] tags, powerpc: Update tags.sh to support _GLOBAL symbols
From: Ian Munsie @ 2011-08-17  6:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, linuxppc-dev, Michal Marek
  Cc: Ian Munsie, linux-kbuild

From: Ian Munsie <imunsie@au1.ibm.com>

On PowerPC we use _GLOBAL throughout the assembly to define symbols, but
currently these symbols are missing from the tags generated with
ARCH=powerpc make tags. This patch modifies the tags.sh script to
recognise _GLOBAL(.*) so that these symbols will be in the tags.

This is almost (but not quite) PowerPC specific and this change should
not affect anyone else:

$ git grep -E '^_GLOBAL\(([^)]*)\).*' |sed 's/^\([^/]*\/[^/]*\)\/.*$/\1/'|uniq -c
    627 arch/powerpc
      2 arch/um

Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
---
 scripts/tags.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index 75c5d24f1..38f6617 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -129,7 +129,7 @@ exuberant()
 	-I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL                      \
 	-I DEFINE_TRACE,EXPORT_TRACEPOINT_SYMBOL,EXPORT_TRACEPOINT_SYMBOL_GPL \
 	--extra=+f --c-kinds=+px                                \
-	--regex-asm='/^ENTRY\(([^)]*)\).*/\1/'                  \
+	--regex-asm='/^(ENTRY|_GLOBAL)\(([^)]*)\).*/\2/'        \
 	--regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \
 	--regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/'		\
 	--regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/'
@@ -151,7 +151,7 @@ exuberant()
 emacs()
 {
 	all_sources | xargs $1 -a                               \
-	--regex='/^ENTRY(\([^)]*\)).*/\1/'                      \
+	--regex='/^(ENTRY|_GLOBAL)(\([^)]*\)).*/\2/'            \
 	--regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'   \
 	--regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/'		\
 	--regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/'
-- 
1.7.2.5

^ permalink raw reply related

* [PATCH] powerpc/mm: fix the call trace when resumed from hibernation
From: b29983 @ 2011-08-17  5:51 UTC (permalink / raw)
  To: benh; +Cc: Tang Yuantian, linuxppc-dev

From: Tang Yuantian <B29983@freescale.com>

	In SMP mode, the kernel would produce call trace when resumed
	from hibernation. The reason is when the function destroy_context
	is called to drop the resuming mm context, the mm->context.active
	is 1 which is wrong and should be zero.
	We pass the current->active_mm as previous mm context to function
	switch_mmu_context to decrease the context.active by 1.

	In UP mode, there is no effect.

Signed-off-by: Tang Yuantian <b29983@freescale.com>
---
 arch/powerpc/kernel/swsusp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/swsusp.c b/arch/powerpc/kernel/swsusp.c
index 560c961..7cc81f0 100644
--- a/arch/powerpc/kernel/swsusp.c
+++ b/arch/powerpc/kernel/swsusp.c
@@ -34,6 +34,6 @@ void save_processor_state(void)
 void restore_processor_state(void)
 {
 #ifdef CONFIG_PPC32
-	switch_mmu_context(NULL, current->active_mm);
+	switch_mmu_context(current->active_mm, current->active_mm);
 #endif
 }
-- 
1.6.4

^ permalink raw reply related


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