From 067f54c66acd469870ef6946e1591bfcc02de1b3 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Mon, 26 Oct 2009 09:55:40 +0100 Subject: Add minimal SJA1000 header for basic CAN mode This patch is in preparation for the upcoming PLU405 board fix. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/include/sja1000.h b/include/sja1000.h new file mode 100644 index 0000000..59e35af --- /dev/null +++ b/include/sja1000.h @@ -0,0 +1,60 @@ +/* + * Copyright 2009, Matthias Fuchs + * + * SJA1000 register layout for basic CAN mode + * + * 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 + */ + +#ifndef _SJA1000_H_ +#define _SJA1000_H_ + +/* + * SJA1000 register layout in basic can mode + */ +struct sja1000_basic_s { + u8 cr; + u8 cmr; + u8 sr; + u8 ir; + u8 ac; + u8 am; + u8 btr0; + u8 btr1; + u8 oc; + u8 txb[10]; + u8 rxb[10]; + u8 unused; + u8 cdr; +}; + +/* control register */ +#define CR_RR 0x01 + +/* output control register */ +#define OC_MODE0 0x01 +#define OC_MODE1 0x02 +#define OC_POL0 0x04 +#define OC_TN0 0x08 +#define OC_TP0 0x10 +#define OC_POL1 0x20 +#define OC_TN1 0x40 +#define OC_TP1 0x80 + +#endif -- cgit v0.10.2 From be0db3e3141c6c6b4e232b51091f35a284cc54e5 Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Mon, 26 Oct 2009 09:58:45 +0100 Subject: ppc4xx: Initialize magnetic couplers in PLU405 This patch fixes an ugly behavior of the IL712 magnetic couplers as used on PLU405. These parts will remember their last state over a power cycle which might cause unwanted behavior. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/board/esd/plu405/plu405.c b/board/esd/plu405/plu405.c index f14ef7a..c733587 100644 --- a/board/esd/plu405/plu405.c +++ b/board/esd/plu405/plu405.c @@ -26,6 +26,7 @@ #include #include #include +#include #undef FPGA_DEBUG @@ -61,6 +62,34 @@ au_image_t au_image[] = { int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0])); +/* + * generate a short spike on the CAN tx line + * to bring the couplers in sync + */ +void init_coupler(u32 addr) +{ + struct sja1000_basic_s *ctrl = (struct sja1000_basic_s *)addr; + + /* reset */ + out_8(&ctrl->cr, CR_RR); + + /* dominant */ + out_8(&ctrl->btr0, 0x00); /* btr setup is required */ + out_8(&ctrl->btr1, 0x14); /* we use 1Mbit/s */ + out_8(&ctrl->oc, OC_TP1 | OC_TN1 | OC_POL1 | + OC_TP0 | OC_TN0 | OC_POL0 | OC_MODE1); + out_8(&ctrl->cr, 0x00); + + /* delay */ + in_8(&ctrl->cr); + in_8(&ctrl->cr); + in_8(&ctrl->cr); + in_8(&ctrl->cr); + + /* reset */ + out_8(&ctrl->cr, CR_RR); +} + /* Prototypes */ int gunzip(void *, int, unsigned char *, unsigned long *); @@ -214,6 +243,13 @@ int misc_init_r(void) out_8((void *)DUART1_BA + 1, fctr); /* write FCTR */ out_8((void *)DUART1_BA + 3, 0); /* write LCR */ + /* + * Init magnetic couplers + */ + if (!getenv("noinitcoupler")) { + init_coupler(CAN0_BA); + init_coupler(CAN1_BA); + } return 0; } diff --git a/include/configs/PLU405.h b/include/configs/PLU405.h index 2e41526..2f84f7f 100644 --- a/include/configs/PLU405.h +++ b/include/configs/PLU405.h @@ -300,7 +300,8 @@ /* * External Bus Controller (EBC) Setup */ -#define CAN_BA 0xF0000000 /* CAN Base Address */ +#define CAN0_BA 0xF0000000 /* CAN0 Base Address */ +#define CAN1_BA 0xF0000100 /* CAN1 Base Address */ #define DUART0_BA 0xF0000400 /* DUART Base Address */ #define DUART1_BA 0xF0000408 /* DUART Base Address */ #define RTC_BA 0xF0000500 /* RTC Base Address */ -- cgit v0.10.2 From 3ffc0d61bad7d986e344ce7062b37c5c8f04fb0e Mon Sep 17 00:00:00 2001 From: Matthias Fuchs Date: Tue, 27 Oct 2009 19:58:09 +0100 Subject: ppc4xx: Initialize magnetic coupler on VOM405 boards This patch fixes an ugly behavior of the IL712 magnetic coupler as used on VOM405. These parts will remember their last state over a power cycle which might cause unwanted behavior. Signed-off-by: Matthias Fuchs Signed-off-by: Stefan Roese diff --git a/board/esd/vom405/vom405.c b/board/esd/vom405/vom405.c index fb48022..de35036 100644 --- a/board/esd/vom405/vom405.c +++ b/board/esd/vom405/vom405.c @@ -26,11 +26,40 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; extern void lxt971_no_sleep(void); +/* + * generate a short spike on the CAN tx line + * to bring the couplers in sync + */ +void init_coupler(u32 addr) +{ + struct sja1000_basic_s *ctrl = (struct sja1000_basic_s *)addr; + + /* reset */ + out_8(&ctrl->cr, CR_RR); + + /* dominant */ + out_8(&ctrl->btr0, 0x00); /* btr setup is required */ + out_8(&ctrl->btr1, 0x14); /* we use 1Mbit/s */ + out_8(&ctrl->oc, OC_TP1 | OC_TN1 | OC_POL1 | + OC_TP0 | OC_TN0 | OC_POL0 | OC_MODE1); + out_8(&ctrl->cr, 0x00); + + /* delay */ + in_8(&ctrl->cr); + in_8(&ctrl->cr); + in_8(&ctrl->cr); + in_8(&ctrl->cr); + + /* reset */ + out_8(&ctrl->cr, CR_RR); +} + int board_early_init_f (void) { /* @@ -77,6 +106,12 @@ int misc_init_r (void) gd->bd->bi_flashstart = 0 - gd->bd->bi_flashsize; gd->bd->bi_flashoffset = 0; + /* + * Init magnetic coupler + */ + if (!getenv("noinitcoupler")) + init_coupler(CAN_BA); + return (0); } -- cgit v0.10.2 From c0356a88011330646e960dfac8a2c909bede3304 Mon Sep 17 00:00:00 2001 From: Mark Jackson Date: Mon, 17 Aug 2009 16:42:52 +0100 Subject: MIMC200: set default fbmem value This patch adds a default bootargs "fbmem" value to the CONFIG_BOOTARGS string for the MIMC200 board. Signed-off-by: Mark Jackson diff --git a/include/configs/mimc200.h b/include/configs/mimc200.h index 8f71664..36488b3 100644 --- a/include/configs/mimc200.h +++ b/include/configs/mimc200.h @@ -74,7 +74,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTARGS \ - "root=/dev/mtdblock1 rootfstype=jffs2 console=ttyS1" + "root=/dev/mtdblock1 rootfstype=jffs2 fbmem=512k console=ttyS1" #define CONFIG_BOOTCOMMAND \ "fsload boot/uImage; bootm" -- cgit v0.10.2 From f2cea405f83da46b72098ea874fb3eefe185d312 Mon Sep 17 00:00:00 2001 From: Po-Yu Chuang Date: Wed, 23 Sep 2009 15:52:35 +0800 Subject: Add driver for FTRTC010 real time clock Signed-off-by: Po-Yu Chuang Edited commit message. Signed-off-by: Wolfgang Denk diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index ea7d899..772a49a 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -40,6 +40,7 @@ COBJS-$(CONFIG_RTC_DS1556) += ds1556.o COBJS-$(CONFIG_RTC_DS164x) += ds164x.o COBJS-$(CONFIG_RTC_DS174x) += ds174x.o COBJS-$(CONFIG_RTC_DS3231) += ds3231.o +COBJS-$(CONFIG_RTC_FTRTC010) += ftrtc010.o COBJS-$(CONFIG_RTC_ISL1208) += isl1208.o COBJS-$(CONFIG_RTC_M41T11) += m41t11.o COBJS-$(CONFIG_RTC_M41T60) += m41t60.o diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c new file mode 100644 index 0000000..c3c0bc2 --- /dev/null +++ b/drivers/rtc/ftrtc010.c @@ -0,0 +1,124 @@ +/* + * Faraday FTRTC010 Real Time Clock + * + * (C) Copyright 2009 Faraday Technology + * Po-Yu Chuang + * + * 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include + +struct ftrtc010 { + unsigned int sec; /* 0x00 */ + unsigned int min; /* 0x04 */ + unsigned int hour; /* 0x08 */ + unsigned int day; /* 0x0c */ + unsigned int alarm_sec; /* 0x10 */ + unsigned int alarm_min; /* 0x14 */ + unsigned int alarm_hour; /* 0x18 */ + unsigned int record; /* 0x1c */ + unsigned int cr; /* 0x20 */ +}; + +/* + * RTC Control Register + */ +#define FTRTC010_CR_ENABLE (1 << 0) +#define FTRTC010_CR_INTERRUPT_SEC (1 << 1) /* per second irq */ +#define FTRTC010_CR_INTERRUPT_MIN (1 << 2) /* per minute irq */ +#define FTRTC010_CR_INTERRUPT_HR (1 << 3) /* per hour irq */ +#define FTRTC010_CR_INTERRUPT_DAY (1 << 4) /* per day irq */ + +static struct ftrtc010 *rtc = (struct ftrtc010 *)CONFIG_FTRTC010_BASE; + +static void ftrtc010_enable (void) +{ + writel (FTRTC010_CR_ENABLE, &rtc->cr); +} + +/* + * return current time in seconds + */ +static unsigned long ftrtc010_time (void) +{ + unsigned long day; + unsigned long hour; + unsigned long minute; + unsigned long second; + unsigned long second2; + + do { + second = readl (&rtc->sec); + day = readl (&rtc->day); + hour = readl (&rtc->hour); + minute = readl (&rtc->min); + second2 = readl (&rtc->sec); + } while (second != second2); + + return day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 + second; +} + +/* + * Get the current time from the RTC + */ + +int rtc_get (struct rtc_time *tmp) +{ + unsigned long now; + + debug ("%s(): record register: %x\n", + __func__, readl (&rtc->record)); + + now = ftrtc010_time () + readl (&rtc->record); + + to_tm (now, tmp); + + return 0; +} + +/* + * Set the RTC + */ +int rtc_set (struct rtc_time *tmp) +{ + unsigned long new; + unsigned long now; + + debug ("%s(): DATE: %4d-%02d-%02d (wday=%d) TIME: %2d:%02d:%02d\n", + __func__, + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + new = mktime (tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_hour, + tmp->tm_min, tmp->tm_sec); + + now = ftrtc010_time (); + + debug ("%s(): write %lx to record register\n", __func__, new - now); + + writel (new - now, &rtc->record); + + return 0; +} + +void rtc_reset (void) +{ + debug ("%s()\n", __func__); + ftrtc010_enable (); +} -- cgit v0.10.2 From cada315100c88894b85972a91309a6f2413966b6 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Thu, 1 Oct 2009 23:55:17 +0200 Subject: mpc8260: move FDT memory node fixup into common CPU code. Signed-off-by: Marcel Ziswiler Tested-by: Heiko Schocher diff --git a/board/freescale/mpc8260ads/mpc8260ads.c b/board/freescale/mpc8260ads/mpc8260ads.c index 49a88bb..be55626 100644 --- a/board/freescale/mpc8260ads/mpc8260ads.c +++ b/board/freescale/mpc8260ads/mpc8260ads.c @@ -550,24 +550,11 @@ void pci_init_board(void) #endif #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) -void ft_blob_update(void *blob, bd_t *bd) -{ - int ret; - - ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize); - - if (ret < 0) { - printf("ft_blob_update(): cannot set /memory/reg " - "property err:%s\n", fdt_strerror(ret)); - } -} - void ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup(blob, bd); #ifdef CONFIG_PCI ft_pci_setup(blob, bd); #endif - ft_blob_update(blob, bd); } #endif diff --git a/board/ids8247/ids8247.c b/board/ids8247/ids8247.c index 79fe9da..d621833 100644 --- a/board/ids8247/ids8247.c +++ b/board/ids8247/ids8247.c @@ -400,24 +400,8 @@ int board_nand_init(struct nand_chip *nand) #endif /* CONFIG_CMD_NAND */ #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) -/* - * update "memory" property in the blob - */ -void ft_blob_update(void *blob, bd_t *bd) -{ - int ret; - - ret = fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize); - - if (ret < 0) { - printf("ft_blob_update(): cannot set /memory/reg " - "property err:%s\n", fdt_strerror(ret)); - } -} - void ft_board_setup(void *blob, bd_t *bd) { ft_cpu_setup( blob, bd); - ft_blob_update(blob, bd); } #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c index b16a01c..932a805 100644 --- a/board/keymile/mgcoge/mgcoge.c +++ b/board/keymile/mgcoge/mgcoge.c @@ -312,11 +312,10 @@ int hush_init_var (void) #if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) /* - * update "memory" property in the blob + * update "flash" property in the blob */ void ft_blob_update (void *blob, bd_t *bd) { - ulong memory_data[2] = {0}; ulong *flash_data = NULL; ulong flash_reg[6] = {0}; flash_info_t *info; @@ -324,11 +323,6 @@ void ft_blob_update (void *blob, bd_t *bd) int size; int i = 0; - memory_data[0] = cpu_to_be32 (bd->bi_memstart); - memory_data[1] = cpu_to_be32 (bd->bi_memsize); - fdt_set_node_and_value (blob, "/memory", "reg", memory_data, - sizeof (memory_data)); - len = fdt_get_node_and_value (blob, "/localbus", "ranges", (void *)&flash_data); diff --git a/board/muas3001/muas3001.c b/board/muas3001/muas3001.c index 36caed8..e0a7f32 100644 --- a/board/muas3001/muas3001.c +++ b/board/muas3001/muas3001.c @@ -308,25 +308,9 @@ int board_early_init_r (void) void ft_blob_update (void *blob, bd_t *bd) { int ret, nodeoffset = 0; - ulong memory_data[2] = {0}; ulong flash_data[4] = {0}; ulong speed = 0; - memory_data[0] = cpu_to_be32 (bd->bi_memstart); - memory_data[1] = cpu_to_be32 (bd->bi_memsize); - - nodeoffset = fdt_path_offset (blob, "/memory"); - if (nodeoffset >= 0) { - ret = fdt_setprop (blob, nodeoffset, "reg", memory_data, - sizeof(memory_data)); - if (ret < 0) - printf ("ft_blob_update): cannot set /memory/reg " - "property err:%s\n", fdt_strerror (ret)); - } else { - /* memory node is required in dts */ - printf ("ft_blob_update(): cannot find /memory node " - "err:%s\n", fdt_strerror(nodeoffset)); - } /* update Flash addr, size */ flash_data[2] = cpu_to_be32 (CONFIG_SYS_FLASH_BASE); flash_data[3] = cpu_to_be32 (CONFIG_SYS_FLASH_SIZE); diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c index 17e6248..aedbf29 100644 --- a/cpu/mpc8260/cpu.c +++ b/cpu/mpc8260/cpu.c @@ -318,6 +318,7 @@ void ft_cpu_setup (void *blob, bd_t *bd) "timebase-frequency", OF_TBCLK, 1); do_fixup_by_prop_u32(blob, "device_type", "cpu", 4, "clock-frequency", bd->bi_intfreq, 1); + fdt_fixup_memory(blob, (u64)bd->bi_memstart, (u64)bd->bi_memsize); } #endif /* CONFIG_OF_LIBFDT */ -- cgit v0.10.2 From d394a7795027d96ca55799df40bd5c4a13dbeebe Mon Sep 17 00:00:00 2001 From: Jason McMullan Date: Fri, 9 Oct 2009 17:12:23 -0400 Subject: sf: new driver for Winbond W25X16/32/64 devices Signed-off-by: Jason McMullan Signed-off-by: Mike Frysinger diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index e3e0292..4f11b36 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -31,6 +31,7 @@ COBJS-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.o COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o +COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o COBJS := $(COBJS-y) diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 25346a4..612f819 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -140,6 +140,11 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, flash = spi_flash_probe_macronix(spi, idcode); break; #endif +#ifdef CONFIG_SPI_FLASH_WINBOND + case 0xef: + flash = spi_flash_probe_winbond(spi, idcode); + break; +#endif #ifdef CONFIG_SPI_FLASH_STMICRO case 0x20: flash = spi_flash_probe_stmicro(spi, idcode); diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index 0612383..08546fb 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -49,3 +49,4 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode); struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 *idcode); +struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode); diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c new file mode 100644 index 0000000..b8da923 --- /dev/null +++ b/drivers/mtd/spi/winbond.c @@ -0,0 +1,332 @@ +/* + * Copyright 2008, Network Appliance Inc. + * Author: Jason McMullan netapp.com> + * Licensed under the GPL-2 or later. + */ + +#include +#include +#include + +#include "spi_flash_internal.h" + +/* M25Pxx-specific commands */ +#define CMD_W25_WREN 0x06 /* Write Enable */ +#define CMD_W25_WRDI 0x04 /* Write Disable */ +#define CMD_W25_RDSR 0x05 /* Read Status Register */ +#define CMD_W25_WRSR 0x01 /* Write Status Register */ +#define CMD_W25_READ 0x03 /* Read Data Bytes */ +#define CMD_W25_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */ +#define CMD_W25_PP 0x02 /* Page Program */ +#define CMD_W25_SE 0x20 /* Sector (4K) Erase */ +#define CMD_W25_BE 0xd8 /* Block (64K) Erase */ +#define CMD_W25_CE 0xc7 /* Chip Erase */ +#define CMD_W25_DP 0xb9 /* Deep Power-down */ +#define CMD_W25_RES 0xab /* Release from DP, and Read Signature */ + +#define WINBOND_ID_W25X16 0x3015 +#define WINBOND_ID_W25X32 0x3016 +#define WINBOND_ID_W25X64 0x3017 + +#define WINBOND_SR_WIP (1 << 0) /* Write-in-Progress */ + +struct winbond_spi_flash_params { + uint16_t id; + /* Log2 of page size in power-of-two mode */ + uint8_t l2_page_size; + uint16_t pages_per_sector; + uint16_t sectors_per_block; + uint8_t nr_blocks; + const char *name; +}; + +/* spi_flash needs to be first so upper layers can free() it */ +struct winbond_spi_flash { + struct spi_flash flash; + const struct winbond_spi_flash_params *params; +}; + +static inline struct winbond_spi_flash * +to_winbond_spi_flash(struct spi_flash *flash) +{ + return container_of(flash, struct winbond_spi_flash, flash); +} + +static const struct winbond_spi_flash_params winbond_spi_flash_table[] = { + { + .id = WINBOND_ID_W25X16, + .l2_page_size = 8, + .pages_per_sector = 16, + .sectors_per_block = 16, + .nr_blocks = 32, + .name = "W25X16", + }, + { + .id = WINBOND_ID_W25X32, + .l2_page_size = 8, + .pages_per_sector = 16, + .sectors_per_block = 16, + .nr_blocks = 64, + .name = "W25X32", + }, + { + .id = WINBOND_ID_W25X64, + .l2_page_size = 8, + .pages_per_sector = 16, + .sectors_per_block = 16, + .nr_blocks = 128, + .name = "W25X64", + }, +}; + +static int winbond_wait_ready(struct spi_flash *flash, unsigned long timeout) +{ + struct spi_slave *spi = flash->spi; + unsigned long timebase; + int ret; + u8 status; + u8 cmd[4] = { CMD_W25_RDSR, 0xff, 0xff, 0xff }; + + ret = spi_xfer(spi, 32, &cmd[0], NULL, SPI_XFER_BEGIN); + if (ret) { + debug("SF: Failed to send command %02x: %d\n", cmd, ret); + return ret; + } + + timebase = get_timer(0); + do { + ret = spi_xfer(spi, 8, NULL, &status, 0); + if (ret) { + debug("SF: Failed to get status for cmd %02x: %d\n", cmd, ret); + return -1; + } + + if ((status & WINBOND_SR_WIP) == 0) + break; + + } while (get_timer(timebase) < timeout); + + spi_xfer(spi, 0, NULL, NULL, SPI_XFER_END); + + if ((status & WINBOND_SR_WIP) == 0) + return 0; + + debug("SF: Timed out on command %02x: %d\n", cmd, ret); + /* Timed out */ + return -1; +} + +/* + * Assemble the address part of a command for Winbond devices in + * non-power-of-two page size mode. + */ +static void winbond_build_address(struct winbond_spi_flash *stm, u8 *cmd, u32 offset) +{ + unsigned long page_addr; + unsigned long byte_addr; + unsigned long page_size; + unsigned int page_shift; + + /* + * The "extra" space per page is the power-of-two page size + * divided by 32. + */ + page_shift = stm->params->l2_page_size; + page_size = (1 << page_shift); + page_addr = offset / page_size; + byte_addr = offset % page_size; + + cmd[0] = page_addr >> (16 - page_shift); + cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8); + cmd[2] = byte_addr; +} + +static int winbond_read_fast(struct spi_flash *flash, + u32 offset, size_t len, void *buf) +{ + struct winbond_spi_flash *stm = to_winbond_spi_flash(flash); + u8 cmd[5]; + + cmd[0] = CMD_READ_ARRAY_FAST; + winbond_build_address(stm, cmd + 1, offset); + cmd[4] = 0x00; + + return spi_flash_read_common(flash, cmd, sizeof(cmd), buf, len); +} + +static int winbond_write(struct spi_flash *flash, + u32 offset, size_t len, const void *buf) +{ + struct winbond_spi_flash *stm = to_winbond_spi_flash(flash); + unsigned long page_addr; + unsigned long byte_addr; + unsigned long page_size; + unsigned int page_shift; + size_t chunk_len; + size_t actual; + int ret; + u8 cmd[4]; + + page_shift = stm->params->l2_page_size; + page_size = (1 << page_shift); + page_addr = offset / page_size; + byte_addr = offset % page_size; + + ret = spi_claim_bus(flash->spi); + if (ret) { + debug("SF: Unable to claim SPI bus\n"); + return ret; + } + + for (actual = 0; actual < len; actual += chunk_len) { + chunk_len = min(len - actual, page_size - byte_addr); + + cmd[0] = CMD_W25_PP; + cmd[1] = page_addr >> (16 - page_shift); + cmd[2] = page_addr << (page_shift - 8) | (byte_addr >> 8); + cmd[3] = byte_addr; + debug("PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x } chunk_len = %d\n", + buf + actual, + cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); + + ret = spi_flash_cmd(flash->spi, CMD_W25_WREN, NULL, 0); + if (ret < 0) { + debug("SF: Enabling Write failed\n"); + goto out; + } + + ret = spi_flash_cmd_write(flash->spi, cmd, 4, + buf + actual, chunk_len); + if (ret < 0) { + debug("SF: Winbond Page Program failed\n"); + goto out; + } + + ret = winbond_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); + if (ret < 0) { + debug("SF: Winbond page programming timed out\n"); + goto out; + } + + page_addr++; + byte_addr = 0; + } + + debug("SF: Winbond: Successfully programmed %u bytes @ 0x%x\n", + len, offset); + ret = 0; + +out: + spi_release_bus(flash->spi); + return ret; +} + +int winbond_erase(struct spi_flash *flash, u32 offset, size_t len) +{ + struct winbond_spi_flash *stm = to_winbond_spi_flash(flash); + unsigned long sector_size; + unsigned int page_shift; + size_t actual; + int ret; + u8 cmd[4]; + + /* + * This function currently uses sector erase only. + * probably speed things up by using bulk erase + * when possible. + */ + + page_shift = stm->params->l2_page_size; + sector_size = (1 << page_shift) * stm->params->pages_per_sector; + + if (offset % sector_size || len % sector_size) { + debug("SF: Erase offset/length not multiple of sector size\n"); + return -1; + } + + len /= sector_size; + cmd[0] = CMD_W25_SE; + + ret = spi_claim_bus(flash->spi); + if (ret) { + debug("SF: Unable to claim SPI bus\n"); + return ret; + } + + for (actual = 0; actual < len; actual++) { + winbond_build_address(stm, &cmd[1], offset + actual * sector_size); + printf("Erase: %02x %02x %02x %02x\n", + cmd[0], cmd[1], cmd[2], cmd[3]); + + ret = spi_flash_cmd(flash->spi, CMD_W25_WREN, NULL, 0); + if (ret < 0) { + debug("SF: Enabling Write failed\n"); + goto out; + } + + ret = spi_flash_cmd_write(flash->spi, cmd, 4, NULL, 0); + if (ret < 0) { + debug("SF: Winbond sector erase failed\n"); + goto out; + } + + ret = winbond_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT); + if (ret < 0) { + debug("SF: Winbond sector erase timed out\n"); + goto out; + } + } + + debug("SF: Winbond: Successfully erased %u bytes @ 0x%x\n", + len * sector_size, offset); + ret = 0; + +out: + spi_release_bus(flash->spi); + return ret; +} + +struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode) +{ + const struct winbond_spi_flash_params *params; + unsigned long page_size; + struct winbond_spi_flash *stm; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(winbond_spi_flash_table); i++) { + params = &winbond_spi_flash_table[i]; + if (params->id == ((idcode[1] << 8) | idcode[2])) + break; + } + + if (i == ARRAY_SIZE(winbond_spi_flash_table)) { + debug("SF: Unsupported Winbond ID %02x%02x\n", + idcode[1], idcode[2]); + return NULL; + } + + stm = malloc(sizeof(struct winbond_spi_flash)); + if (!stm) { + debug("SF: Failed to allocate memory\n"); + return NULL; + } + + stm->params = params; + stm->flash.spi = spi; + stm->flash.name = params->name; + + /* Assuming power-of-two page size initially. */ + page_size = 1 << params->l2_page_size; + + stm->flash.write = winbond_write; + stm->flash.erase = winbond_erase; + stm->flash.read = winbond_read_fast; + stm->flash.size = page_size * params->pages_per_sector + * params->sectors_per_block + * params->nr_blocks; + + debug("SF: Detected %s with page size %u, total %u bytes\n", + params->name, page_size, stm->flash.size); + + return &stm->flash; +} -- cgit v0.10.2 From fcffb680e77fcb48598d4a9944dbe2d4503170e0 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 14 Oct 2009 19:28:03 -0400 Subject: sf: fix stmicro offset setup while erasing Reported-by: Peter Gombos Signed-off-by: Mike Frysinger diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index 9b910c1..ae0d047 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -281,7 +281,8 @@ int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len) ret = 0; for (actual = 0; actual < len; actual++) { - cmd[1] = (offset / sector_size) + actual; + cmd[1] = offset >> 16; + offset += sector_size; ret = spi_flash_cmd(flash->spi, CMD_M25PXX_WREN, NULL, 0); if (ret < 0) { -- cgit v0.10.2 From 57baa379cf2f67df89a5c6052767fd25daff20bd Mon Sep 17 00:00:00 2001 From: Scott McNutt Date: Mon, 23 Nov 2009 15:54:25 -0500 Subject: Nios2/Nios: Remove unnecessary (residual) linker Nios command scripts from the standalone examples. Signed-off-by: Scott McNutt diff --git a/examples/standalone/nios.lds b/examples/standalone/nios.lds deleted file mode 100644 index 4c1080b..0000000 --- a/examples/standalone/nios.lds +++ /dev/null @@ -1,61 +0,0 @@ -/* - * (C) Copyright 2003, Psyent Corporation - * Scott McNutt - * - * 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 - */ - - -OUTPUT_FORMAT("elf32-nios") -OUTPUT_ARCH(nios) -ENTRY(_start) - -SECTIONS -{ - .text : - { - *(.text) - } - __text_end = .; - - . = ALIGN(4); - .rodata : - { - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - } - __rodata_end = .; - - . = ALIGN(4); - .data : - { - *(.data) - } - . = ALIGN(4); - __data_end = .; - - __bss_start = .; - . = ALIGN(4); - .bss (NOLOAD) : - { - *(.bss) - } - . = ALIGN(4); - __bss_end = .; - _end = .; -} diff --git a/examples/standalone/nios2.lds b/examples/standalone/nios2.lds deleted file mode 100644 index a3e5ea8..0000000 --- a/examples/standalone/nios2.lds +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (C) Copyright 2004, Psyent Corporation - * Scott McNutt - * - * 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 - */ - - -OUTPUT_FORMAT("elf32-littlenios2") -OUTPUT_ARCH(nios2) -ENTRY(_start) - -SECTIONS -{ - .text : - { - *(.text) - *(.text.*) - *(.gnu.linkonce.t*) - *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) - *(.gnu.linkonce.r*) - } - . = ALIGN (4); - _etext = .; - PROVIDE (etext = .); - - /* INIT DATA sections - "Small" data (see the gcc -G option) - * is always gp-relative. Here we make all init data sections - * adjacent to simplify the startup code -- and provide - * the global pointer for gp-relative access. - */ - _data = .; - .data : - { - *(.data) - *(.data.*) - *(.gnu.linkonce.d*) - } - - . = ALIGN(16); - _gp = .; /* Global pointer addr */ - PROVIDE (gp = .); - - .sdata : - { - *(.sdata) - *(.sdata.*) - *(.gnu.linkonce.s.*) - } - . = ALIGN(4); - - _edata = .; - PROVIDE (edata = .); - - /* UNINIT DATA - Small uninitialized data is first so it's - * adjacent to sdata and can be referenced via gp. The normal - * bss follows. We keep it adjacent to simplify init code. - */ - __bss_start = .; - .sbss (NOLOAD) : - { - *(.sbss) - *(.sbss.*) - *(.gnu.linkonce.sb.*) - *(.scommon) - } - . = ALIGN(4); - .bss (NOLOAD) : - { - *(.bss) - *(.bss.*) - *(.dynbss) - *(COMMON) - *(.scommon) - } - . = ALIGN(4); - _end = .; - PROVIDE (end = .); - - /* CMD TABLE - uboot command sections - */ - . = .; - __uboot_cmd_start = .; - .u_boot_cmd : - { - *(.u_boot_cmd) - } - . = ALIGN(4); - __u_boot_cmd_end = .; - - /* DEBUG -- symbol table, string table, etc. etc. - */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } -} diff --git a/lib_nios/config.mk b/lib_nios/config.mk index d48aa6d..e1b9f07 100644 --- a/lib_nios/config.mk +++ b/lib_nios/config.mk @@ -24,6 +24,6 @@ CROSS_COMPILE ?= nios-elf- -STANDALONE_LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 -T nios.lds +STANDALONE_LOAD_ADDR = 0x00800000 -L $(gcclibdir)/m32 PLATFORM_CPPFLAGS += -m32 -DCONFIG_NIOS -D__NIOS__ -ffixed-g7 -gstabs diff --git a/lib_nios2/config.mk b/lib_nios2/config.mk index 34ee697..be40639 100644 --- a/lib_nios2/config.mk +++ b/lib_nios2/config.mk @@ -24,7 +24,7 @@ CROSS_COMPILE ?= nios2-elf- -STANDALONE_LOAD_ADDR = 0x02000000 -L $(gcclibdir) -T nios2.lds +STANDALONE_LOAD_ADDR = 0x02000000 -L $(gcclibdir) PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__ PLATFORM_CPPFLAGS += -ffixed-r15 -G0 -- cgit v0.10.2 From de03825386eaedb5e17261dd87cde86e9a764ba9 Mon Sep 17 00:00:00 2001 From: Scott McNutt Date: Mon, 23 Nov 2009 16:29:40 -0500 Subject: Nios2: Fix compiler warnings in lib_nios2/board.c (unused variables) Signed-off-by: Scott McNutt diff --git a/lib_nios2/board.c b/lib_nios2/board.c index 008f04f..41d3297 100644 --- a/lib_nios2/board.c +++ b/lib_nios2/board.c @@ -83,8 +83,6 @@ void board_init (void) { bd_t *bd; init_fnc_t **init_fnc_ptr; - char *s, *e; - int i; /* Pointer is writable since we allocated a register for it. * Nios treats CONFIG_SYS_GBL_DATA_OFFSET as an address. -- cgit v0.10.2 From 0a7691e820e33b23f61c6ea0ef6fa72099d1a6ae Mon Sep 17 00:00:00 2001 From: Renato Andreola Date: Mon, 23 Nov 2009 16:45:14 -0500 Subject: Nios2: do_boom_linux(): kernel gunzip input data integrity problem due to missing cache flush. Added instruction and data caches flush. Signed-off-by: Scott McNutt diff --git a/lib_nios2/bootm.c b/lib_nios2/bootm.c index 53fd569..675bfac 100644 --- a/lib_nios2/bootm.c +++ b/lib_nios2/bootm.c @@ -24,6 +24,7 @@ #include #include #include +#include int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) { @@ -32,6 +33,10 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; + /* flushes data and instruction caches before calling the kernel */ + flush_dcache (0,CONFIG_SYS_DCACHE_SIZE); + flush_icache (0,CONFIG_SYS_ICACHE_SIZE); + /* For now we assume the Microtronix linux ... which only * needs to be called ;-) */ -- cgit v0.10.2 From 6a590c5f5fd12cdd27f3153522acfac3854590e7 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Wed, 28 Oct 2009 22:13:35 +0100 Subject: Building of FIT images does not work. The type is not set for generation of the FIT images, resulting in no images being created without printing or returning an error Signed-off-by: Remy Bohmer diff --git a/tools/mkimage.c b/tools/mkimage.c index ab6ea32..8a20594 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -229,6 +229,7 @@ main (int argc, char **argv) case 'f': if (--argc <= 0) usage (); + params.type = IH_TYPE_FLATDT; params.datafile = *++argv; params.fflag = 1; goto NXTARG; -- cgit v0.10.2 From faf36c1437c95e4a86835633d9801c5f6396a3c7 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Wed, 28 Oct 2009 22:13:36 +0100 Subject: Fix mingw tools build mkimage does not build due to missing strtok_r() and getline() implementation Signed-off-by: Remy Bohmer diff --git a/tools/mingw_support.c b/tools/mingw_support.c index 67cd6e1..6379710 100644 --- a/tools/mingw_support.c +++ b/tools/mingw_support.c @@ -24,7 +24,9 @@ #include "mingw_support.h" #include #include +#include #include +#include #include int fsync(int fd) @@ -77,3 +79,158 @@ int munmap(void *addr, size_t len) return 0; } + +/* Reentrant string tokenizer. Generic version. + Copyright (C) 1991,1996-1999,2001,2004,2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Parse S into tokens separated by characters in DELIM. + If S is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" +*/ +char *strtok_r(char *s, const char *delim, char **save_ptr) +{ + char *token; + + if (s == NULL) + s = *save_ptr; + + /* Scan leading delimiters. */ + s += strspn(s, delim); + if (*s == '\0') { + *save_ptr = s; + return NULL; + } + + /* Find the end of the token. */ + token = s; + s = strpbrk (token, delim); + if (s == NULL) { + /* This token finishes the string. */ + *save_ptr = memchr(token, '\0', strlen(token)); + } else { + /* Terminate the token and make *SAVE_PTR point past it. */ + *s = '\0'; + *save_ptr = s + 1; + } + return token; +} + +/* getline.c -- Replacement for GNU C library function getline + +Copyright (C) 1993, 1996, 2001, 2002 Free Software Foundation, Inc. + +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. */ + +/* Written by Jan Brittenson, bson@gnu.ai.mit.edu. */ + +/* Always add at least this many bytes when extending the buffer. */ +#define MIN_CHUNK 64 + +/* Read up to (and including) a TERMINATOR from STREAM into *LINEPTR + + OFFSET (and null-terminate it). *LINEPTR is a pointer returned from + malloc (or NULL), pointing to *N characters of space. It is realloc'd + as necessary. Return the number of characters read (not including the + null terminator), or -1 on error or EOF. + NOTE: There is another getstr() function declared in . */ +static int getstr(char **lineptr, size_t *n, FILE *stream, + char terminator, size_t offset) +{ + int nchars_avail; /* Allocated but unused chars in *LINEPTR. */ + char *read_pos; /* Where we're reading into *LINEPTR. */ + int ret; + + if (!lineptr || !n || !stream) + return -1; + + if (!*lineptr) { + *n = MIN_CHUNK; + *lineptr = malloc(*n); + if (!*lineptr) + return -1; + } + + nchars_avail = *n - offset; + read_pos = *lineptr + offset; + + for (;;) { + register int c = getc(stream); + + /* We always want at least one char left in the buffer, since we + always (unless we get an error while reading the first char) + NUL-terminate the line buffer. */ + + assert(*n - nchars_avail == read_pos - *lineptr); + if (nchars_avail < 2) { + if (*n > MIN_CHUNK) + *n *= 2; + else + *n += MIN_CHUNK; + + nchars_avail = *n + *lineptr - read_pos; + *lineptr = realloc(*lineptr, *n); + if (!*lineptr) + return -1; + read_pos = *n - nchars_avail + *lineptr; + assert(*n - nchars_avail == read_pos - *lineptr); + } + + if (c == EOF || ferror (stream)) { + /* Return partial line, if any. */ + if (read_pos == *lineptr) + return -1; + else + break; + } + + *read_pos++ = c; + nchars_avail--; + + if (c == terminator) + /* Return the line. */ + break; + } + + /* Done - NUL terminate and return the number of chars read. */ + *read_pos = '\0'; + + ret = read_pos - (*lineptr + offset); + return ret; +} + +int getline (char **lineptr, size_t *n, FILE *stream) +{ + return getstr(lineptr, n, stream, '\n', 0); +} diff --git a/tools/mingw_support.h b/tools/mingw_support.h index 9e45e64..2793674 100644 --- a/tools/mingw_support.h +++ b/tools/mingw_support.h @@ -44,5 +44,7 @@ typedef ULONG ulong; int fsync(int fd); void *mmap(void *, size_t, int, int, int, int); int munmap(void *, size_t); +char *strtok_r(char *s, const char *delim, char **save_ptr); +int getline(char **lineptr, size_t *n, FILE *stream); #endif /* __MINGW_SUPPORT_H_ */ -- cgit v0.10.2 From 41dfd8a60324243dbe2dc313a607910824a68aa7 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Wed, 28 Oct 2009 22:13:37 +0100 Subject: Add support for CS2 dataflash for Atmel-SPI. The only missing chipselect line support is CS2, and I need it on CS2... Signed-off-by: Remy Bohmer diff --git a/drivers/spi/atmel_dataflash_spi.c b/drivers/spi/atmel_dataflash_spi.c index 614965c..3a648e6 100644 --- a/drivers/spi/atmel_dataflash_spi.c +++ b/drivers/spi/atmel_dataflash_spi.c @@ -30,7 +30,8 @@ #include #define AT91_SPI_PCS0_DATAFLASH_CARD 0xE /* Chip Select 0: NPCS0%1110 */ -#define AT91_SPI_PCS1_DATAFLASH_CARD 0xD /* Chip Select 0: NPCS0%1101 */ +#define AT91_SPI_PCS1_DATAFLASH_CARD 0xD /* Chip Select 1: NPCS1%1101 */ +#define AT91_SPI_PCS2_DATAFLASH_CARD 0xB /* Chip Select 2: NPCS2%1011 */ #define AT91_SPI_PCS3_DATAFLASH_CARD 0x7 /* Chip Select 3: NPCS3%0111 */ void AT91F_SpiInit(void) @@ -57,7 +58,14 @@ void AT91F_SpiInit(void) ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), AT91_BASE_SPI + AT91_SPI_CSR(1)); #endif - +#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS2 + /* Configure CS2 */ + writel(AT91_SPI_NCPHA | + (AT91_SPI_DLYBS & DATAFLASH_TCSS) | + (AT91_SPI_DLYBCT & DATAFLASH_TCHS) | + ((get_mck_clk_rate() / AT91_SPI_CLK) << 8), + AT91_BASE_SPI + AT91_SPI_CSR(2)); +#endif #ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3 /* Configure CS3 */ writel(AT91_SPI_NCPHA | @@ -99,6 +107,12 @@ void AT91F_SpiEnable(int cs) writel(mode | ((AT91_SPI_PCS1_DATAFLASH_CARD<<16) & AT91_SPI_PCS), AT91_BASE_SPI + AT91_SPI_MR); break; + case 2: /* Configure SPI CS2 for Serial DataFlash AT45DBxx */ + mode = readl(AT91_BASE_SPI + AT91_SPI_MR); + mode &= 0xFFF0FFFF; + writel(mode | ((AT91_SPI_PCS2_DATAFLASH_CARD<<16) & AT91_SPI_PCS), + AT91_BASE_SPI + AT91_SPI_MR); + break; case 3: mode = readl(AT91_BASE_SPI + AT91_SPI_MR); mode &= 0xFFF0FFFF; -- cgit v0.10.2 From 01826abc02ce160501534788e63629ccbe31b05c Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Thu, 12 Nov 2009 11:46:07 +0200 Subject: OMAP3: pandora: fix booting without serial attached When the board is booted without serial cable attached (which is how most of them will be used) UART RX is left floating and sometimes picks noise, which interrupts countdown and enters U-Boot prompt instead of booting the kernel. Fix this by setting up internal pullup on UART RX pin. This does not prevent serial from working as the internal pullup is weak. Signed-off-by: Grazvydas Ignotas diff --git a/board/pandora/pandora.h b/board/pandora/pandora.h index 5bfa0f9..f0ad16b 100644 --- a/board/pandora/pandora.h +++ b/board/pandora/pandora.h @@ -219,7 +219,8 @@ const omap3_sysinfo sysinfo = { MUX_VAL(CP(UART2_RX), (IEN | PTD | EN | M4)) /*GPIO_147,*/\ /*UART2_RX*/\ /*Serial Interface (Peripheral boot, Linux console, on AV connector)*/\ - MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)) /*UART3_RX*/\ + /*RX pulled up to avoid noise when nothing is connected to serial port*/\ + MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTU | EN | M0)) /*UART3_RX*/\ MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)) /*UART3_TX*/\ /*LEDs (Controlled by OMAP)*/\ MUX_VAL(CP(MMC1_DAT6), (IDIS | PTD | DIS | M4)) /*GPIO_128*/\ -- cgit v0.10.2 From b25e38fc36e13fa8037fa4d37fe909d1d6e6f372 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Thu, 29 Oct 2009 14:24:22 +0100 Subject: Repair build fail in case CONFIG_PPC=n and CONFIG_FIT=y Signed-off-by: Remy Bohmer diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 8f83598..32fd9bb 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -524,7 +524,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) } break; #endif -#ifdef CONFIG_OF_LIBFDT +#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_SYS_BOOTMAPSZ) case BOOTM_STATE_FDT: { ulong bootmap_base = getenv_bootm_low(); diff --git a/include/image.h b/include/image.h index 5a424e6..04b62d1 100644 --- a/include/image.h +++ b/include/image.h @@ -219,12 +219,10 @@ typedef struct bootm_headers { const char *fit_uname_rd; /* init ramdisk subimage node unit name */ int fit_noffset_rd; /* init ramdisk subimage node offset */ -#if defined(CONFIG_PPC) void *fit_hdr_fdt; /* FDT blob FIT image header */ const char *fit_uname_fdt; /* FDT blob subimage node unit name */ int fit_noffset_fdt;/* FDT blob subimage node offset */ #endif -#endif #ifndef USE_HOSTCC image_info_t os; /* os image info */ -- cgit v0.10.2 From 67b96e87da1b84660fa1e5b78cc760246d116814 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Wed, 28 Oct 2009 22:13:39 +0100 Subject: Repair the 'netretry=once' option. 'netretry = once' does the same as 'netretry = yes', because it is not stored when it was tried once. Signed-off-by: Remy Bohmer Signed-off-by: Ben Warren diff --git a/net/net.c b/net/net.c index cab4b2d..fd13cd9 100644 --- a/net/net.c +++ b/net/net.c @@ -197,6 +197,8 @@ volatile uchar *NetTxPacket = 0; /* THE transmit packet */ static int net_check_prereq (proto_t protocol); +static int NetTryCount; + /**********************************************************************/ IPaddr_t NetArpWaitPacketIP; @@ -320,6 +322,7 @@ NetLoop(proto_t protocol) NetArpWaitReplyIP = 0; NetArpWaitTxPacket = NULL; NetTxPacket = NULL; + NetTryCount = 1; if (!NetTxPacket) { int i; @@ -558,17 +561,30 @@ startAgainHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) void NetStartAgain (void) { char *nretry; - int noretry = 0, once = 0; + int retry_forever = 0; + unsigned long retrycnt = 0; + + nretry = getenv("netretry"); + if (nretry) { + if (!strcmp(nretry, "yes")) + retry_forever = 1; + else if (!strcmp(nretry, "no")) + retrycnt = 0; + else if (!strcmp(nretry, "once")) + retrycnt = 1; + else + retrycnt = simple_strtoul(nretry, NULL, 0); + } else + retry_forever = 1; - if ((nretry = getenv ("netretry")) != NULL) { - noretry = (strcmp (nretry, "no") == 0); - once = (strcmp (nretry, "once") == 0); - } - if (noretry) { - eth_halt (); + if ((!retry_forever) && (NetTryCount >= retrycnt)) { + eth_halt(); NetState = NETLOOP_FAIL; return; } + + NetTryCount++; + #ifndef CONFIG_NET_MULTI NetSetTimeout (10000UL, startAgainTimeout); NetSetHandler (startAgainHandler); @@ -580,7 +596,7 @@ void NetStartAgain (void) eth_init (gd->bd); if (NetRestartWrap) { NetRestartWrap = 0; - if (NetDevExists && !once) { + if (NetDevExists) { NetSetTimeout (10000UL, startAgainTimeout); NetSetHandler (startAgainHandler); } else { -- cgit v0.10.2 From a8fa379d47f06c7d3ed75c8fb26ae43ee38e1fd7 Mon Sep 17 00:00:00 2001 From: Nishanth Menon Date: Mon, 2 Nov 2009 09:40:18 -0600 Subject: mkconfig: deny messed up ARCH definition Refuse to setup a platform if the command line ARCH= is not the same as the one required for the board. This prevents any user with prehistoric aliases from messing up their builds. Reported in thread: http://old.nabble.com/-U-Boot--Build-breaks-on-some-OMAP3-configs-to26132721.html Inputs from: Mike Frysinger and Wolfgang Denk: http://lists.denx.de/pipermail/u-boot/2009-November/063642.html Cc: Wolfgang Denk Cc: Mike Frysinger Cc: Anand Gadiyar Cc: Dirk Behme Signed-off-by: Nishanth Menon diff --git a/mkconfig b/mkconfig index 4c5675b..1075510 100755 --- a/mkconfig +++ b/mkconfig @@ -27,6 +27,11 @@ done [ $# -lt 4 ] && exit 1 [ $# -gt 6 ] && exit 1 +if [ "${ARCH}" -a "${ARCH}" != "$2" ]; then + echo "Failed: \$ARCH=${ARCH}, should be '$2' for ${BOARD_NAME}" 1>&2 + exit 1 +fi + echo "Configuring for ${BOARD_NAME} board..." # -- cgit v0.10.2 From 0008555f4d57c15ad86ee735861ca0d783042f61 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 3 Nov 2009 11:36:26 -0500 Subject: bootm: mark local boot_os[] table static Signed-off-by: Mike Frysinger diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 32fd9bb..401bf27 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -129,7 +129,7 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); static boot_os_fn do_bootm_integrity; #endif -boot_os_fn * boot_os[] = { +static boot_os_fn *boot_os[] = { #ifdef CONFIG_BOOTM_LINUX [IH_OS_LINUX] = do_bootm_linux, #endif -- cgit v0.10.2 From e06ab6546b332acc55ac4e7c31338662328b0fb3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 3 Nov 2009 11:36:39 -0500 Subject: spi_flash.h: pull in linux/types.h for u## types diff --git a/include/spi_flash.h b/include/spi_flash.h index de4f174..1f8ba29 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -24,6 +24,7 @@ #define _SPI_FLASH_H_ #include +#include struct spi_flash_region { unsigned int count; -- cgit v0.10.2 From 425d3b666eee5c58fdb82fb894a535dd71782a05 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 3 Nov 2009 23:31:07 -0600 Subject: ppc: Move conditional compilation of kgdb.c to Makefile Signed-off-by: Peter Tyser diff --git a/lib_ppc/Makefile b/lib_ppc/Makefile index 399b41e..60a7625 100644 --- a/lib_ppc/Makefile +++ b/lib_ppc/Makefile @@ -35,7 +35,7 @@ COBJS-y += bootm.o COBJS-y += cache.o COBJS-y += extable.o COBJS-y += interrupts.o -COBJS-y += kgdb.o +COBJS-$(CONFIG_CMD_KGDB) += kgdb.o COBJS-y += time.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) diff --git a/lib_ppc/kgdb.c b/lib_ppc/kgdb.c index 78c2f0c..d3eb1f3 100644 --- a/lib_ppc/kgdb.c +++ b/lib_ppc/kgdb.c @@ -1,8 +1,5 @@ #include #include - -#if defined(CONFIG_CMD_KGDB) - #include #include #include @@ -322,5 +319,3 @@ kgdb_breakpoint(int argc, char *argv[]) breakinst: .long 0x7d821008\n\ "); } - -#endif -- cgit v0.10.2 From 8204e068110e8abe5db9c3b7df9971b58cda8f26 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 4 Nov 2009 16:03:25 -0500 Subject: tools: gitignore *.exe binaries Signed-off-by: Mike Frysinger diff --git a/tools/.gitignore b/tools/.gitignore index 03f54ef..cb067a4 100644 --- a/tools/.gitignore +++ b/tools/.gitignore @@ -8,3 +8,4 @@ /ncp /ubsha1 /inca-swap-bytes +/*.exe -- cgit v0.10.2 From fd66066ee3ce15c2966feb9b2be0f0d51a95db48 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 4 Nov 2009 16:13:19 -0500 Subject: img2srec: use standard types The img2srec code creates a lot of typedefs with common names. These easily clash with system headers that include these typedefs (like mingw). Signed-off-by: Mike Frysinger diff --git a/tools/img2srec.c b/tools/img2srec.c index f10379f..ec76964 100644 --- a/tools/img2srec.c +++ b/tools/img2srec.c @@ -53,6 +53,7 @@ |*************************************************************************/ #include "os_support.h" +#include #include #include #include @@ -63,63 +64,22 @@ #include /************************************************************************* -| DEFINES -|*************************************************************************/ - -#define FALSE 0 -#define TRUE 1 - -/************************************************************************* -| MACROS -|*************************************************************************/ - -/************************************************************************* -| TYPEDEFS -|*************************************************************************/ - -typedef uint8_t CHAR; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef int BOOL; - -/************************************************************************* -| LOCALS -|*************************************************************************/ - -/************************************************************************* -| PROTOTYPES -|*************************************************************************/ - -static char *ExtractHex(DWORD *value, char *getPtr); -static char *ExtractDecimal(DWORD *value, char *getPtr); -static void ExtractNumber(DWORD *value, char *getPtr); -static BYTE *ExtractWord(WORD *value, BYTE *buffer); -static BYTE *ExtractLong(DWORD *value, BYTE *buffer); -static BYTE *ExtractBlock(WORD count, BYTE *data, BYTE *buffer); -static char *WriteHex(char *pa, BYTE value, WORD *pCheckSum); -static char *BuildSRecord(char *pa, WORD sType, DWORD addr, - const BYTE *data, int nCount); -static void ConvertELF(char *fileName, DWORD loadOffset); -int main(int argc, char *argv[]); - -/************************************************************************* | FUNCTIONS |*************************************************************************/ -static char* ExtractHex (DWORD* value, char* getPtr) +static char* ExtractHex (uint32_t* value, char* getPtr) { - DWORD num; - DWORD digit; - BYTE c; + uint32_t num; + uint32_t digit; + uint8_t c; while (*getPtr == ' ') getPtr++; num = 0; for (;;) { c = *getPtr; - if ((c >= '0') && (c <= '9')) digit = (DWORD)(c - '0'); - else if ((c >= 'A') && (c <= 'F')) digit = (DWORD)(c - 'A' + 10); - else if ((c >= 'a') && (c <= 'f')) digit = (DWORD)(c - 'a' + 10); + if ((c >= '0') && (c <= '9')) digit = (uint32_t)(c - '0'); + else if ((c >= 'A') && (c <= 'F')) digit = (uint32_t)(c - 'A' + 10); + else if ((c >= 'a') && (c <= 'f')) digit = (uint32_t)(c - 'a' + 10); else break; num <<= 4; num += digit; @@ -129,17 +89,17 @@ static char* ExtractHex (DWORD* value, char* getPtr) return getPtr; } /* ExtractHex */ -static char* ExtractDecimal (DWORD* value, char* getPtr) +static char* ExtractDecimal (uint32_t* value, char* getPtr) { - DWORD num; - DWORD digit; - BYTE c; + uint32_t num; + uint32_t digit; + uint8_t c; while (*getPtr == ' ') getPtr++; num = 0; for (;;) { c = *getPtr; - if ((c >= '0') && (c <= '9')) digit = (DWORD)(c - '0'); + if ((c >= '0') && (c <= '9')) digit = (uint32_t)(c - '0'); else break; num *= 10; num += digit; @@ -150,13 +110,13 @@ static char* ExtractDecimal (DWORD* value, char* getPtr) } /* ExtractDecimal */ -static void ExtractNumber (DWORD* value, char* getPtr) +static void ExtractNumber (uint32_t* value, char* getPtr) { - BOOL neg = FALSE;; + bool neg = false;; while (*getPtr == ' ') getPtr++; if (*getPtr == '-') { - neg = TRUE; + neg = true; getPtr++; } /* if */ if ((*getPtr == '0') && ((*(getPtr+1) == 'x') || (*(getPtr+1) == 'X'))) { @@ -170,38 +130,38 @@ static void ExtractNumber (DWORD* value, char* getPtr) } /* ExtractNumber */ -static BYTE* ExtractWord(WORD* value, BYTE* buffer) +static uint8_t* ExtractWord(uint16_t* value, uint8_t* buffer) { - WORD x; - x = (WORD)*buffer++; - x = (x<<8) + (WORD)*buffer++; + uint16_t x; + x = (uint16_t)*buffer++; + x = (x<<8) + (uint16_t)*buffer++; *value = x; return buffer; } /* ExtractWord */ -static BYTE* ExtractLong(DWORD* value, BYTE* buffer) +static uint8_t* ExtractLong(uint32_t* value, uint8_t* buffer) { - DWORD x; - x = (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; - x = (x<<8) + (DWORD)*buffer++; + uint32_t x; + x = (uint32_t)*buffer++; + x = (x<<8) + (uint32_t)*buffer++; + x = (x<<8) + (uint32_t)*buffer++; + x = (x<<8) + (uint32_t)*buffer++; *value = x; return buffer; } /* ExtractLong */ -static BYTE* ExtractBlock(WORD count, BYTE* data, BYTE* buffer) +static uint8_t* ExtractBlock(uint16_t count, uint8_t* data, uint8_t* buffer) { while (count--) *data++ = *buffer++; return buffer; } /* ExtractBlock */ -static char* WriteHex(char* pa, BYTE value, WORD* pCheckSum) +static char* WriteHex(char* pa, uint8_t value, uint16_t* pCheckSum) { - WORD temp; + uint16_t temp; static char ByteToHex[] = "0123456789ABCDEF"; @@ -214,13 +174,13 @@ static char* WriteHex(char* pa, BYTE value, WORD* pCheckSum) } -static char* BuildSRecord(char* pa, WORD sType, DWORD addr, - const BYTE* data, int nCount) +static char* BuildSRecord(char* pa, uint16_t sType, uint32_t addr, + const uint8_t* data, int nCount) { - WORD addrLen; - WORD sRLen; - WORD checkSum; - WORD i; + uint16_t addrLen; + uint16_t sRLen; + uint16_t checkSum; + uint16_t i; switch (sType) { case 0: @@ -244,11 +204,11 @@ static char* BuildSRecord(char* pa, WORD sType, DWORD addr, *pa++ = (char)(sType + '0'); sRLen = addrLen + nCount + 1; checkSum = 0; - pa = WriteHex(pa, (BYTE)sRLen, &checkSum); + pa = WriteHex(pa, (uint8_t)sRLen, &checkSum); /* Write address field */ for (i = 1; i <= addrLen; i++) { - pa = WriteHex(pa, (BYTE)(addr >> (8 * (addrLen - i))), &checkSum); + pa = WriteHex(pa, (uint8_t)(addr >> (8 * (addrLen - i))), &checkSum); } /* for */ /* Write code/data fields */ @@ -258,25 +218,25 @@ static char* BuildSRecord(char* pa, WORD sType, DWORD addr, /* Write checksum field */ checkSum = ~checkSum; - pa = WriteHex(pa, (BYTE)checkSum, &checkSum); + pa = WriteHex(pa, (uint8_t)checkSum, &checkSum); *pa++ = '\0'; return pa; } -static void ConvertELF(char* fileName, DWORD loadOffset) +static void ConvertELF(char* fileName, uint32_t loadOffset) { FILE* file; int i; int rxCount; - BYTE rxBlock[1024]; - DWORD loadSize; - DWORD firstAddr; - DWORD loadAddr; - DWORD loadDiff = 0; + uint8_t rxBlock[1024]; + uint32_t loadSize; + uint32_t firstAddr; + uint32_t loadAddr; + uint32_t loadDiff = 0; Elf32_Ehdr elfHeader; Elf32_Shdr sectHeader[32]; - BYTE* getPtr; + uint8_t* getPtr; char srecLine[128]; char *hdr_name; @@ -292,11 +252,11 @@ static void ConvertELF(char* fileName, DWORD loadOffset) getPtr = ExtractBlock(sizeof elfHeader.e_ident, elfHeader.e_ident, rxBlock); getPtr = ExtractWord(&elfHeader.e_type, getPtr); getPtr = ExtractWord(&elfHeader.e_machine, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_version, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_entry, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_phoff, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_shoff, getPtr); - getPtr = ExtractLong((DWORD *)&elfHeader.e_flags, getPtr); + getPtr = ExtractLong((uint32_t *)&elfHeader.e_version, getPtr); + getPtr = ExtractLong((uint32_t *)&elfHeader.e_entry, getPtr); + getPtr = ExtractLong((uint32_t *)&elfHeader.e_phoff, getPtr); + getPtr = ExtractLong((uint32_t *)&elfHeader.e_shoff, getPtr); + getPtr = ExtractLong((uint32_t *)&elfHeader.e_flags, getPtr); getPtr = ExtractWord(&elfHeader.e_ehsize, getPtr); getPtr = ExtractWord(&elfHeader.e_phentsize, getPtr); getPtr = ExtractWord(&elfHeader.e_phnum, getPtr); @@ -319,16 +279,16 @@ static void ConvertELF(char* fileName, DWORD loadOffset) fseek(file, elfHeader.e_shoff, SEEK_SET); for (i = 0; i < elfHeader.e_shnum; i++) { rxCount = fread(rxBlock, 1, sizeof sectHeader[0], file); - getPtr = ExtractLong((DWORD *)§Header[i].sh_name, rxBlock); - getPtr = ExtractLong((DWORD *)§Header[i].sh_type, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_flags, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_addr, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_offset, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_size, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_link, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_info, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_addralign, getPtr); - getPtr = ExtractLong((DWORD *)§Header[i].sh_entsize, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_name, rxBlock); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_type, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_flags, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_addr, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_offset, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_size, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_link, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_info, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_addralign, getPtr); + getPtr = ExtractLong((uint32_t *)§Header[i].sh_entsize, getPtr); if (rxCount != sizeof sectHeader[0]) { fclose(file); fprintf (stderr, "*** illegal file format\n"); @@ -342,7 +302,7 @@ static void ConvertELF(char* fileName, DWORD loadOffset) ++hdr_name; } /* write start record */ - (void)BuildSRecord(srecLine, 0, 0, (BYTE *)hdr_name, strlen(hdr_name)); + (void)BuildSRecord(srecLine, 0, 0, (uint8_t *)hdr_name, strlen(hdr_name)); printf("%s\r\n",srecLine); /* write data records */ @@ -395,7 +355,7 @@ static void ConvertELF(char* fileName, DWORD loadOffset) int main( int argc, char *argv[ ]) { - DWORD offset; + uint32_t offset; if (argc == 2) { ConvertELF(argv[1], 0); -- cgit v0.10.2 From 824d82997fbcf28e49081d36fdd5d3be1b92b03d Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Wed, 4 Nov 2009 13:37:59 -0800 Subject: Fix example FIT image source files The example FIT image source files do not compile with the latest dtc and mkimage. The following error message is produced: DTC: dts->dtb on file "kernel.its" Error: kernel.its 7:0 - 1:0 syntax error FATAL ERROR: Unable to parse input tree ./mkimage: Can't read kernel.itb.tmp: Invalid argument The FIT image source files are missing the "/dts-v1/;" directive at the beginning of the file. Add the directive to the examples. Signed-off-by: Ira W. Snyder diff --git a/doc/uImage.FIT/kernel.its b/doc/uImage.FIT/kernel.its index d1a5939..ef3ab8f 100644 --- a/doc/uImage.FIT/kernel.its +++ b/doc/uImage.FIT/kernel.its @@ -1,6 +1,9 @@ /* * Simple U-boot uImage source file containing a single kernel */ + +/dts-v1/; + / { description = "Simple image with single Linux kernel"; #address-cells = <1>; diff --git a/doc/uImage.FIT/kernel_fdt.its b/doc/uImage.FIT/kernel_fdt.its index fd6dee2..7e940d2 100644 --- a/doc/uImage.FIT/kernel_fdt.its +++ b/doc/uImage.FIT/kernel_fdt.its @@ -1,6 +1,9 @@ /* * Simple U-boot uImage source file containing a single kernel and FDT blob */ + +/dts-v1/; + / { description = "Simple image with single Linux kernel and FDT blob"; #address-cells = <1>; diff --git a/doc/uImage.FIT/multi.its b/doc/uImage.FIT/multi.its index 1d8c2db..a120da0 100644 --- a/doc/uImage.FIT/multi.its +++ b/doc/uImage.FIT/multi.its @@ -1,6 +1,9 @@ /* * U-boot uImage source file with multiple kernels, ramdisks and FDT blobs */ + +/dts-v1/; + / { description = "Various kernels, ramdisks and FDT blobs"; #address-cells = <1>; diff --git a/doc/uImage.FIT/update3.its b/doc/uImage.FIT/update3.its index 285cf73..a6eaef6 100644 --- a/doc/uImage.FIT/update3.its +++ b/doc/uImage.FIT/update3.its @@ -1,6 +1,9 @@ /* * Example Automatic software update file. */ + +/dts-v1/; + / { description = "Automatic software updates: kernel, ramdisk, FDT"; #address-cells = <1>; diff --git a/doc/uImage.FIT/update_uboot.its b/doc/uImage.FIT/update_uboot.its index e0d27ea..846723e 100644 --- a/doc/uImage.FIT/update_uboot.its +++ b/doc/uImage.FIT/update_uboot.its @@ -2,6 +2,9 @@ * Automatic software update for U-Boot * Make sure the flashing addresses ('load' prop) is correct for your board! */ + +/dts-v1/; + / { description = "Automatic U-Boot update"; #address-cells = <1>; -- cgit v0.10.2 From deec1fbd4f704dded2e668bb9e368631981ea139 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Wed, 2 Dec 2009 22:26:30 +0100 Subject: MAINTAINERS: update responsible for MPC85xx/86xx Signed-off-by: Wolfgang Denk Cc: Kumar Gala Cc: Becky Bruce diff --git a/MAINTAINERS b/MAINTAINERS index d70a9d2..59599b8 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -277,7 +277,7 @@ Nye Liu ZUMA MPC7xx_74xx -Jon Loeliger +Kumar Gala MPC8540ADS MPC8540 MPC8560ADS MPC8560 -- cgit v0.10.2 From af860962b544ddf323c4ff68454f00d31e44df0a Mon Sep 17 00:00:00 2001 From: Becky Bruce Date: Wed, 4 Nov 2009 18:30:08 -0600 Subject: 85xx: Remove unused CONFIG_ASSUME_AMD_FLASH from config files A bunch of the 85xx boards have this cruft in them - it's not used anywhere. Delete it. Signed-off-by: Becky Bruce diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h index a847275..46d6e9d 100644 --- a/include/configs/MPC8536DS.h +++ b/include/configs/MPC8536DS.h @@ -70,13 +70,6 @@ #define CONFIG_TSEC_ENET /* tsec ethernet support */ #define CONFIG_ENV_OVERWRITE -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_board_sys_clk(unsigned long dummy); extern unsigned long get_board_ddr_clk(unsigned long dummy); diff --git a/include/configs/MPC8541CDS.h b/include/configs/MPC8541CDS.h index a8f206f..f41fe30 100644 --- a/include/configs/MPC8541CDS.h +++ b/include/configs/MPC8541CDS.h @@ -46,13 +46,6 @@ #define CONFIG_FSL_VIA -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h index 0caf456..b7d3553 100644 --- a/include/configs/MPC8544DS.h +++ b/include/configs/MPC8544DS.h @@ -50,13 +50,6 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_INTERRUPTS /* enable pci, srio, ddr interrupts */ -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_board_sys_clk(unsigned long dummy); #endif diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h index e69ba90..53de56d 100644 --- a/include/configs/MPC8548CDS.h +++ b/include/configs/MPC8548CDS.h @@ -52,13 +52,6 @@ #define CONFIG_FSL_VIA -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/include/configs/MPC8555CDS.h b/include/configs/MPC8555CDS.h index 94952dc..abbfd47 100644 --- a/include/configs/MPC8555CDS.h +++ b/include/configs/MPC8555CDS.h @@ -46,13 +46,6 @@ #define CONFIG_FSL_VIA -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/include/configs/MPC8568MDS.h b/include/configs/MPC8568MDS.h index 7b8c6c7..426b933 100644 --- a/include/configs/MPC8568MDS.h +++ b/include/configs/MPC8568MDS.h @@ -44,13 +44,6 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_FSL_LAW 1 /* Use common FSL init code */ -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the MDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif /*Replace a call to get_clock_freq (after it is implemented)*/ diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h index 17ea3bb..b87f375 100644 --- a/include/configs/MPC8569MDS.h +++ b/include/configs/MPC8569MDS.h @@ -44,13 +44,6 @@ #define CONFIG_ENV_OVERWRITE #define CONFIG_FSL_LAW 1 /* Use common FSL init code */ -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the MDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_clock_freq(void); #endif diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h index 000f8f6..0e7745c 100644 --- a/include/configs/MPC8572DS.h +++ b/include/configs/MPC8572DS.h @@ -53,13 +53,6 @@ #define CONFIG_TSEC_ENET /* tsec ethernet support */ #define CONFIG_ENV_OVERWRITE -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long get_board_sys_clk(unsigned long dummy); extern unsigned long get_board_ddr_clk(unsigned long dummy); diff --git a/include/configs/P2020DS.h b/include/configs/P2020DS.h index b48c199..9574fca 100644 --- a/include/configs/P2020DS.h +++ b/include/configs/P2020DS.h @@ -54,13 +54,6 @@ #define CONFIG_TSEC_ENET /* tsec ethernet support */ #define CONFIG_ENV_OVERWRITE -/* - * When initializing flash, if we cannot find the manufacturer ID, - * assume this is the AMD flash associated with the CDS board. - * This allows booting from a promjet. - */ -#define CONFIG_ASSUME_AMD_FLASH - #ifndef __ASSEMBLY__ extern unsigned long calculate_board_sys_clk(unsigned long dummy); extern unsigned long calculate_board_ddr_clk(unsigned long dummy); -- cgit v0.10.2 From 604f7ce55ad74694ef8743ad2e99933dc0265e46 Mon Sep 17 00:00:00 2001 From: Sanjeev Premi Date: Mon, 9 Nov 2009 22:43:00 +0530 Subject: Fix build failure in examples/standalone Some versions of 'make' do not handle trailing white-spaces properly. Trailing spaces in ELF causes a 'fake' source to be added to the variable COBJS; leading to build failure (listed below). The problem was found with GNU Make 3.80. Using text-function 'strip' as a workaround for the problem. make[1]: Entering directory `/home/sanjeev/u-boot/examples/standalone' arm-none-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e80000 -I/home/sanjeev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/codesourcery/2009q1- 203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/include -pipe -DCONFIG_ ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes -fno-stack-protector -g -Os -fno-common -ff ixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x80e80000 -I/home/sanje ev/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/co desourcery/2009q1-203/bin/../lib/gcc/arm-none-linux-gnueabi/4.3.3/includ e -pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux -mno-thumb-inte rwork -march=armv5 -I.. -Bstatic -T u-boot.lds -Ttext 0x80e80000 -o .c arm-none-linux-gnueabi-gcc: no input files make[1]: *** [.c] Error 1 make[1]: Leaving directory `/home/sanjeev/u-boot/examples/standalone' make: *** [examples/standalone] Error 2 premi # Signed-off-by: Sanjeev Premi Fixed typo (s/ElF/ELF/). Signed-off-by: Wolfgang Denk diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 5e2f2bc..6ea3b93 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -38,7 +38,13 @@ ELF-mpc8260 += mem_to_mem_idma2intr ELF-ppc += sched ELF-oxc += eepro100_eeprom -ELF := $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU)) +# +# Some versions of make do not handle trailing white spaces properly; +# leading to build failures. The problem was found with GNU Make 3.80. +# Using 'strip' as a workaround for the problem. +# +ELF := $(strip $(ELF-y) $(ELF-$(ARCH)) $(ELF-$(BOARD)) $(ELF-$(CPU))) + SREC = $(addsuffix .srec,$(ELF)) BIN = $(addsuffix .bin,$(ELF)) -- cgit v0.10.2 From 9ef78511cda39987e5fc10febf386fd19f58ecf7 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 9 Nov 2009 15:17:50 -0600 Subject: circbuf: Move to lib_generic and conditionally compile circbuf could be used as a generic library and is only currently needed when CONFIG_USB_TTY is defined. Signed-off-by: Peter Tyser diff --git a/common/Makefile b/common/Makefile index 3781738..47f6a71 100644 --- a/common/Makefile +++ b/common/Makefile @@ -29,7 +29,6 @@ AOBJS = # core COBJS-y += main.o -COBJS-y += circbuf.o COBJS-y += console.o COBJS-y += command.o COBJS-y += dlmalloc.o diff --git a/common/circbuf.c b/common/circbuf.c deleted file mode 100644 index 2332c63..0000000 --- a/common/circbuf.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * (C) Copyright 2003 - * Gerry Hamel, geh@ti.com, Texas Instruments - * - * 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 - - -int buf_init (circbuf_t * buf, unsigned int size) -{ - assert (buf != NULL); - - buf->size = 0; - buf->totalsize = size; - buf->data = (char *) malloc (sizeof (char) * size); - assert (buf->data != NULL); - - buf->top = buf->data; - buf->tail = buf->data; - buf->end = &(buf->data[size]); - - return 1; -} - -int buf_free (circbuf_t * buf) -{ - assert (buf != NULL); - assert (buf->data != NULL); - - free (buf->data); - memset (buf, 0, sizeof (circbuf_t)); - - return 1; -} - -int buf_pop (circbuf_t * buf, char *dest, unsigned int len) -{ - unsigned int i; - char *p = buf->top; - - assert (buf != NULL); - assert (dest != NULL); - - /* Cap to number of bytes in buffer */ - if (len > buf->size) - len = buf->size; - - for (i = 0; i < len; i++) { - dest[i] = *p++; - /* Bounds check. */ - if (p == buf->end) { - p = buf->data; - } - } - - /* Update 'top' pointer */ - buf->top = p; - buf->size -= len; - - return len; -} - -int buf_push (circbuf_t * buf, const char *src, unsigned int len) -{ - /* NOTE: this function allows push to overwrite old data. */ - unsigned int i; - char *p = buf->tail; - - assert (buf != NULL); - assert (src != NULL); - - for (i = 0; i < len; i++) { - *p++ = src[i]; - if (p == buf->end) { - p = buf->data; - } - /* Make sure pushing too much data just replaces old data */ - if (buf->size < buf->totalsize) { - buf->size++; - } else { - buf->top++; - if (buf->top == buf->end) { - buf->top = buf->data; - } - } - } - - /* Update 'tail' pointer */ - buf->tail = p; - - return len; -} diff --git a/lib_generic/Makefile b/lib_generic/Makefile index 686601c..2ec261a 100644 --- a/lib_generic/Makefile +++ b/lib_generic/Makefile @@ -31,6 +31,7 @@ COBJS-$(CONFIG_BZIP2) += bzlib_crctable.o COBJS-$(CONFIG_BZIP2) += bzlib_decompress.o COBJS-$(CONFIG_BZIP2) += bzlib_randtable.o COBJS-$(CONFIG_BZIP2) += bzlib_huffman.o +COBJS-$(CONFIG_USB_TTY) += circbuf.o COBJS-y += crc16.o COBJS-y += crc32.o COBJS-y += ctype.o diff --git a/lib_generic/circbuf.c b/lib_generic/circbuf.c new file mode 100644 index 0000000..2332c63 --- /dev/null +++ b/lib_generic/circbuf.c @@ -0,0 +1,110 @@ +/* + * (C) Copyright 2003 + * Gerry Hamel, geh@ti.com, Texas Instruments + * + * 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 + + +int buf_init (circbuf_t * buf, unsigned int size) +{ + assert (buf != NULL); + + buf->size = 0; + buf->totalsize = size; + buf->data = (char *) malloc (sizeof (char) * size); + assert (buf->data != NULL); + + buf->top = buf->data; + buf->tail = buf->data; + buf->end = &(buf->data[size]); + + return 1; +} + +int buf_free (circbuf_t * buf) +{ + assert (buf != NULL); + assert (buf->data != NULL); + + free (buf->data); + memset (buf, 0, sizeof (circbuf_t)); + + return 1; +} + +int buf_pop (circbuf_t * buf, char *dest, unsigned int len) +{ + unsigned int i; + char *p = buf->top; + + assert (buf != NULL); + assert (dest != NULL); + + /* Cap to number of bytes in buffer */ + if (len > buf->size) + len = buf->size; + + for (i = 0; i < len; i++) { + dest[i] = *p++; + /* Bounds check. */ + if (p == buf->end) { + p = buf->data; + } + } + + /* Update 'top' pointer */ + buf->top = p; + buf->size -= len; + + return len; +} + +int buf_push (circbuf_t * buf, const char *src, unsigned int len) +{ + /* NOTE: this function allows push to overwrite old data. */ + unsigned int i; + char *p = buf->tail; + + assert (buf != NULL); + assert (src != NULL); + + for (i = 0; i < len; i++) { + *p++ = src[i]; + if (p == buf->end) { + p = buf->data; + } + /* Make sure pushing too much data just replaces old data */ + if (buf->size < buf->totalsize) { + buf->size++; + } else { + buf->top++; + if (buf->top == buf->end) { + buf->top = buf->data; + } + } + } + + /* Update 'tail' pointer */ + buf->tail = p; + + return len; +} -- cgit v0.10.2 From 06015146a15adc7455440c491d543f6a8091551d Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Mon, 9 Nov 2009 15:18:52 -0600 Subject: m41t11: Remove unused functions Signed-off-by: Peter Tyser diff --git a/drivers/rtc/m41t11.c b/drivers/rtc/m41t11.c index e0c27e1..bb13487 100644 --- a/drivers/rtc/m41t11.c +++ b/drivers/rtc/m41t11.c @@ -181,18 +181,4 @@ void rtc_reset (void) val = val & 0x3F;/*turn off freq test keep calibration*/ i2c_write(CONFIG_SYS_I2C_RTC_ADDR, RTC_CONTROL_ADDR, 1, &val, 1); } - -int rtc_store(int addr, unsigned char* data, int size) -{ - /*don't let things wrap onto the time on a write*/ - if( (addr+size) >= M41T11_STORAGE_SZ ) - return 1; - return i2c_write( CONFIG_SYS_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size ); -} - -int rtc_recall(int addr, unsigned char* data, int size) -{ - return i2c_read( CONFIG_SYS_I2C_RTC_ADDR, REG_CNT+addr, 1, data, size ); -} - #endif -- cgit v0.10.2 From a5dd4dc64fe68e549c5ffcf6a048281b5ba94752 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Wed, 11 Nov 2009 10:36:19 -0600 Subject: cmd_license: Remove unneeded #ifdef CONFIG_CMD_LICENSE cmd_license is already conditionally compiled at the Makefile-level. Signed-off-by: Peter Tyser diff --git a/common/cmd_license.c b/common/cmd_license.c index 141215b..c6f272a 100644 --- a/common/cmd_license.c +++ b/common/cmd_license.c @@ -23,8 +23,6 @@ #include -#if defined(CONFIG_CMD_LICENSE) - /* COPYING is currently 15951 bytes in size */ #define LICENSE_MAX 20480 @@ -56,5 +54,3 @@ U_BOOT_CMD(license, 1, 1, do_license, "print GPL license text", "" ); - -#endif /* CONFIG_CMD_LICENSE */ -- cgit v0.10.2 From c253122395753abb9e531d8906c5265dc8803fb1 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Wed, 11 Nov 2009 10:36:28 -0600 Subject: Move do_irqinfo() to common/cmd_irq.c cmd_irq.c is a much better home and it is already conditionally compiled based on CONFIG_CMD_IRQ. Signed-off-by: Peter Tyser diff --git a/common/cmd_irq.c b/common/cmd_irq.c index 4604a5a..2c7e6bb 100644 --- a/common/cmd_irq.c +++ b/common/cmd_irq.c @@ -47,3 +47,12 @@ U_BOOT_CMD( "enable or disable interrupts", "[on, off]" ); + +/* Implemented in $(CPU)/interrupts.c */ +int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); + +U_BOOT_CMD( + irqinfo, 1, 1, do_irqinfo, + "print information about IRQs", + "" +); diff --git a/common/cmd_misc.c b/common/cmd_misc.c index b97537e..b0ced2f 100644 --- a/common/cmd_misc.c +++ b/common/cmd_misc.c @@ -49,17 +49,6 @@ int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) return 0; } -/* Implemented in $(CPU)/interrupts.c */ -#if defined(CONFIG_CMD_IRQ) -int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); - -U_BOOT_CMD( - irqinfo, 1, 1, do_irqinfo, - "print information about IRQs", - "" -); -#endif - U_BOOT_CMD( sleep , 2, 1, do_sleep, "delay execution for some time", -- cgit v0.10.2 From d52e3e0176a74c30549251e16c5c00a363c544d2 Mon Sep 17 00:00:00 2001 From: Magnus Lilja Date: Wed, 11 Nov 2009 19:56:36 +0100 Subject: cmd_date: Fix spelling in error message. Signed-off-by: Magnus Lilja diff --git a/common/cmd_date.c b/common/cmd_date.c index 9f50f89..3141a39 100644 --- a/common/cmd_date.c +++ b/common/cmd_date.c @@ -71,9 +71,9 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) /* and write to RTC */ rcode = rtc_set (&tm); if(rcode) - puts("## Set date failled\n"); + puts("## Set date failed\n"); } else { - puts("## Get date failled\n"); + puts("## Get date failed\n"); } } /* FALL TROUGH */ @@ -81,7 +81,7 @@ int do_date (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) rcode = rtc_get (&tm); if (rcode) { - puts("## Get date failled\n"); + puts("## Get date failed\n"); break; } -- cgit v0.10.2 From f3a7bddc06c927c36a1a99a97131299479ef207a Mon Sep 17 00:00:00 2001 From: Magnus Lilja Date: Wed, 11 Nov 2009 19:56:58 +0100 Subject: RTC: Fix return code in MC13783 RTC driver. Signed-off-by: Magnus Lilja diff --git a/drivers/rtc/mc13783-rtc.c b/drivers/rtc/mc13783-rtc.c index 05db2f1..416f50d 100644 --- a/drivers/rtc/mc13783-rtc.c +++ b/drivers/rtc/mc13783-rtc.c @@ -109,7 +109,7 @@ int rtc_set(struct rtc_time *rtc) spi_release_bus(slave); - return -1; + return 0; } void rtc_reset(void) -- cgit v0.10.2 From 64a480601a5614b441de692ae15a62c51e0bb381 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 11 Nov 2009 17:51:56 -0500 Subject: smc91111_eeprom: drop CONFIG stub protection Since the Makefile now controls the compilation of this, there is no need for CONFIG checking nor the stub function. Signed-off-by: Mike Frysinger diff --git a/examples/standalone/smc91111_eeprom.c b/examples/standalone/smc91111_eeprom.c index 89afc87..428ea7b 100644 --- a/examples/standalone/smc91111_eeprom.c +++ b/examples/standalone/smc91111_eeprom.c @@ -33,8 +33,6 @@ struct eth_device { unsigned long iobase; }; #include "../drivers/net/smc91111.h" -#ifdef CONFIG_SMC91111 - #ifndef SMC91111_EEPROM_INIT # define SMC91111_EEPROM_INIT() #endif @@ -391,13 +389,3 @@ void dump_reg (struct eth_device *dev) printf ("\n"); } } - -#else - -int smc91111_eeprom (int argc, char *argv[]) -{ - printf("Not supported for this board\n"); - return 1; -} - -#endif -- cgit v0.10.2 From bd3784df94bfeca43fbf34094df9cb1bd3ecca3b Mon Sep 17 00:00:00 2001 From: Pratap Chandu Date: Thu, 12 Nov 2009 19:28:25 +0530 Subject: Removes dead code in the file common/cmd_i2c.c There is some dead code enclosed by #if 0 .... #endif in the file common/cmd_i2c.c This patch removes the dead code. Signed-off-by: Pratap Chandu diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 8f0fc9e..8d6feda 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -326,14 +326,6 @@ int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) #if !defined(CONFIG_SYS_I2C_FRAM) udelay(11000); #endif - -#if 0 - for (timeout = 0; timeout < 10; timeout++) { - udelay(2000); - if (i2c_probe(chip) == 0) - break; - } -#endif } return (0); -- cgit v0.10.2 From ad53226156fa64b6d04c0d1d6e91e09979cbea15 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Tue, 17 Nov 2009 01:59:29 -0500 Subject: README: Update the list of directories. Bring the directory listing more into line with current content. Signed-off-by: Robert P. J. Day diff --git a/README b/README index 2c77687..1e1bccc 100644 --- a/README +++ b/README @@ -138,6 +138,7 @@ U-Boot will always have a patchlevel of "0". Directory Hierarchy: ==================== +- api Machine/arch independent API for external apps - board Board dependent files - common Misc architecture independent functions - cpu CPU specific files @@ -178,8 +179,8 @@ Directory Hierarchy: - disk Code for disk drive partition handling - doc Documentation (don't expect too much) - drivers Commonly used device drivers -- dtt Digital Thermometer and Thermostat drivers - examples Example code for standalone applications, etc. +- fs Filesystem code (cramfs, ext2, jffs2, etc.) - include Header Files - lib_arm Files generic to ARM architecture - lib_avr32 Files generic to AVR32 architecture @@ -187,9 +188,12 @@ Directory Hierarchy: - lib_generic Files generic to all architectures - lib_i386 Files generic to i386 architecture - lib_m68k Files generic to m68k architecture +- lib_microblaze Files generic to microblaze architecture - lib_mips Files generic to MIPS architecture - lib_nios Files generic to NIOS architecture +- lib_nios2 Files generic to NIOS2 architecture - lib_ppc Files generic to PowerPC architecture +- lib_sh Files generic to SH architecture - lib_sparc Files generic to SPARC architecture - libfdt Library files to support flattened device trees - net Networking code -- cgit v0.10.2 From bcb324d68f7955c1136dafc944eb55db8ebaa601 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Thu, 19 Nov 2009 11:00:28 -0500 Subject: Remove superfluous preprocessor tests from some cmd_*.c files. A small number of common/cmd_*.c files contain preprocessor tests that are apparently superfluous since those same tests are used in the Makefile to control the compilation of those files. Those tests are clearly redundant as long as they surround the entirety of the source in those files. Signed-off-by: Robert P. J. Day diff --git a/common/cmd_cache.c b/common/cmd_cache.c index 0dfa336..1202258 100644 --- a/common/cmd_cache.c +++ b/common/cmd_cache.c @@ -27,8 +27,6 @@ #include #include -#if defined(CONFIG_CMD_CACHE) - static int on_off (const char *); int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -108,5 +106,3 @@ U_BOOT_CMD( "[on, off]\n" " - enable or disable data (writethrough) cache" ); - -#endif diff --git a/common/cmd_mgdisk.c b/common/cmd_mgdisk.c index aadc335..3ba62f6 100644 --- a/common/cmd_mgdisk.c +++ b/common/cmd_mgdisk.c @@ -24,8 +24,6 @@ #include #include -#if defined (CONFIG_CMD_MG_DISK) - #include int do_mg_disk_cmd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) @@ -72,5 +70,3 @@ U_BOOT_CMD( " - sector read : mgd readsec [sector] [to] [counts]\n" " - sector write : mgd writesec [from] [sector] [counts]" ); - -#endif -- cgit v0.10.2 From 270737acca21f3939f814de5dcf350a1c3d80d83 Mon Sep 17 00:00:00 2001 From: Michael Brandt Date: Sun, 22 Nov 2009 14:13:27 +0100 Subject: EXT2FS: fix inode size for ext2fs rev#0 extfs.c assumes that there is always a valid inode_size field in the superblock. But this is not true for ext2fs rev 0. Such ext2fs images are for instance generated by genext2fs. Symptoms on ARM machines are messages like: "raise: Signal # 8 caught"; on PowerPC "ext2ls" will print nothing. This fix checks for rev 0 and uses then 128 bytes as inode size. Signed-off-by: Michael Brandt Tested on: TQM5200S Tested-by: Wolfgang Denk Signed-off-by: Wolfgang Denk diff --git a/fs/ext2/ext2fs.c b/fs/ext2/ext2fs.c index d54f60b..4b391d6 100644 --- a/fs/ext2/ext2fs.c +++ b/fs/ext2/ext2fs.c @@ -178,6 +178,7 @@ int indir1_blkno = -1; uint32_t *indir2_block = NULL; int indir2_size = 0; int indir2_blkno = -1; +static unsigned int inode_size; static int ext2fs_blockgroup @@ -212,7 +213,7 @@ static int ext2fs_read_inode unsigned int blkoff; #ifdef DEBUG - printf ("ext2fs read inode %d\n", ino); + printf ("ext2fs read inode %d, inode_size %d\n", ino, inode_size); #endif /* It is easier to calculate if the first inode is 0. */ ino--; @@ -222,16 +223,12 @@ static int ext2fs_read_inode return (0); } - inodes_per_block = EXT2_BLOCK_SIZE(data) / __le16_to_cpu(sblock->inode_size); - -#ifdef DEBUG - printf ("ext2fs read inode blkno %d blkoff %d\n", blkno, blkoff); -#endif + inodes_per_block = EXT2_BLOCK_SIZE(data) / inode_size; blkno = __le32_to_cpu (blkgrp.inode_table_id) + (ino % __le32_to_cpu (sblock->inodes_per_group)) / inodes_per_block; - blkoff = (ino % inodes_per_block) * __le16_to_cpu (sblock->inode_size); + blkoff = (ino % inodes_per_block) * inode_size; #ifdef DEBUG printf ("ext2fs read inode blkno %d blkoff %d\n", blkno, blkoff); #endif @@ -863,6 +860,15 @@ int ext2fs_mount (unsigned part_length) { if (__le16_to_cpu (data->sblock.magic) != EXT2_MAGIC) { goto fail; } + if (__le32_to_cpu(data->sblock.revision_level == 0)) { + inode_size = 128; + } else { + inode_size = __le16_to_cpu(data->sblock.inode_size); + } +#ifdef DEBUG + printf("EXT2 rev %d, inode_size %d\n", + __le32_to_cpu(data->sblock.revision_level), inode_size); +#endif data->diropen.data = data; data->diropen.ino = 2; data->diropen.inode_read = 1; -- cgit v0.10.2 From 1a99de2cb4d08eb3bf9fb3f60a9d533150de8c0e Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 24 Nov 2009 16:42:08 -0600 Subject: tools/mkimage: Assume FDT image type for FIT images When building a Flattened Image Tree (FIT) the image type needs to be "flat_dt". Commit 89a4d6b12fd6394898b8a454cbabeaf1cd59bae5 introduced a regression which caused the user to need to specify the "-T flat_dt" parameter on the command line when building a FIT image. The "-T flat_dt" parameter should not be needed and is at odds with the current FIT image documentation. Signed-off-by: Peter Tyser diff --git a/tools/mkimage.c b/tools/mkimage.c index 8a20594..2bf9a5b 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -232,6 +232,12 @@ main (int argc, char **argv) params.type = IH_TYPE_FLATDT; params.datafile = *++argv; params.fflag = 1; + + /* + * The flattened image tree (FIT) format + * requires a flattened device tree image type + */ + params.type = IH_TYPE_FLATDT; goto NXTARG; case 'n': if (--argc <= 0) -- cgit v0.10.2 From 8e1c89663cc8796b85588910046e03b388a7597c Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 24 Nov 2009 16:42:09 -0600 Subject: tools/fit_image.c: Remove unused fit_set_header() The FIT fit_set_header() function was copied from the standard uImage's image_set_header() function during mkimage reorganization. However, the fit_set_header() function is not used since FIT images use a standard device tree blob header. Signed-off-by: Peter Tyser diff --git a/tools/fit_image.c b/tools/fit_image.c index d1e612f..ef9ffee 100644 --- a/tools/fit_image.c +++ b/tools/fit_image.c @@ -155,38 +155,6 @@ static int fit_handle_file (struct mkimage_params *params) return (EXIT_SUCCESS); } -static void fit_set_header (void *ptr, struct stat *sbuf, int ifd, - struct mkimage_params *params) -{ - uint32_t checksum; - - image_header_t * hdr = (image_header_t *)ptr; - - checksum = crc32 (0, - (const unsigned char *)(ptr + - sizeof(image_header_t)), - sbuf->st_size - sizeof(image_header_t)); - - /* Build new header */ - image_set_magic (hdr, IH_MAGIC); - image_set_time (hdr, sbuf->st_mtime); - image_set_size (hdr, sbuf->st_size - sizeof(image_header_t)); - image_set_load (hdr, params->addr); - image_set_ep (hdr, params->ep); - image_set_dcrc (hdr, checksum); - image_set_os (hdr, params->os); - image_set_arch (hdr, params->arch); - image_set_type (hdr, params->type); - image_set_comp (hdr, params->comp); - - image_set_name (hdr, params->imagename); - - checksum = crc32 (0, (const unsigned char *)hdr, - sizeof(image_header_t)); - - image_set_hcrc (hdr, checksum); -} - static int fit_check_params (struct mkimage_params *params) { return ((params->dflag && (params->fflag || params->lflag)) || @@ -202,7 +170,7 @@ static struct image_type_params fitimage_params = { .print_header = fit_print_contents, .check_image_type = fit_check_image_types, .fflag_handle = fit_handle_file, - .set_header = fit_set_header, + .set_header = NULL, /* FIT images use DTB header */ .check_params = fit_check_params, }; -- cgit v0.10.2 From c81296c16fd9d12422c9968cc0f1d9bf440a7d88 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 24 Nov 2009 16:42:10 -0600 Subject: tools/mkimage: Print FIT image contents after creation Previously, there was no indication to the user that a FIT image was successfully created after executing mkimage. For example: $ mkimage -f uImage.its uImage.itb DTC: dts->dtb on file "uImage.its" Adding some additional output after creating a FIT image lets the user know exactly what is contained in their image, eg: $ mkimage -f uImage.its uImage.itb DTC: dts->dtb on file "uImage.its" FIT description: Linux kernel 2.6.32-rc7-00201-g7550d6f-dirty Created: Tue Nov 24 15:43:01 2009 Image 0 (kernel@1) Description: Linux Kernel 2.6.32-rc7-00201-g7550d6f-dirty Type: Kernel Image Compression: gzip compressed Data Size: 2707311 Bytes = 2643.86 kB = 2.58 MB Architecture: PowerPC OS: Linux Load Address: 0x00000000 Entry Point: 0x00000000 Hash algo: crc32 Hash value: efe0798b Hash algo: sha1 Hash value: ecafba8c95684f2c8fec67e33c41ec88df1534d7 Image 1 (fdt@1) Description: Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Size: 12288 Bytes = 12.00 kB = 0.01 MB Architecture: PowerPC Hash algo: crc32 Hash value: a5cab676 Hash algo: sha1 Hash value: 168722b13e305283cfd6603dfe8248cc329adea6 Default Configuration: 'config@1' Configuration 0 (config@1) Description: Default Linux kernel Kernel: kernel@1 FDT: fdt@1 This brings the behavior of creating a FIT image in line with creating a standard uImage, which also prints out the uImage contents after creation. Signed-off-by: Peter Tyser diff --git a/tools/mkimage.c b/tools/mkimage.c index 2bf9a5b..6826eae 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -299,23 +299,35 @@ NXTARG: ; params.imagefile = *argv; - if (!params.fflag){ - if (params.lflag) { - ifd = open (params.imagefile, O_RDONLY|O_BINARY); - } else { - ifd = open (params.imagefile, - O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666); - } + if (params.fflag){ + if (tparams->fflag_handle) + /* + * in some cases, some additional processing needs + * to be done if fflag is defined + * + * For ex. fit_handle_file for Fit file support + */ + retval = tparams->fflag_handle(¶ms); - if (ifd < 0) { - fprintf (stderr, "%s: Can't open %s: %s\n", - params.cmdname, params.imagefile, - strerror(errno)); - exit (EXIT_FAILURE); - } + if (retval != EXIT_SUCCESS) + exit (retval); + } + + if (params.lflag || params.fflag) { + ifd = open (params.imagefile, O_RDONLY|O_BINARY); + } else { + ifd = open (params.imagefile, + O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666); + } + + if (ifd < 0) { + fprintf (stderr, "%s: Can't open %s: %s\n", + params.cmdname, params.imagefile, + strerror(errno)); + exit (EXIT_FAILURE); } - if (params.lflag) { + if (params.lflag || params.fflag) { /* * list header information of existing image */ @@ -353,17 +365,6 @@ NXTARG: ; (void) close (ifd); exit (retval); - } else if (params.fflag) { - if (tparams->fflag_handle) - /* - * in some cases, some additional processing needs - * to be done if fflag is defined - * - * For ex. fit_handle_file for Fit file support - */ - retval = tparams->fflag_handle(¶ms); - - exit (retval); } /* -- cgit v0.10.2 From cccfc2ab77877dbdd2abe26b28d4c1f467feb0c0 Mon Sep 17 00:00:00 2001 From: Detlev Zundel Date: Tue, 1 Dec 2009 17:16:19 +0100 Subject: README: Rearrange paragraphs to regain linear arrangement. Two later additions to the Configuration Option section unfortunately split the description of Show boot progress and the list of its call outs. Signed-off-by: Detlev Zundel diff --git a/README b/README index 1e1bccc..8047c77 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ # -# (C) Copyright 2000 - 2008 +# (C) Copyright 2000 - 2009 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. # # See file CREDITS for list of people who contributed to this @@ -1893,25 +1893,6 @@ The following options need to be configured: example, some LED's) on your board. At the moment, the following checkpoints are implemented: -- Automatic software updates via TFTP server - CONFIG_UPDATE_TFTP - CONFIG_UPDATE_TFTP_CNT_MAX - CONFIG_UPDATE_TFTP_MSEC_MAX - - These options enable and control the auto-update feature; - for a more detailed description refer to doc/README.update. - -- MTD Support (mtdparts command, UBI support) - CONFIG_MTD_DEVICE - - Adds the MTD device infrastructure from the Linux kernel. - Needed for mtdparts command support. - - CONFIG_MTD_PARTITIONS - - Adds the MTD partitioning infrastructure from the Linux - kernel. Needed for UBI support. - Legacy uImage format: Arg Where When @@ -2065,6 +2046,25 @@ FIT uImage format: -150 common/cmd_nand.c Incorrect FIT image format 151 common/cmd_nand.c FIT image format OK +- Automatic software updates via TFTP server + CONFIG_UPDATE_TFTP + CONFIG_UPDATE_TFTP_CNT_MAX + CONFIG_UPDATE_TFTP_MSEC_MAX + + These options enable and control the auto-update feature; + for a more detailed description refer to doc/README.update. + +- MTD Support (mtdparts command, UBI support) + CONFIG_MTD_DEVICE + + Adds the MTD device infrastructure from the Linux kernel. + Needed for mtdparts command support. + + CONFIG_MTD_PARTITIONS + + Adds the MTD partitioning infrastructure from the Linux + kernel. Needed for UBI support. + Modem Support: -------------- -- cgit v0.10.2 From f68ab43de67f59925542efb6bcec30f4a84fe695 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 4 Dec 2009 05:35:15 -0500 Subject: lzma: ignore unset filesizes The Linux kernel build system changed how it compresses things with LZMA such that the header no longer contains the filesize (it is instead set to all F's). So if we get a LZMA image that has -1 for the 64bit field, let's just assume that the decompressed size is unknown and continue on. Signed-off-by: Mike Frysinger diff --git a/lib_generic/lzma/LzmaTools.c b/lib_generic/lzma/LzmaTools.c index 408b577..8860bfb 100644 --- a/lib_generic/lzma/LzmaTools.c +++ b/lib_generic/lzma/LzmaTools.c @@ -97,11 +97,14 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize, } else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) { /* * SizeT is a 32 bit uint => We cannot manage files larger than - * 4GB! + * 4GB! Assume however that all 0xf values is "unknown size" and + * not actually a file of 2^64 bits. * */ - debug ("LZMA: 64bit support not enabled.\n"); - return SZ_ERROR_DATA; + if (outSizeHigh != (SizeT)-1 || outSize != (SizeT)-1) { + debug ("LZMA: 64bit support not enabled.\n"); + return SZ_ERROR_DATA; + } } debug ("LZMA: Uncompresed size............ 0x%lx\n", outSizeFull); -- cgit v0.10.2