From 500856eb1707ed17d9204baa61dd59948d3b2899 Mon Sep 17 00:00:00 2001 From: Rafal Jaworowski Date: Wed, 9 Jan 2008 19:39:36 +0100 Subject: API for external applications. This is an API for external (standalone) applications running on top of U-Boot, and is meant to be more extensible and robust than the existing jumptable mechanism. It is similar to UNIX syscall approach. See api/README for more details. Included is the demo application using this new framework (api_examples). Please note this is still an experimental feature, and is turned off by default. Signed-off-by: Rafal Jaworowski --- api_examples/Makefile | 103 ++++++++++++ api_examples/crt0.S | 50 ++++++ api_examples/demo.c | 258 +++++++++++++++++++++++++++++ api_examples/glue.c | 405 ++++++++++++++++++++++++++++++++++++++++++++++ api_examples/glue.h | 76 +++++++++ api_examples/libgenwrap.c | 90 +++++++++++ 6 files changed, 982 insertions(+) create mode 100644 api_examples/Makefile create mode 100644 api_examples/crt0.S create mode 100644 api_examples/demo.c create mode 100644 api_examples/glue.c create mode 100644 api_examples/glue.h create mode 100644 api_examples/libgenwrap.c (limited to 'api_examples') diff --git a/api_examples/Makefile b/api_examples/Makefile new file mode 100644 index 00000000000..5812bcd3370 --- /dev/null +++ b/api_examples/Makefile @@ -0,0 +1,103 @@ +# +# (C) Copyright 2007 Semihalf +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundatio; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +ifeq ($(ARCH),ppc) +LOAD_ADDR = 0x40000 +endif + +#ifeq ($(ARCH),arm) +#LOAD_ADDR = 0xc100000 +#endif + +include $(TOPDIR)/config.mk + +ELF += demo +BIN += demo.bin + +#CFLAGS += -v + +COBJS := $(ELF:=.o) +SOBJS := crt0.o +ifeq ($(ARCH),ppc) +SOBJS += ppcstring.o +endif + +LIB = $(obj)libglue.a +LIBCOBJS= glue.o crc32.o ctype.o string.o vsprintf.o libgenwrap.o + +LIBOBJS = $(addprefix $(obj),$(SOBJS) $(LIBCOBJS)) + +SRCS := $(COBJS:.o=.c) $(LIBCOBJS:.o=.c) $(SOBJS:.o=.S) +OBJS := $(addprefix $(obj),$(COBJS)) +ELF := $(addprefix $(obj),$(ELF)) +BIN := $(addprefix $(obj),$(BIN)) + +gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`) + +CPPFLAGS += -I.. + +all: $(obj).depend $(OBJS) $(LIB) $(BIN) $(ELF) + +######################################################################### +$(LIB): $(obj).depend $(LIBOBJS) + $(AR) $(ARFLAGS) $@ $(LIBOBJS) + +$(ELF): +$(obj)%: $(obj)%.o $(LIB) + $(LD) $(obj)crt0.o -Ttext $(LOAD_ADDR) \ + -o $@ $< $(LIB) \ + -L$(gcclibdir) -lgcc + +$(BIN): +$(obj)%.bin: $(obj)% + $(OBJCOPY) -O binary $< $@ 2>/dev/null + +$(obj)crc32.c: + @rm -f $(obj)crc32.c + ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c + +$(obj)ctype.c: + @rm -f $(obj)ctype.c + ln -s $(src)../lib_generic/ctype.c $(obj)ctype.c + +$(obj)string.c: + @rm -f $(obj)string.c + ln -s $(src)../lib_generic/string.c $(obj)string.c + +$(obj)vsprintf.c: + @rm -f $(obj)vsprintf.c + ln -s $(src)../lib_generic/vsprintf.c $(obj)vsprintf.c + +ifeq ($(ARCH),ppc) +$(obj)ppcstring.S: + @rm -f $(obj)ppcstring.S + ln -s $(src)../lib_ppc/ppcstring.S $(obj)ppcstring.S +endif + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/api_examples/crt0.S b/api_examples/crt0.S new file mode 100644 index 00000000000..8d4f7064eb9 --- /dev/null +++ b/api_examples/crt0.S @@ -0,0 +1,50 @@ +/* + * (C) Copyright 2007 Semihalf + * + * Written by: Rafal Jaworowski + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#if defined(CONFIG_PPC) + + .text + + .globl _start +_start: + b main + + + .globl syscall +syscall: + lis %r11, syscall_ptr@ha + addi %r11, %r11, syscall_ptr@l + lwz %r11, 0(%r11) + mtctr %r11 + bctr + + + .globl syscall_ptr +syscall_ptr: + .align 4 + .long 0 +#else +#error No support for this arch! +#endif diff --git a/api_examples/demo.c b/api_examples/demo.c new file mode 100644 index 00000000000..a4aeef183b5 --- /dev/null +++ b/api_examples/demo.c @@ -0,0 +1,258 @@ +/* + * (C) Copyright 2007 Semihalf + * + * Written by: Rafal Jaworowski + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include +#include +#include + +#include "glue.h" + +#define errf(fmt, args...) do { printf("ERROR @ %s(): ", __func__); printf(fmt, ##args); } while (0) + +void test_dump_si(struct sys_info *); +void test_dump_di(int); +void test_dump_sig(struct api_signature *); + +char buf[2048]; + +#define WAIT_SECS 5 + +int main(int argc, char *argv[]) +{ + int rv = 0; + int h, i, j; + int devs_no; + struct api_signature *sig = NULL; + ulong start, now; + struct device_info *di; + + if (!api_search_sig(&sig)) + return -1; + + syscall_ptr = sig->syscall; + if (syscall_ptr == NULL) + return -2; + + if (sig->version > API_SIG_VERSION) + return -3; + + printf("API signature found @%x\n", sig); + test_dump_sig(sig); + + printf("\n*** Consumer API test ***\n"); + printf("syscall ptr 0x%08x@%08x\n", syscall_ptr, &syscall_ptr); + + /* console activities */ + ub_putc('B'); + + printf("*** Press any key to continue ***\n"); + printf("got char 0x%x\n", ub_getc()); + + /* system info */ + test_dump_si(ub_get_sys_info()); + + /* timing */ + printf("\n*** Timing - wait a couple of secs ***\n"); + start = ub_get_timer(0); + printf("\ntime: start %lu\n\n", start); + for (i = 0; i < WAIT_SECS; i++) + for (j = 0; j < 1000; j++) + ub_udelay(1000); /* wait 1 ms */ + + /* this is the number of milliseconds that passed from ub_get_timer(0) */ + now = ub_get_timer(start); + printf("\ntime: now %lu\n\n", now); + + /* enumerate devices */ + printf("\n*** Enumerate devices ***\n"); + devs_no = ub_dev_enum(); + + printf("Number of devices found: %d\n", devs_no); + if (devs_no == 0) + return -1; + + + printf("\n*** Show devices ***\n"); + for (i = 0; i < devs_no; i++) { + test_dump_di(i); + printf("\n"); + } + + printf("\n*** Operations on devices ***\n"); + + /* test opening a device already opened */ + h = 0; + if ((rv = ub_dev_open(h)) != 0) { + errf("open device %d error %d\n", h, rv); + return -1; + } + if ((rv = ub_dev_open(h)) != 0) + errf("open device %d error %d\n", h, rv); + + ub_dev_close(h); + + /* test storage */ + printf("Trying storage devices...\n"); + for (i = 0; i < devs_no; i++) { + di = ub_dev_get(i); + + if (di->type & DEV_TYP_STOR) + break; + + } + if (i == devs_no) + printf("No storage devices available\n"); + else { + if ((rv = ub_dev_open(i)) != 0) + errf("open device %d error %d\n", i, rv); + else if ((rv = ub_dev_read(i, &buf, 200, 20)) != 0) + errf("could not read from device %d, error %d\n", i, rv); + + ub_dev_close(i); + } + + /* test networking */ + printf("Trying network devices...\n"); + for (i = 0; i < devs_no; i++) { + di = ub_dev_get(i); + + if (di->type == DEV_TYP_NET) + break; + + } + if (i == devs_no) + printf("No network devices available\n"); + else { + if ((rv = ub_dev_open(i)) != 0) + errf("open device %d error %d\n", i, rv); + else if ((rv = ub_dev_send(i, &buf, 2048)) != 0) + errf("could not send to device %d, error %d\n", i, rv); + + ub_dev_close(i); + } + + if (ub_dev_close(h) != 0) + errf("could not close device %d\n", h); + + printf("\n*** Env vars ***\n"); + + printf("ethact = %s\n", ub_env_get("ethact")); + printf("old fileaddr = %s\n", ub_env_get("fileaddr")); + ub_env_set("fileaddr", "deadbeef"); + printf("new fileaddr = %s\n", ub_env_get("fileaddr")); + + const char *env = NULL; + + while ((env = ub_env_enum(env)) != NULL) + printf("%s = %s\n", env, ub_env_get(env)); + + /* reset */ + ub_reset(); + printf("\nHmm, reset returned...?!\n"); + + return rv; +} + +void test_dump_sig(struct api_signature *sig) +{ + printf("signature:\n"); + printf(" version\t= %d\n", sig->version); + printf(" checksum\t= 0x%08x\n", sig->checksum); + printf(" sc entry\t= 0x%08x\n", sig->syscall); +} + +void test_dump_si(struct sys_info *si) +{ + int i; + + printf("sys info:\n"); + printf(" clkbus\t= 0x%08x\n", si->clk_bus); + printf(" clkcpu\t= 0x%08x\n", si->clk_cpu); + printf(" bar\t\t= 0x%08x\n", si->bar); + + printf("---\n"); + for (i = 0; i < si->mr_no; i++) { + if (si->mr[i].flags == 0) + break; + + printf(" start\t= 0x%08lx\n", si->mr[i].start); + printf(" size\t= 0x%08lx\n", si->mr[i].size); + + switch(si->mr[i].flags & 0x000F) { + case MR_ATTR_FLASH: + printf(" type FLASH\n"); + break; + case MR_ATTR_DRAM: + printf(" type DRAM\n"); + break; + case MR_ATTR_SRAM: + printf(" type SRAM\n"); + break; + default: + printf(" type UNKNOWN\n"); + } + printf("---\n"); + } +} + +static char * test_stor_typ(int type) +{ + if (type & DT_STOR_IDE) + return "IDE"; + + if (type & DT_STOR_SCSI) + return "SCSI"; + + if (type & DT_STOR_USB) + return "USB"; + + if (type & DT_STOR_MMC); + return "MMC"; + + return "Unknown"; +} + +void test_dump_di(int handle) +{ + int i; + struct device_info *di = ub_dev_get(handle); + + printf("device info (%d):\n", handle); + printf(" cookie\t= 0x%08x\n", (uint32_t)di->cookie); + printf(" type\t\t= 0x%08x\n", di->type); + + if (di->type == DEV_TYP_NET) { + printf(" hwaddr\t= "); + for (i = 0; i < 6; i++) + printf("%02x ", di->di_net.hwaddr[i]); + + printf("\n"); + + } else if (di->type & DEV_TYP_STOR) { + printf(" type\t\t= %s\n", test_stor_typ(di->type)); + printf(" blk size\t\t= %d\n", di->di_stor.block_size); + printf(" blk count\t\t= %d\n", di->di_stor.block_count); + } +} diff --git a/api_examples/glue.c b/api_examples/glue.c new file mode 100644 index 00000000000..75983691fde --- /dev/null +++ b/api_examples/glue.c @@ -0,0 +1,405 @@ +/* + * (C) Copyright 2007 Semihalf + * + * Written by: Rafal Jaworowski + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +#include +#include +#include + +#include "glue.h" + +static int valid_sig(struct api_signature *sig) +{ + uint32_t checksum; + struct api_signature s; + + if (sig == NULL) + return 0; + /* + * Clear the checksum field (in the local copy) so as to calculate the + * CRC with the same initial contents as at the time when the sig was + * produced + */ + s = *sig; + s.checksum = 0; + + checksum = crc32(0, (unsigned char *)&s, sizeof(struct api_signature)); + + if (checksum != sig->checksum) + return 0; + + return 1; +} + +/* + * Searches for the U-Boot API signature + * + * returns 1/0 depending on found/not found result + */ +int api_search_sig(struct api_signature **sig) { + + unsigned char *sp; + + if (sig == NULL) + return 0; + + sp = (unsigned char *)API_SEARCH_START; + + while ((sp + (int)API_SIG_MAGLEN) < (unsigned char *)API_SEARCH_END) { + if (!memcmp(sp, API_SIG_MAGIC, API_SIG_MAGLEN)) { + *sig = (struct api_signature *)sp; + if (valid_sig(*sig)) + return 1; + } + sp += API_SIG_MAGLEN; + } + + *sig = NULL; + return 0; +} + +/**************************************** + * + * console + * + ****************************************/ + +int ub_getc(void) +{ + int c; + + if (!syscall(API_GETC, NULL, (uint32_t)&c)) + return -1; + + return c; +} + +int ub_tstc(void) +{ + int t; + + if (!syscall(API_TSTC, NULL, (uint32_t)&t)) + return -1; + + return t; +} + +void ub_putc(char c) +{ + syscall(API_PUTC, NULL, (uint32_t)&c); +} + +void ub_puts(const char *s) +{ + syscall(API_PUTS, NULL, (uint32_t)s); +} + +/**************************************** + * + * system + * + ****************************************/ + +void ub_reset(void) +{ + syscall(API_RESET, NULL); +} + +#define MR_MAX 5 +static struct mem_region mr[MR_MAX]; +static struct sys_info si; + +struct sys_info * ub_get_sys_info(void) +{ + int err = 0; + + memset(&si, 0, sizeof(struct sys_info)); + si.mr = mr; + si.mr_no = MR_MAX; + memset(&mr, 0, sizeof(mr)); + + if (!syscall(API_GET_SYS_INFO, &err, (u_int32_t)&si)) + return NULL; + + return ((err) ? NULL : &si); +} + +/**************************************** + * + * timing + * + ****************************************/ + +void ub_udelay(unsigned long usec) +{ + syscall(API_UDELAY, NULL, &usec); +} + +unsigned long ub_get_timer(unsigned long base) +{ + unsigned long cur; + + if (!syscall(API_GET_TIMER, NULL, &cur, &base)) + return 0; + + return cur; +} + + +/**************************************************************************** + * + * devices + * + * Devices are identified by handles: numbers 0, 1, 2, ..., MAX_DEVS-1 + * + ***************************************************************************/ + +#define MAX_DEVS 6 + +static struct device_info devices[MAX_DEVS]; + +struct device_info * ub_dev_get(int i) +{ + return ((i < 0 || i >= MAX_DEVS) ? NULL : &devices[i]); +} + +/* + * Enumerates the devices: fills out device_info elements in the devices[] + * array. + * + * returns: number of devices found + */ +int ub_dev_enum(void) +{ + struct device_info *di; + int n = 0; + + memset(&devices, 0, sizeof(struct device_info) * MAX_DEVS); + di = &devices[0]; + + if (!syscall(API_DEV_ENUM, NULL, di)) + return 0; + + while (di->cookie != NULL) { + + if (++n >= MAX_DEVS) + break; + + /* take another device_info */ + di++; + + /* pass on the previous cookie */ + di->cookie = devices[n - 1].cookie; + + if (!syscall(API_DEV_ENUM, NULL, di)) + return 0; + } + + return n; +} + +/* + * handle: 0-based id of the device + * + * returns: 0 when OK, err otherwise + */ +int ub_dev_open(int handle) +{ + struct device_info *di; + int err = 0; + + if (handle < 0 || handle >= MAX_DEVS) + return API_EINVAL; + + di = &devices[handle]; + + if (!syscall(API_DEV_OPEN, &err, di)) + return -1; + + return err; +} + +int ub_dev_close(int handle) +{ + struct device_info *di; + + if (handle < 0 || handle >= MAX_DEVS) + return API_EINVAL; + + di = &devices[handle]; + if (!syscall(API_DEV_CLOSE, NULL, di)) + return -1; + + return 0; +} + +/* + * + * Validates device for read/write, it has to: + * + * - have sane handle + * - be opened + * + * returns: 0/1 accordingly + */ +static int dev_valid(int handle) +{ + if (handle < 0 || handle >= MAX_DEVS) + return 0; + + if (devices[handle].state != DEV_STA_OPEN) + return 0; + + return 1; +} + +static int dev_stor_valid(int handle) +{ + if (!dev_valid(handle)) + return 0; + + if (!(devices[handle].type & DEV_TYP_STOR)) + return 0; + + return 1; +} + +int ub_dev_read(int handle, void *buf, lbasize_t len, lbastart_t start) +{ + struct device_info *di; + lbasize_t act_len; + int err = 0; + + if (!dev_stor_valid(handle)) + return API_ENODEV; + + di = &devices[handle]; + if (!syscall(API_DEV_READ, &err, di, buf, &len, &start, &act_len)) + return -1; + + if (err) + return err; + + if (act_len != len) + return API_EIO; + + return 0; +} + +static int dev_net_valid(int handle) +{ + if (!dev_valid(handle)) + return 0; + + if (devices[handle].type != DEV_TYP_NET) + return 0; + + return 1; +} + +int ub_dev_recv(int handle, void *buf, int len) +{ + struct device_info *di; + int err = 0, act_len; + + if (!dev_net_valid(handle)) + return API_ENODEV; + + di = &devices[handle]; + if (!syscall(API_DEV_READ, &err, di, buf, &len, &act_len)) + return -1; + + if (err) + return -1; + + return act_len; +} + +int ub_dev_send(int handle, void *buf, int len) +{ + struct device_info *di; + int err = 0; + + if (!dev_net_valid(handle)) + return API_ENODEV; + + di = &devices[handle]; + if (!syscall(API_DEV_WRITE, &err, di, buf, &len)) + return -1; + + return err; +} + +/**************************************** + * + * env vars + * + ****************************************/ + +char * ub_env_get(const char *name) +{ + char *value; + + if (!syscall(API_ENV_GET, NULL, (uint32_t)name, (uint32_t)&value)) + return NULL; + + return value; +} + +void ub_env_set(const char *name, char *value) +{ + syscall(API_ENV_SET, NULL, (uint32_t)name, (uint32_t)value); +} + + +static char env_name[256]; + +const char * ub_env_enum(const char *last) +{ + const char *env, *str; + int i; + + env = NULL; + + /* + * It's OK to pass only the name piece as last (and not the whole + * 'name=val' string), since the API_ENUM_ENV call uses envmatch() + * internally, which handles such case + */ + if (!syscall(API_ENV_ENUM, NULL, (uint32_t)last, (uint32_t)&env)) + return NULL; + + if (!env) + /* no more env. variables to enumerate */ + return NULL; + + /* next enumerated env var */ + memset(env_name, 0, 256); + for (i = 0, str = env; *str != '=' && *str != '\0';) + env_name[i++] = *str++; + + env_name[i] = '\0'; + + return env_name; +} diff --git a/api_examples/glue.h b/api_examples/glue.h new file mode 100644 index 00000000000..a82f783cbe0 --- /dev/null +++ b/api_examples/glue.h @@ -0,0 +1,76 @@ +/* + * (C) Copyright 2007 Semihalf + * + * Written by: Rafal Jaworowski + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + */ + +/* + * This is the header file for conveniency wrapper routines (API glue) + */ + +#ifndef _API_GLUE_H_ +#define _API_GLUE_H_ + +#define API_SEARCH_START (255 * 1024 * 1024) /* start at 1MB below top RAM */ +#define API_SEARCH_END (256 * 1024 * 1024 - 1) /* ...and search to the end */ + +int syscall(int, int *, ...); +void * syscall_ptr; + +int api_search_sig(struct api_signature **sig); + +/* + * ub_ library calls are part of the application, not U-Boot code! They are + * front-end wrappers that are used by the consumer application: they prepare + * arguments for particular syscall and jump to the low level syscall() + */ + +/* console */ +int ub_getc(void); +int ub_tstc(void); +void ub_putc(char c); +void ub_puts(const char *s); + +/* system */ +void ub_reset(void); +struct sys_info * ub_get_sys_info(void); + +/* time */ +void ub_udelay(unsigned long); +unsigned long ub_get_timer(unsigned long); + +/* env vars */ +char * ub_env_get(const char *name); +void ub_env_set(const char *name, char *value); +const char * ub_env_enum(const char *last); + +/* devices */ +int ub_dev_enum(void); +int ub_dev_open(int handle); +int ub_dev_close(int handle); +int ub_dev_read(int handle, void *buf, + lbasize_t len, lbastart_t start); +int ub_dev_send(int handle, void *buf, int len); +int ub_dev_recv(int handle, void *buf, int len); +struct device_info * ub_dev_get(int); + +#endif /* _API_GLUE_H_ */ diff --git a/api_examples/libgenwrap.c b/api_examples/libgenwrap.c new file mode 100644 index 00000000000..df62633ca70 --- /dev/null +++ b/api_examples/libgenwrap.c @@ -0,0 +1,90 @@ +/* + * (C) Copyright 2007 Semihalf + * + * Written by: Rafal Jaworowski + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * This is is a set of wrappers/stubs that allow to use certain routines from + * U-Boot's lib_generic in the standalone app. This way way we can re-use + * existing code e.g. operations on strings and similar. + * + */ + +#include +#include +#include + +#include "glue.h" + +/* + * printf() and vprintf() are stolen from u-boot/common/console.c + */ +void printf (const char *fmt, ...) +{ + va_list args; + uint i; + char printbuffer[256]; + + va_start (args, fmt); + + /* For this to work, printbuffer must be larger than + * anything we ever want to print. + */ + i = vsprintf (printbuffer, fmt, args); + va_end (args); + + /* Print the string */ + ub_puts (printbuffer); +} + +void vprintf (const char *fmt, va_list args) +{ + uint i; + char printbuffer[256]; + + /* For this to work, printbuffer must be larger than + * anything we ever want to print. + */ + i = vsprintf (printbuffer, fmt, args); + + /* Print the string */ + ub_puts (printbuffer); +} + +void putc (const char c) +{ + ub_putc(c); +} + +void udelay(unsigned long usec) +{ + ub_udelay(usec); +} + +void do_reset (void) +{ + ub_reset(); +} + +void *malloc(size_t len) +{ + return NULL; +} -- cgit v1.3.1 From d3a6532cbe263d992f49e86ac95bede28e96f9c8 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Thu, 10 Jan 2008 00:55:14 +0100 Subject: Coding Style cleanup; update CHANGELOG Signed-off-by: Wolfgang Denk --- CHANGELOG | 372 ++++++++++++++++++++++++++++++++++++++++++++++ api/README | 2 +- api/api.c | 12 +- api/api_net.c | 2 +- api_examples/Makefile | 2 +- api_examples/demo.c | 2 +- api_examples/glue.c | 4 +- board/atum8548/atum8548.c | 6 +- board/atum8548/init.S | 22 +-- board/sbc8548/sbc8548.c | 1 - drivers/qe/qe.c | 18 +-- 11 files changed, 407 insertions(+), 36 deletions(-) (limited to 'api_examples') diff --git a/CHANGELOG b/CHANGELOG index 43c0bd5bccd..7b9e34bdd16 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,297 @@ +commit 17a41e4492121ccf9fa2c10c2cb1a6d1c18d74f7 +Author: Kim Phillips +Date: Wed Jan 9 16:56:54 2008 -0600 + + Add QE brg freq and correct qe bus freq fdt update code + + Signed-off-by: Kim Phillips + Signed-off-by: Andy Fleming + +commit 890dfef06c2d169a3356359596890754dfb8ee1c +Author: Andy Fleming +Date: Wed Jan 9 16:34:51 2008 -0600 + + Remove cache config from ATUM8548 and sbc8548 configs + + These boards weren't updated by Kumar's config patch because they + weren't in the tree, yet. + + Signed-off-by: Andy Fleming + +commit b8ec2385038c094b07ec5b49336289a46b6e9cc6 +Author: Timur Tabi +Date: Mon Jan 7 13:31:19 2008 -0600 + + 85xx: add ability to upload QE firmware + + Define the layout of a binary blob that contains a QE firmware and instructions + on how to upload it. Add function qe_upload_firmware() to parse the blob and + perform the actual upload. Add command-line command "qe fw" to take a firmware + blob in memory and upload it. Update ft_cpu_setup() on 85xx to create the + 'firmware' device tree node if U-Boot has uploaded a firmware. Fully define + 'struct rsp' in immap_qe.h to include the actual RISC Special Registers. + + Signed-off-by: Timur Tabi + +commit b009f3eca99bb7b9e6ba6639a8909a138dd5e9fe +Author: Kumar Gala +Date: Tue Jan 8 01:22:21 2008 -0600 + + 85xx: Remove cache config from configs.h + + Either use the standard defines in asm/cache.h or grab the information + at runtime from the L1CFG SPR. + + Also, minor cleanup in cache.h to make the code a bit more readable. + + Signed-off-by: Kumar Gala + +commit b964e9368f45372aaf1da0c13fe56f6d81ae8e96 +Author: robert lazarski +Date: Fri Dec 21 10:39:27 2007 -0500 + + mpc85xx: Add support for ATUM8548 (updated) + + Add support for Instituto Atlantico's ATUM8548 board + + Signed-off-by: robert lazarski + Signed-off-by: Andy Fleming + +commit 7bd6104b71de9bca80ac8e0936003443bb42f2fc +Author: robert lazarski +Date: Fri Dec 21 10:36:37 2007 -0500 + + mpc85xx: Add support for ATUM8548 (updated) + + Add support for Instituto Atlantico's ATUM8548 board + + Signed-off-by: robert lazarski + +commit 9e3ed392d2c8965e24c942b58796c31c644c2f70 +Author: Joe Hamman +Date: Thu Dec 13 06:45:14 2007 -0600 + + mpc85xx: Add support for SBC8548 (updated) + + Add support for Wind River's SBC8548 reference board. + + Signed-off by: Joe Hamman + +commit 11c45ebd46d6517b51b7a92dd52a618b2f4e5586 +Author: Joe Hamman +Date: Thu Dec 13 06:45:08 2007 -0600 + + mpc85xx: Add support for SBC8548 (updated) + + Add support for Wind River's SBC8548 reference board. + + Signed-off by: Joe Hamman + Signed-off by: Andy Fleming + +commit 64d4bcb087c2ece1c4d0de8efe85e0075e5b1594 +Author: Anton Vorontsov +Date: Mon Oct 22 19:58:19 2007 +0400 + + MPC8568E-MDS: set up QE pario for UART1 + + To use UART1 on the MPC8568E-MDS, QE pario pins PC[0:3] should + be set up appropriately. + + Signed-off-by: Anton Vorontsov + +commit ad162249cb371e9e38971676f09be791e5f3cf4a +Author: Anton Vorontsov +Date: Mon Oct 22 18:12:46 2007 +0400 + + MPC8568E-MDS: reset UCCs to use them reliably + + In order to use GETH1 and GETH2 on the MPC8568E-MDS, we should reset + UCCs. + + p.s Similar code exists in the Linux kernel board file (for capability + reasons with older U-Boots), but should be removed some day. + + Signed-off-by: Anton Vorontsov + +commit 2146cf56821c3364786ca94a7306008c5824b238 +Author: Kumar Gala +Date: Wed Dec 19 01:18:15 2007 -0600 + + Reworked FSL Book-E TLB macros to be more readable + + The old macros made it difficult to know what WIMGE and perm bits + were set for a TLB entry. Actually use the bit masks for these items + since they are only a single bit. + + Also moved the macros into mmu.h out of e500.h since they aren't specific + to e500. + + Signed-off-by: Kumar Gala + +commit 1d47273d46925929f8f2c1913cd96d7257aade88 +Author: Kumar Gala +Date: Tue Dec 18 23:21:51 2007 -0600 + + Use FSL Book-E MMU macros from Linux Kernel + + Grab the FSL Book-E MAS register macros from Linux. Also added + defines for page sizes up to 4TB and removed SHAREN since it doesnt + really exist. + + Signed-off-by: Kumar Gala + +commit 02df4a270f817ef6ec39047a01b55fecdc5f3b37 +Author: Andy Fleming +Date: Wed Jan 9 13:51:32 2008 -0600 + + Fix my own merge stupidity + + Way back in August I merged Heiko's patch: + 566a494f592: [PCS440EP] upgrade the PCS440EP board + + with Jon's CONFIG_COMMANDS patches. + + This was done in commit: 6bf6f114dcdd97ec3f80c2761ed40e31229d6b78 + + However, in the process, I left out some of Heiko's good changes. + + Now Heiko's and Jon's patches are properly merged in fat_register_device() + + Signed-off-by: Andy Fleming + +commit 6636b62a6efc7f14e6e788788631ae7a7fca4537 +Author: James Yang +Date: Wed Jan 9 11:17:49 2008 -0600 + + Expose parse_line() globally. + + Add new function readline_into_buffer() that allows the + output of readline to be put into a pointer to char buffer. + + This refactoring allows other functions besides the + main command loop to also use the same input mechanism. + + Signed-off-by: James Yang + Acked-by: Jon Loeliger + +commit 7ca90513486abd4ae50bd1b7403f47cc58c5ad25 +Author: Guennadi Liakhovetski +Date: Wed Jan 9 01:15:25 2008 +0100 + + trivial: fix consequences of a bad merge + + Fix what looks like a merge artifact. + + Signed-off-by: Guennadi Liakhovetski + +commit 4785a694c0045996ccf0ac5b8edf531efc1b730e +Author: Zhang Wei +Date: Thu Jan 3 10:51:15 2008 +0800 + + Add Ctrl combo key support to usb keyboard driver. + + Ctrl combo key support is added, which is very useful to input Ctrl-C + for interrupt current job. + Also add usb_event_poll() calling to usb_kbd_testc(), which can get + key input when tstc() is called. + + Signed-off-by: Zhang Wei + +commit 10c7382bc5d5e64c47f94ac2ca78cc574442e82d +Author: Marcel Ziswiler +Date: Sun Dec 30 03:30:56 2007 +0100 + + fix various comments + + Signed-off-by: Marcel Ziswiler + +commit 7817cb2083d982923752fe0f12b67c0e7c09a027 +Author: Marcel Ziswiler +Date: Sun Dec 30 03:30:46 2007 +0100 + + fix comments with new drivers organization + + Signed-off-by: Marcel Ziswiler + +commit a9b410dc7d2a4721c408b13abfc037988150f145 +Author: Shinya Kuribayashi +Date: Fri Dec 28 12:50:59 2007 +0900 + + Remove the obsolete terse version of do_mii() + + We now have more useful version of do_mii() and everybody use it. + Gerald Van Baren says: + + > When I originally wrote the mii command 6(!) years ago, I wrote a + > verbose version that printed human readable decomposition of the flags, + > etc., and a terse one that didn't print as much stuff and thus had a + > smaller memory footprint. + > + > It sounds like the terse version has withered and died, apparently + > people are only using the verbose version (which is very understandable, + > I do myself). + + Signed-off-by: Shinya Kuribayashi + Signed-off-by: Gerald Van Baren + +commit 01c687aa6e065bd4faf80f723361e798941dd6b0 +Author: Mike Frysinger +Date: Thu Dec 27 13:42:56 2007 -0500 + + Do not reference sha1.c when building mkimage. + + remove sha1.o from mkimage linking since it isn't actually used. + + Signed-Off-By: Mike Frysinger + +commit b9173af73e524d37c812f210173cf83385c5171a +Author: Shinya Kuribayashi +Date: Thu Dec 27 15:39:54 2007 +0900 + + common/cmd_mii.c: Add sanity argc check + + If type mii command without arguments, we suffer from uninitialized argv[] + entries; for example we MIPS get stuck by TLB error. + + Signed-off-by: Shinya Kuribayashi + +commit 500856eb1707ed17d9204baa61dd59948d3b2899 +Author: Rafal Jaworowski +Date: Wed Jan 9 19:39:36 2008 +0100 + + API for external applications. + + This is an API for external (standalone) applications running on top of + U-Boot, and is meant to be more extensible and robust than the existing + jumptable mechanism. It is similar to UNIX syscall approach. See api/README + for more details. + + Included is the demo application using this new framework (api_examples). + + Please note this is still an experimental feature, and is turned off by + default. + + Signed-off-by: Rafal Jaworowski + +commit 26a41790f8eba19ad450e18ae91351daf485b3e2 +Author: Rafal Jaworowski +Date: Wed Jan 9 18:05:27 2008 +0100 + + Globalize envmatch() + + The newly introduced API (routines related to env vars) will need to call + it. + + Signed-off-by: Rafal Zabdyr + +commit 6007f3251c0967adc13f2ed8be1b924ddc30124d +Author: Wolfgang Denk +Date: Wed Jan 9 15:14:46 2008 +0100 + + Coding Style cleanup, update CHANGELOG + + Signed-off-by: Wolfgang Denk + commit fc6414eca55f1fc108fb12fc8cdc43bd8b4463f9 Author: Mike Frysinger Date: Tue Dec 18 04:29:55 2007 -0500 @@ -98,6 +392,20 @@ Date: Tue Nov 20 13:14:20 2007 +0100 Signed-off-by: Guennadi Liakhovetski +commit 58694f9709c0c3e3178e349ae748d98cfb0c639a +Author: Zhang Wei +Date: Thu Jan 3 10:51:15 2008 +0800 + + Add Ctrl combo key support to usb keyboard driver. + + Ctrl combo key support is added, which is very useful to input Ctrl-C + for interrupt current job. + Also add usb_event_poll() calling to usb_kbd_testc(), which can get + key input when tstc() is called. + + Signed-off-by: Zhang Wei + Signed-off-by: Markus Klotzbuecher + commit 07eb02687f008721974a2fb54cd7fdc28033ab3c Author: Wolfgang Denk Date: Wed Jan 9 13:43:38 2008 +0100 @@ -411,6 +719,28 @@ Date: Tue Jan 8 11:13:09 2008 +0100 Signed-off-by: Matthias Fuchs +commit c83d7ca4dadd44ae430235077f63b64a11f36f6e +Author: Wolfgang Denk +Date: Tue Jan 8 22:58:27 2008 +0100 + + Fix compile problem with new env code. + + Signed-off-by: Wolfgang Denk + +commit 6de66b35426312a21174a9bf0576a094e2904bea +Author: Markus Klotzbücher +Date: Tue Nov 27 10:23:20 2007 +0100 + + tools: fix fw_printenv tool to compile again + + This patch updates the fw_printenv/fw_setenv userspace tool to include + the correct MTD header in order to compile against current kernel + headers. Backward compatibility is preserved by introducing an option + MTD_VERSION which can be set to "old" for compilation using the old MTD + headers. Along with this a number of warnings are fixed. + + Signed-off-by: Markus Klotzbuecher + commit ad3006fe7e84667021753b74247b0bafd97ba35f Author: Gerald Van Baren Date: Mon Jan 7 23:47:32 2008 -0500 @@ -4521,6 +4851,48 @@ Date: Wed Oct 3 07:34:10 2007 +0200 Signed-off-by: Stefan Roese +commit 245a362ad3c0c1b84fccc9fec7b623eb14f6e502 +Author: Marian Balakowicz +Date: Wed Oct 24 01:37:36 2007 +0200 + + TQM5200: Call usb_cpu_init() during board init + + usb_cpu_init() configures GPS USB pins, clocks, etc. and + is required for proper operation of kernel USB subsystem. + This setup was previously done in the kernel by the fixup + code which is being removed, thus low level init must be + done by U-boot now. + + Signed-off-by: Marian Balakowicz + Signed-off-by: Markus Klotzbuecher + +commit b5af773f8d92677e06f3295b45557c9d0a487c24 +Author: Zhang Wei +Date: Thu Oct 25 17:51:27 2007 +0800 + + Fix the issue of usb_kbd driver missing the scan code of key 'z'. + + The scan code of the key 'z' is 0x1d, which should be handled. + + The change has be tested on NOVATEK USB keyboard and ULI PCI OHCI + controller. + + Signed-off-by: Zhang Wei + Signed-off-by: Markus Klotzbuecher + +commit 85ac988e86f9414fa645b0148dc66c3520a1eb84 +Author: Rodolfo Giometti +Date: Mon Oct 15 11:59:17 2007 +0200 + + PXA USB OHCI: "usb stop" implementation. + + Some USB keys need to be switched off before loading the kernel + otherwise they can remain in an undefined status which prevents them + to be correctly recognized by the kernel. + + Signed-off-by: Rodolfo Giometti + Signed-off-by: Markus Klotzbuecher + commit 31548249decf18a6b877a18436b6139dd483fe4a Author: Justin Flammia Date: Mon Oct 29 17:40:35 2007 -0400 diff --git a/api/README b/api/README index c8f9c457c44..6df225f584b 100644 --- a/api/README +++ b/api/README @@ -22,7 +22,7 @@ U-Boot machine/arch independent API for external apps - the U-Boot integral part of the API is meant to be thin and non-intrusive, leaving as much processing as possible on the consumer application side, for example it doesn't keep states, but relies on hints from the app and - so on + so on - optional (CONFIG_API) diff --git a/api/api.c b/api/api.c index 10f83eb691c..0598d9082dc 100644 --- a/api/api.c +++ b/api/api.c @@ -231,7 +231,7 @@ static int API_dev_enum(va_list ap) /* start over - clean up enumeration */ dev_enum_reset(); /* XXX shouldn't the name contain 'stor'? */ debugf("RESTART ENUM\n"); - + /* net device enumeration first */ if (dev_enum_net(di)) return 0; @@ -365,7 +365,7 @@ static int API_dev_write(va_list ap) return API_EINVAL; if (di->type & DEV_TYP_STOR) - /* + /* * write to storage is currently not supported by U-Boot: * no storage device implements block_write() method */ @@ -523,7 +523,7 @@ static int API_env_enum(va_list ap) char *last, **next; last = (char *)va_arg(ap, u_int32_t); - + if ((next = (char **)va_arg(ap, u_int32_t)) == NULL) return API_EINVAL; @@ -540,7 +540,7 @@ static int API_env_enum(va_list ap) return 0; } } - + if (envmatch((uchar *)last, i) < 0) continue; @@ -567,7 +567,7 @@ static cfp_t calls_table[API_MAXCALL] = { NULL, }; * serviced until finished. * * e.g. syscall(1, int *, u_int32_t, u_int32_t, u_int32_t, u_int32_t); - * + * * call: syscall number * * retval: points to the return value placeholder, this is the place the @@ -655,7 +655,7 @@ void platform_set_mr(struct sys_info *si, unsigned long start, unsigned long siz if (!si->mr || !size || (flags == 0)) return; - + /* find free slot */ for (i = 0; i < si->mr_no; i++) if (si->mr[i].flags == 0) { diff --git a/api/api_net.c b/api/api_net.c index 9b20a1740c7..9611ab0dda9 100644 --- a/api/api_net.c +++ b/api/api_net.c @@ -75,7 +75,7 @@ int dev_close_net(void *cookie) return 0; } -/* +/* * There can only be one active eth interface at a time - use what is * currently set to eth_current */ diff --git a/api_examples/Makefile b/api_examples/Makefile index 5812bcd3370..cb49a9ea797 100644 --- a/api_examples/Makefile +++ b/api_examples/Makefile @@ -71,7 +71,7 @@ $(BIN): $(obj)%.bin: $(obj)% $(OBJCOPY) -O binary $< $@ 2>/dev/null -$(obj)crc32.c: +$(obj)crc32.c: @rm -f $(obj)crc32.c ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c diff --git a/api_examples/demo.c b/api_examples/demo.c index a4aeef183b5..eae9712b71f 100644 --- a/api_examples/demo.c +++ b/api_examples/demo.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) /* enumerate devices */ printf("\n*** Enumerate devices ***\n"); devs_no = ub_dev_enum(); - + printf("Number of devices found: %d\n", devs_no); if (devs_no == 0) return -1; diff --git a/api_examples/glue.c b/api_examples/glue.c index 75983691fde..2bf47ae3d21 100644 --- a/api_examples/glue.c +++ b/api_examples/glue.c @@ -150,7 +150,7 @@ struct sys_info * ub_get_sys_info(void) * timing * ****************************************/ - + void ub_udelay(unsigned long usec) { syscall(API_UDELAY, NULL, &usec); @@ -298,7 +298,7 @@ int ub_dev_read(int handle, void *buf, lbasize_t len, lbastart_t start) if (!syscall(API_DEV_READ, &err, di, buf, &len, &start, &act_len)) return -1; - if (err) + if (err) return err; if (act_len != len) diff --git a/board/atum8548/atum8548.c b/board/atum8548/atum8548.c index 4d7dc7728cb..f11abd816bb 100644 --- a/board/atum8548/atum8548.c +++ b/board/atum8548/atum8548.c @@ -140,7 +140,7 @@ testdram(void) for (p = pstart; p < pend; p++) { printf ("DRAM test attempting to write 0xaaaaaaaa at: %08x\n", (uint) p); *p = 0xaaaaaaaa; - } + } for (p = pstart; p < pend; p++) { if (*p != 0xaaaaaaaa) { @@ -191,7 +191,7 @@ pci_init_board(void) debug (" pci_init_board: devdisr=%x, io_sel=%x, host_agent=%x\n", devdisr, io_sel, host_agent); - /* explicitly set 'Clock out select register' to echo SYSCLK input to our CPLD */ + /* explicitly set 'Clock out select register' to echo SYSCLK input to our CPLD */ gur->clkocr |= MPC85xx_ATUM_CLKOCR; if (io_sel & 1) { @@ -376,7 +376,7 @@ pci_init_board(void) int last_stage_init(void) { - int ic = icache_status (); + int ic = icache_status (); printf ("icache_status: %d\n", ic); return 0; } diff --git a/board/atum8548/init.S b/board/atum8548/init.S index a410e2e568c..654a5699078 100644 --- a/board/atum8548/init.S +++ b/board/atum8548/init.S @@ -70,7 +70,7 @@ tlb1_entry: /* * Number of TLB0 and TLB1 entries in the following table */ - .long (2f-1f)/16 + .long (2f-1f)/16 1: #if (CFG_CCSRBAR_DEFAULT != CFG_CCSRBAR) @@ -182,15 +182,15 @@ tlb1_entry: /* * LAW(Local Access Window) configuration: * - * 0x0000_0000 0x7fff_ffff DDR 2G - * 0x8000_0000 0x9fff_ffff PCI1 MEM 512M - * 0xa000_0000 0xbfff_ffff PCIe MEM 512M - * 0xc000_0000 0xdfff_ffff PCI2 MEM 512M - * 0xe000_0000 0xe000_ffff CCSR 1M - * 0xe200_0000 0xe10f_ffff PCI1 IO 1M - * 0xe280_0000 0xe20f_ffff PCI2 IO 1M - * 0xe300_0000 0xe30f_ffff PCIe IO 1M - * 0xf800_0000 0xffff_ffff FLASH (boot bank) 128M + * 0x0000_0000 0x7fff_ffff DDR 2G + * 0x8000_0000 0x9fff_ffff PCI1 MEM 512M + * 0xa000_0000 0xbfff_ffff PCIe MEM 512M + * 0xc000_0000 0xdfff_ffff PCI2 MEM 512M + * 0xe000_0000 0xe000_ffff CCSR 1M + * 0xe200_0000 0xe10f_ffff PCI1 IO 1M + * 0xe280_0000 0xe20f_ffff PCI2 IO 1M + * 0xe300_0000 0xe30f_ffff PCIe IO 1M + * 0xf800_0000 0xffff_ffff FLASH (boot bank) 128M * * Notes: * CCSRBAR and L2-as-SRAM don't need a configured Local Access Window. @@ -227,7 +227,7 @@ law_entry: .long (CFG_PCIE1_IO_PHYS>>12) & 0xfffff .long LAWAR_EN | LAWAR_TRGT_PCIE | (LAWAR_SIZE & LAWAR_SIZE_1M) - /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ + /* LBC window - maps 256M 0xf0000000 -> 0xffffffff */ .long (CFG_LBC_CACHE_BASE>>12) & 0xfffff .long LAWAR_EN | LAWAR_TRGT_IF_LBC | (LAWAR_SIZE & LAWAR_SIZE_256M) diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c index 5e258f5d691..65052e60c87 100644 --- a/board/sbc8548/sbc8548.c +++ b/board/sbc8548/sbc8548.c @@ -566,4 +566,3 @@ ft_board_setup(void *blob, bd_t *bd) #endif } #endif - diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c index 276788c8574..c802014a50b 100644 --- a/drivers/qe/qe.c +++ b/drivers/qe/qe.c @@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; void qe_issue_cmd(uint cmd, uint sbc, u8 mcn, u32 cmd_data) { - u32 cecr; + u32 cecr; if (cmd == QE_RESET) { out_be32(&qe_immr->cp.cecr,(u32) (cmd | QE_CR_FLG)); @@ -357,10 +357,10 @@ int qe_upload_firmware(const struct qe_firmware *firmware) return -EPERM; } - /* - * Validate the CRC. We would normally call crc32_no_comp(), but that - * function isn't available unless you turn on JFFS support. - */ + /* + * Validate the CRC. We would normally call crc32_no_comp(), but that + * function isn't available unless you turn on JFFS support. + */ crc = be32_to_cpu(*(u32 *)((void *)firmware + calc_size)); if (crc != (crc32(-1, (const void *) firmware, calc_size) ^ -1)) { printf("Firmware CRC is invalid\n"); @@ -438,10 +438,10 @@ static int qe_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return -EINVAL; } - /* - * If a length was supplied, compare that with the 'length' - * field. - */ + /* + * If a length was supplied, compare that with the 'length' + * field. + */ if (argc > 3) { ulong length = simple_strtoul(argv[3], NULL, 16); -- cgit v1.3.1