All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [RFC][PATCH] Set linux,stdout-path via aliases
@ 2007-11-21 22:04 Kumar Gala
  2007-11-26 17:29 ` Scott Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Kumar Gala @ 2007-11-21 22:04 UTC (permalink / raw)
  To: u-boot

I was hoping to get some suggestions on how to handle using aliases to set
linux,stdout-path.

* Do we want this protected via some board CONFIG?
  - should this be mutually exclusive with OF_STDOUT_PATH?
  - if so, which has precedence?
* Was figuring we'd use CONFIG_CONS_INDEX to find the proper alias

any other comments are welcome.. this patch is a hack that works right
now.

- k

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 74b5a93..c50dbbd 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -72,10 +72,12 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,

 int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 {
-	int   nodeoffset;
+	int   nodeoffset, pnode;
 	int   err;
 	u32   tmp;		/* used to set 32 bit integer properties */
 	char  *str;		/* used to set string properties */
+	const char *path;
+	char p[100];

 	err = fdt_check_header(fdt);
 	if (err < 0) {
@@ -160,6 +162,18 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 			printf("WARNING: could not set linux,initrd-end %s.\n",
 				fdt_strerror(err));
 	}
+
+ 	pnode = fdt_path_offset(fdt, "/aliases");
+ 	if (pnode >= 0) {
+ 		int len;
+ 		path = fdt_getprop(fdt, pnode, "serial0", &len);
+ 		if (path) {
+ 			strcpy(p, path);
+ 			fdt_setprop(fdt, nodeoffset, "linux,stdout-path",
+ 					p, len);
+ 		}
+ 	}
+
 #ifdef OF_STDOUT_PATH
 	err = fdt_setprop(fdt, nodeoffset,
 		"linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [RFC][PATCH] Set linux,stdout-path via aliases
  2007-11-21 22:04 [U-Boot-Users] [RFC][PATCH] Set linux,stdout-path via aliases Kumar Gala
@ 2007-11-26 17:29 ` Scott Wood
  2007-11-26 18:20   ` Kumar Gala
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Wood @ 2007-11-26 17:29 UTC (permalink / raw)
  To: u-boot

On Wed, Nov 21, 2007 at 04:04:57PM -0600, Kumar Gala wrote:
> +	char p[100];
[snip]
> + 		path = fdt_getprop(fdt, pnode, "serial0", &len);
> + 		if (path) {
> + 			strcpy(p, path);

Tsk, tsk.

-Scott

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot-Users] [RFC][PATCH] Set linux,stdout-path via aliases
  2007-11-26 17:29 ` Scott Wood
@ 2007-11-26 18:20   ` Kumar Gala
  0 siblings, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2007-11-26 18:20 UTC (permalink / raw)
  To: u-boot


On Nov 26, 2007, at 11:29 AM, Scott Wood wrote:

> On Wed, Nov 21, 2007 at 04:04:57PM -0600, Kumar Gala wrote:
>> +	char p[100];
> [snip]
>> + 		path = fdt_getprop(fdt, pnode, "serial0", &len);
>> + 		if (path) {
>> + 			strcpy(p, path);
>
> Tsk, tsk.

yes, I was being lazy for the RFC purposes :)

- k

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-11-26 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 22:04 [U-Boot-Users] [RFC][PATCH] Set linux,stdout-path via aliases Kumar Gala
2007-11-26 17:29 ` Scott Wood
2007-11-26 18:20   ` Kumar Gala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.