Re: [U-Boot] [linux-sunxi] Re: Proposal to add NAND-boot support for Sunxi SPL

2015-05-28 Thread Henrik Nordström
fre 2015-05-22 klockan 15:51 +0200 skrev Hans de Goede:

 What info do we need when we're only reading ? If the BROM can get away with 
 a fixed
 way of reading the nand for booting, we should be able to make the SPL get
 away with it too ...

BROM tries at least 4 different strategies in reading the NAND boot
blocks. Two different NAND protocol strategies and two different format
strategies have been observed (4 different access patterns). And ontop
of this it tries both randomizer scrambled and plain access.

 Distros already need to build and distribute a u-boot-with-spl.bin per 
 supported
 board. This doubles the number of builds they have to do and the number of
 files they need to distribute. If at all possible I would really like
 to have a unified SPL binary.

The SPL shrinks considerably in size if built in thumbs mode.

What I envisioned for sunix u-boot SPL was board-agnostic SPL binaries
with a little configuration header. This way you only need two (or three
is SPI is added) binaries, a list of board configurations and tool for
applying the config and write the resulting binary to the boot device
(NAND/MMC/SPI)

There isn't really that many board specific parameters.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] Announcing u-boot with full A31 support

2014-11-02 Thread Henrik Nordström
sön 2014-11-02 klockan 17:06 +0100 skrev Hans de Goede:

 I still need to cleanup the axp221 and p2wi patches a bit, and then I'll post
 the entire series for review.

Is this the reason why PLL1 configuration is still disabled in the patch
set?

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] [PATCH 0/2] sunxi: Single u-boot binary for Allwinner A10/A13/A20 devices

2014-08-04 Thread Henrik Nordström
sön 2014-08-03 klockan 06:26 +0300 skrev Siarhei Siamashka:

 Most of Allwinner devices have NAND. Booting from NAND is supported by
 BROM, so there is no reason why u-boot SPL can't read it too.

An alterantive is to let BROM load it. BROM has support for a custom
header on the loaded boot binary, and is where Allwinner store hardware
properties needed by the bootloader.

Today we do not use this area in the SPL, but it's trivial to add. Have
always been the intention to have DRAM parameters there.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] Re: [PATCH] video: add cfb console driver for sunxi

2014-08-04 Thread Henrik Nordström
mån 2014-08-04 klockan 17:05 +0200 skrev Luc Verhaegen:
 But... What do we do when u-boot sets up cfb, without setting up a
 simplefb node in the dt. Or what do we do when a simplefb node is set 
 up, but no simplefb code is included in the kernel? Well, we then either 
 need to claim the clocks, and make sure that nothing else touches the 
 memory, or we need to cleanly disable the display engine. But which do 
 we choose, do we keep the u-boot output forever, or do we sync off when 
 the kernel starts?

And what happens if we simply ignore it? Is there a risk of anything
burning beyond software repair? If not, ignore it. There is no need to
support all incompatible mixes even if it means some people will see
strange fireworks on their screens when not following the software
requirements.

It's really no different from booting a kernel with wrong dt, or using a
u-boot with wrong DRAM settings etc. An incompatible mix which is not
meant to function properly.

If you use a u-boot with this framebuffer support then you must also
either use a kernel which supports being booted in such state, or make
sure u-boot shuts things off before handing over to the kernel.

If we can handle the situation gracefully in the kernel then fine, but
it's by no means required, or even desired to spend any effort or even
any serious thoughts on before compatible setups works.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] Re: [PATCH] video: add cfb console driver for sunxi

2014-08-04 Thread Henrik Nordström
mån 2014-08-04 klockan 18:53 +0200 skrev Michal Suchanek:

 Then you have to define what is compatible.

Yes, and the part I responded to was odd unexpected combinations of
u-boot only partially providing the right information (missing in DT) or
kernel not having enabled support.

Likewise there is the opposite situation which is also in the
unsupported area, simplefb nodes in the DT but framebuffer not actually
enabled by u-boot.

Exact details on what needs to be provided in DT and how for glitch free
handover from u-boot to KMS is a bit premature to dive into now.

 eg. you can define that if you do have simplefb in u-boot you should
 have it in kernel.

Maybe. I am only saying that there is no need to try to cover all corner
cases and odd/partial combinations. It's sufficient to cover two cases:
all enabled, all disabled. In both u-boot, kernel and DT. (well, enabled
in kernel but not in DT should be the same as disabled in kernel, so
three cases).

 If you do not have simplefb in kernel the fb memory may get reused and
 the clocks should get disabled as unused, eventually. Unless you set
 the debug option not to disable them. And KMS might eventually take
 over reprogramming or re-enabling the clocks again if you have it.

Memory would be lost today if the region is reserved in DT, but may
eventually be reclaimed when support is available in kernel. And user
should expect strange display effects as clock sources and eventually
memory gets reprogrammed and/or repurposed without anything shutting off
the disaplay engine. I do not see a problem here.

My preferred solution to this problem is to have u-boot shut off (or not
enable) the display engine before starting the kernel, and to provide a
DT without simplefb nodes. Don't worry too much about this odd case in
the kernel.

 Or as pointed out earlier you might find this unacceptable and even
 with simplefb compiled out the KMS driver would need enough simplefb
 logic to analyze the simplefb DT node and reuse the clocks and memory
 without reprogramming.

Maybe, but glich free handover is not a primary or even high priority
goal, or even what I really commented on.

It's something that can be looked into when KMS is functional. And
missing support should cause no more than a temporary display glitch
until KMS have fully claimed and programed the display components.
Likely on the same scale as KMS selecting another display mode.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] Re: [PATCH] video: add cfb console driver for sunxi

2014-08-04 Thread Henrik Nordström
mån 2014-08-04 klockan 19:28 +0200 skrev Luc Verhaegen:

 We can work around most situations gracefully in kernelspace. We should 
 for instance never set a bad mode, and never show random memory content, 
 as that is a total no-go. So some code will have to exist to cleanly 
 disable the display engine (we're in luck, we only need to poke the ahb 
 gating and some clocks).

I seriously don't worry about display mode corruption or showing random
memory if people boot configurations/combinations which are not
supported.

 But if we can overlook some of the above, we also should just consider 
 the memory lost until a kms driver kicks in, and ioremaps/whatevers it 
 for its own use.

If it in any way hinders development of the KMS driver then yes.

 How's this for the sunxi implementation of simplefb:
 * u-boot lists used clocks, to allow some code in simplefb.c to grab all 
   clocks. This is necessary as the list of clocks might change with 
   changed cfb-console driver functionality.

Is this list of clocks in any way different from what KMS needs to use?

 * when the clocks get disabled, the existing display engine setup 
   becomes useless. the dt simplefb node has its status set to disabled. 
   The memory range info remains, none of the reserved ram is returned 
   to system. This needs to happen in both simplefb.c and in clk-sunxi.c.

Disabled by whom?

 * when the memory range gets mapped by the kms driver (currently, on 
   sunxi-3.4 i just use the full disp driver reserved range directly) in 
   a way that it will be released again at unload, the memory range info 
   remains. This ensures that future kms driver reloads can still grab 
   this memory.

Why do a KMS reload need to be able to grab the same memory again? The
display is shut off when the KMS driver is unloaded, right? Or this only
temporary?

 * when however the memory range gets mapped to cma globally, the memory 
   range info is removed.
 
 It makes sense to add the clock handling and the disabling of the
 simple-framebuffer node in the actual simplefb driver. The memory 
 handling should be considered platform specific behaviour for now, but 
 perhaps dt reserved memory infrastructure can come to the rescue in 
 future.

Maybe, but people who need framebuffer in u-boot likley need it in
kernel as well I would think, so I do not worry much about releasing the
memory back to kernel for general purpose use if it has been reserved by
u-boot.

If you really have no use of the display then don't enable it in the
first place (or make sure it's shut off). Including any memory
reservations.

Similar to PC BIOS settings for reserved (shared) memory on many IGP
devices. You don't normally change such settings in kernel. If you want
a different memory layout then shut down, change BIOS settings and boot
again. Not a problem imho. (shut down, change u-boot  DT settings, boot
again).

Regards
Henrik

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


Re: [U-Boot] [PATCH v3 00/10] sunxi: Bug fixes, sun4i and sun5i support and network improvements

2014-07-09 Thread Henrik Nordström
ons 2014-07-09 klockan 09:00 +0100 skrev Ian Campbell:

 I hadn't thought of it. Is it only the SPL binary which differs between
 FEL and non-FEL then?

There is also a small difference in the default environment to enable
boot-from-RAM in the FEL version of main u-boot. This is not enabled in
the normal u-boot to avoid any risk of infinite looping boot failure
from wrongly detected ram boot image.

Regards
Henrik

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


Re: [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu

2014-03-23 Thread Henrik Nordström
sön 2014-03-16 klockan 14:53 +0100 skrev Hans de Goede:
  void reset_cpu(ulong addr)
  {
 + static const struct sunxi_wdog *wdog =
 +  ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)-wdog;
 +
 + /* Set the watchdog for its shortest interval (.5s) and wait */
 + writel(WDT_MODE_RESET_EN | WDT_MODE_EN, wdog-mode);
 + writel(WDT_CTRL_RESTART, wdog-ctl);
 + while (1);

This code is incomplete and do not reload the watchdog if already
running. wdog-ctl is locked by a magic key. Should use

writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, wdog-ctl);

where

#define WDT_CTRL_KEY(0x0a57  1)

Unfortunatley Allwinner kindly omitted this little detail from the User
Manual.

Found out while trying to use the watchdog as a watchdog and not only
reset. Asked Tom while he still was at Allwinner and got clarification
on how to use the watchdog control register.

Regards
Henrik

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


Re: [U-Boot] [PATCH u-boot sunxi 3/4] sunxi: Implement reset_cpu

2014-03-23 Thread Henrik Nordström
sön 2014-03-16 klockan 18:38 + skrev Ian Campbell:

 Not sure why cmd_watchdog.c is sunxi, seems like in principal it could
 be generic.

In principal it could, but there is no common API for setting the
watchdog timer, and no common API for disabling the watchdog once armed.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] [PATCH v2 0/9] sunxi: initial upstreamining effort

2014-03-23 Thread Henrik Nordström
fre 2014-03-21 klockan 21:54 + skrev Ian Campbell:

 I've tried to give corect credit and S-o-b based upon:
   git log --pretty='%aN' linux-sunxi/sunxi -- [PATHS] | sort -u
   git log linux-sunxi/sunxi -- [PATHS] | grep -i signed.off.by  | sort -u
   Manual inspection

As you noticed there is S-o-b lines missing on most of my commits in
sunxi branch. This was corrected in the sunxi-patchqueue branch where
previous patchset were prepared for mainlining.

Please add an implicit S-o-b line on any arch/arm/cpu/armv7/sunxi/ or
board/sunxi/ on patches including code I have committed.

Regards
Henrik

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


Re: [U-Boot] [PATCH v1 0/9] sunxi: initial upstreamining effort

2014-03-14 Thread Henrik Nordström
fre 2014-03-14 klockan 10:33 + skrev Ian Campbell:

 This is my first cut at an upstreamable series based upon the
 https://github.com/linux-sunxi/u-boot-sunxi.git#sunxi tree.

Thanks for picking this up. Much needed.

Regards
Henrik

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


Re: [U-Boot] [linux-sunxi] Re: [PATCH v1 3/9] sunxi: initial sun7i dram setup support

2014-03-14 Thread Henrik Nordström
fre 2014-03-14 klockan 10:17 -0400 skrev Tom Rini:

 And as for the rest of the code, lots of magic numbers to #define
 what/why (why udelay(2) and 22?)

Unfortunately the only documentation we have on the sun7i DRAM
controller is Allwinner boot0 + boot1 code, and that code uses.. magic
numbers  shifts with no explanations.

We have guessed some small bits, but a lot is completely unknown.

Regards
Henriki

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


Re: [U-Boot] [PATCH v2] Always build u-boot.img when using CONFIG_SPL_FRAMEWORK

2013-08-26 Thread Henrik Nordström
Use of uImage formatted u-boot have long been preferred, and recent
changes to better support Falcon mode on MMC now enforces it on MMC.

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
Changes in v2:
  - Rebased to current master.

 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 4a630a5..cadebde 100644
--- a/Makefile
+++ b/Makefile
@@ -398,6 +398,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin
$(obj)System.map
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
 ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
-- 
1.8.3.1



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


[U-Boot] [PATCH] Always build u-boot.img when using CONFIG_SPL_FRAMEWORK

2013-08-21 Thread Henrik Nordström
From 015f65db8c6c01fe527f2f88af255ecdb5e2c58d Mon Sep 17 00:00:00 2001
From: Henrik Nordstrom hen...@henriknordstrom.net
Date: Wed, 21 Aug 2013 21:20:47 +0200
Subject: [PATCH] Always build u-boot.img when using CONFIG_SPL_FRAMEWORK

Use of uImage formatted u-boot binary have long been preferred, and
recent changes to better support Falcon mode on MMC now enforces it on
MMC.
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index 43b57da..76dbda9 100644
--- a/Makefile
+++ b/Makefile
@@ -397,6 +397,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin
$(obj)System.map
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_SPL_FRAMEWORK) += $(obj)u-boot.img
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ,,$(CONFIG_SPL_TARGET))
-- 
1.8.3.1



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


Re: [U-Boot] [PATCH v2] sandbox: block driver using host file/device as backing store

2013-06-16 Thread Henrik Nordström
sön 2013-06-16 klockan 07:50 -0700 skrev Simon Glass:

 Did you send a new version? I might have missed it.

Not yet. Work got in a bit of a panic mode and then been ill for a
while. Not forgotten.

Regards
Henrik


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


Re: [U-Boot] Building two different SPL for the same board?

2013-05-23 Thread Henrik Nordström
ons 2013-05-22 klockan 11:26 -0400 skrev Tom Rini:

 If we can implement it cleanly, this isn't (at the 1000 meter view) all
 that much different than what we do on some PowerPC platforms today
 where everything must fit within a few kilobytes.

Yes it is quite doable. The pieces I have done should be possible to fit
without too much effort.

The question is more if these kinds of board initialization only
programs is seen as suitable for having in the u-boot tree.  It's not
really an SPL as it does not load anything, but it's 99.9% the same code
as used in u-boot SPL.

Regards
Henrik



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


Re: [U-Boot] Building two different SPL for the same board?

2013-05-23 Thread Henrik Nordström
tor 2013-05-23 klockan 16:39 -0400 skrev Tom Rini:

 My rather poor understanding of how some of the Freescale ARM parts do
 SPL is a lot more like this (whack things about, let ROM load next
 parts) than the SPL takes over, loads U-Boot method.  And this is OK,
 in so far as it gets needed jobs done in the resources available.

Got it integrated into the tree now and after config changes it could be
reduced to only a dummy (empty) start.c + linker script. The binary grew
by a few KB compared to the separate version, but still well within the
margin.

https://github.com/linux-sunxi/u-boot-sunxi/commit/79272ff764ee392d616feb02fb91c2dcaad42f04

Will show up for review in next round of submitting the sunxi changes.

Regards
Henrik

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


Re: [U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-21 Thread Henrik Nordström
tis 2013-05-21 klockan 14:26 +0200 skrev Wolfgang Denk:

  but imho the user shouldn't really need to care for these and is why I
  hooked into the go command.
 
 In this case you should use the common C API.

Unfortunately the go command do now know what range(s) it needs to
flush.

 No.  bootm  knows exactly the location and size of the image, so it is
 sufficient to flush / invalidate a part of the memory, usually a
 pretty small one compared to the total RAM size.

See arch/arm/cpu/armv7/cpu.c cleaup_before_linux() for what I am talking
about regarding bootm.

  And I do not think there needs to be commands for flushing specific
  regions other than for testing. Region based flushing is better done by
  code which knows what is needed. It's hard for users to get this right
  as most times it works anyway.
 
 The code should know which ranges need flushing, not the user.

Agreed. But I don't see how this can be done for go.

Should we instrument all the load commands to remember which ranges
something have been loaded into since last flush?

Regards
Henrik

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


Re: [U-Boot] sandbox: block driver using host file/device as backing store, crash in ext4

2013-05-18 Thread Henrik Nordström
tor 2013-05-16 klockan 21:53 -0700 skrev Simon Glass:

 Sorry I meant:
 
 =ext4ls host 0:3
 Segmentation fault (core dumped)
 
 It may not be your code, but I think the segfault is there.

It's crashing in ext4 for me.

#0  ext4fs_set_blk_dev (rbdd=0x6434a0 host_devices, 
info=info@entry=0x643980 fs_partition) at dev.c:56

#0  ext4fs_set_blk_dev (rbdd=0x6434a0 host_devices, 
info=info@entry=0x643980 fs_partition) at dev.c:56
56  get_fs()-total_sect = (info-size * info-blksz) 
57  get_fs()-dev_desc-log2blksz;
58  get_fs()-dev_desc = rbdd;

p(gdb) p get_fs()
$2 = (struct ext_filesystem *) 0x644410 ext_fs
(gdb) p $2-dev_desc
$5 = (block_dev_desc_t *) 0x0

Looks like a generic ext4 bug in the new block size handling code.

I think it just needs to be shuffled around a bit so the dev_desc is
assigned before, not after.

Regards
Henrik

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


Re: [U-Boot] load file to memory in standalone program

2013-05-18 Thread Henrik Nordström
lör 2013-05-18 klockan 15:14 + skrev Scott A:
 Hi,I am attempting to read a set of files from the fat file system
 into a location in memory.This is easy using the command interface
 using something likefatload mmc 0:1 0x4800 file.txt
 However i want to do this in a standalone program. Is there a function
 call available to do this in a standalone program.if so could someone
 give an example.

The standalone API do not include filesystem operations, only raw device
operations.

I think it would be a great addition to add generic filesystem
operations to the standalone API. The fs_read() and fs_write() functions
should be possible to export via the standalone API as-is, but should
probably be wrapped a little bit to select which filesystem/partition to
operate on, similar to do_load() but without the u-boot env magics or
variable arguments.

any specification of filesystem type in the API (if needed) should be
done in string form to ensure a long term stable API I think.

Regards
Henrik







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


Re: [U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-17 Thread Henrik Nordström
fre 2013-05-17 klockan 00:13 +0200 skrev Wolfgang Denk:

 There is a common, architecture-independent C API that implements
 cache flushing/invalidation; please re-read the summary at [1]

Sorry I missed that discussion. Had a bit too much mail for a while.

  Or maybe just punt it. If you are on an arch with incoherent caches then
  make sure to make use of the cache command to flush caches and maybe
  even disable caches before using go.
 
 The cache commands currently do not support subcommands for flushing
 / invalidating the caches.  See again [1].

From what I see the cache commands do have a sub commands for flushing.

icache flush calls icache_invalidate_all().

dcache flush calls flush_dcache_all().

but imho the user shouldn't really need to care for these and is why I
hooked into the go command.

I don't see much of a performance problem with a automatic full cache
flush when using the go command on platforms with incoherent caches. In
most use cases it's not very different from the bootm command which also
needs to do the same (and using a similar hooking mechanism as what I
used for go, but not saying that is a good thing)

Platforms with coherent caches likely do not need to care and can keep
the cache as-is.

And I do not think there needs to be commands for flushing specific
regions other than for testing. Region based flushing is better done by
code which knows what is needed. It's hard for users to get this right
as most times it works anyway.

Regards
Henrik

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


[U-Boot] Building two different SPL for the same board?

2013-05-17 Thread Henrik Nordström
I am looking into reusing the SPL system initialization part for a very
minimalistic SPL which only initializes the board.

To give a bit of context, on the Allwinner CPUs there is a recovery boot
mode where data can be copied over USB and executed by the CPU. But most
of the board including DRAM controller is not initialized by default so
the very first thing you need to do is to upload  execute board
initialization code (but excluding CPU initialization).

Note: It is not really an SPL as all it does is initializing the board
and then returning control to the USB loader so additional code
(u-boot.bin) can be uploaded to DRAM and executed.

I have this implemented today partially out-of-tree leaching objects
from an u-boot build to build a binary with the initialization code. My
question is if it would make sense to try integrate this into the u-boot
tree somehow. Have something similar been done for any other board?

The current code is at
https://github.com/linux-sunxi/sunxi-tools/tree/master/felboot
mainly main.c (entry + stubs), the rest is only for a small printf and
is not needed.

Regards
Henrik

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


Re: [U-Boot] Building two different SPL for the same board?

2013-05-17 Thread Henrik Nordström
fre 2013-05-17 klockan 14:17 -0400 skrev Tom Rini:

 I would say you want to hypothetically add a _felboot build target for
 the allwinner boards that instead of building out a regular
 CONFIG_SPL_FRAMEWORK (I hope!) SPL spits out just a very tiny one that
 does what you need for this use case.  Having different builds for
 different SPL cases is a normal thing that we do on a few boards, but
 none are quite so drastically different sounding as this.

Yes the main SPL is using CONFIG_SPL_FRAMEWORK. But the low level board
initialization is done in s_init (via lowlevel_init).

This other boot helper is basically only calling s_init() and then
returns to the caller with the board now configured in a reasonable
state allowing it to accept u-boot.bin to be uploaded into SDRAM.

Regards
Henrik

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


Re: [U-Boot] hush variable expansion quoting

2013-05-16 Thread Henrik Nordström
tis 2013-05-14 klockan 19:06 +0200 skrev Henrik Nordström:
 Quoting is broken (ignored/lost) when there is variable expansions
 
 # test a b = c; echo $?
 1
 # v=a b
 # test $v = c; echo $?
 0
 # echo ab
 ab
 # v=ab
 # echo $v
 a b

And not entirely unexpected escaping helps here

# echo \$v\
ab

Please note that this issue hits the whole command pipe as soon as
there is one variable expansion.

# echo a   b $v
a b a b
# echo a   b a   b
ab ab

this due to the execution taking a quite differen path when there is
variables involved, and quotes gets destroyied in that path.

upstream hush do not have this problem, but it's not entirely trivial to
pinpoint what fixed it without running an bisect (too many related fixes
 restructuring)

Regards
Henrik

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


Re: [U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-16 Thread Henrik Nordström
tor 2013-05-16 klockan 09:37 -0400 skrev Tom Rini:

 That this topic keeps coming up is one of the reasons I asked Henrik to
 post this patch when I was looking over the Allwinner support queue.  I
 thought this was a rather clever fixup.

For what it's worth a similar issue is also relevant to bootm, but it's
a bit different there trying to disable the icache entirely.

I do not like having these things arch specific. I implemented it as an
ARMv7 hook only because there is no general cross-platform u-boot
function for clearing the icache. I'd much rather have a generic
function call for invalidating the cache and leave it up to the arches
to get it implemented where needed. 

icache_invalidate_all() is close to that call, except that it's only
reasonably possible to use it on ARMv7 currently. Trying to use it
anywhere else will give confusing (but correct) and unneeded errors on
the console, if it at all builds (requires CONFIG_CACHE).

Cluttering the places that need the flush with ARCH specific details
such as defines is generally not very maintainable. I'd rather have
those in the appropriate header.

 The problem is that with go we can't know 'size' for go because it's
 just a binary blob, so we need, roughly, flush_cache(gd-ram_top -
 gd-reloc_off, gd-ram_size) yes?  That I believe is one of the points
 that wasn't solved in the last go-round here.

Yes.

For this approach the icache flushes need to go into the places where
data are loaded into memory.  But that would be even worse performance
killer.

Or maybe just punt it. If you are on an arch with incoherent caches then
make sure to make use of the cache command to flush caches and maybe
even disable caches before using go.

Regards
Henrik

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


Re: [U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-15 Thread Henrik Nordström
ons 2013-05-15 klockan 17:11 +0200 skrev Albert ARIBAUD:

 What is the rationale behind putting it in arch/ rather than in common/
 by adding this to the existing common/cmd_boot.c file under ARMv7
 conditionals?

Only because of what I said earlier: blindly calling
invalidate_icache_all() from the go command will cause loud complains on
other arches where the icache is not supported/enabled.

 Also:
 
  ARM v7 runs with icache enabled. For reliable results the go command
  needs to flush the icache before jumping or it may risk running
  cached instructions that differ from what currently is in memory.
 
 IIUC, the issue is due to cache being enabled when doing the go, rather
 than due to armv7 per se.

Not entirely sure what you mean.

 So, should we not have this icache flush conditioned at compile time on
 cache being compiled in, and at run time on cache being enabled? This
 way, we would automatically cater for the same issue appearing in other
 ARM CPUs, and even more, in other architectures.

Except.. see common/cmd_cache.c top of file and you'll see the yelling I
am talking about.

Regards
Henrik

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


Re: [U-Boot] [PATCH] sandbox: block driver using host file/device as backing store

2013-05-15 Thread Henrik Nordström
ons 2013-05-15 klockan 10:42 -0700 skrev Simon Glass:
 Some high-level comments:
 
 Configuring for sandbox board...
 sandbox.c: In function ‘host_dev_bind’:

  - should not have any warnings

Shame on me :)

Fixed now, and should have before submitting for review.

 =sb bind
 Segmentation fault (core dumped)
 
 - should print a nice error if an arg is missing

Right. done.

And correct usage is
sb bind 0 file
(devices 0-3 supported, arbitrary limit of 4 currently)

have corrected the help message to reflect this.


 =sb bind fred
 =
 
 - should print an error if the file is not found

In this version it opens the file on access and you get the error then.
Have now moved that to the bind operation which gives immediate
feedback.

Initially I thought of having some predefined device backing names but
it's better to always use the sb bind command to establish the backing
name.

Have also added and sb info command to show the bound devices.

 - should create an example of how to use this

Yes. Is there any existing documentation for sandbox somewhere to add
to?

 - suggest a test script in test/sandbox which sets up a loopback
 device containing a partition table and ext2 filesystem (for example,
 then runs U-Boot sandbox and lists and reads a file. Example test
 scripts you might copy are:
 
 http://patchwork.ozlabs.org/patch/228876/
 
 and this rather more complicated one:
 
 http://patchwork.ozlabs.org/patch/211049/

Ok. I'll look into this.

 Also please enable partitions and EFI support so we get more functionality:
 
 #define CONFIG_PARTITION_UUIDS
 #define CONFIG_CMD_PART
 #define CONFIG_EFI_PARTITION

Ok, can do this. Didn't want to enable too much as part of the block
driver patch.

Done.

Current version of the patch is at
https://github.com/hno/u-boot/commit/9b5f9b762a6e901f599b7ae1c9946806a4422929.patch

will submit a new copy to the mailinglist after adding documentation 
testsuite.

Regards
Henrik

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


[U-Boot] [PATCH v2] sandbox: block driver using host file/device as backing store

2013-05-15 Thread Henrik Nordström
Version 2 of this patch addressing the code comments by Simon and adding
some small missing pieces.

left on the to-do is documentation and adding test suite tests.

---
A simple host block driver using any host file/device
as backing store.

Adds two sb subcommands for managing host device bindings:
sb bind dev [filename] - bind host device to file
sb info [dev]- show device binding  info

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 common/cmd_sandbox.c   |  54 +++
 disk/part.c|  23 +++-
 drivers/block/Makefile |   1 +
 drivers/block/sandbox.c| 127 +
 include/config_fallbacks.h |   3 +-
 include/configs/sandbox.h  |   6 +++
 include/part.h |   3 ++
 include/sandboxblockdev.h  |  29 +++
 8 files changed, 228 insertions(+), 18 deletions(-)
 create mode 100644 drivers/block/sandbox.c
 create mode 100644 include/sandboxblockdev.h

diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
index a28a844..59fbc97 100644
--- a/common/cmd_sandbox.c
+++ b/common/cmd_sandbox.c
@@ -19,6 +19,8 @@
 
 #include common.h
 #include fs.h
+#include part.h
+#include sandboxblockdev.h
 
 static int do_sandbox_load(cmd_tbl_t *cmdtp, int flag, int argc,
   char * const argv[])
@@ -38,10 +40,60 @@ static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int 
argc,
return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
 }
 
+static int do_sandbox_bind(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   if (argc  2 || argc  3)
+   return CMD_RET_USAGE;
+   char *ep;
+   char *dev_str = argv[1];
+   char *file = argc = 3 ? argv[2] : NULL;
+   int dev = simple_strtoul(dev_str, ep, 16);
+   if (*ep) {
+   printf(** Bad device specification %s **\n, dev_str);
+   return CMD_RET_USAGE;
+   }
+   return host_dev_bind(dev, file);
+}
+
+static int do_sandbox_info(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   if (argc  1 || argc  2)
+   return CMD_RET_USAGE;
+   int min_dev = 0;
+   int max_dev = CONFIG_HOST_MAX_DEVICES - 1;
+   if (argc = 2) {
+   char *ep;
+   char *dev_str = argv[1];
+   int dev = simple_strtoul(dev_str, ep, 16);
+   if (*ep) {
+   printf(** Bad device specification %s **\n, dev_str);
+   return CMD_RET_USAGE;
+   }
+   min_dev = dev;
+   max_dev = dev;
+   }
+   int dev;
+   printf(%3s %12s %s\n, dev, blocks, path);
+   for (dev = min_dev; dev = max_dev; dev++) {
+   printf(%3d , dev);
+   block_dev_desc_t *blk_dev = host_get_dev(dev);
+   if (!blk_dev)
+   continue;
+   struct host_block_dev *host_dev = blk_dev-priv;
+   printf(%12lu %s\n, (unsigned long)blk_dev-lba,
+  host_dev-filename);
+   }
+   return 0;
+}
+
 static cmd_tbl_t cmd_sandbox_sub[] = {
U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, , ),
U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, , ),
U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, , ),
+   U_BOOT_CMD_MKENT(bind, 3, 0, do_sandbox_bind, , ),
+   U_BOOT_CMD_MKENT(info, 3, 0, do_sandbox_info, , ),
 };
 
 static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -70,4 +122,6 @@ U_BOOT_CMD(
sb ls host filename  - list files on host\n
sb save host dev filename addr bytes [offset] - 
save a file to host\n
+   sb bind dev [filename] - bind \host\ device to file\n
+   sb info [dev]- show device binding  info
 );
diff --git a/disk/part.c b/disk/part.c
index d73625c..5906aef 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -59,6 +59,9 @@ static const struct block_drvr block_drvr[] = {
 #if defined(CONFIG_SYSTEMACE)
{ .name = ace, .get_dev = systemace_get_dev, },
 #endif
+#if defined(CONFIG_SANDBOX)
+   { .name = host, .get_dev = host_get_dev, },
+#endif
{ },
 };
 
@@ -302,6 +305,9 @@ static void print_part_header (const char *type, 
block_dev_desc_t * dev_desc)
case IF_TYPE_MMC:
puts (MMC);
break;
+   case IF_TYPE_HOST:
+   puts(HOST);
+   break;
default:
puts (UNKNOWN);
break;
@@ -462,23 +468,6 @@ int get_device_and_partition(const char *ifname, const 
char *dev_part_str,
int part;
disk_partition_t tmpinfo;
 
-   /*
-* For now, we have a special case for sandbox, since there is no
-* real block device support.
-*/
-   if (0 == strcmp(ifname, host)) {
-   *dev_desc = NULL;
-   info-start = info-size =  info-blksz = 

Re: [U-Boot] [PATCH v2] sandbox: block driver using host file/device as backing store

2013-05-15 Thread Henrik Nordström
ons 2013-05-15 klockan 15:20 -0700 skrev Simon Glass:
 Hi Henrik,
 
 On Wed, May 15, 2013 at 2:54 PM, Henrik Nordström
 hen...@henriknordstrom.net wrote:
  Version 2 of this patch addressing the code comments by Simon and adding
  some small missing pieces.
 
 Looks good.
 
 For change log, you should follow the standard approach - also instead
 of 'comments by Simon' it is good to list the things you changed. You
 might find patman useful for preparing and sending patches.

Just looked into it and looks nice. Giving it a try for next version.

Took a little while to get started, mostly because it crashes  burns
when not finding an matching alias for sandbox.

 blank line here, please fix globally (a blank line between
 declarations and code).

Ok.

  +static int do_sandbox_info(cmd_tbl_t *cmdtp, int flag, int argc,
  +  char * const argv[])
  +{
  +   if (argc  1 || argc  2)
  +   return CMD_RET_USAGE;
 
 Probably best to put this after the declarations

Ok. Also restrucured do_sandbox_bind a little to match this. There one
of the declarations depends on this being checked first.


 Move to top of function. Try to collect your declarations within a
 block when it's easy to do so.

Ok.


  +   printf(%3s %12s %s\n, dev, blocks, path);
  +   for (dev = min_dev; dev = max_dev; dev++) {
  +   printf(%3d , dev);
  +   block_dev_desc_t *blk_dev = host_get_dev(dev);
  +   if (!blk_dev)
  +   continue;
 
 Does this case ever happen? If so you don't print \n.

Yes. And it then relies on the driver to print an error.

  +   struct host_block_dev *host_dev = blk_dev-priv;
 
 Maybe leave the assignment here but put the declaration at the start
 of the block.

Yes.

   COBJS-$(CONFIG_IDE_SIL680) += sil680.o
   COBJS-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
   COBJS-$(CONFIG_SYSTEMACE) += systemace.o
  +COBJS-$(CONFIG_SANDBOX) += sandbox.o
 
 Alphabetic order so this should go up two.

up seven. sorted on filename here not CONFIG_..

  +#include sandboxblockdev.h
 
 How about sandbox-blockdev.h

Yee.

 puts() when you don't have format args. Please fix globally.

Ok.

  +   if (host_dev-fd == -1) {
  +   printf(Failed to access host backing file '%s'\n,
  +  host_dev-filename);
  +   return 1;
 
 -ENOENT might be better (include errno.h)

or maybe just -errno?

and handle the error in do_sandbox_bind().

  +int host_dev_bind(int dev, char *filename);
 
 Please add a comment as to what this function does, describing the
 meaning and valid values for each argument.

Ok.

 =ext4load host 0:3
 Segmentation fault (core dumped)

Doesn't ext2load expect a address  filename to load?

Regads
Henrik

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


Re: [U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-15 Thread Henrik Nordström
ons 2013-05-15 klockan 19:39 +0200 skrev Albert ARIBAUD:



 I understand all this, but what I am interested in is the root issue.
 
 IIUC, the problem is that some code is loaded in DDR, and the CPU is
 about to jump to it, but its instruction cache is enabled so maybe some
 instructions after 'go' will be (wrongly) fetched from I-cache instead
 of being read from DDR (and fed into I-cache).

Yes.

 Nothing in this is ARMv7 specific; it could happen in an arm926ejs just
 as well. It could happen on any CPU with distinct, non-consistent I-
 and D- caches an enabled I-cache.

Correct on all accounts.

 So my suggestion is to implement the icache_flush in common/bmmt_cmd.c
 as follows:
 
 ...
 /* just about to 'go' */
 #if CONFIG_ARM
 #if CONFIG_ICACHE
 if (icache_status())
   invalidate_icache_all();
 #endif /* CONFIG_ICACHE */
 #endif /* CONFIG_ARM */
 /* now go */

This style is a nightmare for adding more arches needing this, but
solves the problem today.

But there is no CONFIG_ICACHE. In ARM there is CONFIG_SYS_ICACHE_OFF but
it's not quite the same.

From what I can tell there is no need to theck icache_status(). It's
always safe to call invalidate_icache_all().

So it's back to use the compiler define for ARMv7.

 The only problem I see for now is that, while ARM has a default
 icache_status(), apparently the targets that need the invalidate above
 do not have their own version of icache_status(); they'll need to
 provide one for this code to work.

And also an invalidate_icache_all(). That only exists on armv7 today.

m68k have icache_invalid() which seems to be the same.

Regards
Henrik

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


[U-Boot] ARM v7: Flush icache when executing a program with go

2013-05-14 Thread Henrik Nordström
Tom Rini wanted me to post this again. There is no change from previous
version.

I do agree with Wolfgang Denk that this really SHOULD NOT be arch
specific. The only reason why I made this ARMv7 specific is because
blindly calling invalidate_icache_all() from the go command will cause
loud complains on other arches where the icache is not
supported/enabled. The question is what is the correct solution

- Doing it arch specific like this (or other arch aproach?)

- Change invalidate_icache_all() to be silent if the icache is not
enabled/supported?

- Something else?

---

ARM v7 runs with icache enabled. For reliable results the go command
needs to flush the icache before jumping or it may risk running
cached instructions that differ from what currently is in memory.

---
 arch/arm/cpu/armv7/Makefile   |1 +
 arch/arm/cpu/armv7/cmd_boot.c |   37 +
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/cmd_boot.c

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 4fdbee4..da1b5e8 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -31,6 +31,7 @@ COBJS += cache_v7.o
 
 COBJS  += cpu.o
 COBJS  += syslib.o
+COBJS  += cmd_boot.o
 
 ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
 SOBJS  += lowlevel_init.o
diff --git a/arch/arm/cpu/armv7/cmd_boot.c b/arch/arm/cpu/armv7/cmd_boot.c
new file mode 100644
index 000..6758a55
--- /dev/null
+++ b/arch/arm/cpu/armv7/cmd_boot.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * 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
+ */
+
+/*
+ * Misc boot support
+ */
+#include common.h
+#include command.h
+
+#ifdef CONFIG_CMD_GO
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+char * const argv[])
+{
+   invalidate_icache_all();
+   return entry(argc, argv);
+}
+#endif
-- 
1.7.7.6



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


[U-Boot] hush variable expansion quoting

2013-05-14 Thread Henrik Nordström
Quoting is broken (ignored/lost) when there is variable expansions

# test a b = c; echo $?
1
# v=a b
# test $v = c; echo $?
0
# echo ab
ab
# v=ab
# echo $v
a b

Regards
Henrik

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


[U-Boot] [PATCH] sandbox: block driver using host file/device as backing store

2013-05-14 Thread Henrik Nordström
A simple host block driver using any host file/device
as backing store.

The mapping is established using the sb bind command

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 common/cmd_sandbox.c   |  10 +++-
 disk/part.c|  20 ++-
 drivers/block/Makefile |   1 +
 drivers/block/sandbox.c| 130 +
 include/config_fallbacks.h |   3 +-
 include/configs/sandbox.h  |   2 +
 include/part.h |   3 ++
 7 files changed, 150 insertions(+), 19 deletions(-)
 create mode 100644 drivers/block/sandbox.c

diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
index 206a486..492d569 100644
--- a/common/cmd_sandbox.c
+++ b/common/cmd_sandbox.c
@@ -32,9 +32,16 @@ static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int 
argc,
return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_sandbox_bind(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   return host_dev_bind(atoi(argv[1]), argv[2]);
+}
+
 static cmd_tbl_t cmd_sandbox_sub[] = {
U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, , ),
U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, , ),
+   U_BOOT_CMD_MKENT(bind, 3, 0, do_sandbox_bind, , ),
 };
 
 static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -59,5 +66,6 @@ U_BOOT_CMD(
sb, 6,  1,  do_sandbox,
Miscellaneous sandbox commands,
load host addr filename [bytes offset]  - load a file from 
host\n
-   sb ls host filename  - save a file to host
+   ls host filename  - save a file to host\n
+   bind dev filename - bind \host\ device to file
 );
diff --git a/disk/part.c b/disk/part.c
index d73625c..648839b 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -59,6 +59,9 @@ static const struct block_drvr block_drvr[] = {
 #if defined(CONFIG_SYSTEMACE)
{ .name = ace, .get_dev = systemace_get_dev, },
 #endif
+#if defined(CONFIG_SANDBOX)
+   { .name = host, .get_dev = host_get_dev, },
+#endif
{ },
 };
 
@@ -462,23 +465,6 @@ int get_device_and_partition(const char *ifname, const 
char *dev_part_str,
int part;
disk_partition_t tmpinfo;
 
-   /*
-* For now, we have a special case for sandbox, since there is no
-* real block device support.
-*/
-   if (0 == strcmp(ifname, host)) {
-   *dev_desc = NULL;
-   info-start = info-size =  info-blksz = 0;
-   info-bootable = 0;
-   strcpy((char *)info-type, BOOT_PART_TYPE);
-   strcpy((char *)info-name, Sandbox host);
-#ifdef CONFIG_PARTITION_UUIDS
-   info-uuid[0] = 0;
-#endif
-
-   return 0;
-   }
-
/* If no dev_part_str, use bootdevice environment variable */
if (!dev_part_str || !strlen(dev_part_str) ||
!strcmp(dev_part_str, -))
diff --git a/drivers/block/Makefile b/drivers/block/Makefile
index f1ebdcc..2d2fb55 100644
--- a/drivers/block/Makefile
+++ b/drivers/block/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_SATA_SIL) += sata_sil.o
 COBJS-$(CONFIG_IDE_SIL680) += sil680.o
 COBJS-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
 COBJS-$(CONFIG_SYSTEMACE) += systemace.o
+COBJS-$(CONFIG_SANDBOX) += sandbox.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c
new file mode 100644
index 000..185cee8
--- /dev/null
+++ b/drivers/block/sandbox.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2013 Henrik Nordstrom hen...@henriknordstrom.net
+ *
+ * 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 config.h
+#include common.h
+#include part.h
+#include os.h
+
+#ifndef CONFIG_HOST_MAX_DEVICES
+#define CONFIG_HOST_MAX_DEVICES 4
+#endif
+
+static struct host_block_dev {
+   block_dev_desc_t blk_dev;
+   char *filename;
+   int fd;
+} host_devices[CONFIG_HOST_MAX_DEVICES];
+
+static struct host_block_dev *
+find_host_device(int dev)
+{
+   if (dev = 0  dev  CONFIG_HOST_MAX_DEVICES)
+   return host_devices[dev];
+
+   printf(Invalid host device number\n);
+   return NULL;
+}
+
+static unsigned long host_block_read(int dev, unsigned long 

Re: [U-Boot] Possible GPL violation

2013-03-08 Thread Henrik Nordström
fre 2013-03-08 klockan 10:46 +1300 skrev Charles Manning:
 I have had to deal with this a bit so I'll give my 2c.
 
 Under the GPL2, the company only has to provide source, or make an
 offer to do so, to customers buying the product containing the GPL
 code.

If you go the written offer path then it's not limited to your
customers, the written offer is valid for any third party which pretty
much means anyone. This is to cover that your customers have the right
to redistribute non-commercially with a copy of your written offer.

Regards
Henrik

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


Re: [U-Boot] [PATCH 2/2] net: add ICPlus PHY driver

2012-11-28 Thread Henrik Nordström
tor 2012-11-29 klockan 07:27 +0100 skrev Marek Vasut:
 Dear yegorsli...@googlemail.com,
 
  From: Yegor Yefremov yegorsli...@googlemail.com
  
  The driver code was taken from Linux kernel source:
  drivers/net/phy/icplus.c
  
  Signed-off-by: Yegor Yefremov yegorsli...@googlemail.com
 [...]
 
 Is there any user for this PHY please?

I don't have one, but know at least one user having one in an A10 based
netbook.

http://linux-sunxi.org/File:H6-netbook-mainboard.jpg

Regards
Henrik

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


Re: [U-Boot] [PATCH 0/2] [RFC] DEBUG: relocate to fixed address

2012-11-27 Thread Henrik Nordström
tis 2012-11-27 klockan 16:22 -0600 skrev Scott Wood:

 How am I going to script gdb to figure out the relocation address when  
 I'm just running it on the image to get symbols, not actually  
 connecting to the target?

It can be calculated from ram size and size of your u-boot binary
including bss (reported by size on the elf binary).

If you have u-boot running then bdinfo shows the address.

Hm.. wasn't there talk about a non-relocating u-boot binary for
debugging? Isn't that more appropriate for what you are trying to
accomplish?

 Where would you get the symbol table to load that matches U-Boot  
 post-relocation?

GDB supports symbol table relocation using add-symbol-file command.

Regards
Henrik

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


Re: [U-Boot] [PATCH 1/2] mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target name

2012-11-26 Thread Henrik Nordström
sön 2012-11-25 klockan 21:01 +0100 skrev Wolfgang Denk:

 I think you should avoid doing that.  It's ugly, and I see no real
 advantages for it.

Avoid using the same board config file for multiple boards even when
they differ only in one config parameter or in the SoC model mounted on
the board?

Regards
Henrik

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


Re: [U-Boot] [PATCH 03/22] ARM sunxi: I2C driver

2012-11-26 Thread Henrik Nordström
mån 2012-11-26 klockan 12:13 +0100 skrev Heiko Schocher:

 One question: Did you looked at the i2c driver in
 drivers/i2c/mvtwsi.c? I just looked roughly over
 it, there seems some differences, but there are
 some equal defines, for example the TWI_CTL_*, TWI_STAT_*
 defines, not too big difference in the register structure ...
 maybe it is worth to check, if it is possible to extend the
 existing driver to fit in your needs?

I hadnät noticed, but indeed there is many similarities, and some
differences. The two controllers are clearly of related origin.


Regards
Henrik

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


Re: [U-Boot] [PATCH 1/2] mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target name

2012-11-26 Thread Henrik Nordström
mån 2012-11-26 klockan 14:05 -0700 skrev Tom Rini:

 I think part of the solution is that in the environment now we have
 board_name for the unique run-time-determined board we are on (which
 defaults to CONFIG_SYS_BOARD).  In each of these Allwiner SoCs do we
 have the ability to tell at run-time what we are on, or only build-time?

Only build-time. There is no hardware board ID of any kind on the
boards. But it mostly matters for SPL to know you have the right SPL for
the board, and cosmetics to have main u-boot report the right board
model (not important).

But the more I think about it I think we will move all the important
board parameters to a configuration header added to the SPL binary
image, and we will then also add board name there. There is simply too
many boards needing slightly different parameters but almost the same.

Regards
Henrik

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


Re: [U-Boot] [PATCH 0/2] Makefile mkconfig: Ease board name maintenance on shared boards

2012-11-26 Thread Henrik Nordström
mån 2012-11-26 klockan 14:13 -0700 skrev Tom Rini:

 In the future, please thread the 0/N to the patch series, thanks.

I know. Didn't notice that my git was wrongly configured in this small
patch series before it was sent, and don't know what whent wrong with
the threading of the cover letter in the third big sunxi patch series.
Will make sure they are threaded properly next time.

 So the root problem is that you are able to share a good amount of code
 between many (but lets just go with a10a and a10b for now) boards and
 share a common config file.

Yes.

 When building for a10a in boards.cfg you
 do:
 a10a ... allwinner_common:PERIPHERALX=A10A,PERIPHERALY=A10A
 a10b ... allwinner_common:PERIPHERALX=A10B,PERIPHERALY=A10B

Yes.

 to handle the differences between a10a and a10b.  So, what are you
 wanting to save the fact that we built for a10a or a10b for?  Is this
 later passed along in the environment for run-time detection?  Is there
 no other way to do run-time detection?

Currently it's only for diagnostics purposes, with the board name
reported by SPL at boot time to notice if someone tries to use the wrong
SPL for their board. Several users have already benefitted from this
when trying to figure out why their built OS image do not boot proper.
It's a bit subtle as many times the wrong SPL (incorrect DRAM settings)
will load u-boot just fine only hang while booting the kernel.

But it's mostly cosmetic. Not very important.

Regards
Henirk

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


Re: [U-Boot] [PATCH 1/2] mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target name

2012-11-26 Thread Henrik Nordström
mån 2012-11-26 klockan 16:51 -0500 skrev Tom Rini:

 This is why, sooner rather than later I believe, we need to come up
 with a good way to pass device trees in and around, asap.  An SPL that
 contains a device tree for the correct board (and passes along to
 U-Boot which could in turn pass along to the kernel if it's a full
 tree) would solve your problem, yes?

Yes, if it can be made to fit. The SPL have to fit within 24KB code+data
and we are already at 20KB for the MMC/SD version. Size still unknown
for NAND SPL with the MTD driver still in very early stages. Can
probably shave off a fair bit by removing console output from the SPL
but prefer not to.

Regards
Henrik

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


[U-Boot] [PATCH] ARM v7: Flush icache when executing a program with go

2012-11-25 Thread Henrik Nordström
ARM v7 runs with icache enabled. For reliable results the go command
needs to flush the icache before jumping or it may risk running
cached instructions that differ from what currently is in memory.

---
 arch/arm/cpu/armv7/Makefile   |1 +
 arch/arm/cpu/armv7/cmd_boot.c |   37 +
 2 files changed, 38 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/cmd_boot.c

diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 4fdbee4..da1b5e8 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -31,6 +31,7 @@ COBJS += cache_v7.o
 
 COBJS  += cpu.o
 COBJS  += syslib.o
+COBJS  += cmd_boot.o
 
 ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA20),)
 SOBJS  += lowlevel_init.o
diff --git a/arch/arm/cpu/armv7/cmd_boot.c b/arch/arm/cpu/armv7/cmd_boot.c
new file mode 100644
index 000..6758a55
--- /dev/null
+++ b/arch/arm/cpu/armv7/cmd_boot.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2000-2003
+ * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+ *
+ * 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
+ */
+
+/*
+ * Misc boot support
+ */
+#include common.h
+#include command.h
+
+#ifdef CONFIG_CMD_GO
+unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
+char * const argv[])
+{
+   invalidate_icache_all();
+   return entry(argc, argv);
+}
+#endif
-- 
1.7.7.6


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


[U-Boot] [PATCH 0/2] Makefile mkconfig: Ease board name maintenance on shared boards

2012-11-25 Thread Henrik Nordström
This patch series adds CONFIG_SYS_BOARD_NAME with the boards.cfg board
name. This differs from the source level board name when multiple boards
share the same source using parameters set in boards.cfg.

This is used by the upcoming Allwinner sunxi (A10  A13) SoC support

Henrik Nordstrom (2):
  mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target
name
  Makefile: Accept target names in all lower case to ease matching

 Makefile   |1 +
 include/config_fallbacks.h |4 
 mkconfig   |1 +
 3 files changed, 6 insertions(+), 0 deletions(-)

-- 
1.7.7.6


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


[U-Boot] [PATCH 1/2] mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target name

2012-11-25 Thread Henrik Nordström
This change makes CONFIG_SYS_BOARD_NAME globally available as the configured
target name, avoiding the need to define manually for boards having multiple
targets sharing the same board implementation.
---
 include/config_fallbacks.h |4 
 mkconfig   |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/config_fallbacks.h b/include/config_fallbacks.h
index bfb9680..a1b2b54 100644
--- a/include/config_fallbacks.h
+++ b/include/config_fallbacks.h
@@ -26,4 +26,8 @@
 #define CONFIG_EXT4_WRITE
 #endif
 
+#ifndef CONFIG_SYS_BOARD_NAME
+#define CONFIG_SYS_BOARD_NAME CONFIG_SYS_TARGET
+#endif
+
 #endif /* __CONFIG_FALLBACKS_H */
diff --git a/mkconfig b/mkconfig
index 7c9aa74..ddce037 100755
--- a/mkconfig
+++ b/mkconfig
@@ -173,6 +173,7 @@ done
 echo #define CONFIG_SYS_ARCH  \${arch}\   config.h
 echo #define CONFIG_SYS_CPU   \${cpu}\config.h
 echo #define CONFIG_SYS_BOARD \${board}\  config.h
+echo #define CONFIG_SYS_TARGET \${BOARD_NAME}\  config.h
 
 [ ${vendor} ]  echo #define CONFIG_SYS_VENDOR \${vendor}\  config.h
 
-- 
1.7.7.6


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


[U-Boot] [PATCH 2/2] Makefile: Accept target names in all lower case to ease matching

2012-11-25 Thread Henrik Nordström
---
 Makefile |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 1a17be9..5a98745 100644
--- a/Makefile
+++ b/Makefile
@@ -752,6 +752,7 @@ unconfig:
 sinclude $(obj).boards.depend
 $(obj).boards.depend:  boards.cfg
@awk '(NF  $$1 !~ /^#/) { print $$1 :  $$1 _config; $$(MAKE) }' 
$  $@
+   @awk '(NF  $$1 !~ /^#/  tolower($$1) != $$1) { print tolower($$1) 
:  $$1 _config; $$(MAKE) }' $  $@
 
 #
 # Functions to generate common board directory names
-- 
1.7.7.6


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


[U-Boot] [PATCH 00/22] ARM: Allwinner sunXi (A10 A13) SoC support

2012-11-25 Thread Henrik Nordström
This patch series adds support for Allwinner sunxi (A10  A13) SoC
families, including SPL loader to boot u-boot directly from MMC/SD.

Aaron (1):
  ARM: sunxi: MMC driver

Henrik Nordstrom (14):
  ARM sunxi: I2C driver
  ARM: sunxi: watchdog support
  power: Add AXP209 Power Management controller (I2C)
  ARM sunxi: Basic GPIO driver
  tools: mksunixboot adding a Allwinner boot header
  sunxi: Add more network commands and netconsole support
  ARM: sunxi: U-Boot SPL capable of booting directly from MMC
  ARM sunxi: SPL support for Olimex A13-OLinuXino board
  ARM sunxi: SPL support for Mele A1000 board
  ARM sunxi: SPL support for Cubieboard board
  ARM sunxi: SPL support for Hackberry 1GB board
  ARM sunxi: SPL support for Mini-X board
  ARM sunxi: SPL support for hyundai A7HD board
  ARM sunxi: SPL support for Mele A3700 board

Jari Helaakoski (1):
  ARM sunxi: SPL support for a13_mid board

Sergey Lapin (1):
  ARM sunxi: SPL support for MK802 board

Stefan Roese (2):
  net: Add sunxi (Allwinner) wemac driver
  ARM: sun4i: Enable ethernet support (wemac) on A10 boards

Tom Cubie (1):
  ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support

hehopmajieh (1):
  ARM sunxi: SPL support for Olinuxino A13 Micro

j (1):
  ARM sunxi: SPL support for Rikomagic MK802II board

 MAINTAINERS |   13 +
 Makefile|   12 +
 arch/arm/cpu/armv7/Makefile |2 +-
 arch/arm/cpu/armv7/sunxi/Makefile   |   51 ++
 arch/arm/cpu/armv7/sunxi/board.c|  132 ++
 arch/arm/cpu/armv7/sunxi/clock.c|  171 +++
 arch/arm/cpu/armv7/sunxi/dram.c |  445 ++
 arch/arm/cpu/armv7/sunxi/pinmux.c   |   61 +++
 arch/arm/cpu/armv7/sunxi/reset.S|   39 ++
 arch/arm/cpu/armv7/sunxi/timer.c|  117 +
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |   63 +++
 arch/arm/include/asm/arch-sunxi/clock.h |  179 +++
 arch/arm/include/asm/arch-sunxi/cpu.h   |  146 ++
 arch/arm/include/asm/arch-sunxi/dram.h  |  114 +
 arch/arm/include/asm/arch-sunxi/gpio.h  |  166 +++
 arch/arm/include/asm/arch-sunxi/i2c.h   |  185 
 arch/arm/include/asm/arch-sunxi/mmc.h   |   64 +++
 arch/arm/include/asm/arch-sunxi/spl.h   |   34 ++
 arch/arm/include/asm/arch-sunxi/sys_proto.h |   31 ++
 arch/arm/include/asm/arch-sunxi/timer.h |  102 
 board/sunxi/Makefile|   58 +++
 board/sunxi/board.c |  112 +
 board/sunxi/dram_a13_mid.c  |   31 ++
 board/sunxi/dram_a13_oli_micro.c|   32 ++
 board/sunxi/dram_a13_olinuxino.c|   31 ++
 board/sunxi/dram_cubieboard.c   |   31 ++
 board/sunxi/dram_cubieboard_512.c   |   31 ++
 board/sunxi/dram_hackberry.c|   31 ++
 board/sunxi/dram_hyundai_a7hd.c |   31 ++
 board/sunxi/dram_mele_a1000.c   |   24 +
 board/sunxi/dram_mele_a3700.c   |   31 ++
 board/sunxi/dram_mini_x.c   |   31 ++
 board/sunxi/dram_mk802.c|   24 +
 board/sunxi/dram_mk802ii.c  |   31 ++
 boards.cfg  |   16 +
 drivers/gpio/Makefile   |1 +
 drivers/gpio/sunxi_gpio.c   |  116 +
 drivers/i2c/Makefile|1 +
 drivers/i2c/sunxi_i2c.c |  278 +++
 drivers/mmc/Makefile|1 +
 drivers/mmc/sunxi_mmc.c |  674 +++
 drivers/net/Makefile|1 +
 drivers/net/sunxi_wemac.c   |  533 +
 drivers/power/Makefile  |1 +
 drivers/power/axp209.c  |  183 
 drivers/watchdog/Makefile   |1 +
 drivers/watchdog/sunxi_watchdog.c   |   49 ++
 include/axp209.h|   29 ++
 include/configs/sun4i.h |   74 +++
 include/configs/sun5i.h |   56 +++
 include/configs/sunxi-common.h  |  243 ++
 include/netdev.h|1 +
 spl/Makefile|   10 +
 tools/.gitignore|1 +
 tools/Makefile  |6 +
 tools/mksunxiboot.README|   13 +
 tools/mksunxiboot.c |  162 +++
 57 files changed, 5105 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/Makefile
 create mode 100644 arch/arm/cpu/armv7/sunxi/board.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/clock.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/dram.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/pinmux.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/reset.S
 create mode 100644 arch/arm/cpu/armv7/sunxi/timer.c
 create mode 100644 

[U-Boot] [PATCH 02/22] ARM: sunxi: MMC driver

2012-11-25 Thread Henrik Nordström
This adds a basic MMC driver for Allwinner sun4i/sun5i family of SoC
this driver is limited to a single MMC channel.

Signed-off-by: Tom Cubie tangli...@allwinnertech.com
Signed-off-by: Henrik Nodstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 arch/arm/include/asm/arch-sunxi/mmc.h |   64 +++
 board/sunxi/board.c   |9 +
 drivers/mmc/Makefile  |1 +
 drivers/mmc/sunxi_mmc.c   |  674 +
 include/configs/sunxi-common.h|   14 +-
 5 files changed, 759 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/mmc.h
 create mode 100644 drivers/mmc/sunxi_mmc.c

diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h 
b/arch/arm/include/asm/arch-sunxi/mmc.h
new file mode 100644
index 000..e96e7d2
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/mmc.h
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Aaron leafy.m...@allwinnertech.com
+ *
+ * MMC register definition for allwinner sunxi platform.
+ *
+ * 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
+ */
+
+#ifndef _SUNXI_MMC_H
+#define _SUNXI_MMC_H
+
+struct sunxi_mmc {
+   u32 gctrl;  /* (0x00) SMC Global Control Register */
+   u32 clkcr;  /* (0x04) SMC Clock Control Register */
+   u32 timeout;/* (0x08) SMC Time Out Register */
+   u32 width;  /* (0x0C) SMC Bus Width Register */
+   u32 blksz;  /* (0x10) SMC Block Size Register */
+   u32 bytecnt;/* (0x14) SMC Byte Count Register */
+   u32 cmd;/* (0x18) SMC Command Register */
+   u32 arg;/* (0x1C) SMC Argument Register */
+   u32 resp0;  /* (0x20) SMC Response Register 0 */
+   u32 resp1;  /* (0x24) SMC Response Register 1 */
+   u32 resp2;  /* (0x28) SMC Response Register 2 */
+   u32 resp3;  /* (0x2C) SMC Response Register 3 */
+   u32 imask;  /* (0x30) SMC Interrupt Mask Register */
+   u32 mint;   /* (0x34) SMC Masked Interrupt Status Reg */
+   u32 rint;   /* (0x38) SMC Raw Interrupt Status Register */
+   u32 status; /* (0x3C) SMC Status Register */
+   u32 ftrglevel;  /* (0x40) SMC FIFO Threshold Watermark Reg */
+   u32 funcsel;/* (0x44) SMC Function Select Register */
+   u32 cbcr;   /* (0x48) SMC CIU Byte Count Register */
+   u32 bbcr;   /* (0x4C) SMC BIU Byte Count Register */
+   u32 dbgc;   /* (0x50) SMC Debug Enable Register */
+   u32 res0[11];   /* (0x54~0x7c) */
+   u32 dmac;   /* (0x80) SMC IDMAC Control Register */
+   u32 dlba;   /* (0x84) SMC IDMAC Descr List Base Addr Reg */
+   u32 idst;   /* (0x88) SMC IDMAC Status Register */
+   u32 idie;   /* (0x8C) SMC IDMAC Interrupt Enable Register */
+   u32 chda;   /* (0x90) */
+   u32 cbda;   /* (0x94) */
+   u32 res1[26];   /* (0x98~0xff) */
+   u32 fifo;   /* (0x100) SMC FIFO Access Address */
+};
+
+int sunxi_mmc_init(int sdc_no);
+#endif /* _SUNXI_MMC_H */
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index ae05953..50fb40f 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -55,3 +55,12 @@ int dram_init(void)
 
return 0;
 }
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+   sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
+
+   return 0;
+}
+#endif
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index a1dd730..6128910 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -47,6 +47,7 @@ COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
 COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
 COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 COBJS-$(CONFIG_DWMMC) += dw_mmc.o
+COBJS-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
new file mode 100644
index 000..05bc231
--- /dev/null
+++ 

[U-Boot] [PATCH 03/22] ARM sunxi: I2C driver

2012-11-25 Thread Henrik Nordström
A basic basic driver for the I2C controller found in Allwinner
sunXi (A10  A13) SoCs.

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 arch/arm/cpu/armv7/sunxi/clock.c  |   15 ++
 arch/arm/include/asm/arch-sunxi/i2c.h |  185 ++
 drivers/i2c/Makefile  |1 +
 drivers/i2c/sunxi_i2c.c   |  278 +
 include/configs/sunxi-common.h|8 +
 5 files changed, 487 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-sunxi/i2c.h
 create mode 100644 drivers/i2c/sunxi_i2c.c

diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
index 424acfc..b9bbb7d 100644
--- a/arch/arm/cpu/armv7/sunxi/clock.c
+++ b/arch/arm/cpu/armv7/sunxi/clock.c
@@ -42,6 +42,7 @@ int clock_init(void)
return 0;
 }
 
+
 /* Return PLL5 frequency in Hz
  * Note: Assumes PLL5 reference is 24MHz clock
  */
@@ -55,3 +56,17 @@ unsigned int clock_get_pll5(void)
int p = 1  ((rval  16)  3);
return 2400 * n * k / p;
 }
+
+int clock_twi_onoff(int port, int state)
+{
+   struct sunxi_ccm_reg *const ccm =
+   (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+   if (port  2)
+   return -1;
+
+   /* set the apb1 clock gate for twi */
+   sr32(ccm-apb1_gate, 0 + port, 1, state);
+
+   return 0;
+}
diff --git a/arch/arm/include/asm/arch-sunxi/i2c.h 
b/arch/arm/include/asm/arch-sunxi/i2c.h
new file mode 100644
index 000..9a6e168
--- /dev/null
+++ b/arch/arm/include/asm/arch-sunxi/i2c.h
@@ -0,0 +1,185 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom hen...@henriknordstrom.net
+ *
+ * Based on sun4i linux kernle i2c.h
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangla...@allwinnertech.com
+ * Victor Wei weizih...@allwinnertech.com
+ *
+ * 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
+ */
+#ifndef _SUNXI_I2C_H_
+#define _SUNXI_I2C_H_
+
+struct i2c {
+   u32 saddr;  /*  31:8bit res,7-1bit for slave addr,0 bit for GCE */
+   u32 xsaddr; /*  31:8bit res,7-0bit for second addr in 10bit addr */
+   u32 data;   /*  31:8bit res, 7-0bit send or receive data byte */
+   u32 ctl;/*  INT_EN,BUS_EN,M_STA,INT_FLAG,A_ACK */
+   u32 status; /*  28 interrupt types + 0xF8 normal type = 29  */
+   u32 clkr;   /*  31:7bit res,6-3bit,CLK_M,2-0bit CLK_N */
+   u32 reset;  /*  31:1bit res;0bit,write 1 to clear 0. */
+   u32 efr;/*  31:2bit res,1:0 bit data byte follow read comand */
+   u32 lctl;   /*  31:6bits res 5:0bit for sdascl control */
+};
+
+/* TWI address register */
+#define TWI_GCE_EN (0x1  0)  /* gen call addr enable slave mode */
+#define TWI_ADDR_MASK  (0x7f  1) /* 7:1bits */
+#define TWI_XADDR_MASK 0xff/* 7:0bits for extend slave address */
+
+#define TWI_DATA_MASK  0xff/* 7:0bits for send or received */
+
+/* TWI Control Register Bit Fields */
+/* 1:0 bits reserved */
+/* set 1 to send A_ACK,then low level on SDA */
+#define TWI_CTL_ACK(0x1  2)
+/* INT_FLAG,interrupt status flag: set '1' when interrupt coming */
+#define TWI_CTL_INTFLG (0x1  3)
+#define TWI_CTL_STP(0x1  4)  /* M_STP,Automatic clear 0 */
+#define TWI_CTL_STA(0x1  5)  /* M_STA,atutomatic clear 0 */
+#define TWI_CTL_BUSEN  (0x1  6)  /* BUS_EN, mastr mode should be set 1 */
+#define TWI_CTL_INTEN  (0x1  7)  /* INT_EN */
+/* 31:8 bit reserved */
+
+/*
+ * TWI Clock Register Bit Fields  Masks,default value:0x_
+ * Fin is APB CLOCK INPUT;
+ * Fsample = F0 = Fin/2^CLK_N;
+ *   F1 = F0/(CLK_M+1);
+ *
+ * Foscl = F1/10 = Fin/(2^CLK_N * (CLK_M+1)*10);
+ * Foscl is clock SCL;standard mode:100KHz or fast mode:400KHz
+ */
+
+#define TWI_CLK_DIV_M  (0xF  3)  /* 6:3bit  */
+#define TWI_CLK_DIV_N  (0x7  0)  /* 2:0bit */
+#define TWI_CLK_DIV(N, M)  N)  0xF)  3) | (((M)  0x7)  0))
+
+/* TWI Soft Reset Register Bit Fields  Masks  */
+/* write 1 to clear 0, when complete soft reset clear 0 */
+#define TWI_SRST_SRST  (0x1  0)
+
+/* TWI Enhance Feature Register Bit Fields  

[U-Boot] [PATCH 05/22] power: Add AXP209 Power Management controller (I2C)

2012-11-25 Thread Henrik Nordström
This adds support for AXP209 Power Management controller,
used by most sunxi (Allwinner A10/A13) based boards.

From: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 drivers/power/Makefile |1 +
 drivers/power/axp209.c |  183 
 include/axp209.h   |   29 
 3 files changed, 213 insertions(+), 0 deletions(-)
 create mode 100644 drivers/power/axp209.c
 create mode 100644 include/axp209.h

diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index 8c71901..ad768ff 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB:= $(obj)libpower.o
 
+COBJS-$(CONFIG_AXP209_POWER)   += axp209.o
 COBJS-$(CONFIG_FTPMU010_POWER) += ftpmu010.o
 COBJS-$(CONFIG_TPS6586X_POWER) += tps6586x.o
 COBJS-$(CONFIG_TWL4030_POWER)  += twl4030.o
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
new file mode 100644
index 000..be98d80
--- /dev/null
+++ b/drivers/power/axp209.c
@@ -0,0 +1,183 @@
+/*
+ * (C) Copyright 2012
+ * Henrik Nordstrom hen...@henriknordstrom.net
+ *
+ * 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 common.h
+#include i2c.h
+#include axp209.h
+
+enum axp209_reg {
+   AXP209_CHIP_VERSION = 0x3,
+   AXP209_DCDC2_VOLTAGE = 0x23,
+   AXP209_DCDC3_VOLTAGE = 0x27,
+   AXP209_LDO24_VOLTAGE = 0x28,
+   AXP209_LDO3_VOLTAGE = 0x29,
+   AXP209_SHUTDOWN = 0x32,
+};
+
+int axp209_write(enum axp209_reg reg, u8 val)
+{
+   return i2c_write(0x34, reg, 1, val, 1);
+}
+
+int axp209_read(enum axp209_reg reg, u8 *val)
+{
+   return i2c_read(0x34, reg, 1, val, 1);
+}
+
+int axp209_set_dcdc2(int mvolt)
+{
+   int cfg = (mvolt - 700) / 25;
+   int rc;
+   u8 current;
+
+   if (cfg  0)
+   cfg = 0;
+   if (cfg  (1  6) - 1)
+   cfg = (1  6) - 1;
+
+   /* Do we really need to be this gentle? It has built-in voltage slope */
+   while ((rc = axp209_read(AXP209_DCDC2_VOLTAGE, current)) == 0
+   current != cfg) {
+   if (current  cfg)
+   current++;
+   else
+   current--;
+
+   rc = axp209_write(AXP209_DCDC2_VOLTAGE, current);
+   if (rc)
+   break;
+   }
+
+   return rc;
+}
+
+int axp209_set_dcdc3(int mvolt)
+{
+   int cfg = (mvolt - 700) / 25;
+   u8 reg;
+   int rc;
+
+   if (cfg  0)
+   cfg = 0;
+   if (cfg  (1  7) - 1)
+   cfg = (1  7) - 1;
+
+   rc = axp209_write(AXP209_DCDC3_VOLTAGE, cfg);
+   rc |= axp209_read(AXP209_DCDC3_VOLTAGE, reg);
+
+   return rc;
+}
+
+int axp209_set_ldo2(int mvolt)
+{
+   int cfg = (mvolt - 1800) / 100;
+   int rc;
+   u8 reg;
+
+   if (cfg  0)
+   cfg = 0;
+   if (cfg  15)
+   cfg = 15;
+
+   rc = axp209_read(AXP209_LDO24_VOLTAGE, reg);
+   if (rc)
+   return rc;
+
+   reg = (reg  0x0f) | (cfg  4);
+   rc = axp209_write(AXP209_LDO24_VOLTAGE, reg);
+   if (rc)
+   return rc;
+
+   return 0;
+}
+
+int axp209_set_ldo3(int mvolt)
+{
+   int cfg = (mvolt - 700) / 25;
+
+   if (cfg  0)
+   cfg = 0;
+   if (cfg  127)
+   cfg = 127;
+   if (mvolt == -1)
+   cfg = 0x80; /* detemined by LDO3IN pin */
+
+   return axp209_write(AXP209_LDO3_VOLTAGE, cfg);
+}
+
+int axp209_set_ldo4(int mvolt)
+{
+   int cfg = (mvolt - 1800) / 100;
+   int rc;
+   static const int vindex[] = {
+   1250, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2500,
+   2700, 2800, 3000, 3100, 3200, 3300
+   };
+   u8 reg;
+
+   /* Translate mvolt to register cfg value, requested = selected */
+   for (cfg = 0; mvolt  vindex[cfg]  cfg  15; cfg++)
+   ;
+
+   rc = axp209_read(AXP209_LDO24_VOLTAGE, reg);
+   if (rc)
+   return rc;
+
+   /* LDO4 configuration is in lower 4 bits */
+   reg = (reg  0xf0) | (cfg  0);
+   rc = 

[U-Boot] [PATCH 06/22] ARM sunxi: Basic GPIO driver

2012-11-25 Thread Henrik Nordström
GPIO driver for Allwinner sun4i/sun5i family of SoCs

GPIO Pins are named by their symbolic pin names Pg#
such as PH19 or H19.

Note: This do not perform any validation if the pin is in use
for some other I/O function. Use with care.
---
 arch/arm/include/asm/arch-sunxi/gpio.h |2 +
 drivers/gpio/Makefile  |1 +
 drivers/gpio/sunxi_gpio.c  |  116 
 include/configs/sunxi-common.h |4 +
 4 files changed, 123 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/sunxi_gpio.c

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
b/arch/arm/include/asm/arch-sunxi/gpio.h
index fceee6b..a3f8a74 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -160,5 +160,7 @@ enum sunxi_gpio_number {
 
 int sunxi_gpio_set_cfgpin(u32 pin, u32 val);
 int sunxi_gpio_get_cfgpin(u32 pin);
+int name_to_gpio(const char *name);
+#define name_to_gpio   name_to_gpio
 
 #endif /* _SUNXI_GPIO_H */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index d50ac3b..6d692e6 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -45,6 +45,7 @@ COBJS-$(CONFIG_OMAP_GPIO) += omap_gpio.o
 COBJS-$(CONFIG_DB8500_GPIO)+= db8500_gpio.o
 COBJS-$(CONFIG_BCM2835_GPIO)   += bcm2835_gpio.o
 COBJS-$(CONFIG_S3C2440_GPIO)   += s3c2440_gpio.o
+COBJS-$(CONFIG_SUNXI_GPIO) += sunxi_gpio.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
new file mode 100644
index 000..d99071e
--- /dev/null
+++ b/drivers/gpio/sunxi_gpio.c
@@ -0,0 +1,116 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * 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 common.h
+#include asm/io.h
+#include asm/gpio.h
+
+static int sunxi_gpio_output(u32 pin, u32 val)
+{
+   u32 dat;
+   u32 bank = GPIO_BANK(pin);
+   u32 num = GPIO_NUM(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   dat = readl(pio-dat);
+   if (val)
+   dat |= 1  num;
+   else
+   dat = ~(1  num);
+
+   writel(dat, pio-dat);
+
+   return 0;
+}
+
+static int sunxi_gpio_input(u32 pin)
+{
+   u32 dat;
+   u32 bank = GPIO_BANK(pin);
+   u32 num = GPIO_NUM(pin);
+   struct sunxi_gpio *pio =
+   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
+
+   dat = readl(pio-dat);
+   dat = num;
+
+   return dat  0x1;
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   return 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+   sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_INPUT);
+
+   return sunxi_gpio_input(gpio);
+}
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+   sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_OUTPUT);
+
+   return sunxi_gpio_output(gpio, value);
+}
+
+int gpio_get_value(unsigned gpio)
+{
+   return sunxi_gpio_input(gpio);
+}
+
+int gpio_set_value(unsigned gpio, int value)
+{
+   return sunxi_gpio_output(gpio, value);
+}
+
+int name_to_gpio(const char *name)
+{
+   int group = 0;
+   int groupsize = 9 * 32;
+   long pin;
+   const char *eptr;
+   if (*name == 'P' || *name == 'p')
+   name++;
+   if (*name = 'A') {
+   group = *name - (*name  'a' ? 'a' : 'A');
+   groupsize = 32;
+   name++;
+   }
+
+   pin = simple_strtol(name, eptr, 10);
+   if (!*name || *eptr)
+   return -1;
+   if (pin  0 || pin  groupsize || group = 9)
+   return -1;
+   return group * 32 + pin;
+}
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5bf8eea..bc1f200 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -206,4 +206,8 @@
 /* #define CONFIG_WATCHDOG */
 /* #define CONFIG_SUNXI_WATCHDOG */
 
+/* GPIO */
+#define CONFIG_SUNXI_GPIO
+#define CONFIG_CMD_GPIO
+
 #endif /* __CONFIG_H */
-- 
1.7.7.6



[U-Boot] [PATCH 07/22] tools: mksunixboot adding a Allwinner boot header

2012-11-25 Thread Henrik Nordström
This tool adds a boot header to the supplied file, for booting
code directly from the SoC embedded boot rom. Needed for making
the SPL loader bootable.

From: Tom Cubie mr.hip...@gmail.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 Makefile |1 +
 tools/.gitignore |1 +
 tools/Makefile   |6 ++
 tools/mksunxiboot.README |   13 
 tools/mksunxiboot.c  |  162 ++
 5 files changed, 183 insertions(+), 0 deletions(-)
 create mode 100644 tools/mksunxiboot.README
 create mode 100644 tools/mksunxiboot.c

diff --git a/Makefile b/Makefile
index 5a98745..81fe532 100644
--- a/Makefile
+++ b/Makefile
@@ -799,6 +799,7 @@ clean:
   $(obj)tools/gen_eth_addr$(obj)tools/img2srec   \
   $(obj)tools/mk{env,}image   $(obj)tools/mpc86x_clk \
   $(obj)tools/mk{smdk5250,}spl   \
+  $(obj)tools/mksunxiboot\
   $(obj)tools/mxsboot\
   $(obj)tools/ncb $(obj)tools/ubsha1 \
   $(obj)tools/kernel-doc/docproc
diff --git a/tools/.gitignore b/tools/.gitignore
index 9bce719..92fcbbd 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -7,6 +7,7 @@
 /mkimage
 /mpc86x_clk
 /mxsboot
+/mksunxiboot
 /ncb
 /ncp
 /ubsha1
diff --git a/tools/Makefile b/tools/Makefile
index 686840a..508112d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -69,6 +69,7 @@ BIN_FILES-$(CONFIG_XWAY_SWAP_BYTES) += xway-swap-bytes$(SFX)
 BIN_FILES-y += mkenvimage$(SFX)
 BIN_FILES-y += mkimage$(SFX)
 BIN_FILES-$(CONFIG_SMDK5250) += mksmdk5250spl$(SFX)
+BIN_FILES-$(CONFIG_SUNXI) += mksunxiboot$(SFX)
 BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX)
 BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX)
 BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
@@ -98,6 +99,7 @@ NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += mkenvimage.o
 NOPED_OBJ_FILES-y += mkimage.o
 OBJ_FILES-$(CONFIG_SMDK5250) += mkexynosspl.o
+OBJ_FILES-$(CONFIG_SUNXI) += mksunxiboot.o
 OBJ_FILES-$(CONFIG_MX28) += mxsboot.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
 NOPED_OBJ_FILES-y += os_support.o
@@ -228,6 +230,10 @@ $(obj)mpc86x_clk$(SFX):$(obj)mpc86x_clk.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@
 
+$(obj)mksunxiboot$(SFX):   $(obj)mksunxiboot.o
+   $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+   $(HOSTSTRIP) $@
+
 $(obj)mxsboot$(SFX):   $(obj)mxsboot.o
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
$(HOSTSTRIP) $@
diff --git a/tools/mksunxiboot.README b/tools/mksunxiboot.README
new file mode 100644
index 000..9a4b379
--- /dev/null
+++ b/tools/mksunxiboot.README
@@ -0,0 +1,13 @@
+This program make a arm binary file can be loaded by Allwinner A10 and releated
+chips from storage media such as nand and mmc.
+
+More information about A10 boot, please refer to
+http://rhombus-tech.net/allwinner_a10/a10_boot_process/
+
+To compile this program, just type make, you will get 'mksunxiboot'.
+
+To use it,
+$./mksunxiboot u-boot.bin u-boot-mmc.bin
+then you can write it to a mmc card with dd.
+$sudo dd if=u-boot-mmc.bin of=/dev/sdb bs=1024 seek=8
+then insert your mmc card to your A10 tablet, you can boot from mmc card.
diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c
new file mode 100644
index 000..fd81529
--- /dev/null
+++ b/tools/mksunxiboot.c
@@ -0,0 +1,162 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. www.allwinnertech.com
+ * Tom Cubie tangli...@allwinnertech.com
+ *
+ * a simple tool to generate bootable image for sunxi platform.
+ *
+ * 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 fcntl.h
+#include stdio.h
+#include unistd.h
+#include stdlib.h
+#include string.h
+#include errno.h
+#include sys/types.h
+#include sys/stat.h
+
+typedef unsigned char u8;
+typedef unsigned int u32;
+
+/* boot head definition from sun4i boot code */
+typedef struct boot_file_head {
+   u32 jump_instruction;   /* one intruction jumping to real code */
+   u8 magic[8];/* =eGON.BT0 or eGON.BT1, not C-style str */
+   u32 

[U-Boot] [PATCH 08/22] net: Add sunxi (Allwinner) wemac driver

2012-11-25 Thread Henrik Nordström
This patch adds support for the WEMAC, the ethernet controller included
in the Allwinner A10 SoC. It will get used in the upcoming A10 board
support.

From: Stefan Roese s...@denx.de
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 drivers/net/Makefile  |1 +
 drivers/net/sunxi_wemac.c |  533 +
 include/netdev.h  |1 +
 3 files changed, 535 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/sunxi_wemac.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 786a656..9255155 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -68,6 +68,7 @@ COBJS-$(CONFIG_RTL8169) += rtl8169.o
 COBJS-$(CONFIG_SH_ETHER) += sh_eth.o
 COBJS-$(CONFIG_SMC9) += smc9.o
 COBJS-$(CONFIG_SMC911X) += smc911x.o
+COBJS-$(CONFIG_SUNXI_WEMAC) += sunxi_wemac.o
 COBJS-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
 COBJS-$(CONFIG_TSEC_ENET) += tsec.o fsl_mdio.o
 COBJS-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
diff --git a/drivers/net/sunxi_wemac.c b/drivers/net/sunxi_wemac.c
new file mode 100644
index 000..1db3529
--- /dev/null
+++ b/drivers/net/sunxi_wemac.c
@@ -0,0 +1,533 @@
+/*
+ * sunxi_wemac.c -- Allwinner A10 ethernet driver
+ *
+ * (C) Copyright 2012, Stefan Roese s...@denx.de
+ *
+ * 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.
+ */
+
+#include common.h
+#include malloc.h
+#include net.h
+#include miiphy.h
+#include linux/err.h
+#include asm/io.h
+#include asm/arch/clock.h
+#include asm/arch/gpio.h
+
+/* EMAC register  */
+struct wemac_regs {
+   u32 ctl;/* 0x00 */
+   u32 tx_mode;/* 0x04 */
+   u32 tx_flow;/* 0x08 */
+   u32 tx_ctl0;/* 0x0c */
+   u32 tx_ctl1;/* 0x10 */
+   u32 tx_ins; /* 0x14 */
+   u32 tx_pl0; /* 0x18 */
+   u32 tx_pl1; /* 0x1c */
+   u32 tx_sta; /* 0x20 */
+   u32 tx_io_data; /* 0x24 */
+   u32 tx_io_data1; /* 0x28 */
+   u32 tx_tsvl0;   /* 0x2c */
+   u32 tx_tsvh0;   /* 0x30 */
+   u32 tx_tsvl1;   /* 0x34 */
+   u32 tx_tsvh1;   /* 0x38 */
+   u32 rx_ctl; /* 0x3c */
+   u32 rx_hash0;   /* 0x40 */
+   u32 rx_hash1;   /* 0x44 */
+   u32 rx_sta; /* 0x48 */
+   u32 rx_io_data; /* 0x4c */
+   u32 rx_fbc; /* 0x50 */
+   u32 int_ctl;/* 0x54 */
+   u32 int_sta;/* 0x58 */
+   u32 mac_ctl0;   /* 0x5c */
+   u32 mac_ctl1;   /* 0x60 */
+   u32 mac_ipgt;   /* 0x64 */
+   u32 mac_ipgr;   /* 0x68 */
+   u32 mac_clrt;   /* 0x6c */
+   u32 mac_maxf;   /* 0x70 */
+   u32 mac_supp;   /* 0x74 */
+   u32 mac_test;   /* 0x78 */
+   u32 mac_mcfg;   /* 0x7c */
+   u32 mac_mcmd;   /* 0x80 */
+   u32 mac_madr;   /* 0x84 */
+   u32 mac_mwtd;   /* 0x88 */
+   u32 mac_mrdd;   /* 0x8c */
+   u32 mac_mind;   /* 0x90 */
+   u32 mac_ssrr;   /* 0x94 */
+   u32 mac_a0; /* 0x98 */
+   u32 mac_a1; /* 0x9c */
+};
+
+/* SRAMC register  */
+struct sunxi_sramc_regs {
+   u32 ctrl0;
+   u32 ctrl1;
+};
+
+/* 0: Disable   1: Aborted frame enable(default) */
+#define EMAC_TX_AB_M   (0x1  0)
+/* 0: CPU   1: DMA(default) */
+#define EMAC_TX_TM (0x1  1)
+
+#define EMAC_TX_SETUP  (0)
+
+/* 0: DRQ asserted  1: DRQ automatically(default) */
+#define EMAC_RX_DRQ_MODE   (0x1  1)
+/* 0: CPU   1: DMA(default) */
+#define EMAC_RX_TM (0x1  2)
+/* 0: Normal(default)1: Pass all Frames */
+#define EMAC_RX_PA (0x1  4)
+/* 0: Normal(default)1: Pass Control Frames */
+#define EMAC_RX_PCF(0x1  5)
+/* 0: Normal(default)1: Pass Frames with CRC Error */
+#define EMAC_RX_PCRCE  (0x1  6)
+/* 0: Normal(default)1: Pass Frames with Length Error */
+#define EMAC_RX_PLE(0x1  7)
+/* 0: Normal 1: Pass Frames length out of range(default) */
+#define EMAC_RX_POR(0x1  8)
+/* 0: Not accept 1: Accept unicast Packets(default) */
+#define EMAC_RX_UCAD   (0x1  16)
+/* 0: Normal(default)1: DA Filtering */
+#define EMAC_RX_DAF(0x1  17)
+/* 0: Not accept 1: Accept multicast Packets(default) */
+#define EMAC_RX_MCO(0x1  20)
+/* 0: Disable(default)   1: Enable Hash filter */
+#define EMAC_RX_MHF(0x1  21)
+/* 0: Not accept 1: Accept Broadcast Packets(default) */
+#define EMAC_RX_BCO(0x1  22)
+/* 0: 

[U-Boot] [PATCH 09/22] ARM: sun4i: Enable ethernet support (wemac) on A10 boards

2012-11-25 Thread Henrik Nordström
From: Stefan Roese s...@denx.de
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 arch/arm/cpu/armv7/sunxi/board.c |   14 ++
 include/configs/sun4i.h  |8 
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 5c94110..29cc4bd 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -32,6 +32,7 @@
 #include asm/arch/timer.h
 #include asm/arch/gpio.h
 #include asm/arch/sys_proto.h
+#include netdev.h
 
 int gpio_init(void)
 {
@@ -78,3 +79,16 @@ void enable_caches(void)
dcache_enable();
 }
 #endif
+
+#if defined(CONFIG_SUNXI_WEMAC)
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int cpu_eth_init(bd_t *bis)
+{
+   sunxi_wemac_initialize(bis);
+
+   return 0;
+}
+#endif
diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h
index 513f618..ad51446 100644
--- a/include/configs/sun4i.h
+++ b/include/configs/sun4i.h
@@ -44,4 +44,12 @@
 
 #define CONFIG_CONS_INDEX  1   /* UART0 */
 
+/* Ethernet support on A10 */
+#define CONFIG_SUNXI_WEMAC
+#define CONFIG_MII /* MII PHY management   */
+
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_CMD_PING
+
 #endif /* __CONFIG_H */
-- 
1.7.7.6


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


[U-Boot] [PATCH 10/22] sunxi: Add more network commands and netconsole support

2012-11-25 Thread Henrik Nordström
Add most network related commands

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net

---
 include/configs/sun4i.h |   21 -
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h
index ad51446..a58f82b 100644
--- a/include/configs/sun4i.h
+++ b/include/configs/sun4i.h
@@ -47,9 +47,28 @@
 /* Ethernet support on A10 */
 #define CONFIG_SUNXI_WEMAC
 #define CONFIG_MII /* MII PHY management   */
-
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_SNTP
+#define CONFIG_CMD_DNS
+#define CONFIG_NETCONSOLE
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+#define CONFIG_BOOTP_NISDOMAIN
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_BOOTP_NTPSERVER
+#define CONFIG_BOOTP_TIMEOFFSET
+#define CONFIG_BOOTP_MAY_FAIL
+#define CONFIG_BOOTP_SERVERIP
+#define CONFIG_BOOTP_DHCP_REQUEST_DELAY5
+#define CONFIG_TIMESTAMP
 
 #endif /* __CONFIG_H */
-- 
1.7.7.6


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


[U-Boot] [PATCH 19/22] ARM sunxi: SPL support for MK802 board

2012-11-25 Thread Henrik Nordström
From: Sergey Lapin sla...@ossfans.org
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile |1 +
 board/sunxi/dram_mk802.c |   24 
 boards.cfg   |1 +
 3 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_mk802.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 091db59..b3a40f4 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -34,6 +34,7 @@ COBJS-$(CONFIG_HACKBERRY) += dram_hackberry.o
 COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
 COBJS-$(CONFIG_MINI_X) += dram_mini_x.o
 COBJS-$(CONFIG_A7HD)   += dram_hyundai_a7hd.o
+COBJS-$(CONFIG_MK802)  += dram_mk802.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_mk802.c b/board/sunxi/dram_mk802.c
new file mode 100644
index 000..a6779b0
--- /dev/null
+++ b/board/sunxi/dram_mk802.c
@@ -0,0 +1,24 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 360,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .size = 512,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index b8a5375..12fbcc9 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -300,6 +300,7 @@ sun4iarm armv7   sunxi  
 -
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
 sun5iarm armv7   sunxi   - 
 sunxi   sun5i
 sun5i_sdcon  arm armv7   sunxi   - 
 sunxi   sun5i:UART0_PORT_F
+mk802arm armv7   sunxi   - 
 sunxi   sun4i:MK802,SPL
 kzm9garm armv7   kzm9g   kmc   
 rmobile
 armadillo-800eva arm armv7   armadillo-800eva
atmark-techno  rmobile
 zynq arm armv7   zynq
xilinx zynq
-- 
1.7.7.6


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


[U-Boot] [PATCH 12/22] ARM sunxi: SPL support for Olimex A13-OLinuXino board

2012-11-25 Thread Henrik Nordström
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile |1 +
 board/sunxi/dram_a13_olinuxino.c |   31 +++
 boards.cfg   |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_a13_olinuxino.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 43acbab..0351935 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB:= $(obj)lib$(BOARD).o
 
 COBJS-y:= board.o
+COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_a13_olinuxino.c b/board/sunxi/dram_a13_olinuxino.c
new file mode 100644
index 000..12b66d9
--- /dev/null
+++ b/board/sunxi/dram_a13_olinuxino.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 8,
+   .bus_width = 16,
+   .cas = 9,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 512,
+   .tpr0 = 0x42d899b7,
+   .tpr1 = 0xa090,
+   .tpr2 = 0x22a00,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0x10,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 13d1f74..0db382d 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -288,6 +288,7 @@ whistler arm armv7:arm720t 
whistler  nvidia
 colibri_t20_iris arm armv7:arm720t colibri_t20_iris  
toradextegra20
 u8500_href   arm armv7   u8500   
st-ericssonu8500
 snowball arm armv7   snowball   
st-ericssonu8500
+A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
 sun5iarm armv7   sunxi   - 
 sunxi   sun5i
-- 
1.7.7.6


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


[U-Boot] [PATCH 13/22] ARM sunxi: SPL support for Mele A1000 board

2012-11-25 Thread Henrik Nordström
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile  |1 +
 board/sunxi/dram_mele_a1000.c |   24 
 boards.cfg|1 +
 3 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_mele_a1000.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 0351935..b386b2b 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)lib$(BOARD).o
 
 COBJS-y:= board.o
 COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
+COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_mele_a1000.c b/board/sunxi/dram_mele_a1000.c
new file mode 100644
index 000..a6779b0
--- /dev/null
+++ b/board/sunxi/dram_mele_a1000.c
@@ -0,0 +1,24 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 360,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .size = 512,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 0db382d..8371a12 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -289,6 +289,7 @@ colibri_t20_iris arm armv7:arm720t 
colibri_t20_iris  toradex
 u8500_href   arm armv7   u8500   
st-ericssonu8500
 snowball arm armv7   snowball   
st-ericssonu8500
 A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
+Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
 sun5iarm armv7   sunxi   - 
 sunxi   sun5i
-- 
1.7.7.6


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


[U-Boot] [PATCH 20/22] ARM sunxi: SPL support for Rikomagic MK802II board

2012-11-25 Thread Henrik Nordström
From: j j...@mailb.org
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile   |1 +
 board/sunxi/dram_mk802ii.c |   31 +++
 boards.cfg |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_mk802ii.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index b3a40f4..95826f2 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_MELE_A1000)+= dram_mele_a1000.o
 COBJS-$(CONFIG_MINI_X) += dram_mini_x.o
 COBJS-$(CONFIG_A7HD)   += dram_hyundai_a7hd.o
 COBJS-$(CONFIG_MK802)  += dram_mk802.o
+COBJS-$(CONFIG_MK802II)+= dram_mk802ii.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_mk802ii.c b/board/sunxi/dram_mk802ii.c
new file mode 100644
index 000..4fc1398
--- /dev/null
+++ b/board/sunxi/dram_mk802ii.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 4096,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 1024,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0x4,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 12fbcc9..14d6c67 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -301,6 +301,7 @@ sun4i_sdcon  arm armv7   sunxi  
 -
 sun5iarm armv7   sunxi   - 
 sunxi   sun5i
 sun5i_sdcon  arm armv7   sunxi   - 
 sunxi   sun5i:UART0_PORT_F
 mk802arm armv7   sunxi   - 
 sunxi   sun4i:MK802,SPL
+mk802ii  arm armv7   sunxi   - 
 sunxi   sun4i:MK802II,SPL
 kzm9garm armv7   kzm9g   kmc   
 rmobile
 armadillo-800eva arm armv7   armadillo-800eva
atmark-techno  rmobile
 zynq arm armv7   zynq
xilinx zynq
-- 
1.7.7.6


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


[U-Boot] [PATCH 15/22] ARM sunxi: SPL support for Hackberry 1GB board

2012-11-25 Thread Henrik Nordström
From: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: J M mtx51...@gmail.com
---
 board/sunxi/Makefile |1 +
 board/sunxi/dram_hackberry.c |   31 +++
 boards.cfg   |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_hackberry.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index c2c6c65..e8b9ef8 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -29,6 +29,7 @@ COBJS-y   := board.o
 COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
 COBJS-$(CONFIG_CUBIEBOARD) += dram_cubieboard.o
 COBJS-$(CONFIG_CUBIEBOARD_512) += dram_cubieboard_512.o
+COBJS-$(CONFIG_HACKBERRY)  += dram_hackberry.o
 COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
 
 COBJS  := $(COBJS-y)
diff --git a/board/sunxi/dram_hackberry.c b/board/sunxi/dram_hackberry.c
new file mode 100644
index 000..188b5cb
--- /dev/null
+++ b/board/sunxi/dram_hackberry.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 4096,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 1,
+   .size = 1024,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 207af34..08ded68 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -291,6 +291,7 @@ snowball arm armv7   
snowball   st-e
 A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
 Cubieboard   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD,SPL
 Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
+Hackberryarm armv7   sunxi   - 
 sunxi   sun4i:HACKBERRY,SPL
 Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
-- 
1.7.7.6


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


[U-Boot] [PATCH 21/22] ARM sunxi: SPL support for Mele A3700 board

2012-11-25 Thread Henrik Nordström
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile  |1 +
 board/sunxi/dram_mele_a3700.c |   31 +++
 boards.cfg|1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_mele_a3700.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 95826f2..c7d7268 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -36,6 +36,7 @@ COBJS-$(CONFIG_MINI_X)+= dram_mini_x.o
 COBJS-$(CONFIG_A7HD)   += dram_hyundai_a7hd.o
 COBJS-$(CONFIG_MK802)  += dram_mk802.o
 COBJS-$(CONFIG_MK802II)+= dram_mk802ii.o
+COBJS-$(CONFIG_MELE_A3700) += dram_mele_a3700.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_mele_a3700.c b/board/sunxi/dram_mele_a3700.c
new file mode 100644
index 000..56a9d64
--- /dev/null
+++ b/board/sunxi/dram_mele_a3700.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 360,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 8,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 1024,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 14d6c67..1704a9a 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -295,6 +295,7 @@ Cubieboard_512   arm armv7   sunxi  
 -
 Hackberryarm armv7   sunxi   - 
 sunxi   sun4i:HACKBERRY,SPL
 Hyundai_A7HD arm armv7   sunxi   - 
 sunxi   sun4i:A7HD,SPL
 Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
+Mele_A3700   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A3700,SPL
 Mini-X   arm armv7   sunxi   - 
 sunxi   sun4i:MINI_X,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
-- 
1.7.7.6


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


[U-Boot] [PATCH 16/22] ARM sunxi: SPL support for a13_mid board

2012-11-25 Thread Henrik Nordström
From:Jari Helaakoski tekk...@gmail.com
Signed-off-by: Jari Helaakoski tekk...@gmail.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile   |1 +
 board/sunxi/dram_a13_mid.c |   31 +++
 boards.cfg |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_a13_mid.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index e8b9ef8..f6a836f 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)lib$(BOARD).o
 
 COBJS-y:= board.o
 COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
+COBJS-$(CONFIG_A13_MID)+= dram_a13_mid.o
 COBJS-$(CONFIG_CUBIEBOARD) += dram_cubieboard.o
 COBJS-$(CONFIG_CUBIEBOARD_512) += dram_cubieboard_512.o
 COBJS-$(CONFIG_HACKBERRY)  += dram_hackberry.o
diff --git a/board/sunxi/dram_a13_mid.c b/board/sunxi/dram_a13_mid.c
new file mode 100644
index 000..3b0e595
--- /dev/null
+++ b/board/sunxi/dram_a13_mid.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 8,
+   .bus_width = 16,
+   .cas = 9,
+   .zq = 123,
+   .odt_en = 1,
+   .size = 512,
+   .tpr0 = 0x42d899b7,
+   .tpr1 = 0xa090,
+   .tpr2 = 0x22a00,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0x4,
+   .emr2 = 0x10,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 08ded68..0a8b938 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -289,6 +289,7 @@ colibri_t20_iris arm armv7:arm720t 
colibri_t20_iris  toradex
 u8500_href   arm armv7   u8500   
st-ericssonu8500
 snowball arm armv7   snowball   
st-ericssonu8500
 A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
+A13_MID  arm armv7   sunxi   - 
 sunxi   sun5i:A13_MID,SPL
 Cubieboard   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD,SPL
 Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
 Hackberryarm armv7   sunxi   - 
 sunxi   sun4i:HACKBERRY,SPL
-- 
1.7.7.6


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


[U-Boot] [PATCH 17/22] ARM sunxi: SPL support for Mini-X board

2012-11-25 Thread Henrik Nordström
From: Jari Helaakoski tekk...@gmail.com
Signed-off-by: Jari Helaakoski tekk...@gmail.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile  |1 +
 board/sunxi/dram_mini_x.c |   31 +++
 boards.cfg|1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_mini_x.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index f6a836f..9c6c875 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_CUBIEBOARD)+= dram_cubieboard.o
 COBJS-$(CONFIG_CUBIEBOARD_512) += dram_cubieboard_512.o
 COBJS-$(CONFIG_HACKBERRY)  += dram_hackberry.o
 COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
+COBJS-$(CONFIG_MINI_X) += dram_mini_x.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_mini_x.c b/board/sunxi/dram_mini_x.c
new file mode 100644
index 000..fc8cc92
--- /dev/null
+++ b/board/sunxi/dram_mini_x.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 360,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 512,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 0a8b938..d9b3d87 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -294,6 +294,7 @@ Cubieboard   arm armv7   sunxi  
 -
 Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
 Hackberryarm armv7   sunxi   - 
 sunxi   sun4i:HACKBERRY,SPL
 Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
+Mini-X   arm armv7   sunxi   - 
 sunxi   sun4i:MINI_X,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
 sun5iarm armv7   sunxi   - 
 sunxi   sun5i
-- 
1.7.7.6


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


[U-Boot] [PATCH 22/22] ARM sunxi: SPL support for Olinuxino A13 Micro

2012-11-25 Thread Henrik Nordström
From: hehopmajieh gamis...@gmail.com
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 board/sunxi/Makefile |1 +
 board/sunxi/dram_a13_oli_micro.c |   32 
 boards.cfg   |1 +
 include/configs/sunxi-common.h   |2 ++
 4 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_a13_oli_micro.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index c7d7268..8f6b984 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -27,6 +27,7 @@ LIB   := $(obj)lib$(BOARD).o
 
 COBJS-y:= board.o
 COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
+COBJS-$(CONFIG_A13_OLINUXINOM) += dram_a13_oli_micro.o
 COBJS-$(CONFIG_A13_MID)+= dram_a13_mid.o
 COBJS-$(CONFIG_CUBIEBOARD) += dram_cubieboard.o
 COBJS-$(CONFIG_CUBIEBOARD_512) += dram_cubieboard_512.o
diff --git a/board/sunxi/dram_a13_oli_micro.c b/board/sunxi/dram_a13_oli_micro.c
new file mode 100644
index 000..09653df
--- /dev/null
+++ b/board/sunxi/dram_a13_oli_micro.c
@@ -0,0 +1,32 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 408,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 16,
+   .cas = 9,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 256,
+   .tpr0 = 0x42d899b7,
+   .tpr1 = 0xa090,
+   .tpr2 = 0x22a00,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0x10,
+   .emr3 = 0,
+
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 1704a9a..ae6d05e 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -289,6 +289,7 @@ colibri_t20_iris arm armv7:arm720t 
colibri_t20_iris  toradex
 u8500_href   arm armv7   u8500   
st-ericssonu8500
 snowball arm armv7   snowball   
st-ericssonu8500
 A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
+A13-OLinuXinoM   arm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINOM,SPL,NO_AXP
 A13_MID  arm armv7   sunxi   - 
 sunxi   sun5i:A13_MID,SPL
 Cubieboard   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD,SPL
 Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index b0dcfdb..c2976f0 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -236,6 +236,8 @@
 
 /* PMU */
 #define CONFIG_SPL_POWER_SUPPORT
+#ifndef CONFIG_NO_AXP
 #define CONFIG_AXP209_POWER
+#endif
 
 #endif /* __CONFIG_H */
-- 
1.7.7.6


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


[U-Boot] [PATCH 18/22] ARM sunxi: SPL support for hyundai A7HD board

2012-11-25 Thread Henrik Nordström
Signed-off-by: Luc Verhaegen l...@skynet.be
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 board/sunxi/Makefile|1 +
 board/sunxi/dram_hyundai_a7hd.c |   31 +++
 boards.cfg  |1 +
 3 files changed, 33 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_hyundai_a7hd.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index 9c6c875..091db59 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -33,6 +33,7 @@ COBJS-$(CONFIG_CUBIEBOARD_512)+= dram_cubieboard_512.o
 COBJS-$(CONFIG_HACKBERRY)  += dram_hackberry.o
 COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
 COBJS-$(CONFIG_MINI_X) += dram_mini_x.o
+COBJS-$(CONFIG_A7HD)   += dram_hyundai_a7hd.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/board/sunxi/dram_hyundai_a7hd.c b/board/sunxi/dram_hyundai_a7hd.c
new file mode 100644
index 000..56a9d64
--- /dev/null
+++ b/board/sunxi/dram_hyundai_a7hd.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 360,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 8,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 1024,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index d9b3d87..b8a5375 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -293,6 +293,7 @@ A13_MID  arm armv7   sunxi  
 -
 Cubieboard   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD,SPL
 Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
 Hackberryarm armv7   sunxi   - 
 sunxi   sun4i:HACKBERRY,SPL
+Hyundai_A7HD arm armv7   sunxi   - 
 sunxi   sun4i:A7HD,SPL
 Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
 Mini-X   arm armv7   sunxi   - 
 sunxi   sun4i:MINI_X,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
-- 
1.7.7.6


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


[U-Boot] [PATCH 04/22] ARM: sunxi: watchdog support

2012-11-25 Thread Henrik Nordström
This adds support for the hardware watchdog in Allwinner
sun4i  sun5i (sunxi) SoC familiy.

From: Henrik Nordstrom hen...@henriknordstrom.net

Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 arch/arm/cpu/armv7/sunxi/board.c|3 ++
 arch/arm/include/asm/arch-sunxi/sys_proto.h |1 -
 drivers/watchdog/Makefile   |1 +
 drivers/watchdog/sunxi_watchdog.c   |   49 +++
 include/configs/sunxi-common.h  |4 ++
 5 files changed, 57 insertions(+), 1 deletions(-)
 create mode 100644 drivers/watchdog/sunxi_watchdog.c

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 652c19d..5c94110 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -59,6 +59,9 @@ int gpio_init(void)
 /* do some early init */
 void s_init(void)
 {
+#if defined(CONFIG_WATCHDOG)  defined(CONFIG_SUNXI_WATCHDOG)
+   watchdog_set(23);   /* max possible timeout */
+#endif
clock_init();
gpio_init();
 }
diff --git a/arch/arm/include/asm/arch-sunxi/sys_proto.h 
b/arch/arm/include/asm/arch-sunxi/sys_proto.h
index 1e8ae5d..9729100 100644
--- a/arch/arm/include/asm/arch-sunxi/sys_proto.h
+++ b/arch/arm/include/asm/arch-sunxi/sys_proto.h
@@ -27,6 +27,5 @@
 
 void sr32(u32 *, u32, u32, u32);
 void sdelay(unsigned long);
-void watchdog_init(void);
 
 #endif
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 923acb9..50b5fae 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -28,6 +28,7 @@ LIB   := $(obj)libwatchdog.o
 COBJS-$(CONFIG_AT91SAM9_WATCHDOG) += at91sam9_wdt.o
 COBJS-$(CONFIG_FTWDT010_WATCHDOG) += ftwdt010_wdt.o
 COBJS-$(CONFIG_TNETV107X_WATCHDOG) += tnetv107x_wdt.o
+COBJS-$(CONFIG_SUNXI_WATCHDOG)+= sunxi_watchdog.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/watchdog/sunxi_watchdog.c 
b/drivers/watchdog/sunxi_watchdog.c
new file mode 100644
index 000..65a763d
--- /dev/null
+++ b/drivers/watchdog/sunxi_watchdog.c
@@ -0,0 +1,49 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom hen...@hno.se
+ *
+ * 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 common.h
+#include asm/arch/timer.h
+#include asm/armv7.h
+#include asm/io.h
+
+void watchdog_reset(void)
+{
+   static struct sunxi_wdog *const wdog =
+   ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)-wdog;
+
+   /* a little magic to reload the watchdog */
+   writel(0xA57  1 | 1  0, wdog-ctl);
+}
+
+static void watchdog_set(int interval)
+{
+   static struct sunxi_wdog *const wdog =
+   ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)-wdog;
+
+   /* Set timeout, reset  enable */
+   writel(interval  2 | 1  1 | 1  0, wdog-mode);
+   watchdog_reset();
+}
+
+void watchdog_init(void)
+{
+#ifdef CONFIG_WATCHDOG
+   watchdog_set(23);   /* max possible timeout */
+#endif
+}
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index c2d16fb..5bf8eea 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -202,4 +202,8 @@
 #define CONFIG_SYS_I2C_SLAVE   0x7f
 #define CONFIG_CMD_I2C
 
+/* Watchdog */
+/* #define CONFIG_WATCHDOG */
+/* #define CONFIG_SUNXI_WATCHDOG */
+
 #endif /* __CONFIG_H */
-- 
1.7.7.6


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


[U-Boot] [PATCH 14/22] ARM sunxi: SPL support for Cubieboard board

2012-11-25 Thread Henrik Nordström
From: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Alejandro Mery am...@geeks.cl
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Stefan Roese s...@denx.de
---
 board/sunxi/Makefile  |2 ++
 board/sunxi/dram_cubieboard.c |   31 +++
 board/sunxi/dram_cubieboard_512.c |   31 +++
 boards.cfg|2 ++
 4 files changed, 66 insertions(+), 0 deletions(-)
 create mode 100644 board/sunxi/dram_cubieboard.c
 create mode 100644 board/sunxi/dram_cubieboard_512.c

diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index b386b2b..c2c6c65 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -27,6 +27,8 @@ LIB   := $(obj)lib$(BOARD).o
 
 COBJS-y:= board.o
 COBJS-$(CONFIG_A13_OLINUXINO)  += dram_a13_olinuxino.o
+COBJS-$(CONFIG_CUBIEBOARD) += dram_cubieboard.o
+COBJS-$(CONFIG_CUBIEBOARD_512) += dram_cubieboard_512.o
 COBJS-$(CONFIG_MELE_A1000) += dram_mele_a1000.o
 
 COBJS  := $(COBJS-y)
diff --git a/board/sunxi/dram_cubieboard.c b/board/sunxi/dram_cubieboard.c
new file mode 100644
index 000..7e71b35
--- /dev/null
+++ b/board/sunxi/dram_cubieboard.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 480,
+   .type = 3,
+   .rank_num = 1,
+   .density = 4096,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 1024,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/board/sunxi/dram_cubieboard_512.c 
b/board/sunxi/dram_cubieboard_512.c
new file mode 100644
index 000..3377fba
--- /dev/null
+++ b/board/sunxi/dram_cubieboard_512.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include common.h
+#include asm/arch/dram.h
+
+static struct dram_para dram_para = {
+   .clock = 480,
+   .type = 3,
+   .rank_num = 1,
+   .density = 2048,
+   .io_width = 16,
+   .bus_width = 32,
+   .cas = 6,
+   .zq = 123,
+   .odt_en = 0,
+   .size = 512,
+   .tpr0 = 0x30926692,
+   .tpr1 = 0x1090,
+   .tpr2 = 0x1a0c8,
+   .tpr3 = 0,
+   .tpr4 = 0,
+   .tpr5 = 0,
+   .emr1 = 0,
+   .emr2 = 0,
+   .emr3 = 0,
+};
+
+int sunxi_dram_init(void)
+{
+   return dramc_init(dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index 8371a12..207af34 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -289,6 +289,8 @@ colibri_t20_iris arm armv7:arm720t 
colibri_t20_iris  toradex
 u8500_href   arm armv7   u8500   
st-ericssonu8500
 snowball arm armv7   snowball   
st-ericssonu8500
 A13-OLinuXinoarm armv7   sunxi   - 
 sunxi   sun5i:A13_OLINUXINO,SPL
+Cubieboard   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD,SPL
+Cubieboard_512   arm armv7   sunxi   - 
 sunxi   sun4i:CUBIEBOARD_512,SPL
 Mele_A1000   arm armv7   sunxi   - 
 sunxi   sun4i:MELE_A1000,SPL
 sun4iarm armv7   sunxi   - 
 sunxi   sun4i
 sun4i_sdcon  arm armv7   sunxi   - 
 sunxi   sun4i:UART0_PORT_F
-- 
1.7.7.6


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


[U-Boot] [PATCH 11/22] ARM: sunxi: U-Boot SPL capable of booting directly from MMC

2012-11-25 Thread Henrik Nordström
Allwinner sunxi family of SoCs boots from MMC0/NAND/NOR/MMC2 loading
boot code into an embedded 32KB SRAM.

This patch adds support for booting u-boot SPL from MMC0

We first initializes the console UART, then DRAM controller with board
specific DRAM configuration details, configure CPU core voltage and
clocks before loading the full u-boot image into DRAM.

From: Henrik Nordstrom hen...@henriknordstrom.net
Signed-off-by: Tom Cubie tangli...@allwinnertech.com
Signed-off-by: Stefan Roese s...@denx.de
Signed-off-by: Henrik Nordstrom hen...@henriknordstrom.net
---
 Makefile|   11 +
 arch/arm/cpu/armv7/sunxi/board.c|   38 +++
 arch/arm/cpu/armv7/sunxi/clock.c|   99 +++
 arch/arm/cpu/armv7/sunxi/dram.c |  445 +++
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |   63 +
 arch/arm/include/asm/arch-sunxi/spl.h   |   34 +++
 board/sunxi/board.c |   46 
 include/configs/sunxi-common.h  |   30 ++-
 spl/Makefile|   10 +
 9 files changed, 775 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/sunxi/dram.c
 create mode 100644 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
 create mode 100644 arch/arm/include/asm/arch-sunxi/spl.h

diff --git a/Makefile b/Makefile
index 81fe532..d1b7f97 100644
--- a/Makefile
+++ b/Makefile
@@ -517,6 +517,16 @@ $(obj)u-boot.spr:  $(obj)u-boot.img 
$(obj)spl/u-boot-spl.bin
conv=notrunc 2/dev/null
cat $(obj)spl/u-boot-spl-pad.img $(obj)u-boot.img  $@
 
+# sunxi: Combined object with SPL U-Boot with sunxi header (sunxi-spl.bin)
+# and the full-blown U-Boot attached to it
+$(obj)u-boot-sunxi-with-spl.bin: $(obj)spl/sunxi-spl.bin $(obj)u-boot.bin
+   tr \000 \377  /dev/zero | dd ibs=1 
count=$(CONFIG_SPL_PAD_TO) \
+   of=$(obj)spl/sunxi-spl-pad.bin 2/dev/null
+   dd if=$(obj)spl/sunxi-spl.bin of=$(obj)spl/sunxi-spl-pad.bin \
+   conv=notrunc 2/dev/null
+   cat $(obj)spl/sunxi-spl-pad.bin $(obj)u-boot.bin  $@
+   rm $(obj)spl/sunxi-spl-pad.bin
+
 ifeq ($(SOC),tegra20)
 ifeq ($(CONFIG_OF_SEPARATE),y)
 nodtb=dtb
@@ -854,6 +864,7 @@ clobber:tidy
@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name * -type l 
-print | xargs rm -f
@rm -f $(obj)dts/*.tmp
@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
+   @rm -f $(obj)spl/sun?i-spl.bin
 
 mrproper \
 distclean: clobber unconfig
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 29cc4bd..6dc2bd0 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -27,12 +27,37 @@
 #include common.h
 #include asm/io.h
 #include serial.h
+#include i2c.h
 #include asm/gpio.h
 #include asm/arch/clock.h
 #include asm/arch/timer.h
 #include asm/arch/gpio.h
 #include asm/arch/sys_proto.h
 #include netdev.h
+#ifdef CONFIG_SPL_BUILD
+#include spl.h
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+/* Pointer to the global data structure for SPL */
+DECLARE_GLOBAL_DATA_PTR;
+
+/* The sunxi internal brom will try to loader external bootloader
+ * from mmc0, nannd flash, mmc2.
+ * Unfortunately we can't check how SPL was loaded so assume
+ * it's always the first SD/MMC controller
+ */
+u32 spl_boot_device(void)
+{
+   return BOOT_DEVICE_MMC1;
+}
+
+/* No confiration data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(void)
+{
+   return MMCSD_MODE_RAW;
+}
+#endif
 
 int gpio_init(void)
 {
@@ -65,6 +90,19 @@ void s_init(void)
 #endif
clock_init();
gpio_init();
+
+#ifdef CONFIG_SPL_BUILD
+   gd = gdata;
+   preloader_console_init();
+
+#ifdef CONFIG_SPL_I2C_SUPPORT
+   /* Needed early by sunxi_board_init if PMU is enabled */
+   i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
+
+   sunxi_board_init();
+#endif
+
 }
 
 void reset_cpu(ulong addr)
diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
index b9bbb7d..91cfae3 100644
--- a/arch/arm/cpu/armv7/sunxi/clock.c
+++ b/arch/arm/cpu/armv7/sunxi/clock.c
@@ -24,13 +24,34 @@
 #include common.h
 #include asm/io.h
 #include asm/arch/clock.h
+#include asm/arch/gpio.h
 #include asm/arch/sys_proto.h
 
+#ifdef CONFIG_SPL_BUILD
+static void clock_init_safe(void)
+{
+   struct sunxi_ccm_reg * const ccm =
+   (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+   /* Set safe defaults until PMU is configured */
+   writel(AXI_DIV_1  0 | AHB_DIV_2  4 | APB0_DIV_1  8 |
+  CPU_CLK_SRC_OSC24M  16, ccm-cpu_ahb_apb0_cfg);
+   writel(0xa1005000, ccm-pll1_cfg);
+   sdelay(200);
+   writel(AXI_DIV_1  0 | AHB_DIV_2  4 | APB0_DIV_1  8 |
+  CPU_CLK_SRC_PLL1  16, ccm-cpu_ahb_apb0_cfg);
+}
+#endif
+
 int clock_init(void)
 {
struct sunxi_ccm_reg *const ccm =
(struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
 
+#ifdef CONFIG_SPL_BUILD

Re: [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 13:23 +0100 skrev Luka Perkov:
 Hi Henrik,
 
 I have few comments bellow.
 
  +++ b/arch/arm/cpu/armv7/sunxi/Makefile

  +# (C) Copyright 2000-2003
 
 I don't know about the dates. It's 2012 now... Same goes for all other files.

Heh.. Not sure which board that was copied from.

Not sure what to set as copyright here. Can't say there have been any
significant contributions by anyone in this file, but have updated the
year to 2011-2012 to match current use.

Reviewing the others to see if copyright should be bumped, but some are
really published in 2011 and have only received non-copyrightable
cleanups after.

There is some doubt on the earlier span of the copyright on Allwinner
code, quite likely many are originally from 2011 and not 2007-2011 as
their copyright template says, but not in a position to tell for sure.

  +#defineCONFIG_SUNXI/* which is sunxi family */
 
 Space, not tab here.

Fixed.

  +/* Clock Defines */
 
 Why not remove this comment when there is no defines under it ?

Removed.

  +/*---
 
 I don't think we need  chars above.

Fixed.

  +/*---
 
 I don't think we need  chars above.

Fixed.


  +#define CONFIG_IDENT_STRING Allwinner Technology 
 
 Why do you need trailing space ?

We don't. Fixed.


Revised patch coming shortly.

Regards
Henrik

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


Re: [U-Boot] [PATCH 02/22] ARM: sunxi: MMC driver

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 15:33 +0100 skrev Luka Perkov:
  +#define MMCDBG(fmt...) printf([mmc]: fmt)
 
 Why not reuse something from existing uboot code ? (exaple from api/api.c):
 
  
  53 #ifdef DEBUG
  54 #define debugf(fmt, args...) do { printf(%s(): , __func__); printf(fmt, 
 ##args); } while (0)
  55 #else
  56 #define debugf(fmt, args...)
  57 #endif

Because it's not in a reusable header?

But should at least use up to date syntax, and debug() instead of
printf, and less #ifdefs.

What about this:

#define MMCDBG(fmt, args...)debug([sunxi_mmc]  fmt, ##args)

and printf() changed to debug() in the other debug helpers, and no
#ifdefs, the compiler will sort it out nicely at -OS


  +static void dumpmmcreg(struct sunxi_mmc *reg)
  +{
 
 I dont see this function is called anywhere...

Indeed. Current debug code dumps the register space in hex instead.

Added back a call as it's easier to decipher than the hex dump.

  -#define CONFIG_ENV_OFFSET  (544  10) /* (8 + 24 + 512)KB */
  +#define CONFIG_ENV_OFFSET  (544  10) /* (8 + 24 + 512)KB */
 
 The comment moving should go in the first patch.

Fixed.

Regards
Henrik

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


Re: [U-Boot] [PATCH 03/22] ARM sunxi: I2C driver

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 15:41 +0100 skrev Luka Perkov:

 Why don't you do it like this:
 
 #ifdef CONFIG_CMD_I2C
 #define CONFIG_SPL_I2C_SUPPORT
 #define CONFIG_SYS_I2C_SPEED  40
 #define CONFIG_HARD_I2C
 #define CONFIG_SUNXI_I2C
 #define CONFIG_SYS_I2C_SLAVE  0x7f
 #endif /* CONFIG_CMD_I2C */
 
 That way you can simply turn on i2c support in board configuration file.
 If users don't want/need i2c they don't need to use it.

SPL I2C support is orthogonal to CMD_I2C.

SPL needs I2C support for PMU control to configure the right CPU core
voltage and some other parameters.

Right now we only have one board which do not really need I2C driver in
SPL, all the others always need I2C driver enabled in SPL.

And we don't really have any board specific config files at the moment.
sunxi-common.h is the shared-by-all board config file, with sun4i.h and
sun5i.h being SoC generation dependent. The known boards are all so
similar that they can use the same main u-boot binary, almost even in
both SoC generations. 

SPL do differ noticeably in parameters from board to board.

Regards
Henrik

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


Re: [U-Boot] [PATCH 00/22] ARM: Allwinner sunXi (A10 A13) SoC support

2012-11-25 Thread Henrik Nordström
Thanks for your patch reviews. Will fix up your comments and submit a
new batch of patches later tonight.

sön 2012-11-25 klockan 16:21 +0100 skrev Luka Perkov:

 I think you should add README file in doc directory. It should at least
 contain information how to add support for new boards and point to the
 tool used for generating images.

There have long been thougts about moving the SPL DRAM controller
parameters to a boot header added by mksunxiboot instead of wiring them
into the source.

Which tool for generating images? mksunxiboot? The SPL image is built
automatically.

But yes, a README explaining how to install the SPL would help. We do
have a bit of a such README but I see now that it's slightly misplaced
as tools/mksunxiboot.README, should move do doc/README.sunxi and
expanded a bit.

 Do you have any plans for adding support so the boards can boot from
 SPI/NAND/NOR, anything else then MMC/SD ?

NAND is coming once we get the NAND controller under reasonable control.
It's a little too smart controller to fit nicely in mtd, and not exactly
well documented. Plus that many boards are using NAND chips not
recognised by u-boot mtd code.

Support for booting from MMC2 is also coming.

There is no known boards using SPI boot media so this probably will not
get added in the near future.

NOR is not supported by the SoC other than in SPI package.

Regards
Henrik

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


Re: [U-Boot] [PATCH 1/2] mkconfig: Make CONFIG_SYS_BOARD_NAME default to the configured target name

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 18:43 +0100 skrev Wolfgang Denk:
   echo #define CONFIG_SYS_BOARD \${board}\  config.h
  +echo #define CONFIG_SYS_TARGET \${BOARD_NAME}\  config.h
 
 I don't see what the difference is between CONFIG_SYS_BOARD (which is
 the board name) and CONFIG_SYS_BOARD_NAME ?

CONFIG_SYS_BOARD is the board config name, which may differ from the
board name given to make.

CONFIG_SYS_BOARD_NAME is set to the name in boards.cfg.

To illustrate using existing boards in boards.cfg look at for example
the spear boards.

spear300 arm arm926ejs   spear300spear  
spear   spear3xx_evb:spear300
spear300_nandarm arm926ejs   spear300spear  
spear   spear3xx_evb:spear300,nand
[...]
spear320_usbtty_nand arm arm926ejs   spear320spear  
spear   spear3xx_evb:spear320,usbtty,nand


CONFIG_SYS_BOARD is spear3xx_evb on all 16 of these as they are the same 
board with only different CONFIG_.. parameters set via boards.cfg.

CONFIG_SYS_BOARD_NAME is the first column, unique on each.

 In any case, documentation for CONFIG_SYS_BOARD_NAME is missing.

This should go in README?

Regards
Henrik

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


Re: [U-Boot] [PATCH 2/2] Makefile: Accept target names in all lower case to ease matching

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 18:45 +0100 skrev Wolfgang Denk:
 Dear Henrik Nordström,
 
 In message 1353842544.17518.11.ca...@home.hno.se you wrote:
  ---
   Makefile |1 +
   1 files changed, 1 insertions(+), 0 deletions(-)
  
  diff --git a/Makefile b/Makefile
  index 1a17be9..5a98745 100644
  --- a/Makefile
  +++ b/Makefile
  @@ -752,6 +752,7 @@ unconfig:
   sinclude $(obj).boards.depend
   $(obj).boards.depend:  boards.cfg
  @awk '(NF  $$1 !~ /^#/) { print $$1 :  $$1 _config; $$(MAKE) }' 
  $  $@
  +   @awk '(NF  $$1 !~ /^#/  tolower($$1) != $$1) { print tolower($$1) 
  :  $$1 _config; $$(MAKE) }' $  $@
 
 NAK.  This is not DOS.  Names are case sensitive.

Ok, then I'll swing the patch in the other direction and make target
names actually case sensitive. Because today they are a bit confused
partially case-insensitive.

Note that it's not about board config file names or directory names,
only about the first column in boards.cfg.

Regards
Henrik


---
From: Henrik Nordstrom hen...@henriknordstrom.net
Date: Sun, 25 Nov 2012 19:00:12 +0100
Subject: [PATCH] mkconfig: Make board name matching case-sensitive

As per mail discussion board names are supposed to be case-sensitive
---
 mkconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mkconfig b/mkconfig
index 7c9aa74..324703f 100755
--- a/mkconfig
+++ b/mkconfig
@@ -21,7 +21,7 @@ options=
 
 if [ \( $# -eq 2 \) -a \( $1 = -A \) ] ; then
# Automatic mode
-   line=`egrep -i ^[[:space:]]*${2}[[:space:]] boards.cfg` || {
+   line=`egrep ^[[:space:]]*${2}[[:space:]] boards.cfg` || {
echo make: *** No rule to make target \`$2_config'.  Stop. 2
exit 1
}
-- 
1.7.7.6


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


Re: [U-Boot] [PATCH 00/22] ARM: Allwinner sunXi (A10 A13) SoC support

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 18:58 +0100 skrev Marek Vasut:

 The mkimage infrastructure won't work? I think it's much better than yet 
 another 
 tool (mksunxi...) 

Suggestion how to fit adding an SPL header with these parameters in
mkimage is welcome

http://lists.denx.de/pipermail/u-boot/2012-November/140772.html

Regards
Henrik

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


Re: [U-Boot] [PATCH] ARM v7: Flush icache when executing a program with go

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 18:41 +0100 skrev Wolfgang Denk:
 Dear Henrik Nordström,
 
 In message 1353842010.17518.3.ca...@home.hno.se you wrote:
  ARM v7 runs with icache enabled. For reliable results the go command
  needs to flush the icache before jumping or it may risk running
  cached instructions that differ from what currently is in memory.
 
 This should never be an architecutre specific thing.  Whether we flush
 caches or not should be the same on all architectures.

Agreed.

But this needs some flush icache if supported  enabled for current
arch function that do not yell loudly if icache not supported/enabled.
invalidate_icache_all() yells loudly if not implememented by the current
arch.

Regards
Henrik

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


Re: [U-Boot] [PATCH 06/22] ARM sunxi: Basic GPIO driver

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 20:50 +0100 skrev Wolfgang Denk:
 Dear Henrik Nordström,
 
 In message 1353843623.17518.17.ca...@home.hno.se you wrote:
  GPIO driver for Allwinner sun4i/sun5i family of SoCs
  
  GPIO Pins are named by their symbolic pin names Pg#
  such as PH19 or H19.
  
  Note: This do not perform any validation if the pin is in use
  for some other I/O function. Use with care.
 
 SoB missing.

Sorry about that.

 Um are these patches actually bisectable???  It appears not; for
 example, you reference gpio_direction_input() in ealier patches, but
 define it only now.

Um.. right, on sun4i_sdcon with console redirected to the SD pins the
uart code uses that as a shorthand for sunxi_gpio_set_cfgpin(). Fixing.
Thanks for noticing.

And sorry for not doing a full matrix bisect validation, only did bisect
test on the basic targets when splitting the patch series. Will run a
full bisect matrix test for next round.

Regards
Henrik

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


Re: [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 20:33 +0100 skrev Wolfgang Denk:
 Dear Henrik Nordström,
 
 In message 1353843450.17518.13.ca...@home.hno.se you wrote:
  This adds support for the Allwinner A10/A13 SoC's. Additionally
  board support for the dev-boards sun4i/sun5i is added.
  
  Signed-off-by: Tom Cubie tangli...@allwinnertech.com
  Signed-off-by: Henrik Nordström hen...@henriknordstrom.net
  Signed-off-by: Stefan Roese s...@denx.de
 
 Where exactly is Stefan's SoB coming from?  I don't think I have seen
 this here on the list before?

He has been helping off-list to clean up the worst things and adding
ethernet support and adding Signed-off-by in the process.

Regards
Henrik

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


Re: [U-Boot] [PATCH 2/2] Makefile: Accept target names in all lower case to ease matching

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 21:04 +0100 skrev Wolfgang Denk:

 Well, these are make targets, so they are definitely case sensitive.
 
   if [ \( $# -eq 2 \) -a \( $1 = -A \) ] ; then
  # Automatic mode
  -   line=`egrep -i ^[[:space:]]*${2}[[:space:]] boards.cfg` || {
  +   line=`egrep ^[[:space:]]*${2}[[:space:]] boards.cfg` || {
 
 Did you test what gets broken by this patch?

All normal make targetname is unaffected by the change as they are
case sensitive.

What gets broken by the change os someone calling

   make wronglycasedtargetname_config

Or direct invocation of

  ./mkconfig -A wronglycasedtargetname

Regards
Henrik

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


Re: [U-Boot] [PATCH 01/22] ARM: sunxi: Basic Allwinner A10/A13 (sun4i/sun5i) support

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 19:06 +0100 skrev Marek Vasut:
  +COBJS  += timer.o
  +COBJS  += dram.o
  +COBJS  += board.o
  +COBJS  += clock.o
  +COBJS  += pinmux.o
 
 COBJS = x.o y.o z.o
 works just fine

Does it matter?

+= is easier to deal with when adding/removing files.

  +void enable_caches(void)
  +{
  +   /* Enable D-cache. I-cache is already enabled in start.S */
  +   dcache_enable();
 
 Why don't you enable them both? What if someone fiddled with them prior to 
 reset?

Because as the comment says, u-boot already enables I-cache in armv7
start.S.

  +}
  +#endif
 [...]
 
  +   cfg = readl(pio-cfg[0] + index);
  +   cfg = ~(0xf  offset);
  +   cfg |= val  offset;
  +
  +   writel(cfg, pio-cfg[0] + index);
 
 clrsetbits_le32()

Yes. Need to fix those in many places. Will do a full review.

  +   return 0;
  +}
  +
  +int sunxi_gpio_get_cfgpin(u32 pin)
  +{
  +   u32 cfg;
  +   u32 bank = GPIO_BANK(pin);
  +   u32 index = GPIO_CFG_INDEX(pin);
  +   u32 offset = GPIO_CFG_OFFSET(pin);
  +   struct sunxi_gpio *pio =
  +   ((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)-gpio_bank[bank];
  +
  +   cfg = readl(pio-cfg[0] + index);
  +   cfg = offset;
 
 I think you want to put this into drivers/gpio, no?

Why? It is accessing the pinmux setting of the pin, not GPIO value.

May want to rename the whole family of functions to _pinmux_

  +++ b/arch/arm/cpu/armv7/sunxi/reset.S

 Put this into proper C code.

Agreed. Inherited it as asm but there is no need for asm here. Will
replace by parts from the watchdog code, which also sets the register
proper.

  diff --git a/arch/arm/cpu/armv7/sunxi/timer.c
  b/arch/arm/cpu/armv7/sunxi/timer.c new file mode 100644
  index 000..e19df09
  --- /dev/null
  +++ b/arch/arm/cpu/armv7/sunxi/timer.c
  @@ -0,0 +1,117 @@
 [...]
 
  +/* delay x useconds */
 
 proper kerneldoc all around won't hurt.

 +void __udelay(unsigned long usec)
 

It's the same level of documentation or better as used pretty much
everywhere else. Most don't have a comment at all here.

Any example of the level of documentation you'd like to see?

Regards
Henrik

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


Re: [U-Boot] mksunxiboot tool SPL parameters

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 19:16 +0100 skrev Henrik Nordström:
 sön 2012-11-25 klockan 18:58 +0100 skrev Marek Vasut:
 
  The mkimage infrastructure won't work? I think it's much better than yet 
  another 
  tool (mksunxi...) 
 
 Suggestion how to fit adding an SPL header with these parameters in
 mkimage is welcome
 
 http://lists.denx.de/pipermail/u-boot/2012-November/140772.html

Got sent a bit premature.

Have not spent time in integrating this header mkimage because the tool
is currently only used build-time. There is at this time no need to have
a tool for adding this header outside of running make.

If the SPL parameters are runtime parameterized instead of wired into
C code then it makes great sense to add this to mkimage. Just not
entirely sure on what the proper usage parameters of mkimage is to
supply the needed SPL parameters. Or where to keep those parameters in
the tree if not in the source.

Regards
Henrik

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


Re: [U-Boot] [PATCH 01/22] Re: Copyright on board makefiles.

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 20:55 +0100 skrev Wolfgang Denk:
 Dear Henrik Nordström,
 
 In message 1353848939.28559.13.ca...@home.hno.se you wrote:
 
+# (C) Copyright 2000-2003
   
   I don't know about the dates. It's 2012 now... Same goes for all other 
   files.
  
  Heh.. Not sure which board that was copied from.
  
  Not sure what to set as copyright here. Can't say there have been any
  significant contributions by anyone in this file, but have updated the
  year to 2011-2012 to match current use.
 
 You have changed a Copyright entry that was attributed to me?
 
 Who exactly gave you the right to do that? 

We copied one of your Makefiles as template. There is still some generic
board Makefile lines left ofcourse. Same as is used on every board.

The intention here was to give you the copyright to the changed file as
it's more part of the build system than any board specifics. I
presonally do not consider the board specific additions as
copyrightable.

You want me to keep your old copyright from 2003 and add my own?

Or only keep your old copyright from 2003?

Regards
Henrik

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


Re: [U-Boot] [PATCH 00/22] ARM: Allwinner sunXi (A10 A13) SoC support

2012-11-25 Thread Henrik Nordström
sön 2012-11-25 klockan 18:02 +0100 skrev Luka Perkov:

 You might want to wait a few days... Somebody else might have comments.

Good point. Will resuimt the patchset with accumulated fixes by next
weekend.

Regards
Henrik

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


Re: [U-Boot] [PATCH 00/22] ARM: Allwinner sunXi (A10 A13) SoC support

2012-11-25 Thread Henrik Nordström
mån 2012-11-26 klockan 13:43 +1100 skrev Graeme Russ:

 It's good to see not only the core A10 support, but several boards
 right off the bat. With respect to the boards, is putting them all in
 the same board directory the right thing to do?

I don't know. Stefan suggested the current layout in lack of anthing
that really is board unique.

These boards do not really have anything unique as far as main u-boot is
concerned. They only differ in the DRAM parameters needed by SPL.

 As Wolfgang mentioned, don't forget to run your patches through
 checkpatch.pl and make sure you properly prefix your next version v2

I thought I had fixed all checkpatch things that matters, but obviously
missed some.

And better to get the patches looked at. Did not expect them to pass
without comments.

Regards
Henrik

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


Re: [U-Boot] common/xyzmodem.c, ymodem, slow behavior receiving bytes

2012-11-14 Thread Henrik Nordström
ons 2012-11-14 klockan 10:47 +0100 skrev Angelo Dureghello:
   Also, i don't understand why -g is set by default. 

 My question becouse sometime embedded programmers fight for a bite free 
 in the flash. On limited boards like mine (4M Flash) once kernel and 
 some apps are stored, very small size remain for u-boot and some n.v. data 
 storage. But no problem for me, i change flags as needed eventually.

-g do not change the on-flash size at all. The debug information is not
included in the u-boot.bin file you install in flash.

 Sure, 20 Mhz boards are able to handle 115200 as well. So there is clearly
 something non working properly in my custom board. First thought is the 
 sdram not well initialized, resulting in very slow execution of the u-boot 
 code. Is there a way in u-boot to test code execution speed ?

Memory speed can be tested with mw command to fill some region of unused
memory with a pattern.



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


Re: [U-Boot] wanting a couple clarifications on the boards.cfg file

2012-11-12 Thread Henrik Nordström
mån 2012-11-12 klockan 12:43 -0500 skrev Robert P. J. Day:
   after some playing around, i think i have a pretty good handle on
 the structure and usage of the boards.cfg file, except for what are
 apparently some oddities (not errors, just redundancies in some
 sense).
 
   first, with lines like this:
 
 apx4devkit   arm arm926ejs   apx4devkit  
 bluegiga   mxs apx4devkit
 m28evk   arm arm926ejs   m28evk  denx 
   mxs m28evk
 mx28evk  arm arm926ejs   mx28evk 
 freescale  mxs mx28evk
 
 that last field would seem to be redundant, since the default value is
 just the name of the first (target) field, correct?

It can be different.

Does not need to be specified when it's the same.

   also odd is something like this:
 
 mx31ads  arm arm1136 -   
 freescale  mx31
 mx31pdk  arm arm1136 -   
 freescale  mx31 mx31pdk:NAND_U_BOOT
 
   given that nothing else in the entire file refers to mx31pdk, it
 seems overly complicated for mx31pdk to refer to its own config file,
 only to add a preprocessor definition.

Yes, but syntax do not allow specifying defines without a config name I
think.

Regards
Henrik

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


Re: [U-Boot] Documentation about Falcon Mode

2012-11-10 Thread Henrik Nordström
lör 2012-11-10 klockan 00:25 +0100 skrev Anatolij Gustschin:

 Some documentation is in README (SPL framework) and doc/README.SPL, example
 code is in mainline (see i.e. twister board). For slides see [1]. Links to
 the videos mentioned in the slides can be found here [2].

The piece I am missing is how to use u-boot to prepare the saved boot
information used when loading the kernel directly from SPL.

How to make the SPL framework load a kernel image is quite obvious. But
not how to have the right parameters sent to the kernel.

Regards
Henrik

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


Re: [U-Boot] [PATCH v2 10/25] common/misc: sparse fixes

2012-11-05 Thread Henrik Nordström
mån 2012-10-29 klockan 18:34 -0500 skrev Kim Phillips:

 diff --git a/common/command.c b/common/command.c
 index 50c8429..f51df26 100644
 --- a/common/command.c
 +++ b/common/command.c
 @@ -40,8 +40,15 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, 
 cmd_tbl_t * cmdtp, int
   int i;
   int rcode = 0;
  
 + if (cmd_items  CONFIG_SYS_MAXARGS) {
 + printf(%s: cmd_items %d exceeds hardcoded limit %d.
 + Recompile with higher CONFIG_SYS_MAXARGS?\n,
 +__func__, cmd_items, CONFIG_SYS_MAXARGS);
 + return -1;
 + }
 +
   if (argc == 1) {/*show list of commands */
 - cmd_tbl_t *cmd_array[cmd_items];
 + cmd_tbl_t *cmd_array[CONFIG_SYS_MAXARGS];
   int i, j, swaps;
  


This breaks the help command if there is more than 16 commands enabled,
i.e. for everyone.

CONFIG_SYS_MAXARGS is not meant to be the maximum number of commands, it
is the maximum number of arguments to a single command.

Regards
Henrik

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


Re: [U-Boot] [PATCH] common: fix help command breakage

2012-11-05 Thread Henrik Nordström
mån 2012-11-05 klockan 19:51 -0600 skrev Kim Phillips:
 commit 199adb601ff34bdbbd0667fac80dfe0a87bffc2b common/misc: sparse
 fixes broke the help command trying to fix the sparse error
 command.c:44:38: error: bad constant expression.
 
 As Henrik points out, the fix was bad because the commit used
 CONFIG_SYS_MAXARGS whereas the code intended to use the maximum
 number of commands (not arguments to a command).
 
 this patch fixes both by making the allocation manually on the heap.
 
 Reported-by: Henrik Nordström hen...@henriknordstrom.net
 Signed-off-by: Kim Phillips kim.phill...@freescale.com

Tested-by: Henrik Nordström hen...@henriknordstrom.net



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


Re: [U-Boot] [PATCH 2/3] i2c: common changes for multibus/multiadapter support

2012-10-22 Thread Henrik Nordström
mån 2012-10-22 klockan 19:40 +0200 skrev Heiko Schocher:
 +- Legacy I2C Support:CONFIG_HARD_I2C | CONFIG_SOFT_I2C
 +
 + NOTE: It is intended to move drivers to CONFIG_SYS_I2C which
 + provides the following compelling advantages:
 + 1. Heiko to fill in

Something missing here?

Regards
Henrik


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


Re: [U-Boot] A little introduction

2012-09-12 Thread Henrik Nordström
ons 2012-09-12 klockan 11:26 +1000 skrev Graeme Russ:

 I must make an apology - I had committed to assisting you and Tom in
 bringing this port into mainline U-Boot (including investigating the
 SPL breakage et. al.).

No need to apology. We all have life (to various degrees) outside
computers.

AW A1X SPL seems to be under control. And currently massaging support
for the two CPUs (AW A10 and A13) into a shared (and fully up to date)
tree. The two CPUs are mostly the same for u-boot with only some tiny
differences in DRAM and clocking.

 That's great news. When you say 'little brother', does that imply that
 the A13 is a lower-powered/featured device when compared against the
 A10?

A13 is a very stripped down device compared to A10, aimed solely at dirt
cheap 7 tablets where A10 is a general multi-purpose flexible beast.

 Good to hear that there are individuals committed to supporting this
 hardware. My perception is that we are seeing explosive growth in the
 'cheap but feature-full' ARM SoC market. But the consequence of the
 amount of competition in the market is that vendor margins are
 dropping and, as a consequence, vendors are devoting very little time
 to support us. I just wish they would at least produce datasheets that
 were more than an over-rated product brochure ;)

There is a restricted circulation AW A10 datasheet which is not the
product brochure, but the Linux kernel sources is the authorative source
of information in any interesting areas.

Regards
Henrik

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


[U-Boot] A little introduction

2012-09-07 Thread Henrik Nordström
A little introduction to let you know who I am and why I am here.

I am maintaining u-boot support for Allwinner A1x class CPUs, and ARM
Cortex A8 class SoC by chineese Allwinner Tech.
http://www.github.com/hno/uboot-allwinner/

To be honest I am not guilty to much of the code. The bulk of the A10
support was kindly donated by Allwinner via Tom Cubie, including a SPL
support enabling the A10 boot rom to boot u-boot dir4ectly from sd
cards. So far for th A10 I have mostly managed to produce failed ports
to later u-boot versions where SPL crashes and cleaned things up a
little.

For the last couple of months I have been staring at A13, the newer
little brother of A10, trying to get SPL to work there and now finally I
have got the pieces together and we have a working (but not optimal) SPL
for A13.

Also involved in the free kernel development for Allwinner A1x class
SoCs and other supporting tools for the SoC family.

Outside u-boot I am the proud father of 6 wonderful kids, president of
the Squid Software Foundation, and an independent IT consultant focusing
on Linux  networking.

Been hacking on computers for more than 3 decades, ranging from demo
programming, game development, web interfaces, application level
proxies, kernel drivers, and now back to bare metal in u-boot.

My work on u-boot is done by interest in both the SoCs in question and
bare metal development, and plan to continue looking after this class of
SoCs for quite some time.

Kind regards
Henrik Nordström
Sweden


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