* [PATCH 09/11] dtc: add a testcase with labels
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Create a source file with labels for use as a testcase
to check parsing dts files.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
I started with the existing test01.dts and added labels and
a labeled subnode.
The labels could instead be added to that file if desired,
but that would mean the output of the compiler would not
match the input when writing dts from dts or dtb input.
I haven't studied how to use the new testsuite to check
the result. Initially I was going to suggest diff on the
asm output, but with the libfdt library we could write a
test to change the property and reserve contents then
use the library to fetch and compare.
Index: dtc/tests/label01.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/label01.dts 2007-06-14 22:17:39.000000000 -0500
@@ -0,0 +1,60 @@
+/memreserve/ 1000000000000000 0000000002000000;
+memrsv2: /memreserve/ 2000000000000000-20ffffffffffffff;
+/memreserve/ 0-13;
+
+/ {
+ model = "MyBoardName";
+ compatible = "MyBoardName", "MyBoardFamilyName";
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ cpus {
+ linux,phandle = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ PowerPC,970@0 {
+ name = "PowerPC,970";
+ device_type = "cpu";
+ reg = <0>;
+ clock-frequency = <5f5e1000>;
+ timebase-frequency = <1FCA055>;
+ linux,boot-cpu;
+ i-cache-size = <10000>;
+ d-cache-size = <8000>;
+ };
+
+ PowerPC,970@1 {
+ name = "PowerPC,970";
+ device_type = "cpu";
+ reg = <1>;
+ clock-frequency = <5f5e1000>;
+ timebase-frequency = <1FCA055>;
+ i-cache-size = <10000>;
+ d-cache-size = <8000>;
+ };
+
+ };
+
+ node: randomnode {
+ prop: string = data: "\xff\0stuffstuff\t\t\t\n\n\n" data_end: ;
+ blob = [byte: 0a 0b 0c 0d de ea ad be ef byte_end: ];
+ ref = < cell: &/memory@0 cell_end: >;
+ mixed = "abc", pre: [1234] post: , gap: < aligned: a b c>;
+ subnode: child {
+ };
+ /* subnode_end: is auto-generated by node emit */
+ };
+ /* node_end: is auto-generated by node emit */
+
+ memory@0 {
+ device_type = "memory";
+ memreg: reg = <00000000 00000000 00000000 20000000>;
+ };
+
+ chosen {
+ bootargs = "root=/dev/sda2";
+ linux,platform = <00000600>;
+ };
+
+};
+
^ permalink raw reply
* [PATCH 10/11] dtc: align header comments in asm output
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Insert tabs to align the comments describing the fields of the
boot parameters header struct.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
Previously some of the comments were seperated by one space and
others by one tab from the field.
Purely cosmetic, but then so are the comments.
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2007-06-20 03:13:25.000000000 -0500
+++ dtc/flattree.c 2007-06-20 03:13:51.000000000 -0500
@@ -469,21 +469,21 @@ void dt_to_asm(FILE *f, struct boot_info
emit_label(f, symprefix, "blob_start");
emit_label(f, symprefix, "header");
- fprintf(f, "\t.long\tOF_DT_HEADER /* magic */\n");
- fprintf(f, "\t.long\t_%s_blob_abs_end - _%s_blob_start /* totalsize */\n",
+ fprintf(f, "\t.long\tOF_DT_HEADER\t\t\t\t/* magic */\n");
+ fprintf(f, "\t.long\t_%s_blob_abs_end - _%s_blob_start\t/* totalsize */\n",
symprefix, symprefix);
- fprintf(f, "\t.long\t_%s_struct_start - _%s_blob_start /* off_dt_struct */\n",
+ fprintf(f, "\t.long\t_%s_struct_start - _%s_blob_start\t/* off_dt_struct */\n",
symprefix, symprefix);
- fprintf(f, "\t.long\t_%s_strings_start - _%s_blob_start /* off_dt_strings */\n",
+ fprintf(f, "\t.long\t_%s_strings_start - _%s_blob_start\t/* off_dt_strings */\n",
symprefix, symprefix);
- fprintf(f, "\t.long\t_%s_reserve_map - _%s_blob_start /* off_dt_strings */\n",
+ fprintf(f, "\t.long\t_%s_reserve_map - _%s_blob_start\t/* off_dt_strings */\n",
symprefix, symprefix);
- fprintf(f, "\t.long\t%d /* version */\n", vi->version);
- fprintf(f, "\t.long\t%d /* last_comp_version */\n",
+ fprintf(f, "\t.long\t%d\t\t\t\t\t/* version */\n", vi->version);
+ fprintf(f, "\t.long\t%d\t\t\t\t\t/* last_comp_version */\n",
vi->last_comp_version);
if (vi->flags & FTF_BOOTCPUID)
- fprintf(f, "\t.long\t%i\t/*boot_cpuid_phys*/\n",
+ fprintf(f, "\t.long\t%i\t\t\t\t\t/* boot_cpuid_phys */\n",
boot_cpuid_phys);
if (vi->flags & FTF_STRTABSIZE)
^ permalink raw reply
* [PATCH 08/11] dtc: store labels in asscending order
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
When adding a label, walk to the end of the list since the
label reflects the end of the data.
Since merging data buffers already preserved the order, this
will cause the labels to be emitted in order when writing
assembly output.
It should also aid emiting labels when writing dts output
should that be added in the future (data formatting would
need to break at each label).
Signed-off-by: Milton Miller <miltonm@bga.com>
---
Currently cosmetic as the labels will be on the correct
data either way.
Index: dtc/data.c
===================================================================
--- dtc.orig/data.c 2007-06-14 21:39:34.000000000 -0500
+++ dtc/data.c 2007-06-14 21:50:52.000000000 -0500
@@ -301,16 +301,22 @@ struct data data_add_fixup(struct data d
struct data data_add_label(struct data d, char *label)
{
- struct fixup *f;
+ struct fixup *f, **p;
struct data nd;
f = xmalloc(sizeof(*f));
f->offset = d.len;
f->ref = label;
- f->next = d.labels;
nd = d;
- nd.labels = f;
+ p = &nd.labels;
+
+ /* adding to end keeps them sorted */
+ while (*p)
+ p = &((*p)->next);
+
+ f->next = *p;
+ *p = f;
return nd;
}
^ permalink raw reply
* [PATCH 07/11] dtc: implement labels on property data
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Extend the parser grammer to allow labels before or after any
property data (string, cell list, or byte list), and any
byte or cell within the property data.
Store the labels using the same linked list structure as node
references using in a parallel list.
When writing assembly output emit global labels as offsets from
the start of the definition of the data.
Note that the alignment for a cell list is done as part of the
opening < delimiter, not the = or , before it. To label a cell
after a string or byte list put the label inside the cell list.
For example,
prop = zero: [ aa bb ], two: < four: 1234 > eight: ;
will produce labels with offsets 0, 2, 4, and 8 bytes from
the beginning of the data for property prop.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
The testcase in the following patch will also note in the source
tree the gap between labels two and four above.
I took out the explcit list of fields in emtpy_data because it
would have required a third line to add the label field and all
fields were initialized to the default value.
Index: dtc/data.c
===================================================================
--- dtc.orig/data.c 2007-06-14 06:52:52.000000000 -0500
+++ dtc/data.c 2007-06-14 16:18:12.000000000 -0500
@@ -29,12 +29,17 @@ void fixup_free(struct fixup *f)
void data_free(struct data d)
{
- struct fixup *f;
+ struct fixup *f, *nf;
f = d.refs;
while (f) {
- struct fixup *nf;
+ nf = f->next;
+ fixup_free(f);
+ f = nf;
+ }
+ f = d.labels;
+ while (f) {
nf = f->next;
fixup_free(f);
f = nf;
@@ -198,27 +203,36 @@ struct data data_append_data(struct data
return d;
}
-struct data data_merge(struct data d1, struct data d2)
+void fixup_merge(struct fixup **fd, struct fixup **fd2, int d1_len)
{
- struct data d;
struct fixup **ff;
struct fixup *f, *f2;
- d = data_append_data(d1, d2.val, d2.len);
-
/* Extract d2's fixups */
- f2 = d2.refs;
- d2.refs = NULL;
+ f2 = *fd2;
+ *fd2 = NULL;
/* Tack them onto d's list of fixups */
- ff = &d.refs;
+ ff = fd;
while (*ff)
ff = &((*ff)->next);
*ff = f2;
/* And correct them for their new position */
for (f = f2; f; f = f->next)
- f->offset += d1.len;
+ f->offset += d1_len;
+
+
+}
+
+struct data data_merge(struct data d1, struct data d2)
+{
+ struct data d;
+
+ d = data_append_data(d1, d2.val, d2.len);
+
+ fixup_merge(&d.refs, &d2.refs, d1.len);
+ fixup_merge(&d.labels, &d2.labels, d1.len);
data_free(d2);
@@ -285,6 +299,22 @@ struct data data_add_fixup(struct data d
return nd;
}
+struct data data_add_label(struct data d, char *label)
+{
+ struct fixup *f;
+ struct data nd;
+
+ f = xmalloc(sizeof(*f));
+ f->offset = d.len;
+ f->ref = label;
+ f->next = d.labels;
+
+ nd = d;
+ nd.labels = f;
+
+ return nd;
+}
+
int data_is_one_string(struct data d)
{
int i;
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y 2007-06-14 06:52:52.000000000 -0500
+++ dtc/dtc-parser.y 2007-06-14 06:52:52.000000000 -0500
@@ -131,9 +131,11 @@ propdata: propdataprefix DT_STRING { $$
$$ = data_merge(data_append_align($1, sizeof(cell_t)), $3);
}
| propdataprefix '[' bytestring ']' { $$ = data_merge($1, $3); }
+ | propdata DT_LABEL { $$ = data_add_label($1, $2); }
;
propdataprefix: propdata ',' { $$ = $1; }
+ | propdataprefix DT_LABEL { $$ = data_add_label($1, $2); }
| /* empty */ { $$ = empty_data; }
;
@@ -150,10 +152,12 @@ celllist: celllist opt_cell_base DT_CELL
| celllist DT_REF {
$$ = data_append_cell(data_add_fixup($1, $2), -1);
}
+ | celllist DT_LABEL { $$ = data_add_label($1, $2); }
| /* empty */ { $$ = empty_data; }
;
bytestring: bytestring DT_BYTE { $$ = data_append_byte($1, $2); }
+ | bytestring DT_LABEL { $$ = data_add_label($1, $2); }
| /* empty */ { $$ = empty_data; }
;
Index: dtc/dtc.h
===================================================================
--- dtc.orig/dtc.h 2007-06-14 06:52:17.000000000 -0500
+++ dtc/dtc.h 2007-06-14 16:59:49.000000000 -0500
@@ -111,10 +111,10 @@ struct data {
char *val;
int asize;
struct fixup *refs;
+ struct fixup *labels;
};
-#define empty_data \
- ((struct data){.len = 0, .val = NULL, .asize = 0, .refs = NULL})
+#define empty_data ((struct data){ /* all .members = 0 or NULL */ })
void fixup_free(struct fixup *f);
void data_free(struct data d);
@@ -135,6 +135,7 @@ struct data data_append_zeroes(struct da
struct data data_append_align(struct data d, int align);
struct data data_add_fixup(struct data d, char *ref);
+struct data data_add_label(struct data d, char *label);
int data_is_one_string(struct data d);
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2007-06-14 06:52:52.000000000 -0500
+++ dtc/flattree.c 2007-06-14 06:52:52.000000000 -0500
@@ -121,6 +121,12 @@ static void emit_label(FILE *f, char *pr
fprintf(f, "_%s_%s:\n", prefix, label);
}
+static void emit_offset_label(FILE *f, char *label, int offset)
+{
+ fprintf(f, "\t.globl\t%s\n", label);
+ fprintf(f, "%s\t= . + %d\n", label, offset);
+}
+
static void asm_emit_cell(void *e, cell_t val)
{
FILE *f = e;
@@ -157,6 +163,13 @@ static void asm_emit_data(void *e, struc
{
FILE *f = e;
int off = 0;
+ struct fixup *l;
+
+ l = d.labels;
+ while (l) {
+ emit_offset_label(f, l->ref, l->offset);
+ l = l->next;
+ }
while ((d.len - off) >= sizeof(u32)) {
fprintf(f, "\t.long\t0x%x\n",
^ permalink raw reply
* [PATCH 06/11] dtc: allow a label: in any dts context
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Change the lexer to recognise a label in any context. Place
before other celldata and bytestrings to avoid the initial
characters being stolen by other matches.
A label is a character sequence starting with an alphabetic
or underscore optinally followed by the same plus digits and
terminating in a colon.
The included terminating colon will prevent matching hex numbers.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
The following patches parse matches in CELLDATA and BYTESTRING
in addition to the current INITIAL context; matches in MEMRESERVE
and INCLUDE context will not be parsed.
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 77ccd54..0e356bb 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -107,6 +107,16 @@ #endif
BEGIN(INITIAL);
return ';';
}
+
+<*>[a-zA-Z_][a-zA-Z0-9_]*: {
+ yylloc.filenum = srcpos_filenum;
+ yylloc.first_line = yylineno;
+ DPRINT("Label: %s\n", yytext);
+ yylval.str = strdup(yytext);
+ yylval.str[yyleng-1] = '\0';
+ return DT_LABEL;
+ }
+
<CELLDATA>[bodh]# {
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
@@ -189,15 +199,6 @@ #endif
}
-[a-zA-Z_][a-zA-Z0-9_]*: {
- yylloc.filenum = srcpos_filenum;
- yylloc.first_line = yylineno;
- DPRINT("Label: %s\n", yytext);
- yylval.str = strdup(yytext);
- yylval.str[yyleng-1] = '\0';
- return DT_LABEL;
- }
-
<*>{WS}+ /* eat whitespace */
<*>"/*"([^*]|\*+[^*/])*\*+"/" {
^ permalink raw reply related
* [PATCH 04/11] dtc: implement labels on memory reserve slots
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Allow a label to be placed on a memory reserve entry.
Change the parser to recogonise and store them. Emit
them when writing assembly output.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
The infrastructure for storing the label was already present, so
the changes are small.
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y 2007-06-14 22:59:05.000000000 -0500
+++ dtc/dtc-parser.y 2007-06-14 22:59:07.000000000 -0500
@@ -92,11 +92,11 @@ memreserves: memreserve memreserves {
}
;
-memreserve: DT_MEMRESERVE DT_ADDR DT_ADDR ';' {
- $$ = build_reserve_entry($2, $3, NULL);
+memreserve: label DT_MEMRESERVE DT_ADDR DT_ADDR ';' {
+ $$ = build_reserve_entry($3, $4, $1);
}
- | DT_MEMRESERVE DT_ADDR '-' DT_ADDR ';' {
- $$ = build_reserve_entry($2, $4 - $2 + 1, NULL);
+ | label DT_MEMRESERVE DT_ADDR '-' DT_ADDR ';' {
+ $$ = build_reserve_entry($3, $5 - $3 + 1, $1);
}
;
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2007-06-14 22:59:00.000000000 -0500
+++ dtc/flattree.c 2007-06-14 22:59:07.000000000 -0500
@@ -497,6 +497,10 @@ void dt_to_asm(FILE *f, struct boot_info
* as it appears .quad isn't available in some assemblers.
*/
for (re = bi->reservelist; re; re = re->next) {
+ if (re->label) {
+ fprintf(f, "\t.globl\t%s\n", re->label);
+ fprintf(f, "%s:\n", re->label);
+ }
fprintf(f, "\t.long\t0x%08x\n\t.long\t0x%08x\n",
(unsigned int)(re->re.address >> 32),
(unsigned int)(re->re.address & 0xffffffff));
^ permalink raw reply
* [PATCH 05/11] dtc: clean up grow_data_for()
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Change the grow_data_for function to copy struct data and
modifiy the fields it is updating instead of storing all
fields individually to a stack allocated struct.
This reduces maintence for future enhancements as now all
instances of struct data are created by modifying a copy
of an existing struct data or directly copying empty_data.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
It took me a bit of time to find the source of the
uninitialized pointer that was causing my changes
to segfault.
diff --git a/data.c b/data.c
index 5d7db17..3d68792 100644
--- a/data.c
+++ b/data.c
@@ -57,6 +57,8 @@ struct data data_grow_for(struct data d,
if (xlen == 0)
return d;
+ nd = d;
+
newsize = xlen;
while ((d.len + xlen) > newsize)
@@ -64,8 +66,6 @@ struct data data_grow_for(struct data d,
nd.asize = newsize;
nd.val = xrealloc(d.val, newsize);
- nd.len = d.len;
- nd.refs = d.refs;
assert(nd.asize >= (d.len + xlen));
^ permalink raw reply related
* [PATCH 03/11] dtc: complain about unparsed digits in cell lists
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
Check that strtoul() parsed the complete string.
As with the number overflow case, write a non-fatal error
message to stdout.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
I saw the FIXME and knew how to fix it.
I think the severity should be higher, but opted for the
detailed error message compared to the fixed string of
yyerror() and its immediate termination of parsing.
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y 2007-06-14 22:59:04.000000000 -0500
+++ dtc/dtc-parser.y 2007-06-14 23:01:32.000000000 -0500
@@ -192,19 +192,27 @@ void yyerror (char const *s)
* Convert a string representation of a numeric cell
* in the given base into a cell.
*
- * FIXME: The string "abc123", base 10, should be flagged
- * as an error due to the leading "a", but isn't yet.
+ * FIXME: should these specification errors be fatal instead?
*/
cell_t cell_from_string(char *s, unsigned int base)
{
cell_t c;
+ char *e;
+
+ c = strtoul(s, &e, base);
+ if (*e) {
+ fprintf(stderr,
+ "Line %d: Invalid cell value '%s' : "
+ "%c is not a base %d digit; %d assumed\n",
+ yylloc.first_line, s, *e, base, c);
+ }
- c = strtoul(s, NULL, base);
if (errno == EINVAL || errno == ERANGE) {
fprintf(stderr,
"Line %d: Invalid cell value '%s'; %d assumed\n",
yylloc.first_line, s, c);
+ errno = 0;
}
return c;
^ permalink raw reply
* [PATCH 02/11] dtc: move declaration of yyerror
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
yyerror() is used by both dtc-parser.y and dtc-lexer.l, so move
the declaration to srcpos.h.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
eliminates implicit declaration warning.
Index: dtc/dtc-parser.y
===================================================================
--- dtc.orig/dtc-parser.y 2007-06-14 23:16:18.000000000 -0500
+++ dtc/dtc-parser.y 2007-06-14 23:16:25.000000000 -0500
@@ -26,7 +26,6 @@
#include "srcpos.h"
int yylex(void);
-void yyerror(char const *);
cell_t cell_from_string(char *s, unsigned int base);
extern struct boot_info *the_boot_info;
Index: dtc/srcpos.h
===================================================================
--- dtc.orig/srcpos.h 2007-06-14 23:16:18.000000000 -0500
+++ dtc/srcpos.h 2007-06-14 23:16:25.000000000 -0500
@@ -62,6 +62,7 @@ typedef struct YYLTYPE {
+extern void yyerror(char const *);
extern int srcpos_filenum;
^ permalink raw reply
* [PATCH 01/11] dtc: fix asm for version 17
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
In-Reply-To: <dtc-5-00.miltonm@bga.com>
The version 17 flat device tree format added struct size. When
writing versin 17 assembly output the field must be emitted.
Signed-off-by: Milton Miller <miltonm@bga.com>
---
Found when trying to parse the binary from the assembled output.
Index: dtc/flattree.c
===================================================================
--- dtc.orig/flattree.c 2007-06-14 22:56:59.000000000 -0500
+++ dtc/flattree.c 2007-06-14 22:59:00.000000000 -0500
@@ -477,6 +477,10 @@ void dt_to_asm(FILE *f, struct boot_info
fprintf(f, "\t.long\t_%s_strings_end - _%s_strings_start\t/* size_dt_strings */\n",
symprefix, symprefix);
+ if (vi->flags & FTF_STRUCTSIZE)
+ fprintf(f, "\t.long\t_%s_struct_end - _%s_struct_start\t/* size_dt_struct */\n",
+ symprefix, symprefix);
+
/*
* Reserve map entries.
* Align the reserve map to a doubleword boundary.
^ permalink raw reply
* [PATCH 00/11] dtc: some fixes, and make asm labels for data
From: Milton Miller @ 2007-07-07 6:18 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev, David Gibson
The following series adds the features of labeling memory reserve
slots and labeling specific bytes or cells of property data. When
translating from dts to asm, a global symbol is created with the
name matching the label in the dts file.
With these features a program does not need to understand the
flattened device tree headers, offsets, layouts, or alignments to
modify a property's contents. Instead it can read or write to the
bytes or words addressed by a global symbol.
In addition the series contains 3 fixes to the compiler (one major
- incorrect output, one recognising an input error, and one compiler
warning), a source dtc for use as a testcase, and two formatting
changes to the generated assembly.
I verified the label placement in the asm output and compared the
dts to dtb output with outptut of dts to asm after cc -c ond objcopy
-o binary, the difference was trailing padding of the assembled
version. I also compared the dts to dts output with the dtb to dts
of the assembled version. Although I did not include the assembled
output with the testcase, it should be placed in the test directory
when the samples there are upgraded to version 17.
I have not studied the tests directory since the new libfdt test
suite was merged to evaluate how to test the labels point at the
property.
I choose not to attempt writing the labels when generating dts
output at this time, although I did consider it. The code currently
resolves node references to phandles creating the properties if
needed, so creating dts from dts is already a lossy operation. I
felt there was no benefit in preserving the labels until there is
a method to read and write some kind of symbol or map file of labels
with dtb input and therefore couldn't justify writing the code to
split the data as it is output. Such code could be used to avoid
formatting a list of strings as list of cells or bytes.
I did not provide a method to label the address and size fields of
a memory reserve entry. Although it could be implemented, I didn't
deem it necessary as there is no header before the address field
and placing a label on the size field of a reserve created with the
start-end syntax would be misleading.
I did not include a prefix when generating the labels, matching the
existing labels output on node and property tags. If code is later
added to change the _dt label prefix used in the header to allow
multiple trees to be linked in one program, a prefix should be added
to the labels to create a a seperate namespace for each dts.
milton
^ permalink raw reply
* Re: [PATCH] Add USB support to mpc8349-mitx board port
From: Grant Likely @ 2007-07-07 5:46 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, paulus, leoli, Timur Tabi
In-Reply-To: <200707070148.20526.arnd@arndb.de>
On 7/6/07, Arnd Bergmann <arnd@arndb.de> wrote:
> On Saturday 07 July 2007, Grant Likely wrote:
> > --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> > @@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
> >
> > ppc_md.pci_exclude_device = mpc83xx_exclude_device;
> > #endif
> > +
> > +mpc834x_usb_cfg();
> > }
>
> Why is that necessary? Shouldn't there be an of_platform_driver that
> simply does all the setup automatically if the device is present?
This call is actually for SoC setup stuff. There are actually 2 USB
engines on the SoC, and this call figures out what mode the pins are
supposed to be in. I think this stuff firmly falls into the platform
setup arena since it is highly chip specific.
You bring up a good point though. The current usb support code in
sysdev/fsl_soc.c uses arch_initcall(fsl_usb_of_init) to go searching
for USB interfaces in the device tree, which are EHCI (and sometimes
OTG) compatible. fsl_usb_of_init calls
platform_device_register_simple() for each USB device found which is
kind of a round about way of doing things. That should probably be
depreciated and an of_platform_device binding should be added to the
EHCI driver.
This same comment probably goes for the other arch_initcall functions
in fsl_soc.c which do exactly the same thing for other devices.
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Re: Mem-2-Mem DMA - Generalized API
From: Timur Tabi @ 2007-07-07 5:24 UTC (permalink / raw)
To: Clifford Wolf; +Cc: linuxppc-embedded
In-Reply-To: <20070704090554.GA30693@clifford.at>
Clifford Wolf wrote:
> Hi,
>
> On Mon, Jun 25, 2007 at 08:01:10PM +0200, Clifford Wolf wrote:
>> I've put a 'draft header file' of an api as I would have expected it
>> online: [...]
>
> Ok, so here comes the first implementation:
> (I also have other projects, so it took a while.. ;-)
>
> http://www.clifford.at/priv/dmatransfer-20070704.diff
Why aren't you following the DMA API in include/linux/dmaengine.h?
^ permalink raw reply
* [PATCH] Handle reg-shift property for of_serial ports
From: David Woodhouse @ 2007-07-07 4:58 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, arnd
The MV64660 has reg-shift==2 for its otherwise 16550-compatible uarts.
While the bootwrapper copes with this, of_serial.c doesn't. (The udbg
code doesn't either, but I'll fix that later).
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
diff --git a/drivers/serial/of_serial.c b/drivers/serial/of_serial.c
index 7ffdaea..0761ff9 100644
--- a/drivers/serial/of_serial.c
+++ b/drivers/serial/of_serial.c
@@ -25,12 +25,13 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
{
struct resource resource;
struct device_node *np = ofdev->node;
- const unsigned int *clk, *spd;
+ const unsigned int *clk, *spd, *rs;
int ret;
memset(port, 0, sizeof *port);
spd = of_get_property(np, "current-speed", NULL);
clk = of_get_property(np, "clock-frequency", NULL);
+ rs = of_get_property(np, "reg-shift", NULL);
if (!clk) {
dev_warn(&ofdev->dev, "no clock-frequency property set\n");
return -ENODEV;
@@ -48,6 +49,8 @@ static int __devinit of_platform_serial_setup(struct of_device *ofdev,
port->iotype = UPIO_MEM;
port->type = type;
port->uartclk = *clk;
+ if (rs)
+ port->regshift = *rs;
port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP
| UPF_FIXED_PORT;
port->dev = &ofdev->dev;
--
dwmw2
^ permalink raw reply related
* Re: Executing from readablee, no-exec pages
From: Benjamin Herrenschmidt @ 2007-07-07 2:33 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, paulus
In-Reply-To: <20070706164942.GA10806@ld0162-tx32.am.freescale.net>
> Well, it means that leaving VM_READ out of the check (except where the
> hardware PTE has an exec bit) isn't really buying us anything
> security-wise (especially since the primary reason for no-exec protection
> is to avoid code injections via stack overflow, and those pages will
> usually already be present), so it doesn't hurt much to let things keep
> working.
>
> At the least, I'd like it to keep working for a few more kernel releases
> (with a warning printed when a VM_EXEC-only test would have failed), so
> people have time to upgrade glibc.
I agree. Care to send a patch ? :-0
Ben.
^ permalink raw reply
* Re: Executing from readablee, no-exec pages
From: Benjamin Herrenschmidt @ 2007-07-07 2:33 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, paulus
In-Reply-To: <1183732922.2747.36.camel@shinybook.infradead.org>
On Fri, 2007-07-06 at 10:42 -0400, David Woodhouse wrote:
> On Thu, 2007-07-05 at 16:55 -0500, Scott Wood wrote:
> > To maintain compatibility with these versions, we could change the test
> > in do_page_fault() to include VM_READ as well as VM_EXEC on targets that
> > don't have a separate exec-bit in hardware (are there any powerpc mmus
> > that do?).
>
> 64-bit implementations since POWER4 have separate exec permissions,
> don't they? So any userspace which tries to execute non-executable pages
> is already broken when running on a ppc64 machine; I wouldn't worry too
> much about letting it break on ppc32 too.
>
> We already use vDSO signal trampolines even on the 32-bit kernel, right?
The problem was with old glibc 32 bits which used to jump to an
instruction in the .got iirc that wasn't in an executable section
Ben.
^ permalink raw reply
* Re: [PATCH] Add USB support to mpc8349-mitx board port
From: Arnd Bergmann @ 2007-07-06 23:48 UTC (permalink / raw)
To: linuxppc-dev; +Cc: leoli, paulus
In-Reply-To: <20070706222909.19943.39455.stgit@trillian.secretlab.ca>
On Saturday 07 July 2007, Grant Likely wrote:
> --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
> +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
> @@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
> =A0
> =A0=A0=A0=A0=A0=A0=A0=A0ppc_md.pci_exclude_device =3D mpc83xx_exclude_dev=
ice;
> =A0#endif
> +
> +=A0=A0=A0=A0=A0=A0=A0mpc834x_usb_cfg();
> =A0}
Why is that necessary? Shouldn't there be an of_platform_driver that
simply does all the setup automatically if the device is present?
Arnd <><
^ permalink raw reply
* [PATCH] Add USB support to mpc8349-mitx board port
From: Grant Likely @ 2007-07-06 22:29 UTC (permalink / raw)
To: paulus, linuxppc-dev, galak, leoli, kim.phillips
From: Grant Likely <grant.likely@secretlab.ca>
This patch depends on Li Yang's patch: "83xx USB platform code rework"
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
arch/powerpc/platforms/83xx/mpc834x_itx.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 40a0194..1ace7ac 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -63,6 +63,8 @@ static void __init mpc834x_itx_setup_arch(void)
ppc_md.pci_exclude_device = mpc83xx_exclude_device;
#endif
+
+ mpc834x_usb_cfg();
}
static void __init mpc834x_itx_init_IRQ(void)
^ permalink raw reply related
* [PATCH] pseries: Re: Minor: Removed double return.
From: Linas Vepstas @ 2007-07-06 22:58 UTC (permalink / raw)
To: Manish Ahuja; +Cc: ppc-dev
In-Reply-To: <468EBB5B.2070309@austin.ibm.com>
You want to say its a patch in the subject line.
--linas
On Fri, Jul 06, 2007 at 04:59:55PM -0500, Manish Ahuja wrote:
> Found 2 instances of return one right after each other in
> arch_add_memory(). This minor patch fixes it.
> Signed-off-by:Manish Ahuja <mahuja@us.ibm.com>
>
>
> Index: 2.6.22-rc4/arch/powerpc/mm/mem.c
> ===================================================================
> --- 2.6.22-rc4.orig/arch/powerpc/mm/mem.c 2007-06-11 21:10:46.000000000 -0500
> +++ 2.6.22-rc4/arch/powerpc/mm/mem.c 2007-06-29 22:52:42.000000000 -0500
> @@ -129,8 +129,6 @@
> zone = pgdata->node_zones;
>
> return __add_pages(zone, start_pfn, nr_pages);
> -
> - return 0;
> }
>
> /*
^ permalink raw reply
* Re: [PATCH 2.6.23] 83xx USB platform code rework
From: Grant Likely @ 2007-07-06 22:27 UTC (permalink / raw)
To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <11834557963629-git-send-email-leoli@freescale.com>
On 7/3/07, Li Yang <leoli@freescale.com> wrote:
> Add 831x USB platform setup code and rework 834x USB
> platform setup code. Move USB platform code to usb.c
> for different boards with CPU of the same series to share
> the USB initialization code.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> Respin for 2.6.22-rc7. Remove USB_EHCI_FSL selects in Kconfig, as they
> will be enabled in USB Kconfig.
>
> arch/powerpc/platforms/83xx/Makefile | 2 +-
> arch/powerpc/platforms/83xx/mpc8313_rdb.c | 1 +
> arch/powerpc/platforms/83xx/mpc834x_mds.c | 49 +-------
> arch/powerpc/platforms/83xx/mpc83xx.h | 28 ++++-
> arch/powerpc/platforms/83xx/usb.c | 181 +++++++++++++++++++++++++++++
> 5 files changed, 213 insertions(+), 48 deletions(-)
> create mode 100644 arch/powerpc/platforms/83xx/usb.c
>
> diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
> index 31a91b5..5a98f88 100644
> --- a/arch/powerpc/platforms/83xx/Makefile
> +++ b/arch/powerpc/platforms/83xx/Makefile
> @@ -1,7 +1,7 @@
> #
> # Makefile for the PowerPC 83xx linux kernel.
> #
> -obj-y := misc.o
> +obj-y := misc.o usb.o
> obj-$(CONFIG_PCI) += pci.o
> obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o
> obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
> diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
> index 96970ac..a404910 100644
> --- a/arch/powerpc/platforms/83xx/mpc8313_rdb.c
> +++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
> @@ -53,6 +53,7 @@ static void __init mpc8313_rdb_setup_arch(void)
>
> ppc_md.pci_exclude_device = mpc83xx_exclude_device;
> #endif
> + mpc831x_usb_cfg();
> }
>
> void __init mpc8313_rdb_init_IRQ(void)
> diff --git a/arch/powerpc/platforms/83xx/mpc834x_mds.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
> index 10394b2..28b3840 100644
> --- a/arch/powerpc/platforms/83xx/mpc834x_mds.c
> +++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
> @@ -44,55 +44,16 @@ unsigned long isa_mem_base = 0;
> #endif
>
> #define BCSR5_INT_USB 0x02
> -/* Note: This is only for PB, not for PB+PIB
> - * On PB only port0 is connected using ULPI */
> -static int mpc834x_usb_cfg(void)
> +static int mpc834xemds_usb_cfg(void)
> {
> - unsigned long sccr, sicrl;
> - void __iomem *immap;
> + struct device_node *np;
> void __iomem *bcsr_regs = NULL;
> u8 bcsr5;
> - struct device_node *np = NULL;
> - int port0_is_dr = 0;
> -
> - if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr")) != NULL)
> - port0_is_dr = 1;
> - if ((np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph")) != NULL){
> - if (port0_is_dr) {
> - printk(KERN_WARNING
> - "There is only one USB port on PB board! \n");
> - return -1;
> - } else if (!port0_is_dr)
> - /* No usb port enabled */
> - return -1;
> - }
> -
> - immap = ioremap(get_immrbase(), 0x1000);
> - if (!immap)
> - return -1;
> -
> - /* Configure clock */
> - sccr = in_be32(immap + MPC83XX_SCCR_OFFS);
> - if (port0_is_dr)
> - sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
> - else
> - sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
> - out_be32(immap + MPC83XX_SCCR_OFFS, sccr);
> -
> - /* Configure Pin */
> - sicrl = in_be32(immap + MPC83XX_SICRL_OFFS);
> - /* set port0 only */
> - if (port0_is_dr)
> - sicrl |= MPC83XX_SICRL_USB0;
> - else
> - sicrl &= ~(MPC83XX_SICRL_USB0);
> - out_be32(immap + MPC83XX_SICRL_OFFS, sicrl);
> -
> - iounmap(immap);
>
> + mpc834x_usb_cfg();
> /* Map BCSR area */
> np = of_find_node_by_name(NULL, "bcsr");
> - if (np != 0) {
> + if (np) {
> struct resource res;
>
> of_address_to_resource(np, 0, &res);
> @@ -134,7 +95,7 @@ static void __init mpc834x_mds_setup_arch(void)
> ppc_md.pci_exclude_device = mpc83xx_exclude_device;
> #endif
>
> - mpc834x_usb_cfg();
> + mpc834xemds_usb_cfg();
> }
>
> static void __init mpc834x_mds_init_IRQ(void)
> diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
> index 9cd03b5..a44e5b1 100644
> --- a/arch/powerpc/platforms/83xx/mpc83xx.h
> +++ b/arch/powerpc/platforms/83xx/mpc83xx.h
> @@ -6,6 +6,7 @@
>
> /* System Clock Control Register */
> #define MPC83XX_SCCR_OFFS 0xA08
> +#define MPC83XX_SCCR_USB_MASK 0x00f00000
> #define MPC83XX_SCCR_USB_MPHCM_11 0x00c00000
> #define MPC83XX_SCCR_USB_MPHCM_01 0x00400000
> #define MPC83XX_SCCR_USB_MPHCM_10 0x00800000
> @@ -15,12 +16,31 @@
>
> /* system i/o configuration register low */
> #define MPC83XX_SICRL_OFFS 0x114
> -#define MPC83XX_SICRL_USB0 0x40000000
> -#define MPC83XX_SICRL_USB1 0x20000000
> +#define MPC834X_SICRL_USB_MASK 0x60000000
> +#define MPC834X_SICRL_USB0 0x40000000
> +#define MPC834X_SICRL_USB1 0x20000000
> +#define MPC831X_SICRL_USB_MASK 0x00000c00
> +#define MPC831X_SICRL_USB_ULPI 0x00000800
>
> /* system i/o configuration register high */
> #define MPC83XX_SICRH_OFFS 0x118
> -#define MPC83XX_SICRH_USB_UTMI 0x00020000
> +#define MPC834X_SICRH_USB_UTMI 0x00020000
> +#define MPC831X_SICRH_USB_MASK 0x000000e0
> +#define MPC831X_SICRH_USB_ULPI 0x000000a0
> +
> +/* USB Control Register */
> +#define FSL_USB2_CONTROL_OFFS 0x500
> +#define CONTROL_UTMI_PHY_EN 0x00000200
> +#define CONTROL_REFSEL_48MHZ 0x00000080
> +#define CONTROL_PHY_CLK_SEL_ULPI 0x00000400
> +#define CONTROL_OTG_PORT 0x00000020
> +
> +/* USB PORTSC Registers */
> +#define FSL_USB2_PORTSC1_OFFS 0x184
> +#define FSL_USB2_PORTSC2_OFFS 0x188
> +#define PORTSCX_PTW_16BIT 0x10000000
> +#define PORTSCX_PTS_UTMI 0x00000000
> +#define PORTSCX_PTS_ULPI 0x80000000
>
> /*
> * Declaration for the various functions exported by the
> @@ -31,5 +51,7 @@ extern int add_bridge(struct device_node *dev);
> extern int mpc83xx_exclude_device(u_char bus, u_char devfn);
> extern void mpc83xx_restart(char *cmd);
> extern long mpc83xx_time_init(void);
> +extern int mpc834x_usb_cfg(void);
> +extern int mpc831x_usb_cfg(void);
>
> #endif /* __MPC83XX_H__ */
> diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
> new file mode 100644
> index 0000000..e7fdf01
> --- /dev/null
> +++ b/arch/powerpc/platforms/83xx/usb.c
> @@ -0,0 +1,181 @@
> +/*
> + * Freescale 83xx USB SOC setup code
> + *
> + * Copyright (C) 2007 Freescale Semiconductor, Inc.
> + * Author: Li Yang
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + */
> +
> +
> +#include <linux/stddef.h>
> +#include <linux/kernel.h>
> +#include <linux/errno.h>
> +
> +#include <asm/io.h>
> +#include <asm/prom.h>
> +#include <sysdev/fsl_soc.h>
> +
> +#include "mpc83xx.h"
> +
> +
> +#ifdef CONFIG_MPC834x
> +int mpc834x_usb_cfg(void)
> +{
> + unsigned long sccr, sicrl, sicrh;
> + void __iomem *immap;
> + struct device_node *np = NULL;
> + int port0_is_dr = 0, port1_is_dr = 0;
> + const void *prop, *dr_mode;
> +
> + immap = ioremap(get_immrbase(), 0x1000);
> + if (!immap)
> + return -ENOMEM;
> +
> + /* Read registers */
> + /* Note: DR and MPH must use the same clock setting in SCCR */
> + sccr = in_be32(immap + MPC83XX_SCCR_OFFS) & ~MPC83XX_SCCR_USB_MASK;
> + sicrl = in_be32(immap + MPC83XX_SICRL_OFFS) & ~MPC834X_SICRL_USB_MASK;
> + sicrh = in_be32(immap + MPC83XX_SICRH_OFFS) & ~MPC834X_SICRH_USB_UTMI;
> +
> + np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
> + if (np) {
> + sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
> +
> + prop = of_get_property(np, "phy_type", NULL);
> + if (prop && (!strcmp(prop, "utmi") ||
> + !strcmp(prop, "utmi_wide"))) {
> + sicrl |= MPC834X_SICRL_USB0 | MPC834X_SICRL_USB1;
> + sicrh |= MPC834X_SICRH_USB_UTMI;
> + port1_is_dr = 1;
> + } else if (prop && !strcmp(prop, "serial")) {
> + dr_mode = of_get_property(np, "dr_mode", NULL);
> + if (dr_mode && !strcmp(dr_mode, "otg")) {
> + sicrl |= MPC834X_SICRL_USB0 | MPC834X_SICRL_USB1;
> + port1_is_dr = 1;
> + } else {
> + sicrl |= MPC834X_SICRL_USB0;
> + }
> + } else if (prop && !strcmp(prop, "ulpi")) {
> + sicrl |= MPC834X_SICRL_USB0;
> + } else {
> + printk(KERN_WARNING "834x USB PHY type not supported\n");
> + }
> + port0_is_dr = 1;
> + of_node_put(np);
> + }
> + np = of_find_compatible_node(NULL, "usb", "fsl-usb2-mph");
> + if (np) {
> + sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
> +
> + prop = of_get_property(np, "port0", NULL);
> + if (prop) {
> + if (port0_is_dr)
> + printk(KERN_WARNING
> + "834x USB port0 can't be used by both DR and MPH!\n");
> + sicrl |= MPC834X_SICRL_USB0;
> + }
> + prop = of_get_property(np, "port1", NULL);
> + if (prop) {
> + if (port1_is_dr)
> + printk(KERN_WARNING
> + "834x USB port1 can't be used by both DR and MPH!\n");
> + sicrl |= MPC834X_SICRL_USB1;
> + }
> + of_node_put(np);
> + }
> +
> + /* Write back */
> + out_be32(immap + MPC83XX_SCCR_OFFS, sccr);
> + out_be32(immap + MPC83XX_SICRL_OFFS, sicrl);
> + out_be32(immap + MPC83XX_SICRH_OFFS, sicrh);
> +
> + iounmap(immap);
> + return 0;
> +}
> +#endif /* CONFIG_MPC834x */
> +
> +#ifdef CONFIG_PPC_MPC831x
> +int mpc831x_usb_cfg(void)
> +{
> + u32 temp;
> + void __iomem *immap, *usb_regs;
> + struct device_node *np = NULL;
> + const void *prop;
> + struct resource res;
> + int ret = 0;
> +#ifdef CONFIG_USB_OTG
> + const void *dr_mode;
> +#endif
> +
> + np = of_find_compatible_node(NULL, "usb", "fsl-usb2-dr");
> + if (!np)
> + return -ENODEV;
> + prop = of_get_property(np, "phy_type", NULL);
> +
> + /* Map IMMR space for pin and clock settings */
> + immap = ioremap(get_immrbase(), 0x1000);
> + if (!immap) {
> + of_node_put(np);
> + return -ENOMEM;
> + }
> +
> + /* Configure clock */
> + temp = in_be32(immap + MPC83XX_SCCR_OFFS);
> + temp &= ~MPC83XX_SCCR_USB_MASK;
> + temp |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
> + out_be32(immap + MPC83XX_SCCR_OFFS, temp);
> +
> + /* Configure pin mux for ULPI. There is no pin mux for UTMI */
> + if (!strcmp(prop, "ulpi")) {
> + temp = in_be32(immap + MPC83XX_SICRL_OFFS);
> + temp &= ~MPC831X_SICRL_USB_MASK;
> + temp |= MPC831X_SICRL_USB_ULPI;
> + out_be32(immap + MPC83XX_SICRL_OFFS, temp);
> +
> + temp = in_be32(immap + MPC83XX_SICRH_OFFS);
> + temp &= ~MPC831X_SICRH_USB_MASK;
> + temp |= MPC831X_SICRH_USB_ULPI;
> + out_be32(immap + MPC83XX_SICRH_OFFS, temp);
> + }
> +
> + iounmap(immap);
> +
> + /* Map USB SOC space */
> + ret = of_address_to_resource(np, 0, &res);
> + if (ret) {
> + of_node_put(np);
> + return ret;
> + }
> + usb_regs = ioremap(res.start, res.end - res.start + 1);
> +
> + /* Using on-chip PHY */
> + if (!strcmp(prop, "utmi_wide") ||
> + !strcmp(prop, "utmi")) {
> + /* Set UTMI_PHY_EN, REFSEL to 48MHZ */
> + out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
> + CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ);
> + /* Using external UPLI PHY */
> + } else if (!strcmp(prop, "ulpi")) {
> + /* Set PHY_CLK_SEL to ULPI */
> + temp = CONTROL_PHY_CLK_SEL_ULPI;
> +#ifdef CONFIG_USB_OTG
> + /* Set OTG_PORT */
> + dr_mode = of_get_property(np, "dr_mode", NULL);
> + if (dr_mode && !strcmp(dr_mode, "otg"))
> + temp |= CONTROL_OTG_PORT;
> +#endif /* CONFIG_USB_OTG */
> + out_be32(usb_regs + FSL_USB2_CONTROL_OFFS, temp);
> + } else {
> + printk(KERN_WARNING "831x USB PHY type not supported\n");
> + ret = -EINVAL;
> + }
> +
> + iounmap(usb_regs);
> + of_node_put(np);
> + return ret;
> +}
> +#endif /* CONFIG_PPC_MPC831x */
> --
> 1.5.2.GIT
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply
* Minor: Removed double return.
From: Manish Ahuja @ 2007-07-06 21:59 UTC (permalink / raw)
To: ppc-dev
[-- Attachment #1: Type: text/plain, Size: 154 bytes --]
Found 2 instances of return one right after each other in
arch_add_memory(). This minor patch fixes it.
Signed-off-by:Manish Ahuja <mahuja@us.ibm.com>
[-- Attachment #2: double-return --]
[-- Type: text/plain, Size: 382 bytes --]
Index: 2.6.22-rc4/arch/powerpc/mm/mem.c
===================================================================
--- 2.6.22-rc4.orig/arch/powerpc/mm/mem.c 2007-06-11 21:10:46.000000000 -0500
+++ 2.6.22-rc4/arch/powerpc/mm/mem.c 2007-06-29 22:52:42.000000000 -0500
@@ -129,8 +129,6 @@
zone = pgdata->node_zones;
return __add_pages(zone, start_pfn, nr_pages);
-
- return 0;
}
/*
^ permalink raw reply
* Re: PowerPC equivalent to dma_mmap_writecombine()?
From: Arnd Bergmann @ 2007-07-06 21:26 UTC (permalink / raw)
To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <468EA3DA.8070903@freescale.com>
On Friday 06 July 2007, Timur Tabi wrote:
> Arnd Bergmann wrote:
>=20
> > Not sure exactly what arm does here, but it sounds like you want
> > to call remap_pfn_range with the _PAGE_NO_CACHE bit set in the
> > protection flags, and _PAGE_GUARDED not set.
>=20
> I always have a hard time with these mapping functions. =A0Is this right?
>=20
> vma->vm_page_prot =3D __pgprot((pgprot_val(vma->vm_page_prot) | _PAGE_NO_=
CACHE) &=20
> ~_PAGE_GUARDED));
>=20
> ret =3D remap_pfn_range(vma, vma->vm_start, runtime->dma_addr, runtime->d=
ma_bytes,=20
> vma->vm_page_prot);
>=20
> Alternatively, could I use function snd_pcm_lib_mmap_iomem() (sound/core/=
pcm_native.c)?=20
> It looks like it does the right thing, although it doesn't unset the guar=
ded bit. =A0If=20
> that's wrong, I can submit a patch to unset that bit on PowerPC, but like=
I said, I can=20
> never quite get my head around this mapping stuff.
The guarded bit is disabled by default, so you don't need t remove it, so
the function you quoted should be alright for this purpose. Not sure if you
need the ioremap in there though.
Arnd <><
^ permalink raw reply
* Re: PowerPC equivalent to dma_mmap_writecombine()?
From: Timur Tabi @ 2007-07-06 20:19 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev
In-Reply-To: <200707051813.53762.arnd@arndb.de>
Arnd Bergmann wrote:
> Not sure exactly what arm does here, but it sounds like you want
> to call remap_pfn_range with the _PAGE_NO_CACHE bit set in the
> protection flags, and _PAGE_GUARDED not set.
I always have a hard time with these mapping functions. Is this right?
vma->vm_page_prot = __pgprot((pgprot_val(vma->vm_page_prot) | _PAGE_NO_CACHE) &
~_PAGE_GUARDED));
ret = remap_pfn_range(vma, vma->vm_start, runtime->dma_addr, runtime->dma_bytes,
vma->vm_page_prot);
Alternatively, could I use function snd_pcm_lib_mmap_iomem() (sound/core/pcm_native.c)?
It looks like it does the right thing, although it doesn't unset the guarded bit. If
that's wrong, I can submit a patch to unset that bit on PowerPC, but like I said, I can
never quite get my head around this mapping stuff.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply
* [PATCH] pasemi: don't auto-select CONFIG_EMBEDDED
From: Olof Johansson @ 2007-07-06 20:15 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
Disable auto-select of CONFIG_EMBEDDED. ELECTRA_IDE selects PATA_PLATFORM
which should be sufficient.
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig
index 4275ff8..95cd90f 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -5,7 +5,6 @@ config PPC_PASEMI
select MPIC
select PPC_UDBG_16550
select PPC_NATIVE
- select EMBEDDED
help
This option enables support for PA Semi's PWRficient line
of SoC processors, including PA6T-1682M
^ permalink raw reply related
* mpc83xx USB support status
From: Grant Likely @ 2007-07-06 20:02 UTC (permalink / raw)
To: Li Yang-r58472, Timur Tabi, Behan Webster, Linux PPC Linux PPC
Li,
What is the state of mpc83xx support in arch/powerpc? I saw some of
the patches you posted to the ppc and usb-devel lists, but I want to
make sure I've got the whole set. Also, can you tell me what the
state of those patches are (ie. which ones will be picked up for
2.6.23?)
I'm working on the mpc8349-mitx-gp board, and I can do the work to get
your changes working on that board.
Thanks,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ 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