Re: [PATCH] of: gpio: Add Kconfig variable to depend on

2013-11-26 Thread Sascha Hauer
On Sat, Nov 23, 2013 at 07:21:38AM +0100, Alexander Aring wrote:
> Hi Sascha,
> 
> On Fri, Nov 22, 2013 at 03:55:22PM +0100, Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer 
> > ---
> >  drivers/of/Kconfig  | 5 +
> >  drivers/of/Makefile | 2 +-
> >  include/of_gpio.h   | 6 +++---
> >  3 files changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> > index 6b893d7..cdf7ac7 100644
> > --- a/drivers/of/Kconfig
> > +++ b/drivers/of/Kconfig
> > @@ -19,6 +19,11 @@ config OF_NET
> > depends on NET
> > def_bool y
> >  
> > +config OF_GPIO
> > +   depends on CONFIG_GPIOLIB
> > +   depends on CONFIG_OFDEVICE
> > +   def_bool y
> 
> On current next branch the "def_bool y" is missing, so I get:
> 
> drivers/of/Kconfig:22:warning: config symbol defined without type
> 
> I will send a patch soon...

I fixed this by using the correct patch. The wrong one leaked in by
accident.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH 04/17] ARM: am335x phytec phyCORE: Switch to devicetree probe support

2013-11-26 Thread Sascha Hauer
On Wed, Nov 27, 2013 at 04:20:11AM +0100, Alexander Aring wrote:
> Hi Sascha,
> 
> nice patchstack.
> 
> On Tue, Nov 26, 2013 at 05:45:54PM +0100, Sascha Hauer wrote:
> > This switches the am335x Phytec phyCORE to devicetree probe support.
> > For now we use a linked in dtb.
> > 
> > Signed-off-by: Sascha Hauer 
> > ---
> >  arch/arm/boards/pcm051/Makefile   |   2 +-
> >  arch/arm/boards/pcm051/board.c| 149 
> > ++
> >  arch/arm/boards/pcm051/mux.c  |  65 ---
> >  arch/arm/boards/pcm051/mux.h  |   4 -
> >  arch/arm/configs/pcm051_defconfig |  26 --
> >  arch/arm/configs/pcm051_mlo_defconfig |   8 +-
> >  6 files changed, 32 insertions(+), 222 deletions(-)
> >  delete mode 100644 arch/arm/boards/pcm051/mux.c
> >  delete mode 100644 arch/arm/boards/pcm051/mux.h
> > 
> > diff --git a/arch/arm/boards/pcm051/Makefile 
> > b/arch/arm/boards/pcm051/Makefile
> > index 69d48e1..092c31d 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 mux.o
> > +obj-y += board.o
> > diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
> ...
> > -CONFIG_ARCH_AM33XX=y
> >  CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
> >  CONFIG_MACH_PCM051=y
> > -CONFIG_OMAP_UART1=y
> > -CONFIG_AEABI=y
> > +CONFIG_THUMB2_BAREBOX=y
> >  CONFIG_ARM_BOARD_APPEND_ATAG=y
> >  CONFIG_CMD_ARM_MMUINFO=y
> >  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
> >  CONFIG_ARM_UNWIND=y
> > +CONFIG_PBL_IMAGE=y
> > +CONFIG_PBL_RELOCATABLE=y
> >  CONFIG_MMU=y
> > -CONFIG_TEXT_BASE=0x8f00
> > -CONFIG_MALLOC_SIZE=0x200
> > +CONFIG_TEXT_BASE=0x0
> > +CONFIG_MALLOC_SIZE=0x0
> Why is this zero now? Are these things defined in the dts file?

It's a relocatable binary which gets relocated during runtime. The
address doesn't matter anymore, but setting it to zero helps translating
the addresses from the objdump to the running binary.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH] commands: of_node fix descripion

2013-11-26 Thread Sascha Hauer
On Tue, Nov 26, 2013 at 09:57:33AM +0100, Jan Weitzel wrote:
> Remove copy and paste error
> 
> Signed-off-by: Jan Weitzel 
> ---
>  commands/Kconfig |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/commands/Kconfig b/commands/Kconfig
> index 9738ec4..1e07b5b 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -559,7 +559,7 @@ config CMD_OF_NODE
>   select OFTREE
>   prompt "of_node"
>   help
> -   The of_property command allows adding and removing devicetree nodes.
> +   The of_node command allows adding and removing devicetree nodes.

Applied, thanks

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

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


Re: [PATCH 04/17] ARM: am335x phytec phyCORE: Switch to devicetree probe support

2013-11-26 Thread Alexander Aring
Hi Sascha,

nice patchstack.

On Tue, Nov 26, 2013 at 05:45:54PM +0100, Sascha Hauer wrote:
> This switches the am335x Phytec phyCORE to devicetree probe support.
> For now we use a linked in dtb.
> 
> Signed-off-by: Sascha Hauer 
> ---
>  arch/arm/boards/pcm051/Makefile   |   2 +-
>  arch/arm/boards/pcm051/board.c| 149 
> ++
>  arch/arm/boards/pcm051/mux.c  |  65 ---
>  arch/arm/boards/pcm051/mux.h  |   4 -
>  arch/arm/configs/pcm051_defconfig |  26 --
>  arch/arm/configs/pcm051_mlo_defconfig |   8 +-
>  6 files changed, 32 insertions(+), 222 deletions(-)
>  delete mode 100644 arch/arm/boards/pcm051/mux.c
>  delete mode 100644 arch/arm/boards/pcm051/mux.h
> 
> diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
> index 69d48e1..092c31d 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 mux.o
> +obj-y += board.o
> diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
...
> -CONFIG_ARCH_AM33XX=y
>  CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
>  CONFIG_MACH_PCM051=y
> -CONFIG_OMAP_UART1=y
> -CONFIG_AEABI=y
> +CONFIG_THUMB2_BAREBOX=y
>  CONFIG_ARM_BOARD_APPEND_ATAG=y
>  CONFIG_CMD_ARM_MMUINFO=y
>  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
>  CONFIG_ARM_UNWIND=y
> +CONFIG_PBL_IMAGE=y
> +CONFIG_PBL_RELOCATABLE=y
>  CONFIG_MMU=y
> -CONFIG_TEXT_BASE=0x8f00
> -CONFIG_MALLOC_SIZE=0x200
> +CONFIG_TEXT_BASE=0x0
> +CONFIG_MALLOC_SIZE=0x0
Why is this zero now? Are these things defined in the dts file?

- Alex

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


[PATCH 14/17] ARM: am335x Phytec phyCORE: configure environment from devicetree

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/pcm051/board.c | 17 ++---
 arch/arm/dts/am335x-phytec-phycore.dts | 18 +-
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
index 4b76f4c..a64d219 100644
--- a/arch/arm/boards/pcm051/board.c
+++ b/arch/arm/boards/pcm051/board.c
@@ -47,26 +47,13 @@ static int pcm051_devices_init(void)
 
switch (bootsource_get()) {
case BOOTSOURCE_SPI:
-   devfs_add_partition("m25p0", 0x0, SZ_128K,
-   DEVFS_PARTITION_FIXED, "xload");
-   devfs_add_partition("m25p0", SZ_128K, SZ_512K,
-   DEVFS_PARTITION_FIXED, "self0");
-   devfs_add_partition("m25p0", SZ_128K + SZ_512K, SZ_128K,
-   DEVFS_PARTITION_FIXED, "env0");
+   of_device_enable_path("/chosen/environment-spi");
break;
case BOOTSOURCE_MMC:
omap_set_bootmmc_devname("mmc0");
break;
default:
-   devfs_add_partition("nand0", 0x0, SZ_128K,
-   DEVFS_PARTITION_FIXED, "xload_raw");
-   dev_add_bb_dev("xload_raw", "xload");
-   devfs_add_partition("nand0", SZ_512K, SZ_512K,
-   DEVFS_PARTITION_FIXED, "self_raw");
-   dev_add_bb_dev("self_raw", "self0");
-   devfs_add_partition("nand0", SZ_512K + SZ_512K, SZ_128K,
-   DEVFS_PARTITION_FIXED, "env_raw");
-   dev_add_bb_dev("env_raw", "env0");
+   of_device_enable_path("/chosen/environment-nand");
break;
}
 
diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 8fbfae6..81c08fd 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -6,6 +6,22 @@
model = "Phytec phyCORE AM335x";
compatible = "phytec,phycore-am335x", "ti,am33xx";
 
+   chosen {
+   linux,stdout-path = &uart0;
+
+   environment-spi {
+   compatible = "barebox,environment";
+   device-path = &flash, "partname:bareboxenv";
+   status = "disabled";
+   };
+
+   environment-nand {
+   compatible = "barebox,environment";
+   device-path = &nand, "partname:bareboxenv";
+   status = "disabled";
+   };
+   };
+
memory {
device_type = "memory";
reg = <0x8000 0x2000>; /* 512 MB */
@@ -211,7 +227,7 @@
pinctrl-names = "default";
pinctrl-0 = <&nandflash_pins_s0>;
ranges = <0 0 0x0800 0x1000>;   /* CS0: NAND */
-   nand@0,0 {
+   nand: nand@0,0 {
reg = <0 0 0>; /* CS0, offset 0 */
nand-bus-width = <8>;
ti,nand-ecc-opt = "bch8-romcode";
-- 
1.8.4.2


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


[PATCH 06/17] ARM: am33xx Phytec phyCORE: Switch to multiimage support

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/pcm051/lowlevel.c | 41 ---
 arch/arm/configs/pcm051_defconfig |  4 
 arch/arm/configs/pcm051_mlo_defconfig |  9 
 arch/arm/dts/Makefile |  1 +
 arch/arm/mach-omap/Kconfig|  1 +
 images/Makefile   |  3 ++-
 images/Makefile.am33xx| 22 +++
 7 files changed, 63 insertions(+), 18 deletions(-)
 create mode 100644 images/Makefile.am33xx

diff --git a/arch/arm/boards/pcm051/lowlevel.c 
b/arch/arm/boards/pcm051/lowlevel.c
index 08f36ec..d3cac68 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -46,6 +46,9 @@ static const struct am33xx_ddr_data 
MT41J256M8HX15E_2x256M8_data = {
.dll_lock_diff0 = 0x0,
 };
 
+extern char __dtb_am335x_phytec_phycore_start[];
+extern char __dtb_am335x_phytec_phycore_end[];
+
 /**
  * @brief The basic entry point for board initialization.
  *
@@ -55,8 +58,10 @@ static const struct am33xx_ddr_data 
MT41J256M8HX15E_2x256M8_data = {
  *
  * @return void
  */
-static int pcm051_board_init(void)
+static noinline void pcm051_board_init(void)
 {
+   unsigned long sdram = 0x8000, fdt;
+
/* WDT1 is already running when the bootloader gets control
 * Disable it to avoid "random" resets
 */
@@ -66,9 +71,6 @@ static int pcm051_board_init(void)
writel(WDT_DISABLE_CODE2, AM33XX_WDT_REG(WSPR));
while (readl(AM33XX_WDT_REG(WWPS)) != 0x0);
 
-   if (am33xx_running_in_sdram())
-   return 0;
-
am33xx_pll_init(MPUPLL_M_600, 25, DDRPLL_M_303);
 
am335x_sdram_init(0x18B, &MT41J256M8HX15E_2x256M8_cmd,
@@ -80,16 +82,39 @@ static int pcm051_board_init(void)
omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
putc_ll('>');
 
-   return 0;
+   /*
+* Copy the devicetree blob to sdram so that the barebox code finds it
+* inside valid SDRAM instead of SRAM.
+*/
+   memcpy((void *)sdram, __dtb_am335x_phytec_phycore_start,
+   __dtb_am335x_phytec_phycore_end -
+   __dtb_am335x_phytec_phycore_start);
+   fdt = sdram;
+
+   barebox_arm_entry(sdram, SZ_512M, fdt);
 }
 
-void __naked __bare_init barebox_arm_reset_vector(uint32_t *data)
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sram, bootinfo, r1, r2)
 {
-   am33xx_save_bootinfo(data);
+   am33xx_save_bootinfo((void *)bootinfo);
 
arm_cpu_lowlevel_init();
 
+   /*
+* Setup C environment, the board init code uses global variables.
+* Stackpointer has already been initialized by the ROM code.
+*/
+   relocate_to_current_adr();
+   setup_c();
+
pcm051_board_init();
+}
+
+ENTRY_FUNCTION(start_am33xx_phytec_phycore_sdram, r0, r1, r2)
+{
+   uint32_t fdt;
+
+   fdt = (uint32_t)__dtb_am335x_phytec_phycore_start - 
get_runtime_offset();
 
-   barebox_arm_entry(0x8000, SZ_512M, 0);
+   barebox_arm_entry(0x8000, SZ_512M, fdt);
 }
diff --git a/arch/arm/configs/pcm051_defconfig 
b/arch/arm/configs/pcm051_defconfig
index e55ac47..482329a 100644
--- a/arch/arm/configs/pcm051_defconfig
+++ b/arch/arm/configs/pcm051_defconfig
@@ -1,5 +1,3 @@
-CONFIG_BUILTIN_DTB=y
-CONFIG_BUILTIN_DTB_NAME="am335x-phytec-phycore"
 CONFIG_ARCH_OMAP=y
 CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
 CONFIG_MACH_PCM051=y
@@ -8,8 +6,6 @@ CONFIG_ARM_BOARD_APPEND_ATAG=y
 CONFIG_CMD_ARM_MMUINFO=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_UNWIND=y
-CONFIG_PBL_IMAGE=y
-CONFIG_PBL_RELOCATABLE=y
 CONFIG_MMU=y
 CONFIG_TEXT_BASE=0x0
 CONFIG_MALLOC_SIZE=0x0
diff --git a/arch/arm/configs/pcm051_mlo_defconfig 
b/arch/arm/configs/pcm051_mlo_defconfig
index 4f6a7b1..dc4165a 100644
--- a/arch/arm/configs/pcm051_mlo_defconfig
+++ b/arch/arm/configs/pcm051_mlo_defconfig
@@ -1,5 +1,3 @@
-CONFIG_BUILTIN_DTB=y
-CONFIG_BUILTIN_DTB_NAME="am335x-phytec-phycore"
 CONFIG_ARCH_OMAP=y
 CONFIG_OMAP_BUILD_IFT=y
 CONFIG_MACH_PCM051=y
@@ -8,9 +6,10 @@ CONFIG_THUMB2_BAREBOX=y
 # CONFIG_MEMINFO is not set
 CONFIG_ENVIRONMENT_VARIABLES=y
 CONFIG_MMU=y
-CONFIG_TEXT_BASE=0x402F0400
-CONFIG_STACK_SIZE=0x1600
-CONFIG_MALLOC_SIZE=0x100
+CONFIG_TEXT_BASE=0x0
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_RELOCATABLE=y
 CONFIG_PROMPT="MLO>"
 CONFIG_SHELL_NONE=y
 # CONFIG_ERRNO_MESSAGES is not set
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 9e85d5a..6618660 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -28,6 +28,7 @@ pbl-$(CONFIG_MACH_FREESCALE_MX51_PDK) += imx51-babbage.dtb.o
 pbl-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o
 pbl-$(CONFIG_MACH_FREESCALE_MX53_VMX53) += imx53-voipac-bsb.dtb.o
 pbl-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o 
imx6dl-dfi-fs700-m60-6s.dtb.o
+pbl-$(CONFIG_MACH_PCM051) += am335x-phytec-phycore.dtb.o
 pbl-$(CONFIG_MACH_PHYTEC_PFLA02) += imx6q-phytec-

[PATCH 03/17] ARM: Add base am335x-phytec-phycore devicetree file

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/dts/Makefile  |   2 +
 arch/arm/dts/am335x-phytec-phycore.dts | 233 +
 2 files changed, 235 insertions(+)
 create mode 100644 arch/arm/dts/am335x-phytec-phycore.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index e2ef0b3..9e85d5a 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1,3 +1,5 @@
+dtb-$(CONFIG_ARCH_AM33XX) += \
+   am335x-phytec-phycore.dtb
 dtb-$(CONFIG_ARCH_IMX51) += imx51-babbage.dtb \
imx51-genesi-efika-sb.dtb
 dtb-$(CONFIG_ARCH_IMX53) += imx53-qsb.dtb \
diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
new file mode 100644
index 000..3888c67
--- /dev/null
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -0,0 +1,233 @@
+/dts-v1/;
+
+#include "am33xx.dtsi"
+
+/ {
+   model = "Phytec phyCORE AM335x";
+   compatible = "phytec,phycore-am335x", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x2000>; /* 512 MB */
+   };
+
+   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 {
+   i2c0_pins: pinmux_i2c0_pins {
+   pinctrl-single,pins = <
+   0x188 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
i2c0_sda.i2c0_sda */
+   0x18c (PIN_INPUT_PULLUP | MUX_MODE0)/* 
i2c0_scl.i2c0_scl */
+   >;
+   };
+
+   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)
+   >;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = <
+   0x170 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
uart0_rxd.uart0_rxd */
+   0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart0_txd.uart0_txd */
+   >;
+   };
+
+   mmc1_pins: pinmux_mmc1_pins {
+   pinctrl-single,pins = <
+   0xf0 (MUX_MODE0 | INPUT_EN | PULL_UP)   /* 
mmc0_dat3.mmc0_dat3 */
+   0xf4 (MUX_MODE0 | INPUT_EN | PULL_UP)   /* 
mmc0_dat2.mmc0_dat2 */
+   0xf8 (MUX_MODE0 | INPUT_EN | PULL_UP)   /* 
mmc0_dat1.mmc0_dat1 */
+   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 */
+   >;
+   };
+
+   emac_rmii1_pins: pinmux_emac_rmii1_pins {
+   pinctrl-single,pins = <
+   0x10c (INPUT_EN | MUX_MODE1)
+   0x110 (INPUT_EN | MUX_MODE1)
+   0x114 MUX_MODE1
+   0x124 MUX_MODE1
+   0x128 MUX_MODE1
+   0x13c (INPUT_EN | MUX_MODE1)
+   0x140 (INPUT_EN | MUX_MODE1)
+   0x148 (PULL_UP | INPUT_EN | MUX_MODE0)
+   0x14c (PULL_UP | MUX_MODE0)
+   0x144 (INPUT_EN | MUX_MODE0)
+
+   /* 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)   /* 

[PATCH 16/17] ARM: OMAP: introduce multiboard support and move am33xx boards to it

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/configs/am335x_beaglebone_defconfig |  1 +
 arch/arm/configs/am335x_beaglebone_mlo_defconfig |  1 +
 arch/arm/configs/pcm051_defconfig|  1 +
 arch/arm/configs/pcm051_mlo_defconfig|  1 +
 arch/arm/mach-omap/Kconfig   | 36 ++--
 5 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/arch/arm/configs/am335x_beaglebone_defconfig 
b/arch/arm/configs/am335x_beaglebone_defconfig
index 38e19ef..857b89c 100644
--- a/arch/arm/configs/am335x_beaglebone_defconfig
+++ b/arch/arm/configs/am335x_beaglebone_defconfig
@@ -1,4 +1,5 @@
 CONFIG_ARCH_OMAP=y
+CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_CMD_ARM_MMUINFO=y
diff --git a/arch/arm/configs/am335x_beaglebone_mlo_defconfig 
b/arch/arm/configs/am335x_beaglebone_mlo_defconfig
index ac682cc..905cc6d 100644
--- a/arch/arm/configs/am335x_beaglebone_mlo_defconfig
+++ b/arch/arm/configs/am335x_beaglebone_mlo_defconfig
@@ -1,6 +1,7 @@
 CONFIG_ARCH_OMAP=y
 # CONFIG_OMAP_GPMC is not set
 CONFIG_OMAP_BUILD_IFT=y
+CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_THUMB2_BAREBOX=y
 # CONFIG_CMD_ARM_CPUINFO is not set
diff --git a/arch/arm/configs/pcm051_defconfig 
b/arch/arm/configs/pcm051_defconfig
index 949c82f..d7e510b 100644
--- a/arch/arm/configs/pcm051_defconfig
+++ b/arch/arm/configs/pcm051_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARCH_OMAP=y
 CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
+CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_PCM051=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_ARM_BOARD_APPEND_ATAG=y
diff --git a/arch/arm/configs/pcm051_mlo_defconfig 
b/arch/arm/configs/pcm051_mlo_defconfig
index dc4165a..ae5764b 100644
--- a/arch/arm/configs/pcm051_mlo_defconfig
+++ b/arch/arm/configs/pcm051_mlo_defconfig
@@ -1,5 +1,6 @@
 CONFIG_ARCH_OMAP=y
 CONFIG_OMAP_BUILD_IFT=y
+CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_PCM051=y
 CONFIG_THUMB2_BAREBOX=y
 # CONFIG_CMD_ARM_CPUINFO is not set
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
index 3a5..12b9c1f 100644
--- a/arch/arm/mach-omap/Kconfig
+++ b/arch/arm/mach-omap/Kconfig
@@ -114,8 +114,29 @@ config CMD_BOOT_ORDER
help
  A command to choose the next boot device on a warm reset.
 
+config OMAP_MULTI_BOARDS
+   bool "Allow multiple boards to be selected"
+   select HAVE_DEFAULT_ENVIRONMENT_NEW
+   select HAVE_PBL_MULTI_IMAGES
+
+if OMAP_MULTI_BOARDS
+
+config MACH_BEAGLEBONE
+   bool "Texas Instrument's Beagle Bone"
+   select ARCH_AM33XX
+   help
+ Say Y here if you are using Beagle Bone
+
+config MACH_PCM051
+   bool "Phytec phyCORE pcm051"
+   select ARCH_AM33XX
+   help
+ Say Y here if you are using Phytecs phyCORE pcm051 board
+endif
+
 choice
prompt "Select OMAP board"
+   depends on !OMAP_MULTI_BOARDS
 
 config MACH_OMAP343xSDP
bool "Texas Instrument's SDP343x"
@@ -130,13 +151,6 @@ config MACH_BEAGLE
help
  Say Y here if you are using Beagle Board
 
-config MACH_BEAGLEBONE
-   bool "Texas Instrument's Beagle Bone"
-   select ARCH_AM33XX
-   select HAVE_PBL_MULTI_IMAGES
-   help
- Say Y here if you are using Beagle Bone
-
 config MACH_OMAP3EVM
bool "Texas Instrument's OMAP3 EVM"
select ARCH_OMAP3
@@ -175,14 +189,6 @@ config MACH_PCAAXL2
help
  Say Y here if you are using a phyCARD-A-XL1 PCA-A-XL1
 
-config MACH_PCM051
-   bool "Phytec phyCORE pcm051"
-   select HAVE_DEFAULT_ENVIRONMENT_NEW
-   select ARCH_AM33XX
-   select HAVE_PBL_MULTI_IMAGES
-   help
- Say Y here if you are using Phytecs phyCORE pcm051 board
-
 endchoice
 
 if ARCH_OMAP
-- 
1.8.4.2


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


[PATCH 08/17] ARM: dts: Add am33xx beaglebone(black) dts files

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/dts/Makefile|   2 +
 arch/arm/dts/am335x-bone-common.dtsi | 299 +++
 arch/arm/dts/am335x-bone.dts |  29 
 arch/arm/dts/am335x-boneblack.dts|  78 +
 arch/arm/dts/tps65217.dtsi   |  56 +++
 5 files changed, 464 insertions(+)
 create mode 100644 arch/arm/dts/am335x-bone-common.dtsi
 create mode 100644 arch/arm/dts/am335x-bone.dts
 create mode 100644 arch/arm/dts/am335x-boneblack.dts
 create mode 100644 arch/arm/dts/tps65217.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6618660..cff294b 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1,4 +1,6 @@
 dtb-$(CONFIG_ARCH_AM33XX) += \
+   am335x-bone.dtb \
+   am335x-boneblack.dtb \
am335x-phytec-phycore.dtb
 dtb-$(CONFIG_ARCH_IMX51) += imx51-babbage.dtb \
imx51-genesi-efika-sb.dtb
diff --git a/arch/arm/dts/am335x-bone-common.dtsi 
b/arch/arm/dts/am335x-bone-common.dtsi
new file mode 100644
index 000..e3f27ec
--- /dev/null
+++ b/arch/arm/dts/am335x-bone-common.dtsi
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * 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.
+ */
+
+/ {
+   model = "TI AM335x BeagleBone";
+   compatible = "ti,am335x-bone", "ti,am33xx";
+
+   cpus {
+   cpu@0 {
+   cpu0-supply = <&dcdc2_reg>;
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x1000>; /* 256 MB */
+   };
+
+   leds {
+   pinctrl-names = "default";
+   pinctrl-0 = <&user_leds_s0>;
+
+   compatible = "gpio-leds";
+
+   led@2 {
+   label = "beaglebone:green:heartbeat";
+   gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "heartbeat";
+   default-state = "off";
+   };
+
+   led@3 {
+   label = "beaglebone:green:mmc0";
+   gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "mmc0";
+   default-state = "off";
+   };
+
+   led@4 {
+   label = "beaglebone:green:usr2";
+   gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "cpu0";
+   default-state = "off";
+   };
+
+   led@5 {
+   label = "beaglebone:green:usr3";
+   gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
+   linux,default-trigger = "mmc1";
+   default-state = "off";
+   };
+   };
+
+   vmmcsd_fixed: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "vmmcsd_fixed";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+};
+
+&am33xx_pinmux {
+   pinctrl-names = "default";
+   pinctrl-0 = <&clkout2_pin>;
+
+   user_leds_s0: user_leds_s0 {
+   pinctrl-single,pins = <
+   0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* 
gpmc_a5.gpio1_21 */
+   0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7)/* 
gpmc_a6.gpio1_22 */
+   0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7)  /* 
gpmc_a7.gpio1_23 */
+   0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7)/* 
gpmc_a8.gpio1_24 */
+   >;
+   };
+
+   i2c0_pins: pinmux_i2c0_pins {
+   pinctrl-single,pins = <
+   0x188 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
i2c0_sda.i2c0_sda */
+   0x18c (PIN_INPUT_PULLUP | MUX_MODE0)/* 
i2c0_scl.i2c0_scl */
+   >;
+   };
+
+   uart0_pins: pinmux_uart0_pins {
+   pinctrl-single,pins = <
+   0x170 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
uart0_rxd.uart0_rxd */
+   0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
uart0_txd.uart0_txd */
+   >;
+   };
+
+   clkout2_pin: pinmux_clkout2_pin {
+   pinctrl-single,pins = <
+   0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* 
xdma_event_intr1.clkout2 */
+   >;
+   };
+
+   cpsw_default: cpsw_default {
+   pinctrl-single,pins = <
+   /* Slave 1 */
+   0x110 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
mii1_rxerr.mii1_rxerr */
+   0x114 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* 
mii1_txen.mii1_txen */
+   0x118 (PIN_INPUT_PULLUP | MUX_MODE0)/* 
mii1_rxdv.mii1_rxdv */

[PATCH 04/17] ARM: am335x phytec phyCORE: Switch to devicetree probe support

2013-11-26 Thread Sascha Hauer
This switches the am335x Phytec phyCORE to devicetree probe support.
For now we use a linked in dtb.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/pcm051/Makefile   |   2 +-
 arch/arm/boards/pcm051/board.c| 149 ++
 arch/arm/boards/pcm051/mux.c  |  65 ---
 arch/arm/boards/pcm051/mux.h  |   4 -
 arch/arm/configs/pcm051_defconfig |  26 --
 arch/arm/configs/pcm051_mlo_defconfig |   8 +-
 6 files changed, 32 insertions(+), 222 deletions(-)
 delete mode 100644 arch/arm/boards/pcm051/mux.c
 delete mode 100644 arch/arm/boards/pcm051/mux.h

diff --git a/arch/arm/boards/pcm051/Makefile b/arch/arm/boards/pcm051/Makefile
index 69d48e1..092c31d 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 mux.o
+obj-y += board.o
diff --git a/arch/arm/boards/pcm051/board.c b/arch/arm/boards/pcm051/board.c
index e7a7b79..4b76f4c 100644
--- a/arch/arm/boards/pcm051/board.c
+++ b/arch/arm/boards/pcm051/board.c
@@ -19,107 +19,17 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 
-#include "mux.h"
-
-/**
- * @brief UART serial port initialization
- * arch
- *
- * @return result of device registration
- */
-static int pcm051_console_init(void)
-{
-   barebox_set_model("Phytec phyCORE-AM335x");
-   barebox_set_hostname("phycore-am335x");
-
-   am33xx_enable_uart0_pin_mux();
-   /* 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);
-
-/*
-* SPI Flash works at 80Mhz however the SPI controller runs with 48MHz.
-* So setup Max speed to be less than the controller speed.
-*/
-static struct spi_board_info pcm051_spi_board_info[] = {
-   {
-   .name   = "m25p80",
-   .max_speed_hz   = 2400,
-   .bus_num= 0,
-   .chip_select= 0,
-   },
-};
-
-static struct cpsw_slave_data cpsw_slaves[] = {
-   {
-   .phy_id = 0,
-   .phy_if = PHY_INTERFACE_MODE_RMII,
-   },
-};
-
-static struct cpsw_platform_data cpsw_data = {
-   .slave_data = cpsw_slaves,
-   .num_slaves = ARRAY_SIZE(cpsw_slaves),
-};
-
-static struct i2c_board_info i2c0_devices[] = {
-   {
-   I2C_BOARD_INFO("24c32", 0x52),
-   },
-};
-
-static struct gpmc_config pcm051_nand_cfg = {
-   .cfg = {
-   0x0800, /* CONF1 */
-   0x00030300, /* CONF2 */
-   0x00030300, /* CONF3 */
-   0x02000311, /* CONF4 */
-   0x00030303, /* CONF5 */
-   0x03000540, /* CONF6 */
-   },
-   .base = 0x0800,
-   .size = GPMC_SIZE_16M,
-};
-
-static struct gpmc_nand_platform_data nand_plat = {
-   .wait_mon_pin = 1,
-   .ecc_mode = OMAP_ECC_BCH8_CODE_HW,
-   .nand_cfg = &pcm051_nand_cfg,
-};
-
 static struct omap_barebox_part pcm051_barebox_part = {
.nand_offset = SZ_512K,
.nand_size = SZ_512K,
@@ -127,59 +37,13 @@ static struct omap_barebox_part pcm051_barebox_part = {
.nor_size = SZ_512K,
 };
 
-static void pcm051_spi_init(void)
-{
-   int ret;
-
-   am33xx_enable_spi0_pin_mux();
-
-   ret = spi_register_board_info(pcm051_spi_board_info,
-   ARRAY_SIZE(pcm051_spi_board_info));
-   am33xx_add_spi0();
-}
-
-static void pcm051_eth_init(void)
-{
-   am33xx_register_ethaddr(0, 0);
-
-   writel(0x49, AM33XX_MAC_MII_SEL);
-
-   am33xx_enable_rmii1_pin_mux();
-
-   am33xx_add_cpsw(&cpsw_data);
-}
-
-static void pcm051_i2c_init(void)
-{
-   am33xx_enable_i2c0_pin_mux();
-
-   i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
-
-   am33xx_add_i2c0(NULL);
-}
-
-static void pcm051_nand_init(void)
-{
-   pcm051_enable_nand_pin_mux();
-
-   gpmc_generic_init(0x12);
-
-   omap_add_gpmc_nand_device(&nand_plat);
-}
-
 static int pcm051_devices_init(void)
 {
-   pcm051_enable_mmc0_pin_mux();
-
-   am33xx_add_mmc0(NULL);
+   if (!of_machine_is_compatible("phytec,phycore-am335x"))
+   return 0;
 
-   pcm051_spi_init();
-   pcm051_eth_init();
-   pcm051_i2c_init();
-   pcm051_nand_init();
-
-   pcm051_enable_user_led_pin_mux();
-   pcm051_enable_user_btn_pin_mux();
+   am33xx_register_ethaddr(0, 0);
+   writel(0x69, AM33XX_MAC_MII_SEL);
 
switch (bootsource_get()) {
case BOOTSOURCE_SPI:
@@ -190,6 +54,9 @@ static int pcm051_devices_init(void)
 

[PATCH] AM33xx devicetree support

2013-11-26 Thread Sascha Hauer
The following series based on the previous patches switch the am33xx based 
boards
(Phytec phyCORE and Beaglebone(black)) over to devicetree and multi image 
support.

I've tested this on both boards in both MLO and regular builds. They start, the
devices come up and things seem to work, but more testing would be welcomed.
Wait, I just realized that the network on Beaglebone black stopped working, I'll
have a look.

Sascha

The following changes since commit 9df02e05f5fff6dafab5c140ce92dc33c196e5f9:

  Merge branch 'for-next/x86' into next (2013-11-26 17:22:06 +0100)

are available in the git repository at:


  git://git.pengutronix.de/git/barebox.git work/am335x

for you to fetch changes up to 82f44858223a2e61cb825ea6f68b6d2f77975e6e:

  ARM: OMAP: consolidate am335x mlo defconfigs (2013-11-26 17:37:36 +0100)


Sascha Hauer (17):
  ARM: Make multi images startup process simpler
  ARM: Make ENTRY_FUNCTION more robust
  ARM: Add base am335x-phytec-phycore devicetree file
  ARM: am335x phytec phyCORE: Switch to devicetree probe support
  ARM: am33xx Phytec phyCORE: initialize debug UART
  ARM: am33xx Phytec phyCORE: Switch to multiimage support
  ARM: am33xx Phytec phyCORE: update defconfig
  ARM: dts: Add am33xx beaglebone(black) dts files
  ARM: am33xx: beaglebone: remove mlo_large_defconfig
  ARM: beaglebone: Add memory to devicetrees
  ARM: beaglebone: Switch to devicetree and multiimage
  ARM: am335x Phytec phyCORE: Move partition descriptions to devicetree
  ARM: OMAP: Safe boot info in fixed SRAM address
  ARM: am335x Phytec phyCORE: configure environment from devicetree
  ARM: beaglebone: configure console from devicetree
  ARM: OMAP: introduce multiboard support and move am33xx boards to it
  ARM: OMAP: consolidate am335x mlo defconfigs

 arch/arm/boards/beaglebone/beaglebone.h|   2 +
 arch/arm/boards/beaglebone/board.c | 121 +---
 arch/arm/boards/beaglebone/lowlevel.c  |  67 -
 arch/arm/boards/dfi-fs700-m60/lowlevel.c   |   8 +-
 arch/arm/boards/dmo-mx6-realq7/lowlevel.c  |   4 +-
 arch/arm/boards/ebv-socrates/lowlevel.c|   6 +-
 arch/arm/boards/efika-mx-smartbook/lowlevel.c  |   4 +-
 arch/arm/boards/freescale-mx51-pdk/lowlevel.c  |   4 +-
 arch/arm/boards/freescale-mx53-loco/lowlevel.c |   4 +-
 arch/arm/boards/freescale-mx53-vmx53/lowlevel.c|   4 +-
 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c |   4 +-
 arch/arm/boards/gk802/lowlevel.c   |   4 +-
 arch/arm/boards/pcm051/Makefile|   2 +-
 arch/arm/boards/pcm051/board.c | 166 +--
 arch/arm/boards/pcm051/env/init/mtdparts-nand  |  11 -
 arch/arm/boards/pcm051/env/init/mtdparts-nor   |  12 -
 arch/arm/boards/pcm051/lowlevel.c  |  44 ++-
 arch/arm/boards/pcm051/mux.c   |  65 -
 arch/arm/boards/pcm051/mux.h   |   4 -
 arch/arm/boards/phytec-pfla02/lowlevel.c   |   8 +-
 arch/arm/boards/solidrun-cubox/lowlevel.c  |   4 +-
 arch/arm/boards/terasic-sockit/lowlevel.c  |   8 +-
 arch/arm/boards/toradex-colibri-t20-iris/entry.c   |   4 +-
 arch/arm/boards/toshiba-ac100/entry.c  |   4 +-
 arch/arm/boards/tqma6x/lowlevel.c  |   8 +-
 arch/arm/configs/am335x_beaglebone_defconfig   |   8 +-
 .../configs/am335x_beaglebone_mlo_large_defconfig  |  55 
 .../configs/am335x_beaglebone_mlo_small_defconfig  |  29 --
 .../{pcm051_mlo_defconfig => am335x_mlo_defconfig} |  27 +-
 arch/arm/configs/pcm051_defconfig  |  34 ++-
 arch/arm/cpu/Makefile  |   2 +-
 arch/arm/cpu/start-images.c|  49 
 arch/arm/cpu/uncompress.c  |   9 +-
 arch/arm/dts/Makefile  |   6 +
 arch/arm/dts/am335x-bone-common.dtsi   | 300 
 arch/arm/dts/am335x-bone.dts   |  39 +++
 arch/arm/dts/am335x-boneblack.dts  |  88 ++
 arch/arm/dts/am335x-phytec-phycore.dts | 304 +
 arch/arm/dts/tps65217.dtsi |  56 
 arch/arm/include/asm/barebox-arm.h |  16 +-
 arch/arm/mach-omap/Kconfig |  34 ++-
 arch/arm/mach-omap/Makefile|   4 +-
 arch/arm/mach-omap/am33xx_generic.c|   3 +-
 arch/arm/mach-omap/include/mach/am33xx-generic.h   |   3 +-
 arch/arm/mach-omap/include/mach/am33xx-silicon.h   |   1 +
 arch/arm/mach-omap/include/mach/generic.h  |   2 -
 arch/arm/mach-omap/include/mach/omap3-generic.h|   2 +-
 arch/arm/mach-omap/include/mach/omap3-silicon.h|   1 +
 arch/arm/mach-omap/include/mach/omap4-generic.h|   2 +-
 arch/arm/mach-omap/include/mach/omap4-

[PATCH 02/17] ARM: Make ENTRY_FUNCTION more robust

2013-11-26 Thread Sascha Hauer
An entry function should begin with a exception header. For this to work
properly the entry function should not contain any code which gcc might
put before the header. To make this sure change the ENTRY_FUNCTION macro
so that it generates one function which only contains the exception header
and a second function which contains the original body of the entry function.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/dfi-fs700-m60/lowlevel.c   |  8 ++--
 arch/arm/boards/dmo-mx6-realq7/lowlevel.c  |  4 +---
 arch/arm/boards/ebv-socrates/lowlevel.c|  6 ++
 arch/arm/boards/efika-mx-smartbook/lowlevel.c  |  4 +---
 arch/arm/boards/freescale-mx51-pdk/lowlevel.c  |  4 +---
 arch/arm/boards/freescale-mx53-loco/lowlevel.c |  4 +---
 arch/arm/boards/freescale-mx53-vmx53/lowlevel.c|  4 +---
 arch/arm/boards/freescale-mx6-sabrelite/lowlevel.c |  4 +---
 arch/arm/boards/gk802/lowlevel.c   |  4 +---
 arch/arm/boards/phytec-pfla02/lowlevel.c   |  8 ++--
 arch/arm/boards/solidrun-cubox/lowlevel.c  |  4 +---
 arch/arm/boards/terasic-sockit/lowlevel.c  |  8 ++--
 arch/arm/boards/toradex-colibri-t20-iris/entry.c   |  4 +---
 arch/arm/boards/toshiba-ac100/entry.c  |  4 +---
 arch/arm/boards/tqma6x/lowlevel.c  |  8 ++--
 arch/arm/include/asm/barebox-arm.h | 16 +---
 16 files changed, 33 insertions(+), 61 deletions(-)

diff --git a/arch/arm/boards/dfi-fs700-m60/lowlevel.c 
b/arch/arm/boards/dfi-fs700-m60/lowlevel.c
index 725c58d..2995bd4 100644
--- a/arch/arm/boards/dfi-fs700-m60/lowlevel.c
+++ b/arch/arm/boards/dfi-fs700-m60/lowlevel.c
@@ -61,12 +61,10 @@ static inline void early_uart_init_6s(void)
 
 extern char __dtb_imx6q_dfi_fs700_m60_6q_start[];
 
-ENTRY_FUNCTION(start_imx6q_dfi_fs700_m60_6q)(void)
+ENTRY_FUNCTION(start_imx6q_dfi_fs700_m60_6q, r0, r1, r2)
 {
uint32_t fdt;
 
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
 
arm_setup_stack(0x0094 - 8);
@@ -80,13 +78,11 @@ ENTRY_FUNCTION(start_imx6q_dfi_fs700_m60_6q)(void)
 
 extern char __dtb_imx6dl_dfi_fs700_m60_6s_start[];
 
-ENTRY_FUNCTION(start_imx6dl_dfi_fs700_m60_6s)(void)
+ENTRY_FUNCTION(start_imx6dl_dfi_fs700_m60_6s, r0, r1, r2)
 {
uint32_t fdt;
int i;
 
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
 
arm_setup_stack(0x0092 - 8);
diff --git a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c 
b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
index 240116d..f47575e 100644
--- a/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
+++ b/arch/arm/boards/dmo-mx6-realq7/lowlevel.c
@@ -140,12 +140,10 @@ static void sdram_init(void)
 
 extern char __dtb_imx6q_dmo_realq7_start[];
 
-ENTRY_FUNCTION(start_imx6_realq7)(void)
+ENTRY_FUNCTION(start_imx6_realq7, r0, r1, r2)
 {
uint32_t fdt;
 
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
 
arm_setup_stack(0x0094 - 8);
diff --git a/arch/arm/boards/ebv-socrates/lowlevel.c 
b/arch/arm/boards/ebv-socrates/lowlevel.c
index d2f02e0..e93ae38 100644
--- a/arch/arm/boards/ebv-socrates/lowlevel.c
+++ b/arch/arm/boards/ebv-socrates/lowlevel.c
@@ -45,7 +45,7 @@ static inline void ledoff(void)
 
 extern char __dtb_socfpga_cyclone5_socrates_start[];
 
-ENTRY_FUNCTION(start_socfpga_socrates)(void)
+ENTRY_FUNCTION(start_socfpga_socrates, r0, r1, r2)
 {
uint32_t fdt;
 
@@ -87,10 +87,8 @@ static noinline void socrates_entry(void)
barebox_arm_entry(0x0, SZ_1G, 0);
 }
 
-ENTRY_FUNCTION(start_socfpga_socrates_xload)(void)
+ENTRY_FUNCTION(start_socfpga_socrates_xload, r0, r1, r2)
 {
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
 
arm_setup_stack(0x + SZ_64K - SZ_4K - 16);
diff --git a/arch/arm/boards/efika-mx-smartbook/lowlevel.c 
b/arch/arm/boards/efika-mx-smartbook/lowlevel.c
index 5a56861..72c8b00 100644
--- a/arch/arm/boards/efika-mx-smartbook/lowlevel.c
+++ b/arch/arm/boards/efika-mx-smartbook/lowlevel.c
@@ -6,12 +6,10 @@
 
 extern char __dtb_imx51_genesi_efika_sb_start[];
 
-ENTRY_FUNCTION(start_imx51_genesi_efikasb)(void)
+ENTRY_FUNCTION(start_imx51_genesi_efikasb, r0, r1, r2)
 {
uint32_t fdt;
 
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
arm_setup_stack(0x2000 - 16);
imx51_init_lowlevel(800);
diff --git a/arch/arm/boards/freescale-mx51-pdk/lowlevel.c 
b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
index 8c1acb4..f606011 100644
--- a/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
+++ b/arch/arm/boards/freescale-mx51-pdk/lowlevel.c
@@ -5,12 +5,10 @@
 
 extern char __dtb_imx51_babbage_start[];
 
-ENTRY_FUNCTION(start_imx51_babbage)(void)
+ENTRY_FUNCTION(start_imx51_babbage, r0, r1, r2)
 {
uint32_t fdt;
 
-   __barebox_arm_head();
-
arm_cpu_lowlevel_init();
 
fdt = (uint32_t)__dtb_imx51_babbage_start - get_runtime_offset();
diff --git a/arch/arm/boards/freescale-mx5

[PATCH 11/17] ARM: beaglebone: Switch to devicetree and multiimage

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/beaglebone/beaglebone.h  |   2 +
 arch/arm/boards/beaglebone/board.c   | 121 ++-
 arch/arm/boards/beaglebone/lowlevel.c|  67 ++---
 arch/arm/configs/am335x_beaglebone_defconfig |   7 +-
 arch/arm/configs/am335x_beaglebone_mlo_defconfig |  11 ++-
 arch/arm/dts/Makefile|   1 +
 arch/arm/mach-omap/Kconfig   |   1 +
 images/Makefile.am33xx   |   8 ++
 8 files changed, 86 insertions(+), 132 deletions(-)

diff --git a/arch/arm/boards/beaglebone/beaglebone.h 
b/arch/arm/boards/beaglebone/beaglebone.h
index 25c5b0e..a4f48e5 100644
--- a/arch/arm/boards/beaglebone/beaglebone.h
+++ b/arch/arm/boards/beaglebone/beaglebone.h
@@ -1,6 +1,8 @@
 #ifndef __BOARD_BEAGLEBONE_H
 #define __BOARD_BEAGLEBONE_H
 
+#include 
+
 static inline int is_beaglebone_black(void)
 {
return am33xx_get_cpu_rev() != AM335X_ES1_0;
diff --git a/arch/arm/boards/beaglebone/board.c 
b/arch/arm/boards/beaglebone/board.c
index dfeb47c..66e8438 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -22,142 +22,34 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include "beaglebone.h"
 
-#ifdef CONFIG_DRIVER_SERIAL_NS16550
-
-/**
- * @brief UART serial port initialization - remember to enable COM clocks in
- * arch
- *
- * @return result of device registration
- */
-static int beaglebone_console_init(void)
-{
-   barebox_set_model("Texas Instruments beaglebone");
-   barebox_set_hostname("beaglebone");
-
-   am33xx_add_uart0();
-
-   return 0;
-}
-console_initcall(beaglebone_console_init);
-#endif /* CONFIG_DRIVER_SERIAL_NS16550 */
-
-static int beaglebone_mem_init(void)
-{
-   if (is_beaglebone_black())
-   omap_add_ram0(SZ_512M);
-   else
-   omap_add_ram0(SZ_256M);
-
-   return 0;
-}
-mem_initcall(beaglebone_mem_init);
-
-static struct cpsw_slave_data cpsw_slaves[] = {
-   {
-   .phy_id = 0,
-   .phy_if = PHY_INTERFACE_MODE_MII,
-   },
-};
-
-static struct cpsw_platform_data cpsw_data = {
-   .slave_data = cpsw_slaves,
-   .num_slaves = ARRAY_SIZE(cpsw_slaves),
-};
-
-static void beaglebone_eth_init(void)
-{
-   am33xx_register_ethaddr(0, 0);
-
-   writel(0, AM33XX_MAC_MII_SEL);
-
-   am33xx_enable_mii1_pin_mux();
-
-   am33xx_add_cpsw(&cpsw_data);
-}
-
-static struct i2c_board_info i2c0_devices[] = {
-   {
-   I2C_BOARD_INFO("24c256", 0x50)
-   },
-};
-
-static const __maybe_unused struct module_pin_mux mmc1_pin_mux[] = {
-   {OFFSET(gpmc_ad0), (MODE(1) | RXACTIVE)},   /* MMC1_DAT0 */
-   {OFFSET(gpmc_ad1), (MODE(1) | RXACTIVE)},   /* MMC1_DAT1 */
-   {OFFSET(gpmc_ad2), (MODE(1) | RXACTIVE)},   /* MMC1_DAT2 */
-   {OFFSET(gpmc_ad3), (MODE(1) | RXACTIVE)},   /* MMC1_DAT3 */
-   {OFFSET(gpmc_ad4), (MODE(1) | RXACTIVE)},   /* MMC1_DAT4 */
-   {OFFSET(gpmc_ad5), (MODE(1) | RXACTIVE)},   /* MMC1_DAT5 */
-   {OFFSET(gpmc_ad6), (MODE(1) | RXACTIVE)},   /* MMC1_DAT6 */
-   {OFFSET(gpmc_ad7), (MODE(1) | RXACTIVE)},   /* MMC1_DAT7 */
-   {OFFSET(gpmc_csn1), (MODE(2) | RXACTIVE | PULLUP_EN)},  /* MMC1_CLK */
-   {OFFSET(gpmc_csn2), (MODE(2) | RXACTIVE | PULLUP_EN)},  /* MMC1_CMD */
-   {-1},
-};
-
-static struct omap_hsmmc_platform_data beaglebone_sd = {
-   .devname = "sd",
-};
-
-static struct omap_hsmmc_platform_data beaglebone_emmc = {
-   .devname = "emmc",
-};
-
 static int beaglebone_devices_init(void)
 {
-   am33xx_enable_mmc0_pin_mux();
-   am33xx_add_mmc0(&beaglebone_sd);
-
-   if (is_beaglebone_black()) {
-   configure_module_pin_mux(mmc1_pin_mux);
-   am33xx_add_mmc1(&beaglebone_emmc);
-   }
-
if (bootsource_get() == BOOTSOURCE_MMC) {
if (bootsource_get_instance() == 0)
-   omap_set_bootmmc_devname("sd");
+   omap_set_bootmmc_devname("mmc0");
else
-   omap_set_bootmmc_devname("emmc");
+   omap_set_bootmmc_devname("mmc1");
}
 
-   am33xx_enable_i2c0_pin_mux();
-   i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
-   am33xx_add_i2c0(NULL);
-
-   beaglebone_eth_init();
+   am33xx_register_ethaddr(0, 0);
 
return 0;
 }
@@ -165,7 +57,12 @@ device_initcall(beaglebone_devices_init);
 
 static int beaglebone_env_init(void)
 {
-   int black = is_beaglebone_black();
+   int 

[PATCH 17/17] ARM: OMAP: consolidate am335x mlo defconfigs

2013-11-26 Thread Sascha Hauer
The Beaglebone and the AM335x Phytec phyCORE can be compiled
together, so merge the configs into a am335x_mlo_defconfig.

Signed-off-by: Sascha Hauer 
---
 arch/arm/configs/am335x_beaglebone_mlo_defconfig | 33 --
 arch/arm/configs/am335x_mlo_defconfig| 44 
 arch/arm/configs/pcm051_mlo_defconfig| 37 
 3 files changed, 44 insertions(+), 70 deletions(-)
 delete mode 100644 arch/arm/configs/am335x_beaglebone_mlo_defconfig
 create mode 100644 arch/arm/configs/am335x_mlo_defconfig
 delete mode 100644 arch/arm/configs/pcm051_mlo_defconfig

diff --git a/arch/arm/configs/am335x_beaglebone_mlo_defconfig 
b/arch/arm/configs/am335x_beaglebone_mlo_defconfig
deleted file mode 100644
index 905cc6d..000
--- a/arch/arm/configs/am335x_beaglebone_mlo_defconfig
+++ /dev/null
@@ -1,33 +0,0 @@
-CONFIG_ARCH_OMAP=y
-# CONFIG_OMAP_GPMC is not set
-CONFIG_OMAP_BUILD_IFT=y
-CONFIG_OMAP_MULTI_BOARDS=y
-CONFIG_MACH_BEAGLEBONE=y
-CONFIG_THUMB2_BAREBOX=y
-# CONFIG_CMD_ARM_CPUINFO is not set
-# CONFIG_BANNER is not set
-# CONFIG_MEMINFO is not set
-CONFIG_ENVIRONMENT_VARIABLES=y
-CONFIG_MMU=y
-CONFIG_TEXT_BASE=0x0
-CONFIG_MALLOC_SIZE=0x0
-CONFIG_MALLOC_TLSF=y
-CONFIG_RELOCATABLE=y
-CONFIG_PROMPT="MLO>"
-CONFIG_SHELL_NONE=y
-# CONFIG_ERRNO_MESSAGES is not set
-# CONFIG_TIMESTAMP is not set
-# CONFIG_DEFAULT_ENVIRONMENT is not set
-CONFIG_OFDEVICE=y
-CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
-# CONFIG_SPI is not set
-CONFIG_MCI=y
-# CONFIG_MCI_WRITE is not set
-CONFIG_MCI_OMAP_HSMMC=y
-CONFIG_PINCTRL=y
-CONFIG_PINCTRL_SINGLE=y
-# CONFIG_FS_RAMFS is not set
-# CONFIG_FS_DEVFS is not set
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/am335x_mlo_defconfig 
b/arch/arm/configs/am335x_mlo_defconfig
new file mode 100644
index 000..19f78d0
--- /dev/null
+++ b/arch/arm/configs/am335x_mlo_defconfig
@@ -0,0 +1,44 @@
+CONFIG_ARCH_OMAP=y
+CONFIG_OMAP_BUILD_IFT=y
+CONFIG_OMAP_MULTI_BOARDS=y
+CONFIG_MACH_BEAGLEBONE=y
+CONFIG_MACH_PCM051=y
+CONFIG_THUMB2_BAREBOX=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+# CONFIG_MEMINFO is not set
+CONFIG_MMU=y
+CONFIG_TEXT_BASE=0x0
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_RELOCATABLE=y
+CONFIG_PROMPT="MLO>"
+CONFIG_SHELL_NONE=y
+# CONFIG_ERRNO_MESSAGES is not set
+# CONFIG_TIMESTAMP is not set
+CONFIG_CONSOLE_ACTIVATE_NONE=y
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_OFDEVICE=y
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+CONFIG_DRIVER_SPI_OMAP3=y
+CONFIG_MTD=y
+# CONFIG_MTD_WRITE is not set
+# CONFIG_MTD_OOB_DEVICE is not set
+CONFIG_MTD_M25P80=y
+CONFIG_NAND=y
+# CONFIG_NAND_ECC_SOFT is not set
+# CONFIG_NAND_ECC_HW_SYNDROME is not set
+# CONFIG_NAND_ECC_HW_NONE is not set
+# CONFIG_NAND_INFO is not set
+# CONFIG_NAND_BBT is not set
+CONFIG_NAND_OMAP_GPMC=y
+CONFIG_MCI=y
+# CONFIG_MCI_WRITE is not set
+CONFIG_MCI_OMAP_HSMMC=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_SINGLE=y
+CONFIG_BUS_OMAP_GPMC=y
+# CONFIG_FS_RAMFS is not set
+# CONFIG_FS_DEVFS is not set
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/pcm051_mlo_defconfig 
b/arch/arm/configs/pcm051_mlo_defconfig
deleted file mode 100644
index ae5764b..000
--- a/arch/arm/configs/pcm051_mlo_defconfig
+++ /dev/null
@@ -1,37 +0,0 @@
-CONFIG_ARCH_OMAP=y
-CONFIG_OMAP_BUILD_IFT=y
-CONFIG_OMAP_MULTI_BOARDS=y
-CONFIG_MACH_PCM051=y
-CONFIG_THUMB2_BAREBOX=y
-# CONFIG_CMD_ARM_CPUINFO is not set
-# CONFIG_MEMINFO is not set
-CONFIG_ENVIRONMENT_VARIABLES=y
-CONFIG_MMU=y
-CONFIG_TEXT_BASE=0x0
-CONFIG_MALLOC_SIZE=0x0
-CONFIG_MALLOC_TLSF=y
-CONFIG_RELOCATABLE=y
-CONFIG_PROMPT="MLO>"
-CONFIG_SHELL_NONE=y
-# CONFIG_ERRNO_MESSAGES is not set
-# CONFIG_TIMESTAMP is not set
-CONFIG_CONSOLE_SIMPLE=y
-# CONFIG_DEFAULT_ENVIRONMENT is not set
-CONFIG_OFDEVICE=y
-CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
-CONFIG_DRIVER_SPI_OMAP3=y
-CONFIG_MTD=y
-CONFIG_MTD_M25P80=y
-CONFIG_NAND=y
-CONFIG_NAND_OMAP_GPMC=y
-CONFIG_MCI=y
-CONFIG_MCI_STARTUP=y
-CONFIG_MCI_OMAP_HSMMC=y
-CONFIG_PINCTRL=y
-CONFIG_PINCTRL_SINGLE=y
-CONFIG_BUS_OMAP_GPMC=y
-# CONFIG_FS_RAMFS is not set
-# CONFIG_FS_DEVFS is not set
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_LFN=y
-- 
1.8.4.2


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


[PATCH 12/17] ARM: am335x Phytec phyCORE: Move partition descriptions to devicetree

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/pcm051/env/init/mtdparts-nand | 11 -
 arch/arm/boards/pcm051/env/init/mtdparts-nor  | 12 --
 arch/arm/dts/am335x-phytec-phycore.dts| 59 ++-
 3 files changed, 57 insertions(+), 25 deletions(-)
 delete mode 100644 arch/arm/boards/pcm051/env/init/mtdparts-nand
 delete mode 100644 arch/arm/boards/pcm051/env/init/mtdparts-nor

diff --git a/arch/arm/boards/pcm051/env/init/mtdparts-nand 
b/arch/arm/boards/pcm051/env/init/mtdparts-nand
deleted file mode 100644
index 12f0ffd..000
--- a/arch/arm/boards/pcm051/env/init/mtdparts-nand
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = menu ]; then
-   init-menu-add-entry "$0" "NAND partitions"
-   exit
-fi
-
-mtdparts="128k(nand0.xload),128k(nand0.xload_backup1),128k(nand0.xload_backup2),128k(nand0.xload_backup3),512k(nand0.barebox)ro,128k(nand0.bareboxenv),8M(nand0.kernel),-(nand0.root)"
-kernelname="omap2-nand.0"
-
-mtdparts-add -b -d nand0 -k ${kernelname} -p ${mtdparts}
diff --git a/arch/arm/boards/pcm051/env/init/mtdparts-nor 
b/arch/arm/boards/pcm051/env/init/mtdparts-nor
deleted file mode 100644
index 5c762ad..000
--- a/arch/arm/boards/pcm051/env/init/mtdparts-nor
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-if [ "$1" = menu ]; then
-   init-menu-add-entry "$0" "NOR partitions"
-   exit
-fi
-
-mtdparts="128k(m25p0.xload),512k(m25p0.barebox),128k(m25p0.bareboxenv),4M(m25p0.kernel),-(m25p0.root)"
-kernelname="spi_flash"
-
-mtdparts-add -d m25p0 -k ${kernelname} -p ${mtdparts}
-
diff --git a/arch/arm/dts/am335x-phytec-phycore.dts 
b/arch/arm/dts/am335x-phytec-phycore.dts
index 3888c67..8fbfae6 100644
--- a/arch/arm/dts/am335x-phytec-phycore.dts
+++ b/arch/arm/dts/am335x-phytec-phycore.dts
@@ -161,8 +161,23 @@
#size-cells = <1>;
 
partition@0 {
-   label = "barebox-environment";
-   reg = <0x8 0x8>;
+   label = "xload";
+   reg = <0x0 0x2>;
+   };
+
+   partition@1 {
+   label = "barebox";
+   reg = <0x2 0x8>;
+   };
+
+   partition@2 {
+   label = "bareboxenv";
+   reg = <0xa 0x2>;
+   };
+
+   partition@3 {
+   label = "kernel";
+   reg = <0xc 0x40>;
};
};
 };
@@ -229,5 +244,45 @@
#address-cells = <1>;
#size-cells = <1>;
elm_id = <&elm>;
+
+   partition@0 {
+   label = "xload";
+   reg = <0x0 0x2>;
+   };
+
+   partition@1 {
+   label = "xload_backup1";
+   reg = <0x2 0x2>;
+   };
+
+   partition@2 {
+   label = "xload_backup2";
+   reg = <0x4 0x2>;
+   };
+
+   partition@3 {
+   label = "xload_backup3";
+   reg = <0x6 0x2>;
+   };
+
+   partition@4 {
+   label = "barebox";
+   reg = <0x8 0x8>;
+   };
+
+   partition@5 {
+   label = "bareboxenv";
+   reg = <0x10 0x2>;
+   };
+
+   partition@6 {
+   label = "kernel";
+   reg = <0x12 0x80>;
+   };
+
+   partition@7 {
+   label = "root";
+   reg = <0x92 0x1f6e>;
+   };
};
 };
-- 
1.8.4.2


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


[PATCH 13/17] ARM: OMAP: Safe boot info in fixed SRAM address

2013-11-26 Thread Sascha Hauer
Storing the boot information in the image itself and passing a pointer
around between images is cumbersome and doesn't fit well with multiimage
support where the pointer we pass around is already occupied by the
devicetree.
Do the same as U-Boot does and store the boot information at the bottom
of the SRAM public stack.
To maintain the compatibility between new xloaders and older barebox
binaries we still pass the boot information to the next stage via pointer.

Signed-off-by: Sascha Hauer 
---
 arch/arm/mach-omap/Makefile  |  4 ++--
 arch/arm/mach-omap/am33xx_generic.c  |  3 ++-
 arch/arm/mach-omap/include/mach/am33xx-generic.h |  3 ++-
 arch/arm/mach-omap/include/mach/am33xx-silicon.h |  1 +
 arch/arm/mach-omap/include/mach/generic.h|  2 --
 arch/arm/mach-omap/include/mach/omap3-generic.h  |  2 +-
 arch/arm/mach-omap/include/mach/omap3-silicon.h  |  1 +
 arch/arm/mach-omap/include/mach/omap4-generic.h  |  2 +-
 arch/arm/mach-omap/include/mach/omap4-silicon.h  |  3 +--
 arch/arm/mach-omap/omap3_generic.c   |  3 ++-
 arch/arm/mach-omap/omap4_generic.c   |  3 ++-
 arch/arm/mach-omap/omap_bootinfo.S   | 25 
 arch/arm/mach-omap/omap_generic.c| 17 
 13 files changed, 28 insertions(+), 41 deletions(-)
 delete mode 100644 arch/arm/mach-omap/omap_bootinfo.S

diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index 0d5428d..81a771e 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 omap_devices.o omap_generic.o omap_fb.o 
omap_bootinfo.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o omap_bootinfo.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o omap_fb.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_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/am33xx_generic.c 
b/arch/arm/mach-omap/am33xx_generic.c
index 68dc933..c227918 100644
--- a/arch/arm/mach-omap/am33xx_generic.c
+++ b/arch/arm/mach-omap/am33xx_generic.c
@@ -124,8 +124,9 @@ static int am33xx_bootsource(void)
 {
enum bootsource src;
int instance = 0;
+   uint32_t *am33xx_bootinfo = (void *)AM33XX_SRAM_SCRATCH_SPACE;
 
-   switch (omap_bootinfo[2] & 0xFF) {
+   switch (am33xx_bootinfo[2] & 0xFF) {
case 0x05:
src = BOOTSOURCE_NAND;
break;
diff --git a/arch/arm/mach-omap/include/mach/am33xx-generic.h 
b/arch/arm/mach-omap/include/mach/am33xx-generic.h
index e74a666..8472d07 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-generic.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-generic.h
@@ -11,6 +11,7 @@ u32 am33xx_get_cpu_rev(void);
 static inline void am33xx_save_bootinfo(uint32_t *info)
 {
unsigned long i = (unsigned long)info;
+   uint32_t *scratch = (void *)AM33XX_SRAM_SCRATCH_SPACE;
 
if (i & 0x3)
return;
@@ -19,7 +20,7 @@ static inline void am33xx_save_bootinfo(uint32_t *info)
if (i > AM33XX_SRAM0_START + AM33XX_SRAM0_SIZE)
return;
 
-   omap_save_bootinfo(info);
+   memcpy(scratch, info, 3 * sizeof(uint32_t));
 }
 
 u32 am33xx_running_in_flash(void);
diff --git a/arch/arm/mach-omap/include/mach/am33xx-silicon.h 
b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
index 30b605a..16e665f 100644
--- a/arch/arm/mach-omap/include/mach/am33xx-silicon.h
+++ b/arch/arm/mach-omap/include/mach/am33xx-silicon.h
@@ -120,6 +120,7 @@
 /* OCMC */
 #define AM33XX_SRAM0_START 0x402f0400
 #define AM33XX_SRAM0_SIZE  (SZ_128K - SZ_1K)
+#define AM33XX_SRAM_SCRATCH_SPACE  0x4030b800 /* start of public 
stack */
 #define AM33XX_SRAM_GPMC_STACK_SIZE(0x40)
 
 /* DDR offsets */
diff --git a/arch/arm/mach-omap/include/mach/generic.h 
b/arch/arm/mach-omap/include/mach/generic.h
index f4e18f3..a2a48cc 100644
--- a/arch/arm/mach-omap/include/mach/generic.h
+++ b/arch/arm/mach-omap/include/mach/generic.h
@@ -73,8 +73,6 @@ static inline int omap_set_mmc_dev(const char *mmcdev)
 }
 #endif
 
-extern uint32_t omap_bootinfo[3];
-void omap_save_bootinfo(void *data);
 void __noreturn omap_start_barebox(void *barebox);
 
 void omap_set_bootmmc_devname(const char *devname);
diff --git a/arch/arm/mach-omap/include/mach/omap3-generic.h 
b/arch/arm/mach-omap/include/mach/omap3-generic.h
index 2210d87..5e29bac 100644
--- a/arch/arm/mach-omap/include/mach/omap3-generic.h
+++ b/arch/arm/mach-omap/include/mach/omap3-generic.h
@@ -16,7 +16,7 @@ static inline void omap3_save_bootinfo(uint32_t *info)
if (i > OMAP3_SRAM_BASE + SZ_64K)
return;
 
-   omap_save_bootinfo(info);
+   memcpy((void *)OMAP3_SRAM_SCRATCH_SPACE, info, 3 * sizeof(uint32_t

[PATCH 01/17] ARM: Make multi images startup process simpler

2013-11-26 Thread Sascha Hauer
The multi image startup process used to have three binaries involved:
- The lowlevel board code to initialize SDRAM
- the uncompressor
- the regular (compressed) barebox binary
Drop the uncompressor and put the uncompress code into the lowlevel
board code binary. This makes the startup process easier.

Signed-off-by: Sascha Hauer 
---
 arch/arm/cpu/Makefile   |  2 +-
 arch/arm/cpu/start-images.c | 49 -
 arch/arm/cpu/uncompress.c   |  9 +
 images/Makefile | 12 +++
 4 files changed, 9 insertions(+), 63 deletions(-)
 delete mode 100644 arch/arm/cpu/start-images.c

diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index aba201b..c29d030 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -23,7 +23,7 @@ obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
 
 pbl-y += setupc.o
 pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
-pbl-$(CONFIG_PBL_MULTI_IMAGES) += start-images.o uncompress.o
+pbl-$(CONFIG_PBL_MULTI_IMAGES) += uncompress.o
 
 obj-y += common.o cache.o
 pbl-y += common.o cache.o
diff --git a/arch/arm/cpu/start-images.c b/arch/arm/cpu/start-images.c
deleted file mode 100644
index d48d245..000
--- a/arch/arm/cpu/start-images.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * start-pbl.c
- *
- * Copyright (c) 2010-2012 Sascha Hauer , Pengutronix
- * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD 
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
-   uint32_t boarddata)
-{
-   unsigned long barebox_base;
-   void __noreturn (*barebox)(uint32_t, uint32_t, uint32_t);
-
-   barebox_base = ld_var(__image_end) - get_runtime_offset() + 4;
-
-   if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
-   barebox = (void *)(barebox_base + 1);
-   else
-   barebox = (void *)barebox_base;
-
-   barebox(membase, memsize, boarddata);
-}
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index b0819c7..6d3302a 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -43,7 +43,7 @@ static int __attribute__((__used__))
__attribute__((__section__(".image_end")))
__image_end_dummy = 0xdeadbeef;
 
-static void noinline uncompress(uint32_t membase,
+static void __noreturn noinline uncompress_start_payload(uint32_t membase,
uint32_t memsize, uint32_t boarddata)
 {
uint32_t offset;
@@ -99,12 +99,13 @@ static void noinline uncompress(uint32_t membase,
 }
 
 /*
- * Generic second stage pbl uncompressor entry
+ * For the multi images startup process board code jumps here. We will 
uncompress
+ * the attached barebox image and start it.
  */
-ENTRY_FUNCTION(start_uncompress)(uint32_t membase, uint32_t memsize,
+void __naked __noreturn barebox_arm_entry(uint32_t membase, uint32_t memsize,
uint32_t boarddata)
 {
arm_setup_stack(membase + memsize - 16);
 
-   uncompress(membase, memsize, boarddata);
+   uncompress_start_payload(membase, memsize, boarddata);
 }
diff --git a/images/Makefile b/images/Makefile
index ec033ab..b080a8c 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -69,10 +69,10 @@ $(obj)/%.pblb: $(obj)/%.pbl FORCE
 
 quiet_cmd_pblx ?= PBLX$@
   cmd_pblx ?= cat $(obj)/$(patsubst %.pblx,%.pblb,$(2)) > $@; \
- $(call size_append, $(obj)/barebox.x) >> $@; \
- cat $(obj)/barebox.x >> $@
+ $(call size_append, $(obj)/barebox.z) >> $@; \
+ cat $(obj)/barebox.z >> $@
 
-$(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.x FORCE
+$(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.z FORCE
$(call if_changed,pblx,$(@F))
 
 $(obj)/%.s: $(obj)/% FORCE
@@ -93,12 +93,6 @@ quiet_cmd_selfextract = COMP$@
$(call size_append, $<) >> $@; \
cat $< >> $@
 
-pblx-y += start_uncompress
-# barebox.x - self extracting barebox binary
-# 
-$(obj)/barebox.x: $(obj)/barebox.z $(obj)/start_uncompress.pblb FORCE
-   $(call if_changed,selfextract)
-
 # %.img - crea

[PATCH 15/17] ARM: beaglebone: configure console from devicetree

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/configs/am335x_beaglebone_defconfig | 2 +-
 arch/arm/dts/am335x-bone-common.dtsi | 4 
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/arm/configs/am335x_beaglebone_defconfig 
b/arch/arm/configs/am335x_beaglebone_defconfig
index c80adc9..38e19ef 100644
--- a/arch/arm/configs/am335x_beaglebone_defconfig
+++ b/arch/arm/configs/am335x_beaglebone_defconfig
@@ -1,5 +1,4 @@
 CONFIG_ARCH_OMAP=y
-CONFIG_OMAP_MULTI_BOARDS=y
 CONFIG_MACH_BEAGLEBONE=y
 CONFIG_THUMB2_BAREBOX=y
 CONFIG_CMD_ARM_MMUINFO=y
@@ -17,6 +16,7 @@ CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_MENU=y
 # CONFIG_TIMESTAMP is not set
+CONFIG_CONSOLE_ACTIVATE_NONE=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
 CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/beaglebone/env"
 CONFIG_CMD_EDIT=y
diff --git a/arch/arm/dts/am335x-bone-common.dtsi 
b/arch/arm/dts/am335x-bone-common.dtsi
index 1ecf0b3..00271c4 100644
--- a/arch/arm/dts/am335x-bone-common.dtsi
+++ b/arch/arm/dts/am335x-bone-common.dtsi
@@ -7,6 +7,10 @@
  */
 
 / {
+   chosen {
+   linux,stdout-path = &uart0;
+   };
+
cpus {
cpu@0 {
cpu0-supply = <&dcdc2_reg>;
-- 
1.8.4.2


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


[PATCH 09/17] ARM: am33xx: beaglebone: remove mlo_large_defconfig

2013-11-26 Thread Sascha Hauer
As with devicetree support the binary will get too large for the
SRAM drop the configuration. It was mainly meant for debugging purposes
anyway.

Signed-off-by: Sascha Hauer 
---
 arch/arm/configs/am335x_beaglebone_mlo_defconfig   | 29 
 .../configs/am335x_beaglebone_mlo_large_defconfig  | 55 --
 .../configs/am335x_beaglebone_mlo_small_defconfig  | 29 
 3 files changed, 29 insertions(+), 84 deletions(-)
 create mode 100644 arch/arm/configs/am335x_beaglebone_mlo_defconfig
 delete mode 100644 arch/arm/configs/am335x_beaglebone_mlo_large_defconfig
 delete mode 100644 arch/arm/configs/am335x_beaglebone_mlo_small_defconfig

diff --git a/arch/arm/configs/am335x_beaglebone_mlo_defconfig 
b/arch/arm/configs/am335x_beaglebone_mlo_defconfig
new file mode 100644
index 000..ea29c24
--- /dev/null
+++ b/arch/arm/configs/am335x_beaglebone_mlo_defconfig
@@ -0,0 +1,29 @@
+CONFIG_ARCH_OMAP=y
+CONFIG_ARCH_AM33XX=y
+# CONFIG_OMAP_GPMC is not set
+CONFIG_OMAP_BUILD_IFT=y
+CONFIG_THUMB2_BAREBOX=y
+# CONFIG_CMD_ARM_CPUINFO is not set
+# CONFIG_BANNER is not set
+# CONFIG_MEMINFO is not set
+CONFIG_ENVIRONMENT_VARIABLES=y
+CONFIG_MMU=y
+CONFIG_TEXT_BASE=0x402F0400
+CONFIG_STACK_SIZE=0x1600
+CONFIG_MALLOC_SIZE=0x100
+CONFIG_MALLOC_TLSF=y
+CONFIG_PROMPT="MLO>"
+CONFIG_SHELL_NONE=y
+# CONFIG_ERRNO_MESSAGES is not set
+# CONFIG_TIMESTAMP is not set
+# CONFIG_DEFAULT_ENVIRONMENT is not set
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+# CONFIG_SPI is not set
+CONFIG_MCI=y
+# CONFIG_MCI_WRITE is not set
+CONFIG_MCI_OMAP_HSMMC=y
+# CONFIG_FS_RAMFS is not set
+# CONFIG_FS_DEVFS is not set
+CONFIG_FS_FAT=y
+CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/am335x_beaglebone_mlo_large_defconfig 
b/arch/arm/configs/am335x_beaglebone_mlo_large_defconfig
deleted file mode 100644
index d90f581..000
--- a/arch/arm/configs/am335x_beaglebone_mlo_large_defconfig
+++ /dev/null
@@ -1,55 +0,0 @@
-CONFIG_ARCH_OMAP=y
-CONFIG_ARCH_AM33XX=y
-# CONFIG_OMAP_GPMC is not set
-CONFIG_OMAP_BUILD_IFT=y
-CONFIG_THUMB2_BAREBOX=y
-# CONFIG_CMD_ARM_CPUINFO is not set
-CONFIG_MMU=y
-CONFIG_TEXT_BASE=0x402F0400
-CONFIG_MEMORY_LAYOUT_FIXED=y
-CONFIG_STACK_BASE=0x4030B800
-CONFIG_STACK_SIZE=0x1600
-CONFIG_MALLOC_BASE=0x8F00
-CONFIG_MALLOC_SIZE=0x100
-CONFIG_PROMPT="barebox> "
-CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-# CONFIG_TIMESTAMP is not set
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/beaglebone/env"
-CONFIG_BAREBOXENV_TARGET=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_READLINE=y
-# CONFIG_CMD_UMOUNT is not set
-# CONFIG_CMD_CLEAR is not set
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_IOMEM=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_BOOTM_SHOW_TYPE=y
-CONFIG_CMD_BOOTM_VERBOSE=y
-CONFIG_CMD_BOOTM_INITRD=y
-CONFIG_CMD_BOOTM_OFTREE=y
-CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
-# CONFIG_CMD_BOOTU is not set
-CONFIG_CMD_RESET=y
-CONFIG_CMD_GO=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_TIMEOUT=y
-# CONFIG_CMD_VERSION is not set
-CONFIG_CMD_MAGICVAR=y
-CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
-# CONFIG_SPI is not set
-CONFIG_MCI=y
-CONFIG_MCI_STARTUP=y
-# CONFIG_MCI_INFO is not set
-# CONFIG_MCI_WRITE is not set
-CONFIG_MCI_OMAP_HSMMC=y
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_LFN=y
diff --git a/arch/arm/configs/am335x_beaglebone_mlo_small_defconfig 
b/arch/arm/configs/am335x_beaglebone_mlo_small_defconfig
deleted file mode 100644
index ea29c24..000
--- a/arch/arm/configs/am335x_beaglebone_mlo_small_defconfig
+++ /dev/null
@@ -1,29 +0,0 @@
-CONFIG_ARCH_OMAP=y
-CONFIG_ARCH_AM33XX=y
-# CONFIG_OMAP_GPMC is not set
-CONFIG_OMAP_BUILD_IFT=y
-CONFIG_THUMB2_BAREBOX=y
-# CONFIG_CMD_ARM_CPUINFO is not set
-# CONFIG_BANNER is not set
-# CONFIG_MEMINFO is not set
-CONFIG_ENVIRONMENT_VARIABLES=y
-CONFIG_MMU=y
-CONFIG_TEXT_BASE=0x402F0400
-CONFIG_STACK_SIZE=0x1600
-CONFIG_MALLOC_SIZE=0x100
-CONFIG_MALLOC_TLSF=y
-CONFIG_PROMPT="MLO>"
-CONFIG_SHELL_NONE=y
-# CONFIG_ERRNO_MESSAGES is not set
-# CONFIG_TIMESTAMP is not set
-# CONFIG_DEFAULT_ENVIRONMENT is not set
-CONFIG_DRIVER_SERIAL_NS16550=y
-CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
-# CONFIG_SPI is not set
-CONFIG_MCI=y
-# CONFIG_MCI_WRITE is not set
-CONFIG_MCI_OMAP_HSMMC=y
-# CONFIG_FS_RAMFS is not set
-# CONFIG_FS_DEVFS is not set
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_LFN=y
-- 
1.8.4.2


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


[PATCH 05/17] ARM: am33xx Phytec phyCORE: initialize debug UART

2013-11-26 Thread Sascha Hauer
Add debug UART initialization to lowlevel init and print a '>'. Helps
debugging lowlevel code.

Signed-off-by: Sascha Hauer 
---
 arch/arm/boards/pcm051/lowlevel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/boards/pcm051/lowlevel.c 
b/arch/arm/boards/pcm051/lowlevel.c
index ded108e..08f36ec 100644
--- a/arch/arm/boards/pcm051/lowlevel.c
+++ b/arch/arm/boards/pcm051/lowlevel.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static const struct am33xx_cmd_control MT41J256M8HX15E_2x256M8_cmd = {
.slave_ratio0 = 0x40,
@@ -76,6 +77,8 @@ static int pcm051_board_init(void)
 
am33xx_uart0_soft_reset();
am33xx_enable_uart0_pin_mux();
+   omap_uart_lowlevel_init((void *)AM33XX_UART0_BASE);
+   putc_ll('>');
 
return 0;
 }
-- 
1.8.4.2


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


[PATCH 10/17] ARM: beaglebone: Add memory to devicetrees

2013-11-26 Thread Sascha Hauer
barebox needs it to initialize the memory. While at it, give the
beabglebone black another name than the original beaglebone has.

Signed-off-by: Sascha Hauer 
---
 arch/arm/dts/am335x-bone-common.dtsi |  3 ---
 arch/arm/dts/am335x-bone.dts | 10 ++
 arch/arm/dts/am335x-boneblack.dts| 10 ++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/am335x-bone-common.dtsi 
b/arch/arm/dts/am335x-bone-common.dtsi
index e3f27ec..1ecf0b3 100644
--- a/arch/arm/dts/am335x-bone-common.dtsi
+++ b/arch/arm/dts/am335x-bone-common.dtsi
@@ -7,9 +7,6 @@
  */
 
 / {
-   model = "TI AM335x BeagleBone";
-   compatible = "ti,am335x-bone", "ti,am33xx";
-
cpus {
cpu@0 {
cpu0-supply = <&dcdc2_reg>;
diff --git a/arch/arm/dts/am335x-bone.dts b/arch/arm/dts/am335x-bone.dts
index 94ee427..a2e62a3 100644
--- a/arch/arm/dts/am335x-bone.dts
+++ b/arch/arm/dts/am335x-bone.dts
@@ -10,6 +10,16 @@
 #include "am33xx.dtsi"
 #include "am335x-bone-common.dtsi"
 
+/ {
+   model = "TI AM335x BeagleBone";
+   compatible = "ti,am335x-bone", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x1000>; /* 256 MB */
+   };
+};
+
 &ldo3_reg {
regulator-min-microvolt = <180>;
regulator-max-microvolt = <330>;
diff --git a/arch/arm/dts/am335x-boneblack.dts 
b/arch/arm/dts/am335x-boneblack.dts
index 6b71ad9..f79a6bc 100644
--- a/arch/arm/dts/am335x-boneblack.dts
+++ b/arch/arm/dts/am335x-boneblack.dts
@@ -10,6 +10,16 @@
 #include "am33xx.dtsi"
 #include "am335x-bone-common.dtsi"
 
+/ {
+   model = "TI AM335x BeagleBone black";
+   compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
+
+   memory {
+   device_type = "memory";
+   reg = <0x8000 0x2000>; /* 512 MB */
+   };
+};
+
 &ldo3_reg {
regulator-min-microvolt = <180>;
regulator-max-microvolt = <180>;
-- 
1.8.4.2


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


[PATCH 07/17] ARM: am33xx Phytec phyCORE: update defconfig

2013-11-26 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 arch/arm/configs/pcm051_defconfig | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/configs/pcm051_defconfig 
b/arch/arm/configs/pcm051_defconfig
index 482329a..949c82f 100644
--- a/arch/arm/configs/pcm051_defconfig
+++ b/arch/arm/configs/pcm051_defconfig
@@ -19,6 +19,7 @@ CONFIG_CMDLINE_EDITING=y
 CONFIG_AUTO_COMPLETE=y
 CONFIG_MENU=y
 # CONFIG_TIMESTAMP is not set
+CONFIG_BLSPEC=y
 CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
 CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/pcm051/env"
 CONFIG_DEBUG_INFO=y
@@ -34,6 +35,8 @@ CONFIG_CMD_TIME=y
 CONFIG_CMD_TFTP=y
 CONFIG_CMD_ECHO_E=y
 CONFIG_CMD_LOADB=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_IOMEM=y
 CONFIG_CMD_CRC=y
 CONFIG_CMD_CRC_CMP=y
 CONFIG_CMD_MD5SUM=y
@@ -52,6 +55,10 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_UNCOMPRESS=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_SPI=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_LED_TRIGGER=y
+CONFIG_CMD_MIITOOL=y
+CONFIG_CMD_DETECT=y
 CONFIG_NET=y
 CONFIG_NET_DHCP=y
 CONFIG_NET_NFS=y
@@ -73,6 +80,10 @@ CONFIG_USB=y
 CONFIG_MCI=y
 CONFIG_MCI_STARTUP=y
 CONFIG_MCI_OMAP_HSMMC=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_LED_TRIGGERS=y
 CONFIG_EEPROM_AT24=y
 CONFIG_GPIO_GENERIC_PLATFORM=y
 CONFIG_PINCTRL=y
-- 
1.8.4.2


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


[PATCH] ARM: start: fix fdt inside valid memory check

2013-11-26 Thread Sascha Hauer
We want to check whether boarddata contains a valid dtb if it's inside
valid memory. This includes the base of SDRAM, so use '>=' instead of '>'.

Signed-off-by: Sascha Hauer 
---
 arch/arm/cpu/start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c
index f0a7df3..21c63c0 100644
--- a/arch/arm/cpu/start.c
+++ b/arch/arm/cpu/start.c
@@ -82,7 +82,7 @@ static noinline __noreturn void __start(uint32_t membase, 
uint32_t memsize,
 * If boarddata is a pointer inside valid memory and contains a
 * FDT magic then use it as later to probe devices
 */
-   if (boarddata > membase && boarddata < membase + memsize &&
+   if (boarddata >= membase && boarddata < membase + memsize &&
get_unaligned_be32((void *)boarddata) == FDT_MAGIC) {
uint32_t totalsize = get_unaligned_be32((void *)boarddata + 4);
endmem -= ALIGN(totalsize, 64);
-- 
1.8.4.2


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


[PATCH 1/2] common Kconfig: Add missing depends on

2013-11-26 Thread Sascha Hauer
CONFIG_MAXARGS is only used with the simple console support, so add
a 'depends on'. While at it, move it below the shell selection.

Signed-off-by: Sascha Hauer 
---
 common/Kconfig | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index ccfbc80..f47602e 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -292,11 +292,6 @@ config CBSIZE
prompt "Buffer size for input from the Console"
default 1024
 
-config MAXARGS
-   int
-   prompt "max. Number of arguments accepted for monitor commands"
-   default 16
-
 choice
prompt "Select your shell"
 
@@ -328,6 +323,12 @@ choice
  at the end of the barebox startup process.
 endchoice
 
+config MAXARGS
+   int
+   depends on SHELL_SIMPLE
+   prompt "max. Number of arguments accepted for monitor commands"
+   default 16
+
 config GLOB
bool
prompt "hush globbing support"
-- 
1.8.4.2


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


[PATCH 2/2] common Kconfig: disable unused options for SHELL_NONE

2013-11-26 Thread Sascha Hauer
Let commandline editing and long help depend on !SHELL_NONE.

Signed-off-by: Sascha Hauer 
---
 common/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/Kconfig b/common/Kconfig
index f47602e..623372b 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -285,6 +285,7 @@ config SIMPLE_READLINE
 
 config LONGHELP
bool
+   depends on !SHELL_NONE
prompt "Enable long help texts"
 
 config CBSIZE
@@ -365,6 +366,7 @@ config HUSH_GETOPT
  This enables a getopt function builtin to hush.
 
 config CMDLINE_EDITING
+   depends on !SHELL_NONE
bool
prompt "Enable command line editing"
 
-- 
1.8.4.2


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


[PATCH 2/3] device: Add functions to add resources

2013-11-26 Thread Sascha Hauer
We currently have functions to add a device based on function parameters.
This adds the corresponding functions to add resources to a device without
registering the device itself. This is useful to manipulate devices before
registering them.

Signed-off-by: Sascha Hauer 
---
 drivers/base/resource.c | 60 ++---
 include/driver.h|  9 
 2 files changed, 56 insertions(+), 13 deletions(-)

diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 2985c78..71ae0fe 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -20,33 +20,67 @@
 #include 
 #include 
 #include 
+#include 
 
-static struct device_d *alloc_device(const char* devname, int id, void *pdata)
+struct device_d *device_alloc(const char *devname, int id)
 {
struct device_d *dev;
 
dev = xzalloc(sizeof(*dev));
strcpy(dev->name, devname);
dev->id = id;
-   dev->platform_data = pdata;
 
return dev;
 }
 
+int device_add_data(struct device_d *dev, void *data, size_t size)
+{
+   free(dev->platform_data);
+
+   if (data)
+   dev->platform_data = xmemdup(data, size);
+   else
+   dev->platform_data = NULL;
+
+   return 0;
+}
+
+int device_add_resources(struct device_d *dev, const struct resource *res, int 
num)
+{
+   dev->resource = xmemdup(res, sizeof(*res) * num);
+   dev->num_resources = num;
+
+   return 0;
+}
+
+int device_add_resource(struct device_d *dev, const char *resname,
+   resource_size_t start, resource_size_t size, unsigned int flags)
+{
+   struct resource res = {
+   .start = start,
+   .end = start + size - 1,
+   .flags = flags,
+   };
+
+   if (resname)
+   res.name = xstrdup(resname);
+
+   return device_add_resources(dev, &res, 1);
+}
+
 struct device_d *add_generic_device(const char* devname, int id, const char 
*resname,
resource_size_t start, resource_size_t size, unsigned int flags,
void *pdata)
 {
-   struct resource *res;
+   struct device_d *dev;
 
-   res = xzalloc(sizeof(struct resource));
-   if (resname)
-   res[0].name = xstrdup(resname);
-   res[0].start = start;
-   res[0].end = start + size - 1;
-   res[0].flags = flags;
+   dev = device_alloc(devname, id);
+   dev->platform_data = pdata;
+   device_add_resource(dev, resname, start, size, flags);
+
+   platform_device_register(dev);
 
-   return add_generic_device_res(devname, id, res, 1, pdata);
+   return dev;
 }
 EXPORT_SYMBOL(add_generic_device);
 
@@ -55,9 +89,9 @@ struct device_d *add_generic_device_res(const char* devname, 
int id,
 {
struct device_d *dev;
 
-   dev = alloc_device(devname, id, pdata);
-   dev->resource = res;
-   dev->num_resources = nb;
+   dev = device_alloc(devname, id);
+   dev->platform_data = pdata;
+   device_add_resources(dev, res, nb);
 
platform_device_register(dev);
 
diff --git a/include/driver.h b/include/driver.h
index 7f0532e..bbe789b 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -229,6 +229,15 @@ void *dev_get_mem_region(struct device_d *dev, int num);
  */
 void __iomem *dev_request_mem_region(struct device_d *dev, int num);
 
+struct device_d *device_alloc(const char *devname, int id);
+
+int device_add_resources(struct device_d *dev, const struct resource *res, int 
num);
+
+int device_add_resource(struct device_d *dev, const char *resname,
+   resource_size_t start, resource_size_t size, unsigned int 
flags);
+
+int device_add_data(struct device_d *dev, void *data, size_t size);
+
 /*
  * register a generic device
  * with only one resource
-- 
1.8.4.2


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


[PATCH 1/3] string: Add (x)memdup

2013-11-26 Thread Sascha Hauer
It's a common task to duplicate some memory. Add (x)memdup functions.

Signed-off-by: Sascha Hauer 
---
 include/string.h |  2 ++
 include/xfuncs.h |  1 +
 lib/string.c | 14 ++
 lib/xfuncs.c | 10 ++
 4 files changed, 27 insertions(+)

diff --git a/include/string.h b/include/string.h
index b906e15..a833da1 100644
--- a/include/string.h
+++ b/include/string.h
@@ -3,4 +3,6 @@
 
 #include 
 
+void *memdup(const void *, size_t);
+
 #endif /* __STRING_H */
diff --git a/include/xfuncs.h b/include/xfuncs.h
index 261aaa5..8efc99d 100644
--- a/include/xfuncs.h
+++ b/include/xfuncs.h
@@ -8,5 +8,6 @@ void *xrealloc(void *ptr, size_t size);
 void *xzalloc(size_t size);
 char *xstrdup(const char *s);
 void* xmemalign(size_t alignment, size_t bytes);
+void* xmemdup(const void *orig, size_t size);
 
 #endif /* __XFUNCS_H */
diff --git a/lib/string.c b/lib/string.c
index eeec137..ceced7f 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -725,3 +725,17 @@ void *memchr_inv(const void *start, int c, size_t bytes)
return check_bytes8(start, value, bytes % 8);
 }
 EXPORT_SYMBOL(memchr_inv);
+
+void *memdup(const void *orig, size_t size)
+{
+   void *buf;
+
+   buf = malloc(size);
+   if (!buf)
+   return NULL;
+
+   memcpy(buf, orig, size);
+
+   return buf;
+}
+EXPORT_SYMBOL(memdup);
diff --git a/lib/xfuncs.c b/lib/xfuncs.c
index db85720..86d0013 100644
--- a/lib/xfuncs.c
+++ b/lib/xfuncs.c
@@ -75,3 +75,13 @@ void* xmemalign(size_t alignment, size_t bytes)
return p;
 }
 EXPORT_SYMBOL(xmemalign);
+
+void *xmemdup(const void *orig, size_t size)
+{
+   void *buf = xmalloc(size);
+
+   memcpy(buf, orig, size);
+
+   return buf;
+}
+EXPORT_SYMBOL(xmemdup);
-- 
1.8.4.2


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


[PATCH v2] OMAP gpmc bus driver support

2013-11-26 Thread Sascha Hauer
This adds OMAP gpmc bus driver support. Unlike the last version
this one sets the device_node of the registered nand device correctly
so that the partitions can be populated from the devicetree.

Sascha


Sascha Hauer (3):
  string: Add (x)memdup
  device: Add functions to add resources
  bus: Add omap gpmc driver

 arch/arm/mach-omap/include/mach/gpmc_nand.h |   3 +
 drivers/base/resource.c |  60 +++-
 drivers/bus/Kconfig |   6 +
 drivers/bus/Makefile|   1 +
 drivers/bus/omap-gpmc.c | 480 
 include/driver.h|   9 +
 include/string.h|   2 +
 include/xfuncs.h|   1 +
 lib/string.c|  14 +
 lib/xfuncs.c|  10 +
 10 files changed, 573 insertions(+), 13 deletions(-)
 create mode 100644 drivers/bus/omap-gpmc.c

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


[PATCH 3/3] bus: Add omap gpmc driver

2013-11-26 Thread Sascha Hauer
This adds a devicetree-only driver for to configure the gpmc and its
child devices from dt. Currently only NAND is supported.

Signed-off-by: Sascha Hauer 
---
 arch/arm/mach-omap/include/mach/gpmc_nand.h |   3 +
 drivers/bus/Kconfig |   6 +
 drivers/bus/Makefile|   1 +
 drivers/bus/omap-gpmc.c | 480 
 4 files changed, 490 insertions(+)
 create mode 100644 drivers/bus/omap-gpmc.c

diff --git a/arch/arm/mach-omap/include/mach/gpmc_nand.h 
b/arch/arm/mach-omap/include/mach/gpmc_nand.h
index 8d138ec..8839486 100644
--- a/arch/arm/mach-omap/include/mach/gpmc_nand.h
+++ b/arch/arm/mach-omap/include/mach/gpmc_nand.h
@@ -59,6 +59,9 @@ struct gpmc_nand_platform_data {
struct nand_ecclayout *oob;
/** gpmc config for nand */
struct gpmc_config *nand_cfg;
+
+   struct device_node *of_node;
+   struct device_node *elm_of_node;
 };
 
 int omap_add_gpmc_nand_device(struct gpmc_nand_platform_data *pdata);
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 5938d3f..b0d3c1f 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -4,4 +4,10 @@ config IMX_WEIM
depends on ARCH_IMX
bool "i.MX WEIM driver"
 
+config BUS_OMAP_GPMC
+   depends on ARCH_OMAP
+   depends on OFDEVICE
+   depends on OMAP_GPMC
+   bool "TI OMAP/AM33xx GPMC support"
+
 endmenu
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 42a8d49..f1c5ac7 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -1 +1,2 @@
 obj-$(CONFIG_IMX_WEIM) += imx-weim.o
+obj-$(CONFIG_BUS_OMAP_GPMC) += omap-gpmc.o
diff --git a/drivers/bus/omap-gpmc.c b/drivers/bus/omap-gpmc.c
new file mode 100644
index 000..6424785
--- /dev/null
+++ b/drivers/bus/omap-gpmc.c
@@ -0,0 +1,480 @@
+/*
+ * OMAP GPMC driver. Based upon the corresponding Linux Code
+ *
+ * Copyright (C) 2013 Sascha Hauer, Pengutronix, 
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define GPMC_CS_NUM8
+#define GPMC_NR_WAITPINS   4
+
+#define GPMC_CONFIG1_WRAPBURST_SUPP(1 << 31)
+#define GPMC_CONFIG1_READMULTIPLE_SUPP (1 << 30)
+#define GPMC_CONFIG1_READTYPE_ASYNC(0 << 29)
+#define GPMC_CONFIG1_READTYPE_SYNC (1 << 29)
+#define GPMC_CONFIG1_WRITEMULTIPLE_SUPP(1 << 28)
+#define GPMC_CONFIG1_WRITETYPE_ASYNC   (0 << 27)
+#define GPMC_CONFIG1_WRITETYPE_SYNC(1 << 27)
+#define GPMC_CONFIG1_CLKACTIVATIONTIME(val)((val & 3) << 25)
+#define GPMC_CONFIG1_PAGE_LEN(val) ((val & 3) << 23)
+#define GPMC_CONFIG1_WAIT_READ_MON (1 << 22)
+#define GPMC_CONFIG1_WAIT_WRITE_MON(1 << 21)
+#define GPMC_CONFIG1_WAIT_MON_IIME(val)((val & 3) << 18)
+#define GPMC_CONFIG1_WAIT_PIN_SEL(val) ((val & 3) << 16)
+#define GPMC_CONFIG1_DEVICESIZE(val)   ((val & 3) << 12)
+#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
+#define GPMC_CONFIG1_DEVICETYPE(val)   ((val & 3) << 10)
+#define GPMC_CONFIG1_DEVICETYPE_NORGPMC_CONFIG1_DEVICETYPE(0)
+#define GPMC_CONFIG1_MUXTYPE(val)  ((val & 3) << 8)
+#define GPMC_CONFIG1_TIME_PARA_GRAN(1 << 4)
+#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
+#define GPMC_CONFIG1_FCLK_DIV2 (GPMC_CONFIG1_FCLK_DIV(1))
+#define GPMC_CONFIG1_FCLK_DIV3 (GPMC_CONFIG1_FCLK_DIV(2))
+#define GPMC_CONFIG1_FCLK_DIV4 (GPMC_CONFIG1_FCLK_DIV(3))
+#defineGPMC_CONFIG2_CSEXTRADELAY   (1 << 7)
+#defineGPMC_CONFIG3_ADVEXTRADELAY  (1 << 7)
+#defineGPMC_CONFIG4_OEEXTRADELAY   (1 << 7)
+#defineGPMC_CONFIG4_WEEXTRADELAY   (1 << 23)
+#defineGPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN(1 << 6)
+#defineGPMC_CONFIG6_CYCLE2CYCLESAMECSEN(1 << 7)
+#define GPMC_CONFIG7_CSVALID   (1 << 6)
+
+static unsigned int gpmc_cs_num = GPMC_CS_NUM;
+static unsigned int gpmc_nr_waitpins;
+static unsigned long gpmc_l3_clk = 1; /* This should be a proper clock 
*/
+static void __iomem *gpmc_base;
+
+/* bool type time settings */
+struct gpmc_bool_timings {
+   bool cycle2cyclediffcsen;
+   bool cycle2cyclesamecsen;
+   bool we_extra_delay;
+   bool oe_extra_delay;
+   bool adv_extra_delay;
+   bool cs_extra_delay;
+   bool time_para_granularity;
+};
+
+/*
+ * Note that all values in this struct are in nanoseconds except sync_clk
+ * (which is in picoseconds), while the register values are in gpmc_fck cycles.
+ */
+struct gpmc_timings {
+   /* Minimum clock

[PATCH] commands: of_node fix descripion

2013-11-26 Thread Jan Weitzel
Remove copy and paste error

Signed-off-by: Jan Weitzel 
---
 commands/Kconfig |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/commands/Kconfig b/commands/Kconfig
index 9738ec4..1e07b5b 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -559,7 +559,7 @@ config CMD_OF_NODE
select OFTREE
prompt "of_node"
help
- The of_property command allows adding and removing devicetree nodes.
+ The of_node command allows adding and removing devicetree nodes.
 
 endmenu
 
-- 
1.7.0.4


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