bd_t Cleaning: Interface Part

2005-06-04 Thread Sylvain Munaut
Jon Loeliger wrote:
> On Thu, 2005-05-26 at 18:08, Kumar Gala wrote:
> 
>>Jon,
>>
>>Can you break the patch up into a few pieces, it will be easier to 
>>review that way.  Here are the following pieces that make sense to me:
>>
>>0. New firmware interface (fw_bdt*, Kconfig, ...)
>>1. board code changes (everything in arch/ppc/platforms/*)
>>2. driver changes (things in *_io, ide, net, serial dirs -- try to give 
>>a better list below)
>>3. System changes (files in arch/ppc/syslib and include/asm-ppc)

FWIW, tested on 5200 and works fine. Looks good to me.

Just a remark : I see a CONFIG_FW_OF option that activates
fw_of.o but there is no fw_of.c and I don't see what the flattened
OF tree does in this set of patch ?



Sylvain



bd_t Cleaning: Interface Part

2005-05-31 Thread Jon Loeliger
On Mon, 2005-05-30 at 05:13, Clemens Koller wrote:
> Hello, Jon!
> 
> I guess there is a little typo:
> spped -> speed?

Rats.

Thanks for looking into the mess, and catching that!

jdl





bd_t Cleaning: Interface Part

2005-05-30 Thread Clemens Koller
Hello, Jon!

I guess there is a little typo:
spped -> speed?

> +unsigned long
> +fw_get_ethspped(void)
> +{
> +#if defined(FW_BDT_HAS_ETHSPEED)
> + return binfo->bi_ethspeed;
> +#else
> + return 0;
> +#endif
> +}

and here...

> +unsigned long fw_get_ethspped(void);

Greets,

Clemens Koller
___
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19



bd_t Cleaning: Interface Part

2005-05-27 Thread Jon Loeliger
On Thu, 2005-05-26 at 18:08, Kumar Gala wrote:
> Jon,
> 
> Can you break the patch up into a few pieces, it will be easier to 
> review that way.  Here are the following pieces that make sense to me:
> 
> 0. New firmware interface (fw_bdt*, Kconfig, ...)
> 1. board code changes (everything in arch/ppc/platforms/*)
> 2. driver changes (things in *_io, ide, net, serial dirs -- try to give 
> a better list below)
> 3. System changes (files in arch/ppc/syslib and include/asm-ppc)


OK.

Here's the first of the same patch in four part harmony.

 ppc/Kconfig |   29 +
 ppc/syslib/fw_bdt.c |  598 
 ppc/syslib/fw_bdt.h |  453 
 ppc/syslib/Makefile |4 
 asm-ppc/firmware.h  |   62 +++
 ppc/kernel/ppc_ksyms.c  |4 

Index: arch/ppc/Kconfig
===
--- c7d7a187a2125518e655dfeadffd38156239ffc3/arch/ppc/Kconfig  (mode:100644)
+++ eb4292a8874abcc926f536de90af0bdb001cf12e/arch/ppc/Kconfig  (mode:100644)
@@ -955,6 +955,35 @@
  some command-line options at build time by entering them here.  In
  most cases you will need to specify the root device here.
 
+choice
+   prompt "Firmware setup interface"
+   default FW_BDT
+   help
+ The bd_t structure setup by U-Boot is a flat structure with a
+ fixed structure that must be consistent between U-Boot and Linux.
+ Often that structure definition is out of date and inconsistent.
+ The Open Firmware Flattened Device Tree provides a less fragile
+ mechanism for communicating setup data from the firmware to Linux.
+
+ The Implementation of the Open Firwmare flattened Device Tree
+ hasn't been added to U-Boot yet, so select the bd_t option.
+
+config FW_BDT
+   bool "bd_t structure"
+   help
+ Select this option to use the traditional bd_t style interface
+ to pass residual data from U-Boot to the Linux startup code.
+
+ Select this choice if unsure.
+
+config FW_OF
+   bool "OF Flattened Device Tree"
+   help
+ Select this option to use a flattened Open Firmware device tree
+ to pass data from U-Boot to the Linux startup code.
+
+endchoice
+
 config AMIGA
bool
depends on APUS
Index: arch/ppc/syslib/fw_bdt.c
===
--- /dev/null  (tree:c7d7a187a2125518e655dfeadffd38156239ffc3)
+++ eb4292a8874abcc926f536de90af0bdb001cf12e/arch/ppc/syslib/fw_bdt.c  
(mode:100644)
@@ -0,0 +1,598 @@
+/*
+ * arch/ppc/syslib/fw_bdt.c
+ *
+ * Implements the interface to Firmware information based
+ * on U-Boot's bd_t structure definition.
+ *
+ * Maintainer: Kumar Gala 
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * 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 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "fw_bdt.h"
+
+
+/*
+ * The "residual" data area holds data supplied by the firmware in order
+ * to communicate initialization and setup data to the Linux startup.
+ */
+bd_t __res;
+static bd_t *binfo = &__res;
+
+EXPORT_SYMBOL(__res);
+
+
+/*
+ * Perform any initialization needed in order to setup the interface
+ * between the Firmware-supplied setup data and the Linux use of it.
+ *
+ * That is, copy the data pointed to by r3 to the __res "residual" structure.
+ */
+
+void __init
+fw_initialize(unsigned long r3)
+{
+   if (r3) {
+   memcpy((void *) &__res,
+  (void *) (r3 + KERNELBASE),
+  sizeof(bd_t));
+   }
+}
+
+
+/*
+ * Return the address of an in-memory structure that can be used
+ * to initialize the bd_t firware setup. Woo.
+ */
+
+void *
+fw_get_init_data(void)
+{
+   return &__res;
+}
+
+
+/*
+ * Return the start of DRAM memory.
+ */
+unsigned long
+fw_get_memory_start(void)
+{
+#if defined(FW_BDT_HAS_MEMSTART)
+return binfo->bi_memstart;
+#else
+   return 0;
+#endif
+}
+
+
+/*
+ * Return the amount of memory in bytes.
+ */
+unsigned long
+fw_get_memory_size(void)
+{
+#if defined(FW_BDT_HAS_MEMSIZE)
+return binfo->bi_memsize;
+#else
+   return 0;
+#endif
+}
+
+
+/*
+ * Return the start of FLASH memory.
+ */
+unsigned long
+fw_get_flash_start(void)
+{
+#if defined(FW_BDT_HAS_FLASHSTART)
+return binfo->bi_flashstart;
+#else
+   return 0;
+#endif
+}
+
+
+/*
+ * Return the amount of FLASH memory in bytes.
+ */
+unsigned long
+fw_get_flash_size(void)
+{
+#if defined(FW_BDT_HAS_FLASHSIZE)
+return binfo->bi_flashsize;
+#else
+   return 0;
+#endif
+}
+
+
+unsigned long
+fw_get_flash_offs