summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/boards/bcm2835.rst17
-rw-r--r--Makefile4
-rw-r--r--arch/arm/Kconfig3
-rw-r--r--arch/arm/boards/animeo_ip/init.c1
-rw-r--r--arch/arm/boards/beaglebone/board.c3
-rw-r--r--arch/arm/boards/efika-mx-smartbook/board.c2
-rw-r--r--arch/arm/boards/pm9261/init.c1
-rw-r--r--arch/arm/boards/pm9263/init.c1
-rw-r--r--arch/arm/boards/pm9g45/init.c1
-rw-r--r--arch/arm/boards/qil-a926x/init.c1
-rw-r--r--arch/arm/boards/telit-evk-pro3/init.c2
-rw-r--r--arch/arm/boards/tny-a926x/init.c1
-rw-r--r--arch/arm/boards/usb-a926x/init.c1
l---------arch/arm/boards/versatile/env/boot.d/001-nor1
l---------arch/arm/boards/versatile/env/boot.d/101-nor-update1
-rw-r--r--arch/arm/boards/versatile/env/boot/nor15
-rw-r--r--arch/arm/boards/versatile/env/boot/nor-update14
-rw-r--r--arch/arm/boards/versatile/env/config38
-rw-r--r--arch/arm/boards/versatile/env/init/automount11
-rw-r--r--arch/arm/boards/versatile/env/init/mtdparts-nor11
-rw-r--r--arch/arm/boards/versatile/env/init/ps17
-rw-r--r--arch/arm/boards/versatile/env/nv/boot.default1
-rw-r--r--arch/arm/boards/versatile/env/nv/linux.bootargs.base1
-rw-r--r--arch/arm/boards/versatile/versatilepb.c19
-rw-r--r--arch/arm/configs/rpi_defconfig1
-rw-r--r--arch/arm/configs/versatilepb_arm1176_defconfig99
-rw-r--r--arch/arm/configs/versatilepb_defconfig31
-rw-r--r--arch/arm/cpu/lowlevel.S38
-rw-r--r--arch/arm/dts/am335x-bone-common.dts16
-rw-r--r--arch/arm/dts/am335x-phytec-phycore-som.dtsi2
-rw-r--r--arch/arm/dts/am335x-phytec-phyflex.dts2
-rw-r--r--arch/arm/include/asm/debug_ll_pl011.h25
-rw-r--r--arch/arm/include/asm/system_info.h2
-rw-r--r--arch/arm/mach-at91/at91sam926x_time.c6
-rw-r--r--arch/arm/mach-bcm2835/include/mach/debug_ll.h27
-rw-r--r--arch/arm/mach-highbank/include/mach/debug_ll.h16
-rw-r--r--arch/arm/mach-versatile/Kconfig19
-rw-r--r--arch/arm/mach-versatile/include/mach/debug_ll.h15
-rw-r--r--arch/arm/mach-vexpress/include/mach/debug_ll.h15
-rw-r--r--arch/efi/efi/efi.c18
-rw-r--r--commands/loadxy.c6
-rw-r--r--common/efi-devicepath.c15
-rw-r--r--common/startup.c6
-rw-r--r--drivers/base/driver.c18
-rw-r--r--drivers/i2c/busses/i2c-omap.c11
-rw-r--r--drivers/net/cpsw.c29
-rw-r--r--drivers/net/smc91111.c101
-rw-r--r--drivers/pinctrl/pinctrl-at91.c6
-rw-r--r--drivers/serial/atmel.c6
-rw-r--r--fs/efivarfs.c246
-rw-r--r--include/driver.h8
-rw-r--r--include/efi.h19
-rw-r--r--include/wchar.h2
-rw-r--r--lib/wchar.c16
54 files changed, 729 insertions, 249 deletions
diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst
new file mode 100644
index 0000000000..13cebb01c4
--- /dev/null
+++ b/Documentation/boards/bcm2835.rst
@@ -0,0 +1,17 @@
+Broadcom BCM2835
+================
+
+Raspberry Pi
+------------
+
+ 1. Prepare a card with a FAT filesystem. Download a tiny NOOBS LITE
+ zip archive and unpack it into FAT partition.
+ See http://www.raspberrypi.org/help/noobs-setup/ for details.
+
+ 2. Compile ``barebox.bin`` image (use ``rpi_defconfig``).
+ Copy it to the SD/microSD card and name it ``recovery.img``.
+
+ 3. Connect to board's UART (115200 8N1);
+ Use PIN6 (GND), PIN8 (UART_TX), PIN10 (UART_RX) pins.
+
+ 4. Turn board's power on.
diff --git a/Makefile b/Makefile
index 9606765cc2..90a7eeee65 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
-VERSION = 2014
-PATCHLEVEL = 12
+VERSION = 2015
+PATCHLEVEL = 01
SUBLEVEL = 0
EXTRAVERSION =
NAME = None
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4aa6afec1e..09bbe05bad 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -53,6 +53,7 @@ config ARCH_BCM2835
select COMMON_CLK
select CLOCKSOURCE_BCM2835
select ARM_AMBA
+ select HAS_DEBUG_LL
config ARCH_CLPS711X
bool "Cirrus Logic EP711x/EP721x/EP731x"
@@ -188,9 +189,9 @@ config ARCH_S3C64xx
config ARCH_VERSATILE
bool "ARM Versatile boards (ARM926EJ-S)"
- select CPU_ARM926T
select GPIOLIB
select HAVE_CLK
+ select HAS_DEBUG_LL
config ARCH_VEXPRESS
bool "ARM Vexpres boards"
diff --git a/arch/arm/boards/animeo_ip/init.c b/arch/arm/boards/animeo_ip/init.c
index ca64d6df83..495dc18df5 100644
--- a/arch/arm/boards/animeo_ip/init.c
+++ b/arch/arm/boards/animeo_ip/init.c
@@ -93,6 +93,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.bus_width_16 = 0,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/beaglebone/board.c b/arch/arm/boards/beaglebone/board.c
index 3042189f6d..9b1a9ecdc2 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -92,6 +92,9 @@ static int beaglebone_devices_init(void)
armlinux_set_architecture(MACH_TYPE_BEAGLEBONE);
+ if (IS_ENABLED(CONFIG_SHELL_NONE))
+ return am33xx_of_register_bootdevice();
+
return 0;
}
coredevice_initcall(beaglebone_devices_init);
diff --git a/arch/arm/boards/efika-mx-smartbook/board.c b/arch/arm/boards/efika-mx-smartbook/board.c
index 99efd666f9..4a38afd27b 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -246,6 +246,8 @@ static int efikamx_late_init(void)
for (i = 0; i < ARRAY_SIZE(leds); i++)
led_gpio_register(&leds[i]);
+ led_set_trigger(LED_TRIGGER_HEARTBEAT, &leds[0].led);
+
writew(0x0, MX51_WDOG_BASE_ADDR + 0x8);
imx51_bbu_internal_mmc_register_handler("mmc", "/dev/mmc1",
diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c
index 09d7f80ea8..63f4f19b3f 100644
--- a/arch/arm/boards/pm9261/init.c
+++ b/arch/arm/boards/pm9261/init.c
@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PA16,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
diff --git a/arch/arm/boards/pm9263/init.c b/arch/arm/boards/pm9263/init.c
index 3dca9e4fda..2b6b0891f5 100644
--- a/arch/arm/boards/pm9263/init.c
+++ b/arch/arm/boards/pm9263/init.c
@@ -50,6 +50,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PB30,
.enable_pin = AT91_PIN_PD15,
+ .ecc_mode = NAND_ECC_SOFT,
#if defined(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)
.bus_width_16 = 1,
#else
diff --git a/arch/arm/boards/pm9g45/init.c b/arch/arm/boards/pm9g45/init.c
index 1e43be5a7f..524fe5395a 100644
--- a/arch/arm/boards/pm9g45/init.c
+++ b/arch/arm/boards/pm9g45/init.c
@@ -49,6 +49,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PD3,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.bus_width_16 = 0,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/qil-a926x/init.c b/arch/arm/boards/qil-a926x/init.c
index 99a960470b..4f01e2d478 100644
--- a/arch/arm/boards/qil-a926x/init.c
+++ b/arch/arm/boards/qil-a926x/init.c
@@ -43,6 +43,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/telit-evk-pro3/init.c b/arch/arm/boards/telit-evk-pro3/init.c
index e094ea7c25..ea63b1a094 100644
--- a/arch/arm/boards/telit-evk-pro3/init.c
+++ b/arch/arm/boards/telit-evk-pro3/init.c
@@ -18,6 +18,7 @@
#include <gpio.h>
#include <init.h>
#include <linux/clk.h>
+#include <linux/mtd/nand.h>
#include <mach/at91_rstc.h>
#include <mach/at91sam9_smc.h>
#include <mach/board.h>
@@ -33,6 +34,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/tny-a926x/init.c b/arch/arm/boards/tny-a926x/init.c
index ac86457872..256f8ba9bf 100644
--- a/arch/arm/boards/tny-a926x/init.c
+++ b/arch/arm/boards/tny-a926x/init.c
@@ -55,6 +55,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/usb-a926x/init.c b/arch/arm/boards/usb-a926x/init.c
index 4a28af07e1..f0e1157912 100644
--- a/arch/arm/boards/usb-a926x/init.c
+++ b/arch/arm/boards/usb-a926x/init.c
@@ -59,6 +59,7 @@ static struct atmel_nand_data nand_pdata = {
.det_pin = -EINVAL,
.rdy_pin = AT91_PIN_PC13,
.enable_pin = AT91_PIN_PC14,
+ .ecc_mode = NAND_ECC_SOFT,
.on_flash_bbt = 1,
};
diff --git a/arch/arm/boards/versatile/env/boot.d/001-nor b/arch/arm/boards/versatile/env/boot.d/001-nor
new file mode 120000
index 0000000000..3db66aef68
--- /dev/null
+++ b/arch/arm/boards/versatile/env/boot.d/001-nor
@@ -0,0 +1 @@
+../boot/nor \ No newline at end of file
diff --git a/arch/arm/boards/versatile/env/boot.d/101-nor-update b/arch/arm/boards/versatile/env/boot.d/101-nor-update
new file mode 120000
index 0000000000..e4f1952a39
--- /dev/null
+++ b/arch/arm/boards/versatile/env/boot.d/101-nor-update
@@ -0,0 +1 @@
+../boot/nor-update \ No newline at end of file
diff --git a/arch/arm/boards/versatile/env/boot/nor b/arch/arm/boards/versatile/env/boot/nor
new file mode 100644
index 0000000000..3f31605c4f
--- /dev/null
+++ b/arch/arm/boards/versatile/env/boot/nor
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+ boot-menu-add-entry "$0" "nor"
+ exit
+fi
+
+global.bootm.image="/dev/nor0.kernel"
+global.linux.bootargs.dyn.root="root=ubi0:root ubi.mtd=5 rootfstype=ubifs"
+
+dtb=/dev/nor0.dtb
+filetype -s t ${dtb}
+if [ "$t" = dtb ]; then
+ global.bootm.oftree="${dtb}"
+fi
diff --git a/arch/arm/boards/versatile/env/boot/nor-update b/arch/arm/boards/versatile/env/boot/nor-update
new file mode 100644
index 0000000000..728889d20f
--- /dev/null
+++ b/arch/arm/boards/versatile/env/boot/nor-update
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+ boot-menu-add-entry "$0" "nor update"
+ exit
+fi
+
+global.bootm.image="/dev/nor0.update"
+
+dtb=/dev/nor0.dtb
+filetype -s t ${dtb}
+if [ "$t" = dtb ]; then
+ global.bootm.oftree="${dtb}"
+fi
diff --git a/arch/arm/boards/versatile/env/config b/arch/arm/boards/versatile/env/config
deleted file mode 100644
index 667dce3747..0000000000
--- a/arch/arm/boards/versatile/env/config
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/sh
-
-# use 'dhcp' to do dhcp in barebox and in kernel
-# use 'none' if you want to skip kernel ip autoconfiguration
-ip=dhcp
-
-# or set your networking parameters here
-#eth0.ipaddr=a.b.c.d
-#eth0.netmask=a.b.c.d
-#eth0.gateway=a.b.c.d
-#eth0.serverip=a.b.c.d
-
-# can be either 'nfs', 'tftp' or 'nor'
-kernel_loc=tftp
-# can be either 'net', 'nor' or 'initrd'
-rootfs_loc=initrd
-
-# can be either 'jffs2' or 'ubifs'
-rootfs_type=ubifs
-rootfsimage=root.$rootfs_type
-
-#kernelimage=zImage
-kernelimage=uImage
-#kernelimage=Image
-#kernelimage=Image.lzo
-
-nfsroot="$eth0.serverip:/opt/work/busybox/arm9/rootfs_arm"
-
-nor_parts="256k(barebox)ro,64k(bareboxenv),1536k(kernel),-(root)"
-rootfs_mtdblock_nor=3
-
-autoboot_timeout=3
-
-bootargs="console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0"
-
-# set a fancy prompt (if support is compiled in)
-PS1="\e[1;31m[barebox@\h]:\w\e[0m\n# "
-
diff --git a/arch/arm/boards/versatile/env/init/automount b/arch/arm/boards/versatile/env/init/automount
new file mode 100644
index 0000000000..53f9196a15
--- /dev/null
+++ b/arch/arm/boards/versatile/env/init/automount
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+ init-menu-add-entry "$0" "Automountpoints"
+ exit
+fi
+
+# automount tftp server based on $eth0.serverip
+
+mkdir -p /mnt/tftp
+automount /mnt/tftp 'ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp'
diff --git a/arch/arm/boards/versatile/env/init/mtdparts-nor b/arch/arm/boards/versatile/env/init/mtdparts-nor
new file mode 100644
index 0000000000..9079d482da
--- /dev/null
+++ b/arch/arm/boards/versatile/env/init/mtdparts-nor
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+if [ "$1" = menu ]; then
+ init-menu-add-entry "$0" "NOR partitions"
+ exit
+fi
+
+mtdparts="512k(nor0.barebox)ro,512k(nor0.bareboxenv),4864k(nor0.kernel),256k(nor0.dtb),3M(nor0.update),-(nor0.root)"
+kernelname="physmap-flash.0"
+
+mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}
diff --git a/arch/arm/boards/versatile/env/init/ps1 b/arch/arm/boards/versatile/env/init/ps1
new file mode 100644
index 0000000000..a1d075499f
--- /dev/null
+++ b/arch/arm/boards/versatile/env/init/ps1
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+if [ ${global.allow_color} = "true" ]; then
+ export PS1="\e[1;32mbarebox@\e[1;36m\h:\w\e[0m\n# "
+else
+ export PS1="barebox@\h:\w\n# "
+fi
diff --git a/arch/arm/boards/versatile/env/nv/boot.default b/arch/arm/boards/versatile/env/nv/boot.default
new file mode 100644
index 0000000000..c47e1b2bca
--- /dev/null
+++ b/arch/arm/boards/versatile/env/nv/boot.default
@@ -0,0 +1 @@
+/env/boot.d
diff --git a/arch/arm/boards/versatile/env/nv/linux.bootargs.base b/arch/arm/boards/versatile/env/nv/linux.bootargs.base
new file mode 100644
index 0000000000..826debe7c2
--- /dev/null
+++ b/arch/arm/boards/versatile/env/nv/linux.bootargs.base
@@ -0,0 +1 @@
+console=ttyAMA0,115200n8 CONSOLE=/dev/ttyAMA0
diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c
index fdd0820fd4..9ed114682b 100644
--- a/arch/arm/boards/versatile/versatilepb.c
+++ b/arch/arm/boards/versatile/versatilepb.c
@@ -22,6 +22,7 @@
#include <common.h>
#include <init.h>
#include <asm/armlinux.h>
+#include <asm/system_info.h>
#include <generated/mach-types.h>
#include <mach/init.h>
#include <mach/platform.h>
@@ -32,7 +33,19 @@
static int vpb_console_init(void)
{
- barebox_set_hostname("versatilepb");
+ char *hostname = "versatilepb-unknown";
+ char *model = "ARM Versatile PB";
+
+ if (cpu_is_arm926()) {
+ hostname = "versatilepb-arm926";
+ model = "ARM Versatile PB (arm926)";
+ } else if (cpu_is_arm1176()) {
+ hostname = "versatilepb-arm1176";
+ model = "ARM Versatile PB (arm1176)";
+ }
+
+ barebox_set_hostname(hostname);
+ barebox_set_model(model);
versatile_register_uart(0);
return 0;
@@ -46,8 +59,8 @@ static struct smc91c111_pdata net_pdata = {
static int vpb_devices_init(void)
{
add_cfi_flash_device(DEVICE_ID_DYNAMIC, VERSATILE_FLASH_BASE, VERSATILE_FLASH_SIZE, 0);
- devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self");
- devfs_add_partition("nor0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env0");
+ devfs_add_partition("nor0", 0x00000, SZ_512K, DEVFS_PARTITION_FIXED, "self");
+ devfs_add_partition("nor0", SZ_512K, SZ_512K, DEVFS_PARTITION_FIXED, "env0");
add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, VERSATILE_ETH_BASE,
64 * 1024, IORESOURCE_MEM, &net_pdata);
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 05c013601d..c6b2c50c7b 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -31,6 +31,7 @@ CONFIG_CMD_LN=y
CONFIG_CMD_FILETYPE=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_LOADB=y
+CONFIG_CMD_LOADY=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MM=y
diff --git a/arch/arm/configs/versatilepb_arm1176_defconfig b/arch/arm/configs/versatilepb_arm1176_defconfig
new file mode 100644
index 0000000000..ca0ab3603f
--- /dev/null
+++ b/arch/arm/configs/versatilepb_arm1176_defconfig
@@ -0,0 +1,99 @@
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_NAME="versatile-pb"
+CONFIG_ARCH_VERSATILE=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000
+CONFIG_MACH_VERSATILEPB_ARM1176=y
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_PBL_RELOCATABLE=y
+CONFIG_MALLOC_SIZE=0xa00000
+CONFIG_PROMPT="versatilepb> "
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_CONSOLE_ACTIVATE_ALL=y
+CONFIG_DEFAULT_COMPRESSION_GZIP=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/versatile/env"
+CONFIG_CMD_DMESG=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MEMINFO=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_GO=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_UBIFORMAT=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
+CONFIG_CMD_UNCOMPRESS=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
+CONFIG_CMD_TFTP=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_LOGIN=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_PASSWD=y
+CONFIG_CMD_SPLASH=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OFTREE=y
+CONFIG_NET=y
+CONFIG_NET_NFS=y
+CONFIG_NET_NETCONSOLE=y
+CONFIG_NET_RESOLV=y
+CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_USB=y
+CONFIG_SERIAL_USB_FTDI=y
+CONFIG_DRIVER_NET_SMC91111=y
+CONFIG_I2C=y
+CONFIG_I2C_VERSATILE=y
+CONFIG_MTD=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_AMD is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_2 is not set
+CONFIG_MTD_UBI=y
+CONFIG_USB_HOST=y
+CONFIG_USB_EHCI=y
+CONFIG_USB_STORAGE=y
+CONFIG_VIDEO=y
+CONFIG_DRIVER_VIDEO_ARMCLCD=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_SELF_REGISTER=y
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+CONFIG_FONT_ACORN_8x8=y
+CONFIG_GPIO_PL061=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_DS1307=y
+CONFIG_FS_CRAMFS=y
+CONFIG_FS_EXT4=y
+CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
+CONFIG_PNG=y
+CONFIG_SHA1=y
+CONFIG_SHA256=y
diff --git a/arch/arm/configs/versatilepb_defconfig b/arch/arm/configs/versatilepb_defconfig
index 9f7e0e56ea..54a6fec919 100644
--- a/arch/arm/configs/versatilepb_defconfig
+++ b/arch/arm/configs/versatilepb_defconfig
@@ -1,28 +1,41 @@
CONFIG_BUILTIN_DTB=y
CONFIG_BUILTIN_DTB_NAME="versatile-pb"
CONFIG_ARCH_VERSATILE=y
+CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_PBL_IMAGE=y
+CONFIG_PBL_RELOCATABLE=y
CONFIG_PROMPT="versatilepb> "
-CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
+CONFIG_CONSOLE_ACTIVATE_ALL=y
CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
+CONFIG_DEFAULT_COMPRESSION_GZIP=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/versatile/env"
+CONFIG_CMD_DMESG=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=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_GO=y
CONFIG_CMD_LOADB=y
CONFIG_CMD_RESET=y
CONFIG_CMD_PARTITION=y
+CONFIG_CMD_UBIFORMAT=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_FILETYPE=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_DHCP=y
@@ -30,12 +43,16 @@ CONFIG_CMD_PING=y
CONFIG_CMD_TFTP=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_EDIT=y
+CONFIG_CMD_LOGIN=y
CONFIG_CMD_MENU=y
CONFIG_CMD_MENU_MANAGEMENT=y
-CONFIG_CMD_LOGIN=y
CONFIG_CMD_PASSWD=y
+CONFIG_CMD_SPLASH=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_CRC_CMP=y
+CONFIG_CMD_FLASH=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_CMD_OF_NODE=y
@@ -51,10 +68,18 @@ CONFIG_SERIAL_AMBA_PL011=y
CONFIG_DRIVER_NET_SMC91111=y
CONFIG_I2C=y
CONFIG_I2C_VERSATILE=y
+CONFIG_MTD=y
+CONFIG_DRIVER_CFI=y
+# CONFIG_DRIVER_CFI_AMD is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set
+# CONFIG_DRIVER_CFI_BANK_WIDTH_2 is not set
+CONFIG_MTD_UBI=y
CONFIG_GPIO_PL061=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_DRV_DS1307=y
CONFIG_FS_CRAMFS=y
+CONFIG_FS_EXT4=y
CONFIG_FS_TFTP=y
+CONFIG_FS_NFS=y
CONFIG_SHA1=y
CONFIG_SHA256=y
diff --git a/arch/arm/cpu/lowlevel.S b/arch/arm/cpu/lowlevel.S
index c615d5b581..b76222d8f3 100644
--- a/arch/arm/cpu/lowlevel.S
+++ b/arch/arm/cpu/lowlevel.S
@@ -4,23 +4,41 @@
.section ".text_bare_init_","ax"
ENTRY(arm_cpu_lowlevel_init)
- mov r2, lr
- /* set the cpu to SVC32 mode */
+ /* set the cpu to SVC32 mode, mask irq and fiq */
mrs r12, cpsr
bic r12, r12, #0x1f
orr r12, r12, #0xd3
msr cpsr, r12
-#if __LINUX_ARM_ARCH__ >= 7
- isb
-#elif __LINUX_ARM_ARCH__ == 6
+#if __LINUX_ARM_ARCH__ >= 6
+ /*
+ * ICIALLU: Invalidate all instruction caches to PoU,
+ * includes flushing of branch predictors.
+ * Even if the i-cache is off it might contain stale entries
+ * that are better discarded before enabling the cache.
+ * Architectually this is even possible after a cold reset.
+ */
+ mcr p15, 0, r12, c7, c5, 0
+ /* DSB, ensure completion of the invalidation */
+ mcr p15, 0, r12, c7, c10, 4
+ /*
+ * ISB, ensure instruction fetch path is in sync.
+ * Note that the ARM Architecture Reference Manual, ARMv7-A and ARMv7-R
+ * edition (ARM DDI 0406C.c) doesn't define this instruction in the
+ * ARMv6 part (D12.7.10). It only has: "Support of additional
+ * operations is IMPLEMENTATION DEFINED".
+ * But an earlier version of the ARMARM (ARM DDI 0100I) does define it
+ * as "Flush prefetch buffer (PrefetchFlush)".
+ */
mcr p15, 0, r12, c7, c5, 4
#endif
- /* disable MMU stuff and caches */
- mrc p15, 0, r12, c1, c0, 0
- bic r12, r12 , #(CR_M | CR_C | CR_B)
+ /* disable MMU stuff and data/unified caches */
+ mrc p15, 0, r12, c1, c0, 0 /* SCTLR */
+ bic r12, r12, #(CR_M | CR_C | CR_B)
bic r12, r12, #(CR_S | CR_R | CR_V)
+
+ /* enable instruction cache */
orr r12, r12, #CR_I
#if __LINUX_ARM_ARCH__ >= 6
@@ -34,7 +52,7 @@ ENTRY(arm_cpu_lowlevel_init)
orr r12, r12, #CR_B
#endif
- mcr p15, 0, r12, c1, c0, 0
+ mcr p15, 0, r12, c1, c0, 0 /* SCTLR */
- mov pc, r2
+ mov pc, lr
ENDPROC(arm_cpu_lowlevel_init)
diff --git a/arch/arm/dts/am335x-bone-common.dts b/arch/arm/dts/am335x-bone-common.dts
index bbc55617c8..5d3d2ed5aa 100644
--- a/arch/arm/dts/am335x-bone-common.dts
+++ b/arch/arm/dts/am335x-bone-common.dts
@@ -1,5 +1,12 @@
/dts-v1/;
+/*
+ * DTS for the beaglebone white/black MLO
+ *
+ * Only contains the common parts of both boards which is
+ * all we need for the MLO
+ */
+
#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
@@ -7,3 +14,12 @@
model = "TI AM335x BeagleBone";
compatible = "ti,am335x-bone", "ti,am33xx";
};
+
+&mmc2 {
+ vmmc-supply = <&vmmcsd_fixed>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&emmc_pins>;
+ bus-width = <8>;
+ status = "disabled"; /* only present on beaglebone black, enabled during runtime */
+ ti,vcc-aux-disable-is-sleep;
+};
diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
index 246b5aa62d..c34ae38271 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi
+++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi
@@ -161,7 +161,7 @@
partition@4 {
label = "kernel";
- reg = <0xe0000 0x400000>;
+ reg = <0xe0000 0x0>;
};
};
};
diff --git a/arch/arm/dts/am335x-phytec-phyflex.dts b/arch/arm/dts/am335x-phytec-phyflex.dts
index 6679cf56db..6c49567107 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 = <0xe0000 0x400000>;
+ reg = <0xe0000 0x0>;
};
};
};
diff --git a/arch/arm/include/asm/debug_ll_pl011.h b/arch/arm/include/asm/debug_ll_pl011.h
new file mode 100644
index 0000000000..db015a373b
--- /dev/null
+++ b/arch/arm/include/asm/debug_ll_pl011.h
@@ -0,0 +1,25 @@
+#ifndef __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__
+#define __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__
+
+#ifndef DEBUG_LL_UART_ADDR
+#error DEBUG_LL_UART_ADDR is undefined!
+#endif
+
+#include <io.h>
+#include <linux/amba/serial.h>
+
+static inline void PUTC_LL(char c)
+{
+ /* Wait until there is space in the FIFO */
+ while (readl(DEBUG_LL_UART_ADDR + UART01x_FR) & UART01x_FR_TXFF)
+ ;
+
+ /* Send the character */
+ writel(c, DEBUG_LL_UART_ADDR + UART01x_DR);
+
+ /* Wait to make sure it hits the line, in case we die too soon. */
+ while (readl(DEBUG_LL_UART_ADDR + UART01x_FR) & UART01x_FR_TXFF)
+ ;
+}
+
+#endif /* __INCLUDE_ARM_ASM_DEBUG_LL_PL011_H__ */
diff --git a/arch/arm/include/asm/system_info.h b/arch/arm/include/asm/system_info.h
index 61828602ef..0761848a1a 100644
--- a/arch/arm/include/asm/system_info.h
+++ b/arch/arm/include/asm/system_info.h
@@ -23,7 +23,7 @@
#define CPU_IS_ARM926 0x41069260
#define CPU_IS_ARM926_MASK 0xff0ffff0
-#define CPU_IS_ARM1176 0x410fb767
+#define CPU_IS_ARM1176 0x410fb760
#define CPU_IS_ARM1176_MASK 0xff0ffff0
#define CPU_IS_CORTEX_A8 0x410fc080
diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c
index 789e1ec77e..cc7ad2f39a 100644
--- a/arch/arm/mach-at91/at91sam926x_time.c
+++ b/arch/arm/mach-at91/at91sam926x_time.c
@@ -89,9 +89,9 @@ static int at91_pit_probe(struct device_d *dev)
return ret;
}
- pit_base = dev_request_mem_region(dev, 0);
- if (IS_ERR(pit_base))
- return PTR_ERR(pit_base);
+ pit_base = dev_request_mem_region_err_null(dev, 0);
+ if (!pit_base)
+ return -ENOENT;
pit_rate = clk_get_rate(clk) / 16;
diff --git a/arch/arm/mach-bcm2835/include/mach/debug_ll.h b/arch/arm/mach-bcm2835/include/mach/debug_ll.h
new file mode 100644
index 0000000000..be93cd95ad
--- /dev/null
+++ b/arch/arm/mach-bcm2835/include/mach/debug_ll.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 Antony Pavlov <antonynpavlov@gmail.com>
+ *
+ * This file is part of barebox.
+ * See file CREDITS for list of people who contributed to this project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_BCM2835_DEBUG_LL_H__
+#define __MACH_BCM2835_DEBUG_LL_H__
+
+#include <mach/platform.h>
+
+#define DEBUG_LL_UART_ADDR BCM2835_UART0_BASE
+
+#include <asm/debug_ll_pl011.h>
+
+#endif /* __MACH_BCM2835_DEBUG_LL_H__ */
diff --git a/arch/arm/mach-highbank/include/mach/debug_ll.h b/arch/arm/mach-highbank/include/mach/debug_ll.h
index 4cdbb3ce51..1820eb1d13 100644
--- a/arch/arm/mach-highbank/include/mach/debug_ll.h
+++ b/arch/arm/mach-highbank/include/mach/debug_ll.h
@@ -7,20 +7,8 @@
#ifndef __MACH_DEBUG_LL_H__
#define __MACH_DEBUG_LL_H__
-#include <linux/amba/serial.h>
-#include <io.h>
+#define DEBUG_LL_UART_ADDR 0xfff36000
-#define UART_BASE 0xfff36000
+#include <asm/debug_ll_pl011.h>
-static inline void PUTC_LL(char c)
-{
- /* Wait until there is space in the FIFO */
- while (readl(UART_BASE + UART01x_FR) & UART01x_FR_TXFF);
-
- /* Send the character */
- writel(c, UART_BASE + UART01x_DR);
-
- /* Wait to make sure it hits the line, in case we die too soon. */
- while (readl(UART_BASE + UART01x_FR) & UART01x_FR_TXFF);
-}
#endif
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 9a1bf953b0..755fdc168a 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -1,13 +1,26 @@
if ARCH_VERSATILE
-choice
- prompt "ARM Board type"
+config ARCH_TEXT_BASE
+ default 0x02000000
config MACH_VERSATILEPB
- bool "ARM Versatile/PB (ARM926EJ-S)"
+ bool
+ default y
select ARM_AMBA
select CLKDEV_LOOKUP
+ select HAVE_DEFAULT_ENVIRONMENT_NEW
+
+choice
+ prompt "ARM Board type"
+
+config MACH_VERSATILEPB_926T
+ bool "ARM Versatile/PB (ARM926EJ-S)"
+ select CPU_ARM926T
+
+config MACH_VERSATILEPB_ARM1176
+ bool "ARM Versatile/PB (ARM1176)"
+ select CPU_ARM1176
endchoice
diff --git a/arch/arm/mach-versatile/include/mach/debug_ll.h b/arch/arm/mach-versatile/include/mach/debug_ll.h
index f91812b12d..e6ee877a54 100644
--- a/arch/arm/mach-versatile/include/mach/debug_ll.h
+++ b/arch/arm/mach-versatile/include/mach/debug_ll.h
@@ -16,19 +16,8 @@
#ifndef __MACH_DEBUG_LL_H__
#define __MACH_DEBUG_LL_H__
-#include <linux/amba/serial.h>
-#include <io.h>
+#define DEBUG_LL_UART_ADDR 0x101F1000
-static inline void PUTC_LL(char c)
-{
- /* Wait until there is space in the FIFO */
- while (readl(0x101F1000 + UART01x_FR) & UART01x_FR_TXFF);
-
- /* Send the character */
- writel(c, 0x101F1000 + UART01x_DR);
-
- /* Wait to make sure it hits the line, in case we die too soon. */
- while (readl(0x101F1000 + UART01x_FR) & UART01x_FR_TXFF);
-}
+#include <asm/debug_ll_pl011.h>
#endif
diff --git a/arch/arm/mach-vexpress/include/mach/debug_ll.h b/arch/arm/mach-vexpress/include/mach/debug_ll.h
index 15d6e85239..89b06923ad 100644
--- a/arch/arm/mach-vexpress/include/mach/debug_ll.h
+++ b/arch/arm/mach-vexpress/include/mach/debug_ll.h
@@ -14,20 +14,11 @@
#define DEBUG_LL_PHYS_BASE_RS1 0x1c000000
#ifdef MP
-#define UART_BASE DEBUG_LL_PHYS_BASE
+#define DEBUG_LL_UART_ADDR DEBUG_LL_PHYS_BASE
#else
-#define UART_BASE DEBUG_LL_PHYS_BASE_RS1
+#define DEBUG_LL_UART_ADDR DEBUG_LL_PHYS_BASE_RS1
#endif
-static inline void PUTC_LL(char c)
-{
- /* Wait until there is space in the FIFO */
- while (readl(UART_BASE + UART01x_FR) & UART01x_FR_TXFF);
+#include <asm/debug_ll_pl011.h>
- /* Send the character */
- writel(c, UART_BASE + UART01x_DR);
-
- /* Wait to make sure it hits the line, in case we die too soon. */
- while (readl(UART_BASE + UART01x_FR) & UART01x_FR_TXFF);
-}
#endif
diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c
index 7de8ec82e8..c1efe1d8ae 100644
--- a/arch/efi/efi/efi.c
+++ b/arch/efi/efi/efi.c
@@ -248,7 +248,7 @@ console_initcall(efi_console_init);
void reset_cpu(unsigned long addr)
{
- BS->exit(efi_parent_image, EFI_SUCCESS, 0, NULL);
+ RT->reset_system(EFI_RESET_WARM, EFI_SUCCESS, 0, NULL);
while(1);
}
@@ -341,3 +341,19 @@ efi_status_t efi_main(efi_handle_t image, efi_system_table_t *sys_table)
return EFI_SUCCESS;
}
+
+static int do_efiexit(int argc, char *argv[])
+{
+ return BS->exit(efi_parent_image, EFI_SUCCESS, 0, NULL);
+}
+
+BAREBOX_CMD_HELP_START(efiexit)
+BAREBOX_CMD_HELP_TEXT("Leave barebox and return to the calling EFI process\n")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(efiexit)
+ .cmd = do_efiexit,
+ BAREBOX_CMD_DESC("Usage: efiexit")
+ BAREBOX_CMD_GROUP(CMD_GRP_MISC)
+ BAREBOX_CMD_HELP(cmd_efiexit_help)
+BAREBOX_CMD_END
diff --git a/commands/loadxy.c b/commands/loadxy.c
index df14043d69..1e65cb6221 100644
--- a/commands/loadxy.c
+++ b/commands/loadxy.c
@@ -43,10 +43,10 @@
static int console_change_speed(struct console_device *cdev, int baudrate)
{
int current_baudrate;
+ const char *bstr;
- current_baudrate =
- (int)simple_strtoul(dev_get_param(&cdev->class_dev,
- "baudrate"), NULL, 10);
+ bstr = dev_get_param(&cdev->class_dev, "baudrate");
+ current_baudrate = bstr ? (int)simple_strtoul(bstr, NULL, 10) : 0;
if (baudrate && baudrate != current_baudrate) {
printf("## Switch baudrate from %d to %d bps and press ENTER ...\n",
current_baudrate, baudrate);
diff --git a/common/efi-devicepath.c b/common/efi-devicepath.c
index 2b1d916768..a53c6d2e8b 100644
--- a/common/efi-devicepath.c
+++ b/common/efi-devicepath.c
@@ -1368,3 +1368,18 @@ char *device_path_to_str(struct efi_device_path *dev_path)
return str.str;
}
+
+u8 device_path_to_type(struct efi_device_path *dev_path)
+{
+ struct efi_device_path *dev_path_next;
+
+ dev_path = unpack_device_path(dev_path);
+ dev_path_next = next_device_path_node(dev_path);
+
+ while (!is_device_path_end(dev_path_next)) {
+ dev_path = dev_path_next;
+ dev_path_next = next_device_path_node(dev_path);
+ }
+
+ return device_path_type(dev_path);
+}
diff --git a/common/startup.c b/common/startup.c
index 2b92efcb95..e59b06d533 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -51,6 +51,12 @@ static int mount_root(void)
mount("none", "ramfs", "/", NULL);
mkdir("/dev", 0);
mount("none", "devfs", "/dev", NULL);
+
+ if (IS_ENABLED(CONFIG_FS_EFIVARFS)) {
+ mkdir("/efivars", 0);
+ mount("none", "efivarfs", "/efivars", NULL);
+ }
+
return 0;
}
fs_initcall(mount_root);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index e0125a1b92..81b35031a1 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -318,6 +318,22 @@ void __iomem *dev_request_mem_region_by_name(struct device_d *dev, const char *n
}
EXPORT_SYMBOL(dev_request_mem_region_by_name);
+void __iomem *dev_request_mem_region_err_null(struct device_d *dev, int num)
+{
+ struct resource *res;
+
+ res = dev_get_resource(dev, IORESOURCE_MEM, num);
+ if (IS_ERR(res))
+ return NULL;
+
+ res = request_iomem_region(dev_name(dev), res->start, res->end);
+ if (IS_ERR(res))
+ return NULL;
+
+ return (void __force __iomem *)res->start;
+}
+EXPORT_SYMBOL(dev_request_mem_region_err_null);
+
void __iomem *dev_request_mem_region(struct device_d *dev, int num)
{
struct resource *res;
@@ -330,7 +346,7 @@ void __iomem *dev_request_mem_region(struct device_d *dev, int num)
if (IS_ERR(res))
return ERR_CAST(res);
- return (void __force __iomem *)res->start;
+ return IOMEM(res->start);
}
EXPORT_SYMBOL(dev_request_mem_region);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 094f5916cf..96c3c2bc87 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -271,11 +271,6 @@ static struct omap_i2c_driver_data am33xx_data = {
.fclk_rate = 48000,
};
-static struct omap_i2c_driver_data omap4_of_data = {
- .flags = OMAP_I2C_FLAG_BUS_SHIFT_NONE,
- .fclk_rate = 0,
-};
-
static inline void omap_i2c_write_reg(struct omap_i2c_struct *i2c_omap,
int reg, u16 val)
{
@@ -1011,6 +1006,11 @@ i2c_omap_probe(struct device_d *pdev)
if (r)
return r;
+ if (of_machine_is_compatible("ti,am33xx"))
+ i2c_data = &am33xx_data;
+ if (of_machine_is_compatible("ti,omap4"))
+ i2c_data = &omap4_data;
+
i2c_omap->data = i2c_data;
i2c_omap->reg_shift = (i2c_data->flags >>
OMAP_I2C_FLAG_BUS_SHIFT__SHIFT) & 3;
@@ -1140,7 +1140,6 @@ static __maybe_unused struct of_device_id omap_i2c_dt_ids[] = {
.data = (unsigned long)&omap3_data,
}, {
.compatible = "ti,omap4-i2c",
- .data = (unsigned long)&omap4_of_data,
}, {
/* sentinel */
}
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
index b6618ad675..799fac89a2 100644
--- a/drivers/net/cpsw.c
+++ b/drivers/net/cpsw.c
@@ -910,6 +910,16 @@ static int cpsw_slave_setup(struct cpsw_slave *slave, int slave_num,
struct eth_device *edev = &slave->edev;
struct device_d *dev = &slave->dev;
int ret;
+ struct phy_device *phy;
+
+ phy = mdiobus_scan(&priv->miibus, priv->slaves[slave_num].phy_id);
+ if (IS_ERR(phy))
+ return PTR_ERR(phy);
+
+ phy->dev.device_node = priv->slaves[slave_num].dev.device_node;
+ ret = phy_register_device(phy);
+ if (ret)
+ return ret;
sprintf(dev->name, "cpsw-slave");
dev->id = slave->slave_num;
@@ -1199,22 +1209,11 @@ int cpsw_probe(struct device_d *dev)
mdiobus_register(&priv->miibus);
for (i = 0; i < priv->num_slaves; i++) {
- struct phy_device *phy;
-
- phy = mdiobus_scan(&priv->miibus, priv->slaves[i].phy_id);
- if (IS_ERR(phy)) {
- ret = PTR_ERR(phy);
- goto out;
- }
-
- phy->dev.device_node = priv->slaves[i].dev.device_node;
- ret = phy_register_device(phy);
- if (ret)
- goto out;
-
ret = cpsw_slave_setup(&priv->slaves[i], i, priv);
- if (ret)
- goto out;
+ if (ret) {
+ dev_err(dev, "Failed to setup slave %d: %s\n", i, strerror(-ret));
+ continue;
+ }
}
return 0;
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 55d93676b2..100688ccf8 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -152,6 +152,7 @@
/* Memory Information Register */
/* BANK 0 */
#define MIR_REG 0x0008
+#define MIR_FREE_MASK 0xff00
/* Receive/Phy Control Register */
/* BANK 0 */
@@ -582,6 +583,43 @@ static inline void SMC_SELECT_BANK(struct smc91c111_priv *p, int bank)
SMC_outw(p, bank, BANK_SELECT);
}
+#if SMC_DEBUG > 2
+static void print_packet( unsigned char * buf, int length )
+{
+ int i;
+ int remainder;
+ int lines;
+
+ printf("Packet of length %d \n", length );
+
+#if SMC_DEBUG > 3
+ lines = length / 16;
+ remainder = length % 16;
+
+ for ( i = 0; i < lines ; i ++ ) {
+ int cur;
+
+ for ( cur = 0; cur < 8; cur ++ ) {
+ unsigned char a, b;
+
+ a = *(buf ++ );
+ b = *(buf ++ );
+ printf("%02x%02x ", a, b );
+ }
+ printf("\n");
+ }
+ for ( i = 0; i < remainder/2 ; i++ ) {
+ unsigned char a, b;
+
+ a = *(buf ++ );
+ b = *(buf ++ );
+ printf("%02x%02x ", a, b );
+ }
+ printf("\n");
+#endif
+}
+#endif
+
/* note: timeout in seconds */
static int poll4int(struct smc91c111_priv *priv, unsigned char mask,
int timeout)
@@ -916,6 +954,30 @@ static int smc91c111_eth_open(struct eth_device *edev)
return 0;
}
+static void smc91c111_ensure_freemem(struct eth_device *edev)
+{
+ struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
+ u16 mir, rxfifo;
+
+ SMC_SELECT_BANK(priv, 0);
+ mir = SMC_inw(priv, MIR_REG);
+ SMC_SELECT_BANK(priv, 2);
+
+ if ((mir & MIR_FREE_MASK) == 0) {
+ do {
+ SMC_outw(priv, MC_RELEASE, MMU_CMD_REG);
+ smc_wait_mmu_release_complete(priv);
+
+ SMC_SELECT_BANK(priv, 0);
+ mir = SMC_inw(priv, MIR_REG);
+ SMC_SELECT_BANK(priv, 2);
+ rxfifo = SMC_inw(priv, RXFIFO_REG);
+ dev_dbg(&edev->dev, "%s: card memory saturated, tidying up (rx_tx_fifo=0x%04x mir=0x%04x)\n",
+ SMC_DEV_NAME, rxfifo, mir);
+ } while (!(rxfifo & RXFIFO_REMPTY));
+ }
+}
+
static int smc91c111_eth_send(struct eth_device *edev, void *packet,
int packet_length)
{
@@ -957,6 +1019,7 @@ static int smc91c111_eth_send(struct eth_device *edev, void *packet,
return -EOVERFLOW;
}
+ smc91c111_ensure_freemem(edev);
/* now, try to allocate the memory */
SMC_SELECT_BANK(priv, 2);
SMC_outw(priv, MC_ALLOC | numPages, MMU_CMD_REG);
@@ -1255,44 +1318,6 @@ static void smc_dump_mii_stream (unsigned char * bits, int size)
}
#endif
-
-#if SMC_DEBUG > 2
-static void print_packet( unsigned char * buf, int length )
-{
- int i;
- int remainder;
- int lines;
-
- printf("Packet of length %d \n", length );
-
-#if SMC_DEBUG > 3
- lines = length / 16;
- remainder = length % 16;
-
- for ( i = 0; i < lines ; i ++ ) {
- int cur;
-
- for ( cur = 0; cur < 8; cur ++ ) {
- unsigned char a, b;
-
- a = *(buf ++ );
- b = *(buf ++ );
- printf("%02x%02x ", a, b );
- }
- printf("\n");
- }
- for ( i = 0; i < remainder/2 ; i++ ) {
- unsigned char a, b;
-
- a = *(buf ++ );
- b = *(buf ++ );
- printf("%02x%02x ", a, b );
- }
- printf("\n");
-#endif
-}
-#endif
-
static int smc91c111_init_dev(struct eth_device *edev)
{
return 0;
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 0d6d2e7e53..b803f891eb 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -652,9 +652,9 @@ static int at91_gpio_probe(struct device_d *dev)
}
gpio_banks = max(gpio_banks, alias_idx + 1);
- at91_gpio->regbase = dev_request_mem_region(dev, 0);
- if (IS_ERR(at91_gpio->regbase))
- return PTR_ERR(at91_gpio->regbase);
+ at91_gpio->regbase = dev_request_mem_region_err_null(dev, 0);
+ if (!at91_gpio->regbase)
+ return -ENOENT;
at91_gpio->chip.ops = &at91_gpio_ops;
at91_gpio->chip.ngpio = MAX_NB_GPIO_PER_BANK;
diff --git a/drivers/serial/atmel.c b/drivers/serial/atmel.c
index 1f406925a3..4e4624e235 100644
--- a/drivers/serial/atmel.c
+++ b/drivers/serial/atmel.c
@@ -398,9 +398,9 @@ static int atmel_serial_init_port(struct console_device *cdev)
struct device_d *dev = cdev->dev;
struct atmel_uart_port *uart = to_atmel_uart_port(cdev);
- uart->base = dev_request_mem_region(dev, 0);
- if (IS_ERR(uart->base))
- return PTR_ERR(uart->base);
+ uart->base = dev_request_mem_region_err_null(dev, 0);
+ if (!uart->base)
+ return -ENOENT;
uart->clk = clk_get(dev, "usart");
clk_enable(uart->clk);
diff --git a/fs/efivarfs.c b/fs/efivarfs.c
index 58c637ef19..9a1503bd13 100644
--- a/fs/efivarfs.c
+++ b/fs/efivarfs.c
@@ -1,7 +1,7 @@
/*
- * ramfs.c - a malloc based filesystem
+ * efivars.c - EFI variable filesystem
*
- * Copyright (c) 2007 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
+ * Copyright (c) 2014 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -34,9 +34,20 @@
#include <mach/efi.h>
#include <mach/efi-device.h>
+struct efivarfs_inode {
+ s16 *name;
+ efi_guid_t vendor;
+ char *full_name; /* name including vendor namespacing */
+ struct list_head node;
+};
+
+struct efivarfs_dir {
+ struct list_head *current;
+ DIR dir;
+};
+
struct efivarfs_priv {
- struct efi_file_handle *root_dir;
- struct efi_file_io_interface *protocol;
+ struct list_head inodes;
};
static int char_to_nibble(char c)
@@ -75,8 +86,8 @@ int efi_guid_parse(const char *str, efi_guid_t *guid)
if (*str != '-')
return -EINVAL;
str++;
- break;
- }
+ break;
+ }
}
return 0;
@@ -115,11 +126,81 @@ static int efivarfs_parse_filename(const char *filename, efi_guid_t *vendor, s16
return 0;
}
+static int efivars_create(struct device_d *dev, const char *pathname, mode_t mode)
+{
+ struct efivarfs_priv *priv = dev->priv;
+ struct efivarfs_inode *inode;
+ efi_guid_t vendor;
+ efi_status_t efiret;
+ u8 dummydata;
+ char *name8;
+ s16 *name;
+ int ret;
+
+ if (pathname[0] == '/')
+ pathname++;
+
+ /* deny creating files with other vendor GUID than our own */
+ ret = efivarfs_parse_filename(pathname, &vendor, &name);
+ if (ret)
+ return -ENOENT;
+
+ if (memcmp(&vendor, &EFI_BAREBOX_VENDOR_GUID, sizeof(efi_guid_t)))
+ return -EPERM;
+
+ inode = xzalloc(sizeof(*inode));
+ inode->name = name;
+ inode->vendor = vendor;
+
+
+ name8 = strdup_wchar_to_char(inode->name);
+ inode->full_name = asprintf("%s-%pUl", name8, &inode->vendor);
+ free(name8);
+
+ efiret = RT->set_variable(inode->name, &inode->vendor,
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ 1, &dummydata);
+ if (EFI_ERROR(efiret)) {
+ free(inode);
+ return -efi_errno(efiret);
+ }
+
+ list_add_tail(&inode->node, &priv->inodes);
+
+ return 0;
+}
+
+static int efivars_unlink(struct device_d *dev, const char *pathname)
+{
+ struct efivarfs_priv *priv = dev->priv;
+ struct efivarfs_inode *inode, *tmp;
+ efi_status_t efiret;
+
+ if (pathname[0] == '/')
+ pathname++;
+
+ list_for_each_entry_safe(inode, tmp, &priv->inodes, node) {
+ if (!strcmp(inode->full_name, pathname)) {
+ efiret = RT->set_variable(inode->name, &inode->vendor,
+ 0, 0, NULL);
+ if (EFI_ERROR(efiret))
+ return -efi_errno(efiret);
+ list_del(&inode->node);
+ free(inode);
+ }
+ }
+
+ return 0;
+}
+
struct efivars_file {
void *buf;
unsigned long size;
efi_guid_t vendor;
s16 *name;
+ u32 attributes;
};
static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
@@ -127,7 +208,6 @@ static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
struct efivars_file *efile;
efi_status_t efiret;
int ret;
- uint32_t attributes;
efile = xzalloc(sizeof(*efile));
@@ -135,28 +215,27 @@ static int efivarfs_open(struct device_d *dev, FILE *f, const char *filename)
if (ret)
return -ENOENT;
- efiret = RT->get_variable(efile->name, &efile->vendor, &attributes, &efile->size, NULL);
+ efiret = RT->get_variable(efile->name, &efile->vendor,
+ &efile->attributes, &efile->size, NULL);
if (EFI_ERROR(efiret) && efiret != EFI_BUFFER_TOO_SMALL) {
ret = -efi_errno(efiret);
goto out;
}
- efile->buf = malloc(efile->size + sizeof(uint32_t));
+ efile->buf = malloc(efile->size);
if (!efile->buf) {
ret = -ENOMEM;
goto out;
}
efiret = RT->get_variable(efile->name, &efile->vendor, NULL, &efile->size,
- efile->buf + sizeof(uint32_t));
+ efile->buf);
if (EFI_ERROR(efiret)) {
ret = -efi_errno(efiret);
goto out;
}
- *(uint32_t *)efile->buf = attributes;
-
- f->size = efile->size + sizeof(uint32_t);
+ f->size = efile->size;
f->inode = efile;
return 0;
@@ -187,74 +266,68 @@ static int efivarfs_read(struct device_d *_dev, FILE *f, void *buf, size_t insiz
return insize;
}
-static loff_t efivarfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+static int efivarfs_write(struct device_d *_dev, FILE *f, const void *buf, size_t insize)
{
- f->pos = pos;
-
- return f->pos;
-}
-
-struct efivarfs_dir_entry {
- char *name;
- struct efivarfs_dir_entry *next;
-};
+ struct efivars_file *efile = f->inode;
-struct efivarfs_dir {
- struct efivarfs_dir_entry *first;
- struct efivarfs_dir_entry *current;
- DIR dir;
-};
+ if (efile->size < f->pos + insize) {
+ efile->buf = realloc(efile->buf, f->pos + insize);
+ efile->size = f->pos + insize;
+ }
-static DIR *efivarfs_opendir(struct device_d *dev, const char *pathname)
-{
- efi_status_t efiret;
- efi_guid_t vendor;
- s16 name[1024];
- struct efivarfs_dir *edir;
- unsigned long size;
- unsigned char *name8;
+ memcpy(efile->buf + f->pos, buf, insize);
- name[0] = 0;
+ RT->set_variable(efile->name, &efile->vendor, efile->attributes,
+ efile->size ? efile->size : 1, efile->buf);
- edir = xzalloc(sizeof(*edir));
+ return insize;
+}
- while (1) {
- struct efivarfs_dir_entry *entry;
+static int efivarfs_truncate(struct device_d *dev, FILE *f, ulong size)
+{
+ struct efivars_file *efile = f->inode;
- size = sizeof(name);
- efiret = RT->get_next_variable(&size, name, &vendor);
- if (EFI_ERROR(efiret))
- break;
+ efile->size = size;
+ efile->buf = realloc(efile->buf, efile->size + sizeof(uint32_t));
- entry = xzalloc(sizeof(*entry));
- name8 = strdup_wchar_to_char(name);
+ RT->set_variable(efile->name, &efile->vendor, efile->attributes,
+ efile->size ? efile->size : 1, efile->buf);
- entry->name = asprintf("%s-%pUl", name8, &vendor);
+ f->size = efile->size;
- free(name8);
+ return 0;
+}
- if (!edir->first)
- edir->first = entry;
+static loff_t efivarfs_lseek(struct device_d *dev, FILE *f, loff_t pos)
+{
+ f->pos = pos;
- if (edir->current)
- edir->current->next = entry;
+ return f->pos;
+}
- edir->current = entry;
- }
+static DIR *efivarfs_opendir(struct device_d *dev, const char *pathname)
+{
+ struct efivarfs_priv *priv = dev->priv;
+ struct efivarfs_dir *edir;
- edir->current = edir->first;
+ edir = xzalloc(sizeof(*edir));
+ edir->current = priv->inodes.next;
return &edir->dir;
}
static struct dirent *efivarfs_readdir(struct device_d *dev, DIR *dir)
{
+ struct efivarfs_priv *priv = dev->priv;
struct efivarfs_dir *edir = container_of(dir, struct efivarfs_dir, dir);
+ struct efivarfs_inode *inode;
- if (!edir->current)
+ if (edir->current == &priv->inodes)
return NULL;
- strcpy(dir->d.d_name, edir->current->name);
+ inode = list_entry(edir->current, struct efivarfs_inode, node);
+
+ strcpy(dir->d.d_name, inode->full_name);
edir->current = edir->current->next;
@@ -264,17 +337,6 @@ static struct dirent *efivarfs_readdir(struct device_d *dev, DIR *dir)
static int efivarfs_closedir(struct device_d *dev, DIR *dir)
{
struct efivarfs_dir *edir = container_of(dir, struct efivarfs_dir, dir);
- struct efivarfs_dir_entry *entry;
-
- entry = edir->first;
-
- while (entry) {
- struct efivarfs_dir_entry *tmp;
- free(entry->name);
- tmp = entry->next;
- free(entry);
- entry = tmp;
- }
free(edir);
@@ -308,18 +370,64 @@ static int efivarfs_stat(struct device_d *dev, const char *filename, struct stat
static int efivarfs_probe(struct device_d *dev)
{
+ efi_status_t efiret;
+ efi_guid_t vendor;
+ s16 name[1024];
+ char *name8;
+ unsigned long size;
+ struct efivarfs_priv *priv;
+
+ name[0] = 0;
+
+ priv = xzalloc(sizeof(*priv));
+ INIT_LIST_HEAD(&priv->inodes);
+
+ while (1) {
+ struct efivarfs_inode *inode;
+
+ size = sizeof(name);
+ efiret = RT->get_next_variable(&size, name, &vendor);
+ if (EFI_ERROR(efiret))
+ break;
+
+ inode = xzalloc(sizeof(*inode));
+ inode->name = strdup_wchar(name);
+
+ inode->vendor = vendor;
+
+ name8 = strdup_wchar_to_char(inode->name);
+ inode->full_name = asprintf("%s-%pUl", name8, &vendor);
+ free(name8);
+
+ list_add_tail(&inode->node, &priv->inodes);
+ }
+
+ dev->priv = priv;
+
return 0;
}
static void efivarfs_remove(struct device_d *dev)
{
- free(dev->priv);
+ struct efivarfs_priv *priv = dev->priv;
+ struct efivarfs_inode *inode, *tmp;
+
+ list_for_each_entry_safe(inode, tmp, &priv->inodes, node) {
+ free(inode->name);
+ free(inode);
+ }
+
+ free(priv);
}
static struct fs_driver_d efivarfs_driver = {
+ .create = efivars_create,
+ .unlink = efivars_unlink,
.open = efivarfs_open,
.close = efivarfs_close,
.read = efivarfs_read,
+ .write = efivarfs_write,
+ .truncate = efivarfs_truncate,
.lseek = efivarfs_lseek,
.opendir = efivarfs_opendir,
.readdir = efivarfs_readdir,
diff --git a/include/driver.h b/include/driver.h
index 53e1000067..46aae4f433 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -206,6 +206,14 @@ void *dev_get_mem_region(struct device_d *dev, int num);
*/
void __iomem *dev_request_mem_region(struct device_d *dev, int num);
+/*
+ * exlusively request register base 'num' for a device
+ * will return NULL on error
+ * only used on platform like at91 where the Ressource address collision with
+ * PTR errno
+ */
+void __iomem *dev_request_mem_region_err_null(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);
diff --git a/include/efi.h b/include/efi.h
index 4ad9f69237..9b4f16bd9f 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -255,9 +255,11 @@ extern efi_boot_services_t *BS;
/*
* Types and defines for EFI ResetSystem
*/
-#define EFI_RESET_COLD 0
-#define EFI_RESET_WARM 1
-#define EFI_RESET_SHUTDOWN 2
+typedef enum {
+ EFI_RESET_COLD = 0,
+ EFI_RESET_WARM = 1,
+ EFI_RESET_SHUTDOWN = 2
+} efi_reset_type_t;
/*
* EFI Runtime Services table
@@ -277,9 +279,11 @@ typedef struct {
u32 *Attributes, unsigned long *data_size, void *data);
efi_status_t (EFIAPI *get_next_variable)(unsigned long *variable_name_size,
s16 *variable_name, efi_guid_t *vendor);
- void *set_variable;
+ efi_status_t (EFIAPI *set_variable)(s16 *variable_name, efi_guid_t *vendor,
+ u32 Attributes, unsigned long data_size, void *data);
void *get_next_high_mono_count;
- void *reset_system;
+ void (EFIAPI *reset_system)(efi_reset_type_t reset_type, efi_status_t reset_status,
+ unsigned long data_size, void *reset_data);
void *update_capsule;
void *query_capsule_caps;
void *query_variable_info;
@@ -465,6 +469,10 @@ extern efi_runtime_services_t *RT;
#define EFI_VLANCONFIGDXE_INF_GUID \
EFI_GUID(0xe4f61863, 0xfe2c, 0x4b56, 0xa8, 0xf4, 0x08, 0x51, 0x9b, 0xc4, 0x39, 0xdf)
+/* barebox specific GUIDs */
+#define EFI_BAREBOX_VENDOR_GUID \
+ EFI_GUID(0x5b91f69c, 0x8b88, 0x4a2b, 0x92, 0x69, 0x5f, 0x1d, 0x80, 0x2b, 0x51, 0x75)
+
extern efi_guid_t efi_file_info_id;
extern efi_guid_t efi_simple_file_system_protocol_guid;
extern efi_guid_t efi_device_path_protocol_guid;
@@ -615,6 +623,7 @@ static inline int efi_compare_guid(efi_guid_t *a, efi_guid_t *b)
}
char *device_path_to_str(struct efi_device_path *dev_path);
+u8 device_path_to_type(struct efi_device_path *dev_path);
const char *efi_guid_string(efi_guid_t *g);
diff --git a/include/wchar.h b/include/wchar.h
index 80dcd81bf4..702d8e239a 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -5,6 +5,8 @@
typedef u16 wchar_t;
+wchar_t *strdup_wchar(const wchar_t *src);
+
char *strcpy_wchar_to_char(char *dst, const wchar_t *src);
wchar_t *strcpy_char_to_wchar(wchar_t *dst, const char *src);
diff --git a/lib/wchar.c b/lib/wchar.c
index 6368a01994..b2e9e7545b 100644
--- a/lib/wchar.c
+++ b/lib/wchar.c
@@ -31,6 +31,22 @@ size_t wcslen(const wchar_t *s)
return len;
}
+wchar_t *strdup_wchar(const wchar_t *src)
+{
+ int len = wcslen(src);
+ wchar_t *tmp, *dst;
+
+ if (!(dst = malloc((len + 1) * sizeof(wchar_t))))
+ return NULL;
+
+ tmp = dst;
+
+ while ((*dst++ = *src++))
+ /* nothing */;
+
+ return tmp;
+}
+
char *strcpy_wchar_to_char(char *dst, const wchar_t *src)
{
char *ret = dst;