mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 13:11:31 +00:00
Merge branch 'u-boot/master' into 'u-boot-arm/master'
Trivial merge conflict, needed to manually remove
local_info as per commit 41364f0f
.
Conflicts:
board/samsung/common/board.c
This commit is contained in:
commit
ab6423cae0
121 changed files with 4208 additions and 905 deletions
45
Makefile
45
Makefile
|
@ -165,14 +165,7 @@ VPATH := $(srctree)$(if $(KBUILD_EXTMOD),:$(KBUILD_EXTMOD))
|
|||
|
||||
export srctree objtree VPATH
|
||||
|
||||
OBJTREE := $(objtree)
|
||||
SPLTREE := $(OBJTREE)/spl
|
||||
TPLTREE := $(OBJTREE)/tpl
|
||||
SRCTREE := $(srctree)
|
||||
TOPDIR := $(SRCTREE)
|
||||
export TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
|
||||
|
||||
MKCONFIG := $(SRCTREE)/mkconfig
|
||||
MKCONFIG := $(srctree)/mkconfig
|
||||
export MKCONFIG
|
||||
|
||||
# Make sure CDPATH settings don't interfere
|
||||
|
@ -490,7 +483,7 @@ endif
|
|||
# standard location.
|
||||
|
||||
ifndef LDSCRIPT
|
||||
#LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds.debug
|
||||
#LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds.debug
|
||||
ifdef CONFIG_SYS_LDSCRIPT
|
||||
# need to strip off double quotes
|
||||
LDSCRIPT := $(srctree)/$(CONFIG_SYS_LDSCRIPT:"%"=%)
|
||||
|
@ -500,19 +493,19 @@ endif
|
|||
# If there is no specified link script, we look in a number of places for it
|
||||
ifndef LDSCRIPT
|
||||
ifeq ($(CONFIG_NAND_U_BOOT),y)
|
||||
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-nand.lds
|
||||
LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot-nand.lds
|
||||
ifeq ($(wildcard $(LDSCRIPT)),)
|
||||
LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
|
||||
LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot-nand.lds
|
||||
endif
|
||||
endif
|
||||
ifeq ($(wildcard $(LDSCRIPT)),)
|
||||
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
|
||||
LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot.lds
|
||||
endif
|
||||
ifeq ($(wildcard $(LDSCRIPT)),)
|
||||
LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot.lds
|
||||
LDSCRIPT := $(srctree)/$(CPUDIR)/u-boot.lds
|
||||
endif
|
||||
ifeq ($(wildcard $(LDSCRIPT)),)
|
||||
LDSCRIPT := $(TOPDIR)/arch/$(ARCH)/cpu/u-boot.lds
|
||||
LDSCRIPT := $(srctree)/arch/$(ARCH)/cpu/u-boot.lds
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -556,11 +549,9 @@ export CONFIG_SYS_TEXT_BASE
|
|||
|
||||
# Use UBOOTINCLUDE when you must reference the include/ directory.
|
||||
# Needed to be compatible with the O= option
|
||||
UBOOTINCLUDE :=
|
||||
ifneq ($(OBJTREE),$(SRCTREE))
|
||||
UBOOTINCLUDE += -I$(OBJTREE)/include
|
||||
endif
|
||||
UBOOTINCLUDE += -I$(srctree)/include \
|
||||
UBOOTINCLUDE := \
|
||||
-Iinclude \
|
||||
$(if $(KBUILD_SRC), -I$(srctree)/include) \
|
||||
-I$(srctree)/arch/$(ARCH)/include
|
||||
|
||||
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
|
||||
|
@ -668,7 +659,7 @@ export PLATFORM_LIBS
|
|||
# Pass the version down so we can handle backwards compatibility
|
||||
# on the fly.
|
||||
LDPPFLAGS += \
|
||||
-include $(TOPDIR)/include/u-boot/u-boot.lds.h \
|
||||
-include $(srctree)/include/u-boot/u-boot.lds.h \
|
||||
-DCPUDIR=$(CPUDIR) \
|
||||
$(shell $(LD) --version | \
|
||||
sed -ne 's/GNU ld version \([0-9][0-9]*\)\.\([0-9][0-9]*\).*/-DLD_MAJOR=\1 -DLD_MINOR=\2/p')
|
||||
|
@ -802,11 +793,11 @@ MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
|
|||
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
|
||||
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
|
||||
|
||||
MKIMAGEFLAGS_u-boot.kwb = -n $(CONFIG_SYS_KWD_CONFIG) -T kwbimage \
|
||||
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
|
||||
MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
|
||||
-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
|
||||
|
||||
MKIMAGEFLAGS_u-boot.pbl = -n $(CONFIG_SYS_FSL_PBL_RCW) \
|
||||
-R $(CONFIG_SYS_FSL_PBL_PBI) -T pblimage
|
||||
MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
|
||||
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
|
||||
|
||||
u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
|
||||
$(call if_changed,mkimage)
|
||||
|
@ -858,7 +849,7 @@ u-boot.ais: spl/u-boot-spl.ais u-boot.img FORCE
|
|||
$(call if_changed,pad_cat)
|
||||
|
||||
u-boot.sb: u-boot.bin spl/u-boot-spl.bin
|
||||
$(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs $(objtree)/u-boot.sb
|
||||
$(Q)$(MAKE) $(build)=arch/arm/cpu/arm926ejs/mxs u-boot.sb
|
||||
|
||||
# On x600 (SPEAr600) U-Boot is appended to U-Boot SPL.
|
||||
# Both images are created using mkimage (crc etc), so that the ROM
|
||||
|
@ -1237,12 +1228,12 @@ distclean: mrproper
|
|||
@find $(srctree) $(RCS_FIND_IGNORE) \
|
||||
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
|
||||
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
|
||||
-o -name '.*.rej' \
|
||||
-o -name '.*.rej' -o -name '*.pyc' \
|
||||
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
|
||||
-type f -print | xargs rm -f
|
||||
|
||||
backup:
|
||||
F=`basename $(TOPDIR)` ; cd .. ; \
|
||||
F=`basename $(srctree)` ; cd .. ; \
|
||||
gtar --force-local -zcvf `LC_ALL=C date "+$$F-%Y-%m-%d-%T.tar.gz"` $$F
|
||||
|
||||
help:
|
||||
|
|
|
@ -23,8 +23,6 @@ endif
|
|||
|
||||
PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -DCONFIG_ARC -gdwarf-2
|
||||
|
||||
LDSCRIPT := $(SRCTREE)/$(CPUDIR)/u-boot.lds
|
||||
|
||||
# Needed for relocation
|
||||
LDFLAGS_FINAL += -pie
|
||||
|
||||
|
|
|
@ -14,11 +14,12 @@ obj-y += spl_boot.o spl_lradc_init.o spl_mem_init.o spl_power_init.o
|
|||
endif
|
||||
|
||||
# Specify the target for use in elftosb call
|
||||
MKIMAGE_TARGET-$(CONFIG_MX23) = mx23
|
||||
MKIMAGE_TARGET-$(CONFIG_MX28) = mx28
|
||||
MKIMAGE_TARGET-$(CONFIG_MX23) = mxsimage.mx23.cfg
|
||||
MKIMAGE_TARGET-$(CONFIG_MX28) = mxsimage.mx28.cfg
|
||||
|
||||
$(OBJTREE)/mxsimage.cfg: $(SRCTREE)/$(CPUDIR)/$(SOC)/mxsimage.$(MKIMAGE_TARGET-y).cfg
|
||||
sed "s@OBJTREE@$(OBJTREE)@g" $^ > $@
|
||||
quiet_cmd_mkimage_mxs = UIMAGE $@
|
||||
cmd_mkimage_mxs = $(objtree)/tools/mkimage -n $< -T mxsimage $@ \
|
||||
$(if $(KBUILD_VERBOSE:1=), >/dev/null)
|
||||
|
||||
$(OBJTREE)/u-boot.sb: $(OBJTREE)/u-boot.bin $(OBJTREE)/spl/u-boot-spl.bin $(OBJTREE)/mxsimage.cfg
|
||||
$(OBJTREE)/tools/mkimage -n $(OBJTREE)/mxsimage.cfg -T mxsimage $@
|
||||
u-boot.sb: $(src)/$(MKIMAGE_TARGET-y) u-boot.bin spl/u-boot-spl.bin FORCE
|
||||
$(call if_changed,mkimage_mxs)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
SECTION 0x0 BOOTABLE
|
||||
TAG LAST
|
||||
LOAD 0x0 OBJTREE/spl/u-boot-spl.bin
|
||||
LOAD 0x0 spl/u-boot-spl.bin
|
||||
CALL 0x14 0x0
|
||||
LOAD 0x40000100 OBJTREE/u-boot.bin
|
||||
LOAD 0x40000100 u-boot.bin
|
||||
CALL 0x40000100 0x0
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
SECTION 0x0 BOOTABLE
|
||||
TAG LAST
|
||||
LOAD 0x0 OBJTREE/spl/u-boot-spl.bin
|
||||
LOAD 0x0 spl/u-boot-spl.bin
|
||||
LOAD IVT 0x8000 0x14
|
||||
CALL HAB 0x8000 0x0
|
||||
LOAD 0x40000100 OBJTREE/u-boot.bin
|
||||
LOAD 0x40000100 u-boot.bin
|
||||
LOAD IVT 0x8000 0x40000100
|
||||
CALL HAB 0x8000 0x0
|
||||
|
|
|
@ -4,8 +4,8 @@ options {
|
|||
}
|
||||
|
||||
sources {
|
||||
u_boot_spl="OBJTREE/spl/u-boot-spl.bin";
|
||||
u_boot="OBJTREE/u-boot.bin";
|
||||
u_boot_spl="spl/u-boot-spl.bin";
|
||||
u_boot="u-boot.bin";
|
||||
}
|
||||
|
||||
section (0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
sources {
|
||||
u_boot_spl="OBJTREE/spl/u-boot-spl.bin";
|
||||
u_boot="OBJTREE/u-boot.bin";
|
||||
u_boot_spl="spl/u-boot-spl.bin";
|
||||
u_boot="u-boot.bin";
|
||||
}
|
||||
|
||||
section (0) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* CONFIG_SYS_KWD_CONFIG should be defined in board specific header file
|
||||
*/
|
||||
#ifndef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage.cfg
|
||||
#endif /* CONFIG_SYS_KWD_CONFIG */
|
||||
|
||||
/* Kirkwood has 2k of Security SRAM, use it for SP */
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5208:=$(shell grep CONFIG_M5208 $(TOPDIR)/include/$(cfg))
|
||||
is5249:=$(shell grep CONFIG_M5249 $(TOPDIR)/include/$(cfg))
|
||||
is5253:=$(shell grep CONFIG_M5253 $(TOPDIR)/include/$(cfg))
|
||||
is5271:=$(shell grep CONFIG_M5271 $(TOPDIR)/include/$(cfg))
|
||||
is5272:=$(shell grep CONFIG_M5272 $(TOPDIR)/include/$(cfg))
|
||||
is5275:=$(shell grep CONFIG_M5275 $(TOPDIR)/include/$(cfg))
|
||||
is5282:=$(shell grep CONFIG_M5282 $(TOPDIR)/include/$(cfg))
|
||||
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5208:=$(shell grep CONFIG_M5208 $(srctree)/include/$(cfg))
|
||||
is5249:=$(shell grep CONFIG_M5249 $(srctree)/include/$(cfg))
|
||||
is5253:=$(shell grep CONFIG_M5253 $(srctree)/include/$(cfg))
|
||||
is5271:=$(shell grep CONFIG_M5271 $(srctree)/include/$(cfg))
|
||||
is5272:=$(shell grep CONFIG_M5272 $(srctree)/include/$(cfg))
|
||||
is5275:=$(shell grep CONFIG_M5275 $(srctree)/include/$(cfg))
|
||||
is5282:=$(shell grep CONFIG_M5282 $(srctree)/include/$(cfg))
|
||||
|
||||
ifneq (,$(findstring CONFIG_M5208,$(is5208)))
|
||||
PLATFORM_CPPFLAGS += -mcpu=5208
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5301x:=$(shell grep CONFIG_MCF5301x $(TOPDIR)/include/$(cfg))
|
||||
is532x:=$(shell grep CONFIG_MCF532x $(TOPDIR)/include/$(cfg))
|
||||
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5301x:=$(shell grep CONFIG_MCF5301x $(srctree)/include/$(cfg))
|
||||
is532x:=$(shell grep CONFIG_MCF532x $(srctree)/include/$(cfg))
|
||||
|
||||
ifneq (,$(findstring CONFIG_MCF5301x,$(is5301x)))
|
||||
PLATFORM_CPPFLAGS += -mcpu=53015 -fPIC
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5441x:=$(shell grep CONFIG_MCF5441x $(TOPDIR)/include/$(cfg))
|
||||
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is5441x:=$(shell grep CONFIG_MCF5441x $(srctree)/include/$(cfg))
|
||||
|
||||
ifneq (,$(findstring CONFIG_MCF5441x,$(is5441x)))
|
||||
PLATFORM_CPPFLAGS += -mcpu=54418 -fPIC
|
||||
|
|
|
@ -15,5 +15,3 @@ endif
|
|||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F00000
|
||||
|
||||
PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
|
||||
|
||||
LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
|
||||
|
|
|
@ -14,5 +14,3 @@ endif
|
|||
PLATFORM_CPPFLAGS += -DCONFIG_OPENRISC -D__OR1K__ -ffixed-r10
|
||||
|
||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
|
||||
|
||||
LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
PLATFORM_CPPFLAGS += -DCONFIG_4xx -mstring -msoft-float
|
||||
|
||||
cfg=$(shell grep configs $(OBJTREE)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is440:=$(shell grep CONFIG_440 $(TOPDIR)/include/$(cfg))
|
||||
cfg=$(shell grep configs $(objtree)/include/config.h | sed 's/.*<\(configs.*\)>/\1/')
|
||||
is440:=$(shell grep CONFIG_440 $(srctree)/include/$(cfg))
|
||||
|
||||
ifneq (,$(findstring CONFIG_440,$(is440)))
|
||||
PLATFORM_CPPFLAGS += -Wa,-m440 -mcpu=440
|
||||
|
|
|
@ -5,6 +5,11 @@ PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE
|
|||
PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM -DCONFIG_SYS_GENERIC_BOARD
|
||||
PLATFORM_LIBS += -lrt
|
||||
|
||||
ifdef CONFIG_SANDBOX_SDL
|
||||
PLATFORM_LIBS += $(shell sdl-config --libs)
|
||||
PLATFORM_CPPFLAGS += $(shell sdl-config --cflags)
|
||||
endif
|
||||
|
||||
# Support generic board on sandbox
|
||||
__HAVE_ARCH_GENERIC_BOARD := y
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#
|
||||
|
||||
obj-y := cpu.o os.o start.o state.o
|
||||
obj-$(CONFIG_SANDBOX_SDL) += sdl.o
|
||||
|
||||
# os.c is build in the system environment, so needs standard includes
|
||||
# CFLAGS_REMOVE_os.o cannot be used to drop header include path
|
||||
|
@ -17,3 +18,5 @@ cmd_cc_os.o = $(CC) $(filter-out -nostdinc, \
|
|||
|
||||
$(obj)/os.o: $(src)/os.c FORCE
|
||||
$(call if_changed_dep,cc_os.o)
|
||||
$(obj)/sdl.o: $(src)/sdl.c FORCE
|
||||
$(call if_changed_dep,cc_os.o)
|
||||
|
|
|
@ -58,7 +58,7 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
|||
return (void *)(gd->arch.ram_buf + paddr);
|
||||
}
|
||||
|
||||
phys_addr_t map_to_sysmem(void *ptr)
|
||||
phys_addr_t map_to_sysmem(const void *ptr)
|
||||
{
|
||||
return (u8 *)ptr - gd->arch.ram_buf;
|
||||
}
|
||||
|
|
|
@ -104,21 +104,22 @@ void os_exit(int exit_code)
|
|||
|
||||
/* Restore tty state when we exit */
|
||||
static struct termios orig_term;
|
||||
static bool term_setup;
|
||||
|
||||
static void os_fd_restore(void)
|
||||
{
|
||||
tcsetattr(0, TCSANOW, &orig_term);
|
||||
if (term_setup)
|
||||
tcsetattr(0, TCSANOW, &orig_term);
|
||||
}
|
||||
|
||||
/* Put tty into raw mode so <tab> and <ctrl+c> work */
|
||||
void os_tty_raw(int fd)
|
||||
void os_tty_raw(int fd, bool allow_sigs)
|
||||
{
|
||||
static int setup = 0;
|
||||
struct termios term;
|
||||
|
||||
if (setup)
|
||||
if (term_setup)
|
||||
return;
|
||||
setup = 1;
|
||||
term_setup = true;
|
||||
|
||||
/* If not a tty, don't complain */
|
||||
if (tcgetattr(fd, &orig_term))
|
||||
|
@ -128,7 +129,7 @@ void os_tty_raw(int fd)
|
|||
term.c_iflag = IGNBRK | IGNPAR;
|
||||
term.c_oflag = OPOST | ONLCR;
|
||||
term.c_cflag = CS8 | CREAD | CLOCAL;
|
||||
term.c_lflag = 0;
|
||||
term.c_lflag = allow_sigs ? ISIG : 0;
|
||||
if (tcsetattr(fd, TCSANOW, &term))
|
||||
return;
|
||||
|
||||
|
@ -443,3 +444,93 @@ int os_read_ram_buf(const char *fname)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int make_exec(char *fname, const void *data, int size)
|
||||
{
|
||||
int fd;
|
||||
|
||||
strcpy(fname, "/tmp/u-boot.jump.XXXXXX");
|
||||
fd = mkstemp(fname);
|
||||
if (fd < 0)
|
||||
return -ENOENT;
|
||||
if (write(fd, data, size) < 0)
|
||||
return -EIO;
|
||||
close(fd);
|
||||
if (chmod(fname, 0777))
|
||||
return -ENOEXEC;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_args(char ***argvp, const char *add_args[], int count)
|
||||
{
|
||||
char **argv;
|
||||
int argc;
|
||||
|
||||
for (argv = *argvp, argc = 0; (*argvp)[argc]; argc++)
|
||||
;
|
||||
|
||||
argv = malloc((argc + count + 1) * sizeof(char *));
|
||||
if (!argv) {
|
||||
printf("Out of memory for %d argv\n", count);
|
||||
return -ENOMEM;
|
||||
}
|
||||
memcpy(argv, *argvp, argc * sizeof(char *));
|
||||
memcpy(argv + argc, add_args, count * sizeof(char *));
|
||||
argv[argc + count] = NULL;
|
||||
|
||||
*argvp = argv;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int os_jump_to_image(const void *dest, int size)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
char fname[30], mem_fname[30];
|
||||
int fd, err;
|
||||
const char *extra_args[5];
|
||||
char **argv = state->argv;
|
||||
#ifdef DEBUG
|
||||
int argc, i;
|
||||
#endif
|
||||
|
||||
err = make_exec(fname, dest, size);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
strcpy(mem_fname, "/tmp/u-boot.mem.XXXXXX");
|
||||
fd = mkstemp(mem_fname);
|
||||
if (fd < 0)
|
||||
return -ENOENT;
|
||||
close(fd);
|
||||
err = os_write_ram_buf(mem_fname);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
os_fd_restore();
|
||||
|
||||
extra_args[0] = "-j";
|
||||
extra_args[1] = fname;
|
||||
extra_args[2] = "-m";
|
||||
extra_args[3] = mem_fname;
|
||||
extra_args[4] = "--rm_memory";
|
||||
err = add_args(&argv, extra_args,
|
||||
sizeof(extra_args) / sizeof(extra_args[0]));
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; argv[i]; i++)
|
||||
printf("%d %s\n", i, argv[i]);
|
||||
#endif
|
||||
|
||||
if (state_uninit())
|
||||
os_exit(2);
|
||||
|
||||
err = execv(fname, argv);
|
||||
free(argv);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return unlink(fname);
|
||||
}
|
||||
|
|
341
arch/sandbox/cpu/sdl.c
Normal file
341
arch/sandbox/cpu/sdl.c
Normal file
|
@ -0,0 +1,341 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Google, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <linux/input.h>
|
||||
#include <SDL/SDL.h>
|
||||
#include <sound.h>
|
||||
#include <asm/state.h>
|
||||
|
||||
static struct sdl_info {
|
||||
SDL_Surface *screen;
|
||||
int width;
|
||||
int height;
|
||||
int depth;
|
||||
int pitch;
|
||||
uint frequency;
|
||||
uint audio_pos;
|
||||
uint audio_size;
|
||||
uint8_t *audio_data;
|
||||
bool audio_active;
|
||||
bool inited;
|
||||
} sdl;
|
||||
|
||||
static void sandbox_sdl_poll_events(void)
|
||||
{
|
||||
/*
|
||||
* We don't want to include common.h in this file since it uses
|
||||
* system headers. So add a declation here.
|
||||
*/
|
||||
extern void reset_cpu(unsigned long addr);
|
||||
SDL_Event event;
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
switch (event.type) {
|
||||
case SDL_QUIT:
|
||||
puts("LCD window closed - quitting\n");
|
||||
reset_cpu(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int sandbox_sdl_ensure_init(void)
|
||||
{
|
||||
if (!sdl.inited) {
|
||||
if (SDL_Init(0) < 0) {
|
||||
printf("Unable to initialize SDL: %s\n",
|
||||
SDL_GetError());
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
atexit(SDL_Quit);
|
||||
|
||||
sdl.inited = true;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sandbox_sdl_init_display(int width, int height, int log2_bpp)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
int err;
|
||||
|
||||
if (!width || !state->show_lcd)
|
||||
return 0;
|
||||
err = sandbox_sdl_ensure_init();
|
||||
if (err)
|
||||
return err;
|
||||
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
|
||||
printf("Unable to initialize SDL LCD: %s\n", SDL_GetError());
|
||||
return -EPERM;
|
||||
}
|
||||
SDL_WM_SetCaption("U-Boot", "U-Boot");
|
||||
|
||||
sdl.width = width;
|
||||
sdl.height = height;
|
||||
sdl.depth = 1 << log2_bpp;
|
||||
sdl.pitch = sdl.width * sdl.depth / 8;
|
||||
sdl.screen = SDL_SetVideoMode(width, height, 0, 0);
|
||||
sandbox_sdl_poll_events();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sandbox_sdl_sync(void *lcd_base)
|
||||
{
|
||||
SDL_Surface *frame;
|
||||
|
||||
frame = SDL_CreateRGBSurfaceFrom(lcd_base, sdl.width, sdl.height,
|
||||
sdl.depth, sdl.pitch,
|
||||
0x1f << 11, 0x3f << 5, 0x1f << 0, 0);
|
||||
SDL_BlitSurface(frame, NULL, sdl.screen, NULL);
|
||||
SDL_FreeSurface(frame);
|
||||
SDL_UpdateRect(sdl.screen, 0, 0, 0, 0);
|
||||
sandbox_sdl_poll_events();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define NONE (-1)
|
||||
#define NUM_SDL_CODES (SDLK_UNDO + 1)
|
||||
|
||||
static int16_t sdl_to_keycode[NUM_SDL_CODES] = {
|
||||
/* 0 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, KEY_BACKSPACE, KEY_TAB,
|
||||
NONE, NONE, NONE, KEY_ENTER, NONE,
|
||||
NONE, NONE, NONE, NONE, KEY_POWER, /* use PAUSE as POWER */
|
||||
|
||||
/* 20 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, KEY_ESC, NONE, NONE,
|
||||
NONE, NONE, KEY_SPACE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 40 */
|
||||
NONE, NONE, NONE, NONE, KEY_COMMA,
|
||||
KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1,
|
||||
KEY_2, KEY_3, KEY_4, KEY_5, KEY_6,
|
||||
KEY_7, KEY_8, KEY_9, NONE, KEY_SEMICOLON,
|
||||
|
||||
/* 60 */
|
||||
NONE, KEY_EQUAL, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 80 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, KEY_BACKSLASH, NONE, NONE,
|
||||
NONE, KEY_GRAVE, KEY_A, KEY_B, KEY_C,
|
||||
|
||||
/* 100 */
|
||||
KEY_D, KEY_E, KEY_F, KEY_G, KEY_H,
|
||||
KEY_I, KEY_J, KEY_K, KEY_L, KEY_M,
|
||||
KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R,
|
||||
KEY_S, KEY_T, KEY_U, KEY_V, KEY_W,
|
||||
|
||||
/* 120 */
|
||||
KEY_X, KEY_Y, KEY_Z, NONE, NONE,
|
||||
NONE, NONE, KEY_DELETE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 140 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 160 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 180 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 200 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 220 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 240 */
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
NONE, KEY_KP0, KEY_KP1, KEY_KP2, KEY_KP3,
|
||||
|
||||
/* 260 */
|
||||
KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8,
|
||||
KEY_KP9, KEY_KPDOT, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS,
|
||||
KEY_KPPLUS, KEY_KPENTER, KEY_KPEQUAL, KEY_UP, KEY_DOWN,
|
||||
KEY_RIGHT, KEY_LEFT, KEY_INSERT, KEY_HOME, KEY_END,
|
||||
|
||||
/* 280 */
|
||||
KEY_PAGEUP, KEY_PAGEDOWN, KEY_F1, KEY_F2, KEY_F3,
|
||||
KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8,
|
||||
KEY_F9, KEY_F10, KEY_F11, KEY_F12, NONE,
|
||||
NONE, NONE, NONE, NONE, NONE,
|
||||
|
||||
/* 300 */
|
||||
KEY_NUMLOCK, KEY_CAPSLOCK, KEY_SCROLLLOCK, KEY_RIGHTSHIFT,
|
||||
KEY_LEFTSHIFT,
|
||||
KEY_RIGHTCTRL, KEY_LEFTCTRL, KEY_RIGHTALT, KEY_LEFTALT, KEY_RIGHTMETA,
|
||||
KEY_LEFTMETA, NONE, KEY_FN, NONE, KEY_COMPOSE,
|
||||
NONE, KEY_PRINT, KEY_SYSRQ, KEY_PAUSE, NONE,
|
||||
|
||||
/* 320 */
|
||||
NONE, NONE, NONE,
|
||||
};
|
||||
|
||||
int sandbox_sdl_scan_keys(int key[], int max_keys)
|
||||
{
|
||||
Uint8 *keystate;
|
||||
int i, count;
|
||||
|
||||
sandbox_sdl_poll_events();
|
||||
keystate = SDL_GetKeyState(NULL);
|
||||
for (i = count = 0; i < NUM_SDL_CODES; i++) {
|
||||
if (count >= max_keys)
|
||||
break;
|
||||
else if (keystate[i])
|
||||
key[count++] = sdl_to_keycode[i];
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
int sandbox_sdl_key_pressed(int keycode)
|
||||
{
|
||||
int key[8]; /* allow up to 8 keys to be pressed at once */
|
||||
int count;
|
||||
int i;
|
||||
|
||||
count = sandbox_sdl_scan_keys(key, sizeof(key) / sizeof(key[0]));
|
||||
for (i = 0; i < count; i++) {
|
||||
if (key[i] == keycode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len)
|
||||
{
|
||||
int avail;
|
||||
|
||||
avail = sdl.audio_size - sdl.audio_pos;
|
||||
if (avail < len)
|
||||
len = avail;
|
||||
|
||||
SDL_MixAudio(stream, sdl.audio_data + sdl.audio_pos, len,
|
||||
SDL_MIX_MAXVOLUME);
|
||||
sdl.audio_pos += len;
|
||||
|
||||
/* Loop if we are at the end */
|
||||
if (sdl.audio_pos == sdl.audio_size)
|
||||
sdl.audio_pos = 0;
|
||||
}
|
||||
|
||||
int sandbox_sdl_sound_init(void)
|
||||
{
|
||||
SDL_AudioSpec wanted;
|
||||
|
||||
if (sandbox_sdl_ensure_init())
|
||||
return -1;
|
||||
|
||||
if (sdl.audio_active)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* At present all sandbox sounds crash. This is probably due to
|
||||
* symbol name conflicts with U-Boot. We can remove the malloc()
|
||||
* probles with:
|
||||
*
|
||||
* #define USE_DL_PREFIX
|
||||
*
|
||||
* and get this:
|
||||
*
|
||||
* Assertion 'e->pollfd->fd == e->fd' failed at pulse/mainloop.c:676,
|
||||
* function dispatch_pollfds(). Aborting.
|
||||
*
|
||||
* The right solution is probably to make U-Boot's names private or
|
||||
* link os.c and sdl.c against their libraries before liking with
|
||||
* U-Boot. TBD. For now sound is disabled.
|
||||
*/
|
||||
printf("(Warning: sandbox sound disabled)\n");
|
||||
return 0;
|
||||
|
||||
/* Set the audio format */
|
||||
wanted.freq = 22050;
|
||||
wanted.format = AUDIO_S16;
|
||||
wanted.channels = 1; /* 1 = mono, 2 = stereo */
|
||||
wanted.samples = 1024; /* Good low-latency value for callback */
|
||||
wanted.callback = sandbox_sdl_fill_audio;
|
||||
wanted.userdata = NULL;
|
||||
|
||||
sdl.audio_size = sizeof(uint16_t) * wanted.freq;
|
||||
sdl.audio_data = malloc(sdl.audio_size);
|
||||
if (!sdl.audio_data) {
|
||||
printf("%s: Out of memory\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
sdl.audio_pos = 0;
|
||||
|
||||
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
|
||||
printf("Unable to initialize SDL audio: %s\n", SDL_GetError());
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* Open the audio device, forcing the desired format */
|
||||
if (SDL_OpenAudio(&wanted, NULL) < 0) {
|
||||
printf("Couldn't open audio: %s\n", SDL_GetError());
|
||||
goto err;
|
||||
}
|
||||
sdl.audio_active = true;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
free(sdl.audio_data);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sandbox_sdl_sound_start(uint frequency)
|
||||
{
|
||||
if (!sdl.audio_active)
|
||||
return -1;
|
||||
sdl.frequency = frequency;
|
||||
sound_create_square_wave((unsigned short *)sdl.audio_data,
|
||||
sdl.audio_size, frequency);
|
||||
sdl.audio_pos = 0;
|
||||
SDL_PauseAudio(0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sandbox_sdl_sound_stop(void)
|
||||
{
|
||||
if (!sdl.audio_active)
|
||||
return -1;
|
||||
SDL_PauseAudio(1);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -107,6 +107,16 @@ static int sandbox_cmdline_cb_interactive(struct sandbox_state *state,
|
|||
|
||||
SANDBOX_CMDLINE_OPT_SHORT(interactive, 'i', 0, "Enter interactive mode");
|
||||
|
||||
static int sandbox_cmdline_cb_jump(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
/* Remember to delete this U-Boot image later */
|
||||
state->jumped_fname = arg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
SANDBOX_CMDLINE_OPT_SHORT(jump, 'j', 1, "Jumped from previous U-Boot");
|
||||
|
||||
static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
|
@ -126,6 +136,15 @@ static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
|
|||
SANDBOX_CMDLINE_OPT_SHORT(memory, 'm', 1,
|
||||
"Read/write ram_buf memory contents from file");
|
||||
|
||||
static int sandbox_cmdline_cb_rm_memory(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
state->ram_buf_rm = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
SANDBOX_CMDLINE_OPT(rm_memory, 0, "Remove memory file after reading");
|
||||
|
||||
static int sandbox_cmdline_cb_state(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
|
@ -159,6 +178,43 @@ static int sandbox_cmdline_cb_ignore_missing(struct sandbox_state *state,
|
|||
SANDBOX_CMDLINE_OPT_SHORT(ignore_missing, 'n', 0,
|
||||
"Ignore missing state on read");
|
||||
|
||||
static int sandbox_cmdline_cb_show_lcd(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
state->show_lcd = true;
|
||||
return 0;
|
||||
}
|
||||
SANDBOX_CMDLINE_OPT_SHORT(show_lcd, 'l', 0,
|
||||
"Show the sandbox LCD display");
|
||||
|
||||
static const char *term_args[STATE_TERM_COUNT] = {
|
||||
"raw-with-sigs",
|
||||
"raw",
|
||||
"cooked",
|
||||
};
|
||||
|
||||
static int sandbox_cmdline_cb_terminal(struct sandbox_state *state,
|
||||
const char *arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < STATE_TERM_COUNT; i++) {
|
||||
if (!strcmp(arg, term_args[i])) {
|
||||
state->term_raw = i;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
printf("Unknown terminal setting '%s' (", arg);
|
||||
for (i = 0; i < STATE_TERM_COUNT; i++)
|
||||
printf("%s%s", i ? ", " : "", term_args[i]);
|
||||
puts(")\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
SANDBOX_CMDLINE_OPT_SHORT(terminal, 't', 1,
|
||||
"Set terminal to raw/cooked mode");
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct sandbox_state *state;
|
||||
|
@ -176,6 +232,10 @@ int main(int argc, char *argv[])
|
|||
if (ret)
|
||||
goto err;
|
||||
|
||||
/* Remove old memory file if required */
|
||||
if (state->ram_buf_rm && state->ram_buf_fname)
|
||||
os_unlink(state->ram_buf_fname);
|
||||
|
||||
/* Do pre- and post-relocation init */
|
||||
board_init_f(0);
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ int state_uninit(void)
|
|||
|
||||
state = &main_state;
|
||||
|
||||
if (state->write_ram_buf) {
|
||||
if (state->write_ram_buf && !state->ram_buf_rm) {
|
||||
err = os_write_ram_buf(state->ram_buf_fname);
|
||||
if (err) {
|
||||
printf("Failed to write RAM buffer\n");
|
||||
|
@ -380,6 +380,10 @@ int state_uninit(void)
|
|||
}
|
||||
}
|
||||
|
||||
/* Delete this at the last moment so as not to upset gdb too much */
|
||||
if (state->jumped_fname)
|
||||
os_unlink(state->jumped_fname);
|
||||
|
||||
if (state->state_fdt)
|
||||
os_free(state->state_fdt);
|
||||
memset(state, '\0', sizeof(*state));
|
||||
|
|
|
@ -17,4 +17,100 @@
|
|||
colour = "white";
|
||||
sides = <6>;
|
||||
};
|
||||
|
||||
host@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "sandbox,host-emulation";
|
||||
cros-ec@0 {
|
||||
reg = <0>;
|
||||
compatible = "google,cros-ec";
|
||||
|
||||
/*
|
||||
* This describes the flash memory within the EC. Note
|
||||
* that the STM32L flash erases to 0, not 0xff.
|
||||
*/
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
flash@8000000 {
|
||||
reg = <0x08000000 0x20000>;
|
||||
erase-value = <0>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
/* Information for sandbox */
|
||||
ro {
|
||||
reg = <0 0xf000>;
|
||||
};
|
||||
wp-ro {
|
||||
reg = <0xf000 0x1000>;
|
||||
};
|
||||
rw {
|
||||
reg = <0x10000 0x10000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lcd {
|
||||
compatible = "sandbox,lcd-sdl";
|
||||
xres = <800>;
|
||||
yres = <600>;
|
||||
};
|
||||
|
||||
cros-ec-keyb {
|
||||
compatible = "google,cros-ec-keyb";
|
||||
google,key-rows = <8>;
|
||||
google,key-columns = <13>;
|
||||
google,repeat-delay-ms = <240>;
|
||||
google,repeat-rate-ms = <30>;
|
||||
google,ghost-filter;
|
||||
/*
|
||||
* Keymap entries take the form of 0xRRCCKKKK where
|
||||
* RR=Row CC=Column KKKK=Key Code
|
||||
* The values below are for a US keyboard layout and
|
||||
* are taken from the Linux driver. Note that the
|
||||
* 102ND key is not used for US keyboards.
|
||||
*/
|
||||
linux,keymap = <
|
||||
/* CAPSLCK F1 B F10 */
|
||||
0x0001003a 0x0002003b 0x00030030 0x00040044
|
||||
/* N = R_ALT ESC */
|
||||
0x00060031 0x0008000d 0x000a0064 0x01010001
|
||||
/* F4 G F7 H */
|
||||
0x0102003e 0x01030022 0x01040041 0x01060023
|
||||
/* ' F9 BKSPACE L_CTRL */
|
||||
0x01080028 0x01090043 0x010b000e 0x0200001d
|
||||
/* TAB F3 T F6 */
|
||||
0x0201000f 0x0202003d 0x02030014 0x02040040
|
||||
/* ] Y 102ND [ */
|
||||
0x0205001b 0x02060015 0x02070056 0x0208001a
|
||||
/* F8 GRAVE F2 5 */
|
||||
0x02090042 0x03010029 0x0302003c 0x03030006
|
||||
/* F5 6 - \ */
|
||||
0x0304003f 0x03060007 0x0308000c 0x030b002b
|
||||
/* R_CTRL A D F */
|
||||
0x04000061 0x0401001e 0x04020020 0x04030021
|
||||
/* S K J ; */
|
||||
0x0404001f 0x04050025 0x04060024 0x04080027
|
||||
/* L ENTER Z C */
|
||||
0x04090026 0x040b001c 0x0501002c 0x0502002e
|
||||
/* V X , M */
|
||||
0x0503002f 0x0504002d 0x05050033 0x05060032
|
||||
/* L_SHIFT / . SPACE */
|
||||
0x0507002a 0x05080035 0x05090034 0x050B0039
|
||||
/* 1 3 4 2 */
|
||||
0x06010002 0x06020004 0x06030005 0x06040003
|
||||
/* 8 7 0 9 */
|
||||
0x06050009 0x06060008 0x0608000b 0x0609000a
|
||||
/* L_ALT DOWN RIGHT Q */
|
||||
0x060a0038 0x060b006c 0x060c006a 0x07010010
|
||||
/* E R W I */
|
||||
0x07020012 0x07030013 0x07040011 0x07050017
|
||||
/* U R_SHIFT P O */
|
||||
0x07060016 0x07070036 0x07080019 0x07090018
|
||||
/* UP LEFT */
|
||||
0x070b0067 0x070c0069>;
|
||||
};
|
||||
|
||||
};
|
||||
|
|
14
arch/sandbox/include/asm/arch-sandbox/sound.h
Normal file
14
arch/sandbox/include/asm/arch-sandbox/sound.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Google, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __SANDBOX_SOUND_H
|
||||
#define __SANDBOX_SOUND_H
|
||||
|
||||
int sound_play(unsigned int msec, unsigned int frequency);
|
||||
|
||||
int sound_init(const void *blob);
|
||||
|
||||
#endif
|
118
arch/sandbox/include/asm/sdl.h
Normal file
118
arch/sandbox/include/asm/sdl.h
Normal file
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Google, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __SANDBOX_SDL_H
|
||||
#define __SANDBOX_SDL_H
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_SANDBOX_SDL
|
||||
|
||||
/**
|
||||
* sandbox_sdl_init_display() - Set up SDL video ready for use
|
||||
*
|
||||
* @width: Window width in pixels
|
||||
* @height Window height in pixels
|
||||
* @log2_bpp: Log to base 2 of the number of bits per pixel. So a 32bpp
|
||||
* display will pass 5, since 2*5 = 32
|
||||
* @return 0 if OK, -ENODEV if no device, -EIO if SDL failed to initialize
|
||||
* and -EPERM if the video failed to come up.
|
||||
*/
|
||||
int sandbox_sdl_init_display(int width, int height, int log2_bpp);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL
|
||||
*
|
||||
* This must be called periodically to update the screen for SDL so that the
|
||||
* user can see it.
|
||||
*
|
||||
* @lcd_base: Base of frame buffer
|
||||
* @return 0 if screen was updated, -ENODEV is there is no screen.
|
||||
*/
|
||||
int sandbox_sdl_sync(void *lcd_base);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_scan_keys() - scan for pressed keys
|
||||
*
|
||||
* Works out which keys are pressed and returns a list
|
||||
*
|
||||
* @key: Array to receive keycodes
|
||||
* @max_keys: Size of array
|
||||
* @return number of keycodes found, 0 if none, -ENODEV if no keyboard
|
||||
*/
|
||||
int sandbox_sdl_scan_keys(int key[], int max_keys);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_key_pressed() - check if a particular key is pressed
|
||||
*
|
||||
* @keycode: Keycode to check (KEY_... - see include/linux/input.h
|
||||
* @return 0 if pressed, -ENOENT if not pressed. -ENODEV if keybord not
|
||||
* available,
|
||||
*/
|
||||
int sandbox_sdl_key_pressed(int keycode);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_sound_start() - start playing a sound
|
||||
*
|
||||
* @frequency: Frequency of sounds in Hertz
|
||||
* @return 0 if OK, -ENODEV if no sound is available
|
||||
*/
|
||||
int sandbox_sdl_sound_start(uint frequency);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_sound_stop() - stop playing a sound
|
||||
*
|
||||
* @return 0 if OK, -ENODEV if no sound is available
|
||||
*/
|
||||
int sandbox_sdl_sound_stop(void);
|
||||
|
||||
/**
|
||||
* sandbox_sdl_sound_init() - set up the sound system
|
||||
*
|
||||
* @return 0 if OK, -ENODEV if no sound is available
|
||||
*/
|
||||
int sandbox_sdl_sound_init(void);
|
||||
|
||||
#else
|
||||
static inline int sandbox_sdl_init_display(int width, int height,
|
||||
int log2_bpp)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_sync(void *lcd_base)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_scan_keys(int key[], int max_keys)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_key_pressed(int keycode)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_sound_start(uint frequency)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_sound_stop(void)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
static inline int sandbox_sdl_sound_init(void)
|
||||
{
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -17,6 +17,29 @@ enum exit_type_id {
|
|||
STATE_EXIT_POWER_OFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* Selects the behavior of the serial terminal.
|
||||
*
|
||||
* If Ctrl-C is processed by U-Boot, then the only way to quit sandbox is with
|
||||
* the 'reset' command, or equivalent.
|
||||
*
|
||||
* If the terminal is cooked, then Ctrl-C will terminate U-Boot, and the
|
||||
* command line will not be quite such a faithful emulation.
|
||||
*
|
||||
* Options are:
|
||||
*
|
||||
* raw-with-sigs - Raw, but allow signals (Ctrl-C will quit)
|
||||
* raw - Terminal is always raw
|
||||
* cooked - Terminal is always cooked
|
||||
*/
|
||||
enum state_terminal_raw {
|
||||
STATE_TERM_RAW_WITH_SIGS, /* Default */
|
||||
STATE_TERM_RAW,
|
||||
STATE_TERM_COOKED,
|
||||
|
||||
STATE_TERM_COUNT,
|
||||
};
|
||||
|
||||
struct sandbox_spi_info {
|
||||
const char *spec;
|
||||
const struct sandbox_spi_emu_ops *ops;
|
||||
|
@ -30,16 +53,20 @@ struct sandbox_state {
|
|||
enum exit_type_id exit_type; /* How we exited U-Boot */
|
||||
const char *parse_err; /* Error to report from parsing */
|
||||
int argc; /* Program arguments */
|
||||
char **argv;
|
||||
char **argv; /* Command line arguments */
|
||||
const char *jumped_fname; /* Jumped from previous U_Boot */
|
||||
uint8_t *ram_buf; /* Emulated RAM buffer */
|
||||
unsigned int ram_size; /* Size of RAM buffer */
|
||||
const char *ram_buf_fname; /* Filename to use for RAM buffer */
|
||||
bool ram_buf_rm; /* Remove RAM buffer file after read */
|
||||
bool write_ram_buf; /* Write RAM buffer on exit */
|
||||
const char *state_fname; /* File containing sandbox state */
|
||||
void *state_fdt; /* Holds saved state for sandbox */
|
||||
bool read_state; /* Read sandbox state on startup */
|
||||
bool write_state; /* Write sandbox state on exit */
|
||||
bool ignore_missing_state_on_read; /* No error if state missing */
|
||||
bool show_lcd; /* Show LCD on start-up */
|
||||
enum state_terminal_raw term_raw; /* Terminal raw/cooked */
|
||||
|
||||
/* Pointer to information for each SPI bus/cs */
|
||||
struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
|
||||
|
|
|
@ -25,4 +25,7 @@ int sandbox_main_loop_init(void);
|
|||
|
||||
int cleanup_before_linux(void);
|
||||
|
||||
/* drivers/video/sandbox_sdl.c */
|
||||
int sandbox_lcd_sdl_early_init(void);
|
||||
|
||||
#endif /* _U_BOOT_SANDBOX_H_ */
|
||||
|
|
|
@ -1250,8 +1250,9 @@
|
|||
#define PUDR 0xA4050162
|
||||
#define PVDR 0xA4050164
|
||||
#define PWDR 0xA4050166
|
||||
#define PYDR 0xA4050168
|
||||
#define PZDR 0xA405016A
|
||||
#define PXDR 0xA4050168
|
||||
#define PYDR 0xA405016A
|
||||
#define PZDR 0xA405016C
|
||||
|
||||
/* UBC */
|
||||
#define CBR0 0xFF200000
|
||||
|
|
|
@ -178,8 +178,9 @@
|
|||
#define PUDR 0xA4050162
|
||||
#define PVDR 0xA4050164
|
||||
#define PWDR 0xA4050166
|
||||
#define PYDR 0xA4050168
|
||||
#define PZDR 0xA405016A
|
||||
#define PXDR 0xA4050168
|
||||
#define PYDR 0xA405016A
|
||||
#define PZDR 0xA405016C
|
||||
|
||||
/* UBC */
|
||||
/* H-UDI */
|
||||
|
|
|
@ -200,8 +200,9 @@
|
|||
#define PUDR 0xA4050162
|
||||
#define PVDR 0xA4050164
|
||||
#define PWDR 0xA4050166
|
||||
#define PYDR 0xA4050168
|
||||
#define PZDR 0xA405016A
|
||||
#define PXDR 0xA4050168
|
||||
#define PYDR 0xA405016A
|
||||
#define PZDR 0xA405016C
|
||||
|
||||
/* Ether */
|
||||
#define EDMR 0xA4600000
|
||||
|
|
|
@ -29,6 +29,4 @@ LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
|
|||
LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
|
||||
|
||||
export NORMAL_LIBGCC = $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
|
||||
PREFIXED_LIBGCC = $(OBJTREE)/arch/$(ARCH)/lib/$(shell basename $(NORMAL_LIBGCC))
|
||||
|
||||
CONFIG_USE_PRIVATE_LIBGCC=$(shell dirname $(PREFIXED_LIBGCC))
|
||||
CONFIG_USE_PRIVATE_LIBGCC := arch/x86/lib
|
||||
|
|
|
@ -23,5 +23,6 @@ obj-$(CONFIG_CMD_ZBOOT) += zimage.o
|
|||
LIBGCC := $(notdir $(NORMAL_LIBGCC))
|
||||
extra-y := $(LIBGCC)
|
||||
|
||||
$(obj)/$(LIBGCC): $(NORMAL_LIBGCC)
|
||||
$(OBJCOPY) $< $@ --prefix-symbols=__normal_
|
||||
OBJCOPYFLAGS := --prefix-symbols=__normal_
|
||||
$(obj)/$(LIBGCC): $(NORMAL_LIBGCC) FORCE
|
||||
$(call if_changed,objcopy)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# (mem base + reserved)
|
||||
#
|
||||
|
||||
UBL_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/ublimage.cfg
|
||||
UBL_CONFIG = $(srctree)/board/$(BOARDDIR)/ublimage.cfg
|
||||
ifndef CONFIG_SPL_BUILD
|
||||
ALL-y += u-boot.ubl
|
||||
else
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
|
||||
obj-y += fx12mm.o
|
||||
|
||||
include $(SRCTREE)/board/xilinx/ppc405-generic/Makefile
|
||||
include $(srctree)/board/xilinx/ppc405-generic/Makefile
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
|
||||
obj-y += v5fx30teval.o
|
||||
|
||||
include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile
|
||||
include $(srctree)/board/xilinx/ppc440-generic/Makefile
|
||||
|
|
|
@ -9,10 +9,19 @@ obj-y = L1.o flash.o
|
|||
obj-y += init.o
|
||||
obj-y += bootscript.o
|
||||
|
||||
$(obj)/bootscript.c: $(obj)/bootscript.image
|
||||
od -t x1 -v -A x $^ | awk -f $(srctree)/$(src)/x2c.awk > $@
|
||||
quiet_cmd_awk = AWK $@
|
||||
cmd_awk = od -t x1 -v -A x $< | $(AWK) -f $(filter-out $<,$^) > $@
|
||||
|
||||
$(obj)/bootscript.c: $(obj)/bootscript.image $(src)/x2c.awk
|
||||
$(call cmd,awk)
|
||||
|
||||
quiet_cmd_mkimage = UIMAGE $@
|
||||
cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
|
||||
$(if $(KBUILD_VERBOSE:1=), >/dev/null)
|
||||
|
||||
MKIMAGEFLAGS_bootscript.image := -A ppc -O linux -T script -C none \
|
||||
-a 0 -e 0 -n bootscript
|
||||
$(obj)/bootscript.image: $(src)/bootscript.hush
|
||||
-$(OBJTREE)/tools/mkimage -A ppc -O linux -T script -C none -a 0 -e 0 -n bootscript -d $< $@
|
||||
$(call cmd,mkimage)
|
||||
|
||||
clean-files := bootscript.c bootscript.image
|
|
@ -9,6 +9,6 @@
|
|||
# HYMOD boards
|
||||
#
|
||||
|
||||
PLATFORM_CPPFLAGS += -I$(TOPDIR)
|
||||
PLATFORM_CPPFLAGS += -I$(srctree)
|
||||
|
||||
OBJCOPYFLAGS = --remove-section=.ppcenv
|
||||
|
|
|
@ -23,5 +23,5 @@ PLATFORM_CPPFLAGS += -DCONFIG_SYS_INIT_DBCR=0x8CFF0000
|
|||
endif
|
||||
|
||||
ifndef CONFIG_KORAT_PERMANENT
|
||||
LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot-F7FC.lds
|
||||
LDSCRIPT := $(srctree)/board/$(BOARDDIR)/u-boot-F7FC.lds
|
||||
endif
|
||||
|
|
|
@ -8,5 +8,11 @@ obj-y := mvblm7.o pci.o fpga.o
|
|||
|
||||
extra-y := bootscript.img
|
||||
|
||||
quiet_cmd_mkimage = UIMAGE $@
|
||||
cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
|
||||
$(if $(KBUILD_VERBOSE:1=), >/dev/null)
|
||||
|
||||
MKIMAGEFLAGS_bootscript.image := -T script -C none -n M7_script
|
||||
|
||||
$(obj)/bootscript.img: $(src)/bootscript
|
||||
@mkimage -T script -C none -n M7_script -d $< $@
|
||||
$(call cmd,mkimage)
|
||||
|
|
|
@ -12,5 +12,11 @@ obj-y := mvsmr.o fpga.o
|
|||
|
||||
extra-y := bootscript.img
|
||||
|
||||
quiet_cmd_mkimage = UIMAGE $@
|
||||
cmd_mkimage = $(objtree)/tools/mkimage $(MKIMAGEFLAGS_$(@F)) -d $< $@ \
|
||||
$(if $(KBUILD_VERBOSE:1=), >/dev/null)
|
||||
|
||||
MKIMAGEFLAGS_bootscript.image := -T script -C none -n mvSMR_Script
|
||||
|
||||
$(obj)/bootscript.img: $(src)/bootscript
|
||||
@mkimage -T script -C none -n mvSMR_Script -d $< $@
|
||||
$(call cmd,mkimage)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
lowlevel_init:
|
||||
|
||||
/* jump to 0xA0020000 if bit 1 of PVDR_A */
|
||||
/* jump to CONFIG_ECOVEC_ROMIMAGE_ADDR if bit 1 of PVDR_A */
|
||||
mov.l PVDR_A, r1
|
||||
mov.l PVDR_D, r2
|
||||
mov.b @r1, r0
|
||||
|
|
|
@ -27,13 +27,6 @@
|
|||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
struct local_info {
|
||||
struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */
|
||||
int cros_ec_err; /* Error for cros_ec, 0 if ok */
|
||||
};
|
||||
|
||||
static struct local_info local;
|
||||
|
||||
int __exynos_early_init_f(void)
|
||||
{
|
||||
return 0;
|
||||
|
@ -159,22 +152,6 @@ int board_early_init_f(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
struct cros_ec_dev *board_get_cros_ec_dev(void)
|
||||
{
|
||||
return local.cros_ec_dev;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CROS_EC
|
||||
static int board_init_cros_ec_devices(const void *blob)
|
||||
{
|
||||
local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev);
|
||||
if (local.cros_ec_err)
|
||||
return -1; /* Will report in board_late_init() */
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_POWER)
|
||||
int power_init_board(void)
|
||||
{
|
||||
|
@ -302,12 +279,12 @@ int board_late_init(void)
|
|||
{
|
||||
stdio_print_current_devices();
|
||||
|
||||
if (local.cros_ec_err) {
|
||||
if (cros_ec_get_error()) {
|
||||
/* Force console on */
|
||||
gd->flags &= ~GD_FLG_SILENT;
|
||||
|
||||
printf("cros-ec communications failure %d\n",
|
||||
local.cros_ec_err);
|
||||
cros_ec_get_error());
|
||||
puts("\nPlease reset with Power+Refresh\n\n");
|
||||
panic("Cannot init cros-ec device");
|
||||
return -1;
|
||||
|
@ -319,7 +296,7 @@ int board_late_init(void)
|
|||
int arch_early_init_r(void)
|
||||
{
|
||||
#ifdef CONFIG_CROS_EC
|
||||
if (board_init_cros_ec_devices(gd->fdt_blob)) {
|
||||
if (cros_ec_board_init()) {
|
||||
printf("%s: Failed to init EC\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <cros_ec.h>
|
||||
#include <fdtdec.h>
|
||||
#include <asm/io.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -4,8 +4,10 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <cros_ec.h>
|
||||
#include <dm.h>
|
||||
#include <os.h>
|
||||
#include <asm/u-boot-sandbox.h>
|
||||
|
||||
/*
|
||||
* Pointer to initial global data area
|
||||
|
@ -33,3 +35,49 @@ int dram_init(void)
|
|||
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
#ifdef CONFIG_VIDEO_SANDBOX_SDL
|
||||
int ret;
|
||||
|
||||
ret = sandbox_lcd_sdl_early_init();
|
||||
if (ret) {
|
||||
puts("Could not init sandbox LCD emulation\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int arch_early_init_r(void)
|
||||
{
|
||||
#ifdef CONFIG_CROS_EC
|
||||
if (cros_ec_board_init()) {
|
||||
printf("%s: Failed to init EC\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_BOARD_LATE_INIT
|
||||
int board_late_init(void)
|
||||
{
|
||||
if (cros_ec_get_error()) {
|
||||
/* Force console on */
|
||||
gd->flags &= ~GD_FLG_SILENT;
|
||||
|
||||
printf("cros-ec communications failure %d\n",
|
||||
cros_ec_get_error());
|
||||
puts("\nPlease reset with Power+Refresh\n\n");
|
||||
panic("Cannot init cros-ec device");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
|
||||
obj-y += ml507.o
|
||||
|
||||
include $(SRCTREE)/board/xilinx/ppc440-generic/Makefile
|
||||
include $(srctree)/board/xilinx/ppc440-generic/Makefile
|
||||
|
|
162
boards.cfg
162
boards.cfg
|
@ -44,8 +44,8 @@
|
|||
###########################################################################################################
|
||||
|
||||
Active aarch64 armv8 - armltd vexpress64 vexpress_aemv8a vexpress_aemv8a:ARM64 David Feng <fenghua@phytium.com.cn>
|
||||
Active arc arc700 - synopsys <none> arcangel4 - Alexey Brodkin <abrodkin@synopsys.com>
|
||||
Active arc arc700 - synopsys - axs101 - Alexey Brodkin <abrodkin@synopsys.com>
|
||||
Active arc arc700 - synopsys <none> arcangel4 - Alexey Brodkin <abrodkin@synopsys.com>
|
||||
Active arc arc700 - synopsys <none> arcangel4-be - Alexey Brodkin <abrodkin@synopsys.com>
|
||||
Active arm arm1136 - armltd integrator integratorcp_cm1136 integratorcp:CM1136 Linus Walleij <linus.walleij@linaro.org>
|
||||
Active arm arm1136 mx31 - - imx31_phycore - -
|
||||
|
@ -252,6 +252,10 @@ Active arm arm946es - armltd integrator
|
|||
Active arm armv7 - armltd vexpress vexpress_ca15_tc2 - -
|
||||
Active arm armv7 - armltd vexpress vexpress_ca5x2 - Matt Waddel <matt.waddel@linaro.org>
|
||||
Active arm armv7 - armltd vexpress vexpress_ca9x4 - Matt Waddel <matt.waddel@linaro.org>
|
||||
Active arm armv7 am33xx BuR kwb kwb kwb:SERIAL1,CONS_INDEX=1 Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_mmc tseries:SERIAL1,CONS_INDEX=1,EMMC_BOOT Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_nand tseries:SERIAL1,CONS_INDEX=1,NAND Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_spi tseries:SERIAL1,CONS_INDEX=1,SPI_BOOT,EMMC_BOOT Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx compulab cm_t335 cm_t335 - Igor Grinberg <grinberg@compulab.co.il>
|
||||
Active arm armv7 am33xx isee igep0033 am335x_igep0033 - Enric Balletbo i Serra <eballetbo@iseebcn.com>
|
||||
Active arm armv7 am33xx phytec pcm051 pcm051_rev1 pcm051:REV1 Lars Poeschel <poeschel@lemonage.de>
|
||||
|
@ -260,10 +264,6 @@ Active arm armv7 am33xx siemens dxr2
|
|||
Active arm armv7 am33xx siemens pxm2 pxm2 - Roger Meier <r.meier@siemens.com>
|
||||
Active arm armv7 am33xx siemens rut rut - Roger Meier <r.meier@siemens.com>
|
||||
Active arm armv7 am33xx silica pengwyn pengwyn - Lothar Felten <lothar.felten@gmail.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_nand tseries:SERIAL1,CONS_INDEX=1,NAND Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_mmc tseries:SERIAL1,CONS_INDEX=1,EMMC_BOOT Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR tseries tseries_spi tseries:SERIAL1,CONS_INDEX=1,SPI_BOOT,EMMC_BOOT Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx BuR kwb kwb kwb:SERIAL1,CONS_INDEX=1 Hannes Petermaier <hannes.petermaier@br-automation.com>
|
||||
Active arm armv7 am33xx ti am335x am335x_boneblack am335x_evm:SERIAL1,CONS_INDEX=1,EMMC_BOOT Tom Rini <trini@ti.com>
|
||||
Active arm armv7 am33xx ti am335x am335x_evm am335x_evm:SERIAL1,CONS_INDEX=1,NAND Tom Rini <trini@ti.com>
|
||||
Active arm armv7 am33xx ti am335x am335x_evm_nor am335x_evm:SERIAL1,CONS_INDEX=1,NAND,NOR Tom Rini <trini@ti.com>
|
||||
|
@ -422,40 +422,32 @@ Active avr32 at32ap at32ap700x in-circuit -
|
|||
Active avr32 at32ap at32ap700x mimc - mimc200 - Mark Jackson <mpfj@mimc.co.uk>
|
||||
Active avr32 at32ap at32ap700x miromico - hammerhead - Julien May <julien.may@miromico.ch>:Alex Raimondi <alex.raimondi@miromico.ch>
|
||||
Active blackfin blackfin - - - bct-brettl2 - Peter Meerwald <devel@bct-electronic.com>
|
||||
Active blackfin blackfin - - - bf506f-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf518f-ezbrd - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf506f-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf518f-ezbrd - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf525-ucr2 - Haitao Zhang <hzhang@ucrobotics.com>:Chong Huang <chuang@ucrobotics.com>
|
||||
Active blackfin blackfin - - - bf526-ezbrd - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf527-ad7160-eval - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf527-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf527-sdp - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf533-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf533-stamp - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf526-ezbrd - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf527-ad7160-eval - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf527-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf527-sdp - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf533-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf533-stamp - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf537-minotaur - Martin Strubel <strubel@section5.ch>
|
||||
Active blackfin blackfin - - - bf537-pnav - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf537-pnav - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf537-srv1 - Martin Strubel <strubel@section5.ch>
|
||||
Active blackfin blackfin - - - bf537-stamp - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf538f-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf548-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf537-stamp - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf538f-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf548-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf561-acvilon - Anton Shurpin <shurpin.aa@niistt.ru>:Valentin Yakovenkov <yakovenkov@niistt.ru>
|
||||
Active blackfin blackfin - - - bf561-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf609-ezkit - Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - bf561-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - bf609-ezkit - Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active blackfin blackfin - - - blackstamp - Wojtek Skulski <skulski@pas.rochester.edu>:Wojtek Skulski <info@skutek.com>:Benjamin Matthews <mben12@gmail.com>
|
||||
Active blackfin blackfin - - - blackvme - Wojtek Skulski <skulski@pas.rochester.edu>:Wojtek Skulski <info@skutek.com>:Benjamin Matthews <mben12@gmail.com>
|
||||
Active blackfin blackfin - - - br4 - Dimitar Penev <dpn@switchfin.org>
|
||||
Active blackfin blackfin - - - cm-bf527 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - cm-bf533 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - cm-bf537e - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - cm-bf537u - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - cm-bf548 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - cm-bf561 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - dnp5370 - M.Hasewinkel (MHA) <info@ssv-embedded.de>
|
||||
Active blackfin blackfin - - - ibf-dsp561 - I-SYST Micromodule <support@i-syst.com>
|
||||
Active blackfin blackfin - - - ip04 - Brent Kandetzki <brentk@teleco.com>
|
||||
Active blackfin blackfin - - - pr1 - Dimitar Penev <dpn@switchfin.org>
|
||||
Active blackfin blackfin - - - tcm-bf518 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - - tcm-bf537 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - bf527-ezkit bf527-ezkit-v2 bf527-ezkit:BF527_EZKIT_REV_2_1 Sonic Zhang <sonic.adi@gmail.com>:Blackfin Team <u-boot-devel@blackfin.uclinux.org>
|
||||
Active blackfin blackfin - - bf527-ezkit bf527-ezkit-v2 bf527-ezkit:BF527_EZKIT_REV_2_1 Sonic Zhang <sonic.adi@gmail.com>
|
||||
Active m68k mcf5227x - freescale m52277evb M52277EVB M52277EVB:SYS_SPANSION_BOOT,SYS_TEXT_BASE=0x00000000 TsiChung Liew <Tsi-Chung.Liew@freescale.com>
|
||||
Active m68k mcf5227x - freescale m52277evb M52277EVB_stmicro M52277EVB:CF_SBF,SYS_STMICRO_BOOT,SYS_TEXT_BASE=0x43E00000 TsiChung Liew <Tsi-Chung.Liew@freescale.com>
|
||||
Active m68k mcf523x - freescale m5235evb M5235EVB M5235EVB:SYS_TEXT_BASE=0xFFE00000 TsiChung Liew <Tsi-Chung.Liew@freescale.com>
|
||||
|
@ -627,8 +619,6 @@ Active powerpc mpc5xxx - intercontrol digsy_mtc
|
|||
Active powerpc mpc5xxx - manroland - hmi1001 - -
|
||||
Active powerpc mpc5xxx - manroland - mucmc52 - Heiko Schocher <hs@denx.de>
|
||||
Active powerpc mpc5xxx - manroland - uc101 - Heiko Schocher <hs@denx.de>
|
||||
Active powerpc mpc5xxx - matrix_vision mvbc_p MVBC_P MVBC_P:MVBC_P Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Active powerpc mpc5xxx - matrix_vision mvsmr MVSMR - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Active powerpc mpc5xxx - phytec pcm030 pcm030 - Jon Smirl <jonsmirl@gmail.com>
|
||||
Active powerpc mpc5xxx - phytec pcm030 pcm030_LOWBOOT pcm030:SYS_TEXT_BASE=0xFF000000 Jon Smirl <jonsmirl@gmail.com>
|
||||
Active powerpc mpc5xxx - tqc tqm5200 aev - -
|
||||
|
@ -651,13 +641,10 @@ Active powerpc mpc824x - - cpc45
|
|||
Active powerpc mpc824x - - cpc45 CPC45_ROMBOOT CPC45:BOOT_ROM Josef Wagner <Wagner@Microsys.de>
|
||||
Active powerpc mpc824x - - cu824 CU824 - Wolfgang Denk <wd@denx.de>
|
||||
Active powerpc mpc824x - - eXalion eXalion - Torsten Demke <torsten.demke@fci.com>
|
||||
Active powerpc mpc824x - - hidden_dragon HIDDEN_DRAGON - Yusdi Santoso <yusdi_santoso@adaptec.com>
|
||||
Active powerpc mpc824x - - musenki MUSENKI - Jim Thompson <jim@musenki.com>
|
||||
Active powerpc mpc824x - - mvblue MVBLUE - -
|
||||
Active powerpc mpc824x - - sandpoint Sandpoint8240 - Wolfgang Denk <wd@denx.de>
|
||||
Active powerpc mpc824x - - sandpoint Sandpoint8245 - Jim Thompson <jim@musenki.com>
|
||||
Active powerpc mpc824x - etin - debris - Sangmoon Kim <dogoil@etinsys.com>
|
||||
Active powerpc mpc824x - etin - kvme080 - Sangmoon Kim <dogoil@etinsys.com>
|
||||
Active powerpc mpc8260 - - - atc - Wolfgang Denk <wd@denx.de>
|
||||
Active powerpc mpc8260 - - - ep8260 - Frank Panno <fpanno@delphintech.com>
|
||||
Active powerpc mpc8260 - - - ep82xxm - -
|
||||
|
@ -670,11 +657,8 @@ Active powerpc mpc8260 - - cpu86
|
|||
Active powerpc mpc8260 - - cpu86 CPU86_ROMBOOT CPU86:BOOT_ROM Wolfgang Denk <wd@denx.de>
|
||||
Active powerpc mpc8260 - - cpu87 CPU87 - -
|
||||
Active powerpc mpc8260 - - cpu87 CPU87_ROMBOOT CPU87:BOOT_ROM -
|
||||
Active powerpc mpc8260 - - ep8248 ep8248 - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - - ids8247 IDS8247 - Heiko Schocher <hs@denx.de>
|
||||
Active powerpc mpc8260 - - iphase4539 IPHASE4539 - Wolfgang Grandegger <wg@denx.de>
|
||||
Active powerpc mpc8260 - - ispan ISPAN - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - - ispan ISPAN_REVB ISPAN:SYS_REV_B Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - - muas3001 muas3001 - Heiko Schocher <hs@denx.de>
|
||||
Active powerpc mpc8260 - - muas3001 muas3001_dev muas3001:MUAS_DEV_BOARD Heiko Schocher <hs@denx.de>
|
||||
Active powerpc mpc8260 - - pm826 PM825 PM826:PCI,SYS_TEXT_BASE=0xFF000000 Wolfgang Denk <wd@denx.de>
|
||||
|
@ -689,25 +673,6 @@ Active powerpc mpc8260 - - pm828
|
|||
Active powerpc mpc8260 - - pm828 PM828_PCI PM828:PCI -
|
||||
Active powerpc mpc8260 - - pm828 PM828_ROMBOOT PM828:BOOT_ROM,SYS_TEXT_BASE=0xFF800000 -
|
||||
Active powerpc mpc8260 - - pm828 PM828_ROMBOOT_PCI PM828:PCI,BOOT_ROM,SYS_TEXT_BASE=0xFF800000 -
|
||||
Active powerpc mpc8260 - - rattler Rattler - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - - rattler Rattler8248 Rattler:MPC8248 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - - zpc1900 ZPC1900 - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_33MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_33MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_40MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_40MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8272ADS MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads MPC8272ADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-VR MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-VR_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_66MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_66MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8260ads PQ2FADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8260 - freescale mpc8266ads MPC8266ADS - Rune Torgersen <runet@innovsys.com>
|
||||
Active powerpc mpc8260 - funkwerk vovpn-gw VoVPN-GW_66MHz VoVPN-GW:CLKIN_66MHz -
|
||||
Active powerpc mpc8260 - keymile km82xx mgcoge km82xx:MGCOGE Holger Brunck <holger.brunck@keymile.com>
|
||||
|
@ -758,8 +723,6 @@ Active powerpc mpc83xx - freescale mpc8360emds
|
|||
Active powerpc mpc83xx - freescale mpc8360emds MPC8360EMDS_66_HOST_33 MPC8360EMDS:CLKIN_66MHZ,PCI,PCI_33M,PQ_MDS_PIB=1 Dave Liu <daveliu@freescale.com>
|
||||
Active powerpc mpc83xx - freescale mpc8360emds MPC8360EMDS_66_HOST_66 MPC8360EMDS:CLKIN_66MHZ,PCI,PCI_66M,PQ_MDS_PIB=1 Dave Liu <daveliu@freescale.com>
|
||||
Active powerpc mpc83xx - freescale mpc8360emds MPC8360EMDS_66_SLAVE MPC8360EMDS:CLKIN_66MHZ,PCI,PCISLAVE Dave Liu <daveliu@freescale.com>
|
||||
Active powerpc mpc83xx - freescale mpc8360erdk MPC8360ERDK - Anton Vorontsov <avorontsov@ru.mvista.com>
|
||||
Active powerpc mpc83xx - freescale mpc8360erdk MPC8360ERDK_33 MPC8360ERDK:CLKIN_33MHZ Anton Vorontsov <avorontsov@ru.mvista.com>
|
||||
Active powerpc mpc83xx - freescale mpc837xemds MPC837XEMDS - Dave Liu <daveliu@freescale.com>
|
||||
Active powerpc mpc83xx - freescale mpc837xemds MPC837XEMDS_HOST MPC837XEMDS:PCI Dave Liu <daveliu@freescale.com>
|
||||
Active powerpc mpc83xx - freescale mpc837xerdb MPC837XERDB - Joe D'Abbraccio <ljd015@freescale.com>
|
||||
|
@ -771,8 +734,6 @@ Active powerpc mpc83xx - keymile km83xx
|
|||
Active powerpc mpc83xx - keymile km83xx suvd3 suvd3:SUVD3 Holger Brunck <holger.brunck@keymile.com>
|
||||
Active powerpc mpc83xx - keymile km83xx tuge1 tuxx1:TUGE1 Holger Brunck <holger.brunck@keymile.com>
|
||||
Active powerpc mpc83xx - keymile km83xx tuxx1 tuxx1:TUXX1 Holger Brunck <holger.brunck@keymile.com>
|
||||
Active powerpc mpc83xx - matrix_vision mergerbox MERGERBOX - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Active powerpc mpc83xx - matrix_vision mvblm7 MVBLM7 - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Active powerpc mpc83xx - sheldon simpc8313 SIMPC8313_LP SIMPC8313:NAND_LP Ron Madrid <info@sheldoninst.com>
|
||||
Active powerpc mpc83xx - sheldon simpc8313 SIMPC8313_SP SIMPC8313:NAND_SP Ron Madrid <info@sheldoninst.com>
|
||||
Active powerpc mpc83xx - tqc tqm834x TQM834x - -
|
||||
|
@ -978,21 +939,21 @@ Active powerpc mpc85xx - freescale p2041rdb
|
|||
Active powerpc mpc85xx - freescale t1040qds T1040QDS T1040QDS:PPC_T1040 Poonam Aggrwal <poonam.aggrwal@freescale.com>
|
||||
Active powerpc mpc85xx - freescale t104xrdb T1040RDB T1040RDB:PPC_T1040 Poonam Aggrwal <poonam.aggrwal@freescale.com>
|
||||
Active powerpc mpc85xx - freescale t104xrdb T1042RDB_PI T1042RDB_PI:PPC_T1042 Poonam Aggrwal <poonam.aggrwal@freescale.com>
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS T208xQDS:PPC_T2080
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SDCARD T208xQDS:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SPIFLASH T208xQDS:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_NAND T208xQDS:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SRIO_PCIE_BOOT T208xQDS:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS T208xQDS:PPC_T2081
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SDCARD T208xQDS:PPC_T2081,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SPIFLASH T208xQDS:PPC_T2081,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_NAND T208xQDS:PPC_T2081,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SRIO_PCIE_BOOT T208xQDS:PPC_T2081,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB T208xRDB:PPC_T2080
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SDCARD T208xRDB:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SPIFLASH T208xRDB:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_NAND T208xRDB:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SRIO_PCIE_BOOT T208xRDB:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS T208xQDS:PPC_T2080 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_NAND T208xQDS:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SDCARD T208xQDS:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SPIFLASH T208xQDS:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2080QDS_SRIO_PCIE_BOOT T208xQDS:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS T208xQDS:PPC_T2081 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_NAND T208xQDS:PPC_T2081,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SDCARD T208xQDS:PPC_T2081,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SPIFLASH T208xQDS:PPC_T2081,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xqds T2081QDS_SRIO_PCIE_BOOT T208xQDS:PPC_T2081,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB T208xRDB:PPC_T2080 -
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_NAND T208xRDB:PPC_T2080,RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SDCARD T208xRDB:PPC_T2080,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SPIFLASH T208xRDB:PPC_T2080,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t208xrdb T2080RDB_SRIO_PCIE_BOOT T208xRDB:PPC_T2080,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t4qds T4160QDS T4240QDS:PPC_T4160 -
|
||||
Active powerpc mpc85xx - freescale t4qds T4160QDS_SDCARD T4240QDS:PPC_T4160,RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF40000 -
|
||||
Active powerpc mpc85xx - freescale t4qds T4160QDS_SPIFLASH T4240QDS:PPC_T4160,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF40000 -
|
||||
|
@ -1026,8 +987,6 @@ Active powerpc mpc8xx - - -
|
|||
Active powerpc mpc8xx - - - spc1920 - -
|
||||
Active powerpc mpc8xx - - - svm_sc8xx - John Zhan <zhanz@sinovee.com>
|
||||
Active powerpc mpc8xx - - - v37 - -
|
||||
Active powerpc mpc8xx - - adder Adder - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8xx - - adder AdderII Adder:MPC852T Yuli Barcohen <yuli@arabellasw.com>
|
||||
Active powerpc mpc8xx - - cogent cogent_mpc8xx - Murray Jensen <Murray.Jensen@csiro.au>
|
||||
Active powerpc mpc8xx - - esteem192e ESTEEM192E - Conn Clark <clark@esteem.com>
|
||||
Active powerpc mpc8xx - - fads MPC86xADS - -
|
||||
|
@ -1120,7 +1079,6 @@ Active powerpc ppc4xx - - w7o
|
|||
Active powerpc ppc4xx - - w7o W7OLMG - Erik Theisen <etheisen@mindspring.com>
|
||||
Active powerpc ppc4xx - amcc - acadia - Stefan Roese <sr@denx.de>
|
||||
Active powerpc ppc4xx - amcc - bamboo - Stefan Roese <sr@denx.de>
|
||||
Active powerpc ppc4xx - amcc - bluestone - Tirumala Marri <tmarri@apm.com>
|
||||
Active powerpc ppc4xx - amcc - bubinga - -
|
||||
Active powerpc ppc4xx - amcc - ebony - Stefan Roese <sr@denx.de>
|
||||
Active powerpc ppc4xx - amcc - katmai - Stefan Roese <sr@denx.de>
|
||||
|
@ -1148,7 +1106,6 @@ Active powerpc ppc4xx - avnet fx12mm
|
|||
Active powerpc ppc4xx - avnet fx12mm fx12mm_flash fx12mm:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc405-generic/init.o Georg Schardt <schardt@team-ctech.de>
|
||||
Active powerpc ppc4xx - avnet v5fx30teval v5fx30teval v5fx30teval:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,BOOT_FROM_XMD=1,INIT_TLB=board/xilinx/ppc440-generic/init.o Ricardo Ribalda <ricardo.ribalda@uam.es>
|
||||
Active powerpc ppc4xx - avnet v5fx30teval v5fx30teval_flash v5fx30teval:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc440-generic/init.o Ricardo Ribalda <ricardo.ribalda@uam.es>
|
||||
Active powerpc ppc4xx - cray L1 CRAYL1 - David Updegraff <dave@cray.com>
|
||||
Active powerpc ppc4xx - dave PPChameleonEVB CATcenter CATcenter:PPCHAMELEON_MODULE_MODEL=1 -
|
||||
Active powerpc ppc4xx - dave PPChameleonEVB CATcenter_25 CATcenter:PPCHAMELEON_MODULE_MODEL=1,PPCHAMELEON_CLK_25 -
|
||||
Active powerpc ppc4xx - dave PPChameleonEVB CATcenter_33 CATcenter:PPCHAMELEON_MODULE_MODEL=1,PPCHAMELEON_CLK_33 -
|
||||
|
@ -1198,8 +1155,6 @@ Active powerpc ppc4xx - mpl mip405
|
|||
Active powerpc ppc4xx - mpl pip405 PIP405 - Denis Peter <d.peter@mpl.ch>
|
||||
Active powerpc ppc4xx - prodrive - alpr - Stefan Roese <sr@denx.de>
|
||||
Active powerpc ppc4xx - prodrive - p3p440 - Stefan Roese <sr@denx.de>
|
||||
Active powerpc ppc4xx - sandburst karef KAREF - Travis Sawyer (travis.sawyer@sandburst.com>
|
||||
Active powerpc ppc4xx - sandburst metrobox METROBOX - Travis Sawyer (travis.sawyer@sandburst.com>
|
||||
Active powerpc ppc4xx - xes - xpedite1000 - Peter Tyser <ptyser@xes-inc.com>
|
||||
Active powerpc ppc4xx - xilinx ml507 ml507 ml507:SYS_TEXT_BASE=0x04000000,RESET_VECTOR_ADDRESS=0x04100000,BOOT_FROM_XMD=1,INIT_TLB=board/xilinx/ppc440-generic/init.o Ricardo Ribalda <ricardo.ribalda@uam.es>
|
||||
Active powerpc ppc4xx - xilinx ml507 ml507_flash ml507:SYS_TEXT_BASE=0xF7F60000,RESET_VECTOR_ADDRESS=0xF7FFFFFC,INIT_TLB=board/xilinx/ppc440-generic/init.o Ricardo Ribalda <ricardo.ribalda@uam.es>
|
||||
|
@ -1236,6 +1191,53 @@ Active sparc leon3 - gaisler -
|
|||
Active sparc leon3 - gaisler - gr_xc3s_1500 - -
|
||||
Active sparc leon3 - gaisler - grsim - -
|
||||
Active x86 x86 coreboot chromebook-x86 coreboot coreboot-x86 coreboot:SYS_TEXT_BASE=0x01110000 -
|
||||
# The following were moved to "Orphan" in March, 2014
|
||||
Orphan blackfin blackfin - - - cm-bf527 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - cm-bf533 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - cm-bf537e - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - cm-bf537u - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - cm-bf548 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - cm-bf561 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - tcm-bf518 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan blackfin blackfin - - - tcm-bf537 - Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
|
||||
Orphan powerpc mpc5xxx - matrix_vision mvbc_p MVBC_P MVBC_P:MVBC_P Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Orphan powerpc mpc5xxx - matrix_vision mvsmr MVSMR - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Orphan powerpc mpc824x - - hidden_dragon HIDDEN_DRAGON - Yusdi Santoso <yusdi_santoso@adaptec.com>
|
||||
Orphan powerpc mpc824x - etin - debris - Sangmoon Kim <dogoil@etinsys.com>
|
||||
Orphan powerpc mpc824x - etin - kvme080 - Sangmoon Kim <dogoil@etinsys.com>
|
||||
Orphan powerpc mpc8260 - - ep8248 ep8248 - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - - ispan ISPAN - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - - ispan ISPAN_REVB ISPAN:SYS_REV_B Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - - rattler Rattler - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - - rattler Rattler8248 Rattler:MPC8248 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - - zpc1900 ZPC1900 - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_33MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_33MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_40MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_40MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8260ADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8272ADS MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads MPC8272ADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-VR MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-VR_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_66MHz MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_66MHz_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS-ZU_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8260 - freescale mpc8260ads PQ2FADS_lowboot MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc83xx - freescale mpc8360erdk MPC8360ERDK - Anton Vorontsov <avorontsov@ru.mvista.com>
|
||||
Orphan powerpc mpc83xx - freescale mpc8360erdk MPC8360ERDK_33 MPC8360ERDK:CLKIN_33MHZ Anton Vorontsov <avorontsov@ru.mvista.com>
|
||||
Orphan powerpc mpc83xx - matrix_vision mergerbox MERGERBOX - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Orphan powerpc mpc83xx - matrix_vision mvblm7 MVBLM7 - Andre Schwarz <andre.schwarz@matrix-vision.de>
|
||||
Orphan powerpc mpc8xx - - adder Adder - Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc mpc8xx - - adder AdderII Adder:MPC852T Yuli Barcohen <yuli@arabellasw.com>
|
||||
Orphan powerpc ppc4xx - amcc - bluestone - Tirumala Marri <tmarri@apm.com>
|
||||
Orphan powerpc ppc4xx - cray L1 CRAYL1 - David Updegraff <dave@cray.com>
|
||||
Orphan powerpc ppc4xx - sandburst karef KAREF - Travis Sawyer <travis.sawyer@sandburst.com>
|
||||
Orphan powerpc ppc4xx - sandburst metrobox METROBOX - Travis Sawyer <travis.sawyer@sandburst.com>
|
||||
# The following were move to "Orphan" in September, 2013
|
||||
Orphan arm arm1136 mx31 - imx31_phycore imx31_phycore_eet imx31_phycore:IMX31_PHYCORE_EET (resigned) Guennadi Liakhovetski <g.liakhovetski@gmx.de>
|
||||
Orphan arm arm1136 mx31 freescale - mx31ads - (resigned) Guennadi Liakhovetski <g.liakhovetski@gmx.de>
|
||||
Orphan arm pxa - - - lubbock - (dead address) Kyle Harris <kharris@nexus-tech.net>
|
||||
|
|
|
@ -230,6 +230,7 @@ obj-$(SPD) += ddr_spd.o
|
|||
obj-$(CONFIG_HWCONFIG) += hwconfig.o
|
||||
obj-$(CONFIG_BOUNCE_BUFFER) += bouncebuf.o
|
||||
obj-y += console.o
|
||||
obj-$(CONFIG_CROS_EC) += cros_ec.o
|
||||
obj-y += dlmalloc.o
|
||||
obj-y += image.o
|
||||
obj-$(CONFIG_OF_LIBFDT) += image-fdt.o
|
||||
|
|
|
@ -282,45 +282,39 @@ __weak int arch_cpu_init(void)
|
|||
|
||||
#ifdef CONFIG_OF_HOSTFILE
|
||||
|
||||
#define CHECK(x) err = (x); if (err) goto failed;
|
||||
|
||||
/* Create an empty device tree blob */
|
||||
static int make_empty_fdt(void *fdt)
|
||||
{
|
||||
int err;
|
||||
|
||||
CHECK(fdt_create(fdt, 256));
|
||||
CHECK(fdt_finish_reservemap(fdt));
|
||||
CHECK(fdt_begin_node(fdt, ""));
|
||||
CHECK(fdt_end_node(fdt));
|
||||
CHECK(fdt_finish(fdt));
|
||||
|
||||
return 0;
|
||||
failed:
|
||||
printf("Unable to create empty FDT: %s\n", fdt_strerror(err));
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
static int read_fdt_from_file(void)
|
||||
{
|
||||
struct sandbox_state *state = state_get_current();
|
||||
const char *fname = state->fdt_fname;
|
||||
void *blob;
|
||||
int size;
|
||||
ssize_t size;
|
||||
int err;
|
||||
int fd;
|
||||
|
||||
blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0);
|
||||
if (!state->fdt_fname) {
|
||||
err = make_empty_fdt(blob);
|
||||
err = fdt_create_empty_tree(blob, 256);
|
||||
if (!err)
|
||||
goto done;
|
||||
return err;
|
||||
printf("Unable to create empty FDT: %s\n", fdt_strerror(err));
|
||||
return -EINVAL;
|
||||
}
|
||||
err = fs_set_blk_dev("host", NULL, FS_TYPE_SANDBOX);
|
||||
if (err)
|
||||
return err;
|
||||
size = fs_read(state->fdt_fname, CONFIG_SYS_FDT_LOAD_ADDR, 0, 0);
|
||||
if (size < 0)
|
||||
|
||||
size = os_get_filesize(fname);
|
||||
if (size < 0) {
|
||||
printf("Failed to file FDT file '%s'\n", fname);
|
||||
return -ENOENT;
|
||||
}
|
||||
fd = os_open(fname, OS_O_RDONLY);
|
||||
if (fd < 0) {
|
||||
printf("Failed to open FDT file '%s'\n", fname);
|
||||
return -EACCES;
|
||||
}
|
||||
if (os_read(fd, blob, size) != size) {
|
||||
os_close(fd);
|
||||
return -EIO;
|
||||
}
|
||||
os_close(fd);
|
||||
|
||||
done:
|
||||
gd->fdt_blob = blob;
|
||||
|
|
44
common/cros_ec.c
Normal file
44
common/cros_ec.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*
|
||||
* Alternatively, this software may be distributed under the terms of the
|
||||
* GNU General Public License ("GPL") version 2 as published by the Free
|
||||
* Software Foundation.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <cros_ec.h>
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
struct local_info {
|
||||
struct cros_ec_dev *cros_ec_dev; /* Pointer to cros_ec device */
|
||||
int cros_ec_err; /* Error for cros_ec, 0 if ok */
|
||||
};
|
||||
|
||||
static struct local_info local;
|
||||
|
||||
struct cros_ec_dev *board_get_cros_ec_dev(void)
|
||||
{
|
||||
return local.cros_ec_dev;
|
||||
}
|
||||
|
||||
static int board_init_cros_ec_devices(const void *blob)
|
||||
{
|
||||
local.cros_ec_err = cros_ec_init(blob, &local.cros_ec_dev);
|
||||
if (local.cros_ec_err)
|
||||
return -1; /* Will report in board_late_init() */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cros_ec_board_init(void)
|
||||
{
|
||||
return board_init_cros_ec_devices(gd->fdt_blob);
|
||||
}
|
||||
|
||||
int cros_ec_get_error(void)
|
||||
{
|
||||
return local.cros_ec_err;
|
||||
}
|
21
common/lcd.c
21
common/lcd.c
|
@ -28,6 +28,8 @@
|
|||
#include <watchdog.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <splash.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
|
||||
defined(CONFIG_CPU_MONAHANS)
|
||||
|
@ -63,6 +65,10 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SANDBOX
|
||||
#include <asm/sdl.h>
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_LCD_ALIGNMENT
|
||||
#define CONFIG_LCD_ALIGNMENT PAGE_SIZE
|
||||
#endif
|
||||
|
@ -144,6 +150,13 @@ void lcd_sync(void)
|
|||
if (lcd_flush_dcache)
|
||||
flush_dcache_range((u32)lcd_base,
|
||||
(u32)(lcd_base + lcd_get_size(&line_length)));
|
||||
#elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL)
|
||||
static ulong last_sync;
|
||||
|
||||
if (get_timer(last_sync) > 10) {
|
||||
sandbox_sdl_sync(lcd_base);
|
||||
last_sync = get_timer(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -403,7 +416,7 @@ int drv_lcd_init(void)
|
|||
struct stdio_dev lcddev;
|
||||
int rc;
|
||||
|
||||
lcd_base = (void *) gd->fb_base;
|
||||
lcd_base = map_sysmem(gd->fb_base, 0);
|
||||
|
||||
lcd_init(lcd_base); /* LCD initialization */
|
||||
|
||||
|
@ -494,8 +507,8 @@ static int lcd_init(void *lcdbase)
|
|||
* by setting up gd->fb_base. Check for this condition and fixup
|
||||
* 'lcd_base' address.
|
||||
*/
|
||||
if ((unsigned long)lcdbase != gd->fb_base)
|
||||
lcd_base = (void *)gd->fb_base;
|
||||
if (map_to_sysmem(lcdbase) != gd->fb_base)
|
||||
lcd_base = map_sysmem(gd->fb_base, 0);
|
||||
|
||||
debug("[LCD] Using LCD frambuffer at %p\n", lcd_base);
|
||||
|
||||
|
@ -886,7 +899,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
|
|||
ushort *cmap_base = NULL;
|
||||
ushort i, j;
|
||||
uchar *fb;
|
||||
bmp_image_t *bmp=(bmp_image_t *)bmp_image;
|
||||
bmp_image_t *bmp = (bmp_image_t *)map_sysmem(bmp_image, 0);
|
||||
uchar *bmap;
|
||||
ushort padded_width;
|
||||
unsigned long width, height, byte_width;
|
||||
|
|
10
config.mk
10
config.mk
|
@ -25,15 +25,15 @@ OBJCOPYFLAGS :=
|
|||
# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
|
||||
# CPU-specific code.
|
||||
CPUDIR=arch/$(ARCH)/cpu/$(CPU)
|
||||
ifneq ($(SRCTREE)/$(CPUDIR),$(wildcard $(SRCTREE)/$(CPUDIR)))
|
||||
ifneq ($(srctree)/$(CPUDIR),$(wildcard $(srctree)/$(CPUDIR)))
|
||||
CPUDIR=arch/$(ARCH)/cpu
|
||||
endif
|
||||
|
||||
sinclude $(TOPDIR)/arch/$(ARCH)/config.mk # include architecture dependend rules
|
||||
sinclude $(TOPDIR)/$(CPUDIR)/config.mk # include CPU specific rules
|
||||
sinclude $(srctree)/arch/$(ARCH)/config.mk # include architecture dependend rules
|
||||
sinclude $(srctree)/$(CPUDIR)/config.mk # include CPU specific rules
|
||||
|
||||
ifdef SOC
|
||||
sinclude $(TOPDIR)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
|
||||
sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk # include SoC specific rules
|
||||
endif
|
||||
ifneq ($(BOARD),)
|
||||
ifdef VENDOR
|
||||
|
@ -43,7 +43,7 @@ BOARDDIR = $(BOARD)
|
|||
endif
|
||||
endif
|
||||
ifdef BOARD
|
||||
sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk # include board specific rules
|
||||
sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
|
||||
endif
|
||||
|
||||
#########################################################################
|
||||
|
|
17
disk/part.c
17
disk/part.c
|
@ -452,23 +452,6 @@ int get_device_and_partition(const char *ifname, const char *dev_part_str,
|
|||
int part;
|
||||
disk_partition_t tmpinfo;
|
||||
|
||||
/*
|
||||
* For now, we have a special case for sandbox, since there is no
|
||||
* real block device support.
|
||||
*/
|
||||
if (0 == strcmp(ifname, "host")) {
|
||||
*dev_desc = NULL;
|
||||
info->start = info->size = info->blksz = 0;
|
||||
info->bootable = 0;
|
||||
strcpy((char *)info->type, BOOT_PART_TYPE);
|
||||
strcpy((char *)info->name, "Sandbox host");
|
||||
#ifdef CONFIG_PARTITION_UUIDS
|
||||
info->uuid[0] = 0;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If no dev_part_str, use bootdevice environment variable */
|
||||
if (!dev_part_str || !strlen(dev_part_str) ||
|
||||
!strcmp(dev_part_str, "-"))
|
||||
|
|
|
@ -13,7 +13,7 @@ can be reused. No code duplication or symlinking is necessary anymore.
|
|||
How it works
|
||||
------------
|
||||
|
||||
There is a new directory TOPDIR/spl which contains only a Makefile.
|
||||
There is a new directory $(srctree)/spl which contains only a Makefile.
|
||||
The object files are built separately for SPL and placed in this directory.
|
||||
The final binaries which are generated are u-boot-spl, u-boot-spl.bin and
|
||||
u-boot-spl.map.
|
||||
|
|
|
@ -19,7 +19,7 @@ board can be reused. No code duplication or symlinking is necessary anymore.
|
|||
How it works
|
||||
------------
|
||||
|
||||
There has been a directory TOPDIR/spl which contains only a Makefile. The
|
||||
There has been a directory $(srctree)/spl which contains only a Makefile. The
|
||||
Makefile is shared by SPL and TPL.
|
||||
|
||||
The object files are built separately for SPL/TPL and placed in the
|
||||
|
|
|
@ -28,7 +28,7 @@ these symbols when linking full U-Boot even though they are not
|
|||
referenced in the source code as such.
|
||||
|
||||
If a new board is defined do not forget to define the command section
|
||||
by writing in u-boot.lds ($(TOPDIR)/board/boardname/u-boot.lds) these
|
||||
by writing in u-boot.lds ($(srctree)/board/boardname/u-boot.lds) these
|
||||
3 lines:
|
||||
|
||||
.u_boot_list : {
|
||||
|
|
|
@ -42,7 +42,7 @@ Board specific configuration file specifications:
|
|||
kwbimage.cfg. The name can be set as part of the full path
|
||||
to the file using CONFIG_SYS_KWD_CONFIG (probably in
|
||||
include/configs/<yourboard>.h). The path should look like:
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/<yourkwbimagename>.cfg
|
||||
$(CONFIG_BOARDDIR)/<yourkwbimagename>.cfg
|
||||
2. This file can have empty lines and lines starting with "#" as first
|
||||
character to put comments
|
||||
3. This file can have configuration command lines as mentioned below,
|
||||
|
|
|
@ -127,8 +127,14 @@ To enable USB Host Ethernet in U-Boot, your platform must of course
|
|||
support USB with CONFIG_CMD_USB enabled and working. You will need to
|
||||
add some config settings to your board header file:
|
||||
|
||||
#define CONFIG_CMD_USB /* the 'usb' interactive command */
|
||||
#define CONFIG_USB_HOST_ETHER /* Enable USB Ethernet adapters */
|
||||
#define CONFIG_USB_ETHER_ASIX /* Asix, or whatever driver(s) you want */
|
||||
|
||||
and one or more of the following for individual adapter hardware:
|
||||
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
|
||||
As with built-in networking, you will also want to enable some network
|
||||
commands, for example:
|
||||
|
@ -148,7 +154,10 @@ settings should start you off:
|
|||
|
||||
You can also set the default IP address of your board and the server
|
||||
as well as the default file to load when a 'bootp' command is issued.
|
||||
All of these can be obtained from the bootp server if not set.
|
||||
However note that encoding these individual network settings into a
|
||||
common exectuable is discouraged, as it leads to potential conflicts,
|
||||
and all the parameters can either get stored in the board's external
|
||||
environment, or get obtained from the bootp server if not set.
|
||||
|
||||
#define CONFIG_IPADDR 10.0.0.2 (replace with your value)
|
||||
#define CONFIG_SERVERIP 10.0.0.1 (replace with your value)
|
||||
|
|
13
doc/device-tree-bindings/video/sandbox-fb.txt
Normal file
13
doc/device-tree-bindings/video/sandbox-fb.txt
Normal file
|
@ -0,0 +1,13 @@
|
|||
Sandbox LCD
|
||||
===========
|
||||
|
||||
This uses the displaymode.txt binding except that only xres and yres are
|
||||
required properties.
|
||||
|
||||
Example:
|
||||
|
||||
lcd {
|
||||
compatible = "sandbox,lcd-sdl";
|
||||
xres = <800>;
|
||||
yres = <600>;
|
||||
};
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <cros_ec.h>
|
||||
#include <errno.h>
|
||||
#include <fdtdec.h>
|
||||
#include <input.h>
|
||||
#include <key_matrix.h>
|
||||
|
@ -39,20 +40,34 @@ static struct keyb {
|
|||
* @param config Keyboard config
|
||||
* @param keys List of keys that we have detected
|
||||
* @param max_count Maximum number of keys to return
|
||||
* @return number of pressed keys, 0 for none
|
||||
* @param samep Set to true if this scan repeats the last, else false
|
||||
* @return number of pressed keys, 0 for none, -EIO on error
|
||||
*/
|
||||
static int check_for_keys(struct keyb *config,
|
||||
struct key_matrix_key *keys, int max_count)
|
||||
struct key_matrix_key *keys, int max_count,
|
||||
bool *samep)
|
||||
{
|
||||
struct key_matrix_key *key;
|
||||
static struct mbkp_keyscan last_scan;
|
||||
static bool last_scan_valid;
|
||||
struct mbkp_keyscan scan;
|
||||
unsigned int row, col, bit, data;
|
||||
int num_keys;
|
||||
|
||||
if (cros_ec_scan_keyboard(config->dev, &scan)) {
|
||||
debug("%s: keyboard scan failed\n", __func__);
|
||||
return -1;
|
||||
return -EIO;
|
||||
}
|
||||
*samep = last_scan_valid && !memcmp(&last_scan, &scan, sizeof(scan));
|
||||
|
||||
/*
|
||||
* This is a bit odd. The EC has no way to tell us that it has run
|
||||
* out of key scans. It just returns the same scan over and over
|
||||
* again. So the only way to detect that we have run out is to detect
|
||||
* that this scan is the same as the last.
|
||||
*/
|
||||
last_scan_valid = true;
|
||||
memcpy(&last_scan, &scan, sizeof(last_scan));
|
||||
|
||||
for (col = num_keys = bit = 0; col < config->matrix.num_cols;
|
||||
col++) {
|
||||
|
@ -112,6 +127,7 @@ int cros_ec_kbc_check(struct input_config *input)
|
|||
int keycodes[KBC_MAX_KEYS];
|
||||
int num_keys, num_keycodes;
|
||||
int irq_pending, sent;
|
||||
bool same = false;
|
||||
|
||||
/*
|
||||
* Loop until the EC has no more keyscan records, or we have
|
||||
|
@ -125,7 +141,10 @@ int cros_ec_kbc_check(struct input_config *input)
|
|||
do {
|
||||
irq_pending = cros_ec_interrupt_pending(config.dev);
|
||||
if (irq_pending) {
|
||||
num_keys = check_for_keys(&config, keys, KBC_MAX_KEYS);
|
||||
num_keys = check_for_keys(&config, keys, KBC_MAX_KEYS,
|
||||
&same);
|
||||
if (num_keys < 0)
|
||||
return 0;
|
||||
last_num_keys = num_keys;
|
||||
memcpy(last_keys, keys, sizeof(keys));
|
||||
} else {
|
||||
|
@ -142,6 +161,13 @@ int cros_ec_kbc_check(struct input_config *input)
|
|||
num_keycodes = key_matrix_decode(&config.matrix, keys,
|
||||
num_keys, keycodes, KBC_MAX_KEYS);
|
||||
sent = input_send_keycodes(input, keycodes, num_keycodes);
|
||||
|
||||
/*
|
||||
* For those ECs without an interrupt, stop scanning when we
|
||||
* see that the scan is the same as last time.
|
||||
*/
|
||||
if ((irq_pending < 0) && same)
|
||||
break;
|
||||
} while (irq_pending && !sent);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -11,6 +11,7 @@ obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
|
|||
obj-$(CONFIG_CROS_EC) += cros_ec.o
|
||||
obj-$(CONFIG_CROS_EC_LPC) += cros_ec_lpc.o
|
||||
obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o
|
||||
obj-$(CONFIG_CROS_EC_SANDBOX) += cros_ec_sandbox.o
|
||||
obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
|
||||
obj-$(CONFIG_FSL_IIM) += fsl_iim.o
|
||||
obj-$(CONFIG_GPIO_LED) += gpio_led.o
|
||||
|
|
|
@ -7,10 +7,11 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* The Matrix Keyboard Protocol driver handles talking to the keyboard
|
||||
* controller chip. Mostly this is for keyboard functions, but some other
|
||||
* things have slipped in, so we provide generic services to talk to the
|
||||
* KBC.
|
||||
* This is the interface to the Chrome OS EC. It provides keyboard functions,
|
||||
* power control and battery management. Quite a few other functions are
|
||||
* provided to enable the EC software to be updated, talk to the EC's I2C bus
|
||||
* and store a small amount of data in a memory which persists while the EC
|
||||
* is not reset.
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
@ -20,6 +21,7 @@
|
|||
#include <fdtdec.h>
|
||||
#include <malloc.h>
|
||||
#include <spi.h>
|
||||
#include <asm/errno.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm-generic/gpio.h>
|
||||
|
||||
|
@ -73,11 +75,184 @@ int cros_ec_calc_checksum(const uint8_t *data, int size)
|
|||
return csum & 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a request packet for protocol version 3.
|
||||
*
|
||||
* The packet is stored in the device's internal output buffer.
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param cmd Command to send (EC_CMD_...)
|
||||
* @param cmd_version Version of command to send (EC_VER_...)
|
||||
* @param dout Output data (may be NULL If dout_len=0)
|
||||
* @param dout_len Size of output data in bytes
|
||||
* @return packet size in bytes, or <0 if error.
|
||||
*/
|
||||
static int create_proto3_request(struct cros_ec_dev *dev,
|
||||
int cmd, int cmd_version,
|
||||
const void *dout, int dout_len)
|
||||
{
|
||||
struct ec_host_request *rq = (struct ec_host_request *)dev->dout;
|
||||
int out_bytes = dout_len + sizeof(*rq);
|
||||
|
||||
/* Fail if output size is too big */
|
||||
if (out_bytes > (int)sizeof(dev->dout)) {
|
||||
debug("%s: Cannot send %d bytes\n", __func__, dout_len);
|
||||
return -EC_RES_REQUEST_TRUNCATED;
|
||||
}
|
||||
|
||||
/* Fill in request packet */
|
||||
rq->struct_version = EC_HOST_REQUEST_VERSION;
|
||||
rq->checksum = 0;
|
||||
rq->command = cmd;
|
||||
rq->command_version = cmd_version;
|
||||
rq->reserved = 0;
|
||||
rq->data_len = dout_len;
|
||||
|
||||
/* Copy data after header */
|
||||
memcpy(rq + 1, dout, dout_len);
|
||||
|
||||
/* Write checksum field so the entire packet sums to 0 */
|
||||
rq->checksum = (uint8_t)(-cros_ec_calc_checksum(dev->dout, out_bytes));
|
||||
|
||||
cros_ec_dump_data("out", cmd, dev->dout, out_bytes);
|
||||
|
||||
/* Return size of request packet */
|
||||
return out_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the device to receive a protocol version 3 response.
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param din_len Maximum size of response in bytes
|
||||
* @return maximum expected number of bytes in response, or <0 if error.
|
||||
*/
|
||||
static int prepare_proto3_response_buffer(struct cros_ec_dev *dev, int din_len)
|
||||
{
|
||||
int in_bytes = din_len + sizeof(struct ec_host_response);
|
||||
|
||||
/* Fail if input size is too big */
|
||||
if (in_bytes > (int)sizeof(dev->din)) {
|
||||
debug("%s: Cannot receive %d bytes\n", __func__, din_len);
|
||||
return -EC_RES_RESPONSE_TOO_BIG;
|
||||
}
|
||||
|
||||
/* Return expected size of response packet */
|
||||
return in_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a protocol version 3 response packet.
|
||||
*
|
||||
* The packet must already be stored in the device's internal input buffer.
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param dinp Returns pointer to response data
|
||||
* @param din_len Maximum size of response in bytes
|
||||
* @return number of bytes of response data, or <0 if error
|
||||
*/
|
||||
static int handle_proto3_response(struct cros_ec_dev *dev,
|
||||
uint8_t **dinp, int din_len)
|
||||
{
|
||||
struct ec_host_response *rs = (struct ec_host_response *)dev->din;
|
||||
int in_bytes;
|
||||
int csum;
|
||||
|
||||
cros_ec_dump_data("in-header", -1, dev->din, sizeof(*rs));
|
||||
|
||||
/* Check input data */
|
||||
if (rs->struct_version != EC_HOST_RESPONSE_VERSION) {
|
||||
debug("%s: EC response version mismatch\n", __func__);
|
||||
return -EC_RES_INVALID_RESPONSE;
|
||||
}
|
||||
|
||||
if (rs->reserved) {
|
||||
debug("%s: EC response reserved != 0\n", __func__);
|
||||
return -EC_RES_INVALID_RESPONSE;
|
||||
}
|
||||
|
||||
if (rs->data_len > din_len) {
|
||||
debug("%s: EC returned too much data\n", __func__);
|
||||
return -EC_RES_RESPONSE_TOO_BIG;
|
||||
}
|
||||
|
||||
cros_ec_dump_data("in-data", -1, dev->din + sizeof(*rs), rs->data_len);
|
||||
|
||||
/* Update in_bytes to actual data size */
|
||||
in_bytes = sizeof(*rs) + rs->data_len;
|
||||
|
||||
/* Verify checksum */
|
||||
csum = cros_ec_calc_checksum(dev->din, in_bytes);
|
||||
if (csum) {
|
||||
debug("%s: EC response checksum invalid: 0x%02x\n", __func__,
|
||||
csum);
|
||||
return -EC_RES_INVALID_CHECKSUM;
|
||||
}
|
||||
|
||||
/* Return error result, if any */
|
||||
if (rs->result)
|
||||
return -(int)rs->result;
|
||||
|
||||
/* If we're still here, set response data pointer and return length */
|
||||
*dinp = (uint8_t *)(rs + 1);
|
||||
|
||||
return rs->data_len;
|
||||
}
|
||||
|
||||
static int send_command_proto3(struct cros_ec_dev *dev,
|
||||
int cmd, int cmd_version,
|
||||
const void *dout, int dout_len,
|
||||
uint8_t **dinp, int din_len)
|
||||
{
|
||||
int out_bytes, in_bytes;
|
||||
int rv;
|
||||
|
||||
/* Create request packet */
|
||||
out_bytes = create_proto3_request(dev, cmd, cmd_version,
|
||||
dout, dout_len);
|
||||
if (out_bytes < 0)
|
||||
return out_bytes;
|
||||
|
||||
/* Prepare response buffer */
|
||||
in_bytes = prepare_proto3_response_buffer(dev, din_len);
|
||||
if (in_bytes < 0)
|
||||
return in_bytes;
|
||||
|
||||
switch (dev->interface) {
|
||||
#ifdef CONFIG_CROS_EC_SPI
|
||||
case CROS_EC_IF_SPI:
|
||||
rv = cros_ec_spi_packet(dev, out_bytes, in_bytes);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_CROS_EC_SANDBOX
|
||||
case CROS_EC_IF_SANDBOX:
|
||||
rv = cros_ec_sandbox_packet(dev, out_bytes, in_bytes);
|
||||
break;
|
||||
#endif
|
||||
case CROS_EC_IF_NONE:
|
||||
/* TODO: support protocol 3 for LPC, I2C; for now fall through */
|
||||
default:
|
||||
debug("%s: Unsupported interface\n", __func__);
|
||||
rv = -1;
|
||||
}
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
||||
/* Process the response */
|
||||
return handle_proto3_response(dev, dinp, din_len);
|
||||
}
|
||||
|
||||
static int send_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
||||
const void *dout, int dout_len,
|
||||
uint8_t **dinp, int din_len)
|
||||
{
|
||||
int ret;
|
||||
int ret = -1;
|
||||
|
||||
/* Handle protocol version 3 support */
|
||||
if (dev->protocol_version == 3) {
|
||||
return send_command_proto3(dev, cmd, cmd_version,
|
||||
dout, dout_len, dinp, din_len);
|
||||
}
|
||||
|
||||
switch (dev->interface) {
|
||||
#ifdef CONFIG_CROS_EC_SPI
|
||||
|
@ -129,19 +304,15 @@ static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
|
|||
int cmd_version, const void *dout, int dout_len, uint8_t **dinp,
|
||||
int din_len)
|
||||
{
|
||||
uint8_t *din;
|
||||
uint8_t *din = NULL;
|
||||
int len;
|
||||
|
||||
if (cmd_version != 0 && !dev->cmd_version_is_supported) {
|
||||
debug("%s: Command version >0 unsupported\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
len = send_command(dev, cmd, cmd_version, dout, dout_len,
|
||||
&din, din_len);
|
||||
|
||||
/* If the command doesn't complete, wait a while */
|
||||
if (len == -EC_RES_IN_PROGRESS) {
|
||||
struct ec_response_get_comms_status *resp;
|
||||
struct ec_response_get_comms_status *resp = NULL;
|
||||
ulong start;
|
||||
|
||||
/* Wait for command to complete */
|
||||
|
@ -169,7 +340,8 @@ static int ec_command_inptr(struct cros_ec_dev *dev, uint8_t cmd,
|
|||
NULL, 0, &din, din_len);
|
||||
}
|
||||
|
||||
debug("%s: len=%d, dinp=%p, *dinp=%p\n", __func__, len, dinp, *dinp);
|
||||
debug("%s: len=%d, dinp=%p, *dinp=%p\n", __func__, len, dinp,
|
||||
dinp ? *dinp : NULL);
|
||||
if (dinp) {
|
||||
/* If we have any data to return, it must be 64bit-aligned */
|
||||
assert(len <= 0 || !((uintptr_t)din & 7));
|
||||
|
@ -220,8 +392,8 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
|
||||
int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan)
|
||||
{
|
||||
if (ec_command(dev, EC_CMD_CROS_EC_STATE, 0, NULL, 0, scan,
|
||||
sizeof(scan->data)) < sizeof(scan->data))
|
||||
if (ec_command(dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan,
|
||||
sizeof(scan->data)) != sizeof(scan->data))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -232,10 +404,10 @@ int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int maxlen)
|
|||
struct ec_response_get_version *r;
|
||||
|
||||
if (ec_command_inptr(dev, EC_CMD_GET_VERSION, 0, NULL, 0,
|
||||
(uint8_t **)&r, sizeof(*r)) < sizeof(*r))
|
||||
(uint8_t **)&r, sizeof(*r)) != sizeof(*r))
|
||||
return -1;
|
||||
|
||||
if (maxlen > sizeof(r->version_string_ro))
|
||||
if (maxlen > (int)sizeof(r->version_string_ro))
|
||||
maxlen = sizeof(r->version_string_ro);
|
||||
|
||||
switch (r->current_image) {
|
||||
|
@ -258,7 +430,7 @@ int cros_ec_read_version(struct cros_ec_dev *dev,
|
|||
{
|
||||
if (ec_command_inptr(dev, EC_CMD_GET_VERSION, 0, NULL, 0,
|
||||
(uint8_t **)versionp, sizeof(**versionp))
|
||||
< sizeof(**versionp))
|
||||
!= sizeof(**versionp))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -267,7 +439,7 @@ int cros_ec_read_version(struct cros_ec_dev *dev,
|
|||
int cros_ec_read_build_info(struct cros_ec_dev *dev, char **strp)
|
||||
{
|
||||
if (ec_command_inptr(dev, EC_CMD_GET_BUILD_INFO, 0, NULL, 0,
|
||||
(uint8_t **)strp, EC_HOST_PARAM_SIZE) < 0)
|
||||
(uint8_t **)strp, EC_PROTO2_MAX_PARAM_SIZE) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -279,7 +451,7 @@ int cros_ec_read_current_image(struct cros_ec_dev *dev,
|
|||
struct ec_response_get_version *r;
|
||||
|
||||
if (ec_command_inptr(dev, EC_CMD_GET_VERSION, 0, NULL, 0,
|
||||
(uint8_t **)&r, sizeof(*r)) < sizeof(*r))
|
||||
(uint8_t **)&r, sizeof(*r)) != sizeof(*r))
|
||||
return -1;
|
||||
|
||||
*image = r->current_image;
|
||||
|
@ -336,7 +508,7 @@ int cros_ec_read_hash(struct cros_ec_dev *dev,
|
|||
debug("%s: No valid hash (status=%d size=%d). Compute one...\n",
|
||||
__func__, hash->status, hash->size);
|
||||
|
||||
p.cmd = EC_VBOOT_HASH_RECALC;
|
||||
p.cmd = EC_VBOOT_HASH_START;
|
||||
p.hash_type = EC_VBOOT_HASH_TYPE_SHA256;
|
||||
p.nonce_size = 0;
|
||||
p.offset = EC_VBOOT_HASH_OFFSET_RW;
|
||||
|
@ -413,15 +585,15 @@ int cros_ec_interrupt_pending(struct cros_ec_dev *dev)
|
|||
{
|
||||
/* no interrupt support : always poll */
|
||||
if (!fdt_gpio_isvalid(&dev->ec_int))
|
||||
return 1;
|
||||
return -ENOENT;
|
||||
|
||||
return !gpio_get_value(dev->ec_int.gpio);
|
||||
}
|
||||
|
||||
int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_cros_ec_info *info)
|
||||
int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_mkbp_info *info)
|
||||
{
|
||||
if (ec_command(dev, EC_CMD_CROS_EC_INFO, 0, NULL, 0, info,
|
||||
sizeof(*info)) < sizeof(*info))
|
||||
if (ec_command(dev, EC_CMD_MKBP_INFO, 0, NULL, 0, info,
|
||||
sizeof(*info)) != sizeof(*info))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -436,7 +608,7 @@ int cros_ec_get_host_events(struct cros_ec_dev *dev, uint32_t *events_ptr)
|
|||
* used by ACPI/SMI.
|
||||
*/
|
||||
if (ec_command_inptr(dev, EC_CMD_HOST_EVENT_GET_B, 0, NULL, 0,
|
||||
(uint8_t **)&resp, sizeof(*resp)) < sizeof(*resp))
|
||||
(uint8_t **)&resp, sizeof(*resp)) < (int)sizeof(*resp))
|
||||
return -1;
|
||||
|
||||
if (resp->mask & EC_HOST_EVENT_MASK(EC_HOST_EVENT_INVALID))
|
||||
|
@ -474,7 +646,7 @@ int cros_ec_flash_protect(struct cros_ec_dev *dev,
|
|||
|
||||
if (ec_command(dev, EC_CMD_FLASH_PROTECT, EC_VER_FLASH_PROTECT,
|
||||
¶ms, sizeof(params),
|
||||
resp, sizeof(*resp)) < sizeof(*resp))
|
||||
resp, sizeof(*resp)) != sizeof(*resp))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -504,23 +676,30 @@ static int cros_ec_check_version(struct cros_ec_dev *dev)
|
|||
*
|
||||
* So for now, just read all the data anyway.
|
||||
*/
|
||||
dev->cmd_version_is_supported = 1;
|
||||
|
||||
/* Try sending a version 3 packet */
|
||||
dev->protocol_version = 3;
|
||||
if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req, sizeof(req),
|
||||
(uint8_t **)&resp, sizeof(*resp)) > 0) {
|
||||
/* It appears to understand new version commands */
|
||||
dev->cmd_version_is_supported = 1;
|
||||
} else {
|
||||
dev->cmd_version_is_supported = 0;
|
||||
if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req,
|
||||
sizeof(req), (uint8_t **)&resp,
|
||||
sizeof(*resp)) < 0) {
|
||||
debug("%s: Failed both old and new command style\n",
|
||||
__func__);
|
||||
return -1;
|
||||
}
|
||||
(uint8_t **)&resp, sizeof(*resp)) > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
/* Try sending a version 2 packet */
|
||||
dev->protocol_version = 2;
|
||||
if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req, sizeof(req),
|
||||
(uint8_t **)&resp, sizeof(*resp)) > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fail if we're still here, since the EC doesn't understand any
|
||||
* protcol version we speak. Version 1 interface without command
|
||||
* version is no longer supported, and we don't know about any new
|
||||
* protocol versions.
|
||||
*/
|
||||
dev->protocol_version = 0;
|
||||
printf("%s: ERROR: old EC interface not supported\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cros_ec_test(struct cros_ec_dev *dev)
|
||||
|
@ -599,8 +778,8 @@ static int cros_ec_flash_write_block(struct cros_ec_dev *dev,
|
|||
|
||||
p.offset = offset;
|
||||
p.size = size;
|
||||
assert(data && p.size <= sizeof(p.data));
|
||||
memcpy(p.data, data, p.size);
|
||||
assert(data && p.size <= EC_FLASH_WRITE_VER0_SIZE);
|
||||
memcpy(&p + 1, data, p.size);
|
||||
|
||||
return ec_command_inptr(dev, EC_CMD_FLASH_WRITE, 0,
|
||||
&p, sizeof(p), NULL, 0) >= 0 ? 0 : -1;
|
||||
|
@ -611,8 +790,7 @@ static int cros_ec_flash_write_block(struct cros_ec_dev *dev,
|
|||
*/
|
||||
static int cros_ec_flash_write_burst_size(struct cros_ec_dev *dev)
|
||||
{
|
||||
struct ec_params_flash_write p;
|
||||
return sizeof(p.data);
|
||||
return EC_FLASH_WRITE_VER0_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -718,7 +896,7 @@ int cros_ec_flash_update_rw(struct cros_ec_dev *dev,
|
|||
|
||||
if (cros_ec_flash_offset(dev, EC_FLASH_REGION_RW, &rw_offset, &rw_size))
|
||||
return -1;
|
||||
if (image_size > rw_size)
|
||||
if (image_size > (int)rw_size)
|
||||
return -1;
|
||||
|
||||
/* Invalidate the existing hash, just in case the AP reboots
|
||||
|
@ -804,7 +982,7 @@ int cros_ec_get_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t *state)
|
|||
|
||||
if (ec_command_inptr(dev, EC_CMD_LDO_GET, 0,
|
||||
¶ms, sizeof(params),
|
||||
(uint8_t **)&resp, sizeof(*resp)) < sizeof(*resp))
|
||||
(uint8_t **)&resp, sizeof(*resp)) != sizeof(*resp))
|
||||
return -1;
|
||||
|
||||
*state = resp->state;
|
||||
|
@ -813,7 +991,8 @@ int cros_ec_get_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t *state)
|
|||
}
|
||||
|
||||
/**
|
||||
* Decode MBKP details from the device tree and allocate a suitable device.
|
||||
* Decode EC interface details from the device tree and allocate a suitable
|
||||
* device.
|
||||
*
|
||||
* @param blob Device tree blob
|
||||
* @param node Node to decode from
|
||||
|
@ -858,6 +1037,11 @@ static int cros_ec_decode_fdt(const void *blob, int node,
|
|||
case COMPAT_INTEL_LPC:
|
||||
dev->interface = CROS_EC_IF_LPC;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_CROS_EC_SANDBOX
|
||||
case COMPAT_SANDBOX_HOST_EMULATION:
|
||||
dev->interface = CROS_EC_IF_SANDBOX;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
debug("%s: Unknown compat id %d\n", __func__, compat);
|
||||
|
@ -913,6 +1097,12 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
|
|||
if (cros_ec_lpc_init(dev, blob))
|
||||
return -CROS_EC_ERR_DEV_INIT;
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_CROS_EC_SANDBOX
|
||||
case CROS_EC_IF_SANDBOX:
|
||||
if (cros_ec_sandbox_init(dev, blob))
|
||||
return -CROS_EC_ERR_DEV_INIT;
|
||||
break;
|
||||
#endif
|
||||
case CROS_EC_IF_NONE:
|
||||
default:
|
||||
|
@ -941,7 +1131,6 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMD_CROS_EC
|
||||
int cros_ec_decode_region(int argc, char * const argv[])
|
||||
{
|
||||
if (argc > 0) {
|
||||
|
@ -958,6 +1147,139 @@ int cros_ec_decode_region(int argc, char * const argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
int cros_ec_decode_ec_flash(const void *blob, struct fdt_cros_ec *config)
|
||||
{
|
||||
int flash_node, node;
|
||||
|
||||
node = fdtdec_next_compatible(blob, 0, COMPAT_GOOGLE_CROS_EC);
|
||||
if (node < 0) {
|
||||
debug("Failed to find chrome-ec node'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
flash_node = fdt_subnode_offset(blob, node, "flash");
|
||||
if (flash_node < 0) {
|
||||
debug("Failed to find flash node\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fdtdec_read_fmap_entry(blob, flash_node, "flash",
|
||||
&config->flash)) {
|
||||
debug("Failed to decode flash node in chrome-ec'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
config->flash_erase_value = fdtdec_get_int(blob, flash_node,
|
||||
"erase-value", -1);
|
||||
for (node = fdt_first_subnode(blob, flash_node); node >= 0;
|
||||
node = fdt_next_subnode(blob, node)) {
|
||||
const char *name = fdt_get_name(blob, node, NULL);
|
||||
enum ec_flash_region region;
|
||||
|
||||
if (0 == strcmp(name, "ro")) {
|
||||
region = EC_FLASH_REGION_RO;
|
||||
} else if (0 == strcmp(name, "rw")) {
|
||||
region = EC_FLASH_REGION_RW;
|
||||
} else if (0 == strcmp(name, "wp-ro")) {
|
||||
region = EC_FLASH_REGION_WP_RO;
|
||||
} else {
|
||||
debug("Unknown EC flash region name '%s'\n", name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fdtdec_read_fmap_entry(blob, node, "reg",
|
||||
&config->region[region])) {
|
||||
debug("Failed to decode flash region in chrome-ec'\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cros_ec_i2c_xfer(struct cros_ec_dev *dev, uchar chip, uint addr,
|
||||
int alen, uchar *buffer, int len, int is_read)
|
||||
{
|
||||
union {
|
||||
struct ec_params_i2c_passthru p;
|
||||
uint8_t outbuf[EC_PROTO2_MAX_PARAM_SIZE];
|
||||
} params;
|
||||
union {
|
||||
struct ec_response_i2c_passthru r;
|
||||
uint8_t inbuf[EC_PROTO2_MAX_PARAM_SIZE];
|
||||
} response;
|
||||
struct ec_params_i2c_passthru *p = ¶ms.p;
|
||||
struct ec_response_i2c_passthru *r = &response.r;
|
||||
struct ec_params_i2c_passthru_msg *msg = p->msg;
|
||||
uint8_t *pdata;
|
||||
int read_len, write_len;
|
||||
int size;
|
||||
int rv;
|
||||
|
||||
p->port = 0;
|
||||
|
||||
if (alen != 1) {
|
||||
printf("Unsupported address length %d\n", alen);
|
||||
return -1;
|
||||
}
|
||||
if (is_read) {
|
||||
read_len = len;
|
||||
write_len = alen;
|
||||
p->num_msgs = 2;
|
||||
} else {
|
||||
read_len = 0;
|
||||
write_len = alen + len;
|
||||
p->num_msgs = 1;
|
||||
}
|
||||
|
||||
size = sizeof(*p) + p->num_msgs * sizeof(*msg);
|
||||
if (size + write_len > sizeof(params)) {
|
||||
puts("Params too large for buffer\n");
|
||||
return -1;
|
||||
}
|
||||
if (sizeof(*r) + read_len > sizeof(response)) {
|
||||
puts("Read length too big for buffer\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Create a message to write the register address and optional data */
|
||||
pdata = (uint8_t *)p + size;
|
||||
msg->addr_flags = chip;
|
||||
msg->len = write_len;
|
||||
pdata[0] = addr;
|
||||
if (!is_read)
|
||||
memcpy(pdata + 1, buffer, len);
|
||||
msg++;
|
||||
|
||||
if (read_len) {
|
||||
msg->addr_flags = chip | EC_I2C_FLAG_READ;
|
||||
msg->len = read_len;
|
||||
}
|
||||
|
||||
rv = ec_command(dev, EC_CMD_I2C_PASSTHRU, 0, p, size + write_len,
|
||||
r, sizeof(*r) + read_len);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
||||
/* Parse response */
|
||||
if (r->i2c_status & EC_I2C_STATUS_ERROR) {
|
||||
printf("Transfer failed with status=0x%x\n", r->i2c_status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rv < sizeof(*r) + read_len) {
|
||||
puts("Truncated read response\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (read_len)
|
||||
memcpy(buffer, r->data, read_len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CMD_CROS_EC
|
||||
|
||||
/**
|
||||
* Perform a flash read or write command
|
||||
*
|
||||
|
@ -1011,6 +1333,187 @@ static int do_read_write(struct cros_ec_dev *dev, int is_write, int argc,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_alen() - Small parser helper function to get address length
|
||||
*
|
||||
* Returns the address length.
|
||||
*/
|
||||
static uint get_alen(char *arg)
|
||||
{
|
||||
int j;
|
||||
int alen;
|
||||
|
||||
alen = 1;
|
||||
for (j = 0; j < 8; j++) {
|
||||
if (arg[j] == '.') {
|
||||
alen = arg[j+1] - '0';
|
||||
break;
|
||||
} else if (arg[j] == '\0') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return alen;
|
||||
}
|
||||
|
||||
#define DISP_LINE_LEN 16
|
||||
|
||||
/*
|
||||
* TODO(sjg@chromium.org): This code copied almost verbatim from cmd_i2c.c
|
||||
* so we can remove it later.
|
||||
*/
|
||||
static int cros_ec_i2c_md(struct cros_ec_dev *dev, int flag, int argc,
|
||||
char * const argv[])
|
||||
{
|
||||
u_char chip;
|
||||
uint addr, alen, length = 0x10;
|
||||
int j, nbytes, linebytes;
|
||||
|
||||
if (argc < 2)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
if (1 || (flag & CMD_FLAG_REPEAT) == 0) {
|
||||
/*
|
||||
* New command specified.
|
||||
*/
|
||||
|
||||
/*
|
||||
* I2C chip address
|
||||
*/
|
||||
chip = simple_strtoul(argv[0], NULL, 16);
|
||||
|
||||
/*
|
||||
* I2C data address within the chip. This can be 1 or
|
||||
* 2 bytes long. Some day it might be 3 bytes long :-).
|
||||
*/
|
||||
addr = simple_strtoul(argv[1], NULL, 16);
|
||||
alen = get_alen(argv[1]);
|
||||
if (alen > 3)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
/*
|
||||
* If another parameter, it is the length to display.
|
||||
* Length is the number of objects, not number of bytes.
|
||||
*/
|
||||
if (argc > 2)
|
||||
length = simple_strtoul(argv[2], NULL, 16);
|
||||
}
|
||||
|
||||
/*
|
||||
* Print the lines.
|
||||
*
|
||||
* We buffer all read data, so we can make sure data is read only
|
||||
* once.
|
||||
*/
|
||||
nbytes = length;
|
||||
do {
|
||||
unsigned char linebuf[DISP_LINE_LEN];
|
||||
unsigned char *cp;
|
||||
|
||||
linebytes = (nbytes > DISP_LINE_LEN) ? DISP_LINE_LEN : nbytes;
|
||||
|
||||
if (cros_ec_i2c_xfer(dev, chip, addr, alen, linebuf, linebytes,
|
||||
1))
|
||||
puts("Error reading the chip.\n");
|
||||
else {
|
||||
printf("%04x:", addr);
|
||||
cp = linebuf;
|
||||
for (j = 0; j < linebytes; j++) {
|
||||
printf(" %02x", *cp++);
|
||||
addr++;
|
||||
}
|
||||
puts(" ");
|
||||
cp = linebuf;
|
||||
for (j = 0; j < linebytes; j++) {
|
||||
if ((*cp < 0x20) || (*cp > 0x7e))
|
||||
puts(".");
|
||||
else
|
||||
printf("%c", *cp);
|
||||
cp++;
|
||||
}
|
||||
putc('\n');
|
||||
}
|
||||
nbytes -= linebytes;
|
||||
} while (nbytes > 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cros_ec_i2c_mw(struct cros_ec_dev *dev, int flag, int argc,
|
||||
char * const argv[])
|
||||
{
|
||||
uchar chip;
|
||||
ulong addr;
|
||||
uint alen;
|
||||
uchar byte;
|
||||
int count;
|
||||
|
||||
if ((argc < 3) || (argc > 4))
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
/*
|
||||
* Chip is always specified.
|
||||
*/
|
||||
chip = simple_strtoul(argv[0], NULL, 16);
|
||||
|
||||
/*
|
||||
* Address is always specified.
|
||||
*/
|
||||
addr = simple_strtoul(argv[1], NULL, 16);
|
||||
alen = get_alen(argv[1]);
|
||||
if (alen > 3)
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
/*
|
||||
* Value to write is always specified.
|
||||
*/
|
||||
byte = simple_strtoul(argv[2], NULL, 16);
|
||||
|
||||
/*
|
||||
* Optional count
|
||||
*/
|
||||
if (argc == 4)
|
||||
count = simple_strtoul(argv[3], NULL, 16);
|
||||
else
|
||||
count = 1;
|
||||
|
||||
while (count-- > 0) {
|
||||
if (cros_ec_i2c_xfer(dev, chip, addr++, alen, &byte, 1, 0))
|
||||
puts("Error writing the chip.\n");
|
||||
/*
|
||||
* Wait for the write to complete. The write can take
|
||||
* up to 10mSec (we allow a little more time).
|
||||
*/
|
||||
/*
|
||||
* No write delay with FRAM devices.
|
||||
*/
|
||||
#if !defined(CONFIG_SYS_I2C_FRAM)
|
||||
udelay(11000);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Temporary code until we have driver model and can use the i2c command */
|
||||
static int cros_ec_i2c_passthrough(struct cros_ec_dev *dev, int flag,
|
||||
int argc, char * const argv[])
|
||||
{
|
||||
const char *cmd;
|
||||
|
||||
if (argc < 1)
|
||||
return CMD_RET_USAGE;
|
||||
cmd = *argv++;
|
||||
argc--;
|
||||
if (0 == strcmp("md", cmd))
|
||||
cros_ec_i2c_md(dev, flag, argc, argv);
|
||||
else if (0 == strcmp("mw", cmd))
|
||||
cros_ec_i2c_mw(dev, flag, argc, argv);
|
||||
else
|
||||
return CMD_RET_USAGE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||
{
|
||||
struct cros_ec_dev *dev = last_dev;
|
||||
|
@ -1044,7 +1547,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
}
|
||||
printf("%s\n", id);
|
||||
} else if (0 == strcmp("info", cmd)) {
|
||||
struct ec_response_cros_ec_info info;
|
||||
struct ec_response_mkbp_info info;
|
||||
|
||||
if (cros_ec_info(dev, &info)) {
|
||||
debug("%s: Could not read KBC info\n", __func__);
|
||||
|
@ -1213,10 +1716,10 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
if (!ret) {
|
||||
/* Print versions */
|
||||
printf("RO version: %1.*s\n",
|
||||
sizeof(p->version_string_ro),
|
||||
(int)sizeof(p->version_string_ro),
|
||||
p->version_string_ro);
|
||||
printf("RW version: %1.*s\n",
|
||||
sizeof(p->version_string_rw),
|
||||
(int)sizeof(p->version_string_rw),
|
||||
p->version_string_rw);
|
||||
printf("Firmware copy: %s\n",
|
||||
(p->current_image <
|
||||
|
@ -1254,6 +1757,8 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
debug("%s: Could not access LDO%d\n", __func__, index);
|
||||
return ret;
|
||||
}
|
||||
} else if (0 == strcmp("i2c", cmd)) {
|
||||
ret = cros_ec_i2c_passthrough(dev, flag, argc - 2, argv + 2);
|
||||
} else {
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
@ -1267,7 +1772,7 @@ static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|||
}
|
||||
|
||||
U_BOOT_CMD(
|
||||
crosec, 5, 1, do_cros_ec,
|
||||
crosec, 6, 1, do_cros_ec,
|
||||
"CROS-EC utility command",
|
||||
"init Re-init CROS-EC (done on startup automatically)\n"
|
||||
"crosec id Read CROS-EC ID\n"
|
||||
|
@ -1284,6 +1789,8 @@ U_BOOT_CMD(
|
|||
"crosec vbnvcontext [hexstring] Read [write] VbNvContext from EC\n"
|
||||
"crosec ldo <idx> [<state>] Switch/Read LDO state\n"
|
||||
"crosec test run tests on cros_ec\n"
|
||||
"crosec version Read CROS-EC version"
|
||||
"crosec version Read CROS-EC version\n"
|
||||
"crosec i2c md chip address[.0, .1, .2] [# of objects] - read from I2C passthru\n"
|
||||
"crosec i2c mw chip address[.0, .1, .2] value [count] - write to I2C passthru (fill)"
|
||||
);
|
||||
#endif
|
||||
|
|
|
@ -35,7 +35,7 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
uint8_t *ptr;
|
||||
/* Receive input data, so that args will be dword aligned */
|
||||
uint8_t *in_ptr;
|
||||
int ret;
|
||||
int len, csum, ret;
|
||||
|
||||
old_bus = i2c_get_bus_num();
|
||||
|
||||
|
@ -67,24 +67,24 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
* will be dword aligned.
|
||||
*/
|
||||
in_ptr = dev->din + sizeof(int64_t);
|
||||
if (!dev->cmd_version_is_supported) {
|
||||
/* Send an old-style command */
|
||||
*ptr++ = cmd;
|
||||
out_bytes = dout_len + 1;
|
||||
in_bytes = din_len + 2;
|
||||
in_ptr--; /* Expect just a status byte */
|
||||
} else {
|
||||
*ptr++ = EC_CMD_VERSION0 + cmd_version;
|
||||
*ptr++ = cmd;
|
||||
*ptr++ = dout_len;
|
||||
in_ptr -= 2; /* Expect status, length bytes */
|
||||
|
||||
if (dev->protocol_version != 2) {
|
||||
/* Something we don't support */
|
||||
debug("%s: Protocol version %d unsupported\n",
|
||||
__func__, dev->protocol_version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
*ptr++ = EC_CMD_VERSION0 + cmd_version;
|
||||
*ptr++ = cmd;
|
||||
*ptr++ = dout_len;
|
||||
in_ptr -= 2; /* Expect status, length bytes */
|
||||
|
||||
memcpy(ptr, dout, dout_len);
|
||||
ptr += dout_len;
|
||||
|
||||
if (dev->cmd_version_is_supported)
|
||||
*ptr++ = (uint8_t)
|
||||
cros_ec_calc_checksum(dev->dout, dout_len + 3);
|
||||
*ptr++ = (uint8_t)
|
||||
cros_ec_calc_checksum(dev->dout, dout_len + 3);
|
||||
|
||||
/* Set to the proper i2c bus */
|
||||
if (i2c_set_bus_num(dev->bus_num)) {
|
||||
|
@ -121,26 +121,20 @@ int cros_ec_i2c_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
return -(int)*in_ptr;
|
||||
}
|
||||
|
||||
if (dev->cmd_version_is_supported) {
|
||||
int len, csum;
|
||||
|
||||
len = in_ptr[1];
|
||||
if (len + 3 > sizeof(dev->din)) {
|
||||
debug("%s: Received length %#02x too large\n",
|
||||
__func__, len);
|
||||
return -1;
|
||||
}
|
||||
csum = cros_ec_calc_checksum(in_ptr, 2 + len);
|
||||
if (csum != in_ptr[2 + len]) {
|
||||
debug("%s: Invalid checksum rx %#02x, calced %#02x\n",
|
||||
__func__, in_ptr[2 + din_len], csum);
|
||||
return -1;
|
||||
}
|
||||
din_len = min(din_len, len);
|
||||
cros_ec_dump_data("in", -1, in_ptr, din_len + 3);
|
||||
} else {
|
||||
cros_ec_dump_data("in (old)", -1, in_ptr, in_bytes);
|
||||
len = in_ptr[1];
|
||||
if (len + 3 > sizeof(dev->din)) {
|
||||
debug("%s: Received length %#02x too large\n",
|
||||
__func__, len);
|
||||
return -1;
|
||||
}
|
||||
csum = cros_ec_calc_checksum(in_ptr, 2 + len);
|
||||
if (csum != in_ptr[2 + len]) {
|
||||
debug("%s: Invalid checksum rx %#02x, calced %#02x\n",
|
||||
__func__, in_ptr[2 + din_len], csum);
|
||||
return -1;
|
||||
}
|
||||
din_len = min(din_len, len);
|
||||
cros_ec_dump_data("in", -1, in_ptr, din_len + 3);
|
||||
|
||||
/* Return pointer to dword-aligned input data, if any */
|
||||
*dinp = dev->din + sizeof(int64_t);
|
||||
|
@ -178,7 +172,5 @@ int cros_ec_i2c_init(struct cros_ec_dev *dev, const void *blob)
|
|||
{
|
||||
i2c_init(dev->max_frequency, dev->addr);
|
||||
|
||||
dev->cmd_version_is_supported = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -40,71 +40,6 @@ static int wait_for_sync(struct cros_ec_dev *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a command to a LPC CROS_EC device and return the reply.
|
||||
*
|
||||
* The device's internal input/output buffers are used.
|
||||
*
|
||||
* @param dev CROS_EC device
|
||||
* @param cmd Command to send (EC_CMD_...)
|
||||
* @param cmd_version Version of command to send (EC_VER_...)
|
||||
* @param dout Output data (may be NULL If dout_len=0)
|
||||
* @param dout_len Size of output data in bytes
|
||||
* @param dinp Place to put pointer to response data
|
||||
* @param din_len Maximum size of response in bytes
|
||||
* @return number of bytes in response, or -1 on error
|
||||
*/
|
||||
static int old_lpc_command(struct cros_ec_dev *dev, uint8_t cmd,
|
||||
const uint8_t *dout, int dout_len,
|
||||
uint8_t **dinp, int din_len)
|
||||
{
|
||||
int ret, i;
|
||||
|
||||
if (dout_len > EC_OLD_PARAM_SIZE) {
|
||||
debug("%s: Cannot send %d bytes\n", __func__, dout_len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (din_len > EC_OLD_PARAM_SIZE) {
|
||||
debug("%s: Cannot receive %d bytes\n", __func__, din_len);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (wait_for_sync(dev)) {
|
||||
debug("%s: Timeout waiting ready\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
debug_trace("cmd: %02x, ", cmd);
|
||||
for (i = 0; i < dout_len; i++) {
|
||||
debug_trace("%02x ", dout[i]);
|
||||
outb(dout[i], EC_LPC_ADDR_OLD_PARAM + i);
|
||||
}
|
||||
outb(cmd, EC_LPC_ADDR_HOST_CMD);
|
||||
debug_trace("\n");
|
||||
|
||||
if (wait_for_sync(dev)) {
|
||||
debug("%s: Timeout waiting ready\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = inb(EC_LPC_ADDR_HOST_DATA);
|
||||
if (ret) {
|
||||
debug("%s: CROS_EC result code %d\n", __func__, ret);
|
||||
return -ret;
|
||||
}
|
||||
|
||||
debug_trace("resp: %02x, ", ret);
|
||||
for (i = 0; i < din_len; i++) {
|
||||
dev->din[i] = inb(EC_LPC_ADDR_OLD_PARAM + i);
|
||||
debug_trace("%02x ", dev->din[i]);
|
||||
}
|
||||
debug_trace("\n");
|
||||
*dinp = dev->din;
|
||||
|
||||
return din_len;
|
||||
}
|
||||
|
||||
int cros_ec_lpc_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
||||
const uint8_t *dout, int dout_len,
|
||||
uint8_t **dinp, int din_len)
|
||||
|
@ -119,11 +54,6 @@ int cros_ec_lpc_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
int csum;
|
||||
int i;
|
||||
|
||||
/* Fall back to old-style command interface if args aren't supported */
|
||||
if (!dev->cmd_version_is_supported)
|
||||
return old_lpc_command(dev, cmd, dout, dout_len, dinp,
|
||||
din_len);
|
||||
|
||||
if (dout_len > EC_HOST_PARAM_SIZE) {
|
||||
debug("%s: Cannot send %d bytes\n", __func__, dout_len);
|
||||
return -1;
|
||||
|
@ -256,13 +186,9 @@ int cros_ec_lpc_check_version(struct cros_ec_dev *dev)
|
|||
(inb(EC_LPC_ADDR_MEMMAP +
|
||||
EC_MEMMAP_HOST_CMD_FLAGS) &
|
||||
EC_HOST_CMD_FLAG_LPC_ARGS_SUPPORTED)) {
|
||||
dev->cmd_version_is_supported = 1;
|
||||
} else {
|
||||
/* We are going to use the old IO ports */
|
||||
dev->cmd_version_is_supported = 0;
|
||||
return 0;
|
||||
}
|
||||
debug("lpc: version %s\n", dev->cmd_version_is_supported ?
|
||||
"new" : "old");
|
||||
|
||||
return 0;
|
||||
printf("%s: ERROR: old EC interface not supported\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
|
559
drivers/misc/cros_ec_sandbox.c
Normal file
559
drivers/misc/cros_ec_sandbox.c
Normal file
|
@ -0,0 +1,559 @@
|
|||
/*
|
||||
* Chromium OS cros_ec driver - sandbox emulation
|
||||
*
|
||||
* Copyright (c) 2013 The Chromium OS Authors.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <cros_ec.h>
|
||||
#include <ec_commands.h>
|
||||
#include <errno.h>
|
||||
#include <hash.h>
|
||||
#include <malloc.h>
|
||||
#include <os.h>
|
||||
#include <sha256.h>
|
||||
#include <spi.h>
|
||||
#include <asm/state.h>
|
||||
#include <asm/sdl.h>
|
||||
#include <linux/input.h>
|
||||
|
||||
/*
|
||||
* Ultimately it shold be possible to connect an Chrome OS EC emulation
|
||||
* to U-Boot and remove all of this code. But this provides a test
|
||||
* environment for bringing up chromeos_sandbox and demonstrating its
|
||||
* utility.
|
||||
*
|
||||
* This emulation includes the following:
|
||||
*
|
||||
* 1. Emulation of the keyboard, by converting keypresses received from SDL
|
||||
* into key scan data, passed back from the EC as key scan messages. The
|
||||
* key layout is read from the device tree.
|
||||
*
|
||||
* 2. Emulation of vboot context - so this can be read/written as required.
|
||||
*
|
||||
* 3. Save/restore of EC state, so that the vboot context, flash memory
|
||||
* contents and current image can be preserved across boots. This is important
|
||||
* since the EC is supposed to continue running even if the AP resets.
|
||||
*
|
||||
* 4. Some event support, in particular allowing Escape to be pressed on boot
|
||||
* to enter recovery mode. The EC passes this to U-Boot through the normal
|
||||
* event message.
|
||||
*
|
||||
* 5. Flash read/write/erase support, so that software sync works. The
|
||||
* protect messages are supported but no protection is implemented.
|
||||
*
|
||||
* 6. Hashing of the EC image, again to support software sync.
|
||||
*
|
||||
* Other features can be added, although a better path is probably to link
|
||||
* the EC image in with U-Boot (Vic has demonstrated a prototype for this).
|
||||
*/
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#define KEYBOARD_ROWS 8
|
||||
#define KEYBOARD_COLS 13
|
||||
|
||||
/* A single entry of the key matrix */
|
||||
struct ec_keymatrix_entry {
|
||||
int row; /* key matrix row */
|
||||
int col; /* key matrix column */
|
||||
int keycode; /* corresponding linux key code */
|
||||
};
|
||||
|
||||
/**
|
||||
* struct ec_state - Information about the EC state
|
||||
*
|
||||
* @vbnv_context: Vboot context data stored by EC
|
||||
* @ec_config: FDT config information about the EC (e.g. flashmap)
|
||||
* @flash_data: Contents of flash memory
|
||||
* @flash_data_len: Size of flash memory
|
||||
* @current_image: Current image the EC is running
|
||||
* @matrix_count: Number of keys to decode in matrix
|
||||
* @matrix: Information about keyboard matrix
|
||||
* @keyscan: Current keyscan information (bit set for each row/column pressed)
|
||||
* @recovery_req: Keyboard recovery requested
|
||||
*/
|
||||
struct ec_state {
|
||||
uint8_t vbnv_context[EC_VBNV_BLOCK_SIZE];
|
||||
struct fdt_cros_ec ec_config;
|
||||
uint8_t *flash_data;
|
||||
int flash_data_len;
|
||||
enum ec_current_image current_image;
|
||||
int matrix_count;
|
||||
struct ec_keymatrix_entry *matrix; /* the key matrix info */
|
||||
uint8_t keyscan[KEYBOARD_COLS];
|
||||
bool recovery_req;
|
||||
} s_state, *state;
|
||||
|
||||
/**
|
||||
* cros_ec_read_state() - read the sandbox EC state from the state file
|
||||
*
|
||||
* If data is available, then blob and node will provide access to it. If
|
||||
* not this function sets up an empty EC.
|
||||
*
|
||||
* @param blob: Pointer to device tree blob, or NULL if no data to read
|
||||
* @param node: Node offset to read from
|
||||
*/
|
||||
static int cros_ec_read_state(const void *blob, int node)
|
||||
{
|
||||
struct ec_state *ec = &s_state;
|
||||
const char *prop;
|
||||
int len;
|
||||
|
||||
/* Set everything to defaults */
|
||||
ec->current_image = EC_IMAGE_RO;
|
||||
if (!blob)
|
||||
return 0;
|
||||
|
||||
/* Read the data if available */
|
||||
ec->current_image = fdtdec_get_int(blob, node, "current-image",
|
||||
EC_IMAGE_RO);
|
||||
prop = fdt_getprop(blob, node, "vbnv-context", &len);
|
||||
if (prop && len == sizeof(ec->vbnv_context))
|
||||
memcpy(ec->vbnv_context, prop, len);
|
||||
|
||||
prop = fdt_getprop(blob, node, "flash-data", &len);
|
||||
if (prop) {
|
||||
ec->flash_data_len = len;
|
||||
ec->flash_data = os_malloc(len);
|
||||
if (!ec->flash_data)
|
||||
return -ENOMEM;
|
||||
memcpy(ec->flash_data, prop, len);
|
||||
debug("%s: Loaded EC flash data size %#x\n", __func__, len);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* cros_ec_write_state() - Write out our state to the state file
|
||||
*
|
||||
* The caller will ensure that there is a node ready for the state. The node
|
||||
* may already contain the old state, in which case it is overridden.
|
||||
*
|
||||
* @param blob: Device tree blob holding state
|
||||
* @param node: Node to write our state into
|
||||
*/
|
||||
static int cros_ec_write_state(void *blob, int node)
|
||||
{
|
||||
struct ec_state *ec = &s_state;
|
||||
|
||||
/* We are guaranteed enough space to write basic properties */
|
||||
fdt_setprop_u32(blob, node, "current-image", ec->current_image);
|
||||
fdt_setprop(blob, node, "vbnv-context", ec->vbnv_context,
|
||||
sizeof(ec->vbnv_context));
|
||||
return state_setprop(node, "flash-data", ec->flash_data,
|
||||
ec->ec_config.flash.length);
|
||||
}
|
||||
|
||||
SANDBOX_STATE_IO(cros_ec, "google,cros-ec", cros_ec_read_state,
|
||||
cros_ec_write_state);
|
||||
|
||||
/**
|
||||
* Return the number of bytes used in the specified image.
|
||||
*
|
||||
* This is the actual size of code+data in the image, as opposed to the
|
||||
* amount of space reserved in flash for that image. This code is similar to
|
||||
* that used by the real EC code base.
|
||||
*
|
||||
* @param ec Current emulated EC state
|
||||
* @param entry Flash map entry containing the image to check
|
||||
* @return actual image size in bytes, 0 if the image contains no content or
|
||||
* error.
|
||||
*/
|
||||
static int get_image_used(struct ec_state *ec, struct fmap_entry *entry)
|
||||
{
|
||||
int size;
|
||||
|
||||
/*
|
||||
* Scan backwards looking for 0xea byte, which is by definition the
|
||||
* last byte of the image. See ec.lds.S for how this is inserted at
|
||||
* the end of the image.
|
||||
*/
|
||||
for (size = entry->length - 1;
|
||||
size > 0 && ec->flash_data[entry->offset + size] != 0xea;
|
||||
size--)
|
||||
;
|
||||
|
||||
return size ? size + 1 : 0; /* 0xea byte IS part of the image */
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the key matrix from the device tree
|
||||
*
|
||||
* Keymap entries in the fdt take the form of 0xRRCCKKKK where
|
||||
* RR=Row CC=Column KKKK=Key Code
|
||||
*
|
||||
* @param ec Current emulated EC state
|
||||
* @param blob Device tree blob containing keyscan information
|
||||
* @param node Keyboard node of device tree containing keyscan information
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
static int keyscan_read_fdt_matrix(struct ec_state *ec, const void *blob,
|
||||
int node)
|
||||
{
|
||||
const u32 *cell;
|
||||
int upto;
|
||||
int len;
|
||||
|
||||
cell = fdt_getprop(blob, node, "linux,keymap", &len);
|
||||
ec->matrix_count = len / 4;
|
||||
ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix));
|
||||
if (!ec->matrix) {
|
||||
debug("%s: Out of memory for key matrix\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Now read the data */
|
||||
for (upto = 0; upto < ec->matrix_count; upto++) {
|
||||
struct ec_keymatrix_entry *matrix = &ec->matrix[upto];
|
||||
u32 word;
|
||||
|
||||
word = fdt32_to_cpu(*cell++);
|
||||
matrix->row = word >> 24;
|
||||
matrix->col = (word >> 16) & 0xff;
|
||||
matrix->keycode = word & 0xffff;
|
||||
|
||||
/* Hard-code some sanity limits for now */
|
||||
if (matrix->row >= KEYBOARD_ROWS ||
|
||||
matrix->col >= KEYBOARD_COLS) {
|
||||
debug("%s: Matrix pos out of range (%d,%d)\n",
|
||||
__func__, matrix->row, matrix->col);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (upto != ec->matrix_count) {
|
||||
debug("%s: Read mismatch from key matrix\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next keyscan message contents
|
||||
*
|
||||
* @param ec Current emulated EC state
|
||||
* @param scan Place to put keyscan bytes for the keyscan message (must hold
|
||||
* enough space for a full keyscan)
|
||||
* @return number of bytes of valid scan data
|
||||
*/
|
||||
static int cros_ec_keyscan(struct ec_state *ec, uint8_t *scan)
|
||||
{
|
||||
const struct ec_keymatrix_entry *matrix;
|
||||
int bytes = KEYBOARD_COLS;
|
||||
int key[8]; /* allow up to 8 keys to be pressed at once */
|
||||
int count;
|
||||
int i;
|
||||
|
||||
memset(ec->keyscan, '\0', bytes);
|
||||
count = sandbox_sdl_scan_keys(key, ARRAY_SIZE(key));
|
||||
|
||||
/* Look up keycode in matrix */
|
||||
for (i = 0, matrix = ec->matrix; i < ec->matrix_count; i++, matrix++) {
|
||||
bool found;
|
||||
int j;
|
||||
|
||||
for (found = false, j = 0; j < count; j++) {
|
||||
if (matrix->keycode == key[j])
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
debug("%d: %d,%d\n", matrix->keycode, matrix->row,
|
||||
matrix->col);
|
||||
ec->keyscan[matrix->col] |= 1 << matrix->row;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(scan, ec->keyscan, bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process an emulated EC command
|
||||
*
|
||||
* @param ec Current emulated EC state
|
||||
* @param req_hdr Pointer to request header
|
||||
* @param req_data Pointer to body of request
|
||||
* @param resp_hdr Pointer to place to put response header
|
||||
* @param resp_data Pointer to place to put response data, if any
|
||||
* @return length of response data, or 0 for no response data, or -1 on error
|
||||
*/
|
||||
static int process_cmd(struct ec_state *ec,
|
||||
struct ec_host_request *req_hdr, const void *req_data,
|
||||
struct ec_host_response *resp_hdr, void *resp_data)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* TODO(sjg@chromium.org): Check checksums */
|
||||
debug("EC command %#0x\n", req_hdr->command);
|
||||
|
||||
switch (req_hdr->command) {
|
||||
case EC_CMD_HELLO: {
|
||||
const struct ec_params_hello *req = req_data;
|
||||
struct ec_response_hello *resp = resp_data;
|
||||
|
||||
resp->out_data = req->in_data + 0x01020304;
|
||||
len = sizeof(*resp);
|
||||
break;
|
||||
}
|
||||
case EC_CMD_GET_VERSION: {
|
||||
struct ec_response_get_version *resp = resp_data;
|
||||
|
||||
strcpy(resp->version_string_ro, "sandbox_ro");
|
||||
strcpy(resp->version_string_rw, "sandbox_rw");
|
||||
resp->current_image = ec->current_image;
|
||||
debug("Current image %d\n", resp->current_image);
|
||||
len = sizeof(*resp);
|
||||
break;
|
||||
}
|
||||
case EC_CMD_VBNV_CONTEXT: {
|
||||
const struct ec_params_vbnvcontext *req = req_data;
|
||||
struct ec_response_vbnvcontext *resp = resp_data;
|
||||
|
||||
switch (req->op) {
|
||||
case EC_VBNV_CONTEXT_OP_READ:
|
||||
memcpy(resp->block, ec->vbnv_context,
|
||||
sizeof(resp->block));
|
||||
len = sizeof(*resp);
|
||||
break;
|
||||
case EC_VBNV_CONTEXT_OP_WRITE:
|
||||
memcpy(ec->vbnv_context, resp->block,
|
||||
sizeof(resp->block));
|
||||
len = 0;
|
||||
break;
|
||||
default:
|
||||
printf(" ** Unknown vbnv_context command %#02x\n",
|
||||
req->op);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EC_CMD_REBOOT_EC: {
|
||||
const struct ec_params_reboot_ec *req = req_data;
|
||||
|
||||
printf("Request reboot type %d\n", req->cmd);
|
||||
switch (req->cmd) {
|
||||
case EC_REBOOT_DISABLE_JUMP:
|
||||
len = 0;
|
||||
break;
|
||||
case EC_REBOOT_JUMP_RW:
|
||||
ec->current_image = EC_IMAGE_RW;
|
||||
len = 0;
|
||||
break;
|
||||
default:
|
||||
puts(" ** Unknown type");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EC_CMD_HOST_EVENT_GET_B: {
|
||||
struct ec_response_host_event_mask *resp = resp_data;
|
||||
|
||||
resp->mask = 0;
|
||||
if (ec->recovery_req) {
|
||||
resp->mask |= EC_HOST_EVENT_MASK(
|
||||
EC_HOST_EVENT_KEYBOARD_RECOVERY);
|
||||
}
|
||||
|
||||
len = sizeof(*resp);
|
||||
break;
|
||||
}
|
||||
case EC_CMD_VBOOT_HASH: {
|
||||
const struct ec_params_vboot_hash *req = req_data;
|
||||
struct ec_response_vboot_hash *resp = resp_data;
|
||||
struct fmap_entry *entry;
|
||||
int ret, size;
|
||||
|
||||
entry = &state->ec_config.region[EC_FLASH_REGION_RW];
|
||||
|
||||
switch (req->cmd) {
|
||||
case EC_VBOOT_HASH_RECALC:
|
||||
case EC_VBOOT_HASH_GET:
|
||||
size = SHA256_SUM_LEN;
|
||||
len = get_image_used(ec, entry);
|
||||
ret = hash_block("sha256",
|
||||
ec->flash_data + entry->offset,
|
||||
len, resp->hash_digest, &size);
|
||||
if (ret) {
|
||||
printf(" ** hash_block() failed\n");
|
||||
return -1;
|
||||
}
|
||||
resp->status = EC_VBOOT_HASH_STATUS_DONE;
|
||||
resp->hash_type = EC_VBOOT_HASH_TYPE_SHA256;
|
||||
resp->digest_size = size;
|
||||
resp->reserved0 = 0;
|
||||
resp->offset = entry->offset;
|
||||
resp->size = len;
|
||||
len = sizeof(*resp);
|
||||
break;
|
||||
default:
|
||||
printf(" ** EC_CMD_VBOOT_HASH: Unknown command %d\n",
|
||||
req->cmd);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EC_CMD_FLASH_PROTECT: {
|
||||
const struct ec_params_flash_protect *req = req_data;
|
||||
struct ec_response_flash_protect *resp = resp_data;
|
||||
uint32_t expect = EC_FLASH_PROTECT_ALL_NOW |
|
||||
EC_FLASH_PROTECT_ALL_AT_BOOT;
|
||||
|
||||
printf("mask=%#x, flags=%#x\n", req->mask, req->flags);
|
||||
if (req->flags == expect || req->flags == 0) {
|
||||
resp->flags = req->flags ? EC_FLASH_PROTECT_ALL_NOW :
|
||||
0;
|
||||
resp->valid_flags = EC_FLASH_PROTECT_ALL_NOW;
|
||||
resp->writable_flags = 0;
|
||||
len = sizeof(*resp);
|
||||
} else {
|
||||
puts(" ** unexpected flash protect request\n");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EC_CMD_FLASH_REGION_INFO: {
|
||||
const struct ec_params_flash_region_info *req = req_data;
|
||||
struct ec_response_flash_region_info *resp = resp_data;
|
||||
struct fmap_entry *entry;
|
||||
|
||||
switch (req->region) {
|
||||
case EC_FLASH_REGION_RO:
|
||||
case EC_FLASH_REGION_RW:
|
||||
case EC_FLASH_REGION_WP_RO:
|
||||
entry = &state->ec_config.region[req->region];
|
||||
resp->offset = entry->offset;
|
||||
resp->size = entry->length;
|
||||
len = sizeof(*resp);
|
||||
printf("EC flash region %d: offset=%#x, size=%#x\n",
|
||||
req->region, resp->offset, resp->size);
|
||||
break;
|
||||
default:
|
||||
printf("** Unknown flash region %d\n", req->region);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EC_CMD_FLASH_ERASE: {
|
||||
const struct ec_params_flash_erase *req = req_data;
|
||||
|
||||
memset(ec->flash_data + req->offset,
|
||||
ec->ec_config.flash_erase_value,
|
||||
req->size);
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
case EC_CMD_FLASH_WRITE: {
|
||||
const struct ec_params_flash_write *req = req_data;
|
||||
|
||||
memcpy(ec->flash_data + req->offset, req + 1, req->size);
|
||||
len = 0;
|
||||
break;
|
||||
}
|
||||
case EC_CMD_MKBP_STATE:
|
||||
len = cros_ec_keyscan(ec, resp_data);
|
||||
break;
|
||||
default:
|
||||
printf(" ** Unknown EC command %#02x\n", req_hdr->command);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int cros_ec_sandbox_packet(struct cros_ec_dev *dev, int out_bytes,
|
||||
int in_bytes)
|
||||
{
|
||||
struct ec_host_request *req_hdr = (struct ec_host_request *)dev->dout;
|
||||
const void *req_data = req_hdr + 1;
|
||||
struct ec_host_response *resp_hdr = (struct ec_host_response *)dev->din;
|
||||
void *resp_data = resp_hdr + 1;
|
||||
int len;
|
||||
|
||||
len = process_cmd(&s_state, req_hdr, req_data, resp_hdr, resp_data);
|
||||
if (len < 0)
|
||||
return len;
|
||||
|
||||
resp_hdr->struct_version = 3;
|
||||
resp_hdr->result = EC_RES_SUCCESS;
|
||||
resp_hdr->data_len = len;
|
||||
resp_hdr->reserved = 0;
|
||||
len += sizeof(*resp_hdr);
|
||||
resp_hdr->checksum = 0;
|
||||
resp_hdr->checksum = (uint8_t)
|
||||
-cros_ec_calc_checksum((const uint8_t *)resp_hdr, len);
|
||||
|
||||
return in_bytes;
|
||||
}
|
||||
|
||||
int cros_ec_sandbox_decode_fdt(struct cros_ec_dev *dev, const void *blob)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cros_ec_check_keyboard(struct cros_ec_dev *dev)
|
||||
{
|
||||
struct ec_state *ec = &s_state;
|
||||
ulong start;
|
||||
|
||||
printf("Press keys for EC to detect on reset (ESC=recovery)...");
|
||||
start = get_timer(0);
|
||||
while (get_timer(start) < 1000)
|
||||
;
|
||||
putc('\n');
|
||||
if (!sandbox_sdl_key_pressed(KEY_ESC)) {
|
||||
ec->recovery_req = true;
|
||||
printf(" - EC requests recovery\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize sandbox EC emulation.
|
||||
*
|
||||
* @param dev CROS_EC device
|
||||
* @param blob Device tree blob
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int cros_ec_sandbox_init(struct cros_ec_dev *dev, const void *blob)
|
||||
{
|
||||
struct ec_state *ec = &s_state;
|
||||
int node;
|
||||
int err;
|
||||
|
||||
state = &s_state;
|
||||
err = cros_ec_decode_ec_flash(blob, &ec->ec_config);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
node = fdtdec_next_compatible(blob, 0, COMPAT_GOOGLE_CROS_EC_KEYB);
|
||||
if (node < 0) {
|
||||
debug("%s: No cros_ec keyboard found\n", __func__);
|
||||
} else if (keyscan_read_fdt_matrix(ec, blob, node)) {
|
||||
debug("%s: Could not read key matrix\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If we loaded EC data, check that the length matches */
|
||||
if (ec->flash_data &&
|
||||
ec->flash_data_len != ec->ec_config.flash.length) {
|
||||
printf("EC data length is %x, expected %x, discarding data\n",
|
||||
ec->flash_data_len, ec->ec_config.flash.length);
|
||||
os_free(ec->flash_data);
|
||||
ec->flash_data = NULL;
|
||||
}
|
||||
|
||||
/* Otherwise allocate the memory */
|
||||
if (!ec->flash_data) {
|
||||
ec->flash_data_len = ec->ec_config.flash.length;
|
||||
ec->flash_data = os_malloc(ec->flash_data_len);
|
||||
if (!ec->flash_data)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -17,6 +17,30 @@
|
|||
#include <cros_ec.h>
|
||||
#include <spi.h>
|
||||
|
||||
int cros_ec_spi_packet(struct cros_ec_dev *dev, int out_bytes, int in_bytes)
|
||||
{
|
||||
int rv;
|
||||
|
||||
/* Do the transfer */
|
||||
if (spi_claim_bus(dev->spi)) {
|
||||
debug("%s: Cannot claim SPI bus\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rv = spi_xfer(dev->spi, max(out_bytes, in_bytes) * 8,
|
||||
dev->dout, dev->din,
|
||||
SPI_XFER_BEGIN | SPI_XFER_END);
|
||||
|
||||
spi_release_bus(dev->spi);
|
||||
|
||||
if (rv) {
|
||||
debug("%s: Cannot complete SPI transfer\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return in_bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a command to a LPC CROS_EC device and return the reply.
|
||||
*
|
||||
|
@ -42,6 +66,12 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
int csum, len;
|
||||
int rv;
|
||||
|
||||
if (dev->protocol_version != 2) {
|
||||
debug("%s: Unsupported EC protcol version %d\n",
|
||||
__func__, dev->protocol_version);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Sanity-check input size to make sure it plus transaction overhead
|
||||
* fits in the internal device buffer.
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
#include <spi.h>
|
||||
#include <spi_flash.h>
|
||||
|
@ -381,8 +382,11 @@ int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
|
|||
}
|
||||
|
||||
cmdsz = SPI_FLASH_CMD_LEN + flash->dummy_byte;
|
||||
cmd = malloc(cmdsz);
|
||||
memset(cmd, 0, cmdsz);
|
||||
cmd = calloc(1, cmdsz);
|
||||
if (!cmd) {
|
||||
debug("SF: Failed to allocate cmd\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
cmd[0] = flash->read_cmd;
|
||||
while (len) {
|
||||
|
|
|
@ -54,10 +54,11 @@ const struct spi_flash_params spi_flash_params_table[] = {
|
|||
{"S25FL128P_64K", 0x012018, 0x0301, 64 * 1024, 256, RD_FULL, WR_QPP},
|
||||
{"S25FL032P", 0x010215, 0x4d00, 64 * 1024, 64, RD_FULL, WR_QPP},
|
||||
{"S25FL064P", 0x010216, 0x4d00, 64 * 1024, 128, RD_FULL, WR_QPP},
|
||||
{"S25FL128S_256K", 0x012018, 0x4d00, 256 * 1024, 64, RD_FULL, WR_QPP},
|
||||
{"S25FL128S_64K", 0x012018, 0x4d01, 64 * 1024, 256, RD_FULL, WR_QPP},
|
||||
{"S25FL256S_256K", 0x010219, 0x4d00, 64 * 1024, 512, RD_FULL, WR_QPP},
|
||||
{"S25FL256S_256K", 0x010219, 0x4d00, 256 * 1024, 128, RD_FULL, WR_QPP},
|
||||
{"S25FL256S_64K", 0x010219, 0x4d01, 64 * 1024, 512, RD_FULL, WR_QPP},
|
||||
{"S25FL512S_256K", 0x010220, 0x4d00, 64 * 1024, 1024, RD_FULL, WR_QPP},
|
||||
{"S25FL512S_256K", 0x010220, 0x4d00, 256 * 1024, 256, RD_FULL, WR_QPP},
|
||||
{"S25FL512S_64K", 0x010220, 0x4d01, 64 * 1024, 1024, RD_FULL, WR_QPP},
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */
|
||||
|
|
|
@ -123,12 +123,11 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
flash = malloc(sizeof(*flash));
|
||||
flash = calloc(1, sizeof(*flash));
|
||||
if (!flash) {
|
||||
debug("SF: Failed to allocate spi_flash\n");
|
||||
return NULL;
|
||||
}
|
||||
memset(flash, '\0', sizeof(*flash));
|
||||
|
||||
/* Assign spi data */
|
||||
flash->spi = spi;
|
||||
|
@ -147,7 +146,21 @@ static struct spi_flash *spi_flash_validate_params(struct spi_slave *spi,
|
|||
|
||||
/* Compute the flash size */
|
||||
flash->shift = (flash->dual_flash & SF_DUAL_PARALLEL_FLASH) ? 1 : 0;
|
||||
flash->page_size = ((ext_jedec == 0x4d00) ? 512 : 256) << flash->shift;
|
||||
/*
|
||||
* The Spansion S25FL032P and S25FL064P have 256b pages, yet use the
|
||||
* 0x4d00 Extended JEDEC code. The rest of the Spansion flashes with
|
||||
* the 0x4d00 Extended JEDEC code have 512b pages. All of the others
|
||||
* have 256b pages.
|
||||
*/
|
||||
if (ext_jedec == 0x4d00) {
|
||||
if ((jedec == 0x0215) || (jedec == 0x216))
|
||||
flash->page_size = 256;
|
||||
else
|
||||
flash->page_size = 512;
|
||||
} else {
|
||||
flash->page_size = 256;
|
||||
}
|
||||
flash->page_size <<= flash->shift;
|
||||
flash->sector_size = params->sector_size << flash->shift;
|
||||
flash->size = flash->sector_size * params->nr_sectors << flash->shift;
|
||||
#ifdef CONFIG_SF_DUAL_FLASH
|
||||
|
|
|
@ -11,9 +11,11 @@
|
|||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <lcd.h>
|
||||
#include <os.h>
|
||||
#include <serial.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/state.h>
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -30,7 +32,10 @@ static unsigned int serial_buf_read;
|
|||
|
||||
static int sandbox_serial_init(void)
|
||||
{
|
||||
os_tty_raw(0);
|
||||
struct sandbox_state *state = state_get_current();
|
||||
|
||||
if (state->term_raw != STATE_TERM_COOKED)
|
||||
os_tty_raw(0, state->term_raw == STATE_TERM_RAW_WITH_SIGS);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -60,6 +65,9 @@ static int sandbox_serial_tstc(void)
|
|||
ssize_t count;
|
||||
|
||||
os_usleep(100);
|
||||
#ifdef CONFIG_LCD
|
||||
lcd_sync();
|
||||
#endif
|
||||
if (next_index == serial_buf_read)
|
||||
return 1; /* buffer full */
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#
|
||||
|
||||
obj-$(CONFIG_SOUND) += sound.o
|
||||
obj-$(CONFIG_I2S) += samsung-i2s.o
|
||||
obj-$(CONFIG_I2S) += sound-i2s.o
|
||||
obj-$(CONFIG_I2S_SAMSUNG) += samsung-i2s.o
|
||||
obj-$(CONFIG_SOUND_SANDBOX) += sandbox.o
|
||||
obj-$(CONFIG_SOUND_WM8994) += wm8994.o
|
||||
obj-$(CONFIG_SOUND_MAX98095) += max98095.o
|
||||
|
|
23
drivers/sound/sandbox.c
Normal file
23
drivers/sound/sandbox.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Google, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arch/sound.h>
|
||||
#include <asm/sdl.h>
|
||||
|
||||
int sound_play(uint32_t msec, uint32_t frequency)
|
||||
{
|
||||
sandbox_sdl_sound_start(frequency);
|
||||
mdelay(msec);
|
||||
sandbox_sdl_sound_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sound_init(const void *blob)
|
||||
{
|
||||
return sandbox_sdl_sound_init();
|
||||
}
|
208
drivers/sound/sound-i2s.c
Normal file
208
drivers/sound/sound-i2s.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* Copyright (C) 2012 Samsung Electronics
|
||||
* R. Chandrasekar <rcsekar@samsung.com>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <libfdt.h>
|
||||
#include <fdtdec.h>
|
||||
#include <i2c.h>
|
||||
#include <i2s.h>
|
||||
#include <sound.h>
|
||||
#include <asm/arch/sound.h>
|
||||
#include "wm8994.h"
|
||||
#include "max98095.h"
|
||||
|
||||
/* defines */
|
||||
#define SOUND_400_HZ 400
|
||||
#define SOUND_BITS_IN_BYTE 8
|
||||
|
||||
static struct i2stx_info g_i2stx_pri;
|
||||
|
||||
/*
|
||||
* get_sound_i2s_values gets values for i2s parameters
|
||||
*
|
||||
* @param i2stx_info i2s transmitter transfer param structure
|
||||
* @param blob FDT blob if enabled else NULL
|
||||
*/
|
||||
static int get_sound_i2s_values(struct i2stx_info *i2s, const void *blob)
|
||||
{
|
||||
int node;
|
||||
int error = 0;
|
||||
int base;
|
||||
|
||||
node = fdt_path_offset(blob, "i2s");
|
||||
if (node <= 0) {
|
||||
debug("EXYNOS_SOUND: No node for sound in device tree\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the pre-defined sound specific values from FDT.
|
||||
* All of these are expected to be correct otherwise
|
||||
* wrong register values in i2s setup parameters
|
||||
* may result in no sound play.
|
||||
*/
|
||||
base = fdtdec_get_addr(blob, node, "reg");
|
||||
if (base == FDT_ADDR_T_NONE) {
|
||||
debug("%s: Missing i2s base\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
i2s->base_address = base;
|
||||
|
||||
i2s->audio_pll_clk = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-epll-clock-frequency", -1);
|
||||
error |= i2s->audio_pll_clk;
|
||||
debug("audio_pll_clk = %d\n", i2s->audio_pll_clk);
|
||||
i2s->samplingrate = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-sampling-rate", -1);
|
||||
error |= i2s->samplingrate;
|
||||
debug("samplingrate = %d\n", i2s->samplingrate);
|
||||
i2s->bitspersample = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-bits-per-sample", -1);
|
||||
error |= i2s->bitspersample;
|
||||
debug("bitspersample = %d\n", i2s->bitspersample);
|
||||
i2s->channels = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-channels", -1);
|
||||
error |= i2s->channels;
|
||||
debug("channels = %d\n", i2s->channels);
|
||||
i2s->rfs = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-lr-clk-framesize", -1);
|
||||
error |= i2s->rfs;
|
||||
debug("rfs = %d\n", i2s->rfs);
|
||||
i2s->bfs = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-bit-clk-framesize", -1);
|
||||
error |= i2s->bfs;
|
||||
debug("bfs = %d\n", i2s->bfs);
|
||||
|
||||
i2s->id = fdtdec_get_int(blob, node, "samsung,i2s-id", -1);
|
||||
error |= i2s->id;
|
||||
debug("id = %d\n", i2s->id);
|
||||
|
||||
if (error == -1) {
|
||||
debug("fail to get sound i2s node properties\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init codec
|
||||
*
|
||||
* @param blob FDT blob
|
||||
* @param pi2s_tx i2s parameters required by codec
|
||||
* @return int value, 0 for success
|
||||
*/
|
||||
static int codec_init(const void *blob, struct i2stx_info *pi2s_tx)
|
||||
{
|
||||
int ret;
|
||||
const char *codectype;
|
||||
int node;
|
||||
|
||||
/* Get the node from FDT for sound */
|
||||
node = fdt_path_offset(blob, "i2s");
|
||||
if (node <= 0) {
|
||||
debug("EXYNOS_SOUND: No node for sound in device tree\n");
|
||||
debug("node = %d\n", node);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the pre-defined sound codec specific values from FDT.
|
||||
* All of these are expected to be correct otherwise sound
|
||||
* can not be played
|
||||
*/
|
||||
codectype = fdt_getprop(blob, node, "samsung,codec-type", NULL);
|
||||
debug("device = %s\n", codectype);
|
||||
if (!strcmp(codectype, "wm8994")) {
|
||||
/* Check the codec type and initialise the same */
|
||||
ret = wm8994_init(blob, pi2s_tx->id + 1,
|
||||
pi2s_tx->samplingrate,
|
||||
(pi2s_tx->samplingrate * (pi2s_tx->rfs)),
|
||||
pi2s_tx->bitspersample, pi2s_tx->channels);
|
||||
} else if (!strcmp(codectype, "max98095")) {
|
||||
ret = max98095_init(blob, pi2s_tx->id + 1,
|
||||
pi2s_tx->samplingrate,
|
||||
(pi2s_tx->samplingrate * (pi2s_tx->rfs)),
|
||||
pi2s_tx->bitspersample);
|
||||
} else {
|
||||
debug("%s: Unknown codec type %s\n", __func__, codectype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
debug("%s: Codec init failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sound_init(const void *blob)
|
||||
{
|
||||
int ret;
|
||||
struct i2stx_info *pi2s_tx = &g_i2stx_pri;
|
||||
|
||||
/* Get the I2S Values */
|
||||
if (get_sound_i2s_values(pi2s_tx, blob) < 0) {
|
||||
debug(" FDT I2S values failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (codec_init(blob, pi2s_tx) < 0) {
|
||||
debug(" Codec init failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = i2s_tx_init(pi2s_tx);
|
||||
if (ret) {
|
||||
debug("%s: Failed to init i2c transmit: ret=%d\n", __func__,
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sound_play(uint32_t msec, uint32_t frequency)
|
||||
{
|
||||
unsigned int *data;
|
||||
unsigned long data_size;
|
||||
unsigned int ret = 0;
|
||||
|
||||
/*Buffer length computation */
|
||||
data_size = g_i2stx_pri.samplingrate * g_i2stx_pri.channels;
|
||||
data_size *= (g_i2stx_pri.bitspersample / SOUND_BITS_IN_BYTE);
|
||||
data = malloc(data_size);
|
||||
|
||||
if (data == NULL) {
|
||||
debug("%s: malloc failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sound_create_square_wave((unsigned short *)data,
|
||||
data_size / sizeof(unsigned short),
|
||||
frequency);
|
||||
|
||||
while (msec >= 1000) {
|
||||
ret = i2s_transfer_tx_data(&g_i2stx_pri, data,
|
||||
(data_size / sizeof(int)));
|
||||
msec -= 1000;
|
||||
}
|
||||
if (msec) {
|
||||
unsigned long size =
|
||||
(data_size * msec) / (sizeof(int) * 1000);
|
||||
|
||||
ret = i2s_transfer_tx_data(&g_i2stx_pri, data, size);
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -5,193 +5,10 @@
|
|||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <malloc.h>
|
||||
#include <common.h>
|
||||
#include <asm/io.h>
|
||||
#include <libfdt.h>
|
||||
#include <fdtdec.h>
|
||||
#include <i2c.h>
|
||||
#include <i2s.h>
|
||||
#include <sound.h>
|
||||
#include <asm/arch/sound.h>
|
||||
#include "wm8994.h"
|
||||
#include "max98095.h"
|
||||
|
||||
/* defines */
|
||||
#define SOUND_400_HZ 400
|
||||
#define SOUND_BITS_IN_BYTE 8
|
||||
|
||||
static struct i2stx_info g_i2stx_pri;
|
||||
|
||||
/*
|
||||
* get_sound_i2s_values gets values for i2s parameters
|
||||
*
|
||||
* @param i2stx_info i2s transmitter transfer param structure
|
||||
* @param blob FDT blob if enabled else NULL
|
||||
*/
|
||||
static int get_sound_i2s_values(struct i2stx_info *i2s, const void *blob)
|
||||
{
|
||||
#ifdef CONFIG_OF_CONTROL
|
||||
int node;
|
||||
int error = 0;
|
||||
int base;
|
||||
|
||||
node = fdt_path_offset(blob, "i2s");
|
||||
if (node <= 0) {
|
||||
debug("EXYNOS_SOUND: No node for sound in device tree\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the pre-defined sound specific values from FDT.
|
||||
* All of these are expected to be correct otherwise
|
||||
* wrong register values in i2s setup parameters
|
||||
* may result in no sound play.
|
||||
*/
|
||||
base = fdtdec_get_addr(blob, node, "reg");
|
||||
if (base == FDT_ADDR_T_NONE) {
|
||||
debug("%s: Missing i2s base\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
i2s->base_address = base;
|
||||
|
||||
i2s->audio_pll_clk = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-epll-clock-frequency", -1);
|
||||
error |= i2s->audio_pll_clk;
|
||||
debug("audio_pll_clk = %d\n", i2s->audio_pll_clk);
|
||||
i2s->samplingrate = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-sampling-rate", -1);
|
||||
error |= i2s->samplingrate;
|
||||
debug("samplingrate = %d\n", i2s->samplingrate);
|
||||
i2s->bitspersample = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-bits-per-sample", -1);
|
||||
error |= i2s->bitspersample;
|
||||
debug("bitspersample = %d\n", i2s->bitspersample);
|
||||
i2s->channels = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-channels", -1);
|
||||
error |= i2s->channels;
|
||||
debug("channels = %d\n", i2s->channels);
|
||||
i2s->rfs = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-lr-clk-framesize", -1);
|
||||
error |= i2s->rfs;
|
||||
debug("rfs = %d\n", i2s->rfs);
|
||||
i2s->bfs = fdtdec_get_int(blob,
|
||||
node, "samsung,i2s-bit-clk-framesize", -1);
|
||||
error |= i2s->bfs;
|
||||
debug("bfs = %d\n", i2s->bfs);
|
||||
|
||||
i2s->id = fdtdec_get_int(blob, node, "samsung,i2s-id", -1);
|
||||
error |= i2s->id;
|
||||
debug("id = %d\n", i2s->id);
|
||||
|
||||
if (error == -1) {
|
||||
debug("fail to get sound i2s node properties\n");
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
i2s->base_address = samsung_get_base_i2s();
|
||||
i2s->audio_pll_clk = I2S_PLL_CLK;
|
||||
i2s->samplingrate = I2S_SAMPLING_RATE;
|
||||
i2s->bitspersample = I2S_BITS_PER_SAMPLE;
|
||||
i2s->channels = I2S_CHANNELS;
|
||||
i2s->rfs = I2S_RFS;
|
||||
i2s->bfs = I2S_BFS;
|
||||
i2s->id = 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Init codec
|
||||
*
|
||||
* @param blob FDT blob
|
||||
* @param pi2s_tx i2s parameters required by codec
|
||||
* @return int value, 0 for success
|
||||
*/
|
||||
static int codec_init(const void *blob, struct i2stx_info *pi2s_tx)
|
||||
{
|
||||
int ret;
|
||||
const char *codectype;
|
||||
#ifdef CONFIG_OF_CONTROL
|
||||
int node;
|
||||
|
||||
/* Get the node from FDT for sound */
|
||||
node = fdt_path_offset(blob, "i2s");
|
||||
if (node <= 0) {
|
||||
debug("EXYNOS_SOUND: No node for sound in device tree\n");
|
||||
debug("node = %d\n", node);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the pre-defined sound codec specific values from FDT.
|
||||
* All of these are expected to be correct otherwise sound
|
||||
* can not be played
|
||||
*/
|
||||
codectype = fdt_getprop(blob, node, "samsung,codec-type", NULL);
|
||||
debug("device = %s\n", codectype);
|
||||
#else
|
||||
codectype = AUDIO_CODEC;
|
||||
#endif
|
||||
if (!strcmp(codectype, "wm8994")) {
|
||||
/* Check the codec type and initialise the same */
|
||||
ret = wm8994_init(blob, pi2s_tx->id + 1,
|
||||
pi2s_tx->samplingrate,
|
||||
(pi2s_tx->samplingrate * (pi2s_tx->rfs)),
|
||||
pi2s_tx->bitspersample, pi2s_tx->channels);
|
||||
} else if (!strcmp(codectype, "max98095")) {
|
||||
ret = max98095_init(blob, pi2s_tx->id + 1,
|
||||
pi2s_tx->samplingrate,
|
||||
(pi2s_tx->samplingrate * (pi2s_tx->rfs)),
|
||||
pi2s_tx->bitspersample);
|
||||
} else {
|
||||
debug("%s: Unknown codec type %s\n", __func__, codectype);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
debug("%s: Codec init failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sound_init(const void *blob)
|
||||
{
|
||||
int ret;
|
||||
struct i2stx_info *pi2s_tx = &g_i2stx_pri;
|
||||
|
||||
/* Get the I2S Values */
|
||||
if (get_sound_i2s_values(pi2s_tx, blob) < 0) {
|
||||
debug(" FDT I2S values failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (codec_init(blob, pi2s_tx) < 0) {
|
||||
debug(" Codec init failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = i2s_tx_init(pi2s_tx);
|
||||
if (ret) {
|
||||
debug("%s: Failed to init i2c transmit: ret=%d\n", __func__,
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates square wave sound data for 1 second
|
||||
*
|
||||
* @param data data buffer pointer
|
||||
* @param size size of the buffer
|
||||
* @param freq frequency of the wave
|
||||
*/
|
||||
static void sound_prepare_buffer(unsigned short *data, int size, uint32_t freq)
|
||||
void sound_create_square_wave(unsigned short *data, int size, uint32_t freq)
|
||||
{
|
||||
const int sample = 48000;
|
||||
const unsigned short amplitude = 16000; /* between 1 and 32767 */
|
||||
|
@ -218,39 +35,3 @@ static void sound_prepare_buffer(unsigned short *data, int size, uint32_t freq)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sound_play(uint32_t msec, uint32_t frequency)
|
||||
{
|
||||
unsigned int *data;
|
||||
unsigned long data_size;
|
||||
unsigned int ret = 0;
|
||||
|
||||
/*Buffer length computation */
|
||||
data_size = g_i2stx_pri.samplingrate * g_i2stx_pri.channels;
|
||||
data_size *= (g_i2stx_pri.bitspersample / SOUND_BITS_IN_BYTE);
|
||||
data = malloc(data_size);
|
||||
|
||||
if (data == NULL) {
|
||||
debug("%s: malloc failed\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sound_prepare_buffer((unsigned short *)data,
|
||||
data_size / sizeof(unsigned short), frequency);
|
||||
|
||||
while (msec >= 1000) {
|
||||
ret = i2s_transfer_tx_data(&g_i2stx_pri, data,
|
||||
(data_size / sizeof(int)));
|
||||
msec -= 1000;
|
||||
}
|
||||
if (msec) {
|
||||
unsigned long size =
|
||||
(data_size * msec) / (sizeof(int) * 1000);
|
||||
|
||||
ret = i2s_transfer_tx_data(&g_i2stx_pri, data, size);
|
||||
}
|
||||
|
||||
free(data);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -102,33 +102,26 @@ void AT91F_SpiEnable(int cs)
|
|||
{
|
||||
unsigned long mode;
|
||||
|
||||
mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode &= ~AT91_SPI_PCS;
|
||||
|
||||
switch (cs) {
|
||||
case 0: /* Configure SPI CS0 for Serial DataFlash AT45DBxx */
|
||||
mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode &= 0xFFF0FFFF;
|
||||
writel(mode | ((AT91_SPI_PCS0_DATAFLASH_CARD<<16) & AT91_SPI_PCS),
|
||||
ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
case 0:
|
||||
mode |= AT91_SPI_PCS0_DATAFLASH_CARD << 16;
|
||||
break;
|
||||
case 1: /* Configure SPI CS1 for Serial DataFlash AT45DBxx */
|
||||
mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode &= 0xFFF0FFFF;
|
||||
writel(mode | ((AT91_SPI_PCS1_DATAFLASH_CARD<<16) & AT91_SPI_PCS),
|
||||
ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
case 1:
|
||||
mode |= AT91_SPI_PCS1_DATAFLASH_CARD << 16;
|
||||
break;
|
||||
case 2: /* Configure SPI CS2 for Serial DataFlash AT45DBxx */
|
||||
mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode &= 0xFFF0FFFF;
|
||||
writel(mode | ((AT91_SPI_PCS2_DATAFLASH_CARD<<16) & AT91_SPI_PCS),
|
||||
ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
case 2:
|
||||
mode |= AT91_SPI_PCS2_DATAFLASH_CARD << 16;
|
||||
break;
|
||||
case 3:
|
||||
mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode &= 0xFFF0FFFF;
|
||||
writel(mode | ((AT91_SPI_PCS3_DATAFLASH_CARD<<16) & AT91_SPI_PCS),
|
||||
ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
mode |= AT91_SPI_PCS3_DATAFLASH_CARD << 16;
|
||||
break;
|
||||
}
|
||||
|
||||
writel(mode, ATMEL_BASE_SPI0 + AT91_SPI_MR);
|
||||
|
||||
/* SPI_Enable */
|
||||
writel(AT91_SPI_SPIEN, ATMEL_BASE_SPI0 + AT91_SPI_CR);
|
||||
}
|
||||
|
|
|
@ -202,3 +202,16 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up a new SPI slave for an fdt node
|
||||
*
|
||||
* @param blob Device tree blob
|
||||
* @param node SPI peripheral node to use
|
||||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
struct spi_slave *spi_setup_slave_fdt(const void *blob, int slave_node,
|
||||
int spi_node)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -8,4 +8,5 @@ obj-$(CONFIG_USB_HOST_ETHER) += usb_ether.o
|
|||
ifdef CONFIG_USB_ETHER_ASIX
|
||||
obj-y += asix.o
|
||||
endif
|
||||
obj-$(CONFIG_USB_ETHER_MCS7830) += mcs7830.o
|
||||
obj-$(CONFIG_USB_ETHER_SMSC95XX) += smsc95xx.o
|
||||
|
|
812
drivers/usb/eth/mcs7830.c
Normal file
812
drivers/usb/eth/mcs7830.c
Normal file
|
@ -0,0 +1,812 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Gerhard Sittig <gsi@denx.de>
|
||||
* based on the U-Boot Asix driver as well as information
|
||||
* from the Linux Moschip driver
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* MOSCHIP MCS7830 based (7730/7830/7832) USB 2.0 Ethernet Devices
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <errno.h>
|
||||
#include <linux/mii.h>
|
||||
#include <malloc.h>
|
||||
#include <usb.h>
|
||||
|
||||
#include "usb_ether.h"
|
||||
|
||||
#define MCS7830_BASE_NAME "mcs"
|
||||
|
||||
#define USBCALL_TIMEOUT 1000
|
||||
#define LINKSTATUS_TIMEOUT 5000 /* link status, connect timeout */
|
||||
#define LINKSTATUS_TIMEOUT_RES 50 /* link status, resolution in msec */
|
||||
|
||||
#define MCS7830_RX_URB_SIZE 2048
|
||||
|
||||
/* command opcodes */
|
||||
#define MCS7830_WR_BREQ 0x0d
|
||||
#define MCS7830_RD_BREQ 0x0e
|
||||
|
||||
/* register layout, numerical offset specs for USB API calls */
|
||||
struct mcs7830_regs {
|
||||
uint8_t multicast_hashes[8];
|
||||
uint8_t packet_gap[2];
|
||||
uint8_t phy_data[2];
|
||||
uint8_t phy_command[2];
|
||||
uint8_t configuration;
|
||||
uint8_t ether_address[6];
|
||||
uint8_t frame_drop_count;
|
||||
uint8_t pause_threshold;
|
||||
};
|
||||
#define REG_MULTICAST_HASH offsetof(struct mcs7830_regs, multicast_hashes)
|
||||
#define REG_PHY_DATA offsetof(struct mcs7830_regs, phy_data)
|
||||
#define REG_PHY_CMD offsetof(struct mcs7830_regs, phy_command)
|
||||
#define REG_CONFIG offsetof(struct mcs7830_regs, configuration)
|
||||
#define REG_ETHER_ADDR offsetof(struct mcs7830_regs, ether_address)
|
||||
#define REG_FRAME_DROP_COUNTER offsetof(struct mcs7830_regs, frame_drop_count)
|
||||
#define REG_PAUSE_THRESHOLD offsetof(struct mcs7830_regs, pause_threshold)
|
||||
|
||||
/* bit masks and default values for the above registers */
|
||||
#define PHY_CMD1_READ 0x40
|
||||
#define PHY_CMD1_WRITE 0x20
|
||||
#define PHY_CMD1_PHYADDR 0x01
|
||||
|
||||
#define PHY_CMD2_PEND 0x80
|
||||
#define PHY_CMD2_READY 0x40
|
||||
|
||||
#define CONF_CFG 0x80
|
||||
#define CONF_SPEED100 0x40
|
||||
#define CONF_FDX_ENABLE 0x20
|
||||
#define CONF_RXENABLE 0x10
|
||||
#define CONF_TXENABLE 0x08
|
||||
#define CONF_SLEEPMODE 0x04
|
||||
#define CONF_ALLMULTICAST 0x02
|
||||
#define CONF_PROMISCUOUS 0x01
|
||||
|
||||
#define PAUSE_THRESHOLD_DEFAULT 0
|
||||
|
||||
/* bit masks for the status byte which follows received ethernet frames */
|
||||
#define STAT_RX_FRAME_CORRECT 0x20
|
||||
#define STAT_RX_LARGE_FRAME 0x10
|
||||
#define STAT_RX_CRC_ERROR 0x08
|
||||
#define STAT_RX_ALIGNMENT_ERROR 0x04
|
||||
#define STAT_RX_LENGTH_ERROR 0x02
|
||||
#define STAT_RX_SHORT_FRAME 0x01
|
||||
|
||||
/*
|
||||
* struct mcs7830_private - private driver data for an individual adapter
|
||||
* @config: shadow for the network adapter's configuration register
|
||||
* @mchash: shadow for the network adapter's multicast hash registers
|
||||
*/
|
||||
struct mcs7830_private {
|
||||
uint8_t config;
|
||||
uint8_t mchash[8];
|
||||
};
|
||||
|
||||
/*
|
||||
* mcs7830_read_reg() - read a register of the network adapter
|
||||
* @dev: network device to read from
|
||||
* @idx: index of the register to start reading from
|
||||
* @size: number of bytes to read
|
||||
* @data: buffer to read into
|
||||
* Return: zero upon success, negative upon error
|
||||
*/
|
||||
static int mcs7830_read_reg(struct ueth_data *dev, uint8_t idx,
|
||||
uint16_t size, void *data)
|
||||
{
|
||||
int len;
|
||||
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, buf, size);
|
||||
|
||||
debug("%s() idx=0x%04X sz=%d\n", __func__, idx, size);
|
||||
|
||||
len = usb_control_msg(dev->pusb_dev,
|
||||
usb_rcvctrlpipe(dev->pusb_dev, 0),
|
||||
MCS7830_RD_BREQ,
|
||||
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
0, idx, buf, size,
|
||||
USBCALL_TIMEOUT);
|
||||
if (len != size) {
|
||||
debug("%s() len=%d != sz=%d\n", __func__, len, size);
|
||||
return -EIO;
|
||||
}
|
||||
memcpy(data, buf, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_write_reg() - write a register of the network adapter
|
||||
* @dev: network device to write to
|
||||
* @idx: index of the register to start writing to
|
||||
* @size: number of bytes to write
|
||||
* @data: buffer holding the data to write
|
||||
* Return: zero upon success, negative upon error
|
||||
*/
|
||||
static int mcs7830_write_reg(struct ueth_data *dev, uint8_t idx,
|
||||
uint16_t size, void *data)
|
||||
{
|
||||
int len;
|
||||
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, buf, size);
|
||||
|
||||
debug("%s() idx=0x%04X sz=%d\n", __func__, idx, size);
|
||||
|
||||
memcpy(buf, data, size);
|
||||
len = usb_control_msg(dev->pusb_dev,
|
||||
usb_sndctrlpipe(dev->pusb_dev, 0),
|
||||
MCS7830_WR_BREQ,
|
||||
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
|
||||
0, idx, buf, size,
|
||||
USBCALL_TIMEOUT);
|
||||
if (len != size) {
|
||||
debug("%s() len=%d != sz=%d\n", __func__, len, size);
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_phy_emit_wait() - emit PHY read/write access, wait for its execution
|
||||
* @dev: network device to talk to
|
||||
* @rwflag: PHY_CMD1_READ or PHY_CMD1_WRITE opcode
|
||||
* @index: number of the PHY register to read or write
|
||||
* Return: zero upon success, negative upon error
|
||||
*/
|
||||
static int mcs7830_phy_emit_wait(struct ueth_data *dev,
|
||||
uint8_t rwflag, uint8_t index)
|
||||
{
|
||||
int rc;
|
||||
int retry;
|
||||
uint8_t cmd[2];
|
||||
|
||||
/* send the PHY read/write request */
|
||||
cmd[0] = rwflag | PHY_CMD1_PHYADDR;
|
||||
cmd[1] = PHY_CMD2_PEND | (index & 0x1f);
|
||||
rc = mcs7830_write_reg(dev, REG_PHY_CMD, sizeof(cmd), cmd);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* wait for the response to become available (usually < 1ms) */
|
||||
retry = 10;
|
||||
do {
|
||||
rc = mcs7830_read_reg(dev, REG_PHY_CMD, sizeof(cmd), cmd);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
if (cmd[1] & PHY_CMD2_READY)
|
||||
return 0;
|
||||
if (!retry--)
|
||||
return -ETIMEDOUT;
|
||||
mdelay(1);
|
||||
} while (1);
|
||||
/* UNREACH */
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_read_phy() - read a PHY register of the network adapter
|
||||
* @dev: network device to read from
|
||||
* @index: index of the PHY register to read from
|
||||
* Return: non-negative 16bit register content, negative upon error
|
||||
*/
|
||||
static int mcs7830_read_phy(struct ueth_data *dev, uint8_t index)
|
||||
{
|
||||
int rc;
|
||||
uint16_t val;
|
||||
|
||||
/* issue the PHY read request and wait for its execution */
|
||||
rc = mcs7830_phy_emit_wait(dev, PHY_CMD1_READ, index);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* fetch the PHY data which was read */
|
||||
rc = mcs7830_read_reg(dev, REG_PHY_DATA, sizeof(val), &val);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
rc = le16_to_cpu(val);
|
||||
debug("%s(%s, %d) => 0x%04X\n", __func__, dev->eth_dev.name, index, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_write_phy() - write a PHY register of the network adapter
|
||||
* @dev: network device to write to
|
||||
* @index: index of the PHY register to write to
|
||||
* @val: value to write to the PHY register
|
||||
* Return: zero upon success, negative upon error
|
||||
*/
|
||||
static int mcs7830_write_phy(struct ueth_data *dev, uint8_t index, uint16_t val)
|
||||
{
|
||||
int rc;
|
||||
|
||||
debug("%s(%s, %d, 0x%04X)\n", __func__, dev->eth_dev.name, index, val);
|
||||
|
||||
/* setup the PHY data which is to get written */
|
||||
val = cpu_to_le16(val);
|
||||
rc = mcs7830_write_reg(dev, REG_PHY_DATA, sizeof(val), &val);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* issue the PHY write request and wait for its execution */
|
||||
rc = mcs7830_phy_emit_wait(dev, PHY_CMD1_WRITE, index);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_write_config() - write to the network adapter's config register
|
||||
* @eth: network device to write to
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* the data which gets written is taken from the shadow config register
|
||||
* within the device driver's private data
|
||||
*/
|
||||
static int mcs7830_write_config(struct ueth_data *dev)
|
||||
{
|
||||
struct mcs7830_private *priv;
|
||||
int rc;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
priv = dev->dev_priv;
|
||||
|
||||
rc = mcs7830_write_reg(dev, REG_CONFIG,
|
||||
sizeof(priv->config), &priv->config);
|
||||
if (rc < 0) {
|
||||
debug("writing config to adapter failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_write_mchash() - write the network adapter's multicast filter
|
||||
* @eth: network device to write to
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* the data which gets written is taken from the shadow multicast hashes
|
||||
* within the device driver's private data
|
||||
*/
|
||||
static int mcs7830_write_mchash(struct ueth_data *dev)
|
||||
{
|
||||
struct mcs7830_private *priv;
|
||||
int rc;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
priv = dev->dev_priv;
|
||||
|
||||
rc = mcs7830_write_reg(dev, REG_MULTICAST_HASH,
|
||||
sizeof(priv->mchash), &priv->mchash);
|
||||
if (rc < 0) {
|
||||
debug("writing multicast hash to adapter failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_set_autoneg() - setup and trigger ethernet link autonegotiation
|
||||
* @eth: network device to run link negotiation on
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* the routine advertises available media and starts autonegotiation
|
||||
*/
|
||||
static int mcs7830_set_autoneg(struct ueth_data *dev)
|
||||
{
|
||||
int adv, flg;
|
||||
int rc;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
|
||||
/*
|
||||
* algorithm taken from the Linux driver, which took it from
|
||||
* "the original mcs7830 version 1.4 driver":
|
||||
*
|
||||
* enable all media, reset BMCR, enable auto neg, restart
|
||||
* auto neg while keeping the enable auto neg flag set
|
||||
*/
|
||||
|
||||
adv = ADVERTISE_PAUSE_CAP | ADVERTISE_ALL | ADVERTISE_CSMA;
|
||||
rc = mcs7830_write_phy(dev, MII_ADVERTISE, adv);
|
||||
|
||||
flg = 0;
|
||||
if (!rc)
|
||||
rc = mcs7830_write_phy(dev, MII_BMCR, flg);
|
||||
|
||||
flg |= BMCR_ANENABLE;
|
||||
if (!rc)
|
||||
rc = mcs7830_write_phy(dev, MII_BMCR, flg);
|
||||
|
||||
flg |= BMCR_ANRESTART;
|
||||
if (!rc)
|
||||
rc = mcs7830_write_phy(dev, MII_BMCR, flg);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_get_rev() - identify a network adapter's chip revision
|
||||
* @eth: network device to identify
|
||||
* Return: non-negative number, reflecting the revision number
|
||||
*
|
||||
* currently, only "rev C and higher" and "below rev C" are needed, so
|
||||
* the return value is #1 for "below rev C", and #2 for "rev C and above"
|
||||
*/
|
||||
static int mcs7830_get_rev(struct ueth_data *dev)
|
||||
{
|
||||
uint8_t buf[2];
|
||||
int rc;
|
||||
int rev;
|
||||
|
||||
/* register 22 is readable in rev C and higher */
|
||||
rc = mcs7830_read_reg(dev, REG_FRAME_DROP_COUNTER, sizeof(buf), buf);
|
||||
if (rc < 0)
|
||||
rev = 1;
|
||||
else
|
||||
rev = 2;
|
||||
debug("%s() rc=%d, rev=%d\n", __func__, rc, rev);
|
||||
return rev;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_apply_fixup() - identify an adapter and potentially apply fixups
|
||||
* @eth: network device to identify and apply fixups to
|
||||
* Return: zero upon success (no errors emitted from here)
|
||||
*
|
||||
* this routine identifies the network adapter's chip revision, and applies
|
||||
* fixups for known issues
|
||||
*/
|
||||
static int mcs7830_apply_fixup(struct ueth_data *dev)
|
||||
{
|
||||
int rev;
|
||||
int i;
|
||||
uint8_t thr;
|
||||
|
||||
rev = mcs7830_get_rev(dev);
|
||||
debug("%s() rev=%d\n", __func__, rev);
|
||||
|
||||
/*
|
||||
* rev C requires setting the pause threshold (the Linux driver
|
||||
* is inconsistent, the implementation does it for "rev C
|
||||
* exactly", the introductory comment says "rev C and above")
|
||||
*/
|
||||
if (rev == 2) {
|
||||
debug("%s: applying rev C fixup\n", dev->eth_dev.name);
|
||||
thr = PAUSE_THRESHOLD_DEFAULT;
|
||||
for (i = 0; i < 2; i++) {
|
||||
(void)mcs7830_write_reg(dev, REG_PAUSE_THRESHOLD,
|
||||
sizeof(thr), &thr);
|
||||
mdelay(1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_basic_reset() - bring the network adapter into a known first state
|
||||
* @eth: network device to act upon
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* this routine initializes the network adapter such that subsequent invocations
|
||||
* of the interface callbacks can exchange ethernet frames; link negotiation is
|
||||
* triggered from here already and continues in background
|
||||
*/
|
||||
static int mcs7830_basic_reset(struct ueth_data *dev)
|
||||
{
|
||||
struct mcs7830_private *priv;
|
||||
int rc;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
priv = dev->dev_priv;
|
||||
|
||||
/*
|
||||
* comment from the respective Linux driver, which
|
||||
* unconditionally sets the ALLMULTICAST flag as well:
|
||||
* should not be needed, but does not work otherwise
|
||||
*/
|
||||
priv->config = CONF_TXENABLE;
|
||||
priv->config |= CONF_ALLMULTICAST;
|
||||
|
||||
rc = mcs7830_set_autoneg(dev);
|
||||
if (rc < 0) {
|
||||
error("setting autoneg failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = mcs7830_write_mchash(dev);
|
||||
if (rc < 0) {
|
||||
error("failed to set multicast hash\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = mcs7830_write_config(dev);
|
||||
if (rc < 0) {
|
||||
error("failed to set configuration\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = mcs7830_apply_fixup(dev);
|
||||
if (rc < 0) {
|
||||
error("fixup application failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_read_mac() - read an ethernet adapter's MAC address
|
||||
* @eth: network device to read from
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* this routine fetches the MAC address stored within the ethernet adapter,
|
||||
* and stores it in the ethernet interface's data structure
|
||||
*/
|
||||
static int mcs7830_read_mac(struct eth_device *eth)
|
||||
{
|
||||
struct ueth_data *dev;
|
||||
int rc;
|
||||
uint8_t buf[ETH_ALEN];
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
dev = eth->priv;
|
||||
|
||||
rc = mcs7830_read_reg(dev, REG_ETHER_ADDR, ETH_ALEN, buf);
|
||||
if (rc < 0) {
|
||||
debug("reading MAC from adapter failed\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
memcpy(ð->enetaddr[0], buf, ETH_ALEN);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_write_mac() - write an ethernet adapter's MAC address
|
||||
* @eth: network device to write to
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* this routine takes the MAC address from the ethernet interface's data
|
||||
* structure, and writes it into the ethernet adapter such that subsequent
|
||||
* exchange of ethernet frames uses this address
|
||||
*/
|
||||
static int mcs7830_write_mac(struct eth_device *eth)
|
||||
{
|
||||
struct ueth_data *dev;
|
||||
int rc;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
dev = eth->priv;
|
||||
|
||||
if (sizeof(eth->enetaddr) != ETH_ALEN)
|
||||
return -EINVAL;
|
||||
rc = mcs7830_write_reg(dev, REG_ETHER_ADDR, ETH_ALEN, eth->enetaddr);
|
||||
if (rc < 0) {
|
||||
debug("writing MAC to adapter failed\n");
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_init() - network interface's init callback
|
||||
* @eth: network device to initialize
|
||||
* @bd: board information
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* after initial setup during probe() and get_info(), this init() callback
|
||||
* ensures that the link is up and subsequent send() and recv() calls can
|
||||
* exchange ethernet frames
|
||||
*/
|
||||
static int mcs7830_init(struct eth_device *eth, bd_t *bd)
|
||||
{
|
||||
struct ueth_data *dev;
|
||||
int timeout;
|
||||
int have_link;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
dev = eth->priv;
|
||||
|
||||
timeout = 0;
|
||||
do {
|
||||
have_link = mcs7830_read_phy(dev, MII_BMSR) & BMSR_LSTATUS;
|
||||
if (have_link)
|
||||
break;
|
||||
udelay(LINKSTATUS_TIMEOUT_RES * 1000);
|
||||
timeout += LINKSTATUS_TIMEOUT_RES;
|
||||
} while (timeout < LINKSTATUS_TIMEOUT);
|
||||
if (!have_link) {
|
||||
debug("ethernet link is down\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_send() - network interface's send callback
|
||||
* @eth: network device to send the frame from
|
||||
* @packet: ethernet frame content
|
||||
* @length: ethernet frame length
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* this routine send an ethernet frame out of the network interface
|
||||
*/
|
||||
static int mcs7830_send(struct eth_device *eth, void *packet, int length)
|
||||
{
|
||||
struct ueth_data *dev;
|
||||
int rc;
|
||||
int gotlen;
|
||||
/* there is a status byte after the ethernet frame */
|
||||
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, buf, PKTSIZE + sizeof(uint8_t));
|
||||
|
||||
dev = eth->priv;
|
||||
|
||||
memcpy(buf, packet, length);
|
||||
rc = usb_bulk_msg(dev->pusb_dev,
|
||||
usb_sndbulkpipe(dev->pusb_dev, dev->ep_out),
|
||||
&buf[0], length, &gotlen,
|
||||
USBCALL_TIMEOUT);
|
||||
debug("%s() TX want len %d, got len %d, rc %d\n",
|
||||
__func__, length, gotlen, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_recv() - network interface's recv callback
|
||||
* @eth: network device to receive frames from
|
||||
* Return: zero upon success, negative upon error
|
||||
*
|
||||
* this routine checks for available ethernet frames that the network
|
||||
* interface might have received, and notifies the network stack
|
||||
*/
|
||||
static int mcs7830_recv(struct eth_device *eth)
|
||||
{
|
||||
struct ueth_data *dev;
|
||||
ALLOC_CACHE_ALIGN_BUFFER(uint8_t, buf, MCS7830_RX_URB_SIZE);
|
||||
int rc, wantlen, gotlen;
|
||||
uint8_t sts;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
dev = eth->priv;
|
||||
|
||||
/* fetch input data from the adapter */
|
||||
wantlen = MCS7830_RX_URB_SIZE;
|
||||
rc = usb_bulk_msg(dev->pusb_dev,
|
||||
usb_rcvbulkpipe(dev->pusb_dev, dev->ep_in),
|
||||
&buf[0], wantlen, &gotlen,
|
||||
USBCALL_TIMEOUT);
|
||||
debug("%s() RX want len %d, got len %d, rc %d\n",
|
||||
__func__, wantlen, gotlen, rc);
|
||||
if (rc != 0) {
|
||||
error("RX: failed to receive\n");
|
||||
return rc;
|
||||
}
|
||||
if (gotlen > wantlen) {
|
||||
error("RX: got too many bytes (%d)\n", gotlen);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* the bulk message that we received from USB contains exactly
|
||||
* one ethernet frame and a trailing status byte
|
||||
*/
|
||||
if (gotlen < sizeof(sts))
|
||||
return -EIO;
|
||||
gotlen -= sizeof(sts);
|
||||
sts = buf[gotlen];
|
||||
|
||||
if (sts == STAT_RX_FRAME_CORRECT) {
|
||||
debug("%s() got a frame, len=%d\n", __func__, gotlen);
|
||||
NetReceive(buf, gotlen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
debug("RX: frame error (sts 0x%02X, %s %s %s %s %s)\n",
|
||||
sts,
|
||||
(sts & STAT_RX_LARGE_FRAME) ? "large" : "-",
|
||||
(sts & STAT_RX_LENGTH_ERROR) ? "length" : "-",
|
||||
(sts & STAT_RX_SHORT_FRAME) ? "short" : "-",
|
||||
(sts & STAT_RX_CRC_ERROR) ? "crc" : "-",
|
||||
(sts & STAT_RX_ALIGNMENT_ERROR) ? "align" : "-");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_halt() - network interface's halt callback
|
||||
* @eth: network device to cease operation of
|
||||
* Return: none
|
||||
*
|
||||
* this routine is supposed to undo the effect of previous initialization and
|
||||
* ethernet frames exchange; in this implementation it's a NOP
|
||||
*/
|
||||
static void mcs7830_halt(struct eth_device *eth)
|
||||
{
|
||||
debug("%s()\n", __func__);
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_iface_idx - index of detected network interfaces
|
||||
*
|
||||
* this counter keeps track of identified supported interfaces,
|
||||
* to assign unique names as more interfaces are found
|
||||
*/
|
||||
static int mcs7830_iface_idx;
|
||||
|
||||
/*
|
||||
* mcs7830_eth_before_probe() - network driver's before_probe callback
|
||||
* Return: none
|
||||
*
|
||||
* this routine initializes driver's internal data in preparation of
|
||||
* subsequent probe callbacks
|
||||
*/
|
||||
void mcs7830_eth_before_probe(void)
|
||||
{
|
||||
mcs7830_iface_idx = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* struct mcs7830_dongle - description of a supported Moschip ethernet dongle
|
||||
* @vendor: 16bit USB vendor identification
|
||||
* @product: 16bit USB product identification
|
||||
*
|
||||
* this structure describes a supported USB ethernet dongle by means of the
|
||||
* vendor and product codes found during USB enumeration; no flags are held
|
||||
* here since all supported dongles have identical behaviour, and required
|
||||
* fixups get determined at runtime, such that no manual configuration is
|
||||
* needed
|
||||
*/
|
||||
struct mcs7830_dongle {
|
||||
uint16_t vendor;
|
||||
uint16_t product;
|
||||
};
|
||||
|
||||
/*
|
||||
* mcs7830_dongles - the list of supported Moschip based USB ethernet dongles
|
||||
*/
|
||||
static const struct mcs7830_dongle const mcs7830_dongles[] = {
|
||||
{ 0x9710, 0x7832, }, /* Moschip 7832 */
|
||||
{ 0x9710, 0x7830, }, /* Moschip 7830 */
|
||||
{ 0x9710, 0x7730, }, /* Moschip 7730 */
|
||||
{ 0x0df6, 0x0021, }, /* Sitecom LN 30 */
|
||||
};
|
||||
|
||||
/*
|
||||
* mcs7830_eth_probe() - network driver's probe callback
|
||||
* @dev: detected USB device to check
|
||||
* @ifnum: detected USB interface to check
|
||||
* @ss: USB ethernet data structure to fill in upon match
|
||||
* Return: #1 upon match, #0 upon mismatch or error
|
||||
*
|
||||
* this routine checks whether the found USB device is supported by
|
||||
* this ethernet driver, and upon match fills in the USB ethernet
|
||||
* data structure which later is passed to the get_info callback
|
||||
*/
|
||||
int mcs7830_eth_probe(struct usb_device *dev, unsigned int ifnum,
|
||||
struct ueth_data *ss)
|
||||
{
|
||||
struct usb_interface *iface;
|
||||
struct usb_interface_descriptor *iface_desc;
|
||||
int i;
|
||||
struct mcs7830_private *priv;
|
||||
int ep_in_found, ep_out_found, ep_intr_found;
|
||||
|
||||
debug("%s()\n", __func__);
|
||||
|
||||
/* iterate the list of supported dongles */
|
||||
iface = &dev->config.if_desc[ifnum];
|
||||
iface_desc = &iface->desc;
|
||||
for (i = 0; i < ARRAY_SIZE(mcs7830_dongles); i++) {
|
||||
if (dev->descriptor.idVendor == mcs7830_dongles[i].vendor &&
|
||||
dev->descriptor.idProduct == mcs7830_dongles[i].product)
|
||||
break;
|
||||
}
|
||||
if (i == ARRAY_SIZE(mcs7830_dongles))
|
||||
return 0;
|
||||
debug("detected USB ethernet device: %04X:%04X\n",
|
||||
dev->descriptor.idVendor, dev->descriptor.idProduct);
|
||||
|
||||
/* fill in driver private data */
|
||||
priv = calloc(1, sizeof(*priv));
|
||||
if (!priv)
|
||||
return 0;
|
||||
|
||||
/* fill in the ueth_data structure, attach private data */
|
||||
memset(ss, 0, sizeof(*ss));
|
||||
ss->ifnum = ifnum;
|
||||
ss->pusb_dev = dev;
|
||||
ss->subclass = iface_desc->bInterfaceSubClass;
|
||||
ss->protocol = iface_desc->bInterfaceProtocol;
|
||||
ss->dev_priv = priv;
|
||||
|
||||
/*
|
||||
* a minimum of three endpoints is expected: in (bulk),
|
||||
* out (bulk), and interrupt; ignore all others
|
||||
*/
|
||||
ep_in_found = ep_out_found = ep_intr_found = 0;
|
||||
for (i = 0; i < iface_desc->bNumEndpoints; i++) {
|
||||
uint8_t eptype, epaddr;
|
||||
bool is_input;
|
||||
|
||||
eptype = iface->ep_desc[i].bmAttributes;
|
||||
eptype &= USB_ENDPOINT_XFERTYPE_MASK;
|
||||
|
||||
epaddr = iface->ep_desc[i].bEndpointAddress;
|
||||
is_input = epaddr & USB_DIR_IN;
|
||||
epaddr &= USB_ENDPOINT_NUMBER_MASK;
|
||||
|
||||
if (eptype == USB_ENDPOINT_XFER_BULK) {
|
||||
if (is_input && !ep_in_found) {
|
||||
ss->ep_in = epaddr;
|
||||
ep_in_found++;
|
||||
}
|
||||
if (!is_input && !ep_out_found) {
|
||||
ss->ep_out = epaddr;
|
||||
ep_out_found++;
|
||||
}
|
||||
}
|
||||
|
||||
if (eptype == USB_ENDPOINT_XFER_INT) {
|
||||
if (is_input && !ep_intr_found) {
|
||||
ss->ep_int = epaddr;
|
||||
ss->irqinterval = iface->ep_desc[i].bInterval;
|
||||
ep_intr_found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
debug("endpoints: in %d, out %d, intr %d\n",
|
||||
ss->ep_in, ss->ep_out, ss->ep_int);
|
||||
|
||||
/* apply basic sanity checks */
|
||||
if (usb_set_interface(dev, iface_desc->bInterfaceNumber, 0) ||
|
||||
!ss->ep_in || !ss->ep_out || !ss->ep_int) {
|
||||
debug("device probe incomplete\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev->privptr = ss;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* mcs7830_eth_get_info() - network driver's get_info callback
|
||||
* @dev: detected USB device
|
||||
* @ss: USB ethernet data structure filled in at probe()
|
||||
* @eth: ethernet interface data structure to fill in
|
||||
* Return: #1 upon success, #0 upon error
|
||||
*
|
||||
* this routine registers the mandatory init(), send(), recv(), and
|
||||
* halt() callbacks with the ethernet interface, can register the
|
||||
* optional write_hwaddr() callback with the ethernet interface,
|
||||
* and initiates configuration of the interface such that subsequent
|
||||
* calls to those callbacks results in network communication
|
||||
*/
|
||||
int mcs7830_eth_get_info(struct usb_device *dev, struct ueth_data *ss,
|
||||
struct eth_device *eth)
|
||||
{
|
||||
debug("%s()\n", __func__);
|
||||
if (!eth) {
|
||||
debug("%s: missing parameter.\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(eth->name, sizeof(eth->name), "%s%d",
|
||||
MCS7830_BASE_NAME, mcs7830_iface_idx++);
|
||||
eth->init = mcs7830_init;
|
||||
eth->send = mcs7830_send;
|
||||
eth->recv = mcs7830_recv;
|
||||
eth->halt = mcs7830_halt;
|
||||
eth->write_hwaddr = mcs7830_write_mac;
|
||||
eth->priv = ss;
|
||||
|
||||
if (mcs7830_basic_reset(ss))
|
||||
return 0;
|
||||
|
||||
if (mcs7830_read_mac(eth))
|
||||
return 0;
|
||||
debug("MAC %pM\n", eth->enetaddr);
|
||||
|
||||
return 1;
|
||||
}
|
|
@ -30,6 +30,13 @@ static const struct usb_eth_prob_dev prob_dev[] = {
|
|||
.get_info = asix_eth_get_info,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_USB_ETHER_MCS7830
|
||||
{
|
||||
.before_probe = mcs7830_eth_before_probe,
|
||||
.probe = mcs7830_eth_probe,
|
||||
.get_info = mcs7830_eth_get_info,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_USB_ETHER_SMSC95XX
|
||||
{
|
||||
.before_probe = smsc95xx_eth_before_probe,
|
||||
|
|
|
@ -33,6 +33,7 @@ obj-$(CONFIG_VIDEO_MX3) += mx3fb.o videomodes.o
|
|||
obj-$(CONFIG_VIDEO_IPUV3) += mxc_ipuv3_fb.o ipu_common.o ipu_disp.o
|
||||
obj-$(CONFIG_VIDEO_MXS) += mxsfb.o videomodes.o
|
||||
obj-$(CONFIG_VIDEO_OMAP3) += omap3_dss.o
|
||||
obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o
|
||||
obj-$(CONFIG_VIDEO_SED13806) += sed13806.o
|
||||
obj-$(CONFIG_VIDEO_SM501) += sm501.o
|
||||
obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
|
||||
|
|
79
drivers/video/sandbox_sdl.c
Normal file
79
drivers/video/sandbox_sdl.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Google, Inc
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <fdtdec.h>
|
||||
#include <lcd.h>
|
||||
#include <malloc.h>
|
||||
#include <asm/sdl.h>
|
||||
#include <asm/u-boot-sandbox.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
enum {
|
||||
/* Maximum LCD size we support */
|
||||
LCD_MAX_WIDTH = 1366,
|
||||
LCD_MAX_HEIGHT = 768,
|
||||
LCD_MAX_LOG2_BPP = 4, /* 2^4 = 16 bpp */
|
||||
};
|
||||
|
||||
vidinfo_t panel_info;
|
||||
|
||||
void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue)
|
||||
{
|
||||
}
|
||||
|
||||
void lcd_ctrl_init(void *lcdbase)
|
||||
{
|
||||
/*
|
||||
* Allocate memory to keep BMP color conversion map. This is required
|
||||
* for 8 bit BMPs only (hence 256 colors). If malloc fails - keep
|
||||
* going, it is not even clear if displyaing the bitmap will be
|
||||
* required on the way up.
|
||||
*/
|
||||
panel_info.cmap = malloc(256 * NBITS(panel_info.vl_bpix) / 8);
|
||||
}
|
||||
|
||||
void lcd_enable(void)
|
||||
{
|
||||
if (sandbox_sdl_init_display(panel_info.vl_col, panel_info.vl_row,
|
||||
panel_info.vl_bpix))
|
||||
puts("LCD init failed\n");
|
||||
}
|
||||
|
||||
int sandbox_lcd_sdl_early_init(void)
|
||||
{
|
||||
const void *blob = gd->fdt_blob;
|
||||
int xres = LCD_MAX_WIDTH, yres = LCD_MAX_HEIGHT;
|
||||
int node;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* The code in common/lcd.c does not cope with not being able to
|
||||
* set up a frame buffer. It will just happily keep writing to
|
||||
* invalid memory. So here we make sure that at least some buffer
|
||||
* is available even if it actually won't be displayed.
|
||||
*/
|
||||
node = fdtdec_next_compatible(blob, 0, COMPAT_SANDBOX_LCD_SDL);
|
||||
if (node >= 0) {
|
||||
xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH);
|
||||
yres = fdtdec_get_int(blob, node, "yres", LCD_MAX_HEIGHT);
|
||||
if (xres < 0 || xres > LCD_MAX_WIDTH) {
|
||||
xres = LCD_MAX_WIDTH;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
if (yres < 0 || yres > LCD_MAX_HEIGHT) {
|
||||
yres = LCD_MAX_HEIGHT;
|
||||
ret = -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
panel_info.vl_col = xres;
|
||||
panel_info.vl_row = yres;
|
||||
panel_info.vl_bpix = LCD_COLOR16;
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -314,6 +314,7 @@ static inline int print_cpuinfo(void)
|
|||
}
|
||||
#endif
|
||||
int update_flash_size(int flash_size);
|
||||
int arch_early_init_r(void);
|
||||
|
||||
/**
|
||||
* Show the DRAM size in a board-specific way
|
||||
|
@ -360,6 +361,11 @@ int do_ext2load(cmd_tbl_t *, int, int, char * const []);
|
|||
int env_init (void);
|
||||
void env_relocate (void);
|
||||
int envmatch (uchar *, int);
|
||||
|
||||
/* Avoid unfortunate conflict with libc's getenv() */
|
||||
#ifdef CONFIG_SANDBOX
|
||||
#define getenv uboot_getenv
|
||||
#endif
|
||||
char *getenv (const char *);
|
||||
int getenv_f (const char *name, char *buf, unsigned len);
|
||||
ulong getenv_ulong(const char *name, int base, ulong default_val);
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/b4860qds/b4_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/b4860qds/b4_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/b4860qds/b4_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/b4860qds/b4_rcw.cfg
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/corenet_ds/pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW \
|
||||
$(SRCTREE)/board/freescale/corenet_ds/rcw_p2041rdb.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/corenet_ds/pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/corenet_ds/rcw_p2041rdb.cfg
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/t1040qds/t1040_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/t1040qds/t1040_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/t1040qds/t1040_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t1040qds/t1040_rcw.cfg
|
||||
#endif
|
||||
|
||||
/* High Level Configuration Options */
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/t208xqds/t208x_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/t208xqds/t208x_pbi.cfg
|
||||
#if defined(CONFIG_PPC_T2080)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/t208xqds/t2080_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t208xqds/t2080_rcw.cfg
|
||||
#elif defined(CONFIG_PPC_T2081)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/t208xqds/t2081_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t208xqds/t2081_rcw.cfg
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/t208xrdb/t2080_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/t208xrdb/t2080_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/t208xrdb/t2080_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t208xrdb/t2080_rcw.cfg
|
||||
#endif
|
||||
|
||||
#define CONFIG_SRIO_PCIE_BOOT_MASTER
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/t4qds/t4_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/freescale/t4qds/t4_rcw.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/t4qds/t4_pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/t4qds/t4_rcw.cfg
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SRIO_PCIE_BOOT_SLAVE
|
||||
|
|
|
@ -15,19 +15,15 @@
|
|||
#ifdef CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/freescale/corenet_ds/pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/freescale/corenet_ds/pbi.cfg
|
||||
#if defined(CONFIG_P3041DS)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW \
|
||||
$(SRCTREE)/board/freescale/corenet_ds/rcw_p3041ds.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/corenet_ds/rcw_p3041ds.cfg
|
||||
#elif defined(CONFIG_P4080DS)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW \
|
||||
$(SRCTREE)/board/freescale/corenet_ds/rcw_p4080ds.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/corenet_ds/rcw_p4080ds.cfg
|
||||
#elif defined(CONFIG_P5020DS)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW \
|
||||
$(SRCTREE)/board/freescale/corenet_ds/rcw_p5020ds.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/corenet_ds/rcw_p5020ds.cfg
|
||||
#elif defined(CONFIG_P5040DS)
|
||||
#define CONFIG_SYS_FSL_PBL_RCW \
|
||||
$(SRCTREE)/board/freescale/corenet_ds/rcw_p5040ds.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/freescale/corenet_ds/rcw_p5040ds.cfg
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#define CONFIG_CMD_SOUND
|
||||
#ifdef CONFIG_CMD_SOUND
|
||||
#define CONFIG_SOUND
|
||||
#define CONFIG_I2S_SAMSUNG
|
||||
#define CONFIG_I2S
|
||||
#define CONFIG_SOUND_MAX98095
|
||||
#define CONFIG_SOUND_WM8994
|
||||
|
|
|
@ -61,8 +61,9 @@
|
|||
|
||||
/* USB networking support */
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
|
||||
/* General networking support */
|
||||
#define CONFIG_CMD_NET
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
#define CONFIG_RAMBOOT_PBL
|
||||
#define CONFIG_RAMBOOT_TEXT_BASE CONFIG_SYS_TEXT_BASE
|
||||
#define CONFIG_RESET_VECTOR_ADDRESS 0xfffffffc
|
||||
#define CONFIG_SYS_FSL_PBL_PBI $(SRCTREE)/board/keymile/kmp204x/pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW $(SRCTREE)/board/keymile/kmp204x/rcw_kmp204x.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_PBI board/keymile/kmp204x/pbi.cfg
|
||||
#define CONFIG_SYS_FSL_PBL_RCW board/keymile/kmp204x/rcw_kmp204x.cfg
|
||||
|
||||
/* High Level Configuration Options */
|
||||
#define CONFIG_BOOKE
|
||||
|
|
|
@ -40,8 +40,7 @@
|
|||
#define CONFIG_IDENT_STRING "\nKeymile Kirkwood 128M16"
|
||||
#define CONFIG_HOSTNAME km_kirkwood_128m16
|
||||
#undef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG \
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_KM_DISABLE_PCIE
|
||||
#define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/
|
||||
|
||||
|
@ -59,8 +58,7 @@
|
|||
#endif
|
||||
|
||||
#undef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG \
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_KM_ENV_IS_IN_SPI_NOR
|
||||
#define CONFIG_KM_FPGA_CONFIG
|
||||
#define CONFIG_KM_PIGGY4_88E6352
|
||||
|
@ -73,8 +71,7 @@
|
|||
#define CONFIG_HOSTNAME mgcoge3un
|
||||
#define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/
|
||||
#undef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG \
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-memphis.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-memphis.cfg
|
||||
#define CONFIG_KM_BOARD_EXTRA_ENV "waitforne=true\0"
|
||||
#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 3
|
||||
#define CONFIG_KM_DISABLE_PCIE
|
||||
|
@ -85,8 +82,7 @@
|
|||
#define CONFIG_IDENT_STRING "\nKeymile COGE5UN"
|
||||
#define CONFIG_KM_IVM_BUS 1 /* I2C2 (Mux-Port 1)*/
|
||||
#undef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG \
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage_256M8_1.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage_256M8_1.cfg
|
||||
#define CONFIG_KM_ENV_IS_IN_SPI_NOR
|
||||
#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 3
|
||||
#define CONFIG_HOSTNAME kmcoge5un
|
||||
|
@ -106,8 +102,7 @@
|
|||
#define CONFIG_IDENT_STRING "\nKeymile SUV31"
|
||||
#define CONFIG_HOSTNAME kmsuv31
|
||||
#undef CONFIG_SYS_KWD_CONFIG
|
||||
#define CONFIG_SYS_KWD_CONFIG \
|
||||
$(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage_128M16_1.cfg
|
||||
#define CONFIG_KM_ENV_IS_IN_SPI_NOR
|
||||
#define CONFIG_KM_FPGA_CONFIG
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@
|
|||
* from the Network Space v2
|
||||
*/
|
||||
#if defined(CONFIG_INETSPACE_V2)
|
||||
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-is2.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-is2.cfg
|
||||
#elif defined(CONFIG_NETSPACE_LITE_V2) || defined(CONFIG_NETSPACE_MINI_V2)
|
||||
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-ns2l.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-ns2l.cfg
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
*/
|
||||
#if defined(CONFIG_LSCHLV2)
|
||||
#define CONFIG_IDENT_STRING " LS-CHLv2"
|
||||
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-lschl.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lschl.cfg
|
||||
#define CONFIG_MACH_TYPE 3006
|
||||
#define CONFIG_SYS_TCLK 166666667 /* 166 MHz */
|
||||
#elif defined(CONFIG_LSXHL)
|
||||
#define CONFIG_IDENT_STRING " LS-XHL"
|
||||
#define CONFIG_SYS_KWD_CONFIG $(SRCTREE)/$(CONFIG_BOARDDIR)/kwbimage-lsxhl.cfg
|
||||
#define CONFIG_SYS_KWD_CONFIG $(CONFIG_BOARDDIR)/kwbimage-lsxhl.cfg
|
||||
#define CONFIG_MACH_TYPE 2663
|
||||
/* CONFIG_SYS_TCLK is 200000000 by default */
|
||||
#else
|
||||
|
|
|
@ -185,6 +185,7 @@
|
|||
#define CONFIG_USB_STORAGE
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
#define CONFIG_MXC_USB_PORT 1
|
||||
#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#define CONFIG_USB_STORAGE
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
#define CONFIG_MXC_USB_PORT 1
|
||||
#define CONFIG_MXC_USB_PORTSC (PORT_PTS_UTMI | PORT_PTS_PTW)
|
||||
|
|
|
@ -115,6 +115,7 @@
|
|||
#define CONFIG_USB_STORAGE
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
#define CONFIG_USB_MAX_CONTROLLER_COUNT 2
|
||||
#define CONFIG_EHCI_HCD_INIT_AFTER_RESET /* For OTG port */
|
||||
|
|
|
@ -120,8 +120,9 @@
|
|||
|
||||
#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
#define CONFIG_USB_ETHER_SMSC95XX
|
||||
|
||||
/* GPIO banks */
|
||||
#define CONFIG_OMAP3_GPIO_5 /* GPIO128..159 is in GPIO bank 5 */
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
#define CONFIG_CMD_GPIO
|
||||
#define CONFIG_SANDBOX_GPIO
|
||||
#define CONFIG_SANDBOX_GPIO_COUNT 20
|
||||
#define CONFIG_SANDBOX_GPIO_COUNT 128
|
||||
|
||||
#define CONFIG_CMD_GPT
|
||||
#define CONFIG_PARTITION_UUIDS
|
||||
|
@ -66,7 +66,7 @@
|
|||
/*
|
||||
* Size of malloc() pool, although we don't actually use this yet.
|
||||
*/
|
||||
#define CONFIG_SYS_MALLOC_LEN (4 << 20) /* 4MB */
|
||||
#define CONFIG_SYS_MALLOC_LEN (32 << 20) /* 32MB */
|
||||
|
||||
#define CONFIG_SYS_HUSH_PARSER
|
||||
#define CONFIG_SYS_LONGHELP /* #undef to save memory */
|
||||
|
@ -80,6 +80,7 @@
|
|||
#define CONFIG_CMDLINE_EDITING
|
||||
#define CONFIG_COMMAND_HISTORY
|
||||
#define CONFIG_AUTO_COMPLETE
|
||||
#define CONFIG_BOOTDELAY 3
|
||||
|
||||
#define CONFIG_ENV_SIZE 8192
|
||||
#define CONFIG_ENV_IS_NOWHERE
|
||||
|
@ -90,6 +91,8 @@
|
|||
#define CONFIG_CMD_SF_TEST
|
||||
#define CONFIG_CMD_SPI
|
||||
#define CONFIG_SPI_FLASH
|
||||
#define CONFIG_OF_SPI
|
||||
#define CONFIG_OF_SPI_FLASH
|
||||
#define CONFIG_SPI_FLASH_SANDBOX
|
||||
#define CONFIG_SPI_FLASH_STMICRO
|
||||
#define CONFIG_SPI_FLASH_WINBOND
|
||||
|
@ -98,7 +101,9 @@
|
|||
#define CONFIG_SYS_LOAD_ADDR 0x00000000
|
||||
#define CONFIG_SYS_MEMTEST_START 0x00100000
|
||||
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + 0x1000)
|
||||
#define CONFIG_SYS_FDT_LOAD_ADDR 0x1000000
|
||||
#define CONFIG_SYS_FDT_LOAD_ADDR 0x100
|
||||
|
||||
#define CONFIG_PHYSMEM
|
||||
|
||||
/* Size of our emulated memory */
|
||||
#define CONFIG_SYS_SDRAM_BASE 0
|
||||
|
@ -126,13 +131,36 @@
|
|||
#define CONFIG_SHA1
|
||||
#define CONFIG_SHA256
|
||||
|
||||
#define CONFIG_TPM_TIS_SANDBOX
|
||||
|
||||
#define CONFIG_CMD_SANDBOX
|
||||
|
||||
#define CONFIG_BOOTARGS ""
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS "stdin=serial\0" \
|
||||
"stdout=serial\0" \
|
||||
"stderr=serial\0"
|
||||
#define CONFIG_CROS_EC
|
||||
#define CONFIG_CMD_CROS_EC
|
||||
#define CONFIG_CROS_EC_SANDBOX
|
||||
#define CONFIG_KEYBOARD
|
||||
#define CONFIG_CROS_EC_KEYB
|
||||
#define CONFIG_ARCH_EARLY_INIT_R
|
||||
#define CONFIG_BOARD_LATE_INIT
|
||||
|
||||
#define CONFIG_SOUND
|
||||
#define CONFIG_SOUND_SANDBOX
|
||||
#define CONFIG_CMD_SOUND
|
||||
|
||||
#define CONFIG_SANDBOX_SDL
|
||||
#define CONFIG_LCD
|
||||
#define CONFIG_VIDEO_SANDBOX_SDL
|
||||
#define CONFIG_CMD_BMP
|
||||
#define CONFIG_BOARD_EARLY_INIT_F
|
||||
#define CONFIG_CONSOLE_MUX
|
||||
#define CONFIG_SYS_CONSOLE_IS_IN_ENV
|
||||
#define LCD_BPP LCD_COLOR16
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS "stdin=serial,cros-ec-keyb\0" \
|
||||
"stdout=serial,lcd\0" \
|
||||
"stderr=serial,lcd\0"
|
||||
|
||||
#define CONFIG_GZIP_COMPRESSED
|
||||
#define CONFIG_BZIP2
|
||||
|
|
|
@ -140,7 +140,10 @@
|
|||
* can enable it here if your baseboard features ethernet.
|
||||
*/
|
||||
|
||||
/* #define CONFIG_MACB */
|
||||
#define CONFIG_MACB
|
||||
#define CONFIG_USB_HOST_ETHER
|
||||
#define CONFIG_USB_ETHER_ASIX
|
||||
#define CONFIG_USB_ETHER_MCS7830
|
||||
|
||||
#ifdef CONFIG_MACB
|
||||
# define CONFIG_RMII /* use reduced MII inteface */
|
||||
|
|
|
@ -20,6 +20,7 @@ enum cros_ec_interface_t {
|
|||
CROS_EC_IF_SPI,
|
||||
CROS_EC_IF_I2C,
|
||||
CROS_EC_IF_LPC, /* Intel Low Pin Count interface */
|
||||
CROS_EC_IF_SANDBOX,
|
||||
};
|
||||
|
||||
/* Our configuration information */
|
||||
|
@ -33,7 +34,7 @@ struct cros_ec_dev {
|
|||
unsigned int bus_num; /* Bus number (for I2C) */
|
||||
unsigned int max_frequency; /* Maximum interface frequency */
|
||||
struct fdt_gpio_state ec_int; /* GPIO used as EC interrupt line */
|
||||
int cmd_version_is_supported; /* Device supports command versions */
|
||||
int protocol_version; /* Protocol version to use */
|
||||
int optimise_flash_write; /* Don't write erased flash blocks */
|
||||
|
||||
/*
|
||||
|
@ -63,6 +64,17 @@ struct mbkp_keyscan {
|
|||
uint8_t data[CROS_EC_KEYSCAN_COLS];
|
||||
};
|
||||
|
||||
/* Holds information about the Chrome EC */
|
||||
struct fdt_cros_ec {
|
||||
struct fmap_entry flash; /* Address and size of EC flash */
|
||||
/*
|
||||
* Byte value of erased flash, or -1 if not known. It is normally
|
||||
* 0xff but some flash devices use 0 (e.g. STM32Lxxx)
|
||||
*/
|
||||
int flash_erase_value;
|
||||
struct fmap_entry region[EC_FLASH_REGION_COUNT];
|
||||
};
|
||||
|
||||
/**
|
||||
* Read the ID of the CROS-EC device
|
||||
*
|
||||
|
@ -140,7 +152,7 @@ enum {
|
|||
};
|
||||
|
||||
/**
|
||||
* Set up the Chromium OS matrix keyboard protocol
|
||||
* Initialise the Chromium OS EC driver
|
||||
*
|
||||
* @param blob Device tree blob containing setup information
|
||||
* @param cros_ecp Returns pointer to the cros_ec device, or NULL if none
|
||||
|
@ -157,7 +169,7 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp);
|
|||
* @param info Place to put the info structure
|
||||
*/
|
||||
int cros_ec_info(struct cros_ec_dev *dev,
|
||||
struct ec_response_cros_ec_info *info);
|
||||
struct ec_response_mkbp_info *info);
|
||||
|
||||
/**
|
||||
* Read the host event flags
|
||||
|
@ -226,6 +238,7 @@ struct cros_ec_dev *board_get_cros_ec_dev(void);
|
|||
int cros_ec_i2c_init(struct cros_ec_dev *dev, const void *blob);
|
||||
int cros_ec_spi_init(struct cros_ec_dev *dev, const void *blob);
|
||||
int cros_ec_lpc_init(struct cros_ec_dev *dev, const void *blob);
|
||||
int cros_ec_sandbox_init(struct cros_ec_dev *dev, const void *blob);
|
||||
|
||||
/**
|
||||
* Read information from the fdt for the i2c cros_ec interface
|
||||
|
@ -245,12 +258,20 @@ int cros_ec_i2c_decode_fdt(struct cros_ec_dev *dev, const void *blob);
|
|||
*/
|
||||
int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob);
|
||||
|
||||
/**
|
||||
* Read information from the fdt for the sandbox cros_ec interface
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param blob Device tree blob
|
||||
* @return 0 if ok, -1 if we failed to read all required information
|
||||
*/
|
||||
int cros_ec_sandbox_decode_fdt(struct cros_ec_dev *dev, const void *blob);
|
||||
|
||||
/**
|
||||
* Check whether the LPC interface supports new-style commands.
|
||||
*
|
||||
* LPC has its own way of doing this, which involves checking LPC values
|
||||
* visible to the host. Do this, and update dev->cmd_version_is_supported
|
||||
* accordingly.
|
||||
* visible to the host. Do this, and update dev->protocol_version accordingly.
|
||||
*
|
||||
* @param dev CROS-EC device to check
|
||||
*/
|
||||
|
@ -301,6 +322,21 @@ int cros_ec_spi_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version,
|
|||
const uint8_t *dout, int dout_len,
|
||||
uint8_t **dinp, int din_len);
|
||||
|
||||
/**
|
||||
* Send a packet to a CROS-EC device and return the response packet.
|
||||
*
|
||||
* Expects the request packet to be stored in dev->dout. Stores the response
|
||||
* packet in dev->din.
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param out_bytes Size of request packet to output
|
||||
* @param in_bytes Maximum size of response packet to receive
|
||||
* @return number of bytes in response packet, or <0 on error
|
||||
*/
|
||||
int cros_ec_spi_packet(struct cros_ec_dev *dev, int out_bytes, int in_bytes);
|
||||
int cros_ec_sandbox_packet(struct cros_ec_dev *dev, int out_bytes,
|
||||
int in_bytes);
|
||||
|
||||
/**
|
||||
* Dump a block of data for a command.
|
||||
*
|
||||
|
@ -431,4 +467,52 @@ int cros_ec_set_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t state);
|
|||
* @return 0 if ok, -1 on error
|
||||
*/
|
||||
int cros_ec_get_ldo(struct cros_ec_dev *dev, uint8_t index, uint8_t *state);
|
||||
|
||||
/**
|
||||
* Initialize the Chrome OS EC at board initialization time.
|
||||
*
|
||||
* @return 0 if ok, -ve on error
|
||||
*/
|
||||
int cros_ec_board_init(void);
|
||||
|
||||
/**
|
||||
* Get access to the error reported when cros_ec_board_init() was called
|
||||
*
|
||||
* This permits delayed reporting of the EC error if it failed during
|
||||
* early init.
|
||||
*
|
||||
* @return error (0 if there was no error, -ve if there was an error)
|
||||
*/
|
||||
int cros_ec_get_error(void);
|
||||
|
||||
/**
|
||||
* Returns information from the FDT about the Chrome EC flash
|
||||
*
|
||||
* @param blob FDT blob to use
|
||||
* @param config Structure to use to return information
|
||||
*/
|
||||
int cros_ec_decode_ec_flash(const void *blob, struct fdt_cros_ec *config);
|
||||
|
||||
/**
|
||||
* Check the current keyboard state, in case recovery mode is requested.
|
||||
* This function is for sandbox only.
|
||||
*
|
||||
* @param ec CROS-EC device
|
||||
*/
|
||||
void cros_ec_check_keyboard(struct cros_ec_dev *dev);
|
||||
|
||||
/*
|
||||
* Tunnel an I2C transfer to the EC
|
||||
*
|
||||
* @param dev CROS-EC device
|
||||
* @param chip Chip address (7-bit I2C address)
|
||||
* @param addr Register address to read/write
|
||||
* @param alen Length of register address in bytes
|
||||
* @param buffer Buffer containing data to read/write
|
||||
* @param len Length of buffer
|
||||
* @param is_read 1 if this is a read, 0 if this is a write
|
||||
*/
|
||||
int cros_ec_i2c_xfer(struct cros_ec_dev *dev, uchar chip, uint addr,
|
||||
int alen, uchar *buffer, int len, int is_read);
|
||||
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue