Re: [U-Boot] Unable to understand flow of U-Boot Code.

2013-05-15 Thread Vikram Narayanan

Hello,

On 5/15/2013 3:35 PM, Rajdeep Vaghasia wrote:

Hello,

I am trying to understand the flow of U-boot code, but unable to get the
complete link.


This question has been asked *innumerous* times in the list.
One sample from the archive
http://lists.denx.de/pipermail/u-boot/2013-January/144950.html

Dig in to the archives, you'll find more.


I can not understand how the flow goes. In which sequence the code executes.


Do you have a board and a JTAG? If yes, just hook in the JTAG and load 
u-boot to see where it goes from the reset vector.



So, please give me some reference, which can explain the complete flow of
execution of U-Boot code.


Sorry, there is no such ready reckoner available which would give you 
the _complete_ flow.


Start with the README in the root folder.

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


Re: [U-Boot] [PATCH] Add initial support for mx6slevk board

2013-04-01 Thread Vikram Narayanan

On 3/31/2013 2:38 AM, Fabio Estevam wrote:

From: Fabio Estevam fabio.este...@freescale.com

snip

diff --git a/arch/arm/include/asm/arch-mx6/mx6sl_pins.h 
b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h
new file mode 100644
index 000..cd974d8
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx6/mx6sl_pins.h
@@ -0,0 +1,1374 @@
+/*
+ * Copyright (C) 2013 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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.
+ */
+
+#ifndef __ASM_ARCH_MX6_MX6SL_PINS_H__
+#define __ASM_ARCH_MX6_MX6SL_PINS_H__
+
+#include asm/imx-common/iomux-v3.h
+
+/* Use to set PAD control */
+#define PAD_CTL_HYS(1  16)
+#define PAD_CTL_PUS_100K_DOWN  (0  14)
+#define PAD_CTL_PUS_47K_UP (1  14)
+#define PAD_CTL_PUS_100K_UP(2  14)
+#define PAD_CTL_PUS_22K_UP (3  14)
+
+#define PAD_CTL_PUE(1  13)
+#define PAD_CTL_PKE(1  12)
+#define PAD_CTL_ODE(1  11)
+#define PAD_CTL_SPEED_LOW  (1  6)
+#define PAD_CTL_SPEED_MED  (2  6)
+#define PAD_CTL_SPEED_HIGH (3  6)
+#define PAD_CTL_DSE_DISABLE(0  3)
+#define PAD_CTL_DSE_240ohm (1  3)
+#define PAD_CTL_DSE_120ohm (2  3)
+#define PAD_CTL_DSE_80ohm  (3  3)
+#define PAD_CTL_DSE_60ohm  (4  3)
+#define PAD_CTL_DSE_48ohm  (5  3)
+#define PAD_CTL_DSE_40ohm  (6  3)
+#define PAD_CTL_DSE_34ohm  (7  3)
+#define PAD_CTL_SRE_FAST   (1  0)
+#define PAD_CTL_SRE_SLOW   (0  0)
+


Is the above same for all the variants of i.Mx?
Can we put this into a common header file?


+#define IOMUX_CONFIG_SION 0x10
+#define NO_MUX_I0
+#define NO_PAD_I0
+enum {
+   MX6_PAD_AUD_MCLK__AUDMUX_AUDIO_CLK_OUT  = 
IOMUX_PAD(0x02A4, 0x004C, 0, 0x, 0, 0),
+   MX6_PAD_AUD_MCLK__PWM4_PWMO = 
IOMUX_PAD(0x02A4, 0x004C, 1, 0x, 0, 0),
+   MX6_PAD_AUD_MCLK__ECSPI3_RDY= 
IOMUX_PAD(0x02A4, 0x004C, 2, 0x06B4, 0, 0),
+   MX6_PAD_AUD_MCLK__FEC_MDC   = 
IOMUX_PAD(0x02A4, 0x004C, 3, 0x, 0, 0),


Is the mx6slevk using all the pins defined here?
If not please take off the unused IOMUX pins so that we don't add dead code.

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


Re: [U-Boot] [PATCH] Add initial support for mx6slevk board

2013-04-01 Thread Vikram Narayanan

On 4/2/2013 3:45 AM, Fabio Estevam wrote:

On Mon, Apr 1, 2013 at 2:44 PM, Fabio Estevam feste...@gmail.com wrote:

On Mon, Apr 1, 2013 at 2:26 PM, Vikram Narayanan vikram...@gmail.com wrote:


Is the above same for all the variants of i.Mx?
Can we put this into a common header file?


Ok, I can try to put this into a common location.


+#define IOMUX_CONFIG_SION 0x10
+#define NO_MUX_I0
+#define NO_PAD_I0
+enum {
+   MX6_PAD_AUD_MCLK__AUDMUX_AUDIO_CLK_OUT  =
IOMUX_PAD(0x02A4, 0x004C, 0, 0x, 0, 0),
+   MX6_PAD_AUD_MCLK__PWM4_PWMO =
IOMUX_PAD(0x02A4, 0x004C, 1, 0x, 0, 0),
+   MX6_PAD_AUD_MCLK__ECSPI3_RDY=
IOMUX_PAD(0x02A4, 0x004C, 2, 0x06B4, 0, 0),
+   MX6_PAD_AUD_MCLK__FEC_MDC   =
IOMUX_PAD(0x02A4, 0x004C, 3, 0x, 0, 0),



Is the mx6slevk using all the pins defined here?


No, I put all pins for completion.


I meant completeness, here.


If not please take off the unused IOMUX pins so that we don't add dead code.


I thought it was common practice to provide the complete IOMUX pin file.


Looking at mx6q_pins.h I see that the IOMUX table is complete, but
mx6dl_pins.h is not, so just want to get a confirmation  first before
doing v2.


Please refer the mx6dl discussion here.
http://www.mail-archive.com/u-boot@lists.denx.de/msg94194.html

It was Troy's idea, to include only the necessary pins.

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


Re: [U-Boot] u-boot build error [from v2013.01 onwards]

2013-01-26 Thread Vikram Narayanan
On 1/27/2013 7:10 AM, Jagan Teki wrote:
 This error occurred for all boards in the u-boot, I have used
 arm-none-linux-gnueabi- xtool for versatilepb board.
 I saw this issue specially from 2013.01 on-wards.

Can you check your host setup once?

Below is the output from my setup. I don't see any error.

$ git describe 
v2013.01
$ make ARCH=arm versatilepb_config
Configuring for versatilepb - Board: versatile, Options: ARCH_VERSATILE_PB
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 11.04
Release:11.04
Codename:   natty

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


Re: [U-Boot] [RFC][PULL-REQ] MTD update

2012-12-29 Thread Vikram Narayanan

On 12/28/2012 7:29 PM, Tom Rini wrote:

On Fri, Dec 28, 2012 at 07:17:42AM -0500, Sergey Lapin wrote:


Hi, all!

As I failed to submit 250KB patch to the list
I will send this pull request

This patch is not for inclusion yet.
This patch is just update of u-boot MTD with
Linux kernel's MTD v3.8-rc.


First, while I appreciate the effort, I'd rather us sync with v3.7
release rather than the in-flux v3.8.  Second, can you please look at
the archives about how we've done these re-syncs before?  I really don't
want to take a single giant patch and we're usually able to break this
up into chunks.  Thanks!


Can someone point to the exact thread where such discussion has happened 
before?


The re-sync has to happen addressing the bisect-ability as well.

Already there was a discussion on syncing the UBI layer. So, if some 
ideas are thrown, it would be beneficial for both MTD and UBI sync.


Thanks,
Vikram

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


Re: [U-Boot] [PATCH] arm/bootstage: Move the bootstage call after gd init

2012-12-27 Thread Vikram Narayanan

On 12/27/2012 3:52 PM, Albert ARIBAUD wrote:

On Thu, 27 Dec 2012 10:41:06 +0100, Albert ARIBAUD
albert.u.b...@aribaud.net wrote:

Hi Simon,

On Wed, 26 Dec 2012 12:39:32 -0800, Simon Glass s...@chromium.org
wrote:

Hi Vikram,

On Sun, Dec 23, 2012 at 3:27 AM, Vikram Narayanan vikram...@gmail.com wrote:

bootstage_mark_name calls timer_get_boot_us which inturn calls
the arch timer. The arch timer uses the gd pointer to save the
lastinc count. A call to bootstage_mark_name here results in a
data abort as gd is uninitialized.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
Cc: Wolfgang Denk w...@denx.de
Cc: Albert Aribaud albert.u.b...@aribaud.net


Acked-by: Simon Glass s...@chromium.org

This bug will affect boards which don't have their own
timer_get_boot_us() function.

Albert, I think we should try to get this in as a bug fix in the
upcoming release.

Thanks for the fix Vikram.


Thanks Vikram and Simon; I'll pull this in today.


... actually, this will depend on whether my crt0 change gets in for
2013.01, as with this change, gd is already initialized when
entering board_init_f().


Yes. You are right. If your patch goes in, my patch need not be applied.

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


[U-Boot] [PATCH] arm/bootstage: Move the bootstage call after gd init

2012-12-23 Thread Vikram Narayanan
bootstage_mark_name calls timer_get_boot_us which inturn calls
the arch timer. The arch timer uses the gd pointer to save the
lastinc count. A call to bootstage_mark_name here results in a
data abort as gd is uninitialized.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
Cc: Wolfgang Denk w...@denx.de
Cc: Albert Aribaud albert.u.b...@aribaud.net
---
Though it is true that there are currently no users for this
feature, it isn't good to see an abort when someone tries to
use BOOTSTAGE. I was bugged by this error when trying to 
use this feature on i.Mx6Q based board.

 arch/arm/lib/board.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index e0cb635..2f09ab9 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -277,13 +277,13 @@ void board_init_f(ulong bootflag)
void *new_fdt = NULL;
size_t fdt_size = 0;
 
-   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, board_init_f);
-
/* Pointer is writable since we allocated a register for it */
gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR)  ~0x07);
/* compiler optimization barrier needed for GCC = 3.4 */
__asm__ __volatile__(: : :memory);
 
+   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, board_init_f);
+
memset((void *)gd, 0, sizeof(gd_t));
 
gd-mon_len = _bss_end_ofs;
-- 
1.7.4.1

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


Re: [U-Boot] Bricked when trying to attach UBI

2012-12-19 Thread Vikram Narayanan

On 12/19/2012 4:58 PM, Luca Ceresoli wrote:

Hi all,


snip

On bricked devices the output of the ubi part nand0,3 command is:

Creating 1 MTD partitions on nand0:
0x0010-0x1000 : mtd=3
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:129024 bytes
UBI: smallest flash I/O unit:2048
UBI: sub-page size:  512
UBI: VID header offset:  512 (aligned 512)
UBI: data offset:2048
UBI error: ubi_wl_init_scan: no enough physical eraseblocks (0, need 1)


Just curious, What does the above command say when you try to attach an 
empty partition. Does it result in the same error?



Now the device is totally blocked, and power cycling does not change
the result.

The interesting thing is that if I load Linux (2.6.37 + OMAP patches +
board support patches) via TFTP and boot it with bootm, it correctly
attaches UBI (fixing any problem it may have) and boots correctly.
After that the board is unbricked: U-Boot can boot again normally from
NAND.

Without the ambition of understanding all UBI internals, I tried to
visually inspect the UBI code around the line where the error is
produced and compare it to the corresponding Linux sources. They looked
extremely similar, so I haven't and obvious hint of why U-Boot and
Linux produce different results.

I also tried with an updated U-Boot master, but the error is still
there.

Obviously I have changed nothing in the UBI and MTD code, both in
U-Boot and in Linux.

Can you suggest a proper way to track the root of the problem, or to
bypass it?


I think its the right time to sync the UBI code with the current kernel 
tree. But it seems like a huge work. Any suggestions?


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


Re: [U-Boot] Bricked when trying to attach UBI

2012-12-19 Thread Vikram Narayanan

On 12/19/2012 11:52 PM, Stefan Roese wrote:
snip

I think its the right time to sync the UBI code with the current kernel
tree. But it seems like a huge work. Any suggestions?


Yes, syncing with the latest UBI/UBIFS code would be the best solution.
Even though a try with an increased malloc area as suggested by Andreas
might be a chance.

And yes, this re-sync with the latest-and-greatest Linux code version is
of course a bigger task. It has been suggest as part of booting from an
UBI volume task to the celinux forum:

http://lists.celinuxforum.org/pipermail/celinux-dev/2012-April/000543.html


Yeah. I had queried sometime back on the activity of this task.


But nothing has happened till now. Any volunteers? But please keep in
mind that intensive testing is required before the current (stable?)
code version can be replaced.



Looks like the MTD layer might needs to be patched up as well at some 
places. What do you think?


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


Re: [U-Boot] Bricked when trying to attach UBI

2012-12-19 Thread Vikram Narayanan

On 12/20/2012 12:17 AM, Vikram Narayanan wrote:

On 12/19/2012 11:52 PM, Stefan Roese wrote:
snip

I think its the right time to sync the UBI code with the current kernel
tree. But it seems like a huge work. Any suggestions?


Yes, syncing with the latest UBI/UBIFS code would be the best solution.
Even though a try with an increased malloc area as suggested by Andreas
might be a chance.

And yes, this re-sync with the latest-and-greatest Linux code version is
of course a bigger task. It has been suggest as part of booting from an
UBI volume task to the celinux forum:

http://lists.celinuxforum.org/pipermail/celinux-dev/2012-April/000543.html



Yeah. I had queried sometime back on the activity of this task.


But nothing has happened till now. Any volunteers? But please keep in
mind that intensive testing is required before the current (stable?)
code version can be replaced.



Looks like the MTD layer might needs to be patched up as well at some
places. What do you think?


May be we shall start some discussions and put forth some ideas, which 
might eventually invite some volunteers.


What is your proposal of syncing with the latest code?
* Pick out changes from the Kernel's git (pick out UBI related commits 
right from the point where current u-boot code is)

* Compare and move the code

Both are equally complicated with the second option having very less 
chance to figure out why that was added. Ideas are welcome.


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


Re: [U-Boot] UBI Fixable bit-flip issue.

2012-12-17 Thread Vikram Narayanan

Hi,

On 12/17/2012 2:14 PM, Holger Brunck wrote:

Hi,

On 12/15/2012 04:14 AM, Vikram Narayanan wrote:

On 12/14/2012 11:33 PM, Vikram Narayanan wrote:


I'm seeing a fixable bit-flip in the current u-boot (v2012.10) on a
i.Mx6 Solo based custom board. The problem is similar to the one
explained here [1].

As observed by the thread's author, does reverting the commit 1b1f9a9
solves the issue? Did someone face a similar issue?



this was a workaround I had until I found a proper solution for v2011.09. In the
meantime the following fix was included in u-boot:

http://git.denx.de/?p=u-boot.git;a=commit;h=d63894654df72b010de2abb4b3f07d0d755f65b6

This solves this issue for my problem. This patch is included in v2012.10 so
this should be ok. Maybe you hit a different problem.



Thanks for clarifying. I'll see if I can reproduce it someway and also 
rebase my work on top of v2012.10 to see if that solves the issue.


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


[U-Boot] UBI Fixable bit-flip issue.

2012-12-14 Thread Vikram Narayanan

Hello,

I'm seeing a fixable bit-flip in the current u-boot (v2012.10) on a 
i.Mx6 Solo based custom board. The problem is similar to the one 
explained here [1].


As observed by the thread's author, does reverting the commit 1b1f9a9 
solves the issue? Did someone face a similar issue?


Thanks,
Vikram

[1] http://lists.denx.de/pipermail/u-boot/2011-September/100237.html
[2] http://lists.denx.de/pipermail/u-boot/2011-September/101887.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] UBI Fixable bit-flip issue.

2012-12-14 Thread Vikram Narayanan

Ccing the Author of [1].

On 12/14/2012 11:33 PM, Vikram Narayanan wrote:

Hello,

I'm seeing a fixable bit-flip in the current u-boot (v2012.10) on a
i.Mx6 Solo based custom board. The problem is similar to the one
explained here [1].

As observed by the thread's author, does reverting the commit 1b1f9a9
solves the issue? Did someone face a similar issue?

Thanks,
Vikram

[1] http://lists.denx.de/pipermail/u-boot/2011-September/100237.html
[2] http://lists.denx.de/pipermail/u-boot/2011-September/101887.html


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


Re: [U-Boot] [PATCH v4 1/3] Add README for the Falcon mode

2012-11-24 Thread Vikram Narayanan

Hello Andreas,

On 11/24/2012 3:29 AM, Andreas Bießmann wrote:

Dear Vikram Narayanan,

On 23.11.12 19:10, Vikram Narayanan wrote:

snip


+The parameters generated with this step can be saved into NAND at the
offset
+0x80 (value for twister for CONFIG_CMD_SPL_NAND_OFS)
+
+nand erase.part bootparms
+nand write 0x8100 bootparms 0x4000


If the offset is known at compile time, why should the end user use the
above commands to write it? Can't it be automated? Just an idea.


No, please read
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/102326
or
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/147205



Thanks. Clarified.

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


Re: [U-Boot] [PATCH v4 1/3] Add README for the Falcon mode

2012-11-23 Thread Vikram Narayanan

Hi Stefano,

Sorry for bumping in at v4. Below are some of my comments.

On 11/23/2012 9:01 PM, Stefano Babic wrote:

Simple howto to add support to a board
for booting the kernel from SPL (Falcon mode).

Signed-off-by: Stefano Babicsba...@denx.de
---
Changes in v4:
- fix capitalization, styling, in spl help (Andreas Biessmann)
- move CONFIG_SPL_OS_BOOT before function in doc (Andreas Biessmann)


snip

diff --git a/doc/README.falcon b/doc/README.falcon
new file mode 100644
index 000..1c041ea
--- /dev/null
+++ b/doc/README.falcon
@@ -0,0 +1,173 @@
+U-Boot Falcon Mode
+
+
+Introduction
+
+
+This document provides an overview how to add support for Falcon Mode


s/an overview/an overview of/


+to a board.
+Falcon Mode is introduced to speed up the booting process, allowing
+to boot a Linux kernel (or whatever image) without a full blown U-Boot.
+
+Falcon Mode relies on the SPL framework. In fact, to make booting faster,
+U-Boot is split into two parts: the SPL (Secondary Program Loader) and U-Boot
+image. In most implementations, SPL is used to start U-Boot when booting from
+a mass storage, such as NAND or SD-Card. SPL has now support for other media,
+and can be generalized seen as a way to start an image performing the minimum


Rephrase the above line as,
and can generally be seen 


+required initialization. SPL initializes mainly the RAM controller, and after
+that copies U-Boot image into the memory. The Falcon Mode extends this way


Rephrase ..

SPL mainly initializes the RAM controller, and then copies U-boot image 
to the main memory.



+allowing to start the Linux kernel directly from SPL. A new command is added
+to U-Boot to prepare the parameters that SPL must pass to the kernel, using
+ATAGS or Device Tree.
+
+Falcon Mode adds a command under U-Boot to reuse all code responsible to 
prepare


Already it is mentioned that 'a new command is added'. The above line is 
redundant then. Please rephrase it.



+the interface with the kernel. In usual U-Boot systems, these parameters are
+generated each time before loading the kernel, passing to Linux the address
+in memory where the parameters can be read.
+With Falcon Mode, this snapshot can be saved into persistent storage and SPL is
+informed to load it before running the kernel.
+
+To boot the kernel, these steps under a Falcon-aware U-Boot are required:
+
+1. Boot the board into U-Boot.
+Use the spl export command to generate the kernel parameters area or the DT.
+U-Boot runs as when it boots the kernel, but stops before passing the control
+to the kernel.
+
+2. Save the prepared snapshot into persistent media.
+The address where to save it must be configured into board configuration
+file (CONFIG_CMD_SPL_NAND_OFS for NAND).
+
+3. Boot the board into Falcon Mode. SPL will load the kernel and copy
+the parameters area to the required address.


copy the parameters which is saved in the persistent media to the 


+
+It is required to implement a custom mechanism to select if SPL loads U-Boot
+or another image.
+
+The value of a GPIO is a simple way to operate the selection, as well as
+reading a character from the SPL console if CONFIG_SPL_CONSOLE is set.
+
+Falcon Mode is generally activated by setting CONFIG_SPL_OS_BOOT. This tells
+SPL that U-Boot is not the only available image that SPL is able to start.
+
+Configuration
+
+CONFIG_CMD_SPL Enable the spl export command.
+   The command spl export is then available in U-Boot
+   mode
+CONFIG_SYS_SPL_ARGS_ADDR   Address in RAM where the parameters must be
+   copied by SPL.
+   In most cases, it isstart_of_ram  + 0x100


A space in between is and ''


+
+CONFIG_SYS_NAND_SPL_KERNEL_OFFSOffset in NAND where the kernel is 
stored
+
+CONFIG_CMD_SPL_NAND_OFSOffset in NAND where the parameters area was 
saved.


Can the above be renamed to include the word 'PARAMS'? But becomes 
lengthy. Any suggestions?



+
+CONFIG_CMD_SPL_WRITE_SIZE  Size of the parameters area to be copied
+
+CONFIG_SPL_OS_BOOT Activate Falcon Mode.
+   A board should implement the following functions:


Is there a big difference between the line above and the one below?


+Function that a board must implement
+
+
+void spl_board_prepare_for_linux(void) : optional
+   Called from SPL before starting the kernel
+
+spl_start_uboot() : required
+   Returns 0 if SPL starts the kernel, 1 if U-Boot
+   must be started.
+
+
+Using spl command
+-
+
+spl - SPL configuration
+
+Usage:
+
+spl exportimg=atags|fdt  [kernel_addr] [initrd_addr] [fdt_addr ]
+
+img: atags or fdt
+kernel_addr: kernel is loaded as part of the boot process, but it is not 
started.
+ This is the address where a kernel image is stored.

Re: [U-Boot] UBIFS fails on SheevaPlug

2012-11-12 Thread Vikram Narayanan

On 11/12/2012 10:25 PM, Dimax wrote:

I read the page but not sure how exactly to do it.
I'm not familiar with git. I have gust used source from ftp.


You don't need a git for it. Mail access should be fine.

Find the below mail in your inbox and reply to that,
http://www.mail-archive.com/u-boot@lists.denx.de/msg97893.html
with the tag

Tested-by: Dimax dimax.m...@gmail.com

snip

Can you please add your credits to the patch that fixes your problem?
Please read
http://www.denx.de/wiki/view/U-Boot/Patches#Review_Process_Git_Tags and
add a proper Tested-by tag to the
'[PATCH] mv-common.h: increase malloc arena to 4MiB' mail.


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


Re: [U-Boot] [PATCH] ubifs: Allow ubifsmount volume reference by number

2012-11-05 Thread Vikram Narayanan

On 11/2/2012 8:24 AM, Joe Hershberger wrote:

UBI can mount volumes by name or number  The current code forces you
to name the volume by prepending every name with ubi:.

 From fs/ubifs/super.c
  * There are several ways to specify UBI volumes when mounting UBIFS:
  * o ubiX_Y- UBI device number X, volume Y;
  * o ubiY  - UBI device number 0, volume Y;
  * o ubiX:NAME - mount UBI device X, volume with name NAME;
  * o ubi:NAME  - mount UBI device 0, volume with name NAME.

Now any name passed in any of the above forms are allowed.


What exactly are we gaining from this naming compared to the default?
In what way the old naming affects the end user?

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


Re: [U-Boot] [PATCH] ubifs: Allow ubifsmount volume reference by number

2012-11-05 Thread Vikram Narayanan

Hi Joe,

On 11/5/2012 10:19 PM, Joe Hershberger wrote:

Hi Vikram,

On Mon, Nov 5, 2012 at 10:43 AM, Vikram Narayananvikram...@gmail.com  wrote:


On 11/2/2012 8:24 AM, Joe Hershberger wrote:


UBI can mount volumes by name or number  The current code forces you
to name the volume by prepending every name with ubi:.

  From fs/ubifs/super.c
   * There are several ways to specify UBI volumes when mounting UBIFS:
   * o ubiX_Y- UBI device number X, volume Y;
   * o ubiY  - UBI device number 0, volume Y;
   * o ubiX:NAME - mount UBI device X, volume with name NAME;
   * o ubi:NAME  - mount UBI device 0, volume with name NAME.

Now any name passed in any of the above forms are allowed.



What exactly are we gaining from this naming compared to the default?
In what way the old naming affects the end user?


The reason I needed this change is so that I could specify the volume
by number in a script instead of being forced to know the name.  In
Linux you can use the volume number using the format above (it's the
same code).


If that is the case, then the one can create the partition using the 
below command,


 ubi createvol vol name

vol name can be any of the 4 methods listed above.

and the prefix ubi: will be appended in the environment which is 
expected by kernel for mounting. Right?


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


Re: [U-Boot] [PATCH] ubifs: Allow ubifsmount volume reference by number

2012-11-05 Thread Vikram Narayanan

On 11/5/2012 11:48 PM, Joe Hershberger wrote:

Hi Vikram,

On Mon, Nov 5, 2012 at 11:36 AM, Vikram Narayananvikram...@gmail.com  wrote:

Hi Joe,


On 11/5/2012 10:19 PM, Joe Hershberger wrote:


Hi Vikram,

On Mon, Nov 5, 2012 at 10:43 AM, Vikram Narayananvikram...@gmail.com
wrote:



On 11/2/2012 8:24 AM, Joe Hershberger wrote:



UBI can mount volumes by name or number  The current code forces you
to name the volume by prepending every name with ubi:.

   From fs/ubifs/super.c
* There are several ways to specify UBI volumes when mounting UBIFS:
* o ubiX_Y- UBI device number X, volume Y;
* o ubiY  - UBI device number 0, volume Y;
* o ubiX:NAME - mount UBI device X, volume with name NAME;
* o ubi:NAME  - mount UBI device 0, volume with name NAME.

Now any name passed in any of the above forms are allowed.




What exactly are we gaining from this naming compared to the default?
In what way the old naming affects the end user?



The reason I needed this change is so that I could specify the volume
by number in a script instead of being forced to know the name.  In
Linux you can use the volume number using the format above (it's the
same code).



If that is the case, then the one can create the partition using the below
command,


ubi createvolvol name


vol name  can be any of the 4 methods listed above.


I believe that is incorrect.vol name  is literally the name that
can be used in the form ubiX:vol name.  It doesn't make sense to
use the above forms when creating the volume.  The ubi index is
already set by calling ubi partmtd partition.  The volume index is
simply the next volume in that ubi.


say I've an mtdpartition by the name filesystem

ubi part filesystem
ubi createvol rootfs

If I invoke the above commands, I'll have a ubi volume with a name 
rootfs with the complete size of (filesystem - metadata).


When passing bootargs to the kernel I'd give the root as
root=ubi0:rootfs

Why should this be wrong?




and the prefix ubi: will be appended in the environment which is expected
by kernel for mounting. Right?


I assume you meant prepended.  Please expand on what you are saying


Yes. I meant prepended. sorry.


here.  What environment variable?  Prepended by what / who?  Yes, the


Prepended by the string ubi: as you've done in this patch for some 
configs.


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


Re: [U-Boot] [PATCH v2 1/2] arm: move C runtime setup code in crt0.S

2012-11-04 Thread Vikram Narayanan

Hello Albert,

On 11/4/2012 5:02 PM, Albert ARIBAUD wrote:

Move all the C runtime setup code from every start.S
in arch/arm into arch/arm/lib/crt0.S. This covers
the code sequence from isetting up the initial stack
to calling into board_init_r().

Also, rewrite the C runtime setup and make functions
board_init_*() and relocate_code() behave according to
normal C semantics (no jumping across the C stack any
more, etc).

Some SPL targets had to be touched because they use
start.S exolicitly or for some reason; the relevant
maintainers and custodians are cc:ed.

Signed-off-by: Albert ARIBAUDalbert.u.b...@aribaud.net
---
Changes in v2:
- moved description from cover letter to patch commit msg
- added note about tests in the cover letter
- fixed baords with CONFIG_SPL but not CONFIG_SPL_STACK


snip


diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
new file mode 100644
index 000..fd6bd92
--- /dev/null
+++ b/arch/arm/lib/crt0.S
@@ -0,0 +1,180 @@
+/*
+ *  crt0 - C-runtime startup Code for ARM U-Boot
+ *
+ *  Copyright (c) 2012  Albert ARIBAUDalbert.u.b...@aribaud.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
+ */
+
+#includeconfig.h
+#includeasm-offsets.h
+
+/*
+ * This file handles the target-independent stages of the U-Boot
+ * start-up where a C runtime environment is needed. Its entry point
+ * is _main and is branched into from the target's start.S file.
+ *
+ * _main execution sequence is:
+ *
+ * 1. Set up initial environment for calling board_init_f().
+ *This environment only provides a stack and a place to store
+ *the GD ('global data') structure. In this context, VARIABLE
+ *global data, initialized or not (BSS), are UNAVAILABLE; only
+ *CONSTANT initialized data are available.
+ *
+ * 2. Call board_init_f(). This function prepares the hardware for
+ *execution from DDR. As DDR may not be available, board_init_f()
+ *must use GD to store any data which must be passed on to later,
+ *stages, including the reloction destination and the new stack
+ *pointer address, below which the stack resides and above it the
+ *new GD resides.
+ *
+ * 3. Set up intermediate environment where the stack and GD are the
+ *ones allocated by board_init_f() in DDR, but BSS and initialized
+ *non-const data are still not available.
+ *
+ * 4. Call relocate_code(). This function relocates U-Boot from its
+ *current location into the relocation destination computed by
+ *board_init_f().
+ *
+ * 5. Set up final environment for calling board_init_r(). This
+ *environment has BSS (initialized to 0), initialized non-const
+ *data (initialized to their intended value), and stack in DDR.
+ *GD has but retained values set by board_init_f(). Some CPUs
+ *have some work to do at this point, so call c_runtime_cpu_setup.
+ *
+ * 6. Call noard_init_r(). If the function returns, reset the board.
+ */


s/noard_init_r/board_init_r


+
+/*
+ * offset of the nand_boot() function for SPL crt
+ */
+
+#if defined(CONFIG_NAND_SPL)
+
+.globl nand_boot
+_nand_boot:
+   .word nand_boot
+
+#elif ! defined(CONFIG_SPL_BUILD)
+
+/*
+ * offset of the board_init_r() function for non-SPL crt
+ */
+
+.globl board_init_r
+_board_init_r:
+   .word board_init_r
+
+#endif
+
+/*
+ * start and end of BSS
+ */
+
+.globl __bss_start
+.globl __bss_end__
+
+/*
+ * entry point of crt0 sequence
+ */
+
+.global _main
+
+_main:
+
+/*
+ * Set up initial C runtime environment and call board_init_f(0).
+ */
+
+#if defined(CONFIG_NAND_SPL)
+   /* deprecated, use instead CONFIG_SPL_BUILD */
+   ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#elif defined(CONFIG_SPL_BUILD)  defined(CONFIG_SPL_STACK)
+   ldr sp, =(CONFIG_SPL_STACK)
+#else
+   ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
+#endif
+   bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
+   mov r8, sp  /* GD is above SP */
+   mov r0, #0
+   bl  board_init_f
+
+/*
+ * Set up intermediate environment (new sp and gd) and call
+ * relocate_code(addr_sp, gd, addr_moni). Trick here is that
+ * we'll return 'here' but relocated.
+ */
+
+   ldr sp, [r8, #GD_START_ADDR_SP] /* r8 = gd-start_addr_sp */
+   ldr

Re: [U-Boot] UBIFS fails on SheevaPlug

2012-10-31 Thread Vikram Narayanan

Hello Andreas,

On 10/30/2012 4:32 AM, Andreas Bießmann wrote:

Dear Vikram Narayanan,

first of all you are right. u-boot ubifs implementation will never
recover the ubifs on media, cause it is mounted read only.



snip


calls sget() (line 1043)
which in turn calls kzalloc() (line 67)
which may return -ENOMEM


I agree. But in Dimax's case this isn't. Right?


But u-boot will manage to get the data out of the unordered ubifs (if no
error like this ENOMEM occur). That is the same process as in kernel if
it is mounted read-only (recovery deferred).


I can't comment on this, unless I know the specifics.


So if the kernel can manage to mount the unordered ubifs u-boot should
do so. If it can't (but the kernel can) there is an error that should be
fixed.



But in the kernel, the read-only isn't hardcoded. So, the kernel code 
can try to recover and even update the corrupted data back to the media 
and mount it. (It's my guess. The kernel may/mayn't do this way).


But if the same fails to happen in u-boot code, I'd say the feature is 
missing and it needs to be pulled in from the kernel code.


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


Re: [U-Boot] [PATCH] mv-common.h: increase malloc arena to 4MiB

2012-10-31 Thread Vikram Narayanan

Hello Andreas,

On 10/30/2012 5:28 AM, Andreas Bießmann wrote:

This will fix the following error:

---8---
UBIFS error (pid 0): ubifs_mount: Error reading superblock on volume 'ubi:root' 
errno=-12!
---8---


Did this solve the ubifs mount issue?
Did someone test it?

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


Re: [U-Boot] UBIFS fails on SheevaPlug

2012-10-29 Thread Vikram Narayanan

Hello Dimax,

On 10/29/2012 2:57 PM, Dimax wrote:

I also want to look back at my original problem of non-recovered UBIFS.
Want to make sure my effort will not be useless.
Let's say I've increased the memory allocation size. But are you sure
u-boot implementation of ubifs really can recover partitions just like
original Linux driver does? Is it implemented at all?


AFAIK, u-boot can't recover your partition. u-boot just mounts it read-only.

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


Re: [U-Boot] UBIFS fails on SheevaPlug

2012-10-29 Thread Vikram Narayanan
On 10/29/2012 10:55 PM, Dimax wrote:
 I remember I have unbricked sheevaplug with USB key.
 But I'm still not sure if effort is not useless as I see no conclusion
 about u-boot ability to recover UBIFS partition (at least to try).
 Can anybody tell it for sure?

This is what I've got from the code [1].

Code flow
-
common/cmd_ubifs.c:
do_ubifs_mount calls ubifs_mount 

fs/ubifs/super.c,
In ubifs_mount()  (line 1167)
flags = MS_RDONLY;  (line 1188)
calls ubifs_get_sb (with flags as a param)
ubifs_get_sb (line 1018)
The flags get updated here.
sb-s_flags = flags; (line 1057)

Calls ubifs_fill_super
sb gets assigned, so are the flags.
c-vfs_sb = sb; (line 962)

Calls mount_ubifs
mount_ubifs(c); (line 983)

In mount_ubifs() (line 582)

struct super_block *sb = c-vfs_sb;
int err, mounted_read_only = (sb-s_flags  MS_RDONLY);

sb taken from the assigned ptr @ line 962.
Flags extracted from the assigned flags @ 1188.
Just see where the variable 'mounter_read_only' gets referred and you'll get 
the answer.
U-boot will _not_ recover your UBIFS partition like the Linux kernel. CMIIW.

[1] 
http://git.denx.de/?p=u-boot.git;a=tree;h=5bb3505fa867ded03cbee83f7722ab5182930637;hb=5bb3505fa867ded03cbee83f7722ab5182930637

Hope this helps,
Vikram
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-29 Thread Vikram Narayanan

On 10/29/2012 10:04 PM, Scott Wood wrote:


It's not worth arguing over a single line of code that isn't going to
cause any significant change. That would save us both some time.


So you're withdrawing the patch?


Yes.


I'm more concerned about the precedent it sets than the one specific line.


Agree with your concern.

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


Re: [U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-28 Thread Vikram Narayanan

On 10/24/2012 10:41 PM, Scott Wood wrote:

On 10/23/2012 11:14:34 PM, Vikram Narayanan wrote:

On 10/24/2012 7:22 AM, Scott Wood wrote:

On 10/23/2012 12:15:11 PM, Vikram Narayanan wrote:

On 10/23/2012 9:15 PM, Tom Rini wrote:

On Tue, Oct 23, 2012 at 12:26:53PM +0200, Stefan Roese wrote:

On 10/23/2012 12:05 PM, Vikram Narayanan wrote:

As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Stefan Roeses...@denx.de
---
common/spl/spl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
}
#endif

-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__maybe_unused gd_t *dummy1, __maybe_unused
ulong dummy2)
{
u32 boot_device;
debug(spl:board_init_r()\n);



Perhaps even __always_unused instead of __maybe_unused as these
variables are never used?


Also, what does this give us? Fixing a sparse warning?


Not a sparse warning. I noticed this while looking at the code.


If there's no warning, why do we need to ugly up the code with
__maybe_unused?


I'd rather call this a proper way of coding, than calling it ugly. But
perceptions differ.


If you want to push for a change to the official coding style, and
changing the warning options to go with it, go ahead (I'll argue against
it of course), but until and unless you succeed at that, this isn't the
way U-Boot code is written. I don't see a single instance of
__maybe_unused in an argument list, or a single instance of
__always_unused anywhere in U-Boot other than its definition.
Unnecessary clutter is harmful to readability.


It's not worth arguing over a single line of code that isn't going to 
cause any significant change. That would save us both some time.


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


Re: [U-Boot] [PATCH 1/2] mmc: add bcm2835 driver

2012-10-28 Thread Vikram Narayanan

On 10/28/2012 8:58 AM, Stephen Warren wrote:

On 10/26/2012 05:33 AM, Vikram Narayanan wrote:

Some nitpicks.

On 10/24/2012 10:20 AM, Stephen Warren wrote:

snip

+static u8 bcm2835_sdhci_readb(struct sdhci_host *host, int reg)
+{
+u32 val = bcm2835_sdhci_raw_readl(host, (reg   ~3));
+val = val   (reg   3   0x18)   0xff;
+
+return (u8)val;
+}


Can the above used magics be made as macros?


This code was taken directly from the downstream Linux kernel, so I
changed it as little as possible, to make comparisons easier. Still, if
people want I can certainly make it easier to understand the expression
a bit.


Seems reasonable.


I don't think the issue is the magic numbers so much as understanding
what the expression does; the magic are obvious then. It's simply
extracting byte n from from a u32. Would the following be more obvious:

byte_num = reg  3;
byte_shift = bytenum * 8;
byte = (val  byte_shift)  0xff;

... and similar for the other functions?


This looks better to me than the former. Thanks.

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


Re: [U-Boot] [PATCH 1/2] mmc: add bcm2835 driver

2012-10-26 Thread Vikram Narayanan

Some nitpicks.

On 10/24/2012 10:20 AM, Stephen Warren wrote:

This adds a simple driver for the BCM2835's SD controller.

Workarounds are implemented for:
* Register writes can't be too close to each-other in time, or they will
   be lost.
* Register accesses must all be 32-bit, so implement custom accessors.

This code was extracted from:
git://github.com/gonzoua/u-boot-pi.git master
which was created by Oleksandr Tymoshenko.

Portions of the code there were obviously based on the Linux kernel at:
git://github.com/raspberrypi/linux.git rpi-3.2.27

No s-o-b tags were present in either location.

swarren changed the following for upstream:
* Removed hack udelay()s in bcm2835_sdhci_raw_writel(); setting
   SDHCI_QUIRK_WAIT_SEND_CMD appears to solve the issues.
* Remove register logging from read*/write* functions.
* Sort out confusion with min/max_freq values passed to add_sdhci().
* Simplified and commented twoticks_delay calculation.
* checkpatch fixes.

Cc: Oleksandr Tymoshenkogo...@bluezbox.com
Signed-off-by: Stephen Warrenswar...@wwwdotorg.org
---
This series is based on the previous bcm2835 patches I sent, to add the
mbox and video drivers. Patch 1 should be independant, but patch 2 depends
on those other patches.

  arch/arm/include/asm/arch-bcm2835/sdhci.h |   24 
  drivers/mmc/Makefile  |1 +
  drivers/mmc/bcm2835_sdhci.c   |  172 +
  3 files changed, 197 insertions(+)
  create mode 100644 arch/arm/include/asm/arch-bcm2835/sdhci.h
  create mode 100644 drivers/mmc/bcm2835_sdhci.c

diff --git a/arch/arm/include/asm/arch-bcm2835/sdhci.h 
b/arch/arm/include/asm/arch-bcm2835/sdhci.h
new file mode 100644
index 000..a4f867b
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/sdhci.h
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * 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
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#ifndef _BCM2835_SDHCI_H_
+#define _BCM2835_SDHCI_H_
+
+#define BCM2835_SDHCI_BASE 0x2030
+
+int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq);
+
+#endif
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index a1dd730..6be36f2 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -43,6 +43,7 @@ COBJS-$(CONFIG_MXS_MMC) += mxsmmc.o
  COBJS-$(CONFIG_OMAP_HSMMC) += omap_hsmmc.o
  COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o
  COBJS-$(CONFIG_SDHCI) += sdhci.o
+COBJS-$(CONFIG_BCM2835_SDHCI) += bcm2835_sdhci.o
  COBJS-$(CONFIG_S5P_SDHCI) += s5p_sdhci.o
  COBJS-$(CONFIG_SH_MMCIF) += sh_mmcif.o
  COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
new file mode 100644
index 000..1d623c0
--- /dev/null
+++ b/drivers/mmc/bcm2835_sdhci.c
@@ -0,0 +1,172 @@
+/*
+ * This code was extracted from:
+ * git://github.com/gonzoua/u-boot-pi.git master
+ * and hence presumably (C) 2012 Oleksandr Tymoshenko
+ *
+ * Tweaks for U-Boot upstreaming
+ * (C) 2012 Stephen Warren
+ *
+ * Portions (e.g. read/write macros, concepts for back-to-back register write
+ * timing workarounds) obviously extracted from the Linux kernel at:
+ * https://github.com/raspberrypi/linux.git rpi-3.2.27
+ *
+ * The Linux kernel code has the following (c) and license, which is hence
+ * propagated to Oleksandr's tree and here:
+ *
+ * Support for SDHCI device on 2835
+ * Based on sdhci-bcm2708.c (c) 2010 Broadcom
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/* Supports:
+ * SDHCI platform device - Arasan SD controller in BCM2708
+ *
+ * Inspired by sdhci-pci.c, by Pierre Ossman
+ */
+
+#includecommon.h
+#includemalloc.h
+#includesdhci.h
+
+/* 400KHz is max freq for card ID etc. Use that as min */
+#define MIN_FREQ 40
+
+static uint twoticks_delay;
+
+static inline void bcm2835_sdhci_raw_writel(struct sdhci_host *host, u32 val,
+   int reg)
+{
+   static ulong last_write;
+
+   

[U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-23 Thread Vikram Narayanan
As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stefan Roese s...@denx.de
---
 common/spl/spl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
 }
 #endif
 
-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__maybe_unused gd_t *dummy1, __maybe_unused ulong dummy2)
 {
u32 boot_device;
debug(spl:board_init_r()\n);
-- 
1.7.4.1


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


[U-Boot] [PATCH 0/2] socfpga/spl: Cleanup

2012-10-23 Thread Vikram Narayanan
Cleanups for SPL/socfpga.

Cc: Dinh Nguyen dingu...@altera.com

Vikram Narayanan (2):
  arm/socfpga: Remove timer_init from spl_board_init
  socfpga/spl: Remove malloc.h

 arch/arm/cpu/armv7/socfpga/spl.c   |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/2] socfpga/spl: Remove timer_init from spl_board_init

2012-10-23 Thread Vikram Narayanan
Timer is initialized already in board_init_r function in
(common/spl/spl.c) No need to initialize it again

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Dinh Nguyen dingu...@altera.com
---
 arch/arm/cpu/armv7/socfpga/spl.c |3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index 944238b..23053fd 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -37,9 +37,6 @@ u32 spl_boot_device(void)
  */
 void spl_board_init(void)
 {
-   /* init timer for enabling delay function */
-   timer_init();
-
/* de-assert reset for peripherals and bridges based on handoff */
reset_deassert_peripherals_handoff();
 
-- 
1.7.4.1


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


[U-Boot] [PATCH 2/2] socfpga/spl: Remove malloc.h

2012-10-23 Thread Vikram Narayanan
Remove unused header

Signed-off-by: Vikram Narayanan vikram...@gmail.com
---
 arch/arm/cpu/armv7/socfpga/spl.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index 23053fd..84216eb 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -21,7 +21,6 @@
 #include asm/utils.h
 #include version.h
 #include image.h
-#include malloc.h
 #include asm/arch/reset_manager.h
 #include spl.h
 
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-23 Thread Vikram Narayanan

On 10/23/2012 3:56 PM, Stefan Roese wrote:

On 10/23/2012 12:05 PM, Vikram Narayanan wrote:

As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Stefan Roeses...@denx.de
---
  common/spl/spl.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
  }
  #endif

-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__maybe_unused gd_t *dummy1, __maybe_unused ulong dummy2)
  {
u32 boot_device;
debug(spl:board_init_r()\n);



Perhaps even __always_unused instead of __maybe_unused as these
variables are never used?


Yes. It is better, in the case if it is never used at all.

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


[U-Boot] [PATCH v2] common/spl: Mark arguments as unused

2012-10-23 Thread Vikram Narayanan
As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stefan Roese s...@denx.de
---
Changes for v2:
use __always_unused instead of __maybe_unused

 common/spl/spl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
 }
 #endif
 
-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__always_unused gd_t *dummy1, __always_unused ulong dummy2)
 {
u32 boot_device;
debug(spl:board_init_r()\n);
-- 
1.7.4.1

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


[U-Boot] [PATCH] nand_spl: Define nand_select function

2012-10-23 Thread Vikram Narayanan
Split up the selection of nand_chip from nand_init to a separate
function. This is just to make it a little consistent as we've
nand_deselect function.

Also use it in spl_nand_load_image function.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stefan Roese s...@denx.de
---
 common/spl/spl_nand.c  |1 +
 drivers/mtd/nand/nand_spl_simple.c |6 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 61de5a4..5ebeb38 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -34,6 +34,7 @@ void spl_nand_load_image(void)
 
debug(spl: nand - using hw ecc\n);
nand_init();
+   nand_select();
 
/*use CONFIG_SYS_TEXT_BASE as temporary storage area */
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
diff --git a/drivers/mtd/nand/nand_spl_simple.c 
b/drivers/mtd/nand/nand_spl_simple.c
index 4a4d02f..77c56fc 100644
--- a/drivers/mtd/nand/nand_spl_simple.c
+++ b/drivers/mtd/nand/nand_spl_simple.c
@@ -270,12 +270,16 @@ void nand_init(void)
nand_chip.ecc.correct = nand_correct_data;
}
 #endif
+}
 
+/* Select before operation */
+void nand_select(void)
+{
if (nand_chip.select_chip)
nand_chip.select_chip(mtd, 0);
 }
 
-/* Unselect after operation */
+/* Deselect after operation */
 void nand_deselect(void)
 {
if (nand_chip.select_chip)
-- 
1.7.4.1

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


Re: [U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-23 Thread Vikram Narayanan

On 10/23/2012 9:15 PM, Tom Rini wrote:

On Tue, Oct 23, 2012 at 12:26:53PM +0200, Stefan Roese wrote:

On 10/23/2012 12:05 PM, Vikram Narayanan wrote:

As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Stefan Roeses...@denx.de
---
  common/spl/spl.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
  }
  #endif

-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__maybe_unused gd_t *dummy1, __maybe_unused ulong dummy2)
  {
u32 boot_device;
debug(spl:board_init_r()\n);



Perhaps even __always_unused instead of __maybe_unused as these
variables are never used?


Also, what does this give us?  Fixing a sparse warning?


Not a sparse warning. I noticed this while looking at the code.

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


Re: [U-Boot] [PATCH] nand_spl: Define nand_select function

2012-10-23 Thread Vikram Narayanan

On 10/23/2012 9:17 PM, Tom Rini wrote:

On Tue, Oct 23, 2012 at 04:51:05PM +0530, Vikram Narayanan wrote:


Split up the selection of nand_chip from nand_init to a separate
function. This is just to make it a little consistent as we've
nand_deselect function.

Also use it in spl_nand_load_image function.

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Stefan Roeses...@denx.de


What does this allow for us to do next?  We've added a few bytes to SPL
and we're already close to being too large sometimes.



Yep. 12 bytes added. If SPL is too much loaded to include this, the 
patch shall be dropped.


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


Re: [U-Boot] [PATCH] common/spl: Mark arguments as unused

2012-10-23 Thread Vikram Narayanan

On 10/24/2012 7:22 AM, Scott Wood wrote:

On 10/23/2012 12:15:11 PM, Vikram Narayanan wrote:

On 10/23/2012 9:15 PM, Tom Rini wrote:

On Tue, Oct 23, 2012 at 12:26:53PM +0200, Stefan Roese wrote:

On 10/23/2012 12:05 PM, Vikram Narayanan wrote:

As dummy{1,2} are not used anywhere, mark it with __maybe_unused

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Stefan Roeses...@denx.de
---
common/spl/spl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 0d829c0..62fd3bd 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -145,7 +145,7 @@ static void spl_ram_load_image(void)
}
#endif

-void board_init_r(gd_t *dummy1, ulong dummy2)
+void board_init_r(__maybe_unused gd_t *dummy1, __maybe_unused
ulong dummy2)
{
u32 boot_device;
debug(spl:board_init_r()\n);



Perhaps even __always_unused instead of __maybe_unused as these
variables are never used?


Also, what does this give us? Fixing a sparse warning?


Not a sparse warning. I noticed this while looking at the code.


If there's no warning, why do we need to ugly up the code with
__maybe_unused?


I'd rather call this a proper way of coding, than calling it ugly. But 
perceptions differ.



Unused arguments are quite common, as a result of implementing a common
interface where this implementation doesn't need all the information
that the interface provides. It should not cause a warning and should
not require annotation.


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


Re: [U-Boot] [PATCH v2 2/2] add Eukrea's CPUIMX25

2012-09-23 Thread Vikram Narayanan

On 9/23/2012 5:33 PM, Eric Bénard wrote:

this board is based on an i.MX25 from Freescale.
It consists of a SOM containing :
- NAND flash (internal or external boot supported and tested)
- mDDR (64MB tested)
- ethernet PHY connected in RMII mode (tested)
and a baseboard containing :
- a serial transceiver on UART1 (tested)
- a SDCard connector on eSDHC1 (tested but disabled until Benoît's fix
   gets applied)

bootlog :
U-Boot 2012.10-rc1-3-gdd12be5 (Sep 23 2012 - 13:53:21)

CPU:   Freescale i.MX25 rev1.2 at 399 MHz
Reset cause: POR

DRAM:  64 MiB
NAND:  256 MiB
MMC:
In:serial
Out:   serial
Err:   serial
Net:   FEC
Hit any key to stop autoboot:  0

Signed-off-by: Eric Bénarde...@eukrea.com
---
v2: rebased against 2012.10-rc1, disabled eSDHC until proper fix
 from Benoît gets applied, updated bootlog.

  MAINTAINERS   |2 +
  board/eukrea/cpuimx25/Makefile|   44 +++
  board/eukrea/cpuimx25/config.mk   |5 +
  board/eukrea/cpuimx25/cpuimx25.c  |  123 ++
  board/eukrea/cpuimx25/imximage.cfg|   55 
  board/eukrea/cpuimx25/lowlevel_init.S |  113 
  boards.cfg|2 +
  include/configs/cpuimx25.h|  198 +
  nand_spl/board/eukrea/cpuimx25/Makefile   |   79 
  nand_spl/board/eukrea/cpuimx25/config.mk  |1 +
  nand_spl/board/eukrea/cpuimx25/u-boot.lds |   83 
  11 files changed, 705 insertions(+), 0 deletions(-)
  create mode 100644 board/eukrea/cpuimx25/Makefile
  create mode 100644 board/eukrea/cpuimx25/config.mk
  create mode 100644 board/eukrea/cpuimx25/cpuimx25.c
  create mode 100644 board/eukrea/cpuimx25/imximage.cfg
  create mode 100644 board/eukrea/cpuimx25/lowlevel_init.S
  create mode 100644 include/configs/cpuimx25.h
  create mode 100644 nand_spl/board/eukrea/cpuimx25/Makefile
  create mode 100644 nand_spl/board/eukrea/cpuimx25/config.mk
  create mode 100644 nand_spl/board/eukrea/cpuimx25/u-boot.lds

diff --git a/MAINTAINERS b/MAINTAINERS
index aa54fe1..94e759f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -606,6 +606,8 @@ Eric Benarde...@eukrea.com
cpuat91 ARM920T
cpu9260 ARM926EJS (AT91SAM9260 SoC)
cpu9G20 ARM926EJS (AT91SAM9G20 SoC)
+   cpuimx25i.MX25
+   cpuimx25nandi.MX25

  Ajay Bhargavajay.bhar...@einfochips.com

diff --git a/board/eukrea/cpuimx25/Makefile b/board/eukrea/cpuimx25/Makefile
new file mode 100644
index 000..46131fd
--- /dev/null
+++ b/board/eukrea/cpuimx25/Makefile
@@ -0,0 +1,44 @@
+#
+# (C) Copyright 2009 DENX Software Engineering
+# Author: John Rigbyjcri...@gmail.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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := cpuimx25.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/eukrea/cpuimx25/config.mk b/board/eukrea/cpuimx25/config.mk
new file mode 100644
index 000..18b2883
--- /dev/null
+++ b/board/eukrea/cpuimx25/config.mk
@@ -0,0 +1,5 @@
+ifdef CONFIG_NAND_SPL
+CONFIG_SYS_TEXT_BASE = 0x810c
+else
+CONFIG_SYS_TEXT_BASE = 0x8120
+endif
diff --git a/board/eukrea/cpuimx25/cpuimx25.c b/board/eukrea/cpuimx25/cpuimx25.c
new file mode 100644
index 000..72fa8a5
--- /dev/null
+++ b/board/eukrea/cpuimx25/cpuimx25.c
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2009 DENX Software Engineering
+ * (C) Copyright 2012 Eukrea Electromatiquewww.eukrea.com
+ * Eric Benarde...@eukrea.com
+ *
+ * Based on tx25.c:
+ *   Author: John Rigbyjri...@gmail.com
+ *
+ * Based on imx27lite.c:
+ *   Copyright (C) 2008,2009 Eric Jarrigejora...@users.sourceforge.net
+ *   Copyright (C) 2009 Ilya Yanokya...@emcraft.com
+ * And:
+ *   RedBoot tx25_misc.c Copyright (C) 2009 

Re: [U-Boot] [PATCH V2 08/21] mx6: add plugin file for use with imximage.cfg

2012-09-21 Thread Vikram Narayanan

On 9/22/2012 8:09 AM, Troy Kisky wrote:

The plugin command of mkimage can take this
file as an argument.


An explanation of what is plugin and what the file plugin.S does 
should be better. Not in the subject of the patch, you can place it as a 
README.




Signed-off-by: Troy Kiskytroy.ki...@boundarydevices.com
---
  arch/arm/cpu/armv7/mx6/Makefile  |5 +-
  arch/arm/cpu/armv7/mx6/plugin.S  |  164 ++
  arch/arm/include/asm/arch-mx6/imx-regs.h |1 +
  3 files changed, 169 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/cpu/armv7/mx6/plugin.S

diff --git a/arch/arm/cpu/armv7/mx6/Makefile b/arch/arm/cpu/armv7/mx6/Makefile
index cbce411..b1fce4e 100644
--- a/arch/arm/cpu/armv7/mx6/Makefile
+++ b/arch/arm/cpu/armv7/mx6/Makefile
@@ -33,11 +33,14 @@ SOBJS   = lowlevel_init.o
  SRCS  := $(SOBJS:.o=.S) $(COBJS:.o=.c)
  OBJS  := $(addprefix $(obj),$(SOBJS) $(COBJS))

-all:   $(obj).depend $(LIB)
+all:   $(obj).depend $(LIB) plugin.bin

  $(LIB):   $(OBJS)
$(call cmd_link_o_target, $(OBJS))

+plugin.bin: plugin.o
+   $(OBJCOPY) -O binary --gap-fill 0xff $  $@
+
  #

  # defines $(obj).depend target
diff --git a/arch/arm/cpu/armv7/mx6/plugin.S b/arch/arm/cpu/armv7/mx6/plugin.S
new file mode 100644
index 000..99c6b20
--- /dev/null
+++ b/arch/arm/cpu/armv7/mx6/plugin.S
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2012 Boundary Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+#includeconfig.h
+#includeasm/arch/imx-regs.h
+
+#define HAB_RVT_ENTRY  0x98
+#define HAB_RVT_FAIL_SAFE_VECT 0xbc
+#define HAB_RVT_LOAD_DATA  0xc8
+
+#define HDR_SELF_PTR   0x14
+#define HDR_BOOT_DATA  0x20
+#define HDR_IMAGE_LEN  0x24
+
+#define L2X0_CTRL  0x100
+#define SCU_CONFIG 0x004
+
+/*
+ * Disable L2 cache because ROM will turn it on when a plugin is used.
+ * There are cache coherence problems if cache is on when Linux kernel
+ * expects it to be off.
+ */
+.macro disable_l2_cache
+   ldr r1, =L2_BASE_ADDR
+   mov r0, #0x0
+   str r0, [r1, #L2X0_CTRL]
+.endm
+
+
+/*
+ * plugin_start(void **start, size_t *bytes, UINT32 *ivt_offset)
+ */
+plugin_start:
+/* Save the return address and the function arguments */
+   push{r0-r8, lr}
+
+/* r0-r2 must be= 0x100 and must be 4 byte aligned */
+   cmp r0, #0x100
+   cmphs   r1, #0x100
+   cmphs   r2, #0x100
+
+/* rCPU: 22 - mx6q, 12 - mx6dl, 12|0x100 - solo, 2 - sololite */
+#define rCPU   r2
+#define rIomux r3
+#define rVal0  r4  /* mx6q value */
+#define rVal1  r5  /* mx6dl value */
+#define rVal2  r6  /* mx6solo value */
+#define rVal3  r7  /* mx6sololite value */
+#define rFlag  lr
+#define rTable r8
+
+   orr rFlag, r0, r1
+   orr rFlag, rFlag, r2
+   orrlo   rFlag, rFlag, #1
+
+   mov rCPU, #22   /* mx6q */
+   mov r1, #SCU_BASE_ADDR
+   ldr r0, [r1, #SCU_CONFIG]
+   and r0, r0, #3
+   cmp r0, #3  /* is mx6q? */
+   movne   rCPU, #12   /* mx6dl */
+   cmpne   r0, #1  /* is mx6dl? */
+   movne   rCPU, #2/* mx6 sololite */
+
+   ldrne   r1, =ANATOP_BASE_ADDR
+   ldrne   r0, [r1, #0x280]
+   movne   r0, r0, LSR #16
+   cmpne   r0, #0x60   /* is mx6 Sololite? */
+   movne   rCPU, #12 | 0x100   /* Solo */
+
+   mov rVal0, #0
+   mov rVal1, #0
+   mov rVal2, #0
+   mov rVal3, #0
+   ldr rIomux, =IOMUXC_BASE_ADDR
+   adr rTable, mx6_table
+   b   3f
+
+1: movsr0, r1, LSR #30
+   beq 2f
+   mov r1, r1, LSL rCPU
+   movsr1, r1, LSR #32-10
+   addne   r1, rIomux, r1, LSL #2
+   cmp r0, #3
+   subne   r0, r0, #1
+   orr r1, r1, r0
+
+2: andsr0, r1, #3
+   bic r1, r1, #3
+   ldrne   rVal0, [rTable], #4
+   movne   rVal1, rVal0
+   movne   rVal2, rVal0
+   movne   rVal3, rVal0
+   subnes  r0, r0, #1
+   ldrne   rVal1, [rTable], #4
+   movne   rVal2, rVal1
+   movne   rVal3, rVal1
+   subnes  r0, r0, #1
+   ldrne   rVal2, [rTable], #4
+   ldrne   rVal3, [rTable], #4
+
+   mov r0, rVal0
+   cmp rCPU, #22
+   movne   r0, rVal1
+   cmpne   rCPU, #12
+   movne   r0, rVal2
+   cmpne   rCPU, #12|0x100
+   movne   r0, rVal3
+   cmp r1, #0
+   strne   r0, [r1]
+3: ldr r1, [rTable], #4
+   cmp r1, #0
+   bne 1b
+
+   tst rFlag, #3
+   bne 4f  /* Branch if not called as plugin */
+/* Align end of table to 64 byte boundary */
+   sub rTable, rTable, #1
+   orr rTable, rTable, #0x3f
+   add rTable, rTable, #1
+   ldr r2, [rTable, #HDR_SELF_PTR]
+   ldr r0, [rTable, #HDR_BOOT_DATA]
+   ldr 

Re: [U-Boot] [PATCH V2 18/21] arch-mx6: add mx6dl_pins.h

2012-09-21 Thread Vikram Narayanan

On 9/22/2012 8:09 AM, Troy Kisky wrote:

Only the values used in the sabrelite board are
added currently. Add more as other boards use them.


Though there are no users, better add it for completeness. This should 
also avoid people patching this file often.




Signed-off-by: Troy Kiskytroy.ki...@boundarydevices.com
---
  arch/arm/include/asm/arch-mx6/mx6dl_pins.h |  118 
  1 file changed, 118 insertions(+)
  create mode 100644 arch/arm/include/asm/arch-mx6/mx6dl_pins.h

diff --git a/arch/arm/include/asm/arch-mx6/mx6dl_pins.h 
b/arch/arm/include/asm/arch-mx6/mx6dl_pins.h
new file mode 100644
index 000..5848013
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx6/mx6dl_pins.h
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc. All Rights Reserved.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#ifndef __ASM_ARCH_MX6_MX6DL_PINS_H__
+#define __ASM_ARCH_MX6_MX6DL_PINS_H__
+
+#includeasm/imx-common/iomux-v3.h
+
+/* Use to set PAD control */
+#define PAD_CTL_HYS(1  16)
+#define PAD_CTL_PUS_100K_DOWN  (0  14)
+#define PAD_CTL_PUS_47K_UP (1  14)
+#define PAD_CTL_PUS_100K_UP(2  14)
+#define PAD_CTL_PUS_22K_UP (3  14)
+
+#define PAD_CTL_PUE(1  13)
+#define PAD_CTL_PKE(1  12)
+#define PAD_CTL_ODE(1  11)
+#define PAD_CTL_SPEED_LOW  (1  6)
+#define PAD_CTL_SPEED_MED  (2  6)
+#define PAD_CTL_SPEED_HIGH (3  6)
+#define PAD_CTL_DSE_DISABLE(0  3)
+#define PAD_CTL_DSE_240ohm (1  3)
+#define PAD_CTL_DSE_120ohm (2  3)
+#define PAD_CTL_DSE_80ohm  (3  3)
+#define PAD_CTL_DSE_60ohm  (4  3)
+#define PAD_CTL_DSE_48ohm  (5  3)
+#define PAD_CTL_DSE_40ohm  (6  3)
+#define PAD_CTL_DSE_34ohm  (7  3)
+#define PAD_CTL_SRE_FAST   (1  0)
+#define PAD_CTL_SRE_SLOW   (0  0)
+
+#define IOMUX_CONFIG_SION 0x10
+#define NO_MUX_I0
+#define NO_PAD_I0
+enum {
+   MX6DL_PAD_EIM_D16__ECSPI1_SCLK  = IOMUX_PAD(0x0514, 0x0144, 1, 
0x07D8, 2, 0),
+   MX6DL_PAD_EIM_D17__ECSPI1_MISO  = IOMUX_PAD(0x0518, 0x0148, 1, 
0x07DC, 2, 0),
+   MX6DL_PAD_EIM_D18__ECSPI1_MOSI  = IOMUX_PAD(0x051C, 0x014C, 1, 
0x07E0, 2, 0),
+   MX6DL_PAD_EIM_D19__GPIO_3_19= IOMUX_PAD(0x0520, 0x0150, 5, 
0x, 0, 0),
+   MX6DL_PAD_EIM_D21__GPIO_3_21= IOMUX_PAD(0x0528, 0x0158, 5, 
0x, 0, 0),
+   MX6DL_PAD_EIM_D21__I2C1_SCL = IOMUX_PAD(0x0528, 0x0158, 6 | 
IOMUX_CONFIG_SION, 0x0868, 1, 0),
+   MX6DL_PAD_EIM_D23__GPIO_3_23= IOMUX_PAD(0x0530, 0x0160, 5, 
0x, 0, 0),
+   MX6DL_PAD_EIM_D26__UART2_TXD= IOMUX_PAD(0x053C, 0x016C, 4, 
0x, 0, 0),
+   MX6DL_PAD_EIM_D27__UART2_RXD= IOMUX_PAD(0x0540, 0x0170, 4, 
0x0904, 1, 0),
+   MX6DL_PAD_EIM_D28__I2C1_SDA = IOMUX_PAD(0x0544, 0x0174, 1 | 
IOMUX_CONFIG_SION, 0x086C, 1, 0),
+   MX6DL_PAD_EIM_D28__GPIO_3_28= IOMUX_PAD(0x0544, 0x0174, 5, 
0x, 0, 0),
+   MX6DL_PAD_ENET_MDC__ENET_MDC= IOMUX_PAD(0x05B8, 0x01E8, 1, 
0x, 0,  0),
+   MX6DL_PAD_ENET_MDIO__ENET_MDIO  = IOMUX_PAD(0x05BC, 0x01EC, 1, 
0x0810, 0, 0),
+   MX6DL_PAD_ENET_REF_CLK__ENET_TX_CLK = IOMUX_PAD(0x05C0, 0x01F0, 1, 
0x, 0, 0),
+   MX6DL_PAD_ENET_RXD0__GPIO_1_27  = IOMUX_PAD(0x05C8, 0x01F8, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_16__GPIO_7_11= IOMUX_PAD(0x05E4, 0x0214, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_16__I2C3_SDA = IOMUX_PAD(0x05E4, 0x0214, 6 | 
IOMUX_CONFIG_SION, 0x087C, 1, 0),
+   MX6DL_PAD_GPIO_17__GPIO_7_12= IOMUX_PAD(0x05E8, 0x0218, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_18__GPIO_7_13= IOMUX_PAD(0x05EC, 0x021C, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_19__GPIO_4_5 = IOMUX_PAD(0x05F0, 0x0220, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_5__GPIO_1_5  = IOMUX_PAD(0x0600, 0x0230, 5, 
0x, 0, 0),
+   MX6DL_PAD_GPIO_5__I2C3_SCL  = IOMUX_PAD(0x0600, 0x0230, 6 | 
IOMUX_CONFIG_SION, 0x0878, 2, 0),
+   MX6DL_PAD_KEY_COL3__I2C2_SCL= IOMUX_PAD(0x0638, 0x0250, 4 | 
IOMUX_CONFIG_SION, 0x0870, 1, 0),
+   MX6DL_PAD_KEY_COL3__GPIO_4_12   = IOMUX_PAD(0x0638, 

Re: [U-Boot] [PATCH V2 19/21] mx6qsabrelite: add support for mx6 solo/duallite

2012-09-21 Thread Vikram Narayanan

On 9/22/2012 8:09 AM, Troy Kisky wrote:

Signed-off-by: Troy Kiskytroy.ki...@boundarydevices.com
---
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |  231 ++---
  board/freescale/mx6qsabrelite/pads.h  |  172 ++
  2 files changed, 226 insertions(+), 177 deletions(-)
  create mode 100644 board/freescale/mx6qsabrelite/pads.h

diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index 4b4e89b..ad2347d 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -26,6 +26,8 @@
  #includeasm/arch/imx-regs.h
  #includeasm/arch/iomux.h
  #includeasm/arch/mx6x_pins.h
+#includeasm/arch/mx6dl_pins.h
+#includeasm/arch/sys_proto.h
  #includeasm/errno.h
  #includeasm/gpio.h
  #includeasm/imx-common/iomux-v3.h
@@ -38,163 +40,46 @@
  #includenetdev.h
  DECLARE_GLOBAL_DATA_PTR;

-#define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |   \
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |  \
-   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+#include pads.h
+#define FOR_DL_SOLO
+#include pads.h

-#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |   \
-   PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |  \
-   PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+int cpu_is_mx6q(void)
+{
+   return get_cpu_type() == MXC_CPU_MX6Q;
+}

-#define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
-   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+#define IOMUX_SETUP(list)  iomux_setup(mx6q_##list, ARRAY_SIZE(mx6q_##list), \
+   mx6dl_solo_##list, ARRAY_SIZE(mx6dl_solo_##list))

-#define SPI_PAD_CTRL (PAD_CTL_HYS |\
-   PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
-   PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+int iomux_setup(iomux_v3_cfg_t *mx6q_pad_list, int mx6q_pad_cnt,
+   iomux_v3_cfg_t *mx6dl_solo_pad_list, int mx6dl_solo_pad_cnt)
+{
+   int mx6q = cpu_is_mx6q();
+   iomux_v3_cfg_t *p =  mx6q ? mx6q_pad_list : mx6dl_solo_pad_list;
+   int cnt = mx6q ? mx6q_pad_cnt : mx6dl_solo_pad_cnt;

-#define BUTTON_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |   \
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
-   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+   return imx_iomux_v3_setup_multiple_pads(p, cnt);
+}

-#define I2C_PAD_CTRL   (PAD_CTL_PKE | PAD_CTL_PUE |\
-   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
-   PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
-   PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+static const unsigned char col_lookup[] = {9, 10, 11, 8, 12, 9, 9, 9};
+static const unsigned char bank_lookup[] = {3, 2};

  int dram_init(void)
  {
-   gd-ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
-
-   return 0;
+   unsigned mdctl = readl(MMDC_P0_BASE_ADDR + 0x000);
+   unsigned mdmisc = readl(MMDC_P0_BASE_ADDR + 0x018);
+   int bits = 11 + 0 + 0 + 1;  /* row+col+bank+width */
+
+   bits += (mdctl  24)  7;  /* row */
+   bits += col_lookup[(mdctl  20)  7];  /* col */
+   bits += bank_lookup[(mdmisc  5)  1]; /* bank */
+   bits += (mdctl  16)  3;  /* width */
+   bits += (mdctl  30)  1;  /* cs1 enabled*/
+   gd-ram_size = 1  bits;
+   return 0;
  }



No magic numbers please. Replace it with macros.

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


Re: [U-Boot] [U-Boot-DM] [PATCH 01/11] DM: add block device core

2012-09-20 Thread Vikram Narayanan
On Fri, Sep 21, 2012 at 1:07 AM, Pavel Herrmann morpheus.i...@gmail.com wrote:
 This core will register all block devices (disk, cards, partitons) and provide
 unfied access to them, instead of current method with device + partition 
 offset

 Signed-off-by: Pavel Herrmann morpheus.i...@gmail.com
 ---
  Makefile  |   1 +
  drivers/blockdev/Makefile |  42 
  include/dm/blockdev.h | 121 
 ++
  3 files changed, 164 insertions(+)
  create mode 100644 drivers/blockdev/Makefile
  create mode 100644 include/dm/blockdev.h

snip
 +struct blockdev_ops {
 +   lbaint_t(*read)(struct instance *inst, lbaint_t start,
 +   lbaint_t blkcnt, void *buffer);
 +   lbaint_t(*write)(struct instance *inst, lbaint_t start,
 +   lbaint_t blkcnt, void *buffer);
 +   lbaint_t(*erase)(struct instance *inst, lbaint_t start,
 +   lbaint_t blkcnt);

lbaint_t is little cryptic. Any better name suggestions?

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


Re: [U-Boot] [PATCH 2/2] mx6: Add basic support for mx6qsabresd board.

2012-09-12 Thread Vikram Narayanan

On 9/12/2012 12:02 AM, Fabio Estevam wrote:

mx6qsabresd is a board based on mx6q SoC with the following features:
- 1GB of DDR3
- 1 USB OTG port
- 1 HDMI output port
- SPI NOR
- LVDS panel
- Gigabit Ethernet
- Camera Connector
- eMMC and SD card slot
- Audio

Add very basic support for it.

Signed-off-by: Fabio Estevamfabio.este...@freescale.com

snip

+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX  1
+#define CONFIG_BAUDRATE115200
+#define CONFIG_SYS_BAUDRATE_TABLE  {9600, 19200, 38400, 57600, 115200}


According to this commit,
CONFIG_SYS_BAUDRATE_TABLE: Add config_fallbacks.h, place there
(26750c8aee2383a026e0cf89e9310628d3a5a6a0), the above line isn't 
required anymore. Right?


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


[U-Boot] Boot U-Boot from UBI volume

2012-09-10 Thread Vikram Narayanan

Hello,

I'd like know about the progress of this proposal
http://elinux.org/Boot_U-Boot_from_UBI_volume

Someone is working on it currently?

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


Re: [U-Boot] [PATCH 01/14] dm: Initial import of design documents

2012-09-02 Thread Vikram Narayanan

Hello Wolfgang Denk,

On 9/2/2012 9:30 PM, Wolfgang Denk wrote:

Dear Marek Vasut,

In message1344426150-1229-1-git-send-email-ma...@denx.de  you wrote:

From: Marek Vasutmarek.va...@gmail.com

This patch contains UDM-design.txt, which is document containing
general description of the driver model. The remaining files contains
descriptions of conversion process of particular subsystems.

Signed-off-by: Marek Vasutmarek.va...@gmail.com
---
  doc/driver-model/UDM-design.txt   |  315 +
  doc/driver-model/UDM-fpga.txt |  115 ++
  doc/driver-model/UDM-keyboard.txt |   47 ++
  doc/driver-model/UDM-serial.txt   |  191 ++
  doc/driver-model/UDM-stdio.txt|  191 ++
  doc/driver-model/UDM-tpm.txt  |   48 ++
  doc/driver-model/UDM-usb.txt  |   94 +++
  doc/driver-model/UDM-video.txt|   74 +


May I know to which tree these patches are going in? I couldn't see it 
in the u-boot.git.


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


Re: [U-Boot] [PATCH v2 1/2] bcm: Add GPIO driver

2012-07-31 Thread Vikram Narayanan

Hello Stephen,

On 7/15/2012 10:53 PM, Stephen Warren wrote:

On 07/11/2012 02:37 PM, Vikram Narayanan wrote:

Driver for BCM2835 SoC. This gives the basic functionality of
setting/clearing the output.



diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h 
b/arch/arm/include/asm/arch-bcm2835/gpio.h



+#define BCM2835_GPIO_BASE  0x7E20
+#define BCM2835_NUM_GPIOS  53


For consistency, that might be better as BCM2835_GPIO_COUNT, but not a
big deal.


diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile



  COBJS-$(CONFIG_DA8XX_GPIO)+= da8xx_gpio.o
  COBJS-$(CONFIG_ALTERA_PIO)+= altera_pio.o
  COBJS-$(CONFIG_MPC83XX_GPIO)  += mpc83xx_gpio.o
+COBJS-$(CONFIG_BCM2835_GPIO)   += gpio_bcm2835.o


It looks like the name bcm2835_gpio.c would be more consistent with
existing drivers, but not a big deal.


diff --git a/drivers/gpio/gpio_bcm2835.c b/drivers/gpio/gpio_bcm2835.c




Linux kernel follows this naming, to be exact, it should've been 
gpio-bcm2835.c. Having a thought in mind that one day the namings would 
be made consistent with the kernel. That is the reason for this naming, 
but isn't a big deal to change it.



+inline int gpio_is_valid(unsigned gpio)
+{
+   return (gpio  BCM2835_NUM_GPIOS) ? 0 : 1;


Presumably gpio==0 is a valid GPIO, so that should be= not. It'd be
simpler to write it as:

return gpio  BCM2835_NUM_GPIOS;


+int gpio_request(unsigned gpio, const char *label)
+{
+   return (gpio_is_valid(gpio)) ? 1 : 0;


Why not just return gpio_is_valid_(gpio) directly?


+int gpio_direction_input(unsigned gpio)



+   val = readl(reg-gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]);
+   val= ~(BCM2835_GPIO_FSEL_MASK  BCM2835_GPIO_FSEL_SHIFT(gpio));


Even if BCM2835_GPIO_OUTPUT==0, it seems better to | it in here for
documentation purposes, so add:

val |= (BCM2835_GPIO_INPUT  BCM2835_GPIO_FSEL_SHIFT(gpio));

Otherwise, there's not much point creating the #define BCM2835_GPIO_INPUT.


+int gpio_direction_output(unsigned gpio, int value)
+{
+   struct bcm_gpio_regs *reg = (struct bcm_gpio_regs *)BCM2835_GPIO_BASE;
+   unsigned val;
+
+   val = readl(reg-gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]);
+   val= ~(BCM2835_GPIO_FSEL_MASK  BCM2835_GPIO_FSEL_SHIFT(gpio));
+   val |= (BCM2835_GPIO_OUTPUT  BCM2835_GPIO_FSEL_SHIFT(gpio));
+   writel(val, reg-gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]);


This (setting the direction) should happen after the following to set
the value:


+   if (value)
+   gpio_set_value(gpio, value);


That way, when the GPIO is set to output, the correct value will
immediately be driven onto the GPIO, so a glitch may be avoided.


+int gpio_get_value(unsigned gpio)



+   return (val  BCM2835_GPIO_COMMON_MASK(gpio))  0x1;




Agree for all the above. Will get reflected in the v3.


Shouldn't that be BCM2835_GPIO_COMMON_SHIFT not BCM2835_GPIO_COMMON_MASK?


If you'd like to have naming consistency FSEL_SHIFT/COMMON_SHIFT, then 
it shall be COMMON_SHIFT.


But it doesn't do any shifting like the FSEL_SHIFT, rather it does only 
masking of bits. So, it makes more sense for me to name it as MASK and 
not SHIFT.


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


Re: [U-Boot] [PATCH v2 1/2] bcm: Add GPIO driver

2012-07-31 Thread Vikram Narayanan

On 7/31/2012 9:22 PM, Stephen Warren wrote:

On 07/31/2012 09:46 AM, Vikram Narayanan wrote:

On 7/15/2012 10:53 PM, Stephen Warren wrote:

On 07/11/2012 02:37 PM, Vikram Narayanan wrote:

Driver for BCM2835 SoC. This gives the basic functionality of
setting/clearing the output.



diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h
b/arch/arm/include/asm/arch-bcm2835/gpio.h


One more comment on the patch subject; it probably should be gpio:
bcm2835: not bcm: since (a) it's in the GPIO directory and (b) the
GPIO module is specifically for a BCM2835, and probably doesn't apply to
any/all Broadcom devices.



Linux kernel follows this naming, to be exact, it should've been
gpio-bcm2835.c. Having a thought in mind that one day the namings would
be made consistent with the kernel. That is the reason for this naming,
but isn't a big deal to change it.


Hmmm. It seems better to be internally consistent with U-Boot rather
than keeping (onyl part of) U-Boot consistent with the kernel...


Yes.




Shouldn't that be BCM2835_GPIO_COMMON_SHIFT not BCM2835_GPIO_COMMON_MASK?


If you'd like to have naming consistency FSEL_SHIFT/COMMON_SHIFT, then
it shall be COMMON_SHIFT.

But it doesn't do any shifting like the FSEL_SHIFT, rather it does only
masking of bits. So, it makes more sense for me to name it as MASK and
not SHIFT.


The full quote you're replying to was:


+int gpio_get_value(unsigned gpio)



+   return (val  BCM2835_GPIO_COMMON_MASK(gpio))  0x1;


Shouldn't that be BCM2835_GPIO_COMMON_SHIFT not BCM2835_GPIO_COMMON_MASK?


... so that macro is being used as a shift not as a mask.


Naming isn't really a problem for me. If you want it to be SHIFT, I'd go 
with it.

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


[U-Boot] [PATCH v3 0/2] Add GPIO driver for BCM2835 SoC

2012-07-31 Thread Vikram Narayanan
Also, add the driver to the raspberrypi default config

Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Albert Aribaud albert.u.b...@aribaud.net

Vikram Narayanan (2):
  gpio: bcm2835: Add GPIO driver
  rbpi: Add BCM2835 GPIO driver for raspberry pi

Changes from v2:
  Incorporate further comments from Stephen Warren
Changes from v1:
  Incorporate comments from Stephen Warren

 arch/arm/include/asm/arch-bcm2835/gpio.h |   71 
 drivers/gpio/Makefile|1 +
 drivers/gpio/bcm2835_gpio.c  |   88 ++
 include/configs/rpi_b.h  |3 +-
 4 files changed, 162 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/bcm2835_gpio.c

-- 
1.7.4.1

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


[U-Boot] [PATCH v3 1/2] gpio: bcm2835: Add GPIO driver

2012-07-31 Thread Vikram Narayanan
Driver for BCM2835 SoC. This gives the basic functionality of
setting/clearing the output.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
---
 arch/arm/include/asm/arch-bcm2835/gpio.h |   71 
 drivers/gpio/Makefile|1 +
 drivers/gpio/bcm2835_gpio.c  |   88 ++
 3 files changed, 160 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/bcm2835_gpio.c

diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h 
b/arch/arm/include/asm/arch-bcm2835/gpio.h
new file mode 100644
index 000..515456a
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/gpio.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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 _BCM2835_GPIO_H_
+#define _BCM2835_GPIO_H_
+
+#define BCM2835_GPIO_BASE  0x7E20
+#define BCM2835_GPIO_COUNT 53
+
+#define BCM2835_GPIO_FSEL_MASK 0x7
+#define BCM2835_GPIO_INPUT 0x0
+#define BCM2835_GPIO_OUTPUT0x1
+#define BCM2835_GPIO_ALT0  0x2
+#define BCM2835_GPIO_ALT1  0x3
+#define BCM2835_GPIO_ALT2  0x4
+#define BCM2835_GPIO_ALT3  0x5
+#define BCM2835_GPIO_ALT4  0x6
+#define BCM2835_GPIO_ALT5  0x7
+
+#define BCM2835_GPIO_COMMON_BANK(gpio) ((gpio  32) ? 0 : 1)
+#define BCM2835_GPIO_COMMON_SHIFT(gpio)(gpio  0x1f)
+
+#define BCM2835_GPIO_FSEL_BANK(gpio)   (gpio / 10)
+#define BCM2835_GPIO_FSEL_SHIFT(gpio)  ((gpio % 10) * 3)
+
+struct bcm_gpio_regs {
+   u32 gpfsel[6];
+   u32 reserved1;
+   u32 gpset[2];
+   u32 reserved2;
+   u32 gpclr[2];
+   u32 reserved3;
+   u32 gplev[2];
+   u32 reserved4;
+   u32 gpeds[2];
+   u32 reserved5;
+   u32 gpren[2];
+   u32 reserved6;
+   u32 gpfen[2];
+   u32 reserved7;
+   u32 gphen[2];
+   u32 reserved8;
+   u32 gplen[2];
+   u32 reserved9;
+   u32 gparen[2];
+   u32 reserved10;
+   u32 gppud;
+   u32 gppudclk[2];
+};
+
+#endif /* _BCM2835_GPIO_H_ */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 32a2474..8d2f2b2 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_TEGRA_GPIO)+= tegra_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o
 COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o
 COBJS-$(CONFIG_MPC83XX_GPIO)   += mpc83xx_gpio.o
+COBJS-$(CONFIG_BCM2835_GPIO)   += bcm2835_gpio.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c
new file mode 100644
index 000..eb02efa
--- /dev/null
+++ b/drivers/gpio/bcm2835_gpio.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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/gpio.h
+#include asm/io.h
+
+inline int gpio_is_valid(unsigned gpio)
+{
+   return (gpio  BCM2835_GPIO_COUNT);
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   return gpio_is_valid(gpio);
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+   struct bcm_gpio_regs *reg = (struct bcm_gpio_regs *)BCM2835_GPIO_BASE;
+   unsigned val;
+
+   val = readl(reg-gpfsel[BCM2835_GPIO_FSEL_BANK

[U-Boot] [PATCH v3 2/2] rbpi: Add BCM2835 GPIO driver for raspberry pi

2012-07-31 Thread Vikram Narayanan
Add the driver to the default config

Signed-off-by: Vikram Narayanan vikram...@gmail.com
---
 include/configs/rpi_b.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h
index f547027..d4bbccc 100644
--- a/include/configs/rpi_b.h
+++ b/include/configs/rpi_b.h
@@ -43,7 +43,8 @@
 #define CONFIG_SYS_NO_FLASH
 
 /* Devices */
-/* None yet */
+/* GPIO */
+#define CONFIG_BCM2835_GPIO
 
 /* Console UART */
 #define CONFIG_PL011_SERIAL
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH v3 1/2] gpio: bcm2835: Add GPIO driver

2012-07-31 Thread Vikram Narayanan

On 7/31/2012 11:18 PM, Vikram Narayanan wrote:

Driver for BCM2835 SoC. This gives the basic functionality of
setting/clearing the output.

Signed-off-by: Vikram Narayananvikram...@gmail.com
---
  arch/arm/include/asm/arch-bcm2835/gpio.h |   71 
  drivers/gpio/Makefile|1 +
  drivers/gpio/bcm2835_gpio.c  |   88 ++
  3 files changed, 160 insertions(+), 0 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
  create mode 100644 drivers/gpio/bcm2835_gpio.c

diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h 
b/arch/arm/include/asm/arch-bcm2835/gpio.h
new file mode 100644
index 000..515456a
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/gpio.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ *vikram...@gmail.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 _BCM2835_GPIO_H_
+#define _BCM2835_GPIO_H_
+
+#define BCM2835_GPIO_BASE  0x7E20
+#define BCM2835_GPIO_COUNT 53


GPIO count should be 54 to make the gpio_is_valid work correctly when 
the gpio is 53.

Will fix in v4.

Any other comments?


+
+#define BCM2835_GPIO_FSEL_MASK 0x7
+#define BCM2835_GPIO_INPUT 0x0
+#define BCM2835_GPIO_OUTPUT0x1
+#define BCM2835_GPIO_ALT0  0x2
+#define BCM2835_GPIO_ALT1  0x3
+#define BCM2835_GPIO_ALT2  0x4
+#define BCM2835_GPIO_ALT3  0x5
+#define BCM2835_GPIO_ALT4  0x6
+#define BCM2835_GPIO_ALT5  0x7
+
+#define BCM2835_GPIO_COMMON_BANK(gpio) ((gpio  32) ? 0 : 1)
+#define BCM2835_GPIO_COMMON_SHIFT(gpio)(gpio  0x1f)
+
+#define BCM2835_GPIO_FSEL_BANK(gpio)   (gpio / 10)
+#define BCM2835_GPIO_FSEL_SHIFT(gpio)  ((gpio % 10) * 3)
+
+struct bcm_gpio_regs {
+   u32 gpfsel[6];
+   u32 reserved1;
+   u32 gpset[2];
+   u32 reserved2;
+   u32 gpclr[2];
+   u32 reserved3;
+   u32 gplev[2];
+   u32 reserved4;
+   u32 gpeds[2];
+   u32 reserved5;
+   u32 gpren[2];
+   u32 reserved6;
+   u32 gpfen[2];
+   u32 reserved7;
+   u32 gphen[2];
+   u32 reserved8;
+   u32 gplen[2];
+   u32 reserved9;
+   u32 gparen[2];
+   u32 reserved10;
+   u32 gppud;
+   u32 gppudclk[2];
+};
+
+#endif /* _BCM2835_GPIO_H_ */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 32a2474..8d2f2b2 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -40,6 +40,7 @@ COBJS-$(CONFIG_TEGRA_GPIO)+= tegra_gpio.o
  COBJS-$(CONFIG_DA8XX_GPIO)+= da8xx_gpio.o
  COBJS-$(CONFIG_ALTERA_PIO)+= altera_pio.o
  COBJS-$(CONFIG_MPC83XX_GPIO)  += mpc83xx_gpio.o
+COBJS-$(CONFIG_BCM2835_GPIO)   += bcm2835_gpio.o

  COBJS := $(COBJS-y)
  SRCS  := $(COBJS:.o=.c)
diff --git a/drivers/gpio/bcm2835_gpio.c b/drivers/gpio/bcm2835_gpio.c
new file mode 100644
index 000..eb02efa
--- /dev/null
+++ b/drivers/gpio/bcm2835_gpio.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ *vikram...@gmail.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
+ */
+
+#includecommon.h
+#includeasm/gpio.h
+#includeasm/io.h
+
+inline int gpio_is_valid(unsigned gpio)
+{
+   return (gpio  BCM2835_GPIO_COUNT);
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   return gpio_is_valid(gpio);
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
+
+int

[U-Boot] [PATCH v2 0/2] GPIO driver for BCM2835 SoC

2012-07-11 Thread Vikram Narayanan
Add GPIO driver for BCM2835 Soc. Also add the driver to the raspberrypi default 
config

Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Albert Aribaud albert.u.b...@aribaud.net

Vikram Narayanan (2):
  bcm: Add GPIO driver
  rbpi: Add BCM2835 GPIO driver for raspberry pi
  
Changes from v1:
  Incorporate comments from Stephen Warren.

 arch/arm/include/asm/arch-bcm2835/gpio.h |   71 
 drivers/gpio/Makefile|1 +
 drivers/gpio/gpio_bcm2835.c  |   87 ++
 include/configs/rpi_b.h  |3 +-
 4 files changed, 161 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/gpio_bcm2835.c

-- 
1.7.4.1

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


[U-Boot] [PATCH v2 1/2] bcm: Add GPIO driver

2012-07-11 Thread Vikram Narayanan
Driver for BCM2835 SoC. This gives the basic functionality of
setting/clearing the output.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Albert Aribaud albert.u.b...@aribaud.net
---
 arch/arm/include/asm/arch-bcm2835/gpio.h |   71 
 drivers/gpio/Makefile|1 +
 drivers/gpio/gpio_bcm2835.c  |   87 ++
 3 files changed, 159 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/gpio_bcm2835.c

diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h 
b/arch/arm/include/asm/arch-bcm2835/gpio.h
new file mode 100644
index 000..3ab06e0
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/gpio.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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 _BCM2835_GPIO_H_
+#define _BCM2835_GPIO_H_
+
+#define BCM2835_GPIO_BASE  0x7E20
+#define BCM2835_NUM_GPIOS  53
+
+#define BCM2835_GPIO_FSEL_MASK 0x7
+#define BCM2835_GPIO_INPUT 0x0
+#define BCM2835_GPIO_OUTPUT0x1
+#define BCM2835_GPIO_ALT0  0x2
+#define BCM2835_GPIO_ALT1  0x3
+#define BCM2835_GPIO_ALT2  0x4
+#define BCM2835_GPIO_ALT3  0x5
+#define BCM2835_GPIO_ALT4  0x6
+#define BCM2835_GPIO_ALT5  0x7
+
+#define BCM2835_GPIO_COMMON_BANK(gpio) ((gpio  32) ? 0 : 1)
+#define BCM2835_GPIO_COMMON_MASK(gpio) (gpio  0x1f)
+
+#define BCM2835_GPIO_FSEL_BANK(gpio)   (gpio / 10)
+#define BCM2835_GPIO_FSEL_SHIFT(gpio)  ((gpio % 10) * 3)
+
+struct bcm_gpio_regs {
+   u32 gpfsel[6];
+   u32 reserved1;
+   u32 gpset[2];
+   u32 reserved2;
+   u32 gpclr[2];
+   u32 reserved3;
+   u32 gplev[2];
+   u32 reserved4;
+   u32 gpeds[2];
+   u32 reserved5;
+   u32 gpren[2];
+   u32 reserved6;
+   u32 gpfen[2];
+   u32 reserved7;
+   u32 gphen[2];
+   u32 reserved8;
+   u32 gplen[2];
+   u32 reserved9;
+   u32 gparen[2];
+   u32 reserved10;
+   u32 gppud;
+   u32 gppudclk[2];
+};
+
+#endif /* _BCM2835_GPIO_H_ */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index fb3b09a..7653e84 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_TEGRA2_GPIO)   += tegra2_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o
 COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o
 COBJS-$(CONFIG_MPC83XX_GPIO)   += mpc83xx_gpio.o
+COBJS-$(CONFIG_BCM2835_GPIO)   += gpio_bcm2835.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/gpio/gpio_bcm2835.c b/drivers/gpio/gpio_bcm2835.c
new file mode 100644
index 000..23cdd90
--- /dev/null
+++ b/drivers/gpio/gpio_bcm2835.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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/gpio.h
+#include asm/io.h
+
+inline int gpio_is_valid(unsigned gpio)
+{
+   return (gpio  BCM2835_NUM_GPIOS) ? 0 : 1;
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   return (gpio_is_valid(gpio)) ? 1 : 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+   struct bcm_gpio_regs *reg = (struct bcm_gpio_regs

[U-Boot] [PATCH v2 2/2] rbpi: Add BCM2835 GPIO driver for raspberry pi

2012-07-11 Thread Vikram Narayanan
Add the driver to the default config

Signed-off-by: Vikram Narayanan vikram...@gmail.com
---
 include/configs/rpi_b.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h
index f547027..d4bbccc 100644
--- a/include/configs/rpi_b.h
+++ b/include/configs/rpi_b.h
@@ -43,7 +43,8 @@
 #define CONFIG_SYS_NO_FLASH
 
 /* Devices */
-/* None yet */
+/* GPIO */
+#define CONFIG_BCM2835_GPIO
 
 /* Console UART */
 #define CONFIG_PL011_SERIAL
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH 0/2] Add GPIO driver for BCM2835 SoC

2012-07-03 Thread Vikram Narayanan

Hello Stephen,

On 7/4/2012 7:37 AM, Stephen Warren wrote:

On 06/24/2012 11:19 AM, Vikram Narayanan wrote:

Add a GPIO driver for the BCM2835 Soc.
Refer Datasheet 
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
Also, add the driver to the raspberrypi's default config


Vikram,

Are you planning on revising this driver and re-posting? I was hoping to
enhance it to add support for the pin muxing functionality of the HW,
but obviously want to wait for any revised version before doing so.


Yes. I'm on it. I'm quite busy on other tasks.
I'll post the v2 by the end of this week.
Hope this should be ok for you.

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


Re: [U-Boot] [PATCH 1/2] bcm: Add GPIO driver for BCM2835 SoC

2012-06-27 Thread Vikram Narayanan

Hello Stephen,

On 6/27/2012 7:09 AM, Stephen Warren wrote:

On 06/24/2012 11:21 AM, Vikram Narayanan wrote:

First off, it's great to see some patches for the chip. Thanks. Sorry
for being so nit-picky below; it's a tendency of mine...


Thanks for the detailed review. I'd make a v2 for this.
And I might probably include you in the signed-off-by line.
Hope you don't mind that.

Do you have a hosted repo somewhere for this rpi_b stuff?
If so, please post it here or we shall have one, which has all the 
patches queued in for the mainline. What do you say? Share your opinions 
about this.



BTW, I don't think this patch compiles; gpio_set_value() references
variable pin, which doesn't exist.


Sorry about that, Late night submission!

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


Re: [U-Boot] [PATCH 1/2] bcm: Add GPIO driver for BCM2835 SoC

2012-06-27 Thread Vikram Narayanan


On 6/27/2012 11:36 PM, Stephen Warren wrote:

On 06/27/2012 11:32 AM, Vikram Narayanan wrote:

Hello Stephen,

On 6/27/2012 7:09 AM, Stephen Warren wrote:

On 06/24/2012 11:21 AM, Vikram Narayanan wrote:

First off, it's great to see some patches for the chip. Thanks. Sorry
for being so nit-picky below; it's a tendency of mine...


Thanks for the detailed review. I'd make a v2 for this.
And I might probably include you in the signed-off-by line.
Hope you don't mind that.


No, you shouldn't add any tags to the patch that refer to other people,
except perhaps a Reported-By, without their explicitly giving those tags.

Also, Signed-off-by wouldn't make sense here since I'm not vouching for
the code or passing it along. Once V2 is posted, I may give an ack or
review tag.


I'm aware of it. :)
Just for the level of details you said to change in the code I said so.
Don't mind that.


Do you have a hosted repo somewhere for this rpi_b stuff?
If so, please post it here or we shall have one, which has all the
patches queued in for the mainline. What do you say? Share your opinions
about this.


I do have a repo. It's at:
https://github.com/swarren/u-boot

However, that's my personal work-space. The RPi patches should
eventually make it into the official U-Boot repositories through the
standard review process. They are:

ARM repo:
git://git.denx.de/u-boot-arm.git

Main repo:
git://git.denx.de/u-boot.git


I'm aware of this too. I'm referring to a public hosting of these RPi 
patches somewhere, so that it could easily be submitted to the mainline 
in _one_ shot. Since your initial SoC support patches aren't added to 
the u-boot-arm, I planned to have everything queued up for submission 
into the mainline *via* the mailing list. Hope you got my point.

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


[U-Boot] [PATCH 0/2] Add GPIO driver for BCM2835 SoC

2012-06-24 Thread Vikram Narayanan
Add a GPIO driver for the BCM2835 Soc.
Refer Datasheet 
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
Also, add the driver to the raspberrypi's default config


Vikram Narayanan (2):
  bcm: Add GPIO driver for BCM2835 SoC
  rbpi: Add BCM2835 GPIO driver for raspberry pi

 arch/arm/include/asm/arch-bcm2835/gpio.h |   49 +++
 drivers/gpio/Makefile|1 +
 drivers/gpio/rpi_gpio.c  |  128 ++
 include/configs/rpi_b.h  |4 +-
 4 files changed, 181 insertions(+), 1 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/rpi_gpio.c

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/2] bcm: Add GPIO driver for BCM2835 SoC

2012-06-24 Thread Vikram Narayanan

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Albert Aribaud albert.u.b...@aribaud.net
---
 arch/arm/include/asm/arch-bcm2835/gpio.h |   49 +++
 drivers/gpio/Makefile|1 +
 drivers/gpio/rpi_gpio.c  |  128 ++
 3 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-bcm2835/gpio.h
 create mode 100644 drivers/gpio/rpi_gpio.c

diff --git a/arch/arm/include/asm/arch-bcm2835/gpio.h 
b/arch/arm/include/asm/arch-bcm2835/gpio.h
new file mode 100644
index 000..3cba0fb
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/gpio.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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 _BCM2835_GPIO_H_
+#define _BCM2835_GPIO_H_
+
+#define BCM2835_GPIO_BASE  (0x7E20)
+#define BCM2835_MAX_GPIOS  53
+
+#define BCM2835_GPIO_FSEL_CLR_MASK (0x7)
+#define BCM2835_GPIO_OUTPUT(0x1)
+
+#define GPIO_TO_BANK(n)(n / 10)
+#define GPIO_TO_PIN(n) (n % 10)
+
+struct bcm_gpio_regs {
+   u32 gpfsel[6];
+   u32 reserved1;
+   u32 gpset0;
+   u32 gpset1;
+   u32 reserved2;
+   u32 gpclr0;
+   u32 gpclr1;
+   u32 reserved3;
+   u32 gplev0;
+   u32 gplev1;
+};
+
+#endif /* _BCM2835_GPIO_H_ */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index fb3b09a..b042c46 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_TEGRA2_GPIO)   += tegra2_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o
 COBJS-$(CONFIG_ALTERA_PIO) += altera_pio.o
 COBJS-$(CONFIG_MPC83XX_GPIO)   += mpc83xx_gpio.o
+COBJS-$(CONFIG_BCM2835_GPIO)   += rpi_gpio.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/gpio/rpi_gpio.c b/drivers/gpio/rpi_gpio.c
new file mode 100644
index 000..c2b547f
--- /dev/null
+++ b/drivers/gpio/rpi_gpio.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2012 Vikram Narayananan
+ * vikram...@gmail.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/gpio.h
+#include asm/io.h
+
+struct bcm_gpio {
+   u32 bank;
+   u32 pin;
+};
+
+inline int gpio_is_valid(unsigned gpio)
+{
+   return (gpio  BCM2835_MAX_GPIOS) ? 0 : 1;
+}
+
+static int get_bank_pin(unsigned gpio, struct bcm_gpio *pio)
+{
+   int bank = GPIO_TO_BANK(gpio);
+   int pin = GPIO_TO_PIN(gpio);
+
+   if (!gpio_is_valid(gpio))
+   return -1;
+
+   pin = 0x09;
+   pio-pin = pin;
+   pio-bank = bank;
+   return 0;
+}
+
+int gpio_request(unsigned gpio, const char *label)
+{
+   return (gpio_is_valid(gpio)) ? 1 : 0;
+}
+
+int gpio_free(unsigned gpio)
+{
+   return 0;
+}
+
+int gpio_direction_input(unsigned gpio)
+{
+   struct bcm_gpio pio;
+   struct bcm_gpio_regs *reg = (struct bcm_gpio_regs *)BCM2835_GPIO_BASE;
+   unsigned val = 0;
+
+   if (get_bank_pin(gpio, pio))
+   return -1;
+
+   val = readl(reg-gpfsel[pio.bank]);
+   val = ~(BCM2835_GPIO_FSEL_CLR_MASK  (pio.pin * 3));
+   writel(val, reg-gpfsel[pio.bank]);
+}
+
+int gpio_direction_output(unsigned gpio, int value)
+{
+   struct bcm_gpio pio;
+   struct bcm_gpio_regs *reg = (struct bcm_gpio_regs *)BCM2835_GPIO_BASE;
+   unsigned val = 0;
+
+   if (get_bank_pin(gpio

[U-Boot] [PATCH 2/2] rbpi: Add BCM2835 GPIO driver for raspberry pi

2012-06-24 Thread Vikram Narayanan

Add the driver to the rpi_b's default config

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Stephen Warren swar...@wwwdotorg.org
Cc: Albert Aribaud albert.u.b...@aribaud.net
---
 include/configs/rpi_b.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h
index f547027..fb45a18 100644
--- a/include/configs/rpi_b.h
+++ b/include/configs/rpi_b.h
@@ -43,7 +43,9 @@
 #define CONFIG_SYS_NO_FLASH
 
 /* Devices */
-/* None yet */
+/* GPIO */
+#define CONFIG_BCM2835_GPIO
+
 
 /* Console UART */
 #define CONFIG_PL011_SERIAL
-- 
1.7.4.1


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


[U-Boot] mx51evk: Fix build error when CONFIG_VIDEO is disabled

2012-06-18 Thread Vikram Narayanan
The inclusion of LCD patch into mx51evk breaks the build when
CONFIG_VIDEO is disabled. Fix this by splitting the video related
stuff to a new file.

Also rename the function lcd_iomux to setup_iomux_lcd to make the
namings aligned with the other iomux functions.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Stefano Babic sba...@denx.de
---
 board/freescale/mx51evk/Makefile|4 +-
 board/freescale/mx51evk/mx51evk.c   |   65 +++-
 board/freescale/mx51evk/mx51evk_video.c |   83 +++
 3 files changed, 93 insertions(+), 59 deletions(-)
 create mode 100644 board/freescale/mx51evk/mx51evk_video.c

diff --git a/board/freescale/mx51evk/Makefile b/board/freescale/mx51evk/Makefile
index 470588e..9ded43f 100644
--- a/board/freescale/mx51evk/Makefile
+++ b/board/freescale/mx51evk/Makefile
@@ -23,8 +23,10 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  := mx51evk.o
+COBJS-y+= mx51evk.o
+COBJS-$(CONFIG_VIDEO)  += mx51evk_video.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/freescale/mx51evk/mx51evk.c 
b/board/freescale/mx51evk/mx51evk.c
index 514a7ac..2b82c8e 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -36,12 +36,6 @@
 #include fsl_pmic.h
 #include mc13892.h
 #include usb/ehci-fsl.h
-#include linux/fb.h
-#include ipu_pixfmt.h
-
-#define MX51EVK_LCD_3V3(3 * 32 + 9)/* GPIO4_9 */
-#define MX51EVK_LCD_5V (3 * 32 + 10)   /* GPIO4_10 */
-#define MX51EVK_LCD_BACKLIGHT  (2 * 32 + 4)/* GPIO3_4 */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -459,53 +453,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-static struct fb_videomode claa_wvga = {
-   .name   = CLAA07LC0ACW,
-   .refresh= 57,
-   .xres   = 800,
-   .yres   = 480,
-   .pixclock   = 37037,
-   .left_margin= 40,
-   .right_margin   = 60,
-   .upper_margin   = 10,
-   .lower_margin   = 10,
-   .hsync_len  = 20,
-   .vsync_len  = 10,
-   .sync   = 0,
-   .vmode  = FB_VMODE_NONINTERLACED
-};
-
-void lcd_iomux(void)
-{
-   /* DI2_PIN15 */
-   mxc_request_iomux(MX51_PIN_DI_GP4, IOMUX_CONFIG_ALT4);
-
-   /* Pad settings for MX51_PIN_DI2_DISP_CLK */
-   mxc_iomux_set_pad(MX51_PIN_DI2_DISP_CLK, PAD_CTL_HYS_NONE |
- PAD_CTL_PKE_ENABLE | PAD_CTL_PUE_KEEPER |
- PAD_CTL_DRV_MAX | PAD_CTL_SRE_SLOW);
-
-   /* Turn on 3.3V voltage for LCD */
-   mxc_request_iomux(MX51_PIN_CSI2_D12, IOMUX_CONFIG_ALT3);
-   gpio_direction_output(MX51EVK_LCD_3V3, 1);
-
-   /* Turn on 5V voltage for LCD */
-   mxc_request_iomux(MX51_PIN_CSI2_D13, IOMUX_CONFIG_ALT3);
-   gpio_direction_output(MX51EVK_LCD_5V, 1);
-
-   /* Turn on GPIO backlight */
-   mxc_request_iomux(MX51_PIN_DI1_D1_CS, IOMUX_CONFIG_ALT4);
-   mxc_iomux_set_input(MX51_GPIO3_IPP_IND_G_IN_4_SELECT_INPUT,
-   INPUT_CTL_PATH1);
-   gpio_direction_output(MX51EVK_LCD_BACKLIGHT, 1);
-}
-
-void lcd_enable(void)
-{
-   int ret = ipuv3_fb_init(claa_wvga, 1, IPU_PIX_FMT_RGB565);
-   if (ret)
-   printf(LCD cannot be configured: %d\n, ret);
-}
 
 int board_early_init_f(void)
 {
@@ -514,8 +461,9 @@ int board_early_init_f(void)
 #ifdef CONFIG_USB_EHCI_MX5
setup_usb_h1();
 #endif
-   lcd_iomux();
-
+#ifdef CONFIG_VIDEO
+   setup_iomux_lcd();
+#endif
return 0;
 }
 
@@ -523,9 +471,9 @@ int board_init(void)
 {
/* address of boot parameters */
gd-bd-bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
+#ifdef CONFIG_VIDEO
lcd_enable();
-
+#endif
return 0;
 }
 
@@ -536,8 +484,9 @@ int board_late_init(void)
setup_iomux_spi();
power_init();
 #endif
+#ifdef CONFIG_VIDEO
setenv(stdout, serial);
-
+#endif
return 0;
 }
 #endif
diff --git a/board/freescale/mx51evk/mx51evk_video.c 
b/board/freescale/mx51evk/mx51evk_video.c
new file mode 100644
index 000..e316e4c
--- /dev/null
+++ b/board/freescale/mx51evk/mx51evk_video.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ * Fabio Estevam fabio.este...@freescale.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

[U-Boot] mx53loco: Fix build error when CONFIG_VIDEO is disabled

2012-06-18 Thread Vikram Narayanan
The inclusion of LCD patch into mx51evk breaks the build when
CONFIG_VIDEO is disabled. Fix this by splitting the video
related stuff to a new file.

Also rename the function lcd_iomux to setup_iomux_lcd to make the
namings aligned with the other iomux functions.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: Stefano Babic sba...@denx.de
---
 board/freescale/mx53loco/Makefile |4 +-
 board/freescale/mx53loco/mx53loco.c   |   78 ++-
 board/freescale/mx53loco/mx53loco_video.c |   96 +
 3 files changed, 106 insertions(+), 72 deletions(-)
 create mode 100644 board/freescale/mx53loco/mx53loco_video.c

diff --git a/board/freescale/mx53loco/Makefile 
b/board/freescale/mx53loco/Makefile
index a6ea939..f92c928 100644
--- a/board/freescale/mx53loco/Makefile
+++ b/board/freescale/mx53loco/Makefile
@@ -22,8 +22,10 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  := mx53loco.o
+COBJS-y+= mx53loco.o
+COBJS-$(CONFIG_VIDEO) += mx53loco_video.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/freescale/mx53loco/mx53loco.c 
b/board/freescale/mx53loco/mx53loco.c
index d8e027c..d494716 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -39,10 +39,6 @@
 #include pmic.h
 #include dialog_pmic.h
 #include fsl_pmic.h
-#include linux/fb.h
-#include ipu_pixfmt.h
-
-#define MX53LOCO_LCD_POWER (2 * 32 + 24)   /* GPIO3_24 */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -406,75 +402,13 @@ static void clock_1GHz(void)
printf(CPU:   Switch DDR clock to 400MHz failed\n);
 }
 
-static struct fb_videomode claa_wvga = {
-   .name   = CLAA07LC0ACW,
-   .refresh= 57,
-   .xres   = 800,
-   .yres   = 480,
-   .pixclock   = 37037,
-   .left_margin= 40,
-   .right_margin   = 60,
-   .upper_margin   = 10,
-   .lower_margin   = 10,
-   .hsync_len  = 20,
-   .vsync_len  = 10,
-   .sync   = 0,
-   .vmode  = FB_VMODE_NONINTERLACED
-};
-
-void lcd_iomux(void)
-{
-   mxc_request_iomux(MX53_PIN_DI0_DISP_CLK, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DI0_PIN15, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DI0_PIN2, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DI0_PIN3, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT0, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT1, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT2, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT3, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT4, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT5, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT6, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT7, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT8, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT9, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT10, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT11, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT12, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT13, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT14, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT15, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT16, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT17, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT18, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT19, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT20, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT21, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT22, IOMUX_CONFIG_ALT0);
-   mxc_request_iomux(MX53_PIN_DISP0_DAT23, IOMUX_CONFIG_ALT0);
-
-   /* Turn on GPIO backlight */
-   mxc_request_iomux(MX53_PIN_EIM_D24, IOMUX_CONFIG_ALT1);
-   gpio_direction_output(MX53LOCO_LCD_POWER, 1);
-
-   /* Turn on display contrast */
-   mxc_request_iomux(MX53_PIN_GPIO_1, IOMUX_CONFIG_ALT1);
-   gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_GPIO_1), 1);
-}
-
-void lcd_enable(void)
-{
-   int ret = ipuv3_fb_init(claa_wvga, 0, IPU_PIX_FMT_RGB565);
-   if (ret)
-   printf(LCD cannot be configured: %d\n, ret);
-}
-
 int board_early_init_f(void)
 {
setup_iomux_uart();
setup_iomux_fec();
-   lcd_iomux();
-
+#ifdef CONFIG_VIDEO
+   setup_iomux_lcd();
+#endif
return 0;
 }
 
@@ -500,8 +434,9 @@ int board_late_init(void)
clock_1GHz();
print_cpuinfo();
 
+#ifdef CONFIG_VIDEO

[U-Boot] [PATCH v4] tx25: Use generic gpio_* calls

2012-06-16 Thread Vikram Narayanan
Instead of manipulating gpio registers directly, use the calls
from the gpio library.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Acked-by: Stefano Babic sba...@denx.de
Cc: John Rigby jcri...@gmail.com
Cc: Fabio Estevam fabio.este...@freescale.com
---
Changes from v3:
Use gpio_set_value instead of gpio_direction_output
(Ahh. Missed it again!!. Very bad)

Changes from v2:
Swap the place of the change log and commit message.

Changes from v1:
Used appropriate gpio_* lib calls.

 board/karo/tx25/tx25.c |   25 +
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..07fd98d 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -34,14 +34,13 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
+#define GPIO_FEC_RESET_B   MXC_GPIO_PORT_TO_NUM(4, 7)
+#define GPIO_FEC_ENABLE_B  MXC_GPIO_PORT_TO_NUM(4, 9)
 void tx25_fec_init(void)
 {
struct iomuxc_mux_ctl *muxctl;
struct iomuxc_pad_ctl *padctl;
-   u32 val;
u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
-   struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE;
-   struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE;
u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;
 
debug(tx25_fec_init\n);
@@ -66,18 +65,15 @@ void tx25_fec_init(void)
writel(0x0, padctl-pad_d11);
 
/* drop PHY power and assert reset (low) */
-   val = readl(gpio4-gpio_dr)  ~((1  7) | (1  9));
-   writel(val, gpio4-gpio_dr);
-   val = readl(gpio4-gpio_dir) | (1  7) | (1  9);
-   writel(val, gpio4-gpio_dir);
+   gpio_direction_output(GPIO_FEC_RESET_B, 0);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
 
mdelay(5);
 
debug(resetting phy\n);
 
/* turn on PHY power leaving reset asserted */
-   val = readl(gpio4-gpio_dr) | 1  9;
-   writel(val, gpio4-gpio_dr);
+   gpio_set_value(GPIO_FEC_ENABLE_B, 1);
 
mdelay(10);
 
@@ -107,19 +103,16 @@ void tx25_fec_init(void)
/*
 * set each to 1 and make each an output
 */
-   val = readl(gpio3-gpio_dr) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dr);
-   val = readl(gpio3-gpio_dir) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dir);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 10), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 11), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 12), 1);
 
mdelay(22); /* this value came from RedBoot */
 
/*
 * deassert PHY reset
 */
-   val = readl(gpio4-gpio_dr) | 1  7;
-   writel(val, gpio4-gpio_dr);
-   writel(val, gpio4-gpio_dr);
+   gpio_set_value(GPIO_FEC_RESET_B, 1);
 
mdelay(5);
 
-- 
1.7.4.1

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


Re: [U-Boot] [PATCH 1/3] imx25: Move MXC_GPIO_PORT_TO_NUM to imx-regs.h

2012-06-15 Thread Vikram Narayanan

Hi Stefano,

On 6/15/2012 8:25 PM, Stefano Babic wrote:

On 13/06/2012 13:37, Fabio Estevam wrote:

On Mon, Jun 11, 2012 at 12:02 PM, Vikram Narayananvikram...@gmail.com  wrote:


Also, this macro is useful not only for mx25, and it would be nice to
let it avaible for the other i.MX SoCs as well.



Agree. But I guess u-boot doesn't have a common folder where this can be put
up something like plat-mxc. So, I should think where to place this macro to
avoid duplicates in many header files. Any pointers?


Yes, a common folder would help indeed.

Copying Stefano, so that he could provide us some suggestion on this.


A general common folder helps - we have already an imx-common, whose
name was copied from omap-common we already head. At the moment, it
contains files common to i.MX5 and i.MX6. However, it is located under
armv7, and it is not accessible for other i.MX.

Really I am for a solution like in kernel, with a plat-mxc into
include/asm/, where we can put common things for all i.MX.


I'm with the same idea too. In this way we can avoid duplicate 
datastructures spread across many arch directories.


So, are there any opposers for this?

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


[U-Boot] [PATCH v3] tx25: Use generic gpio_* calls

2012-06-15 Thread Vikram Narayanan
Instead of manipulating gpio registers directly, use the calls
from the gpio library.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Acked-by: Stefano Babic sba...@denx.de
Cc: John Rigby jcri...@gmail.com
Cc: Fabio Estevam fabio.este...@freescale.com
---
Changes from v2:
Swap the place of the change log and commit message.

Changes from v1:
Used appropriate gpio_* lib calls.

 board/karo/tx25/tx25.c |   25 +
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..ff2de38 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -34,14 +34,13 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
+#define GPIO_FEC_RESET_B   MXC_GPIO_PORT_TO_NUM(4, 7)
+#define GPIO_FEC_ENABLE_B  MXC_GPIO_PORT_TO_NUM(4, 9)
 void tx25_fec_init(void)
 {
struct iomuxc_mux_ctl *muxctl;
struct iomuxc_pad_ctl *padctl;
-   u32 val;
u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
-   struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE;
-   struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE;
u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;
 
debug(tx25_fec_init\n);
@@ -66,18 +65,15 @@ void tx25_fec_init(void)
writel(0x0, padctl-pad_d11);
 
/* drop PHY power and assert reset (low) */
-   val = readl(gpio4-gpio_dr)  ~((1  7) | (1  9));
-   writel(val, gpio4-gpio_dr);
-   val = readl(gpio4-gpio_dir) | (1  7) | (1  9);
-   writel(val, gpio4-gpio_dir);
+   gpio_direction_output(GPIO_FEC_RESET_B, 0);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
 
mdelay(5);
 
debug(resetting phy\n);
 
/* turn on PHY power leaving reset asserted */
-   val = readl(gpio4-gpio_dr) | 1  9;
-   writel(val, gpio4-gpio_dr);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
 
mdelay(10);
 
@@ -107,19 +103,16 @@ void tx25_fec_init(void)
/*
 * set each to 1 and make each an output
 */
-   val = readl(gpio3-gpio_dr) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dr);
-   val = readl(gpio3-gpio_dir) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dir);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 10), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 11), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 12), 1);
 
mdelay(22); /* this value came from RedBoot */
 
/*
 * deassert PHY reset
 */
-   val = readl(gpio4-gpio_dr) | 1  7;
-   writel(val, gpio4-gpio_dr);
-   writel(val, gpio4-gpio_dr);
+   gpio_set_value(GPIO_FEC_RESET_B, 1);
 
mdelay(5);
 
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH 1/2] patman: Change the location of patman config file

2012-06-13 Thread Vikram Narayanan

Hello Wolfgang,

On 5/30/2012 11:04 AM, Simon Glass wrote:



On Wed, May 23, 2012 at 11:58 AM, Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com wrote:

Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com
Cc: Simon Glass s...@chromium.org mailto:s...@chromium.org
Cc: Wolfgang Denk w...@denx.de mailto:w...@denx.de


Acked-by: Simon Glass s...@chromium.org mailto:s...@chromium.org


Can you please consider this patch series? Both are acked by Simon.
If you have any issues in taking this in, please let me know.

Thanks,
Vikram



---
  tools/patman/README  |2 +-
  tools/patman/settings.py |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 7ba9e80..1af8665 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -68,7 +68,7 @@ How to configure it
  For most cases patman will locate and use the file 'doc/git-mailrc' in
  your U-Boot directory. This contains most of the aliases you will
need.

-To add your own, create a file ~/.config/patman directory like this:
+To add your own, create a file ~/.patman like this:

 
  # patman alias file
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 049c709..f980071 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -69,7 +69,7 @@ def Setup(config_fname=''):

 settings = ConfigParser.SafeConfigParser()
 if config_fname == '':
-config_fname = '%s/.config/patman' % os.getenv('HOME')
+config_fname = '%s/.patman' % os.getenv('HOME')
 if config_fname:
 settings.read(config_fname)

--
1.7.4.1





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


Re: [U-Boot] [PATCH v2] tx25: Use generic gpio_* calls

2012-06-13 Thread Vikram Narayanan

On 6/13/2012 1:22 PM, Stefano Babic wrote:

On 12/06/2012 18:37, Vikram Narayanan wrote:

Changes from v1:
Used appropriate gpio_* lib calls.

---
Instead of manipulating gpio registers directly, use the calls
from the gpio library.


Changelog must go after the --- line and commit message before. They
are swapped. Apart of that..


Sorry for the mix up of commit message and the change log.
Will send a v3 for this.

BTW, did someone test this on tx25?
@John: Any comments from your side?

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


Re: [U-Boot] [PATCH] mx6: Avoid writing to read-only bits in imximage.cfg

2012-06-13 Thread Vikram Narayanan

Hello Marek,

On 6/13/2012 5:57 PM, Marek Vasut wrote:

Dear Vikram Narayanan,


If in case this is valid according to the latest datasheet, ignore this
patch.

--
According to REV C manual, the register IOMUXC_IOMUXC_GPR4 has
bits 4 and 5 read-only and the value is always set as zero.
So write '0' to these bits instead of writing '1'.


I'm acking this as writing 0 to read-only bits is the only rightous thing to do.
btw. how did you find this? Good catch, praise on you :-)


:)
In the middle of writing a imximage.cfg file for a custom mx6 board.

Regards,
Vikram



Acked-by: Marek Vasutma...@denx.de


Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Jason Liur64...@freescale.com
Cc: Dirk Behmedirk.be...@googlemail.com
---
  board/freescale/mx6qarm2/imximage.cfg  |2 +-
  board/freescale/mx6qsabrelite/imximage.cfg |2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qarm2/imximage.cfg
b/board/freescale/mx6qarm2/imximage.cfg index ceecbf9..bf941a3 100644
--- a/board/freescale/mx6qarm2/imximage.cfg
+++ b/board/freescale/mx6qarm2/imximage.cfg
@@ -167,7 +167,7 @@ DATA 4 0x020c407c 0x0FC3
  DATA 4 0x020c4080 0x03FF

  # enable AXI cache for VDOA/VPU/IPU
-DATA 4 0x020e0010 0xF0FF
+DATA 4 0x020e0010 0xF0CF
  # set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7
  DATA 4 0x020e0018 0x007F007F
  DATA 4 0x020e001c 0x007F007F
diff --git a/board/freescale/mx6qsabrelite/imximage.cfg
b/board/freescale/mx6qsabrelite/imximage.cfg index c389427..62498ab 100644
--- a/board/freescale/mx6qsabrelite/imximage.cfg
+++ b/board/freescale/mx6qsabrelite/imximage.cfg
@@ -164,7 +164,7 @@ DATA 4 0x020c407c 0x0FC3
  DATA 4 0x020c4080 0x03FF

  # enable AXI cache for VDOA/VPU/IPU
-DATA 4 0x020e0010 0xF0FF
+DATA 4 0x020e0010 0xF0CF
  # set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7
  DATA 4 0x020e0018 0x007F007F
  DATA 4 0x020e001c 0x007F007F


Best regards,
Marek Vasut


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


[U-Boot] mx53loco build fails with CONFIG_VIDEO disabled

2012-06-13 Thread Vikram Narayanan

Hello,

mx53loco build fails when CONFIG_VIDEO and its friends disabled.
I can send a patch fixing this.

I _really_ don't like ifdef -ing a lot of stuff. Instead I'd feel to 
have a separate file in the directory which does this LCD init and FB 
init call, and let the makefile handle the conditional compilation.


@Fabio:
As you've pushed this stuff, I'd like to have your opinions on splitting 
this into a separate file.


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


Re: [U-Boot] [PATCH] mx6: Avoid writing to read-only bits in imximage.cfg

2012-06-13 Thread Vikram Narayanan

Hello Marek,

On 6/13/2012 10:45 PM, Marek Vasut wrote:

Dear Vikram Narayanan,


Hello Marek,

On 6/13/2012 5:57 PM, Marek Vasut wrote:

Dear Vikram Narayanan,


If in case this is valid according to the latest datasheet, ignore this
patch.

--
According to REV C manual, the register IOMUXC_IOMUXC_GPR4 has
bits 4 and 5 read-only and the value is always set as zero.
So write '0' to these bits instead of writing '1'.


I'm acking this as writing 0 to read-only bits is the only rightous thing
to do. btw. how did you find this? Good catch, praise on you :-)

:
:)

In the middle of writing a imximage.cfg file for a custom mx6 board.


So it did manifest somehow?


Still in progress. :)

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


Re: [U-Boot] mx53loco build fails with CONFIG_VIDEO disabled

2012-06-13 Thread Vikram Narayanan

On 6/13/2012 10:50 PM, Stefano Babic wrote:

On 13/06/2012 19:00, Vikram Narayanan wrote:

Hello,

mx53loco build fails when CONFIG_VIDEO and its friends disabled.
I can send a patch fixing this.



But CONFIG_VIDEO is *not* set in mx53loco.h mainline. Do you mean you
are testing Fabio's patches ?


With this (fedab338f3459315cb69627fcf46032ec8df1753) it is already in 
the master.



Fabio, can you give me an overview about your IPU patches ? I have seen
several patches during my vacation, but it is not clear to me the
status. In patchwork, most of them (but not all) are assigned to
Anatolji. Can you help me to sync myself with the current status ?


I _really_ don't like ifdef -ing a lot of stuff.


Nobody likes it ;-)


Instead I'd feel to
have a separate file in the directory which does this LCD init and FB
init call, and let the makefile handle the conditional compilation.


A way we use in the past to have different compilation of the same board
with different features is to use a separate entry into boards.cfg, for
example see imx31_phycore, or also magnesium and imx27lite, or...

Anyway, when patches for IPU flow into mainline, is there a good reason
to not enable CONFIG_VIDEO for mx53loco ?


Though this would be helpful for headless boards, I'm not the right guy. 
Fabio can give a better picture here.


Regards,
Vikram


Best regards,
Stefano


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


[U-Boot] [PATCH] mx6: Avoid writing to read-only bits in imximage.cfg

2012-06-12 Thread Vikram Narayanan
If in case this is valid according to the latest datasheet, ignore this patch.

--
According to REV C manual, the register IOMUXC_IOMUXC_GPR4 has
bits 4 and 5 read-only and the value is always set as zero.
So write '0' to these bits instead of writing '1'.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Jason Liu r64...@freescale.com
Cc: Dirk Behme dirk.be...@googlemail.com
---
 board/freescale/mx6qarm2/imximage.cfg  |2 +-
 board/freescale/mx6qsabrelite/imximage.cfg |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qarm2/imximage.cfg 
b/board/freescale/mx6qarm2/imximage.cfg
index ceecbf9..bf941a3 100644
--- a/board/freescale/mx6qarm2/imximage.cfg
+++ b/board/freescale/mx6qarm2/imximage.cfg
@@ -167,7 +167,7 @@ DATA 4 0x020c407c 0x0FC3
 DATA 4 0x020c4080 0x03FF
 
 # enable AXI cache for VDOA/VPU/IPU
-DATA 4 0x020e0010 0xF0FF
+DATA 4 0x020e0010 0xF0CF
 # set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7
 DATA 4 0x020e0018 0x007F007F
 DATA 4 0x020e001c 0x007F007F
diff --git a/board/freescale/mx6qsabrelite/imximage.cfg 
b/board/freescale/mx6qsabrelite/imximage.cfg
index c389427..62498ab 100644
--- a/board/freescale/mx6qsabrelite/imximage.cfg
+++ b/board/freescale/mx6qsabrelite/imximage.cfg
@@ -164,7 +164,7 @@ DATA 4 0x020c407c 0x0FC3
 DATA 4 0x020c4080 0x03FF
 
 # enable AXI cache for VDOA/VPU/IPU
-DATA 4 0x020e0010 0xF0FF
+DATA 4 0x020e0010 0xF0CF
 # set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7
 DATA 4 0x020e0018 0x007F007F
 DATA 4 0x020e001c 0x007F007F
-- 
1.7.4.1

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


[U-Boot] [PATCH v2] tx25: Use generic gpio_* calls

2012-06-12 Thread Vikram Narayanan
Changes from v1:
Used appropriate gpio_* lib calls.

---
Instead of manipulating gpio registers directly, use the calls
from the gpio library.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Fabio Estevam fabio.este...@freescale.com
Cc: John Rigby jcri...@gmail.com
Cc: Stefano Babic sba...@denx.de
---
 board/karo/tx25/tx25.c |   25 +
 1 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..ff2de38 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -34,14 +34,13 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
+#define GPIO_FEC_RESET_B   MXC_GPIO_PORT_TO_NUM(4, 7)
+#define GPIO_FEC_ENABLE_B  MXC_GPIO_PORT_TO_NUM(4, 9)
 void tx25_fec_init(void)
 {
struct iomuxc_mux_ctl *muxctl;
struct iomuxc_pad_ctl *padctl;
-   u32 val;
u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
-   struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE;
-   struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE;
u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;
 
debug(tx25_fec_init\n);
@@ -66,18 +65,15 @@ void tx25_fec_init(void)
writel(0x0, padctl-pad_d11);
 
/* drop PHY power and assert reset (low) */
-   val = readl(gpio4-gpio_dr)  ~((1  7) | (1  9));
-   writel(val, gpio4-gpio_dr);
-   val = readl(gpio4-gpio_dir) | (1  7) | (1  9);
-   writel(val, gpio4-gpio_dir);
+   gpio_direction_output(GPIO_FEC_RESET_B, 0);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
 
mdelay(5);
 
debug(resetting phy\n);
 
/* turn on PHY power leaving reset asserted */
-   val = readl(gpio4-gpio_dr) | 1  9;
-   writel(val, gpio4-gpio_dr);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
 
mdelay(10);
 
@@ -107,19 +103,16 @@ void tx25_fec_init(void)
/*
 * set each to 1 and make each an output
 */
-   val = readl(gpio3-gpio_dr) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dr);
-   val = readl(gpio3-gpio_dir) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dir);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 10), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 11), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 12), 1);
 
mdelay(22); /* this value came from RedBoot */
 
/*
 * deassert PHY reset
 */
-   val = readl(gpio4-gpio_dr) | 1  7;
-   writel(val, gpio4-gpio_dr);
-   writel(val, gpio4-gpio_dr);
+   gpio_set_value(GPIO_FEC_RESET_B, 1);
 
mdelay(5);
 
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH 2/3] tx25: Use generic gpio_* calls

2012-06-11 Thread Vikram Narayanan

Hi Fabio,

On 6/10/2012 8:08 PM, Fabio Estevam wrote:

On Sun, Jun 10, 2012 at 10:03 AM, Vikram Narayananvikram...@gmail.com  wrote:


/* drop PHY power and assert reset (low) */
-   val = readl(gpio4-gpio_dr)  ~((1  7) | (1  9));
-   writel(val,gpio4-gpio_dr);
-   val = readl(gpio4-gpio_dir) | (1  7) | (1  9);
-   writel(val,gpio4-gpio_dir);
+   gpio_direction_output(GPIO_FEC_RESET_B, 0);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
+
+   gpio_direction_output(GPIO_FEC_RESET_B, 1);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);


gpio_direction_output should be set only once for each GPIO.

After you set the direction (input or output) you should use
'gpio_set_value' for setting the GPIO to 0 or 1.


That was my understanding too. But some board file used it in the above 
way. Hope I got a wrong example. I'll fix this.



Also, please remove the:


+   gpio_direction_output(GPIO_FEC_RESET_B, 1);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);


lines, as the setting to 1 should be after the delay (via gpio_set_value).


Any idea about the delay value?

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


Re: [U-Boot] [PATCH 1/3] imx25: Move MXC_GPIO_PORT_TO_NUM to imx-regs.h

2012-06-11 Thread Vikram Narayanan

On 6/10/2012 8:03 PM, Fabio Estevam wrote:

Hi Vikram,

On Sun, Jun 10, 2012 at 10:02 AM, Vikram Narayananvikram...@gmail.com  wrote:


+
+/* Converts a GPIO port number and the internal bit position
+ * to the GPIO number
+ */
+#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit  0x1f))


Just a minor comment:

MXC_GPIO_PORT_TO_NUM looks like a very looong string.

Couldn't we use the same macro as in the Linux kernel (IMX_GPIO_NR) instead?

It is more concise and it would nice to have the same macro name for
kernel and U-boot.

What do you think?


Yes. That should be a better option. I'll go with it.

~Vikram


Thanks,

Fabio Estevam


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


Re: [U-Boot] [PATCH 1/3] imx25: Move MXC_GPIO_PORT_TO_NUM to imx-regs.h

2012-06-11 Thread Vikram Narayanan

Hello Fabio,

On 6/10/2012 8:33 PM, Fabio Estevam wrote:

On Sun, Jun 10, 2012 at 10:02 AM, Vikram Narayananvikram...@gmail.com  wrote:

Move the macro to imx-regs.h so that the other mx25 boards can
make use of it.

Signed-off-by: Vikram Narayananvikram...@gmail.com
---
  arch/arm/include/asm/arch-mx25/gpio.h |4 
  arch/arm/include/asm/arch-mx25/imx-regs.h |6 ++
  2 files changed, 6 insertions(+), 4 deletions(-)


Also, this macro is useful not only for mx25, and it would be nice to
let it avaible for the other i.MX SoCs as well.


Agree. But I guess u-boot doesn't have a common folder where this can be 
put up something like plat-mxc. So, I should think where to place this 
macro to avoid duplicates in many header files. Any pointers?


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


[U-Boot] imx: gpio cleanups

2012-06-10 Thread Vikram Narayanan
This patchset cleanups up the gpio related stuff on imx boards.
Define a common header for gpio and remove the same struct
defines in all the include directories.

Vikram Narayanan (3):
  imx25: Move MXC_GPIO_PORT_TO_NUM to imx-regs.h
  tx25: Use generic gpio_* calls
  imx: Define a common header file for gpio.h

 arch/arm/include/asm/arch-mx25/gpio.h  |   45 
 arch/arm/include/asm/arch-mx25/imx-regs.h  |6 +++
 arch/arm/include/asm/arch-mx31/gpio.h  |   35 ---
 arch/arm/include/asm/arch-mx35/gpio.h  |   40 -
 arch/arm/include/asm/arch-mx5/gpio.h   |   35 ---
 board/CarMediaLab/flea3/flea3.c|2 +-
 board/davedenx/qong/fpga.c |2 +-
 board/davedenx/qong/qong.c |2 +-
 board/denx/m28evk/m28evk.c |2 +-
 board/efikamx/efikamx-usb.c|2 +-
 board/efikamx/efikamx.c|2 +-
 board/esg/ima3-mx53/ima3-mx53.c|2 +-
 board/freescale/mx28evk/mx28evk.c  |2 +-
 board/freescale/mx35pdk/mx35pdk.c  |2 +-
 board/freescale/mx51evk/mx51evk.c  |2 +-
 board/freescale/mx53ard/mx53ard.c  |2 +-
 board/freescale/mx53evk/mx53evk.c  |2 +-
 board/freescale/mx53loco/mx53loco.c|2 +-
 board/freescale/mx53smd/mx53smd.c  |2 +-
 board/freescale/mx6qarm2/mx6qarm2.c|2 +-
 board/freescale/mx6qsabrelite/mx6qsabrelite.c  |2 +-
 board/karo/tx25/tx25.c |   30 ++---
 board/syteco/zmx25/zmx25.c |2 +-
 board/ttcontrol/vision2/vision2.c  |2 +-
 common/cmd_gpio.c  |2 +-
 drivers/gpio/mxc_gpio.c|2 +-
 .../asm/arch-mx6/gpio.h = drivers/gpio/mxc_gpio.h |   12 +++---
 drivers/spi/mxc_spi.c  |2 +-
 28 files changed, 46 insertions(+), 199 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-mx25/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx31/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx35/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx5/gpio.h
 rename arch/arm/include/asm/arch-mx6/gpio.h = drivers/gpio/mxc_gpio.h (85%)

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/3] imx25: Move MXC_GPIO_PORT_TO_NUM to imx-regs.h

2012-06-10 Thread Vikram Narayanan
Move the macro to imx-regs.h so that the other mx25 boards can
make use of it.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
---
 arch/arm/include/asm/arch-mx25/gpio.h |4 
 arch/arm/include/asm/arch-mx25/imx-regs.h |6 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
b/arch/arm/include/asm/arch-mx25/gpio.h
index dc6edc7..cc32d50 100644
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ b/arch/arm/include/asm/arch-mx25/gpio.h
@@ -25,10 +25,6 @@
 #ifndef __ASM_ARCH_MX25_GPIO_H
 #define __ASM_ARCH_MX25_GPIO_H
 
-/* Converts a GPIO port number and the internal bit position
- * to the GPIO number
- */
-#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit  0x1f))
 
 /* GPIO registers */
 struct gpio_regs {
diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h 
b/arch/arm/include/asm/arch-mx25/imx-regs.h
index cf925d7..1f67abb 100644
--- a/arch/arm/include/asm/arch-mx25/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
@@ -356,4 +356,10 @@ struct aips_regs {
 #define CHIP_REV_1_0   0x10
 #define CHIP_REV_1_1   0x11
 
+
+/* Converts a GPIO port number and the internal bit position
+ * to the GPIO number
+ */
+#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1)  5) + (bit  0x1f))
+
 #endif /* _IMX_REGS_H */
-- 
1.7.4.1


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


[U-Boot] [PATCH 2/3] tx25: Use generic gpio_* calls

2012-06-10 Thread Vikram Narayanan
Instead of manipulating gpio registers directly, use the calls
from the gpio library.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: John Rigby jcri...@gmail.com
Cc: Stefano Babic sba...@denx.de
---
 board/karo/tx25/tx25.c |   28 
 1 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 2a29943..6d03130 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -34,14 +34,13 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
+#define GPIO_FEC_RESET_B   MXC_GPIO_PORT_TO_NUM(4, 7)
+#define GPIO_FEC_ENABLE_B  MXC_GPIO_PORT_TO_NUM(4, 9)
 void tx25_fec_init(void)
 {
struct iomuxc_mux_ctl *muxctl;
struct iomuxc_pad_ctl *padctl;
-   u32 val;
u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
-   struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE;
-   struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE;
u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;
 
debug(tx25_fec_init\n);
@@ -66,18 +65,18 @@ void tx25_fec_init(void)
writel(0x0, padctl-pad_d11);
 
/* drop PHY power and assert reset (low) */
-   val = readl(gpio4-gpio_dr)  ~((1  7) | (1  9));
-   writel(val, gpio4-gpio_dr);
-   val = readl(gpio4-gpio_dir) | (1  7) | (1  9);
-   writel(val, gpio4-gpio_dir);
+   gpio_direction_output(GPIO_FEC_RESET_B, 0);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 0);
+
+   gpio_direction_output(GPIO_FEC_RESET_B, 1);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
 
mdelay(5);
 
debug(resetting phy\n);
 
/* turn on PHY power leaving reset asserted */
-   val = readl(gpio4-gpio_dr) | 1  9;
-   writel(val, gpio4-gpio_dr);
+   gpio_direction_output(GPIO_FEC_ENABLE_B, 1);
 
mdelay(10);
 
@@ -107,19 +106,16 @@ void tx25_fec_init(void)
/*
 * set each to 1 and make each an output
 */
-   val = readl(gpio3-gpio_dr) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dr);
-   val = readl(gpio3-gpio_dir) | (1  10) | (1  11) | (1  12);
-   writel(val, gpio3-gpio_dir);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 10), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 11), 1);
+   gpio_direction_output(MXC_GPIO_PORT_TO_NUM(3, 12), 1);
 
mdelay(22); /* this value came from RedBoot */
 
/*
 * deassert PHY reset
 */
-   val = readl(gpio4-gpio_dr) | 1  7;
-   writel(val, gpio4-gpio_dr);
-   writel(val, gpio4-gpio_dr);
+   gpio_direction_output(GPIO_FEC_RESET_B, 1);
 
mdelay(5);
 
-- 
1.7.4.1


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


[U-Boot] [PATCH 3/3] imx: Define a common header file for gpio.h

2012-06-10 Thread Vikram Narayanan
Remove redundant gpio_regs structure for every board and define a
common header for gpio_regs in the drivers/gpio directory. All the
board files needs to be changed to point to asm-generic/gpio.h
for gpio_* functions.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: John Rigby jcri...@gmail.com
Cc: Stefano Babic sba...@denx.de
Cc: Fabio Estevam fabio.este...@freescale.com
---
 arch/arm/include/asm/arch-mx25/gpio.h  |   41 
 arch/arm/include/asm/arch-mx31/gpio.h  |   35 -
 arch/arm/include/asm/arch-mx35/gpio.h  |   40 ---
 arch/arm/include/asm/arch-mx5/gpio.h   |   35 -
 board/CarMediaLab/flea3/flea3.c|2 +-
 board/davedenx/qong/fpga.c |2 +-
 board/davedenx/qong/qong.c |2 +-
 board/denx/m28evk/m28evk.c |2 +-
 board/efikamx/efikamx-usb.c|2 +-
 board/efikamx/efikamx.c|2 +-
 board/esg/ima3-mx53/ima3-mx53.c|2 +-
 board/freescale/mx28evk/mx28evk.c  |2 +-
 board/freescale/mx35pdk/mx35pdk.c  |2 +-
 board/freescale/mx51evk/mx51evk.c  |2 +-
 board/freescale/mx53ard/mx53ard.c  |2 +-
 board/freescale/mx53evk/mx53evk.c  |2 +-
 board/freescale/mx53loco/mx53loco.c|2 +-
 board/freescale/mx53smd/mx53smd.c  |2 +-
 board/freescale/mx6qarm2/mx6qarm2.c|2 +-
 board/freescale/mx6qsabrelite/mx6qsabrelite.c  |2 +-
 board/karo/tx25/tx25.c |2 +-
 board/syteco/zmx25/zmx25.c |2 +-
 board/ttcontrol/vision2/vision2.c  |2 +-
 common/cmd_gpio.c  |2 +-
 drivers/gpio/mxc_gpio.c|2 +-
 .../asm/arch-mx6/gpio.h = drivers/gpio/mxc_gpio.h |   12 +++---
 drivers/spi/mxc_spi.c  |2 +-
 27 files changed, 28 insertions(+), 179 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-mx25/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx31/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx35/gpio.h
 delete mode 100644 arch/arm/include/asm/arch-mx5/gpio.h
 rename arch/arm/include/asm/arch-mx6/gpio.h = drivers/gpio/mxc_gpio.h (85%)

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
b/arch/arm/include/asm/arch-mx25/gpio.h
deleted file mode 100644
index cc32d50..000
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, sba...@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
- */
-
-
-#ifndef __ASM_ARCH_MX25_GPIO_H
-#define __ASM_ARCH_MX25_GPIO_H
-
-
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;/* data */
-   u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
-   u32 icr1;   /* interrupt config 1 */
-   u32 icr2;   /* interrupt config 2 */
-   u32 imr;/* interrupt mask */
-   u32 isr;/* interrupt status */
-   u32 edge_sel;   /* edge select */
-};
-
-#endif
diff --git a/arch/arm/include/asm/arch-mx31/gpio.h 
b/arch/arm/include/asm/arch-mx31/gpio.h
deleted file mode 100644
index 95b73bf..000
--- a/arch/arm/include/asm/arch-mx31/gpio.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2011
- * Stefano Babic, DENX Software Engineering, sba...@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

Re: [U-Boot] imx: gpio cleanups

2012-06-10 Thread Vikram Narayanan

On 6/10/2012 6:31 PM, Vikram Narayanan wrote:

This patchset cleanups up the gpio related stuff on imx boards.
Define a common header for gpio and remove the same struct
defines in all the include directories.


As I don't have any mx25 based hardware, I've not tested it on any 
boards. Any testing report would be appreciated.


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


[U-Boot] IOMUX setting for NAND boot

2012-05-29 Thread Vikram Narayanan

Hello,

If I were to use NAND as a boot device on a custom i.Mx6 based hardware, 
should I mention the IOMUX ALT settings in the DCD headers for the NAND 
pins?


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


Re: [U-Boot] [PATCH V2] MPC8xxx: Define cache ops for USB

2012-05-25 Thread Vikram Narayanan

Hello Marek,

On 5/25/2012 7:44 PM, Marek Vasut wrote:

This patch conditionally defines flush_dcache_range() and
invalidate_dcache_range() on MPC8xxx, to avoid EHCI complaining,
resulting in the following output:

snip

+
+void invalidate_dcache_range(unsigned long start, unsigned long stop)
+{
+}
+
+void flush_dcache_range(unsigned long start, unsigned long stop)
+{
+}


Don't mind if this is a stupid question.
Can't this be placed in some common header?
Just to avoid code duplication!

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


Re: [U-Boot] [PATCH V5 RESEND 1/3] mtd/NAND: Add FSMC driver support

2012-05-24 Thread Vikram Narayanan

On 5/24/2012 10:58 AM, Amit Virdi wrote:

From: Vipin KUMARvipin.ku...@st.com

Flexible static memory controller is a peripheral provided by ST,
which controls the access to NAND chips along with many other
memory device chips eg NOR, SRAM.

This patch adds the driver support for FSMC controller interfacing
with NAND memory.

Signed-off-by: Vipin Kumarvipin.ku...@st.com
Signed-off-by: Amit Virdiamit.vi...@st.com
---
  drivers/mtd/nand/Makefile |1 +
  drivers/mtd/nand/fsmc_nand.c  |  487 +
  include/linux/mtd/fsmc_nand.h |  101 +
  3 files changed, 589 insertions(+), 0 deletions(-)
  create mode 100644 drivers/mtd/nand/fsmc_nand.c
  create mode 100644 include/linux/mtd/fsmc_nand.h

diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
index 1d1b628..29dc20e 100644
--- a/drivers/mtd/nand/Makefile
+++ b/drivers/mtd/nand/Makefile
@@ -49,6 +49,7 @@ COBJS-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
  COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o
  COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o
  COBJS-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o
+COBJS-$(CONFIG_NAND_FSMC) += fsmc_nand.o
  COBJS-$(CONFIG_NAND_JZ4740) += jz4740_nand.o
  COBJS-$(CONFIG_NAND_KB9202) += kb9202_nand.o
  COBJS-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
new file mode 100644
index 000..292fa8c
--- /dev/null
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -0,0 +1,487 @@
+/*
+ * (C) Copyright 2010
+ * Vipin Kumar, ST Micoelectronics, vipin.ku...@st.com.
+ *
+ * (C) Copyright 2012
+ * Amit Virdi, ST Micoelectronics, amit.vi...@st.com.


Fix the typo please. In all the copyright headers.

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


[U-Boot] [PATCH 0/2] patman: Various fixes

2012-05-23 Thread Vikram Narayanan

This fixes the location of patman config file from ~/.config/patman to
~/.patman. Also addresses the creation of new config file when it isn't
present.

Cc: Simon Glass s...@chromium.org
Cc: Wolfgang Denk w...@denx.de

Vikram Narayanan (2):
  patman: Change the location of patman config file
  patman: Handle creation of patman config file

 tools/patman/README  |5 -
 tools/patman/gitutil.py  |   18 ++
 tools/patman/settings.py |   39 +++
 3 files changed, 57 insertions(+), 5 deletions(-)

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


[U-Boot] [PATCH 1/2] patman: Change the location of patman config file

2012-05-23 Thread Vikram Narayanan
Move the config file from ~/.config/patman to ~/.patman as it is
more appropriate to have it there. Update the same in the README.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
Cc: Wolfgang Denk w...@denx.de 
---
 tools/patman/README  |2 +-
 tools/patman/settings.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 7ba9e80..1af8665 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -68,7 +68,7 @@ How to configure it
 For most cases patman will locate and use the file 'doc/git-mailrc' in
 your U-Boot directory. This contains most of the aliases you will need.
 
-To add your own, create a file ~/.config/patman directory like this:
+To add your own, create a file ~/.patman like this:
 
 
 # patman alias file
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 049c709..f980071 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -69,7 +69,7 @@ def Setup(config_fname=''):
 
 settings = ConfigParser.SafeConfigParser()
 if config_fname == '':
-config_fname = '%s/.config/patman' % os.getenv('HOME')
+config_fname = '%s/.patman' % os.getenv('HOME')
 if config_fname:
 settings.read(config_fname)
 
-- 
1.7.4.1


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


[U-Boot] [PATCH 2/2] patman: Handle creation of patman config file

2012-05-23 Thread Vikram Narayanan
patman shouts when it couldn't find a $(HOME)/.patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find there. Update the
same in the README

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Acked-by: Simon Glass s...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Wolfgang Denk w...@denx.de
---
 tools/patman/README  |3 +++
 tools/patman/gitutil.py  |   18 ++
 tools/patman/settings.py |   37 ++---
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 1af8665..86ede78 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -68,6 +68,9 @@ How to configure it
 For most cases patman will locate and use the file 'doc/git-mailrc' in
 your U-Boot directory. This contains most of the aliases you will need.
 
+During the first run patman creates a config file for you by taking the default
+user name and email address from the global .gitconfig file.
+
 To add your own, create a file ~/.patman like this:
 
 
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 48ca998..59eca99 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -357,6 +357,24 @@ def GetAliasFile():
 fname = os.path.join(GetTopLevel(), fname.strip())
 return fname
 
+def GetDefaultUserName():
+Gets the user.name from .gitconfig file.
+
+Returns:
+User name found in .gitconfig file, or None if none
+
+uname = command.OutputOneLine('git', 'config', '--global', 'user.name')
+return uname
+
+def GetDefaultUserEmail():
+Gets the user.email from the global .gitconfig file.
+
+Returns:
+User's email found in .gitconfig file, or None if none
+
+uemail = command.OutputOneLine('git', 'config', '--global', 'user.email')
+return uemail
+
 def Setup():
 Set up git utils, by reading the alias files.
 settings.Setup('')
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index f980071..4dda17b 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -24,7 +24,7 @@ import os
 import re
 
 import command
-
+import gitutil
 
 def ReadGitAliases(fname):
 Read a git alias file. This is in the form used by git:
@@ -61,6 +61,33 @@ def ReadGitAliases(fname):
 
 fd.close()
 
+def CreatePatmanConfigFile(config_fname):
+Creates a config file under $(HOME)/.patman if it can't find one.
+
+Args:
+config_fname: Default config filename i.e., $(HOME)/.patman
+
+Returns:
+None
+
+name = gitutil.GetDefaultUserName()
+if name == None:
+name = raw_input(Enter name: )
+
+email = gitutil.GetDefaultUserEmail()
+
+if email == None:
+email = raw_input(Enter email: )
+
+try:
+f = open(config_fname, 'w')
+except IOError:
+print Couldn't create patman config file\n
+raise
+
+print f, [alias]\nme: %s %s % (name, email)
+f.close();
+
 def Setup(config_fname=''):
 Set up the settings module by reading config files.
 
@@ -70,8 +97,12 @@ def Setup(config_fname=''):
 settings = ConfigParser.SafeConfigParser()
 if config_fname == '':
 config_fname = '%s/.patman' % os.getenv('HOME')
-if config_fname:
-settings.read(config_fname)
+
+if not os.path.exists(config_fname):
+print No config file found ~/.patman\nCreating one...\n
+CreatePatmanConfigFile(config_fname)
+
+settings.read(config_fname)
 
 for name, value in settings.items('alias'):
 alias[name] = value.split(',')
-- 
1.7.4.1


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


Re: [U-Boot] [PATCH v3] patman: Handle creation of patman config

2012-05-21 Thread Vikram Narayanan

Hello Wolfgang,

On 5/1/2012 10:37 AM, Simon Glass wrote:

On Mon, Apr 30, 2012 at 8:46 PM, Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com wrote:

patman shouts when it couldn't find a $(HOME)/.config/patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name http://user.name and user.email in the
global .gitconfig
file, waits for the user input if it can't find those.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com
Cc: Simon Glass s...@chromium.org mailto:s...@chromium.org


Acked-by: Simon Glass s...@chromium.org mailto:s...@chromium.org


Can you please take this patch in?

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


Re: [U-Boot] [PATCH 0/2] patman further fixes

2012-05-21 Thread Vikram Narayanan

Hello Simon,

On 5/8/2012 11:40 PM, Vikram Narayanan wrote:

Update README and source file with the new location of config file

Cc: Simon Glasss...@chromium.org

Vikram Narayanan (2):
   patman: Change the location of the config file
   patman: Update README

  tools/patman/README  |5 -
  tools/patman/settings.py |8 
  2 files changed, 8 insertions(+), 5 deletions(-)



Ping...

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


[U-Boot] [PATCH 0/2] patman further fixes

2012-05-08 Thread Vikram Narayanan
Update README and source file with the new location of config file

Cc: Simon Glass s...@chromium.org

Vikram Narayanan (2):
  patman: Change the location of the config file
  patman: Update README

 tools/patman/README  |5 -
 tools/patman/settings.py |8 
 2 files changed, 8 insertions(+), 5 deletions(-)

-- 
1.7.4.1

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


[U-Boot] [PATCH 1/2] patman: Change the location of the config file

2012-05-08 Thread Vikram Narayanan
Move the config file from ~/.config/patman to ~/.patman
as it is more appropriate to have it there.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
---
 tools/patman/settings.py |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 9b7e75d..4dda17b 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -62,10 +62,10 @@ def ReadGitAliases(fname):
 fd.close()
 
 def CreatePatmanConfigFile(config_fname):
-Creates a config file under $(HOME)/.config/ if it can't find one.
+Creates a config file under $(HOME)/.patman if it can't find one.
 
 Args:
-config_fname: Default config filename i.e., $(HOME)/.config/patman
+config_fname: Default config filename i.e., $(HOME)/.patman
 
 Returns:
 None
@@ -96,10 +96,10 @@ def Setup(config_fname=''):
 
 settings = ConfigParser.SafeConfigParser()
 if config_fname == '':
-config_fname = '%s/.config/patman' % os.getenv('HOME')
+config_fname = '%s/.patman' % os.getenv('HOME')
 
 if not os.path.exists(config_fname):
-print No config file found under ~/.config/\nCreating one...\n
+print No config file found ~/.patman\nCreating one...\n
 CreatePatmanConfigFile(config_fname)
 
 settings.read(config_fname)
-- 
1.7.4.1

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


[U-Boot] [PATCH 2/2] patman: Update README

2012-05-08 Thread Vikram Narayanan
Make changes in the README file with the new location of patman
config file. Also update the creation of config file.


Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
---
 tools/patman/README |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 7ba9e80..86ede78 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -68,7 +68,10 @@ How to configure it
 For most cases patman will locate and use the file 'doc/git-mailrc' in
 your U-Boot directory. This contains most of the aliases you will need.
 
-To add your own, create a file ~/.config/patman directory like this:
+During the first run patman creates a config file for you by taking the default
+user name and email address from the global .gitconfig file.
+
+To add your own, create a file ~/.patman like this:
 
 
 # patman alias file
-- 
1.7.4.1

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


Re: [U-Boot] [PATCH 0/2] patman further fixes

2012-05-08 Thread Vikram Narayanan

On 5/8/2012 11:40 PM, Vikram Narayanan wrote:

Update README and source file with the new location of config file


Please note that this patch depends on
patman: Handle creation of patman config patch, which is Acked but
not applied to the master yet.


Cc: Simon Glasss...@chromium.org

Vikram Narayanan (2):
   patman: Change the location of the config file
   patman: Update README

  tools/patman/README  |5 -
  tools/patman/settings.py |8 
  2 files changed, 8 insertions(+), 5 deletions(-)



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


Re: [U-Boot] [PATCH v2 2/4] patman: Add meaningful statements instead of blah blah

2012-04-30 Thread Vikram Narayanan

Hello Wolfgang,

On 4/30/2012 1:14 PM, Wolfgang Denk wrote:

Dear Vikram Narayanan,

In message4f9acbb8.2040...@gmail.com  you wrote:

Add example statements for commit message and series messages

Signed-off-by: Vikram Narayananvikram...@gmail.com
Cc: Simon Glasss...@chromium.org
---
  tools/patman/README |9 -
  1 files changed, 4 insertions(+), 5 deletions(-)


snip

I'm not sure this is an improvement. Your example messages are pretty
much specific, so people in completely different situations will not
find much help in them either.

I suggest we leave the text as is.  What do you think?


Yes. Then, its better to leave as it is.

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


Re: [U-Boot] [PATCH v2 4/4] patman: Handle creation of patman config

2012-04-30 Thread Vikram Narayanan

Hello Wolfgang,

On 4/30/2012 2:14 PM, Wolfgang Denk wrote:

Dear Vikram  Simon,

In message4f9acbd1.1080...@gmail.com  you wrote:


patman shouts when it couldn't find a $(HOME)/.config/patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find those.


I have a more general question here:  Why is the config file in
$(HOME)/.config/patman  (instead for example $(HOME)/.patman) ?

My understanding is that $(HOME)/.config/ is defined by the XDG Base
Directory Specification - but patman has nothign to do with the X11
desktop - or has it?


Your argument is right. But Simon is the right person for answering this 
as he is the one who pushed patman.


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


Re: [U-Boot] [PATCH v2 4/4] patman: Handle creation of patman config

2012-04-30 Thread Vikram Narayanan

On 4/30/2012 11:07 PM, Simon Glass wrote:

Hi Vikram,

On Fri, Apr 27, 2012 at 9:39 AM, Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com wrote:


patman shouts when it couldn't find a $(HOME)/.config/patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name http://user.name and user.email in the
global .gitconfig
file, waits for the user input if it can't find those.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
mailto:vikram...@gmail.com
Cc: Simon Glass s...@chromium.org mailto:s...@chromium.org


Acked-by: Simon Glass s...@chromium.org mailto:s...@chromium.org

In terms of changing the config file to ~/.patman, this could actually
be a subsequent patch if you like. But there are a few nits below if you
re-issue.



I feel that can be dealt in a separate patch which follows this. For the 
few nits, I'll send a v3 _only_ for this patch and not for the whole 
series as the other two are ACK'ed and one is decided not to be ACK'ed.


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


[U-Boot] [PATCH v3] patman: Handle creation of patman config

2012-04-30 Thread Vikram Narayanan
patman shouts when it couldn't find a $(HOME)/.config/patman file.
Handle it in a sane way by creating a new one for the user.
It looks for a user.name and user.email in the global .gitconfig
file, waits for the user input if it can't find those.

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org

---
 tools/patman/gitutil.py  |   18 ++
 tools/patman/settings.py |   37 ++---
 2 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 48ca998..59eca99 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -357,6 +357,24 @@ def GetAliasFile():
 fname = os.path.join(GetTopLevel(), fname.strip())
 return fname
 
+def GetDefaultUserName():
+Gets the user.name from .gitconfig file.
+
+Returns:
+User name found in .gitconfig file, or None if none
+
+uname = command.OutputOneLine('git', 'config', '--global', 'user.name')
+return uname
+
+def GetDefaultUserEmail():
+Gets the user.email from the global .gitconfig file.
+
+Returns:
+User's email found in .gitconfig file, or None if none
+
+uemail = command.OutputOneLine('git', 'config', '--global', 'user.email')
+return uemail
+
 def Setup():
 Set up git utils, by reading the alias files.
 settings.Setup('')
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 049c709..9b7e75d 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -24,7 +24,7 @@ import os
 import re
 
 import command
-
+import gitutil
 
 def ReadGitAliases(fname):
 Read a git alias file. This is in the form used by git:
@@ -61,6 +61,33 @@ def ReadGitAliases(fname):
 
 fd.close()
 
+def CreatePatmanConfigFile(config_fname):
+Creates a config file under $(HOME)/.config/ if it can't find one.
+
+Args:
+config_fname: Default config filename i.e., $(HOME)/.config/patman
+
+Returns:
+None
+
+name = gitutil.GetDefaultUserName()
+if name == None:
+name = raw_input(Enter name: )
+
+email = gitutil.GetDefaultUserEmail()
+
+if email == None:
+email = raw_input(Enter email: )
+
+try:
+f = open(config_fname, 'w')
+except IOError:
+print Couldn't create patman config file\n
+raise
+
+print f, [alias]\nme: %s %s % (name, email)
+f.close();
+
 def Setup(config_fname=''):
 Set up the settings module by reading config files.
 
@@ -70,8 +97,12 @@ def Setup(config_fname=''):
 settings = ConfigParser.SafeConfigParser()
 if config_fname == '':
 config_fname = '%s/.config/patman' % os.getenv('HOME')
-if config_fname:
-settings.read(config_fname)
+
+if not os.path.exists(config_fname):
+print No config file found under ~/.config/\nCreating one...\n
+CreatePatmanConfigFile(config_fname)
+
+settings.read(config_fname)
 
 for name, value in settings.items('alias'):
 alias[name] = value.split(',')
-- 
1.7.4.1

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


[U-Boot] [PATCH v2 0/4] patman fixes

2012-04-27 Thread Vikram Narayanan

This patchset fixes a few typo. And also addresses creation of patman
config file.

Changes from v1:
Improved the patch with comments from Simon Glass

Vikram Narayanan (4):
  patman: Fix a typo error
  patman: Add meaningful statements instead of blah blah
  patman: Change the location of patman path
  patman: Handle creation of patman config

 tools/patman/README  |   17 -
 tools/patman/gitutil.py  |   18 ++
 tools/patman/settings.py |   34 +++---
 3 files changed, 57 insertions(+), 12 deletions(-)

--
1.7.4.1

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


[U-Boot] [PATCH v2 1/4] patman: Fix a typo error

2012-04-27 Thread Vikram Narayanan

Replace gti with git in README file

Signed-off-by: Vikram Narayanan vikram...@gmail.com
Cc: Simon Glass s...@chromium.org
---
 tools/patman/README |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index 587c97f..d9820ab 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -197,7 +197,7 @@ patch series and see how the patches turn out.
 Where Patches Are Sent
 ==
 
-Once the patches are created, patman sends them using gti send-email. The
+Once the patches are created, patman sends them using git send-email. The
 whole series is sent to the recipients in Series-to: and Series-cc.
 You can Cc individual patches to other people with the Cc: tag. Tags in the
 subject are also picked up to Cc patches. For example, a commit like this:
-- 
1.7.4.1

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


  1   2   >