Patchwork mainboard.c: init() still being called?

login
register
about
Submitter Patrick Georgi
Date 2010-08-26 16:33:36
Message ID <4C769760.8090400@coresystems.de>
Download mbox | patch
Permalink /patch/1805/
State New
Headers show

Comments

Patrick Georgi - 2010-08-26 16:33:36
Am 25.08.2010 18:10, schrieb Jens Rottmann:
> i.e. make the mainboard the root device of the device tree - seemed plausible to
> me, somehow. This compiles and boots fine, but the 'register' statement still
> doesn't have any effect, sio_gp1x_config in the mainboard's chip.h still isn't
> set - hmm, tough luck ... Why have a struct mainboard_config if it can't be
> used? Maybe it should be removed completely??
That mechanism could be fixed to work correctly again. Attached patch
should do that.


Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Myles Watson - 2010-08-26 16:42:42
> Am 25.08.2010 18:10, schrieb Jens Rottmann:
> > i.e. make the mainboard the root device of the device tree - seemed
> plausible to
> > me, somehow. This compiles and boots fine, but the 'register' statement
> still
> > doesn't have any effect, sio_gp1x_config in the mainboard's chip.h still

sio_gp1x_config sounds like it should be in the superio, not the mainboard.
I'm not sure I understand the need for mainboard_config.  I'd rather just
see it die.  I think everything that's been there could be moved to devices
or Kconfig.

How many boards try to use mainboard_config?

Thanks,
Myles
Myles Watson - 2010-08-26 17:28:26
On Thu, Aug 26, 2010 at 10:42 AM, Myles Watson <mylesgw@gmail.com> wrote:
>> Am 25.08.2010 18:10, schrieb Jens Rottmann:
>> > i.e. make the mainboard the root device of the device tree - seemed
>> plausible to
>> > me, somehow. This compiles and boots fine, but the 'register' statement
>> still
>> > doesn't have any effect, sio_gp1x_config in the mainboard's chip.h still
>
> sio_gp1x_config sounds like it should be in the superio, not the mainboard.
> I'm not sure I understand the need for mainboard_config.  I'd rather just
> see it die.  I think everything that's been there could be moved to devices
> or Kconfig.
>
> How many boards try to use mainboard_config?
Three.  Two lippert boards and amd/rumba.

rumba uses it for a NIC IRQ setting.

Thanks,
Myles
Myles Watson - 2010-08-26 18:32:16
One reason for keeping other settings out of the mainboard is that
they may get overwritten later.

It looks like the register at gpio_address + 0x18
(GPIOL_PULLUP_ENABLE) is getting written in cs5536.c and
spacerunner-lx/mainboard.c.

Thanks,
Myles

Patch

Index: util/sconfig/main.c

===================================================================
--- util/sconfig/main.c	(Revision 5743)

+++ util/sconfig/main.c	(Arbeitskopie)

@@ -23,7 +23,7 @@ 

 
 extern int linenum;
 
-struct device *head, *lastdev;
+struct device *head, *lastdev, *first;
 
 struct header headers;
 
@@ -127,6 +127,13 @@ 

 	new_chip->type = chip;
 	new_chip->chip = new_chip;
 
+	if (strncmp(path, "mainboard/", 10) == 0) {
+		new_chip->id = 0;
+		new_chip->name_underscore = "mainboard";
+		root.chip = new_chip;
+		first = new_chip;
+	}
+
 	struct stat st;
 	char *chip_h = malloc(strlen(path)+12);
 	sprintf(chip_h, "src/%s/chip.h", path);
@@ -397,17 +404,17 @@ 

 		printf("usage: sconfig vendor/mainboard outputdir\n");
 		return 1;
 	}
-	char *mainboard=argv[1];
+	char *mainboard_name=argv[1];
 	char *outputdir=argv[2];
-	char *devtree=malloc(strlen(mainboard)+30);
+	char *devtree=malloc(strlen(mainboard_name)+30);
 	char *outputc=malloc(strlen(outputdir)+10);
-	sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard);
+	sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard_name);
 	sprintf(outputc, "%s/static.c", outputdir);
 
 	headers.next = malloc(sizeof(struct header));
-	headers.next->name = malloc(strlen(mainboard)+12);
+	headers.next->name = malloc(strlen(mainboard_name)+12);
 	headers.next->next = 0;
-	sprintf(headers.next->name, "mainboard/%s", mainboard);
+	sprintf(headers.next->name, "mainboard/%s", mainboard_name);
 
 	FILE *filec = fopen(devtree, "r");
 	if (!filec) {
@@ -419,6 +426,7 @@ 

 	yyrestart(filec);
 
 	lastdev = head = &root;
+	first = &mainboard;
 
 	yyparse();
 
@@ -446,8 +454,12 @@ 

 	}
 	fprintf(staticc, "\n/* pass 0 */\n");
 	walk_device_tree(staticc, &root, pass0, NULL);
-	fprintf(staticc, "\n/* pass 1 */\nstruct mainboard_config mainboard_info_0;\nstruct device **last_dev_p = &%s.next;\n", lastdev->name);
-	walk_device_tree(staticc, &root, pass1, NULL);
+	fprintf(staticc, "\n/* pass 1 */\nstruct device **last_dev_p = &%s.next;\n", lastdev->name);
+	if (first == &mainboard)
+		pass1(staticc, first);
+	if (root.next_sibling)
+		walk_device_tree(staticc, root.next_sibling, pass1, NULL);
+	pass1(staticc, &root);
 
 	fclose(staticc);