[PATCH 2/2] mtd: nand_omap_gpmc: Fix ecc check for bch8 romcode

2015-03-30 Thread Teresa Gámez
The bch8 romcode was only checked and corrected for the
first 512 bytes of a 2048 byte page. Set interation counter
and eccsizes correct for the different bch types.

Tested OMAP_ECC_BCH8_CODE_HW and OMAP_ECC_BCH8_CODE_HW_ROMCODE.

Reported-by: Gabor Janak g.ja...@agilion.de
Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/mtd/nand/nand_omap_gpmc.c | 38 +++---
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c 
b/drivers/mtd/nand/nand_omap_gpmc.c
index 647605b..9d9d27e 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -298,37 +298,45 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t 
*dat,
 {
struct nand_chip *nand = (struct nand_chip *)(mtd-priv);
struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand-priv);
-   int i, j, eccsize, eccflag, count, totalcount;
+   int i, j, eccflag, count, totalcount, actual_eccsize;
unsigned int err_loc[8];
-   int blocks = 0;
int select_4_8;
 
-   if (oinfo-ecc_mode == OMAP_ECC_BCH4_CODE_HW) {
-   eccsize = 7;
+   int eccsteps = oinfo-nand.ecc.steps;
+   int eccsize = oinfo-nand.ecc.bytes;
+
+   switch (oinfo-ecc_mode) {
+   case OMAP_ECC_BCH4_CODE_HW:
+   actual_eccsize = eccsize;
select_4_8 = 0;
-   } else {
-   eccsize = 13;
+   break;
+   case OMAP_ECC_BCH8_CODE_HW:
+   eccsize /= eccsteps;
+   actual_eccsize = eccsize;
+   select_4_8 = 1;
+   break;
+   case OMAP_ECC_BCH8_CODE_HW_ROMCODE:
+   actual_eccsize = eccsize - 1;
select_4_8 = 1;
+   break;
+   default:
+   dev_err(oinfo-pdev, invalid driver configuration\n);
+   return -EINVAL;
}
 
-   if (nand-ecc.size  == 2048)
-   blocks = 4;
-   else
-   blocks = 1;
-
totalcount = 0;
 
-   for (i = 0; i  blocks; i++) {
+   for (i = 0; i  eccsteps; i++) {
/* check if any ecc error */
eccflag = 0;
-   for (j = 0; (j  eccsize)  (eccflag == 0); j++) {
+   for (j = 0; (j  actual_eccsize)  (eccflag == 0); j++) {
if (calc_ecc[j] != 0)
eccflag = 1;
}
 
if (eccflag == 1) {
eccflag = 0;
-   for (j = 0; (j  eccsize) 
+   for (j = 0; (j  actual_eccsize) 
(eccflag == 0); j++)
if (read_ecc[j] != 0xFF)
eccflag = 1;
@@ -350,7 +358,7 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t 
*dat,
/* else, not interested to correct ecc */
}
 
-   calc_ecc = calc_ecc + eccsize;
+   calc_ecc = calc_ecc + actual_eccsize;
read_ecc = read_ecc + eccsize;
dat += 512;
}
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] mtd: nand_omap_gpmc: Remove unused code

2015-03-30 Thread Teresa Gámez
The ecc layout structs are not used anywhere.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/mtd/nand/nand_omap_gpmc.c | 68 ---
 1 file changed, 68 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c 
b/drivers/mtd/nand/nand_omap_gpmc.c
index d254042..647605b 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -130,53 +130,6 @@ static struct nand_bbt_descr bb_descrip_flashbased = {
.pattern = scan_ff_pattern,
 };
 
-/** Large Page x8 NAND device Layout */
-static struct nand_ecclayout ecc_lp_x8 = {
-   .eccbytes = 12,
-   .eccpos = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
-   .oobfree = {
-   {
-   .offset = 60,
-   .length = 2,
-   }
-   }
-};
-
-/** Large Page x16 NAND device Layout */
-static struct nand_ecclayout ecc_lp_x16 = {
-   .eccbytes = 12,
-   .eccpos = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13},
-   .oobfree = {
-   {
-   .offset = 60,
-   .length = 2,
-   }
-   }
-};
-
-/** Small Page x8 NAND device Layout */
-static struct nand_ecclayout ecc_sp_x8 = {
-   .eccbytes = 3,
-   .eccpos = {1, 2, 3},
-   .oobfree = {
-   {
-   .offset = 14,
-   .length = 2,
-   }
-   }
-};
-
-/** Small Page x16 NAND device Layout */
-static struct nand_ecclayout ecc_sp_x16 = {
-   .eccbytes = 3,
-   .eccpos = {2, 3, 4},
-   .oobfree = {
-   {
-   .offset = 14,
-   .length = 2 }
-   }
-};
-
 /**
  * @brief calls the platform specific dev_ready functionds
  *
@@ -891,7 +844,6 @@ static int gpmc_nand_probe(struct device_d *pdev)
struct mtd_info *minfo;
void __iomem *cs_base;
int err;
-   struct nand_ecclayout *layout, *lsp, *llp;
 
pdata = (struct gpmc_nand_platform_data *)pdev-platform_data;
if (pdata == NULL) {
@@ -1012,26 +964,6 @@ static int gpmc_nand_probe(struct device_d *pdev)
 
gpmc_set_buswidth(nand, nand-options  NAND_BUSWIDTH_16);
 
-   if (nand-options  NAND_BUSWIDTH_16) {
-   lsp = ecc_sp_x16;
-   llp = ecc_lp_x16;
-   } else {
-   lsp = ecc_sp_x8;
-   llp = ecc_lp_x8;
-   }
-
-   switch (minfo-writesize) {
-   case 512:
-   layout = lsp;
-   break;
-   case 2048:
-   layout = llp;
-   break;
-   default:
-   err = -EINVAL;
-   goto out_release_mem;
-   }
-
nand-read_buf   = omap_read_buf_pref;
if (IS_ENABLED(CONFIG_MTD_WRITE))
nand-write_buf  = omap_write_buf_pref;
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] AM335x: MLO image issue

2015-03-23 Thread Teresa Gámez
Hello,

we have encountered an issue in the AM335x MLO, which seems to depend on the 
image size itself. The bootloader hangs up in the decompress_unlzo() function.
The decompress_unlzo() function fails with dest len longer than block size
and ends up in it's error function in an infinite loop.

As the error seems to depend in the image size, adding or removing random code
makes the image working again.

We have seen this issue so far only with a MLO size of 98823 bytes and
barebox.z size: 61003 bytes. But could reproduce it using different toolchains.

So we suspect this is an issue in the lzo code. 
Syncing the lzo code with the kernel code, seems to help.
For this we have attached a patch.
But we are unsure if this is the solution to the bug we have.

Any ideas on this?

Regards,
Teresa

Stefan Müller-Klieser (1):
  lib/lzo: port lzo fix from upstream kernel

 lib/lzo/lzo1x_decompress_safe.c | 105 ++--
 1 file changed, 58 insertions(+), 47 deletions(-)

-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] lib/lzo: port lzo fix from upstream kernel

2015-03-23 Thread Teresa Gámez
From: Stefan Müller-Klieser s.mueller-klie...@phytec.de

This ports commit 72cf90124e87d975d0b from mainline kernel to the
barebox. We were experiencing reproducible boot hang ups on one am335x
board which depended on the barebox.z size. The MLO was trapped in the
decompression code. We found some bug reports around the lzo
decompressor in kernel and u-boot. With this version we cannot reproduce
the hang up any more.

Signed-off-by: Stefan Müller-Klieser s.mueller-klie...@phytec.de
---
 lib/lzo/lzo1x_decompress_safe.c | 105 ++--
 1 file changed, 58 insertions(+), 47 deletions(-)

diff --git a/lib/lzo/lzo1x_decompress_safe.c b/lib/lzo/lzo1x_decompress_safe.c
index 48bedba..2c2ded1 100644
--- a/lib/lzo/lzo1x_decompress_safe.c
+++ b/lib/lzo/lzo1x_decompress_safe.c
@@ -16,31 +16,21 @@
 #include lzo.h
 #include lzodefs.h
 
-#define HAVE_IP(t, x)  \
-   (((size_t)(ip_end - ip) = (size_t)(t + x))   \
-(((t + x) = t)  ((t + x) = x)))
-
-#define HAVE_OP(t, x)  \
-   (((size_t)(op_end - op) = (size_t)(t + x))   \
-(((t + x) = t)  ((t + x) = x)))
-
-#define NEED_IP(t, x)  \
-   do {\
-   if (!HAVE_IP(t, x)) \
-   goto input_overrun; \
-   } while (0)
-
-#define NEED_OP(t, x)  \
-   do {\
-   if (!HAVE_OP(t, x)) \
-   goto output_overrun;\
-   } while (0)
-
-#define TEST_LB(m_pos) \
-   do {\
-   if ((m_pos)  out)  \
-   goto lookbehind_overrun;\
-   } while (0)
+#define HAVE_IP(x)  ((size_t)(ip_end - ip) = (size_t)(x))
+#define HAVE_OP(x)  ((size_t)(op_end - op) = (size_t)(x))
+#define NEED_IP(x)  if (!HAVE_IP(x)) goto input_overrun
+#define NEED_OP(x)  if (!HAVE_OP(x)) goto output_overrun
+#define TEST_LB(m_pos)  if ((m_pos)  out) goto lookbehind_overrun
+
+/* This MAX_255_COUNT is the maximum number of times we can add 255 to a base
+ * count without overflowing an integer. The multiply will overflow when
+ * multiplying 255 by more than MAXINT/255. The sum will overflow earlier
+ * depending on the base count. Since the base count is taken from a u8
+ * and a few bits, it is safe to assume that it will always be lower than
+ * or equal to 2*255, thus we can always prevent any overflow by accepting
+ * two less 255 steps. See Documentation/lzo.txt for more information.
+ */
+#define MAX_255_COUNT  size_t)~0) / 255) - 2)
 
 int lzo1x_decompress_safe(const unsigned char *in, size_t in_len,
  unsigned char *out, size_t *out_len)
@@ -72,17 +62,24 @@ int lzo1x_decompress_safe(const unsigned char *in, size_t 
in_len,
if (t  16) {
if (likely(state == 0)) {
if (unlikely(t == 0)) {
+   size_t offset;
+   const unsigned char *ip_last = ip;
+
while (unlikely(*ip == 0)) {
-   t += 255;
ip++;
-   NEED_IP(1, 0);
+   NEED_IP(1);
}
-   t += 15 + *ip++;
+   offset = ip - ip_last;
+   if (unlikely(offset  MAX_255_COUNT))
+   return LZO_E_ERROR;
+
+   offset = (offset  8) - offset;
+   t += offset + 15 + *ip++;
}
t += 3;
 copy_literal_run:
 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
-   if (likely(HAVE_IP(t, 15)  HAVE_OP(t, 15))) {
+   if (likely(HAVE_IP(t + 15)  HAVE_OP(t + 15))) 
{
const unsigned char *ie = ip + t;
unsigned char *oe = op + t;
do {
@@ -98,8 +95,8 @@ copy_literal_run:
} else
 #endif
{
-   NEED_OP(t, 0);
-   NEED_IP(t, 3);
+   NEED_OP(t);
+   NEED_IP(t + 3);
do {

[PATCH] ARM: phytec-som-am335x: Remove bootargs-ip from boot scripts

2015-03-12 Thread Teresa Gámez
We do not pass the ip to kernel any more. So remove adding
it to bootargs when booting from nand, mmc or spi nor.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc  | 2 --
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand | 2 --
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi  | 2 --
 3 files changed, 6 deletions(-)

diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
index 670afc7..834669d 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
@@ -3,6 +3,4 @@
 global.bootm.image=/boot/linuximage
 global.bootm.oftree=/boot/oftree
 
-bootargs-ip
-
 global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rw rootwait
diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
index c6e49be..b9b1bc6 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/nand
@@ -3,6 +3,4 @@
 global.bootm.image=/dev/nand0.kernel.bb
 global.bootm.oftree=/dev/nand0.oftree.bb
 
-bootargs-ip
-
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=root rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
index 43a89fe..71c5834 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
@@ -3,7 +3,5 @@
 global.bootm.image=/dev/m25p0.kernel
 global.bootm.oftree=/dev/m25p0.oftree
 
-bootargs-ip
-
 # Use rootfs from NAND
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root rw 
rootfstype=ubifs
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: Fix nv variable bootargs.base

2015-02-27 Thread Teresa Gámez
Some console parameters where faulty named bootargs.base. Which does
not have any effect. Removed them where possible and renamed the others
to linux.bootargs.console.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/highbank/env/nv/bootargs.base| 1 -
 arch/arm/boards/highbank/env/nv/linux.bootargs.console   | 1 +
 .../boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base  | 1 -
 .../boards/phytec-som-am335x/defaultenv-physom-am335x/nv/bootargs.base   | 1 -
 arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base  | 1 -
 arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console | 1 +
 6 files changed, 2 insertions(+), 4 deletions(-)
 delete mode 100644 arch/arm/boards/highbank/env/nv/bootargs.base
 create mode 100644 arch/arm/boards/highbank/env/nv/linux.bootargs.console
 delete mode 100644 
arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base
 delete mode 100644 
arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/nv/bootargs.base
 delete mode 100644 arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base
 create mode 100644 arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console

diff --git a/arch/arm/boards/highbank/env/nv/bootargs.base 
b/arch/arm/boards/highbank/env/nv/bootargs.base
deleted file mode 100644
index 826debe..000
--- a/arch/arm/boards/highbank/env/nv/bootargs.base
+++ /dev/null
@@ -1 +0,0 @@
-console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0
diff --git a/arch/arm/boards/highbank/env/nv/linux.bootargs.console 
b/arch/arm/boards/highbank/env/nv/linux.bootargs.console
new file mode 100644
index 000..826debe
--- /dev/null
+++ b/arch/arm/boards/highbank/env/nv/linux.bootargs.console
@@ -0,0 +1 @@
+console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0
diff --git 
a/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base 
b/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base
deleted file mode 100644
index 6b62c99..000
--- 
a/arch/arm/boards/phytec-phycard-imx6/defaultenv-phycard-imx6/nv/bootargs.base
+++ /dev/null
@@ -1 +0,0 @@
-console=ttymxc2,115200
diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/nv/bootargs.base 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/nv/bootargs.base
deleted file mode 100644
index d7b01a1..000
--- 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/nv/bootargs.base
+++ /dev/null
@@ -1 +0,0 @@
-console=ttyO0,115200
diff --git a/arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base 
b/arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base
deleted file mode 100644
index 476b1fb..000
--- a/arch/arm/boards/telit-evk-pro3/env/nv/bootargs.base
+++ /dev/null
@@ -1 +0,0 @@
-console=ttyS0,115200
diff --git a/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console 
b/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console
new file mode 100644
index 000..476b1fb
--- /dev/null
+++ b/arch/arm/boards/telit-evk-pro3/env/nv/linux.bootargs.console
@@ -0,0 +1 @@
+console=ttyS0,115200
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [For next PATCH 3/3] ARM: phytec-som-am335x: Update sd-card rootfs to ext4

2015-02-24 Thread Teresa Gámez
Am Mittwoch, den 25.02.2015, 08:22 +0100 schrieb Sascha Hauer:
 On Tue, Feb 24, 2015 at 08:52:14AM +0100, Teresa Gámez wrote:
  Update rootfs to ext4. ext3 filesystems are still getting mounted.
  
  Signed-off-by: Teresa Gámez t.ga...@phytec.de
  ---
   arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git 
  a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc 
  b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
  index 1a642f9..447e471 100644
  --- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
  +++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
  @@ -5,4 +5,4 @@ global.bootm.oftree=/boot/oftree
   
   bootargs-ip
   
  -global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext3 rw 
  rootwait
  +global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext4 rw 
  rootwait
 
 Is the rootfstype necessary anyway? It should be automatically detected,
 no?

Yes, detection works. I'll remove it.

Teresa

 
 Sascha
 



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH] ARM: phytec-som-am335x: Remove mmc rootfstype

2015-02-24 Thread Teresa Gámez
Rootfs type is beeing detected. Removed the rootfstype parameter.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
index 1a642f9..670afc7 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
@@ -5,4 +5,4 @@ global.bootm.oftree=/boot/oftree
 
 bootargs-ip
 
-global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext3 rw 
rootwait
+global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rw rootwait
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 1/3] ARM: phytec-som-am335x: Fix rootfs bootargs

2015-02-23 Thread Teresa Gámez
The roofs is mounted from nand when booting from spi. The VID header offset
was set fix to 2048. This is not needed any more. Removed it like it was done
for nand.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
index a9c0fe8..43a89fe 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/spi
@@ -6,4 +6,4 @@ global.bootm.oftree=/dev/m25p0.oftree
 bootargs-ip
 
 # Use rootfs from NAND
-global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
+global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root rw 
rootfstype=ubifs
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 3/3] ARM: phytec-som-am335x: Update sd-card rootfs to ext4

2015-02-23 Thread Teresa Gámez
Update rootfs to ext4. ext3 filesystems are still getting mounted.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc 
b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
index 1a642f9..447e471 100644
--- a/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
+++ b/arch/arm/boards/phytec-som-am335x/defaultenv-physom-am335x/boot/mmc
@@ -5,4 +5,4 @@ global.bootm.oftree=/boot/oftree
 
 bootargs-ip
 
-global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext3 rw 
rootwait
+global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext4 rw 
rootwait
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 2/3] ARM: am335x_defconfig: Add ext4 support

2015-02-23 Thread Teresa Gámez
Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/configs/am335x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/am335x_defconfig 
b/arch/arm/configs/am335x_defconfig
index 0b8f58d..0db2075 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -125,6 +125,7 @@ CONFIG_EEPROM_AT24=y
 CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_PINCTRL_SINGLE=y
 CONFIG_BUS_OMAP_GPMC=y
+CONFIG_FS_EXT4=y
 CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
 CONFIG_FS_FAT=y
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


bareboxenv: console bootargs

2015-02-20 Thread Teresa Gámez
Hello,

I have noticed that the console= bootarg parameter in the latest
enviroment is set in the /env/nv/linux.bootargs.base variable. But it is
also set over common/console.c in the variable linux.bootargs.console
which results here in two console= parameter:

commandline: console=ttyO0,115200n8 console=ttyO0,115200
root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait

Wouldn't it be the right way to set the linux.bootargs.console instead
of the linux.bootargs.base in the enviroment. If it needs to be
overwritten at all...

I suspect that other boards, then the am335x ones, are also affected.

Regards
Teresa




___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: beagle bone black: problem of boot from eMMC

2015-01-05 Thread Teresa Gámez
Hello Manuel,

Am Mittwoch, den 31.12.2014, 14:52 + schrieb manuelcur...@eaton.com:
 
 After, I wanted to boot from the the internal eMMC. 
 So after boot from sd card, I mounted the eMMC (mount /dev/mmc1.0) and
 copied the MLO and barebox.bin in the /mnt/mmc1.0 folder.
 
 When I try to boot from the internal eMMC ,I have the following error: 
 -
 barebox 2014.12.0 #2 Wed Dec 31 15:29:16 GMT 2014
 
 
 Board: TI AM335x BeagleBone
 detected 'BeagleBone Black'
 omap-hsmmc 4806.mmc: registered as 4806.mmc
 booting from MMC
 fat fat0: probe failed: error 22
 Unable to mount  (-22)
 booting failed
 -

This issue comes from commit:

commit 0d6392de4ad824a6553c0e3e3e18edef689a7c85
Author: Sascha Hauer s.ha...@pengutronix.de
Date:   Thu Jun 5 12:09:07 2014 +0200

ARM: AM335x: Beaglebone: Use stripped down devicetree for MLO

For the MLO only the am335x-bone-common.dtsi is used to create the
device tree. But this does not have the emmc support included.

 
 I tried myself to find a 'correction' by added the call of
 am33xx_of_register_bootdevice(void) function at the end of the static
 int beaglebone_devices_init(void) function. With this modification,
 sometime (depending of the last boot: from SD Card or from eMMC)  I can
 boot, someting not. 

What you are also missing is a disabled emmc node from the
am335x-boneblack.dts in the am335x-bone-common.dtsi.

This may help.

Regards,
Teresa

 So my correction,although improving the situation, is not exactly the
 correction to do. Some one can help me ? 
 
 Thanks very much !
  
 
 
 -
 Eaton Industries (France) S.A.S ~ Siège social: 110 Rue Blaise Pascal, 
 Immeuble Le Viséo - Bâtiment A Innovallée, 38330, Montbonnot-St.-Martin, 
 France ~ Lieu d'enregistrement au registre du commerce: Grenoble ~ Numéro 
 d'enregistrement: 509 653 176 ~ Capital social souscrit et liberé:€ 16215441 
 ~ Numéro de TVA: FR47509653176
 
 -
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] net: cpsw: Fix crashes on beaglebone black

2015-01-05 Thread Teresa Gámez
Hello Philippe,

Am Samstag, den 27.12.2014, 15:39 +0100 schrieb ledphili...@gmail.com:
 Hello,
 
 The current version (2014.12.0-00116-ge91702b) crashes on the beaglebone 
 black 
 if the ethernet driver is enabled. Here is the trace:
 
 barebox 2014.12.0-00116-ge91702b #15 Sat Dec 27 15:30:25 CET 2014
 
 
 Board: TI AM335x BeagleBone black
 detected 'BeagleBone Black'
 cpsw 4a10.ethernet: detected phy mask 0x1
 mdio_bus: miibus0: probed
 eth0: got preset MAC address: d0:39:72:41:0a:26
 cpsw 4a10.ethernet: probe failed: I/O error
 unable to handle paging request at address 0x6e6f62f2
 pc : [9fe24e4a]lr : [9fe0751f]
 sp : 9e60  ip :   fp : 
 r10: 8ff1d8b8  r9 : 8ff12534  r8 : 8ff1d974
 r7 :   r6 : 8ff1d8e0  r5 : 9fe55220  r4 : 6e6f62f2
 r3 :   r2 :   r1 : 8ff1d8e0  r0 : 6e6f62f2
 Flags: nZCV  IRQs off  FIQs on  Mode SVC_32
 [9fe24e4a] (strcmp+0xc/0x1a) from [9fe0751f] 
 (get_device_by_name_id+0x1f/0x38)
 [9fe0751f] (get_device_by_name_id+0x1f/0x38) from [9fe07837] 
 (register_device+0x17/0xc8)
 [9fe07837] (register_device+0x17/0xc8) from [9fe1dcb3] 
 (of_platform_device_create+0x17b/0x1b0)
 [9fe1dcb3] (of_platform_device_create+0x17b/0x1b0) from [9fe1dd13] 
 (of_platform_bus_create+0x2b/0x68)
 [9fe1dd13] (of_platform_bus_create+0x2b/0x68) from [9fe1dda7] 
 (of_platform_populate+0x2f/0x44)
 [9fe1dda7] (of_platform_populate+0x2f/0x44) from [9fe07967] 
 (platform_probe+0x9/0xa)
 [9fe07967] (platform_probe+0x9/0xa) from [9fe07561] 
 (device_probe+0x11/0x44)
 [9fe07561] (device_probe+0x11/0x44) from [9fe075bb] 
 (match.part.2+0x27/0x2e)
 [9fe075bb] (match.part.2+0x27/0x2e) from [9fe076d5] 
 (register_driver+0x59/0x74)
 [9fe076d5] (register_driver+0x59/0x74) from [9fe00827] 
 (start_barebox+0x1b/0xb8)
 [9fe00827] (start_barebox+0x1b/0xb8) from [9fe3291f] (__start+0xa3/0xb8)
 [9fe3291f] (__start+0xa3/0xb8) from [9fe5] (__bare_init_start+0x1/0xc)
 
 [9fe32349] (unwind_backtrace+0x1/0x58) from [9fe258e9] (panic+0x1d/0x34)
 [9fe258e9] (panic+0x1d/0x34) from [9fe327e1] (do_exception+0xd/0x10)
 [9fe327e1] (do_exception+0xd/0x10) from [9fe32849] 
 (do_data_abort+0x21/0x2c)
 [9fe32849] (do_data_abort+0x21/0x2c) from [9fe32508] 
 (data_abort+0x48/0x60)
 
 

I suspect the issue comes from the dummy cpsw_emac1 node which adds a
non existing phy in the beaglebone device tree. So the mdiobus_scan
fails. This patch will workaround the issue but I'm unsure about right
solution here. 

Regards,
Teresa 

 
 The following patch resolves the problem on my board. Please review it and 
 check if it is fine.
 
 Regards,
 
 
 Signed-off-by: Philippe Leduc ledphili...@gmail.com
 ---
  drivers/net/cpsw.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
 index b6618ad..311cd44 100644
 --- a/drivers/net/cpsw.c
 +++ b/drivers/net/cpsw.c
 @@ -1202,10 +1202,8 @@ int cpsw_probe(struct device_d *dev)
 struct phy_device *phy;
  
 phy = mdiobus_scan(priv-miibus, priv-slaves[i].phy_id);
 -   if (IS_ERR(phy)) {
 -   ret = PTR_ERR(phy);
 -   goto out;
 -   }
 +   if (IS_ERR(phy))
 +   continue;
  
 phy-dev.device_node = priv-slaves[i].dev.device_node;
 ret = phy_register_device(phy);



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: AM335x: Fix typo in Phytec boards

2014-12-10 Thread Teresa Gámez
Has to be bootsource not boosource.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 .../phytec-phycore-am335x/defaultenv-phycore-am335x/init/bootsource | 6 +++---
 .../phytec-phyflex-am335x/defaultenv-phyflex-am335x/init/bootsource | 6 +++---
 arch/arm/dts/am335x-phytec-phycore-som-mlo.dts  | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/init/bootsource
 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/init/bootsource
index 76d1f9b..3f2ff4b 100644
--- 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/init/bootsource
+++ 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/init/bootsource
@@ -6,10 +6,10 @@ fi
 
 if [ $bootsource = mmc ]; then
global.boot.default=mmc nand spi net
-elif [ $boosource = nand ]; then
+elif [ $bootsource = nand ]; then
global.boot.default=nand spi mmc net
-elif [ $boosource = spi ]; then
+elif [ $bootsource = spi ]; then
global.boot.default=spi nand mmc net
-elif [ $boosource = net ]; then
+elif [ $bootsource = net ]; then
global.boot.default=net nand spi mmc
 fi
diff --git 
a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/init/bootsource
 
b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/init/bootsource
index 76d1f9b..3f2ff4b 100644
--- 
a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/init/bootsource
+++ 
b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/init/bootsource
@@ -6,10 +6,10 @@ fi
 
 if [ $bootsource = mmc ]; then
global.boot.default=mmc nand spi net
-elif [ $boosource = nand ]; then
+elif [ $bootsource = nand ]; then
global.boot.default=nand spi mmc net
-elif [ $boosource = spi ]; then
+elif [ $bootsource = spi ]; then
global.boot.default=spi nand mmc net
-elif [ $boosource = net ]; then
+elif [ $bootsource = net ]; then
global.boot.default=net nand spi mmc
 fi
diff --git a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts 
b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
index 4117439..d8fceff 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
+++ b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
@@ -15,7 +15,7 @@
compatible = phytec,phycore-am335x-som, ti,am33xx;
 };
 
-/* Keep all boosources disabled, we enable and register them
+/* Keep all bootsources disabled, we enable and register them
  * later while booting.
  */
 
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] ARM: dts: Add missing gpmc setting for phyFLEX-AM335x

2014-12-09 Thread Teresa Gámez
cycle2cycle-diffcsen needs to be enabled.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phyflex.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am335x-phytec-phyflex.dts 
b/arch/arm/dts/am335x-phytec-phyflex.dts
index c4481f5..6679cf5 100644
--- a/arch/arm/dts/am335x-phytec-phyflex.dts
+++ b/arch/arm/dts/am335x-phytec-phyflex.dts
@@ -272,6 +272,7 @@
gpmc,wait-on-write = true;
gpmc,bus-turnaround-ns = 0;
gpmc,cycle2cycle-delay-ns = 50;
+   gpmc,cycle2cycle-diffcsen;
gpmc,clk-activation-ns = 0;
gpmc,wait-monitoring-ns = 0;
gpmc,wr-access-ns = 0;
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] ARM: dts: Add missing gpmc setting for phyCORE-AM335x

2014-12-09 Thread Teresa Gámez
cycle2cycle-diffcsen needs to be enabled.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore-som.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi 
b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
index f1bcb8b..fbd6760 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
@@ -225,6 +225,7 @@
gpmc,wait-on-write = true;
gpmc,bus-turnaround-ns = 0;
gpmc,cycle2cycle-delay-ns = 50;
+   gpmc,cycle2cycle-diffcsen;
gpmc,clk-activation-ns = 0;
gpmc,wait-monitoring-ns = 0;
gpmc,wr-access-ns = 0;
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/3] ARM: dts: am335x-phytec-phyflex: Increase kernel partition on SPI NOR

2014-12-09 Thread Teresa Gámez
Hello Sascha,

Am Dienstag, den 09.12.2014, 10:13 +0100 schrieb Sascha Hauer:
 Hi Teresa,
 
 On Mon, Dec 08, 2014 at 10:59:49AM +0100, Teresa Gámez wrote:
  Increase kernel partition to end of SPI NOR.
  
  Signed-off-by: Teresa Gámez t.ga...@phytec.de
  ---
   arch/arm/dts/am335x-phytec-phyflex.dts | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  diff --git a/arch/arm/dts/am335x-phytec-phyflex.dts 
  b/arch/arm/dts/am335x-phytec-phyflex.dts
  index c4481f5..0de7e87 100644
  --- a/arch/arm/dts/am335x-phytec-phyflex.dts
  +++ b/arch/arm/dts/am335x-phytec-phyflex.dts
  @@ -187,7 +187,7 @@
   
  partition@4 {
  label = kernel;
  -   reg = 0xe 0x40;
  +   reg = 0xe 0x0;
  };
 
 I wasn't aware barebox handles this case like you intend here. What
 about the kernel? Won't you end up with a zero sized partition there?

have a look at include/linux/mtd/partitions.h in the linux kernel.

There is a macro defined 
#define MTDPART_SIZ_FULL(0)

And the comment above says: 
size: the partition size; if defined as MTDPART_SIZ_FULL, the partition
will extend to the end of the master MTD device.

This works fine for kernel and barebox. 

Teresa

 
 Sascha
 



___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/3] ARM: dts: am335x-phytec-phyflex: Increase kernel partition on SPI NOR

2014-12-08 Thread Teresa Gámez
Increase kernel partition to end of SPI NOR.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phyflex.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/am335x-phytec-phyflex.dts 
b/arch/arm/dts/am335x-phytec-phyflex.dts
index c4481f5..0de7e87 100644
--- a/arch/arm/dts/am335x-phytec-phyflex.dts
+++ b/arch/arm/dts/am335x-phytec-phyflex.dts
@@ -187,7 +187,7 @@
 
partition@4 {
label = kernel;
-   reg = 0xe 0x40;
+   reg = 0xe 0x0;
};
};
 };
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/3] ARM: phytec: am335x: Update enviroment comment

2014-12-08 Thread Teresa Gámez
We do not have a root partition in spi flash any more.
Adapt comment.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 .../arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi | 2 +-
 .../arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
index c87299a..2147a6c 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
@@ -4,5 +4,5 @@ global.bootm.image=/dev/m25p0.kernel
 
 bootargs-ip
 
-# Use rootfs form NAND for now as rootfs partition  4MB
+# Use rootfs form NAND
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi 
b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
index c87299a..2147a6c 100644
--- a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
+++ b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
@@ -4,5 +4,5 @@ global.bootm.image=/dev/m25p0.kernel
 
 bootargs-ip
 
-# Use rootfs form NAND for now as rootfs partition  4MB
+# Use rootfs form NAND
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/3] ARM: dts: am335x-phytec-phycore-som: Increase kernel partition on SPI NOR

2014-12-08 Thread Teresa Gámez
Increase kernel partition to end of SPI NOR.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore-som.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi 
b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
index f1bcb8b..98945b2 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
@@ -162,7 +162,7 @@
 
partition@4 {
label = kernel;
-   reg = 0xe 0x40;
+   reg = 0xe 0x0;
};
};
 };
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2] ARM: phytec: am335x: Update enviroment comment

2014-12-08 Thread Teresa Gámez
We do not have a root partition in spi flash any more.
Adapt comment.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
v2: Fixed typo

 .../arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi | 2 +-
 .../arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
index c87299a..2f858bd 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
@@ -4,5 +4,5 @@ global.bootm.image=/dev/m25p0.kernel
 
 bootargs-ip
 
-# Use rootfs form NAND for now as rootfs partition  4MB
+# Use rootfs from NAND
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi 
b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
index c87299a..2f858bd 100644
--- a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
+++ b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
@@ -4,5 +4,5 @@ global.bootm.image=/dev/m25p0.kernel
 
 bootargs-ip
 
-# Use rootfs form NAND for now as rootfs partition  4MB
+# Use rootfs from NAND
 global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 2/3] ARM: am335x: Add register of boot devices

2014-11-03 Thread Teresa Gámez
Add support for registering disabled boot devices from oftree.
Creating a device tree with all bootable devices disabled, makes
it possible to only enable and register the devices needed to
load the next stage bootloader.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
v2:
- updated of funcion name

 arch/arm/mach-omap/am33xx_generic.c  | 31 
 arch/arm/mach-omap/include/mach/am33xx-generic.h |  1 +
 2 files changed, 32 insertions(+)

diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
index f293134..b561575 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -428,3 +428,34 @@ void am335x_sdram_init(int ioctrl, const struct 
am33xx_cmd_control *cmd_ctrl,
 
am33xx_config_sdram(emif_regs);
 }
+
+int am33xx_of_register_bootdevice(void)
+{
+   struct device_d *dev;
+
+   switch (bootsource_get()) {
+   case BOOTSOURCE_MMC:
+   if (bootsource_get_instance() == 0)
+   dev = 
of_device_enable_and_register_by_name(mmc@4806);
+   else
+   dev = 
of_device_enable_and_register_by_name(mmc@481d8000);
+   break;
+   case BOOTSOURCE_NAND:
+   dev = of_device_enable_and_register_by_name(gpmc@5000);
+   break;
+   case BOOTSOURCE_SPI:
+   dev = of_device_enable_and_register_by_name(spi@4803);
+   break;
+   default:
+   /* Use nand fallback */
+   dev = of_device_enable_and_register_by_name(gpmc@5000);
+   break;
+   }
+
+   if (!dev) {
+   printf(Unable to register boot device\n);
+   return -ENODEV;
+   }
+
+   return 0;
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h 
b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index 6c85d51..7312061 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -33,5 +33,6 @@ void __noreturn am33xx_reset_cpu(unsigned long addr);
 void am33xx_enable_per_clocks(void);
 int am33xx_init(void);
 int am33xx_devices_init(void);
+int am33xx_of_register_bootdevice(void);
 
 #endif /* __MACH_AM33XX_GENERIC_H */
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 3/3] ARM: am335x: phyCORE-AM335x: Create new dts for MLO

2014-11-03 Thread Teresa Gámez
Use a mlo device tree with all bootable devices disabled.
The bootsource is checked in the board file and only the
needed device is enabled and registered.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/board.c|  3 +++
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |  3 ++-
 arch/arm/dts/Makefile|  2 +-
 arch/arm/dts/am335x-phytec-phycore-som-mlo.dts   | 28 
 4 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/am335x-phytec-phycore-som-mlo.dts

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c 
b/arch/arm/boards/phytec-phycore-am335x/board.c
index 64e3904..a72cebd 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -83,6 +83,9 @@ static int pcm051_devices_init(void)
xloadslots, ARRAY_SIZE(xloadslots));
am33xx_bbu_nand_register_handler(nand, /dev/nand0.barebox.bb);
 
+   if (IS_ENABLED(CONFIG_SHELL_NONE))
+   return am33xx_of_register_bootdevice();
+
return 0;
 }
 device_initcall(pcm051_devices_init);
diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index 55cc667..5ab8b5b 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -118,6 +118,7 @@ struct pcm051_sdram_timings timings[] = {
 };
 
 extern char __dtb_am335x_phytec_phycore_som_start[];
+extern char __dtb_am335x_phytec_phycore_som_mlo_start[];
 extern char __dtb_am335x_phytec_phycore_som_no_spi_start[];
 
 /**
@@ -154,7 +155,7 @@ static noinline void pcm051_board_init(int sdram)
omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
putc_ll('');
 
-   fdt = __dtb_am335x_phytec_phycore_som_start - get_runtime_offset();
+   fdt = __dtb_am335x_phytec_phycore_som_mlo_start - get_runtime_offset();
 
am335x_barebox_entry(fdt);
 }
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index a9e9ee7..d8160fe 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,7 +26,7 @@ pbl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += 
tegra124-jetson-tk1.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCAAXL3) += imx6q-phytec-pbaa03.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o 
am335x-phytec-phycore-som-no-spi.dtb.o
+pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o 
am335x-phytec-phycore-som-no-spi.dtb.o am335x-phytec-phycore-som-mlo.dtb.o
 pbl-dtb-$(CONFIG_MACH_PFLA03) += am335x-phytec-phyflex.dtb.o
 pbl-dtb-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6s-phytec-pbab01.dtb.o 
imx6dl-phytec-pbab01.dtb.o imx6q-phytec-pbab01.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += 
armada-xp-openblocks-ax3-4-bb.dtb.o
diff --git a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts 
b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
new file mode 100644
index 000..4117439
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Teresa Gámez t.ga...@phytec.de PHYTEC Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include am33xx.dtsi
+#include am335x-phytec-phycore-som.dtsi
+
+/ {
+   model = Phytec phyCORE AM335x;
+   compatible = phytec,phycore-am335x-som, ti,am33xx;
+};
+
+/* Keep all boosources disabled, we enable and register them
+ * later while booting.
+ */
+
+mmc1 {
+   status = disabled;
+};
+
+gpmc {
+   status = disabled;
+};
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 1/3] of: Add of_device_enable_and_register functions

2014-11-03 Thread Teresa Gámez
Function to enable and register a disabled device.
The devices can be registered using the
device node with of_device_enable_and_register() or
with the device node name/path by using the
of_device_enable_and_register_by_name() function.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
v2:
- renamed functions

 drivers/of/platform.c | 43 +++
 include/of.h  | 14 ++
 2 files changed, 57 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c417cfd..92ef534 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -197,6 +197,49 @@ static struct device_d *of_platform_device_create(struct 
device_node *np,
return NULL;
 }
 
+/**
+ * of_device_enable_and_register - Enable and register device
+ * @np: pointer to node to enable create device for
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered. Unavailable devices will not get registered.
+ */
+struct device_d *of_device_enable_and_register(struct device_node *np)
+{
+   struct device_d *dev;
+
+   of_device_enable(np);
+
+   dev = of_platform_device_create(np, NULL);
+   if (!dev)
+   return NULL;
+
+   return dev;
+}
+EXPORT_SYMBOL(of_device_enable_and_register);
+
+/**
+ * of_device_enable_and_register_by_name - Enable and register device by name
+ * @name: name or path of the device node
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered. Unavailable devices will not get registered.
+ */
+struct device_d *of_device_enable_and_register_by_name(const char *name)
+{
+   struct device_node *node;
+
+   node = of_find_node_by_name(NULL, name);
+   if (!node)
+   node = of_find_node_by_path(name);
+
+   if (!node)
+   return NULL;
+
+   return of_device_enable_and_register(node);
+}
+EXPORT_SYMBOL(of_device_enable_and_register_by_name);
+
 #ifdef CONFIG_ARM_AMBA
 static struct device_d *of_amba_device_create(struct device_node *np)
 {
diff --git a/include/of.h b/include/of.h
index 29694a9..7b93c58 100644
--- a/include/of.h
+++ b/include/of.h
@@ -227,6 +227,8 @@ extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
struct device_d *parent);
 extern struct device_d *of_find_device_by_node(struct device_node *np);
+extern struct device_d *of_device_enable_and_register(struct device_node *np);
+extern struct device_d *of_device_enable_and_register_by_name(const char 
*name);
 
 struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node);
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
@@ -582,6 +584,18 @@ static inline struct device_d 
*of_find_device_by_node(struct device_node *np)
 {
return NULL;
 }
+
+static inline struct device_d *of_device_enable_and_register(
+   struct device_node *np)
+{
+   return NULL;
+}
+
+static inline struct device_d *of_device_enable_and_register_by_name(
+   const char *name)
+{
+   return NULL;
+}
 #endif
 
 #define for_each_node_by_name(dn, name) \
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH] boards: defaultenv: Fix nand bootargs for AM335x boards.

2014-10-31 Thread Teresa Gámez
Update nand bootargs for phyFLEX-AM335x and phyCORE-AM335x
to support modern kernels.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 .../boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand| 2 +-
 .../boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
index d9ef145..1dfbef9 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
@@ -5,4 +5,4 @@ global.bootm.image=/dev/nand0.kernel.bb
 
 bootargs-ip
 
-global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
+global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=root rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand 
b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand
index d9ef145..1dfbef9 100644
--- a/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand
+++ b/arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand
@@ -5,4 +5,4 @@ global.bootm.image=/dev/nand0.kernel.bb
 
 bootargs-ip
 
-global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
+global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=root rw 
rootfstype=ubifs
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 1/3] of: Add of_register_disabled_device functions

2014-10-30 Thread Teresa Gámez
Function to enable and register a disabled device.
The devices can be registered using the
device node with of_register_disabled_device() or
with the device node name/path by using the
of_register_disabled_device_by_name() function.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/of/platform.c | 43 +++
 include/of.h  | 14 ++
 2 files changed, 57 insertions(+)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index c417cfd..e4a3042 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -197,6 +197,49 @@ static struct device_d *of_platform_device_create(struct 
device_node *np,
return NULL;
 }
 
+/**
+ * of_register_disabled_device - Enable and register device
+ * @np: pointer to node to enable create device for
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered. Unavailable devices will not get registered.
+ */
+struct device_d *of_register_disabled_device(struct device_node *np)
+{
+   struct device_d *dev;
+
+   of_device_enable(np);
+
+   dev = of_platform_device_create(np, NULL);
+   if (!dev)
+   return NULL;
+
+   return dev;
+}
+EXPORT_SYMBOL(of_register_disabled_device);
+
+/**
+ * of_register_disabled_device - Enable and register device by name
+ * @name: name or path of the device node
+ *
+ * Returns pointer to created platform device, or NULL if a device was not
+ * registered. Unavailable devices will not get registered.
+ */
+struct device_d *of_register_disabled_device_by_name(const char *name)
+{
+   struct device_node *node;
+
+   node = of_find_node_by_name(NULL, name);
+   if (!node)
+   node = of_find_node_by_path(name);
+
+   if (!node)
+   return NULL;
+
+   return of_register_disabled_device(node);
+}
+EXPORT_SYMBOL(of_register_disabled_device_by_name);
+
 #ifdef CONFIG_ARM_AMBA
 static struct device_d *of_amba_device_create(struct device_node *np)
 {
diff --git a/include/of.h b/include/of.h
index 29694a9..67b1937 100644
--- a/include/of.h
+++ b/include/of.h
@@ -227,6 +227,8 @@ extern int of_platform_populate(struct device_node *root,
const struct of_device_id *matches,
struct device_d *parent);
 extern struct device_d *of_find_device_by_node(struct device_node *np);
+extern struct device_d *of_register_disabled_device(struct device_node *np);
+extern struct device_d *of_register_disabled_device_by_name(const char *name);
 
 struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node);
 int of_parse_partitions(struct cdev *cdev, struct device_node *node);
@@ -582,6 +584,18 @@ static inline struct device_d 
*of_find_device_by_node(struct device_node *np)
 {
return NULL;
 }
+
+static inline struct device_d *of_register_disabled_device(
+   struct device_node *np)
+{
+   return NULL;
+}
+
+static inline struct device_d *of_register_disabled_device_by_name(
+   const char *name)
+{
+   return NULL;
+}
 #endif
 
 #define for_each_node_by_name(dn, name) \
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 2/3] ARM: am335x: Add register of boot devices

2014-10-30 Thread Teresa Gámez
Add support for registering disabled boot devices from oftree.
Creating a device tree with all bootable devices disabled, makes
it possible to only enable and register the devices needed to
load the next stage bootloader.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/am33xx_generic.c  | 31 
 arch/arm/mach-omap/include/mach/am33xx-generic.h |  1 +
 2 files changed, 32 insertions(+)

diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
index f293134..a04e8c7 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -428,3 +428,34 @@ void am335x_sdram_init(int ioctrl, const struct 
am33xx_cmd_control *cmd_ctrl,
 
am33xx_config_sdram(emif_regs);
 }
+
+int am33xx_of_register_bootdevice(void)
+{
+   struct device_d *dev;
+
+   switch (bootsource_get()) {
+   case BOOTSOURCE_MMC:
+   if (bootsource_get_instance() == 0)
+   dev = 
of_register_disabled_device_by_name(mmc@4806);
+   else
+   dev = 
of_register_disabled_device_by_name(mmc@481d8000);
+   break;
+   case BOOTSOURCE_NAND:
+   dev = of_register_disabled_device_by_name(gpmc@5000);
+   break;
+   case BOOTSOURCE_SPI:
+   dev = of_register_disabled_device_by_name(spi@4803);
+   break;
+   default:
+   /* Use nand fallback */
+   dev = of_register_disabled_device_by_name(gpmc@5000);
+   break;
+   }
+
+   if (!dev) {
+   printf(Unable to register boot device\n);
+   return -ENODEV;
+   }
+
+   return 0;
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h 
b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index 6c85d51..7312061 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -33,5 +33,6 @@ void __noreturn am33xx_reset_cpu(unsigned long addr);
 void am33xx_enable_per_clocks(void);
 int am33xx_init(void);
 int am33xx_devices_init(void);
+int am33xx_of_register_bootdevice(void);
 
 #endif /* __MACH_AM33XX_GENERIC_H */
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[For next PATCH 3/3] ARM: am335x: phyCORE-AM335x: Create new dts for MLO

2014-10-30 Thread Teresa Gámez
Use a mlo device tree with all bootable devices disabled.
The bootsource is checked in the board file and only the
needed device is enabled and registered.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/board.c|  3 +++
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |  3 ++-
 arch/arm/dts/Makefile|  2 +-
 arch/arm/dts/am335x-phytec-phycore-som-mlo.dts   | 28 
 4 files changed, 34 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/am335x-phytec-phycore-som-mlo.dts

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c 
b/arch/arm/boards/phytec-phycore-am335x/board.c
index 64e3904..a72cebd 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -83,6 +83,9 @@ static int pcm051_devices_init(void)
xloadslots, ARRAY_SIZE(xloadslots));
am33xx_bbu_nand_register_handler(nand, /dev/nand0.barebox.bb);
 
+   if (IS_ENABLED(CONFIG_SHELL_NONE))
+   return am33xx_of_register_bootdevice();
+
return 0;
 }
 device_initcall(pcm051_devices_init);
diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index 55cc667..5ab8b5b 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -118,6 +118,7 @@ struct pcm051_sdram_timings timings[] = {
 };
 
 extern char __dtb_am335x_phytec_phycore_som_start[];
+extern char __dtb_am335x_phytec_phycore_som_mlo_start[];
 extern char __dtb_am335x_phytec_phycore_som_no_spi_start[];
 
 /**
@@ -154,7 +155,7 @@ static noinline void pcm051_board_init(int sdram)
omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
putc_ll('');
 
-   fdt = __dtb_am335x_phytec_phycore_som_start - get_runtime_offset();
+   fdt = __dtb_am335x_phytec_phycore_som_mlo_start - get_runtime_offset();
 
am335x_barebox_entry(fdt);
 }
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index a9e9ee7..d8160fe 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,7 +26,7 @@ pbl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += 
tegra124-jetson-tk1.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCAAXL3) += imx6q-phytec-pbaa03.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o 
am335x-phytec-phycore-som-no-spi.dtb.o
+pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o 
am335x-phytec-phycore-som-no-spi.dtb.o am335x-phytec-phycore-som-mlo.dtb.o
 pbl-dtb-$(CONFIG_MACH_PFLA03) += am335x-phytec-phyflex.dtb.o
 pbl-dtb-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6s-phytec-pbab01.dtb.o 
imx6dl-phytec-pbab01.dtb.o imx6q-phytec-pbab01.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += 
armada-xp-openblocks-ax3-4-bb.dtb.o
diff --git a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts 
b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
new file mode 100644
index 000..4117439
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Teresa Gámez t.ga...@phytec.de PHYTEC Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include am33xx.dtsi
+#include am335x-phytec-phycore-som.dtsi
+
+/ {
+   model = Phytec phyCORE AM335x;
+   compatible = phytec,phycore-am335x-som, ti,am33xx;
+};
+
+/* Keep all boosources disabled, we enable and register them
+ * later while booting.
+ */
+
+mmc1 {
+   status = disabled;
+};
+
+gpmc {
+   status = disabled;
+};
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/6] ARM: defconfig: Enable of_display_timings in am335x_defconfig

2014-10-10 Thread Teresa Gámez
Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/configs/am335x_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/am335x_defconfig 
b/arch/arm/configs/am335x_defconfig
index 6ef9c83..7dcfaed 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -79,6 +79,7 @@ CONFIG_CMD_USBGADGET=y
 CONFIG_CMD_BAREBOX_UPDATE=y
 CONFIG_CMD_OF_NODE=y
 CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_DISPLAY_TIMINGS=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
 CONFIG_NET=y
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/6] net: cpsw: Fix probe for one port ethernet

2014-10-10 Thread Teresa Gámez
If only one port is pinned out, probe fails
as the second port phy_id is not found.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/net/cpsw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 167b2dd..9c8cff3 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -1071,7 +1071,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
return ret;
}
 
-   if (!strncmp(child-name, slave, 5)) {
+   if (i  priv-num_slaves  !strncmp(child-name, slave, 5)) {
struct cpsw_slave *slave = priv-slaves[i];
uint32_t phy_id[2];
 
@@ -1088,7 +1088,7 @@ static int cpsw_probe_dt(struct cpsw_priv *priv)
}
}
 
-   for (i = 0; i  2; i++) {
+   for (i = 0; i  priv-num_slaves; i++) {
struct cpsw_slave *slave = priv-slaves[i];
 
cpsw_gmii_sel_am335x(slave);
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/6] phyCORE-AM335x: Update default enviroment

2014-10-10 Thread Teresa Gámez
- Set default bootsource to the $boosource variable
- Pass ip to kernel on all boot options
- mount rootfs rw

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 .../phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc   |  7 +--
 .../phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand  |  5 -
 .../phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi   |  4 +++-
 .../defaultenv-phycore-am335x/config-board | 10 ++
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc
index 32854d1..6a60761 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/mmc
@@ -1,5 +1,8 @@
 #!/bin/sh
 
-global.bootm.image=/boot/uImage
+global.bootm.image=/boot/linuximage
 #global.bootm.oftree=/boot/oftree
-global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext3 rootwait
+
+bootargs-ip
+
+global.linux.bootargs.dyn.root=root=/dev/mmcblk0p2 rootfstype=ext3 rw 
rootwait
diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
index cdfd93d..d9ef145 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/nand
@@ -2,4 +2,7 @@
 
 global.bootm.image=/dev/nand0.kernel.bb
 #global.bootm.oftree=/env/oftree
-global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 
rootfstype=ubifs
+
+bootargs-ip
+
+global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
index 7a53d84..c87299a 100644
--- a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
+++ b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/boot/spi
@@ -2,5 +2,7 @@
 
 global.bootm.image=/dev/m25p0.kernel
 
+bootargs-ip
+
 # Use rootfs form NAND for now as rootfs partition  4MB
-global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 
rootfstype=ubifs
+global.linux.bootargs.dyn.root=root=ubi0:root ubi.mtd=nand0.root,2048 rw 
rootfstype=ubifs
diff --git 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/config-board 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/config-board
index 7f0b2b7..a492ed1 100644
--- 
a/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/config-board
+++ 
b/arch/arm/boards/phytec-phycore-am335x/defaultenv-phycore-am335x/config-board
@@ -5,3 +5,13 @@
 
 global.hostname=pcm051
 global.linux.bootargs.base=console=ttyO0,115200
+
+if [ $bootsource = mmc ]; then
+   global.boot.default=mmc nand spi net
+elif [ $boosource = nand ]; then
+   global.boot.default=nand spi mmc net
+elif [ $boosource = spi ]; then
+   global.boot.default=spi nand mmc net
+elif [ $boosource = net ]; then
+   global.boot.default=net nand spi mmc
+fi
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 4/6] phyCORE-AM335x: Strip down device tree

2014-10-10 Thread Teresa Gámez
The phyCORE-AM335x is a SOM that can be connected to different
carrierboards like PCM-953, phyBOARD-WEGA and phyBOARD-MAIA.

It is enough for the bootloader to support the SOM specific
parts and can be so used also on different carrierboards.

Removed carrierboard specific settings like led and the
second ethernet slave.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore.dts | 41 +-
 1 file changed, 1 insertion(+), 40 deletions(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index e7e7780..1a1352f 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -21,23 +21,6 @@
status = disabled;
};
};
-
-   gpio-leds {
-   compatible = gpio-leds;
-   pinctrl-names = default;
-   pinctrl-0 = pcm051_led_pins;
-
-   led-green {
-   label = green;
-   gpios = gpio1 30 0;
-   linux,default-trigger = heartbeat;
-   };
-
-   led-amber {
-   label = amber;
-   gpios = gpio1 31 1;
-   };
-   };
 };
 
 am33xx_pinmux {
@@ -72,7 +55,6 @@
0xfc (MUX_MODE0 | INPUT_EN | PULL_UP)   /* 
mmc0_dat0.mmc0_dat0 */
0x100 (MUX_MODE0 | INPUT_EN | PULL_UP)  /* 
mmc0_clk.mmc0_clk */
0x104 (MUX_MODE0 | INPUT_EN | PULL_UP)  /* 
mmc0_cmd.mmc0_cmd */
-   0x160 (MUX_MODE7 | INPUT_EN | PULL_UP)  /* spi0_cs1.??, 
card detect */
;
};
 
@@ -86,20 +68,6 @@
0x13c (PIN_INPUT_PULLDOWN | MUX_MODE1)  /* 
mii1_rxd1.rmii1_rxd1 */
0x140 (PIN_INPUT_PULLDOWN | MUX_MODE1)  /* 
mii1_rxd0.rmii1_rxd0 */
0x144 (PIN_INPUT_PULLDOWN | MUX_MODE0)  /* 
rmii1_refclk.rmii1_refclk */
-
-   /* Slave 2 */
-   0x40 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a0.rgmii2_tctl */
-   0x44 (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a1.rgmii2_rctl */
-   0x48 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a2.rgmii2_td3 */
-   0x4c (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a3.rgmii2_td2 */
-   0x50 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a4.rgmii2_td1 */
-   0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a5.rgmii2_td0 */
-   0x58 (PIN_OUTPUT_PULLDOWN | MUX_MODE2)  /* 
gpmc_a6.rgmii2_tclk */
-   0x5c (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a7.rgmii2_rclk */
-   0x60 (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a8.rgmii2_rd3 */
-   0x64 (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a9.rgmii2_rd2 */
-   0x68 (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a10.rgmii2_rd1 */
-   0x6c (PIN_INPUT_PULLDOWN | MUX_MODE2)   /* 
gpmc_a11.rgmii2_rd0 */
;
};
 
@@ -224,19 +192,12 @@
 cpsw_emac0 {
phy_id = davinci_mdio, 0;
phy-mode = rmii;
-   dual_emac_res_vlan = 1;
-};
-
-cpsw_emac1 {
-   phy_id = davinci_mdio, 2;
-   phy-mode = rgmii;
-   dual_emac_res_vlan = 2;
 };
 
 mac {
pinctrl-names = default;
pinctrl-0 = emac_rmii1_pins;
-   dual_emac = 1;
+   slaves = 1;
status = okay;
 };
 
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 6/6] phyCORE-AM335x: Add barebox image without SPI NOR

2014-10-10 Thread Teresa Gámez
Boards like phyBOARD-WEGA RDK have an phyCORE-AM335x
connected with no SPI NOR flash. Added dts to support this.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c  | 10 ++
 arch/arm/dts/Makefile |  2 +-
 arch/arm/dts/am335x-phytec-phycore-som-no-spi.dts | 20 
 images/Makefile.am33xx|  4 
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/am335x-phytec-phycore-som-no-spi.dts

diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index 47902d0..55cc667 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -118,6 +118,7 @@ struct pcm051_sdram_timings timings[] = {
 };
 
 extern char __dtb_am335x_phytec_phycore_som_start[];
+extern char __dtb_am335x_phytec_phycore_som_no_spi_start[];
 
 /**
  * @brief The basic entry point for board initialization.
@@ -202,3 +203,12 @@ ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, 
r2)
 
am335x_barebox_entry(fdt);
 }
+
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_no_spi_sdram, r0, r1, r2)
+{
+   void *fdt;
+
+   fdt = __dtb_am335x_phytec_phycore_som_no_spi_start - 
get_runtime_offset();
+
+   am335x_barebox_entry(fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 65ed022..ede2b59 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,7 +26,7 @@ pbl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += 
tegra124-jetson-tk1.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCAAXL3) += imx6q-phytec-pbaa03.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o
+pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o 
am335x-phytec-phycore-som-no-spi.dtb.o
 pbl-dtb-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6s-phytec-pbab01.dtb.o 
imx6dl-phytec-pbab01.dtb.o imx6q-phytec-pbab01.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += 
armada-xp-openblocks-ax3-4-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += 
kirkwood-openblocks_a6-bb.dtb.o
diff --git a/arch/arm/dts/am335x-phytec-phycore-som-no-spi.dts 
b/arch/arm/dts/am335x-phytec-phycore-som-no-spi.dts
new file mode 100644
index 000..6350706
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore-som-no-spi.dts
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2014 Teresa Gámez t.ga...@phytec.de Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include am33xx.dtsi
+#include am335x-phytec-phycore-som.dtsi
+
+/ {
+   model = Phytec phyCORE AM335x;
+   compatible = phytec,phycore-am335x-som, ti,am33xx;
+};
+
+eeprom {
+   status = okay;
+};
diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx
index 92dd61a..8d58733 100644
--- a/images/Makefile.am33xx
+++ b/images/Makefile.am33xx
@@ -19,6 +19,10 @@ pblx-$(CONFIG_MACH_PCM051) += 
start_am33xx_phytec_phycore_sdram
 FILE_barebox-am33xx-phytec-phycore.img = start_am33xx_phytec_phycore_sdram.pblx
 am33xx-barebox-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore.img
 
+pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_no_spi_sdram
+FILE_barebox-am33xx-phytec-phycore-no-spi.img = 
start_am33xx_phytec_phycore_no_spi_sdram.pblx
+am33xx-barebox-$(CONFIG_MACH_PCM051) += 
barebox-am33xx-phytec-phycore-no-spi.img
+
 pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_256mb
 FILE_barebox-am33xx-phytec-phycore-mlo-256mb.img = 
start_am33xx_phytec_phycore_sram_256mb.pblx.mlo
 am33xx-mlo-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore-mlo-256mb.img
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 5/6] ARM: dts: split phyCORE-AM335x device tree

2014-10-10 Thread Teresa Gámez
To support different module variants, split the phyCORE dts
in dts and dtsi. Configurable parts which are supported by
barebox are spi nor flash and i2c eeprom.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/board.c|   4 +-
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |   6 +-
 arch/arm/dts/Makefile|   2 +-
 arch/arm/dts/am335x-phytec-phycore-som.dts   |  24 ++
 arch/arm/dts/am335x-phytec-phycore-som.dtsi  | 286 ++
 arch/arm/dts/am335x-phytec-phycore.dts   | 292 ---
 6 files changed, 316 insertions(+), 298 deletions(-)
 create mode 100644 arch/arm/dts/am335x-phytec-phycore-som.dts
 create mode 100644 arch/arm/dts/am335x-phytec-phycore-som.dtsi
 delete mode 100644 arch/arm/dts/am335x-phytec-phycore.dts

diff --git a/arch/arm/boards/phytec-phycore-am335x/board.c 
b/arch/arm/boards/phytec-phycore-am335x/board.c
index 035866b..64e3904 100644
--- a/arch/arm/boards/phytec-phycore-am335x/board.c
+++ b/arch/arm/boards/phytec-phycore-am335x/board.c
@@ -34,7 +34,7 @@
 
 static int pcm051_coredevice_init(void)
 {
-   if (!of_machine_is_compatible(phytec,pcm051))
+   if (!of_machine_is_compatible(phytec,phycore-am335x-som))
return 0;
 
am33xx_register_ethaddr(0, 0);
@@ -58,7 +58,7 @@ static char *xloadslots[] = {
 
 static int pcm051_devices_init(void)
 {
-   if (!of_machine_is_compatible(phytec,pcm051))
+   if (!of_machine_is_compatible(phytec,phycore-am335x-som))
return 0;
 
switch (bootsource_get()) {
diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index 66bae80..47902d0 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -117,7 +117,7 @@ struct pcm051_sdram_timings timings[] = {
},
 };
 
-extern char __dtb_am335x_phytec_phycore_start[];
+extern char __dtb_am335x_phytec_phycore_som_start[];
 
 /**
  * @brief The basic entry point for board initialization.
@@ -153,7 +153,7 @@ static noinline void pcm051_board_init(int sdram)
omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
putc_ll('');
 
-   fdt = __dtb_am335x_phytec_phycore_start - get_runtime_offset();
+   fdt = __dtb_am335x_phytec_phycore_som_start - get_runtime_offset();
 
am335x_barebox_entry(fdt);
 }
@@ -198,7 +198,7 @@ ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, 
r2)
 {
void *fdt;
 
-   fdt = __dtb_am335x_phytec_phycore_start - get_runtime_offset();
+   fdt = __dtb_am335x_phytec_phycore_som_start - get_runtime_offset();
 
am335x_barebox_entry(fdt);
 }
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 3fcd5f1..65ed022 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -26,7 +26,7 @@ pbl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += 
tegra124-jetson-tk1.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCAAXL3) += imx6q-phytec-pbaa03.dtb.o
 pbl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore.dtb.o
+pbl-dtb-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore-som.dtb.o
 pbl-dtb-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6s-phytec-pbab01.dtb.o 
imx6dl-phytec-pbab01.dtb.o imx6q-phytec-pbab01.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += 
armada-xp-openblocks-ax3-4-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += 
kirkwood-openblocks_a6-bb.dtb.o
diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dts 
b/arch/arm/dts/am335x-phytec-phycore-som.dts
new file mode 100644
index 000..93f09e2
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dts
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2014 Teresa Gámez t.ga...@phytec.de Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+/dts-v1/;
+
+#include am33xx.dtsi
+#include am335x-phytec-phycore-som.dtsi
+
+/ {
+   model = Phytec phyCORE AM335x;
+   compatible = phytec,phycore-am335x-som, ti,am33xx;
+};
+
+spi0 {
+   status = okay;
+};
+
+eeprom {
+   status = okay;
+};
diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi 
b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
new file mode 100644
index 000..f1bcb8b
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
@@ -0,0 +1,286 @@
+/ {
+   chosen {
+   linux,stdout-path = uart0;
+
+   environment-spi {
+   compatible = barebox,environment;
+   device-path = flash, partname:bareboxenv;
+   status = disabled;
+   };
+
+   environment-nand {
+   compatible = barebox,environment

[PATCH 4/4] pfla03: add to am335x_defconfig

2014-10-07 Thread Teresa Gámez
From: Stefan Müller-Klieser s.mueller-klie...@phytec.de

Signed-off-by: Stefan Müller-Klieser s.mueller-klie...@phytec.de
---
 arch/arm/configs/am335x_defconfig | 1 +
 arch/arm/configs/am335x_mlo_defconfig | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/configs/am335x_defconfig 
b/arch/arm/configs/am335x_defconfig
index 6ef9c83..0f92564 100644
--- a/arch/arm/configs/am335x_defconfig
+++ b/arch/arm/configs/am335x_defconfig
@@ -5,6 +5,7 @@ CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_AFI_GF=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_MACH_PCM051=y
+CONFIG_MACH_PFLA03=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/configs/am335x_mlo_defconfig 
b/arch/arm/configs/am335x_mlo_defconfig
index dee8c5b..d691570 100644
--- a/arch/arm/configs/am335x_mlo_defconfig
+++ b/arch/arm/configs/am335x_mlo_defconfig
@@ -4,6 +4,7 @@ CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_AFI_GF=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_MACH_PCM051=y
+CONFIG_MACH_PFLA03=y
 CONFIG_THUMB2_BAREBOX=y
 # CONFIG_CMD_ARM_CPUINFO is not set
 # CONFIG_MEMINFO is not set
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 0/4] Add phyFLEX-AM335x support

2014-10-07 Thread Teresa Gámez
This patchset adds phyFLEX-AM335x support. This is
based on Jan's work and was rewitten for device
tree and multi image support by Stefan. I cleaned up the
code and rebased it to master.

Teresa

Jan Weitzel (2):
  net: cpsw: Allow gigabit connection
  net: micrel: Add ksz8081 support

Stefan Müller-Klieser (2):
  boards: Add phytec-phyflex-am335x
  pfla03: add to am335x_defconfig

 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/phytec-phyflex-am335x/Makefile |   3 +
 arch/arm/boards/phytec-phyflex-am335x/board.c  | 100 ++
 .../defaultenv-phyflex-am335x/boot/mmc |   8 +
 .../defaultenv-phyflex-am335x/boot/nand|   8 +
 .../defaultenv-phyflex-am335x/boot/spi |   8 +
 .../defaultenv-phyflex-am335x/config-board |  17 +
 arch/arm/boards/phytec-phyflex-am335x/lowlevel.c   | 180 +++
 arch/arm/configs/am335x_defconfig  |   1 +
 arch/arm/configs/am335x_mlo_defconfig  |   1 +
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/am335x-phytec-phyflex.dts | 356 +
 arch/arm/mach-omap/Kconfig |   5 +
 drivers/net/cpsw.c |   3 +-
 drivers/net/phy/micrel.c   |  10 +-
 images/Makefile.am33xx |  12 +
 16 files changed, 711 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/Makefile
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/board.c
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/mmc
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/config-board
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/lowlevel.c
 create mode 100644 arch/arm/dts/am335x-phytec-phyflex.dts

-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/4] net: cpsw: Allow gigabit connection

2014-10-07 Thread Teresa Gámez
From: Jan Weitzel j.weit...@phytec.de

Signed-off-by: Jan Weitzel j.weit...@phytec.de
---
 drivers/net/cpsw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index 167b2dd..50890c4 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -581,8 +581,7 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
else if (phydev-speed == SPEED_100)
mac_control |= BIT(15);
else if (phydev-speed == SPEED_1000)
-   mac_control = ~BIT(7); /* TODO: Do not enable
-* gig support now */
+   mac_control |= BIT(7);
if (phydev-duplex == DUPLEX_FULL)
mac_control |= BIT(0);  /* FULLDUPLEXEN */
}
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/4] net: micrel: Add ksz8081 support

2014-10-07 Thread Teresa Gámez
From: Jan Weitzel j.weit...@phytec.de

Signed-off-by: Jan Weitzel j.weit...@phytec.de
---
 drivers/net/phy/micrel.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 88c64e5..866391c 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -226,13 +226,21 @@ static struct phy_driver ksphy_driver[] = {
 }, {
.phy_id = PHY_ID_KSZ8051,
.phy_id_mask= 0x00f0,
-   .drv.name   = Micrel KSZ8051,
+   .drv.name   = Micrel KSZ8051,
.features   = (PHY_BASIC_FEATURES | SUPPORTED_Pause
| SUPPORTED_Asym_Pause),
.config_init= ks8051_config_init,
.config_aneg= genphy_config_aneg,
.read_status= genphy_read_status,
 }, {
+   .phy_id = PHY_ID_KSZ8081,
+   .phy_id_mask= MICREL_PHY_ID_MASK,
+   .drv.name   = Micrel KSZ8081/91,
+   .features   = (PHY_BASIC_FEATURES | SUPPORTED_Pause),
+   .config_init= kszphy_config_init,
+   .config_aneg= genphy_config_aneg,
+   .read_status= genphy_read_status,
+}, {
.phy_id = PHY_ID_KSZ8001,
.drv.name   = Micrel KSZ8001 or KS8721,
.phy_id_mask= 0x00ff,
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/4] boards: Add phytec-phyflex-am335x

2014-10-07 Thread Teresa Gámez
From: Stefan Müller-Klieser s.mueller-klie...@phytec.de

Add support for PHYTEC's phyFLEX-AM335x.

Signed-off-by: Stefan Müller-Klieser s.mueller-klie...@phytec.de
[clean ups]
Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/Makefile   |   1 +
 arch/arm/boards/phytec-phyflex-am335x/Makefile |   3 +
 arch/arm/boards/phytec-phyflex-am335x/board.c  | 100 ++
 .../defaultenv-phyflex-am335x/boot/mmc |   8 +
 .../defaultenv-phyflex-am335x/boot/nand|   8 +
 .../defaultenv-phyflex-am335x/boot/spi |   8 +
 .../defaultenv-phyflex-am335x/config-board |  17 +
 arch/arm/boards/phytec-phyflex-am335x/lowlevel.c   | 180 +++
 arch/arm/dts/Makefile  |   1 +
 arch/arm/dts/am335x-phytec-phyflex.dts | 356 +
 arch/arm/mach-omap/Kconfig |   5 +
 images/Makefile.am33xx |  12 +
 12 files changed, 699 insertions(+)
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/Makefile
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/board.c
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/mmc
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/nand
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/boot/spi
 create mode 100644 
arch/arm/boards/phytec-phyflex-am335x/defaultenv-phyflex-am335x/config-board
 create mode 100644 arch/arm/boards/phytec-phyflex-am335x/lowlevel.c
 create mode 100644 arch/arm/dts/am335x-phytec-phyflex.dts

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index c80b9c9..25045ac 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -79,6 +79,7 @@ obj-$(CONFIG_MACH_PCM038) += 
phytec-phycore-imx27/
 obj-$(CONFIG_MACH_PCM043)  += phytec-phycore-imx35/
 obj-$(CONFIG_MACH_PCM049)  += phytec-phycore-omap4460/
 obj-$(CONFIG_MACH_PCM051)  += phytec-phycore-am335x/
+obj-$(CONFIG_MACH_PFLA03)  += phytec-phyflex-am335x/
 obj-$(CONFIG_MACH_PHYTEC_PFLA02)   += phytec-phyflex-imx6/
 obj-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += plathome-openblocks-ax3/
 obj-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6)  += plathome-openblocks-a6/
diff --git a/arch/arm/boards/phytec-phyflex-am335x/Makefile 
b/arch/arm/boards/phytec-phyflex-am335x/Makefile
new file mode 100644
index 000..54734b5
--- /dev/null
+++ b/arch/arm/boards/phytec-phyflex-am335x/Makefile
@@ -0,0 +1,3 @@
+lwl-y += lowlevel.o
+obj-y += board.o
+bbenv-y += defaultenv-phyflex-am335x
diff --git a/arch/arm/boards/phytec-phyflex-am335x/board.c 
b/arch/arm/boards/phytec-phyflex-am335x/board.c
new file mode 100644
index 000..12fad8f
--- /dev/null
+++ b/arch/arm/boards/phytec-phyflex-am335x/board.c
@@ -0,0 +1,100 @@
+/*
+ * pfla03 - phyFLEX-AM335x Board Initalization Code
+ *
+ * Copyright (C) 2014 Stefan Müller-Klieser, Phytec Messtechnik GmbH
+ *
+ * Based on arch/arm/boards/omap/board-beagle.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include bootsource.h
+#include common.h
+#include nand.h
+#include init.h
+#include io.h
+#include sizes.h
+#include envfs.h
+#include asm/armlinux.h
+#include generated/mach-types.h
+#include linux/phy.h
+#include linux/micrel_phy.h
+#include mach/am33xx-generic.h
+#include mach/am33xx-silicon.h
+#include mach/bbu.h
+
+static int ksz9031rn_phy_fixup(struct phy_device *dev)
+{
+   phy_write_mmd_indirect(dev, 6, 2, 0);
+   phy_write_mmd_indirect(dev, 8, 2, 0x003ff);
+
+   return 0;
+}
+
+static int pfla03_coredevice_init(void)
+{
+   if (!of_machine_is_compatible(phytec,phyflex-am335x-som))
+   return 0;
+
+   phy_register_fixup_for_uid(PHY_ID_KSZ9031, MICREL_PHY_ID_MASK,
+   ksz9031rn_phy_fixup);
+   am33xx_register_ethaddr(0, 0);
+   am33xx_register_ethaddr(1, 1);
+
+   return 0;
+}
+coredevice_initcall(pfla03_coredevice_init);
+
+static struct omap_barebox_part pfla03_barebox_part = {
+   .nand_offset = SZ_512K,
+   .nand_size = SZ_512K,
+   .nor_offset = SZ_128K,
+   .nor_size = SZ_512K,
+};
+
+static char *xloadslots[] = {
+   /dev/nand0.xload.bb,
+   /dev/nand0.xload_backup1.bb,
+   /dev/nand0.xload_backup2.bb,
+   /dev/nand0.xload_backup3.bb
+};
+
+static int

[PATCHv3 3/5] of: base: Add of_parse_phandle_from

2014-09-30 Thread Teresa Gámez
Added of_parse_phandle_from() to be able to use external root nodes.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/of/base.c | 28 
 include/of.h  | 11 +++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 061fc79..f363cc1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1130,16 +1130,19 @@ int of_property_write_u64_array(struct device_node *np,
 }
 
 /**
- * of_parse_phandle - Resolve a phandle property to a device_node pointer
+ * of_parse_phandle_from - Resolve a phandle property to a device_node pointer 
from
+ * a given root node
  * @np: Pointer to device node holding phandle property
+ * @root: root node of the tree to search in. If NULL use the internal tree.
  * @phandle_name: Name of property holding a phandle value
  * @index: For properties holding a table of phandles, this is the index into
  * the table
  *
  * Returns the device_node pointer found or NULL.
  */
-struct device_node *of_parse_phandle(const struct device_node *np,
-const char *phandle_name, int index)
+struct device_node *of_parse_phandle_from(const struct device_node *np,
+   struct device_node *root,
+   const char *phandle_name, int index)
 {
const __be32 *phandle;
int size;
@@ -1148,7 +1151,24 @@ struct device_node *of_parse_phandle(const struct 
device_node *np,
if ((!phandle) || (size  sizeof(*phandle) * (index + 1)))
return NULL;
 
-   return of_find_node_by_phandle(be32_to_cpup(phandle + index));
+   return of_find_node_by_phandle_from(be32_to_cpup(phandle + index),
+   root);
+}
+EXPORT_SYMBOL(of_parse_phandle_from);
+
+/**
+ * of_parse_phandle - Resolve a phandle property to a device_node pointer
+ * @np: Pointer to device node holding phandle property
+ * @phandle_name: Name of property holding a phandle value
+ * @index: For properties holding a table of phandles, this is the index into
+ * the table
+ *
+ * Returns the device_node pointer found or NULL.
+ */
+struct device_node *of_parse_phandle(const struct device_node *np,
+const char *phandle_name, int index)
+{
+   return of_parse_phandle_from(np, root_node, phandle_name, index);
 }
 EXPORT_SYMBOL(of_parse_phandle);
 
diff --git a/include/of.h b/include/of.h
index 4281cce..decf151 100644
--- a/include/of.h
+++ b/include/of.h
@@ -205,6 +205,10 @@ extern int of_property_write_u64_array(struct device_node 
*np,
 extern struct device_node *of_parse_phandle(const struct device_node *np,
const char *phandle_name,
int index);
+extern struct device_node *of_parse_phandle_from(const struct device_node *np,
+   struct device_node *root,
+   const char *phandle_name,
+   int index);
 extern int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct of_phandle_args *out_args);
@@ -439,6 +443,13 @@ static inline struct device_node *of_parse_phandle(const 
struct device_node *np,
return NULL;
 }
 
+static inline struct device_node *of_parse_phandle_from(const struct 
device_node *np,
+   struct device_node *root,
+   const char *phandle_name, int index)
+{
+   return NULL;
+}
+
 static inline int of_parse_phandle_with_args(const struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct of_phandle_args *out_args)
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv3 1/5] of: base: Add for_each_node_by_name_from

2014-09-30 Thread Teresa Gámez
Added for_each_node_by_name_from() to be able to
pass external root node.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 include/of.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/of.h b/include/of.h
index e6993fd..cd2bfe0 100644
--- a/include/of.h
+++ b/include/of.h
@@ -568,6 +568,9 @@ static inline struct device_d 
*of_find_device_by_node(struct device_node *np)
 #define for_each_node_by_name(dn, name) \
for (dn = of_find_node_by_name(NULL, name); dn; \
 dn = of_find_node_by_name(dn, name))
+#define for_each_node_by_name_from(dn, root, name) \
+   for (dn = of_find_node_by_name(root, name); dn; \
+dn = of_find_node_by_name(dn, name))
 #define for_each_compatible_node(dn, type, compatible) \
for (dn = of_find_compatible_node(NULL, type, compatible); dn; \
 dn = of_find_compatible_node(dn, type, compatible))
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv3 4/5] of: Added of_set_property_to_child_phandle

2014-09-30 Thread Teresa Gámez
Set a property to a phandle of a child node. This may be used
for selections like display-timings.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/of/base.c | 21 +
 include/of.h  |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index f363cc1..e9f0883 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -356,6 +356,27 @@ phandle of_node_create_phandle(struct device_node *node)
 }
 EXPORT_SYMBOL(of_node_create_phandle);
 
+int of_set_property_to_child_phandle(struct device_node *node, char *prop_name)
+{
+   int ret;
+   phandle p;
+
+   /* Check if property exist */
+   if (!of_get_property(of_get_parent(node), prop_name, NULL))
+   return -EINVAL;
+
+   /* Create or get existing phandle of child node */
+   p = of_node_create_phandle(node);
+   p = cpu_to_be32(p);
+
+   node = of_get_parent(node);
+
+   ret = of_set_property(node, prop_name, p, sizeof(p), 0);
+
+   return ret;
+}
+EXPORT_SYMBOL(of_set_property_to_child_phandle);
+
 /*
  * Find a property with a given name for a given node
  * and return the value.
diff --git a/include/of.h b/include/of.h
index decf151..29694a9 100644
--- a/include/of.h
+++ b/include/of.h
@@ -714,6 +714,7 @@ int of_device_disable_path(const char *path);
 
 phandle of_get_tree_max_phandle(struct device_node *root);
 phandle of_node_create_phandle(struct device_node *node);
+int of_set_property_to_child_phandle(struct device_node *node, char 
*prop_name);
 struct device_node *of_find_node_by_alias(struct device_node *root,
const char *alias);
 struct device_node *of_find_node_by_path_or_alias(struct device_node *root,
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv3 5/5] commands: add of_display_timings

2014-09-30 Thread Teresa Gámez
A lot of boards use display-timings nodes to define the timings of one or more
displays. This command makes it possible to list and select displays which are
defined in a device tree.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
Changes v3:
- removed overwriting of root node
- using now for_each_node_by_name_from and of_parse_phandle_from
- eliminated ret variable

Changes v2:
- removed cast
- added free(ftd)
- freed root

 commands/Kconfig  |  15 
 commands/Makefile |   1 +
 commands/of_display_timings.c | 164 ++
 3 files changed, 180 insertions(+)
 create mode 100644 commands/of_display_timings.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 3a49baf..0563e63 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1973,6 +1973,21 @@ config CMD_OF_PROPERTY
  [00 11 22 .. nn]  - byte stream
  If the value does not start with '' or '[' it is interpreted as 
string
 
+config CMD_OF_DISPLAY_TIMINGS
+   tristate
+   select OFTREE
+   prompt of_display_timings
+   help
+ List and select display timings
+
+ Usage: of_display_timings [-lS] [-s path] [-f dtb]
+
+ Options:
+ -llist path of all available display-timings
+ -Slist path of all selected display-timings
+ -s path   select display-timings and register oftree fixup
+ -f dtbwork on dtb. Has no effect on -s option
+
 config CMD_OFTREE
tristate
select OFTREE
diff --git a/commands/Makefile b/commands/Makefile
index 52b6137..f5ecbe6 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_CMD_OFTREE)  += oftree.o
 obj-$(CONFIG_CMD_OF_PROPERTY)  += of_property.o
 obj-$(CONFIG_CMD_OF_NODE)  += of_node.o
 obj-$(CONFIG_CMD_OF_DUMP)  += of_dump.o
+obj-$(CONFIG_CMD_OF_DISPLAY_TIMINGS)   += of_display_timings.o
 obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o
 obj-$(CONFIG_CMD_IOMEM)+= iomemport.o
 obj-$(CONFIG_CMD_LINUX_EXEC)   += linux_exec.o
diff --git a/commands/of_display_timings.c b/commands/of_display_timings.c
new file mode 100644
index 000..ccf2db0
--- /dev/null
+++ b/commands/of_display_timings.c
@@ -0,0 +1,164 @@
+/*
+ * of_display_timings.c - list and select display_timings
+ *
+ * Copyright (c) 2014 Teresa Gámez t.ga...@phytec.de PHYTEC Messtechnik GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include common.h
+#include filetype.h
+#include libfile.h
+#include of.h
+#include command.h
+#include malloc.h
+#include complete.h
+#include asm/byteorder.h
+#include getopt.h
+#include linux/err.h
+#include string.h
+
+static int of_display_timing(struct device_node *root, void *timingpath)
+{
+   int ret = 0;
+   struct device_node *display;
+
+   display = of_find_node_by_path_from(root, timingpath);
+   if (!display) {
+   pr_err(Path to display-timings is not vaild.\n);
+   ret = -EINVAL;
+   goto out;
+   }
+
+   ret = of_set_property_to_child_phandle(display, native-mode);
+   if (ret)
+   pr_err(Could not set display\n);
+out:
+   return ret;
+}
+
+static int do_of_display_timings(int argc, char *argv[])
+{
+   int opt;
+   int list = 0;
+   int selected = 0;
+   struct device_node *root = NULL;
+   struct device_node *display = NULL;
+   struct device_node *timings = NULL;
+   char *timingpath = NULL;
+   char *dtbfile = NULL;
+
+   while ((opt = getopt(argc, argv, sS:lf:))  0) {
+   switch (opt) {
+   case 'l':
+   list = 1;
+   break;
+   case 'f':
+   dtbfile = optarg;
+   break;
+   case 's':
+   selected = 1;
+   break;
+   case 'S':
+   timingpath = xzalloc(strlen(optarg) + 1);
+   strcpy(timingpath, optarg);
+   break;
+   default:
+   return COMMAND_ERROR_USAGE;
+   }
+   }
+
+   /* Check if external dtb given */
+   if (dtbfile) {
+   void *fdt;
+   size_t size;
+
+   fdt = read_file(dtbfile, size);
+   if (!fdt) {
+   pr_err(unable to read %s: %s\n, dtbfile

[PATCHv3 2/5] of: base: Add of_find_node_by_phandle_from

2014-09-30 Thread Teresa Gámez
Added of_find_node_by_phandle_from() to find nodes by
phandle with a given root node.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/of/base.c | 28 
 include/of.h  |  8 
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index c440a69..061fc79 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -265,19 +265,39 @@ struct device_node *of_find_node_by_alias(struct 
device_node *root, const char *
 EXPORT_SYMBOL_GPL(of_find_node_by_alias);
 
 /*
- * of_find_node_by_phandle - Find a node given a phandle
- * @handle:phandle of the node to find
+ * of_find_node_by_phandle_from - Find a node given a phandle from given
+ * root node.
+ * @handle:  phandle of the node to find
+ * @root:root node of the tree to search in. If NULL use the
+ *   internal tree.
  */
-struct device_node *of_find_node_by_phandle(phandle phandle)
+struct device_node *of_find_node_by_phandle_from(phandle phandle,
+   struct device_node *root)
 {
struct device_node *node;
 
-   of_tree_for_each_node_from(node, root_node)
+   if (!root)
+   root = root_node;
+
+   if (!root)
+   return 0;
+
+   of_tree_for_each_node_from(node, root)
if (node-phandle == phandle)
return node;
 
return NULL;
 }
+EXPORT_SYMBOL(of_find_node_by_phandle_from);
+
+/*
+ * of_find_node_by_phandle - Find a node given a phandle
+ * @handle:phandle of the node to find
+ */
+struct device_node *of_find_node_by_phandle(phandle phandle)
+{
+   return of_find_node_by_phandle_from(phandle, root_node);
+}
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
 /*
diff --git a/include/of.h b/include/of.h
index cd2bfe0..4281cce 100644
--- a/include/of.h
+++ b/include/of.h
@@ -123,6 +123,8 @@ extern struct device_node *of_find_node_by_path_from(struct 
device_node *from,
const char *path);
 extern struct device_node *of_find_node_by_path(const char *path);
 extern struct device_node *of_find_node_by_phandle(phandle phandle);
+extern struct device_node *of_find_node_by_phandle_from(phandle phandle,
+   struct device_node *root);
 extern struct device_node *of_find_node_by_type(struct device_node *from,
const char *type);
 extern struct device_node *of_find_compatible_node(struct device_node *from,
@@ -472,6 +474,12 @@ static inline struct device_node 
*of_find_node_by_phandle(phandle phandle)
return NULL;
 }
 
+static inline struct device_node *of_find_node_by_phandle_from(phandle phandle,
+   struct device_node *root)
+{
+   return NULL;
+}
+
 static inline struct device_node *of_find_compatible_node(
struct device_node *from,
const char *type,
-- 
1.9.1


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2] commands: add of_display_timings

2014-09-26 Thread Teresa Gámez
A lot of boards use display-timings nodes to define the timings of one or more
displays. This command makes it possible to list and select displays which are
defined in a device tree.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
Changes v2:
- removed cast
- added free(ftd)
- freed root

 commands/Kconfig  |   15 
 commands/Makefile |1 +
 commands/of_display_timings.c |  182 +
 3 files changed, 198 insertions(+), 0 deletions(-)
 create mode 100644 commands/of_display_timings.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 3a49baf..0563e63 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1973,6 +1973,21 @@ config CMD_OF_PROPERTY
  [00 11 22 .. nn]  - byte stream
  If the value does not start with '' or '[' it is interpreted as 
string
 
+config CMD_OF_DISPLAY_TIMINGS
+   tristate
+   select OFTREE
+   prompt of_display_timings
+   help
+ List and select display timings
+
+ Usage: of_display_timings [-lS] [-s path] [-f dtb]
+
+ Options:
+ -llist path of all available display-timings
+ -Slist path of all selected display-timings
+ -s path   select display-timings and register oftree fixup
+ -f dtbwork on dtb. Has no effect on -s option
+
 config CMD_OFTREE
tristate
select OFTREE
diff --git a/commands/Makefile b/commands/Makefile
index 52b6137..f5ecbe6 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_CMD_OFTREE)  += oftree.o
 obj-$(CONFIG_CMD_OF_PROPERTY)  += of_property.o
 obj-$(CONFIG_CMD_OF_NODE)  += of_node.o
 obj-$(CONFIG_CMD_OF_DUMP)  += of_dump.o
+obj-$(CONFIG_CMD_OF_DISPLAY_TIMINGS)   += of_display_timings.o
 obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o
 obj-$(CONFIG_CMD_IOMEM)+= iomemport.o
 obj-$(CONFIG_CMD_LINUX_EXEC)   += linux_exec.o
diff --git a/commands/of_display_timings.c b/commands/of_display_timings.c
new file mode 100644
index 000..9a6f8c8
--- /dev/null
+++ b/commands/of_display_timings.c
@@ -0,0 +1,182 @@
+/*
+ * of_display_timings.c - list and select display_timings
+ *
+ * Copyright (c) 2014 Teresa Gámez t.ga...@phytec.de PHYTEC Messtechnik GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include common.h
+#include filetype.h
+#include libfile.h
+#include of.h
+#include command.h
+#include malloc.h
+#include complete.h
+#include asm/byteorder.h
+#include getopt.h
+#include linux/err.h
+#include string.h
+
+static int of_display_timing(struct device_node *root, void *timingpath)
+{
+   int ret = 0;
+   struct device_node *display;
+
+   display = of_find_node_by_path_from(root, timingpath);
+   if (!display) {
+   pr_err(Path to display-timings is not vaild.\n);
+   ret = -EINVAL;
+   goto out;
+   }
+
+   ret = of_set_property_to_child_phandle(display, native-mode);
+   if (ret)
+   pr_err(Could not set display\n);
+out:
+   return ret;
+}
+
+static int do_of_display_timings(int argc, char *argv[])
+{
+   int opt;
+   int list = 0;
+   int selected = 0;
+   int ret = 0;
+   struct device_node *root = NULL;
+   struct device_node *internal_root = NULL;
+   struct device_node *display = NULL;
+   struct device_node *timings = NULL;
+   char *timingpath = NULL;
+   char *dtbfile = NULL;
+
+   while ((opt = getopt(argc, argv, sS:lf:))  0) {
+   switch (opt) {
+   case 'l':
+   list = 1;
+   break;
+   case 'f':
+   dtbfile = optarg;
+   break;
+   case 's':
+   selected = 1;
+   break;
+   case 'S':
+   timingpath = xzalloc(strlen(optarg) + 1);
+   strcpy(timingpath, optarg);
+   break;
+   default:
+   return COMMAND_ERROR_USAGE;
+   }
+   }
+
+   /* Check if external dtb given */
+   if (dtbfile) {
+   void *fdt;
+   size_t size;
+
+   fdt = read_file(dtbfile, size);
+   if (!fdt) {
+   pr_err(unable to read %s: %s\n, dtbfile,
+   strerror(errno

[PATCH] read_file_2: Fix return value

2014-09-24 Thread Teresa Gámez
Set return value correct in error case.
This prevents barebox from crashing in some conditions.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 lib/libfile.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/libfile.c b/lib/libfile.c
index c6fb6d7..c626e2f 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -163,8 +163,10 @@ again:
buf = xzalloc(read_size + 1);
 
fd = open(filename, O_RDONLY);
-   if (fd  0)
+   if (fd  0) {
+   ret = fd;
goto err_out;
+   }
 
ret = read_full(fd, buf, read_size);
if (ret  0)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] of: Added of_set_property_to_child_phandle

2014-09-24 Thread Teresa Gámez
Set a property to a phandle of a child node. This may be used
for selections like display-timings.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/of/base.c |   21 +
 include/of.h  |1 +
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index c440a69..eb5e1a1 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -336,6 +336,27 @@ phandle of_node_create_phandle(struct device_node *node)
 }
 EXPORT_SYMBOL(of_node_create_phandle);
 
+int of_set_property_to_child_phandle(struct device_node *node, char *prop_name)
+{
+   int ret;
+   phandle p;
+
+   /* Check if property exist */
+   if (!of_get_property(of_get_parent(node), prop_name, NULL))
+   return -EINVAL;
+
+   /* Create or get existing phandle of child node */
+   p = of_node_create_phandle(node);
+   p = cpu_to_be32(p);
+
+   node = of_get_parent(node);
+
+   ret = of_set_property(node, prop_name, p, sizeof(p), 0);
+
+   return ret;
+}
+EXPORT_SYMBOL(of_set_property_to_child_phandle);
+
 /*
  * Find a property with a given name for a given node
  * and return the value.
diff --git a/include/of.h b/include/of.h
index e6993fd..45ef56d 100644
--- a/include/of.h
+++ b/include/of.h
@@ -692,6 +692,7 @@ int of_device_disable_path(const char *path);
 
 phandle of_get_tree_max_phandle(struct device_node *root);
 phandle of_node_create_phandle(struct device_node *node);
+int of_set_property_to_child_phandle(struct device_node *node, char 
*prop_name);
 struct device_node *of_find_node_by_alias(struct device_node *root,
const char *alias);
 struct device_node *of_find_node_by_path_or_alias(struct device_node *root,
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] commands: add of_display_timings

2014-09-24 Thread Teresa Gámez
A lot of boards use display-timings nodes to define the timings of one or more
displays. This command makes it possible to list and select displays which are
defined in a device tree.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 commands/Kconfig  |   15 
 commands/Makefile |1 +
 commands/of_display_timings.c |  180 +
 3 files changed, 196 insertions(+), 0 deletions(-)
 create mode 100644 commands/of_display_timings.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 3a49baf..0563e63 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -1973,6 +1973,21 @@ config CMD_OF_PROPERTY
  [00 11 22 .. nn]  - byte stream
  If the value does not start with '' or '[' it is interpreted as 
string
 
+config CMD_OF_DISPLAY_TIMINGS
+   tristate
+   select OFTREE
+   prompt of_display_timings
+   help
+ List and select display timings
+
+ Usage: of_display_timings [-lS] [-s path] [-f dtb]
+
+ Options:
+ -llist path of all available display-timings
+ -Slist path of all selected display-timings
+ -s path   select display-timings and register oftree fixup
+ -f dtbwork on dtb. Has no effect on -s option
+
 config CMD_OFTREE
tristate
select OFTREE
diff --git a/commands/Makefile b/commands/Makefile
index 52b6137..f5ecbe6 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_CMD_OFTREE)  += oftree.o
 obj-$(CONFIG_CMD_OF_PROPERTY)  += of_property.o
 obj-$(CONFIG_CMD_OF_NODE)  += of_node.o
 obj-$(CONFIG_CMD_OF_DUMP)  += of_dump.o
+obj-$(CONFIG_CMD_OF_DISPLAY_TIMINGS)   += of_display_timings.o
 obj-$(CONFIG_CMD_MAGICVAR) += magicvar.o
 obj-$(CONFIG_CMD_IOMEM)+= iomemport.o
 obj-$(CONFIG_CMD_LINUX_EXEC)   += linux_exec.o
diff --git a/commands/of_display_timings.c b/commands/of_display_timings.c
new file mode 100644
index 000..67763f8
--- /dev/null
+++ b/commands/of_display_timings.c
@@ -0,0 +1,180 @@
+/*
+ * of_display_timings.c - list and select display_timings
+ *
+ * Copyright (c) 2014 Teresa Gámez t.ga...@phytec.de PHYTEC Messtechnik GmbH
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include common.h
+#include filetype.h
+#include libfile.h
+#include of.h
+#include command.h
+#include malloc.h
+#include complete.h
+#include asm/byteorder.h
+#include getopt.h
+#include linux/err.h
+#include string.h
+
+static int of_display_timing(struct device_node *root, void *timingpath)
+{
+   int ret = 0;
+   struct device_node *display;
+
+   display = of_find_node_by_path_from(root, (char *) timingpath);
+   if (!display) {
+   pr_err(Path to display-timings is not vaild.\n);
+   ret = -EINVAL;
+   goto out;
+   }
+
+   ret = of_set_property_to_child_phandle(display, native-mode);
+   if (ret)
+   pr_err(Could not set display\n);
+out:
+   return ret;
+}
+
+static int do_of_display_timings(int argc, char *argv[])
+{
+   int opt;
+   int list = 0;
+   int selected = 0;
+   int ret = 0;
+   struct device_node *root = NULL;
+   struct device_node *internal_root = NULL;
+   struct device_node *display = NULL;
+   struct device_node *timings = NULL;
+   char *timingpath = NULL;
+   char *dtbfile = NULL;
+
+   while ((opt = getopt(argc, argv, sS:lf:))  0) {
+   switch (opt) {
+   case 'l':
+   list = 1;
+   break;
+   case 'f':
+   dtbfile = optarg;
+   break;
+   case 's':
+   selected = 1;
+   break;
+   case 'S':
+   timingpath = xzalloc(strlen(optarg) + 1);
+   strcpy(timingpath, optarg);
+   break;
+   default:
+   return COMMAND_ERROR_USAGE;
+   }
+   }
+
+   /* Check if external dtb given */
+   if (dtbfile) {
+   void *fdt;
+   size_t size;
+
+   fdt = read_file(dtbfile, size);
+   if (!fdt) {
+   pr_err(unable to read %s: %s\n, dtbfile,
+   strerror(errno));
+   return -errno

[PATCH] commands: of_dump: Fix return value

2014-09-11 Thread Teresa Gámez
In an error case the return value is set nicely
but 0 is always beeing returned.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 commands/of_dump.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/of_dump.c b/commands/of_dump.c
index 1222ebf..513a4b8 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -34,7 +34,7 @@
 static int do_of_dump(int argc, char *argv[])
 {
int opt;
-   int ret;
+   int ret = 0;
int fix = 0;
struct device_node *root = NULL, *node, *of_free = NULL;
char *dtbfile = NULL;
@@ -117,7 +117,7 @@ out:
if (of_free)
of_delete_node(of_free);
 
-   return 0;
+   return ret;
 }
 
 BAREBOX_CMD_HELP_START(of_dump)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] defaultenv: Reorder overlay append order

2014-09-10 Thread Teresa Gámez
The defaultenv_add_base() functions adds the enviroment coming from
CONFIG_DEFAULT_ENVIRONMENT_PATH. But this is not only for
traditional enviroments, but also for external enviroments in e.g. build
systems. The external enviroment should override the enviroment set
in the board file and not the other way around. Made sure that
external enviroment is always added last.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 defaultenv/defaultenv.c |   16 ++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/defaultenv/defaultenv.c b/defaultenv/defaultenv.c
index dc0e484..3b4efcf 100644
--- a/defaultenv/defaultenv.c
+++ b/defaultenv/defaultenv.c
@@ -50,10 +50,20 @@ static void defaultenv_add_base(void)
defaultenv_append_directory(defaultenv_2_dfu);
if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT_GENERIC))
defaultenv_append_directory(defaultenv_1);
+}
+
+static void defaultenv_add_external(void)
+{
+   static int external_added;
+
+   if (external_added)
+   return;
+
+   external_added = 1;
 
/*
-* The traditional environment given with 
CONFIG_DEFAULT_ENVIRONMENT_PATH.
-* Once all users are converted to bbenv-y this can go.
+* The traditional or external environment given with
+* CONFIG_DEFAULT_ENVIRONMENT_PATH.
 */
defaultenv_append((void *)default_environment,
default_environment_size, defaultenv);
@@ -141,6 +151,8 @@ int defaultenv_load(const char *dir, unsigned flags)
 
defaultenv_add_base();
 
+   defaultenv_add_external();
+
list_for_each_entry(df, defaultenv_list, list) {
ret = defaultenv_load_one(df, dir, flags);
if (ret)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH v2] ARM: phyCORE-AM335x: Update partition table

2014-09-05 Thread Teresa Gámez
Added device tree partition and made rootfs partition
variable size depending on nand flash size.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
v2:
- fixed root partition start

 arch/arm/dts/am335x-phytec-phycore.dts |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 16febd3..e7e7780 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -194,8 +194,13 @@
};
 
partition@3 {
+   label = oftree;
+   reg = 0xc 0x2;
+   };
+
+   partition@4 {
label = kernel;
-   reg = 0xc 0x40;
+   reg = 0xe 0x40;
};
};
 };
@@ -305,13 +310,22 @@
};
 
partition@6 {
-   label = kernel;
-   reg = 0x12 0x80;
+   label = oftree;
+   reg = 0x12 0x2;
};
 
partition@7 {
+   label = kernel;
+   reg = 0x14 0x80;
+   };
+
+   partition@8 {
label = root;
-   reg = 0x92 0x1f6e;
+   /*
+* Size 0x0 extends partition to
+* end of nand flash.
+*/
+   reg = 0x94 0x0;
};
};
 };
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 4/5] ARM: phyCORE-AM335x: Add support for 2x512MB RAM

2014-09-04 Thread Teresa Gámez
Added settings for 1GB RAM option.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |   25 ++
 images/Makefile.am33xx   |4 +++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index a15e151..66bae80 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -36,6 +36,7 @@ enum {
MT41J128M16125IT_256MB,
MT41J64M1615IT_128MB,
MT41J256M16HA15EIT_512MB,
+   MT41J512M8125IT_2x512MB,
 };
 
 struct pcm051_sdram_timings timings[] = {
@@ -95,6 +96,25 @@ struct pcm051_sdram_timings timings[] = {
.wr_slave_ratio0= 0x7b,
},
},
+
+   /* 1024MB */
+   [MT41J512M8125IT_2x512MB] = {
+   .regs = {
+   .emif_read_latency  = 0x7,
+   .emif_tim1  = 0x0AAAE4DB,
+   .emif_tim2  = 0x266B7FDA,
+   .emif_tim3  = 0x501F867F,
+   .sdram_config   = 0x61C053B2,
+   .zq_config  = 0x50074BE4,
+   .sdram_ref_ctrl = 0x0C30
+   },
+   .data = {
+   .rd_slave_ratio0= 0x32,
+   .wr_dqs_slave_ratio0= 0x48,
+   .fifo_we_slave_ratio0   = 0x99,
+   .wr_slave_ratio0= 0x80,
+   },
+   },
 };
 
 extern char __dtb_am335x_phytec_phycore_start[];
@@ -169,6 +189,11 @@ ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_512mb, 
bootinfo, r1, r2)
pcm051_board_entry(bootinfo, MT41J256M16HA15EIT_512MB);
 }
 
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_2x512mb, bootinfo, r1, r2)
+{
+   pcm051_board_entry(bootinfo, MT41J512M8125IT_2x512MB);
+}
+
 ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, r2)
 {
void *fdt;
diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx
index c1f19c1..d24338e 100644
--- a/images/Makefile.am33xx
+++ b/images/Makefile.am33xx
@@ -23,6 +23,10 @@ pblx-$(CONFIG_MACH_PCM051) += 
start_am33xx_phytec_phycore_sram_512mb
 FILE_barebox-am33xx-phytec-phycore-mlo-512mb.img = 
start_am33xx_phytec_phycore_sram_512mb.pblx.mlo
 am33xx-mlo-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore-mlo-512mb.img
 
+pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_2x512mb
+FILE_barebox-am33xx-phytec-phycore-mlo-2x512mb.img = 
start_am33xx_phytec_phycore_sram_2x512mb.pblx.mlo
+am33xx-mlo-$(CONFIG_MACH_PCM051) += 
barebox-am33xx-phytec-phycore-mlo-2x512mb.img
+
 pblx-$(CONFIG_MACH_BEAGLEBONE) += start_am33xx_beaglebone_sdram
 FILE_barebox-am33xx-beaglebone.img = start_am33xx_beaglebone_sdram.pblx
 am33xx-barebox-$(CONFIG_MACH_BEAGLEBONE) += barebox-am33xx-beaglebone.img
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/5] ARM: phyCORE-AM335x: Update RAM Timings

2014-09-04 Thread Teresa Gámez
Increased the RAM frequency to 400MHz.
Recalculation of the RAM timing values was needed.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |   70 +++---
 1 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index ff1f04e..ff0b021 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -16,15 +16,15 @@
 #include debug_ll.h
 
 static const struct am33xx_cmd_control pcm051_cmd = {
-   .slave_ratio0 = 0x40,
+   .slave_ratio0 = 0x80,
.dll_lock_diff0 = 0x0,
-   .invert_clkout0 = 0x1,
-   .slave_ratio1 = 0x40,
+   .invert_clkout0 = 0x0,
+   .slave_ratio1 = 0x80,
.dll_lock_diff1 = 0x0,
-   .invert_clkout1 = 0x1,
-   .slave_ratio2 = 0x40,
+   .invert_clkout1 = 0x0,
+   .slave_ratio2 = 0x80,
.dll_lock_diff2 = 0x0,
-   .invert_clkout2 = 0x1,
+   .invert_clkout2 = 0x0,
 };
 
 struct pcm051_sdram_timings {
@@ -42,57 +42,57 @@ struct pcm051_sdram_timings timings[] = {
/* 1x256M16 */
[MT41J128M16125IT_1x256M16] = {
.regs = {
-   .emif_read_latency  = 0x6,
-   .emif_tim1  = 0x0888A39B,
-   .emif_tim2  = 0x26337FDA,
-   .emif_tim3  = 0x501F830F,
-   .sdram_config   = 0x61C04AB2,
+   .emif_read_latency  = 0x7,
+   .emif_tim1  = 0x0AAAD4DB,
+   .emif_tim2  = 0x26437FDA,
+   .emif_tim3  = 0x501F83FF,
+   .sdram_config   = 0x61C052B2,
.zq_config  = 0x50074BE4,
-   .sdram_ref_ctrl = 0x093B,
+   .sdram_ref_ctrl = 0x0C30,
},
.data = {
.rd_slave_ratio0= 0x3B,
-   .wr_dqs_slave_ratio0= 0x3B,
-   .fifo_we_slave_ratio0   = 0x97,
-   .wr_slave_ratio0= 0x76,
+   .wr_dqs_slave_ratio0= 0x33,
+   .fifo_we_slave_ratio0   = 0x9c,
+   .wr_slave_ratio0= 0x6f,
},
},
 
/* 1x128M16 */
[MT41J64M1615IT_1x128M16] = {
.regs =  {
-   .emif_read_latency  = 0x6,
-   .emif_tim1  = 0x0888A39B,
-   .emif_tim2  = 0x26247FDA,
-   .emif_tim3  = 0x501F821F,
-   .sdram_config   = 0x61C04A32,
+   .emif_read_latency  = 0x7,
+   .emif_tim1  = 0x0AAAE4DB,
+   .emif_tim2  = 0x262F7FDA,
+   .emif_tim3  = 0x501F82BF,
+   .sdram_config   = 0x61C05232,
.zq_config  = 0x50074BE4,
-   .sdram_ref_ctrl = 0x093B,
+   .sdram_ref_ctrl = 0x0C30,
},
.data = {
-   .rd_slave_ratio0= 0x3A,
-   .wr_dqs_slave_ratio0= 0x36,
+   .rd_slave_ratio0= 0x38,
+   .wr_dqs_slave_ratio0= 0x34,
.fifo_we_slave_ratio0   = 0xA2,
-   .wr_slave_ratio0= 0x74,
+   .wr_slave_ratio0= 0x72,
},
},
 
/* 1x512MB */
[MT41J256M16HA15EIT_1x512M16] = {
.regs = {
-   .emif_read_latency  = 0x6,
-   .emif_tim1  = 0x0888A39B,
-   .emif_tim2  = 0x26517FDA,
-   .emif_tim3  = 0x501F84EF,
-   .sdram_config   = 0x61C04B32,
+   .emif_read_latency  = 0x7,
+   .emif_tim1  = 0x0AAAE4DB,
+   .emif_tim2  = 0x266B7FDA,
+   .emif_tim3  = 0x501F867F,
+   .sdram_config   = 0x61C05332,
.zq_config  = 0x50074BE4,
-   .sdram_ref_ctrl = 0x093B,
+   .sdram_ref_ctrl = 0x0C30
},
.data = {
-   .rd_slave_ratio0= 0x3B,
-   .wr_dqs_slave_ratio0= 0x3B,
-   .fifo_we_slave_ratio0   = 0x96

[PATCH 5/5] ARM: phyCORE-AM335x: Update partition table

2014-09-04 Thread Teresa Gámez
Added device tree partition and made rootfs partition
variable size depending on nand flash size.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore.dts |   22 ++
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 16febd3..047dc15 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -194,8 +194,13 @@
};
 
partition@3 {
+   label = oftree;
+   reg = 0xc 0x2;
+   };
+
+   partition@4 {
label = kernel;
-   reg = 0xc 0x40;
+   reg = 0xe 0x40;
};
};
 };
@@ -305,13 +310,22 @@
};
 
partition@6 {
-   label = kernel;
-   reg = 0x12 0x80;
+   label = oftree;
+   reg = 0x12 0x2;
};
 
partition@7 {
+   label = kernel;
+   reg = 0x14 0x80;
+   };
+
+   partition@8 {
label = root;
-   reg = 0x92 0x1f6e;
+   /*
+* Size 0x0 extends partition to
+* end of nand flash.
+*/
+   reg = 0x92 0x0;
};
};
 };
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/5] ARM: phyCORE-AM335x: Fixup RAM setting naming

2014-09-04 Thread Teresa Gámez
Naming is confusing and wrong. Fixed it up.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/phytec-phycore-am335x/lowlevel.c |   30 +++---
 images/Makefile.am33xx   |   18 ++--
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c 
b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
index ff0b021..a15e151 100644
--- a/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
+++ b/arch/arm/boards/phytec-phycore-am335x/lowlevel.c
@@ -33,14 +33,14 @@ struct pcm051_sdram_timings {
 };
 
 enum {
-   MT41J128M16125IT_1x256M16,
-   MT41J64M1615IT_1x128M16,
-   MT41J256M16HA15EIT_1x512M16,
+   MT41J128M16125IT_256MB,
+   MT41J64M1615IT_128MB,
+   MT41J256M16HA15EIT_512MB,
 };
 
 struct pcm051_sdram_timings timings[] = {
-   /* 1x256M16 */
-   [MT41J128M16125IT_1x256M16] = {
+   /* 256MB */
+   [MT41J128M16125IT_256MB] = {
.regs = {
.emif_read_latency  = 0x7,
.emif_tim1  = 0x0AAAD4DB,
@@ -58,8 +58,8 @@ struct pcm051_sdram_timings timings[] = {
},
},
 
-   /* 1x128M16 */
-   [MT41J64M1615IT_1x128M16] = {
+   /* 128MB */
+   [MT41J64M1615IT_128MB] = {
.regs =  {
.emif_read_latency  = 0x7,
.emif_tim1  = 0x0AAAE4DB,
@@ -77,8 +77,8 @@ struct pcm051_sdram_timings timings[] = {
},
},
 
-   /* 1x512MB */
-   [MT41J256M16HA15EIT_1x512M16] = {
+   /* 512MB */
+   [MT41J256M16HA15EIT_512MB] = {
.regs = {
.emif_read_latency  = 0x7,
.emif_tim1  = 0x0AAAE4DB,
@@ -154,19 +154,19 @@ static noinline void pcm051_board_entry(unsigned long 
bootinfo, int sdram)
pcm051_board_init(sdram);
 }
 
-ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_1x256m16, bootinfo, r1, r2)
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_256mb, bootinfo, r1, r2)
 {
-   pcm051_board_entry(bootinfo, MT41J128M16125IT_1x256M16);
+   pcm051_board_entry(bootinfo, MT41J128M16125IT_256MB);
 }
 
-ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_1x128m16, bootinfo, r1, r2)
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_128mb, bootinfo, r1, r2)
 {
-   pcm051_board_entry(bootinfo, MT41J64M1615IT_1x128M16);
+   pcm051_board_entry(bootinfo, MT41J64M1615IT_128MB);
 }
 
-ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_1x512m16, bootinfo, r1, r2)
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram_512mb, bootinfo, r1, r2)
 {
-   pcm051_board_entry(bootinfo, MT41J256M16HA15EIT_1x512M16);
+   pcm051_board_entry(bootinfo, MT41J256M16HA15EIT_512MB);
 }
 
 ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, r2)
diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx
index fa1f848..c1f19c1 100644
--- a/images/Makefile.am33xx
+++ b/images/Makefile.am33xx
@@ -11,17 +11,17 @@ pblx-$(CONFIG_MACH_PCM051) += 
start_am33xx_phytec_phycore_sdram
 FILE_barebox-am33xx-phytec-phycore.img = start_am33xx_phytec_phycore_sdram.pblx
 am33xx-barebox-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore.img
 
-pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_1x256m16
-FILE_barebox-am33xx-phytec-phycore-mlo-1x256m16.img = 
start_am33xx_phytec_phycore_sram_1x256m16.pblx.mlo
-am33xx-mlo-$(CONFIG_MACH_PCM051) += 
barebox-am33xx-phytec-phycore-mlo-1x256m16.img
+pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_256mb
+FILE_barebox-am33xx-phytec-phycore-mlo-256mb.img = 
start_am33xx_phytec_phycore_sram_256mb.pblx.mlo
+am33xx-mlo-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore-mlo-256mb.img
 
-pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_1x128m16
-FILE_barebox-am33xx-phytec-phycore-mlo-1x128m16.img = 
start_am33xx_phytec_phycore_sram_1x128m16.pblx.mlo
-am33xx-mlo-$(CONFIG_MACH_PCM051) += 
barebox-am33xx-phytec-phycore-mlo-1x128m16.img
+pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_128mb
+FILE_barebox-am33xx-phytec-phycore-mlo-128mb.img = 
start_am33xx_phytec_phycore_sram_128mb.pblx.mlo
+am33xx-mlo-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore-mlo-128mb.img
 
-pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_1x512m16
-FILE_barebox-am33xx-phytec-phycore-mlo-1x512m16.img = 
start_am33xx_phytec_phycore_sram_1x512m16.pblx.mlo
-am33xx-mlo-$(CONFIG_MACH_PCM051) += 
barebox-am33xx-phytec-phycore-mlo-1x512m16.img
+pblx-$(CONFIG_MACH_PCM051) += start_am33xx_phytec_phycore_sram_512mb
+FILE_barebox-am33xx-phytec-phycore-mlo-512mb.img = 
start_am33xx_phytec_phycore_sram_512mb.pblx.mlo
+am33xx-mlo-$(CONFIG_MACH_PCM051) += barebox-am33xx-phytec-phycore-mlo-512mb.img
 
 pblx-$(CONFIG_MACH_BEAGLEBONE) += start_am33xx_beaglebone_sdram
 FILE_barebox-am33xx-beaglebone.img = start_am33xx_beaglebone_sdram.pblx
-- 
1.7.0.4

[PATCH 1/5] ARM: phyCORE-AM335x: Updated SPI NOR dts entries

2014-09-04 Thread Teresa Gámez
Updated the SPI NOR flash entries. NOR flash got
detected but did not work.

- Updated muxing
- Fixed frequency
- Fixed CS
- Removed first compatible entry (the flashes used is changing frequently)

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore.dts |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 5678138..16febd3 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -50,10 +50,10 @@
 
spi0_pins: pinmux_spi0_pins {
pinctrl-single,pins = 
-   0x150 (INPUT_EN | MUX_MODE0)
-   0x154 (PULL_UP | INPUT_EN | MUX_MODE0)
-   0x158 (INPUT_EN | MUX_MODE0)
-   0x15c (PULL_UP | INPUT_EN | MUX_MODE0)
+   0x150 (PIN_INPUT_PULLDOWN | MUX_MODE0)  /* 
spi0_clk.spi0_clk */
+   0x154 (PIN_INPUT_PULLDOWN | MUX_MODE0)  /* 
spi0_d0.spi0_d0 */
+   0x158 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
spi0_d1.spi0_d1 */
+   0x15c (PIN_INPUT_PULLUP | MUX_MODE0)/* 
spi0_cs0.spi0_cs0 */
;
};
 
@@ -172,9 +172,9 @@
status = okay;
 
flash: m25p80 {
-   compatible = sst,sst25vf032b, m25p80;
-   spi-max-frequency = 1500;
-   reg = 1;
+   compatible = m25p80;
+   spi-max-frequency = 4800;
+   reg = 0;
#address-cells = 1;
#size-cells = 1;
 
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: am335x Phytec phyCORE: Enable ethernet

2014-07-09 Thread Teresa Gámez
With an update of the am33xx.dtsi (commit 9313920df6) the mdio and mac
nodes are not enabled on default any more. Enable them explicit
in the board dts now.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/dts/am335x-phytec-phycore.dts |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 6196eb3..63debd2 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -214,6 +214,7 @@
 davinci_mdio {
pinctrl-names = default;
pinctrl-0 = davinci_mdio_default;
+   status = okay;
 };
 
 phy_sel {
@@ -236,6 +237,7 @@
pinctrl-names = default;
pinctrl-0 = emac_rmii1_pins;
dual_emac = 1;
+   status = okay;
 };
 
 gpmc {
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2] mci: omap: Fix default value of mci.f_max

2013-10-02 Thread Teresa Gámez
With commit c2ef47887 mci.f_max default value is
only set when pdata is available.

Fix this with always setting the mci.f_max default
value and overrite it when pdata available.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
changes in v2:
- set default value always and overwrite it when pdata available 
- updated commit message

 drivers/mci/omap_hsmmc.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index a2cd3fe..19db461 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -609,19 +609,17 @@ static int omap_mmc_probe(struct device_d *dev)
hsmmc-mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 
hsmmc-mci.f_min = 40;
+   hsmmc-mci.f_max = 5200;
 
pdata = (struct omap_hsmmc_platform_data *)dev-platform_data;
if (pdata) {
if (pdata-f_max)
hsmmc-mci.f_max = pdata-f_max;
-   else
-   hsmmc-mci.f_max = 5200;
 
if (pdata-devname)
hsmmc-mci.devname = pdata-devname;
}
 
-
dev-priv = hsmmc;
dev-detect = omap_mmc_detect,
 
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] arm: Update mach-types

2013-09-27 Thread Teresa Gámez
Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/tools/mach-types |  585 -
 1 files changed, 580 insertions(+), 5 deletions(-)

diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 325513f..01bc7aa 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
 #
 #   http://www.arm.linux.org.uk/developer/machines/?action=new
 #
-# Last update: Mon May 14 09:28:07 2012
+# Last update: Wed Sep 25 08:48:26 2013
 #
 # machine_is_xxx   CONFIG_ MACH_TYPE_xxx   number
 #
@@ -3006,6 +3006,7 @@ armada_xp_db  MACH_ARMADA_XP_DB   
ARMADA_XP_DB3036
 spdm   MACH_SPDM   SPDM3037
 gtib   MACH_GTIB   GTIB3038
 dgm3240MACH_DGM3240DGM3240 
3039
+iv_atlas_i_lpe MACH_ATLAS_I_LPEATLAS_I_LPE 3040
 htcmegaMACH_HTCMEGAHTCMEGA 
3041
 tricorder  MACH_TRICORDER  TRICORDER   3042
 tx28   MACH_TX28   TX283043
@@ -3279,7 +3280,7 @@ shenzhou  MACH_SHENZHOU   SHENZHOU
3319
 cwme9210   MACH_CWME9210   CWME92103320
 cwme9210js MACH_CWME9210JS CWME9210JS  3321
 pgs_v1 MACH_PGS_SITARA PGS_SITARA  3322
-colibri_tegra2 MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2  3323
+colibri_t20MACH_COLIBRI_TEGRA2 COLIBRI_TEGRA2  3323
 w21MACH_W21W21 3324
 polysat1   MACH_POLYSAT1   POLYSAT13325
 datawayMACH_DATAWAYDATAWAY 
3326
@@ -3811,7 +3812,7 @@ farleys   MACH_FARLEYSFARLEYS 
3856
 efm32gg_dk3750 MACH_EFM32GG_DK3750 EFM32GG_DK3750  3857
 zeus_board MACH_ZEUS_BOARD ZEUS_BOARD  3858
 cc51   MACH_CC51   CC513859
-fxi_c210   MACH_FXI_C210   FXI_C2103860
+cottoncandyMACH_FXI_C210   FXI_C2103860
 msm8627_cdpMACH_MSM8627_CDPMSM8627_CDP 3861
 msm8627_mtpMACH_MSM8627_MTPMSM8627_MTP 3862
 armadillo800evaMACH_ARMADILLO800EVAARMADILLO800EVA 
3863
@@ -4071,7 +4072,7 @@ tam335x   MACH_TAM335XTAM335X 
4116
 grouperMACH_GROUPERGROUPER 
4117
 mpcsa21_9g20   MACH_MPCSA21_9G20   MPCSA21_9G204118
 m6u_cpuMACH_M6U_CPUM6U_CPU 
4119
-davinci_dp10   MACH_DAVINCI_DP10   DAVINCI_DP104120
+davinci_dp7MACH_DAVINCI_DP10   DAVINCI_DP104120
 ginkgo MACH_GINKGO GINKGO  4121
 cgt_qmx6   MACH_CGT_QMX6   CGT_QMX64122
 profpgaMACH_PROFPGAPROFPGA 
4123
@@ -4121,7 +4122,7 @@ msm8625_ffa   MACH_MSM8625_FFA
MSM8625_FFA 4166
 vpu101 MACH_VPU101 VPU101  4167
 operaulMACH_OPERA_UL   OPERA_UL
4168
 baileysMACH_BAILEYSBAILEYS 
4169
-familybox  MACH_FAMILYBOX  FAMILYBOX   4170
+cloudbox   MACH_FAMILYBOX  FAMILYBOX   4170
 ensemble_mx35  MACH_ENSEMBLE_MX35  ENSEMBLE_MX35   4171
 sc_sps_1   MACH_SC_SPS_1   SC_SPS_14172
 ucsimply_sam9260   MACH_UCSIMPLY_SAM9260   UCSIMPLY_SAM92604173
@@ -4148,3 +4149,577 @@ msm8625_evt MACH_MSM8625_EVT
MSM8625_EVT 4193
 mx53_sellwood  MACH_MX53_SELLWOOD  MX53_SELLWOOD   4194
 somiq_am35 MACH_SOMIQ_AM35 SOMIQ_AM35  4195
 somiq_am37 MACH_SOMIQ_AM37 SOMIQ_AM37  4196
+k2_plc_cl  MACH_K2_PLC_CL  K2_PLC_CL   4197
+tc2MACH_TC2TC2 4198
+dulex_jMACH_DULEX_JDULEX_J 
4199
+stm_b2044  MACH_STM_B2044  STM_B2044   4200
+deluxe_j   MACH_DELUXE_J   DELUXE_J4201
+mango2443  MACH_MANGO2443  MANGO2443   4202
+cp2dcg

[PATCH] mci: omap: Fix default value of mci.f_max

2013-09-27 Thread Teresa Gámez
Set default value of mci.f_max even when no pdata
is available.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/mci/omap_hsmmc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/omap_hsmmc.c b/drivers/mci/omap_hsmmc.c
index a2cd3fe..f63697f 100644
--- a/drivers/mci/omap_hsmmc.c
+++ b/drivers/mci/omap_hsmmc.c
@@ -614,11 +614,11 @@ static int omap_mmc_probe(struct device_d *dev)
if (pdata) {
if (pdata-f_max)
hsmmc-mci.f_max = pdata-f_max;
-   else
-   hsmmc-mci.f_max = 5200;
 
if (pdata-devname)
hsmmc-mci.devname = pdata-devname;
+   } else {
+   hsmmc-mci.f_max = 5200;
}
 
 
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] PCM051: Fix muxing of MMC0 CD

2013-09-02 Thread Teresa Gámez
Card detect should be rather muxed as gpio then
mmc0_sdcd, as driver does not support this.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/pcm051/mux.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/pcm051/mux.c b/arch/arm/boards/pcm051/mux.c
index 6ef5af1..b54f3d5 100644
--- a/arch/arm/boards/pcm051/mux.c
+++ b/arch/arm/boards/pcm051/mux.c
@@ -10,7 +10,7 @@ static const struct module_pin_mux mmc0_pin_mux[] = {
{OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)},  /* MMC0_DAT0 */
{OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CLK */
{OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CMD */
-   {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)},   /* MMC0_CD */
+   {OFFSET(spi0_cs1), (MODE(7) | RXACTIVE | PULLUP_EN)},   /* MMC0_CD */
{-1},
 };
 
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH for next] PCM051: Fixup DDRPLL

2013-08-29 Thread Teresa Gámez
The correct DDRPLL for PCM051 is 303MHz.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 As the board runs also fine with 266MHz. There
 is no need to fix it in master.

 arch/arm/boards/pcm051/lowlevel.c  |2 +-
 arch/arm/mach-omap/include/mach/am33xx-clock.h |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/pcm051/lowlevel.c 
b/arch/arm/boards/pcm051/lowlevel.c
index 078e83b..48578cd 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -68,7 +68,7 @@ static int pcm051_board_init(void)
if (running_in_sdram())
return 0;
 
-   pll_init(MPUPLL_M_600, 25, DDRPLL_M_266);
+   pll_init(MPUPLL_M_600, 25, DDRPLL_M_303);
 
am335x_sdram_init(0x18B, MT41J256M8HX15E_2x256M8_cmd,
MT41J256M8HX15E_2x256M8_regs,
diff --git a/arch/arm/mach-omap/include/mach/am33xx-clock.h 
b/arch/arm/mach-omap/include/mach/am33xx-clock.h
index b3c7519..ecd90b2 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-clock.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-clock.h
@@ -49,6 +49,7 @@
 /* DDR Freq is 266 MHZ for now*/
 /* Set Fdll = 400 MHZ , Fdll = M * 2 * CLKINP/ N + 1; clkout = Fdll /(2 * M2) 
*/
 #define DDRPLL_M_266   266
+#define DDRPLL_M_303   303
 #define DDRPLL_M_400   400
 #define DDRPLL_N   (OSC - 1)
 #define DDRPLL_M2  1
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] ARM: OMAP: PCM051: Remove spi platform data

2013-08-26 Thread Teresa Gámez
SPI NOR flash can be detected by driver so no platform data
is necessary.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/pcm051/board.c |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
index 1993f34..4a740c8 100644
--- a/arch/arm/boards/pcm051/board.c
+++ b/arch/arm/boards/pcm051/board.c
@@ -66,11 +66,6 @@ static int pcm051_mem_init(void)
 }
 mem_initcall(pcm051_mem_init);
 
-static struct flash_platform_data pcm051_spi_flash = {
-   .name   = m25p,
-   .type   = w25q64,
-};
-
 /*
 * SPI Flash works at 80Mhz however the SPI controller runs with 48MHz.
 * So setup Max speed to be less than the controller speed.
@@ -78,7 +73,6 @@ static struct flash_platform_data pcm051_spi_flash = {
 static struct spi_board_info pcm051_spi_board_info[] = {
{
.name   = m25p80,
-   .platform_data  = pcm051_spi_flash,
.max_speed_hz   = 2400,
.bus_num= 0,
.chip_select= 0,
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/3 for next] beaglebone: Clean up lowlevel code

2013-08-23 Thread Teresa Gámez
Using here now the initialisiation functions in
am33xx_generic.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
I'm not able to test this as I do not have a beaglebone.
But I do have oritened on the u-boot code which does
not seem to differ between ddr2 and ddr3 initalisation
functions.
How bad this colidates now with Saschas and Jans bbb patches.
Maybe someone could test this anyway? And we'll find a solution
for a cleaner lowlevel code..

 arch/arm/boards/beaglebone/lowlevel.c |  252 ++--
 1 files changed, 48 insertions(+), 204 deletions(-)

diff --git a/arch/arm/boards/beaglebone/lowlevel.c 
b/arch/arm/boards/beaglebone/lowlevel.c
index 2f3b3df..368188a 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -12,211 +12,59 @@
 #include mach/am33xx-mux.h
 #include mach/wdt.h
 
-/* UART Defines */
-#define UART_SYSCFG_OFFSET  (0x54)
-#define UART_SYSSTS_OFFSET  (0x58)
-
-#define UART_RESET  (0x1  1)
-#define UART_CLK_RUNNING_MASK   0x1
-#define UART_SMART_IDLE_EN  (0x1  0x3)
-
-/* AM335X EMIF Register values */
-#define EMIF_SDMGT 0x8000
-#define EMIF_SDRAM 0x4650
-#define EMIF_PHYCFG0x2
-#define DDR_PHY_RESET  (0x1  10)
-#define DDR_FUNCTIONAL_MODE_EN 0x1
-#define DDR_PHY_READY  (0x1  2)
-#defineVTP_CTRL_READY  (0x1  5)
-#define VTP_CTRL_ENABLE(0x1  6)
-#define VTP_CTRL_LOCK_EN   (0x1  4)
-#define VTP_CTRL_START_EN  (0x1)
-#define DDR2_RATIO 0x80/* for mDDR */
-#define CMD_FORCE  0x00/* common #def */
-#define CMD_DELAY  0x00
-
-#define EMIF_READ_LATENCY  0x05
-#define EMIF_TIM1  0x0666B3D6
-#define EMIF_TIM2  0x143731DA
-#defineEMIF_TIM3   0x0347
-#define EMIF_SDCFG 0x43805332
-#define EMIF_SDREF 0x081a
-#define DDR2_DLL_LOCK_DIFF 0x0
 #define DDR2_RD_DQS0x12
 #define DDR2_PHY_FIFO_WE   0x80
-
-#defineDDR2_INVERT_CLKOUT  0x00
 #defineDDR2_WR_DQS 0x00
 #defineDDR2_PHY_WRLVL  0x00
 #defineDDR2_PHY_GATELVL0x00
 #defineDDR2_PHY_WR_DATA0x40
-#definePHY_RANK0_DELAY 0x01
-#define PHY_DLL_LOCK_DIFF  0x0
-#define DDR_IOCTRL_VALUE   0x18B
-
-static void beaglebone_data_macro_config(int dataMacroNum)
-{
-   u32 BaseAddrOffset = 0x00;
-
-   if (dataMacroNum == 1)
-   BaseAddrOffset = 0xA4;
-
-   __raw_writel(((DDR2_RD_DQS30)|(DDR2_RD_DQS20)
-   |(DDR2_RD_DQS10)|(DDR2_RD_DQS0)),
-   (AM33XX_DATA0_RD_DQS_SLAVE_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_RD_DQS2,
-   (AM33XX_DATA0_RD_DQS_SLAVE_RATIO_1 + BaseAddrOffset));
-   __raw_writel(((DDR2_WR_DQS30)|(DDR2_WR_DQS20)
-   |(DDR2_WR_DQS10)|(DDR2_WR_DQS0)),
-   (AM33XX_DATA0_WR_DQS_SLAVE_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_WR_DQS2,
-   (AM33XX_DATA0_WR_DQS_SLAVE_RATIO_1 + BaseAddrOffset));
-   __raw_writel(((DDR2_PHY_WRLVL30)|(DDR2_PHY_WRLVL20)
-   |(DDR2_PHY_WRLVL10)|(DDR2_PHY_WRLVL0)),
-   (AM33XX_DATA0_WRLVL_INIT_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_PHY_WRLVL2,
-   (AM33XX_DATA0_WRLVL_INIT_RATIO_1 + BaseAddrOffset));
-   __raw_writel(((DDR2_PHY_GATELVL30)|(DDR2_PHY_GATELVL20)
-   |(DDR2_PHY_GATELVL10)|(DDR2_PHY_GATELVL0)),
-   (AM33XX_DATA0_GATELVL_INIT_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_PHY_GATELVL2,
-   (AM33XX_DATA0_GATELVL_INIT_RATIO_1 + BaseAddrOffset));
-   __raw_writel(((DDR2_PHY_FIFO_WE30)|(DDR2_PHY_FIFO_WE20)
-   |(DDR2_PHY_FIFO_WE10)|(DDR2_PHY_FIFO_WE0)),
-   (AM33XX_DATA0_FIFO_WE_SLAVE_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_PHY_FIFO_WE2,
-   (AM33XX_DATA0_FIFO_WE_SLAVE_RATIO_1 + BaseAddrOffset));
-   __raw_writel(((DDR2_PHY_WR_DATA30)|(DDR2_PHY_WR_DATA20)
-   |(DDR2_PHY_WR_DATA10)|(DDR2_PHY_WR_DATA0)),
-   (AM33XX_DATA0_WR_DATA_SLAVE_RATIO_0 + BaseAddrOffset));
-   __raw_writel(DDR2_PHY_WR_DATA2,
-   (AM33XX_DATA0_WR_DATA_SLAVE_RATIO_1 + BaseAddrOffset));
-   __raw_writel(PHY_DLL_LOCK_DIFF,
-   (AM33XX_DATA0_DLL_LOCK_DIFF_0 + BaseAddrOffset));
-}
-
-static void beaglebone_cmd_macro_config(void)
-{
-   __raw_writel(DDR2_RATIO, AM33XX_CMD0_CTRL_SLAVE_RATIO_0);
-   __raw_writel(CMD_FORCE, AM33XX_CMD0_CTRL_SLAVE_FORCE_0);
-   __raw_writel(CMD_DELAY, AM33XX_CMD0_CTRL_SLAVE_DELAY_0);
-   __raw_writel(DDR2_DLL_LOCK_DIFF, AM33XX_CMD0_DLL_LOCK_DIFF_0);
-   __raw_writel(DDR2_INVERT_CLKOUT, AM33XX_CMD0_INVERT_CLKOUT_0);
-
-   __raw_writel(DDR2_RATIO, AM33XX_CMD1_CTRL_SLAVE_RATIO_0);
-   __raw_writel(CMD_FORCE, AM33XX_CMD1_CTRL_SLAVE_FORCE_0);
-   __raw_writel

[PATCH 1/3 for next] AM33xx: Cleanup of lowlevel code

2013-08-23 Thread Teresa Gámez
There is a lot of duplicate lowlevel code between the
am33xx boards. Move this code to am33xx_generic and
create structs for sdram settings.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/am33xx_generic.c  |  166 ++
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   45 ++
 2 files changed, 211 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
index a653ef7..1b43749 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -171,3 +171,169 @@ static int am33xx_gpio_init(void)
return 0;
 }
 coredevice_initcall(am33xx_gpio_init);
+
+/* UART Defines */
+#define UART_SYSCFG_OFFSET 0x54
+#define UART_SYSSTS_OFFSET 0x58
+
+#define UART_CLK_RUNNING_MASK  0x1
+#define UART_RESET (0x1  1)
+#define UART_SMART_IDLE_EN (0x1  0x3)
+
+void am33xx_uart0_soft_reset(void)
+{
+   int reg;
+
+   reg  = readl(AM33XX_UART0_BASE + UART_SYSCFG_OFFSET);
+   reg |= UART_RESET;
+   writel(reg, (AM33XX_UART0_BASE + UART_SYSCFG_OFFSET));
+   while ((readl(AM33XX_UART0_BASE + UART_SYSSTS_OFFSET) 
+   UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
+   ;
+
+   /* Disable smart idle */
+   reg = readl((AM33XX_UART0_BASE + UART_SYSCFG_OFFSET));
+   reg |= UART_SMART_IDLE_EN;
+   writel(reg, (AM33XX_UART0_BASE + UART_SYSCFG_OFFSET))
+   ;
+}
+
+
+#define VTP_CTRL_READY (0x1  5)
+#define VTP_CTRL_ENABLE(0x1  6)
+#define VTP_CTRL_START_EN  (0x1)
+
+void am33xx_config_vtp(void)
+{
+   writel(readl(AM33XX_VTP0_CTRL_REG) | VTP_CTRL_ENABLE,
+   AM33XX_VTP0_CTRL_REG);
+   writel(readl(AM33XX_VTP0_CTRL_REG)  (~VTP_CTRL_START_EN),
+   AM33XX_VTP0_CTRL_REG);
+   writel(readl(AM33XX_VTP0_CTRL_REG) | VTP_CTRL_START_EN,
+   AM33XX_VTP0_CTRL_REG);
+
+   /* Poll for READY */
+   while ((readl(AM33XX_VTP0_CTRL_REG) 
+   VTP_CTRL_READY) != VTP_CTRL_READY)
+   ;
+}
+
+void am33xx_ddr_phydata_cmd_macro(const struct am33xx_cmd_control *cmd_ctrl)
+{
+   writel(cmd_ctrl-slave_ratio0, AM33XX_CMD0_CTRL_SLAVE_RATIO_0);
+   writel(cmd_ctrl-dll_lock_diff0, AM33XX_CMD0_DLL_LOCK_DIFF_0);
+   writel(cmd_ctrl-invert_clkout0, AM33XX_CMD0_INVERT_CLKOUT_0);
+
+   writel(cmd_ctrl-slave_ratio1, AM33XX_CMD1_CTRL_SLAVE_RATIO_0);
+   writel(cmd_ctrl-dll_lock_diff1, AM33XX_CMD1_DLL_LOCK_DIFF_0);
+   writel(cmd_ctrl-invert_clkout1, AM33XX_CMD1_INVERT_CLKOUT_0);
+
+   writel(cmd_ctrl-slave_ratio2, AM33XX_CMD2_CTRL_SLAVE_RATIO_0);
+   writel(cmd_ctrl-dll_lock_diff2, AM33XX_CMD2_DLL_LOCK_DIFF_0);
+   writel(cmd_ctrl-invert_clkout2, AM33XX_CMD2_INVERT_CLKOUT_0);
+}
+
+#define CM_EMIF_SDRAM_CONFIG   (AM33XX_CTRL_BASE + 0x110)
+
+void am33xx_config_sdram(const struct am33xx_emif_regs *regs)
+{
+   writel(regs-emif_read_latency, AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_1));
+   writel(regs-emif_read_latency,
+   AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_1_SHADOW));
+   writel(regs-emif_read_latency, AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_2));
+   writel(regs-emif_tim1, AM33XX_EMIF4_0_REG(SDRAM_TIM_1));
+   writel(regs-emif_tim1, AM33XX_EMIF4_0_REG(SDRAM_TIM_1_SHADOW));
+   writel(regs-emif_tim2, AM33XX_EMIF4_0_REG(SDRAM_TIM_2));
+   writel(regs-emif_tim2, AM33XX_EMIF4_0_REG(SDRAM_TIM_2_SHADOW));
+   writel(regs-emif_tim3, AM33XX_EMIF4_0_REG(SDRAM_TIM_3));
+   writel(regs-emif_tim3, AM33XX_EMIF4_0_REG(SDRAM_TIM_3_SHADOW));
+
+   if (regs-zq_config) {
+   /*
+* A value of 0x2800 for the REF CTRL will give us
+* about 570us for a delay, which will be long enough
+* to configure things.
+*/
+   writel(0x2800, AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL));
+   writel(regs-zq_config, AM33XX_EMIF4_0_REG(ZQ_CONFIG));
+   writel(regs-sdram_config, CM_EMIF_SDRAM_CONFIG);
+   writel(regs-sdram_config, AM33XX_EMIF4_0_REG(SDRAM_CONFIG));
+   writel(regs-sdram_ref_ctrl,
+   AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL));
+   writel(regs-sdram_ref_ctrl,
+   AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL_SHADOW));
+
+   }
+
+   writel(regs-sdram_ref_ctrl,
+   AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL));
+   writel(regs-sdram_ref_ctrl,
+   AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL_SHADOW));
+   writel(regs-sdram_config, CM_EMIF_SDRAM_CONFIG);
+}
+
+void am33xx_config_io_ctrl(int ioctrl)
+{
+   writel(ioctrl, AM33XX_DDR_CMD0_IOCTRL);
+   writel(ioctrl, AM33XX_DDR_CMD1_IOCTRL);
+   writel(ioctrl, AM33XX_DDR_CMD2_IOCTRL);
+   writel(ioctrl, AM33XX_DDR_DATA0_IOCTRL);
+   writel(ioctrl, AM33XX_DDR_DATA1_IOCTRL

[PATCH 2/3 for next] PCM051: Clean up lowlevel code

2013-08-23 Thread Teresa Gámez
Use now the initialisation functions from am33xx_generic.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/pcm051/lowlevel.c |  206 +++--
 1 files changed, 36 insertions(+), 170 deletions(-)

diff --git a/arch/arm/boards/pcm051/lowlevel.c 
b/arch/arm/boards/pcm051/lowlevel.c
index dd06c6a..faf23fc 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -13,171 +13,36 @@
 #include mach/am33xx-mux.h
 #include mach/wdt.h
 
-/* UART Defines */
-#define UART_SYSCFG_OFFSET  (0x54)
-#define UART_SYSSTS_OFFSET  (0x58)
-
-#define UART_RESET  (0x1  1)
-#define UART_CLK_RUNNING_MASK   0x1
-#define UART_SMART_IDLE_EN  (0x1  0x3)
-
-/* AM335X EMIF Register values */
-#define VTP_CTRL_READY  (0x1  5)
-#define VTP_CTRL_ENABLE (0x1  6)
-#define VTP_CTRL_START_EN   (0x1)
-#define CMD_FORCE  0x00/* common #def */
-#define CMD_DELAY  0x00
-
-#define EMIF_READ_LATENCY   0x06
-#define EMIF_SDCFG  0x61C04832 /* CL 5, CWL 5 */
-#define EMIF_SDREF  0x093B
-
-#define EMIF_TIM1   0x0668A39B
-#define EMIF_TIM2   0x26337FDA
-#define EMIF_TIM3   0x501F830F
-
-#define DLL_LOCK_DIFF   0x0
-#define PHY_WR_DATA 0xC1
-#define RD_DQS  0x3B
-#define WR_DQS  0x85
-#define PHY_FIFO_WE 0x100
-#define INVERT_CLKOUT   0x1
-#define PHY_RANK0_DELAY 0x01
-#define DDR_IOCTRL_VALUE0x18B
-#define CTRL_SLAVE_RATIO0x40
-#define PHY_LVL_MODE0x1
-#define DDR_ZQ_CFG  0x50074BE4
-
-static void Cmd_Macro_Config(void)
-{
-   writel(CTRL_SLAVE_RATIO, AM33XX_CMD0_CTRL_SLAVE_RATIO_0);
-   writel(CMD_FORCE, AM33XX_CMD0_CTRL_SLAVE_FORCE_0);
-   writel(CMD_DELAY, AM33XX_CMD0_CTRL_SLAVE_DELAY_0);
-   writel(DLL_LOCK_DIFF, AM33XX_CMD0_DLL_LOCK_DIFF_0);
-   writel(INVERT_CLKOUT, AM33XX_CMD0_INVERT_CLKOUT_0);
-
-   writel(CTRL_SLAVE_RATIO, AM33XX_CMD1_CTRL_SLAVE_RATIO_0);
-   writel(CMD_FORCE, AM33XX_CMD1_CTRL_SLAVE_FORCE_0);
-   writel(CMD_DELAY, AM33XX_CMD1_CTRL_SLAVE_DELAY_0);
-   writel(DLL_LOCK_DIFF, AM33XX_CMD1_DLL_LOCK_DIFF_0);
-   writel(INVERT_CLKOUT, AM33XX_CMD1_INVERT_CLKOUT_0);
-
-   writel(CTRL_SLAVE_RATIO, AM33XX_CMD2_CTRL_SLAVE_RATIO_0);
-   writel(CMD_FORCE, AM33XX_CMD2_CTRL_SLAVE_FORCE_0);
-   writel(CMD_DELAY, AM33XX_CMD2_CTRL_SLAVE_DELAY_0);
-   writel(DLL_LOCK_DIFF, AM33XX_CMD2_DLL_LOCK_DIFF_0);
-   writel(INVERT_CLKOUT, AM33XX_CMD2_INVERT_CLKOUT_0);
-}
-
-static void config_vtp(void)
-{
-   writel(readl(AM33XX_VTP0_CTRL_REG) | VTP_CTRL_ENABLE,
-   AM33XX_VTP0_CTRL_REG);
-   writel(readl(AM33XX_VTP0_CTRL_REG)  (~VTP_CTRL_START_EN),
-   AM33XX_VTP0_CTRL_REG);
-   writel(readl(AM33XX_VTP0_CTRL_REG) | VTP_CTRL_START_EN,
-   AM33XX_VTP0_CTRL_REG);
-
-   /* Poll for READY */
-   while ((readl(AM33XX_VTP0_CTRL_REG) 
-   VTP_CTRL_READY) != VTP_CTRL_READY);
-}
-
-static void phy_config_data(void)
-{
-   writel(RD_DQS, AM33XX_DATA0_RD_DQS_SLAVE_RATIO_0);
-   writel(WR_DQS, AM33XX_DATA0_WR_DQS_SLAVE_RATIO_0);
-   writel(PHY_FIFO_WE, AM33XX_DATA0_FIFO_WE_SLAVE_RATIO_0);
-   writel(PHY_WR_DATA, AM33XX_DATA0_WR_DATA_SLAVE_RATIO_0);
-
-   writel(RD_DQS, AM33XX_DATA1_RD_DQS_SLAVE_RATIO_0);
-   writel(WR_DQS, AM33XX_DATA1_WR_DQS_SLAVE_RATIO_0);
-   writel(PHY_FIFO_WE, AM33XX_DATA1_FIFO_WE_SLAVE_RATIO_0);
-   writel(PHY_WR_DATA, AM33XX_DATA1_WR_DATA_SLAVE_RATIO_0);
-}
-
-static void config_emif(void)
-{
-   /*Program EMIF0 CFG Registers*/
-   writel(EMIF_READ_LATENCY, AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_1));
-   writel(EMIF_READ_LATENCY,
-   AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_1_SHADOW));
-   writel(EMIF_READ_LATENCY, AM33XX_EMIF4_0_REG(DDR_PHY_CTRL_2));
-   writel(EMIF_TIM1, AM33XX_EMIF4_0_REG(SDRAM_TIM_1));
-   writel(EMIF_TIM1, AM33XX_EMIF4_0_REG(SDRAM_TIM_1_SHADOW));
-   writel(EMIF_TIM2, AM33XX_EMIF4_0_REG(SDRAM_TIM_2));
-   writel(EMIF_TIM2, AM33XX_EMIF4_0_REG(SDRAM_TIM_2_SHADOW));
-   writel(EMIF_TIM3, AM33XX_EMIF4_0_REG(SDRAM_TIM_3));
-   writel(EMIF_TIM3, AM33XX_EMIF4_0_REG(SDRAM_TIM_3_SHADOW));
-
-   writel(EMIF_SDREF, AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL));
-   writel(EMIF_SDREF, AM33XX_EMIF4_0_REG(SDRAM_REF_CTRL_SHADOW));
-
-   writel(EMIF_SDCFG, AM33XX_EMIF4_0_REG(SDRAM_CONFIG));
-   writel(DDR_ZQ_CFG, AM33XX_EMIF4_0_REG(ZQ_CONFIG));
-
-   while ((readl(AM33XX_EMIF4_0_REG(SDRAM_STATUS))  0x4) != 0x4);
-}
-
-static void pcm051_config_ddr(void)
-{
-   enable_ddr_clocks();
-
-   config_vtp();
-
-   /* init mode */
-   writel(PHY_LVL_MODE, AM33XX_DATA0_WRLVL_INIT_MODE_0);
-   writel(PHY_LVL_MODE, AM33XX_DATA0_GATELVL_INIT_MODE_0);
-   writel

[PATCH] AM33xx: Make OSC frequency board depended

2013-08-20 Thread Teresa Gámez
The oscillator frequency varies on different AM33xx boards.
Pass the osc frequency from lowlevel board code
to set the correct one on every board.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/beaglebone/lowlevel.c  |2 +-
 arch/arm/boards/pcm051/lowlevel.c  |2 +-
 arch/arm/mach-omap/am33xx_clock.c  |   26 
 arch/arm/mach-omap/include/mach/am33xx-clock.h |8 +--
 4 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/arm/boards/beaglebone/lowlevel.c 
b/arch/arm/boards/beaglebone/lowlevel.c
index d871ca1..2f3b3df 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -198,7 +198,7 @@ void beaglebone_sram_init(void)
u32 regVal, uart_base;
 
/* Setup the PLLs and the clocks for the peripherals */
-   pll_init(MPUPLL_M_500);
+   pll_init(MPUPLL_M_500, 24);
 
beaglebone_config_ddr();
 
diff --git a/arch/arm/boards/pcm051/lowlevel.c 
b/arch/arm/boards/pcm051/lowlevel.c
index f4a1742..dd06c6a 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -159,7 +159,7 @@ void pcm051_sram_init(void)
u32 regVal, uart_base;
 
/* Setup the PLLs and the clocks for the peripherals */
-   pll_init(MPUPLL_M_600);
+   pll_init(MPUPLL_M_600, 25);
 
pcm051_config_ddr();
 
diff --git a/arch/arm/mach-omap/am33xx_clock.c 
b/arch/arm/mach-omap/am33xx_clock.c
index 9928e9f..c6cae42 100644
--- a/arch/arm/mach-omap/am33xx_clock.c
+++ b/arch/arm/mach-omap/am33xx_clock.c
@@ -156,7 +156,7 @@ static void per_clocks_enable(void)
while (__raw_readl(CM_PER_SPI1_CLKCTRL) != PRCM_MOD_EN);
 }
 
-static void mpu_pll_config(int mpupll_M)
+static void mpu_pll_config(int mpupll_M, int osc)
 {
u32 clkmode, clksel, div_m2;
 
@@ -170,7 +170,7 @@ static void mpu_pll_config(int mpupll_M)
while(__raw_readl(CM_IDLEST_DPLL_MPU) != 0x0100);
 
clksel = clksel  (~0x7);
-   clksel = clksel | ((mpupll_M  0x8) | MPUPLL_N);
+   clksel = clksel | ((mpupll_M  0x8) | (osc - 1));
__raw_writel(clksel, CM_CLKSEL_DPLL_MPU);
 
div_m2 = div_m2  ~0x1f;
@@ -183,7 +183,7 @@ static void mpu_pll_config(int mpupll_M)
while(__raw_readl(CM_IDLEST_DPLL_MPU) != 0x1);
 }
 
-static void core_pll_config(void)
+static void core_pll_config(int osc)
 {
u32 clkmode, clksel, div_m4, div_m5, div_m6;
 
@@ -199,7 +199,7 @@ static void core_pll_config(void)
while(__raw_readl(CM_IDLEST_DPLL_CORE) != 0x0100);
 
clksel = clksel  (~0x7);
-   clksel = clksel | ((COREPLL_M  0x8) | COREPLL_N);
+   clksel = clksel | ((COREPLL_M  0x8) | (osc - 1));
__raw_writel(clksel, CM_CLKSEL_DPLL_CORE);
 
div_m4 = div_m4  ~0x1f;
@@ -221,7 +221,7 @@ static void core_pll_config(void)
while(__raw_readl(CM_IDLEST_DPLL_CORE) != 0x1);
 }
 
-static void per_pll_config(void)
+static void per_pll_config(int osc)
 {
u32 clkmode, clksel, div_m2;
 
@@ -235,7 +235,7 @@ static void per_pll_config(void)
while(__raw_readl(CM_IDLEST_DPLL_PER) != 0x0100);
 
clksel = clksel  (~0x7);
-   clksel = clksel | ((PERPLL_M  0x8) | PERPLL_N);
+   clksel = clksel | ((PERPLL_M  0x8) | (osc - 1));
__raw_writel(clksel, CM_CLKSEL_DPLL_PER);
 
div_m2 = div_m2  ~0x7f;
@@ -248,7 +248,7 @@ static void per_pll_config(void)
while(__raw_readl(CM_IDLEST_DPLL_PER) != 0x1);
 }
 
-static void ddr_pll_config(void)
+static void ddr_pll_config(int osc)
 {
u32 clkmode, clksel, div_m2;
 
@@ -263,7 +263,7 @@ static void ddr_pll_config(void)
while ((__raw_readl(CM_IDLEST_DPLL_DDR)  0x0100) != 0x0100);
 
clksel = clksel  (~0x7);
-   clksel = clksel | ((DDRPLL_M  0x8) | DDRPLL_N);
+   clksel = clksel | ((DDRPLL_M  0x8) | (osc - 1));
__raw_writel(clksel, CM_CLKSEL_DPLL_DDR);
 
div_m2 = div_m2  0xFFE0;
@@ -294,12 +294,12 @@ void enable_ddr_clocks(void)
 /*
  * Configure the PLL/PRCM for necessary peripherals
  */
-void pll_init(int mpupll_M)
+void pll_init(int mpupll_M, int osc)
 {
-   mpu_pll_config(mpupll_M);
-   core_pll_config();
-   per_pll_config();
-   ddr_pll_config();
+   mpu_pll_config(mpupll_M, osc);
+   core_pll_config(osc);
+   per_pll_config(osc);
+   ddr_pll_config(osc);
/* Enable the required interconnect clocks */
interface_clocks_enable();
/* Enable power domain transition */
diff --git a/arch/arm/mach-omap/include/mach/am33xx-clock.h 
b/arch/arm/mach-omap/include/mach/am33xx-clock.h
index 968509e..6035da6 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-clock.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-clock.h
@@ -23,20 +23,16 @@
 
 /* Put the pll config values over here */
 
-#define OSC24
-
 /* MAIN PLL Fdll = 1 GHZ, */
 #define MPUPLL_M_500   500 /* 125 * n */
 #define

[RFCv2 PATCH 2/2] OMAP: Add option to use environment from MMC

2013-04-02 Thread Teresa Gámez
Make loading environment from MMC generic for all OMAP.

Tested on AM335x, OMAP4.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
Tested-by: Jan Weitzel j.weit...@phytec.de
---
v2:
- removed environment code also from beaglebone

 arch/arm/boards/beaglebone/board.c|   32 
 arch/arm/boards/panda/board.c |   30 --
 arch/arm/mach-omap/include/mach/generic.h |1 +
 arch/arm/mach-omap/omap_generic.c |   33 +
 4 files changed, 34 insertions(+), 62 deletions(-)

diff --git a/arch/arm/boards/beaglebone/board.c 
b/arch/arm/boards/beaglebone/board.c
index 56e69a2..0a05323 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -25,8 +25,6 @@
 #include console.h
 #include init.h
 #include driver.h
-#include fs.h
-#include linux/stat.h
 #include envfs.h
 #include sizes.h
 #include io.h
@@ -112,33 +110,3 @@ static int beaglebone_devices_init(void)
return 0;
 }
 device_initcall(beaglebone_devices_init);
-
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-static int beaglebone_env_init(void)
-{
-   struct stat s;
-   char *diskdev = /dev/disk0.0;
-   int ret;
-
-   ret = stat(diskdev, s);
-   if (ret) {
-   printf(device %s not found. Using default environment\n, 
diskdev);
-   return 0;
-   }
-
-   mkdir (/boot, 0666);
-   ret = mount(diskdev, fat, /boot);
-   if (ret) {
-   printf(failed to mount %s\n, diskdev);
-   return 0;
-   }
-
-   if (IS_ENABLED(CONFIG_OMAP_BUILD_IFT))
-   default_environment_path = /dev/defaultenv;
-   else
-   default_environment_path = /boot/barebox.env;
-
-   return 0;
-}
-late_initcall(beaglebone_env_init);
-#endif
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 2518d3a..d1f9a5e 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -1,12 +1,10 @@
 #include common.h
 #include console.h
 #include init.h
-#include fs.h
 #include driver.h
 #include io.h
 #include ns16550.h
 #include asm/armlinux.h
-#include linux/stat.h
 #include generated/mach-types.h
 #include mach/omap4-silicon.h
 #include mach/omap4-devices.h
@@ -20,7 +18,6 @@
 #include asm/mmu.h
 #include mach/gpio.h
 #include envfs.h
-#include mach/generic.h
 #include i2c/i2c.h
 #include gpio.h
 #include led.h
@@ -164,30 +161,3 @@ static int panda_devices_init(void)
return 0;
 }
 device_initcall(panda_devices_init);
-
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-static int panda_env_init(void)
-{
-   struct stat s;
-   char *diskdev = /dev/disk0.0;
-   int ret;
-
-   ret = stat(diskdev, s);
-   if (ret) {
-   printf(no %s. using default env\n, diskdev);
-   return 0;
-   }
-
-   mkdir (/boot, 0666);
-   ret = mount(diskdev, fat, /boot);
-   if (ret) {
-   printf(failed to mount %s\n, diskdev);
-   return 0;
-   }
-
-   default_environment_path = /boot/bareboxenv;
-
-   return 0;
-}
-late_initcall(panda_env_init);
-#endif
diff --git a/arch/arm/mach-omap/include/mach/generic.h 
b/arch/arm/mach-omap/include/mach/generic.h
index edc4f1d..7455404 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -35,6 +35,7 @@ enum omap_boot_src {
OMAP_BOOTSRC_USB1,
 };
 
+enum omap_boot_src omap_bootsrc(void);
 enum omap_boot_src am33xx_bootsrc(void);
 enum omap_boot_src omap3_bootsrc(void);
 enum omap_boot_src omap4_bootsrc(void);
diff --git a/arch/arm/mach-omap/omap_generic.c 
b/arch/arm/mach-omap/omap_generic.c
index f2fd1d3..580ed3e 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -30,3 +30,36 @@ enum omap_boot_src omap_bootsrc(void)
return am33xx_bootsrc();
 #endif
 }
+
+#if defined(CONFIG_DEFAULT_ENVIRONMENT)  defined(CONFIG_MCI_STARTUP)
+static int omap_env_init(void)
+{
+   struct stat s;
+   char *diskdev = /dev/disk0.0;
+   int ret;
+
+   if (omap_bootsrc() != OMAP_BOOTSRC_MMC1)
+   return 0;
+
+   ret = stat(diskdev, s);
+   if (ret) {
+   printf(no %s. using default env\n, diskdev);
+   return 0;
+   }
+
+   mkdir(/boot, 0666);
+   ret = mount(diskdev, fat, /boot);
+   if (ret) {
+   printf(failed to mount %s\n, diskdev);
+   return 0;
+   }
+
+   if (IS_ENABLED(CONFIG_OMAP_BUILD_IFT))
+   default_environment_path = /dev/defaultenv;
+   else
+   default_environment_path = /boot/barebox.env;
+
+   return 0;
+}
+late_initcall(omap_env_init);
+#endif
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[RFC PATCH 2/2] OMAP: Add option to use enviroment from MMC

2013-03-26 Thread Teresa Gámez
Make loading enviroment from MMC generic for all OMAP.

Tested on AM335x, OMAP4.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
Tested-by: Jan Weitzel j.weit...@phytec.de
---
 arch/arm/boards/panda/board.c |   30 ---
 arch/arm/mach-omap/include/mach/generic.h |1 +
 arch/arm/mach-omap/omap_generic.c |   32 +
 3 files changed, 33 insertions(+), 30 deletions(-)

diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 2518d3a..d1f9a5e 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -1,12 +1,10 @@
 #include common.h
 #include console.h
 #include init.h
-#include fs.h
 #include driver.h
 #include io.h
 #include ns16550.h
 #include asm/armlinux.h
-#include linux/stat.h
 #include generated/mach-types.h
 #include mach/omap4-silicon.h
 #include mach/omap4-devices.h
@@ -20,7 +18,6 @@
 #include asm/mmu.h
 #include mach/gpio.h
 #include envfs.h
-#include mach/generic.h
 #include i2c/i2c.h
 #include gpio.h
 #include led.h
@@ -164,30 +161,3 @@ static int panda_devices_init(void)
return 0;
 }
 device_initcall(panda_devices_init);
-
-#ifdef CONFIG_DEFAULT_ENVIRONMENT
-static int panda_env_init(void)
-{
-   struct stat s;
-   char *diskdev = /dev/disk0.0;
-   int ret;
-
-   ret = stat(diskdev, s);
-   if (ret) {
-   printf(no %s. using default env\n, diskdev);
-   return 0;
-   }
-
-   mkdir (/boot, 0666);
-   ret = mount(diskdev, fat, /boot);
-   if (ret) {
-   printf(failed to mount %s\n, diskdev);
-   return 0;
-   }
-
-   default_environment_path = /boot/bareboxenv;
-
-   return 0;
-}
-late_initcall(panda_env_init);
-#endif
diff --git a/arch/arm/mach-omap/include/mach/generic.h 
b/arch/arm/mach-omap/include/mach/generic.h
index edc4f1d..7455404 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -35,6 +35,7 @@ enum omap_boot_src {
OMAP_BOOTSRC_USB1,
 };
 
+enum omap_boot_src omap_bootsrc(void);
 enum omap_boot_src am33xx_bootsrc(void);
 enum omap_boot_src omap3_bootsrc(void);
 enum omap_boot_src omap4_bootsrc(void);
diff --git a/arch/arm/mach-omap/omap_generic.c 
b/arch/arm/mach-omap/omap_generic.c
index f2fd1d3..5882794 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -30,3 +30,35 @@ enum omap_boot_src omap_bootsrc(void)
return am33xx_bootsrc();
 #endif
 }
+
+#if defined(CONFIG_DEFAULT_ENVIRONMENT)  defined(CONFIG_MCI_STARTUP)
+static int omap_env_init(void)
+{
+   struct stat s;
+   char *diskdev = /dev/disk0.0;
+   int ret;
+
+   if (omap_bootsrc() != OMAP_BOOTSRC_MMC1)
+   return 0;
+
+   ret = stat(diskdev, s);
+   if (ret) {
+   printf(no %s. using default env\n, diskdev);
+   return 0;
+   }
+
+   mkdir(/boot, 0666);
+   ret = mount(diskdev, fat, /boot);
+   if (ret) {
+   printf(failed to mount %s\n, diskdev);
+   return 0;
+   }
+
+   printf(Loading enviroment from MMC\n);
+
+   default_environment_path = /boot/bareboxenv;
+
+   return 0;
+}
+late_initcall(omap_env_init);
+#endif
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[RFC PATCH 1/2] OMAP: Move bootsource functions

2013-03-26 Thread Teresa Gámez
The bootsource functions are not specific to the first stage
bootloader. They may also be used for detecting the
bootsource to decide where to load the enviroment from.

Also clean up includes in board files.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/beagle/board.c|1 -
 arch/arm/boards/beaglebone/board.c|1 -
 arch/arm/boards/panda/board.c |2 +-
 arch/arm/boards/pcm049/board.c|1 -
 arch/arm/boards/phycard-a-l1/pca-a-l1.c   |1 -
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |1 -
 arch/arm/mach-omap/Makefile   |2 +-
 arch/arm/mach-omap/am33xx_generic.c   |2 +-
 arch/arm/mach-omap/include/mach/generic.h |   16 ++
 arch/arm/mach-omap/include/mach/xload.h   |   16 --
 arch/arm/mach-omap/omap3_generic.c|2 +-
 arch/arm/mach-omap/omap4_generic.c|2 +-
 arch/arm/mach-omap/omap4_rom_usb.c|2 +-
 arch/arm/mach-omap/omap_generic.c |   32 +
 arch/arm/mach-omap/xload.c|   13 +--
 15 files changed, 55 insertions(+), 39 deletions(-)
 delete mode 100644 arch/arm/mach-omap/include/mach/xload.h
 create mode 100644 arch/arm/mach-omap/omap_generic.c

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index bed4651..972c05e 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -62,7 +62,6 @@
 #include i2c/i2c.h
 #include linux/err.h
 #include usb/ehci.h
-#include mach/xload.h
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
diff --git a/arch/arm/boards/beaglebone/board.c 
b/arch/arm/boards/beaglebone/board.c
index e4b8b0a..56e69a2 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -45,7 +45,6 @@
 #include linux/err.h
 #include linux/phy.h
 #include usb/ehci.h
-#include mach/xload.h
 #include mach/am33xx-devices.h
 #include mach/am33xx-mux.h
 #include mach/wdt.h
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index f1fbd5e..2518d3a 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -20,7 +20,7 @@
 #include asm/mmu.h
 #include mach/gpio.h
 #include envfs.h
-#include mach/xload.h
+#include mach/generic.h
 #include i2c/i2c.h
 #include gpio.h
 #include led.h
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 680539a..b0d689b 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -36,7 +36,6 @@
 #include mach/gpio.h
 #include mach/gpmc.h
 #include mach/gpmc_nand.h
-#include mach/xload.h
 #include i2c/i2c.h
 
 static int pcm049_console_init(void)
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c 
b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index 234d689..7cf6ae8 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -54,7 +54,6 @@
 #include mach/gpmc.h
 #include mach/gpmc_nand.h
 #include mach/omap_hsmmc.h
-#include mach/xload.h
 #include mach/sdrc.h
 #include mach/omap3-silicon.h
 #include mach/sys_info.h
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c 
b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index be7060f..8f79d98 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -35,7 +35,6 @@
 #include mach/gpio.h
 #include mach/gpmc.h
 #include mach/gpmc_nand.h
-#include mach/xload.h
 #include mach/omap_hsmmc.h
 #include mach/omap4-devices.h
 #include i2c/i2c.h
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 38786b2..d9e00f7 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,7 +15,7 @@
 # GNU General Public License for more details.
 #
 #
-obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o
 pbl-$(CONFIG_ARCH_OMAP) += syslib.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
index d3014c2..059c55e 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -24,7 +24,7 @@
 #include mach/am33xx-silicon.h
 #include mach/am33xx-clock.h
 #include mach/sys_info.h
-#include mach/xload.h
+#include mach/generic.h
 #include mach/am33xx-generic.h
 
 void __noreturn reset_cpu(unsigned long addr)
diff --git a/arch/arm/mach-omap/include/mach/generic.h 
b/arch/arm/mach-omap/include/mach/generic.h
index c801a06..edc4f1d 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -1,3 +1,5 @@
+#ifndef _MACH_GENERIC_H
+#define _MACH_GENERIC_H
 
 /* I2C controller revisions */
 #define OMAP_I2C_REV_2 0x20
@@ -24,3 +26,17 @@
 #else
 #define cpu_is_omap4xxx()  (0)
 #endif
+
+enum omap_boot_src {
+   OMAP_BOOTSRC_UNKNOWN,
+   OMAP_BOOTSRC_MMC1

[RFC PATCH 2/2] AM33XX: pcm051: Create custom mux file

2013-03-12 Thread Teresa Gámez
The pcm051 has no MMC WP pin. This pin is used for a gpio and
needs to be muxed different. Created a custom mux file for
this case.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/pcm051/Makefile |2 +-
 arch/arm/boards/pcm051/board.c  |4 +++-
 arch/arm/boards/pcm051/mux.c|   20 
 arch/arm/boards/pcm051/mux.h|2 ++
 4 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/mux.c
 create mode 100644 arch/arm/boards/pcm051/mux.h

diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
index 092c31d..69d48e1 100644
--- a/arch/arm/boards/pcm051/Makefile
+++ b/arch/arm/boards/pcm051/Makefile
@@ -1,2 +1,2 @@
 lwl-y += lowlevel.o
-obj-y += board.o
+obj-y += board.o mux.o
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
index a38d844..8754ba5 100644
--- a/arch/arm/boards/pcm051/board.c
+++ b/arch/arm/boards/pcm051/board.c
@@ -27,6 +27,8 @@
 #include mach/am33xx-mux.h
 #include mach/am33xx-silicon.h
 
+#include mux.h
+
 /**
  * @brief UART serial port initialization
  * arch
@@ -52,7 +54,7 @@ mem_initcall(pcm051_mem_init);
 
 static int pcm051_devices_init(void)
 {
-   am33xx_enable_mmc0_pin_mux();
+   pcm051_enable_mmc0_pin_mux();
 
am33xx_add_mmc0(NULL);
 
diff --git a/arch/arm/boards/pcm051/mux.c b/arch/arm/boards/pcm051/mux.c
new file mode 100644
index 000..b8fb669
--- /dev/null
+++ b/arch/arm/boards/pcm051/mux.c
@@ -0,0 +1,20 @@
+#include common.h
+#include config.h
+#include asm/io.h
+#include mach/am33xx-mux.h
+
+static const struct module_pin_mux mmc0_pin_mux[] = {
+   {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)},  /* MMC0_DAT3 */
+   {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)},  /* MMC0_DAT2 */
+   {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)},  /* MMC0_DAT1 */
+   {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)},  /* MMC0_DAT0 */
+   {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CLK */
+   {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)},   /* MMC0_CMD */
+   {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)},   /* MMC0_CD */
+   {-1},
+};
+
+void pcm051_enable_mmc0_pin_mux(void)
+{
+   configure_module_pin_mux(mmc0_pin_mux);
+}
diff --git a/arch/arm/boards/pcm051/mux.h b/arch/arm/boards/pcm051/mux.h
new file mode 100644
index 000..8113a84
--- /dev/null
+++ b/arch/arm/boards/pcm051/mux.h
@@ -0,0 +1,2 @@
+extern void pcm051_enable_mmc0_pin_mux(void);
+
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[RFC PATCH 1/2] AM33XX: Move muxing defines to header file

2013-03-12 Thread Teresa Gámez
The muxing in the am33xx_mux.c file is not generic as the muxing
setup does not fit for every board. Move the structs and functions
to the mach/am33xx-mux.h so board dependend mux setups can be
created.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/beaglebone/board.c   |4 +-
 arch/arm/boards/beaglebone/lowlevel.c|2 +-
 arch/arm/boards/pcm051/board.c   |2 +-
 arch/arm/mach-omap/am33xx_mux.c  |  246 +-
 arch/arm/mach-omap/include/mach/am33xx-mux.h |  246 +-
 5 files changed, 252 insertions(+), 248 deletions(-)

diff --git a/arch/arm/boards/beaglebone/board.c 
b/arch/arm/boards/beaglebone/board.c
index e4b8b0a..70c6070 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -95,7 +95,7 @@ static void beaglebone_eth_init(void)
 
writel(0, AM33XX_MAC_MII_SEL);
 
-   enable_mii1_pin_mux();
+   am33xx_enable_mii1_pin_mux();
 
am33xx_add_cpsw(cpsw_data);
 }
@@ -104,7 +104,7 @@ static int beaglebone_devices_init(void)
 {
am33xx_add_mmc0(NULL);
 
-   enable_i2c0_pin_mux();
+   am33xx_enable_i2c0_pin_mux();
beaglebone_eth_init();
 
armlinux_set_bootparams((void *)0x8100);
diff --git a/arch/arm/boards/beaglebone/lowlevel.c 
b/arch/arm/boards/beaglebone/lowlevel.c
index 76ac90b..a9737d9 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -243,7 +243,7 @@ static int beaglebone_board_init(void)
beaglebone_sram_init();
 
/* Enable pin mux */
-   enable_uart0_pin_mux();
+   am33xx_enable_uart0_pin_mux();
 
return 0;
 }
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
index 9739a2c..a38d844 100644
--- a/arch/arm/boards/pcm051/board.c
+++ b/arch/arm/boards/pcm051/board.c
@@ -52,7 +52,7 @@ mem_initcall(pcm051_mem_init);
 
 static int pcm051_devices_init(void)
 {
-   enable_mmc0_pin_mux();
+   am33xx_enable_mmc0_pin_mux();
 
am33xx_add_mmc0(NULL);
 
diff --git a/arch/arm/mach-omap/am33xx_mux.c b/arch/arm/mach-omap/am33xx_mux.c
index 3d7f245..36fe379 100644
--- a/arch/arm/mach-omap/am33xx_mux.c
+++ b/arch/arm/mach-omap/am33xx_mux.c
@@ -15,242 +15,12 @@
 #include common.h
 #include config.h
 #include asm/io.h
+#include mach/am33xx-mux.h
 #include mach/am33xx-silicon.h
 
 #define MUX_CFG(value, offset) \
__raw_writel(value, (AM33XX_CTRL_BASE + offset));
 
-/* PAD Control Fields */
-#define SLEWCTRL   (0x1  6)
-#defineRXACTIVE(0x1  5)
-#definePULLUP_EN   (0x1  4) /* Pull UP Selection */
-#define PULLUDEN   (0x0  3) /* Pull up enabled */
-#define PULLUDDIS  (0x1  3) /* Pull up disabled */
-#define MODE(val)  val
-
-/*
- * PAD CONTROL OFFSETS
- * Field names corresponds to the pad signal name
- */
-/* TODO replace with defines */
-struct pad_signals {
-   int gpmc_ad0;
-   int gpmc_ad1;
-   int gpmc_ad2;
-   int gpmc_ad3;
-   int gpmc_ad4;
-   int gpmc_ad5;
-   int gpmc_ad6;
-   int gpmc_ad7;
-   int gpmc_ad8;
-   int gpmc_ad9;
-   int gpmc_ad10;
-   int gpmc_ad11;
-   int gpmc_ad12;
-   int gpmc_ad13;
-   int gpmc_ad14;
-   int gpmc_ad15;
-   int gpmc_a0;
-   int gpmc_a1;
-   int gpmc_a2;
-   int gpmc_a3;
-   int gpmc_a4;
-   int gpmc_a5;
-   int gpmc_a6;
-   int gpmc_a7;
-   int gpmc_a8;
-   int gpmc_a9;
-   int gpmc_a10;
-   int gpmc_a11;
-   int gpmc_wait0;
-   int gpmc_wpn;
-   int gpmc_be1n;
-   int gpmc_csn0;
-   int gpmc_csn1;
-   int gpmc_csn2;
-   int gpmc_csn3;
-   int gpmc_clk;
-   int gpmc_advn_ale;
-   int gpmc_oen_ren;
-   int gpmc_wen;
-   int gpmc_be0n_cle;
-   int lcd_data0;
-   int lcd_data1;
-   int lcd_data2;
-   int lcd_data3;
-   int lcd_data4;
-   int lcd_data5;
-   int lcd_data6;
-   int lcd_data7;
-   int lcd_data8;
-   int lcd_data9;
-   int lcd_data10;
-   int lcd_data11;
-   int lcd_data12;
-   int lcd_data13;
-   int lcd_data14;
-   int lcd_data15;
-   int lcd_vsync;
-   int lcd_hsync;
-   int lcd_pclk;
-   int lcd_ac_bias_en;
-   int mmc0_dat3;
-   int mmc0_dat2;
-   int mmc0_dat1;
-   int mmc0_dat0;
-   int mmc0_clk;
-   int mmc0_cmd;
-   int mii1_col;
-   int mii1_crs;
-   int mii1_rxerr;
-   int mii1_txen;
-   int mii1_rxdv;
-   int mii1_txd3;
-   int mii1_txd2;
-   int mii1_txd1;
-   int mii1_txd0;
-   int mii1_txclk;
-   int mii1_rxclk;
-   int mii1_rxd3;
-   int mii1_rxd2;
-   int mii1_rxd1;
-   int mii1_rxd0;
-   int rmii1_refclk;
-   int mdio_data;
-   int mdio_clk;
-   int spi0_sclk;
-   int spi0_d0;
-   int spi0_d1;
-   int spi0_cs0;
-   int spi0_cs1

[PATCHv2 1/6] ARM AM33XX: Add mmc0 pin mux function

2012-12-20 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/am33xx_mux.c  |5 +
 arch/arm/mach-omap/include/mach/am33xx-mux.h |1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/am33xx_mux.c b/arch/arm/mach-omap/am33xx_mux.c
index 22bf317..3d7f245 100644
--- a/arch/arm/mach-omap/am33xx_mux.c
+++ b/arch/arm/mach-omap/am33xx_mux.c
@@ -504,3 +504,8 @@ void enable_uart0_pin_mux(void)
 {
configure_module_pin_mux(uart0_pin_mux);
 }
+
+void enable_mmc0_pin_mux(void)
+{
+   configure_module_pin_mux(mmc0_pin_mux);
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-mux.h 
b/arch/arm/mach-omap/include/mach/am33xx-mux.h
index ed328f5..6078b3a 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-mux.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-mux.h
@@ -18,5 +18,6 @@ extern void enable_i2c0_pin_mux(void);
 extern void enable_i2c1_pin_mux(void);
 extern void enable_i2c2_pin_mux(void);
 extern void enable_uart0_pin_mux(void);
+extern void enable_mmc0_pin_mux(void);
 
 #endif /*__AM33XX_MUX_H__ */
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 3/6] ARM OMAP: Apply RAM device register functions to boards

2012-12-20 Thread Teresa Gámez
Apply RAM and SRAM register functions to all OMAP boards.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/archosg9/board.c  |2 +-
 arch/arm/boards/beagle/board.c|2 +-
 arch/arm/boards/beaglebone/board.c|2 +-
 arch/arm/boards/omap343xdsp/board.c   |2 +-
 arch/arm/boards/omap3evm/board.c  |2 +-
 arch/arm/boards/panda/board.c |2 +-
 arch/arm/boards/pcm049/board.c|5 ++---
 arch/arm/boards/phycard-a-l1/pca-a-l1.c   |5 ++---
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |6 +++---
 9 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c
index 5f62748..1911c62 100644
--- a/arch/arm/boards/archosg9/board.c
+++ b/arch/arm/boards/archosg9/board.c
@@ -35,7 +35,7 @@ static int archosg9_console_init(void){
 console_initcall(archosg9_console_init);
 
 static int archosg9_mem_init(void){
-   arm_add_mem_device(ram0, 0x8000, SZ_1G);
+   omap_add_ram0(SZ_1G);
return 0;
 }
 mem_initcall(archosg9_mem_init);
diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index 04c4d32..e0e1da6 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -280,7 +280,7 @@ static struct gpmc_nand_platform_data nand_plat = {
 
 static int beagle_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 128 * 1024 * 1024);
+   omap_add_ram0(SZ_128M);
 
return 0;
 }
diff --git a/arch/arm/boards/beaglebone/board.c 
b/arch/arm/boards/beaglebone/board.c
index a7e3e74..f9ac7a4 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -307,7 +307,7 @@ console_initcall(beaglebone_console_init);
 
 static int beaglebone_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 256 * 1024 * 1024);
+   omap_add_ram0(256 * 1024 * 1024);
 
return 0;
 }
diff --git a/arch/arm/boards/omap343xdsp/board.c 
b/arch/arm/boards/omap343xdsp/board.c
index eb752ff..6dbbc4c 100644
--- a/arch/arm/boards/omap343xdsp/board.c
+++ b/arch/arm/boards/omap343xdsp/board.c
@@ -620,7 +620,7 @@ console_initcall(sdp3430_console_init);
 
 static int sdp3430_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 128 * 1024 * 1024);
+   omap_add_ram0(128 * 1024 * 1024);
 
return 0;
 }
diff --git a/arch/arm/boards/omap3evm/board.c b/arch/arm/boards/omap3evm/board.c
index 03d3ab8..f636fe3 100644
--- a/arch/arm/boards/omap3evm/board.c
+++ b/arch/arm/boards/omap3evm/board.c
@@ -232,7 +232,7 @@ console_initcall(omap3evm_init_console);
 
 static int omap3evm_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 128 * 1024 * 1024);
+   omap_add_ram0(SZ_128M);
 
return 0;
 }
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 5b27f46..8054a6a 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -44,7 +44,7 @@ console_initcall(panda_console_init);
 
 static int panda_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, SZ_1G);
+   omap_add_ram0(SZ_1G);
 
return 0;
 }
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index ca3f906..680539a 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -49,10 +49,9 @@ console_initcall(pcm049_console_init);
 
 static int pcm049_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, SZ_512M);
+   omap_add_ram0(SZ_512M);
 
-   add_mem_device(sram0, 0x4030, 48 * 1024,
-  IORESOURCE_MEM_WRITEABLE);
+   omap44xx_add_sram0();
return 0;
 }
 mem_initcall(pcm049_mem_init);
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c 
b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index b582d71..4b307a6 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -358,10 +358,9 @@ static int pcaal1_mem_init(void)
 */
gpmc_generic_init(0x10);
 #endif
-   add_mem_device(sram0, OMAP_SRAM_BASE, 60 * SZ_1K,
-  IORESOURCE_MEM_WRITEABLE);
+   omap3_add_sram0();
 
-   arm_add_mem_device(ram0, OMAP_SDRC_CS0, 
get_sdr_cs_size(SDRC_CS0_OSET));
+   omap_add_ram0(get_sdr_cs_size(SDRC_CS0_OSET));
printf(found %s at SDCS0\n, 
size_human_readable(get_sdr_cs_size(SDRC_CS0_OSET)));
 
if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0)  (get_sdr_cs1_base() != 
OMAP_SDRC_CS0)) {
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c 
b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index 3931f57..be7060f 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -50,10 +50,10 @@ console_initcall(pcaaxl2_console_init);
 
 static int pcaaxl2_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, SZ_512M);
+   omap_add_ram0(SZ_512M);
+
+   omap44xx_add_sram0

[PATCHv2 0/6] Add PCM051 support

2012-12-20 Thread Teresa Gámez
This is rebased on the new AM33XX patch stack of Jan Luebbe.
It adds phyCORE-AM335x (pcm051) support.
Added also device register functions for SRAM, RAM and EHCI.

Teresa Gámez (6):
  ARM AM33XX: Add mmc0 pin mux function
  ARM OMAP: Add SRAM and DRAM to device register functions
  ARM OMAP: Apply RAM device register functions to boards
  ARM OMAP: Add EHCI to device register functions
  ARM OMAP: Apply EHCI device register functions
  pcm051: Add inital support

 arch/arm/Makefile   |1 +
 arch/arm/boards/archosg9/board.c|2 +-
 arch/arm/boards/beagle/board.c  |5 +-
 arch/arm/boards/beaglebone/board.c  |2 +-
 arch/arm/boards/omap343xdsp/board.c |2 +-
 arch/arm/boards/omap3evm/board.c|2 +-
 arch/arm/boards/panda/board.c   |5 +-
 arch/arm/boards/pcm049/board.c  |5 +-
 arch/arm/boards/pcm051/Makefile |1 +
 arch/arm/boards/pcm051/board.c  |   64 +++
 arch/arm/boards/pcm051/config.h |   21 +++
 arch/arm/boards/pcm051/env/boot/sd  |   10 
 arch/arm/boards/pcm051/env/config   |   22 
 arch/arm/boards/phycard-a-l1/pca-a-l1.c |5 +-
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c   |6 +-
 arch/arm/configs/pcm051_defconfig   |   56 
 arch/arm/mach-omap/Kconfig  |   10 
 arch/arm/mach-omap/am33xx_mux.c |5 ++
 arch/arm/mach-omap/include/mach/am33xx-mux.h|1 +
 arch/arm/mach-omap/include/mach/devices.h   |4 ++
 arch/arm/mach-omap/include/mach/omap3-devices.h |   12 
 arch/arm/mach-omap/include/mach/omap4-devices.h |   11 
 arch/arm/mach-omap/include/mach/omap4-silicon.h |5 ++
 arch/arm/mach-omap/omap_devices.c   |   12 
 24 files changed, 250 insertions(+), 19 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 100644 arch/arm/boards/pcm051/env/boot/sd
 create mode 100644 arch/arm/boards/pcm051/env/config
 create mode 100644 arch/arm/configs/pcm051_defconfig


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 4/6] ARM OMAP: Add EHCI to device register functions

2012-12-20 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/include/mach/omap3-devices.h |6 ++
 arch/arm/mach-omap/include/mach/omap4-devices.h |6 ++
 arch/arm/mach-omap/include/mach/omap4-silicon.h |3 +++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/omap3-devices.h 
b/arch/arm/mach-omap/include/mach/omap3-devices.h
index 9d682cf..2e8e06f 100644
--- a/arch/arm/mach-omap/include/mach/omap3-devices.h
+++ b/arch/arm/mach-omap/include/mach/omap3-devices.h
@@ -87,4 +87,10 @@ static inline struct device_d *omap3_add_i2c3(void *pdata)
return omap_add_i2c(2, OMAP3_I2C3_BASE, pdata);
 }
 
+static inline struct device_d *omap3_add_ehci(void *pdata)
+{
+   return add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP3_EHCI_BASE,
+   OMAP3_EHCI_BASE + 0x10, pdata);
+}
+
 #endif /* __MACH_OMAP3_DEVICES_H */
diff --git a/arch/arm/mach-omap/include/mach/omap4-devices.h 
b/arch/arm/mach-omap/include/mach/omap4-devices.h
index df0694f..5aba72d 100644
--- a/arch/arm/mach-omap/include/mach/omap4-devices.h
+++ b/arch/arm/mach-omap/include/mach/omap4-devices.h
@@ -73,4 +73,10 @@ static inline struct device_d *omap44xx_add_i2c4(void *pdata)
return omap_add_i2c(3, OMAP44XX_I2C4_BASE, pdata);
 }
 
+static inline struct device_d *omap44xx_add_ehci(void *pdata)
+{
+   return add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP44XX_EHCI_BASE,
+   OMAP44XX_EHCI_BASE + 0x10, pdata);
+}
+
 #endif /* __MACH_OMAP4_DEVICES_H */
diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h 
b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index 379588d..0e8abda 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -121,6 +121,9 @@
 /* GPMC */
 #define OMAP44XX_GPMC_BASE 0x5000
 
+/* EHCI */
+#define OMAP44XX_EHCI_BASE (OMAP44XX_L4_CORE_BASE + 0x64C00)
+
 /* DMM */
 #define OMAP44XX_DMM_BASE  0x4E00
 #define DMM_LISA_MAP_BASE  (OMAP44XX_DMM_BASE + 0x40)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 2/6] ARM OMAP: Add SRAM and DRAM to device register functions

2012-12-20 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/include/mach/devices.h   |4 
 arch/arm/mach-omap/include/mach/omap3-devices.h |6 ++
 arch/arm/mach-omap/include/mach/omap4-devices.h |5 +
 arch/arm/mach-omap/include/mach/omap4-silicon.h |2 ++
 arch/arm/mach-omap/omap_devices.c   |   12 
 5 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/devices.h 
b/arch/arm/mach-omap/include/mach/devices.h
index 9881604..6cbb25e 100644
--- a/arch/arm/mach-omap/include/mach/devices.h
+++ b/arch/arm/mach-omap/include/mach/devices.h
@@ -3,6 +3,10 @@
 
 #include mach/omap_hsmmc.h
 
+void omap_add_ram0(resource_size_t size);
+
+void omap_add_sram0(resource_size_t base, resource_size_t size);
+
 struct device_d *omap_add_uart(int id, unsigned long base);
 
 struct device_d *omap_add_mmc(int id, unsigned long base,
diff --git a/arch/arm/mach-omap/include/mach/omap3-devices.h 
b/arch/arm/mach-omap/include/mach/omap3-devices.h
index 6617430..9d682cf 100644
--- a/arch/arm/mach-omap/include/mach/omap3-devices.h
+++ b/arch/arm/mach-omap/include/mach/omap3-devices.h
@@ -8,6 +8,12 @@
 #include mach/mcspi.h
 #include mach/omap_hsmmc.h
 
+
+static inline void omap3_add_sram0(void)
+{
+   return omap_add_sram0(OMAP3_SRAM_BASE, 64 * SZ_1K);
+}
+
 /* the device numbering is the same as in the device tree */
 
 static inline struct device_d *omap3_add_spi(int id, resource_size_t start)
diff --git a/arch/arm/mach-omap/include/mach/omap4-devices.h 
b/arch/arm/mach-omap/include/mach/omap4-devices.h
index 448de68..df0694f 100644
--- a/arch/arm/mach-omap/include/mach/omap4-devices.h
+++ b/arch/arm/mach-omap/include/mach/omap4-devices.h
@@ -8,6 +8,11 @@
 #include mach/mcspi.h
 #include mach/omap_hsmmc.h
 
+static inline void omap44xx_add_sram0(void)
+{
+   return omap_add_sram0(OMAP44XX_SRAM_BASE, 48 * SZ_1K);
+}
+
 static inline struct device_d *omap44xx_add_uart1(void)
 {
return omap_add_uart(0, OMAP44XX_UART1_BASE);
diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h 
b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index b5d1eb9..379588d 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -39,6 +39,8 @@
 #define OMAP44XX_L4_WKUP_BASE  0x4A30
 #define OMAP44XX_L4_PER_BASE   0x4800
 
+#define OMAP44XX_SRAM_BASE 0x4030
+
 /* EMIF and DMM registers */
 #define OMAP44XX_EMIF1_BASE0x4c00
 #define OMAP44XX_EMIF2_BASE0x4d00
diff --git a/arch/arm/mach-omap/omap_devices.c 
b/arch/arm/mach-omap/omap_devices.c
index acf029d..e83ac85 100644
--- a/arch/arm/mach-omap/omap_devices.c
+++ b/arch/arm/mach-omap/omap_devices.c
@@ -1,7 +1,19 @@
 #include driver.h
 #include ns16550.h
+#include asm/armlinux.h
+
 #include mach/omap3-devices.h
 
+void omap_add_ram0(resource_size_t size)
+{
+   arm_add_mem_device(ram0, 0x8000, size);
+}
+
+void omap_add_sram0(resource_size_t base, resource_size_t size)
+{
+   add_mem_device(sram0, base, size, IORESOURCE_MEM_WRITEABLE);
+}
+
 static struct NS16550_plat serial_plat = {
.clock = 4800,  /* 48MHz (APLL96/2) */
.shift = 2,
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 5/6] ARM OMAP: Apply EHCI device register functions

2012-12-20 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/beagle/board.c |3 +--
 arch/arm/boards/panda/board.c  |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index e0e1da6..88096bb 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -293,8 +293,7 @@ static int beagle_devices_init(void)
 
 #ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(omap_ehci_pdata) = 0)
-   add_usb_ehci_device(DEVICE_ID_DYNAMIC, OMAP3_EHCI_BASE,
-   OMAP3_EHCI_BASE + 0x10, ehci_pdata);
+   omap3_add_ehci(ehci_pdata);
 #endif /* CONFIG_USB_EHCI_OMAP */
 #ifdef CONFIG_OMAP_GPMC
/* WP is made high and WAIT1 active Low */
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 8054a6a..4ca2a81 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -86,8 +86,7 @@ static void panda_ehci_init(void)
/* enable power to hub */
gpio_set_value(GPIO_HUB_POWER, 1);
 
-   add_usb_ehci_device(DEVICE_ID_DYNAMIC, 0x4a064c00,
-   0x4a064c00 + 0x10, ehci_pdata);
+   omap44xx_add_ehci(ehci_pdata);
 }
 #else
 static void panda_ehci_init(void)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 6/6] pcm051: Add inital support

2012-12-20 Thread Teresa Gámez
Added initial support for Phytec phyCORE-AM335x.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/Makefile  |1 +
 arch/arm/boards/pcm051/Makefile|1 +
 arch/arm/boards/pcm051/board.c |   64 
 arch/arm/boards/pcm051/config.h|   21 
 arch/arm/boards/pcm051/env/boot/sd |   10 ++
 arch/arm/boards/pcm051/env/config  |   22 
 arch/arm/configs/pcm051_defconfig  |   56 +++
 arch/arm/mach-omap/Kconfig |   10 ++
 8 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 100644 arch/arm/boards/pcm051/env/boot/sd
 create mode 100644 arch/arm/boards/pcm051/env/config
 create mode 100644 arch/arm/configs/pcm051_defconfig

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 5082a13..487cc64 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -115,6 +115,7 @@ board-$(CONFIG_MACH_PCM027) := pcm027
 board-$(CONFIG_MACH_PCM037):= pcm037
 board-$(CONFIG_MACH_PCM038):= pcm038
 board-$(CONFIG_MACH_PCM043):= pcm043
+board-$(CONFIG_MACH_PCM051):= pcm051
 board-$(CONFIG_MACH_PM9261):= pm9261
 board-$(CONFIG_MACH_PM9263):= pm9263
 board-$(CONFIG_MACH_PM9G45):= pm9g45
diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
new file mode 100644
index 000..dcfc293
--- /dev/null
+++ b/arch/arm/boards/pcm051/Makefile
@@ -0,0 +1 @@
+obj-y += board.o
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
new file mode 100644
index 000..9739a2c
--- /dev/null
+++ b/arch/arm/boards/pcm051/board.c
@@ -0,0 +1,64 @@
+/*
+ * pcm051 - phyCORE-AM335x Board Initalization Code
+ *
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * Based on arch/arm/boards/omap/board-beagle.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include common.h
+#include init.h
+#include sizes.h
+#include ns16550.h
+#include asm/armlinux.h
+#include generated/mach-types.h
+#include mach/am33xx-devices.h
+#include mach/am33xx-mux.h
+#include mach/am33xx-silicon.h
+
+/**
+ * @brief UART serial port initialization
+ * arch
+ *
+ * @return result of device registration
+ */
+static int pcm051_console_init(void)
+{
+   /* Register the serial port */
+   am33xx_add_uart0();
+
+   return 0;
+}
+console_initcall(pcm051_console_init);
+
+static int pcm051_mem_init(void)
+{
+   omap_add_ram0(SZ_512M);
+
+   return 0;
+}
+mem_initcall(pcm051_mem_init);
+
+static int pcm051_devices_init(void)
+{
+   enable_mmc0_pin_mux();
+
+   am33xx_add_mmc0(NULL);
+
+   armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
+   armlinux_set_architecture(MACH_TYPE_PCM051);
+
+   return 0;
+}
+device_initcall(pcm051_devices_init);
diff --git a/arch/arm/boards/pcm051/config.h b/arch/arm/boards/pcm051/config.h
new file mode 100644
index 000..8b2b876
--- /dev/null
+++ b/arch/arm/boards/pcm051/config.h
@@ -0,0 +1,21 @@
+/**
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#endif /* __CONFIG_H */
diff --git a/arch/arm/boards/pcm051/env/boot/sd 
b/arch/arm/boards/pcm051/env/boot/sd
new file mode 100644
index 000..f303c10
--- /dev/null
+++ b/arch/arm/boards/pcm051/env/boot/sd
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ $1 = menu ]; then
+   boot-menu-add-entry $0 kernel  rootfs on SD card
+   exit
+fi
+
+global.bootm.image=/boot/uImage
+global.bootm.oftree=/boot/oftree
+global.linux.bootargs.dyn.root=root=/dev

Re: [PATCH 18/19] arm: beaglebone: add first-stage support for AM335x and board

2012-12-19 Thread Teresa Gámez
Hello Jan,

On Tue, 18. Dec 15:22, Jan Luebbe wrote:
 Signed-off-by: Jan Luebbe j...@pengutronix.de
 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---

[...]
 
 diff --git a/arch/arm/boards/beaglebone/board.c 
 b/arch/arm/boards/beaglebone/board.c
 new file mode 100644
 index 000..d139e94
 --- /dev/null
 +++ b/arch/arm/boards/beaglebone/board.c
 @@ -0,0 +1,358 @@
 +/*
 + * (C) Copyright 2008
 + * Texas Instruments, www.ti.com
 + * Raghavendra KH r-khandenaha...@ti.com
 + *
 + * Copyright (C) 2012 Jan Luebbe j.lue...@pengutronix.de
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + */
 +
 +/**
 + * @file
 + * @brief BeagleBone Specific Board Initialization routines
 + */
 +
 +#include common.h
 +#include console.h
 +#include init.h
 +#include driver.h
 +#include fs.h
 +#include linux/stat.h
 +#include environment.h
 +#include sizes.h
 +#include io.h
 +#include ns16550.h
 +#include asm/armlinux.h
 +#include generated/mach-types.h
 +#include mach/am33xx-silicon.h
 +#include mach/am33xx-clock.h
 +#include mach/sdrc.h
 +#include mach/sys_info.h
 +#include mach/syslib.h
 +#include mach/gpmc.h
 +#include mach/ehci.h
 +#include i2c/i2c.h
 +#include linux/err.h
 +#include usb/ehci.h
 +#include mach/xload.h
 +#include mach/am33xx-devices.h
 +#include mach/am33xx-mux.h
 +#include mach/cpsw.h

This won't compile as mach/cpsw.h is not known yet.
Move this line to next patch.

Regards,
Teresa

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


v2012.12.0: pcm049 is broken

2012-12-18 Thread Teresa Gámez
Hello,

since commit 1dbfd5ed82fd2b6b0ba6df98e2e23aaf3cd1a197
ARM: Support multiple ARM architectures
the MLO of pcm049 doesn't start up. It seems to be a problem with thumb-2.
When I disable thumb-2 and shrink the image with also disabling mtd support,
the MLO works again. And mtd is not the problem...

Any ideas?

Regards,
Teresa

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 13/14] arm: beaglebone: add first-stage support for AM335x and board

2012-12-18 Thread Teresa Gámez
Hello Jan,

thank you on continue to work on am33xx.
Sadly I do not have a beaglebone and my board has ddr3 ram
so I wasn't able to test the first stage support.

I have a small note below.


On Thu, 13. Dec 17:30, Jan Luebbe wrote:
 Signed-off-by: Jan Luebbe j...@pengutronix.de
 ---
  arch/arm/Makefile  |1 +
  arch/arm/boards/beaglebone/Makefile|1 +
  arch/arm/boards/beaglebone/board.c |  364 ++
  arch/arm/boards/beaglebone/config.h|   17 +
  arch/arm/boards/beaglebone/env/boot/sd |   11 +
  arch/arm/boards/beaglebone/env/config  |   21 +
  arch/arm/configs/am335x_beaglebone_defconfig   |   54 +++
  .../configs/am335x_beaglebone_mlo_large_defconfig  |   55 +++
  .../configs/am335x_beaglebone_mlo_small_defconfig  |   31 ++
  arch/arm/mach-omap/Kconfig |   11 +-
  arch/arm/mach-omap/Makefile|2 +-
  arch/arm/mach-omap/am33xx_clock.c  |  289 +++
  arch/arm/mach-omap/am33xx_generic.c|   68 +++
  arch/arm/mach-omap/am33xx_mux.c|  506 
 
  arch/arm/mach-omap/gpmc.c  |3 +
  arch/arm/mach-omap/include/mach/am33xx-clock.h |  171 +++
  arch/arm/mach-omap/include/mach/am33xx-mux.h   |   22 +
  arch/arm/mach-omap/include/mach/am33xx-silicon.h   |  145 +-
  arch/arm/mach-omap/include/mach/xload.h|1 +
  arch/arm/mach-omap/xload.c |2 +
  20 files changed, 1772 insertions(+), 3 deletions(-)
  create mode 100644 arch/arm/boards/beaglebone/Makefile
  create mode 100644 arch/arm/boards/beaglebone/board.c
  create mode 100644 arch/arm/boards/beaglebone/config.h
  create mode 100644 arch/arm/boards/beaglebone/env/boot/sd
  create mode 100644 arch/arm/boards/beaglebone/env/config
  create mode 100644 arch/arm/configs/am335x_beaglebone_defconfig
  create mode 100644 arch/arm/configs/am335x_beaglebone_mlo_large_defconfig
  create mode 100644 arch/arm/configs/am335x_beaglebone_mlo_small_defconfig
  create mode 100644 arch/arm/mach-omap/am33xx_clock.c
  create mode 100644 arch/arm/mach-omap/am33xx_mux.c
  create mode 100644 arch/arm/mach-omap/include/mach/am33xx-mux.h


[...]
 
 diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h 
 b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
 index 1858756..ea44d25 100644
 --- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
 +++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
 @@ -43,7 +43,150 @@
  #define AM33XX_DMTIMER0_BASE (AM33XX_L4_WKUP_BASE + 0x205000)
  
  /* PRM */
 -#define OMAP_PRM_BASE(AM33XX_L4_WKUP_BASE + 0x20)
 +#define AM33XX_PRM_BASE  (AM33XX_L4_WKUP_BASE + 0x20)
  
 +#define AM33XX_PRM_RSTCTRL   (AM33XX_PRM_BASE + 0x0f00)
 +#define AM33XX_PRM_RSTCTRL_RESET 0x1
 +
 +/* CTRL */
 +#define AM33XX_CTRL_BASE (AM33XX_L4_WKUP_BASE + 0x21)
 +
 +/* Watchdog Timer */
 +#define WDT_BASE0x44E35000
 +
 +/* EMIF Base address */
 +#define EMIF4_0_CFG_BASE0x4C00
 +#define EMIF4_1_CFG_BASE0x4D00
 +#define DMM_BASE0x4E00
 +
 +#define AM335X_CPSW_BASE 0x4A10
 +#define AM335X_CPSW_MDIO_BASE0x4A101000
 +
 +/*DMM  EMIF4 MMR Declaration*/
 +#define DMM_LISA_MAP__0  (DMM_BASE + 0x40)
 +#define DMM_LISA_MAP__1  (DMM_BASE + 0x44)
 +#define DMM_LISA_MAP__2  (DMM_BASE + 0x48)
 +#define DMM_LISA_MAP__3  (DMM_BASE + 0x4C)
 +#define DMM_PAT_BASE_ADDR(DMM_BASE + 0x460)
 +
 +#define EMIF_MOD_ID_REV  (EMIF4_0_CFG_BASE + 0x0)
 +#define EMIF4_0_SDRAM_STATUS(EMIF4_0_CFG_BASE + 0x04)
 +#define EMIF4_0_SDRAM_CONFIG(EMIF4_0_CFG_BASE + 0x08)
 +#define EMIF4_0_SDRAM_CONFIG2   (EMIF4_0_CFG_BASE + 0x0C)
 +#define EMIF4_0_SDRAM_REF_CTRL  (EMIF4_0_CFG_BASE + 0x10)
 +#define EMIF4_0_SDRAM_REF_CTRL_SHADOW   (EMIF4_0_CFG_BASE + 0x14)
 +#define EMIF4_0_SDRAM_TIM_1 (EMIF4_0_CFG_BASE + 0x18)
 +#define EMIF4_0_SDRAM_TIM_1_SHADOW  (EMIF4_0_CFG_BASE + 0x1C)
 +#define EMIF4_0_SDRAM_TIM_2 (EMIF4_0_CFG_BASE + 0x20)
 +#define EMIF4_0_SDRAM_TIM_2_SHADOW  (EMIF4_0_CFG_BASE + 0x24)
 +#define EMIF4_0_SDRAM_TIM_3 (EMIF4_0_CFG_BASE + 0x28)
 +#define EMIF4_0_SDRAM_TIM_3_SHADOW  (EMIF4_0_CFG_BASE + 0x2C)
 +#define EMIF0_0_SDRAM_MGMT_CTRL (EMIF4_0_CFG_BASE + 0x38)
 +#define EMIF0_0_SDRAM_MGMT_CTRL_SHD (EMIF4_0_CFG_BASE + 0x3C)
 +#define EMIF4_0_DDR_PHY_CTRL_1  (EMIF4_0_CFG_BASE + 0xE4)
 +#define EMIF4_0_DDR_PHY_CTRL_1_SHADOW   (EMIF4_0_CFG_BASE + 0xE8)
 +#define EMIF4_0_DDR_PHY_CTRL_2  (EMIF4_0_CFG_BASE + 0xEC)
 +#define EMIF4_0_IODFT_TLGC  

[PATCH 2/7] ARM OMAP4: Add EHCI base define

2012-12-18 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/include/mach/omap4-silicon.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h 
b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index 1d236f2..a5cc221 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -121,6 +121,9 @@
 /* GPMC */
 #define OMAP44XX_GPMC_BASE 0x5000
 
+/* EHCI */
+#define OMAP44XX_EHCI_BASE (OMAP44XX_L4_CORE_BASE + 0x64C00)
+
 /* DMM */
 #define OMAP44XX_DMM_BASE  0x4E00
 #define DMM_LISA_MAP_BASE  (OMAP44XX_DMM_BASE + 0x40)
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/7] ARM OMAP4: Add SRAM base define

2012-12-18 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/include/mach/omap4-silicon.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/include/mach/omap4-silicon.h 
b/arch/arm/mach-omap/include/mach/omap4-silicon.h
index 5755856..1d236f2 100644
--- a/arch/arm/mach-omap/include/mach/omap4-silicon.h
+++ b/arch/arm/mach-omap/include/mach/omap4-silicon.h
@@ -39,6 +39,8 @@
 #define OMAP44XX_L4_WKUP_BASE  0x4A30
 #define OMAP44XX_L4_PER_BASE   0x4800
 
+#define OMAP44XX_SRAM_BASE 0x4030
+
 /* EMIF and DMM registers */
 #define OMAP44XX_EMIF1_BASE0x4c00
 #define OMAP44XX_EMIF2_BASE0x4d00
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 6/7] ARM AM33XX: Add mmc0 pin mux function

2012-12-18 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/am33xx_mux.c  |5 +
 arch/arm/mach-omap/include/mach/am33xx-mux.h |1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap/am33xx_mux.c b/arch/arm/mach-omap/am33xx_mux.c
index 22bf317..3d7f245 100644
--- a/arch/arm/mach-omap/am33xx_mux.c
+++ b/arch/arm/mach-omap/am33xx_mux.c
@@ -504,3 +504,8 @@ void enable_uart0_pin_mux(void)
 {
configure_module_pin_mux(uart0_pin_mux);
 }
+
+void enable_mmc0_pin_mux(void)
+{
+   configure_module_pin_mux(mmc0_pin_mux);
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-mux.h 
b/arch/arm/mach-omap/include/mach/am33xx-mux.h
index ed328f5..6078b3a 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-mux.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-mux.h
@@ -18,5 +18,6 @@ extern void enable_i2c0_pin_mux(void);
 extern void enable_i2c1_pin_mux(void);
 extern void enable_i2c2_pin_mux(void);
 extern void enable_uart0_pin_mux(void);
+extern void enable_mmc0_pin_mux(void);
 
 #endif /*__AM33XX_MUX_H__ */
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 4/7] ARM OMAP: Create device file

2012-12-18 Thread Teresa Gámez
Created wrapper to add omap devices.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/Makefile  |4 +-
 arch/arm/mach-omap/devices.c |   69 +++
 arch/arm/mach-omap/include/mach/am33xx-devices.h |   36 ++
 arch/arm/mach-omap/include/mach/devices.h|   27 
 arch/arm/mach-omap/include/mach/omap3-devices.h  |   60 -
 arch/arm/mach-omap/include/mach/omap4-devices.h  |   77 ++
 6 files changed, 269 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-omap/devices.c
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-devices.h
 create mode 100644 arch/arm/mach-omap/include/mach/devices.h
 create mode 100644 arch/arm/mach-omap/include/mach/omap4-devices.h

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 1536744..494da4e 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,8 @@
 # GNU General Public License for more details.
 #
 #
-obj-$(CONFIG_ARCH_OMAP) += syslib.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
 obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/devices.c b/arch/arm/mach-omap/devices.c
new file mode 100644
index 000..011db5a
--- /dev/null
+++ b/arch/arm/mach-omap/devices.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include driver.h
+#include sizes.h
+#include ns16550.h
+#include asm/armlinux.h
+#include mach/devices.h
+
+static inline struct device_d *omap_add_device(char *name, resource_size_t 
base,
+   resource_size_t size, void *pdata)
+{
+   return add_generic_device(name, DEVICE_ID_DYNAMIC, NULL,
+   base, size, IORESOURCE_MEM, pdata);
+}
+
+void omap_add_ram0(resource_size_t size)
+{
+   arm_add_mem_device(ram0, 0x8000, size);
+}
+
+void omap_add_sram0(resource_size_t base, resource_size_t size)
+{
+   add_mem_device(sram0, base, size, IORESOURCE_MEM_WRITEABLE);
+}
+
+static struct NS16550_plat serial_plat = {
+   .clock = 4800,  /* 48MHz (APLL96/2) */
+   .shift = 2,
+};
+
+struct device_d *omap_add_ns16550(resource_size_t base)
+{
+   return add_ns16550_device(DEVICE_ID_DYNAMIC, base, SZ_1K,
+   IORESOURCE_MEM_8BIT, serial_plat);
+}
+
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata)
+{
+   return omap_add_device(omap-hsmmc, base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata)
+{
+   return omap_add_device(i2c-omap, base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_spi(int id, resource_size_t base, void *pdata)
+{
+return add_generic_device(omap3_spi, id, NULL,
+   base, SZ_4K, IORESOURCE_MEM, pdata);
+}
diff --git a/arch/arm/mach-omap/include/mach/am33xx-devices.h 
b/arch/arm/mach-omap/include/mach/am33xx-devices.h
new file mode 100644
index 000..40ce854
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/am33xx-devices.h
@@ -0,0 +1,36 @@
+#include driver.h
+#include sizes.h
+
+#include mach/devices.h
+#include mach/mcspi.h
+#include mach/am33xx-silicon.h
+
+static inline struct device_d *am33xx_add_ns16550_uart0(void)
+{
+   return omap_add_ns16550(AM33XX_UART0_BASE);
+}
+
+static inline struct device_d *am33xx_add_ns16550_uart1(void)
+{
+   return omap_add_ns16550(AM33XX_UART1_BASE);
+}
+
+static inline struct device_d *am33xx_add_ns16550_uart2(void)
+{
+   return omap_add_ns16550(AM33XX_UART2_BASE);
+}
+
+static inline struct device_d *am33xx_add_mmc0(void *pdata)
+{
+   return omap_add_mmc(AM33XX_MMCHS0_BASE + 0x100, pdata);
+}
+
+static inline struct device_d *am33xx_add_mmc1(void *pdata)
+{
+   return omap_add_mmc(AM33XX_MMC1_BASE + 0x100, pdata);
+}
+
+static inline struct device_d *am33xx_add_mmc2(void *pdata)
+{
+   return omap_add_mmc(AM33XX_MMCHS2_BASE + 0x100, pdata);
+}
diff --git

[PATCH 0/7] Adding pcm051 support

2012-12-18 Thread Teresa Gámez
This patch stack is based on top of the patch series AM33XX support
by Jan Luebbe.
It includes the wrapper for adding omap devices and pcm051 support.

Teresa Gámez (7):
  ARM OMAP4: Add SRAM base define
  ARM OMAP4: Add EHCI base define
  ARM AM33XX: Add MMC Bases
  ARM OMAP: Create device file
  ARM OMAP: Use wrapper in board files
  ARM AM33XX: Add mmc0 pin mux function
  pcm051: Add inital support

 arch/arm/Makefile|1 +
 arch/arm/boards/archosg9/board.c |   19 ++
 arch/arm/boards/beagle/board.c   |   20 ++
 arch/arm/boards/beaglebone/board.c   |   17 +
 arch/arm/boards/omap343xdsp/board.c  |   12 +--
 arch/arm/boards/omap3evm/board.c |   20 ++
 arch/arm/boards/panda/board.c|   22 ++-
 arch/arm/boards/pcm049/board.c   |   21 ++
 arch/arm/boards/pcm051/Makefile  |1 +
 arch/arm/boards/pcm051/board.c   |   64 ++
 arch/arm/boards/pcm051/config.h  |   21 ++
 arch/arm/boards/pcm051/env/boot/sd   |   10 +++
 arch/arm/boards/pcm051/env/config|   22 ++
 arch/arm/boards/phycard-a-l1/pca-a-l1.c  |   20 ++
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c|   21 ++
 arch/arm/configs/pcm051_defconfig|   56 
 arch/arm/mach-omap/Kconfig   |   10 +++
 arch/arm/mach-omap/Makefile  |4 +-
 arch/arm/mach-omap/am33xx_mux.c  |5 ++
 arch/arm/mach-omap/devices.c |   69 +++
 arch/arm/mach-omap/include/mach/am33xx-devices.h |   36 ++
 arch/arm/mach-omap/include/mach/am33xx-mux.h |1 +
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |2 +
 arch/arm/mach-omap/include/mach/devices.h|   27 
 arch/arm/mach-omap/include/mach/omap3-devices.h  |   60 -
 arch/arm/mach-omap/include/mach/omap4-devices.h  |   77 ++
 arch/arm/mach-omap/include/mach/omap4-silicon.h  |5 ++
 27 files changed, 517 insertions(+), 126 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 100644 arch/arm/boards/pcm051/env/boot/sd
 create mode 100644 arch/arm/boards/pcm051/env/config
 create mode 100644 arch/arm/configs/pcm051_defconfig
 create mode 100644 arch/arm/mach-omap/devices.c
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-devices.h
 create mode 100644 arch/arm/mach-omap/include/mach/devices.h
 create mode 100644 arch/arm/mach-omap/include/mach/omap4-devices.h


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 7/7] pcm051: Add inital support

2012-12-18 Thread Teresa Gámez
Added initial support for Phytec phyCORE-AM335x.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/Makefile  |1 +
 arch/arm/boards/pcm051/Makefile|1 +
 arch/arm/boards/pcm051/board.c |   64 
 arch/arm/boards/pcm051/config.h|   21 
 arch/arm/boards/pcm051/env/boot/sd |   10 ++
 arch/arm/boards/pcm051/env/config  |   22 
 arch/arm/configs/pcm051_defconfig  |   56 +++
 arch/arm/mach-omap/Kconfig |   10 ++
 8 files changed, 185 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 100644 arch/arm/boards/pcm051/env/boot/sd
 create mode 100644 arch/arm/boards/pcm051/env/config
 create mode 100644 arch/arm/configs/pcm051_defconfig

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 5082a13..487cc64 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -115,6 +115,7 @@ board-$(CONFIG_MACH_PCM027) := pcm027
 board-$(CONFIG_MACH_PCM037):= pcm037
 board-$(CONFIG_MACH_PCM038):= pcm038
 board-$(CONFIG_MACH_PCM043):= pcm043
+board-$(CONFIG_MACH_PCM051):= pcm051
 board-$(CONFIG_MACH_PM9261):= pm9261
 board-$(CONFIG_MACH_PM9263):= pm9263
 board-$(CONFIG_MACH_PM9G45):= pm9g45
diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
new file mode 100644
index 000..dcfc293
--- /dev/null
+++ b/arch/arm/boards/pcm051/Makefile
@@ -0,0 +1 @@
+obj-y += board.o
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
new file mode 100644
index 000..ad76dc5
--- /dev/null
+++ b/arch/arm/boards/pcm051/board.c
@@ -0,0 +1,64 @@
+/*
+ * pcm051 - phyCORE-AM335x Board Initalization Code
+ *
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * Based on arch/arm/boards/omap/board-beagle.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include common.h
+#include init.h
+#include sizes.h
+#include ns16550.h
+#include asm/armlinux.h
+#include generated/mach-types.h
+#include mach/am33xx-devices.h
+#include mach/am33xx-mux.h
+#include mach/am33xx-silicon.h
+
+/**
+ * @brief UART serial port initialization
+ * arch
+ *
+ * @return result of device registration
+ */
+static int pcm051_console_init(void)
+{
+   /* Register the serial port */
+   am33xx_add_ns16550_uart0();
+
+   return 0;
+}
+console_initcall(pcm051_console_init);
+
+static int pcm051_mem_init(void)
+{
+   omap_add_ram0(SZ_512M);
+
+   return 0;
+}
+mem_initcall(pcm051_mem_init);
+
+static int pcm051_devices_init(void)
+{
+   enable_mmc0_pin_mux();
+
+   am33xx_add_mmc0(NULL);
+
+   armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
+   armlinux_set_architecture(MACH_TYPE_PCM051);
+
+   return 0;
+}
+device_initcall(pcm051_devices_init);
diff --git a/arch/arm/boards/pcm051/config.h b/arch/arm/boards/pcm051/config.h
new file mode 100644
index 000..8b2b876
--- /dev/null
+++ b/arch/arm/boards/pcm051/config.h
@@ -0,0 +1,21 @@
+/**
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#endif /* __CONFIG_H */
diff --git a/arch/arm/boards/pcm051/env/boot/sd 
b/arch/arm/boards/pcm051/env/boot/sd
new file mode 100644
index 000..f303c10
--- /dev/null
+++ b/arch/arm/boards/pcm051/env/boot/sd
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [ $1 = menu ]; then
+   boot-menu-add-entry $0 kernel  rootfs on SD card
+   exit
+fi
+
+global.bootm.image=/boot/uImage
+global.bootm.oftree=/boot/oftree
+global.linux.bootargs.dyn.root=root=/dev

[PATCH] ARM OMAP: Enable gpio output

2012-10-18 Thread Teresa Gámez
Enable output instead of disabling it.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/omap4_generic.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap/omap4_generic.c 
b/arch/arm/mach-omap/omap4_generic.c
index 76134f2..d7771bf 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -532,7 +532,7 @@ noinline int omap4_scale_vcores(unsigned vsel0_pin)
writel(val, base + 0x190);
 
val =  readl(base + 0x134);
-   val = (1  (vsel0_pin  GPIO_MASK));
+   val = ~(1  (vsel0_pin  GPIO_MASK));
writel(val, base + 0x134);
 
val = 1  (vsel0_pin  GPIO_MASK);
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] mtd ARM OMAP: Fix compile errors

2012-10-17 Thread Teresa Gámez
Fix compile errors in latest next, caused by commit
56b92e5187692f0ca28a13f0a5993ea66c99b60a
mtd: add parent support

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 drivers/mtd/nand/nand_omap_gpmc.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c 
b/drivers/mtd/nand/nand_omap_gpmc.c
index f4f5335..a2e3eb4 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -670,7 +670,7 @@ static void omap_write_buf_pref(struct mtd_info *mtd,
if (!status)
break;
if (is_timeout(start, 100 * MSECOND)) {
-   dev_err(mtd-dev, prefetch flush timed out\n);
+   dev_err(mtd-parent, prefetch flush timed out\n);
break;
}
}
@@ -929,7 +929,7 @@ static int gpmc_nand_probe(struct device_d *pdev)
 
minfo = oinfo-minfo;
minfo-priv = (void *)nand;
-   minfo-parent = dev;
+   minfo-parent = pdev;
 
if (pdata-cs = GPMC_NUM_CS) {
dev_dbg(pdev, Invalid CS!\n);
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] ARM OMAP: Create device file

2012-10-11 Thread Teresa Gámez
Created wrapper to add omap devices.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/Makefile   |4 +-
 arch/arm/mach-omap/devices.c  |   65 +
 arch/arm/mach-omap/include/mach/devices.h |   24 +++
 3 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap/devices.c
 create mode 100644 arch/arm/mach-omap/include/mach/devices.h

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index f752bc7..672944d 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,8 @@
 # GNU General Public License for more details.
 #
 #
-obj-$(CONFIG_ARCH_OMAP) += syslib.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
 obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
 pbl-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/devices.c b/arch/arm/mach-omap/devices.c
new file mode 100644
index 000..a4812b4
--- /dev/null
+++ b/arch/arm/mach-omap/devices.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include common.h
+#include driver.h
+#include sizes.h
+#include ns16550.h
+#include asm/armlinux.h
+#include mach/devices.h
+
+static inline struct device_d *omap_add_device(char *name, resource_size_t 
base,
+   resource_size_t size, void *pdata)
+{
+   return add_generic_device(name, DEVICE_ID_DYNAMIC, NULL,
+   base, size, IORESOURCE_MEM, pdata);
+}
+
+void omap_add_ram0(resource_size_t size)
+{
+   arm_add_mem_device(ram0, 0x8000, size);
+}
+
+void omap_add_sram0(resource_size_t base, resource_size_t size)
+{
+   add_mem_device(sram0, base, size, IORESOURCE_MEM_WRITEABLE);
+}
+
+static struct NS16550_plat serial_plat = {
+   .clock = 4800,  /* 48MHz (APLL96/2) */
+   .shift = 2,
+};
+
+struct device_d *omap_add_ns16550(resource_size_t base)
+{
+   return add_ns16550_device(DEVICE_ID_DYNAMIC, base, SZ_1K,
+   IORESOURCE_MEM_8BIT, serial_plat);
+}
+
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata)
+{
+   return omap_add_device(omap-hsmmc, base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata)
+{
+   return omap_add_device(i2c-omap, base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_spi(resource_size_t base, int id, void *pdata)
+{
+return add_generic_device(omap3_spi, id, NULL,
+   base, SZ_4K, IORESOURCE_MEM, pdata);
+}
diff --git a/arch/arm/mach-omap/include/mach/devices.h 
b/arch/arm/mach-omap/include/mach/devices.h
new file mode 100644
index 000..05f1fe4
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/devices.h
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ *
+ */
+
+#ifndef __ASM_ARCH_OMAP_DEVICES_H
+#define __ASM_ARCH_OMAP_DEVICES_H
+
+void omap_add_ram0(resource_size_t size);
+void omap_add_sram0(resource_size_t base, resource_size_t size);
+struct device_d *omap_add_ns16550(resource_size_t base);
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata);
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata);
+struct device_d *omap_add_spi(resource_size_t base, int id, void *pdata);
+
+#endif
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/2] ARM OMAP: Use wrapper in board files

2012-10-11 Thread Teresa Gámez
Use the omap wrappers in board files instead of add_generic_device().
Compile tested every affected board. Tested on pcm049.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/boards/beagle/board.c|   17 +
 arch/arm/boards/omap343xdsp/board.c   |   12 
 arch/arm/boards/omap3evm/board.c  |   18 +-
 arch/arm/boards/panda/board.c |   19 +--
 arch/arm/boards/pcm049/board.c|   21 +++--
 arch/arm/boards/phycard-a-l1/pca-a-l1.c   |   20 +---
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |   21 +++--
 7 files changed, 38 insertions(+), 90 deletions(-)

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index 19bf740..bab11c8 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -62,6 +62,7 @@
 #include mach/sys_info.h
 #include mach/syslib.h
 #include mach/control.h
+#include mach/devices.h
 #include mach/omap3-mux.h
 #include mach/gpmc.h
 #include mach/gpmc_nand.h
@@ -235,11 +236,6 @@ pure_initcall(beagle_board_init);
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-   .clock = 4800,  /* 48MHz (APLL96/2) */
-   .shift = 2,
-};
-
 /**
  * @brief UART serial port initialization - remember to enable COM clocks in
  * arch
@@ -249,8 +245,7 @@ static struct NS16550_plat serial_plat = {
 static int beagle_console_init(void)
 {
/* Register the serial port */
-   add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, 
IORESOURCE_MEM_8BIT,
-  serial_plat);
+   omap_add_ns16550(OMAP_UART3_BASE);
 
return 0;
 }
@@ -287,7 +282,7 @@ static struct gpmc_nand_platform_data nand_plat = {
 
 static int beagle_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 128 * 1024 * 1024);
+   omap_add_ram0(SZ_128M);
 
return 0;
 }
@@ -296,8 +291,7 @@ mem_initcall(beagle_mem_init);
 static int beagle_devices_init(void)
 {
i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-   add_generic_device(i2c-omap, DEVICE_ID_DYNAMIC, NULL, OMAP_I2C1_BASE, 
SZ_4K,
-  IORESOURCE_MEM, NULL);
+   omap_add_i2c(OMAP_I2C1_BASE, NULL);
 
 #ifdef CONFIG_USB_EHCI_OMAP
if (ehci_omap_init(omap_ehci_pdata) = 0)
@@ -310,8 +304,7 @@ static int beagle_devices_init(void)
 #endif
omap_add_gpmc_nand_device(nand_plat);
 
-   add_generic_device(omap-hsmmc, DEVICE_ID_DYNAMIC, NULL, 
OMAP_MMC1_BASE, SZ_4K,
-  IORESOURCE_MEM, NULL);
+   omap_add_mmc(OMAP_MMC1_BASE, NULL);
 
armlinux_set_bootparams((void *)0x8100);
armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap343xdsp/board.c 
b/arch/arm/boards/omap343xdsp/board.c
index 2343dc0..08211c3 100644
--- a/arch/arm/boards/omap343xdsp/board.c
+++ b/arch/arm/boards/omap343xdsp/board.c
@@ -45,11 +45,13 @@
 
 #include common.h
 #include console.h
+#include sizes.h
 #include init.h
 #include driver.h
 #include io.h
 #include ns16550.h
 #include asm/armlinux.h
+#include mach/devices.h
 #include mach/silicon.h
 #include mach/sdrc.h
 #include mach/sys_info.h
@@ -604,11 +606,6 @@ static void mux_config(void)
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-   .clock = 4800,  /* 48MHz (APLL96/2) */
-   .shift = 2,
-};
-
 /**
  * @brief UART serial port initialization - remember to enable COM clocks in 
arch
  *
@@ -617,8 +614,7 @@ static struct NS16550_plat serial_plat = {
 static int sdp3430_console_init(void)
 {
/* Register the serial port */
-   add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, 
IORESOURCE_MEM_8BIT,
-  serial_plat);
+   omap_add_ns16550(OMAP_UART3_BASE);
 
return 0;
 }
@@ -628,7 +624,7 @@ console_initcall(sdp3430_console_init);
 
 static int sdp3430_mem_init(void)
 {
-   arm_add_mem_device(ram0, 0x8000, 128 * 1024 * 1024);
+   omap_add_ram0(SZ_128M);
 
return 0;
 }
diff --git a/arch/arm/boards/omap3evm/board.c b/arch/arm/boards/omap3evm/board.c
index 7d4a87f..dbaa63c 100644
--- a/arch/arm/boards/omap3evm/board.c
+++ b/arch/arm/boards/omap3evm/board.c
@@ -48,6 +48,7 @@
 #include sizes.h
 #include ns16550.h
 #include asm/armlinux.h
+#include mach/devices.h
 #include mach/silicon.h
 #include mach/sdrc.h
 #include mach/sys_info.h
@@ -214,11 +215,6 @@ pure_initcall(omap3_evm_board_init);
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-   .clock  = 4800,  /* 48MHz (APLL96/2) */
-   .shift  = 2,
-};
-
 /**
  * @brief Initialize the serial port to be used as console.
  *
@@ -226,14 +222,11 @@ static struct NS16550_plat serial_plat = {
  */
 static int omap3evm_init_console(void)
 {
-   add_ns16550_device(DEVICE_ID_DYNAMIC

[PATCH 1/3] ARM OMAP: gpiolib fix chip.base

2012-10-09 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
@ Vicente: Please check if the patches fix your problem

 arch/arm/mach-omap/gpio.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c
index 376e9a7..49ffbda 100644
--- a/arch/arm/mach-omap/gpio.c
+++ b/arch/arm/mach-omap/gpio.c
@@ -133,7 +133,7 @@ static int omap_gpio_probe(struct device_d *dev)
omapgpio = xzalloc(sizeof(*omapgpio));
omapgpio-base = dev_request_mem_region(dev, 0);
omapgpio-chip.ops = omap_gpio_ops;
-   omapgpio-chip.base = -1;
+   omapgpio-chip.base = dev-id * 32;
omapgpio-chip.ngpio = 32;
omapgpio-chip.dev = dev;
gpiochip_add(omapgpio-chip);
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/3] ARM OMAP: Remove usage of gpio lib calls in lowlevel code

2012-10-09 Thread Teresa Gámez
As the gpio functions are not available at this point, set the gpio manually.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/omap4_generic.c |   29 +++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap/omap4_generic.c 
b/arch/arm/mach-omap/omap4_generic.c
index a159dfc..81b39f9 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -484,11 +484,27 @@ enum omap_boot_src omap4_bootsrc(void)
return OMAP_BOOTSRC_UNKNOWN;
 }
 
+#define GPIO_MASK 0x1f
+
+static void __iomem *omap4_get_gpio_base(unsigned gpio)
+{
+   void __iomem *base;
+
+   if (gpio  32)
+   base = (void *)0x4a31;
+   else
+   base = (void *)(0x48053000 + ((gpio  ~GPIO_MASK)  8));
+
+   return base;
+}
+
 #define I2C_SLAVE 0x12
 
 noinline int omap4_scale_vcores(unsigned vsel0_pin)
 {
+   void __iomem *base;
unsigned int rev = omap4_revision();
+   u32 val = 0;
 
/* For VC bypass only VCOREx_CGF_FORCE  is necessary and
 * VCOREx_CFG_VOLTAGE  changes can be discarded
@@ -510,8 +526,17 @@ noinline int omap4_scale_vcores(unsigned vsel0_pin)
 * VSEL1 is grounded on board. So the following selects
 * VSEL1 = 0 and VSEL0 = 1
 */
-   gpio_direction_output(vsel0_pin, 0);
-   gpio_set_value(vsel0_pin, 1);
+   base = omap4_get_gpio_base(vsel0_pin);
+
+   val = 1  (vsel0_pin  GPIO_MASK);
+   writel(val, base + 0x190);
+
+   val =  readl(base + 0x134);
+   val = (1  (vsel0_pin  GPIO_MASK));
+   writel(val, base + 0x134);
+
+   val = 1  (vsel0_pin  GPIO_MASK);
+   writel(val, base + 0x194);
}
 
/* set VCORE1 force VSEL */
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 0/2] Add ARCH for AM33xx and phyCORE-AM335x support

2012-09-25 Thread Teresa Gámez
This series is based on next-stable tag and tested with Jan Lübbes patch:
Makefile: add target to produce a SPL compatible uImage

v2:
- added generated defconfig
- removed global.boot.default and added boot.d/01 symlink
- created dmtimer0 header
- removed unnecessary cleanup
- use gpiolib

Teresa Gámez (2):
  ARM OMAP AM33XX: create new ARCH for AM33xx
  pcm051: Add inital support

 arch/arm/Makefile|1 +
 arch/arm/boards/pcm051/Makefile  |1 +
 arch/arm/boards/pcm051/board.c   |   72 ++
 arch/arm/boards/pcm051/config.h  |   21 ++
 arch/arm/boards/pcm051/env/boot.d/01 |1 +
 arch/arm/boards/pcm051/env/boot/disk |   10 +++
 arch/arm/boards/pcm051/env/init/automount|   32 ++
 arch/arm/boards/pcm051/env/init/bootargs-base|9 +++
 arch/arm/boards/pcm051/env/init/general  |   12 
 arch/arm/boards/pcm051/env/init/hostname |8 +++
 arch/arm/boards/pcm051/env/network/eth0  |   15 +
 arch/arm/configs/pcm051_defconfig|   56 +
 arch/arm/mach-omap/Kconfig   |   21 ++
 arch/arm/mach-omap/Makefile  |2 +
 arch/arm/mach-omap/am33xx_generic.c  |   47 ++
 arch/arm/mach-omap/dmtimer0.c|   70 +
 arch/arm/mach-omap/include/mach/am33xx-clock.h   |   26 
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   51 +++
 arch/arm/mach-omap/include/mach/clocks.h |3 +
 arch/arm/mach-omap/include/mach/dmtimer0.h   |   36 +++
 arch/arm/mach-omap/include/mach/silicon.h|3 +
 arch/arm/mach-omap/include/mach/timers.h |1 -
 drivers/mci/Kconfig  |2 +-
 23 files changed, 498 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 12 arch/arm/boards/pcm051/env/boot.d/01
 create mode 100644 arch/arm/boards/pcm051/env/boot/disk
 create mode 100644 arch/arm/boards/pcm051/env/init/automount
 create mode 100644 arch/arm/boards/pcm051/env/init/bootargs-base
 create mode 100644 arch/arm/boards/pcm051/env/init/general
 create mode 100644 arch/arm/boards/pcm051/env/init/hostname
 create mode 100644 arch/arm/boards/pcm051/env/network/eth0
 create mode 100644 arch/arm/configs/pcm051_defconfig
 create mode 100644 arch/arm/mach-omap/am33xx_generic.c
 create mode 100644 arch/arm/mach-omap/dmtimer0.c
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-clock.h
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-silicon.h
 create mode 100644 arch/arm/mach-omap/include/mach/dmtimer0.h


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCHv2 1/2] ARM OMAP AM33XX: create new ARCH for AM33xx

2012-09-25 Thread Teresa Gámez
Created ARCH for AM33xx boards as second stage bootloader.
This includes:
- Added dmtimer0
- Created basic header files
- Added MMC support for ARCH_AM33XX
- Added reset function

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/mach-omap/Kconfig   |   11 
 arch/arm/mach-omap/Makefile  |2 +
 arch/arm/mach-omap/am33xx_generic.c  |   47 +++
 arch/arm/mach-omap/dmtimer0.c|   70 ++
 arch/arm/mach-omap/include/mach/am33xx-clock.h   |   26 
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |   51 
 arch/arm/mach-omap/include/mach/clocks.h |3 +
 arch/arm/mach-omap/include/mach/dmtimer0.h   |   36 +++
 arch/arm/mach-omap/include/mach/silicon.h|3 +
 arch/arm/mach-omap/include/mach/timers.h |1 -
 drivers/mci/Kconfig  |2 +-
 11 files changed, 250 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap/am33xx_generic.c
 create mode 100644 arch/arm/mach-omap/dmtimer0.c
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-clock.h
 create mode 100644 arch/arm/mach-omap/include/mach/am33xx-silicon.h
 create mode 100644 arch/arm/mach-omap/include/mach/dmtimer0.h

diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index f69a35d..4f5c905 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -45,12 +45,23 @@ config ARCH_OMAP4
help
  Say Y here if you are using Texas Instrument's OMAP4 based platform
 
+config ARCH_AM33XX
+   bool AM33xx
+   select CPU_V7
+   select GENERIC_GPIO
+   select OMAP_CLOCK_SOURCE_DMTIMER0
+   help
+ Say Y here if you are using Texas Instrument's AM33xx based platform
+
 endchoice
 
 # Blind enable all possible clocks.. think twice before you do this.
 config OMAP_CLOCK_SOURCE_S32K
bool
 
+config OMAP_CLOCK_SOURCE_DMTIMER0
+   bool
+
 config OMAP3_CLOCK_CONFIG
prompt Clock Configuration
bool
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index f752bc7..882c7fc 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -18,10 +18,12 @@
 obj-$(CONFIG_ARCH_OMAP) += syslib.o
 pbl-$(CONFIG_ARCH_OMAP) += syslib.o
 obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
+obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
 obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
 pbl-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
 obj-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
 pbl-$(CONFIG_ARCH_OMAP4) += omap4_generic.o omap4_clock.o
+obj-$(CONFIG_ARCH_AM33XX) += am33xx_generic.o
 obj-$(CONFIG_OMAP3_CLOCK_CONFIG) += omap3_clock.o
 obj-$(CONFIG_OMAP_GPMC) += gpmc.o devices-gpmc-nand.o
 obj-$(CONFIG_SHELL_NONE) += xload.o
diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
new file mode 100644
index 000..12295f5
--- /dev/null
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -0,0 +1,47 @@
+/*
+ * (C) Copyright 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include init.h
+#include io.h
+#include mach/silicon.h
+#include mach/clocks.h
+#include mach/gpio.h
+
+void __noreturn reset_cpu(unsigned long addr)
+{
+   writel(PRM_RSTCTRL_RESET, PRM_REG(RSTCTRL));
+
+   while (1);
+}
+
+static int am33xx_gpio_init(void)
+{
+   add_generic_device(omap-gpio, 0, NULL, 0x44e07100,
+   0x1000, IORESOURCE_MEM, NULL);
+   add_generic_device(omap-gpio, 1, NULL, 0x4804c100,
+   0x1000, IORESOURCE_MEM, NULL);
+   add_generic_device(omap-gpio, 2, NULL, 0x481ac100,
+   0x1000, IORESOURCE_MEM, NULL);
+   add_generic_device(omap-gpio, 3, NULL, 0x481ae100,
+   0x1000, IORESOURCE_MEM, NULL);
+
+   return 0;
+}
+coredevice_initcall(am33xx_gpio_init);
diff --git a/arch/arm/mach-omap/dmtimer0.c b/arch/arm/mach-omap/dmtimer0.c
new file mode 100644
index 000..d768552
--- /dev/null
+++ b/arch/arm/mach-omap/dmtimer0.c
@@ -0,0 +1,70 @@
+/**
+ * @file
+ * @brief Support DMTimer0 counter

[PATCHv2 2/2] pcm051: Add inital support

2012-09-25 Thread Teresa Gámez
Added initial support for Phytec phyCORE-AM335x.

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/Makefile |1 +
 arch/arm/boards/pcm051/Makefile   |1 +
 arch/arm/boards/pcm051/board.c|   72 +
 arch/arm/boards/pcm051/config.h   |   21 +++
 arch/arm/boards/pcm051/env/boot.d/01  |1 +
 arch/arm/boards/pcm051/env/boot/disk  |   10 
 arch/arm/boards/pcm051/env/init/automount |   32 +++
 arch/arm/boards/pcm051/env/init/bootargs-base |9 +++
 arch/arm/boards/pcm051/env/init/general   |   12 
 arch/arm/boards/pcm051/env/init/hostname  |8 +++
 arch/arm/boards/pcm051/env/network/eth0   |   15 +
 arch/arm/configs/pcm051_defconfig |   56 +++
 arch/arm/mach-omap/Kconfig|   10 
 13 files changed, 248 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boards/pcm051/Makefile
 create mode 100644 arch/arm/boards/pcm051/board.c
 create mode 100644 arch/arm/boards/pcm051/config.h
 create mode 12 arch/arm/boards/pcm051/env/boot.d/01
 create mode 100644 arch/arm/boards/pcm051/env/boot/disk
 create mode 100644 arch/arm/boards/pcm051/env/init/automount
 create mode 100644 arch/arm/boards/pcm051/env/init/bootargs-base
 create mode 100644 arch/arm/boards/pcm051/env/init/general
 create mode 100644 arch/arm/boards/pcm051/env/init/hostname
 create mode 100644 arch/arm/boards/pcm051/env/network/eth0
 create mode 100644 arch/arm/configs/pcm051_defconfig

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 208f0f4..821405f 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -109,6 +109,7 @@ board-$(CONFIG_MACH_PCM027) := pcm027
 board-$(CONFIG_MACH_PCM037):= pcm037
 board-$(CONFIG_MACH_PCM038):= pcm038
 board-$(CONFIG_MACH_PCM043):= pcm043
+board-$(CONFIG_MACH_PCM051):= pcm051
 board-$(CONFIG_MACH_PM9261):= pm9261
 board-$(CONFIG_MACH_PM9263):= pm9263
 board-$(CONFIG_MACH_PM9G45):= pm9g45
diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
new file mode 100644
index 000..dcfc293
--- /dev/null
+++ b/arch/arm/boards/pcm051/Makefile
@@ -0,0 +1 @@
+obj-y += board.o
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
new file mode 100644
index 000..7cb85f1
--- /dev/null
+++ b/arch/arm/boards/pcm051/board.c
@@ -0,0 +1,72 @@
+/*
+ * pcm051 - phyCORE-AM335x Board Initalization Code
+ *
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * Based on arch/arm/boards/omap/board-beagle.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include init.h
+#include sizes.h
+#include ns16550.h
+#include asm/armlinux.h
+#include generated/mach-types.h
+#include mach/silicon.h
+
+static struct NS16550_plat serial_plat = {
+   .clock = 4800,  /* 48MHz (APLL96/2) */
+   .shift = 2,
+};
+
+/**
+ * @brief UART serial port initialization
+ * arch
+ *
+ * @return result of device registration
+ */
+static int pcm051_console_init(void)
+{
+   /* Register the serial port */
+   add_ns16550_device(DEVICE_ID_DYNAMIC, AM33XX_UART0_BASE, 1024,
+   IORESOURCE_MEM_8BIT, serial_plat);
+
+   return 0;
+}
+console_initcall(pcm051_console_init);
+
+static int pcm051_mem_init(void)
+{
+   arm_add_mem_device(ram0, AM33XX_DRAM_ADDR_SPACE_START, SZ_512M);
+
+   return 0;
+}
+mem_initcall(pcm051_mem_init);
+
+static int pcm051_devices_init(void)
+{
+   add_generic_device(omap-hsmmc, DEVICE_ID_DYNAMIC, NULL,
+   (AM33XX_MMCHS0_BASE + 0x100), SZ_4K,
+   IORESOURCE_MEM, NULL);
+
+   armlinux_set_bootparams((void *)(AM33XX_DRAM_ADDR_SPACE_START + 0x100));
+   armlinux_set_architecture(MACH_TYPE_PCM051);
+
+   return 0;
+}
+device_initcall(pcm051_devices_init);
diff --git a/arch/arm/boards/pcm051/config.h b/arch/arm/boards/pcm051/config.h
new file mode 100644
index 000..8b2b876
--- /dev/null
+++ b/arch/arm/boards/pcm051/config.h
@@ -0,0 +1,21 @@
+/**
+ * This program is free

[PATCH 2/2] ARM OMAP: switch to gpiolib support

2012-09-24 Thread Teresa Gámez

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 arch/arm/Kconfig   |1 +
 arch/arm/mach-omap/gpio.c  |  171 ---
 arch/arm/mach-omap/omap3_generic.c |   19 
 arch/arm/mach-omap/omap4_generic.c |   19 
 4 files changed, 117 insertions(+), 93 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a54ad03..7b7b058 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -58,6 +58,7 @@ config ARCH_NOMADIK
 config ARCH_OMAP
bool TI OMAP
select HAS_DEBUG_LL
+   select GPIOLIB
 
 config ARCH_PXA
bool Intel/Marvell PXA based
diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c
index 142cf52..d217550 100644
--- a/arch/arm/mach-omap/gpio.c
+++ b/arch/arm/mach-omap/gpio.c
@@ -36,11 +36,10 @@
  * published by the Free Software Foundation.
  */
 #include common.h
-#include mach/gpio.h
 #include io.h
 #include errno.h
-
-#ifdef CONFIG_ARCH_OMAP3
+#include gpio.h
+#include init.h
 
 #define OMAP_GPIO_OE   0x0034
 #define OMAP_GPIO_DATAIN   0x0038
@@ -48,129 +47,115 @@
 #define OMAP_GPIO_CLEARDATAOUT 0x0090
 #define OMAP_GPIO_SETDATAOUT   0x0094
 
-static void __iomem *gpio_bank[] = {
-   (void *)0x4831,
-   (void *)0x4905,
-   (void *)0x49052000,
-   (void *)0x49054000,
-   (void *)0x49056000,
-   (void *)0x49058000,
-};
-#endif
-
-#ifdef CONFIG_ARCH_OMAP4
-
-#define OMAP_GPIO_OE   0x0134
-#define OMAP_GPIO_DATAIN   0x0138
-#define OMAP_GPIO_DATAOUT  0x013c
-#define OMAP_GPIO_CLEARDATAOUT 0x0190
-#define OMAP_GPIO_SETDATAOUT   0x0194
-
-static void __iomem *gpio_bank[] = {
-   (void *)0x4a31,
-   (void *)0x48055000,
-   (void *)0x48057000,
-   (void *)0x48059000,
-   (void *)0x4805b000,
-   (void *)0x4805d000,
+struct omap_gpio_chip {
+   void __iomem *base;
+   struct gpio_chip chip;
 };
-#endif
-
-static inline void __iomem *get_gpio_base(int gpio)
-{
-   return gpio_bank[gpio  5];
-}
 
-static inline int get_gpio_index(int gpio)
+static inline int omap_get_gpio_index(int gpio)
 {
return gpio  0x1f;
 }
 
-static inline int gpio_valid(int gpio)
+static void omap_gpio_set_value(struct gpio_chip *chip,
+   unsigned gpio, int value)
 {
-   if (gpio  0)
-   return -1;
-   if (gpio / 32  ARRAY_SIZE(gpio_bank))
-   return 0;
-   return -1;
-}
-
-static int check_gpio(int gpio)
-{
-   if (gpio_valid(gpio)  0) {
-   printf(ERROR : check_gpio: invalid GPIO %d\n, gpio);
-   return -1;
-   }
-   return 0;
-}
-
-void gpio_set_value(unsigned gpio, int value)
-{
-   void __iomem *reg;
+   struct omap_gpio_chip *omapgpio =
+   container_of(chip, struct omap_gpio_chip, chip);
+   void __iomem *base = omapgpio-base;
u32 l = 0;
 
-   if (check_gpio(gpio)  0)
-   return;
-
-   reg = get_gpio_base(gpio);
-
if (value)
-   reg += OMAP_GPIO_SETDATAOUT;
+   base += OMAP_GPIO_SETDATAOUT;
else
-   reg += OMAP_GPIO_CLEARDATAOUT;
-   l = 1  get_gpio_index(gpio);
+   base += OMAP_GPIO_CLEARDATAOUT;
+
+   l = 1  omap_get_gpio_index(gpio);
 
-   __raw_writel(l, reg);
+   writel(l, base);
 }
 
-int gpio_direction_input(unsigned gpio)
+static int omap_gpio_direction_input(struct gpio_chip *chip,
+   unsigned gpio)
 {
-   void __iomem *reg;
+   struct omap_gpio_chip *omapgpio =
+   container_of(chip, struct omap_gpio_chip, chip);
+   void __iomem *base = omapgpio-base;
u32 val;
 
-   if (check_gpio(gpio)  0)
-   return -EINVAL;
-
-   reg = get_gpio_base(gpio);
-
-   reg += OMAP_GPIO_OE;
+   base += OMAP_GPIO_OE;
 
-   val = __raw_readl(reg);
-   val |= 1  get_gpio_index(gpio);
-   __raw_writel(val, reg);
+   val = readl(base);
+   val |= 1  omap_get_gpio_index(gpio);
+   writel(val, base);
 
return 0;
 }
 
-int gpio_direction_output(unsigned gpio, int value)
+static int omap_gpio_direction_output(struct gpio_chip *chip,
+   unsigned gpio, int value)
 {
-   void __iomem *reg;
+   struct omap_gpio_chip *omapgpio =
+   container_of(chip, struct omap_gpio_chip, chip);
+   void __iomem *base = omapgpio-base;
u32 val;
 
-   if (check_gpio(gpio)  0)
-   return -EINVAL;
-   reg = get_gpio_base(gpio);
+   omap_gpio_set_value(chip, gpio, value);
 
-   gpio_set_value(gpio, value);
+   base += OMAP_GPIO_OE;
 
-   reg += OMAP_GPIO_OE;
-
-   val = __raw_readl(reg);
-   val = ~(1  get_gpio_index(gpio));
-   __raw_writel(val, reg);
+   val = readl(base);
+   val = ~(1  omap_get_gpio_index(gpio));
+   writel(val, base

[PATCH 1/3] Add support for creating barebox.img file.

2012-09-20 Thread Teresa Gámez
The AM335x U-boot SPL expects to load a u-boot image when booting
from SD-Card.

Based on code of Jan Luebbe j...@pengutronix.de

Signed-off-by: Teresa Gámez t.ga...@phytec.de
---
 .gitignore |1 +
 Makefile   |5 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 4154c73..d147992 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,6 +31,7 @@ cross_compile
 barebox
 barebox.S
 barebox.bin
+barebox.img
 barebox.srec
 barebox.netx
 barebox.s5p
diff --git a/Makefile b/Makefile
index c6264d3..3c3cde4 100644
--- a/Makefile
+++ b/Makefile
@@ -680,6 +680,11 @@ ifndef CONFIG_PBL_IMAGE
$(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
 endif
 
+barebox.img: barebox.bin
+   $(srctree)/scripts/mkimage -A $(ARCH) -T firmware -C none \
+   -O barebox -a $(CONFIG_TEXT_BASE) -e $(CONFIG_TEXT_BASE) \
+   -n barebox $(KERNELRELEASE) -d $ $@
+
 ifdef CONFIG_X86
 barebox.S: barebox
 ifdef CONFIG_X86_HDBOOT
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  1   2   >