9
0
Fork 0

Merge branch 'for-next/misc'

This commit is contained in:
Sascha Hauer 2015-09-01 09:43:54 +02:00
commit 69dccb494a
18 changed files with 87 additions and 73 deletions

View File

@ -28,6 +28,7 @@
#include <net/smc91111.h>
#include <platform_data/mtd-nand-mrvl.h>
#include <pwm.h>
#include <linux/sizes.h>
#include <mach/devices.h>
#include <mach/mfp-pxa3xx.h>
@ -66,6 +67,8 @@ static int zylonite_devices_init(void)
&smsc91x_pdata);
add_generic_device("mrvl_nand", DEVICE_ID_DYNAMIC, NULL,
0x43100000, 0x1000, IORESOURCE_MEM, &nand_pdata);
devfs_add_partition("nand0", SZ_1M, SZ_256K, DEVFS_PARTITION_FIXED,
"env0");
return 0;
}
device_initcall(zylonite_devices_init);

View File

@ -1,25 +0,0 @@
#!/bin/sh
PATH=/env/bin
export PATH
. /env/config
addpart /dev/nand0 $mtdparts
usbserial -s "Zylonite usb gadget"
# Phase1: check for MTD override
mtd_env_override
if [ $? = 0 ]; then
echo "Switching to custom environment"
/env/init
exit
fi
# Phase2: initiate network
dhcp -H zylonite
# Phase3: activate netconsole, broadcast everywhere
netconsole.ip=255.255.255.255
netconsole.active=ioe
netconsole.port=6666

View File

@ -1,4 +0,0 @@
#!/bin/sh
loadenv /dev/nand0.barebox-env
exit $?

View File

@ -0,0 +1,5 @@
#!/bin/sh
global.bootm.image="/dev/nand0.kernel"
#global.bootm.oftree="/env/oftree"
global.linux.bootargs.dyn.root="root=ubi0:linux_root ubi.mtd=nand.root rootfstype=ubifs"

View File

@ -1,6 +0,0 @@
#!/bin/sh
autoboot_timeout=3
mtdparts="128k@0(TIMH)ro,128k@128k(OBMI)ro,768k@256k(barebox),256k@1024k(barebox-env),12M@1280k(kernel),38016k@13568k(root)"
bootargs="$bootargs mtdparts=pxa3xx_nand-0:$mtdparts ubi.mtd=5 rootfstype=ubifs root=ubi0:root ro ram=64M console=ttyS0,115200"

View File

@ -0,0 +1,11 @@
#!/bin/sh
if [ "$1" = menu ]; then
init-menu-add-entry "$0" "NAND partitions"
exit
fi
mtdparts="128k@0(TIMH)ro,128k@128k(OBMI)ro,768k@256k(barebox),256k@1024k(barebox-env),12M@1280k(kernel),38016k@13568k(root)"
kernelname="pxa3xx_nand-0"
mtdparts-add -d nand0 -k ${kernelname} -p ${mtdparts}

View File

@ -0,0 +1 @@
zylonite

View File

@ -0,0 +1 @@
ram=64M

View File

@ -0,0 +1 @@
console=ttyS0,115200

View File

@ -8,17 +8,17 @@ CONFIG_ARM_UNWIND=y
# CONFIG_BANNER is not set
CONFIG_MMU=y
CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0x80000
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_MALLOC_SIZE=0x800000
CONFIG_EXPERIMENTAL=y
CONFIG_MODULES=y
CONFIG_KALLSYMS=y
CONFIG_PROMPT="zylonite-barebox:"
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
CONFIG_CONSOLE_ACTIVATE_ALL=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/zylonite/env"
CONFIG_RESET_SOURCE=y
CONFIG_DEFAULT_LOGLEVEL=8
@ -27,8 +27,6 @@ CONFIG_CMD_DMESG=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MEMINFO=y
CONFIG_FLEXIBLE_BOOTARGS=y
CONFIG_CMD_BOOT=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_BOOTM_VERBOSE=y
CONFIG_CMD_BOOTM_INITRD=y
@ -40,26 +38,20 @@ CONFIG_CMD_LOADY=y
CONFIG_CMD_RESET=y
CONFIG_CMD_SAVES=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_AUTOMOUNT=y
CONFIG_CMD_UBIFORMAT=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_GLOBAL=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_BASENAME=y
CONFIG_CMD_CMP=y
CONFIG_CMD_DIRNAME=y
CONFIG_CMD_FILETYPE=y
CONFIG_CMD_LN=y
CONFIG_CMD_READLINK=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_CMD_LET=y
CONFIG_CMD_MSLEEP=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_HOST=y
CONFIG_NET_CMD_IFUP=y
CONFIG_CMD_MIITOOL=y
CONFIG_CMD_PING=y
CONFIG_CMD_TFTP=y

View File

@ -14,6 +14,7 @@
#include <environment.h>
#include <globalvar.h>
#include <magicvar.h>
#include <watchdog.h>
#include <command.h>
#include <readkey.h>
#include <common.h>
@ -24,6 +25,7 @@
#include <clock.h>
#include <boot.h>
#include <glob.h>
#include <init.h>
#include <menu.h>
#include <fs.h>
#include <complete.h>
@ -71,10 +73,28 @@ out:
return ret;
}
static unsigned int boot_watchdog_timeout;
static int init_boot_watchdog_timeout(void)
{
return globalvar_add_simple_int("boot.watchdog_timeout",
&boot_watchdog_timeout, "%u");
}
late_initcall(init_boot_watchdog_timeout);
BAREBOX_MAGICVAR_NAMED(global_watchdog_timeout, global.boot.watchdog_timeout,
"Watchdog enable timeout in seconds before booting");
static int boot_entry(struct blspec_entry *be)
{
int ret;
if (IS_ENABLED(CONFIG_WATCHDOG) && boot_watchdog_timeout) {
ret = watchdog_set_timeout(boot_watchdog_timeout);
if (ret)
pr_warn("Failed to enable watchdog: %s\n", strerror(-ret));
}
if (be->scriptpath) {
ret = boot_script(be->scriptpath);
} else {
@ -375,7 +395,7 @@ static int do_boot(int argc, char *argv[])
dryrun = 0;
timeout = -1;
while ((opt = getopt(argc, argv, "vldmt:")) > 0) {
while ((opt = getopt(argc, argv, "vldmt:w:")) > 0) {
switch (opt) {
case 'v':
verbose++;
@ -392,6 +412,9 @@ static int do_boot(int argc, char *argv[])
case 't':
timeout = simple_strtoul(optarg, NULL, 0);
break;
case 'w':
boot_watchdog_timeout = simple_strtoul(optarg, NULL, 0);
break;
}
}
@ -477,6 +500,7 @@ BAREBOX_CMD_HELP_OPT ("-v","Increase verbosity")
BAREBOX_CMD_HELP_OPT ("-d","Dryrun. See what happens but do no actually boot")
BAREBOX_CMD_HELP_OPT ("-l","List available boot sources")
BAREBOX_CMD_HELP_OPT ("-m","Show a menu with boot options")
BAREBOX_CMD_HELP_OPT ("-w SECS","Start watchdog with timeout SECS before booting")
BAREBOX_CMD_HELP_OPT ("-t SECS","specify timeout in SECS")
BAREBOX_CMD_HELP_END

View File

@ -779,6 +779,7 @@ BAREBOX_CMD_HELP_OPT("-f FILE\t", "flash image file")
BAREBOX_CMD_HELP_OPT("-e VALUE", "use VALUE as erase counter value for all eraseblocks")
BAREBOX_CMD_HELP_OPT("-x NUM\t", "UBI version number to put to EC headers (default 1)")
BAREBOX_CMD_HELP_OPT("-Q NUM\t", "32-bit UBI image sequence number to use")
BAREBOX_CMD_HELP_OPT("-y\t", "Assume yes for all questions")
BAREBOX_CMD_HELP_OPT("-q\t", "suppress progress percentage information")
BAREBOX_CMD_HELP_OPT("-v\t", "be verbose")
BAREBOX_CMD_HELP_TEXT("")

View File

@ -539,8 +539,10 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
#ifdef CONFIG_COMMON_CLK
i2c_fsl->clk = clk_get(pdev, NULL);
if (IS_ERR(i2c_fsl->clk))
return PTR_ERR(i2c_fsl->clk);
if (IS_ERR(i2c_fsl->clk)) {
ret = PTR_ERR(i2c_fsl->clk);
goto fail;
}
#endif
/* Setup i2c_fsl driver structure */
i2c_fsl->adapter.master_xfer = i2c_fsl_xfer;
@ -548,8 +550,10 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
i2c_fsl->adapter.dev.parent = pdev;
i2c_fsl->adapter.dev.device_node = pdev->device_node;
i2c_fsl->base = dev_request_mem_region(pdev, 0);
if (IS_ERR(i2c_fsl->base))
return PTR_ERR(i2c_fsl->base);
if (IS_ERR(i2c_fsl->base)) {
ret = PTR_ERR(i2c_fsl->base);
goto fail;
}
i2c_fsl->dfsrr = -1;

View File

@ -269,18 +269,18 @@ static int read_bytes(struct mci_host *mci, char *dest, unsigned int blkcount, u
xfercount -= len;
dest += len;
status = mmci_readl(host, MMCISTATUS);
status_err = status & (MCI_CMDCRCFAIL | MCI_DATATIMEOUT |
MCI_RXOVERRUN);
status_err = status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT |
MCI_RXOVERRUN);
} while(xfercount && !status_err);
status_err = status &
(MCI_CMDCRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND |
(MCI_DATACRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND |
MCI_RXOVERRUN);
while (!status_err) {
status = mmci_readl(host, MMCISTATUS);
status_err = status &
(MCI_CMDCRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND |
(MCI_DATACRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND |
MCI_RXOVERRUN);
}
@ -288,7 +288,7 @@ static int read_bytes(struct mci_host *mci, char *dest, unsigned int blkcount, u
dev_err(host->hw_dev, "Read data timed out, xfercount: %u, status: 0x%08X\n",
xfercount, status);
return -ETIMEDOUT;
} else if (status & MCI_CMDCRCFAIL) {
} else if (status & MCI_DATACRCFAIL) {
dev_err(host->hw_dev, "Read data bytes CRC error: 0x%x\n", status);
return -EILSEQ;
} else if (status & MCI_RXOVERRUN) {
@ -351,7 +351,7 @@ static int write_bytes(struct mci_host *mci, char *dest, unsigned int blkcount,
dev_dbg(host->hw_dev, "write_bytes: blkcount=%u blksize=%u\n", blkcount, blksize);
status = mmci_readl(host, MMCISTATUS);
status_err = status & (MCI_CMDCRCFAIL | MCI_DATATIMEOUT);
status_err = status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT);
do {
len = mmci_pio_write(host, dest, xfercount, status);
@ -359,11 +359,11 @@ static int write_bytes(struct mci_host *mci, char *dest, unsigned int blkcount,
dest += len;
status = mmci_readl(host, MMCISTATUS);
status_err = status & (MCI_CMDCRCFAIL | MCI_DATATIMEOUT);
status_err = status & (MCI_DATACRCFAIL | MCI_DATATIMEOUT);
} while (!status_err && xfercount);
status_err = status &
(MCI_CMDCRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND);
(MCI_DATACRCFAIL | MCI_DATATIMEOUT | MCI_DATABLOCKEND);
while (!status_err) {
status = mmci_readl(host, MMCISTATUS);
status_err = status &
@ -374,7 +374,7 @@ static int write_bytes(struct mci_host *mci, char *dest, unsigned int blkcount,
dev_err(host->hw_dev, "Write data timed out, xfercount:%u,status:0x%08X\n",
xfercount, status);
return -ETIMEDOUT;
} else if (status & MCI_CMDCRCFAIL) {
} else if (status & MCI_DATACRCFAIL) {
dev_err(host->hw_dev, "Write data CRC error\n");
return -EILSEQ;
}

View File

@ -881,8 +881,9 @@ static int mrvl_nand_scan(struct mtd_info *mtd)
* We'll use a bad block table stored in-flash and don't
* allow writing the bad block marker to the flash.
*/
chip->bbt_options |= NAND_BBT_USE_FLASH |
NAND_BBT_NO_OOB_BBM;
chip->bbt_options |=
NAND_BBT_USE_FLASH | NAND_BBT_NO_OOB_BBM |
NAND_BBT_CREATE_EMPTY;
chip->bbt_td = &bbt_main_descr;
chip->bbt_md = &bbt_mirror_descr;
}

View File

@ -523,6 +523,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "en25q64", INFO(0x1c3017, 0, 64 * 1024, 128, SECT_4K) },
{ "en25qh128", INFO(0x1c7018, 0, 64 * 1024, 256, 0) },
{ "en25qh256", INFO(0x1c7019, 0, 64 * 1024, 512, 0) },
{ "en25s64", INFO(0x1c3817, 0, 64 * 1024, 128, 0) },
/* ESMT */
{ "f25l32pa", INFO(0x8c2016, 0, 64 * 1024, 64, SECT_4K) },
@ -537,6 +538,7 @@ static const struct spi_device_id spi_nor_ids[] = {
/* GigaDevice */
{ "gd25q32", INFO(0xc84016, 0, 64 * 1024, 64, SECT_4K) },
{ "gd25q64", INFO(0xc84017, 0, 64 * 1024, 128, SECT_4K) },
{ "gd25q128", INFO(0xc84018, 0, 64 * 1024, 256, SECT_4K) },
/* Intel/Numonyx -- xxxs33b */
{ "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) },
@ -551,6 +553,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "mx25l3205d", INFO(0xc22016, 0, 64 * 1024, 64, 0) },
{ "mx25l3255e", INFO(0xc29e16, 0, 64 * 1024, 64, SECT_4K) },
{ "mx25l6405d", INFO(0xc22017, 0, 64 * 1024, 128, 0) },
{ "mx25u6435f", INFO(0xc22537, 0, 64 * 1024, 128, SECT_4K) },
{ "mx25l12805d", INFO(0xc22018, 0, 64 * 1024, 256, 0) },
{ "mx25l12855e", INFO(0xc22618, 0, 64 * 1024, 256, 0) },
{ "mx25l25635e", INFO(0xc22019, 0, 64 * 1024, 512, 0) },
@ -559,14 +562,14 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "mx66l1g55g", INFO(0xc2261b, 0, 64 * 1024, 2048, SPI_NOR_QUAD_READ) },
/* Micron */
{ "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, 0) },
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) },
{ "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) },
{ "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, 0) },
{ "n25q032", INFO(0x20ba16, 0, 64 * 1024, 64, SPI_NOR_QUAD_READ) },
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, SPI_NOR_QUAD_READ) },
{ "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) },
{ "n25q128a13", INFO(0x20ba18, 0, 64 * 1024, 256, SPI_NOR_QUAD_READ) },
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_QUAD_READ) },
{ "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) },
{ "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, USE_FSR) },
{ "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, USE_FSR | SPI_NOR_QUAD_READ) },
{ "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
{ "n25q512ax3", INFO(0x20ba20, 0, 64 * 1024, 1024, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
{ "n25q00", INFO(0x20ba21, 0, 64 * 1024, 2048, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ) },
/* PMC */
{ "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) },
@ -646,6 +649,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "m25px80", INFO(0x207114, 0, 64 * 1024, 16, 0) },
/* Winbond -- w25x "blocks" are 64K, "sectors" are 4KiB */
{ "w25x05", INFO(0xef3010, 0, 64 * 1024, 1, SECT_4K) },
{ "w25x10", INFO(0xef3011, 0, 64 * 1024, 2, SECT_4K) },
{ "w25x20", INFO(0xef3012, 0, 64 * 1024, 4, SECT_4K) },
{ "w25x40", INFO(0xef3013, 0, 64 * 1024, 8, SECT_4K) },
@ -656,6 +660,7 @@ static const struct spi_device_id spi_nor_ids[] = {
{ "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K) },
{ "w25x64", INFO(0xef3017, 0, 64 * 1024, 128, SECT_4K) },
{ "w25q64", INFO(0xef4017, 0, 64 * 1024, 128, SECT_4K) },
{ "w25q64dw", INFO(0xef6017, 0, 64 * 1024, 128, SECT_4K) },
{ "w25q80", INFO(0xef5014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16, SECT_4K) },
{ "w25q128", INFO(0xef4018, 0, 64 * 1024, 256, SECT_4K) },

View File

@ -27,12 +27,12 @@ static inline int watchdog_register(struct watchdog *w)
return 0;
}
int watchdog_deregister(struct watchdog *w)
static inline int watchdog_deregister(struct watchdog *w)
{
return 0;
}
int watchdog_set_timeout(unsigned t)
static inline int watchdog_set_timeout(unsigned t)
{
return 0;
}

View File

@ -262,7 +262,7 @@ int copy_file(const char *src, const char *dst, int verbose)
char *rw_buf = NULL;
int srcfd = 0, dstfd = 0;
int r, w;
int ret = 1;
int ret = 1, err1 = 0;
void *buf;
int total = 0;
struct stat statbuf;
@ -326,9 +326,9 @@ out:
if (srcfd > 0)
close(srcfd);
if (dstfd > 0)
close(dstfd);
err1 = close(dstfd);
return ret;
return ret ?: err1;
}
EXPORT_SYMBOL(copy_file);