diff options
50 files changed, 604 insertions, 279 deletions
@@ -24,7 +24,7 @@ VERSION = 2011 PATCHLEVEL = 12 SUBLEVEL = -EXTRAVERSION = -rc1 +EXTRAVERSION = ifneq "$(SUBLEVEL)" "" U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) else @@ -643,7 +643,7 @@ unconfig: sinclude $(obj).boards.depend $(obj).boards.depend: boards.cfg - awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@ + @awk '(NF && $$1 !~ /^#/) { print $$1 ": " $$1 "_config; $$(MAKE)" }' $< > $@ # # Functions to generate common board directory names diff --git a/arch/arm/cpu/arm920t/s3c24x0/Makefile b/arch/arm/cpu/arm920t/s3c24x0/Makefile index bd53724..0029700 100644 --- a/arch/arm/cpu/arm920t/s3c24x0/Makefile +++ b/arch/arm/cpu/arm920t/s3c24x0/Makefile @@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).o COBJS-$(CONFIG_USE_IRQ) += interrupts.o +COBJS-$(CONFIG_DISPLAY_CPUINFO) += cpu_info.o COBJS-y += speed.o COBJS-y += timer.o COBJS-y += usb.o diff --git a/arch/arm/cpu/arm920t/s3c24x0/cpu_info.c b/arch/arm/cpu/arm920t/s3c24x0/cpu_info.c new file mode 100644 index 0000000..14c5c6a --- /dev/null +++ b/arch/arm/cpu/arm920t/s3c24x0/cpu_info.c @@ -0,0 +1,54 @@ +/* + * (C) Copyright 2010 + * David Mueller <d.mueller@elsoft.ch> + * + * 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 <common.h> +#include <asm/io.h> +#include <asm/arch/s3c24x0_cpu.h> + +typedef ulong (*getfreq)(void); + +static const getfreq freq_f[] = { + get_FCLK, + get_HCLK, + get_PCLK, +}; + +static const char freq_c[] = { 'F', 'H', 'P' }; + +int print_cpuinfo(void) +{ + int i; + char buf[32]; +/* the S3C2400 seems to be lacking a CHIP ID register */ +#ifndef CONFIG_S3C2400 + ulong cpuid; + struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio(); + + cpuid = readl(&gpio->gstatus1); + printf("CPUID: %8lX\n", cpuid); +#endif + for (i = 0; i < ARRAY_SIZE(freq_f); i++) + printf("%cCLK: %8s MHz\n", freq_c[i], strmhz(buf, freq_f[i]())); + + return 0; +} diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c index 4415642..ee90ab7 100644 --- a/arch/arm/cpu/arm926ejs/cache.c +++ b/arch/arm/cpu/arm926ejs/cache.c @@ -38,11 +38,6 @@ void invalidate_dcache_all(void) dcache_noop(); } -void flush_dcache_all(void) -{ - dcache_noop(); -} - void invalidate_dcache_range(unsigned long start, unsigned long stop) { dcache_noop(); diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c index a06d449..93c9e60 100644 --- a/arch/arm/cpu/arm926ejs/davinci/timer.c +++ b/arch/arm/cpu/arm926ejs/davinci/timer.c @@ -108,7 +108,7 @@ void __udelay(unsigned long usec) */ ulong get_tbclk(void) { - return CONFIG_SYS_HZ; + return gd->timer_rate_hz; } #ifdef CONFIG_HW_WATCHDOG diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 6a77c71..ef08a55 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -132,6 +132,7 @@ reset: orr r0, r0, #0xd3 msr cpsr,r0 +#if !defined(CONFIG_TEGRA2) /* * Setup vector: * (OMAP4 spl TEXT_BASE is not 32 byte aligned. @@ -147,6 +148,7 @@ reset: ldr r0, =_start mcr p15, 0, r0, c12, c0, 0 @Set VBAR #endif +#endif /* !Tegra2 */ /* the mask ROM code should have PLL and others stable */ #ifndef CONFIG_SKIP_LOWLEVEL_INIT diff --git a/arch/arm/include/asm/arch-davinci/da8xx-fb.h b/arch/arm/include/asm/arch-davinci/da8xx-fb.h index 6d2327c..a9181d8 100644 --- a/arch/arm/include/asm/arch-davinci/da8xx-fb.h +++ b/arch/arm/include/asm/arch-davinci/da8xx-fb.h @@ -123,4 +123,3 @@ struct lcd_sync_arg { void da8xx_video_init(const struct da8xx_panel *panel, int bits_pixel); #endif /* ifndef DA8XX_FB_H */ - diff --git a/arch/arm/include/asm/arch-omap4/clocks.h b/arch/arm/include/asm/arch-omap4/clocks.h index c2a9b46..cd304e8 100644 --- a/arch/arm/include/asm/arch-omap4/clocks.h +++ b/arch/arm/include/asm/arch-omap4/clocks.h @@ -470,6 +470,47 @@ struct omap4_prcm_regs { }; +struct omap4_scrm_regs { + u32 revision; /* 0x0000 */ + u32 pad00[63]; + u32 clksetuptime; /* 0x0100 */ + u32 pmicsetuptime; /* 0x0104 */ + u32 pad01[2]; + u32 altclksrc; /* 0x0110 */ + u32 pad02[2]; + u32 c2cclkm; /* 0x011c */ + u32 pad03[56]; + u32 extclkreq; /* 0x0200 */ + u32 accclkreq; /* 0x0204 */ + u32 pwrreq; /* 0x0208 */ + u32 pad04[1]; + u32 auxclkreq0; /* 0x0210 */ + u32 auxclkreq1; /* 0x0214 */ + u32 auxclkreq2; /* 0x0218 */ + u32 auxclkreq3; /* 0x021c */ + u32 auxclkreq4; /* 0x0220 */ + u32 auxclkreq5; /* 0x0224 */ + u32 pad05[3]; + u32 c2cclkreq; /* 0x0234 */ + u32 pad06[54]; + u32 auxclk0; /* 0x0310 */ + u32 auxclk1; /* 0x0314 */ + u32 auxclk2; /* 0x0318 */ + u32 auxclk3; /* 0x031c */ + u32 auxclk4; /* 0x0320 */ + u32 auxclk5; /* 0x0324 */ + u32 pad07[54]; + u32 rsttime_reg; /* 0x0400 */ + u32 pad08[6]; + u32 c2crstctrl; /* 0x041c */ + u32 extpwronrstctrl; /* 0x0420 */ + u32 pad09[59]; + u32 extwarmrstst_reg; /* 0x0510 */ + u32 apewarmrstst_reg; /* 0x0514 */ + u32 pad10[1]; + u32 c2cwarmrstst_reg; /* 0x051C */ +}; + /* DPLL register offsets */ #define CM_CLKMODE_DPLL 0 #define CM_IDLEST_DPLL 0x4 @@ -652,6 +693,28 @@ struct omap4_prcm_regs { #define TPS62361_BASE_VOLT_MV 500 #define TPS62361_VSEL0_GPIO 7 +/* AUXCLKx reg fields */ +#define AUXCLK_ENABLE_MASK (1 << 8) +#define AUXCLK_SRCSELECT_SHIFT 1 +#define AUXCLK_SRCSELECT_MASK (3 << 1) +#define AUXCLK_CLKDIV_SHIFT 16 +#define AUXCLK_CLKDIV_MASK (0xF << 16) + +#define AUXCLK_SRCSELECT_SYS_CLK 0 +#define AUXCLK_SRCSELECT_CORE_DPLL 1 +#define AUXCLK_SRCSELECT_PER_DPLL 2 +#define AUXCLK_SRCSELECT_ALTERNATE 3 + +#define AUXCLK_CLKDIV_2 1 +#define AUXCLK_CLKDIV_16 0xF + +/* ALTCLKSRC */ +#define ALTCLKSRC_MODE_MASK 3 +#define ALTCLKSRC_ENABLE_INT_MASK 4 +#define ALTCLKSRC_ENABLE_EXT_MASK 8 + +#define ALTCLKSRC_MODE_ACTIVE 1 + /* Defines for DPLL setup */ #define DPLL_LOCKED_FREQ_TOLERANCE_0 0 #define DPLL_LOCKED_FREQ_TOLERANCE_500_KHZ 500 diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 802e833..afa0093 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -206,6 +206,8 @@ static int bootm_linux_fdt(int machid, bootm_headers_t *images) fixup_memory_node(*of_flat_tree); + fdt_fixup_ethernet(*of_flat_tree); + fdt_initrd(*of_flat_tree, *initrd_start, *initrd_end, 1); announce_and_cleanup(); diff --git a/arch/avr32/cpu/interrupts.c b/arch/avr32/cpu/interrupts.c index 6681e13..49a00f1 100644 --- a/arch/avr32/cpu/interrupts.c +++ b/arch/avr32/cpu/interrupts.c @@ -107,7 +107,7 @@ static int set_interrupt_handler(unsigned int nr, void (*handler)(void), return 0; } -void timer_init(void) +int timer_init(void) { extern void timer_interrupt_handler(void); u64 tmp; @@ -120,8 +120,9 @@ void timer_init(void) tb_factor = (u32)tmp; if (set_interrupt_handler(0, &timer_interrupt_handler, 3)) - return; + return -EINVAL; /* For all practical purposes, this gives us an overflow interrupt */ sysreg_write(COMPARE, 0xffffffff); + return 0; } diff --git a/arch/sh/lib/ashrsi3.S b/arch/sh/lib/ashrsi3.S index 6f3cf46..2d68b27 100644 --- a/arch/sh/lib/ashrsi3.S +++ b/arch/sh/lib/ashrsi3.S @@ -56,7 +56,7 @@ Boston, MA 02110-1301, USA. */ ! .global __ashrsi3 - + .align 2 __ashrsi3: mov #31,r0 diff --git a/board/calao/sbc35_a9g20/sbc35_a9g20.c b/board/calao/sbc35_a9g20/sbc35_a9g20.c index 4f5cff6..b6c8791 100644 --- a/board/calao/sbc35_a9g20/sbc35_a9g20.c +++ b/board/calao/sbc35_a9g20/sbc35_a9g20.c @@ -152,7 +152,6 @@ int board_init(void) /* Enable Ctrlc */ console_init_f(); - gd->bd->bi_arch_number = MACH_TYPE_SBC35_A9G20; /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; diff --git a/board/calao/tny_a9260/tny_a9260.c b/board/calao/tny_a9260/tny_a9260.c index 24de177..31074d0 100644 --- a/board/calao/tny_a9260/tny_a9260.c +++ b/board/calao/tny_a9260/tny_a9260.c @@ -86,11 +86,6 @@ int board_init(void) /* Enable Ctrlc */ console_init_f(); -#if defined(CONFIG_TNY_A9260) - gd->bd->bi_arch_number = MACH_TYPE_TNY_A9260; -#elif defined(CONFIG_TNY_A9G20) - gd->bd->bi_arch_number = MACH_TYPE_TNY_A9G20; -#endif /* adress of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; diff --git a/board/denx/m28evk/u-boot.bd b/board/denx/m28evk/u-boot.bd index 3ce7f92..c60615a 100644 --- a/board/denx/m28evk/u-boot.bd +++ b/board/denx/m28evk/u-boot.bd @@ -4,11 +4,11 @@ sources { } section (0) { - load u_boot_spl > 0x0000; - load ivt (entry = 0x0014) > 0x8000; + load u_boot_spl > 0x0000; + load ivt (entry = 0x0014) > 0x8000; hab call 0x8000; - load u_boot > 0x40000100; - load ivt (entry = 0x40000100) > 0x8000; + load u_boot > 0x40000100; + load ivt (entry = 0x40000100) > 0x8000; hab call 0x8000; } diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c index d476cd5..89f1b1d 100644 --- a/board/eltec/elppc/misc.c +++ b/board/eltec/elppc/misc.c @@ -116,7 +116,7 @@ int misc_init_r (void) eerev.etheraddr[5] = 0x4D; /* cache config word for ELPPC */ - *(int *) &eerev.res[0] = 0; + memset(&eerev.res[0], 0, 4); initSrom = 1; /* force dialog */ copyNv = 1; /* copy to nvram */ diff --git a/board/esd/cpci750/mv_eth.c b/board/esd/cpci750/mv_eth.c index 781ad23..001c1ad 100644 --- a/board/esd/cpci750/mv_eth.c +++ b/board/esd/cpci750/mv_eth.c @@ -422,7 +422,7 @@ static int mv64360_eth_real_open (struct eth_device *dev) ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; unsigned int port_num; - u32 port_status, phy_reg_data; + u32 phy_reg_data; ethernet_private = (ETH_PORT_INFO *) dev->priv; /* ronen - when we update the MAC env params we only update dev->enetaddr @@ -520,7 +520,7 @@ static int mv64360_eth_real_open (struct eth_device *dev) */ MV_REG_WRITE (MV64360_ETH_MAXIMUM_TRANSMIT_UNIT (port_num), 0); - port_status = MV_REG_READ (MV64360_ETH_PORT_STATUS_REG (port_num)); + MV_REG_READ (MV64360_ETH_PORT_STATUS_REG (port_num)); /* Check Link status on phy */ eth_port_read_smi_reg (port_num, 1, &phy_reg_data); @@ -638,15 +638,6 @@ static int mv64360_eth_free_rx_rings (struct eth_device *dev) int mv64360_eth_stop (struct eth_device *dev) { - ETH_PORT_INFO *ethernet_private; - struct mv64360_eth_priv *port_private; - unsigned int port_num; - - ethernet_private = (ETH_PORT_INFO *) dev->priv; - port_private = - (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; - /* Disable all gigE address decoder */ MV_REG_WRITE (MV64360_ETH_BASE_ADDR_ENABLE_REG, 0x3f); DP (printf ("%s Ethernet stop called ... \n", __FUNCTION__)); @@ -716,7 +707,6 @@ int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr, { ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; - unsigned int port_num; PKT_INFO pkt_info; ETH_FUNC_RET_STATUS status; struct net_device_stats *stats; @@ -725,7 +715,6 @@ int mv64360_eth_xmit (struct eth_device *dev, volatile void *dataPtr, ethernet_private = (ETH_PORT_INFO *) dev->priv; port_private = (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; stats = port_private->stats; @@ -801,7 +790,6 @@ int mv64360_eth_receive (struct eth_device *dev) { ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; - unsigned int port_num; PKT_INFO pkt_info; struct net_device_stats *stats; @@ -809,7 +797,6 @@ int mv64360_eth_receive (struct eth_device *dev) ethernet_private = (ETH_PORT_INFO *) dev->priv; port_private = (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; stats = port_private->stats; while ((eth_port_receive (ethernet_private, ETH_Q0, &pkt_info) == @@ -900,12 +887,10 @@ static struct net_device_stats *mv64360_eth_get_stats (struct eth_device *dev) { ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; - unsigned int port_num; ethernet_private = (ETH_PORT_INFO *) dev->priv; port_private = (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; mv64360_eth_update_stat (dev); @@ -927,13 +912,10 @@ static void mv64360_eth_update_stat (struct eth_device *dev) ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; struct net_device_stats *stats; - unsigned int port_num; - volatile unsigned int dummy; ethernet_private = (ETH_PORT_INFO *) dev->priv; port_private = (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; stats = port_private->stats; /* These are false updates */ @@ -956,12 +938,12 @@ static void mv64360_eth_update_stat (struct eth_device *dev) * But the unsigned long in PowerPC and MIPS are 32bit. So the next read * is just a dummy read for proper work of the GigE port */ - dummy = eth_read_mib_counter (ethernet_private->port_num, + (void)eth_read_mib_counter (ethernet_private->port_num, ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH); stats->tx_bytes += (unsigned long) eth_read_mib_counter (ethernet_private->port_num, ETH_MIB_GOOD_OCTETS_SENT_LOW); - dummy = eth_read_mib_counter (ethernet_private->port_num, + (void)eth_read_mib_counter (ethernet_private->port_num, ETH_MIB_GOOD_OCTETS_SENT_HIGH); stats->rx_errors += (unsigned long) eth_read_mib_counter (ethernet_private->port_num, @@ -1009,12 +991,10 @@ static void mv64360_eth_print_stat (struct eth_device *dev) ETH_PORT_INFO *ethernet_private; struct mv64360_eth_priv *port_private; struct net_device_stats *stats; - unsigned int port_num; ethernet_private = (ETH_PORT_INFO *) dev->priv; port_private = (struct mv64360_eth_priv *) ethernet_private->port_private; - port_num = port_private->port_num; stats = port_private->stats; /* These are false updates */ @@ -2066,13 +2046,13 @@ static void eth_port_init_mac_tables (ETH_PORT eth_port_num) static void eth_clear_mib_counters (ETH_PORT eth_port_num) { int i; - unsigned int dummy; /* Perform dummy reads from MIB counters */ for (i = ETH_MIB_GOOD_OCTETS_RECEIVED_LOW; i < ETH_MIB_LATE_COLLISION; - i += 4) - dummy = MV_REG_READ ((MV64360_ETH_MIB_COUNTERS_BASE + i += 4) { + (void)MV_REG_READ ((MV64360_ETH_MIB_COUNTERS_BASE (eth_port_num) + i)); + } return; } diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c index 13c5941..e43aaf7 100644 --- a/board/freescale/mx51evk/mx51evk.c +++ b/board/freescale/mx51evk/mx51evk.c @@ -203,7 +203,7 @@ static void setup_usb_h1(void) mxc_iomux_set_pad(MX51_PIN_EIM_D21, GPIO_PAD); } -void board_ehci_hcd_init(int port) +int board_ehci_hcd_init(int port) { /* Set USBH1_STP to GPIO and toggle it */ mxc_request_iomux(MX51_PIN_USBH1_STP, IOMUX_CONFIG_GPIO); @@ -228,6 +228,7 @@ void board_ehci_hcd_init(int port) gpio_direction_output(MX51EVK_USBH1_HUB_RST, 0); mdelay(2); gpio_set_value(MX51EVK_USBH1_HUB_RST, 1); + return 0; } #endif diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c index 57170ce..ea4d354 100644 --- a/board/freescale/mx53loco/mx53loco.c +++ b/board/freescale/mx53loco/mx53loco.c @@ -79,12 +79,13 @@ static void setup_iomux_uart(void) } #ifdef CONFIG_USB_EHCI_MX5 -void board_ehci_hcd_init(int port) +int board_ehci_hcd_init(int port) { /* request VBUS power enable pin, GPIO[8}, gpio7 */ mxc_request_iomux(MX53_PIN_ATA_DA_2, IOMUX_CONFIG_ALT1); gpio_direction_output(IOMUX_TO_GPIO(MX53_PIN_ATA_DA_2), 0); gpio_set_value(IOMUX_TO_GPIO(MX53_PIN_ATA_DA_2), 1); + return 0; } #endif diff --git a/board/keymile/scripts/README b/board/keymile/scripts/README index 7fbcf74..dd935b2 100644 --- a/board/keymile/scripts/README +++ b/board/keymile/scripts/README @@ -7,7 +7,7 @@ default environment must be parsed: run develop : setup environment to configure for rootfs via nfs run ramfs : setup environment to configure for rootfs in ram -Last change: 20.05.2011 +Last change: 24.11.2011 develop-common.txt ============================ diff --git a/board/keymile/scripts/develop-common.txt b/board/keymile/scripts/develop-common.txt index 93e2967..aa3d659 100644 --- a/board/keymile/scripts/develop-common.txt +++ b/board/keymile/scripts/develop-common.txt @@ -2,6 +2,7 @@ altbootcmd=run ${subbootcmds} bootcmd=run ${subbootcmds} configure=km_setboardid && saveenv && reset subbootcmds=tftpfdt tftpkernel nfsargs add_default boot -nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:/opt/eldk/${arch} +nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${toolchain}/${arch} tftpkernel=tftpboot ${load_addr_r} ${hostname}/uImage +toolchain=/opt/eldk rootfssize=0 diff --git a/board/lubbock/lubbock.c b/board/lubbock/lubbock.c index 437f944..3527b38 100644 --- a/board/lubbock/lubbock.c +++ b/board/lubbock/lubbock.c @@ -28,6 +28,8 @@ #include <common.h> #include <netdev.h> #include <asm/arch/pxa.h> +#include <asm/arch/pxa-regs.h> +#include <asm/io.h> DECLARE_GLOBAL_DATA_PTR; @@ -47,6 +49,10 @@ int board_init (void) /* adress of boot parameters */ gd->bd->bi_boot_params = 0xa0000100; + /* Configure GPIO6 and GPIO8 as OUT, AF1. */ + setbits_le32(GPDR0, (1 << 6) | (1 << 8)); + clrsetbits_le32(GAFR0_L, (3 << 12) | (3 << 16), (1 << 12) | (1 << 16)); + return 0; } diff --git a/board/nvidia/ventana/Makefile b/board/nvidia/ventana/Makefile index 9e5a87f..d5140c8 100644 --- a/board/nvidia/ventana/Makefile +++ b/board/nvidia/ventana/Makefile @@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk ifneq ($(OBJTREE),$(SRCTREE)) +$(shell mkdir -p $(obj)../seaboard) $(shell mkdir -p $(obj)../common) endif diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c index 8393e4f..d0ff834 100644 --- a/board/samsung/universal_c210/universal.c +++ b/board/samsung/universal_c210/universal.c @@ -260,7 +260,7 @@ int board_mmc_init(bd_t *bis) #ifdef CONFIG_USB_GADGET static int s5pc210_phy_control(int on) { - int ret; + int ret = 0; struct pmic *p = get_pmic(); if (pmic_probe(p)) diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c index b4271fb..fc8c0b4 100644 --- a/board/ti/panda/panda.c +++ b/board/ti/panda/panda.c @@ -24,15 +24,21 @@ #include <common.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> +#include <asm/arch/clocks.h> +#include <asm/arch/gpio.h> #include "panda_mux_data.h" +#define PANDA_ULPI_PHY_TYPE_GPIO 182 + DECLARE_GLOBAL_DATA_PTR; const struct omap_sysinfo sysinfo = { "Board: OMAP4 Panda\n" }; +struct omap4_scrm_regs *const scrm = (struct omap4_scrm_regs *)0x4a30a000; + /** * @brief board_init * @@ -62,6 +68,59 @@ int board_eth_init(bd_t *bis) */ int misc_init_r(void) { + int phy_type; + u32 auxclk, altclksrc; + + /* EHCI is not supported on ES1.0 */ + if (omap_revision() == OMAP4430_ES1_0) + return 0; + + gpio_direction_input(PANDA_ULPI_PHY_TYPE_GPIO); + phy_type = gpio_get_value(PANDA_ULPI_PHY_TYPE_GPIO); + + if (phy_type == 1) { + /* ULPI PHY supplied by auxclk3 derived from sys_clk */ + debug("ULPI PHY supplied by auxclk3\n"); + + auxclk = readl(&scrm->auxclk3); + /* Select sys_clk */ + auxclk &= ~AUXCLK_SRCSELECT_MASK; + auxclk |= AUXCLK_SRCSELECT_SYS_CLK << AUXCLK_SRCSELECT_SHIFT; + /* Set the divisor to 2 */ + auxclk &= ~AUXCLK_CLKDIV_MASK; + auxclk |= AUXCLK_CLKDIV_2 << AUXCLK_CLKDIV_SHIFT; + /* Request auxilary clock #3 */ + auxclk |= AUXCLK_ENABLE_MASK; + + writel(auxclk, &scrm->auxclk3); + } else { + /* ULPI PHY supplied by auxclk1 derived from PER dpll */ + debug("ULPI PHY supplied by auxclk1\n"); + + auxclk = readl(&scrm->auxclk1); + /* Select per DPLL */ + auxclk &= ~AUXCLK_SRCSELECT_MASK; + auxclk |= AUXCLK_SRCSELECT_PER_DPLL << AUXCLK_SRCSELECT_SHIFT; + /* Set the divisor to 16 */ + auxclk &= ~AUXCLK_CLKDIV_MASK; + auxclk |= AUXCLK_CLKDIV_16 << AUXCLK_CLKDIV_SHIFT; + /* Request auxilary clock #3 */ + auxclk |= AUXCLK_ENABLE_MASK; + + writel(auxclk, &scrm->auxclk1); + } + + altclksrc = readl(&scrm->altclksrc); + + /* Activate alternate system clock supplier */ + altclksrc &= ~ALTCLKSRC_MODE_MASK; + altclksrc |= ALTCLKSRC_MODE_ACTIVE; + + /* enable clocks */ + altclksrc |= ALTCLKSRC_ENABLE_INT_MASK | ALTCLKSRC_ENABLE_EXT_MASK; + + writel(altclksrc, &scrm->altclksrc); + return 0; } diff --git a/common/cmd_net.c b/common/cmd_net.c index f89a24b..89519fa 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -221,8 +221,11 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc, #ifdef CONFIG_CMD_TFTPPUT case 4: - save_addr = strict_strtoul(argv[1], NULL, 16); - save_size = strict_strtoul(argv[2], NULL, 16); + if (strict_strtoul(argv[1], 16, &save_addr) < 0 || + strict_strtoul(argv[2], 16, &save_size) < 0) { + printf("Invalid address/size\n"); + return cmd_usage(cmdtp); + } copy_filename(BootFile, argv[3], sizeof(BootFile)); break; #endif diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index baaa513..63afc82 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -868,7 +868,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, printf("## Warning: Input data exceeds %d bytes" " - truncated\n", MAX_ENV_SIZE); } - ++size; + size += 2; printf("## Info: input data size = %zu = 0x%zX\n", size, size); } diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index 9426f5b..7c0cb66 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -918,7 +918,7 @@ static int parse_menu(char **c, struct pxe_menu *cfg, char *b, int nest_level) { struct token t; char *s = *c; - int err; + int err = 0; get_token(c, &t, L_KEYWORD); diff --git a/doc/README.menu b/doc/README.menu index 1259c6a..0dad6a2 100644 --- a/doc/README.menu +++ b/doc/README.menu @@ -97,7 +97,7 @@ char *pick_a_tool(void) printf("failed to add item!"); menu_destroy(m); return NULL; - } + } } if (menu_get_choice(m, (void **)&tool) != 1) diff --git a/doc/README.p3060qds b/doc/README.p3060qds index 2ed49ca..ec62798 100644 --- a/doc/README.p3060qds +++ b/doc/README.p3060qds @@ -43,7 +43,7 @@ I2C: * I2C1_CH0: EEPROM AT24C64(0x50) RCW, AT24C02(0x51) DDR SPD, AT24C02(0x53) DDR SPD, AT24C02(0x57) SystemID, RTC DS3232(0x68) * I2C1_CH1: 1588 RiserCard(0x55), HSLB Testport, TempMon - ADT7461(0x4C), SerDesMux DS64MB201(0x51/59/5C/5D) + ADT7461(0x4C), SerDesMux DS64MB201(0x51/59/5C/5D) * I2C1_CH2: VDD/GVDD/GIDD ZL6100 (0x21/0x22/0x23/0x24/0x40) * I2C1_CH3: OCM CFG AT24C02(0x55), OCM IPL AT24C64(0x56) * I2C1_CH4: PCIe SLOT1 @@ -108,4 +108,3 @@ Place a linux uImage in the TFTP disk area. tftp 2000000 rootfs.ext2.gz.uboot tftp 3000000 p3060rdb.dtb bootm 1000000 2000000 3000000 - diff --git a/doc/README.pxe b/doc/README.pxe index 9026d9c..95cd9b9 100644 --- a/doc/README.pxe +++ b/doc/README.pxe @@ -115,50 +115,50 @@ Supported global commands ------------------------- Unrecognized commands are ignored. -default <label> - the label named here is treated as the default and is - the first label 'pxe boot' attempts to boot. +default <label> - the label named here is treated as the default and is + the first label 'pxe boot' attempts to boot. menu title <string> - sets a title for the menu of labels being displayed. menu include <path> - use tftp to retrieve the pxe file at <path>, which - is then immediately parsed as if the start of its - contents were the next line in the current file. nesting - of include up to 16 files deep is supported. + is then immediately parsed as if the start of its + contents were the next line in the current file. nesting + of include up to 16 files deep is supported. -prompt <flag> - if 1, always prompt the user to enter a label to boot - from. if 0, only prompt the user if timeout expires. +prompt <flag> - if 1, always prompt the user to enter a label to boot + from. if 0, only prompt the user if timeout expires. timeout <num> - wait for user input for <num>/10 seconds before - auto-booting a node. + auto-booting a node. -label <name> - begin a label definition. labels continue until - a command not recognized as a label command is seen, - or EOF is reached. +label <name> - begin a label definition. labels continue until + a command not recognized as a label command is seen, + or EOF is reached. Supported label commands ------------------------ labels end when a command not recognized as a label command is reached, or EOF. -menu default - set this label as the default label to boot; this is - the same behavior as the global default command but - specified in a different way +menu default - set this label as the default label to boot; this is + the same behavior as the global default command but + specified in a different way -kernel <path> - if this label is chosen, use tftp to retrieve the kernel - at <path>. it will be stored at the address indicated in - the kernel_addr_r environment variable, and that address - will be passed to bootm to boot this kernel. +kernel <path> - if this label is chosen, use tftp to retrieve the kernel + at <path>. it will be stored at the address indicated in + the kernel_addr_r environment variable, and that address + will be passed to bootm to boot this kernel. -append <string> - use <string> as the kernel command line when booting this - label. +append <string> - use <string> as the kernel command line when booting this + label. -initrd <path> - if this label is chosen, use tftp to retrieve the initrd - at <path>. it will be stored at the address indicated in - the initrd_addr_r environment variable, and that address - will be passed to bootm. +initrd <path> - if this label is chosen, use tftp to retrieve the initrd + at <path>. it will be stored at the address indicated in + the initrd_addr_r environment variable, and that address + will be passed to bootm. localboot <flag> - Run the command defined by "localcmd" in the environment. - <flag> is ignored and is only here to match the syntax of - PXELINUX config files. + <flag> is ignored and is only here to match the syntax of + PXELINUX config files. Example ------- @@ -217,7 +217,7 @@ PXELINUX and U-boot's pxe support. - U-boot's pxe doesn't provide the full menu implementation that PXELINUX does, only a simple text based menu using the commands described in - this README. With PXELINUX, it's possible to have a graphical boot + this README. With PXELINUX, it's possible to have a graphical boot menu, submenus, passwords, etc. U-boot's pxe could be extended to support a more robust menuing system like that of PXELINUX's. diff --git a/doc/README.sh7757lcr b/doc/README.sh7757lcr index 109f715..37c1a7a 100644 --- a/doc/README.sh7757lcr +++ b/doc/README.sh7757lcr @@ -67,11 +67,10 @@ Update SPI ROM: ============================ 1. Copy u-boot image to RAM area. -2. Probe SPI device. - => sf probe 0 +2. Probe SPI device. + => sf probe 0 8192 KiB M25P64 at 0:0 is now current device 3. Erase SPI ROM. - => sf erase 0 80000 + => sf erase 0 80000 4. Write u-boot image to SPI ROM. => sf write 0x89000000 0 80000 - diff --git a/doc/mkimage.1 b/doc/mkimage.1 index f27da6b..39652c8 100644 --- a/doc/mkimage.1 +++ b/doc/mkimage.1 @@ -9,13 +9,13 @@ mkimage \- Generate image for U-Boot The .B mkimage command is used to create images for use with the U-Boot boot loader. -Thes eimages can contain the linux kernel, device tree blob, root file +These images can contain the linux kernel, device tree blob, root file system image, firmware images etc., either separate or combined. .B mkimage supports two different formats: -The old, +The old .I legacy image format concatenates the individual parts (for example, kernel image, device tree blob and ramdisk image) and adds a 64 bytes header @@ -23,9 +23,9 @@ containing information about target architecture, operating system, image type, compression method, entry points, time stamp, checksums, etc. -The new, +The new .I FIT (Flattened Image Tree) format -allows for more flexibility in handling images of various and also +allows for more flexibility in handling images of various types and also enhances integrity protection of images with stronger checksums. .SH "OPTIONS" @@ -82,16 +82,16 @@ Set XIP (execute in place) flag. .B Create FIT image: .TP -.BI "\-D "dtc option" +.BI "\-D [" "dtc options" "]" Provide special options to the device tree compiler that is used to create the image. .TP -.BI "\-f "fit-image.its" -Image tree source fine that descbres the structure and contents of the +.BI "\-f [" "image tree source file" "]" +Image tree source file that describes the structure and contents of the FIT image. -.SH EXMAPLES +.SH EXAMPLES List image information: .nf diff --git a/drivers/mmc/pxa_mmc.c b/drivers/mmc/pxa_mmc.c index 2b58a98..80c4445 100644 --- a/drivers/mmc/pxa_mmc.c +++ b/drivers/mmc/pxa_mmc.c @@ -560,11 +560,6 @@ mmc_legacy_init(int verbose) /* Reset device interface type */ mmc_dev.if_type = IF_TYPE_UNKNOWN; -#if defined(CONFIG_LUBBOCK) || \ - (defined(CONFIG_GUMSTIX) && !defined(CONFIG_CPU_PXA27X)) - set_GPIO_mode(GPIO6_MMCCLK_MD); - set_GPIO_mode(GPIO8_MMCCS0_MD); -#endif #ifdef CONFIG_CPU_MONAHANS /* pxa3xx */ writel(readl(CKENA) | CKENA_12_MMC0 | CKENA_13_MMC1, CKENA); #else /* pxa2xx */ diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 6b71bd9..e726f39 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -1146,7 +1146,7 @@ e1000_read_mac_addr(struct eth_device *nic) nic->enetaddr[5] ^= 1; #ifdef CONFIG_E1000_FALLBACK_MAC - if ( *(u32*)(nic->enetaddr) == 0 || *(u32*)(nic->enetaddr) == ~0 ) { + if (!is_valid_ether_addr(nic->enetaddr)) { unsigned char fb_mac[NODE_ADDRESS_SIZE] = CONFIG_E1000_FALLBACK_MAC; memcpy (nic->enetaddr, fb_mac, NODE_ADDRESS_SIZE); diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c index 5491780..5f774f4 100644 --- a/drivers/net/e1000_spi.c +++ b/drivers/net/e1000_spi.c @@ -1,4 +1,5 @@ #include "e1000.h" +#include <linux/compiler.h> /*----------------------------------------------------------------------- * SPI transfer @@ -112,7 +113,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, void spi_free_slave(struct spi_slave *spi) { - struct e1000_hw *hw = e1000_hw_from_spi(spi); + __maybe_unused struct e1000_hw *hw = e1000_hw_from_spi(spi); E1000_DBG(hw->nic, "EEPROM SPI access released\n"); } @@ -469,7 +470,7 @@ static int do_e1000_spi_program(cmd_tbl_t *cmdtp, struct e1000_hw *hw, static int do_e1000_spi_checksum(cmd_tbl_t *cmdtp, struct e1000_hw *hw, int argc, char * const argv[]) { - uint16_t i, length, checksum, checksum_reg; + uint16_t i, length, checksum = 0, checksum_reg; uint16_t *buffer; boolean_t upd; diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h index dd6a422..0692f8b 100644 --- a/drivers/net/sh_eth.h +++ b/drivers/net/sh_eth.h @@ -435,4 +435,3 @@ enum RPADIR_BIT { enum FIFO_SIZE_BIT { FIFO_SIZE_T = 0x00000700, FIFO_SIZE_R = 0x00000007, }; - diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 0d3a988..4c00081 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -195,12 +195,12 @@ static int udc_read_urb_ep0(void) for (i = 0; i < w; i++) { data32[ep0_urb->actual_length / 4 + i] = readl(UDCDN(0)); -// ep0_urb->actual_length += 4; + /* ep0_urb->actual_length += 4; */ } for (i = 0; i < b; i++) { data8[ep0_urb->actual_length + w * 4 + i] = readb(UDCDN(0)); -// ep0_urb->actual_length++; + /* ep0_urb->actual_length++; */ } ep0_urb->actual_length += n; @@ -599,7 +599,6 @@ void udc_setup_ep(struct usb_device_instance *device, unsigned int id, writel(tmp, UDCCN(ep_num)); - //usbdbg usbdbg("UDCCR%c = %x", 'A' + ep_num-1, readl(UDCCN(ep_num))); usbdbg("UDCCSR%c = %x", 'A' + ep_num-1, readl(UDCCSN(ep_num))); } diff --git a/drivers/usb/gadget/s3c_udc_otg.c b/drivers/usb/gadget/s3c_udc_otg.c index 901fac9..1050a98 100644 --- a/drivers/usb/gadget/s3c_udc_otg.c +++ b/drivers/usb/gadget/s3c_udc_otg.c @@ -47,7 +47,6 @@ #include <asm/arch/gpio.h> #include "regs-otg.h" -#include <usb/s3c_udc.h> #include <usb/lin_gadget_compat.h> /***********************************************************/ @@ -73,8 +72,6 @@ #define EP0_CON 0 #define EP_MASK 0xF -#if defined(DEBUG_S3C_UDC_SETUP) || defined(DEBUG_S3C_UDC_ISR) \ - || defined(DEBUG_S3C_UDC_OUT_EP) static char *state_names[] = { "WAIT_FOR_SETUP", "DATA_STATE_XMIT", @@ -86,7 +83,6 @@ static char *state_names[] = { "WAIT_FOR_IN_COMPLETE", "WAIT_FOR_NULL_COMPLETE", }; -#endif #define DRIVER_DESC "S3C HS USB OTG Device Driver, (c) Samsung Electronics" #define DRIVER_VERSION "15 March 2009" @@ -362,7 +358,7 @@ static void done(struct s3c_ep *ep, struct s3c_request *req, int status) { unsigned int stopped = ep->stopped; - DEBUG("%s: %s %p, req = %p, stopped = %d\n", + debug("%s: %s %p, req = %p, stopped = %d\n", __func__, ep->ep.name, ep, &req->req, stopped); list_del_init(&req->queue); @@ -373,7 +369,7 @@ static void done(struct s3c_ep *ep, struct s3c_request *req, int status) status = req->req.status; if (status && status != -ESHUTDOWN) { - DEBUG("complete %s req %p stat %d len %u/%u\n", + debug("complete %s req %p stat %d len %u/%u\n", ep->ep.name, &req->req, status, req->req.actual, req->req.length); } @@ -401,7 +397,7 @@ static void done(struct s3c_ep *ep, struct s3c_request *req, int status) req->req.complete(&ep->ep, &req->req); spin_lock(&ep->dev->lock); - DEBUG("callback completed\n"); + debug("callback completed\n"); ep->stopped = stopped; } @@ -413,7 +409,7 @@ static void nuke(struct s3c_ep *ep, int status) { struct s3c_request *req; - DEBUG("%s: %s %p\n", __func__, ep->ep.name, ep); + debug("%s: %s %p\n", __func__, ep->ep.name, ep); /* called with irqs blocked */ while (!list_empty(&ep->queue)) { @@ -456,7 +452,7 @@ static void reconfig_usbd(void) int i; unsigned int uTemp = writel(CORE_SOFT_RESET, ®->grstctl); - DEBUG(2, "Reseting OTG controller\n"); + debug("Reseting OTG controller\n"); writel(0<<15 /* PHY Low Power Clock sel*/ |1<<14 /* Non-Periodic TxFIFO Rewind Enable*/ @@ -526,13 +522,13 @@ static void reconfig_usbd(void) /* Flush the RX FIFO */ writel(RX_FIFO_FLUSH, ®->grstctl); while (readl(®->grstctl) & RX_FIFO_FLUSH) - DEBUG("%s: waiting for S3C_UDC_OTG_GRSTCTL\n", __func__); + debug("%s: waiting for S3C_UDC_OTG_GRSTCTL\n", __func__); /* Flush all the Tx FIFO's */ writel(TX_FIFO_FLUSH_ALL, ®->grstctl); writel(TX_FIFO_FLUSH_ALL | TX_FIFO_FLUSH, ®->grstctl); while (readl(®->grstctl) & TX_FIFO_FLUSH) - DEBUG("%s: waiting for S3C_UDC_OTG_GRSTCTL\n", __func__); + debug("%s: waiting for S3C_UDC_OTG_GRSTCTL\n", __func__); /* 13. Clear NAK bit of EP0, EP1, EP2*/ /* For Slave mode*/ @@ -581,7 +577,7 @@ static int s3c_ep_enable(struct usb_ep *_ep, struct s3c_udc *dev; unsigned long flags; - DEBUG("%s: %p\n", __func__, _ep); + debug("%s: %p\n", __func__, _ep); ep = container_of(_ep, struct s3c_ep, ep); if (!_ep || !desc || ep->desc || _ep->name == ep0name @@ -590,7 +586,7 @@ static int s3c_ep_enable(struct usb_ep *_ep, || ep_maxpacket(ep) < le16_to_cpu(get_unaligned(&desc->wMaxPacketSize))) { - DEBUG("%s: bad ep or descriptor\n", __func__); + debug("%s: bad ep or descriptor\n", __func__); return -EINVAL; } @@ -599,7 +595,7 @@ static int s3c_ep_enable(struct usb_ep *_ep, && ep->bmAttributes != USB_ENDPOINT_XFER_BULK && desc->bmAttributes != USB_ENDPOINT_XFER_INT) { - DEBUG("%s: %s type mismatch\n", __func__, _ep->name); + debug("%s: %s type mismatch\n", __func__, _ep->name); return -EINVAL; } @@ -608,14 +604,14 @@ static int s3c_ep_enable(struct usb_ep *_ep, && le16_to_cpu(get_unaligned(&desc->wMaxPacketSize)) != ep_maxpacket(ep)) || !get_unaligned(&desc->wMaxPacketSize)) { - DEBUG("%s: bad %s maxpacket\n", __func__, _ep->name); + debug("%s: bad %s maxpacket\n", __func__, _ep->name); return -ERANGE; } dev = ep->dev; if (!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN) { - DEBUG("%s: bogus device state\n", __func__); + debug("%s: bogus device state\n", __func__); return -ESHUTDOWN; } @@ -632,7 +628,7 @@ static int s3c_ep_enable(struct usb_ep *_ep, s3c_udc_ep_activate(ep); spin_unlock_irqrestore(&ep->dev->lock, flags); - DEBUG("%s: enabled %s, stopped = %d, maxpacket = %d\n", + debug("%s: enabled %s, stopped = %d, maxpacket = %d\n", __func__, _ep->name, ep->stopped, ep->ep.maxpacket); return 0; } @@ -645,11 +641,11 @@ static int s3c_ep_disable(struct usb_ep *_ep) struct s3c_ep *ep; unsigned long flags; - DEBUG("%s: %p\n", __func__, _ep); + debug("%s: %p\n", __func__, _ep); ep = container_of(_ep, struct s3c_ep, ep); if (!_ep || !ep->desc) { - DEBUG("%s: %s not enabled\n", __func__, + debug("%s: %s not enabled\n", __func__, _ep ? ep->ep.name : NULL); return -EINVAL; } @@ -664,7 +660,7 @@ static int s3c_ep_disable(struct usb_ep *_ep) spin_unlock_irqrestore(&ep->dev->lock, flags); - DEBUG("%s: disabled %s\n", __func__, _ep->name); + debug("%s: disabled %s\n", __func__, _ep->name); return 0; } @@ -673,7 +669,7 @@ static struct usb_request *s3c_alloc_request(struct usb_ep *ep, { struct s3c_request *req; - DEBUG("%s: %s %p\n", __func__, ep->name, ep); + debug("%s: %s %p\n", __func__, ep->name, ep); req = kmalloc(sizeof *req, gfp_flags); if (!req) @@ -689,7 +685,7 @@ static void s3c_free_request(struct usb_ep *ep, struct usb_request *_req) { struct s3c_request *req; - DEBUG("%s: %p\n", __func__, ep); + debug("%s: %p\n", __func__, ep); req = container_of(_req, struct s3c_request, req); WARN_ON(!list_empty(&req->queue)); @@ -703,7 +699,7 @@ static int s3c_dequeue(struct usb_ep *_ep, struct usb_request *_req) struct s3c_request *req; unsigned long flags; - DEBUG("%s: %p\n", __func__, _ep); + debug("%s: %p\n", __func__, _ep); ep = container_of(_ep, struct s3c_ep, ep); if (!_ep || ep->ep.name == ep0name) @@ -737,11 +733,11 @@ static int s3c_fifo_status(struct usb_ep *_ep) ep = container_of(_ep, struct s3c_ep, ep); if (!_ep) { - DEBUG("%s: bad ep\n", __func__); + debug("%s: bad ep\n", __func__); return -ENODEV; } - DEBUG("%s: %d\n", __func__, ep_index(ep)); + debug("%s: %d\n", __func__, ep_index(ep)); /* LPD can't report unclaimed bytes from IN fifos */ if (ep_is_in(ep)) @@ -759,11 +755,11 @@ static void s3c_fifo_flush(struct usb_ep *_ep) ep = container_of(_ep, struct s3c_ep, ep); if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DEBUG("%s: bad ep\n", __func__); + debug("%s: bad ep\n", __func__); return; } - DEBUG("%s: %d\n", __func__, ep_index(ep)); + debug("%s: %d\n", __func__, ep_index(ep)); } static const struct usb_gadget_ops s3c_udc_ops = { @@ -849,7 +845,7 @@ int s3c_udc_probe(struct s3c_plat_otg_data *pdata) struct s3c_udc *dev = &memory; int retval = 0, i; - DEBUG("%s: %p\n", __func__, pdata); + debug("%s: %p\n", __func__, pdata); dev->pdata = pdata; diff --git a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c index 2553857..b11108d 100644 --- a/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c +++ b/drivers/usb/gadget/s3c_udc_otg_xfer_dma.c @@ -62,7 +62,7 @@ void s3c_udc_pre_setup(void) { u32 ep_ctrl; - DEBUG_IN_EP("%s : Prepare Setup packets.\n", __func__); + debug_cond(DEBUG_IN_EP, "%s : Prepare Setup packets.\n", __func__); invalidate_dcache_range((unsigned long) usb_ctrl_dma_addr, (unsigned long) usb_ctrl_dma_addr @@ -91,7 +91,8 @@ static inline void s3c_ep0_complete_out(void) DEBUG_EP0("%s:EP0 ZLP DOEPCTL0 = 0x%x\n", __func__, readl(®->out_endp[EP0_CON].doepctl)); - DEBUG_IN_EP("%s : Prepare Complete Out packet.\n", __func__); + debug_cond(DEBUG_IN_EP, + "%s : Prepare Complete Out packet.\n", __func__); invalidate_dcache_range((unsigned long) usb_ctrl_dma_addr, (unsigned long) usb_ctrl_dma_addr @@ -203,14 +204,15 @@ int setdma_tx(struct s3c_ep *ep, struct s3c_request *req) writel(DEPCTL_EPENA|DEPCTL_CNAK|ctrl, ®->in_endp[ep_num].diepctl); - DEBUG_IN_EP("%s:EP%d TX DMA start : DIEPDMA0 = 0x%x," - "DIEPTSIZ0 = 0x%x, DIEPCTL0 = 0x%x\n" - "\tbuf = 0x%p, pktcnt = %d, xfersize = %d\n", - __func__, ep_num, - readl(®->in_endp[ep_num].diepdma), - readl(®->in_endp[ep_num].dieptsiz), - readl(®->in_endp[ep_num].diepctl), - buf, pktcnt, length); + debug_cond(DEBUG_IN_EP, + "%s:EP%d TX DMA start : DIEPDMA0 = 0x%x," + "DIEPTSIZ0 = 0x%x, DIEPCTL0 = 0x%x\n" + "\tbuf = 0x%p, pktcnt = %d, xfersize = %d\n", + __func__, ep_num, + readl(®->in_endp[ep_num].diepdma), + readl(®->in_endp[ep_num].dieptsiz), + readl(®->in_endp[ep_num].diepctl), + buf, pktcnt, length); return length; } @@ -287,8 +289,9 @@ static void complete_tx(struct s3c_udc *dev, u8 ep_num) } if (list_empty(&ep->queue)) { - DEBUG_IN_EP("%s: TX DMA done : NULL REQ on IN EP-%d\n", - __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: TX DMA done : NULL REQ on IN EP-%d\n", + __func__, ep_num); return; } @@ -301,33 +304,38 @@ static void complete_tx(struct s3c_udc *dev, u8 ep_num) is_short = (xfer_size < ep->ep.maxpacket); req->req.actual += min(xfer_size, req->req.length - req->req.actual); - DEBUG_IN_EP("%s: TX DMA done : ep = %d, tx bytes = %d/%d, " - "is_short = %d, DIEPTSIZ = 0x%x, remained bytes = %d\n", - __func__, ep_num, req->req.actual, req->req.length, - is_short, ep_tsr, xfer_size); + debug_cond(DEBUG_IN_EP, + "%s: TX DMA done : ep = %d, tx bytes = %d/%d, " + "is_short = %d, DIEPTSIZ = 0x%x, remained bytes = %d\n", + __func__, ep_num, req->req.actual, req->req.length, + is_short, ep_tsr, xfer_size); if (ep_num == 0) { if (dev->ep0state == DATA_STATE_XMIT) { - DEBUG_IN_EP("%s: ep_num = %d, ep0stat ==" - "DATA_STATE_XMIT\n", - __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: ep_num = %d, ep0stat ==" + "DATA_STATE_XMIT\n", + __func__, ep_num); last = write_fifo_ep0(ep, req); if (last) dev->ep0state = WAIT_FOR_COMPLETE; } else if (dev->ep0state == WAIT_FOR_IN_COMPLETE) { - DEBUG_IN_EP("%s: ep_num = %d, completing request\n", - __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: ep_num = %d, completing request\n", + __func__, ep_num); done(ep, req, 0); dev->ep0state = WAIT_FOR_SETUP; } else if (dev->ep0state == WAIT_FOR_COMPLETE) { - DEBUG_IN_EP("%s: ep_num = %d, completing request\n", - __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: ep_num = %d, completing request\n", + __func__, ep_num); done(ep, req, 0); dev->ep0state = WAIT_FOR_OUT_COMPLETE; s3c_ep0_complete_out(); } else { - DEBUG_IN_EP("%s: ep_num = %d, invalid ep state\n", - __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: ep_num = %d, invalid ep state\n", + __func__, ep_num); } return; } @@ -337,7 +345,8 @@ static void complete_tx(struct s3c_udc *dev, u8 ep_num) if (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct s3c_request, queue); - DEBUG_IN_EP("%s: Next Tx request start...\n", __func__); + debug_cond(DEBUG_IN_EP, + "%s: Next Tx request start...\n", __func__); setdma_tx(ep, req); } } @@ -347,19 +356,22 @@ static inline void s3c_udc_check_tx_queue(struct s3c_udc *dev, u8 ep_num) struct s3c_ep *ep = &dev->ep[ep_num]; struct s3c_request *req; - DEBUG_IN_EP("%s: Check queue, ep_num = %d\n", __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: Check queue, ep_num = %d\n", __func__, ep_num); if (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct s3c_request, queue); - DEBUG_IN_EP("%s: Next Tx request(0x%p) start...\n", - __func__, req); + debug_cond(DEBUG_IN_EP, + "%s: Next Tx request(0x%p) start...\n", + __func__, req); if (ep_is_in(ep)) setdma_tx(ep, req); else setdma_rx(ep, req); } else { - DEBUG_IN_EP("%s: NULL REQ on IN EP-%d\n", __func__, ep_num); + debug_cond(DEBUG_IN_EP, + "%s: NULL REQ on IN EP-%d\n", __func__, ep_num); return; } @@ -372,15 +384,15 @@ static void process_ep_in_intr(struct s3c_udc *dev) u8 ep_num = 0; ep_intr = readl(®->daint); - DEBUG_IN_EP("*** %s: EP In interrupt : DAINT = 0x%x\n", - __func__, ep_intr); + debug_cond(DEBUG_IN_EP, + "*** %s: EP In interrupt : DAINT = 0x%x\n", __func__, ep_intr); ep_intr &= DAINT_MASK; while (ep_intr) { if (ep_intr & DAINT_IN_EP_INT(1)) { ep_intr_status = readl(®->in_endp[ep_num].diepint); - DEBUG_IN_EP("\tEP%d-IN : DIEPINT = 0x%x\n", + debug_cond(DEBUG_IN_EP, "\tEP%d-IN : DIEPINT = 0x%x\n", ep_num, ep_intr_status); /* Interrupt Clear */ @@ -473,7 +485,8 @@ static int s3c_udc_irq(int irq, void *_dev) intr_status = readl(®->gintsts); gintmsk = readl(®->gintmsk); - DEBUG_ISR("\n*** %s : GINTSTS=0x%x(on state %s), GINTMSK : 0x%x," + debug_cond(DEBUG_ISR, + "\n*** %s : GINTSTS=0x%x(on state %s), GINTMSK : 0x%x," "DAINT : 0x%x, DAINTMSK : 0x%x\n", __func__, intr_status, state_names[dev->ep0state], gintmsk, readl(®->daint), readl(®->daintmsk)); @@ -484,30 +497,32 @@ static int s3c_udc_irq(int irq, void *_dev) } if (intr_status & INT_ENUMDONE) { - DEBUG_ISR("\tSpeed Detection interrupt\n"); + debug_cond(DEBUG_ISR, "\tSpeed Detection interrupt\n"); writel(INT_ENUMDONE, ®->gintsts); usb_status = (readl(®->dsts) & 0x6); if (usb_status & (USB_FULL_30_60MHZ | USB_FULL_48MHZ)) { - DEBUG_ISR("\t\tFull Speed Detection\n"); + debug_cond(DEBUG_ISR, "\t\tFull Speed Detection\n"); set_max_pktsize(dev, USB_SPEED_FULL); } else { - DEBUG_ISR("\t\tHigh Speed Detection : 0x%x\n", - usb_status); + debug_cond(DEBUG_ISR, + "\t\tHigh Speed Detection : 0x%x\n", + usb_status); set_max_pktsize(dev, USB_SPEED_HIGH); } } if (intr_status & INT_EARLY_SUSPEND) { - DEBUG_ISR("\tEarly suspend interrupt\n"); + debug_cond(DEBUG_ISR, "\tEarly suspend interrupt\n"); writel(INT_EARLY_SUSPEND, ®->gintsts); } if (intr_status & INT_SUSPEND) { usb_status = readl(®->dsts); - DEBUG_ISR("\tSuspend interrupt :(DSTS):0x%x\n", usb_status); + debug_cond(DEBUG_ISR, + "\tSuspend interrupt :(DSTS):0x%x\n", usb_status); writel(INT_SUSPEND, ®->gintsts); if (dev->gadget.speed != USB_SPEED_UNKNOWN @@ -525,7 +540,7 @@ static int s3c_udc_irq(int irq, void *_dev) } if (intr_status & INT_RESUME) { - DEBUG_ISR("\tResume interrupt\n"); + debug_cond(DEBUG_ISR, "\tResume interrupt\n"); writel(INT_RESUME, ®->gintsts); if (dev->gadget.speed != USB_SPEED_UNKNOWN @@ -538,13 +553,15 @@ static int s3c_udc_irq(int irq, void *_dev) if (intr_status & INT_RESET) { usb_status = readl(®->gotgctl); - DEBUG_ISR("\tReset interrupt - (GOTGCTL):0x%x\n", usb_status); + debug_cond(DEBUG_ISR, + "\tReset interrupt - (GOTGCTL):0x%x\n", usb_status); writel(INT_RESET, ®->gintsts); if ((usb_status & 0xc0000) == (0x3 << 18)) { if (reset_available) { - DEBUG_ISR("\t\tOTG core got reset (%d)!!\n", - reset_available); + debug_cond(DEBUG_ISR, + "\t\tOTG core got reset (%d)!!\n", + reset_available); reconfig_usbd(); dev->ep0state = WAIT_FOR_SETUP; reset_available = 0; @@ -554,7 +571,7 @@ static int s3c_udc_irq(int irq, void *_dev) } else { reset_available = 1; - DEBUG_ISR("\t\tRESET handling skipped\n"); + debug_cond(DEBUG_ISR, "\t\tRESET handling skipped\n"); } } @@ -585,7 +602,7 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req, if (unlikely(!_req || !_req->complete || !_req->buf || !list_empty(&req->queue))) { - DEBUG("%s: bad params\n", __func__); + debug("%s: bad params\n", __func__); return -EINVAL; } @@ -593,7 +610,7 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req, if (unlikely(!_ep || (!ep->desc && ep->ep.name != ep0name))) { - DEBUG("%s: bad ep: %s, %d, %x\n", __func__, + debug("%s: bad ep: %s, %d, %p\n", __func__, ep->ep.name, !ep->desc, _ep); return -EINVAL; } @@ -602,7 +619,7 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req, dev = ep->dev; if (unlikely(!dev->driver || dev->gadget.speed == USB_SPEED_UNKNOWN)) { - DEBUG("%s: bogus device state %p\n", __func__, dev->driver); + debug("%s: bogus device state %p\n", __func__, dev->driver); return -ESHUTDOWN; } @@ -612,7 +629,7 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req, _req->actual = 0; /* kickstart this i/o queue? */ - DEBUG("\n*** %s: %s-%s req = %p, len = %d, buf = %p" + debug("\n*** %s: %s-%s req = %p, len = %d, buf = %p" "Q empty = %d, stopped = %d\n", __func__, _ep->name, ep_is_in(ep) ? "in" : "out", _req, _req->length, _req->buf, @@ -644,8 +661,9 @@ static int s3c_queue(struct usb_ep *_ep, struct usb_request *_req, } else if (ep_is_in(ep)) { gintsts = readl(®->gintsts); - DEBUG_IN_EP("%s: ep_is_in, S3C_UDC_OTG_GINTSTS=0x%x\n", - __func__, gintsts); + debug_cond(DEBUG_IN_EP, + "%s: ep_is_in, S3C_UDC_OTG_GINTSTS=0x%x\n", + __func__, gintsts); setdma_tx(ep, req); } else { @@ -775,13 +793,12 @@ static void s3c_ep0_read(struct s3c_udc *dev) { struct s3c_request *req; struct s3c_ep *ep = &dev->ep[0]; - int ret; if (!list_empty(&ep->queue)) { req = list_entry(ep->queue.next, struct s3c_request, queue); } else { - DEBUG("%s: ---> BUG\n", __func__); + debug("%s: ---> BUG\n", __func__); BUG(); return; } @@ -801,7 +818,7 @@ static void s3c_ep0_read(struct s3c_udc *dev) return; } - ret = setdma_rx(ep, req); + setdma_rx(ep, req); } /* @@ -910,19 +927,19 @@ static void s3c_udc_set_nak(struct s3c_ep *ep) u32 ep_ctrl = 0; ep_num = ep_index(ep); - DEBUG("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); + debug("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); if (ep_is_in(ep)) { ep_ctrl = readl(®->in_endp[ep_num].diepctl); ep_ctrl |= DEPCTL_SNAK; writel(ep_ctrl, ®->in_endp[ep_num].diepctl); - DEBUG("%s: set NAK, DIEPCTL%d = 0x%x\n", + debug("%s: set NAK, DIEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->in_endp[ep_num].diepctl)); } else { ep_ctrl = readl(®->out_endp[ep_num].doepctl); ep_ctrl |= DEPCTL_SNAK; writel(ep_ctrl, ®->out_endp[ep_num].doepctl); - DEBUG("%s: set NAK, DOEPCTL%d = 0x%x\n", + debug("%s: set NAK, DOEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->out_endp[ep_num].doepctl)); } @@ -936,7 +953,7 @@ void s3c_udc_ep_set_stall(struct s3c_ep *ep) u32 ep_ctrl = 0; ep_num = ep_index(ep); - DEBUG("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); + debug("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); if (ep_is_in(ep)) { ep_ctrl = readl(®->in_endp[ep_num].diepctl); @@ -948,7 +965,7 @@ void s3c_udc_ep_set_stall(struct s3c_ep *ep) ep_ctrl |= DEPCTL_STALL; writel(ep_ctrl, ®->in_endp[ep_num].diepctl); - DEBUG("%s: set stall, DIEPCTL%d = 0x%x\n", + debug("%s: set stall, DIEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->in_endp[ep_num].diepctl)); } else { @@ -958,7 +975,7 @@ void s3c_udc_ep_set_stall(struct s3c_ep *ep) ep_ctrl |= DEPCTL_STALL; writel(ep_ctrl, ®->out_endp[ep_num].doepctl); - DEBUG("%s: set stall, DOEPCTL%d = 0x%x\n", + debug("%s: set stall, DOEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->out_endp[ep_num].doepctl)); } @@ -971,7 +988,7 @@ void s3c_udc_ep_clear_stall(struct s3c_ep *ep) u32 ep_ctrl = 0; ep_num = ep_index(ep); - DEBUG("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); + debug("%s: ep_num = %d, ep_type = %d\n", __func__, ep_num, ep->ep_type); if (ep_is_in(ep)) { ep_ctrl = readl(®->in_endp[ep_num].diepctl); @@ -991,7 +1008,7 @@ void s3c_udc_ep_clear_stall(struct s3c_ep *ep) } writel(ep_ctrl, ®->in_endp[ep_num].diepctl); - DEBUG("%s: cleared stall, DIEPCTL%d = 0x%x\n", + debug("%s: cleared stall, DIEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->in_endp[ep_num].diepctl)); } else { @@ -1006,7 +1023,7 @@ void s3c_udc_ep_clear_stall(struct s3c_ep *ep) } writel(ep_ctrl, ®->out_endp[ep_num].doepctl); - DEBUG("%s: cleared stall, DOEPCTL%d = 0x%x\n", + debug("%s: cleared stall, DOEPCTL%d = 0x%x\n", __func__, ep_num, readl(®->out_endp[ep_num].doepctl)); } @@ -1025,14 +1042,14 @@ static int s3c_udc_set_halt(struct usb_ep *_ep, int value) if (unlikely(!_ep || !ep->desc || ep_num == EP0_CON || ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC)) { - DEBUG("%s: %s bad ep or descriptor\n", __func__, ep->ep.name); + debug("%s: %s bad ep or descriptor\n", __func__, ep->ep.name); return -EINVAL; } /* Attempt to halt IN ep will fail if any transfer requests * are still queue */ if (value && ep_is_in(ep) && !list_empty(&ep->queue)) { - DEBUG("%s: %s queue not empty, req = %p\n", + debug("%s: %s queue not empty, req = %p\n", __func__, ep->ep.name, list_entry(ep->queue.next, struct s3c_request, queue)); @@ -1040,7 +1057,7 @@ static int s3c_udc_set_halt(struct usb_ep *_ep, int value) } dev = ep->dev; - DEBUG("%s: ep_num = %d, value = %d\n", __func__, ep_num, value); + debug("%s: ep_num = %d, value = %d\n", __func__, ep_num, value); spin_lock_irqsave(&dev->lock, flags); @@ -1076,7 +1093,7 @@ void s3c_udc_ep_activate(struct s3c_ep *ep) daintmsk = (1 << ep_num) << DAINT_OUT_BIT; } - DEBUG("%s: EPCTRL%d = 0x%x, ep_is_in = %d\n", + debug("%s: EPCTRL%d = 0x%x, ep_is_in = %d\n", __func__, ep_num, ep_ctrl, ep_is_in(ep)); /* If the EP is already active don't change the EP Control @@ -1090,12 +1107,12 @@ void s3c_udc_ep_activate(struct s3c_ep *ep) if (ep_is_in(ep)) { writel(ep_ctrl, ®->in_endp[ep_num].diepctl); - DEBUG("%s: USB Ative EP%d, DIEPCTRL%d = 0x%x\n", + debug("%s: USB Ative EP%d, DIEPCTRL%d = 0x%x\n", __func__, ep_num, ep_num, readl(®->in_endp[ep_num].diepctl)); } else { writel(ep_ctrl, ®->out_endp[ep_num].doepctl); - DEBUG("%s: USB Ative EP%d, DOEPCTRL%d = 0x%x\n", + debug("%s: USB Ative EP%d, DOEPCTRL%d = 0x%x\n", __func__, ep_num, ep_num, readl(®->out_endp[ep_num].doepctl)); } @@ -1103,7 +1120,7 @@ void s3c_udc_ep_activate(struct s3c_ep *ep) /* Unmask EP Interrtupt */ writel(readl(®->daintmsk)|daintmsk, ®->daintmsk); - DEBUG("%s: DAINTMSK = 0x%x\n", __func__, readl(®->daintmsk)); + debug("%s: DAINTMSK = 0x%x\n", __func__, readl(®->daintmsk)); } @@ -1236,14 +1253,14 @@ static int s3c_udc_set_feature(struct usb_ep *_ep) void s3c_ep0_setup(struct s3c_udc *dev) { struct s3c_ep *ep = &dev->ep[0]; - int i, bytes, is_in; + int i; u8 ep_num; /* Nuke all previous transfers */ nuke(ep, -EPROTO); /* read control req from fifo (8 bytes) */ - bytes = s3c_fifo_read(ep, (u32 *)usb_ctrl, 8); + s3c_fifo_read(ep, (u32 *)usb_ctrl, 8); DEBUG_SETUP("%s: bRequestType = 0x%x(%s), bRequest = 0x%x" "\twLength = 0x%x, wValue = 0x%x, wIndex= 0x%x\n", @@ -1255,7 +1272,7 @@ void s3c_ep0_setup(struct s3c_udc *dev) #ifdef DEBUG_S3C_UDC { int i, len = sizeof(*usb_ctrl); - char *p = usb_ctrl; + char *p = (char *)usb_ctrl; printf("pkt = "); for (i = 0; i < len; i++) { @@ -1293,11 +1310,8 @@ void s3c_ep0_setup(struct s3c_udc *dev) /* Set direction of EP0 */ if (likely(usb_ctrl->bRequestType & USB_DIR_IN)) { ep->bEndpointAddress |= USB_DIR_IN; - is_in = 1; - } else { ep->bEndpointAddress &= ~USB_DIR_IN; - is_in = 0; } /* cope with automagic for some standard requests. */ dev->req_std = (usb_ctrl->bRequestType & USB_TYPE_MASK) diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c index 68a673e..58cdcbe 100644 --- a/drivers/usb/host/ehci-mx5.c +++ b/drivers/usb/host/ehci-mx5.c @@ -251,5 +251,3 @@ int ehci_hcd_stop(void) { return 0; } - - diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 4f1772f..3542b0b 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -323,7 +323,7 @@ static void fill_dir_slot(fsdata *mydata, dir_entry **dentptr, const char *l_name) { dir_slot *slotptr = (dir_slot *)get_vfatname_block; - __u8 counter, checksum; + __u8 counter = 0, checksum; int idx = 0, ret; char s_name[16]; @@ -926,6 +926,7 @@ static int do_fat_write(const char *filename, void *buffer, int cursect; int root_cluster, ret = -1, name_len; char l_filename[VFAT_MAXLEN_BYTES]; + int write_size = size; dir_curclust = 0; @@ -985,7 +986,11 @@ static int do_fat_write(const char *filename, void *buffer, dentptr = (dir_entry *) do_fat_read_block; name_len = strlen(filename); + if (name_len >= VFAT_MAXLEN_BYTES) + name_len = VFAT_MAXLEN_BYTES - 1; + memcpy(l_filename, filename, name_len); + l_filename[name_len] = 0; /* terminate the string */ downcase(l_filename); startsect = mydata->rootdir_sect; @@ -1012,10 +1017,12 @@ static int do_fat_write(const char *filename, void *buffer, } ret = set_contents(mydata, retdent, buffer, size); - if (ret) { + if (ret < 0) { printf("Error: writing contents\n"); goto exit; } + write_size = ret; + debug("attempt to write 0x%x bytes\n", write_size); /* Flush fat buffer */ ret = flush_fat_buffer(mydata); @@ -1029,7 +1036,7 @@ static int do_fat_write(const char *filename, void *buffer, get_dentfromdir_block, mydata->clust_size * mydata->sect_size); if (ret) { - printf("Error: wrinting directory entry\n"); + printf("Error: writing directory entry\n"); goto exit; } } else { @@ -1056,10 +1063,12 @@ static int do_fat_write(const char *filename, void *buffer, start_cluster, size, 0x20); ret = set_contents(mydata, empty_dentptr, buffer, size); - if (ret) { + if (ret < 0) { printf("Error: writing contents\n"); goto exit; } + write_size = ret; + debug("attempt to write 0x%x bytes\n", write_size); /* Flush fat buffer */ ret = flush_fat_buffer(mydata); @@ -1080,7 +1089,7 @@ static int do_fat_write(const char *filename, void *buffer, exit: free(mydata->fatbuf); - return ret; + return ret < 0 ? ret : write_size; } int file_fat_write(const char *filename, void *buffer, unsigned long maxsize) diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h index db88b68..cf20d2b 100644 --- a/include/configs/P2020COME.h +++ b/include/configs/P2020COME.h @@ -103,12 +103,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_MEMTEST_END 0x1fffffff #define CONFIG_PANIC_HANG /* do not reset board on panic */ - - - - - - /* * Config the L2 Cache as L2 SRAM */ @@ -316,7 +310,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); #define _IO_BASE 0x00000000 #endif - #define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ #define CONFIG_DOS_PARTITION @@ -563,6 +556,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy); "tftp $fdtaddr $tftppath/$fdtfile;" \ "bootm $loadaddr - $fdtaddr" + #define CONFIG_RAMBOOTCOMMAND \ "setenv bootargs root=/dev/ram rw " \ "console=$consoledev,$baudrate $othbootargs;" \ diff --git a/include/configs/sbc35_a9g20.h b/include/configs/sbc35_a9g20.h index 1e355a8..cdf8659 100644 --- a/include/configs/sbc35_a9g20.h +++ b/include/configs/sbc35_a9g20.h @@ -36,6 +36,9 @@ #define CONFIG_ENV_IS_IN_EEPROM #endif +#define MACH_TYPE_SBC35_A9G20 1848 +#define CONFIG_MACH_TYPE MACH_TYPE_SBC35_A9G20 + /* ARM asynchronous clock */ #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */ #define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* 12.000 MHz crystal */ diff --git a/include/configs/tny_a9260.h b/include/configs/tny_a9260.h index ec8ec18..0043926 100644 --- a/include/configs/tny_a9260.h +++ b/include/configs/tny_a9260.h @@ -45,8 +45,12 @@ /* Define actual evaluation board type from used processor type */ #ifdef CONFIG_AT91SAM9G20 # define CONFIG_TNY_A9G20 +# define MACH_TYPE_TNY_A9G20 2059 +# define CONFIG_MACH_TYPE MACH_TYPE_TNY_A9G20 #else # define CONFIG_TNY_A9260 +# define MACH_TYPE_TNY_A9260 2058 +# define CONFIG_MACH_TYPE MACH_TYPE_TNY_A9260 #endif /* ARM asynchronous clock */ diff --git a/include/usb/lin_gadget_compat.h b/include/usb/lin_gadget_compat.h index 9b31511..fce3be7 100644 --- a/include/usb/lin_gadget_compat.h +++ b/include/usb/lin_gadget_compat.h @@ -26,7 +26,7 @@ /* common */ #define spin_lock_init(...) #define spin_lock(...) -#define spin_lock_irqsave(lock, flags) do {flags = 1; } while (0) +#define spin_lock_irqsave(lock, flags) do { debug("%lu\n", flags); } while (0) #define spin_unlock(...) #define spin_unlock_irqrestore(lock, flags) do {flags = 0; } while (0) #define disable_irq(...) diff --git a/include/usb/s3c_udc.h b/include/usb/s3c_udc.h index 14dadc8..31d8f6c 100644 --- a/include/usb/s3c_udc.h +++ b/include/usb/s3c_udc.h @@ -131,16 +131,10 @@ extern struct s3c_udc *the_controller; #define DEBUG_EP0(fmt, args...) do {} while (0) #endif -#ifdef DEBUG_S3C_UDC -#define DEBUG(fmt, args...) printk(fmt, ##args) -#else -#define DEBUG(fmt, args...) do {} while (0) -#endif - #ifdef DEBUG_S3C_UDC_ISR -#define DEBUG_ISR(fmt, args...) printk(fmt, ##args) +#define DEBUG_ISR 1 #else -#define DEBUG_ISR(fmt, args...) do {} while (0) +#define DEBUG_ISR 0 #endif #ifdef DEBUG_S3C_UDC_OUT_EP @@ -150,9 +144,15 @@ extern struct s3c_udc *the_controller; #endif #ifdef DEBUG_S3C_UDC_IN_EP -#define DEBUG_IN_EP(fmt, args...) printk(fmt, ##args) +#define DEBUG_IN_EP 1 #else -#define DEBUG_IN_EP(fmt, args...) do {} while (0) +#define DEBUG_IN_EP 0 +#endif + +#if defined(DEBUG_S3C_UDC_SETUP) || defined(DEBUG_S3C_UDC_EP0) || \ + defined(DEBUG_S3C_UDC_ISR) || defined(DEBUG_S3C_UDC_OUT_EP) || \ + defined(DEBUG_S3C_UDC_IN_EP) || defined(DEBUG_S3C_UDC) +#define DEBUG #endif #define ERR(stuff...) printf("ERR udc: " stuff) diff --git a/post/lib_powerpc/fpu/Makefile b/post/lib_powerpc/fpu/Makefile index b97ad6f..5d0e52d 100644 --- a/post/lib_powerpc/fpu/Makefile +++ b/post/lib_powerpc/fpu/Makefile @@ -24,10 +24,23 @@ include $(TOPDIR)/config.mk LIB = libpost$(ARCH)fpu.o -COBJS-$(CONFIG_HAS_POST) += fpu.o 20001122-1.o 20010114-2.o 20010226-1.o 980619-1.o -COBJS-$(CONFIG_HAS_POST) += acc1.o compare-fp-1.o mul-subnormal-single-1.o +COBJS-$(CONFIG_HAS_POST) += 20001122-1.o +COBJS-$(CONFIG_HAS_POST) += 20010114-2.o +COBJS-$(CONFIG_HAS_POST) += 20010226-1.o +COBJS-$(CONFIG_HAS_POST) += 980619-1.o +COBJS-$(CONFIG_HAS_POST) += acc1.o +COBJS-$(CONFIG_HAS_POST) += compare-fp-1.o +COBJS-$(CONFIG_HAS_POST) += fpu.o +COBJS-$(CONFIG_HAS_POST) += mul-subnormal-single-1.o + +COBJS-$(CONFIG_HAS_POST) += darwin-ldouble.o include $(TOPDIR)/post/rules.mk CFLAGS := $(shell echo $(CFLAGS) | sed s/-msoft-float//) CFLAGS += -mhard-float -fkeep-inline-functions + +$(obj)%.o: %.c + $(CC) $(ALL_CFLAGS) -o $@.fp $< -c + $(OBJCOPY) -R .gnu.attributes $@.fp $@ + rm -f $@.fp diff --git a/post/lib_powerpc/fpu/darwin-ldouble.c b/post/lib_powerpc/fpu/darwin-ldouble.c new file mode 100644 index 0000000..41ae202 --- /dev/null +++ b/post/lib_powerpc/fpu/darwin-ldouble.c @@ -0,0 +1,141 @@ +/* + * Borrowed from GCC 4.2.2 (which still was GPL v2+) + */ +/* 128-bit long double support routines for Darwin. + Copyright (C) 1993, 2003, 2004, 2005, 2006, 2007 + Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +In addition to the permissions in the GNU General Public License, the +Free Software Foundation gives you unlimited permission to link the +compiled version of this file into combinations with other programs, +and to distribute those combinations without any restriction coming +from the use of this file. (The General Public License restrictions +do apply in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine +executable.) + +GCC 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 GCC; see the file COPYING. If not, write to the Free +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +/* + * Implementations of floating-point long double basic arithmetic + * functions called by the IBM C compiler when generating code for + * PowerPC platforms. In particular, the following functions are + * implemented: __gcc_qadd, __gcc_qsub, __gcc_qmul, and __gcc_qdiv. + * Double-double algorithms are based on the paper "Doubled-Precision + * IEEE Standard 754 Floating-Point Arithmetic" by W. Kahan, February 26, + * 1987. An alternative published reference is "Software for + * Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa, + * ACM TOMS vol 7 no 3, September 1981, pages 272-283. + */ + +/* + * Each long double is made up of two IEEE doubles. The value of the + * long double is the sum of the values of the two parts. The most + * significant part is required to be the value of the long double + * rounded to the nearest double, as specified by IEEE. For Inf + * values, the least significant part is required to be one of +0.0 or + * -0.0. No other requirements are made; so, for example, 1.0 may be + * represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a + * NaN is don't-care. + * + * This code currently assumes big-endian. + */ + +#define fabs(x) __builtin_fabs(x) +#define isless(x, y) __builtin_isless(x, y) +#define inf() __builtin_inf() +#define unlikely(x) __builtin_expect((x), 0) +#define nonfinite(a) unlikely(!isless(fabs(a), inf())) + +typedef union { + long double ldval; + double dval[2]; +} longDblUnion; + +/* Add two 'long double' values and return the result. */ +long double __gcc_qadd(double a, double aa, double c, double cc) +{ + longDblUnion x; + double z, q, zz, xh; + + z = a + c; + + if (nonfinite(z)) { + z = cc + aa + c + a; + if (nonfinite(z)) + return z; + x.dval[0] = z; /* Will always be DBL_MAX. */ + zz = aa + cc; + if (fabs(a) > fabs(c)) + x.dval[1] = a - z + c + zz; + else + x.dval[1] = c - z + a + zz; + } else { + q = a - z; + zz = q + c + (a - (q + z)) + aa + cc; + + /* Keep -0 result. */ + if (zz == 0.0) + return z; + + xh = z + zz; + if (nonfinite(xh)) + return xh; + + x.dval[0] = xh; + x.dval[1] = z - xh + zz; + } + return x.ldval; +} + +long double __gcc_qsub(double a, double b, double c, double d) +{ + return __gcc_qadd(a, b, -c, -d); +} + +long double __gcc_qmul(double a, double b, double c, double d) +{ + longDblUnion z; + double t, tau, u, v, w; + + t = a * c; /* Highest order double term. */ + + if (unlikely(t == 0) /* Preserve -0. */ + || nonfinite(t)) + return t; + + /* Sum terms of two highest orders. */ + + /* Use fused multiply-add to get low part of a * c. */ +#ifndef __NO_FPRS__ + asm("fmsub %0,%1,%2,%3" : "=f"(tau) : "f"(a), "f"(c), "f"(t)); +#else + tau = fmsub(a, c, t); +#endif + v = a * d; + w = b * c; + tau += v + w; /* Add in other second-order terms. */ + u = t + tau; + + /* Construct long double result. */ + if (nonfinite(u)) + return u; + z.dval[0] = u; + z.dval[1] = (t - u) + tau; + return z.ldval; +} diff --git a/post/lib_powerpc/multi.c b/post/lib_powerpc/multi.c index 5845616..e9814a6 100644 --- a/post/lib_powerpc/multi.c +++ b/post/lib_powerpc/multi.c @@ -27,9 +27,9 @@ * CPU test * Load/store multiple word instructions: lmw, stmw * - * 26 consecutive words are loaded from a source memory buffer - * into GPRs r6 through r31. After that, 26 consecutive words are stored - * from the GPRs r6 through r31 into a target memory buffer. The contents + * 27 consecutive words are loaded from a source memory buffer + * into GPRs r5 through r31. After that, 27 consecutive words are stored + * from the GPRs r5 through r31 into a target memory buffer. The contents * of the source and target buffers are then compared. */ @@ -38,45 +38,37 @@ #if CONFIG_POST & CONFIG_SYS_POST_CPU -extern void cpu_post_exec_02 (ulong *code, ulong op1, ulong op2); +extern void cpu_post_exec_02(ulong *code, ulong op1, ulong op2); -int cpu_post_test_multi (void) +int cpu_post_test_multi(void) { - int ret = 0; - unsigned int i; - int flag = disable_interrupts(); + int ret = 0; + unsigned int i; + ulong src[27], dst[27]; + int flag = disable_interrupts(); - if (ret == 0) - { - ulong src [26], dst [26]; - - ulong code[] = - { - ASM_LMW(5, 3, 0), - ASM_STMW(5, 4, 0), - ASM_BLR, + ulong code[] = { + ASM_LMW(5, 3, 0), /* lmw r5, 0(r3) */ + ASM_STMW(5, 4, 0), /* stmr r5, 0(r4) */ + ASM_BLR, /* blr */ }; - for (i = 0; i < ARRAY_SIZE(src); ++i) - { - src[i] = i; - dst[i] = 0; + for (i = 0; i < ARRAY_SIZE(src); ++i) { + src[i] = i; + dst[i] = 0; } - cpu_post_exec_02(code, (ulong)src, (ulong)dst); + cpu_post_exec_02(code, (ulong) src, (ulong) dst); ret = memcmp(src, dst, sizeof(dst)) == 0 ? 0 : -1; - } - if (ret != 0) - { - post_log ("Error at multi test !\n"); - } + if (ret != 0) + post_log("Error at multi test !\n"); - if (flag) - enable_interrupts(); + if (flag) + enable_interrupts(); - return ret; + return ret; } #endif diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c index 753d9e6..c5ed373 100644 --- a/tools/mkenvimage.c +++ b/tools/mkenvimage.c @@ -25,6 +25,9 @@ * MA 02111-1307 USA */ +/* We want the GNU version of basename() */ +#define _GNU_SOURCE + #include <errno.h> #include <fcntl.h> #include <stdio.h> @@ -81,6 +84,9 @@ int main(int argc, char **argv) struct stat txt_file_stat; int fp, ep; + const char *prg; + + prg = basename(argv[0]); /* Turn off getopt()'s internal error message */ opterr = 0; @@ -109,19 +115,19 @@ int main(int argc, char **argv) padbyte = strtol(optarg, NULL, 0); break; case 'h': - usage(argv[0]); + usage(prg); return EXIT_SUCCESS; case 'V': printf("%s version %s\n", prg, PLAIN_VERSION); return EXIT_SUCCESS; case ':': fprintf(stderr, "Missing argument for option -%c\n", - optopt); + option); usage(argv[0]); return EXIT_FAILURE; default: - fprintf(stderr, "Wrong option -%c\n", optopt); - usage(argv[0]); + fprintf(stderr, "Wrong option -%c\n", option); + usage(prg); return EXIT_FAILURE; } } @@ -131,7 +137,7 @@ int main(int argc, char **argv) fprintf(stderr, "Please specify the size of the environment " "partition.\n"); - usage(argv[0]); + usage(prg); return EXIT_FAILURE; } |