* Re: [PATCH 03/11] [POWERPC] Add common mpc52xx_setup_pci() routine
From: Stephen Rothwell @ 2007-10-24 7:16 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231321.29359.96506.stgit@hekate.izotz.org>
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
On Wed, 24 Oct 2007 01:13:21 +0200 Marian Balakowicz <m8@semihalf.com> wrote:
>
> +++ b/arch/powerpc/platforms/52xx/lite5200.c
> @@ -155,11 +155,7 @@ static void __init lite5200_setup_arch(void)
> #endif
>
> #ifdef CONFIG_PCI
> - np = of_find_node_by_type(NULL, "pci");
> - if (np) {
> - mpc52xx_add_bridge(np);
> - of_node_put(np);
> - }
> + mpc52xx_setup_pci();
> #endif
Normally we would have no "#ifdef CONFIG_PCI" here but instead define a
static inline void mpc52xx_setup_pci(void) { }
in the header file for the non PCI case.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH 01/11] [POWERPC] Add 'machine: ...' line to common show_cpuinfo()
From: Stephen Rothwell @ 2007-10-24 7:11 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231309.29359.20887.stgit@hekate.izotz.org>
[-- Attachment #1: Type: text/plain, Size: 425 bytes --]
On Wed, 24 Oct 2007 01:13:09 +0200 Marian Balakowicz <m8@semihalf.com> wrote:
>
> + root = of_find_node_by_path("/");
> + if (root)
> + model = of_get_property(root, "model", NULL);
> + of_node_put(root);
The paranoid part of me says:
if (model)
> + seq_printf(m, "machine\t\t: %s\n", model);
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* libfdt: Add some documenting comments in libfdt.h
From: David Gibson @ 2007-10-24 7:10 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch adds some internal documentation in libfdt.h, in the form
of comments on the error codes and some functions. Only a couple of
functions are covered so far, leaving the documentation still woefully
inadequate, but hey, it's a start.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h 2007-10-24 15:56:14.000000000 +1000
+++ dtc/libfdt/libfdt.h 2007-10-24 16:55:09.000000000 +1000
@@ -59,27 +59,64 @@
/* Error codes: informative error codes */
#define FDT_ERR_NOTFOUND 1
+ /* FDT_ERR_NOTFOUND: The requested node or property does not exist */
#define FDT_ERR_EXISTS 2
+ /* FDT_ERR_EXISTS: Attemped to create a node or property which
+ * already exists */
#define FDT_ERR_NOSPACE 3
+ /* FDT_ERR_NOSPACE: Operation needed to expand the device
+ * tree, but its buffer did not have sufficient space to
+ * contain the expanded tree. Use fdt_open_into() to move the
+ * device tree to a buffer with more space. */
/* Error codes: codes for bad parameters */
#define FDT_ERR_BADOFFSET 4
+ /* FDT_ERR_BADOFFSET: Function was passed a structure block
+ * offset which is out-of-bounds, or which points to an
+ * unsuitable part of the structure for the operation. */
#define FDT_ERR_BADPATH 5
+ /* FDT_ERR_BADPATH: Function was passed a badly formatted path
+ * (e.g. missing a leading / for a function which requires an
+ * absolute path) */
#define FDT_ERR_BADSTATE 6
+ /* FDT_ERR_BADSTATE: Function was passed an incomplete device
+ * tree created by the sequential-write functions, which is
+ * not sufficiently complete for the requested operation. */
/* Error codes: codes for bad device tree blobs */
#define FDT_ERR_TRUNCATED 7
+ /* FDT_ERR_TRUNCATED: Structure block of the given device tree
+ * ends without an FDT_END tag. */
#define FDT_ERR_BADMAGIC 8
+ /* FDT_ERR_BADMAGIC: Given "device tree" appears not to be a
+ * device tree at all - it is missing the flattened device
+ * tree magic number. */
#define FDT_ERR_BADVERSION 9
+ /* FDT_ERR_BADVERSION: Given device tree has a version which
+ * can't be handled by the requested operation. For
+ * read-write functions, this may mean that fdt_open_into() is
+ * required to convert the tree to the expected version. */
#define FDT_ERR_BADSTRUCTURE 10
+ /* FDT_ERR_BADSTRUCTURE: Given device tree has a corrupt
+ * structure block or other serious error (e.g. misnested
+ * nodes, or subnodes preceding properties). */
#define FDT_ERR_BADLAYOUT 11
+ /* FDT_ERR_BADLAYOUT: For read-write functions, the given
+ * device tree has it's sub-blocks in an order that the
+ * function can't handle (memory reserve map, then structure,
+ * then strings). Use fdt_open_into() to reorganize the tree
+ * into a form suitable for the read-write operations. */
/* "Can't happen" error indicating a bug in libfdt */
#define FDT_ERR_INTERNAL 12
+ /* FDT_ERR_INTERNAL: libfdt has failed an internal assertion.
+ * Indicates a bug in libfdt itself. */
#define FDT_ERR_MAX 12
-/* Low-level functions (you probably don't need these) */
+/**********************************************************************/
+/* Low-level functions (you probably don't need these) */
+/**********************************************************************/
const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
@@ -94,7 +131,10 @@ static inline void *fdt_offset_ptr_w(voi
uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
-/* General functions */
+/**********************************************************************/
+/* General functions */
+/**********************************************************************/
+
#define fdt_get_header(fdt, field) \
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
@@ -111,15 +151,91 @@ uint32_t fdt_next_tag(const void *fdt, i
#define fdt_set_header(fdt, field, val) \
((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
+/**
+ * fdt_check_header - sanity check a device tree or possible device tree
+ * @fdt: pointer to data which might be a flattened device tree
+ *
+ * fdt_check_header() checks that the given buffer contains what
+ * appears to be a flattened device tree with sane information in its
+ * header.
+ *
+ * returns:
+ * 0, if the buffer appears to contain a valid device tree
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings, as above
+ */
int fdt_check_header(const void *fdt);
+
+/**
+ * fdt_move - move a device tree around in memory
+ * @fdt: pointer to the device tree to move
+ * @buf: pointer to memory where the device is to be moved
+ * @bufsize: size of the memory space at buf
+ *
+ * fdt_move() relocates, if possible, the device tree blob located at
+ * fdt to the buffer at buf of size bufsize. The buffer may overlap
+ * with the existing device tree blob at fdt. Therefore,
+ * fdt_move(fdt, fdt, fdt_totalsize(fdt))
+ * should always succeed.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_NOSPACE, bufsize is insufficient to contain the device tree
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
int fdt_move(const void *fdt, void *buf, int bufsize);
-/* Read-only functions */
+/**********************************************************************/
+/* Read-only functions */
+/**********************************************************************/
+
+/**
+ * fdt_string - retreive a string from the strings block of a device tree
+ * @fdt: pointer to the device tree blob
+ * @stroffset: offset of the string within the strings block (native endian)
+ *
+ * fdt_string() retrieves a pointer to a single string from the
+ * strings block of the device tree blob at fdt.
+ *
+ * returns:
+ * a pointer to the string, on success
+ * NULL, if stroffset is out of bounds
+ */
const char *fdt_string(const void *fdt, int stroffset);
-int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+/**
+ * fdt_num_mem_rsv - retreive the number of memory reserve map entries
+ * @fdt: pointer to the device tree blob
+ *
+ * Returns the number of entries in the device tree blob's memory
+ * reservation map. This does not include the terminating 0,0 entry
+ * or any other (0,0) entries reserved for expansion.
+ *
+ * returns:
+ * the number of entries
+ */
int fdt_num_mem_rsv(const void *fdt);
+/**
+ * fdt_get_mem_rsv - retreive one memory reserve map entry
+ * @fdt: pointer to the device tree blob
+ * @address, @size: pointers to 64-bit variables
+ *
+ * On success, *address and *size will contain the address and size of
+ * the n-th reserve map entry from the device tree blob, in
+ * native-endian format.
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_BADVERSION,
+ * -FDT_ERR_BADSTATE, standard meanings
+ */
+int fdt_get_mem_rsv(const void *fdt, int n, uint64_t *address, uint64_t *size);
+
int fdt_subnode_offset_namelen(const void *fdt, int parentoffset,
const char *name, int namelen);
int fdt_subnode_offset(const void *fdt, int parentoffset, const char *name);
@@ -163,7 +279,10 @@ int fdt_node_check_compatible(const void
int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
const char *compatible);
-/* Write-in-place functions */
+/**********************************************************************/
+/* Write-in-place functions */
+/**********************************************************************/
+
int fdt_setprop_inplace(void *fdt, int nodeoffset, const char *name,
const void *val, int len);
@@ -176,7 +295,10 @@ int fdt_setprop_inplace(void *fdt, int n
int fdt_nop_property(void *fdt, int nodeoffset, const char *name);
int fdt_nop_node(void *fdt, int nodeoffset);
-/* Sequential-write functions */
+/**********************************************************************/
+/* Sequential write functions */
+/**********************************************************************/
+
int fdt_create(void *buf, int bufsize);
int fdt_add_reservemap_entry(void *fdt, uint64_t addr, uint64_t size);
int fdt_finish_reservemap(void *fdt);
@@ -192,7 +314,10 @@ int fdt_property(void *fdt, const char *
int fdt_end_node(void *fdt);
int fdt_finish(void *fdt);
-/* Read-write functions */
+/**********************************************************************/
+/* Read-write functions */
+/**********************************************************************/
+
int fdt_open_into(void *fdt, void *buf, int bufsize);
int fdt_pack(void *fdt);
@@ -214,7 +339,10 @@ int fdt_add_subnode_namelen(void *fdt, i
int fdt_add_subnode(void *fdt, int parentoffset, const char *name);
int fdt_del_node(void *fdt, int nodeoffset);
-/* Extra functions */
+/**********************************************************************/
+/* Debugging / informational functions */
+/**********************************************************************/
+
const char *fdt_strerror(int errval);
#endif /* _LIBFDT_H */
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [PATCH] taskstats scaled time cleanup
From: Michael Neuling @ 2007-10-24 6:54 UTC (permalink / raw)
To: paulus, akpm, linux390
Cc: linuxppc-dev, Balbir Singh, linux-kernel, linux-s390
This moves the ability to scale cputime into generic code. This
allows us to fix the issue in kernel/timer.c (noticed by Balbir) where
we could only add an unscaled value to the scaled utime/stime.
This adds a cputime_to_scaled function. As before, the POWERPC
version does the scaling based on the last SPURR/PURR ratio
calculated. The generic and s390 (only other arch to implement
asm/cputime.h) versions are both NOPs.
Also moves the SPURR and PURR snapshots closer.
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/kernel/time.c | 14 +++++++-------
include/asm-generic/cputime.h | 1 +
include/asm-powerpc/cputime.h | 14 ++++++++++++++
include/asm-powerpc/paca.h | 2 --
include/asm-s390/cputime.h | 1 +
kernel/timer.c | 9 +++++----
6 files changed, 28 insertions(+), 13 deletions(-)
Index: linux-2.6-ozlabs/arch/powerpc/kernel/time.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/time.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/time.c
@@ -66,6 +66,7 @@
#include <asm/smp.h>
#include <asm/vdso_datapage.h>
#include <asm/firmware.h>
+#include <asm/cputime.h>
#ifdef CONFIG_PPC_ISERIES
#include <asm/iseries/it_lp_queue.h>
#include <asm/iseries/hv_call_xm.h>
@@ -186,6 +187,8 @@ u64 __cputime_sec_factor;
EXPORT_SYMBOL(__cputime_sec_factor);
u64 __cputime_clockt_factor;
EXPORT_SYMBOL(__cputime_clockt_factor);
+DEFINE_PER_CPU(unsigned long, cputime_last_delta);
+DEFINE_PER_CPU(unsigned long, cputime_scaled_last_delta);
static void calc_cputime_factors(void)
{
@@ -232,9 +235,9 @@ void account_system_vtime(struct task_st
local_irq_save(flags);
now = read_purr();
+ nowscaled = read_spurr(now);
delta = now - get_paca()->startpurr;
get_paca()->startpurr = now;
- nowscaled = read_spurr(now);
deltascaled = nowscaled - get_paca()->startspurr;
get_paca()->startspurr = nowscaled;
if (!in_interrupt()) {
@@ -247,9 +250,9 @@ void account_system_vtime(struct task_st
get_paca()->system_time = 0;
}
account_system_time(tsk, 0, delta);
- get_paca()->purrdelta = delta;
+ per_cpu(cputime_last_delta, smp_processor_id()) = delta;
account_system_time_scaled(tsk, deltascaled);
- get_paca()->spurrdelta = deltascaled;
+ per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
local_irq_restore(flags);
}
@@ -267,10 +270,7 @@ void account_process_vtime(struct task_s
get_paca()->user_time = 0;
account_user_time(tsk, utime);
- /* Estimate the scaled utime by scaling the real utime based
- * on the last spurr to purr ratio */
- utimescaled = utime * get_paca()->spurrdelta / get_paca()->purrdelta;
- get_paca()->spurrdelta = get_paca()->purrdelta = 0;
+ utimescaled = cputime_to_scaled(utime);
account_user_time_scaled(tsk, utimescaled);
}
Index: linux-2.6-ozlabs/include/asm-generic/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-generic/cputime.h
+++ linux-2.6-ozlabs/include/asm-generic/cputime.h
@@ -18,6 +18,7 @@ typedef unsigned long cputime_t;
#define cputime_lt(__a, __b) ((__a) < (__b))
#define cputime_le(__a, __b) ((__a) <= (__b))
#define cputime_to_jiffies(__ct) (__ct)
+#define cputime_to_scaled(__ct) (__ct)
#define jiffies_to_cputime(__hz) (__hz)
typedef u64 cputime64_t;
Index: linux-2.6-ozlabs/include/asm-powerpc/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/cputime.h
+++ linux-2.6-ozlabs/include/asm-powerpc/cputime.h
@@ -52,12 +52,26 @@ typedef u64 cputime64_t;
* Convert cputime <-> jiffies
*/
extern u64 __cputime_jiffies_factor;
+DECLARE_PER_CPU(unsigned long, cputime_last_delta);
+DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta);
static inline unsigned long cputime_to_jiffies(const cputime_t ct)
{
return mulhdu(ct, __cputime_jiffies_factor);
}
+/* Estimate the scaled cputime by scaling the real cputime based on
+ * the last scaled to real ratio */
+static inline cputime_t cputime_to_scaled(const cputime_t ct)
+{
+ if (cpu_has_feature(CPU_FTR_SPURR) &&
+ per_cpu(cputime_last_delta, smp_processor_id()))
+ return ct *
+ per_cpu(cputime_scaled_last_delta, smp_processor_id())/
+ per_cpu(cputime_last_delta, smp_processor_id());
+ return ct;
+}
+
static inline cputime_t jiffies_to_cputime(const unsigned long jif)
{
cputime_t ct;
Index: linux-2.6-ozlabs/include/asm-powerpc/paca.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-powerpc/paca.h
+++ linux-2.6-ozlabs/include/asm-powerpc/paca.h
@@ -115,8 +115,6 @@ struct paca_struct {
u64 system_time; /* accumulated system TB ticks */
u64 startpurr; /* PURR/TB value snapshot */
u64 startspurr; /* SPURR value snapshot */
- u64 purrdelta; /* FIXME: document */
- u64 spurrdelta; /* FIXME: document */
};
extern struct paca_struct paca[];
Index: linux-2.6-ozlabs/include/asm-s390/cputime.h
===================================================================
--- linux-2.6-ozlabs.orig/include/asm-s390/cputime.h
+++ linux-2.6-ozlabs/include/asm-s390/cputime.h
@@ -54,6 +54,7 @@ __div(unsigned long long n, unsigned int
#define cputime_lt(__a, __b) ((__a) < (__b))
#define cputime_le(__a, __b) ((__a) <= (__b))
#define cputime_to_jiffies(__ct) (__div((__ct), 1000000 / HZ))
+#define cputime_to_scaled(__ct) (__ct)
#define jiffies_to_cputime(__hz) ((cputime_t)(__hz) * (1000000 / HZ))
#define cputime64_zero (0ULL)
Index: linux-2.6-ozlabs/kernel/timer.c
===================================================================
--- linux-2.6-ozlabs.orig/kernel/timer.c
+++ linux-2.6-ozlabs/kernel/timer.c
@@ -825,14 +825,15 @@ void update_process_times(int user_tick)
{
struct task_struct *p = current;
int cpu = smp_processor_id();
+ cputime_t one_jiffy = jiffies_to_cputime(1);
/* Note: this timer irq context must be accounted for as well. */
if (user_tick) {
- account_user_time(p, jiffies_to_cputime(1));
- account_user_time_scaled(p, jiffies_to_cputime(1));
+ account_user_time(p, one_jiffy);
+ account_user_time_scaled(p, cputime_to_scaled(one_jiffy));
} else {
- account_system_time(p, HARDIRQ_OFFSET, jiffies_to_cputime(1));
- account_system_time_scaled(p, jiffies_to_cputime(1));
+ account_system_time(p, HARDIRQ_OFFSET, one_jiffy);
+ account_system_time_scaled(p, cputime_to_scaled(one_jiffy));
}
run_local_timers();
if (rcu_pending(cpu))
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 6:23 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linuxppc-dev
In-Reply-To: <471EE082.3090204@pobox.com>
[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]
On Wed, 2007-10-24 at 02:04 -0400, Jeff Garzik wrote:
> Benjamin Herrenschmidt wrote:
> > On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> >> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> >> children for a property, this is not safe WRT refcounting, so fix it
> >> to use of_get_next_child().
> >>
> >> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> >
> > Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >
> > (Pending you test boot it on one of our G5s first !)
> >
> >> ---
> >> drivers/ata/sata_svw.c | 5 ++++-
> >> 1 files changed, 4 insertions(+), 1 deletions(-)
> >>
> >> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> >> index 12d613c..64c3812 100644
> >> --- a/drivers/ata/sata_svw.c
> >> +++ b/drivers/ata/sata_svw.c
> >> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
> >>
> >> /* Match it to a port node */
> >> index = (ap == ap->host->ports[0]) ? 0 : 1;
> >> - for (np = np->child; np != NULL; np = np->sibling) {
> >> +
> >> + for (np = of_get_next_child(np, NULL);
> >> + np != NULL;
> >> + np = of_get_next_child(np, np)) {
> >> const u32 *reg = of_get_property(np, "reg", NULL);
>
> This sort of thing I would prefer to ACK (ACK!), and let it go upstream
> via the powerpc tree.
Sure thing, just ACK (ACK!) (ACK?) it, and I'll pester paulus to merge
it via his tree.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Jeff Garzik @ 2007-10-24 6:04 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev
In-Reply-To: <1193202117.2085.45.camel@pasglop>
Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
>> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
>> children for a property, this is not safe WRT refcounting, so fix it
>> to use of_get_next_child().
>>
>> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
>
>> ---
>> drivers/ata/sata_svw.c | 5 ++++-
>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
>> index 12d613c..64c3812 100644
>> --- a/drivers/ata/sata_svw.c
>> +++ b/drivers/ata/sata_svw.c
>> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>>
>> /* Match it to a port node */
>> index = (ap == ap->host->ports[0]) ? 0 : 1;
>> - for (np = np->child; np != NULL; np = np->sibling) {
>> +
>> + for (np = of_get_next_child(np, NULL);
>> + np != NULL;
>> + np = of_get_next_child(np, np)) {
>> const u32 *reg = of_get_property(np, "reg", NULL);
This sort of thing I would prefer to ACK (ACK!), and let it go upstream
via the powerpc tree.
Jeff
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 5:31 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, jgarzik
In-Reply-To: <1193202117.2085.45.camel@pasglop>
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
On Wed, 2007-10-24 at 15:01 +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> > k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> > children for a property, this is not safe WRT refcounting, so fix it
> > to use of_get_next_child().
> >
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
>
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>
> (Pending you test boot it on one of our G5s first !)
As if I'd send untested patches !!
...
It just booted and seems happy.
cheers
--
Michael Ellerman
OzLabs, IBM Australia Development Lab
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Grant Likely @ 2007-10-24 5:27 UTC (permalink / raw)
To: Domen Puncer; +Cc: linuxppc-dev, Dragos Carp, dbrownell, linux-kernel
In-Reply-To: <20071024050100.GA3369@nd47.coderock.org>
On 10/23/07, Domen Puncer <domen.puncer@telargo.com> wrote:
> On 23/10/07 21:39 -0600, Grant Likely wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > port_config and the cdm are the responsibility of firmware; and if
> > firmware doesn't set it up correctly, it should be fixed up by
> > platform code on a per-board basis because it's a property of the
> > board.
> >
> > Drivers should never touch these registers. They are completely
> > unprotected and the platform may do odd things with them that the
> > driver must not interfere with.
> >
> > Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> > ---
> >
> > Domen, Dragos; can you please check your usage of this driver. None of
> > the in-tree board ports use it as-is, but they are of course just a
> > device tree change away from being usable on the lite5200b.
>
> My test cases were just a jumper on RX-TX line.
>
> It's not even allowed to set mclken_div_pscX?
> There can be different speed devices on same SPI
> (spi_board_info->max_speed_hz).
Nope; do it in the platform code or a cdm driver. Otherwise there is
no protection against collisions on the cdm registers. The driver
could call a platform hook to fiddle with clocking, but it must not
touch it directly.
(BTW, I don't intended to push this version of the patch; I just want
to get everyone's brain juices flowing to figure out the best way to
solve it.)
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Domen Puncer @ 2007-10-24 5:01 UTC (permalink / raw)
To: Grant Likely
Cc: linuxppc-dev, Dragos Carp, dbrownell, linux-kernel, domen.puncer
In-Reply-To: <20071024033457.8657.8708.stgit@trillian.cg.shawcable.net>
On 23/10/07 21:39 -0600, Grant Likely wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> port_config and the cdm are the responsibility of firmware; and if
> firmware doesn't set it up correctly, it should be fixed up by
> platform code on a per-board basis because it's a property of the
> board.
>
> Drivers should never touch these registers. They are completely
> unprotected and the platform may do odd things with them that the
> driver must not interfere with.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
> Domen, Dragos; can you please check your usage of this driver. None of
> the in-tree board ports use it as-is, but they are of course just a
> device tree change away from being usable on the lite5200b.
My test cases were just a jumper on RX-TX line.
It's not even allowed to set mclken_div_pscX?
There can be different speed devices on same SPI
(spi_board_info->max_speed_hz).
>
> Board ports that use it need to be modified to make the cdm/port_config
> changes in firmware (prefered) or in arch/powerpc/platforms/52xx/<board>.c
>
> Cheers,
> g.
>
> drivers/spi/mpc52xx_psc_spi.c | 77 +----------------------------------------
> 1 files changed, 2 insertions(+), 75 deletions(-)
>
> diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
> index 7051e6c..ec3a618 100644
> --- a/drivers/spi/mpc52xx_psc_spi.c
> +++ b/drivers/spi/mpc52xx_psc_spi.c
> @@ -328,78 +328,15 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
> kfree(spi->controller_state);
> }
>
> -static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
> +static void mpc52xx_psc_spi_config(int psc_id, struct mpc52xx_psc_spi *mps)
> {
> - struct mpc52xx_cdm __iomem *cdm;
> - struct mpc52xx_gpio __iomem *gpio;
> struct mpc52xx_psc __iomem *psc = mps->psc;
> - u32 ul;
> u32 mclken_div;
> - int ret = 0;
> -
> -#if defined(CONFIG_PPC_MERGE)
> - cdm = mpc52xx_find_and_map("mpc5200-cdm");
> - gpio = mpc52xx_find_and_map("mpc5200-gpio");
> -#else
> - cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
> - gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
> -#endif
> - if (!cdm || !gpio) {
> - printk(KERN_ERR "Error mapping CDM/GPIO\n");
> - ret = -EFAULT;
> - goto unmap_regs;
> - }
>
> /* default sysclk is 512MHz */
> mclken_div = 0x8000 |
> (((mps->sysclk ? mps->sysclk : 512000000) / MCLK) & 0x1FF);
It's actually 528e6, and mclken_div doesn't seem to be used anywhere anymore.
>
> - switch (psc_id) {
> - case 1:
...
Domen
^ permalink raw reply
* Re: [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Benjamin Herrenschmidt @ 2007-10-24 5:01 UTC (permalink / raw)
To: Michael Ellerman; +Cc: linuxppc-dev, jgarzik
In-Reply-To: <2576ec47fb43bd1f4464beb8b78adfa70bdde418.1193199877.git.michael@ellerman.id.au>
On Wed, 2007-10-24 at 14:25 +1000, Michael Ellerman wrote:
> k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
> children for a property, this is not safe WRT refcounting, so fix it
> to use of_get_next_child().
>
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
(Pending you test boot it on one of our G5s first !)
> ---
> drivers/ata/sata_svw.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
> index 12d613c..64c3812 100644
> --- a/drivers/ata/sata_svw.c
> +++ b/drivers/ata/sata_svw.c
> @@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
>
> /* Match it to a port node */
> index = (ap == ap->host->ports[0]) ? 0 : 1;
> - for (np = np->child; np != NULL; np = np->sibling) {
> +
> + for (np = of_get_next_child(np, NULL);
> + np != NULL;
> + np = of_get_next_child(np, np)) {
> const u32 *reg = of_get_property(np, "reg", NULL);
> if (!reg)
> continue;
^ permalink raw reply
* [PATCH] Use of_get_next_child() in riva_get_EDID_OF()
From: Michael Ellerman @ 2007-10-24 4:26 UTC (permalink / raw)
To: adaplas; +Cc: linuxppc-dev
riva_get_EDID_OF() uses its own hand-rolled loop to check a nodes
children for a property, this is not safe WRT refcounting, so fix it
to use of_get_next_child().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
drivers/video/riva/fbdev.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 5c47968..07b6b2d 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -1759,7 +1759,10 @@ static int __devinit riva_get_EDID_OF(struct fb_info *info, struct pci_dev *pd)
NVTRACE_ENTER();
dp = pci_device_to_OF_node(pd);
- for (; dp != NULL; dp = dp->child) {
+
+ for (dp = of_get_next_child(dp, NULL);
+ dp != NULL;
+ dp = of_get_next_child(dp, dp)) {
disptype = of_get_property(dp, "display-type", NULL);
if (disptype == NULL)
continue;
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] Use of_get_next_child() in k2_sata_proc_info()
From: Michael Ellerman @ 2007-10-24 4:25 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, jgarzik
k2_sata_proc_info() uses its own hand-rolled loop to check a nodes
children for a property, this is not safe WRT refcounting, so fix it
to use of_get_next_child().
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
drivers/ata/sata_svw.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 12d613c..64c3812 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -289,7 +289,10 @@ static int k2_sata_proc_info(struct Scsi_Host *shost, char *page, char **start,
/* Match it to a port node */
index = (ap == ap->host->ports[0]) ? 0 : 1;
- for (np = np->child; np != NULL; np = np->sibling) {
+
+ for (np = of_get_next_child(np, NULL);
+ np != NULL;
+ np = of_get_next_child(np, np)) {
const u32 *reg = of_get_property(np, "reg", NULL);
if (!reg)
continue;
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] Use of_get_parent() in pci_dma_dev_setup_pSeriesLP()
From: Michael Ellerman @ 2007-10-24 4:24 UTC (permalink / raw)
To: linuxppc-dev
The loop to check parent nodes for a dma-window property in
pci_dma_dev_setup_pSeriesLP() does not use the of_* accessors and
does not properly manage refcounts, fix it to do so.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/platforms/pseries/iommu.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index be17d23..2c6fc3f 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -481,7 +481,7 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev)
static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
{
- struct device_node *pdn, *dn;
+ struct device_node *pdn, *dn, *tmp;
struct iommu_table *tbl;
const void *dma_window = NULL;
struct pci_dn *pci;
@@ -497,18 +497,22 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
dn = pci_device_to_OF_node(dev);
DBG(" node is %s\n", dn->full_name);
- for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
- pdn = pdn->parent) {
+ pdn = of_node_get(dn);
+ while (pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table) {
dma_window = of_get_property(pdn, "ibm,dma-window", NULL);
if (dma_window)
break;
+
+ tmp = of_get_parent(pdn);
+ of_node_put(pdn);
+ pdn = tmp;
}
if (!pdn || !PCI_DN(pdn)) {
printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: "
"no DMA window found for pci dev=%s dn=%s\n",
pci_name(dev), dn? dn->full_name : "<null>");
- return;
+ goto out_put;
}
DBG(" parent is %s\n", pdn->full_name);
@@ -518,7 +522,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
if (dma_window == NULL || pdn->parent == NULL) {
DBG(" no dma window for device, linking to parent\n");
dev->dev.archdata.dma_data = PCI_DN(pdn)->iommu_table;
- return;
+ goto out_put;
}
pci = PCI_DN(pdn);
@@ -538,6 +542,9 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)
}
dev->dev.archdata.dma_data = pci->iommu_table;
+
+out_put:
+ of_node_put(pdn);
}
#else /* CONFIG_PCI */
#define pci_dma_bus_setup_pSeries NULL
--
1.5.1.3.g7a33b
^ permalink raw reply related
* [PATCH] mpc5200: psc-spi driver must not touch port_config or cdm registers
From: Grant Likely @ 2007-10-24 3:39 UTC (permalink / raw)
To: Dragos Carp, linux-kernel, dbrownell, domen.puncer, linuxppc-dev
From: Grant Likely <grant.likely@secretlab.ca>
port_config and the cdm are the responsibility of firmware; and if
firmware doesn't set it up correctly, it should be fixed up by
platform code on a per-board basis because it's a property of the
board.
Drivers should never touch these registers. They are completely
unprotected and the platform may do odd things with them that the
driver must not interfere with.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
Domen, Dragos; can you please check your usage of this driver. None of
the in-tree board ports use it as-is, but they are of course just a
device tree change away from being usable on the lite5200b.
Board ports that use it need to be modified to make the cdm/port_config
changes in firmware (prefered) or in arch/powerpc/platforms/52xx/<board>.c
Cheers,
g.
drivers/spi/mpc52xx_psc_spi.c | 77 +----------------------------------------
1 files changed, 2 insertions(+), 75 deletions(-)
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c
index 7051e6c..ec3a618 100644
--- a/drivers/spi/mpc52xx_psc_spi.c
+++ b/drivers/spi/mpc52xx_psc_spi.c
@@ -328,78 +328,15 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi)
kfree(spi->controller_state);
}
-static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
+static void mpc52xx_psc_spi_config(int psc_id, struct mpc52xx_psc_spi *mps)
{
- struct mpc52xx_cdm __iomem *cdm;
- struct mpc52xx_gpio __iomem *gpio;
struct mpc52xx_psc __iomem *psc = mps->psc;
- u32 ul;
u32 mclken_div;
- int ret = 0;
-
-#if defined(CONFIG_PPC_MERGE)
- cdm = mpc52xx_find_and_map("mpc5200-cdm");
- gpio = mpc52xx_find_and_map("mpc5200-gpio");
-#else
- cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
- gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
-#endif
- if (!cdm || !gpio) {
- printk(KERN_ERR "Error mapping CDM/GPIO\n");
- ret = -EFAULT;
- goto unmap_regs;
- }
/* default sysclk is 512MHz */
mclken_div = 0x8000 |
(((mps->sysclk ? mps->sysclk : 512000000) / MCLK) & 0x1FF);
- switch (psc_id) {
- case 1:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFFFF8;
- ul |= 0x00000006;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc1, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000020;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 2:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFFF8F;
- ul |= 0x00000060;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc2, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000040;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 3:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFFFFF0FF;
- ul |= 0x00000600;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc3, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000080;
- out_be32(&cdm->clk_enables, ul);
- break;
- case 6:
- ul = in_be32(&gpio->port_config);
- ul &= 0xFF8FFFFF;
- ul |= 0x00700000;
- out_be32(&gpio->port_config, ul);
- out_be16(&cdm->mclken_div_psc6, mclken_div);
- ul = in_be32(&cdm->clk_enables);
- ul |= 0x00000010;
- out_be32(&cdm->clk_enables, ul);
- break;
- default:
- ret = -EINVAL;
- goto unmap_regs;
- }
-
/* Reset the PSC into a known state */
out_8(&psc->command, MPC52xx_PSC_RST_RX);
out_8(&psc->command, MPC52xx_PSC_RST_TX);
@@ -421,14 +358,6 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)
out_8(&psc->ctlr, 0x84);
mps->bits_per_word = 8;
-
-unmap_regs:
- if (cdm)
- iounmap(cdm);
- if (gpio)
- iounmap(gpio);
-
- return ret;
}
static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)
@@ -493,9 +422,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr,
if (ret)
goto free_master;
- ret = mpc52xx_psc_spi_port_config(master->bus_num, mps);
- if (ret < 0)
- goto free_irq;
+ mpc52xx_psc_spi_config(master->bus_num, mps);
spin_lock_init(&mps->lock);
init_completion(&mps->done);
^ permalink raw reply related
* Re: [PATCH] PowerPC: Add BCM5248 and Marvell 88E1111 PHY support to NEW EMAC.
From: Benjamin Herrenschmidt @ 2007-10-24 3:31 UTC (permalink / raw)
To: Valentine Barshak; +Cc: linuxppc-dev, jeff, netdev
In-Reply-To: <20071015175717.GA4602@ru.mvista.com>
On Tue, 2007-10-23 at 20:57 -0500, Valentine Barshak wrote:
> +static int m88e1111_init(struct mii_phy *phy)
> +{
> + printk("%s: Marvell 88E1111 Ethernet\n", __FUNCTION__);
> + phy_write(phy, 0x14, 0x0ce3);
> + phy_write(phy, 0x18, 0x4101);
> + phy_write(phy, 0x09, 0x0e00);
> + phy_write(phy, 0x04, 0x01e1);
> + phy_write(phy, 0x00, 0x9140);
> + phy_write(phy, 0x00, 0x1140);
> +
> + return 0;
> +}
Care to put a few comments on why the above is necessary and what it
does ?
Thanks !
Ben.
> +static struct mii_phy_ops m88e1111_phy_ops = {
> + .init = m88e1111_init,
> + .setup_aneg = genmii_setup_aneg,
> + .setup_forced = genmii_setup_forced,
> + .poll_link = genmii_poll_link,
> + .read_link = genmii_read_link
> +};
> +
> +static struct mii_phy_def m88e1111_phy_def = {
> +
> + .phy_id = 0x01410CC0,
> + .phy_id_mask = 0x0ffffff0,
> + .name = "Marvell 88E1111 Ethernet",
> + .ops = &m88e1111_phy_ops,
> +};
> +
> static struct mii_phy_def *mii_phy_table[] = {
> &cis8201_phy_def,
> + &bcm5248_phy_def,
> + &m88e1111_phy_def,
> &genmii_phy_def,
> NULL
> };
^ permalink raw reply
* Re: [PATCH 05/11] [POWERPC] TQM5200 DTS
From: David Gibson @ 2007-10-24 1:51 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231333.29359.35252.stgit@hekate.izotz.org>
On Wed, Oct 24, 2007 at 01:13:33AM +0200, Marian Balakowicz wrote:
> Add device tree source file for TQM5200 board.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
>
> arch/powerpc/boot/dts/tqm5200.dts | 236 +++++++++++++++++++++++++++++++++++++
> 1 files changed, 236 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/tqm5200.dts
>
>
> diff --git a/arch/powerpc/boot/dts/tqm5200.dts b/arch/powerpc/boot/dts/tqm5200.dts
> new file mode 100644
> index 0000000..01c7778
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/tqm5200.dts
> @@ -0,0 +1,236 @@
> +/*
> + * TQM5200 board Device Tree Source
[snip]
> + soc5200@f0000000 {
I thought we were moving towards calling these just /soc@address?
> + model = "fsl,mpc5200";
> + compatible = "mpc5200";
That should have a vendor prefix.
[snip]
> + serial@2000 { // PSC1
> + device_type = "serial";
> + compatible = "mpc5200-psc-uart";
> + port-number = <0>; // Logical port assignment
How are these port-number things used? The device tree shouldn't
generally contain information that isn't inherent to the hardware.
There can be reasons for hacks like this, but we should avoid them if
possible.
> + cell-index = <0>;
cell-index should only be used if the index number is used when
manipulating the hardware (e.g. if there's a global control register
which takes this number).
[snip]
> + ata@3a00 {
> + device_type = "ata";
No such thing as device_type = "ata", drop it. In general, never
include a device_type unless a binding explicitly says to do so.
[snip]
> + lpb@fc000000 {
> + model = "fsl,lpb";
> + compatible = "lpb";
Not nearly specific enough. Must include a vendor prefix at least,
and should have a lot more revision information. You should always be
able to pick the right driver with compatible alone, "model" should
generally be for human consumption, the driver shouldn't need it.
> + device_type = "lpb";
Drop this. Again, presence of a device_type property is the
exception, not the rule.
> + ranges = <0 fc000000 02000000>;
You need #address-cells and #size-cells properties, too.
[snip]
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [microblaze-uclinux] RE: [PATCH v3] Device tree bindings for Xilinx devices
From: David Gibson @ 2007-10-24 1:43 UTC (permalink / raw)
To: Stephen Neuendorffer
Cc: microblaze-uclinux, Michal Simek, Wolfgang Reissnegger,
linuxppc-dev
In-Reply-To: <20071024011525.5D8777B806D@mail165-dub.bigfish.com>
On Tue, Oct 23, 2007 at 06:15:22PM -0700, Stephen Neuendorffer wrote:
[snip]
> / {
> #address-cells = <1>;
> #size-cells = <1>;
> model = "system.mhs";
> chosen {
> bootargs = "root=/dev/xsysace/disc0/part2";
> interrupt-controller = <101>;
interrupt-controller in /chosen is obsolete. Drop it.
> } ;
> cpus {
> #address-cells = <1>;
> #cpus = <1>;
> #size-cells = <0>;
> microblaze,6.00.b@0 {
> 32-bit;
32-bit was never a specified property. Drop.
> clock-frequency = <5f5e1000>;
> d-cache-line-size = <10>;
> d-cache-size = <4000>;
> device_type = "cpu";
> i-cache-line-size = <10>;
> i-cache-size = <4000>;
> linux,boot-cpu;
linux,boot-cpu is long obsolete. Drop.
> reg = <0>;
> timebase-frequency = <1fca055>;
> xlnx,cache-byte-size = <4000>;
> xlnx,dcache-baseaddr = <50000000>;
> xlnx,dcache-byte-size = <4000>;
> xlnx,dcache-highaddr = <5fffffff>;
> xlnx,debug-enabled = <1>;
> xlnx,div-zero-exception = <1>;
> xlnx,dopb-bus-exception = <1>;
> xlnx,fpu-exception = <1>;
> xlnx,icache-baseaddr = <50000000>;
> xlnx,icache-highaddr = <5fffffff>;
> xlnx,ill-opcode-exception = <1>;
> xlnx,iopb-bus-exception = <1>;
> xlnx,number-of-pc-brk = <2>;
> xlnx,pvr = <2>;
> xlnx,unaligned-exceptions = <1>;
> xlnx,use-barrel = <1>;
> xlnx,use-dcache = <1>;
> xlnx,use-div = <1>;
> xlnx,use-fpu = <1>;
> xlnx,use-icache = <1>;
> xlnx,use-msr-instr = <1>;
> xlnx,use-pcmp-instr = <1>;
> } ;
> } ;
> memory {
> device_type = "memory";
> reg = < 50000000 10000000 >;
> } ;
> opb_v20 {
Any node with children must have #address-cells and #size-cells
properties. This one almost certainly needs 'ranges' too. If it has
any bridge control registers, it should have 'reg' also.
> compatible =
> "xlnx,opb-v20-1.10.c\0xlnx,opb-v20\0ibm,opb";
> ethernet@40c00000 {
> compatible =
> "xlnx,opb-ethernet-1.04.a\0xlnx,opb-ethernet";
> device_type = "network";
> interrupt-parent = <101>;
It would be kind of neat if you could get this to generate labels and
references, rather than explicit phandles for the interrupt tree.
> interrupts = < 1 0 >;
> reg = < 40c00000 10000 >;
> xlnx,cam-exist = <0>;
> xlnx,dev-blk-id = <0>;
> xlnx,dev-mir-enable = <0>;
> xlnx,dma-present = <1>;
> xlnx,edk-name = "Ethernet_MAC";
> xlnx,include-dev-pencoder = <0>;
> xlnx,ipif-rdfifo-depth = <4000>;
> xlnx,ipif-wrfifo-depth = <4000>;
> xlnx,jumbo-exist = <0>;
> xlnx,mac-fifo-depth = <10>;
> xlnx,mii-exist = <1>;
> xlnx,opb-clk-period-ps = <2710>;
> xlnx,reset-present = <1>;
> xlnx,rx-dre-type = <0>;
> xlnx,rx-include-csum = <0>;
> xlnx,tx-dre-type = <0>;
> xlnx,tx-include-csum = <0>;
> } ;
> interrupt-controller@41200000 {
> #interrupt-cells = <2>;
> compatible =
> "xlnx,opb-intc-1.00.c\0xlnx,opb-intc";
> interrupt-controller;
> linux,phandle = <101>;
> reg = < 41200000 10000 >;
> xlnx,edk-name = "opb_intc_0";
> } ;
> memory@50000000 {
Ok, I don't really understand why the memory node is duplicated here.
It seems to be covering the same range as the top-level /memory node.
> compatible =
> "xlnx,mch-opb-ddr2-1.02.a\0xlnx,mch-opb-ddr2";
> device_type = "memory";
> reg = < 50000000 10000000 >;
> xlnx,ddr-async-support = <1>;
> xlnx,ddr-awidth = <d>;
> xlnx,ddr-bank-awidth = <2>;
> xlnx,ddr-cas-lat = <3>;
> xlnx,ddr-col-awidth = <a>;
> xlnx,ddr-dwidth = <20>;
> xlnx,ddr-tfaw = <c350>;
> xlnx,ddr-tmrd = <61a8>;
> xlnx,ddr-tras = <15f90>;
> xlnx,ddr-trc = <fde8>;
> xlnx,ddr-trcd = <61a8>;
> xlnx,ddr-trefi = <7704c0>;
> xlnx,ddr-trfc = <1c138>;
> xlnx,ddr-trp = <4e20>;
> xlnx,ddr-trrd = <3a98>;
> xlnx,ddr-twr = <3a98>;
> xlnx,ddr-twtr = <1>;
> xlnx,edk-name = "DDR2_SDRAM_32Mx32";
> xlnx,extra-tsu = <0>;
> xlnx,idelayctrl-loc =
> "IDELAYCTRL_X0Y5-IDELAYCTRL_X0Y4-IDELAYCTRL_X0Y1-IDELAYCTRL_X0Y0";
> xlnx,include-opb-burst-support = <1>;
> xlnx,include-opb-ipif = <1>;
> xlnx,mch0-accessbuf-depth = <4>;
> xlnx,mch1-accessbuf-depth = <8>;
> xlnx,num-banks-mem = <1>;
> xlnx,num-channels = <2>;
> xlnx,num-clk-pairs = <2>;
> xlnx,num-idelayctrl = <4>;
> xlnx,reg-dimm = <0>;
> xlnx,xcl0-writexfer = <0>;
> } ;
> opb_hwicap@41300000 {
> compatible =
> "xlnx,opb-hwicap-1.10.a\0xlnx,opb-hwicap";
> reg = < 41300000 10000 >;
> xlnx,edk-name = "opb_hwicap_0";
> } ;
> opb_iic@40800000 {
> compatible =
> "xlnx,opb-iic-1.02.a\0xlnx,opb-iic";
> interrupt-parent = <101>;
> interrupts = < 2 0 >;
> reg = < 40800000 10000 >;
> xlnx,clk-freq = <5f5e100>;
> xlnx,edk-name = "IIC_EEPROM";
> xlnx,iic-freq = <186a0>;
> xlnx,ten-bit-adr = <0>;
> } ;
> opb_mdm@41400000 {
> compatible =
> "xlnx,opb-mdm-2.00.a\0xlnx,opb-mdm";
> reg = < 41400000 10000 >;
> xlnx,edk-name = "debug_module";
> xlnx,mb-dbg-ports = <1>;
> xlnx,uart-width = <8>;
> xlnx,use-uart = <1>;
> } ;
> opb_timer@41c00000 {
> compatible =
> "xlnx,opb-timer-1.00.b\0xlnx,opb-timer";
> interrupt-parent = <101>;
> interrupts = < 0 0 >;
> reg = < 41c00000 10000 >;
> xlnx,count-width = <20>;
> xlnx,edk-name = "opb_timer_1";
> xlnx,one-timer-only = <1>;
> } ;
> serial@40600000 {
> compatible =
> "xlnx,opb-uartlite-1.00.b\0xlnx,opb-uartlite";
> device_type = "serial";
> interrupt-parent = <101>;
> interrupts = < 3 0 >;
> reg = < 40600000 10000 >;
> xlnx,baudrate = <2580>;
Possibly this should be current-speed, in analogy with ns16550
devices.
> xlnx,clk-freq = <5f5e100>;
> xlnx,data-bits = <8>;
> xlnx,edk-name = "RS232_Uart_1";
> xlnx,odd-parity = <0>;
> xlnx,use-parity = <0>;
> } ;
> } ;
> } ;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* RE: [microblaze-uclinux] RE: [PATCH v3] Device tree bindings for Xilinx devices
From: Stephen Neuendorffer @ 2007-10-24 1:15 UTC (permalink / raw)
To: microblaze-uclinux, Grant Likely
Cc: linuxppc-dev, Michal Simek, Wolfgang Reissnegger
In-Reply-To: <20071019234347.38C1111C006B@mail3-dub.bigfish.com>
I've incorporated a good portion of the combined feedback and pushed the
gen_mhs_devtree patches back to Grant.
The few things I haven't done are relatively cosmetic (like getting rid
of linux,phandle references, decimal vs. hex, and the 'embedded \0')
,=20
The one significant problem that I'm not sure how to deal with pertains
to multiple memory nodes, which often happens. Should they all be
exported at the toplevel (which dtc seems to require), or only the main
memory which is used by Linux?
Some specific responses below:
>>
>> Steve
>>
>> / {
>> #address-cells =3D <1>;
>> #size-cells =3D <1>;
>> compatible =3D "ibm,plb4";
>Not quite; the bus itself needs to be one level deeper. Compatible
>here is refering to the platform itself, not the bus and so should be
>the actual board name or something similar. Maybe something like:
>"xlnx,ml403","xlnx,generic-virtex4";
perhaps the toplevel compatible node should contain a SHA1 hash of
system.mhs?
>> Ethernet_MAC {
>> compatible =3D
>> "xilinx,opb-ethernet-1.04.a\0xilinx,opb-ethernet";
>
>Yes; this is the idea; but I don't like "xilinx,opb-ethernet". I
>think we should always specify specific versions and not try to guess
>what the 'generic' device compatible interface is.
I've left this in, until we can come up with canonical compatible
versions.
(perhaps just truncating the minor version?)
I've attached one more generated test tree, in the hopes that
gen-mhs-devtree can be put to bed and used to validate Michel's BSP
oriented version. Again, the goal is not to make it perfect, but to
make it good enough that it can be a temporary bridge between the
EDK-integrated generator and those writing device drivers.
Steve
/ {
#address-cells =3D <1>;
#size-cells =3D <1>;
model =3D "system.mhs";
chosen {
bootargs =3D "root=3D/dev/xsysace/disc0/part2";
interrupt-controller =3D <101>;
} ;
cpus {
#address-cells =3D <1>;
#cpus =3D <1>;
#size-cells =3D <0>;
microblaze,6.00.b@0 {
32-bit;
clock-frequency =3D <5f5e1000>;
d-cache-line-size =3D <10>;
d-cache-size =3D <4000>;
device_type =3D "cpu";
i-cache-line-size =3D <10>;
i-cache-size =3D <4000>;
linux,boot-cpu;
reg =3D <0>;
timebase-frequency =3D <1fca055>;
xlnx,cache-byte-size =3D <4000>;
xlnx,dcache-baseaddr =3D <50000000>;
xlnx,dcache-byte-size =3D <4000>;
xlnx,dcache-highaddr =3D <5fffffff>;
xlnx,debug-enabled =3D <1>;
xlnx,div-zero-exception =3D <1>;
xlnx,dopb-bus-exception =3D <1>;
xlnx,fpu-exception =3D <1>;
xlnx,icache-baseaddr =3D <50000000>;
xlnx,icache-highaddr =3D <5fffffff>;
xlnx,ill-opcode-exception =3D <1>;
xlnx,iopb-bus-exception =3D <1>;
xlnx,number-of-pc-brk =3D <2>;
xlnx,pvr =3D <2>;
xlnx,unaligned-exceptions =3D <1>;
xlnx,use-barrel =3D <1>;
xlnx,use-dcache =3D <1>;
xlnx,use-div =3D <1>;
xlnx,use-fpu =3D <1>;
xlnx,use-icache =3D <1>;
xlnx,use-msr-instr =3D <1>;
xlnx,use-pcmp-instr =3D <1>;
} ;
} ;
memory {
device_type =3D "memory";
reg =3D < 50000000 10000000 >;
} ;
opb_v20 {
compatible =3D
"xlnx,opb-v20-1.10.c\0xlnx,opb-v20\0ibm,opb";
ethernet@40c00000 {
compatible =3D
"xlnx,opb-ethernet-1.04.a\0xlnx,opb-ethernet";
device_type =3D "network";
interrupt-parent =3D <101>;
interrupts =3D < 1 0 >;
reg =3D < 40c00000 10000 >;
xlnx,cam-exist =3D <0>;
xlnx,dev-blk-id =3D <0>;
xlnx,dev-mir-enable =3D <0>;
xlnx,dma-present =3D <1>;
xlnx,edk-name =3D "Ethernet_MAC";
xlnx,include-dev-pencoder =3D <0>;
xlnx,ipif-rdfifo-depth =3D <4000>;
xlnx,ipif-wrfifo-depth =3D <4000>;
xlnx,jumbo-exist =3D <0>;
xlnx,mac-fifo-depth =3D <10>;
xlnx,mii-exist =3D <1>;
xlnx,opb-clk-period-ps =3D <2710>;
xlnx,reset-present =3D <1>;
xlnx,rx-dre-type =3D <0>;
xlnx,rx-include-csum =3D <0>;
xlnx,tx-dre-type =3D <0>;
xlnx,tx-include-csum =3D <0>;
} ;
interrupt-controller@41200000 {
#interrupt-cells =3D <2>;
compatible =3D
"xlnx,opb-intc-1.00.c\0xlnx,opb-intc";
interrupt-controller;
linux,phandle =3D <101>;
reg =3D < 41200000 10000 >;
xlnx,edk-name =3D "opb_intc_0";
} ;
memory@50000000 {
compatible =3D
"xlnx,mch-opb-ddr2-1.02.a\0xlnx,mch-opb-ddr2";
device_type =3D "memory";
reg =3D < 50000000 10000000 >;
xlnx,ddr-async-support =3D <1>;
xlnx,ddr-awidth =3D <d>;
xlnx,ddr-bank-awidth =3D <2>;
xlnx,ddr-cas-lat =3D <3>;
xlnx,ddr-col-awidth =3D <a>;
xlnx,ddr-dwidth =3D <20>;
xlnx,ddr-tfaw =3D <c350>;
xlnx,ddr-tmrd =3D <61a8>;
xlnx,ddr-tras =3D <15f90>;
xlnx,ddr-trc =3D <fde8>;
xlnx,ddr-trcd =3D <61a8>;
xlnx,ddr-trefi =3D <7704c0>;
xlnx,ddr-trfc =3D <1c138>;
xlnx,ddr-trp =3D <4e20>;
xlnx,ddr-trrd =3D <3a98>;
xlnx,ddr-twr =3D <3a98>;
xlnx,ddr-twtr =3D <1>;
xlnx,edk-name =3D "DDR2_SDRAM_32Mx32";
xlnx,extra-tsu =3D <0>;
xlnx,idelayctrl-loc =3D
"IDELAYCTRL_X0Y5-IDELAYCTRL_X0Y4-IDELAYCTRL_X0Y1-IDELAYCTRL_X0Y0";
xlnx,include-opb-burst-support =3D <1>;
xlnx,include-opb-ipif =3D <1>;
xlnx,mch0-accessbuf-depth =3D <4>;
xlnx,mch1-accessbuf-depth =3D <8>;
xlnx,num-banks-mem =3D <1>;
xlnx,num-channels =3D <2>;
xlnx,num-clk-pairs =3D <2>;
xlnx,num-idelayctrl =3D <4>;
xlnx,reg-dimm =3D <0>;
xlnx,xcl0-writexfer =3D <0>;
} ;
opb_hwicap@41300000 {
compatible =3D
"xlnx,opb-hwicap-1.10.a\0xlnx,opb-hwicap";
reg =3D < 41300000 10000 >;
xlnx,edk-name =3D "opb_hwicap_0";
} ;
opb_iic@40800000 {
compatible =3D
"xlnx,opb-iic-1.02.a\0xlnx,opb-iic";
interrupt-parent =3D <101>;
interrupts =3D < 2 0 >;
reg =3D < 40800000 10000 >;
xlnx,clk-freq =3D <5f5e100>;
xlnx,edk-name =3D "IIC_EEPROM";
xlnx,iic-freq =3D <186a0>;
xlnx,ten-bit-adr =3D <0>;
} ;
opb_mdm@41400000 {
compatible =3D
"xlnx,opb-mdm-2.00.a\0xlnx,opb-mdm";
reg =3D < 41400000 10000 >;
xlnx,edk-name =3D "debug_module";
xlnx,mb-dbg-ports =3D <1>;
xlnx,uart-width =3D <8>;
xlnx,use-uart =3D <1>;
} ;
opb_timer@41c00000 {
compatible =3D
"xlnx,opb-timer-1.00.b\0xlnx,opb-timer";
interrupt-parent =3D <101>;
interrupts =3D < 0 0 >;
reg =3D < 41c00000 10000 >;
xlnx,count-width =3D <20>;
xlnx,edk-name =3D "opb_timer_1";
xlnx,one-timer-only =3D <1>;
} ;
serial@40600000 {
compatible =3D
"xlnx,opb-uartlite-1.00.b\0xlnx,opb-uartlite";
device_type =3D "serial";
interrupt-parent =3D <101>;
interrupts =3D < 3 0 >;
reg =3D < 40600000 10000 >;
xlnx,baudrate =3D <2580>;
xlnx,clk-freq =3D <5f5e100>;
xlnx,data-bits =3D <8>;
xlnx,edk-name =3D "RS232_Uart_1";
xlnx,odd-parity =3D <0>;
xlnx,use-parity =3D <0>;
} ;
} ;
} ;
> -----Original Message-----
> From: owner-microblaze-uclinux@itee.uq.edu.au=20
> [mailto:owner-microblaze-uclinux@itee.uq.edu.au] On Behalf Of=20
> Stephen Neuendorffer
> Sent: Friday, October 19, 2007 4:43 PM
> To: Stephen Neuendorffer; Grant Likely
> Cc: Leonid; Arnd Bergmann; microblaze-uclinux@itee.uq.edu.au;=20
> linuxppc-dev@ozlabs.org; Wolfgang Reissnegger
> Subject: [microblaze-uclinux] RE: [PATCH v3] Device tree=20
> bindings for Xilinx devices
>=20
>=20
> Here's a full .dts generated using an updated version of
> gen_mhs_devtree.py, following the proposal.
> It happens to be a microblaze system, but you get the idea.
>=20
> Grant: Is this pretty what you intend?
>=20
> Steve
>=20
> / {
> #address-cells =3D <1>;
> #size-cells =3D <1>;
> compatible =3D "ibm,plb4";
> model =3D "system.mhs";
> Ethernet_MAC {
> compatible =3D
> "xilinx,opb-ethernet-1.04.a\0xilinx,opb-ethernet";
> device_type =3D "opb_ethernet";
> interrupt-parent =3D <101>;
> interrupts =3D < 1 0 >;
> reg =3D < 40c00000 10000 >;
> xilinx,cam-exist =3D <0>;
> xilinx,dev-blk-id =3D <0>;
> xilinx,dev-mir-enable =3D <0>;
> xilinx,dma-present =3D <1>;
> xilinx,include-dev-pencoder =3D <0>;
> xilinx,ipif-rdfifo-depth =3D <4000>;
> xilinx,ipif-wrfifo-depth =3D <4000>;
> xilinx,jumbo-exist =3D <0>;
> xilinx,mac-fifo-depth =3D <10>;
> xilinx,mii-exist =3D <1>;
> xilinx,opb-clk-period-ps =3D <2710>;
> xilinx,reset-present =3D <1>;
> xilinx,rx-dre-type =3D <0>;
> xilinx,rx-include-csum =3D <0>;
> xilinx,tx-dre-type =3D <0>;
> xilinx,tx-include-csum =3D <0>;
> } ;
> IIC_EEPROM {
> compatible =3D "xilinx,opb-iic-1.02.a\0xilinx,opb-iic";
> device_type =3D "opb_iic";
> interrupt-parent =3D <101>;
> interrupts =3D < 2 0 >;
> reg =3D < 40800000 10000 >;
> xilinx,clk-freq =3D <5f5e100>;
> xilinx,iic-freq =3D <186a0>;
> xilinx,ten-bit-adr =3D <0>;
> } ;
> RS232_Uart_1 {
> compatible =3D
> "xilinx,opb-uartlite-1.00.b\0xilinx,opb-uartlite";
> device_type =3D "opb_uartlite";
> interrupt-parent =3D <101>;
> interrupts =3D < 3 0 >;
> reg =3D < 40600000 10000 >;
> xilinx,baudrate =3D <2580>;
> xilinx,clk-freq =3D <5f5e100>;
> xilinx,data-bits =3D <8>;
> xilinx,odd-parity =3D <0>;
> xilinx,use-parity =3D <0>;
> } ;
> chosen {
> bootargs =3D "root=3D/dev/xsysace/disc0/part2";
> interrupt-controller =3D <101>;
> linux,platform =3D <600>;
> } ;
> cpus {
> #address-cells =3D <1>;
> #cpus =3D <1>;
> #size-cells =3D <0>;
> microblaze_0,6.00. {
> 32-bit;
> clock-frequency =3D <5f5e1000>;
> d-cache-line-size =3D <10>;
> d-cache-size =3D <4000>;
> device_type =3D "cpu";
> i-cache-line-size =3D <10>;
> i-cache-size =3D <4000>;
> linux,boot-cpu;
> reg =3D <0>;
> timebase-frequency =3D <1fca055>;
> xilinx,cache-byte-size =3D <4000>;
> xilinx,dcache-baseaddr =3D <50000000>;
> xilinx,dcache-byte-size =3D <4000>;
> xilinx,dcache-highaddr =3D <5fffffff>;
> xilinx,debug-enabled =3D <1>;
> xilinx,div-zero-exception =3D <1>;
> xilinx,dopb-bus-exception =3D <1>;
> xilinx,fpu-exception =3D <1>;
> xilinx,icache-baseaddr =3D <50000000>;
> xilinx,icache-highaddr =3D <5fffffff>;
> xilinx,ill-opcode-exception =3D <1>;
> xilinx,iopb-bus-exception =3D <1>;
> xilinx,number-of-pc-brk =3D <2>;
> xilinx,pvr =3D <2>;
> xilinx,unaligned-exceptions =3D <1>;
> xilinx,use-barrel =3D <1>;
> xilinx,use-dcache =3D <1>;
> xilinx,use-div =3D <1>;
> xilinx,use-fpu =3D <1>;
> xilinx,use-icache =3D <1>;
> xilinx,use-msr-instr =3D <1>;
> xilinx,use-pcmp-instr =3D <1>;
> } ;
> } ;
> debug_module {
> compatible =3D "xilinx,opb-mdm-2.00.a\0xilinx,opb-mdm";
> device_type =3D "opb_mdm";
> reg =3D < 41400000 10000 >;
> xilinx,mb-dbg-ports =3D <1>;
> xilinx,uart-width =3D <8>;
> xilinx,use-uart =3D <1>;
> } ;
> memory@50000000 {
> device_type =3D "memory";
> edk_name =3D "DDR2_SDRAM_32Mx32";
> memreg:reg =3D < 50000000 10000000 >;
> } ;
> opb_hwicap_0 {
> compatible =3D
> "xilinx,opb-hwicap-1.10.a\0xilinx,opb-hwicap";
> device_type =3D "opb_hwicap";
> reg =3D < 41300000 10000 >;
> } ;
> opb_intc_0 {
> #interrupt-cells =3D <2>;
> compatible =3D "xilinx,opb-intc-1.00.c\0xilinx,opb-intc";
> device_type =3D "opb_intc";
> interrupt-controller;
> linux,phandle =3D <101>;
> reg =3D < 41200000 10000 >;
> } ;
> opb_timer_1 {
> compatible =3D
> "xilinx,opb-timer-1.00.b\0xilinx,opb-timer";
> device_type =3D "opb_timer";
> interrupt-parent =3D <101>;
> interrupts =3D < 0 0 >;
> reg =3D < 41c00000 10000 >;
> xilinx,count-width =3D <20>;
> xilinx,one-timer-only =3D <1>;
> } ;
> } ;=20
>=20
>=20
>=20
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@itee.uq.edu.au
> Project Home Page :=20
> http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive :=20
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/
>=20
>=20
>=20
^ permalink raw reply
* Re: [PATCH] DTC: Remove the need for the GLR Parser.
From: David Gibson @ 2007-10-24 1:11 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
In-Reply-To: <E1IkKge-00060g-2l@jdl.com>
On Tue, Oct 23, 2007 at 09:24:52AM -0500, Jon Loeliger wrote:
> So, like, the other day David Gibson mumbled:
> > On Mon, Oct 22, 2007 at 04:13:54PM -0500, Jon Loeliger wrote:
[snip]
> > I really thought our conflicts
> > were somewhere else. Specifically I thought the problem was that we
> > needed to look ahead more tokens that we were able to differentiate
> > between property and subnode definitions, i.e. between:
> > label propname =
> > and
> > label propname {
>
> Yes, it was. When you compute the closure of the propdef with
> the rule as a right-recursive, that's when you get the conflict.
Ah, right. Been too long since studied LR parsers, obviously.
[snip]
> > More significantly, I don't know that we want to burn our bridges with
> > glr-parser. glr-parser is a beautiful algorithm which means we can
> > use essentially whatever form of grammar is the easiest to work with
> > without having to fiddle about to ensure it's LALR(1). This could
> > still be useful if we encounter some less easily finessable grammar
> > construct in future.
>
> I'm not saying we can't use it in the future, as needed! I'm just
> saying it isn't strictly necessary now.
Sure. Sorry, I was unclear; I wasn't saying we shouldn't remove the
glr-parser option now: certainly we should remove that
right-recursion, and then we don't need it. I'm saying we shouldn't
do other things which would preclude bringing it back.
> > And even without glr-parser, I'm still uncomfortable with the
> > lexer<->parser execution ordering issues with the current
> > /dts-version/ proposal. It may now be true that the order is
> > guaranteed to be correct, but it's still not exactly obvious.
>
> I'm fine with it, and though I read your words, I'm not really
> sure why you are not.... In the long term, maybe think of it
> as a temporary hack then. We'll convert the existing DTS files
> over to the new version, and then deprecate the "dts-version 0"
> files and support and it will all go away relatively soon.
I just think that putting the version number into the token is
simpler, clearer and has no disadvantage compared to a version
integer. And will remain so if we have to bump the version again.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* libfdt: Rename and publish _fdt_next_tag()
From: David Gibson @ 2007-10-24 1:06 UTC (permalink / raw)
To: Jon Loeliger, linuxppc-dev
In-Reply-To: <20071024002852.GG10595@localhost.localdomain>
Although it's a low-level function that shouldn't normally be needed,
there are circumstances where it's useful for users of libfdt to use
the _fdt_next_tag() function. Therefore, this patch renames it to
fdt_next_tag() and publishes it in libfdt.h.
In addition, this patch adds a new testcase using fdt_next_tag(),
dtbs_equal_ordered. This testcase tests for structural equality of
two dtbs, including the order of properties and subnodes, but ignoring
NOP tags, the order of the dtb sections and the layout of strings in
the strings block. This will be useful for testing other dtc
functionality in the future.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/libfdt/fdt.c
===================================================================
--- dtc.orig/libfdt/fdt.c 2007-10-24 10:45:07.000000000 +1000
+++ dtc/libfdt/fdt.c 2007-10-24 10:45:13.000000000 +1000
@@ -90,7 +90,7 @@
return p;
}
-uint32_t _fdt_next_tag(const void *fdt, int offset, int *nextoffset)
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset)
{
const uint32_t *tagp, *lenp;
uint32_t tag;
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h 2007-10-24 10:45:11.000000000 +1000
+++ dtc/libfdt/libfdt.h 2007-10-24 10:45:13.000000000 +1000
@@ -92,8 +92,9 @@
#define fdt_offset_ptr_typed_w(fdt, offset, var) \
((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
-/* General functions */
+uint32_t fdt_next_tag(const void *fdt, int offset, int *nextoffset);
+/* General functions */
#define fdt_get_header(fdt, field) \
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c 2007-10-24 10:45:07.000000000 +1000
+++ dtc/libfdt/fdt_ro.c 2007-10-24 10:45:13.000000000 +1000
@@ -113,13 +113,13 @@
CHECK_HEADER(fdt);
- tag = _fdt_next_tag(fdt, parentoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, parentoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
@@ -229,14 +229,14 @@
if (nodeoffset % FDT_TAGSIZE)
goto fail;
- tag = _fdt_next_tag(fdt, nodeoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
goto fail;
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
err = -FDT_ERR_TRUNCATED;
@@ -302,7 +302,7 @@
CHECK_HEADER(fdt);
- tag = _fdt_next_tag(fdt, 0, &nextoffset);
+ tag = fdt_next_tag(fdt, 0, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADSTRUCTURE;
@@ -313,7 +313,7 @@
while (nextoffset <= nodeoffset) {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
return -FDT_ERR_BADOFFSET;
@@ -374,7 +374,7 @@
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
return -FDT_ERR_BADOFFSET;
@@ -439,7 +439,7 @@
CHECK_HEADER(fdt);
if (startoffset >= 0) {
- tag = _fdt_next_tag(fdt, startoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, startoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
} else {
@@ -453,7 +453,7 @@
* approach; performance can come later. */
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_BEGIN_NODE:
@@ -520,7 +520,7 @@
CHECK_HEADER(fdt);
if (startoffset >= 0) {
- tag = _fdt_next_tag(fdt, startoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, startoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
} else {
@@ -534,7 +534,7 @@
* implement approach; performance can come later. */
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_BEGIN_NODE:
Index: dtc/libfdt/fdt_rw.c
===================================================================
--- dtc.orig/libfdt/fdt_rw.c 2007-10-24 10:45:07.000000000 +1000
+++ dtc/libfdt/fdt_rw.c 2007-10-24 10:45:13.000000000 +1000
@@ -224,7 +224,7 @@
int namestroff;
int err;
- tag = _fdt_next_tag(fdt, nodeoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
@@ -298,10 +298,10 @@
return offset;
/* Try to place the new node after the parent's properties */
- _fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
+ fdt_next_tag(fdt, parentoffset, &nextoffset); /* skip the BEGIN_NODE */
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
} while (tag == FDT_PROP);
nh = _fdt_offset_ptr_w(fdt, offset);
Index: dtc/libfdt/fdt_sw.c
===================================================================
--- dtc.orig/libfdt/fdt_sw.c 2007-10-24 10:45:07.000000000 +1000
+++ dtc/libfdt/fdt_sw.c 2007-10-24 10:45:13.000000000 +1000
@@ -235,7 +235,7 @@
/* Walk the structure, correcting string offsets */
offset = 0;
- while ((tag = _fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
+ while ((tag = fdt_next_tag(fdt, offset, &nextoffset)) != FDT_END) {
if (tag == FDT_PROP) {
struct fdt_property *prop =
fdt_offset_ptr_w(fdt, offset, sizeof(*prop));
Index: dtc/libfdt/fdt_wip.c
===================================================================
--- dtc.orig/libfdt/fdt_wip.c 2007-10-24 10:45:07.000000000 +1000
+++ dtc/libfdt/fdt_wip.c 2007-10-24 10:45:13.000000000 +1000
@@ -100,12 +100,12 @@
uint32_t tag;
int offset, nextoffset;
- tag = _fdt_next_tag(fdt, nodeoffset, &nextoffset);
+ tag = fdt_next_tag(fdt, nodeoffset, &nextoffset);
if (tag != FDT_BEGIN_NODE)
return -FDT_ERR_BADOFFSET;
do {
offset = nextoffset;
- tag = _fdt_next_tag(fdt, offset, &nextoffset);
+ tag = fdt_next_tag(fdt, offset, &nextoffset);
switch (tag) {
case FDT_END:
Index: dtc/tests/dtbs_equal_ordered.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/dtbs_equal_ordered.c 2007-10-24 10:52:47.000000000 +1000
@@ -0,0 +1,139 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Tests if two given dtbs are structurally equal (including order)
+ * Copyright (C) 2007 David Gibson, IBM Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdint.h>
+
+#include <fdt.h>
+#include <libfdt.h>
+
+#include "tests.h"
+#include "testdata.h"
+
+void compare_mem_rsv(const void *fdt1, const void *fdt2)
+{
+ int i;
+ uint64_t addr1, size1, addr2, size2;
+ int err;
+
+ if (fdt_num_mem_rsv(fdt1) != fdt_num_mem_rsv(fdt2))
+ FAIL("Trees have different number of reserve entries");
+ for (i = 0; i < fdt_num_mem_rsv(fdt1); i++) {
+ err = fdt_get_mem_rsv(fdt1, i, &addr1, &size1);
+ if (err)
+ FAIL("fdt_get_mem_rsv(fdt1, %d, ...): %s", i,
+ fdt_strerror(err));
+ err = fdt_get_mem_rsv(fdt2, i, &addr2, &size2);
+ if (err)
+ FAIL("fdt_get_mem_rsv(fdt2, %d, ...): %s", i,
+ fdt_strerror(err));
+ if ((addr1 != addr2) || (size1 != size2))
+ FAIL("Mismatch in reserve entry %d: "
+ "(0x%llx, 0x%llx) != (0x%llx, 0x%llx)", i,
+ addr1, size1, addr2, size2);
+ }
+}
+
+void compare_structure(const void *fdt1, const void *fdt2)
+{
+ int nextoffset1 = 0, nextoffset2 = 0;
+ int offset1, offset2;
+ uint32_t tag1, tag2;
+ const char *name1, *name2;
+ int err;
+ const struct fdt_property *prop1, *prop2;
+ int len1, len2;
+
+ while (1) {
+ do {
+ offset1 = nextoffset1;
+ tag1 = fdt_next_tag(fdt1, offset1, &nextoffset1);
+ } while (tag1 == FDT_NOP);
+ do {
+ offset2 = nextoffset2;
+ tag2 = fdt_next_tag(fdt2, offset2, &nextoffset2);
+ } while (tag2 == FDT_NOP);
+
+ if (tag1 != tag2)
+ FAIL("Tag mismatch (%d != %d) at (%d, %d)",
+ tag1, tag2, offset1, offset2);
+
+ switch (tag1) {
+ case FDT_BEGIN_NODE:
+ name1 = fdt_get_name(fdt1, offset1, &err);
+ if (!name1)
+ FAIL("fdt_get_name(fdt1, %d, ..): %s",
+ offset1, fdt_strerror(err));
+ name2 = fdt_get_name(fdt2, offset2, NULL);
+ if (!name2)
+ FAIL("fdt_get_name(fdt2, %d, ..): %s",
+ offset2, fdt_strerror(err));
+ if (!streq(name1, name2))
+ FAIL("Name mismatch (\"%s\" != \"%s\") at (%d, %d)",
+ name1, name2, offset1, offset2);
+ break;
+
+ case FDT_PROP:
+ prop1 = fdt_offset_ptr_typed(fdt1, offset1, prop1);
+ if (!prop1)
+ FAIL("Could get fdt1 property at %d", offset1);
+ prop2 = fdt_offset_ptr_typed(fdt2, offset2, prop2);
+ if (!prop2)
+ FAIL("Could get fdt2 property at %d", offset2);
+
+ name1 = fdt_string(fdt1, fdt32_to_cpu(prop1->nameoff));
+ name2 = fdt_string(fdt2, fdt32_to_cpu(prop2->nameoff));
+ if (!streq(name1, name2))
+ FAIL("Property name mismatch \"%s\" != \"%s\" "
+ "at (%d, %d)", name1, name2, offset1, offset2);
+ len1 = fdt32_to_cpu(prop1->len);
+ len2 = fdt32_to_cpu(prop2->len);
+ if (len1 != len2)
+ FAIL("Property length mismatch %u != %u "
+ "at (%d, %d)", len1, len2, offset1, offset2);
+
+ if (memcmp(prop1->data, prop2->data, len1) != 0)
+ FAIL("Property value mismatch at (%d, %d)",
+ offset1, offset2);
+ break;
+
+ case FDT_END:
+ return;
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ void *fdt1, *fdt2;
+
+ test_init(argc, argv);
+ if (argc != 3)
+ CONFIG("Usage: %s <dtb file> <dtb file>", argv[0]);
+ fdt1 = load_blob(argv[1]);
+ fdt2 = load_blob(argv[2]);
+
+ compare_mem_rsv(fdt1, fdt2);
+ compare_structure(fdt1, fdt2);
+
+ PASS();
+}
Index: dtc/tests/Makefile.tests
===================================================================
--- dtc.orig/tests/Makefile.tests 2007-10-24 10:45:07.000000000 +1000
+++ dtc/tests/Makefile.tests 2007-10-24 10:45:13.000000000 +1000
@@ -8,7 +8,7 @@
sw_tree1 \
move_and_save \
open_pack rw_tree1 setprop del_property del_node \
- string_escapes
+ string_escapes dtbs_equal_ordered
LIB_TESTS = $(LIB_TESTS_L:%=$(TESTS_PREFIX)%)
LIBTREE_TESTS_L = truncated_property
Index: dtc/tests/tests.h
===================================================================
--- dtc.orig/tests/tests.h 2007-10-24 10:45:07.000000000 +1000
+++ dtc/tests/tests.h 2007-10-24 10:45:13.000000000 +1000
@@ -129,7 +129,7 @@
#define check_getprop_string(fdt, nodeoffset, name, s) \
check_getprop((fdt), (nodeoffset), (name), strlen(s)+1, (s))
int nodename_eq(const char *s1, const char *s2);
-//void *load_blob(const char *filename);
+void *load_blob(const char *filename);
void *load_blob_arg(int argc, char *argv[]);
void save_blob(const char *filename, void *blob);
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-10-24 10:45:07.000000000 +1000
+++ dtc/tests/run_tests.sh 2007-10-24 10:45:13.000000000 +1000
@@ -104,6 +104,7 @@
run_test dtc.sh -I dts -O dtb -o dtc_tree1.test.dtb test_tree1.dts
tree1_tests dtc_tree1.test.dtb
tree1_tests_rw dtc_tree1.test.dtb
+ run_test dtbs_equal_ordered dtc_tree1.test.dtb test_tree1.dtb
run_test dtc.sh -I dts -O dtb -o dtc_escapes.test.dtb escapes.dts
run_test string_escapes dtc_escapes.test.dtb
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* libfdt: Rename and publish _fdt_check_header()
From: David Gibson @ 2007-10-24 0:28 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
It's potentially useful for users of libfdt to sanity check a device
tree (or, rather, a blob of data which may or may not be a device
tree) before processing it in more detail with libfdt.
This patch renames the libfdt internal function _fdt_check_header() to
fdt_check_header() and makes it a published function, so it can now be
used for this purpose.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/libfdt/fdt.c
===================================================================
--- dtc.orig/libfdt/fdt.c 2007-10-24 10:24:58.000000000 +1000
+++ dtc/libfdt/fdt.c 2007-10-24 10:25:12.000000000 +1000
@@ -55,7 +55,7 @@
#include "libfdt_internal.h"
-int _fdt_check_header(const void *fdt)
+int fdt_check_header(const void *fdt)
{
if (fdt_magic(fdt) == FDT_MAGIC) {
/* Complete tree */
@@ -143,7 +143,7 @@
int fdt_move(const void *fdt, void *buf, int bufsize)
{
- int err = _fdt_check_header(fdt);
+ int err = fdt_check_header(fdt);
if (err)
return err;
Index: dtc/libfdt/libfdt.h
===================================================================
--- dtc.orig/libfdt/libfdt.h 2007-10-24 10:23:48.000000000 +1000
+++ dtc/libfdt/libfdt.h 2007-10-24 10:24:49.000000000 +1000
@@ -79,6 +79,22 @@
#define FDT_ERR_MAX 12
+/* Low-level functions (you probably don't need these) */
+
+const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
+static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
+{
+ return (void *)fdt_offset_ptr(fdt, offset, checklen);
+}
+
+
+#define fdt_offset_ptr_typed(fdt, offset, var) \
+ ((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
+#define fdt_offset_ptr_typed_w(fdt, offset, var) \
+ ((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
+
+/* General functions */
+
#define fdt_get_header(fdt, field) \
(fdt32_to_cpu(((const struct fdt_header *)(fdt))->field))
#define fdt_magic(fdt) (fdt_get_header(fdt, magic))
@@ -95,18 +111,7 @@
#define fdt_set_header(fdt, field, val) \
((struct fdt_header *)(fdt))->field = cpu_to_fdt32(val)
-const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
-static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
-{
- return (void *)fdt_offset_ptr(fdt, offset, checklen);
-}
-
-
-#define fdt_offset_ptr_typed(fdt, offset, var) \
- ((typeof(var))(fdt_offset_ptr((fdt), (offset), sizeof(*(var)))))
-#define fdt_offset_ptr_typed_w(fdt, offset, var) \
- ((typeof(var))(fdt_offset_ptr_w((fdt), (offset), sizeof(*(var)))))
-
+int fdt_check_header(const void *fdt);
int fdt_move(const void *fdt, void *buf, int bufsize);
/* Read-only functions */
Index: dtc/libfdt/libfdt_internal.h
===================================================================
--- dtc.orig/libfdt/libfdt_internal.h 2007-10-24 10:23:40.000000000 +1000
+++ dtc/libfdt/libfdt_internal.h 2007-10-24 10:23:45.000000000 +1000
@@ -58,7 +58,6 @@
#define memeq(p, q, n) (memcmp((p), (q), (n)) == 0)
#define streq(p, q) (strcmp((p), (q)) == 0)
-int _fdt_check_header(const void *fdt);
uint32_t _fdt_next_tag(const void *fdt, int startoffset, int *nextoffset);
const char *_fdt_find_string(const char *strtab, int tabsize, const char *s);
int _fdt_node_end_offset(void *fdt, int nodeoffset);
Index: dtc/libfdt/fdt_ro.c
===================================================================
--- dtc.orig/libfdt/fdt_ro.c 2007-10-24 10:25:24.000000000 +1000
+++ dtc/libfdt/fdt_ro.c 2007-10-24 10:25:44.000000000 +1000
@@ -58,7 +58,7 @@
#define CHECK_HEADER(fdt) \
{ \
int err; \
- if ((err = _fdt_check_header(fdt)) != 0) \
+ if ((err = fdt_check_header(fdt)) != 0) \
return err; \
}
@@ -193,7 +193,7 @@
const struct fdt_node_header *nh;
int err;
- if ((err = _fdt_check_header(fdt)) != 0)
+ if ((err = fdt_check_header(fdt)) != 0)
goto fail;
err = -FDT_ERR_BADOFFSET;
@@ -222,7 +222,7 @@
int offset, nextoffset;
int err;
- if ((err = _fdt_check_header(fdt)) != 0)
+ if ((err = fdt_check_header(fdt)) != 0)
goto fail;
err = -FDT_ERR_BADOFFSET;
Index: dtc/libfdt/fdt_rw.c
===================================================================
--- dtc.orig/libfdt/fdt_rw.c 2007-10-24 10:25:52.000000000 +1000
+++ dtc/libfdt/fdt_rw.c 2007-10-24 10:25:56.000000000 +1000
@@ -59,7 +59,7 @@
{
int err;
- if ((err = _fdt_check_header(fdt)))
+ if ((err = fdt_check_header(fdt)))
return err;
if (fdt_version(fdt) < 0x11)
return -FDT_ERR_BADVERSION;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCH] pasemi_mac: fix typo
From: Jeff Garzik @ 2007-10-24 0:23 UTC (permalink / raw)
To: Olof Johansson; +Cc: netdev, linuxppc-dev
In-Reply-To: <20071020191003.GB30034@lixom.net>
Olof Johansson wrote:
> Add missing &:
>
> drivers/net/pasemi_mac.c: In function 'pasemi_mac_clean_rx':
> drivers/net/pasemi_mac.c:553: warning: passing argument 1 of 'prefetch'
> makes pointer from integer without a cast
>
>
> Signed-off-by: Olof Johansson <olof@lixom.net>
>
> diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
> index 9f9a421..ab4d309 100644
> --- a/drivers/net/pasemi_mac.c
> +++ b/drivers/net/pasemi_mac.c
> @@ -550,7 +550,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
>
> n = mac->rx->next_to_clean;
>
> - prefetch(RX_RING(mac, n));
> + prefetch(&RX_RING(mac, n));
>
> for (count = 0; count < limit; count++) {
> macrx = RX_RING(mac, n);
applied
^ permalink raw reply
* RE: Root file system for powerpc 74xx board
From: Bill Farrow @ 2007-10-23 23:58 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <4ac2955e0710230755m318a9fdeq9b8074a819b8797c@mail.gmail.com>
> I have=A0 Linux running on an intel x86 machine with cross
> development environment. I want to host 74xx file system
> with Xfree86 and library support=A0 on the intel machine.=20
>
> I will boot the file system using NFS to the 74xx system.
>
> How to create/extract the file system with xfree86 support from fedora =
file system=A0 ?
I'm not sure if Fedora Linux has a Live CD that you can download for PPC =
machines. We used an Ubuntu (Live) CD for our setup. In our case the =
CD is bootable and contains a file called filesyste.squashfs that is a =
full desktop root filesystem with Xorg, all compiled for PPC. You wont =
be able to unpack the squashfs file on your x86 Host because of the byte =
ordering, so you need to use your PPC target to do the work.
Mount the CDROM iso image on your x86 Host and then export this via NFS =
to your PPC target
Host# sudo mount -o loop -t iso9660 ubuntu-6.10-desktop-powerpc.iso =
/mnt/
Host# sudo mkdir /opt/ubuntu
Host# sudo vi /etc/exports
/mnt 192.168.0.0/255.255.255.0(rw,no_root_squash,sync)
/opt/ubuntu 192.168.0.0/255.255.255.0(rw,no_root_squash,sync)
Use the Target to mount via nfs the Hosts /mnt/ directory that you =
exported, then mount via loopback the filesystem.squashfs and copy the =
contents back to the Host's nfs exported /mnt/ directory.
Target# mount host_ip_address:/mnt/ /mnt/host
Target# mount /mnt/host/casper/filesystem.squashfs /mnt/squashfs
Target# mount host_ip_address:/ubuntu/ /mnt/ubuntu
Target# cp -a /mnt/squashfs /mnt/ubuntu
I'm writing this from memory, so the above commands may be incorrect but =
the general idea and flow should be OK.
Bill
^ permalink raw reply
* Re: [microblaze-uclinux] Re: [microblaze-uclinux] RE: [PATCH v3] Device tree bindings for Xilinx devices
From: David Gibson @ 2007-10-24 0:05 UTC (permalink / raw)
To: Michal Simek; +Cc: microblaze-uclinux, Wolfgang Reissnegger, linuxppc-dev
In-Reply-To: <1815.2979-14673-964852328-1193124877@seznam.cz>
On Tue, Oct 23, 2007 at 09:34:37AM +0200, Michal Simek wrote:
> Hi David,
> I remove some labels from my generator. I created fake system with some peripherals.
> There are 3 buses and 3 bridges.
> Can you check it and tell me what is wrong?
Grant's comments all seem reasonable, apologies if I've duplicated
some of them below.
>
> Thanks,
> Michal Simek
>
> / {
> model = "mONStR";
You should have #address-cells and #size-cells properties.
> chosen {
> bootargs = "root=/dev/xsysace/disc0/part2";
> } ;
> cpus {
> #size-cells = <0>;
> #cpus = < 0 >;
> #address-cells = <1>;
> microblaze_0,5.00.c@0 {
That name is acceptable, but I think just cpu@0 would be better. The
generic names convention seems to be frequently ignored for cpus, but
I don't see a good reason to.
> device_type = "cpu";
> reg = <0>;
> clock-frequency = <5f5e1000>;
> timebase-frequency = <1FCA055>;
> i-cache-line-size = <2000>;
> i-cache-size = <10>;
> d-cache-line-size = <2000>;
> d-cache-size = <10>;
> xilinx,pvr = <0>;
> xilinx,debug-enabled = <1>;
> xilinx,fsl-links = <0>;
> } ;
> } ;
>
> ethernet@10060000 {
> compatible = "opb_ethernet_1.04.a","opb_ethernet";
> interrupts = < 3 0 >;
> reg = < 10060000 10000 >;
> device_type = "network";
> xilinx,cam-exist = <0>;
> xilinx,dev-blk-id = <1>;
> xilinx,dev-mir-enable = <1>;
> xilinx,dma-present = <1>;
> xilinx,include-dev-pencoder = <1>;
> xilinx,ipif-rdfifo-depth = <8000>;
> xilinx,ipif-wrfifo-depth = <8000>;
> xilinx,mii-exist = <1>;
> } ;
> memory@20000000 {
> memreg:reg = < 20000000 10000000 >;
> device_type = "memory";
> } ;
> serial@10030000 {
> compatible = "opb_uart16550_1.00.d","opb_uart16550";
Is this serial port actually 16550 compatible? If so it should have
"ns16550" in the compatible list.
> reg = < 10030000 10000 >;
> device_type = "serial";
> } ;
> opb_timer@10020000 {
> compatible = "opb_timer_1.00.b","opb_timer";
> interrupts = < 0 0 >;
> reg = < 10020000 10000 >;
> xilinx,count-width = <20>;
> xilinx,one-timer-only = <0>;
> } ;
> opb_opb_lite@30000000 {
This is a bus bridge, and so needs #address-cells and #size-cells
properties. It should also have a compatible property to describe the
type of bridge.
> ranges = < 0 30000000 10000000 >;
> opb_gpio@30020000 {
> compatible = "opb_gpio_3.01.b","opb_gpio";
> reg = < 30020000 10000 >;
This doesn't look quite right. The reg property is translated by the
parent's ranges property. So shouldn't this be just reg = <20000
10000>, with the 30000000 added by the parent?
> xilinx,gpio-width = <4>;
> xilinx,is-dual = <0>;
> } ;
> i2c@30030000 {
> compatible = "opb_iic_1.02.a","opb_iic";
> reg = < 30030000 10000 >;
> device_type = "i2c";
There was talk of an i2c device_type, but I don't think it ever
actually happened. I think we should drop this.
> } ;
>
> opb_gpio@30010000 {
> compatible = "opb_gpio_3.01.b","opb_gpio";
> reg = < 30010000 10000 >;
> xilinx,gpio-width = <20>;
> xilinx,is-dual = <0>;
> } ;
> ethernet@30040000 {
> compatible = "opb_ethernetlite_1.01.b","opb_ethernetlite";
> reg = < 30040000 10000 >;
> device_type = "network";
> xilinx,duplex = <1>;
> xilinx,rx-ping-pong = <0>;
> xilinx,tx-ping-pong = <0>;
> } ;
> opb_sysace@30050000 {
> compatible = "opb_sysace_1.00.c","opb_sysace";
> reg = < 30050000 10000 >;
> xilinx,mem-width = <10>;
> } ;
> opb_ps2_dual_ref@30060000 {
> compatible = "opb_ps2_dual_ref_1.00.a","opb_ps2_dual_ref";
> interrupts = < 2 0 >;
> interrupts = < 1 0 >;
Uh... duplicate property names here. Should be
interrupts = <2 0 1 0>;
Also you need an interrupt-parent property somewhere. Either here, or
in one of the ancestor bridges.
> reg = < 30060000 10000 >;
> } ;
> };
> opb_intc@10010000 {
> compatible = "opb_intc_1.00.c","opb_intc";
> reg = < 10010000 10000 >;
Is this an interrupt controller? If so it should have the
interrupt-controller and #interrupt-cells properties.
> } ;
> opb_mdm@10050000 {
> compatible = "opb_mdm_2.00.a","opb_mdm";
> reg = < 10050000 10000 >;
> xilinx,mb-dbg-ports = <1>;
> xilinx,uart-width = <8>;
> xilinx,use-uart = <1>;
> } ;
> serial@10040000 {
> compatible = "opb_uartlite_1.00.b","opb_uartlite";
> interrupts = < 4 0 >;
> reg = < 10040000 10000 >;
> device_type = "serial";
> xilinx,baudrate = <2580>;
> xilinx,data-bits = <8>;
> xilinx,clk-freq = <5f5e100>;
> xilinx,odd-parity = <0>;
> xilinx,use-parity = <0>;
> } ;
> opb2plb_bridge@80000000 {
> ranges = < 0 80000000 80000000 >;
Missing #address-cells and #size-cells again.
> serial@a0020000 {
> compatible = "plb_uart16550_1.00.c","plb_uart16550";
> reg = < a0020000 10000 >;
> device_type = "serial";
> } ;
> plb_gpio@a0010000 {
> compatible = "plb_gpio_1.00.b","plb_gpio";
> reg = < a0010000 10000 >;
> xilinx,gpio-width = <20>;
> xilinx,is-dual = <0>;
> } ;
> ethernet@a0000000 {
> compatible = "plb_ethernet_1.01.a","plb_ethernet";
> reg = < a0000000 10000 >;
> device_type = "network";
> } ;
> plb2opb_bridge@10000000 {
> ranges = < 0 10000000 10000000 >;
> ranges = < 1 20000000 10000000 >;
Duplicate properties again.
> };
> cpus {
This really doesn't look right. I don't think it's technically
forbidden, but almost nothing is going to look for cpus anywhere other
than /cpus. If this dt is for some sort of daughter card, and these
entries represent the cpu of the containing system, we'll need to work
out a different representation (that won't have device_type="cpu").
Although it may be a cpu, it's not *the* cpu from the prespective of
something running on the microblaze.
> #size-cells = <0>;
> #cpus = < 1 >;
> #address-cells = <1>;
> ppc405_0,405@1 {
> device_type = "cpu";
> reg = <0>;
> clock-frequency = <5f5e1000>;
> timebase-frequency = <1FCA055>;
> } ;
> } ;
> };
> } ;
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCH 02/11] [POWERPC] Add 'lpb' bus type for MPC5200 LocalPlus Bus
From: Olof Johansson @ 2007-10-24 0:09 UTC (permalink / raw)
To: Marian Balakowicz; +Cc: linuxppc-dev
In-Reply-To: <20071023231315.29359.87832.stgit@hekate.izotz.org>
Hi,
On Wed, Oct 24, 2007 at 01:13:15AM +0200, Marian Balakowicz wrote:
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---
Your patch lacks any kind of description beyond the title. (I know, it's a
real simple patch, but a real simple description would do too :)
> --- a/arch/powerpc/kernel/of_platform.c
> +++ b/arch/powerpc/kernel/of_platform.c
> @@ -49,6 +49,7 @@ static struct of_device_id of_default_bus_ids[] = {
> { .type = "plb4", },
> { .type = "opb", },
> { .type = "ebc", },
> + { .type = "lpb", },
I thought it was consensus to keep the new bus ids only in platform
code and not add them to the default list, and just pass that list in
to of_platform_bus_probe().
-Olof
^ permalink raw reply
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