[U-Boot] [PATCH V11 11/13] TI: SPL: make SPL available for other SOCs as TI

2011-12-16 Thread Stefano Babic
The SPL is developped first for TI-OMAPx. The patch
move OMAP specific function into OMAP directory.

Signed-off-by: Stefano Babic 
CC: Tom Rini 
CC: Wolfgang Denk 
CC: Simon Schwarz 
---
 arch/arm/cpu/armv7/omap-common/Makefile   |2 +
 arch/arm/cpu/armv7/omap-common/spl_omap.c |   71 +
 arch/arm/cpu/armv7/omap3/board.c  |4 ++
 arch/arm/include/asm/omap_common.h|   34 --
 common/spl.c  |1 +
 common/spl_mmc.c  |   21 ++---
 common/spl_nand.c |   14 +-
 include/spl.h |   68 +++
 8 files changed, 153 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/omap-common/spl_omap.c
 create mode 100644 include/spl.h

diff --git a/arch/arm/cpu/armv7/omap-common/Makefile 
b/arch/arm/cpu/armv7/omap-common/Makefile
index e65e992..6fb544c 100644
--- a/arch/arm/cpu/armv7/omap-common/Makefile
+++ b/arch/arm/cpu/armv7/omap-common/Makefile
@@ -44,6 +44,8 @@ ifndef CONFIG_SPL_BUILD
 ifneq ($(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 COBJS  += mem-common.o
 endif
+else
+COBJS  += spl_omap.o
 endif
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
diff --git a/arch/arm/cpu/armv7/omap-common/spl_omap.c 
b/arch/arm/cpu/armv7/omap-common/spl_omap.c
new file mode 100644
index 000..692d8c2
--- /dev/null
+++ b/arch/arm/cpu/armv7/omap-common/spl_omap.c
@@ -0,0 +1,71 @@
+/*
+ * (C) Copyright 2010
+ * Texas Instruments, 
+ *
+ * Aneesh V 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+   switch (omap_boot_device()) {
+   case BOOT_DEVICE_MMC1:
+   omap_mmc_init(0);
+   break;
+   case BOOT_DEVICE_MMC2:
+   omap_mmc_init(1);
+   break;
+   }
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_NAND_SUPPORT
+void spl_arch_nand_init(void)
+{
+   switch (omap_boot_mode()) {
+   case NAND_MODE_HW_ECC:
+   debug("spl: nand - using hw ecc\n");
+   gpmc_init();
+   nand_init();
+   break;
+   default:
+   puts("spl: ERROR: This bootmode is not implemented - hanging");
+   hang();
+   }
+}
+#endif
+
+u32 spl_boot_mode(void)
+{
+   return omap_boot_mode();
+}
diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index 889d650..f06d614 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -42,6 +42,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_SPL_BUILD
+#include 
+#endif
+
 /* Declarations */
 extern omap3_sysinfo sysinfo;
 static void omap3_setup_aux_cr(void);
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 8a7d1e5..e46e612 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -64,43 +64,9 @@ void preloader_console_init(void);
 #define BOOT_DEVICE_XIPWAIT7
 #endif
 
-/* Boot type */
-#defineMMCSD_MODE_UNDEFINED0
-#define MMCSD_MODE_RAW 1
-#define MMCSD_MODE_FAT 2
-#define NAND_MODE_HW_ECC   3
-
-struct spl_image_info {
-   const char *name;
-   u8 os;
-   u32 load_addr;
-   u32 entry_point;
-   u32 size;
-};
-
-extern struct spl_image_info spl_image;
-
-extern u32* boot_params_ptr;
 u32 omap_boot_device(void);
 u32 omap_boot_mode(void);
 
-/* SPL common function s*/
-void spl_parse_image_header(const struct image_header *header);
-void omap_rev_string(char *omap_rev_string);
-int spl_uboot_key(void);
-void spl_board_prepare_for_linux(void);
-int spl_start_uboot(void);
-
-/* NAND SPL functions */
-void spl_nand_load_image(void);
-
-/* MMC SPL functions */
-void spl_mmc_load_image(void);
-
-#ifdef CONFIG_SPL_BOARD_INIT
-void spl_board_init(void);
-#endif
-
 /*
  * silicon revisions.
  * Moving this to common, so that most of code can be moved to common,
diff --git a/common/spl.c b/common/spl.c
index 1671a03..5fdf3fb 100644
--- a/common/spl.c
+++ b/common/spl

Re: [U-Boot] [PATCH V11 11/13] TI: SPL: make SPL available for other SOCs as TI

2011-12-16 Thread Tom Rini
On Fri, Dec 16, 2011 at 8:37 AM, Stefano Babic  wrote:
> The SPL is developped first for TI-OMAPx. The patch
> move OMAP specific function into OMAP directory.

I wonder if we should fold this into the mv'ing patch as well.

[snip]
> diff --git a/include/spl.h b/include/spl.h
> +/* Boot type */
> +#define        MMCSD_MODE_UNDEFINED    0

Not your bad spacing of course, but please fix.

> +/* NAND SPL functions */
> +void spl_nand_load_image(void);
> +void spl_arch_nand_init(void);
> +
> +/* MMC SPL functions */
> +void spl_mmc_load_image(void);

These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V11 11/13] TI: SPL: make SPL available for other SOCs as TI

2011-12-16 Thread Stefano Babic
On 16/12/2011 16:59, Tom Rini wrote:
> On Fri, Dec 16, 2011 at 8:37 AM, Stefano Babic  wrote:
>> The SPL is developped first for TI-OMAPx. The patch
>> move OMAP specific function into OMAP directory.
> 
> I wonder if we should fold this into the mv'ing patch as well.

I can squash the two patches, but I thought the review is easier as I
did. The previous patch shows clearly that the patch was only moved, and
the changes in Makefile makes possible to build the boards making the
patch bisectable. This patch then

> 
> [snip]
>> diff --git a/include/spl.h b/include/spl.h
>> +/* Boot type */
>> +#defineMMCSD_MODE_UNDEFINED0
> 
> Not your bad spacing of course, but please fix.

Thanks to have found, I will fix it.

> 
>> +/* NAND SPL functions */
>> +void spl_nand_load_image(void);
>> +void spl_arch_nand_init(void);
>> +
>> +/* MMC SPL functions */
>> +void spl_mmc_load_image(void);
> 
> These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT

Do we need in the header file for the prototypes ? We have never done,
and it should be not necessary.

Stefano

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V11 11/13] TI: SPL: make SPL available for other SOCs as TI

2011-12-16 Thread Tom Rini
On Fri, Dec 16, 2011 at 9:18 AM, Stefano Babic  wrote:
> On 16/12/2011 16:59, Tom Rini wrote:
>> On Fri, Dec 16, 2011 at 8:37 AM, Stefano Babic  wrote:
>>> The SPL is developped first for TI-OMAPx. The patch
>>> move OMAP specific function into OMAP directory.
>>
>> I wonder if we should fold this into the mv'ing patch as well.
>
> I can squash the two patches, but I thought the review is easier as I
> did. The previous patch shows clearly that the patch was only moved, and
> the changes in Makefile makes possible to build the boards making the
> patch bisectable. This patch then

Yeah, I guess that works too then, nevermind.

>> [snip]
>>> diff --git a/include/spl.h b/include/spl.h
>>> +/* Boot type */
>>> +#define        MMCSD_MODE_UNDEFINED    0
>>
>> Not your bad spacing of course, but please fix.
>
> Thanks to have found, I will fix it.
>
>>
>>> +/* NAND SPL functions */
>>> +void spl_nand_load_image(void);
>>> +void spl_arch_nand_init(void);
>>> +
>>> +/* MMC SPL functions */
>>> +void spl_mmc_load_image(void);
>>
>> These should be covered by #ifdef CONFIG_SPL_(NAND||MMC)_SUPPORT
>
> Do we need in the header file for the prototypes ? We have never done,
> and it should be not necessary.

I would swear there's other examples like this (and someone brought
this to my attention when i first posted spl_board_init internally).

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot