[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 
Cc: Wolfgang Denk 

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 
Cc: Simon Glass 
Cc: Wolfgang Denk  
---
 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 
Acked-by: Simon Glass 
Cc: Simon Glass 
Cc: Wolfgang Denk 
---
 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 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 KUMAR

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 Kumar
Signed-off-by: Amit Virdi
---
  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


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:



+
+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


[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


[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 
---
 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 
Cc: John Rigby 
Cc: Stefano Babic 
---
 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 
Cc: John Rigby 
Cc: Stefano Babic 
Cc: Fabio Estevam 
---
 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, 
- *
- * 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, 
- *
- * 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; 

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


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 Narayanan  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 Narayanan  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 Narayanan  wrote:

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

Signed-off-by: Vikram Narayanan
---
  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] [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 
Cc: Jason Liu 
Cc: Dirk Behme 
---
 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 
Cc: Fabio Estevam 
Cc: John Rigby 
Cc: Stefano Babic 
---
 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 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 mailto:vikram...@gmail.com>>
Cc: Simon Glass mailto:s...@chromium.org>>
Cc: Wolfgang Denk mailto:w...@denx.de>>


Acked-by: Simon Glass 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 Vasut


Signed-off-by: Vikram Narayanan
Cc: Jason Liu
Cc: Dirk Behme
---
  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


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 Narayanan  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 
Acked-by: Stefano Babic 
Cc: John Rigby 
Cc: Fabio Estevam 
---
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


[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 
Acked-by: Stefano Babic 
Cc: John Rigby 
Cc: Fabio Estevam 
---
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


[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 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 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 
 #include 
 #include 
-#include 
-#include 
-
-#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 
+ *
+ * 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

[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 
Cc: Fabio Estevam 
Cc: Stefano Babic 
---
 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 
 #include 
 #include 
-#include 
-#include 
-
-#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
setenv("stdout", "serial");
-
+#endi

[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 
Cc: Stephen Warren 
Cc: Albert Aribaud 
---
 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
+ * 
+ *
+ * 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
+ * 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+
+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(®->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, &pio))
+   return -1;
+
+   val = re

[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 
Cc: Stephen Warren 
Cc: Albert Aribaud 
---
 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


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


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


[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 
Cc: Albert Aribaud 

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 
Cc: Stephen Warren 
Cc: Albert Aribaud 
---
 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
+ * 
+ *
+ * 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
+ * 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+
+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 *)BCM2835_GPIO_BASE;
+   unsigned val;
+
+   val = readl(®->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)])

[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 
---
 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


[U-Boot] [PATCH 0/4] Cosmetic changes in imx gpio driver

2012-04-04 Thread Vikram Narayanan

Some cosmetic changes in the imx gpio driver.

Vikram Narayanan(4):
 imx: Add GPIO_TO_PORT macro
 imx: Use GPIO_TO_PORT macro instead of (gpio >> 5)
 imx: Return gpio_set_value in gpio_direction_output

 arch/arm/include/asm/arch-mx5/gpio.h |2 ++
 arch/arm/include/asm/arch-mx6/gpio.h |2 ++
 drivers/gpio/mxc_gpio.c  |   11 +--
 3 files changed, 9 insertions(+), 6 deletions(-)

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


[U-Boot] [PATCH 3/3] imx: Return gpio_set_value in gpio_direction_output

2012-04-04 Thread Vikram Narayanan
imx: Return gpio_set_value in gpio_direction_output

Signed-off-by: Vikram Narayanan 
---
 drivers/gpio/mxc_gpio.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
 100.0% drivers/gpio/

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index c4ef001..147c2c9 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -144,6 +144,5 @@ int gpio_direction_output(unsigned gpio, int value)
if (ret < 0)
return ret;
 
-   gpio_set_value(gpio, value);
-   return 0;
+   return gpio_set_value(gpio, value);
 }
-- 
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/4] Cosmetic changes in imx gpio driver

2012-04-04 Thread Vikram Narayanan

Sorry for the subject. It should have been [PATCH 0/3]
A small typo.

On 4/4/2012 9:33 PM, Vikram Narayanan wrote:

Some cosmetic changes in the imx gpio driver.

Vikram Narayanan(4):
imx: Add GPIO_TO_PORT macro
imx: Use GPIO_TO_PORT macro instead of (gpio >> 5)
imx: Return gpio_set_value in gpio_direction_output

arch/arm/include/asm/arch-mx5/gpio.h | 2 ++
arch/arm/include/asm/arch-mx6/gpio.h | 2 ++
drivers/gpio/mxc_gpio.c | 11 +--
3 files changed, 9 insertions(+), 6 deletions(-)

Thanks,
Vikram


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


[U-Boot] [PATCH 1/3] imx: Add GPIO_TO_PORT macro

2012-04-04 Thread Vikram Narayanan
imx: Add GPIO_TO_PORT macro

Signed-off-by: Vikram Narayanan 
---
 arch/arm/include/asm/arch-mx5/gpio.h |2 ++
 arch/arm/include/asm/arch-mx6/gpio.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
  50.0% arch/arm/include/asm/arch-mx5/
  50.0% arch/arm/include/asm/arch-mx6/

diff --git a/arch/arm/include/asm/arch-mx5/gpio.h 
b/arch/arm/include/asm/arch-mx5/gpio.h
index 1dc34e9..bcb5edb 100644
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ b/arch/arm/include/asm/arch-mx5/gpio.h
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
+#define GPIO_TO_PORT(number)   (number/32)
+
 /* GPIO registers */
 struct gpio_regs {
u32 gpio_dr;
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h 
b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e57..385d12d 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,6 +25,8 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
+#define GPIO_TO_PORT(number)   (number/32)
+
 /* GPIO registers */
 struct gpio_regs {
u32 gpio_dr;
-- 
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] imx: Use GPIO_TO_PORT macro instead of (gpio >> 5)

2012-04-04 Thread Vikram Narayanan
imx: Use GPIO_TO_PORT macro instead of (gpio >> 5)

Signed-off-by: Vikram Narayanan 
---
 drivers/gpio/mxc_gpio.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)
 100.0% drivers/gpio/

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index df6..c4ef001 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -53,7 +53,7 @@ static unsigned long gpio_ports[] = {
 static int mxc_gpio_direction(unsigned int gpio,
enum mxc_gpio_direction direction)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 l;
 
@@ -80,7 +80,7 @@ static int mxc_gpio_direction(unsigned int gpio,
 
 int gpio_set_value(unsigned gpio, int value)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 l;
 
@@ -103,7 +103,7 @@ int gpio_set_value(unsigned gpio, int value)
 
 int gpio_get_value(unsigned gpio)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 val;
 
@@ -121,7 +121,7 @@ int gpio_get_value(unsigned gpio)
 
 int gpio_request(unsigned gpio, const char *label)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
if (port >= ARRAY_SIZE(gpio_ports))
return -1;
return 0;
-- 
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] imx: Add GPIO_TO_PORT macro

2012-04-09 Thread Vikram Narayanan

Hello Dirk,

On 4/9/2012 11:03 AM, Dirk Behme wrote:

Dear Vikram ,

On 06.04.2012 10:56, Stefano Babic wrote:

On 04/04/2012 18:05, Vikram Narayanan wrote:

imx: Add GPIO_TO_PORT macro

Signed-off-by: Vikram Narayanan


Hi,


---
arch/arm/include/asm/arch-mx5/gpio.h | 2 ++
arch/arm/include/asm/arch-mx6/gpio.h | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)
50.0% arch/arm/include/asm/arch-mx5/
50.0% arch/arm/include/asm/arch-mx6/

diff --git a/arch/arm/include/asm/arch-mx5/gpio.h
b/arch/arm/include/asm/arch-mx5/gpio.h
index 1dc34e9..bcb5edb 100644
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ b/arch/arm/include/asm/arch-mx5/gpio.h
@@ -25,6 +25,8 @@
#ifndef __ASM_ARCH_MX5_GPIO_H
#define __ASM_ARCH_MX5_GPIO_H

+#define GPIO_TO_PORT(number) (number/32)
+
/* GPIO registers */
struct gpio_regs {
u32 gpio_dr;
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h
b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e57..385d12d 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,6 +25,8 @@
#ifndef __ASM_ARCH_MX6_GPIO_H
#define __ASM_ARCH_MX6_GPIO_H

+#define GPIO_TO_PORT(number) (number/32)
+
/* GPIO registers */
struct gpio_regs {
u32 gpio_dr;


NAK. We have already (and probably too many) GPIO_TO_PORT:

arch/arm/include/asm/arch-mx6/imx-regs.h:#define GPIO_TO_PORT(number)
(((number)/32)+1)
arch/arm/include/asm/arch-mx5/mx5x_pins.h:#define GPIO_TO_PORT(n)
(n / GPIO_NUM_PIN)

Are they not enough ?


@Stefano: Yeah. Just didn't notice it. Will resend it.



Vikram, it seems to me you sent the already NAKed patch to me

https://github.com/dirkbehme/u-boot-imx6/pull/2

again?



Sorry, something went wrong with my filter settings in my mailbox. I 
wasn't aware that it got NACked. Sorry for sending a pull req anyways.



Please send U-Boot patches only to this U-Boot mailing list.


Sure. From now on!


Dirk


~Vikram

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


Re: [U-Boot] [PATCH 1/3] imx: Add GPIO_TO_PORT macro

2012-04-09 Thread Vikram Narayanan

Hi,

On 4/6/2012 2:26 PM, Stefano Babic wrote:

On 04/04/2012 18:05, Vikram Narayanan wrote:

imx: Add GPIO_TO_PORT macro

Signed-off-by: Vikram Narayanan


Hi,


---
  arch/arm/include/asm/arch-mx5/gpio.h |2 ++
  arch/arm/include/asm/arch-mx6/gpio.h |2 ++
  2 files changed, 4 insertions(+), 0 deletions(-)
   50.0% arch/arm/include/asm/arch-mx5/
   50.0% arch/arm/include/asm/arch-mx6/

diff --git a/arch/arm/include/asm/arch-mx5/gpio.h 
b/arch/arm/include/asm/arch-mx5/gpio.h
index 1dc34e9..bcb5edb 100644
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ b/arch/arm/include/asm/arch-mx5/gpio.h
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX5_GPIO_H
  #define __ASM_ARCH_MX5_GPIO_H

+#define GPIO_TO_PORT(number)   (number/32)
+
  /* GPIO registers */
  struct gpio_regs {
u32 gpio_dr;
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h 
b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e57..385d12d 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,6 +25,8 @@
  #ifndef __ASM_ARCH_MX6_GPIO_H
  #define __ASM_ARCH_MX6_GPIO_H

+#define GPIO_TO_PORT(number)   (number/32)
+
  /* GPIO registers */
  struct gpio_regs {
u32 gpio_dr;


NAK. We have already (and probably too many) GPIO_TO_PORT:


Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include 
#elif defined(CONFIG_MX6)
#include 
#endif
. etc

Why not define the GPIO_TO_PORT macro in the driver? Anyways for all its 
the same 32 pins. Any suggestions/flames?


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] imx: Add GPIO_TO_PORT macro

2012-04-09 Thread Vikram Narayanan

Hi Stefano,

On 4/10/2012 4:01 AM, stefano babic wrote:

Am 09/04/2012 18:09, schrieb Vikram Narayanan:

Hi,



Hi,



Yes. You are right.
So, instead of defining all the headers this way,

#if defined(CONFIG_MX53) || defined(CONFIG_MX51)
#include
#elif defined(CONFIG_MX6)
#include
#endif
. etc



We have not this code - I cannot find in u-boot, and wedo not want to
introduce it. As you say, it is nasty. Where have you find it ?


I don't find it anyway. If I want to use the existing macro, it would 
result in this.



There is no driver including mx*_pins.h. At the moment, only board
specific code includes the SOC specific pin header.



Why not define the GPIO_TO_PORT macro in the driver?


Maybe there was some use of the macro outside the driver in the past. I
think before i.MX code was adapted to use common gpio_ functions, boards
are used to write directly into the registers of the GPIO controller.

I do not see any track of the macro in the current tree. So yes, we can
move GPIO_ macros inside the driver.


Sure. I'll just do that.


Anyways for all its
the same 32 pins. Any suggestions/flames?


It seems to me also that the defined GPIO_PORT for MX6 is wrong.

arch/arm/include/asm/arch-mx6/imx-regs.h:

#define GPIO_TO_PORT(number)(((number)/32)+1)

Why is the port starting from 1 ? It is wrong, but really GPIO_TO_PORT()
is not used anymore.


Yes. You are right. I'll send the v2 for this.

Thanks for your response,
Vikram


Best regards,
Stefano Babic



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


[U-Boot] [PATCH v2 0/4] imx: header/gpio driver cleanups

2012-04-10 Thread Vikram Narayanan

 arch/arm/include/asm/arch-mx35/mx35_pins.h |2 --
 arch/arm/include/asm/arch-mx5/mx5x_pins.h  |2 --
 arch/arm/include/asm/arch-mx6/imx-regs.h   |2 --
 drivers/gpio/mxc_gpio.c|   12 ++--
 4 files changed, 6 insertions(+), 12 deletions(-)

Changed from v1:
Dropped defining extra GPIO_TO_PORT macros

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


[U-Boot] [PATCH v2 1/4] imx: Remove unneeded/repititive definitions from imx headers

2012-04-10 Thread Vikram Narayanan
Remove gpio related unused/repititive definitions from imx headers.

Signed-off-by: Vikram Narayanan 
---
 arch/arm/include/asm/arch-mx35/mx35_pins.h |2 --
 arch/arm/include/asm/arch-mx5/mx5x_pins.h  |2 --
 arch/arm/include/asm/arch-mx6/imx-regs.h   |2 --
 3 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx35/mx35_pins.h 
b/arch/arm/include/asm/arch-mx35/mx35_pins.h
index 3676e33..8c38139 100644
--- a/arch/arm/include/asm/arch-mx35/mx35_pins.h
+++ b/arch/arm/include/asm/arch-mx35/mx35_pins.h
@@ -84,8 +84,6 @@
GPIO_NUM_PIN) + ((pin >> MUX_IO_I) &\
((1 << (MUX_IO_P - MUX_IO_I)) - 1)))
 #define IOMUX_TO_IRQ(pin)   (MXC_GPIO_INT_BASE + IOMUX_TO_GPIO(pin))
-#define GPIO_TO_PORT(n) (n / GPIO_NUM_PIN)
-#define GPIO_TO_INDEX(n)(n % GPIO_NUM_PIN)
 
 #define NON_GPIO_I 0x7
 #define PIN_TO_MUX_MASK((1<<(PAD_I - MUX_I)) - 1)
diff --git a/arch/arm/include/asm/arch-mx5/mx5x_pins.h 
b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
index 4e3a31b..122fbee 100644
--- a/arch/arm/include/asm/arch-mx5/mx5x_pins.h
+++ b/arch/arm/include/asm/arch-mx5/mx5x_pins.h
@@ -78,8 +78,6 @@
GPIO_NUM_PIN) + ((pin >> MUX_IO_I) &\
((1 << (MUX_IO_P - MUX_IO_I)) - 1)))
 #define IOMUX_TO_IRQ(pin)   (MXC_GPIO_INT_BASE + IOMUX_TO_GPIO(pin))
-#define GPIO_TO_PORT(n) (n / GPIO_NUM_PIN)
-#define GPIO_TO_INDEX(n)(n % GPIO_NUM_PIN)
 
 #define NON_GPIO_PORT  0x7
 #define PIN_TO_MUX_MASK((1 << (PAD_I - MUX_I)) - 1)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index cad957a..27ecb75 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -168,8 +168,6 @@
 #define FEC_QUIRK_ENET_MAC
 
 #define GPIO_NUMBER(port, index)   port)-1)*32)+((index)&31))
-#define GPIO_TO_PORT(number)   (((number)/32)+1)
-#define GPIO_TO_INDEX(number)  ((number)&31)
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include 
-- 
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 2/4] imx: Add GPIO_TO_PORT macro in the mxc_gpio driver

2012-04-10 Thread Vikram Narayanan
Add GPIO_TO_PORT macro in the mxc_gpio.c driver

Signed-off-by: Vikram Narayanan 
---
 drivers/gpio/mxc_gpio.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index df6..7e65b39 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -34,6 +34,7 @@ enum mxc_gpio_direction {
MXC_GPIO_DIRECTION_OUT,
 };
 
+#define GPIO_TO_PORT(n)(n / 32)
 
 /* GPIO port description */
 static unsigned long gpio_ports[] = {
-- 
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 3/4] imx: Use GPIO_TO_PORT macro in the gpio driver instead of (gpio >> 5)

2012-04-10 Thread Vikram Narayanan
Use the defined GPIO_TO_PORT macro. Remove gpio >> 5 references.

Signed-off-by: Vikram Narayanan 
---
 drivers/gpio/mxc_gpio.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 7e65b39..21b1cdc 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -54,7 +54,7 @@ static unsigned long gpio_ports[] = {
 static int mxc_gpio_direction(unsigned int gpio,
enum mxc_gpio_direction direction)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 l;
 
@@ -81,7 +81,7 @@ static int mxc_gpio_direction(unsigned int gpio,
 
 int gpio_set_value(unsigned gpio, int value)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 l;
 
@@ -104,7 +104,7 @@ int gpio_set_value(unsigned gpio, int value)
 
 int gpio_get_value(unsigned gpio)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
struct gpio_regs *regs;
u32 val;
 
@@ -122,7 +122,7 @@ int gpio_get_value(unsigned gpio)
 
 int gpio_request(unsigned gpio, const char *label)
 {
-   unsigned int port = gpio >> 5;
+   unsigned int port = GPIO_TO_PORT(gpio);
if (port >= ARRAY_SIZE(gpio_ports))
return -1;
return 0;
-- 
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 4/4] imx: Return gpio_set_value in gpio_direction_output

2012-04-10 Thread Vikram Narayanan
Return gpio_set_value in gpio_direction_output.
Earlier it returned 0 and ignored gpio_set_value's return value.

Signed-off-by: Vikram Narayanan 
---
 drivers/gpio/mxc_gpio.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 21b1cdc..f1b1c16 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -145,6 +145,5 @@ int gpio_direction_output(unsigned gpio, int value)
if (ret < 0)
return ret;
 
-   gpio_set_value(gpio, value);
-   return 0;
+   return gpio_set_value(gpio, value);
 }
-- 
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/4] Cleanups/fixes in patman tool

2012-04-25 Thread Vikram Narayanan

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

 tools/patman/README  |   17 -
 tools/patman/settings.py |   26 --
 2 files changed, 32 insertions(+), 11 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/4] patman: Fix a typo error

2012-04-25 Thread Vikram Narayanan

Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 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


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

2012-04-25 Thread Vikram Narayanan
Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 tools/patman/README |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index d9820ab..d98f081 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -132,16 +132,15 @@ Series-prefix: prefix
 
 Cover-letter:
 This is the patch set title
-blah blah
-more blah blah
+This patch set fixes the errors when CONFIG_xxx is enabled.
+Tested on xyz board.
 END
Sets the cover letter contents for the series. The first line
will become the subject of the cover letter
 
 Series-notes:
-blah blah
-blah blah
-more blah blah
+Sorry that I couldn't find time to reply for the comments posted on the v1 of 
my
+patch. This patch superseeds v1. Please comment.
 END
Sets some notes for the patch series, which you don't want in
the commit messages, but do want to send, The notes are joined
-- 
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/4] patman: Change the location of patman path in README

2012-04-25 Thread Vikram Narayanan

Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 tools/patman/README |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index d98f081..4913510 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -93,17 +93,17 @@ How to run it

 First do a dry run:

-$ ./tools/scripts/patman/patman -n
+$ ./tools/patman/patman -n

 If it can't detect the upstream branch, try telling it how many patches
 there are in your series:

-$ ./tools/scripts/patman/patman -n -c5
+$ ./tools/patman/patman -n -c5

 This will create patch files in your current directory and tell you who
 it is thinking of sending them to. Take a look at the patch files.

-$ ./tools/scripts/patman/patman -n -c5 -s1
+$ ./tools/patman/patman -n -c5 -s1

 Similar to the above, but skip the first commit and take the next 5. This
 is useful if your top commit is for setting up testing.
--
1.7.4.1

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


[U-Boot] PATCH 4/4] patman: Handle searching of patman config

2012-04-25 Thread Vikram Narayanan
patman shouts when it couldn't find a $(HOME)/.config/patman file.
Also, it couldn't create patch files without the above config file.
Handle it in a sane way by creating a new one for the user.


Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 tools/patman/settings.py |   26 --
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 049c709..ea8661b 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -61,6 +61,22 @@ def ReadGitAliases(fname):
 
 fd.close()
 
+def CreatePatmanConfigFile(config_fname):
+name = raw_input("Enter name: ")
+email = raw_input("Enter email: ")
+
+try:
+FILE = open(config_fname,"w")
+except IOError:
+print "Couldn't create patman config file\n"
+
+FILE.write("[alias]\nme: ")
+FILE.write(name);
+FILE.write(" <");
+FILE.write(email);
+FILE.write(">")
+FILE.close();
+
 def Setup(config_fname=''):
 """Set up the settings module by reading config files.
 
@@ -70,8 +86,14 @@ 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)
+
+exists = os.path.exists(config_fname)
+
+if exists == False:
+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 
Cc: Simon Glass 
---
 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


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

2012-04-27 Thread Vikram Narayanan
Add example statements for commit message and series messages

Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 tools/patman/README |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index d9820ab..d98f081 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -132,16 +132,15 @@ Series-prefix: prefix
 
 Cover-letter:
 This is the patch set title
-blah blah
-more blah blah
+This patch set fixes the errors when CONFIG_xxx is enabled.
+Tested on xyz board.
 END
Sets the cover letter contents for the series. The first line
will become the subject of the cover letter
 
 Series-notes:
-blah blah
-blah blah
-more blah blah
+Sorry that I couldn't find time to reply for the comments posted on the v1 of 
my
+patch. This patch supersedes v1. Please comment.
 END
Sets some notes for the patch series, which you don't want in
the commit messages, but do want to send, The notes are joined
-- 
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 3/4] patman: Change the location of patman path

2012-04-27 Thread Vikram Narayanan
Fix the location of patman path in README

Signed-off-by: Vikram Narayanan 
Cc: Simon Glass 
---
 tools/patman/README |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/patman/README b/tools/patman/README
index d98f081..4913510 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -93,17 +93,17 @@ How to run it
 
 First do a dry run:
 
-$ ./tools/scripts/patman/patman -n
+$ ./tools/patman/patman -n
 
 If it can't detect the upstream branch, try telling it how many patches
 there are in your series:
 
-$ ./tools/scripts/patman/patman -n -c5
+$ ./tools/patman/patman -n -c5
 
 This will create patch files in your current directory and tell you who
 it is thinking of sending them to. Take a look at the patch files.
 
-$ ./tools/scripts/patman/patman -n -c5 -s1
+$ ./tools/patman/patman -n -c5 -s1
 
 Similar to the above, but skip the first commit and take the next 5. This
 is useful if your top commit is for setting up testing.
-- 
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 4/4] patman: Handle creation of patman config

2012-04-27 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 
Cc: Simon Glass 
---
 tools/patman/gitutil.py  |   18 ++
 tools/patman/settings.py |   34 +++---
 2 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 48ca998..2eacb13 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..03ea307 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,30 @@ def ReadGitAliases(fname):
 
 fd.close()
 
+def CreatePatmanConfigFile(config_fname):
+""" Creates a config file under $(HOME)/.config/ if it can't find one.
+
+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 +94,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


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 message<4f9acbb8.2040...@gmail.com>  you wrote:

Add example statements for commit message and series messages

Signed-off-by: Vikram Narayanan
Cc: Simon Glass
---
  tools/patman/README |9 -
  1 files changed, 4 insertions(+), 5 deletions(-)




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 message<4f9acbd1.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 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 mailto:vikram...@gmail.com>>
Cc: Simon Glass mailto:s...@chromium.org>>


Acked-by: Simon Glass 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 
Cc: Simon Glass 

---
 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 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 

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 
Cc: Simon Glass 
---
 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 
Cc: Simon Glass 
---
 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 Glass

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 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 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 mailto:vikram...@gmail.com>>
Cc: Simon Glass mailto:s...@chromium.org>>


Acked-by: Simon Glass 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 Glass

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


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


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 



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 
+
+/* 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  wrote:

On Mon, Apr 1, 2013 at 2:26 PM, Vikram Narayanan  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


[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 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 Estevam



+/* 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 , 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


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  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 
> ---
>  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
>

> +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 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 Kisky
---
  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.
+ */
+#include
+#include
+
+#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 r1, [rTable, #HDR_IMAGE_LEN]
+   sub rT

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 Kisky
---
  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__
+
+#include
+
+/* 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, 0x0250, 5, 
0x

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 Kisky
---
  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 @@
  #include
  #include
  #include
+#include
+#include
  #include
  #include
  #include
@@ -38,163 +40,46 @@
  #include
  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] [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énard
---
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 Benard
cpuat91 ARM920T
cpu9260 ARM926EJS (AT91SAM9260 SoC)
cpu9G20 ARM926EJS (AT91SAM9G20 SoC)
+   cpuimx25i.MX25
+   cpuimx25nandi.MX25

  Ajay Bhargav

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 Rigby
+#
+# 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 Electromatique
+ * Eric Benard
+ *
+ * Based on tx25.c:
+ *   Author: John Rigby
+ *
+ * Based on imx27lite.c:
+ *   Copyright (C) 2008,2009 Eric Jarrige
+ *   Copyright (C) 2009 Ilya Yanok
+ * And:
+ *   RedBoot tx25_misc.c Copyright (C) 2009 Red Hat
+ *
+ * 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 

[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] 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


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,




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:


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:


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


[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 
Cc: Simon Glass 
Cc: Wolfgang Denk 
Cc: Albert Aribaud 
---
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] [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
 wrote:

Hi Simon,

On Wed, 26 Dec 2012 12:39:32 -0800, Simon Glass 
wrote:

Hi Vikram,

On Sun, Dec 23, 2012 at 3:27 AM, Vikram Narayanan  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 
Cc: Simon Glass 
Cc: Wolfgang Denk 
Cc: Albert Aribaud 


Acked-by: Simon Glass 

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


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] 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] [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(®->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(®->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 
Cc: Albert Aribaud 

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 
---
 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
+ * 
+ *
+ * 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
+ * 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+
+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(®->gpfsel[BCM2835_GPIO_FSEL_BANK(gpio)]);
+   val &= ~(BCM2835_GPIO_FSEL_MASK << BCM28

[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 
---
 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 Narayanan
---
  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
+ *
+ *
+ * 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
+ *
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include
+#include
+#include
+
+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

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 message<1344426150-1229-1-git-send-email-ma...@denx.de>  you wrote:

From: Marek Vasut

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 Vasut
---
  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


[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 
Cc: Stefan Roese 
---
 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 

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 
Cc: Dinh Nguyen 
---
 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 
---
 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 
 #include 
 #include 
-#include 
 #include 
 #include 
 
-- 
1.7.4.1


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


  1   2   >