diff options
339 files changed, 2264 insertions, 1549 deletions
diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst index 98628faf9d..f26299efd9 100644 --- a/Documentation/user/booting-linux.rst +++ b/Documentation/user/booting-linux.rst @@ -99,6 +99,20 @@ with addpart to the Kernel: Kernel command line: mtdparts=physmap-flash.0:512k(bootloader),512k(env),4M(kernel),-(root); mxc_nand:1M(bootloader),1M(env),4M(kernel),-(root) +Creating root= options for the Kernel +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +It's a common case that the Linux Kernel is loaded from a filesystem +that later becomes the root filesystem for the Kernel. For several +filesystems barebox can automatically append a suitable root= option +to the Kernel command line. This is done when ``global.bootm.appendroot`` +is true. How the root= option is appended depends on the device type +and filesystem the kernel is booted from. For disk like devices (SD/MMC, +ATA) the partition UUID will be used, the root= option will be something +like ``root=PARTUUID=deadbeef-1``. For UBIFS fileystems it will be +``root=ubi0:volname ubi.mtd=mtdpartname rootfstype=ubifs``. NFS +filesystems will result in ``root=/dev/nfs nfsroot=ip:/path/to/nfsroot,v3,tcp``. +The ``v3,tcp`` part is configurable in ``global.linux.rootnfsopts``. The boot command ---------------- @@ -1,5 +1,5 @@ VERSION = 2016 -PATCHLEVEL = 04 +PATCHLEVEL = 05 SUBLEVEL = 0 EXTRAVERSION = NAME = None diff --git a/arch/arm/boards/animeo_ip/init.c b/arch/arm/boards/animeo_ip/init.c index 2069ab3764..14b33dc691 100644 --- a/arch/arm/boards/animeo_ip/init.c +++ b/arch/arm/boards/animeo_ip/init.c @@ -8,7 +8,6 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/archosg9/board.c b/arch/arm/boards/archosg9/board.c index 6f82f5ee26..52f7e86fbe 100644 --- a/arch/arm/boards/archosg9/board.c +++ b/arch/arm/boards/archosg9/board.c @@ -13,7 +13,6 @@ #include <common.h> #include <clock.h> #include <init.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <mach/omap4-silicon.h> diff --git a/arch/arm/boards/at91sam9261ek/init.c b/arch/arm/boards/at91sam9261ek/init.c index 6cb170192a..b9e4914376 100644 --- a/arch/arm/boards/at91sam9261ek/init.c +++ b/arch/arm/boards/at91sam9261ek/init.c @@ -34,7 +34,7 @@ #include <mach/io.h> #include <mach/iomux.h> #include <mach/at91sam9_smc.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <gpio_keys.h> #include <readkey.h> #include <led.h> diff --git a/arch/arm/boards/at91sam9n12ek/init.c b/arch/arm/boards/at91sam9n12ek/init.c index 26d08ae659..2ed58c1995 100644 --- a/arch/arm/boards/at91sam9n12ek/init.c +++ b/arch/arm/boards/at91sam9n12ek/init.c @@ -18,7 +18,6 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/at91sam9x5ek/init.c b/arch/arm/boards/at91sam9x5ek/init.c index e0c11a11e1..1ef35803f7 100644 --- a/arch/arm/boards/at91sam9x5ek/init.c +++ b/arch/arm/boards/at91sam9x5ek/init.c @@ -18,7 +18,6 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c index 4ac9517dbe..460f42ac2d 100644 --- a/arch/arm/boards/beagle/board.c +++ b/arch/arm/boards/beagle/board.c @@ -23,7 +23,6 @@ #include <io.h> #include <bbu.h> #include <filetype.h> -#include <ns16550.h> #include <envfs.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/ccxmx51/ccxmx51.c b/arch/arm/boards/ccxmx51/ccxmx51.c index 40cf76dc5a..71a51e1927 100644 --- a/arch/arm/boards/ccxmx51/ccxmx51.c +++ b/arch/arm/boards/ccxmx51/ccxmx51.c @@ -20,7 +20,7 @@ #include <init.h> #include <environment.h> #include <mach/imx51-regs.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/crystalfontz-cfa10036/cfa10036.c b/arch/arm/boards/crystalfontz-cfa10036/cfa10036.c index 6e83570c55..947db7cff6 100644 --- a/arch/arm/boards/crystalfontz-cfa10036/cfa10036.c +++ b/arch/arm/boards/crystalfontz-cfa10036/cfa10036.c @@ -19,7 +19,6 @@ #include <environment.h> #include <envfs.h> #include <errno.h> -#include <fec.h> #include <gpio.h> #include <init.h> #include <mci.h> diff --git a/arch/arm/boards/datamodul-edm-qmx6/board.c b/arch/arm/boards/datamodul-edm-qmx6/board.c index 96c7fbe4bf..043a93461b 100644 --- a/arch/arm/boards/datamodul-edm-qmx6/board.c +++ b/arch/arm/boards/datamodul-edm-qmx6/board.c @@ -26,7 +26,6 @@ #include <linux/sizes.h> #include <init.h> #include <gpio.h> -#include <fec.h> #include <of.h> #include <linux/micrel_phy.h> diff --git a/arch/arm/boards/dss11/init.c b/arch/arm/boards/dss11/init.c index feca909c27..321c383ffc 100644 --- a/arch/arm/boards/dss11/init.c +++ b/arch/arm/boards/dss11/init.c @@ -17,7 +17,6 @@ #include <mci.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/edb93xx/edb93xx.c b/arch/arm/boards/edb93xx/edb93xx.c index 0fb93d23dc..99c69548bd 100644 --- a/arch/arm/boards/edb93xx/edb93xx.c +++ b/arch/arm/boards/edb93xx/edb93xx.c @@ -27,7 +27,7 @@ #include <malloc.h> #include <generated/mach-types.h> #include <mach/ep93xx-regs.h> -#include <net/ep93xx_eth.h> +#include <platform_data/eth-ep93xx.h> #include "edb93xx.h" #define DEVCFG_U1EN (1 << 18) @@ -123,7 +123,7 @@ static int edb93xx_console_init(void) else shortname = "unknown"; - board = asprintf("Cirrus Logic %s", shortname); + board = basprintf("Cirrus Logic %s", shortname); barebox_set_model(board); free(board); barebox_set_hostname(shortname); diff --git a/arch/arm/boards/embedsky-e9/board.c b/arch/arm/boards/embedsky-e9/board.c index 23bfec1b77..0f47677bb0 100644 --- a/arch/arm/boards/embedsky-e9/board.c +++ b/arch/arm/boards/embedsky-e9/board.c @@ -22,7 +22,6 @@ #include <init.h> #include <environment.h> #include <mach/imx6-regs.h> -#include <fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> @@ -70,8 +69,8 @@ static int e9_devices_init(void) armlinux_set_architecture(3980); - environment_path = asprintf("/chosen/environment-mmc%d", - bootsource_get_instance()); + environment_path = basprintf("/chosen/environment-mmc%d", + bootsource_get_instance()); ret = of_device_enable_path(environment_path); diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index 22bf7409a2..90451911e4 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -36,7 +36,7 @@ #include <mach/imx-nand.h> #include <mach/imxfb.h> #include <mach/iim.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <nand.h> #include <mach/iomux-mx25.h> #include <i2c/i2c.h> diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index 31422e64a0..f27dcd6f44 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -1,7 +1,7 @@ /* * Copyright (C) 2009 Eric Benard, Eukrea Electromatique * Based on pcm038.c which is : - * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -22,7 +22,6 @@ #include <init.h> #include <environment.h> #include <mach/imx27-regs.h> -#include <fec.h> #include <notifier.h> #include <gpio.h> #include <asm/armlinux.h> @@ -39,7 +38,7 @@ #include <mach/imx-pll.h> #include <mach/weim.h> #include <mach/imxfb.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <asm/mmu.h> #include <i2c/i2c.h> #include <mfd/lp3972.h> diff --git a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c index 7b3993d506..9c4ea13d8e 100644 --- a/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c +++ b/arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c @@ -27,7 +27,7 @@ #include <environment.h> #include <errno.h> #include <fcntl.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <fs.h> #include <init.h> #include <nand.h> diff --git a/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c b/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c index 75f325001b..fc57f6c157 100644 --- a/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c +++ b/arch/arm/boards/eukrea_cpuimx51/eukrea_cpuimx51.c @@ -20,7 +20,7 @@ #include <init.h> #include <environment.h> #include <mach/imx51-regs.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/freescale-mx21-ads/imx21ads.c b/arch/arm/boards/freescale-mx21-ads/imx21ads.c index 5f0e7bda63..8afe9ace51 100644 --- a/arch/arm/boards/freescale-mx21-ads/imx21ads.c +++ b/arch/arm/boards/freescale-mx21-ads/imx21ads.c @@ -1,8 +1,8 @@ /* * Copyright (C) 2009 Ivo Clarysse - * + * * Based on imx27ads.c, - * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c index 6348692cb1..dd8048851b 100644 --- a/arch/arm/boards/freescale-mx23-evk/mx23-evk.c +++ b/arch/arm/boards/freescale-mx23-evk/mx23-evk.c @@ -139,7 +139,7 @@ static int mx23_evk_console_init(void) add_generic_device("stm_serial", 0, NULL, IMX_DBGUART_BASE, 8192, IORESOURCE_MEM, NULL); - + return 0; } diff --git a/arch/arm/boards/freescale-mx25-3ds/3stack.c b/arch/arm/boards/freescale-mx25-3ds/3stack.c index 6d0e38205a..36ad591cc0 100644 --- a/arch/arm/boards/freescale-mx25-3ds/3stack.c +++ b/arch/arm/boards/freescale-mx25-3ds/3stack.c @@ -30,7 +30,7 @@ #include <partition.h> #include <generated/mach-types.h> #include <mach/imx-nand.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <nand.h> #include <mach/iomux-mx25.h> #include <mach/generic.h> diff --git a/arch/arm/boards/freescale-mx27-ads/imx27ads.c b/arch/arm/boards/freescale-mx27-ads/imx27ads.c index 9fb1760602..9818a55137 100644 --- a/arch/arm/boards/freescale-mx27-ads/imx27ads.c +++ b/arch/arm/boards/freescale-mx27-ads/imx27ads.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,7 +21,7 @@ #include <mach/imx27-regs.h> #include <asm/armlinux.h> #include <io.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <gpio.h> #include <mach/weim.h> #include <partition.h> diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c index fc1237588f..9e5d612bda 100644 --- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c +++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c @@ -17,7 +17,7 @@ #include <common.h> #include <environment.h> #include <errno.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <gpio.h> #include <init.h> #include <mci.h> diff --git a/arch/arm/boards/freescale-mx35-3ds/3stack.c b/arch/arm/boards/freescale-mx35-3ds/3stack.c index cca0fe49eb..caeb3f75e8 100644 --- a/arch/arm/boards/freescale-mx35-3ds/3stack.c +++ b/arch/arm/boards/freescale-mx35-3ds/3stack.c @@ -25,7 +25,7 @@ #include <environment.h> #include <errno.h> #include <fcntl.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <fs.h> #include <init.h> #include <nand.h> diff --git a/arch/arm/boards/freescale-mx51-babbage/board.c b/arch/arm/boards/freescale-mx51-babbage/board.c index c4acb8ee16..915748528d 100644 --- a/arch/arm/boards/freescale-mx51-babbage/board.c +++ b/arch/arm/boards/freescale-mx51-babbage/board.c @@ -20,7 +20,6 @@ #include <init.h> #include <environment.h> #include <mach/imx51-regs.h> -#include <fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/freescale-mx53-smd/board.c b/arch/arm/boards/freescale-mx53-smd/board.c index 196d20a45d..354702dea1 100644 --- a/arch/arm/boards/freescale-mx53-smd/board.c +++ b/arch/arm/boards/freescale-mx53-smd/board.c @@ -17,7 +17,7 @@ #include <common.h> #include <environment.h> #include <fcntl.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <fs.h> #include <init.h> #include <nand.h> diff --git a/arch/arm/boards/freescale-mx6-sabrelite/board.c b/arch/arm/boards/freescale-mx6-sabrelite/board.c index d40f99bb93..63fa58886c 100644 --- a/arch/arm/boards/freescale-mx6-sabrelite/board.c +++ b/arch/arm/boards/freescale-mx6-sabrelite/board.c @@ -18,7 +18,6 @@ #include <init.h> #include <environment.h> #include <mach/imx6-regs.h> -#include <fec.h> #include <gpio.h> #include <mach/bbu.h> #include <asm/armlinux.h> diff --git a/arch/arm/boards/freescale-mx6-sabresd/board.c b/arch/arm/boards/freescale-mx6-sabresd/board.c index 734adde070..595b1eae0b 100644 --- a/arch/arm/boards/freescale-mx6-sabresd/board.c +++ b/arch/arm/boards/freescale-mx6-sabresd/board.c @@ -19,7 +19,6 @@ #include <init.h> #include <environment.h> #include <mach/imx6-regs.h> -#include <fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/friendlyarm-mini2440/mini2440.c b/arch/arm/boards/friendlyarm-mini2440/mini2440.c index b59c8367f3..7f59cb99b2 100644 --- a/arch/arm/boards/friendlyarm-mini2440/mini2440.c +++ b/arch/arm/boards/friendlyarm-mini2440/mini2440.c @@ -21,7 +21,7 @@ #include <init.h> #include <generated/mach-types.h> #include <partition.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <nand.h> #include <mci.h> #include <fb.h> diff --git a/arch/arm/boards/friendlyarm-mini6410/mini6410.c b/arch/arm/boards/friendlyarm-mini6410/mini6410.c index a372db5471..a85b1bd920 100644 --- a/arch/arm/boards/friendlyarm-mini6410/mini6410.c +++ b/arch/arm/boards/friendlyarm-mini6410/mini6410.c @@ -14,7 +14,7 @@ #include <common.h> #include <driver.h> #include <init.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <gpio.h> #include <generated/mach-types.h> #include <asm/armlinux.h> diff --git a/arch/arm/boards/friendlyarm-tiny210/tiny210.c b/arch/arm/boards/friendlyarm-tiny210/tiny210.c index d84b3128ad..b40dc98c5b 100644 --- a/arch/arm/boards/friendlyarm-tiny210/tiny210.c +++ b/arch/arm/boards/friendlyarm-tiny210/tiny210.c @@ -29,7 +29,6 @@ #include <init.h> #include <linux/sizes.h> #include <generated/mach-types.h> -#include <dm9000.h> #include <gpio.h> #include <led.h> #include <io.h> diff --git a/arch/arm/boards/friendlyarm-tiny6410/development-board.c b/arch/arm/boards/friendlyarm-tiny6410/development-board.c index 773a423ea0..5dd05e4cc8 100644 --- a/arch/arm/boards/friendlyarm-tiny6410/development-board.c +++ b/arch/arm/boards/friendlyarm-tiny6410/development-board.c @@ -23,7 +23,7 @@ #include <driver.h> #include <init.h> #include <gpio.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <mach/devices-s3c64xx.h> #include <mach/s3c-generic.h> #include <mach/iomux.h> diff --git a/arch/arm/boards/guf-cupid/board.c b/arch/arm/boards/guf-cupid/board.c index 90f16272fd..6ec74eb49b 100644 --- a/arch/arm/boards/guf-cupid/board.c +++ b/arch/arm/boards/guf-cupid/board.c @@ -33,7 +33,7 @@ #include <nand.h> #include <generated/mach-types.h> #include <mach/imx-nand.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <fb.h> #include <asm/mmu.h> #include <mach/weim.h> diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c index f40f0d1591..176d77e7b3 100644 --- a/arch/arm/boards/guf-neso/board.c +++ b/arch/arm/boards/guf-neso/board.c @@ -18,7 +18,7 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <notifier.h> #include <partition.h> #include <gpio.h> diff --git a/arch/arm/boards/guf-vincell/board.c b/arch/arm/boards/guf-vincell/board.c index ad47ee2558..43c195254e 100644 --- a/arch/arm/boards/guf-vincell/board.c +++ b/arch/arm/boards/guf-vincell/board.c @@ -40,7 +40,8 @@ static void vincell_fec_reset(void) static int vincell_devices_init(void) { - if (!of_machine_is_compatible("guf,imx53-vincell")) + if (!of_machine_is_compatible("guf,imx53-vincell") && + !of_machine_is_compatible("guf,imx53-vincell-lt")) return 0; writel(0, MX53_M4IF_BASE_ADDR + 0xc); diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c index d67607b717..ec0826297b 100644 --- a/arch/arm/boards/karo-tx28/tx28-stk5.c +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c @@ -18,7 +18,7 @@ #include <environment.h> #include <errno.h> #include <mci.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <linux/sizes.h> #include <io.h> #include <net.h> diff --git a/arch/arm/boards/karo-tx51/tx51.c b/arch/arm/boards/karo-tx51/tx51.c index f5ebe46a2b..913df68cc9 100644 --- a/arch/arm/boards/karo-tx51/tx51.c +++ b/arch/arm/boards/karo-tx51/tx51.c @@ -19,7 +19,7 @@ #include <init.h> #include <environment.h> #include <mach/imx51-regs.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/karo-tx53/board.c b/arch/arm/boards/karo-tx53/board.c index 9e65a839ad..99aa9e74f5 100644 --- a/arch/arm/boards/karo-tx53/board.c +++ b/arch/arm/boards/karo-tx53/board.c @@ -16,7 +16,7 @@ #include <bootsource.h> #include <environment.h> #include <fcntl.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <fs.h> #include <init.h> #include <nand.h> diff --git a/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg b/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg new file mode 100644 index 0000000000..455aab92ca --- /dev/null +++ b/arch/arm/boards/karo-tx6x/flash-header-tx6qp-2g.imxcfg @@ -0,0 +1,183 @@ +soc imx6 +loadaddr 0x20000000 +dcdofs 0x400 + +wm 32 0x020e00a4 0x00000016 +wm 32 0x020e00c4 0x00000011 +wm 32 0x020e03b8 0x0000f079 +wm 32 0x020e03d8 0x0000f079 +wm 32 0x020e0898 0x00000000 +wm 32 0x020e089c 0x00000000 +wm 32 0x020e0248 0x00000012 +wm 32 0x020e02c8 0x00000015 +wm 32 0x020e06b0 0x000030b0 +wm 32 0x020e00a0 0x00000015 +wm 32 0x020e03b4 0x000030b0 +wm 32 0x020e024c 0x00000005 +wm 32 0x020e061c 0x000030b0 +wm 32 0x020c402c 0x006336c1 +wm 32 0x020c4034 0x00012093 +wm 32 0x020c4038 0x00012090 +wm 32 0x020c80e0 0x00002001 +set_bits 32 0x020c4068 0x00000030 +set_bits 32 0x020c406c 0x00000c00 +set_bits 32 0x020c4070 0x000000c0 +set_bits 32 0x020c4078 0xff000000 +set_bits 32 0x020c407c 0x0f000000 +set_bits 32 0x020c4080 0x000003fc +wm 32 0x020c80a0 0x00082029 +wm 32 0x020c80b0 0x0007a120 +wm 32 0x020c80c0 0x000f4240 +wm 32 0x020e0004 0x48640005 +wm 32 0x020e0010 0xf00000cf +wm 32 0x020e0018 0x77177717 +wm 32 0x020e001c 0x77177717 +wm 32 0x020e02a8 0x00000001 +wm 32 0x020e02ac 0x00000001 +wm 32 0x020e0920 0x00000003 +wm 32 0x020e02c0 0x00000001 +wm 32 0x020e02c4 0x00000001 +wm 32 0x020e091c 0x00000003 +wm 32 0x020e02ec 0x00000000 +wm 32 0x020e05ac 0x00020030 +wm 32 0x020e05b4 0x00020030 +wm 32 0x020e0528 0x00020030 +wm 32 0x020e0520 0x00020030 +wm 32 0x020e0514 0x00020030 +wm 32 0x020e0510 0x00020030 +wm 32 0x020e05bc 0x00020030 +wm 32 0x020e05c4 0x00020030 +wm 32 0x020e052c 0x00020200 +wm 32 0x020e0530 0x00020200 +wm 32 0x020e0534 0x00020200 +wm 32 0x020e0538 0x00020200 +wm 32 0x020e053c 0x00020200 +wm 32 0x020e0540 0x00020200 +wm 32 0x020e0544 0x00020200 +wm 32 0x020e0548 0x00020200 +wm 32 0x020e054c 0x00020200 +wm 32 0x020e0550 0x00020200 +wm 32 0x020e0554 0x00020200 +wm 32 0x020e0558 0x00020200 +wm 32 0x020e055c 0x00020200 +wm 32 0x020e0560 0x00020200 +wm 32 0x020e0564 0x00020200 +wm 32 0x020e0568 0x00020200 +wm 32 0x020e056c 0x00020030 +wm 32 0x020e0578 0x00020030 +wm 32 0x020e0588 0x00020030 +wm 32 0x020e0594 0x00020030 +wm 32 0x020e057c 0x00020030 +wm 32 0x020e0590 0x00003000 +wm 32 0x020e0598 0x00003000 +wm 32 0x020e0580 0x00000000 +wm 32 0x020e0584 0x00000000 +wm 32 0x020e058c 0x00000000 +wm 32 0x020e059c 0x00003030 +wm 32 0x020e05a0 0x00003030 +wm 32 0x020e0784 0x00000030 +wm 32 0x020e0788 0x00000030 +wm 32 0x020e0794 0x00000030 +wm 32 0x020e079c 0x00000030 +wm 32 0x020e07a0 0x00000030 +wm 32 0x020e07a4 0x00000030 +wm 32 0x020e07a8 0x00000030 +wm 32 0x020e0748 0x00000030 +wm 32 0x020e074c 0x00000030 +wm 32 0x020e0750 0x00020000 +wm 32 0x020e0758 0x00000000 +wm 32 0x020e0774 0x00020000 +wm 32 0x020e078c 0x00000030 +wm 32 0x020e0798 0x000c0000 +wm 32 0x020e0768 0x00002000 +wm 32 0x020e0770 0x00000000 +wm 32 0x020e0754 0x00000200 +wm 32 0x020e075c 0x00000200 +wm 32 0x020e0760 0x00000200 +wm 32 0x020e0764 0x00000200 +wm 32 0x020e076c 0x00000200 +wm 32 0x020e0778 0x00000200 +wm 32 0x020e077c 0x00000200 +wm 32 0x020e0780 0x00000200 +wm 32 0x021b001c 0x04008010 +wm 32 0x021b001c 0x04008040 +wm 32 0x021b0800 0xa1390001 +wm 32 0x021b080c 0x001e001e +wm 32 0x021b0810 0x001e001e +wm 32 0x021b480c 0x001e001e +wm 32 0x021b4810 0x001e001e +wm 32 0x021b083c 0x43430349 +wm 32 0x021b0840 0x03330334 +wm 32 0x021b483c 0x434b0351 +wm 32 0x021b4840 0x033d030e +wm 32 0x021b0848 0x40404040 +wm 32 0x021b0850 0x40404040 +wm 32 0x021b4848 0x40404040 +wm 32 0x021b4850 0x40404040 +wm 32 0x021b081c 0x33333333 +wm 32 0x021b0820 0x33333333 +wm 32 0x021b0824 0x33333333 +wm 32 0x021b0828 0x33333333 +wm 32 0x021b481c 0x33333333 +wm 32 0x021b4820 0x33333333 +wm 32 0x021b4824 0x33333333 +wm 32 0x021b4828 0x33333333 +wm 32 0x021b08b8 0x00000800 +wm 32 0x021b48b8 0x00000800 +wm 32 0x021b0018 0x00000742 +check 32 while_all_bits_clear 0x021b0018 0x00000002 +wm 32 0x021b001c 0x00008000 +check 32 while_any_bit_clear 0x021b001c 0x00004000 +wm 32 0x021b0000 0x841a0000 +check 32 while_any_bit_clear 0x021b0018 0x40000000 +wm 32 0x021b000c 0x898f78f4 +wm 32 0x021b0010 0xff328e64 +wm 32 0x021b0014 0x01ff00db +wm 32 0x021b002c 0x000026d2 +wm 32 0x021b0030 0x008f1023 +wm 32 0x021b0008 0x24444040 +wm 32 0x021b0004 0x00020076 +wm 32 0x021b0040 0x00000047 +wm 32 0x021b001c 0x09308030 +wm 32 0x021b001c 0x00048031 +wm 32 0x021b001c 0x00488032 +wm 32 0x021b001c 0x00008033 +wm 32 0x021b0020 0x0000c000 +wm 32 0x021b001c 0x00008020 +wm 32 0x021b0818 0x00022222 +wm 32 0x021b4818 0x00022222 +wm 32 0x021b0890 0x00000003 +set_bits 32 0x021b0400 0x02000000 +wm 32 0x021b0404 0x00000001 +wm 32 0x021b001c 0x04008010 +wm 32 0x021b001c 0x04008040 +wm 32 0x021b0800 0xa1390001 +check 32 while_all_bits_clear 0x021b0800 0x00010000 +wm 32 0x021b0800 0xa1380000 +wm 32 0x021b001c 0x00048033 +wm 32 0x020e05a8 0x00000030 +wm 32 0x020e05b0 0x00000030 +wm 32 0x020e0524 0x00000030 +wm 32 0x020e051c 0x00000030 +wm 32 0x020e0518 0x00000030 +wm 32 0x020e050c 0x00000030 +wm 32 0x020e05b8 0x00000030 +wm 32 0x020e05c0 0x00000030 +wm 32 0x021b001c 0x04008050 +wm 32 0x021b0860 0x00000030 +wm 32 0x021b4860 0x00000030 +check 32 while_all_bits_clear 0x021b0860 0x0000001f +check 32 while_all_bits_clear 0x021b4860 0x0000001f +wm 32 0x021b001c 0x04008050 +wm 32 0x021b0864 0x00000030 +check 32 while_all_bits_clear 0x021b0864 0x0000001f +wm 32 0x021b001c 0x04008050 +wm 32 0x021b4864 0x00000030 +check 32 while_all_bits_clear 0x021b4864 0x0000001f +wm 32 0x021b001c 0x00008033 +wm 32 0x021b0800 0xa138002b +wm 32 0x021b0020 0x00001800 +wm 32 0x021b0404 0x00001000 +wm 32 0x021b0004 0x00025576 +wm 32 0x021b001c 0x00000000 +check 32 while_all_bits_clear 0x021b001c 0x00004000 diff --git a/arch/arm/boards/karo-tx6x/lowlevel.c b/arch/arm/boards/karo-tx6x/lowlevel.c index 1aa24c5842..459c44b845 100644 --- a/arch/arm/boards/karo-tx6x/lowlevel.c +++ b/arch/arm/boards/karo-tx6x/lowlevel.c @@ -77,3 +77,23 @@ ENTRY_FUNCTION(start_imx6q_tx6x_1g, r0, r1, r2) imx6q_barebox_entry(fdt); } + +BAREBOX_IMD_TAG_STRING(tx6x_mx6_memsize_2G, IMD_TYPE_PARAMETER, "memsize=2048", 0); + +ENTRY_FUNCTION(start_imx6q_tx6x_2g, r0, r1, r2) +{ + void *fdt; + + imx6_cpu_lowlevel_init(); + + arm_setup_stack(0x00920000 - 8); + + IMD_USED(tx6x_mx6_memsize_2G); + + if (IS_ENABLED(CONFIG_DEBUG_LL)) + setup_uart(); + + fdt = __dtb_imx6q_tx6q_start - get_runtime_offset(); + + imx6q_barebox_entry(fdt); +} diff --git a/arch/arm/boards/lubbock/board.c b/arch/arm/boards/lubbock/board.c index 6f517d8926..c2a0db7bd8 100644 --- a/arch/arm/boards/lubbock/board.c +++ b/arch/arm/boards/lubbock/board.c @@ -33,7 +33,7 @@ #include <mach/udc_pxa2xx.h> #include <mach/mci_pxa2xx.h> -#include <net/smc91111.h> +#include <platform_data/eth-smc91111.h> #include <asm/armlinux.h> #include <asm/io.h> #include <asm/mmu.h> diff --git a/arch/arm/boards/mainstone/board.c b/arch/arm/boards/mainstone/board.c index c339bb9315..0e48e79967 100644 --- a/arch/arm/boards/mainstone/board.c +++ b/arch/arm/boards/mainstone/board.c @@ -33,7 +33,7 @@ #include <mach/udc_pxa2xx.h> #include <mach/mci_pxa2xx.h> -#include <net/smc91111.h> +#include <platform_data/eth-smc91111.h> #include <asm/armlinux.h> #include <asm/io.h> #include <asm/mmu.h> diff --git a/arch/arm/boards/mmccpu/init.c b/arch/arm/boards/mmccpu/init.c index 8979b818b0..747c4b2742 100644 --- a/arch/arm/boards/mmccpu/init.c +++ b/arch/arm/boards/mmccpu/init.c @@ -18,7 +18,6 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <gpio.h> #include <asm/armlinux.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/omap343xdsp/board.c b/arch/arm/boards/omap343xdsp/board.c index 1b1cb79212..2fd0dee194 100644 --- a/arch/arm/boards/omap343xdsp/board.c +++ b/arch/arm/boards/omap343xdsp/board.c @@ -20,7 +20,6 @@ #include <init.h> #include <driver.h> #include <io.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <mach/omap3-silicon.h> #include <mach/omap3-devices.h> diff --git a/arch/arm/boards/omap3evm/board.c b/arch/arm/boards/omap3evm/board.c index 0fe69b61a7..eefb540fc1 100644 --- a/arch/arm/boards/omap3evm/board.c +++ b/arch/arm/boards/omap3evm/board.c @@ -44,7 +44,6 @@ #include <driver.h> #include <io.h> #include <linux/sizes.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <mach/omap3-silicon.h> #include <mach/omap3-mux.h> diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c index f7a3a0fa28..acba689623 100644 --- a/arch/arm/boards/panda/board.c +++ b/arch/arm/boards/panda/board.c @@ -4,7 +4,6 @@ #include <driver.h> #include <io.h> #include <gpio.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <mach/omap4-silicon.h> diff --git a/arch/arm/boards/phytec-phycard-imx27/pca100.c b/arch/arm/boards/phytec-phycard-imx27/pca100.c index 0481113c65..b0fee46d3b 100644 --- a/arch/arm/boards/phytec-phycard-imx27/pca100.c +++ b/arch/arm/boards/phytec-phycard-imx27/pca100.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -19,7 +19,6 @@ #include <init.h> #include <environment.h> #include <mach/imx27-regs.h> -#include <fec.h> #include <gpio.h> #include <linux/sizes.h> #include <asm/armlinux.h> diff --git a/arch/arm/boards/phytec-phycard-omap3/pca-a-l1.c b/arch/arm/boards/phytec-phycard-omap3/pca-a-l1.c index 1c2e7f7429..930f3b9c7c 100644 --- a/arch/arm/boards/phytec-phycard-omap3/pca-a-l1.c +++ b/arch/arm/boards/phytec-phycard-omap3/pca-a-l1.c @@ -44,7 +44,6 @@ #include <errno.h> #include <init.h> #include <nand.h> -#include <ns16550.h> #include <partition.h> #include <linux/sizes.h> #include <asm/armlinux.h> diff --git a/arch/arm/boards/phytec-phycard-omap4/pca-a-xl2.c b/arch/arm/boards/phytec-phycard-omap4/pca-a-xl2.c index 78890ba5a9..c0e4448a00 100644 --- a/arch/arm/boards/phytec-phycard-omap4/pca-a-xl2.c +++ b/arch/arm/boards/phytec-phycard-omap4/pca-a-xl2.c @@ -20,7 +20,6 @@ #include <driver.h> #include <io.h> #include <gpio.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <mach/omap4-silicon.h> diff --git a/arch/arm/boards/phytec-phycore-imx27/pcm038.c b/arch/arm/boards/phytec-phycore-imx27/pcm038.c index 01f6a55ad0..f1f808116c 100644 --- a/arch/arm/boards/phytec-phycore-imx27/pcm038.c +++ b/arch/arm/boards/phytec-phycore-imx27/pcm038.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Sascha Hauer, Pengutronix + * Copyright (C) 2007 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/arch/arm/boards/phytec-phycore-imx27/pcm970.c b/arch/arm/boards/phytec-phycore-imx27/pcm970.c index 73df2ad2a8..13bb7c1cf5 100644 --- a/arch/arm/boards/phytec-phycore-imx27/pcm970.c +++ b/arch/arm/boards/phytec-phycore-imx27/pcm970.c @@ -15,7 +15,7 @@ #include <gpio.h> #include <init.h> #include <io.h> -#include <platform_ide.h> +#include <platform_data/ide.h> #include <linux/sizes.h> #include <mach/imx27-regs.h> #include <mach/iomux-mx27.h> diff --git a/arch/arm/boards/phytec-phycore-imx31/pcm037.c b/arch/arm/boards/phytec-phycore-imx31/pcm037.c index a1ffb2e73e..39e7838be0 100644 --- a/arch/arm/boards/phytec-phycore-imx31/pcm037.c +++ b/arch/arm/boards/phytec-phycore-imx31/pcm037.c @@ -31,7 +31,7 @@ #include <asm/sections.h> #include <mach/weim.h> #include <io.h> -#include <smc911x.h> +#include <platform_data/eth-smc911x.h> #include <asm/mmu.h> #include <partition.h> #include <generated/mach-types.h> diff --git a/arch/arm/boards/phytec-phycore-imx35/pcm043.c b/arch/arm/boards/phytec-phycore-imx35/pcm043.c index e31c79d15f..b83698b90a 100644 --- a/arch/arm/boards/phytec-phycore-imx35/pcm043.c +++ b/arch/arm/boards/phytec-phycore-imx35/pcm043.c @@ -34,7 +34,6 @@ #include <nand.h> #include <generated/mach-types.h> #include <mach/imx-nand.h> -#include <fec.h> #include <fb.h> #include <led.h> #include <bootsource.h> diff --git a/arch/arm/boards/phytec-phycore-omap4460/board.c b/arch/arm/boards/phytec-phycore-omap4460/board.c index 6495a6f6ab..807cdd677d 100644 --- a/arch/arm/boards/phytec-phycore-omap4460/board.c +++ b/arch/arm/boards/phytec-phycore-omap4460/board.c @@ -20,7 +20,6 @@ #include <driver.h> #include <gpio.h> #include <io.h> -#include <ns16550.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <mach/omap4-silicon.h> diff --git a/arch/arm/boards/phytec-som-am335x/lowlevel.c b/arch/arm/boards/phytec-som-am335x/lowlevel.c index 73e75eb491..33e83c5a8e 100644 --- a/arch/arm/boards/phytec-som-am335x/lowlevel.c +++ b/arch/arm/boards/phytec-som-am335x/lowlevel.c @@ -125,6 +125,7 @@ PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_sram_2x512mb, am335x_phytec_phycore PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_sram_1024mb, am335x_phytec_phycore_som_mlo, PHYCORE_IM8G16D3FBBG15EI_1024MB); PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_512mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K256M16TW107IT_512MB); PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_256mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K128M16JT_256MB); +PHYTEC_ENTRY_MLO(start_am33xx_phytec_phycore_r2_sram_1024mb, am335x_phytec_phycore_som_mlo, PHYCORE_R2_MT41K512M16HA125IT_1024MB); PHYTEC_ENTRY(start_am33xx_phytec_phycore_sdram, am335x_phytec_phycore_som); PHYTEC_ENTRY(start_am33xx_phytec_phycore_no_spi_sdram, am335x_phytec_phycore_som_no_spi); PHYTEC_ENTRY(start_am33xx_phytec_phycore_no_eeprom_sdram, am335x_phytec_phycore_som_no_eeprom); diff --git a/arch/arm/boards/phytec-som-am335x/ram-timings.h b/arch/arm/boards/phytec-som-am335x/ram-timings.h index 884874caf7..9576d265e5 100644 --- a/arch/arm/boards/phytec-som-am335x/ram-timings.h +++ b/arch/arm/boards/phytec-som-am335x/ram-timings.h @@ -32,6 +32,7 @@ enum { PHYCORE_IM8G16D3FBBG15EI_1024MB, PHYCORE_R2_MT41K256M16TW107IT_512MB, PHYCORE_R2_MT41K128M16JT_256MB, + PHYCORE_R2_MT41K512M16HA125IT_1024MB, PHYCARD_NT5CB128M16BP_256MB, }; @@ -232,6 +233,25 @@ struct am335x_sdram_timings physom_timings[] = { .wr_slave_ratio0 = 0x73, }, }, + + /* 1024MB R2 */ + [PHYCORE_R2_MT41K512M16HA125IT_1024MB] = { + .regs = { + .emif_read_latency = 0x7, + .emif_tim1 = 0x0AAAD4DB, + .emif_tim2 = 0x268F7FDA, + .emif_tim3 = 0x501F88BF, + .sdram_config = 0x61C053B2, + .zq_config = 0x50074BE4, + .sdram_ref_ctrl = 0x00000C30, + }, + .data = { + .rd_slave_ratio0 = 0x38, + .wr_dqs_slave_ratio0 = 0x4d, + .fifo_we_slave_ratio0 = 0x9d, + .wr_slave_ratio0 = 0x82, + }, + }, }; #endif diff --git a/arch/arm/boards/phytec-som-imx6/Makefile b/arch/arm/boards/phytec-som-imx6/Makefile index c61e9cddcf..2f9c4a8a8f 100644 --- a/arch/arm/boards/phytec-som-imx6/Makefile +++ b/arch/arm/boards/phytec-som-imx6/Makefile @@ -1,4 +1,4 @@ obj-y += board.o lwl-y += lowlevel.o bbenv-y += defaultenv-physom-imx6 -bbenv-y += defaultenv-physom-imx6-mira +bbenv-y += defaultenv-physom-imx6-phycore diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c index 85ad8cb5e2..930ad74d74 100644 --- a/arch/arm/boards/phytec-som-imx6/board.c +++ b/arch/arm/boards/phytec-som-imx6/board.c @@ -29,7 +29,8 @@ #include <init.h> #include <of.h> #include <mach/bbu.h> -#include <fec.h> +#include <platform_data/eth-fec.h> + #include <globalvar.h> #include <linux/micrel_phy.h> @@ -113,7 +114,8 @@ static int physom_imx6_devices_init(void) } else if (of_machine_is_compatible("phytec,imx6q-pcm058-nand") || of_machine_is_compatible("phytec,imx6q-pcm058-emmc") - || of_machine_is_compatible("phytec,imx6dl-pcm058-nand")) { + || of_machine_is_compatible("phytec,imx6dl-pcm058-nand") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { barebox_set_hostname("phyCORE-i.MX6"); default_environment_path = "/chosen/environment-spinor"; @@ -124,20 +126,20 @@ static int physom_imx6_devices_init(void) switch (bootsource_get()) { case BOOTSOURCE_MMC: - environment_path = asprintf("/chosen/environment-sd%d", - bootsource_get_instance() + 1); + environment_path = basprintf("/chosen/environment-sd%d", + bootsource_get_instance() + 1); envdev = "MMC"; break; case BOOTSOURCE_NAND: - environment_path = asprintf("/chosen/environment-nand"); + environment_path = basprintf("/chosen/environment-nand"); envdev = "NAND flash"; break; case BOOTSOURCE_SPI: - environment_path = asprintf("/chosen/environment-spinor"); + environment_path = basprintf("/chosen/environment-spinor"); envdev = "SPI NOR flash"; break; default: - environment_path = asprintf(default_environment_path); + environment_path = basprintf(default_environment_path); envdev = default_envdev; break; } @@ -152,15 +154,23 @@ static int physom_imx6_devices_init(void) pr_notice("Using environment in %s\n", envdev); - imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + if (of_machine_is_compatible("phytec,imx6q-pcm058-emmc") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { + imx6_bbu_internal_mmc_register_handler("mmc3", + "/dev/mmc3", + BBU_HANDLER_FLAG_DEFAULT); + } else { + imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT); + } defaultenv_append_directory(defaultenv_physom_imx6); /* Overwrite file /env/init/automount */ if (of_machine_is_compatible("phytec,imx6q-pcm058-nand") || of_machine_is_compatible("phytec,imx6q-pcm058-emmc") - || of_machine_is_compatible("phytec,imx6dl-pcm058-nand")) { - defaultenv_append_directory(defaultenv_physom_imx6_mira); + || of_machine_is_compatible("phytec,imx6dl-pcm058-nand") + || of_machine_is_compatible("phytec,imx6dl-pcm058-emmc")) { + defaultenv_append_directory(defaultenv_physom_imx6_phycore); } return 0; diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/init/automount b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/automount index 3659cf7d39..a059e190e2 100644 --- a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-mira/init/automount +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/automount @@ -12,3 +12,6 @@ automount /mnt/tftp 'ifup eth0 && mount -t tftp $eth0.serverip /mnt/tftp' mkdir -p /mnt/mmc automount -d /mnt/mmc 'mmc0.probe=1 && [ -e /dev/mmc0.0 ] && mount /dev/mmc0.0 /mnt/mmc' + +mkdir -p /mnt/emmc +automount -d /mnt/emmc 'mmc3.probe=1 && [ -e /dev/mmc3.0 ] && mount /dev/mmc3.0 /mnt/emmc' diff --git a/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource new file mode 100644 index 0000000000..515613b041 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/defaultenv-physom-imx6-phycore/init/bootsource @@ -0,0 +1,19 @@ +#!/bin/sh + +if [ -n "$nv.boot.default" ]; then + exit +fi + +if [ $bootsource = mmc ]; then + if [ $bootsource_instance = 0 ]; then + global.boot.default="mmc emmc nand spi net" + elif [ $bootsource_instance = 3 ]; then + global.boot.default="emmc mmc nand spi net" + fi +elif [ $bootsource = nand ]; then + global.boot.default="nand spi emmc mmc net" +elif [ $bootsource = spi ]; then + global.boot.default="spi nand emmc mmc net" +elif [ $bootsource = net ]; then + global.boot.default="net nand spi emmc mmc" +fi diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg new file mode 100644 index 0000000000..54c9e41d28 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg @@ -0,0 +1,8 @@ +#define SETUP_MDCFG0 \ + wm 32 0x021b000c 0x8c929b85 + +#define SETUP_MDASP_MDCTL \ + wm 32 0x021b0040 0x00000047; \ + wm 32 0x021b0000 0x841A0000 + +#include "flash-header-phytec-pcm058.h" diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg new file mode 100644 index 0000000000..f047253084 --- /dev/null +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg @@ -0,0 +1,8 @@ +#define SETUP_MDCFG0 \ + wm 32 0x021b000c 0x555A7955 + +#define SETUP_MDASP_MDCTL \ + wm 32 0x021b0040 0x00000027; \ + wm 32 0x021b0000 0x831A0000 + +#include "flash-header-phytec-pcm058dl.h" diff --git a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h index c7df7907d1..a6e4578cb1 100644 --- a/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h +++ b/arch/arm/boards/phytec-som-imx6/flash-header-phytec-pcm058dl.h @@ -44,18 +44,18 @@ wm 32 0x020e0488 0x00000028 wm 32 0x020e048c 0x00000028 wm 32 0x021b0800 0xa1390003 wm 32 0x021b4800 0xa1380003 -wm 32 0x021b080c 0x0032003A -wm 32 0x021b0810 0x00350037 -wm 32 0x021b480c 0x00260038 -wm 32 0x021b4810 0x002C0038 -wm 32 0x021b083c 0x42630244 -wm 32 0x021b0840 0x02300238 -wm 32 0x021b483c 0x02540258 -wm 32 0x021b4840 0x0236021e -wm 32 0x021b0848 0x46484446 -wm 32 0x021b4848 0x302d2c35 -wm 32 0x021b0850 0x36342630 -wm 32 0x021b4850 0x3423372d +wm 32 0x021b080c 0x0019001C +wm 32 0x021b0810 0x00140019 +wm 32 0x021b480c 0x00030003 +wm 32 0x021b4810 0x00030010 +wm 32 0x021b083c 0x42140210 +wm 32 0x021b0840 0x02040208 +wm 32 0x021b483c 0x42040208 +wm 32 0x021b4840 0x01680178 +wm 32 0x021b0848 0x40423E3E +wm 32 0x021b4848 0x4242443E +wm 32 0x021b0850 0x2C2C2A30 +wm 32 0x021b4850 0x2E2A3228 wm 32 0x021b081c 0x33333333 wm 32 0x021b0820 0x33333333 wm 32 0x021b0824 0x33333333 diff --git a/arch/arm/boards/phytec-som-imx6/lowlevel.c b/arch/arm/boards/phytec-som-imx6/lowlevel.c index eb796e78b8..c732d32a96 100644 --- a/arch/arm/boards/phytec-som-imx6/lowlevel.c +++ b/arch/arm/boards/phytec-som-imx6/lowlevel.c @@ -91,7 +91,10 @@ PHYTEC_ENTRY(start_phytec_pbab01s_256mb_1bank, imx6s_phytec_pbab01, SZ_256M, fal PHYTEC_ENTRY(start_phytec_pbab01s_512mb_1bank, imx6s_phytec_pbab01, SZ_512M, false); PHYTEC_ENTRY(start_phytec_phyboard_alcor_1gib, imx6q_phytec_phyboard_alcor, SZ_1G, false); PHYTEC_ENTRY(start_phytec_phyboard_subra_512mb_1bank, imx6dl_phytec_phyboard_subra, SZ_512M, false); +PHYTEC_ENTRY(start_phytec_phyboard_subra_1gib_1bank, imx6q_phytec_phyboard_subra, SZ_1G, false); PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_nand_256mb, imx6dl_phytec_phycore_som_nand, SZ_256M, true); +PHYTEC_ENTRY(start_phytec_phycore_imx6dl_som_emmc_1gib, imx6dl_phytec_phycore_som_emmc, SZ_1G, true); PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_nand_1gib, imx6q_phytec_phycore_som_nand, SZ_1G, true); PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_emmc_1gib, imx6q_phytec_phycore_som_emmc, SZ_1G, true); +PHYTEC_ENTRY(start_phytec_phycore_imx6q_som_emmc_2gib, imx6q_phytec_phycore_som_emmc, SZ_2G, true); diff --git a/arch/arm/boards/pm9261/init.c b/arch/arm/boards/pm9261/init.c index 63f4f19b3f..177355b633 100644 --- a/arch/arm/boards/pm9261/init.c +++ b/arch/arm/boards/pm9261/init.c @@ -35,7 +35,7 @@ #include <mach/iomux.h> #include <mach/io.h> #include <mach/at91sam9_smc.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <linux/w1-gpio.h> #include <w1_mac_address.h> diff --git a/arch/arm/boards/pm9263/init.c b/arch/arm/boards/pm9263/init.c index 2b6b0891f5..e9f8588649 100644 --- a/arch/arm/boards/pm9263/init.c +++ b/arch/arm/boards/pm9263/init.c @@ -20,7 +20,6 @@ #include <net.h> #include <init.h> #include <environment.h> -#include <fec.h> #include <asm/armlinux.h> #include <generated/mach-types.h> #include <partition.h> diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 0e17587a74..147fce9952 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -201,8 +201,8 @@ static void rpi_get_board_rev(void) if (!rpi_board_rev) goto unknown_rev; - name = asprintf("RaspberryPi %s %s", rpi_models[rpi_board_rev].name, - rpi_model_string); + name = basprintf("RaspberryPi %s %s", + rpi_models[rpi_board_rev].name, rpi_model_string); barebox_set_model(name); free(name); @@ -210,7 +210,7 @@ static void rpi_get_board_rev(void) unknown_rev: rpi_board_rev = 0; - name = asprintf("RaspberryPi %s", rpi_model_string); + name = basprintf("RaspberryPi %s", rpi_model_string); barebox_set_model(name); free(name); } diff --git a/arch/arm/boards/scb9328/scb9328.c b/arch/arm/boards/scb9328/scb9328.c index 3af140423f..fda3b1432c 100644 --- a/arch/arm/boards/scb9328/scb9328.c +++ b/arch/arm/boards/scb9328/scb9328.c @@ -26,7 +26,7 @@ #include <partition.h> #include <fs.h> #include <fcntl.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <led.h> #include <mach/iomux-mx1.h> #include <mach/devices-imx1.h> diff --git a/arch/arm/boards/tqma6x/board.c b/arch/arm/boards/tqma6x/board.c index 9c52c8ae7a..8946a27b69 100644 --- a/arch/arm/boards/tqma6x/board.c +++ b/arch/arm/boards/tqma6x/board.c @@ -26,7 +26,6 @@ #include <linux/sizes.h> #include <init.h> #include <gpio.h> -#include <fec.h> #include <of.h> #include <linux/micrel_phy.h> diff --git a/arch/arm/boards/udoo/board.c b/arch/arm/boards/udoo/board.c index f3668fef0b..f0befaf3a9 100644 --- a/arch/arm/boards/udoo/board.c +++ b/arch/arm/boards/udoo/board.c @@ -19,7 +19,6 @@ #include <init.h> #include <environment.h> #include <mach/imx6-regs.h> -#include <fec.h> #include <gpio.h> #include <mach/bbu.h> #include <asm/armlinux.h> diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c index 3166cd4fed..8691a171e1 100644 --- a/arch/arm/boards/versatile/versatilepb.c +++ b/arch/arm/boards/versatile/versatilepb.c @@ -29,7 +29,7 @@ #include <environment.h> #include <partition.h> #include <linux/sizes.h> -#include <net/smc91111.h> +#include <platform_data/eth-smc91111.h> static int vpb_console_init(void) { diff --git a/arch/arm/boards/zylonite/board.c b/arch/arm/boards/zylonite/board.c index 2ff08b7934..bd72cd1992 100644 --- a/arch/arm/boards/zylonite/board.c +++ b/arch/arm/boards/zylonite/board.c @@ -25,7 +25,7 @@ #include <init.h> #include <partition.h> #include <led.h> -#include <net/smc91111.h> +#include <platform_data/eth-smc91111.h> #include <platform_data/mtd-nand-mrvl.h> #include <pwm.h> #include <linux/clk.h> diff --git a/arch/arm/configs/imx_v7_defconfig b/arch/arm/configs/imx_v7_defconfig index 82b3821d91..1b0739c35c 100644 --- a/arch/arm/configs/imx_v7_defconfig +++ b/arch/arm/configs/imx_v7_defconfig @@ -54,6 +54,7 @@ CONFIG_CMD_IMD=y CONFIG_CMD_MEMINFO=y CONFIG_CMD_ARM_MMUINFO=y CONFIG_CMD_REGULATOR=y +CONFIG_CMD_MMC_EXTCSD=y CONFIG_CMD_BOOTM_SHOW_TYPE=y CONFIG_CMD_BOOTM_VERBOSE=y CONFIG_CMD_BOOTM_INITRD=y @@ -101,6 +102,7 @@ CONFIG_CMD_FLASH=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_LED=y +CONFIG_CMD_NANDTEST=y CONFIG_CMD_SPI=y CONFIG_CMD_LED_TRIGGER=y CONFIG_CMD_USBGADGET=y diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index b83c1109ef..813e098145 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -45,10 +45,12 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \ imx6dl-phytec-pbab01.dtb.o \ imx6q-phytec-pbab01.dtb.o \ imx6q-phytec-phyboard-alcor.dtb.o \ + imx6q-phytec-phyboard-subra.dtb.o \ imx6dl-phytec-phyboard-subra.dtb.o \ imx6q-phytec-phycore-som-nand.dtb.o \ imx6q-phytec-phycore-som-emmc.dtb.o \ - imx6dl-phytec-phycore-som-nand.dtb.o + imx6dl-phytec-phycore-som-nand.dtb.o \ + imx6dl-phytec-phycore-som-emmc.dtb.o pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o diff --git a/arch/arm/dts/am335x-phytec-phycard-som.dtsi b/arch/arm/dts/am335x-phytec-phycard-som.dtsi index d1dfa86bca..f052f0cc3a 100644 --- a/arch/arm/dts/am335x-phytec-phycard-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phycard-som.dtsi @@ -185,42 +185,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; reg = <0x980000 0x0>; }; diff --git a/arch/arm/dts/am335x-phytec-phycore-som.dtsi b/arch/arm/dts/am335x-phytec-phycore-som.dtsi index f3a1d4d45a..e48d545e64 100644 --- a/arch/arm/dts/am335x-phytec-phycore-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phycore-som.dtsi @@ -174,22 +174,22 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "barebox"; reg = <0x20000 0x80000>; }; - partition@2 { + partition@a0000 { label = "bareboxenv"; reg = <0xa0000 0x20000>; }; - partition@3 { + partition@c0000 { label = "oftree"; reg = <0xc0000 0x20000>; }; - partition@4 { + partition@e0000 { label = "kernel"; reg = <0xe0000 0x0>; }; @@ -269,42 +269,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; /* * Size 0x0 extends partition to diff --git a/arch/arm/dts/am335x-phytec-phyflex-som.dtsi b/arch/arm/dts/am335x-phytec-phyflex-som.dtsi index c60943ccec..6561625686 100644 --- a/arch/arm/dts/am335x-phytec-phyflex-som.dtsi +++ b/arch/arm/dts/am335x-phytec-phyflex-som.dtsi @@ -165,22 +165,22 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "barebox"; reg = <0x20000 0x80000>; }; - partition@2 { + partition@a0000 { label = "bareboxenv"; reg = <0xa0000 0x20000>; }; - partition@3 { + partition@c0000 { label = "oftree"; reg = <0xc0000 0x20000>; }; - partition@4 { + partition@e0000 { label = "kernel"; reg = <0xe0000 0x0>; }; @@ -283,42 +283,42 @@ reg = <0x0 0x20000>; }; - partition@1 { + partition@20000 { label = "xload_backup1"; reg = <0x20000 0x20000>; }; - partition@2 { + partition@40000 { label = "xload_backup2"; reg = <0x40000 0x20000>; }; - partition@3 { + partition@60000 { label = "xload_backup3"; reg = <0x60000 0x20000>; }; - partition@4 { + partition@80000 { label = "barebox"; reg = <0x80000 0x80000>; }; - partition@5 { + partition@100000 { label = "bareboxenv"; reg = <0x100000 0x40000>; }; - partition@6 { + partition@140000 { label = "oftree"; reg = <0x140000 0x40000>; }; - partition@7 { + partition@180000 { label = "kernel"; reg = <0x180000 0x800000>; }; - partition@8 { + partition@980000 { label = "root"; reg = <0x980000 0x0>; }; diff --git a/arch/arm/dts/imx25-karo-tx25.dts b/arch/arm/dts/imx25-karo-tx25.dts index d661463282..8d79471a30 100644 --- a/arch/arm/dts/imx25-karo-tx25.dts +++ b/arch/arm/dts/imx25-karo-tx25.dts @@ -126,17 +126,17 @@ reg = <0x0 0x80000>; }; - partition@1 { + partition@80000 { label = "environment"; reg = <0x80000 0x80000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "root"; reg = <0x500000 0x7b00000>; }; diff --git a/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts b/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts index 3ea1b5b052..cb02a1dfce 100644 --- a/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts +++ b/arch/arm/dts/imx27-phytec-phycard-s-rdk-bb.dts @@ -18,20 +18,20 @@ &nfc { partition@0 { label = "boot"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "root"; reg = <0x500000 0x7b00000>; }; diff --git a/arch/arm/dts/imx27-phytec-phycore-rdk.dts b/arch/arm/dts/imx27-phytec-phycore-rdk.dts index f602045c7e..fff154cb97 100644 --- a/arch/arm/dts/imx27-phytec-phycore-rdk.dts +++ b/arch/arm/dts/imx27-phytec-phycore-rdk.dts @@ -32,17 +32,17 @@ reg = <0x00000000 0x00080000>; }; - environment_nand: partition@1 { + environment_nand: partition@80000 { label = "env"; reg = <0x00080000 0x00020000>; }; - partition@2 { + partition@a0000 { label = "kernel"; reg = <0x000a0000 0x00400000>; }; - partition@3 { + partition@4a0000 { label = "root"; reg = <0x004a0000 0>; }; @@ -54,17 +54,17 @@ reg = <0x00000000 0x00080000>; }; - environment_nor: partition@1 { + environment_nor: partition@80000 { label = "env"; reg = <0x00080000 0x00020000>; }; - partition@2 { + partition@a0000 { label = "kernel"; reg = <0x000a0000 0x00400000>; }; - partition@3 { + partition@4a0000 { label = "root"; reg = <0x004a0000 0>; }; diff --git a/arch/arm/dts/imx51-babbage.dts b/arch/arm/dts/imx51-babbage.dts index f8402ca8fa..bde3031d1b 100644 --- a/arch/arm/dts/imx51-babbage.dts +++ b/arch/arm/dts/imx51-babbage.dts @@ -27,9 +27,9 @@ #address-cells = <1>; #size-cells = <1>; - environment_esdhc1: partition@0 { + environment_esdhc1: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx51-genesi-efika-sb.dts b/arch/arm/dts/imx51-genesi-efika-sb.dts index 78cb1b7184..5a2c3a1c40 100644 --- a/arch/arm/dts/imx51-genesi-efika-sb.dts +++ b/arch/arm/dts/imx51-genesi-efika-sb.dts @@ -415,9 +415,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; @@ -533,9 +533,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; }; diff --git a/arch/arm/dts/imx53-ccxmx53.dtsi b/arch/arm/dts/imx53-ccxmx53.dtsi index e4b4e54928..2ed24b65e4 100644 --- a/arch/arm/dts/imx53-ccxmx53.dtsi +++ b/arch/arm/dts/imx53-ccxmx53.dtsi @@ -233,20 +233,20 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "rootfs"; reg = <0x500000 0x0>; }; diff --git a/arch/arm/dts/imx53-guf-vincell-lt.dts b/arch/arm/dts/imx53-guf-vincell-lt.dts index a577ab262e..bcc378d07f 100644 --- a/arch/arm/dts/imx53-guf-vincell-lt.dts +++ b/arch/arm/dts/imx53-guf-vincell-lt.dts @@ -361,15 +361,15 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - bareboxenv: partition@1 { + bareboxenv: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "ubi"; reg = <0x100000 0x0>; }; diff --git a/arch/arm/dts/imx53-mba53.dts b/arch/arm/dts/imx53-mba53.dts index c908c61671..28f463c451 100644 --- a/arch/arm/dts/imx53-mba53.dts +++ b/arch/arm/dts/imx53-mba53.dts @@ -28,9 +28,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx53-qsb-common.dtsi b/arch/arm/dts/imx53-qsb-common.dtsi index 85e1b8bd01..f363af975d 100644 --- a/arch/arm/dts/imx53-qsb-common.dtsi +++ b/arch/arm/dts/imx53-qsb-common.dtsi @@ -43,9 +43,9 @@ #address-cells = <1>; #size-cells = <1>; - bareboxenv: partition@0 { + bareboxenv: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx53-voipac-dmm-668.dtsi b/arch/arm/dts/imx53-voipac-dmm-668.dtsi index 6f76d2867a..e91c7d02a2 100644 --- a/arch/arm/dts/imx53-voipac-dmm-668.dtsi +++ b/arch/arm/dts/imx53-voipac-dmm-668.dtsi @@ -15,20 +15,20 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "kernel"; reg = <0x100000 0x400000>; }; - partition@3 { + partition@500000 { label = "rootfs"; reg = <0x500000 0x07B00000>; }; diff --git a/arch/arm/dts/imx6dl-eltec-hipercam.dts b/arch/arm/dts/imx6dl-eltec-hipercam.dts index f272e78a59..4fe174437e 100644 --- a/arch/arm/dts/imx6dl-eltec-hipercam.dts +++ b/arch/arm/dts/imx6dl-eltec-hipercam.dts @@ -37,15 +37,15 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_nor0: partition@1 { + environment_nor0: partition@e0000 { label = "bareboxenv"; - reg = <0xc0000 0x8000>; + reg = <0xe0000 0x20000>; }; - partition@2 { + partition@100000 { label = "persistent"; reg = <0x100000 0xf00000>; }; diff --git a/arch/arm/dts/imx6dl-hummingboard.dts b/arch/arm/dts/imx6dl-hummingboard.dts index 2314965260..7f4d2b42f2 100644 --- a/arch/arm/dts/imx6dl-hummingboard.dts +++ b/arch/arm/dts/imx6dl-hummingboard.dts @@ -29,11 +29,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts b/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts index 34e414413c..3d1069a965 100644 --- a/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts +++ b/arch/arm/dts/imx6dl-phytec-phyboard-subra.dts @@ -11,24 +11,9 @@ /dts-v1/; #include "imx6s-phytec-pfla02.dtsi" +#include "imx6qdl-phytec-phyboard-subra.dtsi" / { model = "Phytec phyBOARD SUBRA"; compatible = "phytec,imx6dl-pbab05", "phytec,imx6s-pfla02", "fsl,imx6dl"; - - chosen { - stdout-path = &uart4; - }; -}; - -&fec { - status = "okay"; -}; - -&uart4 { - status = "okay"; -}; - -&usdhc3 { - status = "okay"; }; diff --git a/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts b/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts new file mode 100644 index 0000000000..fc153a6b05 --- /dev/null +++ b/arch/arm/dts/imx6dl-phytec-phycore-som-emmc.dts @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; + +#include <arm/imx6dl.dtsi> +#include "imx6dl.dtsi" +#include "imx6qdl-phytec-phycore-som.dtsi" + +/ { + model = "Phytec phyCORE-i.MX6 DualLite/SOLO with eMMC"; + compatible = "phytec,imx6dl-pcm058-emmc", "fsl,imx6dl"; +}; + +&ecspi1 { + status = "okay"; +}; + +&eeprom { + status = "okay"; +}; + +&fec { + status = "okay"; + phy-handle = <ðphy>; + phy-mode = "rgmii"; + phy-reset-gpios = <&gpio1 14 1>; + + mdio { + #address-cells = <1>; + #size-cells = <0>; + + ethphy: ethernet-phy@3 { + reg = <3>; + max-speed = <100>; + }; + }; +}; + +&flash { + status = "okay"; +}; + +&usdhc1 { + status = "okay"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "barebox"; + reg = <0x0 0xe0000>; + }; + + partition@e0000 { + label = "barebox-environment"; + reg = <0xe0000 0x20000>; + }; +}; + +&usdhc4 { + status = "okay"; +}; diff --git a/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts b/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts index 2324f3a6e5..3f2f1c7320 100644 --- a/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts +++ b/arch/arm/dts/imx6dl-phytec-phycore-som-nand.dts @@ -53,11 +53,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6dl-wandboard.dts b/arch/arm/dts/imx6dl-wandboard.dts index a8674004c8..873e9d6985 100644 --- a/arch/arm/dts/imx6dl-wandboard.dts +++ b/arch/arm/dts/imx6dl-wandboard.dts @@ -27,11 +27,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@c0000 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-dmo-edmqmx6.dts b/arch/arm/dts/imx6q-dmo-edmqmx6.dts index 071f5f5c5e..3576211be4 100644 --- a/arch/arm/dts/imx6q-dmo-edmqmx6.dts +++ b/arch/arm/dts/imx6q-dmo-edmqmx6.dts @@ -53,12 +53,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; }; @@ -97,11 +97,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; @@ -111,10 +111,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-embedsky-e9.dts b/arch/arm/dts/imx6q-embedsky-e9.dts index 726d620681..3bbb60bba3 100644 --- a/arch/arm/dts/imx6q-embedsky-e9.dts +++ b/arch/arm/dts/imx6q-embedsky-e9.dts @@ -41,11 +41,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_mmc1: partition@1 { + environment_mmc1: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; @@ -55,10 +55,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_mmc3: partition@1 { + environment_mmc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-guf-santaro.dts b/arch/arm/dts/imx6q-guf-santaro.dts index 27f538a356..2bd1a26317 100644 --- a/arch/arm/dts/imx6q-guf-santaro.dts +++ b/arch/arm/dts/imx6q-guf-santaro.dts @@ -587,9 +587,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-hummingboard.dts b/arch/arm/dts/imx6q-hummingboard.dts index e1d2fa8ce2..e707eb91c9 100644 --- a/arch/arm/dts/imx6q-hummingboard.dts +++ b/arch/arm/dts/imx6q-hummingboard.dts @@ -29,11 +29,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi b/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi index 05224657dc..a6ea7b5cce 100644 --- a/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi +++ b/arch/arm/dts/imx6q-phytec-pcaaxl3.dtsi @@ -139,22 +139,22 @@ reg = <0x0 0x400000>; }; - environment_nand: partition@1 { + environment_nand: partition@400000 { label = "barebox-environment"; reg = <0x400000 0x20000>; }; - partition@2 { + partition@420000 { label = "oftree"; reg = <0x420000 0x20000>; }; - partition@3 { + partition@440000 { label = "kernel"; reg = <0x440000 0x800000>; }; - partition@4 { + partition@C40000 { label = "root"; reg = <0xC40000 0x0>; }; @@ -181,10 +181,10 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@1 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts b/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts index a60fc186e2..1c4a78552d 100644 --- a/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts +++ b/arch/arm/dts/imx6q-phytec-phyboard-alcor.dts @@ -35,4 +35,5 @@ &usdhc3 { status = "okay"; + max-frequency = <25000000>; /* 25 Mhz */ }; diff --git a/arch/arm/dts/imx6q-phytec-phyboard-subra.dts b/arch/arm/dts/imx6q-phytec-phyboard-subra.dts new file mode 100644 index 0000000000..561e985604 --- /dev/null +++ b/arch/arm/dts/imx6q-phytec-phyboard-subra.dts @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/dts-v1/; +#include "imx6q-phytec-pfla02.dtsi" +#include "imx6qdl-phytec-phyboard-subra.dtsi" + +/ { + model = "Phytec phyBOARD SUBRA"; + compatible = "phytec,imx6q-pbab05", "phytec,imx6q-pfla02", "fsl,imx6q"; +}; diff --git a/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts b/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts index 6e19ab553e..74bc09b5d5 100644 --- a/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts +++ b/arch/arm/dts/imx6q-phytec-phycore-som-emmc.dts @@ -20,6 +20,10 @@ compatible = "phytec,imx6q-pcm058-emmc", "fsl,imx6q"; }; +&ecspi1 { + status = "okay"; +}; + &eeprom { status = "okay"; }; @@ -41,8 +45,25 @@ }; }; +&flash { + status = "okay"; +}; + &usdhc1 { status = "okay"; + + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "barebox"; + reg = <0x0 0xe0000>; + }; + + partition@e0000 { + label = "barebox-environment"; + reg = <0xe0000 0x20000>; + }; }; &usdhc4 { diff --git a/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts b/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts index 06f2f71537..aa2c94abee 100644 --- a/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts +++ b/arch/arm/dts/imx6q-phytec-phycore-som-nand.dts @@ -62,11 +62,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6q-var-custom.dts b/arch/arm/dts/imx6q-var-custom.dts index ef6981e3bc..fe03589454 100644 --- a/arch/arm/dts/imx6q-var-custom.dts +++ b/arch/arm/dts/imx6q-var-custom.dts @@ -127,17 +127,17 @@ reg = <0x0 0x200000>; }; - partition@1 { + partition@200000 { label = "barebox-environment"; reg = <0x200000 0x20000>; }; - partition@2 { + partition@220000 { label = "kernel"; reg = <0x220000 0x600000>; }; - partition@3 { + partition@820000 { label = "rootfs"; reg = <0x820000 0x18000000>; }; diff --git a/arch/arm/dts/imx6q-var-som.dtsi b/arch/arm/dts/imx6q-var-som.dtsi index d005f319d6..63a17fc660 100644 --- a/arch/arm/dts/imx6q-var-som.dtsi +++ b/arch/arm/dts/imx6q-var-som.dtsi @@ -42,17 +42,17 @@ reg = <0x0 0x200000>; }; - environment_nand: partition@1 { + environment_nand: partition@200000 { label = "barebox-environment"; reg = <0x200000 0x20000>; }; - partition@2 { + partition@220000 { label = "kernel"; reg = <0x220000 0x600000>; }; - partition@3 { + partition@820000 { label = "rootfs"; reg = <0x820000 0x1F7E0000>; }; diff --git a/arch/arm/dts/imx6q-wandboard.dts b/arch/arm/dts/imx6q-wandboard.dts index 26d8a0077d..0606727a11 100644 --- a/arch/arm/dts/imx6q-wandboard.dts +++ b/arch/arm/dts/imx6q-wandboard.dts @@ -27,11 +27,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0xc0000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@c0000 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0xc0000 0x40000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-gw54xx.dtsi b/arch/arm/dts/imx6qdl-gw54xx.dtsi index ea5739ddcb..5f8e489aeb 100644 --- a/arch/arm/dts/imx6qdl-gw54xx.dtsi +++ b/arch/arm/dts/imx6qdl-gw54xx.dtsi @@ -31,7 +31,7 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x20000>; }; diff --git a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi index 8fcd4e48a4..9ff7395f45 100644 --- a/arch/arm/dts/imx6qdl-nitrogen6x.dtsi +++ b/arch/arm/dts/imx6qdl-nitrogen6x.dtsi @@ -31,12 +31,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi index b79ce2c0f9..9a8c7024a3 100644 --- a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi +++ b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi @@ -66,17 +66,17 @@ reg = <0x0 0x100000>; }; - partition@1 { + partition@100000 { label = "barebox-environment"; reg = <0x100000 0x20000>; }; - partition@2 { + partition@120000 { label = "oftree"; reg = <0x120000 0x20000>; }; - partition@3 { + partition@140000 { label = "kernel"; reg = <0x140000 0x0>; }; @@ -85,6 +85,7 @@ &fec { phy-handle = <ðphy>; + phy-reset-duration = <10>; /* in msecs */ mdio { #address-cells = <1>; @@ -108,22 +109,22 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; - partition@2 { + partition@500000 { label = "oftree"; reg = <0x500000 0x100000>; }; - partition@3 { + partition@600000 { label = "kernel"; reg = <0x600000 0x800000>; }; - partition@4 { + partition@e00000 { label = "root"; reg = <0xe00000 0x0>; }; @@ -180,11 +181,23 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; + }; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; + + eeprom: eeprom@50 { + compatible = "atmel,24c32"; + pagesize = <32>; + reg = <0x50>; }; }; diff --git a/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi b/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi new file mode 100644 index 0000000000..a38765b142 --- /dev/null +++ b/arch/arm/dts/imx6qdl-phytec-phyboard-subra.dtsi @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +/ { + chosen { + stdout-path = &uart4; + }; +}; + +&fec { + status = "okay"; +}; + +&uart4 { + status = "okay"; +}; + +&usdhc3 { + status = "okay"; + max-frequency = <25000000>; /* 25 Mhz */ +}; diff --git a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi index 2a975d103e..d446a5e9af 100644 --- a/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi +++ b/arch/arm/dts/imx6qdl-phytec-phycore-som.dtsi @@ -46,6 +46,7 @@ compatible = "m25p80"; spi-max-frequency = <20000000>; reg = <0>; + status = "disabled"; #address-cells = <1>; #size-cells = <1>; @@ -55,17 +56,17 @@ reg = <0x0 0x100000>; }; - partition@1 { + partition@100000 { label = "barebox-environment"; reg = <0x100000 0x20000>; }; - partition@2 { + partition@120000 { label = "oftree"; reg = <0x120000 0x20000>; }; - partition@3 { + partition@140000 { label = "kernel"; reg = <0x140000 0x0>; }; @@ -91,22 +92,22 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; - partition@2 { + partition@500000 { label = "oftree"; reg = <0x500000 0x100000>; }; - partition@3 { + partition@600000 { label = "kernel"; reg = <0x600000 0x800000>; }; - partition@4 { + partition@e00000 { label = "root"; reg = <0xe00000 0x0>; }; @@ -256,11 +257,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-sabrelite.dtsi b/arch/arm/dts/imx6qdl-sabrelite.dtsi index d5a6ff4b1f..10b0002ec2 100644 --- a/arch/arm/dts/imx6qdl-sabrelite.dtsi +++ b/arch/arm/dts/imx6qdl-sabrelite.dtsi @@ -31,12 +31,12 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - partition@1 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-sabresd.dtsi b/arch/arm/dts/imx6qdl-sabresd.dtsi index 32318cf389..6b10229c88 100644 --- a/arch/arm/dts/imx6qdl-sabresd.dtsi +++ b/arch/arm/dts/imx6qdl-sabresd.dtsi @@ -31,11 +31,11 @@ partition@0 { label = "barebox"; - reg = <0x0 0x80000>; + reg = <0x0 0xe0000>; }; - environment_usdhc3: partition@1 { + environment_usdhc3: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6qdl-tx6x.dtsi b/arch/arm/dts/imx6qdl-tx6x.dtsi index 9c5d676a74..3898425d9c 100644 --- a/arch/arm/dts/imx6qdl-tx6x.dtsi +++ b/arch/arm/dts/imx6qdl-tx6x.dtsi @@ -32,7 +32,7 @@ reg = <0x0 0x400000>; }; - partition@1 { + partition@400000 { label = "barebox-environment"; reg = <0x400000 0x100000>; }; diff --git a/arch/arm/dts/imx6s-riotboard.dts b/arch/arm/dts/imx6s-riotboard.dts index 3d0a930c3f..09ac534625 100644 --- a/arch/arm/dts/imx6s-riotboard.dts +++ b/arch/arm/dts/imx6s-riotboard.dts @@ -233,9 +233,9 @@ reg = <0x0 0x80000>; }; - environment_usdhc4: partition@1 { + environment_usdhc4: partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x80000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/imx6sx-sdb.dts b/arch/arm/dts/imx6sx-sdb.dts index fbf098bbe6..7b60f9326a 100644 --- a/arch/arm/dts/imx6sx-sdb.dts +++ b/arch/arm/dts/imx6sx-sdb.dts @@ -52,9 +52,9 @@ #address-cells = <1>; #size-cells = <1>; - partition@0 { + partition@e0000 { label = "barebox-environment"; - reg = <0x80000 0x20000>; + reg = <0xe0000 0x20000>; }; }; diff --git a/arch/arm/dts/rk3188-radxarock.dts b/arch/arm/dts/rk3188-radxarock.dts index 47b2487dd9..cafd4d36ed 100644 --- a/arch/arm/dts/rk3188-radxarock.dts +++ b/arch/arm/dts/rk3188-radxarock.dts @@ -34,7 +34,7 @@ label = "barebox"; reg = <0x0 0x80000>; }; - partition@1 { + partition@80000 { label = "barebox-environment"; reg = <0x80000 0x80000>; }; diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h index 724ebb0787..b98b3e52a4 100644 --- a/arch/arm/include/asm/elf.h +++ b/arch/arm/include/asm/elf.h @@ -90,8 +90,8 @@ extern char elf_platform[]; #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3) -/* When the program starts, a1 contains a pointer to a function to be - registered with atexit, as per the SVR4 ABI. A value of 0 means we +/* When the program starts, a1 contains a pointer to a function to be + registered with atexit, as per the SVR4 ABI. A value of 0 means we have no such handler. */ #define ELF_PLAT_INIT(_r, load_addr) (_r)->ARM_r0 = 0 diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 28b4f4a4b4..f6024c80ec 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -67,21 +67,30 @@ static int sdram_start_and_size(unsigned long *start, unsigned long *size) return 0; } -static void get_kernel_addresses(unsigned long mem_start, size_t image_size, +static int get_kernel_addresses(size_t image_size, int verbose, unsigned long *load_address, - unsigned long *spacing) + unsigned long *mem_free) { + unsigned long mem_start, mem_size; + int ret; + size_t image_decomp_size; + unsigned long spacing; + + ret = sdram_start_and_size(&mem_start, &mem_size); + if (ret) + return ret; + /* * We don't know the exact decompressed size so just use a conservative * default of 4 times the size of the compressed image. */ - size_t image_decomp_size = PAGE_ALIGN(image_size * 4); + image_decomp_size = PAGE_ALIGN(image_size * 4); /* * By default put oftree/initrd close behind compressed kernel image to * avoid placing it outside of the kernels lowmem region. */ - *spacing = SZ_1M; + spacing = SZ_1M; if (*load_address == UIMAGE_INVALID_ADDRESS) { /* @@ -99,8 +108,12 @@ static void get_kernel_addresses(unsigned long mem_start, size_t image_size, * spacing to allow this relocation to happen without * overwriting anything placed behind the kernel. */ - *spacing += image_decomp_size; + spacing += image_decomp_size; } + + *mem_free = PAGE_ALIGN(*load_address + image_size + spacing); + + return 0; } static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int swap) @@ -160,24 +173,20 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int static int do_bootm_linux(struct image_data *data) { - unsigned long load_address, mem_start, mem_size, mem_free, spacing; + unsigned long load_address, mem_free; int ret; - ret = sdram_start_and_size(&mem_start, &mem_size); - if (ret) - return ret; - load_address = data->os_address; - get_kernel_addresses(mem_start, bootm_get_os_size(data), - bootm_verbose(data), &load_address, &spacing); + ret = get_kernel_addresses(bootm_get_os_size(data), + bootm_verbose(data), &load_address, &mem_free); + if (ret) + return ret; ret = bootm_load_os(data, load_address); if (ret) return ret; - mem_free = PAGE_ALIGN(data->os_res->end + spacing); - return __do_bootm_linux(data, mem_free, 0); } @@ -273,11 +282,7 @@ static int do_bootz_linux(struct image_data *data) u32 end, start; size_t image_size; unsigned long load_address = data->os_address; - unsigned long mem_start, mem_size, mem_free, spacing; - - ret = sdram_start_and_size(&mem_start, &mem_size); - if (ret) - return ret; + unsigned long mem_free; fd = open(data->os_file, O_RDONLY); if (fd < 0) { @@ -315,8 +320,10 @@ static int do_bootz_linux(struct image_data *data) image_size = end - start; load_address = data->os_address; - get_kernel_addresses(mem_start, image_size, bootm_verbose(data), - &load_address, &spacing); + ret = get_kernel_addresses(image_size, bootm_verbose(data), + &load_address, &mem_free); + if (ret) + return ret; data->os_res = request_sdram_region("zimage", load_address, image_size); if (!data->os_res) { @@ -352,8 +359,6 @@ static int do_bootz_linux(struct image_data *data) close(fd); - mem_free = PAGE_ALIGN(data->os_res->end + spacing); - return __do_bootm_linux(data, mem_free, swap); err_out: @@ -570,7 +575,7 @@ static int armlinux_register_image_handler(void) register_image_handler(&aimage_handler); binfmt_register(&binfmt_aimage_hook); } - if (IS_BUILTIN(CONFIG_CMD_BOOTM_FITIMAGE)) + if (IS_BUILTIN(CONFIG_FITIMAGE)) register_image_handler(&arm_fit_handler); binfmt_register(&binfmt_arm_zimage_hook); binfmt_register(&binfmt_barebox_hook); diff --git a/arch/arm/mach-at91/bootstrap.c b/arch/arm/mach-at91/bootstrap.c index 47e78965d9..8502bb00ff 100644 --- a/arch/arm/mach-at91/bootstrap.c +++ b/arch/arm/mach-at91/bootstrap.c @@ -99,49 +99,49 @@ static void boot_nand_barebox_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_nand(true); - getc(); + getchar(); } static void boot_nand_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_nand(false); - getc(); + getchar(); } static void boot_m25p80_barebox_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_nand(true); - getc(); + getchar(); } static void boot_m25p80_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_nand(false); - getc(); + getchar(); } static void boot_dataflash_barebox_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_dataflash(true); - getc(); + getchar(); } static void boot_dataflash_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_dataflash(false); - getc(); + getchar(); } static void boot_mmc_disk_action(struct menu *m, struct menu_entry *me) { at91bootstrap_boot_mmc(); - getc(); + getchar(); } static void boot_reset_action(struct menu *m, struct menu_entry *me) @@ -234,7 +234,7 @@ static int at91_bootstrap(void) { if (is_menu()) { printf("press 'm' to start the menu\n"); - if (tstc() && getc() == 'm') + if (tstc() && getchar() == 'm') at91_bootstrap_menu(); } diff --git a/arch/arm/mach-imx/esdctl.c b/arch/arm/mach-imx/esdctl.c index 66ba51cde1..106e648bd3 100644 --- a/arch/arm/mach-imx/esdctl.c +++ b/arch/arm/mach-imx/esdctl.c @@ -434,7 +434,7 @@ static __maybe_unused struct of_device_id imx_esdctl_dt_ids[] = { } }; -static struct driver_d imx_serial_driver = { +static struct driver_d imx_esdctl_driver = { .name = "imx-esdctl", .probe = imx_esdctl_probe, .id_table = imx_esdctl_ids, @@ -443,7 +443,7 @@ static struct driver_d imx_serial_driver = { static int imx_esdctl_init(void) { - return platform_driver_register(&imx_serial_driver); + return platform_driver_register(&imx_esdctl_driver); } mem_initcall(imx_esdctl_init); diff --git a/arch/arm/mach-imx/iim.c b/arch/arm/mach-imx/iim.c index dbd8ccf054..ecaa7e6332 100644 --- a/arch/arm/mach-imx/iim.c +++ b/arch/arm/mach-imx/iim.c @@ -330,7 +330,7 @@ static void imx_iim_add_mac_param(struct iim_priv *iim, int macnum, int bank, in iimmac->offset = offset; iimmac->bank = iim->bank[bank]; - name = asprintf("ethaddr%d", macnum); + name = basprintf("ethaddr%d", macnum); dev_add_param_mac(&iim->dev, name, imx_iim_set_mac, imx_iim_get_mac, iimmac->ethaddr, iimmac); diff --git a/arch/arm/mach-imx/include/mach/devices.h b/arch/arm/mach-imx/include/mach/devices.h index 45bb0a51ee..6a045dd070 100644 --- a/arch/arm/mach-imx/include/mach/devices.h +++ b/arch/arm/mach-imx/include/mach/devices.h @@ -1,5 +1,5 @@ -#include <fec.h> +#include <platform_data/eth-fec.h> #include <input/matrix_keypad.h> #include <i2c/i2c.h> #include <mach/spi.h> diff --git a/arch/arm/mach-netx/clocksource.c b/arch/arm/mach-netx/clocksource.c index 8f53364e25..263547242e 100644 --- a/arch/arm/mach-netx/clocksource.c +++ b/arch/arm/mach-netx/clocksource.c @@ -1,7 +1,7 @@ /* * * (C) Copyright 2007 - * Sascha Hauer, Pengutronix + * Sascha Hauer, Pengutronix * * See file CREDITS for list of people who contributed to this * project. diff --git a/arch/arm/mach-omap/include/mach/gpmc_nand.h b/arch/arm/mach-omap/include/mach/gpmc_nand.h index 8839486fcf..c9730a9454 100644 --- a/arch/arm/mach-omap/include/mach/gpmc_nand.h +++ b/arch/arm/mach-omap/include/mach/gpmc_nand.h @@ -32,7 +32,6 @@ enum gpmc_ecc_mode { OMAP_ECC_SOFT, OMAP_ECC_HAMMING_CODE_HW_ROMCODE, - OMAP_ECC_BCH4_CODE_HW, OMAP_ECC_BCH8_CODE_HW, OMAP_ECC_BCH8_CODE_HW_ROMCODE, }; diff --git a/arch/arm/mach-omap/omap_devices.c b/arch/arm/mach-omap/omap_devices.c index 9ed3dcf619..f577fa6ea7 100644 --- a/arch/arm/mach-omap/omap_devices.c +++ b/arch/arm/mach-omap/omap_devices.c @@ -1,5 +1,5 @@ #include <driver.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <asm/armlinux.h> #include <mach/omap3-devices.h> diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c index 34ed94007e..d27c7a867f 100644 --- a/arch/arm/mach-omap/omap_generic.c +++ b/arch/arm/mach-omap/omap_generic.c @@ -130,7 +130,7 @@ static int omap_env_init(void) device_detect_by_name(diskdev); - partname = asprintf("/dev/%s.0", diskdev); + partname = basprintf("/dev/%s.0", diskdev); mkdir("/boot", 0666); ret = mount(partname, "fat", "/boot", NULL); diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c index 8805930215..77938190e1 100644 --- a/arch/arm/mach-omap/xload.c +++ b/arch/arm/mach-omap/xload.c @@ -115,7 +115,7 @@ static void *omap_xload_boot_mmc(void) device_detect_by_name(diskdev); - partname = asprintf("%s.0", diskdev); + partname = basprintf("%s.0", diskdev); ret = mount(partname, NULL, "/", NULL); @@ -280,7 +280,7 @@ static void *am33xx_net_boot(void) return NULL; } - file = asprintf("%s/%s", TFTP_MOUNT, bootfile); + file = basprintf("%s/%s", TFTP_MOUNT, bootfile); buf = read_file(file, &len); if (!buf) diff --git a/arch/arm/mach-socfpga/generic.c b/arch/arm/mach-socfpga/generic.c index 906bc63330..c920bd658f 100644 --- a/arch/arm/mach-socfpga/generic.c +++ b/arch/arm/mach-socfpga/generic.c @@ -4,7 +4,6 @@ #include <init.h> #include <io.h> #include <fs.h> -#include <net/designware.h> #include <linux/clkdev.h> #include <linux/clk.h> #include <linux/stat.h> diff --git a/arch/arm/mach-socfpga/include/mach/sequencer.c b/arch/arm/mach-socfpga/include/mach/sequencer.c index c299f754a8..d2338e6406 100644 --- a/arch/arm/mach-socfpga/include/mach/sequencer.c +++ b/arch/arm/mach-socfpga/include/mach/sequencer.c @@ -292,11 +292,11 @@ static void initialize(void) { IOWR_32DIRECT(PHY_MGR_MUX_SEL, 0, 0x3); - //USER memory clock is not stable we begin initialization + //USER memory clock is not stable we begin initialization IOWR_32DIRECT(PHY_MGR_RESET_MEM_STBL, 0, 0); - //USER calibration status all set to zero + //USER calibration status all set to zero IOWR_32DIRECT(PHY_MGR_CAL_STATUS, 0, 0); IOWR_32DIRECT(PHY_MGR_CAL_DEBUG_INFO, 0, 0); @@ -451,7 +451,7 @@ static void set_rank_and_odt_mask(uint32_t rank, uint32_t odt_mode) //USER Given a rank, select the set of shadow registers that is responsible for the //USER delays of such rank, so that subsequent SCC updates will go to those shadow -//USER registers. +//USER registers. static void select_shadow_regs_for_update(uint32_t rank, uint32_t group, uint32_t update_scan_chains) { @@ -494,7 +494,7 @@ static void scc_mgr_set_dqs_en_phase_all_ranks(uint32_t read_group, uint32_t pha for (r = 0; r < RW_MGR_MEM_NUMBER_OF_RANKS; r += NUM_RANKS_PER_SHADOW_REG) { //USER although the h/w doesn't support different phases per shadow register, - //USER for simplicity our scc manager modeling keeps different phase settings per + //USER for simplicity our scc manager modeling keeps different phase settings per //USER shadow reg, and it's important for us to keep them in sync to match h/w. //USER for efficiency, the scan chain update should occur only once to sr0. update_scan_chains = (r == 0) ? 1 : 0; @@ -522,7 +522,7 @@ static void scc_mgr_set_dqdqs_output_phase_all_ranks(uint32_t write_group, uint3 for (r = 0; r < RW_MGR_MEM_NUMBER_OF_RANKS; r += NUM_RANKS_PER_SHADOW_REG) { //USER although the h/w doesn't support different phases per shadow register, - //USER for simplicity our scc manager modeling keeps different phase settings per + //USER for simplicity our scc manager modeling keeps different phase settings per //USER shadow reg, and it's important for us to keep them in sync to match h/w. //USER for efficiency, the scan chain update should occur only once to sr0. update_scan_chains = (r == 0) ? 1 : 0; @@ -749,7 +749,7 @@ static void scc_set_bypass_mode(uint32_t write_group, uint32_t mode) DPRINT(1, "Done Setting HHP Extras"); } - //USER multicast to all DQ enables + //USER multicast to all DQ enables IOWR_32DIRECT(SCC_MGR_DQ_ENA, 0, 0xff); IOWR_32DIRECT(SCC_MGR_DM_ENA, 0, 0xff); @@ -802,7 +802,7 @@ static void scc_mgr_zero_group(uint32_t write_group, uint32_t test_begin, int32_ //USER multicast to all DQ enables IOWR_32DIRECT(SCC_MGR_DQ_ENA, 0, 0xff); - //USER Zero all DM config settings + //USER Zero all DM config settings for (i = 0; i < RW_MGR_NUM_DM_PER_WRITE_GROUP; i++) { if (!out_only) { // Do we really need this? @@ -815,7 +815,7 @@ static void scc_mgr_zero_group(uint32_t write_group, uint32_t test_begin, int32_ //USER multicast to all DM enables IOWR_32DIRECT(SCC_MGR_DM_ENA, 0, 0xff); - //USER zero all DQS io settings + //USER zero all DQS io settings if (!out_only) { scc_mgr_set_dqs_io_in_delay(write_group, 0); } @@ -827,33 +827,33 @@ static void scc_mgr_zero_group(uint32_t write_group, uint32_t test_begin, int32_ //USER multicast to all DQS IO enables (only 1) IOWR_32DIRECT(SCC_MGR_DQS_IO_ENA, 0, 0); - //USER hit update to zero everything + //USER hit update to zero everything IOWR_32DIRECT(SCC_MGR_UPD, 0, 0); } } -//USER load up dqs config settings +//USER load up dqs config settings static void scc_mgr_load_dqs(uint32_t dqs) { IOWR_32DIRECT(SCC_MGR_DQS_ENA, 0, dqs); } -//USER load up dqs io config settings +//USER load up dqs io config settings static void scc_mgr_load_dqs_io(void) { IOWR_32DIRECT(SCC_MGR_DQS_IO_ENA, 0, 0); } -//USER load up dq config settings +//USER load up dq config settings static void scc_mgr_load_dq(uint32_t dq_in_group) { IOWR_32DIRECT(SCC_MGR_DQ_ENA, 0, dq_in_group); } -//USER load up dm config settings +//USER load up dm config settings static void scc_mgr_load_dm(uint32_t dm) { @@ -934,20 +934,20 @@ static void scc_mgr_set_group_dqs_io_and_oct_out1_gradual(uint32_t write_group, } } -//USER apply a delay to the entire output side: DQ, DM, DQS, OCT +//USER apply a delay to the entire output side: DQ, DM, DQS, OCT static void scc_mgr_apply_group_all_out_delay(uint32_t write_group, uint32_t group_bgn, uint32_t delay) { - //USER dq shift + //USER dq shift scc_mgr_apply_group_dq_out1_delay(write_group, group_bgn, delay); - //USER dm shift + //USER dm shift scc_mgr_apply_group_dm_out1_delay(write_group, delay); - //USER dqs and oct shift + //USER dqs and oct shift scc_mgr_apply_group_dqs_io_and_oct_out1(write_group, delay); } @@ -968,14 +968,14 @@ static void scc_mgr_apply_group_all_out_delay_all_ranks(uint32_t write_group, ui } } -//USER apply a delay to the entire output side: DQ, DM, DQS, OCT +//USER apply a delay to the entire output side: DQ, DM, DQS, OCT static void scc_mgr_apply_group_all_out_delay_add(uint32_t write_group, uint32_t group_bgn, uint32_t delay) { uint32_t i, p, new_delay; - //USER dq shift + //USER dq shift for (i = 0, p = group_bgn; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++, p++) { @@ -994,7 +994,7 @@ static void scc_mgr_apply_group_all_out_delay_add(uint32_t write_group, uint32_t scc_mgr_load_dq(i); } - //USER dm shift + //USER dm shift for (i = 0; i < RW_MGR_NUM_DM_PER_WRITE_GROUP; i++) { new_delay = READ_SCC_DM_IO_OUT2_DELAY(i); @@ -1012,7 +1012,7 @@ static void scc_mgr_apply_group_all_out_delay_add(uint32_t write_group, uint32_t scc_mgr_load_dm(i); } - //USER dqs shift + //USER dqs shift new_delay = READ_SCC_DQS_IO_OUT2_DELAY(); new_delay += delay; @@ -1029,7 +1029,7 @@ static void scc_mgr_apply_group_all_out_delay_add(uint32_t write_group, uint32_t scc_mgr_set_dqs_out2_delay(write_group, new_delay); scc_mgr_load_dqs_io(); - //USER oct shift + //USER oct shift new_delay = READ_SCC_OCT_OUT2_DELAY(write_group); new_delay += delay; @@ -1200,7 +1200,7 @@ static void rw_mgr_mem_initialize(void) //USER indicate that memory is stable IOWR_32DIRECT(PHY_MGR_RESET_MEM_STBL, 0, 1); - //USER transition the RESET to high + //USER transition the RESET to high //USER Wait for 500us //USER num_cycles = (CTR2 + 1) * [(CTR1 + 1) * (2 * (CTR0 + 1) + 1) + 1] + 1 //USER Load counters @@ -1215,12 +1215,12 @@ static void rw_mgr_mem_initialize(void) IOWR_32DIRECT(RW_MGR_RUN_SINGLE_GROUP, 0, __RW_MGR_INIT_RESET_1_CKE_0); - //USER bring up clock enable + //USER bring up clock enable //USER tXRP < 250 ck cycles delay_for_n_mem_clocks(250); - // USER initialize RDIMM buffer so MRS and RZQ Calibrate commands will be + // USER initialize RDIMM buffer so MRS and RZQ Calibrate commands will be // USER propagated to discrete memory devices rw_mgr_rdimm_initialize(); @@ -1231,7 +1231,7 @@ static void rw_mgr_mem_initialize(void) continue; } - //USER set rank + //USER set rank set_rank_and_odt_mask(r, RW_MGR_ODT_MODE_OFF); //USER Use Mirror-ed commands for odd ranks if address mirrorring is on @@ -1288,11 +1288,11 @@ static void rw_mgr_mem_handoff(void) //USER set rank set_rank_and_odt_mask(r, RW_MGR_ODT_MODE_OFF); - //USER precharge all banks ... + //USER precharge all banks ... IOWR_32DIRECT(RW_MGR_RUN_SINGLE_GROUP, 0, __RW_MGR_PRECHARGE_ALL); - //USER load up MR settings specified by user + //USER load up MR settings specified by user //USER Use Mirror-ed commands for odd ranks if address mirrorring is on if ((RW_MGR_MEM_ADDRESS_MIRRORING >> r) & 0x1) { @@ -1397,7 +1397,7 @@ static uint32_t rw_mgr_mem_calibrate_read_test_patterns_all_ranks(uint32_t group return 1; } else { // case:139851 - if guaranteed read fails, we can retry using different dqs enable phases. - // It is possible that with the initial phase, dqs enable is asserted/deasserted too close + // It is possible that with the initial phase, dqs enable is asserted/deasserted too close // to an dqs edge, truncating the read burst. uint32_t p; for (p = 0; p <= IO_DQS_EN_PHASE_MAX; p++) { @@ -1411,7 +1411,7 @@ static uint32_t rw_mgr_mem_calibrate_read_test_patterns_all_ranks(uint32_t group } } -//USER load up the patterns we are going to use during a read test +//USER load up the patterns we are going to use during a read test static void rw_mgr_mem_calibrate_read_load_patterns(uint32_t rank_bgn, uint32_t all_ranks) { uint32_t r; @@ -1456,96 +1456,96 @@ static inline void rw_mgr_mem_calibrate_read_load_patterns_all_ranks(void) //void pe_checkout_pattern (void) //{ // // test RW manager -// +// // // do some reads to check load buffer // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_1, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_1, 0, __RW_MGR_READ_B2B_WAIT1); // // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_2, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_2, 0, __RW_MGR_READ_B2B_WAIT2); -// +// // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_0, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_0, 0, __RW_MGR_READ_B2B); -// +// // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_3, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_3, 0, __RW_MGR_READ_B2B); -// +// // // clear error word // IOWR_32DIRECT (RW_MGR_RESET_READ_DATAPATH, 0, 0); -// +// // IOWR_32DIRECT (RW_MGR_RUN_SINGLE_GROUP, 0, __RW_MGR_READ_B2B); -// +// // uint32_t readdata; -// +// // // read error word // readdata = IORD_32DIRECT(BASE_RW_MGR, 0); -// +// // // read DI buffer // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 0*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 1*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 2*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 3*4, 0); -// +// // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_1, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_1, 0, __RW_MGR_READ_B2B_WAIT1); // // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_2, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_2, 0, __RW_MGR_READ_B2B_WAIT2); -// +// // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_0, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_0, 0, __RW_MGR_READ_B2B); -// +// // IOWR_32DIRECT (RW_MGR_LOAD_CNTR_3, 0, 0x0); // IOWR_32DIRECT (RW_MGR_LOAD_JUMP_ADD_3, 0, __RW_MGR_READ_B2B); -// +// // // clear error word // IOWR_32DIRECT (RW_MGR_RESET_READ_DATAPATH, 0, 0); -// +// // // do read // IOWR_32DIRECT (RW_MGR_LOOPBACK_MODE, 0, __RW_MGR_READ_B2B); -// +// // // read error word // readdata = IORD_32DIRECT(BASE_RW_MGR, 0); -// +// // // error word should be 0x00 -// +// // // read DI buffer // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 0*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 1*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 2*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 3*4, 0); -// +// // // clear error word // IOWR_32DIRECT (RW_MGR_RESET_READ_DATAPATH, 0, 0); -// -// // do dm read +// +// // do dm read // IOWR_32DIRECT (RW_MGR_LOOPBACK_MODE, 0, __RW_MGR_LFSR_WR_RD_DM_BANK_0_WL_1); -// +// // // read error word // readdata = IORD_32DIRECT(BASE_RW_MGR, 0); -// +// // // error word should be ff -// +// // // read DI buffer // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 0*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 1*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 2*4, 0); // readdata = IORD_32DIRECT(RW_MGR_DI_BASE + 3*4, 0); -// +// // // exit loopback mode // IOWR_32DIRECT (BASE_RW_MGR, 0, __RW_MGR_IDLE_LOOP2); -// +// // // start of phy manager access -// +// // readdata = IORD_32DIRECT (PHY_MGR_MAX_RLAT_WIDTH, 0); // readdata = IORD_32DIRECT (PHY_MGR_MAX_AFI_WLAT_WIDTH, 0); // readdata = IORD_32DIRECT (PHY_MGR_MAX_AFI_RLAT_WIDTH, 0); // readdata = IORD_32DIRECT (PHY_MGR_CALIB_SKIP_STEPS, 0); -// readdata = IORD_32DIRECT (PHY_MGR_CALIB_VFIFO_OFFSET, 0); +// readdata = IORD_32DIRECT (PHY_MGR_CALIB_VFIFO_OFFSET, 0); // readdata = IORD_32DIRECT (PHY_MGR_CALIB_LFIFO_OFFSET, 0); -// +// // // start of data manager test -// +// // readdata = IORD_32DIRECT (DATA_MGR_DRAM_CFG , 0); // readdata = IORD_32DIRECT (DATA_MGR_MEM_T_WL , 0); // readdata = IORD_32DIRECT (DATA_MGR_MEM_T_ADD , 0); @@ -1560,7 +1560,7 @@ static inline void rw_mgr_mem_calibrate_read_load_patterns_all_ranks(void) // readdata = IORD_32DIRECT (DATA_MGR_CS_WIDTH , 0); // readdata = IORD_32DIRECT (DATA_MGR_ITF_WIDTH , 0); // readdata = IORD_32DIRECT (DATA_MGR_DVC_WIDTH , 0); -// +// //} //USER try a read and see if it returns correct data back. has dummy reads inserted into the mix @@ -1615,7 +1615,7 @@ static uint32_t rw_mgr_mem_calibrate_read_test(uint32_t rank_bgn, uint32_t group tmp_bit_chk = 0; for (vg = RW_MGR_MEM_VIRTUAL_GROUPS_PER_READ_DQS - 1;; vg--) { - //USER reset the fifos to get pointers to known state + //USER reset the fifos to get pointers to known state IOWR_32DIRECT(PHY_MGR_CMD_FIFO_RESET, 0, 0); IOWR_32DIRECT(RW_MGR_RESET_READ_DATAPATH, 0, 0); @@ -1664,7 +1664,7 @@ static inline uint32_t rw_mgr_mem_calibrate_read_test_all_ranks(uint32_t group, static void rw_mgr_incr_vfifo(uint32_t grp, uint32_t * v) { - //USER fiddle with FIFO + //USER fiddle with FIFO if (HARD_PHY) { IOWR_32DIRECT(PHY_MGR_CMD_INC_VFIFO_HARD_PHY, 0, grp); } else if (QUARTER_RATE_MODE && !HARD_VFIFO) { @@ -1718,11 +1718,11 @@ static void rw_mgr_decr_vfifo(uint32_t grp, uint32_t * v) } } -//USER find a good dqs enable to use +//USER find a good dqs enable to use #if NEWVERSION_DQSEN -// Navid's version +// Navid's version static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) { @@ -1823,7 +1823,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (i >= VFIFO_SIZE) { - //USER cannot find working solution + //USER cannot find working solution DPRINT(2, "find_dqs_en_phase: no vfifo/ptap/dtap"); return 0; } @@ -1831,13 +1831,13 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) work_end = work_bgn; //USER If d is 0 then the working window covers a phase tap and we can follow the old procedure - //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end + //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end if (d == 0) { //USER ******************************************************************** //USER * step 3a: if we have room, back off by one and increment in dtaps * COV(EN_PHASE_PTAP_OVERLAP); - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (p == 0) { p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -1864,7 +1864,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER We have found a working dtap before the ptap found above + //USER We have found a working dtap before the ptap found above if (found_begin == 1) { max_working_cnt++; } @@ -1915,14 +1915,14 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (i >= VFIFO_SIZE + 1) { - //USER cannot see edge of failing read + //USER cannot see edge of failing read DPRINT(2, "find_dqs_en_phase: end: failed"); return 0; } //USER ********************************************************* //USER * step 5a: back off one from last, increment in dtaps * - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (p == 0) { p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -1941,7 +1941,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } else { //USER ******************************************************************** - //USER * step 3-5b: Find the right edge of the window using delay taps * + //USER * step 3-5b: Find the right edge of the window using delay taps * COV(EN_PHASE_PTAP_NO_OVERLAP); DPRINT(2, "find_dqs_en_phase: begin found: vfifo=%lu ptap=%lu dtap=%lu begin=%lu", @@ -1956,7 +1956,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) //USER * The actual increment of dtaps is done outside of the if/else loop to share code //USER Only here to counterbalance a subtract later on which is not needed if this branch - //USER of the algorithm is taken + //USER of the algorithm is taken max_working_cnt++; } @@ -1971,7 +1971,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER Go back to working dtap + //USER Go back to working dtap if (d != 0) { work_end -= IO_DELAY_PER_DQS_EN_DCHAIN_TAP; } @@ -1984,9 +1984,9 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) BFM_GBL_SET(dqs_enable_right_edge[grp].ps, work_end); if (work_end >= work_bgn) { - //USER we have a working range + //USER we have a working range } else { - //USER nil range + //USER nil range DPRINT(2, "find_dqs_en_phase: end-2: failed"); return 0; } @@ -1995,12 +1995,12 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) // *************************************************************** //USER * We need to calculate the number of dtaps that equal a ptap - //USER * To do that we'll back up a ptap and re-find the edge of the + //USER * To do that we'll back up a ptap and re-find the edge of the //USER * window using dtaps DPRINT(2, "find_dqs_en_phase: calculate dtaps_per_ptap for tracking"); - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (p == 0) { p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -2033,7 +2033,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (found_passing_read) { - //USER Find a failing read + //USER Find a failing read DPRINT(2, "find_dqs_en_phase: find failing read"); for (d = d + 1; d <= IO_DQS_EN_DELAY_MAX; d++) { DPRINT(2, "find_dqs_en_phase: testing read d=%lu", d); @@ -2069,7 +2069,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) tmp_delay = 0; DPRINT(2, "work_bgn=%ld work_end=%ld work_mid=%ld", work_bgn, work_end, work_mid); - //USER Get the middle delay to be less than a VFIFO delay + //USER Get the middle delay to be less than a VFIFO delay for (p = 0; p <= IO_DQS_EN_PHASE_MAX; p++, tmp_delay += IO_DELAY_PER_OPA_TAP) ; DPRINT(2, "vfifo ptap delay %ld", tmp_delay); while (work_mid > tmp_delay) @@ -2113,7 +2113,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } #if 0 -// Ryan's algorithm +// Ryan's algorithm static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) { @@ -2201,20 +2201,20 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (i >= VFIFO_SIZE) { - //USER cannot find working solution + //USER cannot find working solution return 0; } min_working_p = p; //USER If d is 0 then the working window covers a phase tap and we can follow the old procedure - //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end + //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end if (d == 0) { //USER ******************************************************************** //USER * step 3a: if we have room, back off by one and increment in dtaps * min_working_d = 0; - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (p == 0) { p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -2235,12 +2235,12 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER We have found a working dtap before the ptap found above + //USER We have found a working dtap before the ptap found above if (found_begin == 1) { min_working_p = p; max_working_cnt++; } - //USER Restore VFIFO to old state before we decremented it + //USER Restore VFIFO to old state before we decremented it p = p + 1; if (p > IO_DQS_EN_PHASE_MAX) { p = 0; @@ -2284,14 +2284,14 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (i >= VFIFO_SIZE + 1) { - //USER cannot see edge of failing read + //USER cannot see edge of failing read return 0; } //USER ********************************************************* //USER * step 5a: back off one from last, increment in dtaps * max_working_d = 0; - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (p == 0) { p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -2311,7 +2311,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER Go back to working dtap + //USER Go back to working dtap if (d != 0) { max_working_d = d - 1; } @@ -2319,7 +2319,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } else { //USER ******************************************************************** - //USER * step 3-5b: Find the right edge of the window using delay taps * + //USER * step 3-5b: Find the right edge of the window using delay taps * max_working_p = min_working_p; min_working_d = d; @@ -2333,12 +2333,12 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER Go back to working dtap + //USER Go back to working dtap if (d != 0) { max_working_d = d - 1; } //USER Only here to counterbalance a subtract later on which is not needed if this branch - //USER of the algorithm is taken + //USER of the algorithm is taken max_working_cnt++; } @@ -2346,11 +2346,11 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) //USER * step 6: Find the centre of the window * //USER If the number of working phases is even we will step back a phase and find the - //USER edge with a larger delay chain tap + //USER edge with a larger delay chain tap if ((max_working_cnt & 1) == 0) { p = min_working_p + (max_working_cnt - 1) / 2; - //USER Special case code for backing up a phase + //USER Special case code for backing up a phase if (max_working_p == 0) { max_working_p = IO_DQS_EN_PHASE_MAX; rw_mgr_decr_vfifo(grp, &v); @@ -2378,7 +2378,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } } - //USER Go back to working dtap + //USER Go back to working dtap if (d != 0) { max_working_d = d - 1; } @@ -2395,7 +2395,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) scc_mgr_set_dqs_en_phase_all_ranks(grp, p); scc_mgr_set_dqs_en_delay_all_ranks(grp, d); - //USER push vfifo until we can successfully calibrate + //USER push vfifo until we can successfully calibrate for (i = 0; i < VFIFO_SIZE; i++) { if (rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1, PASS_ONE_BIT, &bit_chk, 0)) { @@ -2415,7 +2415,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) #endif #else -// Val's original version +// Val's original version static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) { @@ -2432,7 +2432,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) fail_cnt = 0; - //USER first push vfifo until we get a failing read + //USER first push vfifo until we get a failing read v = 0; for (i = 0; i < VFIFO_SIZE; i++) { if (!rw_mgr_mem_calibrate_read_test_all_ranks(grp, 1, PASS_ONE_BIT, &bit_chk, 0)) { @@ -2462,7 +2462,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) rw_mgr_mem_calibrate_read_test_all_ranks(grp, NUM_READ_PB_TESTS, PASS_ONE_BIT, &bit_chk, 0); if (bit_chk) { - //USER passing read + //USER passing read if (max_working_cnt == 0) { min_working_d = d; @@ -2471,7 +2471,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) max_working_cnt++; } else { if (max_working_cnt > 0) { - //USER already have one working value + //USER already have one working value break; } } @@ -2481,7 +2481,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) //USER fiddle with FIFO rw_mgr_incr_vfifo(grp, &v); } else { - //USER found working solution! + //USER found working solution! d = min_working_d + (max_working_cnt - 1) / 2; @@ -2494,16 +2494,16 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) } if (i >= VFIFO_SIZE + 1) { - //USER cannot find working solution or cannot see edge of failing read + //USER cannot find working solution or cannot see edge of failing read return 0; } - //USER in the case the number of working steps is even, use 50ps taps to further center the window + //USER in the case the number of working steps is even, use 50ps taps to further center the window if ((max_working_cnt & 1) == 0) { delay_per_ptap_mid = IO_DELAY_PER_OPA_TAP / 2; - //USER increment in 50ps taps until we reach the required amount + //USER increment in 50ps taps until we reach the required amount for (i = 0, j = 0; i <= IO_DQS_EN_DELAY_MAX && j < delay_per_ptap_mid; i++, j += IO_DELAY_PER_DQS_EN_DCHAIN_TAP) ; @@ -2513,7 +2513,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase(uint32_t grp) scc_mgr_set_dqs_en_phase_all_ranks(grp, d); - //USER push vfifo until we can successfully calibrate + //USER push vfifo until we can successfully calibrate for (i = 0; i < VFIFO_SIZE; i++) { if (rw_mgr_mem_calibrate_read_test_all_ranks @@ -2582,7 +2582,7 @@ static inline uint32_t rw_mgr_mem_calibrate_vfifo_find_dqs_en_phase_sweep_dq_in_ return found; } -//USER per-bit deskew DQ and center +//USER per-bit deskew DQ and center #if NEWVERSION_RDDESKEW @@ -2610,10 +2610,10 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr select_curr_shadow_reg_using_rank(rank_bgn); - //USER per-bit deskew + //USER per-bit deskew - //USER set the left and right edge of each bit to an illegal value - //USER use (IO_IO_IN_DELAY_MAX + 1) as an illegal value + //USER set the left and right edge of each bit to an illegal value + //USER use (IO_IO_IN_DELAY_MAX + 1) as an illegal value sticky_bit_chk = 0; for (i = 0; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++) { left_edge[i] = IO_IO_IN_DELAY_MAX + 1; @@ -2654,7 +2654,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr //USER Remember a passing test as the left_edge left_edge[i] = d; } else { - //USER If a left edge has not been seen yet, then a future passing test will mark this edge as the right edge + //USER If a left edge has not been seen yet, then a future passing test will mark this edge as the right edge if (left_edge[i] == IO_IO_IN_DELAY_MAX + 1) { right_edge[i] = -(d + 1); } @@ -2667,7 +2667,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr } } - //USER Reset DQ delay chains to 0 + //USER Reset DQ delay chains to 0 scc_mgr_apply_group_dq_in_delay(write_group, test_bgn, 0); sticky_bit_chk = 0; for (i = RW_MGR_MEM_DQ_PER_READ_DQS - 1;; i--) { @@ -2675,14 +2675,14 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr DPRINT(2, "vfifo_center: left_edge[%lu]: %ld right_edge[%lu]: %ld", i, left_edge[i], i, right_edge[i]); - //USER Check for cases where we haven't found the left edge, which makes our assignment of the the - //USER right edge invalid. Reset it to the illegal value. + //USER Check for cases where we haven't found the left edge, which makes our assignment of the the + //USER right edge invalid. Reset it to the illegal value. if ((left_edge[i] == IO_IO_IN_DELAY_MAX + 1) && (right_edge[i] != IO_IO_IN_DELAY_MAX + 1)) { right_edge[i] = IO_IO_IN_DELAY_MAX + 1; DPRINT(2, "vfifo_center: reset right_edge[%lu]: %ld", i, right_edge[i]); } - //USER Reset sticky bit (except for bits where we have seen both the left and right edge) + //USER Reset sticky bit (except for bits where we have seen both the left and right edge) sticky_bit_chk = sticky_bit_chk << 1; if ((left_edge[i] != IO_IO_IN_DELAY_MAX + 1) && (right_edge[i] != IO_IO_IN_DELAY_MAX + 1)) { @@ -2694,7 +2694,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr } } - //USER Search for the right edge of the window for each bit + //USER Search for the right edge of the window for each bit for (d = 0; d <= IO_DQS_IN_DELAY_MAX - start_dqs; d++) { scc_mgr_set_dqs_bus_in_delay(read_group, d + start_dqs); if (IO_SHIFT_DQS_EN_WHEN_SHIFT_DQS) { @@ -2708,7 +2708,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr IOWR_32DIRECT(SCC_MGR_UPD, 0, 0); - //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit + //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit if (use_read_test) { stop = !rw_mgr_mem_calibrate_read_test(rank_bgn, read_group, NUM_READ_PB_TESTS, @@ -2734,11 +2734,11 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr } else { for (i = 0; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++) { if (bit_chk & 1) { - //USER Remember a passing test as the right_edge + //USER Remember a passing test as the right_edge right_edge[i] = d; } else { if (d != 0) { - //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge + //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge if (right_edge[i] == IO_IO_IN_DELAY_MAX + 1) { left_edge[i] = -(d + 1); } @@ -2748,7 +2748,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr && left_edge[i] != IO_IO_IN_DELAY_MAX + 1) { right_edge[i] = -1; } - //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge + //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge else if (right_edge[i] == IO_IO_IN_DELAY_MAX + 1) { left_edge[i] = -(d + 1); } @@ -2775,7 +2775,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr if ((left_edge[i] == IO_IO_IN_DELAY_MAX + 1) || (right_edge[i] == IO_IO_IN_DELAY_MAX + 1)) { - //USER Restore delay chain settings before letting the loop in + //USER Restore delay chain settings before letting the loop in //USER rw_mgr_mem_calibrate_vfifo to retry different dqs/ck relationships scc_mgr_set_dqs_bus_in_delay(read_group, start_dqs); if (IO_SHIFT_DQS_EN_WHEN_SHIFT_DQS) { @@ -2798,7 +2798,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr } } - //USER Find middle of window for each DQ bit + //USER Find middle of window for each DQ bit mid_min = left_edge[0] - right_edge[0]; min_index = 0; for (i = 1; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++) { @@ -2841,13 +2841,13 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr DPRINT(1, "vfifo_center: start_dqs=%ld start_dqs_en=%ld new_dqs=%ld mid_min=%ld", start_dqs, IO_SHIFT_DQS_EN_WHEN_SHIFT_DQS ? start_dqs_en : -1, new_dqs, mid_min); - //USER Initialize data for export structures + //USER Initialize data for export structures dqs_margin = IO_IO_IN_DELAY_MAX + 1; dq_margin = IO_IO_IN_DELAY_MAX + 1; - //USER add delay to bring centre of all DQ windows to the same "level" + //USER add delay to bring centre of all DQ windows to the same "level" for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++, p++) { - //USER Use values before divide by 2 to reduce round off error + //USER Use values before divide by 2 to reduce round off error shift_dq = (left_edge[i] - right_edge[i] - (left_edge[min_index] - right_edge[min_index])) / 2 + (orig_mid_min - mid_min); @@ -2866,7 +2866,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr DPRINT(2, "vfifo_center: margin[%lu]=[%ld,%ld]", i, left_edge[i] - shift_dq + (-mid_min), right_edge[i] + shift_dq - (-mid_min)); - //USER To determine values for export structures + //USER To determine values for export structures if (left_edge[i] - shift_dq + (-mid_min) < dq_margin) { dq_margin = left_edge[i] - shift_dq + (-mid_min); } @@ -2889,7 +2889,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t wr scc_mgr_load_dqs(read_group); if (update_fom) { - //USER Export values + //USER Export values gbl->fom_in += (dq_margin + dqs_margin) / (RW_MGR_MEM_IF_READ_DQS_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH); @@ -2940,7 +2940,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr } } - //USER determine minimum working value for DQ + //USER determine minimum working value for DQ dq_margin = IO_IO_IN_DELAY_MAX; @@ -2950,7 +2950,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr } } - //USER add delay to bring all DQ windows to the same "level" + //USER add delay to bring all DQ windows to the same "level" for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++, p++) { if (max_working_dq[i] > dq_margin) { @@ -2981,11 +2981,11 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr scc_mgr_set_dqs_bus_in_delay(grp, start_dqs); - //USER margin on the DQS pin + //USER margin on the DQS pin dqs_margin = d - start_dqs - 1; - //USER find mid point, +1 so that we don't go crazy pushing DQ + //USER find mid point, +1 so that we don't go crazy pushing DQ mid = (dq_margin + dqs_margin + 1) / 2; @@ -2993,7 +2993,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr // TCLRPT_SET(debug_summary_report->fom_in, debug_summary_report->fom_in + (dq_margin + dqs_margin)); // TCLRPT_SET(debug_cal_report->cal_status_per_group[grp].fom_in, (dq_margin + dqs_margin)); - //USER center DQS ... if the headroom is setup properly we shouldn't need to + //USER center DQS ... if the headroom is setup properly we shouldn't need to if (dqs_margin > mid) { scc_mgr_set_dqs_bus_in_delay(grp, READ_SCC_DQS_IN_DELAY(grp) + dqs_margin - mid); @@ -3011,7 +3011,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr scc_mgr_load_dqs(grp); - //USER center DQ + //USER center DQ if (dq_margin > mid) { for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_READ_DQS; i++, p++) { @@ -3032,7 +3032,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_center(uint32_t rank_bgn, uint32_t gr #endif //USER calibrate the read valid prediction FIFO. -//USER +//USER //USER - read valid prediction will consist of finding a good DQS enable phase, DQS enable delay, DQS input phase, and DQS input delay. //USER - we also do a per-bit deskew on the DQ lines. @@ -3050,7 +3050,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t read_group, uint32_t test_bg uint32_t failed_substage; uint32_t dqs_in_dtaps, orig_start_dqs; - //USER update info for sims + //USER update info for sims reg_file_set_stage(CAL_STAGE_VFIFO); @@ -3074,7 +3074,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t read_group, uint32_t test_bg dtaps_per_ptap--; tmp_delay = 0; } - //USER update info for sims + //USER update info for sims reg_file_set_group(read_group); @@ -3095,7 +3095,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t read_group, uint32_t test_bg } for (p = 0; p <= IO_DQDQS_OUT_PHASE_MAX && grp_calibrated == 0; p++) { - //USER set a particular dqdqs phase + //USER set a particular dqdqs phase if (DDRX) { scc_mgr_set_dqdqs_output_phase_all_ranks(read_group, p); } @@ -3111,7 +3111,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t read_group, uint32_t test_bg BFM_GBL_SET(gwrite_pos[read_group].p, p); BFM_GBL_SET(gwrite_pos[read_group].d, d); - //USER Load up the patterns used by read calibration using current DQDQS phase + //USER Load up the patterns used by read calibration using current DQDQS phase rw_mgr_mem_calibrate_read_load_patterns_all_ranks(); @@ -3209,7 +3209,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t g, uint32_t test_bgn) uint32_t grp_calibrated; uint32_t failed_substage; - //USER update info for sims + //USER update info for sims reg_file_set_stage(CAL_STAGE_VFIFO); @@ -3217,18 +3217,18 @@ static uint32_t rw_mgr_mem_calibrate_vfifo(uint32_t g, uint32_t test_bgn) failed_substage = CAL_SUBSTAGE_GUARANTEED_READ; - //USER update info for sims + //USER update info for sims reg_file_set_group(g); grp_calibrated = 0; for (p = 0; p <= IO_DQDQS_OUT_PHASE_MAX && grp_calibrated == 0; p++) { - //USER set a particular dqdqs phase + //USER set a particular dqdqs phase if (DDRX) { scc_mgr_set_dqdqs_output_phase_all_ranks(g, p); } - //USER Load up the patterns used by read calibration using current DQDQS phase + //USER Load up the patterns used by read calibration using current DQDQS phase rw_mgr_mem_calibrate_read_load_patterns_all_ranks(); if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_DISABLE_GUARANTEED_READ)) { @@ -3280,7 +3280,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_end(uint32_t read_group, uint32_t tes uint32_t grp_calibrated; uint32_t write_group; - //USER update info for sims + //USER update info for sims reg_file_set_stage(CAL_STAGE_VFIFO_AFTER_WRITES); reg_file_set_sub_stage(CAL_SUBSTAGE_VFIFO_CENTER); @@ -3292,7 +3292,7 @@ static uint32_t rw_mgr_mem_calibrate_vfifo_end(uint32_t read_group, uint32_t tes read_group / (RW_MGR_MEM_IF_READ_DQS_WIDTH / RW_MGR_MEM_IF_WRITE_DQS_WIDTH); } - //USER update info for sims + //USER update info for sims reg_file_set_group(read_group); grp_calibrated = 1; @@ -3330,7 +3330,7 @@ static uint32_t rw_mgr_mem_calibrate_lfifo(void) uint32_t found_one; t_btfld bit_chk; - //USER update info for sims + //USER update info for sims reg_file_set_stage(CAL_STAGE_LFIFO); reg_file_set_sub_stage(CAL_SUBSTAGE_READ_LATENCY); @@ -3358,12 +3358,12 @@ static uint32_t rw_mgr_mem_calibrate_lfifo(void) gbl->curr_read_lat--; } while (gbl->curr_read_lat > 0); - //USER reset the fifos to get pointers to known state + //USER reset the fifos to get pointers to known state IOWR_32DIRECT(PHY_MGR_CMD_FIFO_RESET, 0, 0); if (found_one) { - //USER add a fudge factor to the read latency that was determined + //USER add a fudge factor to the read latency that was determined gbl->curr_read_lat += 2; IOWR_32DIRECT(PHY_MGR_PHY_RLAT, 0, gbl->curr_read_lat); @@ -3508,13 +3508,13 @@ static uint32_t rw_mgr_mem_calibrate_write_test(uint32_t rank_bgn, uint32_t writ continue; } - //USER set rank + //USER set rank set_rank_and_odt_mask(r, RW_MGR_ODT_MODE_READ_WRITE); tmp_bit_chk = 0; for (vg = RW_MGR_MEM_VIRTUAL_GROUPS_PER_WRITE_DQS - 1;; vg--) { - //USER reset the fifos to get pointers to known state + //USER reset the fifos to get pointers to known state IOWR_32DIRECT(PHY_MGR_CMD_FIFO_RESET, 0, 0); tmp_bit_chk = @@ -3584,24 +3584,24 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) reg_file_set_stage(CAL_STAGE_WLEVEL); reg_file_set_sub_stage(CAL_SUBSTAGE_WORKING_DELAY); - //USER maximum phases for the sweep + //USER maximum phases for the sweep dtaps_per_ptap = IORD_32DIRECT(REG_FILE_DTAPS_PER_PTAP, 0); - //USER starting phases + //USER starting phases //USER update info for sims reg_file_set_group(g); - //USER starting and end range where writes work + //USER starting and end range where writes work scc_mgr_spread_out2_delay_all_ranks(g, test_bgn); work_bgn = 0; work_end = 0; - //USER step 1: find first working phase, increment in ptaps, and then in dtaps if ptaps doesn't find a working phase + //USER step 1: find first working phase, increment in ptaps, and then in dtaps if ptaps doesn't find a working phase found_begin = 0; tmp_delay = 0; for (d = 0; d <= dtaps_per_ptap; d++, tmp_delay += IO_DELAY_PER_DCHAIN_TAP) { @@ -3627,7 +3627,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) } if (p > IO_DQDQS_OUT_PHASE_MAX + num_additional_fr_cycles * IO_DLL_CHAIN_LENGTH) { - //USER fail, cannot find first working phase + //USER fail, cannot find first working phase set_failing_group_stage(g, CAL_STAGE_WLEVEL, CAL_SUBSTAGE_WORKING_DELAY); @@ -3639,12 +3639,12 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) reg_file_set_sub_stage(CAL_SUBSTAGE_LAST_WORKING_DELAY); //USER If d is 0 then the working window covers a phase tap and we can follow the old procedure - //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end + //USER otherwise, we've found the beginning, and we need to increment the dtaps until we find the end if (d == 0) { COV(WLEVEL_PHASE_PTAP_OVERLAP); work_end = work_bgn + IO_DELAY_PER_OPA_TAP; - //USER step 2: if we have room, back off by one and increment in dtaps + //USER step 2: if we have room, back off by one and increment in dtaps if (p > 0) { int found = 0; @@ -3693,7 +3693,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) BFM_GBL_SET(dqs_wlevel_left_edge[g].ps, work_bgn); } - //USER step 3: go forward from working phase to non working phase, increment in ptaps + //USER step 3: go forward from working phase to non working phase, increment in ptaps for (p = p + 1; p <= IO_DQDQS_OUT_PHASE_MAX + num_additional_fr_cycles * IO_DLL_CHAIN_LENGTH; @@ -3707,7 +3707,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) } } - //USER step 4: back off one from last, increment in dtaps + //USER step 4: back off one from last, increment in dtaps //USER The actual increment is done outside the if/else statement since it is shared with other code p = p - 1; @@ -3743,9 +3743,9 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) work_end -= IO_DELAY_PER_DCHAIN_TAP; if (work_end >= work_bgn) { - //USER we have a working range + //USER we have a working range } else { - //USER nil range + //USER nil range set_failing_group_stage(g, CAL_STAGE_WLEVEL, CAL_SUBSTAGE_LAST_WORKING_DELAY); @@ -3757,7 +3757,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) BFM_GBL_SET(dqs_wlevel_right_edge[g].d, d - 1); BFM_GBL_SET(dqs_wlevel_right_edge[g].ps, work_end); - //USER center + //USER center work_mid = (work_bgn + work_end) / 2; @@ -3819,20 +3819,20 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) reg_file_set_stage(CAL_STAGE_WLEVEL); reg_file_set_sub_stage(CAL_SUBSTAGE_WORKING_DELAY); - //USER maximum phases for the sweep + //USER maximum phases for the sweep - //USER starting phases + //USER starting phases //USER update info for sims reg_file_set_group(g); - //USER starting and end range where writes work + //USER starting and end range where writes work work_bgn = 0; work_end = 0; - //USER step 1: find first working phase, increment in ptaps + //USER step 1: find first working phase, increment in ptaps for (p = 0; p <= IO_DQDQS_OUT_PHASE_MAX; p++, work_bgn += IO_DELAY_PER_OPA_TAP) { scc_mgr_set_dqdqs_output_phase_all_ranks(g, p); @@ -3843,7 +3843,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) } if (p > IO_DQDQS_OUT_PHASE_MAX) { - //USER fail, cannot find first working phase + //USER fail, cannot find first working phase set_failing_group_stage(g, CAL_STAGE_WLEVEL, CAL_SUBSTAGE_WORKING_DELAY); @@ -3854,7 +3854,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) reg_file_set_sub_stage(CAL_SUBSTAGE_LAST_WORKING_DELAY); - //USER step 2: if we have room, back off by one and increment in dtaps + //USER step 2: if we have room, back off by one and increment in dtaps if (p > 0) { scc_mgr_set_dqdqs_output_phase_all_ranks(g, p - 1); @@ -3873,7 +3873,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) scc_mgr_apply_group_all_out_delay_all_ranks(g, test_bgn, 0); } - //USER step 3: go forward from working phase to non working phase, increment in ptaps + //USER step 3: go forward from working phase to non working phase, increment in ptaps for (p = p + 1; p <= IO_DQDQS_OUT_PHASE_MAX; p++, work_end += IO_DELAY_PER_OPA_TAP) { scc_mgr_set_dqdqs_output_phase_all_ranks(g, p); @@ -3883,7 +3883,7 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) } } - //USER step 4: back off one from last, increment in dtaps + //USER step 4: back off one from last, increment in dtaps scc_mgr_set_dqdqs_output_phase_all_ranks(g, p - 1); @@ -3900,16 +3900,16 @@ static uint32_t rw_mgr_mem_calibrate_wlevel(uint32_t g, uint32_t test_bgn) scc_mgr_apply_group_all_out_delay_all_ranks(g, test_bgn, 0); if (work_end > work_bgn) { - //USER we have a working range + //USER we have a working range } else { - //USER nil range + //USER nil range set_failing_group_stage(g, CAL_STAGE_WLEVEL, CAL_SUBSTAGE_LAST_WORKING_DELAY); return 0; } - //USER center + //USER center work_mid = (work_bgn + work_end) / 2; @@ -3963,9 +3963,9 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w select_curr_shadow_reg_using_rank(rank_bgn); - //USER per-bit deskew + //USER per-bit deskew - //USER set the left and right edge of each bit to an illegal value + //USER set the left and right edge of each bit to an illegal value //USER use (IO_IO_OUT1_DELAY_MAX + 1) as an illegal value sticky_bit_chk = 0; for (i = 0; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++) { @@ -3979,7 +3979,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w IOWR_32DIRECT(SCC_MGR_UPD, 0, 0); - //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit + //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit stop = !rw_mgr_mem_calibrate_write_test(rank_bgn, write_group, 0, PASS_ONE_BIT, &bit_chk, 0); @@ -3998,7 +3998,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w //USER Remember a passing test as the left_edge left_edge[i] = d; } else { - //USER If a left edge has not been seen yet, then a future passing test will mark this edge as the right edge + //USER If a left edge has not been seen yet, then a future passing test will mark this edge as the right edge if (left_edge[i] == IO_IO_OUT1_DELAY_MAX + 1) { right_edge[i] = -(d + 1); } @@ -4011,7 +4011,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } } - //USER Reset DQ delay chains to 0 + //USER Reset DQ delay chains to 0 scc_mgr_apply_group_dq_out1_delay(write_group, test_bgn, 0); sticky_bit_chk = 0; for (i = RW_MGR_MEM_DQ_PER_WRITE_DQS - 1;; i--) { @@ -4019,14 +4019,14 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w DPRINT(2, "write_center: left_edge[%lu]: %ld right_edge[%lu]: %ld", i, left_edge[i], i, right_edge[i]); - //USER Check for cases where we haven't found the left edge, which makes our assignment of the the - //USER right edge invalid. Reset it to the illegal value. + //USER Check for cases where we haven't found the left edge, which makes our assignment of the the + //USER right edge invalid. Reset it to the illegal value. if ((left_edge[i] == IO_IO_OUT1_DELAY_MAX + 1) && (right_edge[i] != IO_IO_OUT1_DELAY_MAX + 1)) { right_edge[i] = IO_IO_OUT1_DELAY_MAX + 1; DPRINT(2, "write_center: reset right_edge[%lu]: %ld", i, right_edge[i]); } - //USER Reset sticky bit (except for bits where we have seen the left edge) + //USER Reset sticky bit (except for bits where we have seen the left edge) sticky_bit_chk = sticky_bit_chk << 1; if ((left_edge[i] != IO_IO_OUT1_DELAY_MAX + 1)) { sticky_bit_chk = sticky_bit_chk | 1; @@ -4037,7 +4037,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } } - //USER Search for the right edge of the window for each bit + //USER Search for the right edge of the window for each bit for (d = 0; d <= IO_IO_OUT1_DELAY_MAX - start_dqs; d++) { scc_mgr_apply_group_dqs_io_and_oct_out1(write_group, d + start_dqs); @@ -4045,7 +4045,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w if (QDRII) { rw_mgr_mem_dll_lock_wait(); } - //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit + //USER Stop searching when the read test doesn't pass AND when we've seen a passing read on every bit stop = !rw_mgr_mem_calibrate_write_test(rank_bgn, write_group, 0, PASS_ONE_BIT, &bit_chk, 0); @@ -4072,11 +4072,11 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } else { for (i = 0; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++) { if (bit_chk & 1) { - //USER Remember a passing test as the right_edge + //USER Remember a passing test as the right_edge right_edge[i] = d; } else { if (d != 0) { - //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge + //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge if (right_edge[i] == IO_IO_OUT1_DELAY_MAX + 1) { left_edge[i] = -(d + 1); } @@ -4086,7 +4086,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w && left_edge[i] != IO_IO_OUT1_DELAY_MAX + 1) { right_edge[i] = -1; } - //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge + //USER If a right edge has not been seen yet, then a future passing test will mark this edge as the left edge else if (right_edge[i] == IO_IO_OUT1_DELAY_MAX + 1) { left_edge[i] = -(d + 1); } @@ -4114,7 +4114,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } } - //USER Find middle of window for each DQ bit + //USER Find middle of window for each DQ bit mid_min = left_edge[0] - right_edge[0]; min_index = 0; for (i = 1; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++) { @@ -4142,13 +4142,13 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w DPRINT(1, "write_center: start_dqs=%ld new_dqs=%ld mid_min=%ld", start_dqs, new_dqs, mid_min); - //USER Initialize data for export structures + //USER Initialize data for export structures dqs_margin = IO_IO_OUT1_DELAY_MAX + 1; dq_margin = IO_IO_OUT1_DELAY_MAX + 1; - //USER add delay to bring centre of all DQ windows to the same "level" + //USER add delay to bring centre of all DQ windows to the same "level" for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++, p++) { - //USER Use values before divide by 2 to reduce round off error + //USER Use values before divide by 2 to reduce round off error shift_dq = (left_edge[i] - right_edge[i] - (left_edge[min_index] - right_edge[min_index])) / 2 + (orig_mid_min - mid_min); @@ -4166,7 +4166,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w DPRINT(2, "write_center: margin[%lu]=[%ld,%ld]", i, left_edge[i] - shift_dq + (-mid_min), right_edge[i] + shift_dq - (-mid_min)); - //USER To determine values for export structures + //USER To determine values for export structures if (left_edge[i] - shift_dq + (-mid_min) < dq_margin) { dq_margin = left_edge[i] - shift_dq + (-mid_min); } @@ -4175,7 +4175,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } } - //USER Move DQS + //USER Move DQS if (QDRII) { scc_mgr_set_group_dqs_io_and_oct_out1_gradual(write_group, new_dqs); } else { @@ -4185,7 +4185,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w DPRINT(2, "write_center: DM"); - //USER set the left and right edge of each bit to an illegal value + //USER set the left and right edge of each bit to an illegal value //USER use (IO_IO_OUT1_DELAY_MAX + 1) as an illegal value left_edge[0] = IO_IO_OUT1_DELAY_MAX + 1; right_edge[0] = IO_IO_OUT1_DELAY_MAX + 1; @@ -4204,7 +4204,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w if (bgn_curr == IO_IO_OUT1_DELAY_MAX + 1) { bgn_curr = -d; } - //USER If current window is bigger than best seen. Set best seen to be current window + //USER If current window is bigger than best seen. Set best seen to be current window if ((end_curr - bgn_curr + 1) > win_best) { win_best = end_curr - bgn_curr + 1; bgn_best = bgn_curr; @@ -4296,7 +4296,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w DPRINT(2, "dm_calib: left=%ld right=%ld mid=%ld dm_margin=%ld", left_edge[0], right_edge[0], mid, dm_margin); - //USER Export values + //USER Export values gbl->fom_out += dq_margin + dqs_margin; DPRINT(2, "write_center: dq_margin=%ld dqs_margin=%ld dm_margin=%ld", dq_margin, dqs_margin, @@ -4321,7 +4321,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w uint32_t start_dqs; uint32_t stop; - //USER per-bit deskew + //USER per-bit deskew for (i = 0; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++) { max_working_dq[i] = 0; @@ -4347,7 +4347,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w scc_mgr_apply_group_dq_out1_delay(write_group, test_bgn, 0); - //USER determine minimum of maximums + //USER determine minimum of maximums dq_margin = IO_IO_OUT1_DELAY_MAX; @@ -4357,7 +4357,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w } } - //USER add delay to center DQ windows + //USER add delay to center DQ windows for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++, p++) { if (max_working_dq[i] > dq_margin) { @@ -4393,7 +4393,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w dqs_margin = d - start_dqs - 1; - //USER time to center, +1 so that we don't go crazy centering DQ + //USER time to center, +1 so that we don't go crazy centering DQ mid = (dq_margin + dqs_margin + 1) / 2; @@ -4402,7 +4402,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w scc_mgr_load_dqs_io(); scc_mgr_load_dqs_for_write_group(write_group); - //USER center dq + //USER center dq if (dq_margin > mid) { for (i = 0, p = test_bgn; i < RW_MGR_MEM_DQ_PER_WRITE_DQS; i++, p++) { @@ -4413,7 +4413,7 @@ static uint32_t rw_mgr_mem_calibrate_writes_center(uint32_t rank_bgn, uint32_t w dqs_margin += dq_margin - mid; dq_margin -= dq_margin - mid; } - //USER do dm centering + //USER do dm centering if (!RLDRAMX) { dm_margin = IO_IO_OUT1_DELAY_MAX; @@ -4496,7 +4496,7 @@ static uint32_t rw_mgr_mem_calibrate_writes(uint32_t rank_bgn, uint32_t g, uint3 reg_file_set_stage(CAL_STAGE_WRITES); reg_file_set_sub_stage(CAL_SUBSTAGE_WRITES_CENTER); - //USER starting phases + //USER starting phases //USER update info for sims @@ -4510,7 +4510,7 @@ static uint32_t rw_mgr_mem_calibrate_writes(uint32_t rank_bgn, uint32_t g, uint3 return 1; } -//USER precharge all banks and activate row 0 in bank "000..." and bank "111..." +//USER precharge all banks and activate row 0 in bank "000..." and bank "111..." static void mem_precharge_and_activate(void) { uint32_t r; @@ -4524,7 +4524,7 @@ static void mem_precharge_and_activate(void) //USER set rank set_rank_and_odt_mask(r, RW_MGR_ODT_MODE_OFF); - //USER precharge all banks ... + //USER precharge all banks ... IOWR_32DIRECT(RW_MGR_RUN_SINGLE_GROUP, 0, __RW_MGR_PRECHARGE_ALL); IOWR_32DIRECT(RW_MGR_LOAD_CNTR_0, 0, 0x0F); @@ -4533,7 +4533,7 @@ static void mem_precharge_and_activate(void) IOWR_32DIRECT(RW_MGR_LOAD_CNTR_1, 0, 0x0F); IOWR_32DIRECT(RW_MGR_LOAD_JUMP_ADD_1, 0, __RW_MGR_ACTIVATE_0_AND_1_WAIT2); - //USER activate rows + //USER activate rows IOWR_32DIRECT(RW_MGR_RUN_SINGLE_GROUP, 0, __RW_MGR_ACTIVATE_0_AND_1); } } @@ -4548,7 +4548,7 @@ static void mem_config(void) uint32_t rw_wl_nop_cycles; uint32_t max_latency; - //USER read in write and read latency + //USER read in write and read latency wlat = IORD_32DIRECT(MEM_T_WL_ADD, 0); wlat += IORD_32DIRECT(DATA_MGR_MEM_T_ADD, 0); /* WL for hard phy does not include additive latency */ @@ -4595,23 +4595,23 @@ static void mem_config(void) //USER configure for a burst length of 8 if (QUARTER_RATE_MODE) { - //USER write latency + //USER write latency wlat = (wlat + 5) / 4 + 1; //USER set a pretty high read latency initially gbl->curr_read_lat = (rlat + 1) / 4 + 8; } else if (HALF_RATE_MODE) { - //USER write latency + //USER write latency wlat = (wlat - 1) / 2 + 1; - //USER set a pretty high read latency initially + //USER set a pretty high read latency initially gbl->curr_read_lat = (rlat + 1) / 2 + 8; } else { - //USER write latency + //USER write latency // Adjust Write Latency for Hard PHY wlat = wlat + 1; - //USER set a pretty high read latency initially + //USER set a pretty high read latency initially gbl->curr_read_lat = rlat + 16; } @@ -4620,7 +4620,7 @@ static void mem_config(void) } IOWR_32DIRECT(PHY_MGR_PHY_RLAT, 0, gbl->curr_read_lat); - //USER advertise write latency + //USER advertise write latency gbl->curr_write_lat = wlat; IOWR_32DIRECT(PHY_MGR_AFI_WLAT, 0, wlat - 2); @@ -4636,7 +4636,7 @@ static void mem_skip_calibrate(void) uint32_t vfifo_offset; uint32_t i, j, r; - // Need to update every shadow register set used by the interface + // Need to update every shadow register set used by the interface for (r = 0; r < RW_MGR_MEM_NUMBER_OF_RANKS; r += NUM_RANKS_PER_SHADOW_REG) { // Strictly speaking this should be called once per group to make @@ -4653,7 +4653,7 @@ static void mem_skip_calibrate(void) // // Write data arrives to the I/O two cycles before write latency is reached (720 deg). // -> due to bit-slip in a/c bus - // -> to allow board skew where dqs is longer than ck + // -> to allow board skew where dqs is longer than ck // -> how often can this happen!? // -> can claim back some ptaps for high freq support if we can relax this, but i digress... // @@ -4683,7 +4683,7 @@ static void mem_skip_calibrate(void) IOWR_32DIRECT(SCC_MGR_UPD, 0, 0); } - // Compensate for simulation model behaviour + // Compensate for simulation model behaviour for (i = 0; i < RW_MGR_MEM_IF_READ_DQS_WIDTH; i++) { scc_mgr_set_dqs_bus_in_delay(i, 10); scc_mgr_load_dqs(i); @@ -4741,7 +4741,7 @@ static uint32_t mem_calibrate(void) } if (((DYNAMIC_CALIB_STEPS) & CALIB_SKIP_ALL) == CALIB_SKIP_ALL) { - //USER Set VFIFO and LFIFO to instant-on settings in skip calibration mode + //USER Set VFIFO and LFIFO to instant-on settings in skip calibration mode mem_skip_calibrate(); } else { @@ -4781,7 +4781,7 @@ static uint32_t mem_calibrate(void) RW_MGR_MEM_IF_WRITE_DQS_WIDTH && group_failed == 0; read_group++, read_test_bgn += RW_MGR_MEM_DQ_PER_READ_DQS) { - //USER Calibrate the VFIFO + //USER Calibrate the VFIFO if (!((STATIC_CALIB_STEPS) & CALIB_SKIP_VFIFO)) { if (!rw_mgr_mem_calibrate_vfifo (read_group, read_test_bgn)) { @@ -4797,7 +4797,7 @@ static uint32_t mem_calibrate(void) } } - //USER level writes (or align DK with CK for RLDRAMX) + //USER level writes (or align DK with CK for RLDRAMX) if (group_failed == 0) { if ((DDRX || RLDRAMII) && !(ARRIAV || CYCLONEV)) { if (!((STATIC_CALIB_STEPS) & CALIB_SKIP_WLEVEL)) { @@ -4815,7 +4815,7 @@ static uint32_t mem_calibrate(void) } } } - //USER Calibrate the output side + //USER Calibrate the output side if (group_failed == 0) { for (rank_bgn = 0, sr = 0; rank_bgn < RW_MGR_MEM_NUMBER_OF_RANKS; @@ -4899,7 +4899,7 @@ static uint32_t mem_calibrate(void) if (failing_groups != 0) { return 0; } - //USER Calibrate the LFIFO + //USER Calibrate the LFIFO if (!((STATIC_CALIB_STEPS) & CALIB_SKIP_LFIFO)) { //USER If we're skipping groups as part of debug, don't calibrate LFIFO if (param->skip_groups == 0) { @@ -4952,7 +4952,7 @@ static uint32_t run_mem_calibrate(void) #endif } - //USER Handoff + //USER Handoff //USER Don't return control of the PHY back to AFI when in debug mode if ((gbl->phy_debug_mode_flags & PHY_DEBUG_IN_DEBUG_MODE) == 0) { @@ -5045,7 +5045,7 @@ static void initialize_hps_phy(void) // These may need to be included also: // wrap_back_en (false) // atpg_en (false) - // pipelineglobalenable (true) + // pipelineglobalenable (true) uint32_t reg; // Tracking also gets configured here because it's in the same register @@ -5148,7 +5148,7 @@ static int socfpga_mem_calibration(void) // Set the calibration enabled by default gbl->phy_debug_mode_flags |= PHY_DEBUG_ENABLE_CAL_RPT; // Only enable margining by default if requested - // Only sweep all groups (regardless of fail state) by default if requested + // Only sweep all groups (regardless of fail state) by default if requested //Set enabled read test by default // Initialize the register file diff --git a/arch/arm/mach-socfpga/xload.c b/arch/arm/mach-socfpga/xload.c index fd0d777add..7f8f0320ca 100644 --- a/arch/arm/mach-socfpga/xload.c +++ b/arch/arm/mach-socfpga/xload.c @@ -2,7 +2,7 @@ #include <platform_data/dw_mmc.h> #include <bootsource.h> #include <bootstrap.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <common.h> #include <malloc.h> #include <init.h> diff --git a/arch/arm/mach-tegra/tegra20.c b/arch/arm/mach-tegra/tegra20.c index 8d1cd5b2fb..10c149a955 100644 --- a/arch/arm/mach-tegra/tegra20.c +++ b/arch/arm/mach-tegra/tegra20.c @@ -16,7 +16,6 @@ #include <common.h> #include <init.h> -#include <ns16550.h> #include <asm/memory.h> #include <mach/iomap.h> #include <mach/lowlevel.h> diff --git a/arch/blackfin/boards/ipe337/ipe337.c b/arch/blackfin/boards/ipe337/ipe337.c index 84cc786f85..604062a54b 100644 --- a/arch/blackfin/boards/ipe337/ipe337.c +++ b/arch/blackfin/boards/ipe337/ipe337.c @@ -4,7 +4,7 @@ #include <asm/cpu/cdefBF561.h> #include <partition.h> #include <fs.h> -#include <smc911x.h> +#include <platform_data/eth-smc911x.h> struct smc911x_plat smcplat = { .shift = 1, diff --git a/arch/blackfin/cpu-bf561/start.S b/arch/blackfin/cpu-bf561/start.S index 96da6b5dda..56c5e8455d 100644 --- a/arch/blackfin/cpu-bf561/start.S +++ b/arch/blackfin/cpu-bf561/start.S @@ -56,7 +56,7 @@ _stext: SSYNC; /* As per HW reference manual DAG registers, - * DATA and Address resgister shall be zero'd + * DATA and Address resgister shall be zero'd * in initialization, after a reset state */ r1 = 0; /* Data registers zero'd */ @@ -73,7 +73,7 @@ _stext: p3 = 0; p4 = 0; p5 = 0; - + i0 = 0; /* DAG Registers zero'd */ i1 = 0; i2 = 0; @@ -124,7 +124,7 @@ no_soft_reset: r1 = 0; LSETUP(4,4) lc0 = p1; [ p0 ++ ] = r1; - + p0.h = hi(SIC_IWR); p0.l = lo(SIC_IWR); r0.l = 0x1; @@ -217,8 +217,8 @@ _real_start: #ifdef CONFIG_BF537 -/* Initialise General-Purpose I/O Modules on BF537 - * Rev 0.0 Anomaly 05000212 - PORTx_FER, +/* Initialise General-Purpose I/O Modules on BF537 + * Rev 0.0 Anomaly 05000212 - PORTx_FER, * PORT_MUX Registers Do Not accept "writes" correctly */ p0.h = hi(PORTF_FER); @@ -292,8 +292,8 @@ DMA: /* Set Destination DMAConfig = DMA Enable, Memory Write, 8-Bit Transfers, 1-D DMA, Flow - Stop, IOC */ W[P1+OFFSET_(MDMA_D0_CONFIG)] = R4; - -WAIT_DMA_DONE: + +WAIT_DMA_DONE: p0.h = hi(MDMA_D0_IRQ_STATUS); p0.l = lo(MDMA_D0_IRQ_STATUS); R0 = W[P0](Z); diff --git a/arch/blackfin/include/asm/cpu/cdefBF561.h b/arch/blackfin/include/asm/cpu/cdefBF561.h index 60fdf1eb79..9a763df04f 100644 --- a/arch/blackfin/include/asm/cpu/cdefBF561.h +++ b/arch/blackfin/include/asm/cpu/cdefBF561.h @@ -11,7 +11,7 @@ #ifndef _CDEF_BF561_H #define _CDEF_BF561_H -/* +/* * #if !defined(__ADSPBF561__) * #warning cdefBF561.h should only be included for BF561 chip. * #endif @@ -299,7 +299,7 @@ #define pPPI0_DELAY (volatile unsigned short *)PPI0_DELAY #define pPPI0_FRAME (volatile unsigned short *)PPI0_FRAME -/* Parallel Peripheral Interface (PPI) 1 registers (0xFFC0 1300-0xFFC0 13FF)*/ +/* Parallel Peripheral Interface (PPI) 1 registers (0xFFC0 1300-0xFFC0 13FF)*/ #define pPPI1_CONTROL (volatile unsigned short *)PPI1_CONTROL #define pPPI1_STATUS (volatile unsigned short *)PPI1_STATUS #define pPPI1_COUNT (volatile unsigned short *)PPI1_COUNT diff --git a/arch/blackfin/include/asm/cpu/defBF561.h b/arch/blackfin/include/asm/cpu/defBF561.h index 11de2beb62..5ab53ab7f0 100644 --- a/arch/blackfin/include/asm/cpu/defBF561.h +++ b/arch/blackfin/include/asm/cpu/defBF561.h @@ -36,7 +36,7 @@ // System Reset and Interrupt Controller registers for // core A (0xFFC0 0100-0xFFC0 01FF) #define SICA_SWRST 0xFFC00100 // Software Reset register -#define SICA_SYSCR 0xFFC00104 // System Reset Configuration +#define SICA_SYSCR 0xFFC00104 // System Reset Configuration // register #define SICA_RVECT 0xFFC00108 // SIC Reset Vector Address // Register @@ -146,22 +146,22 @@ // Register // Timer 0-7 registers (0xFFC0 0600-0xFFC0 06FF) -#define TIMER0_CONFIG 0xFFC00600 // Timer0 Configuration +#define TIMER0_CONFIG 0xFFC00600 // Timer0 Configuration // register #define TIMER0_COUNTER 0xFFC00604 // Timer0 Counter register #define TIMER0_PERIOD 0xFFC00608 // Timer0 Period register #define TIMER0_WIDTH 0xFFC0060C // Timer0 Width register -#define TIMER1_CONFIG 0xFFC00610 // Timer1 Configuration +#define TIMER1_CONFIG 0xFFC00610 // Timer1 Configuration // register #define TIMER1_COUNTER 0xFFC00614 // Timer1 Counter register #define TIMER1_PERIOD 0xFFC00618 // Timer1 Period register #define TIMER1_WIDTH 0xFFC0061C // Timer1 Width register -#define TIMER2_CONFIG 0xFFC00620 // Timer2 Configuration +#define TIMER2_CONFIG 0xFFC00620 // Timer2 Configuration // register #define TIMER2_COUNTER 0xFFC00624 // Timer2 Counter register #define TIMER2_PERIOD 0xFFC00628 // Timer2 Period register #define TIMER2_WIDTH 0xFFC0062C // Timer2 Width register -#define TIMER3_CONFIG 0xFFC00630 // Timer3 Configuration +#define TIMER3_CONFIG 0xFFC00630 // Timer3 Configuration // register #define TIMER3_COUNTER 0xFFC00634 // Timer3 Counter register #define TIMER3_PERIOD 0xFFC00638 // Timer3 Period register @@ -171,17 +171,17 @@ #define TIMER4_COUNTER 0xFFC00644 // Timer4 Counter register #define TIMER4_PERIOD 0xFFC00648 // Timer4 Period register #define TIMER4_WIDTH 0xFFC0064C // Timer4 Width register -#define TIMER5_CONFIG 0xFFC00650 // Timer5 Configuration +#define TIMER5_CONFIG 0xFFC00650 // Timer5 Configuration // register #define TIMER5_COUNTER 0xFFC00654 // Timer5 Counter register #define TIMER5_PERIOD 0xFFC00658 // Timer5 Period register #define TIMER5_WIDTH 0xFFC0065C // Timer5 Width register -#define TIMER6_CONFIG 0xFFC00660 // Timer6 Configuration +#define TIMER6_CONFIG 0xFFC00660 // Timer6 Configuration // register #define TIMER6_COUNTER 0xFFC00664 // Timer6 Counter register #define TIMER6_PERIOD 0xFFC00668 // Timer6 Period register #define TIMER6_WIDTH 0xFFC0066C // Timer6 Width register -#define TIMER7_CONFIG 0xFFC00670 // Timer7 Configuration +#define TIMER7_CONFIG 0xFFC00670 // Timer7 Configuration // register #define TIMER7_COUNTER 0xFFC00674 // Timer7 Counter register #define TIMER7_PERIOD 0xFFC00678 // Timer7 Period register @@ -192,22 +192,22 @@ #define TMRS8_STATUS 0xFFC00688 // Timer Status register // Timer registers 8-11 (0xFFC0 1600-0xFFC0 16FF) -#define TIMER8_CONFIG 0xFFC01600 // Timer8 Configuration +#define TIMER8_CONFIG 0xFFC01600 // Timer8 Configuration // register #define TIMER8_COUNTER 0xFFC01604 // Timer8 Counter register #define TIMER8_PERIOD 0xFFC01608 // Timer8 Period register #define TIMER8_WIDTH 0xFFC0160C // Timer8 Width register -#define TIMER9_CONFIG 0xFFC01610 // Timer9 Configuration +#define TIMER9_CONFIG 0xFFC01610 // Timer9 Configuration // register #define TIMER9_COUNTER 0xFFC01614 // Timer9 Counter register #define TIMER9_PERIOD 0xFFC01618 // Timer9 Period register #define TIMER9_WIDTH 0xFFC0161C // Timer9 Width register -#define TIMER10_CONFIG 0xFFC01620 // Timer10 Configuration +#define TIMER10_CONFIG 0xFFC01620 // Timer10 Configuration // register #define TIMER10_COUNTER 0xFFC01624 // Timer10 Counter register #define TIMER10_PERIOD 0xFFC01628 // Timer10 Period register #define TIMER10_WIDTH 0xFFC0162C // Timer10 Width register -#define TIMER11_CONFIG 0xFFC01630 // Timer11 Configuration +#define TIMER11_CONFIG 0xFFC01630 // Timer11 Configuration // register #define TIMER11_COUNTER 0xFFC01634 // Timer11 Counter register #define TIMER11_PERIOD 0xFFC01638 // Timer11 Period register @@ -240,9 +240,9 @@ // register #define FIO0_DIR 0xFFC00730 // Flag Direction register #define FIO0_POLAR 0xFFC00734 // Flag Polarity register -#define FIO0_EDGE 0xFFC00738 // Flag Interrupt Sensitivity +#define FIO0_EDGE 0xFFC00738 // Flag Interrupt Sensitivity // register -#define FIO0_BOTH 0xFFC0073C // Flag Set on Both Edges +#define FIO0_BOTH 0xFFC0073C // Flag Set on Both Edges // register #define FIO0_INEN 0xFFC00740 // Flag Input Enable register @@ -269,9 +269,9 @@ // register #define FIO1_DIR 0xFFC01530 // Flag Direction register #define FIO1_POLAR 0xFFC01534 // Flag Polarity register -#define FIO1_EDGE 0xFFC01538 // Flag Interrupt Sensitivity +#define FIO1_EDGE 0xFFC01538 // Flag Interrupt Sensitivity // register -#define FIO1_BOTH 0xFFC0153C // Flag Set on Both Edges +#define FIO1_BOTH 0xFFC0153C // Flag Set on Both Edges // register #define FIO1_INEN 0xFFC01540 // Flag Input Enable register @@ -298,9 +298,9 @@ // register #define FIO2_DIR 0xFFC01730 // Flag Direction register #define FIO2_POLAR 0xFFC01734 // Flag Polarity register -#define FIO2_EDGE 0xFFC01738 // Flag Interrupt Sensitivity +#define FIO2_EDGE 0xFFC01738 // Flag Interrupt Sensitivity // register -#define FIO2_BOTH 0xFFC0173C // Flag Set on Both Edges +#define FIO2_BOTH 0xFFC0173C // Flag Set on Both Edges // register #define FIO2_INEN 0xFFC01740 // Flag Input Enable register @@ -386,8 +386,8 @@ #define SPORT1_MRCS3 0xFFC0095C // SPORT1 Multi-Channel // Receive Select Register 3 -// Asynchronous Memory Controller - External Bus Interface Unit -#define EBIU_AMGCTL 0xFFC00A00 // Asynchronous Memory +// Asynchronous Memory Controller - External Bus Interface Unit +#define EBIU_AMGCTL 0xFFC00A00 // Asynchronous Memory // Global Control Register #define EBIU_AMBCTL0 0xFFC00A04 // Asynchronous Memory // Bank Control Register 0 @@ -395,10 +395,10 @@ // Bank Control Register 1 // SDRAM Controller External Bus Interface Unit (0xFFC00A00 - 0xFFC00AFF) -#define EBIU_SDGCTL 0xFFC00A10 // SDRAM Global Control +#define EBIU_SDGCTL 0xFFC00A10 // SDRAM Global Control // Register #define EBIU_SDBCTL 0xFFC00A14 // SDRAM Bank Control Register -#define EBIU_SDRRC 0xFFC00A18 // SDRAM Refresh Rate Control +#define EBIU_SDRRC 0xFFC00A18 // SDRAM Refresh Rate Control // Register #define EBIU_SDSTAT 0xFFC00A1C // SDRAM Status Register @@ -442,7 +442,7 @@ // Addr Increment #define DMA1_0_CURR_DESC_PTR 0xFFC01C20 // DMA1 Channel 0 Current // Descriptor Pointer -#define DMA1_0_CURR_ADDR 0xFFC01C24 // DMA1 Channel 0 Current +#define DMA1_0_CURR_ADDR 0xFFC01C24 // DMA1 Channel 0 Current // Address Pointer #define DMA1_0_CURR_X_COUNT 0xFFC01C30 // DMA1 Channel 0 Current Inner // Loop Count @@ -710,7 +710,7 @@ // Loop Count #define DMA1_10_IRQ_STATUS 0xFFC01EA8 // DMA1 Channel 10 Interrupt // /Status Register -#define DMA1_10_PERIPHERAL_MAP 0xFFC01EAC // DMA1 Channel 10 Peripheral +#define DMA1_10_PERIPHERAL_MAP 0xFFC01EAC // DMA1 Channel 10 Peripheral // Map Register #define DMA1_11_CONFIG 0xFFC01EC8 // DMA1 Channel 11 Configuration @@ -736,7 +736,7 @@ // Loop Count #define DMA1_11_IRQ_STATUS 0xFFC01EE8 // DMA1 Channel 11 Interrupt // /Status Register -#define DMA1_11_PERIPHERAL_MAP 0xFFC01EEC // DMA1 Channel 11 Peripheral +#define DMA1_11_PERIPHERAL_MAP 0xFFC01EEC // DMA1 Channel 11 Peripheral // Map Register // Memory DMA1 Controller registers (0xFFC0 1E80-0xFFC0 1FFF) @@ -1134,7 +1134,7 @@ // Loop Count #define DMA2_10_IRQ_STATUS 0xFFC00EA8 // DMA2 Channel 10 Interrupt // /Status Register -#define DMA2_10_PERIPHERAL_MAP 0xFFC00EAC // DMA2 Channel 10 Peripheral +#define DMA2_10_PERIPHERAL_MAP 0xFFC00EAC // DMA2 Channel 10 Peripheral // Map Register #define DMA2_11_CONFIG 0xFFC00EC8 // DMA2 Channel 11 Configuration @@ -1160,7 +1160,7 @@ // Loop Count #define DMA2_11_IRQ_STATUS 0xFFC00EE8 // DMA2 Channel 11 Interrupt // /Status Register -#define DMA2_11_PERIPHERAL_MAP 0xFFC00EEC // DMA2 Channel 11 Peripheral +#define DMA2_11_PERIPHERAL_MAP 0xFFC00EEC // DMA2 Channel 11 Peripheral // Map Register // Memory DMA2 Controller registers (0xFFC0 0E80-0xFFC0 0FFF) @@ -1190,7 +1190,7 @@ #define MDMA2_D0_IRQ_STATUS 0xFFC00F28 // MemDMA2 Stream 0 Dest // Interrupt/Status Register #define MDMA2_D0_PERIPHERAL_MAP 0xFFC00F2C // MemDMA2 Stream 0 - // Destination Peripheral Map + // Destination Peripheral Map // register #define MDMA2_S0_CONFIG 0xFFC00F48 // MemDMA2 Stream 0 Source @@ -1247,7 +1247,7 @@ #define MDMA2_D1_IRQ_STATUS 0xFFC00FA8 // MemDMA2 Stream 1 Destination // Interrupt/Status Reg #define MDMA2_D1_PERIPHERAL_MAP 0xFFC00FAC // MemDMA2 Stream 1 - // Destination Peripheral Map + // Destination Peripheral Map // register #define MDMA2_S1_CONFIG 0xFFC00FC8 // MemDMA2 Stream 1 Source @@ -1280,7 +1280,7 @@ // Internal Memory DMA Registers (0xFFC0_1800 - 0xFFC0_19FF) #define IMDMA_D0_CONFIG 0xFFC01808 // IMDMA Stream 0 Destination // Configuration -#define IMDMA_D0_NEXT_DESC_PTR 0xFFC01800 // IMDMA Stream 0 Destination +#define IMDMA_D0_NEXT_DESC_PTR 0xFFC01800 // IMDMA Stream 0 Destination // Next Descriptor Ptr Reg #define IMDMA_D0_START_ADDR 0xFFC01804 // IMDMA Stream 0 Destination // Start Address @@ -1292,20 +1292,20 @@ // Inner-Loop Address-Increment #define IMDMA_D0_Y_MODIFY 0xFFC0181C // IMDMA Stream 0 Dest // Outer-Loop Address-Increment -#define IMDMA_D0_CURR_DESC_PTR 0xFFC01820 // IMDMA Stream 0 Destination +#define IMDMA_D0_CURR_DESC_PTR 0xFFC01820 // IMDMA Stream 0 Destination // Current Descriptor Ptr #define IMDMA_D0_CURR_ADDR 0xFFC01824 // IMDMA Stream 0 Destination // Current Address -#define IMDMA_D0_CURR_X_COUNT 0xFFC01830 // IMDMA Stream 0 Destination +#define IMDMA_D0_CURR_X_COUNT 0xFFC01830 // IMDMA Stream 0 Destination // Current Inner-Loop Count -#define IMDMA_D0_CURR_Y_COUNT 0xFFC01838 // IMDMA Stream 0 Destination +#define IMDMA_D0_CURR_Y_COUNT 0xFFC01838 // IMDMA Stream 0 Destination // Current Outer-Loop Count #define IMDMA_D0_IRQ_STATUS 0xFFC01828 // IMDMA Stream 0 Destination // Interrupt/Status #define IMDMA_S0_CONFIG 0xFFC01848 // IMDMA Stream 0 Source // Configuration -#define IMDMA_S0_NEXT_DESC_PTR 0xFFC01840 // IMDMA Stream 0 Source Next +#define IMDMA_S0_NEXT_DESC_PTR 0xFFC01840 // IMDMA Stream 0 Source Next // Descriptor Ptr Reg #define IMDMA_S0_START_ADDR 0xFFC01844 // IMDMA Stream 0 Source Start // Address @@ -1330,7 +1330,7 @@ #define IMDMA_D1_CONFIG 0xFFC01888 // IMDMA Stream 1 Destination // Configuration -#define IMDMA_D1_NEXT_DESC_PTR 0xFFC01880 // IMDMA Stream 1 Destination +#define IMDMA_D1_NEXT_DESC_PTR 0xFFC01880 // IMDMA Stream 1 Destination // Next Descriptor Ptr Reg #define IMDMA_D1_START_ADDR 0xFFC01884 // IMDMA Stream 1 Destination // Start Address @@ -1342,20 +1342,20 @@ // Inner-Loop Address-Increment #define IMDMA_D1_Y_MODIFY 0xFFC0189C // IMDMA Stream 1 Dest // Outer-Loop Address-Increment -#define IMDMA_D1_CURR_DESC_PTR 0xFFC018A0 // IMDMA Stream 1 Destination +#define IMDMA_D1_CURR_DESC_PTR 0xFFC018A0 // IMDMA Stream 1 Destination // Current Descriptor Ptr #define IMDMA_D1_CURR_ADDR 0xFFC018A4 // IMDMA Stream 1 Destination // Current Address -#define IMDMA_D1_CURR_X_COUNT 0xFFC018B0 // IMDMA Stream 1 Destination +#define IMDMA_D1_CURR_X_COUNT 0xFFC018B0 // IMDMA Stream 1 Destination // Current Inner-Loop Count -#define IMDMA_D1_CURR_Y_COUNT 0xFFC018B8 // IMDMA Stream 1 Destination +#define IMDMA_D1_CURR_Y_COUNT 0xFFC018B8 // IMDMA Stream 1 Destination // Current Outer-Loop Count #define IMDMA_D1_IRQ_STATUS 0xFFC018A8 // IMDMA Stream 1 Destination // Interrupt/Status #define IMDMA_S1_CONFIG 0xFFC018C8 // IMDMA Stream 1 Source // Configuration -#define IMDMA_S1_NEXT_DESC_PTR 0xFFC018C0 // IMDMA Stream 1 Source Next +#define IMDMA_S1_NEXT_DESC_PTR 0xFFC018C0 // IMDMA Stream 1 Source Next // Descriptor Ptr Reg #define IMDMA_S1_START_ADDR 0xFFC018C4 // IMDMA Stream 1 Source Start // Address @@ -1413,22 +1413,22 @@ // ************* SYSTEM INTERRUPT CONTROLLER MASKS ***************** -// SICu_IARv Masks +// SICu_IARv Masks // u = A or B // v = 0 to 7 // w = 0 or 1 // Per_number = 0 to 63 -// IVG_number = 7 to 15 +// IVG_number = 7 to 15 // Peripheral #Per_number assigned IVG #IVG_number -// Usage: +// Usage: // r0.l = lo(Peripheral_IVG(62, 10)); // r0.h = hi(Peripheral_IVG(62, 10)); #define Peripheral_IVG(Per_number, IVG_number) \ ( (IVG_number) -7) << ( ((Per_number)%8) *4) // SICx_IMASKw Masks -// masks are 32 bit wide, so two writes reguired for "64 bit" wide registers +// masks are 32 bit wide, so two writes reguired for "64 bit" wide registers #define SIC_UNMASK_ALL 0x00000000 // Unmask all peripheral // interrupts #define SIC_MASK_ALL 0xFFFFFFFF // Mask all peripheral @@ -1612,9 +1612,9 @@ // Relationship #define MFD 0x0000F000 // Multichannel Frame Delay -// ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** +// ********* PARALLEL PERIPHERAL INTERFACE (PPI) MASKS **************** -//// PPI_CONTROL Masks +//// PPI_CONTROL Masks #define PORT_EN 0x00000001 // PPI Port Enable #define PORT_DIR 0x00000002 // PPI Port Direction #define XFR_TYPE 0x0000000C // PPI Transfer Type @@ -1630,7 +1630,7 @@ // x=10-->x=16) #define POL 0x0000C000 // PPI Signal Polarities -//// PPI_STATUS Masks +//// PPI_STATUS Masks #define FLD 0x00000400 // Field Indicator #define FT_ERR 0x00000800 // Frame Track Error #define OVR 0x00001000 // FIFO Overflow Error @@ -1893,7 +1893,7 @@ // incoming Data #define PSSE 0x00000010 // Enable (=1) Slave-Select // input for Master. -#define EMISO 0x00000020 // Enable (=1) MISO pin as an +#define EMISO 0x00000020 // Enable (=1) MISO pin as an // output. #define SIZE 0x00000100 // Word length (0 => 8 bits, // 1 => 16 bits) @@ -1917,25 +1917,25 @@ // disable (=0) //// SPI_FLG Masks -#define FLS1 0x00000002 // Enables (=1) SPI_FLOUT1 as +#define FLS1 0x00000002 // Enables (=1) SPI_FLOUT1 as // flag output for SPI // Slave-select -#define FLS2 0x00000004 // Enables (=1) SPI_FLOUT2 as +#define FLS2 0x00000004 // Enables (=1) SPI_FLOUT2 as // flag output for SPI // Slave-select -#define FLS3 0x00000008 // Enables (=1) SPI_FLOUT3 as +#define FLS3 0x00000008 // Enables (=1) SPI_FLOUT3 as // flag output for SPI // Slave-select -#define FLS4 0x00000010 // Enables (=1) SPI_FLOUT4 as +#define FLS4 0x00000010 // Enables (=1) SPI_FLOUT4 as // flag output for SPI // Slave-select -#define FLS5 0x00000020 // Enables (=1) SPI_FLOUT5 as +#define FLS5 0x00000020 // Enables (=1) SPI_FLOUT5 as // flag output for SPI // Slave-select -#define FLS6 0x00000040 // Enables (=1) SPI_FLOUT6 as +#define FLS6 0x00000040 // Enables (=1) SPI_FLOUT6 as // flag output for SPI // Slave-select -#define FLS7 0x00000080 // Enables (=1) SPI_FLOUT7 as +#define FLS7 0x00000080 // Enables (=1) SPI_FLOUT7 as // flag output for SPI // Slave-select #define FLG1 0x00000200 // Activates (=0) SPI_FLOUT1 @@ -1961,25 +1961,25 @@ // Slave-select //// SPI_FLG Bit Positions -#define FLS1_P 0x00000001 // Enables (=1) SPI_FLOUT1 as +#define FLS1_P 0x00000001 // Enables (=1) SPI_FLOUT1 as // flag output for SPI // Slave-select -#define FLS2_P 0x00000002 // Enables (=1) SPI_FLOUT2 as +#define FLS2_P 0x00000002 // Enables (=1) SPI_FLOUT2 as // flag output for SPI // Slave-select -#define FLS3_P 0x00000003 // Enables (=1) SPI_FLOUT3 as +#define FLS3_P 0x00000003 // Enables (=1) SPI_FLOUT3 as // flag output for SPI // Slave-select -#define FLS4_P 0x00000004 // Enables (=1) SPI_FLOUT4 as +#define FLS4_P 0x00000004 // Enables (=1) SPI_FLOUT4 as // flag output for SPI // Slave-select -#define FLS5_P 0x00000005 // Enables (=1) SPI_FLOUT5 as +#define FLS5_P 0x00000005 // Enables (=1) SPI_FLOUT5 as // flag output for SPI // Slave-select -#define FLS6_P 0x00000006 // Enables (=1) SPI_FLOUT6 as +#define FLS6_P 0x00000006 // Enables (=1) SPI_FLOUT6 as // flag output for SPI // Slave-select -#define FLS7_P 0x00000007 // Enables (=1) SPI_FLOUT7 as +#define FLS7_P 0x00000007 // Enables (=1) SPI_FLOUT7 as // flag output for SPI // Slave-select #define FLG1_P 0x00000009 // Activates (=0) SPI_FLOUT1 @@ -2012,8 +2012,8 @@ // device when some other // device tries to become // master -#define TXE 0x00000004 // Set (=1) when transmission - // occurs with no new data in +#define TXE 0x00000004 // Set (=1) when transmission + // occurs with no new data in // SPI_TDBR #define TXS 0x00000008 // SPI_TDBR Data Buffer // Status (0=Empty, 1=Full) @@ -2031,7 +2031,7 @@ #define AMCKEN 0x0001 // Enable CLKOUT #define AMBEN_B0 0x0002 // Enable Asynchronous Memory Bank 0 // only -#define AMBEN_B0_B1 0x0004 // Enable Asynchronous Memory Banks 0 +#define AMBEN_B0_B1 0x0004 // Enable Asynchronous Memory Banks 0 // & 1 only #define AMBEN_B0_B1_B2 0x0006 // Enable Asynchronous Memory Banks 0, // 1, and 2 @@ -2128,35 +2128,35 @@ // 14 cycles #define B0RAT_15 0x00000F00 // Bank 0 Read Access Time = // 15 cycles -#define B0WAT_1 0x00001000 // Bank 0 Write Access Time = +#define B0WAT_1 0x00001000 // Bank 0 Write Access Time = // 1 cycle -#define B0WAT_2 0x00002000 // Bank 0 Write Access Time = +#define B0WAT_2 0x00002000 // Bank 0 Write Access Time = // 2 cycles -#define B0WAT_3 0x00003000 // Bank 0 Write Access Time = +#define B0WAT_3 0x00003000 // Bank 0 Write Access Time = // 3 cycles -#define B0WAT_4 0x00004000 // Bank 0 Write Access Time = +#define B0WAT_4 0x00004000 // Bank 0 Write Access Time = // 4 cycles -#define B0WAT_5 0x00005000 // Bank 0 Write Access Time = +#define B0WAT_5 0x00005000 // Bank 0 Write Access Time = // 5 cycles -#define B0WAT_6 0x00006000 // Bank 0 Write Access Time = +#define B0WAT_6 0x00006000 // Bank 0 Write Access Time = // 6 cycles -#define B0WAT_7 0x00007000 // Bank 0 Write Access Time = +#define B0WAT_7 0x00007000 // Bank 0 Write Access Time = // 7 cycles -#define B0WAT_8 0x00008000 // Bank 0 Write Access Time = +#define B0WAT_8 0x00008000 // Bank 0 Write Access Time = // 8 cycles -#define B0WAT_9 0x00009000 // Bank 0 Write Access Time = +#define B0WAT_9 0x00009000 // Bank 0 Write Access Time = // 9 cycles -#define B0WAT_10 0x0000A000 // Bank 0 Write Access Time = +#define B0WAT_10 0x0000A000 // Bank 0 Write Access Time = // 10 cycles -#define B0WAT_11 0x0000B000 // Bank 0 Write Access Time = +#define B0WAT_11 0x0000B000 // Bank 0 Write Access Time = // 11 cycles -#define B0WAT_12 0x0000C000 // Bank 0 Write Access Time = +#define B0WAT_12 0x0000C000 // Bank 0 Write Access Time = // 12 cycles -#define B0WAT_13 0x0000D000 // Bank 0 Write Access Time = +#define B0WAT_13 0x0000D000 // Bank 0 Write Access Time = // 13 cycles -#define B0WAT_14 0x0000E000 // Bank 0 Write Access Time = +#define B0WAT_14 0x0000E000 // Bank 0 Write Access Time = // 14 cycles -#define B0WAT_15 0x0000F000 // Bank 0 Write Access Time = +#define B0WAT_15 0x0000F000 // Bank 0 Write Access Time = // 15 cycles #define B1RDYEN 0x00010000 // Bank 1 RDY enable, // 0=disable, 1=enable @@ -2175,29 +2175,29 @@ #define B1TT_4 0x00000000 // Bank 1 Transition Time // from Read to Write = 4 // cycles -#define B1ST_1 0x00100000 // Bank 1 Setup Time from AOE +#define B1ST_1 0x00100000 // Bank 1 Setup Time from AOE // asserted to Read or Write // asserted = 1 cycle -#define B1ST_2 0x00200000 // Bank 1 Setup Time from AOE +#define B1ST_2 0x00200000 // Bank 1 Setup Time from AOE // asserted to Read or Write // asserted = 2 cycles -#define B1ST_3 0x00300000 // Bank 1 Setup Time from AOE +#define B1ST_3 0x00300000 // Bank 1 Setup Time from AOE // asserted to Read or Write // asserted = 3 cycles -#define B1ST_4 0x00000000 // Bank 1 Setup Time from AOE +#define B1ST_4 0x00000000 // Bank 1 Setup Time from AOE // asserted to Read or Write // asserted = 4 cycles -#define B1HT_1 0x00400000 // Bank 1 Hold Time from Read - // or Write deasserted to AOE +#define B1HT_1 0x00400000 // Bank 1 Hold Time from Read + // or Write deasserted to AOE // deasserted = 1 cycle -#define B1HT_2 0x00800000 // Bank 1 Hold Time from Read - // or Write deasserted to AOE +#define B1HT_2 0x00800000 // Bank 1 Hold Time from Read + // or Write deasserted to AOE // deasserted = 2 cycles -#define B1HT_3 0x00C00000 // Bank 1 Hold Time from Read - // or Write deasserted to AOE +#define B1HT_3 0x00C00000 // Bank 1 Hold Time from Read + // or Write deasserted to AOE // deasserted = 3 cycles -#define B1HT_0 0x00000000 // Bank 1 Hold Time from Read - // or Write deasserted to AOE +#define B1HT_0 0x00000000 // Bank 1 Hold Time from Read + // or Write deasserted to AOE // deasserted = 0 cycles #define B1RAT_1 0x01000000 // Bank 1 Read Access Time = // 1 cycle @@ -2229,35 +2229,35 @@ // 14 cycles #define B1RAT_15 0x0F000000 // Bank 1 Read Access Time = // 15 cycles -#define B1WAT_1 0x10000000 // Bank 1 Write Access Time = +#define B1WAT_1 0x10000000 // Bank 1 Write Access Time = // 1 cycle -#define B1WAT_2 0x20000000 // Bank 1 Write Access Time = +#define B1WAT_2 0x20000000 // Bank 1 Write Access Time = // 2 cycles -#define B1WAT_3 0x30000000 // Bank 1 Write Access Time = +#define B1WAT_3 0x30000000 // Bank 1 Write Access Time = // 3 cycles -#define B1WAT_4 0x40000000 // Bank 1 Write Access Time = +#define B1WAT_4 0x40000000 // Bank 1 Write Access Time = // 4 cycles -#define B1WAT_5 0x50000000 // Bank 1 Write Access Time = +#define B1WAT_5 0x50000000 // Bank 1 Write Access Time = // 5 cycles -#define B1WAT_6 0x60000000 // Bank 1 Write Access Time = +#define B1WAT_6 0x60000000 // Bank 1 Write Access Time = // 6 cycles -#define B1WAT_7 0x70000000 // Bank 1 Write Access Time = +#define B1WAT_7 0x70000000 // Bank 1 Write Access Time = // 7 cycles -#define B1WAT_8 0x80000000 // Bank 1 Write Access Time = +#define B1WAT_8 0x80000000 // Bank 1 Write Access Time = // 8 cycles -#define B1WAT_9 0x90000000 // Bank 1 Write Access Time = +#define B1WAT_9 0x90000000 // Bank 1 Write Access Time = // 9 cycles -#define B1WAT_10 0xA0000000 // Bank 1 Write Access Time = +#define B1WAT_10 0xA0000000 // Bank 1 Write Access Time = // 10 cycles -#define B1WAT_11 0xB0000000 // Bank 1 Write Access Time = +#define B1WAT_11 0xB0000000 // Bank 1 Write Access Time = // 11 cycles -#define B1WAT_12 0xC0000000 // Bank 1 Write Access Time = +#define B1WAT_12 0xC0000000 // Bank 1 Write Access Time = // 12 cycles -#define B1WAT_13 0xD0000000 // Bank 1 Write Access Time = +#define B1WAT_13 0xD0000000 // Bank 1 Write Access Time = // 13 cycles -#define B1WAT_14 0xE0000000 // Bank 1 Write Access Time = +#define B1WAT_14 0xE0000000 // Bank 1 Write Access Time = // 14 cycles -#define B1WAT_15 0xF0000000 // Bank 1 Write Access Time = +#define B1WAT_15 0xF0000000 // Bank 1 Write Access Time = // 15 cycles // AMBCTL1 Masks @@ -2278,29 +2278,29 @@ #define B2TT_4 0x00000000 // Bank 2 Transition Time // from Read to Write = 4 // cycles -#define B2ST_1 0x00000010 // Bank 2 Setup Time from AOE +#define B2ST_1 0x00000010 // Bank 2 Setup Time from AOE // asserted to Read or Write // asserted = 1 cycle -#define B2ST_2 0x00000020 // Bank 2 Setup Time from AOE +#define B2ST_2 0x00000020 // Bank 2 Setup Time from AOE // asserted to Read or Write // asserted = 2 cycles -#define B2ST_3 0x00000030 // Bank 2 Setup Time from AOE +#define B2ST_3 0x00000030 // Bank 2 Setup Time from AOE // asserted to Read or Write // asserted = 3 cycles -#define B2ST_4 0x00000000 // Bank 2 Setup Time from AOE +#define B2ST_4 0x00000000 // Bank 2 Setup Time from AOE // asserted to Read or Write // asserted = 4 cycles -#define B2HT_1 0x00000040 // Bank 2 Hold Time from Read - // or Write deasserted to AOE +#define B2HT_1 0x00000040 // Bank 2 Hold Time from Read + // or Write deasserted to AOE // deasserted = 1 cycle -#define B2HT_2 0x00000080 // Bank 2 Hold Time from Read - // or Write deasserted to AOE +#define B2HT_2 0x00000080 // Bank 2 Hold Time from Read + // or Write deasserted to AOE // deasserted = 2 cycles -#define B2HT_3 0x000000C0 // Bank 2 Hold Time from Read - // or Write deasserted to AOE +#define B2HT_3 0x000000C0 // Bank 2 Hold Time from Read + // or Write deasserted to AOE // deasserted = 3 cycles -#define B2HT_0 0x00000000 // Bank 2 Hold Time from Read - // or Write deasserted to AOE +#define B2HT_0 0x00000000 // Bank 2 Hold Time from Read + // or Write deasserted to AOE // deasserted = 0 cycles #define B2RAT_1 0x00000100 // Bank 2 Read Access Time = // 1 cycle @@ -2332,35 +2332,35 @@ // 14 cycles #define B2RAT_15 0x00000F00 // Bank 2 Read Access Time = // 15 cycles -#define B2WAT_1 0x00001000 // Bank 2 Write Access Time = +#define B2WAT_1 0x00001000 // Bank 2 Write Access Time = // 1 cycle -#define B2WAT_2 0x00002000 // Bank 2 Write Access Time = +#define B2WAT_2 0x00002000 // Bank 2 Write Access Time = // 2 cycles -#define B2WAT_3 0x00003000 // Bank 2 Write Access Time = +#define B2WAT_3 0x00003000 // Bank 2 Write Access Time = // 3 cycles -#define B2WAT_4 0x00004000 // Bank 2 Write Access Time = +#define B2WAT_4 0x00004000 // Bank 2 Write Access Time = // 4 cycles -#define B2WAT_5 0x00005000 // Bank 2 Write Access Time = +#define B2WAT_5 0x00005000 // Bank 2 Write Access Time = // 5 cycles -#define B2WAT_6 0x00006000 // Bank 2 Write Access Time = +#define B2WAT_6 0x00006000 // Bank 2 Write Access Time = // 6 cycles -#define B2WAT_7 0x00007000 // Bank 2 Write Access Time = +#define B2WAT_7 0x00007000 // Bank 2 Write Access Time = // 7 cycles -#define B2WAT_8 0x00008000 // Bank 2 Write Access Time = +#define B2WAT_8 0x00008000 // Bank 2 Write Access Time = // 8 cycles -#define B2WAT_9 0x00009000 // Bank 2 Write Access Time = +#define B2WAT_9 0x00009000 // Bank 2 Write Access Time = // 9 cycles -#define B2WAT_10 0x0000A000 // Bank 2 Write Access Time = +#define B2WAT_10 0x0000A000 // Bank 2 Write Access Time = // 10 cycles -#define B2WAT_11 0x0000B000 // Bank 2 Write Access Time = +#define B2WAT_11 0x0000B000 // Bank 2 Write Access Time = // 11 cycles -#define B2WAT_12 0x0000C000 // Bank 2 Write Access Time = +#define B2WAT_12 0x0000C000 // Bank 2 Write Access Time = // 12 cycles -#define B2WAT_13 0x0000D000 // Bank 2 Write Access Time = +#define B2WAT_13 0x0000D000 // Bank 2 Write Access Time = // 13 cycles -#define B2WAT_14 0x0000E000 // Bank 2 Write Access Time = +#define B2WAT_14 0x0000E000 // Bank 2 Write Access Time = // 14 cycles -#define B2WAT_15 0x0000F000 // Bank 2 Write Access Time = +#define B2WAT_15 0x0000F000 // Bank 2 Write Access Time = // 15 cycles #define B3RDYEN 0x00010000 // Bank 3 RDY enable, // 0=disable, 1=enable @@ -2379,29 +2379,29 @@ #define B3TT_4 0x00000000 // Bank 3 Transition Time // from Read to Write = 4 // cycles -#define B3ST_1 0x00100000 // Bank 3 Setup Time from AOE +#define B3ST_1 0x00100000 // Bank 3 Setup Time from AOE // asserted to Read or Write // asserted = 1 cycle -#define B3ST_2 0x00200000 // Bank 3 Setup Time from AOE +#define B3ST_2 0x00200000 // Bank 3 Setup Time from AOE // asserted to Read or Write // asserted = 2 cycles -#define B3ST_3 0x00300000 // Bank 3 Setup Time from AOE +#define B3ST_3 0x00300000 // Bank 3 Setup Time from AOE // asserted to Read or Write // asserted = 3 cycles -#define B3ST_4 0x00000000 // Bank 3 Setup Time from AOE +#define B3ST_4 0x00000000 // Bank 3 Setup Time from AOE // asserted to Read or Write // asserted = 4 cycles -#define B3HT_1 0x00400000 // Bank 3 Hold Time from Read - // or Write deasserted to AOE +#define B3HT_1 0x00400000 // Bank 3 Hold Time from Read + // or Write deasserted to AOE // deasserted = 1 cycle -#define B3HT_2 0x00800000 // Bank 3 Hold Time from Read - // or Write deasserted to AOE +#define B3HT_2 0x00800000 // Bank 3 Hold Time from Read + // or Write deasserted to AOE // deasserted = 2 cycles -#define B3HT_3 0x00C00000 // Bank 3 Hold Time from Read - // or Write deasserted to AOE +#define B3HT_3 0x00C00000 // Bank 3 Hold Time from Read + // or Write deasserted to AOE // deasserted = 3 cycles -#define B3HT_0 0x00000000 // Bank 3 Hold Time from Read - // or Write deasserted to AOE +#define B3HT_0 0x00000000 // Bank 3 Hold Time from Read + // or Write deasserted to AOE // deasserted = 0 cycles #define B3RAT_1 0x01000000 // Bank 3 Read Access Time = // 1 cycle @@ -2433,35 +2433,35 @@ // 14 cycles #define B3RAT_15 0x0F000000 // Bank 3 Read Access Time = // 15 cycles -#define B3WAT_1 0x10000000 // Bank 3 Write Access Time = +#define B3WAT_1 0x10000000 // Bank 3 Write Access Time = // 1 cycle -#define B3WAT_2 0x20000000 // Bank 3 Write Access Time = +#define B3WAT_2 0x20000000 // Bank 3 Write Access Time = // 2 cycles -#define B3WAT_3 0x30000000 // Bank 3 Write Access Time = +#define B3WAT_3 0x30000000 // Bank 3 Write Access Time = // 3 cycles -#define B3WAT_4 0x40000000 // Bank 3 Write Access Time = +#define B3WAT_4 0x40000000 // Bank 3 Write Access Time = // 4 cycles -#define B3WAT_5 0x50000000 // Bank 3 Write Access Time = +#define B3WAT_5 0x50000000 // Bank 3 Write Access Time = // 5 cycles -#define B3WAT_6 0x60000000 // Bank 3 Write Access Time = +#define B3WAT_6 0x60000000 // Bank 3 Write Access Time = // 6 cycles -#define B3WAT_7 0x70000000 // Bank 3 Write Access Time = +#define B3WAT_7 0x70000000 // Bank 3 Write Access Time = // 7 cycles -#define B3WAT_8 0x80000000 // Bank 3 Write Access Time = +#define B3WAT_8 0x80000000 // Bank 3 Write Access Time = // 8 cycles -#define B3WAT_9 0x90000000 // Bank 3 Write Access Time = +#define B3WAT_9 0x90000000 // Bank 3 Write Access Time = // 9 cycles -#define B3WAT_10 0xA0000000 // Bank 3 Write Access Time = +#define B3WAT_10 0xA0000000 // Bank 3 Write Access Time = // 10 cycles -#define B3WAT_11 0xB0000000 // Bank 3 Write Access Time = +#define B3WAT_11 0xB0000000 // Bank 3 Write Access Time = // 11 cycles -#define B3WAT_12 0xC0000000 // Bank 3 Write Access Time = +#define B3WAT_12 0xC0000000 // Bank 3 Write Access Time = // 12 cycles -#define B3WAT_13 0xD0000000 // Bank 3 Write Access Time = +#define B3WAT_13 0xD0000000 // Bank 3 Write Access Time = // 13 cycles -#define B3WAT_14 0xE0000000 // Bank 3 Write Access Time = +#define B3WAT_14 0xE0000000 // Bank 3 Write Access Time = // 14 cycles -#define B3WAT_15 0xF0000000 // Bank 3 Write Access Time = +#define B3WAT_15 0xF0000000 // Bank 3 Write Access Time = // 15 cycles // ********************** SDRAM CONTROLLER MASKS *************************** @@ -2474,7 +2474,7 @@ #define CL_3 0x0000000C // SDRAM CAS latency = 3 // cycles #define PFE 0x00000010 // Enable SDRAM prefetch -#define PFP 0x00000020 // Prefetch has priority over +#define PFP 0x00000020 // Prefetch has priority over // AMC requests #define TRAS_1 0x00000040 // SDRAM tRAS = 1 cycle #define TRAS_2 0x00000080 // SDRAM tRAS = 2 cycles @@ -2646,9 +2646,9 @@ // register #define FIO_DIR 0xFFC00730 // Flag Direction register #define FIO_POLAR 0xFFC00734 // Flag Polarity register -#define FIO_EDGE 0xFFC00738 // Flag Interrupt Sensitivity +#define FIO_EDGE 0xFFC00738 // Flag Interrupt Sensitivity // register -#define FIO_BOTH 0xFFC0073C // Flag Set on Both Edges +#define FIO_BOTH 0xFFC0073C // Flag Set on Both Edges // register #define FIO_INEN 0xFFC00740 // Flag Input Enable register @@ -2662,12 +2662,12 @@ // System Reset and Interrupt Controller registers for // core A (0xFFC0 0100-0xFFC0 01FF) #define SWRST 0xFFC00100 // Software Reset register -#define SYSCR 0xFFC00104 // System Reset Configuration +#define SYSCR 0xFFC00104 // System Reset Configuration // register #define RVECT 0xFFC00108 // SIC Reset Vector Address // Register #define SIC_SWRST 0xFFC00100 // Software Reset register -#define SIC_SYSCR 0xFFC00104 // System Reset Configuration +#define SIC_SYSCR 0xFFC00104 // System Reset Configuration // register #define SIC_RVECT 0xFFC00108 // SIC Reset Vector Address // Register @@ -2851,7 +2851,7 @@ // Addr Increment #define DMA0_CURR_DESC_PTR 0xFFC01C20 // DMA1 Channel 0 Current // Descriptor Pointer -#define DMA0_CURR_ADDR 0xFFC01C24 // DMA1 Channel 0 Current +#define DMA0_CURR_ADDR 0xFFC01C24 // DMA1 Channel 0 Current // Address Pointer #define DMA0_CURR_X_COUNT 0xFFC01C30 // DMA1 Channel 0 Current Inner // Loop Count diff --git a/arch/blackfin/lib/udivsi3.S b/arch/blackfin/lib/udivsi3.S index 357b63241f..def52cb1d5 100644 --- a/arch/blackfin/lib/udivsi3.S +++ b/arch/blackfin/lib/udivsi3.S @@ -106,7 +106,7 @@ ___udivsi3: ** with some post-adjustment */ R3 = R1 >> 1; /* Pre-scaled divisor for primitive case */ - R2 = R0 >> 16; + R2 = R0 >> 16; R2 = R3 - R2; /* shifted divisor < upper 16 bits of dividend */ CC &= CARRY; diff --git a/arch/efi/efi/efi.c b/arch/efi/efi/efi.c index 9c270a597e..36ac016a91 100644 --- a/arch/efi/efi/efi.c +++ b/arch/efi/efi/efi.c @@ -26,7 +26,7 @@ #include <init.h> #include <restart.h> #include <driver.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <io.h> #include <efi.h> #include <malloc.h> diff --git a/arch/mips/mach-ar231x/ar231x.c b/arch/mips/mach-ar231x/ar231x.c index f714a11e92..3a0103b5ce 100644 --- a/arch/mips/mach-ar231x/ar231x.c +++ b/arch/mips/mach-ar231x/ar231x.c @@ -16,7 +16,7 @@ #include <common.h> #include <init.h> #include <io.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <mach/ar231x_platform.h> #include <mach/ar2312_regs.h> diff --git a/arch/nios2/lib/longlong.h b/arch/nios2/lib/longlong.h index 12716828ad..58b29d89e6 100644 --- a/arch/nios2/lib/longlong.h +++ b/arch/nios2/lib/longlong.h @@ -1,7 +1,7 @@ /* longlong.h -- definitions for mixed size 32/64 bit arithmetic. * Copyright (C) 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2004, * 2005 Free Software Foundation, Inc. - * + * * This definition file is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either diff --git a/arch/ppc/boards/freescale-p1010rdb/p1010rdb.c b/arch/ppc/boards/freescale-p1010rdb/p1010rdb.c index 60cae46d25..eab3abac70 100644 --- a/arch/ppc/boards/freescale-p1010rdb/p1010rdb.c +++ b/arch/ppc/boards/freescale-p1010rdb/p1010rdb.c @@ -17,7 +17,7 @@ #include <common.h> #include <init.h> #include <driver.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <net.h> #include <types.h> #include <i2c/i2c.h> diff --git a/arch/ppc/boards/freescale-p1022ds/p1022ds.c b/arch/ppc/boards/freescale-p1022ds/p1022ds.c index 57e7953fb1..95a7234d4b 100644 --- a/arch/ppc/boards/freescale-p1022ds/p1022ds.c +++ b/arch/ppc/boards/freescale-p1022ds/p1022ds.c @@ -17,7 +17,7 @@ #include <common.h> #include <init.h> #include <driver.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <net.h> #include <types.h> #include <i2c/i2c.h> diff --git a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c index 385a436459..b03d791eb1 100644 --- a/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c +++ b/arch/ppc/boards/freescale-p2020rdb/p2020rdb.c @@ -20,7 +20,7 @@ #include <common.h> #include <init.h> #include <driver.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <types.h> #include <i2c/i2c.h> #include <partition.h> diff --git a/arch/ppc/boards/geip-da923rc/da923rc.c b/arch/ppc/boards/geip-da923rc/da923rc.c index b6b5d56acd..85c974780d 100644 --- a/arch/ppc/boards/geip-da923rc/da923rc.c +++ b/arch/ppc/boards/geip-da923rc/da923rc.c @@ -22,7 +22,7 @@ #include <asm/io.h> #include <net.h> #include <gpio.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <partition.h> #include <environment.h> #include <i2c/i2c.h> diff --git a/arch/ppc/boards/geip-da923rc/product_data.c b/arch/ppc/boards/geip-da923rc/product_data.c index 0c4600611a..eda10a4178 100644 --- a/arch/ppc/boards/geip-da923rc/product_data.c +++ b/arch/ppc/boards/geip-da923rc/product_data.c @@ -15,6 +15,7 @@ */ #include <common.h> +#include <crc.h> #include <i2c/i2c.h> #include <mach/immap_85xx.h> #include <mach/fsl_i2c.h> diff --git a/arch/ppc/boards/pcm030/pcm030.c b/arch/ppc/boards/pcm030/pcm030.c index 11b3beb20f..05c1ce9ca8 100644 --- a/arch/ppc/boards/pcm030/pcm030.c +++ b/arch/ppc/boards/pcm030/pcm030.c @@ -26,7 +26,7 @@ #include <common.h> #include <driver.h> #include <init.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <types.h> #include <partition.h> #include <memory.h> diff --git a/arch/ppc/include/asm/elf.h b/arch/ppc/include/asm/elf.h index 2fb48ecbcf..bb8762b385 100644 --- a/arch/ppc/include/asm/elf.h +++ b/arch/ppc/include/asm/elf.h @@ -129,18 +129,18 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG]; /* Altivec registers */ /* - * The entries with indexes 0-31 contain the corresponding vector registers. - * The entry with index 32 contains the vscr as the last word (offset 12) - * within the quadword. This allows the vscr to be stored as either a - * quadword (since it must be copied via a vector register to/from storage) - * or as a word. + * The entries with indexes 0-31 contain the corresponding vector registers. + * The entry with index 32 contains the vscr as the last word (offset 12) + * within the quadword. This allows the vscr to be stored as either a + * quadword (since it must be copied via a vector register to/from storage) + * or as a word. * - * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first + * 64-bit kernel notes: The entry at index 33 contains the vrsave as the first * word (offset 0) within the quadword. * - * This definition of the VMX state is compatible with the current PPC32 - * ptrace interface. This allows signal handling and ptrace to use the same - * structures. This also simplifies the implementation of a bi-arch + * This definition of the VMX state is compatible with the current PPC32 + * ptrace interface. This allows signal handling and ptrace to use the same + * structures. This also simplifies the implementation of a bi-arch * (combined (32- and 64-bit) gdb. * * Note that it's _not_ compatible with 32 bits ucontext which stuffs the @@ -243,7 +243,7 @@ do { \ */ # define elf_read_implies_exec(ex, exec_stk) (test_thread_flag(TIF_32BIT) ? \ (exec_stk != EXSTACK_DISABLE_X) : 0) -#else +#else # define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX) #endif /* __powerpc64__ */ diff --git a/arch/x86/boards/x86_generic/intf_platform_ide.c b/arch/x86/boards/x86_generic/intf_platform_ide.c index 18a2620ce0..528e721d56 100644 --- a/arch/x86/boards/x86_generic/intf_platform_ide.c +++ b/arch/x86/boards/x86_generic/intf_platform_ide.c @@ -24,7 +24,7 @@ #include <driver.h> #include <init.h> #include <linux/err.h> -#include <platform_ide.h> +#include <platform_data/ide.h> #include "envsector.h" static struct ide_port_info ide_plat = { diff --git a/arch/x86/boards/x86_generic/serial_ns16550.c b/arch/x86/boards/x86_generic/serial_ns16550.c index 3b284f3d3d..abc1047a50 100644 --- a/arch/x86/boards/x86_generic/serial_ns16550.c +++ b/arch/x86/boards/x86_generic/serial_ns16550.c @@ -25,7 +25,7 @@ #include <driver.h> #include <init.h> #include <asm/syslib.h> -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> #include <linux/err.h> static struct NS16550_plat serial_plat = { diff --git a/commands/Kconfig b/commands/Kconfig index 875c5f4f01..ca36ffc288 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -266,19 +266,6 @@ endmenu menu "Boot" -# TODO: isn't a command -config FLEXIBLE_BOOTARGS - bool - prompt "flexible Linux bootargs generation" - depends on CMD_GLOBAL - help - Select this to get a more flexible bootargs generation. With this - option the bootargs are concatenated together from global variables - beginning with 'global.linux.bootargs.' and 'global.linux.mtdparts.' - This allows for more flexible scripting since with it it's possible - to replace parts of the bootargs string without reconstructing it - completely. - config CMD_AT91_BOOT_TEST bool "at91_boot_test" depends on ARCH_AT91 @@ -348,7 +335,7 @@ config CMD_BOOTM select UIMAGE select UNCOMPRESS select FILETYPE - select GLOBALVAR + depends on GLOBALVAR prompt "bootm" help Boot an application image @@ -715,7 +702,7 @@ endmenu menu "Environment" config CMD_NV - select GLOBALVAR + depends on NVVAR tristate prompt "nv" help @@ -741,13 +728,12 @@ config CMD_EXPORT config CMD_DEFAULTENV tristate - select ENV_HANDLING prompt "defaultenv" help restore environment from default environment config CMD_GLOBAL - select GLOBALVAR + depends on GLOBALVAR tristate prompt "global" help @@ -762,7 +748,7 @@ config CMD_GLOBAL config CMD_LOADENV tristate - select ENV_HANDLING + depends on ENV_HANDLING prompt "loadenv" help Load environment from ENVFS @@ -806,7 +792,7 @@ config CMD_MAGICVAR_HELP config CMD_SAVEENV tristate - select ENV_HANDLING + depends on ENV_HANDLING prompt "saveenv" help Save environment to persistent storage diff --git a/commands/automount.c b/commands/automount.c index b491d203fd..a71430c9ef 100644 --- a/commands/automount.c +++ b/commands/automount.c @@ -20,6 +20,7 @@ #include <fs.h> #include <errno.h> #include <getopt.h> +#include <libfile.h> static int do_automount(int argc, char *argv[]) { diff --git a/commands/boot.c b/commands/boot.c index f403010130..bd1be4ba75 100644 --- a/commands/boot.c +++ b/commands/boot.c @@ -156,7 +156,7 @@ static int bootscript_scan_path(struct blspec *blspec, const char *path) return 1; } - files = asprintf("%s/*", path); + files = basprintf("%s/*", path); glob(files, 0, NULL, &globb); @@ -208,7 +208,7 @@ static int bootentry_parse_one(struct blspec *blspec, const char *name) char *path; if (*name != '/') - path = asprintf("/env/boot/%s", name); + path = basprintf("/env/boot/%s", name); else path = xstrdup(name); @@ -233,7 +233,7 @@ static struct blspec *bootentries_collect(char *entries[], int num_entries) blspec = blspec_alloc(); if (IS_ENABLED(CONFIG_MENU)) - blspec->menu->display = asprintf("boot"); + blspec->menu->display = basprintf("boot"); if (!num_entries) bootscript_scan_path(blspec, "/env/boot"); diff --git a/commands/bootm.c b/commands/bootm.c index 7a19fa2948..bfec62c98b 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -166,6 +166,7 @@ BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, "bootm default BAREBOX_MAGICVAR_NAMED(global_bootm_initrd_loadaddr, global.bootm.initrd.loadaddr, "bootm default initrd loadaddr"); BAREBOX_MAGICVAR_NAMED(global_bootm_oftree, global.bootm.oftree, "bootm default oftree"); BAREBOX_MAGICVAR_NAMED(global_bootm_verify, global.bootm.verify, "bootm default verify level"); +BAREBOX_MAGICVAR_NAMED(global_bootm_appendroot, global.bootm.appendroot, "Add root= option to Kernel to mount rootfs from the device the Kernel comes from"); static struct binfmt_hook binfmt_uimage_hook = { .type = filetype_uimage, diff --git a/commands/clk.c b/commands/clk.c index e9459a3fd3..f862c45b2a 100644 --- a/commands/clk.c +++ b/commands/clk.c @@ -97,7 +97,7 @@ static int do_clk_get_rate(int argc, char *argv[]) } if (optind == argc) { - fprintf(stderr, "No clock name given\n"); + eprintf("No clock name given\n"); return COMMAND_ERROR_USAGE; } @@ -110,7 +110,7 @@ static int do_clk_get_rate(int argc, char *argv[]) if (variable_name) { char *t; - t = asprintf("%lu", rate); + t = basprintf("%lu", rate); setenv(variable_name, t); free(t); } else diff --git a/commands/crc.c b/commands/crc.c index 58b750eb95..edb1fb125c 100644 --- a/commands/crc.c +++ b/commands/crc.c @@ -20,6 +20,7 @@ #include <common.h> #include <command.h> #include <fs.h> +#include <crc.h> #include <getopt.h> #include <malloc.h> #include <libfile.h> @@ -97,13 +98,13 @@ static int do_crc(int argc, char *argv[]) filename, (ulong)start, (ulong)start + total - 1, crc); if (crcvarname) { - char *crcstr = asprintf("0x%lx", crc); + char *crcstr = basprintf("0x%lx", crc); setenv(crcvarname, crcstr); kfree(crcstr); } if (sizevarname) { - char *sizestr = asprintf("0x%lx", total); + char *sizestr = basprintf("0x%lx", total); setenv(sizevarname, sizestr); kfree(sizestr); } diff --git a/commands/defaultenv.c b/commands/defaultenv.c index bae2d78f47..47bdf26d14 100644 --- a/commands/defaultenv.c +++ b/commands/defaultenv.c @@ -60,8 +60,8 @@ static int do_defaultenv(int argc, char *argv[]) if (ret) return ret; - from = asprintf("/.defaultenv/%s", restorepath); - to = asprintf("%s/%s", dirname, restorepath); + from = basprintf("/.defaultenv/%s", restorepath); + to = basprintf("%s/%s", dirname, restorepath); printf("Restoring %s from default environment\n", restorepath); diff --git a/commands/echo.c b/commands/echo.c index 7d47ab7ca7..8853ee0a30 100644 --- a/commands/echo.c +++ b/commands/echo.c @@ -27,7 +27,7 @@ static int do_echo(int argc, char *argv[]) { int i, optind = 1; - int fd = stdout, opt, newline = 1; + int fd = STDOUT_FILENO, opt, newline = 1; char *file = NULL; int oflags = O_WRONLY | O_CREAT; char str[CONFIG_CBSIZE]; @@ -81,17 +81,17 @@ exit_parse: for (i = optind; i < argc; i++) { if (i > optind) - fputc(fd, ' '); + dputc(fd, ' '); if (process_escape) { process_escape_sequence(argv[i], str, CONFIG_CBSIZE); - fputs(fd, str); + dputs(fd, str); } else { - fputs(fd, argv[i]); + dputs(fd, argv[i]); } } if (newline) - fputc(fd, '\n'); + dputc(fd, '\n'); if (file) close(fd); diff --git a/commands/edit.c b/commands/edit.c index c014892fc4..a5415a6e5b 100644 --- a/commands/edit.c +++ b/commands/edit.c @@ -367,7 +367,7 @@ static void getwinsize(void) printf(ESC "7" ESC "[r" ESC "[999;999H" ESC "[6n"); - while ((r = getc()) != 'R') { + while ((r = getchar()) != 'R') { buf[i] = r; i++; } diff --git a/commands/hashsum.c b/commands/hashsum.c index 8d3694fa78..d05e571fb9 100644 --- a/commands/hashsum.c +++ b/commands/hashsum.c @@ -46,7 +46,7 @@ static int do_hash(char *algo, int argc, char *argv[]) } if (key) { - char *tmp = asprintf("hmac(%s)", algo); + char *tmp = basprintf("hmac(%s)", algo); d = digest_alloc(tmp); free(tmp); BUG_ON(!d); diff --git a/commands/i2c.c b/commands/i2c.c index e6750e3d75..ae7f7fc6d0 100644 --- a/commands/i2c.c +++ b/commands/i2c.c @@ -243,7 +243,7 @@ BAREBOX_CMD_HELP_END BAREBOX_CMD_START(i2c_read) .cmd = do_i2c_read, BAREBOX_CMD_DESC("read from an i2c device") - BAREBOX_CMD_OPTS("[-bacrwv] DATA...") + BAREBOX_CMD_OPTS("[-bacrwv]") BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP) BAREBOX_CMD_HELP(cmd_i2c_read_help) BAREBOX_CMD_END diff --git a/commands/loadb.c b/commands/loadb.c index 6223512477..6180ce371a 100644 --- a/commands/loadb.c +++ b/commands/loadb.c @@ -183,8 +183,7 @@ static int os_data_save(void) ret = write(ofd, write_buffer, MAX_WRITE_BUFFER); if (ret < 0) { - fprintf(stderr, - "write to device failed\n"); + eprintf("write to device failed\n"); return ret; } write_idx = 0; @@ -563,7 +562,7 @@ static ulong load_serial_bin(void) /* Try to allocate the buffer we shall write to files */ write_buffer = malloc(MAX_WRITE_BUFFER); if (write_buffer == NULL) { - fprintf(stderr, "could not allocate file i/o buffer\n"); + eprintf("could not allocate file i/o buffer\n"); return -ENOMEM; } @@ -585,7 +584,7 @@ static ulong load_serial_bin(void) if (write_idx > 0) { i = write(ofd, write_buffer, write_idx); if (i < 0) { - fprintf(stderr, "write to device failed\n"); + eprintf("write to device failed\n"); size = i; goto err_quit; } diff --git a/commands/loadenv.c b/commands/loadenv.c index 8d6be2fa83..44e96c3b60 100644 --- a/commands/loadenv.c +++ b/commands/loadenv.c @@ -26,6 +26,7 @@ #include <envfs.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <malloc.h> #include <globalvar.h> diff --git a/commands/loads.c b/commands/loads.c index aa3095ee8c..eb3e109b0b 100644 --- a/commands/loads.c +++ b/commands/loads.c @@ -59,7 +59,7 @@ static int do_load_serial(int argc, char *argv[]) */ for (i=0; i<100; ++i) { if (tstc()) { - (void) getc(); + (void) getchar(); } udelay(1000); } @@ -142,7 +142,7 @@ static int read_record(char *buf, ulong len) --len; /* always leave room for terminating '\0' byte */ for (p=buf; p < buf+len; ++p) { - c = getc(); /* read character */ + c = getchar(); /* read character */ if (do_echo) putchar(c); @@ -180,7 +180,7 @@ static int do_save_serial(int argc, char *argv[]) printf ("## Ready for S-Record upload, press ENTER to proceed ...\n"); for (;;) { - if (getc() == '\r') + if (getchar() == '\r') break; } if (save_serial(offset, size)) { diff --git a/commands/md.c b/commands/md.c index c88259a3f8..3e83c723a3 100644 --- a/commands/md.c +++ b/commands/md.c @@ -28,6 +28,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/mem.c b/commands/mem.c index 23c703f0b5..907f1f76a8 100644 --- a/commands/mem.c +++ b/commands/mem.c @@ -41,29 +41,6 @@ char *mem_rw_buf; -int open_and_lseek(const char *filename, int mode, loff_t pos) -{ - int fd, ret; - - fd = open(filename, mode | O_RDONLY); - if (fd < 0) { - perror("open"); - return fd; - } - - if (!pos) - return fd; - - ret = lseek(fd, pos, SEEK_SET); - if (ret == -1) { - perror("lseek"); - close(fd); - return -errno; - } - - return fd; -} - /* * Common function for parsing options for the 'md', 'mw', 'memcpy', 'memcmp' * commands. diff --git a/commands/memcmp.c b/commands/memcmp.c index e079d5f78e..ce044df0d9 100644 --- a/commands/memcmp.c +++ b/commands/memcmp.c @@ -28,6 +28,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/memcpy.c b/commands/memcpy.c index 9c8b64525c..168ef3b4fc 100644 --- a/commands/memcpy.c +++ b/commands/memcpy.c @@ -28,6 +28,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/memset.c b/commands/memset.c index fc5b659b9b..f871e07c95 100644 --- a/commands/memset.c +++ b/commands/memset.c @@ -28,6 +28,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/menu.c b/commands/menu.c index 2008aa5e9d..9ec2d579b7 100644 --- a/commands/menu.c +++ b/commands/menu.c @@ -160,8 +160,8 @@ static int do_menu_add(struct cmd_menu *cm) free: eprintf("Menu '%s' add fail", cm->menu); if (ret == -EEXIST) - eputs(" already exist"); - eputs("\n"); + eprintf(" already exist"); + eprintf("\n"); menu_free(m); diff --git a/commands/miitool.c b/commands/miitool.c index ba6e604633..07bce18651 100644 --- a/commands/miitool.c +++ b/commands/miitool.c @@ -120,7 +120,7 @@ static int show_basic_mii(struct mii_bus *mii, struct phy_device *phydev, if (mii_val[MII_BMCR] == 0xffff || mii_val[MII_BMSR] == 0x0000) { - fprintf(stderr, " No MII transceiver present!.\n"); + eprintf(" No MII transceiver present!.\n"); return -1; } diff --git a/commands/mkdir.c b/commands/mkdir.c index 1f978869ab..7d024c871d 100644 --- a/commands/mkdir.c +++ b/commands/mkdir.c @@ -22,6 +22,7 @@ #include <fs.h> #include <errno.h> #include <getopt.h> +#include <libfile.h> static int do_mkdir(int argc, char *argv[]) { diff --git a/commands/mm.c b/commands/mm.c index 7c890a6696..6d2a887892 100644 --- a/commands/mm.c +++ b/commands/mm.c @@ -22,6 +22,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/mmc_extcsd.c b/commands/mmc_extcsd.c index d05128c6e7..d7fc50697c 100644 --- a/commands/mmc_extcsd.c +++ b/commands/mmc_extcsd.c @@ -153,15 +153,16 @@ static int print_field_ge_v7(u8 *reg, int index) tmp = get_field_val(DATA_SECTOR_SIZE, 0, 0x1); if (tmp64 == 0xFFFFFFFF) if (tmp) - str = "16 TB"; + str = strdup("16 TB"); else - str = "2 TB"; + str = strdup("2 TB"); else if (tmp) - sprintf(str, "%llu B", tmp64 * 4096); + str = basprintf("%llu B", tmp64 * 4096); else - sprintf(str, "%llu B", tmp64 * 512); + str = basprintf("%llu B", tmp64 * 512); printf("\tMax_Pre_Loading_Data_Size: %s\n", str); + free(str); return 1; /* EXT_CSD_PRE_LOADING_DATA_SIZE */ @@ -181,15 +182,16 @@ static int print_field_ge_v7(u8 *reg, int index) tmp = get_field_val(DATA_SECTOR_SIZE, 0, 0x1); if (tmp64 == 0xFFFFFFFF) if (tmp) - str = "16 TB"; + str = strdup("16 TB"); else - str = "2 TB"; + str = strdup("2 TB"); else if (tmp) - sprintf(str, "%llu B", tmp64 * 4096); + str = basprintf("%llu B", tmp64 * 4096); else - sprintf(str, "%llu B", tmp64 * 512); + str = basprintf("%llu B", tmp64 * 512); printf("\tPre_Loading_Data_Size: %s\n", str); + free(str); return 1; case EXT_CSD_FFU_STATUS: @@ -319,12 +321,13 @@ static int print_field_ge_v7(u8 *reg, int index) val = get_field_val(DEVICE_LIFE_TIME_EST_TYP_A, 0, 0xFF); val = val * 10; if (val == 0) - str = "not defined"; + str = strdup("not defined"); else if (val == 0xB) - str = "maximum"; + str = strdup("maximum"); else - sprintf(str, "%u%% - %u%%", (val - 10), val); + str = basprintf("%u%% - %u%%", (val - 10), val); printf("\tDevice life time, type A (estimation): %s\n", str); + free(str); return 1; case EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B: @@ -332,12 +335,13 @@ static int print_field_ge_v7(u8 *reg, int index) val = get_field_val(DEVICE_LIFE_TIME_EST_TYP_B, 0, 0xFF); val = val * 10; if (val == 0) - str = "not defined"; + str = strdup("not defined"); else if (val == 0xB) - str = "maximum"; + str = strdup("maximum"); else - sprintf(str, "%u%% - %u%%", (val - 10), val); + str = basprintf("%u%% - %u%%", (val - 10), val); printf("\tDevice life time, type B (estimation): %s\n", str); + free(str); return 1; /* EXT_CSD_NMBR_OF_FW_SCTRS_CRRCTLY_PRGRMD */ @@ -1687,11 +1691,12 @@ static int print_field(u8 *reg, int index) val = get_field_val(SLEEP_NOTIFICATION_TIME, 0, 0xFF); val = 100 << val; if (val) - sprintf(str, "Sleep Notification timeout values: %u us", - val); + str = basprintf("Sleep Notification timeout values: %u us", + val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_S_A_TIMEOUT: @@ -1699,10 +1704,11 @@ static int print_field(u8 *reg, int index) val = get_field_val(S_A_TIMEOUT, 0, 0xFF); val = 100 << val; if (val) - sprintf(str, "Sleep/awake timeout values: %u ns", val); + str = basprintf("Sleep/awake timeout values: %u ns", val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_PRODUCTION_ST8_AWARENSS_TIMEOUT: @@ -1710,12 +1716,13 @@ static int print_field(u8 *reg, int index) val = get_field_val(PRODUCTION_ST8_AWARENSS_TIMEOUT, 0, 0xFF); val = 100 << val; if (val) - sprintf(str, + str = basprintf( "Production State Awareness timeout definition: %u us", val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_S_C_VCCQ: @@ -1723,10 +1730,11 @@ static int print_field(u8 *reg, int index) val = get_field_val(S_C_VCCQ, 0, 0xF); val = 1 << val; if (val) - sprintf(str, "S_C_VCCQ Sleep Current: %u uA", val); + str = basprintf("S_C_VCCQ Sleep Current: %u uA", val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[3-0] %s\n", str); + free(str); return 1; case EXT_CSD_S_C_VCC: @@ -1734,20 +1742,22 @@ static int print_field(u8 *reg, int index) val = get_field_val(S_C_VCC, 0, 0xFF); val = 1 << val; if (val) - sprintf(str, "S_C_VCC Sleep Current: %u uA", val); + str = basprintf("S_C_VCC Sleep Current: %u uA", val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[3-0] %s\n", str); + free(str); return 1; case EXT_CSD_HC_WP_GRP_SIZE: print_field_caption(HC_WP_GRP_SIZE, R); val = get_field_val(HC_WP_GRP_SIZE, 0, 0xFF); if (val) - sprintf(str, "Write protect group size: %u", val); + str = basprintf("Write protect group size: %u", val); else - str = "No support"; + str = strdup("No support"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_REL_WR_SEC_C: @@ -1761,10 +1771,11 @@ static int print_field(u8 *reg, int index) val = get_field_val(ERASE_TIMEOUT_MULT, 0, 0xFF); val = val * 300; if (val) - sprintf(str, "Erase timeout values: %u", val); + str = basprintf("Erase timeout values: %u", val); else - str = "No support"; + str = strdup("No support"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_HC_ERASE_GRP_SIZE: @@ -1772,10 +1783,11 @@ static int print_field(u8 *reg, int index) val = get_field_val(HC_ERASE_GRP_SIZE, 0, 0xFF); val = val * 524288; if (val) - sprintf(str, "Erase-unit size: %u", val); + str = basprintf("Erase-unit size: %u", val); else - str = "No support"; + str = strdup("No support"); printf("\t[7-0] %s\n", str); + free(str); return 1; case EXT_CSD_ACC_SIZE: @@ -1783,10 +1795,11 @@ static int print_field(u8 *reg, int index) val = get_field_val(ACC_SIZE, 0, 0xF); val = val * 512; if (val) - sprintf(str, "Superpage size: %u", val); + str = basprintf("Superpage size: %u", val); else - str = "Not defined"; + str = strdup("Not defined"); printf("\t[3-0] %s\n", str); + free(str); return 1; case EXT_CSD_BOOT_SIZE_MULT: @@ -1867,14 +1880,14 @@ static int request_write_operation(void) int c; printf("This is a one time programmable field!\nDo you want to write? [y/N] "); - c = getc(); + c = getchar(); /* default is N */ if (c == 0xD) { printf("\n"); return 0; } printf("%c", c); - getc(); /* wait for carriage return */ + getchar(); /* wait for carriage return */ printf("\n"); if (c == 'y' || c == 'Y') return 1; diff --git a/commands/mw.c b/commands/mw.c index 8ca3c61d7f..bb6a16ef3d 100644 --- a/commands/mw.c +++ b/commands/mw.c @@ -28,6 +28,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <libfile.h> #include <fcntl.h> #include <getopt.h> #include <linux/stat.h> diff --git a/commands/rm.c b/commands/rm.c index 5f1f582f5e..4eebb3d159 100644 --- a/commands/rm.c +++ b/commands/rm.c @@ -19,6 +19,7 @@ #include <common.h> #include <command.h> #include <fs.h> +#include <libfile.h> #include <getopt.h> #include <errno.h> diff --git a/commands/tftp.c b/commands/tftp.c index 8a3b541382..6a3121ad56 100644 --- a/commands/tftp.c +++ b/commands/tftp.c @@ -58,10 +58,10 @@ static int do_tftpb(int argc, char *argv[]) dest = argv[optind]; if (tftp_push) { - dest = freep = asprintf("%s/%s", TFTP_MOUNT_PATH, dest); + dest = freep = basprintf("%s/%s", TFTP_MOUNT_PATH, dest); flags = O_RDONLY; } else { - source = freep = asprintf("%s/%s", TFTP_MOUNT_PATH, source); + source = freep = basprintf("%s/%s", TFTP_MOUNT_PATH, source); flags = O_WRONLY | O_CREAT; } diff --git a/common/Kconfig b/common/Kconfig index 7c09e8c117..380193b806 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -21,10 +21,6 @@ config HAS_KALLSYMS config HAS_MODULES bool -config ENV_HANDLING - select CRC32 - bool - config HAS_CACHE bool help @@ -78,9 +74,6 @@ config FITIMAGE_SIGNATURE config LOGBUF bool -config GLOBALVAR - bool - config STDDEV bool @@ -159,6 +152,30 @@ config MEMINFO config ENVIRONMENT_VARIABLES bool "environment variables support" +config GLOBALVAR + bool "global environment variables support" + default y if !SHELL_NONE + help + Global environment variables begin with "global.". Unlike normal + shell variables they have the same values in all contexts. Global + variables are used to control several aspects of the system behaviour. + If unsure, say yes here. + +config NVVAR + bool "Non volatile global environment variables support" + default y if !SHELL_NONE + depends on GLOBALVAR + depends on ENV_HANDLING + help + Non volatile environment variables begin with "nv.". They behave like + global variables above, but their values are saved in the environment + storage with 'saveenv' and thus are persistent over restarts. nv variables + are coupled with global variables of the same name. Setting "nv.foo" results + in "global.foo" changed also (but not the other way round: setting "global.foo" + leaves "nv.foo" untouched). The idea is that nv variables can store defaults + while global variables can be changed during runtime without changing the + default. + menu "memory layout" source "pbl/Kconfig" @@ -536,6 +553,18 @@ config BLSPEC on a device and it allows the Operating System to install / update kernels. +config FLEXIBLE_BOOTARGS + bool + prompt "flexible Linux bootargs generation" + depends on GLOBALVAR + help + Select this to get a more flexible bootargs generation. With this + option the bootargs are concatenated together from global variables + beginning with 'global.linux.bootargs.' and 'global.linux.mtdparts.' + This allows for more flexible scripting since with it it's possible + to replace parts of the bootargs string without reconstructing it + completely. + config IMD bool "barebox metadata support" @@ -640,10 +669,20 @@ config PARTITION source common/partitions/Kconfig +config ENV_HANDLING + select CRC32 + bool "Support environment files storage" + default y if !SHELL_NONE + help + Enabling this option will give you environment files which can be stored + over reboots. The "saveenv" command will store all files under /env/ to + the persistent environment, the "loadenv" command (also executed during + startup) will bring them back. If unsure, say yes. + config DEFAULT_ENVIRONMENT bool default y - select ENV_HANDLING + depends on ENV_HANDLING prompt "Compile in default environment" help Enabling this option will give you a default environment when @@ -769,7 +808,6 @@ config POLLER config STATE bool "generic state infrastructure" - depends on OF_BAREBOX_DRIVERS select ENVIRONMENT_VARIABLES select OFTREE select PARAMETER diff --git a/common/blspec.c b/common/blspec.c index 18005569ff..bf98e6b29a 100644 --- a/common/blspec.c +++ b/common/blspec.c @@ -203,16 +203,18 @@ static char *parse_nfs_url(const char *url) if (ip == 0) goto out; - hostpath = asprintf("%s:%s", ip_to_string(ip), path); + hostpath = basprintf("%s:%s", ip_to_string(ip), path); prevpath = nfs_find_mountpath(hostpath); if (prevpath) { mountpath = xstrdup(prevpath); } else { - mountpath = asprintf("/mnt/nfs-%s-blspec-%08x", host, rand()); + mountpath = basprintf("/mnt/nfs-%s-blspec-%08x", host, + rand()); if (port) - options = asprintf("mountport=%s,port=%s", port, port); + options = basprintf("mountport=%s,port=%s", port, + port); ret = make_directory(mountpath); if (ret) @@ -278,7 +280,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry) if (!strcmp(devicetree, "none")) return true; - filename = asprintf("%s/%s", abspath, devicetree); + filename = basprintf("%s/%s", abspath, devicetree); fdt = read_file(filename, &size); if (!fdt) { @@ -338,7 +340,7 @@ int blspec_scan_directory(struct blspec *blspec, const char *root) entry_default = read_file_line("%s/default", root); entry_once = read_file_line("%s/once", root); - abspath = asprintf("%s/%s", root, dirname); + abspath = basprintf("%s/%s", root, dirname); dir = opendir(abspath); if (!dir) { @@ -356,7 +358,7 @@ int blspec_scan_directory(struct blspec *blspec, const char *root) if (*d->d_name == '.') continue; - configname = asprintf("%s/%s", abspath, d->d_name); + configname = basprintf("%s/%s", abspath, d->d_name); dot = strrchr(configname, '.'); if (!dot) { @@ -402,7 +404,7 @@ int blspec_scan_directory(struct blspec *blspec, const char *root) found++; - name = asprintf("%s/%s", dirname, d->d_name); + name = basprintf("%s/%s", dirname, d->d_name); if (entry_default && !strcmp(name, entry_default)) entry->boot_default = true; if (entry_once && !strcmp(name, entry_once)) @@ -415,10 +417,10 @@ int blspec_scan_directory(struct blspec *blspec, const char *root) hwdevname = xstrdup(dev_name(entry->cdev->dev->parent)); } - entry->me.display = asprintf("%-20s %-20s %s", - devname ? devname : "", - hwdevname ? hwdevname : "", - blspec_entry_var_get(entry, "title")); + entry->me.display = basprintf("%-20s %-20s %s", + devname ? devname : "", + hwdevname ? hwdevname : "", + blspec_entry_var_get(entry, "title")); free(devname); free(hwdevname); @@ -637,29 +639,6 @@ int blspec_scan_devicename(struct blspec *blspec, const char *devname) return blspec_scan_device(blspec, dev); } -static int blspec_append_root(struct blspec_entry *entry) -{ - const char *appendroot; - char *rootarg; - - appendroot = blspec_entry_var_get(entry, "linux-appendroot"); - if (!appendroot || strcmp(appendroot, "true")) - return 0; - - rootarg = path_get_linux_rootarg(entry->rootpath); - if (IS_ERR(rootarg)) { - pr_err("Getting root argument for %s failed with: %s\n", - entry->rootpath, strerrorp(rootarg)); - return PTR_ERR(rootarg); - } - - globalvar_add_simple("linux.bootargs.dyn.blspec.appendroot", rootarg); - - free(rootarg); - - return 0; -} - /* * blspec_boot - boot an entry * @@ -671,6 +650,7 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun) { int ret; const char *abspath, *devicetree, *options, *initrd, *linuximage; + const char *appendroot; struct bootm_data data = { .initrd_address = UIMAGE_INVALID_ADDRESS, .os_address = UIMAGE_SOME_ADDRESS, @@ -691,7 +671,7 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun) else abspath = ""; - data.os_file = asprintf("%s/%s", abspath, linuximage); + data.os_file = basprintf("%s/%s", abspath, linuximage); if (devicetree) { if (!strcmp(devicetree, "none")) { @@ -699,25 +679,34 @@ int blspec_boot(struct blspec_entry *entry, int verbose, int dryrun) if (node) of_delete_node(node); } else { - data.oftree_file = asprintf("%s/%s", abspath, - devicetree); + data.oftree_file = basprintf("%s/%s", abspath, + devicetree); } } if (initrd) - data.initrd_file = asprintf("%s/%s", abspath, initrd); + data.initrd_file = basprintf("%s/%s", abspath, initrd); globalvar_add_simple("linux.bootargs.dyn.blspec", options); - ret = blspec_append_root(entry); - if (ret) - goto err_out; + appendroot = blspec_entry_var_get(entry, "linux-appendroot"); + if (appendroot) { + int val; + + ret = strtobool(appendroot, &val); + if (ret) { + pr_err("Invalid value \"%s\" for appendroot option\n", + appendroot); + goto err_out; + } + data.appendroot = val; + } pr_info("booting %s from %s\n", blspec_entry_var_get(entry, "title"), entry->cdev ? dev_name(entry->cdev->dev) : "none"); if (entry->boot_once) { - char *s = asprintf("%s/once", abspath); + char *s = basprintf("%s/once", abspath); ret = unlink(s); if (ret) diff --git a/common/bootargs.c b/common/bootargs.c index 803736fc94..a89f23a3f2 100644 --- a/common/bootargs.c +++ b/common/bootargs.c @@ -53,7 +53,8 @@ const char *linux_bootargs_get(void) parts = globalvar_get_match("linux.mtdparts.", ";"); if (strlen(parts)) { - bootargs = asprintf("%s mtdparts=%s", linux_bootargs, parts); + bootargs = basprintf("%s mtdparts=%s", linux_bootargs, + parts); free(linux_bootargs); free(parts); linux_bootargs = bootargs; @@ -61,7 +62,8 @@ const char *linux_bootargs_get(void) parts = globalvar_get_match("linux.blkdevparts.", ";"); if (strlen(parts)) { - bootargs = asprintf("%s blkdevparts=%s", linux_bootargs, parts); + bootargs = basprintf("%s blkdevparts=%s", linux_bootargs, + parts); free(linux_bootargs); free(parts); linux_bootargs = bootargs; diff --git a/common/bootm.c b/common/bootm.c index 6d22aab289..cad8c73efe 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -48,6 +48,8 @@ static struct image_handler *bootm_find_handler(enum filetype filetype, return NULL; } +static int bootm_appendroot; + void bootm_data_init_defaults(struct bootm_data *data) { data->initrd_address = UIMAGE_INVALID_ADDRESS; @@ -58,6 +60,7 @@ void bootm_data_init_defaults(struct bootm_data *data) getenv_ul("global.bootm.initrd.loadaddr", &data->initrd_address); data->initrd_file = getenv_nonempty("global.bootm.initrd"); data->verify = bootm_get_verify_mode(); + data->appendroot = bootm_appendroot; } static enum bootm_verify bootm_verify_mode = BOOTM_VERIFY_HASH; @@ -576,6 +579,18 @@ int bootm_boot(struct bootm_data *bootm_data) } } + if (bootm_data->appendroot) { + char *rootarg; + + rootarg = path_get_linux_rootarg(data->os_file); + if (!IS_ERR(rootarg)) { + printf("Adding \"%s\" to Kernel commandline\n", rootarg); + globalvar_add_simple("linux.bootargs.bootm.appendroot", + rootarg); + free(rootarg); + } + } + printf("\nLoading %s '%s'", file_type_to_string(os_type), data->os_file); if (os_type == filetype_uimage && @@ -621,6 +636,7 @@ err_out: if (data->of_root_node && data->of_root_node != of_get_root_node()) of_delete_node(data->of_root_node); + globalvar_remove("linux.bootargs.bootm.appendroot"); free(data->os_file); free(data->oftree_file); free(data->initrd_file); @@ -634,6 +650,7 @@ static int bootm_init(void) globalvar_add_simple("bootm.image", NULL); globalvar_add_simple("bootm.image.loadaddr", NULL); globalvar_add_simple("bootm.oftree", NULL); + globalvar_add_simple_bool("bootm.appendroot", &bootm_appendroot); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) { globalvar_add_simple("bootm.initrd", NULL); globalvar_add_simple("bootm.initrd.loadaddr", NULL); diff --git a/common/console.c b/common/console.c index a541892583..a67f169b42 100644 --- a/common/console.c +++ b/common/console.c @@ -164,7 +164,7 @@ int console_set_baudrate(struct console_device *cdev, unsigned baudrate) if (cdev->f_active) { mdelay(50); do { - c = getc(); + c = getchar(); } while (c != '\r' && c != '\n'); } @@ -208,8 +208,8 @@ static void console_set_stdoutpath(struct console_device *cdev) if (id < 0) return; - str = asprintf("console=%s%d,%dn8", cdev->linux_console_name, - id, cdev->baudrate); + str = basprintf("console=%s%d,%dn8", cdev->linux_console_name, id, + cdev->baudrate); globalvar_add_simple("linux.bootargs.console", str); @@ -345,7 +345,7 @@ static int tstc_raw(void) return 0; } -int getc(void) +int getchar(void) { unsigned char ch; uint64_t start; @@ -380,17 +380,7 @@ int getc(void) return ch; } -EXPORT_SYMBOL(getc); - -int fgetc(int fd) -{ - char c; - - if (!fd) - return getc(); - return read(fd, &c, 1); -} -EXPORT_SYMBOL(fgetc); +EXPORT_SYMBOL(getchar); int tstc(void) { @@ -476,7 +466,7 @@ int ctrlc (void) { poller_call(); - if (tstc() && getc() == 3) + if (tstc() && getchar() == 3) return 1; return 0; } diff --git a/common/console_common.c b/common/console_common.c index a9bbce9a28..2e5869fab0 100644 --- a/common/console_common.c +++ b/common/console_common.c @@ -278,7 +278,7 @@ EXPORT_SYMBOL(console_get_first_active); #endif /* !CONFIG_CONSOLE_NONE */ -int fprintf(int file, const char *fmt, ...) +int dprintf(int file, const char *fmt, ...) { va_list args; char printbuffer[CFG_PBSIZE]; @@ -293,30 +293,30 @@ int fprintf(int file, const char *fmt, ...) va_end(args); /* Print the string */ - return fputs(file, printbuffer); + return dputs(file, printbuffer); } -EXPORT_SYMBOL(fprintf); +EXPORT_SYMBOL(dprintf); -int fputs(int fd, const char *s) +int dputs(int fd, const char *s) { if (fd == 1) return puts(s); else if (fd == 2) - return eputs(s); + return console_puts(CONSOLE_STDERR, s); else return write(fd, s, strlen(s)); } -EXPORT_SYMBOL(fputs); +EXPORT_SYMBOL(dputs); -int fputc(int fd, char c) +int dputc(int fd, char c) { if (fd == 1) putchar(c); else if (fd == 2) - eputc(c); + console_putc(CONSOLE_STDERR, c); else return write(fd, &c, 1); return 0; } -EXPORT_SYMBOL(fputc); +EXPORT_SYMBOL(dputc); diff --git a/common/console_countdown.c b/common/console_countdown.c index ffbdb4fa2d..c0c8c95022 100644 --- a/common/console_countdown.c +++ b/common/console_countdown.c @@ -39,7 +39,7 @@ int console_countdown(int timeout_s, unsigned flags, char *out_key) do { if (tstc()) { - key = getc(); + key = getchar(); if (flags & CONSOLE_COUNTDOWN_ANYKEY) goto out; if (flags & CONSOLE_COUNTDOWN_RETURN && key == '\n') diff --git a/common/console_simple.c b/common/console_simple.c index 69e76593ad..9675cbb0a6 100644 --- a/common/console_simple.c +++ b/common/console_simple.c @@ -48,13 +48,13 @@ int tstc(void) } EXPORT_SYMBOL(tstc); -int getc(void) +int getchar(void) { if (!console) return -EINVAL; return console->getc(console); } -EXPORT_SYMBOL(getc); +EXPORT_SYMBOL(getchar); void console_flush(void) { @@ -67,7 +67,7 @@ EXPORT_SYMBOL(console_flush); /* test if ctrl-c was pressed */ int ctrlc (void) { - if (tstc() && getc() == 3) + if (tstc() && getchar() == 3) return 1; return 0; } diff --git a/common/env.c b/common/env.c index c98ed73f9b..6f736d5add 100644 --- a/common/env.c +++ b/common/env.c @@ -28,6 +28,7 @@ #include <xfuncs.h> #include <errno.h> #include <init.h> +#include <string.h> #include <environment.h> static struct env_context root = { @@ -260,7 +261,7 @@ EXPORT_SYMBOL(export); void export_env_ull(const char *name, unsigned long long val) { - char *valstr = asprintf("%llu", val); + char *valstr = basprintf("%llu", val); setenv(name, valstr); export(name); @@ -323,20 +324,25 @@ int getenv_uint(const char *var , unsigned int *val) } EXPORT_SYMBOL(getenv_uint); +/** + * getenv_bool - get a boolean value from an environment variable + * @var - Variable name + * @val - The boolean value returned. + * + * This function treats + * - any positive (nonzero) number as true + * - "0" as false + * - "true" (case insensitive) as true + * - "false" (case insensitive) as false + * + * Returns 0 for success or negative error code if the variable does + * not exist or contains something this function does not recognize + * as true or false. + */ int getenv_bool(const char *var, int *val) { const char *valstr = getenv(var); - if (!valstr || !*valstr) - return -EINVAL; - - if (!*valstr) - *val = false; - else if (*valstr == '0') - *val = false; - else - *val = true; - - return 0; + return strtobool(valstr, val); } EXPORT_SYMBOL(getenv_bool); diff --git a/common/environment.c b/common/environment.c index be102db3d2..c3ad25266a 100644 --- a/common/environment.c +++ b/common/environment.c @@ -29,6 +29,7 @@ #include <malloc.h> #include <errno.h> #include <fs.h> +#include <crc.h> #include <fcntl.h> #include <envfs.h> #include <xfuncs.h> @@ -79,7 +80,7 @@ static int do_compare_file(const char *filename, const char *base) char *cmp; const char *relname = filename + strlen(base) + 1; - cmp = asprintf("%s/%s", TMPDIR, relname); + cmp = basprintf("%s/%s", TMPDIR, relname); ret = compare_file(cmp, filename); free(cmp); @@ -193,7 +194,7 @@ static int file_remove_action(const char *filename, struct stat *statbuf, filename += sizeof(TMPDIR) - 1; - envname = asprintf("%s/%s", data->base, filename); + envname = basprintf("%s/%s", data->base, filename); ret = stat(envname, &s); if (ret) { diff --git a/common/firmware.c b/common/firmware.c index a6f75bf887..664f9107d0 100644 --- a/common/firmware.c +++ b/common/firmware.c @@ -202,7 +202,7 @@ out: int firmwaremgr_load_file(struct firmware_mgr *mgr, const char *firmware) { int ret; - char *name = asprintf("/dev/%s", mgr->handler->id); + char *name = basprintf("/dev/%s", mgr->handler->id); ret = copy_file(firmware, name, 0); diff --git a/common/globalvar.c b/common/globalvar.c index 9a793ac4a9..75e4d43afb 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -33,6 +33,16 @@ int globalvar_add(const char *name, return 0; } +void globalvar_remove(const char *name) +{ + struct param_d *param = get_param_by_name(&global_device, name); + + if (!param) + return; + + dev_remove_param(param); +} + static int nv_save(const char *name, const char *val) { int fd, ret; @@ -42,7 +52,7 @@ static int nv_save(const char *name, const char *val) if (ret) return ret; - fname = asprintf("/env/nv/%s", name); + fname = basprintf("/env/nv/%s", name); fd = open(fname, O_CREAT | O_WRONLY | O_TRUNC); @@ -51,7 +61,7 @@ static int nv_save(const char *name, const char *val) if (fd < 0) return fd; - fprintf(fd, "%s", val); + dprintf(fd, "%s", val); close(fd); @@ -90,6 +100,9 @@ int nvvar_add(const char *name, const char *value) struct param_d *p, *gp; int ret; + if (!IS_ENABLED(CONFIG_NVVAR)) + return -ENOSYS; + gp = get_param_by_name(&nv_device, name); if (gp) { ret = dev_set_param(&global_device, name, value); @@ -131,11 +144,14 @@ int nvvar_remove(const char *name) struct param_d *p; char *fname; + if (!IS_ENABLED(CONFIG_NVVAR)) + return -ENOSYS; + p = get_param_by_name(&nv_device, name); if (!p) return -ENOENT; - fname = asprintf("/env/nv/%s", p->name); + fname = basprintf("/env/nv/%s", p->name); unlink(fname); free(fname); @@ -153,6 +169,9 @@ int nvvar_load(void) DIR *dir; struct dirent *d; + if (!IS_ENABLED(CONFIG_NVVAR)) + return -ENOSYS; + dir = opendir("/env/nv"); if (!dir) return -ENOENT; @@ -185,7 +204,7 @@ static void device_param_print(struct device_d *dev) const char *p = dev_get_param(dev, param->name); const char *nv = NULL; - if (dev != &nv_device) + if (IS_ENABLED(CONFIG_NVVAR) && dev != &nv_device) nv = dev_get_param(&nv_device, param->name); printf("%s%s: %s\n", nv ? "* " : " ", param->name, p); @@ -194,6 +213,9 @@ static void device_param_print(struct device_d *dev) void nvvar_print(void) { + if (!IS_ENABLED(CONFIG_NVVAR)) + return; + device_param_print(&nv_device); } @@ -217,7 +239,8 @@ char *globalvar_get_match(const char *match, const char *separator) if (!strncmp(match, param->name, strlen(match))) { const char *p = dev_get_param(&global_device, param->name); if (val) { - char *new = asprintf("%s%s%s", val, separator, p); + char *new = basprintf("%s%s%s", val, + separator, p); free(val); val = new; } else { @@ -264,7 +287,9 @@ int globalvar_add_simple(const char *name, const char *value) static int globalvar_init(void) { register_device(&global_device); - register_device(&nv_device); + + if (IS_ENABLED(CONFIG_NVVAR)) + register_device(&nv_device); globalvar_add_simple("version", UTS_RELEASE); diff --git a/common/imd.c b/common/imd.c index 241ebbdaed..159b73a828 100644 --- a/common/imd.c +++ b/common/imd.c @@ -306,7 +306,7 @@ int imd_command(int argc, char *argv[]) case 't': type = imd_name_to_type(optarg); if (type == IMD_TYPE_INVALID) { - fprintf(stderr, "no such type: %s\n", optarg); + eprintf("no such type: %s\n", optarg); return -ENOSYS; } break; @@ -325,7 +325,7 @@ int imd_command(int argc, char *argv[]) } if (optind == argc) { - fprintf(stderr, "No image given\n"); + eprintf("No image given\n"); return -ENOSYS; } diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 04c6e6050c..1ffa79d1ec 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -34,6 +34,7 @@ #include <linux/mtd/nand.h> #include <linux/stat.h> #include <io.h> +#include <crc.h> #include <mach/generic.h> #include <mtd/mtd-peb.h> diff --git a/common/menu.c b/common/menu.c index 54f2c71b29..9819569f6f 100644 --- a/common/menu.c +++ b/common/menu.c @@ -327,6 +327,7 @@ int menu_show(struct menu *m) } break; } + case 'k': case BB_KEY_UP: m->selected = list_entry(m->selected->list.prev, struct menu_entry, list); @@ -336,6 +337,7 @@ int menu_show(struct menu *m) } repaint = 1; break; + case 'j': case BB_KEY_DOWN: m->selected = list_entry(m->selected->list.next, struct menu_entry, list); @@ -346,13 +348,14 @@ int menu_show(struct menu *m) repaint = 1; break; case ' ': - if (m->selected->type != MENU_ENTRY_BOX) + if (m->selected->type == MENU_ENTRY_BOX) { + m->selected->box_state = !m->selected->box_state; + if (m->selected->action) + m->selected->action(m, m->selected); + repaint = 1; break; - m->selected->box_state = !m->selected->box_state; - if (m->selected->action) - m->selected->action(m, m->selected); - repaint = 1; - break; + } + /* no break */ case BB_KEY_ENTER: if (ch_previous == BB_KEY_RETURN) break; diff --git a/common/menutree.c b/common/menutree.c index 97e628de88..eb14da0d01 100644 --- a/common/menutree.c +++ b/common/menutree.c @@ -12,9 +12,11 @@ #include <environment.h> #include <libbb.h> #include <common.h> +#include <command.h> #include <glob.h> #include <menu.h> #include <fs.h> +#include <shell.h> #include <libfile.h> #include <linux/stat.h> @@ -96,7 +98,7 @@ int menutree(const char *path, int toplevel) menu = menu_alloc(); - globpath = asprintf("%s/*", path); + globpath = basprintf("%s/*", path); ret = glob(globpath, 0, NULL, &g); free(globpath); if (ret == GLOB_NOMATCH) { @@ -147,7 +149,7 @@ int menutree(const char *path, int toplevel) mt->me.type = MENU_ENTRY_NORMAL; - mt->action = asprintf("%s/action", g.gl_pathv[i]); + mt->action = basprintf("%s/action", g.gl_pathv[i]); ret = stat(mt->action, &s); if (ret) { diff --git a/common/module.c b/common/module.c index eb882bce31..829c120007 100644 --- a/common/module.c +++ b/common/module.c @@ -60,7 +60,7 @@ static const struct kernel_symbol *lookup_symbol(const char *name, return NULL; } -static unsigned long resolve_symbol(Elf32_Shdr *sechdrs, +static unsigned long resolve_symbol(Elf32_Shdr *sechdrs, const char *name) { const struct kernel_symbol *ks; diff --git a/common/partitions.c b/common/partitions.c index 82ec508e64..69a2b1fefb 100644 --- a/common/partitions.c +++ b/common/partitions.c @@ -51,7 +51,7 @@ static int register_one_partition(struct block_device *blk, uint64_t size = part->size * SECTOR_SIZE; struct cdev *cdev; - partition_name = asprintf("%s.%d", blk->cdev.name, no); + partition_name = basprintf("%s.%d", blk->cdev.name, no); if (!partition_name) return -ENOMEM; dev_dbg(blk->dev, "Registering partition %s on drive %s\n", diff --git a/common/partitions/efi.c b/common/partitions/efi.c index a9945dd9eb..88734f166b 100644 --- a/common/partitions/efi.c +++ b/common/partitions/efi.c @@ -17,6 +17,7 @@ #include <init.h> #include <asm/unaligned.h> #include <dma.h> +#include <crc.h> #include <linux/ctype.h> #include "efi.h" diff --git a/common/password.c b/common/password.c index 5b754d943f..d52b746f0f 100644 --- a/common/password.c +++ b/common/password.c @@ -24,6 +24,7 @@ #include <digest.h> #include <malloc.h> #include <xfuncs.h> +#include <command.h> #include <magicvar.h> #include <clock.h> #include <init.h> @@ -62,7 +63,7 @@ int password(unsigned char *passwd, size_t length, int flags, int timeout) do { if (tstc()) { - ch = getc(); + ch = getchar(); switch (ch) { case '\r': diff --git a/common/startup.c b/common/startup.c index 093a23ba08..432be67cd6 100644 --- a/common/startup.c +++ b/common/startup.c @@ -30,6 +30,7 @@ * @brief Main entry into the C part of barebox */ #include <common.h> +#include <shell.h> #include <init.h> #include <command.h> #include <malloc.h> diff --git a/common/state.c b/common/state.c index b55b1503bd..87afff3056 100644 --- a/common/state.c +++ b/common/state.c @@ -20,6 +20,7 @@ #include <errno.h> #include <fcntl.h> #include <fs.h> +#include <crc.h> #include <init.h> #include <ioctl.h> #include <libbb.h> @@ -703,8 +704,8 @@ static int state_convert_node_variable(struct state *state, *indexs = 0; /* construct full name */ - name = asprintf("%s%s%s", - parent_name, parent_name[0] ? "." : "", short_name); + name = basprintf("%s%s%s", parent_name, parent_name[0] ? "." : "", + short_name); free(short_name); if ((conv == STATE_CONVERT_TO_NODE) || diff --git a/common/tlsf.c b/common/tlsf.c index 984342e095..ba68a5e688 100644 --- a/common/tlsf.c +++ b/common/tlsf.c @@ -151,7 +151,7 @@ static const size_t block_start_offset = ** the prev_phys_block field, and no larger than the number of addressable ** bits for FL_INDEX. */ -static const size_t block_size_min = +static const size_t block_size_min = sizeof(block_header_t) - sizeof(block_header_t*); static const size_t block_size_max = tlsf_cast(size_t, 1) << FL_INDEX_MAX; @@ -770,7 +770,7 @@ tlsf_pool tlsf_create(void* mem, size_t bytes) #if defined (TLSF_64BIT) rv += (tlsf_fls_sizet(0x80000000) == 31) ? 0 : 0x100; rv += (tlsf_fls_sizet(0x100000000) == 32) ? 0 : 0x200; - rv += (tlsf_fls_sizet(0xffffffffffffffff) == 63) ? 0 : 0x400; + rv += (tlsf_fls_sizet(0xffffffffffffffff) == 63) ? 0 : 0x400; if (rv) { printf("tlsf_create: %x ffs/fls tests failed!\n", rv); @@ -785,7 +785,7 @@ tlsf_pool tlsf_create(void* mem, size_t bytes) printf("tlsf_create: Pool size must be at least %d bytes.\n", (unsigned int)(pool_overhead + block_size_min)); #else - printf("tlsf_create: Pool size must be between %u and %u bytes.\n", + printf("tlsf_create: Pool size must be between %u and %u bytes.\n", (unsigned int)(pool_overhead + block_size_min), (unsigned int)(pool_overhead + block_size_max)); #endif diff --git a/common/uimage.c b/common/uimage.c index 59d7b65c90..34daf70dc1 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -21,6 +21,7 @@ #include <image.h> #include <malloc.h> #include <errno.h> +#include <crc.h> #include <libbb.h> #include <libfile.h> #include <uncompress.h> diff --git a/crypto/crc32.c b/crypto/crc32.c index 58637bd770..3bff6feb28 100644 --- a/crypto/crc32.c +++ b/crypto/crc32.c @@ -12,6 +12,7 @@ #include <common.h> #include <xfuncs.h> #include <fs.h> +#include <crc.h> #include <fcntl.h> #include <malloc.h> #include <linux/ctype.h> diff --git a/crypto/digest.c b/crypto/digest.c index 46600f246e..7a8c3c092d 100644 --- a/crypto/digest.c +++ b/crypto/digest.c @@ -77,7 +77,7 @@ int digest_generic_digest(struct digest *d, const void *data, int digest_algo_register(struct digest_algo *d) { - if (!d || !d->base.name || !d->update || !d->final || !d->verify) + if (!d || !d->base.name || !d->update || !d->final || !d->verify) return -EINVAL; if (!d->init) diff --git a/crypto/hmac.c b/crypto/hmac.c index 20af2a56de..05b9b50f12 100644 --- a/crypto/hmac.c +++ b/crypto/hmac.c @@ -173,8 +173,8 @@ static int digest_hmac_register(char *name, unsigned int pad_length) dh->name = xstrdup(name); dh->pad_length = pad_length; dh->algo = hmac_algo; - dh->algo.base.name = asprintf("hmac(%s)", name); - dh->algo.base.driver_name = asprintf("hmac(%s)-generic", name); + dh->algo.base.name = basprintf("hmac(%s)", name); + dh->algo.base.driver_name = basprintf("hmac(%s)-generic", name); return digest_algo_register(&dh->algo); } diff --git a/crypto/sha2.c b/crypto/sha2.c index df566c8a4b..cb0f11c77e 100644 --- a/crypto/sha2.c +++ b/crypto/sha2.c @@ -13,7 +13,7 @@ * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 of the License, or (at your option) + * Software Foundation; either version 2 of the License, or (at your option) * any later version. * */ diff --git a/drivers/ata/disk_ata_drive.c b/drivers/ata/disk_ata_drive.c index d30d0ad997..1aa1bb1456 100644 --- a/drivers/ata/disk_ata_drive.c +++ b/drivers/ata/disk_ata_drive.c @@ -243,7 +243,7 @@ static int ata_port_init(struct ata_port *port) rc = cdev_find_free_index("ata"); if (rc == -1) pr_err("Cannot find a free index for the disk node\n"); - port->blk.cdev.name = asprintf("ata%d", rc); + port->blk.cdev.name = basprintf("ata%d", rc); } port->blk.num_blocks = ata_id_n_sectors(port->id); @@ -303,6 +303,14 @@ static int ata_detect(struct device_d *dev) return ata_port_detect(port); } +static void ata_info(struct device_d *dev) +{ + struct ata_port *port = container_of(dev, struct ata_port, class_dev); + + if (port->initialized) + ata_dump_id(port->id); +} + /** * Register an ATA drive behind an IDE like interface * @param dev The interface device @@ -322,6 +330,7 @@ int ata_port_register(struct ata_port *port) } port->class_dev.parent = port->dev; + port->class_dev.info = ata_info; port->class_dev.detect = ata_detect; ret = register_device(&port->class_dev); diff --git a/drivers/ata/disk_bios_drive.c b/drivers/ata/disk_bios_drive.c index 8e768dc7f2..363af3c6dd 100644 --- a/drivers/ata/disk_bios_drive.c +++ b/drivers/ata/disk_bios_drive.c @@ -258,7 +258,7 @@ static int biosdisk_probe(struct device_d *dev) rc = cdev_find_free_index("disk"); if (rc < 0) pr_err("Cannot find a free number for the disk node\n"); - m->blk.cdev.name = asprintf("disk%d", rc); + m->blk.cdev.name = basprintf("disk%d", rc); m->blk.blockbits = SECTOR_SHIFT; rc = blockdevice_register(&m->blk); diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c index 6e74bfb089..c3af0833ba 100644 --- a/drivers/ata/intf_platform_ide.c +++ b/drivers/ata/intf_platform_ide.c @@ -27,7 +27,7 @@ #include <malloc.h> #include <errno.h> #include <ata_drive.h> -#include <platform_ide.h> +#include <platform_data/ide.h> #include <linux/err.h> #include <of.h> diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c index 842957331e..c8098a537f 100644 --- a/drivers/ata/pata-imx.c +++ b/drivers/ata/pata-imx.c @@ -28,7 +28,7 @@ #include <malloc.h> #include <errno.h> #include <ata_drive.h> -#include <platform_ide.h> +#include <platform_data/ide.h> #include <io.h> #include <of.h> #include <linux/err.h> diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c index 6a601956db..7b8036bbf3 100644 --- a/drivers/ata/sata-imx.c +++ b/drivers/ata/sata-imx.c @@ -112,7 +112,7 @@ static int imx_sata_probe(struct device_d *dev) imx_ahci->ahci.dev = dev; dev->priv = &imx_ahci->ahci; - dev->info = ahci_info, + dev->info = ahci_info; ret = ahci_add_host(&imx_ahci->ahci); if (ret) diff --git a/drivers/bus/omap-gpmc.c b/drivers/bus/omap-gpmc.c index 8ae909a1b6..be9ef92851 100644 --- a/drivers/bus/omap-gpmc.c +++ b/drivers/bus/omap-gpmc.c @@ -446,9 +446,6 @@ static struct dt_eccmode modes[] = { .name = "hw-romcode", .mode = OMAP_ECC_HAMMING_CODE_HW_ROMCODE, }, { - .name = "bch4", - .mode = OMAP_ECC_BCH4_CODE_HW, - }, { .name = "bch8", .mode = OMAP_ECC_BCH8_CODE_HW_ROMCODE, }, diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index 3c0a7a9d47..a323d25dd4 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -429,7 +429,7 @@ static int at24_probe(struct device_d *dev) at24->chip = chip; at24->num_addresses = num_addresses; - at24->cdev.name = asprintf("eeprom%d", dev->id); + at24->cdev.name = basprintf("eeprom%d", dev->id); at24->cdev.priv = at24; at24->cdev.dev = dev; at24->cdev.ops = &at24->fops; diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 282887ba78..2e189fecad 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -41,6 +41,8 @@ #define IMX_SDHCI_WML 0x44 #define IMX_SDHCI_MIXCTRL 0x48 +#define IMX_SDHCI_DLL_CTRL 0x60 +#define IMX_SDHCI_MIX_CTRL_FBCLK_SEL (BIT(25)) struct fsl_esdhc_host { struct mci_host mci; @@ -516,11 +518,23 @@ static int esdhc_reset(struct fsl_esdhc_host *host) { void __iomem *regs = host->regs; uint64_t start; + int val; /* reset the controller */ esdhc_write32(regs + SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET, SYSCTL_RSTA); + /* extra register reset for i.MX6 Solo/DualLite */ + if (cpu_is_mx6()) { + /* reset bit FBCLK_SEL */ + val = esdhc_read32(regs + IMX_SDHCI_MIXCTRL); + val &= ~IMX_SDHCI_MIX_CTRL_FBCLK_SEL; + esdhc_write32(regs + IMX_SDHCI_MIXCTRL, val); + + /* reset delay line settings in IMX_SDHCI_DLL_CTRL */ + esdhc_write32(regs + IMX_SDHCI_DLL_CTRL, 0x0); + } + start = get_time_ns(); /* hardware clears the bit when it is done */ while (1) { diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c index 24f57f9da9..59f66757d9 100644 --- a/drivers/mci/mci-core.c +++ b/drivers/mci/mci-core.c @@ -506,8 +506,8 @@ static int mmc_change_freq(struct mci *mci) char *name, *partname; part_size = mci->ext_csd[EXT_CSD_BOOT_MULT] << 17; - partname = asprintf("boot%d", idx); - name = asprintf("%s.%s", mci->cdevname, partname); + partname = basprintf("boot%d", idx); + name = basprintf("%s.%s", mci->cdevname, partname); mci_part_add(mci, part_size, EXT_CSD_PART_CONFIG_ACC_BOOT0 + idx, name, partname, idx, true, @@ -1626,7 +1626,7 @@ static int mci_card_probe(struct mci *mci) mci->cdevname = strdup(host->devname); } else { disknum = cdev_find_free_index("disk"); - mci->cdevname = asprintf("disk%d", disknum); + mci->cdevname = basprintf("disk%d", disknum); } rc = mci_startup(mci); diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c index 2355651022..446da8ad53 100644 --- a/drivers/mci/mxs.c +++ b/drivers/mci/mxs.c @@ -571,7 +571,15 @@ static int mxs_mci_probe(struct device_d *hw_dev) host->f_min = pd->f_min; host->f_max = pd->f_max; } else { - host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34, /* fixed to 3.3 V */ + /* fixed to 3.3 V */ + host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34; + + if (hw_dev->device_node) { + const char *alias = of_alias_get(hw_dev->device_node); + if (alias) + host->devname = xstrdup(alias); + } + mci_of_parse(host); } diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index c1e7d9ece4..fb91ffa008 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c @@ -141,8 +141,8 @@ static int stmpe_probe(struct device_d *dev) } stmpe_dev = xzalloc(sizeof(struct stmpe)); - stmpe_dev->cdev.name = asprintf(DRIVERNAME "%d", - cdev_find_free_index(DRIVERNAME)); + stmpe_dev->cdev.name = basprintf(DRIVERNAME"%d", + cdev_find_free_index(DRIVERNAME)); stmpe_dev->client = to_i2c_client(dev); stmpe_dev->cdev.size = 191; /* 191 known registers */ stmpe_dev->cdev.dev = dev; diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 7a5b14697e..6640a70792 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -17,6 +17,7 @@ config SRAM config STATE_DRV tristate "state driver" + depends on OFDEVICE depends on STATE endmenu diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c index 58b574157a..4fb6f801d2 100644 --- a/drivers/misc/sram.c +++ b/drivers/misc/sram.c @@ -47,8 +47,7 @@ static int sram_probe(struct device_d *dev) sram = xzalloc(sizeof(*sram)); - sram->cdev.name = asprintf("sram%d", - cdev_find_free_index("sram")); + sram->cdev.name = basprintf("sram%d", cdev_find_free_index("sram")); res = dev_get_resource(dev, IORESOURCE_MEM, 0); if (IS_ERR(res)) diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index dcf94bfc0d..6d04b88553 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -470,10 +470,10 @@ static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char static char *print_size(uint64_t s) { if (!(s & ((1 << 20) - 1))) - return asprintf("%lldM", s >> 20); + return basprintf("%lldM", s >> 20); if (!(s & ((1 << 10) - 1))) - return asprintf("%lldk", s >> 10); - return asprintf("0x%lld", s); + return basprintf("%lldk", s >> 10); + return basprintf("0x%lld", s); } static int print_part(char *buf, int bufsize, struct mtd_info *mtd, uint64_t last_ofs, @@ -577,7 +577,8 @@ static int of_mtd_fixup(struct device_node *root, void *ctx) list_for_each_entry(partmtd, &mtd->partitions, partitions_entry) { int na, ns, len = 0; - char *name = asprintf("partition@%0llx", partmtd->master_offset); + char *name = basprintf("partition@%0llx", + partmtd->master_offset); void *p; u8 tmp[16 * 16]; /* Up to 64-bit address + 64-bit size */ @@ -675,7 +676,8 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id) if (device_id == DEVICE_ID_SINGLE) mtd->cdev.name = xstrdup(devname); else - mtd->cdev.name = asprintf("%s%d", devname, mtd->class_dev.id); + mtd->cdev.name = basprintf("%s%d", devname, + mtd->class_dev.id); INIT_LIST_HEAD(&mtd->partitions); diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 6a9bc74847..a40ba25632 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1058,8 +1058,8 @@ static void __init doc_set_driver_info(int chip_id, struct mtd_info *mtd) switch (chip_id) { case DOC_CHIPID_G3: - mtd->name = asprintf("DiskOnChip G3 floor %d", - docg3->device_id); + mtd->name = basprintf("DiskOnChip G3 floor %d", + docg3->device_id); docg3->max_block = 2047; break; } diff --git a/drivers/mtd/mtdoob.c b/drivers/mtd/mtdoob.c index 4dcf2f5915..86076f028d 100644 --- a/drivers/mtd/mtdoob.c +++ b/drivers/mtd/mtdoob.c @@ -79,7 +79,7 @@ static int add_mtdoob_device(struct mtd_info *mtd, const char *devname, void **p mtdoob = xzalloc(sizeof(*mtdoob)); mtdoob->cdev.ops = &mtd_ops_oob; mtdoob->cdev.size = mtd_div_by_wb(mtd->size, mtd) * mtd->oobsize; - mtdoob->cdev.name = asprintf("%s.oob", mtd->cdev.name); + mtdoob->cdev.name = basprintf("%s.oob", mtd->cdev.name); mtdoob->cdev.priv = mtdoob; mtdoob->cdev.dev = &mtd->class_dev; mtdoob->mtd = mtd; diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c index 4d6ac72bd9..b06eb18f3f 100644 --- a/drivers/mtd/mtdraw.c +++ b/drivers/mtd/mtdraw.c @@ -308,7 +308,7 @@ static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **p mtdraw->cdev.ops = (struct file_operations *)&mtd_raw_fops; mtdraw->cdev.size = mtd_div_by_wb(mtd->size, mtd) * (mtd->writesize + mtd->oobsize); - mtdraw->cdev.name = asprintf("%s.raw", mtd->cdev.name); + mtdraw->cdev.name = basprintf("%s.raw", mtd->cdev.name); mtdraw->cdev.priv = mtdraw; mtdraw->cdev.dev = &mtd->class_dev; mtdraw->cdev.mtd = mtd; diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c index e6d42772b3..015f8dc524 100644 --- a/drivers/mtd/nand/nand-bb.c +++ b/drivers/mtd/nand/nand-bb.c @@ -288,7 +288,7 @@ struct cdev *mtd_add_bb(struct mtd_info *mtd, const char *name) if (name) bb->cdev.name = xstrdup(name); else - bb->cdev.name = asprintf("%s.bb", mtd->cdev.name); + bb->cdev.name = basprintf("%s.bb", mtd->cdev.name); nand_bb_calc_size(bb); bb->cdev.ops = &nand_bb_ops; diff --git a/drivers/mtd/nand/nand_imx_bbm.c b/drivers/mtd/nand/nand_imx_bbm.c index 5caa0a26c3..251dfe5d3f 100644 --- a/drivers/mtd/nand/nand_imx_bbm.c +++ b/drivers/mtd/nand/nand_imx_bbm.c @@ -188,7 +188,7 @@ static int do_imx_nand_bbm(int argc, char *argv[]) int c; printf("create flash bbt (y/n)?"); - c = getc(); + c = getchar(); if (c == 'y') yes = 1; printf("\n"); diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c index a920522939..a4e645201f 100644 --- a/drivers/mtd/nand/nand_omap_gpmc.c +++ b/drivers/mtd/nand/nand_omap_gpmc.c @@ -86,7 +86,9 @@ #define GPMC_ECC_SIZE_CONFIG_ECCSIZE1(x) ((x) << 22) #define BCH8_MAX_ERROR 8 /* upto 8 bit correctable */ -#define BCH4_MAX_ERROR 4 /* upto 4 bit correctable */ + +static const uint8_t bch8_vector[] = {0xf3, 0xdb, 0x14, 0x16, 0x8b, 0xd2, + 0xbe, 0xcc, 0xac, 0x6b, 0xff, 0x99, 0x7b}; int omap_gpmc_decode_bch(int select_4_8, unsigned char *ecc, unsigned int *err_loc); @@ -239,9 +241,6 @@ static int __omap_calculate_ecc(struct mtd_info *mtd, const uint8_t *dat, int ecc_size = 8; switch (oinfo->ecc_mode) { - case OMAP_ECC_BCH4_CODE_HW: - ecc_size = 4; - /* fall through */ case OMAP_ECC_BCH8_CODE_HW: case OMAP_ECC_BCH8_CODE_HW_ROMCODE: for (i = 0; i < 4; i++) { @@ -298,26 +297,26 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, { struct nand_chip *nand = (struct nand_chip *)(mtd->priv); struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand->priv); - int i, j, eccflag, count, totalcount, actual_eccsize; + int i, j, eccflag, totalcount, actual_eccsize; + const uint8_t *erased_ecc_vec; unsigned int err_loc[8]; - int select_4_8; + int bitflip_count; + int bch_max_err; int eccsteps = oinfo->nand.ecc.steps; int eccsize = oinfo->nand.ecc.bytes; switch (oinfo->ecc_mode) { - case OMAP_ECC_BCH4_CODE_HW: - actual_eccsize = eccsize; - select_4_8 = 0; - break; case OMAP_ECC_BCH8_CODE_HW: eccsize /= eccsteps; actual_eccsize = eccsize; - select_4_8 = 1; + erased_ecc_vec = bch8_vector; + bch_max_err = BCH8_MAX_ERROR; break; case OMAP_ECC_BCH8_CODE_HW_ROMCODE: actual_eccsize = eccsize - 1; - select_4_8 = 1; + erased_ecc_vec = bch8_vector; + bch_max_err = BCH8_MAX_ERROR; break; default: dev_err(oinfo->pdev, "invalid driver configuration\n"); @@ -327,37 +326,49 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, totalcount = 0; for (i = 0; i < eccsteps; i++) { - /* check if any ecc error */ + bool is_error_reported = false; + bitflip_count = 0; eccflag = 0; + + /* check for any ecc error */ for (j = 0; (j < actual_eccsize) && (eccflag == 0); j++) { - if (calc_ecc[j] != 0) + if (calc_ecc[j] != 0) { eccflag = 1; + break; + } } if (eccflag == 1) { - eccflag = 0; - for (j = 0; (j < actual_eccsize) && - (eccflag == 0); j++) - if (read_ecc[j] != 0xFF) - eccflag = 1; + if (memcmp(calc_ecc, erased_ecc_vec, actual_eccsize) == 0) { + /* + * calc_ecc[] matches pattern for ECC + * (all 0xff) so this is definitely + * an erased-page + */ + } else { + bitflip_count = nand_check_erased_ecc_chunk( + dat, oinfo->nand.ecc.size, read_ecc, + eccsize, NULL, 0, bch_max_err); + if (bitflip_count < 0) + is_error_reported = true; + } } - count = 0; - if (eccflag == 1) { - count = omap_gpmc_decode_bch(select_4_8, calc_ecc, err_loc); - if (count < 0) - return count; - else - totalcount += count; - } + if (is_error_reported) { + bitflip_count = omap_gpmc_decode_bch(1, + calc_ecc, err_loc); + if (bitflip_count < 0) + return bitflip_count; - for (j = 0; j < count; j++) { - if (err_loc[j] < 4096) - dat[err_loc[j] >> 3] ^= + for (j = 0; j < bitflip_count; j++) { + if (err_loc[j] < 4096) + dat[err_loc[j] >> 3] ^= 1 << (err_loc[j] & 7); - /* else, not interested to correct ecc */ + /* else, not interested to correct ecc */ + } } + totalcount += bitflip_count; calc_ecc = calc_ecc + actual_eccsize; read_ecc = read_ecc + eccsize; dat += 512; @@ -435,7 +446,6 @@ static int omap_correct_data(struct mtd_info *mtd, uint8_t *dat, switch (oinfo->ecc_mode) { case OMAP_ECC_HAMMING_CODE_HW_ROMCODE: return omap_correct_hamming(mtd, dat, read_ecc, calc_ecc); - case OMAP_ECC_BCH4_CODE_HW: case OMAP_ECC_BCH8_CODE_HW: case OMAP_ECC_BCH8_CODE_HW_ROMCODE: /* @@ -463,17 +473,6 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode) int cs = 0; switch (oinfo->ecc_mode) { - case OMAP_ECC_BCH4_CODE_HW: - if (mode == NAND_ECC_READ) { - eccsize1 = 0xD; eccsize0 = 0x48; - bch_mod = 0; - bch_wrapmode = 0x09; - } else { - eccsize1 = 0x20; eccsize0 = 0x00; - bch_mod = 0; - bch_wrapmode = 0x06; - } - break; case OMAP_ECC_BCH8_CODE_HW: case OMAP_ECC_BCH8_CODE_HW_ROMCODE: if (mode == NAND_ECC_READ) { @@ -764,17 +763,6 @@ static int omap_gpmc_eccmode(struct gpmc_nand_info *oinfo, omap_oobinfo.oobfree->length = minfo->oobsize - offset - omap_oobinfo.eccbytes; break; - case OMAP_ECC_BCH4_CODE_HW: - oinfo->nand.ecc.bytes = 7; - oinfo->nand.ecc.size = 512; - oinfo->nand.ecc.strength = BCH4_MAX_ERROR; - omap_oobinfo.oobfree->offset = offset; - omap_oobinfo.oobfree->length = minfo->oobsize - - offset - omap_oobinfo.eccbytes; - offset = minfo->oobsize - oinfo->nand.ecc.bytes; - for (i = 0; i < oinfo->nand.ecc.bytes; i++) - omap_oobinfo.eccpos[i] = i + offset; - break; case OMAP_ECC_BCH8_CODE_HW: oinfo->nand.ecc.bytes = 13 * 4; oinfo->nand.ecc.size = 512 * 4; diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c index c26a2455b2..ad38e69ea5 100644 --- a/drivers/mtd/ubi/barebox.c +++ b/drivers/mtd/ubi/barebox.c @@ -176,7 +176,7 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol) priv->ubi = ubi; cdev->ops = &ubi_volume_fops; - cdev->name = asprintf("%s.%s", ubi->cdev.name, vol->name); + cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name); cdev->priv = priv; cdev->size = vol->used_bytes; cdev->dev = &vol->dev; @@ -239,7 +239,7 @@ int ubi_cdev_add(struct ubi_device *ubi) int ret; cdev->ops = &ubi_fops; - cdev->name = asprintf("%s.ubi", ubi->mtd->cdev.name); + cdev->name = basprintf("%s.ubi", ubi->mtd->cdev.name); cdev->priv = ubi; cdev->size = 0; diff --git a/drivers/mtd/ubi/ubi-barebox.h b/drivers/mtd/ubi/ubi-barebox.h index ab970aa19d..557ad88316 100644 --- a/drivers/mtd/ubi/ubi-barebox.h +++ b/drivers/mtd/ubi/ubi-barebox.h @@ -16,6 +16,7 @@ #include <common.h> #include <malloc.h> +#include <crc.h> #include <asm-generic/div64.h> #include <errno.h> #include <linux/err.h> @@ -26,7 +27,7 @@ #include <linux/mtd/mtd.h> #include <linux/mtd/ubi.h> -#define crc32(seed, data, length) crc32_no_comp(seed, (unsigned char const *)data, length) +#define crc32(seed, data, length) crc32_no_comp(seed, (unsigned char * const)data, length) /* configurable */ #define CONFIG_MTD_UBI_WL_THRESHOLD 4096 diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index a8ed0d7710..471d784234 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h @@ -20,6 +20,7 @@ #include <common.h> #include <malloc.h> +#include <crc.h> #include <linux/types.h> #include <linux/list.h> #include <linux/rbtree.h> diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c index 1e67c7a8e7..316b971742 100644 --- a/drivers/net/altera_tse.c +++ b/drivers/net/altera_tse.c @@ -533,7 +533,7 @@ static int tse_probe(struct device_d *dev) } #endif - memset(rx_desc, 0, (sizeof *rx_desc) * (PKTBUFSRX + 1)); + memset(rx_desc, 0, (sizeof *rx_desc) * (PKTBUFSRX + 1)); memset(tx_desc, 0, (sizeof *tx_desc) * 2); iores = dev_request_mem_resource(dev, 0); diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 3dc4b16b67..75a917a76d 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c @@ -49,7 +49,7 @@ #include <asm/system.h> #include <linux/phy.h> #include <mach/emac_defs.h> -#include <net/davinci_emac.h> +#include <platform_data/eth-davinci-emac.h> #include "davinci_emac.h" struct davinci_emac_priv { diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 3b21244478..1d662a71d9 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -27,7 +27,7 @@ #include <io.h> #include <net.h> #include <of_net.h> -#include <net/designware.h> +#include <platform_data/eth-designware.h> #include <linux/phy.h> #include <linux/err.h> #include "designware.h" diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c index ad402e3efc..acc0abbc48 100644 --- a/drivers/net/dm9k.c +++ b/drivers/net/dm9k.c @@ -29,7 +29,7 @@ #include <net.h> #include <io.h> #include <xfuncs.h> -#include <dm9000.h> +#include <platform_data/eth-dm9000.h> #include <errno.h> #include <linux/phy.h> diff --git a/drivers/net/ep93xx.c b/drivers/net/ep93xx.c index 0acb9b692f..fd725a56ee 100644 --- a/drivers/net/ep93xx.c +++ b/drivers/net/ep93xx.c @@ -38,7 +38,7 @@ #include <linux/types.h> #include <mach/ep93xx-regs.h> #include <linux/phy.h> -#include <net/ep93xx_eth.h> +#include <platform_data/eth-ep93xx.h> #include "ep93xx.h" #define EP93XX_MAX_PKT_SIZE 1536 diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 83fdec66d7..8bc7c2993a 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -20,7 +20,7 @@ #include <net.h> #include <init.h> #include <driver.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <io.h> #include <clock.h> #include <xfuncs.h> diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h index 0921b52bae..1947e60f69 100644 --- a/drivers/net/fec_imx.h +++ b/drivers/net/fec_imx.h @@ -193,7 +193,7 @@ static inline int fec_is_imx6(struct fec_priv *priv) #define FEC_RBD_SH 0x0008 /**< Receive BD status: Short frame */ #define FEC_RBD_CR 0x0004 /**< Receive BD status: CRC error */ #define FEC_RBD_OV 0x0002 /**< Receive BD status: Receive FIFO overrun */ -#define FEC_RBD_TR 0x0001 /**< Receive BD status: Frame is truncated */ +#define FEC_RBD_TR 0x0001 /**< Receive BD status: Frame is truncated */ #define FEC_RBD_ERR (FEC_RBD_LG | FEC_RBD_NO | FEC_RBD_CR | \ FEC_RBD_OV | FEC_RBD_TR) diff --git a/drivers/net/fec_mpc5200.c b/drivers/net/fec_mpc5200.c index bb57c34502..b99c23f7d4 100644 --- a/drivers/net/fec_mpc5200.c +++ b/drivers/net/fec_mpc5200.c @@ -10,7 +10,7 @@ #include <mach/mpc5xxx.h> #include <malloc.h> #include <net.h> -#include <fec.h> +#include <platform_data/eth-fec.h> #include <init.h> #include <driver.h> #include <mach/sdma.h> diff --git a/drivers/net/ksz8864rmn.c b/drivers/net/ksz8864rmn.c index 3ca85fb3f3..860af448ea 100644 --- a/drivers/net/ksz8864rmn.c +++ b/drivers/net/ksz8864rmn.c @@ -149,7 +149,7 @@ static int micrel_switch_probe(struct device_d *dev) return -ENODEV; } - priv->cdev.name = asprintf("switch%d", dev->id); + priv->cdev.name = basprintf("switch%d", dev->id); priv->cdev.size = 256; priv->cdev.ops = &micrel_switch_ops; priv->cdev.priv = priv; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index be2c68bf68..73176fbc04 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -52,9 +52,11 @@ int phy_update_status(struct phy_device *phydev) int ret; int oldspeed = phydev->speed, oldduplex = phydev->duplex; - ret = drv->read_status(phydev); - if (ret) - return ret; + if (drv) { + ret = drv->read_status(phydev); + if (ret) + return ret; + } if (phydev->speed == oldspeed && phydev->duplex == oldduplex) return 0; @@ -173,10 +175,15 @@ struct phy_device *phy_device_create(struct mii_bus *bus, int addr, int phy_id) phydev->bus = bus; phydev->dev.bus = &mdio_bus_type; - sprintf(phydev->dev.name, "mdio%d-phy%02x", + if (bus) { + sprintf(phydev->dev.name, "mdio%d-phy%02x", phydev->bus->dev.id, phydev->addr); - phydev->dev.id = DEVICE_ID_SINGLE; + phydev->dev.id = DEVICE_ID_SINGLE; + } else { + sprintf(phydev->dev.name, "fixed-phy"); + phydev->dev.id = DEVICE_ID_DYNAMIC; + } return phydev; } @@ -245,7 +252,9 @@ static void phy_config_aneg(struct phy_device *phydev) struct phy_driver *drv; drv = to_phy_driver(phydev->dev.driver); - drv->config_aneg(phydev); + + if (drv) + drv->config_aneg(phydev); } int phy_register_device(struct phy_device *phydev) @@ -255,13 +264,15 @@ int phy_register_device(struct phy_device *phydev) if (phydev->registered) return -EBUSY; - phydev->dev.parent = &phydev->bus->dev; + if (!phydev->dev.parent) + phydev->dev.parent = &phydev->bus->dev; ret = register_device(&phydev->dev); if (ret) return ret; - phydev->bus->phy_map[phydev->addr] = phydev; + if (phydev->bus) + phydev->bus->phy_map[phydev->addr] = phydev; phydev->registered = 1; @@ -289,6 +300,22 @@ void phy_unregister_device(struct phy_device *phydev) phydev->registered = 0; } +struct phy_device *of_phy_register_fixed_link(struct device_node *np, struct eth_device *edev) +{ + struct phy_device *phydev; + + phydev = phy_device_create(NULL, 0, 0); + + phydev->dev.parent = &edev->dev; + phydev->registered = 1; + phydev->speed = 1000; + phydev->duplex = 1; + phydev->pause = phydev->asym_pause = 0; + phydev->link = 1; + + return phydev; +} + static struct phy_device *of_mdio_find_phy(struct eth_device *edev) { struct device_d *dev; @@ -305,6 +332,12 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev) phy_node = of_parse_phandle(edev->parent->device_node, "phy", 0); if (!phy_node) phy_node = of_parse_phandle(edev->parent->device_node, "phy-device", 0); + if (!phy_node) { + phy_node = of_get_child_by_name(edev->parent->device_node, "fixed-link"); + if (phy_node) + return of_phy_register_fixed_link(phy_node, edev); + } + if (!phy_node) return NULL; diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c index b7055910eb..e08e3dd1b5 100644 --- a/drivers/net/smc91111.c +++ b/drivers/net/smc91111.c @@ -67,7 +67,7 @@ #include <io.h> #include <linux/phy.h> #include <linux/err.h> -#include <net/smc91111.h> +#include <platform_data/eth-smc91111.h> /*--------------------------------------------------------------- . diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index 9b1a38ae21..fe9d1df502 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -28,7 +28,7 @@ #include <errno.h> #include <clock.h> #include <io.h> -#include <smc911x.h> +#include <platform_data/eth-smc911x.h> #include <linux/phy.h> #include "smc911x.h" diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h index 8540a84344..3bf2af9c35 100644 --- a/drivers/net/smc911x.h +++ b/drivers/net/smc911x.h @@ -186,7 +186,7 @@ #define RX_DP_CTRL_RX_FFWD 0x80000000 /* R/W */ #define RX_DP_CTRL_FFWD_BUSY 0x80000000 /* RO */ -#define RX_FIFO_INF 0x7C +#define RX_FIFO_INF 0x7C #define RX_FIFO_INF_RXSUSED 0x00FF0000 /* RO */ #define RX_FIFO_INF_RXDUSED 0x0000FFFF /* RO */ diff --git a/drivers/of/Makefile b/drivers/of/Makefile index f31bb293fb..ec43870061 100644 --- a/drivers/of/Makefile +++ b/drivers/of/Makefile @@ -1,8 +1,8 @@ -obj-y += address.o base.o fdt.o platform.o device.o +obj-y += address.o base.o fdt.o platform.o of_path.o device.o obj-$(CONFIG_OFTREE_MEM_GENERIC) += mem_generic.o obj-$(CONFIG_OF_GPIO) += of_gpio.o obj-$(CONFIG_OF_PCI) += of_pci.o obj-y += partition.o obj-y += of_net.o obj-$(CONFIG_MTD) += of_mtd.o -obj-$(CONFIG_OF_BAREBOX_DRIVERS) += barebox.o of_path.o +obj-$(CONFIG_OF_BAREBOX_DRIVERS) += barebox.o diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c index 125feef2cc..64f483326d 100644 --- a/drivers/of/barebox.c +++ b/drivers/of/barebox.c @@ -61,7 +61,7 @@ static int environment_check_mount(struct device_d *dev, char **devpath) /* Set env to be in a file on the now mounted device */ dev_dbg(dev, "Loading default env from %s on device %s\n", filepath, *devpath); - *devpath = asprintf("%s/%s", ENV_MNT_DIR, filepath); + *devpath = basprintf("%s/%s", ENV_MNT_DIR, filepath); return 0; } diff --git a/drivers/of/base.c b/drivers/of/base.c index d12bfe328a..cbe7b7cec4 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -30,6 +30,8 @@ #include <linux/amba/bus.h> #include <linux/err.h> +static struct device_node *root_node; + /* * Iterate over all nodes of a tree. As a devicetree does not * have a dedicated list head, the start node (usually the root @@ -39,6 +41,9 @@ static inline struct device_node *of_next_node(struct device_node *node) { struct device_node *next; + if (!node) + return root_node; + next = list_first_entry(&node->list, struct device_node, list); return next->parent ? next : NULL; @@ -68,8 +73,6 @@ struct alias_prop { static LIST_HEAD(aliases_lookup); -static struct device_node *root_node; - static struct device_node *of_aliases; #define OF_ROOT_NODE_SIZE_CELLS_DEFAULT 1 @@ -277,12 +280,6 @@ struct device_node *of_find_node_by_phandle_from(phandle phandle, { struct device_node *node; - if (!root) - root = root_node; - - if (!root) - return NULL; - of_tree_for_each_node_from(node, root) if (node->phandle == phandle) return node; @@ -309,15 +306,7 @@ EXPORT_SYMBOL(of_find_node_by_phandle); phandle of_get_tree_max_phandle(struct device_node *root) { struct device_node *n; - phandle max; - - if (!root) - root = root_node; - - if (!root) - return 0; - - max = root->phandle; + phandle max = 0; of_tree_for_each_node_from(n, root) { if (n->phandle > max) @@ -430,9 +419,6 @@ struct device_node *of_find_node_by_name(struct device_node *from, { struct device_node *np; - if (!from) - from = root_node; - of_tree_for_each_node_from(np, from) if (np->name && !of_node_cmp(np->name, name)) return np; @@ -458,9 +444,6 @@ struct device_node *of_find_node_by_type(struct device_node *from, const char *device_type; int ret; - if (!from) - from = root_node; - of_tree_for_each_node_from(np, from) { ret = of_property_read_string(np, "device_type", &device_type); if (!ret && !of_node_cmp(device_type, type)) @@ -489,9 +472,6 @@ struct device_node *of_find_compatible_node(struct device_node *from, { struct device_node *np; - if (!from) - from = root_node; - of_tree_for_each_node_from(np, from) if (of_device_is_compatible(np, compatible)) return np; @@ -516,9 +496,6 @@ struct device_node *of_find_node_with_property(struct device_node *from, { struct device_node *np; - if (!from) - from = root_node; - of_tree_for_each_node_from(np, from) { struct property *pp = of_find_property(np, prop_name, NULL); if (pp) @@ -572,9 +549,6 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from, if (match) *match = NULL; - if (!from) - from = root_node; - of_tree_for_each_node_from(np, from) { const struct of_device_id *m = of_match_node(matches, np); if (m) { @@ -1702,7 +1676,8 @@ struct device_node *of_new_node(struct device_node *parent, const char *name) if (parent) { node->name = xstrdup(name); - node->full_name = asprintf("%s/%s", node->parent->full_name, name); + node->full_name = basprintf("%s/%s", + node->parent->full_name, name); list_add(&node->list, &parent->list); } else { node->name = xstrdup(""); diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 88f0523260..b2253aa7a2 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -46,6 +46,70 @@ static inline char *dt_string(struct fdt_header *f, char *strstart, uint32_t ofs return strstart + ofs; } +static int of_reservemap_num_entries(const struct fdt_header *fdt) +{ + const struct fdt_reserve_entry *r; + int n = 0; + + r = (void *)fdt + be32_to_cpu(fdt->off_mem_rsvmap); + + while (r->size) { + n++; + r++; + if (n == OF_MAX_RESERVE_MAP) + return -EINVAL; + } + + return n; +} + +/** + * of_unflatten_reservemap - store /memreserve/ entries in unflattened tree + * @root - The unflattened tree + * @fdt - the flattened device tree blob + * + * This stores the memreserve entries from the dtb in a newly created + * /memserve node in the unflattened device tree. The device tree + * flatten code moves the entries back to the /memreserve/ area in the + * flattened tree. + * + * Return: 0 for success or negative error code + */ +static int of_unflatten_reservemap(struct device_node *root, + const struct fdt_header *fdt) +{ + int n; + struct property *p; + struct device_node *memreserve; + __be32 cells; + + n = of_reservemap_num_entries(fdt); + if (n <= 0) + return n; + + memreserve = of_new_node(root, "memreserve"); + if (!memreserve) + return -ENOMEM; + + cells = cpu_to_be32(2); + + p = of_new_property(memreserve, "#address-cells", &cells, sizeof(__be32)); + if (!p) + return -ENOMEM; + + p = of_new_property(memreserve, "#size-cells", &cells, sizeof(__be32)); + if (!p) + return -ENOMEM; + + p = of_new_property(memreserve, "reg", + (void *)fdt + be32_to_cpu(fdt->off_mem_rsvmap), + n * sizeof(struct fdt_reserve_entry)); + if (!p) + return -ENOMEM; + + return 0; +} + /** * of_unflatten_dtb - unflatten a dtb binary blob * @infdt - the fdt blob to unflatten @@ -103,6 +167,10 @@ struct device_node *of_unflatten_dtb(const void *infdt) if (!root) return ERR_PTR(-ENOMEM); + ret = of_unflatten_reservemap(root, fdt); + if (ret) + goto err; + while (1) { tag = be32_to_cpu(*(uint32_t *)(infdt + dt_struct)); @@ -289,7 +357,7 @@ static inline int dt_add_string(struct fdt *fdt, const char *str) return ret; } -static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node) +static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node, int is_root) { struct property *p; struct device_node *n; @@ -322,7 +390,10 @@ static int __of_flatten_dtb(struct fdt *fdt, struct device_node *node) } list_for_each_entry(n, &node->children, parent_list) { - ret = __of_flatten_dtb(fdt, n); + if (is_root && !strcmp(n->name, "memreserve")) + continue; + + ret = __of_flatten_dtb(fdt, n, 0); if (ret) return ret; } @@ -347,8 +418,10 @@ void *of_flatten_dtb(struct device_node *node) int ret; struct fdt_header header = {}; struct fdt fdt = {}; - uint32_t ofs; + uint32_t ofs, off_mem_rsvmap; struct fdt_node_header *nh; + struct device_node *memreserve; + int len; header.magic = cpu_to_fdt32(FDT_MAGIC); header.version = cpu_to_fdt32(0x11); @@ -364,14 +437,24 @@ void *of_flatten_dtb(struct device_node *node) ofs = sizeof(struct fdt_header); - header.off_mem_rsvmap = cpu_to_fdt32(ofs); + off_mem_rsvmap = ofs; + header.off_mem_rsvmap = cpu_to_fdt32(off_mem_rsvmap); ofs += sizeof(struct fdt_reserve_entry) * OF_MAX_RESERVE_MAP; fdt.dt_nextofs = ofs; - ret = __of_flatten_dtb(&fdt, node); + ret = __of_flatten_dtb(&fdt, node, 1); if (ret) goto out_free; + + memreserve = of_find_node_by_name(node, "memreserve"); + if (memreserve) { + const void *entries = of_get_property(memreserve, "reg", &len); + + if (entries) + memcpy(fdt.dt + off_mem_rsvmap, entries, len); + } + nh = fdt.dt + fdt.dt_nextofs; nh->tag = cpu_to_fdt32(FDT_END); fdt.dt_nextofs = dt_next_ofs(fdt.dt_nextofs, sizeof(struct fdt_node_header)); @@ -453,7 +536,18 @@ void fdt_add_reserve_map(void *__fdt) struct of_reserve_map *res = &of_reserve_map; struct fdt_reserve_entry *fdt_res = __fdt + be32_to_cpu(fdt->off_mem_rsvmap); - int i; + int i, n; + + n = of_reservemap_num_entries(fdt); + if (n < 0) + return; + + if (n + res->num_entries + 2 > OF_MAX_FREE_RESERVE_MAP) { + pr_err("Too many entries in reserve map\n"); + return; + } + + fdt_res += n; for (i = 0; i < res->num_entries; i++) { of_write_number(&fdt_res->address, res->start[i], 2); diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c index ed620f1755..8e1931f939 100644 --- a/drivers/of/of_path.c +++ b/drivers/of/of_path.c @@ -75,7 +75,7 @@ static int __of_find_path(struct device_node *node, const char *part, char **out mtd_can_have_bb(cdev->mtd)) add_bb = true; - *outpath = asprintf("/dev/%s%s", cdev->name, add_bb ? ".bb" : ""); + *outpath = basprintf("/dev/%s%s", cdev->name, add_bb ? ".bb" : ""); return 0; } diff --git a/drivers/of/partition.c b/drivers/of/partition.c index 6017897b02..b6621f7dad 100644 --- a/drivers/of/partition.c +++ b/drivers/of/partition.c @@ -58,7 +58,7 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node) if (of_get_property(node, "read-only", &len)) flags = DEVFS_PARTITION_READONLY; - filename = asprintf("%s.%s", cdev->name, partname); + filename = basprintf("%s.%s", cdev->name, partname); new = devfs_add_partition(cdev->name, offset, size, flags, filename); if (IS_ERR(new)) diff --git a/drivers/pci/pci-mvebu.c b/drivers/pci/pci-mvebu.c index da2459bafe..907bda0f96 100644 --- a/drivers/pci/pci-mvebu.c +++ b/drivers/pci/pci-mvebu.c @@ -306,7 +306,7 @@ static struct mvebu_pcie *mvebu_pcie_port_probe(struct device_d *dev, reset_gpio = of_get_named_gpio_flags(np, "reset-gpios", 0, &flags); if (gpio_is_valid(reset_gpio)) { int reset_active_low = flags & OF_GPIO_ACTIVE_LOW; - char *reset_name = asprintf("pcie%d.%d-reset", port, lane); + char *reset_name = basprintf("pcie%d.%d-reset", port, lane); u32 reset_udelay = 20000; of_property_read_u32(np, "reset-delay-us", &reset_udelay); @@ -326,7 +326,7 @@ static struct mvebu_pcie *mvebu_pcie_port_probe(struct device_d *dev, pcie->port = port; pcie->lane = lane; pcie->lane_mask = lane_mask; - pcie->name = asprintf("pcie%d.%d", port, lane); + pcie->name = basprintf("pcie%d.%d", port, lane); pcie->devfn = devfn; pcie->base = of_iomap(np, 0); diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c index ec0aaec67f..fa1176fe1b 100644 --- a/drivers/pinctrl/pinctrl-mxs.c +++ b/drivers/pinctrl/pinctrl-mxs.c @@ -89,8 +89,8 @@ static int mxs_pinctrl_set_state(struct pinctrl_device *pdev, struct device_node writel(0x3 << shift, reg + STMP_OFFSET_REG_CLR); writel(muxsel << shift, reg + STMP_OFFSET_REG_SET); - dev_dbg(iomux->pinctrl.dev, "pin %d, mux %d, ma: %d, vol: %d, pull: %d\n", - pinid, muxsel, ma, vol, pull); + dev_dbg(iomux->pinctrl.dev, "(val: 0x%x) pin %d, mux %d, ma: %d, vol: %d, pull: %d\n", + val, pinid, muxsel, ma, vol, pull); /* drive */ reg = iomux->base + 0x300; diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c index 10ce186a12..e7b08a2bfe 100644 --- a/drivers/pinctrl/pinctrl.c +++ b/drivers/pinctrl/pinctrl.c @@ -68,7 +68,7 @@ int of_pinctrl_select_state(struct device_node *np, const char *name) /* For each defined state ID */ for (state = 0; ; state++) { /* Retrieve the pinctrl-* property */ - propname = asprintf("pinctrl-%d", state); + propname = basprintf("pinctrl-%d", state); prop = of_find_property(np, propname, NULL); free(propname); diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c index 0845c234fe..b620e502f2 100644 --- a/drivers/pwm/pwm-imx.c +++ b/drivers/pwm/pwm-imx.c @@ -236,9 +236,10 @@ static int imx_pwm_probe(struct device_d *dev) if (dev->device_node) { imx->chip.devname = of_alias_get(dev->device_node); if (!imx->chip.devname) - imx->chip.devname = asprintf("pwm_%p", imx->mmio_base); + imx->chip.devname = basprintf("pwm_%p", + imx->mmio_base); } else { - imx->chip.devname = asprintf("pwm%d", dev->id); + imx->chip.devname = basprintf("pwm%d", dev->id); } imx->config = data->config; diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c index 011d9002ba..e72f1dbcb0 100644 --- a/drivers/pwm/pwm-mxs.c +++ b/drivers/pwm/pwm-mxs.c @@ -143,7 +143,7 @@ static int mxs_pwm_probe(struct device_d *dev) struct mxs_pwm_chip *mxspwm = &mxs->pwm[i]; mxspwm->chip.ops = &mxs_pwm_ops; - mxspwm->chip.devname = asprintf("pwm%d", i); + mxspwm->chip.devname = basprintf("pwm%d", i); mxspwm->chip.id = i; mxspwm->mxs = mxs; diff --git a/drivers/pwm/pxa_pwm.c b/drivers/pwm/pxa_pwm.c index e399d03efd..c7130c225e 100644 --- a/drivers/pwm/pxa_pwm.c +++ b/drivers/pwm/pxa_pwm.c @@ -134,7 +134,7 @@ static int pxa_pwm_probe(struct device_d *dev) struct pxa_pwm_chip *chip; chip = xzalloc(sizeof(*chip)); - chip->chip.devname = asprintf("pwm%d", dev->id); + chip->chip.devname = basprintf("pwm%d", dev->id); chip->chip.ops = &pxa_pwm_ops; iores = dev_request_mem_resource(dev, 0); if (IS_ERR(iores)) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 73f5c6eb4b..39df980dcb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -153,7 +153,7 @@ static struct regulator_internal *of_regulator_get(struct device_d *dev, const c struct regulator_internal *ri; struct device_node *node; - propname = asprintf("%s-supply", supply); + propname = basprintf("%s-supply", supply); /* * If the device does have a device node return the dummy regulator. diff --git a/drivers/serial/serial_auart.c b/drivers/serial/serial_auart.c index 9bef576cd7..c3b9a1995f 100644 --- a/drivers/serial/serial_auart.c +++ b/drivers/serial/serial_auart.c @@ -230,9 +230,18 @@ static void auart_serial_remove(struct device_d *dev) free(priv); } +static const __maybe_unused struct of_device_id auart_serial_dt_ids[] = { + { + .compatible = "fsl,imx23-auart", + }, { + /* sentinel */ + } +}; + static struct driver_d auart_serial_driver = { .name = "auart_serial", .probe = auart_serial_probe, .remove = auart_serial_remove, + .of_compatible = DRV_OF_COMPAT(auart_serial_dt_ids), }; console_platform_driver(auart_serial_driver); diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index 4ad52ea79c..c6548e3b85 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -41,7 +41,7 @@ #include <linux/clk.h> #include "serial_ns16550.h" -#include <ns16550.h> +#include <platform_data/serial-ns16550.h> struct ns16550_priv { struct console_device cdev; diff --git a/drivers/spi/gpio_spi.c b/drivers/spi/gpio_spi.c index 4ea545a282..e37db756f8 100644 --- a/drivers/spi/gpio_spi.c +++ b/drivers/spi/gpio_spi.c @@ -209,7 +209,7 @@ static int gpio_spi_probe(struct device_d *dev) if (!gpio_is_valid(pdata->cs[n])) continue; - cs_name = asprintf("spi-cs%d", n); + cs_name = basprintf("spi-cs%d", n); ret = gpio_request_one(pdata->cs[n], GPIOF_DIR_OUT, cs_name); if (ret) return ret; diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c index 5bd1845fbb..99ec228887 100644 --- a/drivers/spi/imx_spi.c +++ b/drivers/spi/imx_spi.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Sascha Hauer, Pengutronix + * Copyright (C) 2008 Sascha Hauer, Pengutronix * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index ba3b9da206..9e38ac4942 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1763,7 +1763,7 @@ EXPORT_SYMBOL_GPL(usb_composite_setup_continue); static char *composite_default_mfr(struct usb_gadget *gadget) { - return asprintf("barebox %s", gadget->name); + return basprintf("barebox %s", gadget->name); } void usb_composite_overwrite_options(struct usb_composite_dev *cdev, diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index aaf784913b..859aaff279 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -17,6 +17,7 @@ #define pr_fmt(fmt) "fastboot: " fmt #include <common.h> +#include <command.h> #include <errno.h> #include <malloc.h> #include <fcntl.h> @@ -194,7 +195,7 @@ static void fb_setvar(struct fb_variable *var, const char *fmt, ...) va_list ap; va_start(ap, fmt); - var->value = vasprintf(fmt, ap); + var->value = bvasprintf(fmt, ap); va_end(ap); } @@ -204,7 +205,7 @@ static struct fb_variable *fb_addvar(struct f_fastboot *f_fb, const char *fmt, . va_list ap; va_start(ap, fmt); - var->name = vasprintf(fmt, ap); + var->name = bvasprintf(fmt, ap); va_end(ap); list_add_tail(&var->list, &f_fb->variables); @@ -701,7 +702,8 @@ static void cb_flash(struct usb_ep *ep, struct usb_request *req, const char *cmd if (ret) goto copy; - cmd = asprintf("ubiformat -y -f %s %s", FASTBOOT_TMPFILE, filename); + cmd = basprintf("ubiformat -y -f %s %s", FASTBOOT_TMPFILE, + filename); fastboot_tx_print(f_fb, "INFOThis is an UBI image..."); diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 9d1ffa3070..8218bb2a71 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c @@ -397,7 +397,7 @@ static int usb_stor_add_blkdev(struct us_data *us, struct device_d *dev, pr_err("Cannot find a free number for the disk node\n"); pr_info("Using index %d for the new disk\n", result); - pblk_dev->blk.cdev.name = asprintf("disk%d", result); + pblk_dev->blk.cdev.name = basprintf("disk%d", result); pblk_dev->blk.blockbits = SECTOR_SHIFT; result = blockdevice_register(&pblk_dev->blk); diff --git a/drivers/video/edid.c b/drivers/video/edid.c index 828c3610ac..e5c32a0c1b 100644 --- a/drivers/video/edid.c +++ b/drivers/video/edid.c @@ -469,7 +469,8 @@ static void calc_mode_timings(int xres, int yres, int refresh, mode->yres = yres; mode->refresh = refresh; fb_get_mode(0, refresh, mode); - mode->name = asprintf("%dx%d@%d-calc", mode->xres, mode->yres, mode->refresh); + mode->name = basprintf("%dx%d@%d-calc", mode->xres, mode->yres, + mode->refresh); pr_debug(" %s\n", mode->name); } @@ -602,7 +603,8 @@ const struct fb_videomode vesa_modes[] = { static void add_vesa_mode(struct fb_videomode *mode, int num) { *mode = vesa_modes[num]; - mode->name = asprintf("%dx%d@%d-vesa", mode->xres, mode->yres, mode->refresh); + mode->name = basprintf("%dx%d@%d-vesa", mode->xres, mode->yres, + mode->refresh); pr_debug(" %s\n", mode->name); } @@ -748,7 +750,8 @@ static void get_detailed_timing(unsigned char *block, pr_debug("%sHSync %sVSync\n", (HSYNC_POSITIVE) ? "+" : "-", (VSYNC_POSITIVE) ? "+" : "-"); - mode->name = asprintf("%dx%d@%d", mode->xres, mode->yres, mode->refresh); + mode->name = basprintf("%dx%d@%d", mode->xres, mode->yres, + mode->refresh); } /** diff --git a/drivers/video/fb.c b/drivers/video/fb.c index 09bba001fb..4d2d3aa650 100644 --- a/drivers/video/fb.c +++ b/drivers/video/fb.c @@ -262,7 +262,7 @@ int register_framebuffer(struct fb_info *info) info->line_length = info->xres * (info->bits_per_pixel >> 3); info->cdev.ops = &fb_ops; - info->cdev.name = asprintf("fb%d", id); + info->cdev.name = basprintf("fb%d", id); info->cdev.size = info->line_length * info->yres; info->cdev.dev = dev; info->cdev.priv = info; diff --git a/drivers/video/imx-ipu-v3/imx-ldb.c b/drivers/video/imx-ipu-v3/imx-ldb.c index 2340b9b1d6..17ae894bf7 100644 --- a/drivers/video/imx-ipu-v3/imx-ldb.c +++ b/drivers/video/imx-ipu-v3/imx-ldb.c @@ -161,7 +161,7 @@ static int imx6q_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di, ipuno = ((di >> 1) & 1) + 1; dino = di & 0x1; - clkname = asprintf("ipu%d_di%d_sel", ipuno, dino); + clkname = basprintf("ipu%d_di%d_sel", ipuno, dino); diclk = clk_lookup(clkname); free(clkname); if (IS_ERR(diclk)) { @@ -169,7 +169,7 @@ static int imx6q_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di, return PTR_ERR(diclk); } - clkname = asprintf("ldb_di%d_podf", imx_ldb_ch->chno); + clkname = basprintf("ldb_di%d_podf", imx_ldb_ch->chno); ldbclk = clk_lookup(clkname); free(clkname); if (IS_ERR(ldbclk)) { @@ -208,7 +208,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di, dino = di & 0x1; - clkname = asprintf("ipu_di%d_sel", dino); + clkname = basprintf("ipu_di%d_sel", dino); diclk = clk_lookup(clkname); free(clkname); if (IS_ERR(diclk)) { @@ -216,7 +216,7 @@ static int imx53_ldb_prepare(struct imx_ldb_channel *imx_ldb_ch, int di, return PTR_ERR(diclk); } - clkname = asprintf("ldb_di%d_div", imx_ldb_ch->chno); + clkname = basprintf("ldb_di%d_div", imx_ldb_ch->chno); ldbclk = clk_lookup(clkname); free(clkname); if (IS_ERR(ldbclk)) { diff --git a/drivers/video/imx-ipu-v3/ipu-di.c b/drivers/video/imx-ipu-v3/ipu-di.c index 8df9c9f06b..b6e64fe16a 100644 --- a/drivers/video/imx-ipu-v3/ipu-di.c +++ b/drivers/video/imx-ipu-v3/ipu-di.c @@ -732,8 +732,7 @@ int ipu_di_init(struct ipu_soc *ipu, struct device_d *dev, int id, ipu_di_write(di, 0x10, DI_BS_CLKGEN0); di->clk_di_pixel.parent_names = di->di_parent_names; - di->clk_name = asprintf("%s_di%d_pixel", - dev_name(dev), id); + di->clk_name = basprintf("%s_di%d_pixel", dev_name(dev), id); if (!di->clk_name) return -ENOMEM; diff --git a/drivers/video/imx-ipu-v3/ipufb.c b/drivers/video/imx-ipu-v3/ipufb.c index 747e094789..67fec11d4a 100644 --- a/drivers/video/imx-ipu-v3/ipufb.c +++ b/drivers/video/imx-ipu-v3/ipufb.c @@ -284,7 +284,7 @@ static int ipufb_probe(struct device_d *dev) info = &fbi->info; ipuid = of_alias_get_id(dev->parent->device_node, "ipu"); - fbi->name = asprintf("ipu%d-di%d", ipuid + 1, pdata->di); + fbi->name = basprintf("ipu%d-di%d", ipuid + 1, pdata->di); fbi->id = ipuid * 2 + pdata->di; fbi->dino = pdata->di; diff --git a/drivers/w1/slaves/w1_ds2431.c b/drivers/w1/slaves/w1_ds2431.c index 30e6e1d496..e3e929670d 100644 --- a/drivers/w1/slaves/w1_ds2431.c +++ b/drivers/w1/slaves/w1_ds2431.c @@ -272,7 +272,7 @@ static int ds2431_probe(struct w1_device *dev) cdev->priv = dev; cdev->ops = &ds2431_ops; cdev->size = W1_F2D_EEPROM_SIZE; - cdev->name = asprintf(DRIVERNAME"%d", ds2431_count++); + cdev->name = basprintf(DRIVERNAME"%d", ds2431_count++); if (cdev->name == NULL) return -ENOMEM; diff --git a/drivers/w1/slaves/w1_ds2433.c b/drivers/w1/slaves/w1_ds2433.c index a840d9a2f2..a907c6bf3c 100644 --- a/drivers/w1/slaves/w1_ds2433.c +++ b/drivers/w1/slaves/w1_ds2433.c @@ -171,7 +171,7 @@ static int ds2433_cdev_create(struct w1_device *dev, int size, int id) cdev->priv = dev; cdev->ops = &ds2433_ops; cdev->size = size; - cdev->name = asprintf("%s%d", dev->dev.driver->name, id); + cdev->name = basprintf("%s%d", dev->dev.driver->name, id); if (cdev->name == NULL) return -ENOMEM; diff --git a/fs/bpkfs.c b/fs/bpkfs.c index 1e2619e5cd..f1db963d09 100644 --- a/fs/bpkfs.c +++ b/fs/bpkfs.c @@ -14,6 +14,7 @@ #include <fcntl.h> #include <malloc.h> #include <init.h> +#include <crc.h> #include <linux/stat.h> #include <linux/err.h> #include <bpkfs.h> @@ -102,7 +103,7 @@ static struct bpkfs_handle_hw *bpkfs_get_or_add_hw_id( INIT_LIST_HEAD(&h->list_data); h->hw_id = hw_id; - h->name = asprintf("hw_id_%x", hw_id); + h->name = basprintf("hw_id_%x", hw_id); list_add_tail(&h->list_hw_id, &handle->list); return h; @@ -430,7 +431,7 @@ static int bpkfs_probe(struct device_d *dev) if (!type) { type = "unknown"; - d->name = asprintf("%s_%08x", type, d->type); + d->name = basprintf("%s_%08x", type, d->type); } else { d->name = xstrdup(type); } @@ -463,7 +464,7 @@ static int bpkfs_probe(struct device_d *dev) type = d->name; d = xzalloc(sizeof(*d)); d->type = be32_to_cpu(data_header.type); - d->name = asprintf("%s.crc", type); + d->name = basprintf("%s.crc", type); d->type |= (1 << 31); d->size = 8; sprintf(d->data, "%08x", be32_to_cpu(data_header.crc)); diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 988fa7e8e6..a02c253841 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -306,7 +306,7 @@ static int cramfs_close(struct device_d *dev, FILE *file) free(inodei->block_ptrs); free(inodei); - + return 0; } @@ -30,8 +30,10 @@ #include <fcntl.h> #include <wchar.h> #include <efi.h> +#include <libfile.h> #include <mach/efi.h> #include <mach/efi-device.h> +#include <linux/stddef.h> /* Open modes */ #define EFI_FILE_MODE_READ 0x0000000000000001 @@ -92,8 +94,6 @@ struct efi_file_info { s16 FileName[1]; }; -typedef unsigned short wchar_t; - struct efifs_priv { struct efi_file_handle *root_dir; struct efi_file_io_interface *protocol; @@ -530,8 +530,8 @@ int efi_fs_probe(struct efi_device *efidev) if (efi_loaded_image && efidev->protocol == volume) path = xstrdup("/boot"); else - path = asprintf("/efi%d", index); - device = asprintf("%s", dev_name(&efidev->dev)); + path = basprintf("/efi%d", index); + device = basprintf("%s", dev_name(&efidev->dev)); ret = make_directory(path); if (ret) diff --git a/fs/efivarfs.c b/fs/efivarfs.c index c7a282b05c..86cdcf0b59 100644 --- a/fs/efivarfs.c +++ b/fs/efivarfs.c @@ -154,7 +154,7 @@ static int efivars_create(struct device_d *dev, const char *pathname, mode_t mod name8 = xstrdup_wchar_to_char(inode->name); - inode->full_name = asprintf("%s-%pUl", name8, &inode->vendor); + inode->full_name = basprintf("%s-%pUl", name8, &inode->vendor); free(name8); efiret = RT->set_variable(inode->name, &inode->vendor, @@ -405,7 +405,7 @@ static int efivarfs_probe(struct device_d *dev) inode->vendor = vendor; name8 = xstrdup_wchar_to_char(inode->name); - inode->full_name = asprintf("%s-%pUl", name8, &vendor); + inode->full_name = basprintf("%s-%pUl", name8, &vendor); free(name8); list_add_tail(&inode->node, &priv->inodes); @@ -18,6 +18,7 @@ */ #include <common.h> +#include <command.h> #include <fs.h> #include <driver.h> #include <errno.h> @@ -33,6 +34,7 @@ #include <environment.h> #include <libgen.h> #include <block.h> +#include <libfile.h> char *mkmodestr(unsigned long mode, char *str) { @@ -1299,7 +1301,8 @@ int mount(const char *device, const char *fsname, const char *_path, } if (!fsdev->linux_rootarg && fsdev->cdev && fsdev->cdev->partuuid[0] != 0) { - char *str = asprintf("root=PARTUUID=%s", fsdev->cdev->partuuid); + char *str = basprintf("root=PARTUUID=%s", + fsdev->cdev->partuuid); fsdev_set_linux_rootarg(fsdev, str); } @@ -1718,10 +1721,10 @@ const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions) if (path) return path; - newpath = asprintf("/mnt/%s", cdev->name); + newpath = basprintf("/mnt/%s", cdev->name); make_directory(newpath); - devpath = asprintf("/dev/%s", cdev->name); + devpath = basprintf("/dev/%s", cdev->name); ret = mount(devpath, NULL, newpath, fsoptions); @@ -1317,19 +1317,18 @@ static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev) const char *ip; ip = ip_to_string(npriv->server); - str = asprintf("root=/dev/nfs nfsroot=%s:%s%s%s", - ip, npriv->path, rootnfsopts[0] ? "," : "", - rootnfsopts); + str = basprintf("root=/dev/nfs nfsroot=%s:%s%s%s", ip, npriv->path, + rootnfsopts[0] ? "," : "", rootnfsopts); /* forward specific mount options on demand */ if (npriv->manual_nfs_port == 1) { - tmp = asprintf("%s,port=%hu", str, npriv->nfs_port); + tmp = basprintf("%s,port=%hu", str, npriv->nfs_port); free(str); str = tmp; } if (npriv->manual_mount_port == 1) { - tmp = asprintf("%s,mountport=%hu", str, npriv->mount_port); + tmp = basprintf("%s,mountport=%hu", str, npriv->mount_port); free(str); str = tmp; } diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 0017a4a2d1..ce6e95e373 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -2413,7 +2413,7 @@ retry: goto retry; #endif } - + err = set(s, data); if (err) { #ifndef __BAREBOX__ diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index f07ad5e7f9..8062baaa85 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -1269,8 +1269,8 @@ void ubifs_set_rootarg(struct ubifs_priv *priv, struct fs_device_d *fsdev) mtd = di.mtd; - str = asprintf("root=ubi0:%s ubi.mtd=%s rootfstype=ubifs", - vi.name, mtd->cdev.partname); + str = basprintf("root=ubi0:%s ubi.mtd=%s rootfstype=ubifs", + vi.name, mtd->cdev.partname); fsdev_set_linux_rootarg(fsdev, str); diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 75e54e7fef..5c5a82637e 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -34,6 +34,7 @@ #else #include <common.h> #include <lzo.h> +#include <crc.h> #include <linux/fs.h> #include <linux/sched.h> #include <linux/ctype.h> @@ -423,7 +424,7 @@ struct super_block { struct file_system_type { const char *name; int fs_flags; -#define FS_REQUIRES_DEV 1 +#define FS_REQUIRES_DEV 1 #define FS_BINARY_MOUNTDATA 2 #define FS_HAS_SUBTYPE 4 #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ diff --git a/fs/uimagefs.c b/fs/uimagefs.c index 3fdc5bd2be..13c1fbac05 100644 --- a/fs/uimagefs.c +++ b/fs/uimagefs.c @@ -17,6 +17,7 @@ #include <uimagefs.h> #include <libbb.h> #include <rtc.h> +#include <crc.h> #include <libfile.h> static bool uimagefs_is_data_file(struct uimagefs_handle_data *d) @@ -249,7 +250,7 @@ static int uimagefs_add_name(struct uimagefs_handle *priv) static int uimagefs_add_hex(struct uimagefs_handle *priv, enum uimagefs_type type, uint32_t data) { - char *val = asprintf("0x%x", data); + char *val = basprintf("0x%x", data); return uimagefs_add_str(priv, type, val); } @@ -265,7 +266,7 @@ static int __uimagefs_add_data(struct uimagefs_handle *priv, size_t offset, if (i < 0) d->name = xstrdup(name); else - d->name = asprintf("%s%d", name, i); + d->name = basprintf("%s%d", name, i); d->offset = offset; d->size = size; @@ -303,7 +304,7 @@ static int uimagefs_add_time(struct uimagefs_handle *priv) char *val; to_tm(header->ih_time, &tm); - val = asprintf("%4d-%02d-%02d %2d:%02d:%02d UTC", + val = basprintf("%4d-%02d-%02d %2d:%02d:%02d UTC", tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -514,8 +515,8 @@ static int uimagefs_probe(struct device_d *dev) dev_dbg(dev, "mount: %s\n", fsdev->backingstore); if (IS_BUILTIN(CONFIG_FS_TFTP)) - priv->tmp = asprintf("/.uImage_tmp_%08x", - crc32(0, fsdev->path, strlen(fsdev->path))); + priv->tmp = basprintf("/.uImage_tmp_%08x", + crc32(0, fsdev->path, strlen(fsdev->path))); ret = __uimage_open(priv); if (ret) diff --git a/images/Makefile.am33xx b/images/Makefile.am33xx index 6c7e81a9dc..8be78eff89 100644 --- a/images/Makefile.am33xx +++ b/images/Makefile.am33xx @@ -83,6 +83,12 @@ FILE_barebox-am33xx-phytec-phycore-mlo-1024mb.spi.img = start_am33xx_phytec_phyc am33xx-mlo-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-mlo-1024mb.img am33xx-mlospi-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-mlo-1024mb.spi.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += start_am33xx_phytec_phycore_r2_sram_1024mb +FILE_barebox-am33xx-phytec-phycore-r2-mlo-1024mb.img = start_am33xx_phytec_phycore_r2_sram_1024mb.pblx.mlo +FILE_barebox-am33xx-phytec-phycore-r2-mlo-1024mb.spi.img = start_am33xx_phytec_phycore_r2_sram_1024mb.pblx.mlospi +am33xx-mlo-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-r2-mlo-1024mb.img +am33xx-mlospi-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phycore-r2-mlo-1024mb.spi.img + pblx-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += start_am33xx_phytec_phyflex_sdram FILE_barebox-am33xx-phytec-phyflex.img = start_am33xx_phytec_phyflex_sdram.pblx am33xx-barebox-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += barebox-am33xx-phytec-phyflex.img diff --git a/images/Makefile.imx b/images/Makefile.imx index 6870bce4ca..0ff317ba07 100644 --- a/images/Makefile.imx +++ b/images/Makefile.imx @@ -203,6 +203,11 @@ CFG_start_phytec_phyboard_subra_512mb_1bank.pblx.imximg = $(board)/phytec-som-im FILE_barebox-phytec-phyboard-subra-512mb-1bank.img = start_phytec_phyboard_subra_512mb_1bank.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phyboard-subra-512mb-1bank.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phyboard_subra_1gib_1bank +CFG_start_phytec_phyboard_subra_1gib_1bank.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pfla02-1gib-1bank.imxcfg +FILE_barebox-phytec-phyboard-subra-1gib-1bank.img = start_phytec_phyboard_subra_1gib_1bank.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phyboard-subra-1gib-1bank.img + pblx-$(CONFIG_MACH_DFI_FS700_M60) += start_imx6dl_dfi_fs700_m60_6s CFG_start_imx6dl_dfi_fs700_m60_6s.pblx.imximg = $(board)/dfi-fs700-m60/flash-header-fs700-m60-6s.imxcfg FILE_barebox-dfi-fs700-m60-6s.img = start_imx6dl_dfi_fs700_m60_6s.pblx.imximg @@ -293,6 +298,11 @@ CFG_start_imx6q_tx6x_1g.pblx.imximg = $(board)/karo-tx6x/flash-header-tx6q-1g.im FILE_barebox-karo-imx6q-tx6x-1g.img = start_imx6q_tx6x_1g.pblx.imximg image-$(CONFIG_MACH_TX6X) += barebox-karo-imx6q-tx6x-1g.img +pblx-$(CONFIG_MACH_TX6X) += start_imx6q_tx6x_2g +CFG_start_imx6q_tx6x_2g.pblx.imximg = $(board)/karo-tx6x/flash-header-tx6qp-2g.imxcfg +FILE_barebox-karo-imx6qp-tx6x-2g.img = start_imx6q_tx6x_2g.pblx.imximg +image-$(CONFIG_MACH_TX6X) += barebox-karo-imx6qp-tx6x-2g.img + pblx-$(CONFIG_MACH_UDOO) += start_imx6_udoo CFG_start_imx6_udoo.pblx.imximg = $(board)/udoo/flash-header-mx6-udoo.imxcfg FILE_barebox-udoo-imx6q.img = start_imx6_udoo.pblx.imximg @@ -348,11 +358,21 @@ CFG_start_phytec_phycore_imx6q_som_emmc_1gib.pblx.imximg = $(board)/phytec-som-i FILE_barebox-phytec-phycore-imx6q-som-emmc-1gib.img = start_phytec_phycore_imx6q_som_emmc_1gib.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-1gib.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6q_som_emmc_2gib +CFG_start_phytec_phycore_imx6q_som_emmc_2gib.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058-2gib.imxcfg +FILE_barebox-phytec-phycore-imx6q-som-emmc-2gib.img = start_phytec_phycore_imx6q_som_emmc_2gib.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-2gib.img + pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6dl_som_nand_256mb CFG_start_phytec_phycore_imx6dl_som_nand_256mb.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058dl-256mb.imxcfg FILE_barebox-phytec-phycore-imx6dl-som-nand-256mb.img = start_phytec_phycore_imx6dl_som_nand_256mb.pblx.imximg image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6dl-som-nand-256mb.img +pblx-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += start_phytec_phycore_imx6dl_som_emmc_1gib +CFG_start_phytec_phycore_imx6dl_som_emmc_1gib.pblx.imximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058dl-1gib.imxcfg +FILE_barebox-phytec-phycore-imx6dl-som-emmc-1gib.img = start_phytec_phycore_imx6dl_som_emmc_1gib.pblx.imximg +image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6dl-som-emmc-1gib.img + pblx-$(CONFIG_MACH_GW_VENTANA) += start_imx6q_gw54xx_1gx64 CFG_start_imx6q_gw54xx_1gx64.pblx.imximg = $(board)/gateworks-ventana/flash-header-ventana-quad-1gx64.imxcfg FILE_barebox-gateworks-imx6q-ventana-1gx64.img = start_imx6q_gw54xx_1gx64.pblx.imximg diff --git a/images/Makefile.socfpga b/images/Makefile.socfpga index d52b909ff3..7e642c06c9 100644 --- a/images/Makefile.socfpga +++ b/images/Makefile.socfpga @@ -2,7 +2,7 @@ # barebox image generation Makefile for Altera socfpga # -# %.socfpga - convert into socfpga image +# %.socfpgaimg - convert into socfpga image # ---------------------------------------------------------------- quiet_cmd_socfpga_image = SOCFPGA-IMG $@ cmd_socfpga_image = scripts/socfpga_mkimage -b -o $@ $< diff --git a/include/boot.h b/include/boot.h index 0198cc8826..8fcbb7f012 100644 --- a/include/boot.h +++ b/include/boot.h @@ -21,6 +21,11 @@ struct bootm_data { enum bootm_verify verify; bool force; bool dryrun; + /* + * appendroot - if true, try to add a suitable root= Kernel option to + * mount the rootfs from the same device as the Kernel comes from. + */ + bool appendroot; unsigned long initrd_address; unsigned long os_address; unsigned long os_entry; diff --git a/include/command.h b/include/command.h index 3aca1a9f1b..2e7278099b 100644 --- a/include/command.h +++ b/include/command.h @@ -25,10 +25,7 @@ #include <linux/list.h> #include <linux/stringify.h> - -#ifndef NULL -#define NULL 0 -#endif +#include <linux/stddef.h> #ifndef __ASSEMBLY__ @@ -71,6 +68,7 @@ extern struct command __barebox_cmd_end; struct command *find_cmd(const char *cmd); int execute_command(int argc, char **argv); void barebox_cmd_usage(struct command *cmdtp); +int run_command(const char *cmd); #define COMMAND_SUCCESS 0 #define COMMAND_ERROR 1 diff --git a/include/common.h b/include/common.h index 38a6dbf933..680a0affb6 100644 --- a/include/common.h +++ b/include/common.h @@ -61,7 +61,6 @@ void __noreturn hang (void); char *size_human_readable(unsigned long long size); -int run_command(const char *cmd); int readline (const char *prompt, char *buf, int len); /* common/memsize.c */ @@ -70,12 +69,6 @@ long get_ram_size (volatile long *, long); /* $(CPU)/cpu.c */ void __noreturn poweroff(void); -/* lib_generic/crc32.c */ -uint32_t crc32(uint32_t, const void*, unsigned int); -uint32_t crc32_no_comp(uint32_t, const void*, unsigned int); -int file_crc(char *filename, ulong start, ulong size, ulong *crc, - ulong *total); - /* common/console.c */ int ctrlc (void); @@ -88,16 +81,6 @@ static inline void dump_stack(void) } #endif -#define MEMAREA_SIZE_SPECIFIED 1 - -struct memarea_info { - struct device_d *device; - unsigned long start; - unsigned long end; - unsigned long size; - unsigned long flags; -}; - int parse_area_spec(const char *str, loff_t *start, loff_t *size); /* Just like simple_strtoul(), but this one honors a K/M/G suffix */ @@ -113,17 +96,6 @@ extern int (*barebox_main)(void); void __noreturn start_barebox(void); void shutdown_barebox(void); -int run_shell(void); - -#ifdef CONFIG_SHELL_HUSH -char *shell_expand(char *str); -#else -static inline char *shell_expand(char *str) -{ - return strdup(str); -} -#endif - #define ALIGN_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1)) #define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) @@ -156,7 +128,6 @@ static inline void print_hex_dump(const char *level, const char *prefix_str, int mem_parse_options(int argc, char *argv[], char *optstr, int *mode, char **sourcefile, char **destfile, int *swab); -int open_and_lseek(const char *filename, int mode, loff_t pos); #define RW_BUF_SIZE (unsigned)4096 extern const char version_string[]; diff --git a/include/crc.h b/include/crc.h index 4290f41c57..847a0a4b64 100644 --- a/include/crc.h +++ b/include/crc.h @@ -1,100 +1,14 @@ -/* - *========================================================================== - * - * crc.h - * - * Interface for the CRC algorithms. - * - *========================================================================== - *####ECOSGPLCOPYRIGHTBEGIN#### - * ------------------------------------------- - * This file is part of eCos, the Embedded Configurable Operating System. - * Copyright (C) 2002 Andrew Lunn - * - * eCos is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free - * Software Foundation; either version 2 or (at your option) any later version. - * - * eCos 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 eCos; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - * - * As a special exception, if other files instantiate templates or use macros - * or inline functions from this file, or you compile this file and link it - * with other works to produce a work based on this file, this file does not - * by itself cause the resulting work to be covered by the GNU General Public - * License. However the source code for this file must still be made available - * in accordance with section (3) of the GNU General Public License. - * - * This exception does not invalidate any other reasons why a work based on - * this file might be covered by the GNU General Public License. - * - * Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. - * at http: *sources.redhat.com/ecos/ecos-license/ - * ------------------------------------------- - *####ECOSGPLCOPYRIGHTEND#### - *========================================================================== - *#####DESCRIPTIONBEGIN#### - * - * Author(s): Andrew Lunn - * Contributors: Andrew Lunn - * Date: 2002-08-06 - * Purpose: - * Description: - * - * This code is part of eCos (tm). - * - *####DESCRIPTIONEND#### - * - *========================================================================== - */ - -#ifndef _SERVICES_CRC_CRC_H_ -#define _SERVICES_CRC_CRC_H_ +#ifndef __INCLUDE_CRC_H +#define __INCLUDE_CRC_H #include <linux/types.h> -#ifndef __externC -# ifdef __cplusplus -# define __externC extern "C" -# else -# define __externC extern -# endif -#endif - -/* Compute a CRC, using the POSIX 1003 definition */ -extern uint32_t -cyg_posix_crc32(unsigned char *s, int len); - -/* Gary S. Brown's 32 bit CRC */ - -extern uint32_t -cyg_crc32(unsigned char *s, int len); - -/* Gary S. Brown's 32 bit CRC, but accumulate the result from a */ -/* previous CRC calculation */ - -extern uint32_t -cyg_crc32_accumulate(uint32_t crc, unsigned char *s, int len); - -/* Ethernet FCS Algorithm */ - -extern uint32_t -cyg_ether_crc32(unsigned char *s, int len); - -/* Ethernet FCS algorithm, but accumulate the result from a previous */ -/* CRC calculation. */ - -extern uint32_t -cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len); - /* 16 bit CRC with polynomial x^16+x^12+x^5+1 */ - extern uint16_t cyg_crc16(const unsigned char *s, int len); -#endif /* _SERVICES_CRC_CRC_H_ */ +uint32_t crc32(uint32_t, const void *, unsigned int); +uint32_t crc32_no_comp(uint32_t, const void *, unsigned int); +int file_crc(char *filename, unsigned long start, unsigned long size, + unsigned long *crc, unsigned long *total); + +#endif /* __INCLUDE_CRC_H */ diff --git a/include/dirent.h b/include/dirent.h new file mode 100644 index 0000000000..5ee4c2063e --- /dev/null +++ b/include/dirent.h @@ -0,0 +1,20 @@ +#ifndef __DIRENT_H +#define __DIRENT_H + +struct dirent { + char d_name[256]; +}; + +typedef struct dir { + struct device_d *dev; + struct fs_driver_d *fsdrv; + struct node_d *node; + struct dirent d; + void *priv; /* private data for the fs driver */ +} DIR; + +DIR *opendir(const char *pathname); +struct dirent *readdir(DIR *dir); +int closedir(DIR *dir); + +#endif /* __DIRENT_H */ diff --git a/include/elf.h b/include/elf.h index 6d4addf53b..a749bec34e 100644 --- a/include/elf.h +++ b/include/elf.h @@ -284,7 +284,7 @@ typedef struct elf64_phdr { #define SHN_ABS 0xfff1 #define SHN_COMMON 0xfff2 #define SHN_HIRESERVE 0xffff - + typedef struct { Elf32_Word sh_name; Elf32_Word sh_type; diff --git a/include/fb.h b/include/fb.h index cf113c4300..b2a9c7152b 100644 --- a/include/fb.h +++ b/include/fb.h @@ -73,8 +73,8 @@ struct fb_videomode { struct fb_bitfield { u32 offset; /* beginning of bitfield */ u32 length; /* length of bitfield */ - u32 msb_right; /* != 0 : Most significant bit is */ - /* right */ + u32 msb_right; /* != 0 : Most significant bit is */ + /* right */ }; struct fb_info; diff --git a/include/fcntl.h b/include/fcntl.h index 12f370a418..98020bdfb1 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -1,5 +1,5 @@ -#ifndef _ASM_GENERIC_FCNTL_H -#define _ASM_GENERIC_FCNTL_H +#ifndef __FCNTL_H +#define __FCNTL_H #include <linux/types.h> @@ -24,97 +24,7 @@ #define O_RWSIZE_4 004000000 #define O_RWSIZE_8 010000000 -#define F_DUPFD 0 /* dup */ -#define F_GETFD 1 /* get close_on_exec */ -#define F_SETFD 2 /* set/clear close_on_exec */ -#define F_GETFL 3 /* get file->f_flags */ -#define F_SETFL 4 /* set file->f_flags */ -#ifndef F_GETLK -#define F_GETLK 5 -#define F_SETLK 6 -#define F_SETLKW 7 -#endif -#ifndef F_SETOWN -#define F_SETOWN 8 /* for sockets. */ -#define F_GETOWN 9 /* for sockets. */ -#endif -#ifndef F_SETSIG -#define F_SETSIG 10 /* for sockets. */ -#define F_GETSIG 11 /* for sockets. */ -#endif +int open(const char *pathname, int flags, ...); +int creat(const char *pathname, mode_t mode); -/* for F_[GET|SET]FL */ -#define FD_CLOEXEC 1 /* actually anything with low bit set goes */ - -/* for posix fcntl() and lockf() */ -#ifndef F_RDLCK -#define F_RDLCK 0 -#define F_WRLCK 1 -#define F_UNLCK 2 -#endif - -/* for old implementation of bsd flock () */ -#ifndef F_EXLCK -#define F_EXLCK 4 /* or 3 */ -#define F_SHLCK 8 /* or 4 */ -#endif - -/* for leases */ -#ifndef F_INPROGRESS -#define F_INPROGRESS 16 -#endif - -/* operations for bsd flock(), also used by the kernel implementation */ -#define LOCK_SH 1 /* shared lock */ -#define LOCK_EX 2 /* exclusive lock */ -#define LOCK_NB 4 /* or'd with one of the above to prevent - blocking */ -#define LOCK_UN 8 /* remove lock */ - -#define LOCK_MAND 32 /* This is a mandatory flock ... */ -#define LOCK_READ 64 /* which allows concurrent read operations */ -#define LOCK_WRITE 128 /* which allows concurrent write operations */ -#define LOCK_RW 192 /* which allows concurrent read & write ops */ - -#define F_LINUX_SPECIFIC_BASE 1024 - -#ifndef HAVE_ARCH_STRUCT_FLOCK -#ifndef __ARCH_FLOCK_PAD -#define __ARCH_FLOCK_PAD -#endif - -struct flock { - short l_type; - short l_whence; - off_t l_start; - off_t l_len; - pid_t l_pid; - __ARCH_FLOCK_PAD -}; -#endif - -#ifndef CONFIG_64BIT - -#ifndef F_GETLK64 -#define F_GETLK64 12 /* using 'struct flock64' */ -#define F_SETLK64 13 -#define F_SETLKW64 14 -#endif - -#ifndef HAVE_ARCH_STRUCT_FLOCK64 -#ifndef __ARCH_FLOCK64_PAD -#define __ARCH_FLOCK64_PAD -#endif - -struct flock64 { - short l_type; - short l_whence; - loff_t l_start; - loff_t l_len; - pid_t l_pid; - __ARCH_FLOCK64_PAD -}; -#endif -#endif /* !CONFIG_64BIT */ - -#endif /* _ASM_GENERIC_FCNTL_H */ +#endif /* __FCNTL_H */ diff --git a/include/fs.h b/include/fs.h index 943ba55439..6a592893a9 100644 --- a/include/fs.h +++ b/include/fs.h @@ -1,6 +1,12 @@ #ifndef __FS_H #define __FS_H +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <dirent.h> +#include <sys/mount.h> +#include <sys/stat.h> #include <driver.h> #include <filetype.h> #include <linux/fs.h> @@ -11,18 +17,6 @@ struct partition; struct node_d; struct stat; -struct dirent { - char d_name[256]; -}; - -typedef struct dir { - struct device_d *dev; - struct fs_driver_d *fsdrv; - struct node_d *node; - struct dirent d; - void *priv; /* private data for the fs driver */ -} DIR; - typedef struct filep { struct fs_device_d *fsdev; /* The device this FILE belongs to */ char *path; @@ -107,43 +101,7 @@ struct fs_device_d { #define drv_to_fs_driver(d) container_of(d, struct fs_driver_d, drv) -/* - * standard posix file functions - */ -int open(const char *pathname, int flags, ...); -int creat(const char *pathname, mode_t mode); -int unlink(const char *pathname); -int close(int fd); int flush(int fd); -int lstat(const char *filename, struct stat *s); -int stat(const char *filename, struct stat *s); -int fstat(int fd, struct stat *s); -ssize_t read(int fd, void *buf, size_t count); -ssize_t pread(int fd, void *buf, size_t count, loff_t offset); -int ioctl(int fd, int request, void *buf); -ssize_t write(int fd, const void *buf, size_t count); -ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset); - -loff_t lseek(int fildes, loff_t offset, int whence); -int mkdir (const char *pathname, mode_t mode); - -/* Create a directory and its parents */ -int make_directory(const char *pathname); -int rmdir (const char *pathname); - -const char *getcwd(void); -int chdir(const char *pathname); - -DIR *opendir(const char *pathname); -struct dirent *readdir(DIR *dir); -int closedir(DIR *dir); - -int symlink(const char *pathname, const char *newpath); -int readlink(const char *path, char *buf, size_t bufsiz); - -int mount (const char *device, const char *fsname, const char *path, - const char *fsoptions); -int umount(const char *pathname); int umount_by_cdev(struct cdev *cdev); /* not-so-standard functions */ @@ -183,8 +141,6 @@ void automount_remove(const char *_path); int automount_add(const char *path, const char *cmd); void automount_print(void); -int unlink_recursive(const char *path, char **failedpath); - int fsdev_open_cdev(struct fs_device_d *fsdev); const char *cdev_get_mount_path(struct cdev *cdev); const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions); diff --git a/include/globalvar.h b/include/globalvar.h index e77209bd79..d0c79c07a8 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -14,6 +14,7 @@ int globalvar_add(const char *name, int (*set)(struct device_d *dev, struct param_d *p, const char *val), const char *(*get)(struct device_d *, struct param_d *p), unsigned long flags); +void globalvar_remove(const char *name); char *globalvar_get_match(const char *match, const char *separator); void globalvar_set_match(const char *match, const char *val); diff --git a/include/libfile.h b/include/libfile.h index d5b914a47a..de4f42dbd1 100644 --- a/include/libfile.h +++ b/include/libfile.h @@ -19,4 +19,11 @@ int copy_recursive(const char *src, const char *dst); int compare_file(const char *f1, const char *f2); +int open_and_lseek(const char *filename, int mode, loff_t pos); + +/* Create a directory and its parents */ +int make_directory(const char *pathname); + +int unlink_recursive(const char *path, char **failedpath); + #endif /* __LIBFILE_H */ diff --git a/include/linux/mount.h b/include/linux/mount.h index e4d185ccf8..57d5ba9523 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -1,6 +1,6 @@ /* * - * Definitions for mount interface. This describes the in the kernel build + * Definitions for mount interface. This describes the in the kernel build * linkedlist with mounted filesystems. * * Author: Marco van Wieringen <mvw@planets.elm.net> diff --git a/include/linux/phy.h b/include/linux/phy.h index 38b0670187..d7b10afbc9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -251,7 +251,7 @@ struct phy_driver { struct driver_d drv; }; -#define to_phy_driver(d) container_of(d, struct phy_driver, drv) +#define to_phy_driver(d) ((d) ? container_of(d, struct phy_driver, drv) : NULL) #define PHY_ANY_ID "MATCH ANY PHY" #define PHY_ANY_UID 0xffffffff diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index d85b0adb5c..a5ef1b9a98 100644 --- a/include/linux/rbtree.h +++ b/include/linux/rbtree.h @@ -1,7 +1,7 @@ /* Red Black Trees (C) 1999 Andrea Arcangeli <andrea@suse.de> - + * SPDX-License-Identifier: GPL-2.0+ linux/include/linux/rbtree.h @@ -61,7 +61,7 @@ extern struct rb_node *rb_first_postorder(const struct rb_root *); extern struct rb_node *rb_next_postorder(const struct rb_node *); /* Fast replacement of a single node without remove/rebalance/add/rebalance */ -extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, +extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, struct rb_root *root); static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, diff --git a/include/linux/stddef.h b/include/linux/stddef.h index e36632872d..680d0c7662 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -17,6 +17,8 @@ enum { #include <linux/types.h> #endif +typedef unsigned short wchar_t; + #undef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) diff --git a/include/mtd/utils.h b/include/mtd/utils.h index fca64abd9d..58f89df90c 100644 --- a/include/mtd/utils.h +++ b/include/mtd/utils.h @@ -41,7 +41,7 @@ #define sys_errmsg errmsg #define warnmsg(fmt, ...) do { \ - fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ + eprintf("%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ } while(0) #endif /* INCLUDE_MTD_UTILS_H */ diff --git a/include/net/davinci_emac.h b/include/platform_data/eth-davinci-emac.h index caead1fecf..caead1fecf 100644 --- a/include/net/davinci_emac.h +++ b/include/platform_data/eth-davinci-emac.h diff --git a/include/net/designware.h b/include/platform_data/eth-designware.h index 7a7a26abfd..7a7a26abfd 100644 --- a/include/net/designware.h +++ b/include/platform_data/eth-designware.h diff --git a/include/dm9000.h b/include/platform_data/eth-dm9000.h index a9a4635d2a..a9a4635d2a 100644 --- a/include/dm9000.h +++ b/include/platform_data/eth-dm9000.h diff --git a/include/net/ep93xx_eth.h b/include/platform_data/eth-ep93xx.h index 0fb11d0acd..0fb11d0acd 100644 --- a/include/net/ep93xx_eth.h +++ b/include/platform_data/eth-ep93xx.h diff --git a/include/fec.h b/include/platform_data/eth-fec.h index 699761a998..699761a998 100644 --- a/include/fec.h +++ b/include/platform_data/eth-fec.h diff --git a/include/net/smc91111.h b/include/platform_data/eth-smc91111.h index 72193bf972..72193bf972 100644 --- a/include/net/smc91111.h +++ b/include/platform_data/eth-smc91111.h diff --git a/include/smc911x.h b/include/platform_data/eth-smc911x.h index 4a802ee52c..4a802ee52c 100644 --- a/include/smc911x.h +++ b/include/platform_data/eth-smc911x.h diff --git a/include/platform_ide.h b/include/platform_data/ide.h index f71fbfbc01..f71fbfbc01 100644 --- a/include/platform_ide.h +++ b/include/platform_data/ide.h diff --git a/include/ns16550.h b/include/platform_data/serial-ns16550.h index ccf950b077..ccf950b077 100644 --- a/include/ns16550.h +++ b/include/platform_data/serial-ns16550.h diff --git a/include/shell.h b/include/shell.h index b98cac3dc5..65dad0e1d1 100644 --- a/include/shell.h +++ b/include/shell.h @@ -9,4 +9,15 @@ int shell_get_last_return_code(void); +int run_shell(void); + +#ifdef CONFIG_SHELL_HUSH +char *shell_expand(char *str); +#else +static inline char *shell_expand(char *str) +{ + return strdup(str); +} +#endif + #endif /* __SHELL_H__ */ diff --git a/include/stdio.h b/include/stdio.h index d0817bd071..7b2a42b817 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -9,28 +9,30 @@ */ /* serial stuff */ -void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); - -int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); -int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); -int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); -int vsprintf(char *buf, const char *fmt, va_list args); -char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); -char *vasprintf(const char *fmt, va_list ap); -int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); -int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); +void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); + +int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); +int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); +int scnprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); +int vsprintf(char *buf, const char *fmt, va_list args); +char *basprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); +int asprintf(char **strp, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); +char *bvasprintf(const char *fmt, va_list ap); +int vasprintf(char **strp, const char *fmt, va_list ap); +int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); +int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); #ifndef CONFIG_CONSOLE_NONE /* stdin */ -int tstc(void); +int tstc(void); /* stdout */ -void console_putc(unsigned int ch, const char c); -int getc(void); -int console_puts(unsigned int ch, const char *s); -void console_flush(void); +void console_putc(unsigned int ch, const char c); +int getchar(void); +int console_puts(unsigned int ch, const char *s); +void console_flush(void); -int vprintf(const char *fmt, va_list args); +int vprintf(const char *fmt, va_list args); #else static inline int tstc(void) { @@ -42,7 +44,7 @@ static inline int console_puts(unsigned int ch, const char *str) return 0; } -static inline int getc(void) +static inline int getchar(void) { return -EINVAL; } @@ -87,23 +89,20 @@ static inline void putchar(char c) console_putc(CONSOLE_STDOUT, c); } -/* stderr */ -#define eputc(c) console_putc(CONSOLE_STDERR, c) -#define eputs(s) console_puts(CONSOLE_STDERR, s) -#define eprintf(fmt,args...) fprintf(stderr,fmt ,##args) - /* * FILE based functions */ -#define stdin 0 -#define stdout 1 -#define stderr 2 +/* stderr */ +#define eprintf(fmt,args...) dprintf(STDERR_FILENO, fmt ,##args) + +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 #define MAX_FILES 128 -int fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); -int fputs(int file, const char *s); -int fputc(int file, const char c); -int fgetc(int file); +int dprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); +int dputs(int file, const char *s); +int dputc(int file, const char c); #endif /* __STDIO_H */ diff --git a/include/string.h b/include/string.h index a833da131b..0c557d6f15 100644 --- a/include/string.h +++ b/include/string.h @@ -4,5 +4,6 @@ #include <linux/string.h> void *memdup(const void *, size_t); +int strtobool(const char *str, int *val); #endif /* __STRING_H */ diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h new file mode 100644 index 0000000000..6d6d3f5c00 --- /dev/null +++ b/include/sys/ioctl.h @@ -0,0 +1,6 @@ +#ifndef __SYS_IOCTL_H +#define __SYS_IOCTL_H + +int ioctl(int fd, int request, void *buf); + +#endif /* __SYS_IOCTL_H */ diff --git a/include/sys/mount.h b/include/sys/mount.h new file mode 100644 index 0000000000..978f3406e8 --- /dev/null +++ b/include/sys/mount.h @@ -0,0 +1,8 @@ +#ifndef __SYS_MOUNT_H +#define __SYS_MOUNT_H + +int mount(const char *device, const char *fsname, const char *path, + const char *fsoptions); +int umount(const char *pathname); + +#endif /* __SYS_MOUNT_H */ diff --git a/include/sys/stat.h b/include/sys/stat.h new file mode 100644 index 0000000000..037e5f136d --- /dev/null +++ b/include/sys/stat.h @@ -0,0 +1,9 @@ +#ifndef __STAT_H +#define __STAT_H + +#include <linux/types.h> +#include <linux/stat.h> + +int mkdir (const char *pathname, mode_t mode); + +#endif /* __STAT_H */ diff --git a/include/unistd.h b/include/unistd.h new file mode 100644 index 0000000000..31f430a5b6 --- /dev/null +++ b/include/unistd.h @@ -0,0 +1,24 @@ +#ifndef __UNISTD_H +#define __UNISTD_H + +#include <linux/types.h> + +struct stat; + +int unlink(const char *pathname); +int close(int fd); +int lstat(const char *filename, struct stat *s); +int stat(const char *filename, struct stat *s); +int fstat(int fd, struct stat *s); +ssize_t read(int fd, void *buf, size_t count); +ssize_t pread(int fd, void *buf, size_t count, loff_t offset); +ssize_t write(int fd, const void *buf, size_t count); +ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset); +loff_t lseek(int fildes, loff_t offset, int whence); +int rmdir (const char *pathname); +int symlink(const char *pathname, const char *newpath); +int readlink(const char *path, char *buf, size_t bufsiz); +int chdir(const char *pathname); +const char *getcwd(void); + +#endif /* __UNISTD_H */ diff --git a/include/w1_mac_address.h b/include/w1_mac_address.h index 89dd914095..cd4be765f7 100644 --- a/include/w1_mac_address.h +++ b/include/w1_mac_address.h @@ -33,7 +33,7 @@ static inline int w1_local_mac_address_register(int ethid, char * oui, char *w1_ addr[i] = oui[i]; } - tmp = asprintf("%s.id", w1_dev); + tmp = basprintf("%s.id", w1_dev); if (!tmp) return -ENOMEM; diff --git a/include/wchar.h b/include/wchar.h index 702d8e239a..adb4f373e9 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -2,8 +2,7 @@ #define __WCHAR_H #include <linux/types.h> - -typedef u16 wchar_t; +#include <linux/stddef.h> wchar_t *strdup_wchar(const wchar_t *src); diff --git a/lib/bzlib_private.h b/lib/bzlib_private.h index 87d8f94525..de10dd4215 100644 --- a/lib/bzlib_private.h +++ b/lib/bzlib_private.h @@ -67,6 +67,7 @@ #define _BZLIB_PRIVATE_H #include <malloc.h> +#include <linux/stddef.h> #include "bzlib.h" @@ -515,16 +516,6 @@ BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, #endif - -/*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ - -#ifdef BZ_NO_STDIO -#ifndef NULL -#define NULL 0 -#endif -#endif - - /*-------------------------------------------------------------*/ /*--- end bzlib_private.h ---*/ /*-------------------------------------------------------------*/ diff --git a/lib/glob.c b/lib/glob.c index 1b0137b9a9..5a997ca092 100644 --- a/lib/glob.c +++ b/lib/glob.c @@ -428,7 +428,7 @@ glob_t *pglob; elems = pglob->gl_pathc + 2; if (flags & GLOB_DOOFFS) elems += pglob->gl_offs; - + pglob->gl_pathv = xrealloc(pglob->gl_pathv, elems * sizeof(char *)); if (flags & GLOB_DOOFFS) diff --git a/lib/libfile.c b/lib/libfile.c index a27460c10d..62e9b8ed22 100644 --- a/lib/libfile.c +++ b/lib/libfile.c @@ -91,7 +91,7 @@ char *read_file_line(const char *fmt, ...) struct stat s; va_start(args, fmt); - filename = vasprintf(fmt, args); + filename = bvasprintf(fmt, args); va_end(args); ret = stat(filename, &s); @@ -359,8 +359,8 @@ int copy_recursive(const char *src, const char *dst) if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; - from = asprintf("%s/%s", src, d->d_name); - to = asprintf("%s/%s", dst, d->d_name); + from = basprintf("%s/%s", src, d->d_name); + to = basprintf("%s/%s", dst, d->d_name); ret = copy_recursive(from, to); if (ret) break; @@ -442,3 +442,35 @@ err_out1: close(fd1); return ret; } + +/** + * open_and_lseek - open file and lseek to position + * @filename: The file to open + * @mode: The file open mode + * @pos: The position to lseek to + * + * Return: If successful this function returns a positive filedescriptor + * number, otherwise a negative error code is returned + */ +int open_and_lseek(const char *filename, int mode, loff_t pos) +{ + int fd, ret; + + fd = open(filename, mode | O_RDONLY); + if (fd < 0) { + perror("open"); + return fd; + } + + if (!pos) + return fd; + + ret = lseek(fd, pos, SEEK_SET); + if (ret == -1) { + perror("lseek"); + close(fd); + return -errno; + } + + return fd; +} diff --git a/lib/logo/logo.c b/lib/logo/logo.c index 614d8c0908..9edf212232 100644 --- a/lib/logo/logo.c +++ b/lib/logo/logo.c @@ -36,7 +36,7 @@ static void load_logo(int width, void *start, void *end) char *filename; size_t size = end - start; - filename = asprintf("/logo/barebox-logo-%d.png", width); + filename = basprintf("/logo/barebox-logo-%d.png", width); write_file(filename, start, size); free(filename); } diff --git a/lib/make_directory.c b/lib/make_directory.c index 7432efc192..29d08cf536 100644 --- a/lib/make_directory.c +++ b/lib/make_directory.c @@ -3,6 +3,7 @@ #include <errno.h> #ifdef __BAREBOX__ #include <fs.h> +#include <libfile.h> #include <malloc.h> #include <common.h> #define STATIC diff --git a/lib/parameter.c b/lib/parameter.c index fd05b49adf..3d356fb972 100644 --- a/lib/parameter.c +++ b/lib/parameter.c @@ -27,6 +27,7 @@ #include <net.h> #include <malloc.h> #include <driver.h> +#include <string.h> #include <linux/err.h> struct param_d *get_param_by_name(struct device_d *dev, const char *name) @@ -314,10 +315,13 @@ static int param_int_set(struct device_d *dev, struct param_d *p, const char *va if (!val) return -EINVAL; - *pi->value = simple_strtol(val, NULL, 0); - - if (pi->flags & PARAM_INT_FLAG_BOOL) - *pi->value = !!*pi->value; + if (pi->flags & PARAM_INT_FLAG_BOOL) { + ret = strtobool(val, pi->value); + if (ret) + return ret; + } else { + *pi->value = simple_strtol(val, NULL, 0); + } if (!pi->set) return 0; @@ -341,7 +345,7 @@ static const char *param_int_get(struct device_d *dev, struct param_d *p) } free(p->value); - p->value = asprintf(pi->format, *pi->value); + p->value = basprintf(pi->format, *pi->value); return p->value; } @@ -443,7 +447,7 @@ static const char *param_enum_get(struct device_d *dev, struct param_d *p) free(p->value); if (*pe->value >= pe->num_names) - p->value = asprintf("invalid:%d", *pe->value); + p->value = basprintf("invalid:%d", *pe->value); else p->value = strdup(pe->names[*pe->value]); @@ -556,7 +560,7 @@ struct param_d *dev_add_param_int_ro(struct device_d *dev, const char *name, return ERR_PTR(ret); } - piro->param.value = asprintf(format, value); + piro->param.value = basprintf(format, value); return &piro->param; } @@ -582,7 +586,7 @@ struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name, return ERR_PTR(ret); } - piro->param.value = asprintf(format, value); + piro->param.value = basprintf(format, value); return &piro->param; } diff --git a/lib/rbtree.c b/lib/rbtree.c index 7297792677..6fba2c5bd7 100644 --- a/lib/rbtree.c +++ b/lib/rbtree.c @@ -444,7 +444,7 @@ struct rb_node *rb_next(const struct rb_node *node) * as we can. */ if (node->rb_right) { - node = node->rb_right; + node = node->rb_right; while (node->rb_left) node=node->rb_left; return (struct rb_node *)node; @@ -476,7 +476,7 @@ struct rb_node *rb_prev(const struct rb_node *node) * as we can. */ if (node->rb_left) { - node = node->rb_left; + node = node->rb_left; while (node->rb_right) node=node->rb_right; return (struct rb_node *)node; diff --git a/lib/readkey.c b/lib/readkey.c index 2073a732f4..2870a5a9fe 100644 --- a/lib/readkey.c +++ b/lib/readkey.c @@ -53,15 +53,15 @@ int read_key(void) { char c; char esc[5]; - c = getc(); + c = getchar(); if (c == 27) { int i = 0; - esc[i++] = getc(); - esc[i++] = getc(); + esc[i++] = getchar(); + esc[i++] = getchar(); if (isdigit(esc[1])) { while(1) { - esc[i] = getc(); + esc[i] = getchar(); if (esc[i++] == '~') break; if (i == ARRAY_SIZE(esc)) diff --git a/lib/readline_simple.c b/lib/readline_simple.c index 1a40d113e3..c2960665fb 100644 --- a/lib/readline_simple.c +++ b/lib/readline_simple.c @@ -70,7 +70,7 @@ int readline (const char *prompt, char *line, int len) show_activity(0); } #endif - c = getc(); + c = getchar(); /* * Special character handling diff --git a/lib/show_progress.c b/lib/show_progress.c index f9aa1a945e..a32a13c16d 100644 --- a/lib/show_progress.c +++ b/lib/show_progress.c @@ -21,7 +21,6 @@ #include <fs.h> #include <progress.h> #include <asm-generic/div64.h> -#include <linux/stringify.h> #define HASHES_PER_LINE 65 @@ -58,7 +57,7 @@ void init_progression_bar(int max) progress_max = max; spin = 0; if (progress_max && progress_max != FILESIZE_MAX) - printf("\t[%"__stringify(HASHES_PER_LINE)"s]\r\t[", ""); + printf("\t[%*s]\r\t[", HASHES_PER_LINE, ""); else printf("\t"); } diff --git a/lib/string.c b/lib/string.c index 6a39eb5ced..a3e9fd819b 100644 --- a/lib/string.c +++ b/lib/string.c @@ -739,3 +739,46 @@ void *memdup(const void *orig, size_t size) return buf; } EXPORT_SYMBOL(memdup); + +/** + * strtobool - convert a string to a boolean value + * @str - The string + * @val - The boolean value returned. + * + * This function treats + * - any positive (nonzero) number as true + * - "0" as false + * - "true" (case insensitive) as true + * - "false" (case insensitive) as false + * + * Every other value results in an error and the @val is not + * modified. The caller is expected to initialize @val with the + * correct default before calling strtobool. + * + * Returns 0 for success or negative error code if the variable does + * not exist or contains something this function does not recognize + * as true or false. + */ +int strtobool(const char *str, int *val) +{ + if (!str || !*str) + return -EINVAL; + + if (simple_strtoul(str, NULL, 0) > 0) { + *val = true; + return 0; + } + + if (!strcmp(str, "0") || !strcasecmp(str, "false")) { + *val = false; + return 0; + } + + if (!strcasecmp(str, "true")) { + *val = true; + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL(strtobool); diff --git a/lib/stringlist.c b/lib/stringlist.c index 8a18366a96..8e92c1b207 100644 --- a/lib/stringlist.c +++ b/lib/stringlist.c @@ -34,7 +34,7 @@ int string_list_add_asprintf(struct string_list *sl, const char *fmt, ...) va_start(args, fmt); - new->str = vasprintf(fmt, args); + new->str = bvasprintf(fmt, args); va_end(args); diff --git a/lib/uncompress.c b/lib/uncompress.c index 329c9fc366..3e4bc5f9e5 100644 --- a/lib/uncompress.c +++ b/lib/uncompress.c @@ -125,7 +125,8 @@ int uncompress(unsigned char *inbuf, int len, break; #endif default: - err = asprintf("cannot handle filetype %s", file_type_to_string(ft)); + err = basprintf("cannot handle filetype %s", + file_type_to_string(ft)); error_fn(err); free(err); ret = -ENOSYS; diff --git a/lib/unlink-recursive.c b/lib/unlink-recursive.c index 78dc01593d..434fdc791b 100644 --- a/lib/unlink-recursive.c +++ b/lib/unlink-recursive.c @@ -1,4 +1,5 @@ #include <common.h> +#include <libfile.h> #include <errno.h> #include <libbb.h> #include <fs.h> diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 00b8863957..1122a4ad38 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -646,12 +646,11 @@ int scnprintf(char *buf, size_t size, const char *fmt, ...) } EXPORT_SYMBOL(scnprintf); -/* Simplified asprintf. */ -char *vasprintf(const char *fmt, va_list ap) +int vasprintf(char **strp, const char *fmt, va_list ap) { unsigned int len; - char *p; va_list aq; + char *p; va_copy(aq, ap); len = vsnprintf(NULL, 0, fmt, aq); @@ -659,23 +658,56 @@ char *vasprintf(const char *fmt, va_list ap) p = malloc(len + 1); if (!p) - return NULL; + return -1; vsnprintf(p, len + 1, fmt, ap); - return p; + *strp = p; + + return len; } EXPORT_SYMBOL(vasprintf); -char *asprintf(const char *fmt, ...) +char *bvasprintf(const char *fmt, va_list ap) +{ + char *p; + int len; + + len = vasprintf(&p, fmt, ap); + if (len < 0) + return NULL; + + return p; +} +EXPORT_SYMBOL(bvasprintf); + +int asprintf(char **strp, const char *fmt, ...) { va_list ap; char *p; + int len; va_start(ap, fmt); - p = vasprintf(fmt, ap); + len = vasprintf(&p, fmt, ap); va_end(ap); - return p; + return len; } EXPORT_SYMBOL(asprintf); + +char *basprintf(const char *fmt, ...) +{ + va_list ap; + char *p; + int len; + + va_start(ap, fmt); + len = vasprintf(&p, fmt, ap); + va_end(ap); + + if (len < 0) + return NULL; + + return p; +} +EXPORT_SYMBOL(basprintf); diff --git a/lib/xfuncs.c b/lib/xfuncs.c index 152081c662..aaf0788544 100644 --- a/lib/xfuncs.c +++ b/lib/xfuncs.c @@ -109,7 +109,7 @@ char *xvasprintf(const char *fmt, va_list ap) { char *p; - p = vasprintf(fmt, ap); + p = bvasprintf(fmt, ap); if (!p) panic("ERROR: out of memory\n"); return p; diff --git a/net/dhcp.c b/net/dhcp.c index 4433b442db..792ece491b 100644 --- a/net/dhcp.c +++ b/net/dhcp.c @@ -83,7 +83,7 @@ static char dhcp_tftpname[256]; static const char* dhcp_get_barebox_global(const char * var) { - char * var_global = asprintf("global.dhcp.%s", var); + char * var_global = basprintf("global.dhcp.%s", var); const char *val; if (!var_global) @@ -96,7 +96,7 @@ static const char* dhcp_get_barebox_global(const char * var) static int dhcp_set_barebox_global(const char * var, char *val) { - char * var_global = asprintf("global.dhcp.%s", var); + char * var_global = basprintf("global.dhcp.%s", var); int ret; if (!var_global) @@ -717,7 +717,7 @@ out: #ifdef CONFIG_GLOBALVAR static void dhcp_global_add(const char *var) { - char *var_global = asprintf("dhcp.%s", var); + char *var_global = basprintf("dhcp.%s", var); if (!var_global) return; @@ -80,9 +80,9 @@ static int dns_send(const char *name) domain = getenv("net.domainname"); if (!strchr(name, '.') && domain && *domain) - fullname = asprintf(".%s.%s.", name, domain); + fullname = basprintf(".%s.%s.", name, domain); else - fullname = asprintf(".%s.", name); + fullname = basprintf(".%s.", name); /* replace dots in fullname with chunk len */ dotptr = fullname; diff --git a/net/ifup.c b/net/ifup.c index adab683e96..f22afc9a53 100644 --- a/net/ifup.c +++ b/net/ifup.c @@ -67,8 +67,8 @@ int ifup(const char *name, unsigned flags) for (i = 0; i < ARRAY_SIZE(vars); i++) setenv(vars[i], ""); - cmd = asprintf("source /env/network/%s", name); - cmd_discover = asprintf("/env/network/%s-discover", name); + cmd = basprintf("source /env/network/%s", name); + cmd_discover = basprintf("/env/network/%s-discover", name); ret = run_command(cmd); if (ret) { diff --git a/scripts/bareboximd.c b/scripts/bareboximd.c index d4da681eca..7d4cbeb9a8 100644 --- a/scripts/bareboximd.c +++ b/scripts/bareboximd.c @@ -37,6 +37,8 @@ #include "../include/image-metadata.h" +#define eprintf(args...) fprintf(stderr, ## args) + static void debug(const char *fmt, ...) { va_list ap; diff --git a/scripts/imx/README b/scripts/imx/README index 0d6d0d03a8..474b387cfc 100644 --- a/scripts/imx/README +++ b/scripts/imx/README @@ -30,6 +30,8 @@ check <width> <cond> <addr> <mask> Poll until condition becomes true. while_all_bits_set, while_any_bit_clear, while_any_bit_set +set_bits <width> <addr> <bits> set <bits> in register <addr> +clear_bits <width> <addr> <bits> clear <bits> in register <addr> the i.MX SoCs support a wide range of fancy things doing with the flash header. We limit ourselves to a very simple case, that is the flash header has a fixed diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c index 16f086af31..0d315a2668 100644 --- a/scripts/imx/imx-image.c +++ b/scripts/imx/imx-image.c @@ -252,8 +252,13 @@ static int add_header_v1(struct config_data *data, void *buf) return 0; } -static int write_mem_v1(uint32_t addr, uint32_t val, int width) +static int write_mem_v1(uint32_t addr, uint32_t val, int width, int set_bits, int clear_bits) { + if (set_bits || clear_bits) { + fprintf(stderr, "This SoC does not support setting/clearing bits\n"); + return -EINVAL; + } + if (curdcd > MAX_DCD - 3) { fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD); return -ENOMEM; @@ -362,12 +367,20 @@ static void check_last_dcd(uint32_t cmd) } } -static int write_mem_v2(uint32_t addr, uint32_t val, int width) +static int write_mem_v2(uint32_t addr, uint32_t val, int width, int set_bits, int clear_bits) { uint32_t cmd; cmd = (TAG_WRITE << 24) | width; + if (set_bits && clear_bits) + return -EINVAL; + + if (set_bits) + cmd |= 3 << 3; + if (clear_bits) + cmd |= 2 << 3; + if (curdcd > MAX_DCD - 3) { fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD); return -ENOMEM; @@ -449,13 +462,14 @@ static int check(struct config_data *data, uint32_t cmd, uint32_t addr, uint32_t return 0; } -static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width) +static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits) { switch (data->header_version) { case 1: - return write_mem_v1(addr, val, width); + return write_mem_v1(addr, val, width, set_bits, clear_bits); case 2: - return write_mem_v2(addr, val, width); + return write_mem_v2(addr, val, width, set_bits, clear_bits); default: return -EINVAL; } diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c index ed27831386..cf9d610823 100644 --- a/scripts/imx/imx-usb-loader.c +++ b/scripts/imx/imx-usb-loader.c @@ -412,7 +412,7 @@ int do_status(void) #define V(a) (((a) >> 24) & 0xff), (((a) >> 16) & 0xff), (((a) >> 8) & 0xff), ((a) & 0xff) -static int read_memory(unsigned addr, unsigned char *dest, unsigned cnt) +static int read_memory(unsigned addr, void *dest, unsigned cnt) { static unsigned char read_reg_command[] = { 1, @@ -506,6 +506,9 @@ static int write_memory(unsigned addr, unsigned val, int width) write_reg_command[4] = (unsigned char)(addr >> 8); write_reg_command[5] = (unsigned char)(addr); + if (verbose > 1) + printf("write memory reg: 0x%08x val: 0x%08x width: %d\n", addr, val, width); + switch (width) { case 1: ds = 0x8; @@ -556,6 +559,31 @@ static int write_memory(unsigned addr, unsigned val, int width) return err; } +static int modify_memory(unsigned addr, unsigned val, int width, int set_bits, int clear_bits) +{ + int err; + + if (set_bits || clear_bits) { + uint32_t r; + + err = read_memory(addr, &r, 4); + if (err < 0) + return err; + + if (verbose > 1) + printf("reg 0x%08x val: 0x%08x %s0x%08x\n", addr, r, + set_bits ? "|= " : "&= ~", val); + + if (set_bits) + r |= val; + if (clear_bits) + r &= ~val; + val = r; + } + + return write_memory(addr, val, 4); +} + static int load_file(void *buf, unsigned len, unsigned dladdr, unsigned char type) { static unsigned char dl_command[] = { @@ -682,15 +710,24 @@ static int write_dcd_table_ivt(struct imx_flash_header_v2 *hdr, unsigned char *f while (dcd < dcd_end) { unsigned s_length = (dcd[1] << 8) + dcd[2]; unsigned char *s_end = dcd + s_length; + int set_bits = 0, clear_bits = 0; - printf("sub dcd length %x\n", s_length); + printf("command: 0x%02x sub dcd length: 0x%04x, flags: 0x%02x\n", dcd[0], s_length, dcd[3]); - if ((dcd[0] != 0xcc) || (dcd[3] != 0x04)) { + if ((dcd[0] != 0xcc)) { printf("Skipping unknown sub tag 0x%02x with len %04x\n", dcd[0], s_length); usleep(50000); dcd += s_length; continue; } + + if (dcd[3] & PARAMETER_FLAG_MASK) { + if (dcd[3] & PARAMETER_FLAG_SET) + set_bits = 1; + else + clear_bits = 1; + } + dcd += 4; if (s_end > dcd_end) { @@ -703,9 +740,8 @@ static int write_dcd_table_ivt(struct imx_flash_header_v2 *hdr, unsigned char *f unsigned val = (dcd[4] << 24) | (dcd[5] << 16) | (dcd[6] << 8) | dcd[7]; dcd += 8; - err = write_memory(addr, val, 4); - if (err < 0) - return err; + + modify_memory(addr, val, 4, set_bits, clear_bits); } } return err; @@ -1203,11 +1239,10 @@ cleanup: return ret; } -static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width) +static int write_mem(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits) { - printf("wr 0x%08x 0x%08x\n", addr, val); - - return write_memory(addr, val, width); + return modify_memory(addr, val, width, set_bits, clear_bits); } static int parse_initfile(const char *filename) diff --git a/scripts/imx/imx.c b/scripts/imx/imx.c index ca653895df..70936babfd 100644 --- a/scripts/imx/imx.c +++ b/scripts/imx/imx.c @@ -130,7 +130,8 @@ static int do_cmd_check(struct config_data *data, int argc, char *argv[]) return data->check(data, cmd, addr, mask); } -static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) +static int write_mem(struct config_data *data, int argc, char *argv[], + int set_bits, int clear_bits) { uint32_t addr, val, width; char *end; @@ -170,7 +171,22 @@ static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) return -EINVAL; }; - return data->write_mem(data, addr, val, width); + return data->write_mem(data, addr, val, width, set_bits, clear_bits); +} + +static int do_cmd_write_mem(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 0, 0); +} + +static int do_cmd_set_bits(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 1, 0); +} + +static int do_cmd_clear_bits(struct config_data *data, int argc, char *argv[]) +{ + return write_mem(data, argc, argv, 0, 1); } static int do_loadaddr(struct config_data *data, int argc, char *argv[]) @@ -338,6 +354,12 @@ struct command cmds[] = { .name = "wm", .parse = do_cmd_write_mem, }, { + .name = "set_bits", + .parse = do_cmd_set_bits, + }, { + .name = "clear_bits", + .parse = do_cmd_clear_bits, + }, { .name = "check", .parse = do_cmd_check, }, { diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h index 85071b4ed3..a1369586a9 100644 --- a/scripts/imx/imx.h +++ b/scripts/imx/imx.h @@ -31,6 +31,8 @@ struct imx_boot_data { #define TAG_DCD_HEADER 0xd2 #define DCD_VERSION 0x40 #define TAG_WRITE 0xcc +#define PARAMETER_FLAG_MASK (1 << 3) +#define PARAMETER_FLAG_SET (1 << 4) #define TAG_CHECK 0xcf struct imx_ivt_header { @@ -64,7 +66,8 @@ struct config_data { int header_version; int cpu_type; int (*check)(struct config_data *data, uint32_t cmd, uint32_t addr, uint32_t mask); - int (*write_mem)(struct config_data *data, uint32_t addr, uint32_t val, int width); + int (*write_mem)(struct config_data *data, uint32_t addr, uint32_t val, int width, + int set_bits, int clear_bits); int csf_space; char *csf; }; diff --git a/scripts/include/tools/endian.h b/scripts/include/tools/endian.h index 8001194008..1988f7c046 100644 --- a/scripts/include/tools/endian.h +++ b/scripts/include/tools/endian.h @@ -27,6 +27,28 @@ #define le64toh(x) (x) #endif +#ifndef htobe16 +#define htobe16(x) __bswap_16(x) +#endif +#ifndef htobe32 +#define htobe32(x) __bswap_32(x) +#endif +#ifndef htobe64 +#define htobe64(x) __bswap_64(x) +#endif + +#ifndef be16toh +#define be16toh(x) __bswap_16(x) +#endif + +#ifndef be32toh +#define be32toh(x) __bswap_32(x) +#endif + +#ifndef be64toh +#define be64toh(x) __bswap_64(x) +#endif + #else /* __BYTE_ORDER */ #ifndef htole16 @@ -51,6 +73,28 @@ #define le64toh(x) __bswap_64(x) #endif +#ifndef htobe16 +#define htobe16(x) (x) +#endif +#ifndef htobe32 +#define htobe32(x) (x) +#endif +#ifndef htobe64 +#define htobe64(x) (x) +#endif + +#ifndef be16toh +#define be16toh(x) (x) +#endif + +#ifndef be32toh +#define be32toh(x) (x) +#endif + +#ifndef be64toh +#define be64toh(x) (x) +#endif + #endif #endif /* _TOOLS_ENDIAN_H */ |