[U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-12 Thread Ilya Yanok
This patch adds support for the HTKW mcx AM3517-based board.
Serial, Ethernet, NAND, MMC, RTC, EHCI USB host and both
NAND and MMC SPLs are supported.

Requires updated mach-types file.

Signed-off-by: Ilya Yanok 

---
I'm sorry for non-consistent version history, I will give links to my
previous posts along with version numbers.

The last ("Support for HTKW mcx") series:
Changes from V3
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/118530

 - Comment for misc_init_r function fixed
 - Added check for gpio_request return value.
 - Removed #if defined(CONFIG_GENERIC_MMC) around board_mmc_init
 - CONFIG_USE_IRQ and related stuff removed from config
 - CONFIG_OMAP3_MICRON_DDR removed
 - CONFIG_SYS_MAXRAGS changed 32 -> 16
 - Incorrect multiline comments (/*--- ones) fixed
 - CONFIG_SPL_MAX_SIZE rewritten 0xB400 -> (45 << 10)
 - CONFIG_SPL_NAND_WORKSPACE removed

Changes from V2
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/116548

 - None

Changes from V1
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/115026

 - Calls to gpio_set_value after gpio_direction_output removed
 - Minor style problem (tab instead of space) fixed

SPL series:
Changes from V1
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/112892

 - OMAP EHCI support enabled in config
 - MMC SPL support enabled in config

"DaVinci EMAC and HTKW mcx support" series:
Changes from V3
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/112884

 - NAND SPL support enabled in config

Changes from V2
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/112317

 - removed dead code from board/htkw/mcx/Makefile as Mike suggested
 - removed EMAC reset (now done in generic cpu_eth_init())
 - removed some unsuned defines from configuration header

Changes from V1
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/97

 - various style fixes to make checkpatch (almost) happy
 - FSF address removed from GPL comments
 - CONFIG_SYS_TEXT_BASE moved to configuration header, config.mk droped
 - CONFIG_MACH_TYPE is used instead of setting mach type from board code
 - i2c_init removed from misc_init_r
 - cpu_eth_init removed (added to generic place by another patch)
 - CONTROL_PADCONF defines removed
 - Fixed boolean config options not to have a value
 - CONFIG_MUSB_* and related defines removed

 MAINTAINERS |4 +
 board/htkw/mcx/Makefile |   38 +
 board/htkw/mcx/mcx.c|   91 +++
 board/htkw/mcx/mcx.h|  408 +++
 boards.cfg  |1 +
 include/configs/mcx.h   |  371 ++
 6 files changed, 913 insertions(+), 0 deletions(-)
 create mode 100644 board/htkw/mcx/Makefile
 create mode 100644 board/htkw/mcx/mcx.c
 create mode 100644 board/htkw/mcx/mcx.h
 create mode 100644 include/configs/mcx.h

diff --git a/MAINTAINERS b/MAINTAINERS
index a56ca10..c7fcc10 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -903,6 +903,10 @@ Richard Woodruff 
 
omap2420h4  ARM1136EJS
 
+Ilya Yanok 
+
+   mcx ARM ARMV7 (AM35x SoC)
+
 Syed Mohammed Khasim 
 Sughosh Ganu 
 
diff --git a/board/htkw/mcx/Makefile b/board/htkw/mcx/Makefile
new file mode 100644
index 000..4c8db10
--- /dev/null
+++ b/board/htkw/mcx/Makefile
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+#
+# Based on ti/evm/Makefile
+#
+# 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.
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c
new file mode 100644
index 000..163ae98
--- /dev/null
+++ b/board/htkw/mcx/mcx.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
+ *
+ * Based on ti/evm/evm.c
+ *
+ * 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

Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Tom Rini
On Mon, Dec 12, 2011 at 4:15 PM, Ilya Yanok  wrote:
> This patch adds support for the HTKW mcx AM3517-based board.
> Serial, Ethernet, NAND, MMC, RTC, EHCI USB host and both
> NAND and MMC SPLs are supported.
>
> Requires updated mach-types file.

Just define the MACH_ID locally for now so it builds still please.
Also, some problems:

> +#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
> +int board_mmc_init(bd_t *bis)
> +{
> +       omap_mmc_init(0);
> +       return 0;
> +}
> +#endif

That should just be return omap_mmc_init(0);

[snip to config file]
> +#define CONFIG_SYS_TEXT_BASE           0x80008000
[snip]
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /* address 
> 0x6 */
> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"

You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
corruption problem devkit8000 had?

> +#define CONFIG_SYS_NAND_U_BOOT_SIZE    0x6

IIRC you don't need this define since this SPL says you write
u-boot.img to NAND not u-boot.bin

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Ilya Yanok
Hi Tom,

On 13.12.2011 22:52, Tom Rini wrote:
> On Mon, Dec 12, 2011 at 4:15 PM, Ilya Yanok  wrote:
>> This patch adds support for the HTKW mcx AM3517-based board.
>> Serial, Ethernet, NAND, MMC, RTC, EHCI USB host and both
>> NAND and MMC SPLs are supported.
>>
>> Requires updated mach-types file.
> 
> Just define the MACH_ID locally for now so it builds still please.

Ok, will do.

> Also, some problems:
> 
>> +#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
>> +int board_mmc_init(bd_t *bis)
>> +{
>> +   omap_mmc_init(0);
>> +   return 0;
>> +}
>> +#endif
> 
> That should just be return omap_mmc_init(0);

Surely. I've been told about this one already but forgot to fix it. Sorry.

> [snip to config file]
>> +#define CONFIG_SYS_TEXT_BASE   0x80008000
> [snip]
>> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR0x300 /* address 
>> 0x6 */
>> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
>> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME   "u-boot.img"
> 
> You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
> corruption problem devkit8000 had?

Hm. What corruption problem?

>> +#define CONFIG_SYS_NAND_U_BOOT_SIZE0x6
> 
> IIRC you don't need this define since this SPL says you write
> u-boot.img to NAND not u-boot.bin

Right.

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Ilya Yanok
Hi Tom,

On 13.12.2011 22:52, Tom Rini wrote:
>> +#define CONFIG_SYS_TEXT_BASE   0x80008000
> [snip]
>> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR0x300 /* address 
>> 0x6 */
>> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
>> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME   "u-boot.img"
> 
> You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
> corruption problem devkit8000 had?

No, I can't see any problems. I have to say I can't do _real_ MMC boot,
as my board lacks the required jumper, so I'm testing it but starting
SPL from NAND, rewriting omap3_boot_device to be MMC with BDI and
running it further. It reads u-boot.img from MMC and starts it without
any problem.

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Tom Rini
On Tue, Dec 13, 2011 at 12:13 PM, Ilya Yanok  wrote:
> Hi Tom,
>
> On 13.12.2011 22:52, Tom Rini wrote:
>>> +#define CONFIG_SYS_TEXT_BASE           0x80008000
>> [snip]
>>> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /* address 
>>> 0x6 */
>>> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
>>> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"
>>
>> You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
>> corruption problem devkit8000 had?
>
> No, I can't see any problems. I have to say I can't do _real_ MMC boot,
> as my board lacks the required jumper, so I'm testing it but starting
> SPL from NAND, rewriting omap3_boot_device to be MMC with BDI and
> running it further. It reads u-boot.img from MMC and starts it without
> any problem.

Well, is it just your board that's missing the jumper, or the MCX HTWK
lacks the jumper?  If the latter, just drop the MMC bits out :)

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Ilya Yanok
Hi Tom,

On 13.12.2011 23:30, Tom Rini wrote:
 +#define CONFIG_SYS_TEXT_BASE   0x80008000
>>> [snip]
 +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR0x300 /* address 
 0x6 */
 +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
 +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME   "u-boot.img"
>>>
>>> You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
>>> corruption problem devkit8000 had?
>>
>> No, I can't see any problems. I have to say I can't do _real_ MMC boot,
>> as my board lacks the required jumper, so I'm testing it but starting
>> SPL from NAND, rewriting omap3_boot_device to be MMC with BDI and
>> running it further. It reads u-boot.img from MMC and starts it without
>> any problem.
> 
> Well, is it just your board that's missing the jumper, or the MCX HTWK
> lacks the jumper?  If the latter, just drop the MMC bits out :)

I can't ;) this was an explicit requirement.

As for the devkit8000 boot problem, I have BSS set up close to the top
of the RAM. Probably that's the reason I don't see any problems.

Unfortunately, I can't recall why I had moved BSS... It clashed with
something but I don't remember the details.

Regards, Ilya.

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Tom Rini
On Tue, Dec 13, 2011 at 12:44 PM, Ilya Yanok  wrote:
> Hi Tom,
>
> On 13.12.2011 23:30, Tom Rini wrote:
> +#define CONFIG_SYS_TEXT_BASE           0x80008000
 [snip]
> +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        0x300 /* address 
> 0x6 */
> +#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
> +#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"

 You're able to have CONFIG_SYS_TEXT_BASE that low and not have the
 corruption problem devkit8000 had?
>>>
>>> No, I can't see any problems. I have to say I can't do _real_ MMC boot,
>>> as my board lacks the required jumper, so I'm testing it but starting
>>> SPL from NAND, rewriting omap3_boot_device to be MMC with BDI and
>>> running it further. It reads u-boot.img from MMC and starts it without
>>> any problem.
>>
>> Well, is it just your board that's missing the jumper, or the MCX HTWK
>> lacks the jumper?  If the latter, just drop the MMC bits out :)
>
> I can't ;) this was an explicit requirement.
>
> As for the devkit8000 boot problem, I have BSS set up close to the top
> of the RAM. Probably that's the reason I don't see any problems.
>
> Unfortunately, I can't recall why I had moved BSS... It clashed with
> something but I don't remember the details.

OK.  I _want_ to put this into my /next branch (and thanks for working
over all of the issues that've popped up since you first posted the
series) but I also would like to try and keep differences for
difference sake out of the SPL implementations since I know other
folks are starting to look at the code and port their custom boards or
in-tree boards and I'm sure they'll go "why does X place things here
and Y there and my board isn't working?".  So if you can try and
recall what the clash was (and we can comment it, or maybe it was the
FAT thing :)) I'd really appreciate it.

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Ilya Yanok
Hi Tom,

On 14.12.2011 01:47, Tom Rini wrote:
>> As for the devkit8000 boot problem, I have BSS set up close to the top
>> of the RAM. Probably that's the reason I don't see any problems.
>>
>> Unfortunately, I can't recall why I had moved BSS... It clashed with
>> something but I don't remember the details.
> 
> OK.  I _want_ to put this into my /next branch (and thanks for working
> over all of the issues that've popped up since you first posted the
> series) but I also would like to try and keep differences for
> difference sake out of the SPL implementations since I know other
> folks are starting to look at the code and port their custom boards or
> in-tree boards and I'm sure they'll go "why does X place things here
> and Y there and my board isn't working?".  So if you can try and
> recall what the clash was (and we can comment it, or maybe it was the
> FAT thing :)) I'd really appreciate it.

I see. I've looked through my old commit histories but haven't found
anything interesting. All I can say that it wasn't FAT cause I've
changed BSS location before I've even started playing with MMC SPL.

Probably I just didn't want to change TEXT_BASE... Ah, now I recall.
I tried to make SPL working without breaking the board, so I loaded SPL
to SRAM with BDI and tried to make it work with the u-boot.bin I had in
NAND. That's why I had to preserve TEXT_BASE and move BSS instead.
So that seems unrelated to the problem you observe on devkit8000...

Regards, Ilya.

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-13 Thread Tom Rini
On Tue, Dec 13, 2011 at 5:06 PM, Ilya Yanok  wrote:
> Hi Tom,
>
> On 14.12.2011 01:47, Tom Rini wrote:
>>> As for the devkit8000 boot problem, I have BSS set up close to the top
>>> of the RAM. Probably that's the reason I don't see any problems.
>>>
>>> Unfortunately, I can't recall why I had moved BSS... It clashed with
>>> something but I don't remember the details.
>>
>> OK.  I _want_ to put this into my /next branch (and thanks for working
>> over all of the issues that've popped up since you first posted the
>> series) but I also would like to try and keep differences for
>> difference sake out of the SPL implementations since I know other
>> folks are starting to look at the code and port their custom boards or
>> in-tree boards and I'm sure they'll go "why does X place things here
>> and Y there and my board isn't working?".  So if you can try and
>> recall what the clash was (and we can comment it, or maybe it was the
>> FAT thing :)) I'd really appreciate it.
>
> I see. I've looked through my old commit histories but haven't found
> anything interesting. All I can say that it wasn't FAT cause I've
> changed BSS location before I've even started playing with MMC SPL.
>
> Probably I just didn't want to change TEXT_BASE... Ah, now I recall.
> I tried to make SPL working without breaking the board, so I loaded SPL
> to SRAM with BDI and tried to make it work with the u-boot.bin I had in
> NAND. That's why I had to preserve TEXT_BASE and move BSS instead.
> So that seems unrelated to the problem you observe on devkit8000...

Ah-ha!  Whenever I hit that point I always went "oh, right, I forgot
to adjust CONFIG_SYS_TEXT_BASE" :)  So, would you mind either adding a
comment that says in effect what you've got here "Keep at ... so that
we can still be loaded by non-SPL loaders" or whack everything around
and match the am3517 crane/evm and the omap3 boards?  Thanks!

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


Re: [U-Boot] [PATCH V4 2/2] mcx: support for HTKW mcx board

2011-12-14 Thread Ilya Yanok
Hi Tom,

On 14.12.2011 06:48, Tom Rini wrote:
>> Probably I just didn't want to change TEXT_BASE... Ah, now I recall.
>> I tried to make SPL working without breaking the board, so I loaded SPL
>> to SRAM with BDI and tried to make it work with the u-boot.bin I had in
>> NAND. That's why I had to preserve TEXT_BASE and move BSS instead.
>> So that seems unrelated to the problem you observe on devkit8000...
> 
> Ah-ha!  Whenever I hit that point I always went "oh, right, I forgot
> to adjust CONFIG_SYS_TEXT_BASE" :)  So, would you mind either adding a
> comment that says in effect what you've got here "Keep at ... so that
> we can still be loaded by non-SPL loaders" or whack everything around
> and match the am3517 crane/evm and the omap3 boards?  Thanks!

Ok, I put a comment about TEXT_BASE and SPL_{MALLOC,BSS}.

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