* Re: [PATCH 1/3] mpc83xx: fix usb phy_type in mpc837x rdb device trees
From: Kim Phillips @ 2008-03-28 19:46 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <163986FE-1FE0-4FAB-AACA-6E2605CF4094@kernel.crashing.org>
On Fri, 28 Mar 2008 14:37:51 -0500
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Mar 28, 2008, at 11:44 AM, Anton Vorontsov wrote:
> > On Fri, Mar 28, 2008 at 10:51:25AM -0500, Kim Phillips wrote:
> >> the mpc837x rdb board uses low pin count interfaces (ULPI) to connect
> >> to the USB PHY.
> >
> > I've sent this fix two weeks ago...
> >
> > http://ozlabs.org/pipermail/linuxppc-dev/2008-March/052926.html
> >
> >> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
>
> I'll apply Anton's version and add a signed-off-by Kim.
agreed, thanks!
Kim
^ permalink raw reply
* Re: [PATCH 1/3] mpc83xx: fix usb phy_type in mpc837x rdb device trees
From: Kumar Gala @ 2008-03-28 19:37 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev
In-Reply-To: <20080328164441.GA7146@localhost.localdomain>
On Mar 28, 2008, at 11:44 AM, Anton Vorontsov wrote:
> On Fri, Mar 28, 2008 at 10:51:25AM -0500, Kim Phillips wrote:
>> the mpc837x rdb board uses low pin count interfaces (ULPI) to connect
>> to the USB PHY.
>
> I've sent this fix two weeks ago...
>
> http://ozlabs.org/pipermail/linuxppc-dev/2008-March/052926.html
>
>> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
I'll apply Anton's version and add a signed-off-by Kim.
- k
^ permalink raw reply
* Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
From: Scott Wood @ 2008-03-28 19:15 UTC (permalink / raw)
To: avorontsov; +Cc: linuxppc-dev, linux-mtd
In-Reply-To: <20080328191054.GA30765@localhost.localdomain>
Anton Vorontsov wrote:
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
> Subject: mtd/nand/fsl_elbc_nand: workaround for hangs during nand write
>
> Using current driver elbc sometimes hangs during nand write. Reading back
> last byte helps though (thanks to Scott Wood for the idea).
>
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-by: Scott Wood <scottwood@freescale.com>
-Scott
^ permalink raw reply
* [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs during nand write [was: Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X]
From: Anton Vorontsov @ 2008-03-28 19:10 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, linux-mtd
In-Reply-To: <47ED3EC5.8030508@freescale.com>
On Fri, Mar 28, 2008 at 01:53:57PM -0500, Scott Wood wrote:
> Anton Vorontsov wrote:
> >@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd,
> >const u8 *buf, int len)
> > }
> >
> > memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
> >+#ifdef CONFIG_PPC_MPC837x
> >+ /*
> >+ * This is workaround for the weird elbc hangs on the MPC837X CPUs,
> >+ * Scott Wood says: "...perhaps difference in how long it takes a
> >+ * write to make it through the localbus compared to a write to IMMR
> >+ * is causing problems, and sync isn't helping for some reason."
> >+ * Reading back the last byte helps though.
> >+ */
> >+ in_8(&ctrl->addr[ctrl->index] + len - 1);
> >+#endif
>
> Let's do it regardless of chip -- odds are the issue exists on all
> implementations, and it's just a function of what frequencies things are
> running at.
Ok.
- - - -
From: Anton Vorontsov <avorontsov@ru.mvista.com>
Subject: mtd/nand/fsl_elbc_nand: workaround for hangs during nand write
Using current driver elbc sometimes hangs during nand write. Reading back
last byte helps though (thanks to Scott Wood for the idea).
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/mtd/nand/fsl_elbc_nand.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 378b7aa..2f4ce2a 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -480,7 +480,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
struct fsl_elbc_ctrl *ctrl = priv->ctrl;
unsigned int bufsize = mtd->writesize + mtd->oobsize;
- if (len < 0) {
+ if (len <= 0) {
dev_err(ctrl->dev, "write_buf of %d bytes", len);
ctrl->status = 0;
return;
@@ -495,6 +495,15 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
}
memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
+ /*
+ * This is workaround for the weird elbc hangs during nand write,
+ * Scott Wood says: "...perhaps difference in how long it takes a
+ * write to make it through the localbus compared to a write to IMMR
+ * is causing problems, and sync isn't helping for some reason."
+ * Reading back the last byte helps though.
+ */
+ in_8(&ctrl->addr[ctrl->index] + len - 1);
+
ctrl->index += len;
}
--
1.5.2.2
^ permalink raw reply related
* Re: [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
From: Scott Wood @ 2008-03-28 18:53 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, linux-mtd
In-Reply-To: <20080328184303.GA25882@localhost.localdomain>
Anton Vorontsov wrote:
> @@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
> }
>
> memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
> +#ifdef CONFIG_PPC_MPC837x
> + /*
> + * This is workaround for the weird elbc hangs on the MPC837X CPUs,
> + * Scott Wood says: "...perhaps difference in how long it takes a
> + * write to make it through the localbus compared to a write to IMMR
> + * is causing problems, and sync isn't helping for some reason."
> + * Reading back the last byte helps though.
> + */
> + in_8(&ctrl->addr[ctrl->index] + len - 1);
> +#endif
Let's do it regardless of chip -- odds are the issue exists on all
implementations, and it's just a function of what frequencies things are
running at.
-Scott
^ permalink raw reply
* [PATCH] mtd/nand/fsl_elbc_nand: workaround for hangs on MPC837X
From: Anton Vorontsov @ 2008-03-28 18:43 UTC (permalink / raw)
To: linux-mtd, linuxppc-dev; +Cc: Scott Wood
Using current driver on the MPC837X CPUs elbc hangs during nand write.
Reading last byte helps though (thanks to Scott Wood for the idea).
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/mtd/nand/fsl_elbc_nand.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 378b7aa..be4c05d 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -480,7 +480,7 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
struct fsl_elbc_ctrl *ctrl = priv->ctrl;
unsigned int bufsize = mtd->writesize + mtd->oobsize;
- if (len < 0) {
+ if (len <= 0) {
dev_err(ctrl->dev, "write_buf of %d bytes", len);
ctrl->status = 0;
return;
@@ -495,6 +495,16 @@ static void fsl_elbc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
}
memcpy_toio(&ctrl->addr[ctrl->index], buf, len);
+#ifdef CONFIG_PPC_MPC837x
+ /*
+ * This is workaround for the weird elbc hangs on the MPC837X CPUs,
+ * Scott Wood says: "...perhaps difference in how long it takes a
+ * write to make it through the localbus compared to a write to IMMR
+ * is causing problems, and sync isn't helping for some reason."
+ * Reading back the last byte helps though.
+ */
+ in_8(&ctrl->addr[ctrl->index] + len - 1);
+#endif
ctrl->index += len;
}
--
1.5.2.2
^ permalink raw reply related
* [PATCH] [POWERPC] Move phys_addr_t definition into asm/types.h
From: Kumar Gala @ 2008-03-28 18:38 UTC (permalink / raw)
To: linuxppc-dev
Moved phys_addr_t out of mmu-*.h and into asm/types.h so we can use it in
places that before would have caused recursive includes.
For example to use phys_addr_t in <asm/page.h> we would have included
<asm/mmu.h> which would have possibly included <asm/mmu-hash64.h> which
includes <asm/page.h>. Wheeee recursive include.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
include/asm-powerpc/mmu-40x.h | 2 --
include/asm-powerpc/mmu-44x.h | 2 --
include/asm-powerpc/mmu-8xx.h | 2 --
include/asm-powerpc/mmu-fsl-booke.h | 6 ------
include/asm-powerpc/mmu-hash32.h | 2 --
include/asm-powerpc/mmu-hash64.h | 3 ---
include/asm-powerpc/types.h | 7 +++++++
7 files changed, 7 insertions(+), 17 deletions(-)
diff --git a/include/asm-powerpc/mmu-40x.h b/include/asm-powerpc/mmu-40x.h
index 7d37f77..3d10867 100644
--- a/include/asm-powerpc/mmu-40x.h
+++ b/include/asm-powerpc/mmu-40x.h
@@ -53,8 +53,6 @@
#ifndef __ASSEMBLY__
-typedef unsigned long phys_addr_t;
-
typedef struct {
unsigned long id;
unsigned long vdso_base;
diff --git a/include/asm-powerpc/mmu-44x.h b/include/asm-powerpc/mmu-44x.h
index 62772ae..c8b02d9 100644
--- a/include/asm-powerpc/mmu-44x.h
+++ b/include/asm-powerpc/mmu-44x.h
@@ -53,8 +53,6 @@
#ifndef __ASSEMBLY__
-typedef unsigned long long phys_addr_t;
-
typedef struct {
unsigned long id;
unsigned long vdso_base;
diff --git a/include/asm-powerpc/mmu-8xx.h b/include/asm-powerpc/mmu-8xx.h
index 952bd88..9db877e 100644
--- a/include/asm-powerpc/mmu-8xx.h
+++ b/include/asm-powerpc/mmu-8xx.h
@@ -136,8 +136,6 @@
#define SPRN_M_TW 799
#ifndef __ASSEMBLY__
-typedef unsigned long phys_addr_t;
-
typedef struct {
unsigned long id;
unsigned long vdso_base;
diff --git a/include/asm-powerpc/mmu-fsl-booke.h b/include/asm-powerpc/mmu-fsl-booke.h
index 3758000..925d93c 100644
--- a/include/asm-powerpc/mmu-fsl-booke.h
+++ b/include/asm-powerpc/mmu-fsl-booke.h
@@ -73,12 +73,6 @@
#ifndef __ASSEMBLY__
-#ifndef CONFIG_PHYS_64BIT
-typedef unsigned long phys_addr_t;
-#else
-typedef unsigned long long phys_addr_t;
-#endif
-
typedef struct {
unsigned long id;
unsigned long vdso_base;
diff --git a/include/asm-powerpc/mmu-hash32.h b/include/asm-powerpc/mmu-hash32.h
index 4bd735b..6e21ca6 100644
--- a/include/asm-powerpc/mmu-hash32.h
+++ b/include/asm-powerpc/mmu-hash32.h
@@ -84,8 +84,6 @@ typedef struct {
unsigned long vdso_base;
} mm_context_t;
-typedef unsigned long phys_addr_t;
-
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_POWERPC_MMU_HASH32_H_ */
diff --git a/include/asm-powerpc/mmu-hash64.h b/include/asm-powerpc/mmu-hash64.h
index 2864fa3..0dff767 100644
--- a/include/asm-powerpc/mmu-hash64.h
+++ b/include/asm-powerpc/mmu-hash64.h
@@ -469,9 +469,6 @@ static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
VSID_MODULUS_256M)
#define KERNEL_VSID(ea) VSID_SCRAMBLE(GET_ESID(ea))
-/* Physical address used by some IO functions */
-typedef unsigned long phys_addr_t;
-
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_MMU_HASH64_H_ */
diff --git a/include/asm-powerpc/types.h b/include/asm-powerpc/types.h
index 903fd19..020db52 100644
--- a/include/asm-powerpc/types.h
+++ b/include/asm-powerpc/types.h
@@ -50,6 +50,13 @@ typedef struct {
__u32 u[4];
} __attribute__((aligned(16))) __vector128;
+/* Physical address used by some IO functions */
+#ifndef CONFIG_PHYS_64BIT
+typedef unsigned long phys_addr_t;
+#else
+typedef unsigned long long phys_addr_t;
+#endif
+
#endif /* __ASSEMBLY__ */
#ifdef __KERNEL__
--
1.5.4.1
^ permalink raw reply related
* Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
From: York Sun @ 2008-03-28 18:18 UTC (permalink / raw)
To: avorontsov
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev,
Scott Wood, akpm, Timur Tabi
In-Reply-To: <20080328174853.GA1438@localhost.localdomain>
On Fri, 2008-03-28 at 20:48 +0300, Anton Vorontsov wrote:
> > >+ if (copy_from_user(&pix_fmt, (void __user *)arg,
> > >+ sizeof(pix_fmt)))
> >
> > OK, you fixed the cast here...
>
> Maybe better would be to define "buf" at the top of this function as
> void __user *buf = (void __user *)arg;, i.e. just once?
I think it is a good idea.
>
> >
> > >+ return -EFAULT;
> > >+ ad->pix_fmt = pix_fmt;
> > >+ pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt);
> > >+ break;
> > >+ case MFB_GET_PIXFMT:
> > >+ if (!arg)
> > >+ return -EINVAL;
>
> This if (!arg) appears to be everywhere except default: label, maybe
> this could be placed on top too?
Will do that, too.
York
^ permalink raw reply
* Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
From: Scott Wood @ 2008-03-28 18:09 UTC (permalink / raw)
To: Timur Tabi
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev, akpm,
York Sun
In-Reply-To: <47ED33C6.3090202@freescale.com>
Timur Tabi wrote:
> Scott Wood wrote:
>
>> ...but not anywhere else. All user pointers should have a __user
>> annotation.
>
> Even in a typecast?
Yes. Otherwise, as far as sparse sees, you're passing a kernel pointer
to something expecting a user pointer.
-Scott
^ permalink raw reply
* Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
From: Timur Tabi @ 2008-03-28 18:07 UTC (permalink / raw)
To: Scott Wood
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev, akpm,
York Sun
In-Reply-To: <47ED2B35.4030601@freescale.com>
Scott Wood wrote:
> ...but not anywhere else. All user pointers should have a __user
> annotation.
Even in a typecast?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in the device tree.
From: Scott Wood @ 2008-03-28 18:07 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linuxppc-dev
In-Reply-To: <200803281854.28595.laurentp@cse-semaphore.com>
Laurent Pinchart wrote:
> On Friday 28 March 2008 18:11, Scott Wood wrote:
>> Laurent Pinchart wrote:
>>> Locating the end of the muram isn't as straightforward as it
>>> could be. As the current code already uses the beginning of the
>>> muram to store the BDs and data buffers, should I really bother
>>> locating the end or can I store the SMC parameter ram at the
>>> beginning as well ?
>> Maybe, but the end would be safer. What's the problem with finding
>> the end?
>
> That requires manual parsing of all the cells in the reg property.
> The device-tree API doesn't provide a way to get the length of a
> property,
Sure it does. Do a getprop with an insufficiently large buffer, and it
tells you how much you really need. :-)
> so I'll have to use a big enough pre-allocated buffer. I'm also not
> sure if resources are guaranteed to be sorted in increasing order.
Ah, good point.
> This doesn't make finding the end of the muram really difficult. I
> was just wondering if the increased code complexity was worth it,
> especially seeing how the cpm_serial code in the boot wrapper seem
> quite unstable.
Unstable in what way?
> I'm not familiar with the boot wrapper code so I'm sometimes not very
> confident in my assumptions, but isn't the handling of the
> virtual-reg property in cpm_console_init broken ?
Not as far as I can see.
> If I'm not mistaken, getprop will return the address and size of the
> first resource and not the addresses of the first two resources.
No, it'll get as much of the virtual-reg property as will fit in the
buffer. There's no size in virtual-reg.
> What is virtual-reg used for ? To report the virtual address without
> requiring a device tree walk ? Does it provide any information that
> dt_xlate_reg can't find ?
Yes, it tells you the virtual address when it's not an identity mapping.
It's not currently used on CPM platforms, but might be used down the
road with a QE device on 85xx.
>> Even the end of the first reg resource would be OK.
>
> If I use the end of the first resource, can I assume it spans 0x0000
> - 0x8000 to set the default tx BD address in Kconfig ?
No, especially seeing as it doesn't on any existing boards. :-)
You could set the default to just before 0x2000 with board-specific
exceptions, though.
-Scott
^ permalink raw reply
* Re: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in the device tree.
From: Laurent Pinchart @ 2008-03-28 17:54 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <47ED26BE.2080507@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]
On Friday 28 March 2008 18:11, Scott Wood wrote:
> Laurent Pinchart wrote:
> > Locating the end of the muram isn't as straightforward as it could be. As
> > the current code already uses the beginning of the muram to store the BDs
> > and data buffers, should I really bother locating the end or can I store
> > the SMC parameter ram at the beginning as well ?
>
> Maybe, but the end would be safer. What's the problem with finding the
> end?
That requires manual parsing of all the cells in the reg property. The
device-tree API doesn't provide a way to get the length of a property, so
I'll have to use a big enough pre-allocated buffer. I'm also not sure if
resources are guaranteed to be sorted in increasing order.
This doesn't make finding the end of the muram really difficult. I was just
wondering if the increased code complexity was worth it, especially seeing
how the cpm_serial code in the boot wrapper seem quite unstable.
I'm not familiar with the boot wrapper code so I'm sometimes not very
confident in my assumptions, but isn't the handling of the virtual-reg
property in cpm_console_init broken ?
void *reg_virt[2];
...
n = getprop(devp, "virtual-reg", reg_virt, sizeof(reg_virt));
if (n < (int)sizeof(reg_virt)) {
for (n = 0; n < 2; n++) {
if (!dt_xlate_reg(devp, n, ®_phys, NULL))
return -1;
reg_virt[n] = (void *)reg_phys;
}
}
if (is_smc)
smc = reg_virt[0];
else
scc = reg_virt[0];
param = reg_virt[1];
If I'm not mistaken, getprop will return the address and size of the first
resource and not the addresses of the first two resources. What is
virtual-reg used for ? To report the virtual address without requiring a
device tree walk ? Does it provide any information that dt_xlate_reg can't
find ?
> Even the end of the first reg resource would be OK.
If I use the end of the first resource, can I assume it spans 0x0000 - 0x8000
to set the default tx BD address in Kconfig ?
> > If I'm not mistaken, once the SMC parameter ram gets relocated to the
> > beginning/end of the muram, the boot loader preallocated space can be
> > reclaimed and can be added to the muram in the device tree like I did in
> > my previous patch. Is that correct ?
>
> Yes.
--
Laurent Pinchart
CSE Semaphore Belgium
Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium
T +32 (2) 387 42 59
F +32 (2) 387 42 75
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
From: Anton Vorontsov @ 2008-03-28 17:48 UTC (permalink / raw)
To: Scott Wood
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, Timur Tabi,
linuxppc-dev, akpm, York Sun
In-Reply-To: <47ED2B35.4030601@freescale.com>
On Fri, Mar 28, 2008 at 12:30:29PM -0500, Scott Wood wrote:
> York Sun wrote:
> >+static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
> >+ unsigned long arg)
> >+{
> >+ struct mfb_info *mfbi = info->par;
> >+ struct diu_ad *ad = mfbi->ad;
> >+ struct mfb_chroma_key ck;
> >+ unsigned char global_alpha;
> >+ struct aoi_display_offset aoi_d;
> >+ __u32 pix_fmt;
> >+
> >+ switch (cmd) {
> >+ case MFB_SET_PIXFMT:
> >+ if (!arg)
> >+ return -EINVAL;
> >+ if (copy_from_user(&pix_fmt, (void __user *)arg,
> >+ sizeof(pix_fmt)))
>
> OK, you fixed the cast here...
Maybe better would be to define "buf" at the top of this function as
void __user *buf = (void __user *)arg;, i.e. just once?
>
> >+ return -EFAULT;
> >+ ad->pix_fmt = pix_fmt;
> >+ pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt);
> >+ break;
> >+ case MFB_GET_PIXFMT:
> >+ if (!arg)
> >+ return -EINVAL;
This if (!arg) appears to be everywhere except default: label, maybe
this could be placed on top too?
> >+ pix_fmt = ad->pix_fmt;
> >+ if (copy_to_user((void *)arg, &pix_fmt, sizeof(pix_fmt)))
> >+ return -EFAULT;
> >+ pr_debug("get pixel format 0x%08x\n", ad->pix_fmt);
> >+ break;
> >+ case MFB_SET_AOID:
> >+ if (!arg)
> >+ return -EINVAL;
> >+ if (copy_from_user(&aoi_d, (void *)arg, sizeof(aoi_d)))
> >+ return -EFAULT;
>
> ...but not anywhere else. All user pointers should have a __user
> annotation.
--
Anton Vorontsov
email: cboumailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [PATCH 1/2 v4] Driver for Freescale 8610 and 5121 DIU
From: Scott Wood @ 2008-03-28 17:30 UTC (permalink / raw)
To: York Sun
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev, akpm,
Timur Tabi
In-Reply-To: <12066720572314-git-send-email-yorksun@freescale.com>
York Sun wrote:
> +static int fsl_diu_ioctl(struct fb_info *info, unsigned int cmd,
> + unsigned long arg)
> +{
> + struct mfb_info *mfbi = info->par;
> + struct diu_ad *ad = mfbi->ad;
> + struct mfb_chroma_key ck;
> + unsigned char global_alpha;
> + struct aoi_display_offset aoi_d;
> + __u32 pix_fmt;
> +
> + switch (cmd) {
> + case MFB_SET_PIXFMT:
> + if (!arg)
> + return -EINVAL;
> + if (copy_from_user(&pix_fmt, (void __user *)arg,
> + sizeof(pix_fmt)))
OK, you fixed the cast here...
> + return -EFAULT;
> + ad->pix_fmt = pix_fmt;
> + pr_debug("Set pixel format to 0x%08x\n", ad->pix_fmt);
> + break;
> + case MFB_GET_PIXFMT:
> + if (!arg)
> + return -EINVAL;
> + pix_fmt = ad->pix_fmt;
> + if (copy_to_user((void *)arg, &pix_fmt, sizeof(pix_fmt)))
> + return -EFAULT;
> + pr_debug("get pixel format 0x%08x\n", ad->pix_fmt);
> + break;
> + case MFB_SET_AOID:
> + if (!arg)
> + return -EINVAL;
> + if (copy_from_user(&aoi_d, (void *)arg, sizeof(aoi_d)))
> + return -EFAULT;
...but not anywhere else. All user pointers should have a __user
annotation.
> + default:
> + printk(KERN_ERR "Unknown ioctl command (0x%08X)\n", cmd);
> + return 0;
return -ENOIOCTLCMD;
> + /* Read to clear the status */
> + status = in_be32(&(hw->int_status));
> +
> + ret = request_irq(irq, fsl_diu_isr, 0, "diu", 0);
> + if (ret)
> + pr_info("Request diu IRQ failed.\n");
> + else {
> + ints = INT_PARERR | INT_LS_BF_VS;
> +#if !defined(CONFIG_NOT_COHERENT_CACHE)
> + ints |= INT_VSYNC;
> +#endif
> + if (dr.mode == MFB_MODE2 || dr.mode == MFB_MODE3)
> + ints |= INT_VSYNC_WB;
> +
> + /* Read to clear the status */
> + status = in_be32(&(hw->int_status));
> + out_be32(&(hw->int_mask), ints);
These parentheses are unnecessary; just do &hw->int_mask, etc.
-Scott
^ permalink raw reply
* Re: [PATCH 2/2 v4] Add DIU platform code for MPC8610HPCD
From: Scott Wood @ 2008-03-28 17:19 UTC (permalink / raw)
To: York Sun
Cc: linux-fbdev-devel, a.p.zijlstra, linux-kernel, linuxppc-dev, akpm,
Timur Tabi
In-Reply-To: <1206672058321-git-send-email-yorksun@freescale.com>
York Sun wrote:
> + np = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis");
> + if (np) {
> + of_address_to_resource(np, 0, &r);
> + of_node_put(np);
> + pixis_bdcfg0 = ioremap(r.start + 0x00000008, sizeof(u8));
> + if (!pixis_bdcfg0) {
> + printk(KERN_ERR "Err: can't map FPGA cfg register!\n");
> + return;
> + }
> + pixis_arch = ioremap(r.start + 0x00000001, sizeof(u8));
> + if (!pixis_arch) {
> + printk(KERN_ERR "Err: can't map FPGA arch register!\n");
> + return;
> + }
Just of_iomap() the whole resource, rather than doing it a byte at a time.
> +int __init preallocate_diu_videomemory(void)
> +{
> + pr_debug("diu_size=%lu\n", diu_ops.diu_size);
> +
> + diu_ops.diu_mem = __alloc_bootmem(diu_ops.diu_size, 8, 0);
> + if (!diu_ops.diu_mem) {
> + printk(KERN_ERR "fsl-diu: cannot allocate %lu bytes\n",
> + diu_ops.diu_size);
> + return -ENOMEM;
> + }
> +
> + printk(KERN_INFO "%s: diu_mem=%p\n", __func__, diu_ops.diu_mem);
The pr_debug line is more useful information than the KERN_INFO line...
-Scott
^ permalink raw reply
* Re: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in the device tree.
From: Scott Wood @ 2008-03-28 17:11 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linuxppc-dev
In-Reply-To: <200803281726.47566.laurentp@cse-semaphore.com>
Laurent Pinchart wrote:
> Locating the end of the muram isn't as straightforward as it could be. As the
> current code already uses the beginning of the muram to store the BDs and
> data buffers, should I really bother locating the end or can I store the SMC
> parameter ram at the beginning as well ?
Maybe, but the end would be safer. What's the problem with finding the
end? Even the end of the first reg resource would be OK.
> If I'm not mistaken, once the SMC parameter ram gets relocated to the
> beginning/end of the muram, the boot loader preallocated space can be
> reclaimed and can be added to the muram in the device tree like I did in my
> previous patch. Is that correct ?
Yes.
-Scott
^ permalink raw reply
* video driver problems on set top box board
From: BAK @ 2008-03-28 17:01 UTC (permalink / raw)
To: linuxppc-embedded
I am using a set top box board : MB442 based on STi7109 chip. I use STAPI
(drivers provided by ST) with STlinux kernell. I have some problems with a
module (named mme_host) which must be inserted with arguments (insmod
mme_host.ko transport0=<arguments_to_be_used>). This operation causes the
following error :
insmod: error inserting '/home/bakhaled/modules/mme/mme_host.ko': -1
Operation not permitted
I tried to insert the module without arguments (insmod mme_host.ko) and
this was successful. But when I try to run a test program for video ,
after inserting that mme module without arguments, the system crash down.
(don't execute console commands).
Has any one experienced this type of problems?
Have you any solutions ?
--
View this message in context: http://www.nabble.com/video-driver-problems-on-set-top-box-board-tp16354810p16354810.html
Sent from the linuxppc-embedded mailing list archive at Nabble.com.
^ permalink raw reply
* [patch] PS3: Split device setup for static vs. dynamic devices
From: Geoff Levand @ 2008-03-28 16:53 UTC (permalink / raw)
To: paulus; +Cc: Geert Uytterhoeven, linuxppc-dev
In-Reply-To: <47EAEC2B.1000006@am.sony.com>
From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Split the device setup code in ps3_register_repository_device() in two
routines:
1. ps3_setup_static_device(), to handle the setup of static devices in the
PS3 repository, which can be __init,
2. ps3_setup_dynamic_device(), to handle the setup of storage devices that
may appear later in the PS3 repository.
This fixes a few section mismatch warnings.
Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
Hi Paul,
Here is another one for 2.6.26 that Geert just sent me. Please apply.
-Geoff
arch/powerpc/platforms/ps3/device-init.c | 78 ++++++++++++++++++-------------
1 file changed, 46 insertions(+), 32 deletions(-)
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -499,41 +499,14 @@ static int __init ps3_register_graphics_
}
/**
- * ps3_register_repository_device - Register a device from the repositiory info.
- *
+ * ps3_setup_dynamic_device - Setup a dynamic device from the repository
*/
-static int ps3_register_repository_device(
- const struct ps3_repository_device *repo)
+static int ps3_setup_dynamic_device(const struct ps3_repository_device *repo)
{
int result;
switch (repo->dev_type) {
- case PS3_DEV_TYPE_SB_GELIC:
- result = ps3_setup_gelic_device(repo);
- if (result) {
- pr_debug("%s:%d ps3_setup_gelic_device failed\n",
- __func__, __LINE__);
- }
- break;
- case PS3_DEV_TYPE_SB_USB:
-
- /* Each USB device has both an EHCI and an OHCI HC */
-
- result = ps3_setup_ehci_device(repo);
-
- if (result) {
- pr_debug("%s:%d ps3_setup_ehci_device failed\n",
- __func__, __LINE__);
- }
-
- result = ps3_setup_ohci_device(repo);
-
- if (result) {
- pr_debug("%s:%d ps3_setup_ohci_device failed\n",
- __func__, __LINE__);
- }
- break;
case PS3_DEV_TYPE_STOR_DISK:
result = ps3_setup_storage_dev(repo, PS3_MATCH_ID_STOR_DISK);
@@ -572,6 +545,48 @@ static int ps3_register_repository_devic
return result;
}
+/**
+ * ps3_setup_static_device - Setup a static device from the repository
+ */
+
+static int __init ps3_setup_static_device(const struct ps3_repository_device *repo)
+{
+ int result;
+
+ switch (repo->dev_type) {
+ case PS3_DEV_TYPE_SB_GELIC:
+ result = ps3_setup_gelic_device(repo);
+ if (result) {
+ pr_debug("%s:%d ps3_setup_gelic_device failed\n",
+ __func__, __LINE__);
+ }
+ break;
+ case PS3_DEV_TYPE_SB_USB:
+
+ /* Each USB device has both an EHCI and an OHCI HC */
+
+ result = ps3_setup_ehci_device(repo);
+
+ if (result) {
+ pr_debug("%s:%d ps3_setup_ehci_device failed\n",
+ __func__, __LINE__);
+ }
+
+ result = ps3_setup_ohci_device(repo);
+
+ if (result) {
+ pr_debug("%s:%d ps3_setup_ohci_device failed\n",
+ __func__, __LINE__);
+ }
+ break;
+
+ default:
+ return ps3_setup_dynamic_device(repo);
+ }
+
+ return result;
+}
+
static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
{
struct ps3_repository_device repo;
@@ -601,7 +616,7 @@ found:
pr_debug("%s:%u: device %lu:%lu found after %u retries\n",
__func__, __LINE__, bus_id, dev_id, retries);
- ps3_register_repository_device(&repo);
+ ps3_setup_dynamic_device(&repo);
return;
}
@@ -905,8 +920,7 @@ static int __init ps3_register_devices(v
ps3_register_graphics_devices();
- ps3_repository_find_devices(PS3_BUS_TYPE_SB,
- ps3_register_repository_device);
+ ps3_repository_find_devices(PS3_BUS_TYPE_SB, ps3_setup_static_device);
ps3_register_sound_devices();
^ permalink raw reply
* Re: [PATCH 4/5] [PPC] update lmb for hotplug memory add/remove
From: Badari Pulavarty @ 2008-03-28 16:52 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Andrew Morton, paulus, lkml, Yasunori Goto
In-Reply-To: <EA08C942-E156-410D-8ADA-7A4812B20221@kernel.crashing.org>
Kumar Gala wrote:
>
> On Mar 27, 2008, at 7:39 PM, Badari Pulavarty wrote:
>> ppc kernel maintains information about logical memory blocks in
>> lmb.memory structure at the boot time. Its not updated for
>> hotplug memory add/remove. hotplug memory notifier for memory
>> add/remove now updates lmb.memory.
>>
>> This information is useful for eHEA driver to find out the memory
>> layout and holes.
>>
>> NOTE: No special locking is needed for lmb_add() and lmb_remove().
>> Calls to these are serialized by caller. (pSeries_reconfig_chain).
>>
>> Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
>> ---
>> arch/powerpc/platforms/pseries/hotplug-memory.c | 43 +++++++++++++++
>> include/linux/lmb.h | 3 -
>> lib/lmb.c | 66
>> ++++++++++++++++++++----
>> 3 files changed, 102 insertions(+), 10 deletions(-)
>
> How is lmb_remove different than lmb_alloc?
>
> - k
lmb_remove() can be used to punch a hole in to the existing memory block.
lmb_alloc() tries to allocate for a given alignment, I don't think it can
adjust the current entries. Isn't it ?
Thanks,
Badari
^ permalink raw reply
* Re: [PATCH 1/3] mpc83xx: fix usb phy_type in mpc837x rdb device trees
From: Anton Vorontsov @ 2008-03-28 16:44 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
In-Reply-To: <20080328105125.6a072ff7.kim.phillips@freescale.com>
On Fri, Mar 28, 2008 at 10:51:25AM -0500, Kim Phillips wrote:
> the mpc837x rdb board uses low pin count interfaces (ULPI) to connect
> to the USB PHY.
I've sent this fix two weeks ago...
http://ozlabs.org/pipermail/linuxppc-dev/2008-March/052926.html
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> arch/powerpc/boot/dts/mpc8377_rdb.dts | 2 +-
> arch/powerpc/boot/dts/mpc8378_rdb.dts | 2 +-
> arch/powerpc/boot/dts/mpc8379_rdb.dts | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/mpc8377_rdb.dts b/arch/powerpc/boot/dts/mpc8377_rdb.dts
> index 440aa4d..1a7d516 100644
> --- a/arch/powerpc/boot/dts/mpc8377_rdb.dts
> +++ b/arch/powerpc/boot/dts/mpc8377_rdb.dts
> @@ -151,7 +151,7 @@
> #size-cells = <0>;
> interrupt-parent = <&ipic>;
> interrupts = <38 0x8>;
> - phy_type = "utmi";
> + phy_type = "ulpi";
> };
>
> mdio@24520 {
> diff --git a/arch/powerpc/boot/dts/mpc8378_rdb.dts b/arch/powerpc/boot/dts/mpc8378_rdb.dts
> index 9271153..9d259a1 100644
> --- a/arch/powerpc/boot/dts/mpc8378_rdb.dts
> +++ b/arch/powerpc/boot/dts/mpc8378_rdb.dts
> @@ -151,7 +151,7 @@
> #size-cells = <0>;
> interrupt-parent = <&ipic>;
> interrupts = <38 0x8>;
> - phy_type = "utmi";
> + phy_type = "ulpi";
> };
>
> mdio@24520 {
> diff --git a/arch/powerpc/boot/dts/mpc8379_rdb.dts b/arch/powerpc/boot/dts/mpc8379_rdb.dts
> index 0dda2fc..8dec2ee 100644
> --- a/arch/powerpc/boot/dts/mpc8379_rdb.dts
> +++ b/arch/powerpc/boot/dts/mpc8379_rdb.dts
> @@ -151,7 +151,7 @@
> #size-cells = <0>;
> interrupt-parent = <&ipic>;
> interrupts = <38 0x8>;
> - phy_type = "utmi";
> + phy_type = "ulpi";
> };
>
> mdio@24520 {
> --
> 1.5.4.4.481.g5075
--
Anton Vorontsov
email: cboumailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* [PATCH 2/5] [POWERPC] Xilinx: Virtex: Enable dcr for MMIO and NATIVE
From: Stephen Neuendorffer @ 2008-03-28 16:23 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1206721429-18276-1-git-send-email-stephen.neuendorffer@xilinx.com>
FPGA designs may have need of both MMIO-based and NATIVE-based dcr
interfaces.
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
arch/powerpc/platforms/40x/Kconfig | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index a9260e2..b8e06df 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -123,6 +123,8 @@ config 405GPR
config XILINX_VIRTEX
bool
+ select PPC_DCR_MMIO
+ select PPC_DCR_NATIVE
config XILINX_VIRTEX_II_PRO
bool
--
1.5.3.4-dirty
^ permalink raw reply related
* Re: [PATCH 3/3] sata_fsl: reduce compatibility to fsl,pq-sata
From: Jeff Garzik @ 2008-03-28 16:27 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, linux-ide
In-Reply-To: <970480A0-028A-4370-BB0E-8F555C5C08AF@kernel.crashing.org>
Kumar Gala wrote:
>
> On Mar 28, 2008, at 10:51 AM, Kim Phillips wrote:
>> as prescribed in Documentation/powerpc/booting-without-of.txt.
>>
>> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
>> Cc: Jeff Garzik <jgarzik@pobox.com>
>> ---
>
> Jeff, I'll take this via the powerpc tree if you don't have any issue.
ACK
^ permalink raw reply
* [PATCH 4/5] [POWERPC] Xilinx: Framebuffer: Use dcr infrastructure.
From: Stephen Neuendorffer @ 2008-03-28 16:23 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1206721429-18276-3-git-send-email-stephen.neuendorffer@xilinx.com>
This device contains a dcr interface. Previously, the dcr interface
was assumed to be used in mmio mode, and the register space of the dcr
interface was precomputed and stuffed in the device tree. This patch
makes use of the new dcr infrastructure to represent the dcr interface
as any other dcr interface in the device tree. This enables the dcr
interface to be connected directly to a native dcr interface in a
clean way.
In particular, the device tree expected looks like:
dcr_v29_0: dcr@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "xlnx,dcr-v29-1.00.a";
VGA_FrameBuffer: tft@80 {
compatible = "xlnx,plb-tft-cntlr-ref-1.00.a";
dcr-parent = <&opb2dcr_bridge_0>;
dcr-reg = < 80 2 >;
xlnx,default-tft-base-addr = <7f>;
xlnx,dps-init = <1>;
xlnx,on-init = <1>;
xlnx,pixclk-is-busclk-divby4 = <1>;
} ;
} ;
opb2dcr_bridge_0: opb2dcr-bridge@40700000 {
compatible = "xlnx,opb2dcr-bridge-1.00.b";
dcr-access-method = "mmio";
dcr-controller ;
dcr-mmio-range = < 40700000 1000 >;
dcr-mmio-stride = <4>;
reg = < 40700000 1000 >;
xlnx,family = "virtex2p";
} ;
Note that this patch now requires PPC_DCR_MMIO to be set in order to
advertise the framebuffer as a platform device (i.e. ARCH=ppc).
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
drivers/video/xilinxfb.c | 86 ++++++++++++++++++++++++++--------------------
1 files changed, 49 insertions(+), 37 deletions(-)
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c
index 7b3a842..171cc09 100644
--- a/drivers/video/xilinxfb.c
+++ b/drivers/video/xilinxfb.c
@@ -38,6 +38,7 @@
#endif
#include <asm/io.h>
#include <linux/xilinxfb.h>
+#include <asm/dcr.h>
#define DRIVER_NAME "xilinxfb"
#define DRIVER_DESCRIPTION "Xilinx TFT LCD frame buffer driver"
@@ -112,8 +113,9 @@ struct xilinxfb_drvdata {
struct fb_info info; /* FB driver info record */
- u32 regs_phys; /* phys. address of the control registers */
- u32 __iomem *regs; /* virt. address of the control registers */
+ dcr_host_t dcr_host;
+ unsigned int dcr_start;
+ unsigned int dcr_len;
void *fb_virt; /* virt. address of the frame buffer */
dma_addr_t fb_phys; /* phys. address of the frame buffer */
@@ -136,7 +138,7 @@ struct xilinxfb_drvdata {
* when it's needed.
*/
#define xilinx_fb_out_be32(driverdata, offset, val) \
- out_be32(driverdata->regs + offset, val)
+ dcr_write(driverdata->dcr_host, offset, val)
static int
xilinx_fb_setcolreg(unsigned regno, unsigned red, unsigned green, unsigned blue,
@@ -204,7 +206,8 @@ static struct fb_ops xilinxfb_ops =
* Bus independent setup/teardown
*/
-static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
+static int xilinxfb_assign(struct device *dev, dcr_host_t dcr_host,
+ unsigned int dcr_start, unsigned int dcr_len,
struct xilinxfb_platform_data *pdata)
{
struct xilinxfb_drvdata *drvdata;
@@ -219,21 +222,9 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
}
dev_set_drvdata(dev, drvdata);
- /* Map the control registers in */
- if (!request_mem_region(physaddr, 8, DRIVER_NAME)) {
- dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
- physaddr);
- rc = -ENODEV;
- goto err_region;
- }
- drvdata->regs_phys = physaddr;
- drvdata->regs = ioremap(physaddr, 8);
- if (!drvdata->regs) {
- dev_err(dev, "Couldn't lock memory region at 0x%08lX\n",
- physaddr);
- rc = -ENODEV;
- goto err_map;
- }
+ drvdata->dcr_start = dcr_start;
+ drvdata->dcr_len = dcr_len;
+ drvdata->dcr_host = dcr_host;
/* Allocate the framebuffer memory */
if (pdata->fb_phys) {
@@ -248,7 +239,7 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
if (!drvdata->fb_virt) {
dev_err(dev, "Could not allocate frame buffer memory\n");
rc = -ENOMEM;
- goto err_fbmem;
+ goto err_region;
}
/* Clear (turn to black) the framebuffer */
@@ -298,7 +289,6 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
}
/* Put a banner in the log (for DEBUG) */
- dev_dbg(dev, "regs: phys=%lx, virt=%p\n", physaddr, drvdata->regs);
dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n",
(void*)drvdata->fb_phys, drvdata->fb_virt, fbsize);
@@ -314,12 +304,6 @@ err_cmap:
/* Turn off the display */
xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
-err_fbmem:
- iounmap(drvdata->regs);
-
-err_map:
- release_mem_region(physaddr, 8);
-
err_region:
kfree(drvdata);
dev_set_drvdata(dev, NULL);
@@ -345,9 +329,8 @@ static int xilinxfb_release(struct device *dev)
/* Turn off the display */
xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
- iounmap(drvdata->regs);
- release_mem_region(drvdata->regs_phys, 8);
+ dcr_unmap(drvdata->dcr_host, drvdata->dcr_len);
kfree(drvdata);
dev_set_drvdata(dev, NULL);
@@ -355,6 +338,7 @@ static int xilinxfb_release(struct device *dev)
return 0;
}
+#ifdef CONFIG_PPC_DCR_MMIO
/* ---------------------------------------------------------------------
* Platform bus binding
*/
@@ -364,6 +348,9 @@ xilinxfb_platform_probe(struct platform_device *pdev)
{
struct xilinxfb_platform_data *pdata;
struct resource *res;
+ dcr_host_t dcr_host;
+ int dcr_start = 0;
+ int dcr_len = 2;
/* Find the registers address */
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -386,7 +373,12 @@ xilinxfb_platform_probe(struct platform_device *pdev)
pdata->yvirt = xilinx_fb_default_pdata.yvirt;
}
- return xilinxfb_assign(&pdev->dev, res->start, pdata);
+ dcr_host = dcr_map_mmio_literal(res->start, 4, dcr_start, dcr_len);
+ if (!DCR_MAP_OK(dcr_host)) {
+ dev_err(&pdev->dev, "invalid address\n");
+ return -ENODEV;
+ }
+ return xilinxfb_assign(&pdev->dev, dcr_host, dcr_start, dcr_len, pdata);
}
static int
@@ -405,6 +397,23 @@ static struct platform_driver xilinxfb_platform_driver = {
},
};
+/* Registration helpers to keep the number of #ifdefs to a minimum */
+static inline int __init xilinxfb_platform_register(void)
+{
+ pr_debug("xilinxfb: calling of_register_platform_driver()\n");
+ return platform_driver_register(&xilinxfb_platform_driver);
+}
+
+static inline void __exit xilinxfb_platform_unregister(void)
+{
+ platform_driver_unregister(&xilinxfb_platform_driver);
+}
+#else /* CONFIG_PPC_DCR_MMIO */
+/* CONFIG_OF not enabled; do nothing helpers */
+static inline int __init xilinxfb_platform_register(void) { return 0; }
+static inline void __exit xilinxfb_platform_unregister(void) { }
+#endif /* CONFIG_PPC_DCR_MMIO */
+
/* ---------------------------------------------------------------------
* OF bus binding
*/
@@ -413,20 +422,23 @@ static struct platform_driver xilinxfb_platform_driver = {
static int __devinit
xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
{
- struct resource res;
const u32 *prop;
struct xilinxfb_platform_data pdata;
int size, rc;
+ int start, len;
+ dcr_host_t dcr_host;
/* Copy with the default pdata (not a ptr reference!) */
pdata = xilinx_fb_default_pdata;
dev_dbg(&op->dev, "xilinxfb_of_probe(%p, %p)\n", op, match);
- rc = of_address_to_resource(op->node, 0, &res);
- if (rc) {
+ start = dcr_resource_start(op->node, 0);
+ len = dcr_resource_len(op->node, 0);
+ dcr_host = dcr_map(op->node, start, len);
+ if (!DCR_MAP_OK(dcr_host)) {
dev_err(&op->dev, "invalid address\n");
- return rc;
+ return -ENODEV;
}
prop = of_get_property(op->node, "phys-size", &size);
@@ -450,7 +462,7 @@ xilinxfb_of_probe(struct of_device *op, const struct of_device_id *match)
if (of_find_property(op->node, "rotate-display", NULL))
pdata.rotate_screen = 1;
- return xilinxfb_assign(&op->dev, res.start, &pdata);
+ return xilinxfb_assign(&op->dev, dcr_host, start, len, &pdata);
}
static int __devexit xilinxfb_of_remove(struct of_device *op)
@@ -505,7 +517,7 @@ xilinxfb_init(void)
if (rc)
return rc;
- rc = platform_driver_register(&xilinxfb_platform_driver);
+ rc = xilinxfb_platform_register();
if (rc)
xilinxfb_of_unregister();
@@ -515,7 +527,7 @@ xilinxfb_init(void)
static void __exit
xilinxfb_cleanup(void)
{
- platform_driver_unregister(&xilinxfb_platform_driver);
+ xilinxfb_platform_unregister();
xilinxfb_of_unregister();
}
--
1.5.3.4-dirty
^ permalink raw reply related
* Re: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in the device tree.
From: Laurent Pinchart @ 2008-03-28 16:26 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <20080327153952.GC18728@ld0162-tx32.am.freescale.net>
[-- Attachment #1: Type: text/plain, Size: 1693 bytes --]
On Thursday 27 March 2008 16:39, Scott Wood wrote:
> On Thu, Mar 27, 2008 at 10:10:33AM +0100, Laurent Pinchart wrote:
> > On Wednesday 26 March 2008 17:59, Scott Wood wrote:
> > > This breaks the bootwrapper console.
> >
> > And of course I forgot about that :-)
> >
> > The boot wrapper code doesn't have any dpram allocator. Any objection
> > against using a chunk of dpram at a fixed location ? What about at the
> > beginning of the dpram ? The DTS muram node would then exclude a chunk of
> > dpram at offset 0x0000 instead of 0x1100.
>
> I'm not entirely comfortable with using a chunk outside of what's in the
> muram node, and assuming that it's for the SMC pram -- what if there's
> microcode or something there?
>
> Since udbg is only for debugging, and is marked as potentially dangerous,
> how about just using the end of muram (as described in the device tree)?
> If the muram is fully allocated, it won't happen until after the real
> serial console is initialized.
Locating the end of the muram isn't as straightforward as it could be. As the
current code already uses the beginning of the muram to store the BDs and
data buffers, should I really bother locating the end or can I store the SMC
parameter ram at the beginning as well ?
If I'm not mistaken, once the SMC parameter ram gets relocated to the
beginning/end of the muram, the boot loader preallocated space can be
reclaimed and can be added to the muram in the device tree like I did in my
previous patch. Is that correct ?
--
Laurent Pinchart
CSE Semaphore Belgium
Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium
T +32 (2) 387 42 59
F +32 (2) 387 42 75
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH 3/5] [POWERPC] explicit dcr support
From: Stephen Neuendorffer @ 2008-03-28 16:23 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1206721429-18276-2-git-send-email-stephen.neuendorffer@xilinx.com>
Added literal mapping support if no device-tree support. Added
CONFIG_OF to guard device-tree parts, since literal support works for
arch=ppc.
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
---
arch/powerpc/sysdev/dcr.c | 82 ++++++++++++++++++++++++++++---------
include/asm-powerpc/dcr-generic.h | 2 +
include/asm-powerpc/dcr-mmio.h | 11 +++++
include/asm-powerpc/dcr-native.h | 8 ++++
include/asm-powerpc/dcr.h | 24 +++++++++++
5 files changed, 108 insertions(+), 19 deletions(-)
diff --git a/arch/powerpc/sysdev/dcr.c b/arch/powerpc/sysdev/dcr.c
index d3de0ff..2ccae80 100644
--- a/arch/powerpc/sysdev/dcr.c
+++ b/arch/powerpc/sysdev/dcr.c
@@ -20,9 +20,34 @@
#undef DEBUG
#include <linux/kernel.h>
+#include <linux/module.h>
#include <asm/prom.h>
#include <asm/dcr.h>
+#ifdef CONFIG_OF
+static struct device_node *find_dcr_parent(struct device_node *node)
+{
+ struct device_node *par, *tmp;
+ const u32 *p;
+
+ for (par = of_node_get(node); par;) {
+ if (of_get_property(par, "dcr-controller", NULL))
+ break;
+ p = of_get_property(par, "dcr-parent", NULL);
+ tmp = par;
+ if (p == NULL)
+ par = of_get_parent(par);
+ else
+ par = of_find_node_by_phandle(*p);
+ of_node_put(tmp);
+ }
+ return par;
+}
+#endif /* CONFIG_OF */
+
+
+/* Indirection layer for providing both NATIVE and MMIO support. */
+
#if defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO)
bool dcr_map_ok_generic(dcr_host_t host)
@@ -36,12 +61,24 @@ bool dcr_map_ok_generic(dcr_host_t host)
}
EXPORT_SYMBOL_GPL(dcr_map_ok_generic);
+#ifdef CONFIG_OF
dcr_host_t dcr_map_generic(struct device_node *dev,
unsigned int dcr_n,
unsigned int dcr_c)
{
dcr_host_t host;
- const char *prop = of_get_property(dev, "dcr-access-method", NULL);
+ struct device_node *dp;
+
+ dp = find_dcr_parent(dev);
+ if (dp == NULL) {
+ host.type = INVALID;
+ return host;
+ }
+
+ const char *prop = of_get_property(dp, "dcr-access-method", NULL);
+
+ pr_debug("dcr_map_generic(dcr-access-method = %s)\n",
+ prop);
if (!strcmp(prop, "native")) {
host.type = NATIVE;
@@ -56,6 +93,8 @@ dcr_host_t dcr_map_generic(struct device_node *dev,
}
EXPORT_SYMBOL_GPL(dcr_map_generic);
+#endif /* CONFIG_OF */
+
void dcr_unmap_generic(dcr_host_t host, unsigned int dcr_c)
{
if (host.type == NATIVE)
@@ -85,9 +124,10 @@ EXPORT_SYMBOL_GPL(dcr_write_generic);
#endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */
+#ifdef CONFIG_OF
unsigned int dcr_resource_start(struct device_node *np, unsigned int index)
{
- unsigned int ds;
+ int ds;
const u32 *dr = of_get_property(np, "dcr-reg", &ds);
if (dr == NULL || ds & 1 || index >= (ds / 8))
@@ -99,7 +139,7 @@ EXPORT_SYMBOL_GPL(dcr_resource_start);
unsigned int dcr_resource_len(struct device_node *np, unsigned int index)
{
- unsigned int ds;
+ int ds;
const u32 *dr = of_get_property(np, "dcr-reg", &ds);
if (dr == NULL || ds & 1 || index >= (ds / 8))
@@ -109,26 +149,28 @@ unsigned int dcr_resource_len(struct device_node *np, unsigned int index)
}
EXPORT_SYMBOL_GPL(dcr_resource_len);
+#endif /* CONFIG_OF */
+
+
+
+/* Support for MMIO */
#ifdef CONFIG_PPC_DCR_MMIO
-static struct device_node * find_dcr_parent(struct device_node * node)
+dcr_host_mmio_t dcr_map_mmio_literal_mmio(resource_size_t mmio_start,
+ unsigned int stride,
+ unsigned int dcr_n,
+ unsigned int dcr_c)
{
- struct device_node *par, *tmp;
- const u32 *p;
-
- for (par = of_node_get(node); par;) {
- if (of_get_property(par, "dcr-controller", NULL))
- break;
- p = of_get_property(par, "dcr-parent", NULL);
- tmp = par;
- if (p == NULL)
- par = of_get_parent(par);
- else
- par = of_find_node_by_phandle(*p);
- of_node_put(tmp);
- }
- return par;
+ dcr_host_mmio_t host;
+ host.stride = stride;
+ host.token = ioremap(mmio_start, dcr_c * stride);
+ host.token -= dcr_n * stride;
+ host.base = dcr_n;
+ return host;
}
+EXPORT_SYMBOL_GPL(dcr_map_mmio_literal_mmio);
+
+#ifdef CONFIG_OF
u64 of_translate_dcr_address(struct device_node *dev,
unsigned int dcr_n,
@@ -189,6 +231,8 @@ dcr_host_mmio_t dcr_map_mmio(struct device_node *dev,
}
EXPORT_SYMBOL_GPL(dcr_map_mmio);
+#endif /* CONFIG_OF */
+
void dcr_unmap_mmio(dcr_host_mmio_t host, unsigned int dcr_c)
{
dcr_host_mmio_t h = host;
diff --git a/include/asm-powerpc/dcr-generic.h b/include/asm-powerpc/dcr-generic.h
index 0ee74fb..8032795 100644
--- a/include/asm-powerpc/dcr-generic.h
+++ b/include/asm-powerpc/dcr-generic.h
@@ -34,8 +34,10 @@ typedef struct {
extern bool dcr_map_ok_generic(dcr_host_t host);
+#ifdef CONFIG_OF
extern dcr_host_t dcr_map_generic(struct device_node *dev, unsigned int dcr_n,
unsigned int dcr_c);
+#endif
extern void dcr_unmap_generic(dcr_host_t host, unsigned int dcr_c);
extern u32 dcr_read_generic(dcr_host_t host, unsigned int dcr_n);
diff --git a/include/asm-powerpc/dcr-mmio.h b/include/asm-powerpc/dcr-mmio.h
index acd491d..b12d291 100644
--- a/include/asm-powerpc/dcr-mmio.h
+++ b/include/asm-powerpc/dcr-mmio.h
@@ -34,9 +34,18 @@ static inline bool dcr_map_ok_mmio(dcr_host_mmio_t host)
return host.token != NULL;
}
+extern dcr_host_mmio_t dcr_map_mmio_literal_mmio(resource_size_t mmio_start,
+ unsigned int stride,
+ unsigned int dcr_n,
+ unsigned int dcr_c);
+
+
+#ifdef CONFIG_OF
extern dcr_host_mmio_t dcr_map_mmio(struct device_node *dev,
unsigned int dcr_n,
unsigned int dcr_c);
+#endif
+
extern void dcr_unmap_mmio(dcr_host_mmio_t host, unsigned int dcr_c);
static inline u32 dcr_read_mmio(dcr_host_mmio_t host, unsigned int dcr_n)
@@ -51,9 +60,11 @@ static inline void dcr_write_mmio(dcr_host_mmio_t host,
out_be32(host.token + ((host.base + dcr_n) * host.stride), value);
}
+#ifdef CONFIG_OF
extern u64 of_translate_dcr_address(struct device_node *dev,
unsigned int dcr_n,
unsigned int *stride);
+#endif
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_DCR_MMIO_H */
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h
index 67832e5..9b3e255 100644
--- a/include/asm-powerpc/dcr-native.h
+++ b/include/asm-powerpc/dcr-native.h
@@ -33,6 +33,14 @@ static inline bool dcr_map_ok_native(dcr_host_native_t host)
return 1;
}
+static inline
+dcr_host_native_t dcr_map_native_literal_native(unsigned int dcr_n)
+{
+ dcr_host_native_t host;
+ host.base = dcr_n;
+ return host;
+}
+
#define dcr_map_native(dev, dcr_n, dcr_c) \
((dcr_host_native_t){ .base = (dcr_n) })
#define dcr_unmap_native(host, dcr_c) do {} while (0)
diff --git a/include/asm-powerpc/dcr.h b/include/asm-powerpc/dcr.h
index 6b86322..dfd1c24 100644
--- a/include/asm-powerpc/dcr.h
+++ b/include/asm-powerpc/dcr.h
@@ -35,6 +35,27 @@
#include <asm/dcr-generic.h>
+static inline
+dcr_host_t dcr_map_mmio_literal(resource_size_t mmio_start,
+ unsigned int stride,
+ unsigned int dcr_n,
+ unsigned int dcr_c)
+{
+ dcr_host_t host;
+ host.type = MMIO;
+ host.host.mmio =
+ dcr_map_mmio_literal_mmio(mmio_start, stride, dcr_n, dcr_c);
+ return host;
+}
+static inline
+dcr_host_t dcr_map_native_literal(unsigned int dcr_n)
+{
+ dcr_host_t host;
+ host.type = NATIVE;
+ host.host.native = dcr_map_native_literal_native(dcr_n);
+ return host;
+}
+
#define DCR_MAP_OK(host) dcr_map_ok_generic(host)
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_generic(dev, dcr_n, dcr_c)
#define dcr_unmap(host, dcr_c) dcr_unmap_generic(host, dcr_c)
@@ -45,6 +66,7 @@
#ifdef CONFIG_PPC_DCR_NATIVE
typedef dcr_host_native_t dcr_host_t;
+#define dcr_map_native_literal(dcr_n) dcr_map_native_literal_native(dcr_n)
#define DCR_MAP_OK(host) dcr_map_ok_native(host)
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_native(dev, dcr_n, dcr_c)
#define dcr_unmap(host, dcr_c) dcr_unmap_native(host, dcr_c)
@@ -52,6 +74,8 @@ typedef dcr_host_native_t dcr_host_t;
#define dcr_write(host, dcr_n, value) dcr_write_native(host, dcr_n, value)
#else
typedef dcr_host_mmio_t dcr_host_t;
+#define dcr_map_mmio_literal(mmio_start, stride, dcr_n, dcr_c) \
+ dcr_map_mmio_literal_mmio(mmio_start, stride, dcr_n, dcr_c)
#define DCR_MAP_OK(host) dcr_map_ok_mmio(host)
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_mmio(dev, dcr_n, dcr_c)
#define dcr_unmap(host, dcr_c) dcr_unmap_mmio(host, dcr_c)
--
1.5.3.4-dirty
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox