9
0
Fork 0

Merge branch 'for-next/misc'

This commit is contained in:
Sascha Hauer 2015-03-09 08:30:24 +01:00
commit ac81a0d876
53 changed files with 354 additions and 152 deletions

View File

@ -0,0 +1,7 @@
Phytec phyCORE-i.MX35
=====================
Building the bootloader image for this target is covered by the ``phytec-phycore-imx35_defconfig``.
Use the corresponding ``barebox.bin`` file for this target. This image can be
used for booting in ``internal mode`` from NAND or NOR memory.

View File

@ -3,7 +3,7 @@ Freescale i.MXs
Freescale i.MXs or MXS are a SoC family which consists of the i.MX23
and the i.MX28. These are quite different from the regular i.MX SoCs
and thus are represented by its own architecture in both the Kernel
and thus are represented by their own architecture in both the Kernel
and barebox.
Bootlets
@ -36,11 +36,11 @@ the internal PMIC and the SDRAM. The second image is usually the
bootloader itself. In case of barebox the bootstream is composed
out of the self extracting barebox image (pblx) and the prepare
stage for setting up the SDRAM.
The bootstream image itself is useful for USB boot, but for booting from
SD cards or NAND a BCB header has to be prepended to the image. In case
of SD boot the image has the .mxssd file extension in barebox.
Since the bootstream images are encrypted they are not suitable for
2nd stage execution. For this purpose the 2nd stage images are generated.
@ -67,7 +67,7 @@ The SD images are suitable for booting from SD cards. SD cards need a special
partitioning which can be created with the following fdisk sequence (using
/dev/sdg as example)::
fdisk /dev/sdg
fdisk /dev/sdg
Welcome to fdisk (util-linux 2.25.1).
Changes will remain in memory only, until you decide to write them.
@ -83,17 +83,17 @@ partitioning which can be created with the following fdisk sequence (using
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-7829503, default 2048):
First sector (2048-7829503, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-7829503, default 7829503): +1M
Created a new partition 1 of type 'Linux' and of size 1 MiB.
Command (m for help): t
Command (m for help): t
Selected partition 1
Hex code (type L to list all codes): 53
Changed type of partition 'Linux' to 'OnTrack DM6 Aux3'.
Command (m for help):
Command (m for help):
Command (m for help): w
@ -101,16 +101,16 @@ After writing the new partition table the image can be written directly to
the partition::
cat images/barebox-karo-tx28-sd.img > /dev/sdg1
** NOTE **
The MXS SoCs require a special partition of type 0x53 (OnTrack DM6 Aux)
which contains the BCB header. For some unknown reason the BCB header is
inside a partition, but contains the sector number of the raw device from
which the rest of the image is read from. With standard settings booting
from SD card only works if the partition containing the bootloader starts
at sector 2048 (the standard for fdisk). See the -p parameter to the
mxsboot tool which changes this sector number in the image.
which the rest of the image is read. With standard settings booting from
SD card only works if the partition containing the bootloader starts at
sector 2048 (the standard for fdisk). See the -p parameter to the mxsboot
tool which changes this sector number in the image.
Booting second stage
--------------------

View File

@ -0,0 +1,11 @@
PowerPC boards
--------------
Not all supported boards have a description here.
.. toctree::
:glob:
:numbered:
:maxdepth: 1
powerpc/*

View File

@ -0,0 +1,6 @@
Phytec phyCORE-MPC5200-Tiny
===========================
Building the bootloader image for this target is covered by the ``pcm030_defconfig``.
Use the corresponding ``barebox.bin`` file for this target.

View File

@ -0,0 +1,11 @@
PXA boards
----------
Not all supported boards have a description here.
.. toctree::
:glob:
:numbered:
:maxdepth: 1
pxa/*

View File

@ -0,0 +1,6 @@
Phytec phyCORE-PXA270
=====================
Building the bootloader image for this target is covered by the ``phytec-phycore-pxa270_defconfig``.
Use the corresponding ``barebox.bin`` file for this target.

View File

@ -105,10 +105,12 @@ CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
# Add cleanup flags
CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_barebox += -static --gc-sections
LDFLAGS_barebox += --gc-sections
ifdef CONFIG_RELOCATABLE
LDFLAGS_barebox += -pie
else
LDFLAGS_barebox += -static
endif
ifdef CONFIG_IMAGE_COMPRESSION

View File

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

View File

@ -1 +0,0 @@
earlyprintk console=ttymxc0,115200n8

View File

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

View File

@ -1 +0,0 @@
console=ttymxc0,921600

View File

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

View File

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

View File

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

View File

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

View File

@ -1,45 +0,0 @@
#!/bin/sh
eth0.serverip=
user=
# use 'dhcp' to do dhcp in barebox and in kernel
# use 'none' if you want to skip kernel ip autoconfiguration
ip=dhcp
# or set your networking parameters here
#eth0.ipaddr=a.b.c.d
#eth0.netmask=a.b.c.d
#eth0.gateway=a.b.c.d
#eth0.serverip=a.b.c.d
# can be either 'nfs', 'tftp', 'nor' or 'nand'
kernel_loc=tftp
# can be either 'net', 'nor', 'nand' or 'initrd'
rootfs_loc=net
# can be either 'jffs2' or 'ubifs'
rootfs_type=ubifs
rootfsimage=root-${global.hostname}.$rootfs_type
kernelimage=zImage-${global.hostname}
#kernelimage=uImage-${global.hostname}
#kernelimage=Image-${global.hostname}
#kernelimage=Image-${global.hostname}.lzo
if [ -n $user ]; then
kernelimage="$user"-"$kernelimage"
nfsroot="$eth0.serverip:/home/$user/nfsroot/${global.hostname}"
rootfsimage="$user"-"$rootfsimage"
else
nfsroot="$eth0.serverip:/path/to/nfs/root"
fi
autoboot_timeout=3
bootargs="console=ttyS0,115200"
nor_parts="512k(barebox)ro,256k(bareboxenv),4M(kernel),-(root)"
rootfs_mtdblock_nor=3
PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "

View File

@ -0,0 +1,11 @@
#!/bin/sh
if [ "$1" = menu ]; then
init-menu-add-entry "$0" "NOR partitions"
exit
fi
mtdparts="512k(nor0.barebox),256k(nor0.bareboxenv),4M(nor0.kernel),-(nor0.root)"
kernelname="physmap-flash.0"
mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}

View File

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

View File

@ -8,50 +8,48 @@ CONFIG_MMU=y
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_PARTITION=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/phytec-phycore-pxa270/env"
CONFIG_DEBUG_INFO=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_AUTOMOUNT=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_MEMINFO=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_BOOTM_VERBOSE=y
CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
CONFIG_CMD_UIMAGE=y
# CONFIG_CMD_BOOTZ is not set
# CONFIG_CMD_BOOTU is not set
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_RESET=y
CONFIG_CMD_UIMAGE=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
CONFIG_CMD_SPLASH=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_NET=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_CMD_TFTP=y
CONFIG_FS_TFTP=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SPLASH=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_CRC=y
CONFIG_CMD_CRC_CMP=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_DRIVER_SERIAL_PXA=y
CONFIG_DRIVER_NET_SMC91111=y
# CONFIG_SPI is not set
@ -59,4 +57,5 @@ CONFIG_MTD=y
CONFIG_DRIVER_CFI=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_PXA=y
CONFIG_FS_TFTP=y
CONFIG_LZO_DECOMPRESS=y

View File

@ -88,6 +88,21 @@
movs pc, lr
.endm
.macro try_data_abort
ldr r13, =arm_ignore_data_abort @ check try mode
ldr r13, [r13]
cmp r13, #0
beq do_abort_\@
ldr r13, =arm_data_abort_occurred
str r13, [r13]
mrs r13, spsr @ read saved CPSR
tst r13, #1<<5 @ check Thumb mode
subeq lr, #4 @ next ARM instr
subne lr, #6 @ next Thumb instr
movs pc, lr
do_abort_\@:
.endm
.macro get_irq_stack @ setup IRQ stack
ldr sp, IRQ_STACK_START
.endm
@ -122,6 +137,7 @@ prefetch_abort:
.align 5
data_abort:
try_data_abort
get_bad_stack
bad_save_user_regs
bl do_data_abort
@ -202,5 +218,11 @@ _fiq: .word fiq
.section .data
.align 4
.global arm_ignore_data_abort
arm_ignore_data_abort:
.word arm_ignore_data_abort /* When != 0 data aborts are ignored */
.global arm_data_abort_occurred
arm_data_abort_occurred:
.word arm_data_abort_occurred /* set != 0 by the data abort handler */
abort_stack:
.space 8

View File

@ -23,6 +23,7 @@
*/
#include <common.h>
#include <abort.h>
#include <asm/ptrace.h>
#include <asm/unwind.h>
@ -161,3 +162,19 @@ void do_irq (struct pt_regs *pt_regs)
printf ("interrupt request\n");
do_exception(pt_regs);
}
extern volatile int arm_ignore_data_abort;
extern volatile int arm_data_abort_occurred;
void data_abort_mask(void)
{
arm_data_abort_occurred = 0;
arm_ignore_data_abort = 1;
}
int data_abort_unmask(void)
{
arm_ignore_data_abort = 0;
return arm_data_abort_occurred != 0;
}

View File

@ -5,4 +5,8 @@
#define ARCH_HAS_STACK_DUMP
#endif
#ifdef CONFIG_ARM_EXCEPTIONS
#define ARCH_HAS_DATA_ABORT_MASK
#endif
#endif /* _BAREBOX_H_ */

View File

@ -64,6 +64,7 @@ config MACH_MIOA701
bool "Mitac Mio A701"
select BCH_CONST_PARAMS
select PWM
select POLLER
help
Say Y here if you are using a Mitac Mio A701 smartphone

View File

@ -31,10 +31,11 @@ $(obj)/zbarebox.S: $(obj)/zbarebox FORCE
$(call if_changed,disasm)
PBL_CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map
LDFLAGS_zbarebox += -static --gc-sections
LDFLAGS_zbarebox := -Map $(obj)/zbarebox.map --gc-sections
ifdef CONFIG_PBL_RELOCATABLE
LDFLAGS_zbarebox += -pie
else
LDFLAGS_zbarebox += -static
endif
zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
zbarebox-lds := $(obj)/zbarebox.lds

View File

@ -0,0 +1,11 @@
#!/bin/sh
if [ "$1" = menu ]; then
init-menu-add-entry "$0" "NOR partitions"
exit
fi
mtdparts="512k(nor0.bareboxlow),4M(nor0.kernel),512k(nor0.oftree),26M(nor0.root),512k(nor0.barebox),512k(nor0.bareboxenv)"
kernelname="physmap-flash.0"
mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}

View File

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

View File

@ -1,42 +1,42 @@
CONFIG_TEXT_BASE=0x3e00000
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_LONGHELP=y
CONFIG_GLOB=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_PARTITION=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_MEMINFO=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/ppc/boards/pcm030/env"
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_UIMAGE=y
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_RESET=y
CONFIG_CMD_UIMAGE=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_NET=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_CMD_TFTP=y
CONFIG_FS_TFTP=y
CONFIG_ARCH_MPC5XXX=y
CONFIG_MACH_PHYCORE_MPC5200B_TINY=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_CRC=y
CONFIG_CMD_CRC_CMP=y
CONFIG_CMD_FLASH=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_DRIVER_NET_MPC5200=y
CONFIG_MTD=y
CONFIG_DRIVER_CFI=y
CONFIG_CFI_BUFFER_WRITE=y
CONFIG_FS_TFTP=y
CONFIG_ZLIB=y

View File

@ -27,7 +27,7 @@ static int do_saveenv(int argc, char *argv[])
{
int ret, opt;
unsigned envfs_flags = 0;
char *filename, *dirname;
char *filename = NULL, *dirname = NULL;
printf("saving environment\n");
while ((opt = getopt(argc, argv, "z")) > 0) {
@ -39,15 +39,11 @@ static int do_saveenv(int argc, char *argv[])
}
/* destination and source are given? */
if (argc - optind < 2)
dirname = "/env";
else
if (argc - optind > 1)
dirname = argv[optind + 1];
/* destination only given? */
if (argc - optind < 1)
filename = default_environment_path_get();
else
if (argc - optind > 0)
filename = argv[optind];
ret = envfs_save(filename, dirname, envfs_flags);

View File

@ -414,6 +414,7 @@ config AUTO_COMPLETE
config MENU
bool
prompt "Menu Framework"
depends on !SHELL_NONE
select PROCESS_ESCAPE_SEQUENCE
help
a menu framework that allow us to create list menu to simplify

View File

@ -38,7 +38,7 @@ static int linux_bootargs_overwritten;
*/
const char *linux_bootargs_get(void)
{
char *bootargs, *mtdparts;
char *bootargs, *parts;
if (linux_bootargs_overwritten)
return linux_bootargs;
@ -49,14 +49,21 @@ const char *linux_bootargs_get(void)
if (!strlen(bootargs))
return getenv("bootargs");
mtdparts = globalvar_get_match("linux.mtdparts.", ";");
linux_bootargs = bootargs;
if (strlen(mtdparts)) {
linux_bootargs = asprintf("%s mtdparts=%s", bootargs, mtdparts);
free(bootargs);
free(mtdparts);
} else {
free(mtdparts);
parts = globalvar_get_match("linux.mtdparts.", ";");
if (strlen(parts)) {
bootargs = asprintf("%s mtdparts=%s", linux_bootargs, parts);
free(linux_bootargs);
free(parts);
linux_bootargs = bootargs;
}
parts = globalvar_get_match("linux.blkdevparts.", ";");
if (strlen(parts)) {
bootargs = asprintf("%s blkdevparts=%s", linux_bootargs, parts);
free(linux_bootargs);
free(parts);
linux_bootargs = bootargs;
}
@ -78,3 +85,4 @@ int linux_bootargs_overwrite(const char *bootargs)
BAREBOX_MAGICVAR_NAMED(global_linux_bootargs_, global.linux.bootargs.*, "Linux bootargs variables");
BAREBOX_MAGICVAR_NAMED(global_linux_mtdparts_, global.linux.mtdparts.*, "Linux mtdparts variables");
BAREBOX_MAGICVAR_NAMED(global_linux_blkdevparts_, global.linux.blkdevparts.*, "Linux blkdevparts variables");

View File

@ -97,7 +97,7 @@ void log_clean(unsigned int limit)
}
}
void pr_puts(int level, const char *str)
static void pr_puts(int level, const char *str)
{
struct log_entry *log;

View File

@ -256,6 +256,12 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags)
void *buf = NULL, *wbuf;
struct envfs_entry *env;
if (!filename)
filename = default_environment_path_get();
if (!dirname)
dirname = "/env";
data.writep = NULL;
data.base = dirname;
@ -543,6 +549,12 @@ int envfs_load(const char *filename, const char *dir, unsigned flags)
int ret = 0;
size_t size, rsize;
if (!filename)
filename = default_environment_path_get();
if (!dir)
dir = "/env";
envfd = open(filename, O_RDONLY);
if (envfd < 0) {
printf("environment load %s: %s\n", filename, errno_str());

View File

@ -22,6 +22,13 @@
#include <getopt.h>
#include <malloc.h>
#include <fs.h>
#ifndef CONFIG_CMD_IMD
int imd_command_setenv(const char *variable_name, const char *value)
{
return -ENOSYS;
}
#endif
#endif
/*

View File

@ -1,5 +1,6 @@
#include <common.h>
#include <errno.h>
#include <abort.h>
#define DISP_LINE_LEN 16
@ -26,18 +27,41 @@ int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size, int
for (i = 0; i < linebytes; i += size) {
if (size == 4) {
u32 res;
res = (*uip++ = *((uint *)addr));
data_abort_mask();
res = *((uint *)addr);
if (swab)
res = __swab32(res);
count -= printf(" %08x", res);
if (data_abort_unmask()) {
res = 0xffffffff;
count -= printf(" xxxxxxxx");
} else {
count -= printf(" %08x", res);
}
*uip++ = res;
} else if (size == 2) {
u16 res;
res = (*usp++ = *((ushort *)addr));
data_abort_mask();
res = *((ushort *)addr);
if (swab)
res = __swab16(res);
count -= printf(" %04x", res);
if (data_abort_unmask()) {
res = 0xffff;
count -= printf(" xxxx");
} else {
count -= printf(" %04x", res);
}
*usp++ = res;
} else {
count -= printf(" %02x", (*ucp++ = *((u_char *)addr)));
u8 res;
data_abort_mask();
res = *((u_char *)addr);
if (data_abort_unmask()) {
res = 0xff;
count -= printf(" xx");
} else {
count -= printf(" %02x", res);
}
*ucp++ = res;
}
addr += size;
offs += size;

View File

@ -37,6 +37,7 @@ fi
# allow to stop the boot before execute the /env/init/*
# but without waiting
timeout -s -a -v key 0
autoboot="$?"
if [ "${key}" = "q" ]; then
${login_cmd}
@ -57,8 +58,10 @@ fi
[ -n ${login_cmd} ] && global.console.input_allow=1
timeout -a $global.autoboot_timeout -v key
autoboot="$?"
if [ "$autoboot" = 0 ]; then
timeout -a $global.autoboot_timeout -v key
autoboot="$?"
fi
[ -n ${login_cmd} ] && global.console.input_allow=0

View File

@ -44,6 +44,9 @@ int clk_enable(struct clk *clk)
{
int ret;
if (!clk)
return 0;
if (IS_ERR(clk))
return PTR_ERR(clk);
@ -68,6 +71,9 @@ int clk_enable(struct clk *clk)
void clk_disable(struct clk *clk)
{
if (!clk)
return;
if (IS_ERR(clk))
return;
@ -89,10 +95,15 @@ unsigned long clk_get_rate(struct clk *clk)
struct clk *parent;
unsigned long parent_rate = 0;
if (!clk)
return 0;
if (IS_ERR(clk))
return 0;
parent = clk_get_parent(clk);
if (!IS_ERR_OR_NULL(parent))
parent_rate = clk_get_rate(parent);
@ -107,6 +118,9 @@ long clk_round_rate(struct clk *clk, unsigned long rate)
unsigned long parent_rate = 0;
struct clk *parent;
if (!clk)
return 0;
if (IS_ERR(clk))
return 0;
@ -125,6 +139,9 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
struct clk *parent;
unsigned long parent_rate = 0;
if (!clk)
return 0;
if (IS_ERR(clk))
return PTR_ERR(clk);

View File

@ -25,6 +25,7 @@
#include <fcntl.h>
#include <fs.h>
/*
* Physical requirements:
* - three free GPIOs for the signals nCONFIG, CONFIGURE_DONE, nSTATUS
@ -67,13 +68,19 @@ static int altera_spi_open(struct firmware_handler *fh)
* after about 2 µs the FPGA must acknowledge with
* STATUS and CONFIG DONE lines at low level
*/
ret = wait_on_timeout(2 * USECOND,
if (gpio_is_valid(this->nstat_gpio)) {
ret = wait_on_timeout(2 * USECOND,
(gpio_get_value(this->nstat_gpio) == 0) &&
(gpio_get_value(this->confd_gpio) == 0));
} else {
ret = wait_on_timeout(2 * USECOND,
(gpio_get_value(this->confd_gpio) == 0));
}
if (ret != 0) {
dev_err(dev, "FPGA does not acknowledge the programming initiation\n");
if (gpio_get_value(this->nstat_gpio))
if (gpio_is_valid(this->nstat_gpio) && gpio_get_value(this->nstat_gpio))
dev_err(dev, "STATUS is still high!\n");
if (gpio_get_value(this->confd_gpio))
dev_err(dev, "CONFIG DONE is still high!\n");
@ -90,11 +97,16 @@ static int altera_spi_open(struct firmware_handler *fh)
* after about 1506 µs the FPGA must acknowledge this step
* with the STATUS line at high level
*/
ret = wait_on_timeout(1600 * USECOND,
if (gpio_is_valid(this->nstat_gpio)) {
ret = wait_on_timeout(1600 * USECOND,
gpio_get_value(this->nstat_gpio) == 1);
if (ret != 0) {
dev_err(dev, "FPGA does not acknowledge the programming start\n");
return ret;
if (ret != 0) {
dev_err(dev, "FPGA does not acknowledge the programming start\n");
return ret;
}
} else {
udelay(1600);
}
dev_dbg(dev, "Initiating passed\n");
@ -177,16 +189,24 @@ static int altera_spi_close(struct firmware_handler *fh)
* when programming was successful,
* both status lines should be at high level
*/
ret = wait_on_timeout(10 * USECOND,
if (gpio_is_valid(this->nstat_gpio)) {
ret = wait_on_timeout(10 * USECOND,
(gpio_get_value(this->nstat_gpio) == 1) &&
(gpio_get_value(this->confd_gpio) == 1));
} else {
ret = wait_on_timeout(10 * USECOND,
(gpio_get_value(this->confd_gpio) == 1));
}
if (ret == 0) {
dev_dbg(dev, "Programming successful\n");
return ret;
}
dev_err(dev, "Programming failed due to time out\n");
if (gpio_get_value(this->nstat_gpio) == 0)
if (gpio_is_valid(this->nstat_gpio) &&
gpio_get_value(this->nstat_gpio) == 0)
dev_err(dev, "STATUS is still low!\n");
if (gpio_get_value(this->confd_gpio) == 0)
dev_err(dev, "CONFIG DONE is still low!\n");
@ -201,10 +221,15 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
int ret;
name = "nstat-gpio";
this->nstat_gpio = of_get_named_gpio(n, name, 0);
if (this->nstat_gpio < 0) {
ret = this->nstat_gpio;
goto out;
if (!of_get_property(n, name, NULL)) {
dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n");
this->nstat_gpio = -1;
} else {
this->nstat_gpio = of_get_named_gpio(n, name, 0);
if (this->nstat_gpio < 0) {
ret = this->nstat_gpio;
goto out;
}
}
name = "confd-gpio";
@ -225,9 +250,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
ret = gpio_direction_output(this->nconfig_gpio, 1);
if (ret)
return ret;
ret = gpio_direction_input(this->nstat_gpio);
if (ret)
return ret;
if (gpio_is_valid(this->nstat_gpio)) {
ret = gpio_direction_input(this->nstat_gpio);
if (ret)
return ret;
}
ret = gpio_direction_input(this->confd_gpio);
if (ret)
return ret;

View File

@ -204,6 +204,7 @@ static int led_gpio_of_probe(struct device_d *dev)
for_each_child_of_node(dev->device_node, child) {
struct gpio_led *gled;
const char *default_state;
enum of_gpio_flags flags;
int gpio;
const char *label;
@ -225,6 +226,13 @@ static int led_gpio_of_probe(struct device_d *dev)
led_gpio_register(gled);
led_of_parse_trigger(&gled->led, child);
if (!of_property_read_string(child, "default-state", &default_state)) {
if (!strcmp(default_state, "on"))
led_gpio_set(&gled->led, 1);
else if (!strcmp(default_state, "off"))
led_gpio_set(&gled->led, 0);
}
}
return 0;

View File

@ -406,6 +406,9 @@ static void dwc_version(struct device_d *dev, u32 hwid)
static int dwc_probe_dt(struct device_d *dev, struct dw_eth_dev *priv)
{
if (!IS_ENABLED(CONFIG_OFTREE))
return -ENODEV;
priv->phy_addr = -1;
priv->interface = of_get_phy_mode(dev->device_node);

View File

@ -54,7 +54,7 @@ $(pbl-lds): $(obj)/../arch/$(ARCH)/lib/pbl.lds.S FORCE
$(call if_changed_dep,cpp_lds_S)
quiet_cmd_elf__ ?= LD $@
cmd_elf__ ?= $(LD) $(LDFLAGS) -static --gc-sections -pie \
cmd_elf__ ?= $(LD) $(LDFLAGS) --gc-sections -pie \
-e $(2) -Map $@.map $(LDFLAGS_$(@F)) -o $@ \
-T $(pbl-lds) \
--start-group $(barebox-pbl-common) --end-group

37
include/abort.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef __ABORT_H
#define __ABORT_H
#include <asm/barebox.h>
#ifdef ARCH_HAS_DATA_ABORT_MASK
/*
* data_abort_mask - ignore data aborts
*
* If data aborts are ignored the data abort handler
* will just return.
*/
void data_abort_mask(void);
/*
* data_abort_unmask - Enable data aborts
*
* returns true if a data abort has happened between calling data_abort_mask()
* and data_abort_unmask()
*/
int data_abort_unmask(void);
#else
static inline void data_abort_mask(void)
{
}
static inline int data_abort_unmask(void)
{
return 0;
}
#endif
#endif /* __ABORT_H */