[U-Boot] [PATCH] net: dm9000x: re-add casts to I/O pointers to fix gcc warnings
The DM9000 in/out helper functions were casting the register address when it was accessing things directly (pre commit a45dde2293c816138e53c). But when it was changed to using the in/out helpers, those casts were dropped because those functions don't take pointers. Even more recently, those functions were then changed to use the read/write helpers, but the casts were not re-added. This is necessary because the read/write helpers do take pointers. Otherwise we get a lot of warnings like: dm9000x.c: In function 'dm9000_inblk_8bit': dm9000x.c:172: warning: passing argument 1 of 'readb' makes pointer from integer without a cast Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/net/dm9000x.c | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index 137e41f..709f67a 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value); /* DM9000 network board routine */ -#define DM9000_outb(d,r) writeb(d, r) -#define DM9000_outw(d,r) writew(d, r) -#define DM9000_outl(d,r) writel(d, r) -#define DM9000_inb(r) readb(r) -#define DM9000_inw(r) readw(r) -#define DM9000_inl(r) readl(r) +#define DM9000_outb(d,r) writeb(d, (volatile u8 *)(r)) +#define DM9000_outw(d,r) writew(d, (volatile u16 *)(r)) +#define DM9000_outl(d,r) writel(d, (volatile u32 *)(r)) +#define DM9000_inb(r) readb((volatile u8 *)(r)) +#define DM9000_inw(r) readw((volatile u16 *)(r)) +#define DM9000_inl(r) readl((volatile u32 *)(r)) #ifdef CONFIG_DM9000_DEBUG static void -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI)
Dear Reinhard, Could you please rebase your code to master@ git://git.denx.de/u-boot-at91.git ? Thanks! BR, Eric Reinhard Meyer (-VC) wrote: This patch adds support for the Atmel MultiMedia Card Interface (MCI) in AT91SAM9260 and AT91SAM9XE SoCs and preserves the original support for the AVR32AP700x SoCs. It patches the original atmel_mci.c driver to remove byte order and toolchain dependencies and makes it a common MCI driver for Atmels AVR32AP7000 and AT91SAM9260 based SoCs. The driver itself is not specific to those SoCs and should work with other Atmel devices having an identical MultiMedia Card Interface (MCI), provided the functions get_mci_clk_rate() and SoC_mci_hw_init() are defined. Tested on AT91SAM9XE-EK (AT91SAM9XE512) Tested on ATNGW100 (AVR32AP7000) Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de --- arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c | 20 arch/arm/include/asm/arch-at91/clk.h |5 + arch/arm/include/asm/arch-at91/hardware.h |1 + doc/README.atmel_mci | 68 + drivers/mmc/atmel_mci.c | 112 ++--- drivers/mmc/atmel_mci.h |6 +- include/mmc.h | 93 ++--- 7 files changed, 207 insertions(+), 98 deletions(-) create mode 100644 doc/README.atmel_mci ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] cmd_mmc: use common usage function
Rather than using a custom Usage:, use the common cmd_usage() function. Signed-off-by: Mike Frysinger vap...@gentoo.org --- common/cmd_mmc.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 698157f..329ef09 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -161,7 +161,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) case 0: case 1: case 4: - printf(Usage:\n%s\n, cmdtp-usage); + cmd_usage(cmdtp); return 1; case 2: @@ -218,7 +218,7 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) n, (n == cnt) ? OK : ERROR); return (n == cnt) ? 0 : 1; } else { - printf(Usage:\n%s\n, cmdtp-usage); + cmd_usage(cmdtp); rc = 1; } -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3 v8] mmc: add generic mmc spi driver
On Wednesday, May 19, 2010 00:37:47 Thomas Chou wrote: --- /dev/null +++ b/common/cmd_mmc_spi.c + printf(%s: %d at %u:%u %u %u\n, mmc-name, mmc-block_dev.dev, +bus, cs, speed, mode); this is a bit terse. how about prefixing the hz output with like hz: and the mode with like mode: ? +U_BOOT_CMD( + mmc_spi,4, 0, do_mmc_spi, + mmc_spi setup, + [bus:]cs [hz] [mode] - setup mmc_spi device on given\n + SPI bus and chip select\n +); there should be no newline at the end of the help string --- /dev/null +++ b/drivers/mmc/mmc_spi.c +struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode) +{ + struct mmc *mmc; + mmc-b_max = MMC_SPI_MAX_BLOCKS; do you have some local modification ? i dont see b_max anywhere in include/mmc.h ... unfortunately though, i tried this on my system and it doesnt seem to work. using a simple SPI-MMC card, the old mmc_spi driver works on my board, but booting the new u-boot and running the same things shows: bfin mmc_spi 4 3000 3 MMC_SPI: 0 at 0:4 3000 3 bfin mmc list MMC_SPI: 0 bfin mmcinfo Card did not respond to voltage select! Device: MMC_SPI Manufacturer ID: 0 OEM: 0 Name: Tran Speed: 0 Rd Block Len: 0 MMC version 0.0 High Capacity: No Capacity: 0 Bus Width: 1-bit enabling debugging in the driver shows this: bfin mmcinfo mmc_spi_init_p: clock 0 mmc_spi_set_ios: clock 0 mmc_spi_set_ios: clock 40 mmc_spi_request:cmd0 0 0 0 mmc_spi_sendcmd:cmd0 resp6 1 mmc_spi_request:cmd8 15 1aa 0 mmc_spi_sendcmd:cmd8 resp8 ff mmc_spi_request:cmd55 15 0 0 mmc_spi_sendcmd:cmd55 resp6 5 mmc_spi_request:cmd0 0 0 0 mmc_spi_sendcmd:cmd0 resp6 1 mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp4 1 mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp4 1 these last 2 lines repeat for a while Card did not respond to voltage select! ... -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] fix bug in get_ram_size()
Dear Wolfgang, 2010/6/28 ratbert.chu...@gmail.com: From: Po-Yu Chuang ratb...@faraday-tech.com memory content of base address was not restored Signed-off-by: Po-Yu Chuang ratb...@faraday-tech.com --- common/memsize.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/common/memsize.c b/common/memsize.c index 6c275c9..99469ab 100644 --- a/common/memsize.c +++ b/common/memsize.c @@ -74,6 +74,7 @@ long get_ram_size(volatile long *base, long maxsize) return (0); } + *addr = save[i]; for (cnt = 1; cnt maxsize / sizeof (long); cnt = 1) { addr = base + cnt; /* pointer arith! */ val = *addr; Did you get this patch? I think it is quite straightforward. If you have any concern, please let me know. regards, Po-Yu Chuang ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/2] i2c: soft_i2c: add simple GPIO implementation
Since the vast majority of GPIO I2C implementations behave the same way, support the common GPIO framework with default settings. This adds two new defines CONFIG_SOFT_I2C_GPIO_{SCL,SDA} so that boards which want GPIO I2C support need only define these. Signed-off-by: Mike Frysinger vap...@gentoo.org --- README | 10 ++ drivers/i2c/soft_i2c.c | 42 ++ 2 files changed, 52 insertions(+), 0 deletions(-) diff --git a/README b/README index a9c98f2..c9fb284 100644 --- a/README +++ b/README @@ -1495,6 +1495,16 @@ The following options need to be configured: #define I2C_DELAY udelay(2) + CONFIG_SOFT_I2C_GPIO_SCL / CONFIG_SOFT_I2C_GPIO_SDA + + If your arch supports the generic GPIO framework (asm/gpio.h), + then you may alternatively define the two GPIOs that are to be + used as SCL / SDA. Any of the previous I2C_xxx macros will + have GPIO-based defaults assigned to them as appropriate. + + You should define these to the GPIO value as given directly to + the generic GPIO functions. + CONFIG_SYS_I2C_INIT_BOARD When a board is reset during an i2c bus transfer diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index e0cf1e1..847db76 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -51,6 +51,48 @@ #endif #include i2c.h +#if defined(CONFIG_SOFT_I2C_GPIO_SCL) +# include asm/gpio.h + +# ifndef I2C_GPIO_SYNC +# define I2C_GPIO_SYNC +# endif + +# ifndef I2C_INIT +# define I2C_INIT \ + do { \ + gpio_request(CONFIG_SOFT_I2C_GPIO_SCL, soft_i2c); \ + gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SCL, 0); \ + gpio_request(CONFIG_SOFT_I2C_GPIO_SDA, soft_i2c); \ + } while (0) +# endif + +# ifndef I2C_ACTIVE +# define I2C_ACTIVE gpio_direction_output(CONFIG_SOFT_I2C_GPIO_SDA, 0) +# endif + +# ifndef I2C_TRISTATE +# define I2C_TRISTATE gpio_direction_input(CONFIG_SOFT_I2C_GPIO_SDA) +# endif + +# ifndef I2C_READ +# define I2C_READ (gpio_get_value(CONFIG_SOFT_I2C_GPIO_SDA) != 0) +# endif + +# ifndef I2C_SDA +# define I2C_SDA(bit) gpio_set_value(CONFIG_SOFT_I2C_GPIO_SDA, bit) +# endif + +# ifndef I2C_SCL +# define I2C_SCL(bit) gpio_set_value(CONFIG_SOFT_I2C_GPIO_SCL, bit) +# endif + +# ifndef I2C_DELAY +# define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ +# endif + +#endif + /* #define DEBUG_I2C */ #ifdef DEBUG_I2C -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code
Use the new common gpio framework to simplify and unify the soft i2c configuration settings. Signed-off-by: Mike Frysinger vap...@gentoo.org --- note: i can run this through the Blackfin tree if you want include/configs/bf533-ezkit.h | 43 +--- include/configs/bf533-stamp.h | 43 +--- include/configs/bf561-ezkit.h | 42 +-- include/configs/blackstamp.h | 28 + include/configs/ibf-dsp561.h | 29 +- 5 files changed, 10 insertions(+), 175 deletions(-) diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h index 37a7059..95d3afa 100644 --- a/include/configs/bf533-ezkit.h +++ b/include/configs/bf533-ezkit.h @@ -94,49 +94,10 @@ /* * I2C Settings - * By default PF1 is used as SDA and PF0 as SCL on the Stamp board */ #define CONFIG_SOFT_I2C -#ifdef CONFIG_SOFT_I2C -#define PF_SCL PF0 -#define PF_SDA PF1 -#define I2C_INIT \ - do { \ - *pFIO_DIR |= PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_ACTIVE \ - do { \ - *pFIO_DIR |= PF_SDA; \ - *pFIO_INEN = ~PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_TRISTATE \ - do { \ - *pFIO_DIR = ~PF_SDA; \ - *pFIO_INEN |= PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_READ ((*pFIO_FLAG_D PF_SDA) != 0) -#define I2C_SDA(bit) \ - do { \ - if (bit) \ - *pFIO_FLAG_S = PF_SDA; \ - else \ - *pFIO_FLAG_C = PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_SCL(bit) \ - do { \ - if (bit) \ - *pFIO_FLAG_S = PF_SCL; \ - else \ - *pFIO_FLAG_C = PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ - -#endif +#define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF0 +#define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF1 /* diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index 02c8bc3..f39bfee 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -138,49 +138,10 @@ /* * I2C Settings - * By default PF2 is used as SDA and PF3 as SCL on the Stamp board */ #define CONFIG_SOFT_I2C -#ifdef CONFIG_SOFT_I2C -#define PF_SCL PF3 -#define PF_SDA PF2 -#define I2C_INIT \ - do { \ - *pFIO_DIR |= PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_ACTIVE \ - do { \ - *pFIO_DIR |= PF_SDA; \ - *pFIO_INEN = ~PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_TRISTATE \ - do { \ - *pFIO_DIR = ~PF_SDA; \ - *pFIO_INEN |= PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_READ ((*pFIO_FLAG_D PF_SDA) != 0) -#define I2C_SDA(bit) \ - do { \ - if (bit) \ - *pFIO_FLAG_S = PF_SDA; \ - else \ - *pFIO_FLAG_C = PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_SCL(bit) \ - do { \ - if (bit) \ - *pFIO_FLAG_S = PF_SCL; \ - else \ - *pFIO_FLAG_C = PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ - -#endif +#define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF3 +#define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF2 /* diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h index 036bfe4..4e293b5 100644 --- a/include/configs/bf561-ezkit.h +++ b/include/configs/bf561-ezkit.h @@ -112,46 +112,8 @@ * I2C Settings */ #define CONFIG_SOFT_I2C -#ifdef CONFIG_SOFT_I2C -#define PF_SCL PF0 -#define PF_SDA PF1 -#define I2C_INIT \ - do { \ - *pFIO0_DIR |= PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_ACTIVE \ - do { \ - *pFIO0_DIR |= PF_SDA; \ - *pFIO0_INEN = ~PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_TRISTATE \ - do { \ - *pFIO0_DIR = ~PF_SDA; \ - *pFIO0_INEN |= PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_READ ((*pFIO0_FLAG_D PF_SDA) != 0) -#define I2C_SDA(bit) \ - do { \ - if (bit) \ - *pFIO0_FLAG_S = PF_SDA; \ - else \ - *pFIO0_FLAG_C = PF_SDA; \ - SSYNC(); \ - } while (0) -#define I2C_SCL(bit) \ - do { \ - if (bit) \ - *pFIO0_FLAG_S = PF_SCL; \ - else \ - *pFIO0_FLAG_C = PF_SCL; \ - SSYNC(); \ - } while (0) -#define I2C_DELAY
[U-Boot] [PATCH 1/2] mtd: nand_plat: add simple GPIO framework DEV_READY option
Make it easy to use GPIOs for the DEV_READY pin by using the common GPIO framework. Also make the NAND_PLAT_INIT() define optional. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/mtd/nand/nand_plat.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/mtd/nand/nand_plat.c b/drivers/mtd/nand/nand_plat.c index b35492b..37a0206 100644 --- a/drivers/mtd/nand/nand_plat.c +++ b/drivers/mtd/nand/nand_plat.c @@ -16,6 +16,10 @@ #include common.h #include asm/io.h +#ifdef NAND_PLAT_GPIO_DEV_READY +# include asm/gpio.h +# define NAND_PLAT_DEV_READY(chip) gpio_get_value(NAND_PLAT_GPIO_DEV_READY) +#endif #include nand.h @@ -43,7 +47,14 @@ static int plat_dev_ready(struct mtd_info *mtd) int board_nand_init(struct nand_chip *nand) { +#ifdef NAND_PLAT_GPIO_DEV_READY + gpio_request(NAND_PLAT_GPIO_DEV_READY, nand-plat); + gpio_direction_input(NAND_PLAT_GPIO_DEV_READY); +#endif + +#ifdef NAND_PLAT_INIT NAND_PLAT_INIT(); +#endif nand-cmd_ctrl = plat_cmd_ctrl; nand-dev_ready = plat_dev_ready; -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/2] Blackfin: convert plat-nand code to GPIO framework
Use the new GPIO framework code in both the Blackfin arch and the nand_plat driver to simplify things greatly. Signed-off-by: Mike Frysinger vap...@gentoo.org --- note: i can run this through the Blackfin tree if you want include/configs/bf537-pnav.h|9 + include/configs/bf537-stamp.h |9 + include/configs/bf561-acvilon.h |8 +--- include/configs/ip04.h | 10 +- 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/include/configs/bf537-pnav.h b/include/configs/bf537-pnav.h index 8daebc8..39bbb41 100644 --- a/include/configs/bf537-pnav.h +++ b/include/configs/bf537-pnav.h @@ -132,7 +132,6 @@ #define BFIN_NAND_CLE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 2)) #define BFIN_NAND_ALE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 1)) -#define BFIN_NAND_READY PF12 #define BFIN_NAND_WRITE(addr, cmd) \ do { \ bfin_write8(addr, cmd); \ @@ -141,13 +140,7 @@ #define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd) #define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd) -#define NAND_PLAT_DEV_READY(chip) (bfin_read_PORTHIO() BFIN_NAND_READY) -#define NAND_PLAT_INIT() \ - do { \ - bfin_write_PORTH_FER(bfin_read_PORTH_FER() ~BFIN_NAND_READY); \ - bfin_write_PORTHIO_DIR(bfin_read_PORTHIO_DIR() ~BFIN_NAND_READY); \ - bfin_write_PORTHIO_INEN(bfin_read_PORTHIO_INEN() | BFIN_NAND_READY); \ - } while (0) +#define NAND_PLAT_GPIO_DEV_READY GPIO_PF12 /* diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h index 3592862..96704d7 100644 --- a/include/configs/bf537-stamp.h +++ b/include/configs/bf537-stamp.h @@ -155,7 +155,6 @@ #define BFIN_NAND_CLE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 2)) #define BFIN_NAND_ALE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 1)) -#define BFIN_NAND_READY PF3 #define BFIN_NAND_WRITE(addr, cmd) \ do { \ bfin_write8(addr, cmd); \ @@ -164,13 +163,7 @@ #define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd) #define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd) -#define NAND_PLAT_DEV_READY(chip) (bfin_read_PORTFIO() BFIN_NAND_READY) -#define NAND_PLAT_INIT() \ - do { \ - bfin_write_PORTF_FER(bfin_read_PORTF_FER() ~BFIN_NAND_READY); \ - bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() ~BFIN_NAND_READY); \ - bfin_write_PORTFIO_INEN(bfin_read_PORTFIO_INEN() | BFIN_NAND_READY); \ - } while (0) +#define NAND_PLAT_GPIO_DEV_READY GPIO_PF3 /* diff --git a/include/configs/bf561-acvilon.h b/include/configs/bf561-acvilon.h index 0be170c..ed8d944 100644 --- a/include/configs/bf561-acvilon.h +++ b/include/configs/bf561-acvilon.h @@ -145,7 +145,6 @@ #define BFIN_NAND_CLE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 2)) #define BFIN_NAND_ALE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 3)) -#define BFIN_NAND_READY PF10 #define BFIN_NAND_WRITE(addr, cmd) \ do { \ bfin_write8(addr, cmd); \ @@ -154,12 +153,7 @@ #define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd) #define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd) -#define NAND_PLAT_DEV_READY(chip) (bfin_read_FIO0_FLAG_D() BFIN_NAND_READY) -#define NAND_PLAT_INIT() \ - do { \ - bfin_write_FIO0_DIR(bfin_read_FIO0_DIR() ~BFIN_NAND_READY); \ - bfin_write_FIO0_INEN(bfin_read_FIO0_INEN() | BFIN_NAND_READY); \ - } while (0) +#define NAND_PLAT_GPIO_DEV_READY GPIO_PF10 /* diff --git a/include/configs/ip04.h b/include/configs/ip04.h index 425a745..c024d78 100644 --- a/include/configs/ip04.h +++ b/include/configs/ip04.h @@ -116,7 +116,6 @@ #define BFIN_NAND_CLE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 2)) #define BFIN_NAND_ALE(chip) ((unsigned long)(chip)-IO_ADDR_W | (1 1)) -#define BFIN_NAND_READY PF10 #define BFIN_NAND_WRITE(addr, cmd) \ do { \ bfin_write8(addr, cmd); \ @@ -125,14 +124,7 @@ #define NAND_PLAT_WRITE_CMD(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_CLE(chip), cmd) #define NAND_PLAT_WRITE_ADR(chip, cmd) BFIN_NAND_WRITE(BFIN_NAND_ALE(chip), cmd) -#define NAND_PLAT_DEV_READY(chip) (bfin_read_FIO_FLAG_D() BFIN_NAND_READY) -#define NAND_PLAT_INIT() \ - do { \ - bfin_write_FIO_DIR(bfin_read_FIO_DIR() ~BFIN_NAND_READY); \ - bfin_write_FIO_INEN(bfin_read_FIO_INEN() | BFIN_NAND_READY); \ - bfin_write_FIO_EDGE(bfin_read_FIO_EDGE() ~BFIN_NAND_READY); \ - bfin_write_FIO_POLAR(bfin_read_FIO_POLAR() ~BFIN_NAND_READY); \ - } while (0) +#define NAND_PLAT_GPIO_DEV_READY GPIO_PF10 /* -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de
Re: [U-Boot] [PATCH v2] ARM: Align stack to 8 bytes
On 23 June 2010 05:20, Wolfgang Denk w...@denx.de wrote: Dear Vitaly Kuzmichev, In message 1276625891-22206-1-git-send-email-vkuzmic...@mvista.com you wrote: The ARM ABI requires that the stack be aligned to 8 bytes as it is noted in Procedure Call Standard for the ARM Architecture: http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042d/index.html Unaligned SP also causes the problem with variable-length arrays allocation when VLA address becomes less than stack pointer during aligning of this address, so the next 'push' in the stack overwrites first 4 bytes of VLA. Signed-off-by: Vitaly Kuzmichev vkuzmic...@mvista.com --- arch/arm/cpu/arm1136/start.S | 1 + arch/arm/cpu/arm1176/start.S | 1 + arch/arm/cpu/arm720t/start.S | 1 + arch/arm/cpu/arm920t/start.S | 1 + arch/arm/cpu/arm925t/start.S | 1 + arch/arm/cpu/arm926ejs/start.S | 2 +- arch/arm/cpu/arm946es/start.S | 1 + arch/arm/cpu/arm_cortexa8/start.S | 2 +- arch/arm/cpu/arm_intcm/start.S | 1 + arch/arm/cpu/ixp/start.S | 1 + arch/arm/cpu/lh7a40x/start.S | 1 + arch/arm/cpu/pxa/start.S | 1 + arch/arm/cpu/s3c44b0/start.S | 1 + arch/arm/cpu/sa1100/start.S | 1 + 14 files changed, 14 insertions(+), 2 deletions(-) This is a pretty intrusive patch as it affects all ARM architectures, but the change has been discussed here several times before, and the actual commit looks OK to me, too. Tested on tx25(mx25), imx27lite(mx27), qong(mx31) and trab(s3c2400) Tested-by: Wolfgang Denk w...@denx.de Applied to master (i. e. it will be included in -rc3, this release). ARM custodians: please help testing this! Tested on goni (s5pc110). It works fine. Thanks Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI)
Eric Xu schrieb: Dear Reinhard, Could you please rebase your code to master@ git://git.denx.de/u-boot-at91.git ? Thanks! BR, Eric Reinhard Meyer (-VC) wrote: This patch adds support for the Atmel MultiMedia Card Interface (MCI) in AT91SAM9260 and AT91SAM9XE SoCs and preserves the original support for the AVR32AP700x SoCs. Hi Eric, I am not a GIT specialist and working in the main GIT tree. How do I rebase into another tree? Does the patch not apply to your at91.git tree? Reinhard attachment: reinhard_meyer.vcf___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [U-BOOT][PATCH]mmc: modify setting tran_speed and change csd's instead of response value
Dear Andy, On 18 June 2010 15:59, Minkyu Kang proms...@gmail.com wrote: On 18 June 2010 15:13, Jaehoon Chung jh80.ch...@samsung.com wrote: This patch do the following 1. we need not use cmd.response, because we assinged cmd.response value to mmc-csd. 2. mmc_set_clock() is hard setting, that is not good solution and if mmc is not MMC_MODE_HS, mmc will set card's tran_speed. Signed-off-by: Jaehoon Chung jh80.ch...@samsung.com --- drivers/mmc/mmc.c | 19 ++- 1 files changed, 10 insertions(+), 9 deletions(-) Acked-by: Minkyu Kang mk7.k...@samsung.com Please let me know your opinion. Thanks. Minkyu Kang -- from. prom. www.promsoft.net ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 03/35] Blackfin: expand EVT1 usage documentation a bit more
Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/initcode.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c index 5f80ad6..9453d5d 100644 --- a/arch/blackfin/cpu/initcode.c +++ b/arch/blackfin/cpu/initcode.c @@ -675,7 +675,12 @@ void initcode(ADI_BOOT_DATA *bs) #ifdef CONFIG_BFIN_BOOTROM_USES_EVT1 serial_putc('I'); - /* tell the bootrom where our entry point is */ + /* Tell the bootrom where our entry point is so that it knows +* where to jump to when finishing processing the LDR. This +* allows us to avoid small jump blocks in the LDR, and also +* works around anomaly 05000389 (init address in external +* memory causes bootrom to trigger external addressing IVHW). +*/ if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS) bfin_write_EVT1(CONFIG_SYS_MONITOR_BASE); #endif -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 02/35] Blackfin: implement bootcount support
The default storage location for bootcount is EVT0. This version uses one 32bit value and combines the magic/count value in the upper/lower 16bits. If there is demand for more, should be easy to do. Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/Makefile|1 + arch/blackfin/cpu/bootcount.c | 34 ++ 2 files changed, 35 insertions(+), 0 deletions(-) create mode 100644 arch/blackfin/cpu/bootcount.c diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile index 211b8d5..50c1eea 100644 --- a/arch/blackfin/cpu/Makefile +++ b/arch/blackfin/cpu/Makefile @@ -17,6 +17,7 @@ EXTRA:= CEXTRA := initcode.o SEXTRA := start.o SOBJS:= interrupt.o cache.o +COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o COBJS-y += cpu.o COBJS-y += interrupts.o COBJS-$(CONFIG_JTAG_CONSOLE) += jtag-console.o diff --git a/arch/blackfin/cpu/bootcount.c b/arch/blackfin/cpu/bootcount.c new file mode 100644 index 000..6cf6dd5 --- /dev/null +++ b/arch/blackfin/cpu/bootcount.c @@ -0,0 +1,34 @@ +/* + * functions for handling bootcount support + * + * Copyright (c) 2010 Analog Devices Inc. + * + * Licensed under the 2-clause BSD. + */ + +/* This version uses one 32bit storage and combines the magic/count */ + +#include common.h + +/* We abuse the EVT0 MMR for bootcount storage by default */ +#ifndef CONFIG_SYS_BOOTCOUNT_ADDR +# define CONFIG_SYS_BOOTCOUNT_ADDR EVT0 +#endif + +#define MAGIC_MASK 0x +#define COUNT_MASK 0x + +void bootcount_store(ulong cnt) +{ + ulong magic = (BOOTCOUNT_MAGIC MAGIC_MASK) | (cnt COUNT_MASK); + bfin_write32(CONFIG_SYS_BOOTCOUNT_ADDR, magic); +} + +ulong bootcount_load(void) +{ + ulong magic = bfin_read32(CONFIG_SYS_BOOTCOUNT_ADDR); + if ((magic MAGIC_MASK) == (BOOTCOUNT_MAGIC MAGIC_MASK)) + return magic COUNT_MASK; + else + return 0; +} -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 00/35] Blackfin updates for 2010.09
A few minor bug fixes here and there, but the really exciting development is the import of the GPIO/PORTMUX layer from the Blackfin Linux port. This greatly simplifies code throughout the tree when device drivers need to do things through GPIOs or deal with pin muxing. Hoan Hoang (1): Blackfin: ibf-dsp561: enable AX88180 net driver Michael Hennerich (1): Blackfin: bf527-ad7160-eval: new board support Mike Frysinger (33): Blackfin: clean up trace buffer handling when crashing Blackfin: implement bootcount support Blackfin: expand EVT1 usage documentation a bit more Blackfin: bf537-stamp: drop old spi_flash driver Blackfin: update anomaly lists to latest sheets Blackfin: set up simple NMI handlers for anomaly 05000219 Blackfin: import gpio/portmux layer from Linux Blackfin: unify custom gpio commands Blackfin: back out status_led.h stubs Blackfin: switch to common GPIO LED driver Blackfin: bf537-stamp: use common spi boot workaround code Blackfin: convert gpio flash logic to common gpio layer Blackfin: bfin_mac: convert to portmux framework Blackfin: bfin_nand: convert to portmux framework Blackfin: bfin_sdh: convert to portmux framework Blackfin: pata_bfin: convert to portmux framework Blackfin: serial: convert to portmux framework Blackfin: bfin_spi: convert to portmux framework Blackfin: bfin_spi: support gpios as chip selects Blackfin: bf533-stamp: convert eth/flash swap logic to gpio framework Blackfin: blackstamp: convert eth/flash swap logic to gpio framework Blackfin: bf533-stamp: scrub unused code Blackfin: bf518f-ezbrd: handle different PHYs dynamically Blackfin: bf518f-ezbrd: convert to portmux framework Blackfin: bf548-ezkit: convert to portmux framework Blackfin: bf527-ezkit: convert to portmux framework Blackfin: cm-bf548: convert to portmux framework Blackfin: bf561: use DMA for Core B L1 regions Blackfin: unify default I2C settings for ADI boards Blackfin: bfin_mac: remove space from name Blackfin: enable IP defrag for ADI boards Blackfin: drop old u-boot.lds clean target Blackfin: bf561-acvilon: drop unused env redund define MAINTAINERS |2 + MAKEALL |1 + Makefile |1 - arch/blackfin/cpu/Makefile |3 + arch/blackfin/cpu/bootcount.c| 34 + arch/blackfin/cpu/cmd_gpio.c | 120 +++ arch/blackfin/cpu/cpu.c |4 +- arch/blackfin/cpu/cpu.h |2 + arch/blackfin/cpu/gpio.c | 854 arch/blackfin/cpu/initcode.c | 32 +- arch/blackfin/cpu/interrupt.S|5 + arch/blackfin/cpu/serial.h | 19 + arch/blackfin/cpu/traps.c| 76 +- arch/blackfin/include/asm/blackfin_local.h | 10 +- arch/blackfin/include/asm/gpio.h | 201 arch/blackfin/include/asm/mach-bf527/anomaly.h | 196 +++-- arch/blackfin/include/asm/mach-bf527/def_local.h |4 + arch/blackfin/include/asm/mach-bf527/gpio.h | 65 ++ arch/blackfin/include/asm/mach-bf527/portmux.h | 220 arch/blackfin/include/asm/mach-bf533/anomaly.h | 111 ++- arch/blackfin/include/asm/mach-bf533/def_local.h |4 + arch/blackfin/include/asm/mach-bf533/gpio.h | 31 + arch/blackfin/include/asm/mach-bf533/portmux.h | 71 ++ arch/blackfin/include/asm/mach-bf537/anomaly.h | 85 ++- arch/blackfin/include/asm/mach-bf537/def_local.h |4 + arch/blackfin/include/asm/mach-bf537/gpio.h | 65 ++ arch/blackfin/include/asm/mach-bf537/portmux.h | 152 +++ arch/blackfin/include/asm/mach-bf548/anomaly.h | 96 ++- arch/blackfin/include/asm/mach-bf548/def_local.h |4 + arch/blackfin/include/asm/mach-bf548/gpio.h | 203 arch/blackfin/include/asm/mach-bf548/portmux.h | 320 ++ arch/blackfin/include/asm/mach-bf561/anomaly.h | 132 ++- arch/blackfin/include/asm/mach-bf561/def_local.h |4 + arch/blackfin/include/asm/mach-bf561/gpio.h | 65 ++ arch/blackfin/include/asm/mach-bf561/portmux.h | 97 ++ arch/blackfin/include/asm/portmux.h | 1194 ++ arch/blackfin/include/asm/system.h |2 + board/bf518f-ezbrd/bf518f-ezbrd.c| 41 +- board/bf526-ezbrd/Makefile |1 - board/bf526-ezbrd/status-led.c | 56 - board/bf527-ad7160-eval/Makefile | 54 + board/bf527-ad7160-eval/bf527-ad7160-eval.c | 25 + board/bf527-ad7160-eval/config.mk| 33 + board/bf527-ezkit/bf527-ezkit.c |7 +- board/bf527-ezkit/video.c| 13 +- board/bf533-stamp/bf533-stamp.c | 84 +-- board/bf533-stamp/bf533-stamp.h |
[U-Boot] [PATCH 04/35] Blackfin: bf537-stamp: drop old spi_flash driver
The new common spi framework and spi flash subsystem provides all the same functionality as the old Blackfin-specific driver, so punt the old one as it has been sticking around long enough. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf537-stamp/Makefile|1 - board/bf537-stamp/spi_flash.c | 996 - 2 files changed, 0 insertions(+), 997 deletions(-) delete mode 100644 board/bf537-stamp/spi_flash.c diff --git a/board/bf537-stamp/Makefile b/board/bf537-stamp/Makefile index f728e2c..0e15062 100644 --- a/board/bf537-stamp/Makefile +++ b/board/bf537-stamp/Makefile @@ -31,7 +31,6 @@ LIB = $(obj)lib$(BOARD).a COBJS-y:= $(BOARD).o cmd_bf537led.o COBJS-$(CONFIG_BFIN_IDE) += ide-cf.o -COBJS-$(CONFIG_CMD_EEPROM) += spi_flash.o COBJS-$(CONFIG_POST) += post.o post-memory.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) diff --git a/board/bf537-stamp/spi_flash.c b/board/bf537-stamp/spi_flash.c deleted file mode 100644 index 7b753ad..000 --- a/board/bf537-stamp/spi_flash.c +++ /dev/null @@ -1,996 +0,0 @@ -/* - * SPI flash driver - * - * Enter bugs at http://blackfin.uclinux.org/ - * - * Copyright (c) 2005-2008 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -/* Configuration options: - * CONFIG_SPI_BAUD - value to load into SPI_BAUD (divisor of SCLK to get SPI CLK) - * CONFIG_SPI_FLASH_SLOW_READ - force usage of the slower read - * WARNING: make sure your SCLK + SPI_BAUD is slow enough - */ - -#include common.h -#include malloc.h -#include asm/io.h -#include asm/mach-common/bits/spi.h -#include asm/mach-common/bits/dma.h - -/* Forcibly phase out these */ -#ifdef CONFIG_SPI_FLASH_NUM_SECTORS -# error do not set CONFIG_SPI_FLASH_NUM_SECTORS -#endif -#ifdef CONFIG_SPI_FLASH_SECTOR_SIZE -# error do not set CONFIG_SPI_FLASH_SECTOR_SIZE -#endif - -#if defined(CONFIG_SPI) - -struct flash_info { - char *name; - uint16_t id; - uint16_t ext_id; - unsigned sector_size; - unsigned num_sectors; -}; - -/* SPI Speeds: 50 MHz / 33 MHz */ -static struct flash_info flash_spansion_serial_flash[] = { - { S25FL016, 0x0215, 0, 64 * 1024, 32 }, - { S25FL032, 0x0216, 0, 64 * 1024, 64 }, - { S25FL064, 0x0217, 0, 64 * 1024, 128 }, - { S25FL128-00, 0x2018, 0x0301, 64 * 1024, 256 },/* Package marking FL128PIF */ - { S25FL128-01, 0x2018, 0x0300, 128 * 1024, 64 },/* Package marking FL128PIFL */ - { NULL, 0, 0, 0, 0 } -}; - -/* SPI Speeds: 50 MHz / 20 MHz */ -static struct flash_info flash_st_serial_flash[] = { - { m25p05, 0x2010, 0, 32 * 1024, 2 }, - { m25p10, 0x2011, 0, 32 * 1024, 4 }, - { m25p20, 0x2012, 0, 64 * 1024, 4 }, - { m25p40, 0x2013, 0, 64 * 1024, 8 }, - { m25p80, 0x20FF, 0, 64 * 1024, 16 }, - { m25p16, 0x2015, 0, 64 * 1024, 32 }, - { m25p32, 0x2016, 0, 64 * 1024, 64 }, - { m25p64, 0x2017, 0, 64 * 1024, 128 }, - { m25p128, 0x2018, 0, 256 * 1024, 64 }, - { NULL, 0, 0, 0, 0 } -}; - -/* SPI Speeds: 20 MHz / 40 MHz */ -static struct flash_info flash_sst_serial_flash[] = { - { SST25WF512, 0x2501, 0, 4 * 1024, 128 }, - { SST25WF010, 0x2502, 0, 4 * 1024, 256 }, - { SST25WF020, 0x2503, 0, 4 * 1024, 512 }, - { SST25WF040, 0x2504, 0, 4 * 1024, 1024 }, - { NULL, 0, 0, 0, 0 } -}; - -/* SPI Speeds: 66 MHz / 33 MHz */ -static struct flash_info flash_atmel_dataflash[] = { - { AT45DB011x, 0x0c, 0, 264, 512 }, - { AT45DB021x, 0x14, 0, 264, 1025 }, - { AT45DB041x, 0x1c, 0, 264, 2048 }, - { AT45DB081x, 0x24, 0, 264, 4096 }, - { AT45DB161x, 0x2c, 0, 528, 4096 }, - { AT45DB321x, 0x34, 0, 528, 8192 }, - { AT45DB642x, 0x3c, 0, 1056, 8192 }, - { NULL, 0, 0, 0, 0 } -}; - -/* SPI Speed: 50 MHz / 25 MHz or 40 MHz / 20 MHz */ -static struct flash_info flash_winbond_serial_flash[] = { - { W25X10, 0x3011, 0, 16 * 256, 32 }, - { W25X20, 0x3012, 0, 16 * 256, 64 }, - { W25X40, 0x3013, 0, 16 * 256, 128 }, - { W25X80, 0x3014, 0, 16 * 256, 256 }, - { W25P80, 0x2014, 0, 256 * 256, 16 }, - { W25P16, 0x2015, 0, 256 * 256, 32 }, - { NULL, 0, 0, 0, 0 } -}; - -struct flash_ops { - uint8_t read, write, erase, status; -}; - -#ifdef CONFIG_SPI_FLASH_SLOW_READ -# define OP_READ 0x03 -#else -# define OP_READ 0x0B -#endif -static struct flash_ops flash_st_ops = { - .read = OP_READ, - .write = 0x02, - .erase = 0xD8, - .status = 0x05, -}; - -static struct flash_ops flash_sst_ops = { - .read = OP_READ, - .write = 0x02, - .erase = 0x20, - .status = 0x05, -}; - -static struct flash_ops flash_atmel_ops = { - .read = OP_READ, - .write = 0x82, - .erase = 0x81, - .status = 0xD7, -}; - -static struct flash_ops flash_winbond_ops = { - .read = OP_READ, - .write = 0x02, - .erase = 0x20, - .status = 0x05, -}; - -struct
[U-Boot] [PATCH 01/35] Blackfin: clean up trace buffer handling when crashing
Avoid banging on the trace MMRs when debugging is disabled, avoid calling the funcs multiple times in a row, disable the trace buffer earlier in the exception handler to avoid eating more user entries, and dump the buffer before calling the kgdb hook. This way we maximize useful debugging info up front rather than needing external tools (like gdb/serial/etc...). Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/cpu.h |1 + arch/blackfin/cpu/traps.c | 76 2 files changed, 49 insertions(+), 28 deletions(-) diff --git a/arch/blackfin/cpu/cpu.h b/arch/blackfin/cpu/cpu.h index 0a13c28..c8bec11 100644 --- a/arch/blackfin/cpu/cpu.h +++ b/arch/blackfin/cpu/cpu.h @@ -29,6 +29,7 @@ void board_reset(void) __attribute__((__weak__)); void bfin_reset_or_hang(void) __attribute__((__noreturn__)); +void bfin_dump(struct pt_regs *reg); void bfin_panic(struct pt_regs *reg); void dump(struct pt_regs *regs); diff --git a/arch/blackfin/cpu/traps.c b/arch/blackfin/cpu/traps.c index caaea94..09388aa 100644 --- a/arch/blackfin/cpu/traps.c +++ b/arch/blackfin/cpu/traps.c @@ -29,14 +29,26 @@ #include asm/deferred.h #include cpu.h +#ifdef CONFIG_DEBUG_DUMP +# define ENABLE_DUMP 1 +#else +# define ENABLE_DUMP 0 +#endif + #define trace_buffer_save(x) \ do { \ + if (!ENABLE_DUMP) \ + break; \ (x) = bfin_read_TBUFCTL(); \ bfin_write_TBUFCTL((x) ~TBUFEN); \ } while (0) #define trace_buffer_restore(x) \ - bfin_write_TBUFCTL((x)) + do { \ + if (!ENABLE_DUMP) \ + break; \ + bfin_write_TBUFCTL((x)); \ + } while (0); /* The purpose of this map is to provide a mapping of address-cplb settings * rather than an exact map of what is actually addressable on the part. This @@ -82,8 +94,16 @@ int trap_c(struct pt_regs *regs, uint32_t level) { uint32_t ret = 0; uint32_t trapnr = (regs-seqstat EXCAUSE); + unsigned long tflags; bool data = false; + /* +* Keep the trace buffer so that a miss here points people +* to the right place (their code). Crashes here rarely +* happen. If they do, only the Blackfin maintainer cares. +*/ + trace_buffer_save(tflags); + switch (trapnr) { /* 0x26 - Data CPLB Miss */ case VEC_CPLB_M: @@ -97,7 +117,7 @@ int trap_c(struct pt_regs *regs, uint32_t level) */ if (last_cplb_fault_retx != regs-retx) { last_cplb_fault_retx = regs-retx; - return ret; + break; } } @@ -110,7 +130,6 @@ int trap_c(struct pt_regs *regs, uint32_t level) uint32_t new_cplb_addr = 0, new_cplb_data = 0; static size_t last_evicted; size_t i; - unsigned long tflags; #ifdef CONFIG_EXCEPTION_DEFER /* This should never happen */ @@ -118,13 +137,6 @@ int trap_c(struct pt_regs *regs, uint32_t level) bfin_panic(regs); #endif - /* -* Keep the trace buffer so that a miss here points people -* to the right place (their code). Crashes here rarely -* happen. If they do, only the Blackfin maintainer cares. -*/ - trace_buffer_save(tflags); - new_cplb_addr = (data ? bfin_read_DCPLB_FAULT_ADDR() : bfin_read_ICPLB_FAULT_ADDR()) ~(4 * 1024 * 1024 - 1); for (i = 0; i ARRAY_SIZE(bfin_memory_map); ++i) { @@ -180,7 +192,6 @@ int trap_c(struct pt_regs *regs, uint32_t level) for (i = 0; i 16; ++i) debug(%2i 0x%p 0x%08X\n, i, *CPLB_ADDR++, *CPLB_DATA++); - trace_buffer_restore(tflags); break; } #ifdef CONFIG_CMD_KGDB @@ -208,23 +219,21 @@ int trap_c(struct pt_regs *regs, uint32_t level) #ifdef CONFIG_CMD_KGDB if (level == 3) { /* We need to handle this at EVT5, so try again */ + bfin_dump(regs); ret = 1; break; } if (debugger_exception_handler (*debugger_exception_handler)(regs)) - return 0; + break; #endif bfin_panic(regs); } + + trace_buffer_restore(tflags); + return ret; } -#ifdef CONFIG_DEBUG_DUMP -# define ENABLE_DUMP 1 -#else -# define ENABLE_DUMP 0 -#endif - #ifndef CONFIG_KALLSYMS const char *symbol_lookup(unsigned long addr, unsigned long *caddr) { @@ -364,17 +373,14 @@ void dump(struct pt_regs *fp) printf(\n); } -void dump_bfin_trace_buffer(void) +static void
[U-Boot] [PATCH 06/35] Blackfin: set up simple NMI handlers for anomaly 05000219
Older on-chip Blackfin bootroms do not create a dummy NMI handler, so set up one ourselves when anomaly 05000219 applies. Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/cpu.c |4 +++- arch/blackfin/cpu/cpu.h |1 + arch/blackfin/cpu/initcode.c | 25 + arch/blackfin/cpu/interrupt.S |5 + 4 files changed, 34 insertions(+), 1 deletions(-) diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c index 2c8fd86..18dbdf7 100644 --- a/arch/blackfin/cpu/cpu.c +++ b/arch/blackfin/cpu/cpu.c @@ -91,7 +91,9 @@ int irq_init(void) #else bfin_write_SIC_IMASK(0); #endif - bfin_write_EVT2(evt_default); /* NMI */ + /* Set up a dummy NMI handler if needed. */ + if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_BYPASS || ANOMALY_05000219) + bfin_write_EVT2(evt_nmi); /* NMI */ bfin_write_EVT5(evt_default); /* hardware error */ bfin_write_EVT6(evt_default); /* core timer */ bfin_write_EVT7(evt_default); diff --git a/arch/blackfin/cpu/cpu.h b/arch/blackfin/cpu/cpu.h index c8bec11..ba85e0b 100644 --- a/arch/blackfin/cpu/cpu.h +++ b/arch/blackfin/cpu/cpu.h @@ -34,6 +34,7 @@ void bfin_panic(struct pt_regs *reg); void dump(struct pt_regs *regs); asmlinkage void trap(void); +asmlinkage void evt_nmi(void); asmlinkage void evt_default(void); #endif diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c index 9453d5d..007f5ce 100644 --- a/arch/blackfin/cpu/initcode.c +++ b/arch/blackfin/cpu/initcode.c @@ -101,6 +101,28 @@ static inline void serial_putc(char c) continue; } +__attribute__((always_inline)) static inline void +program_nmi_handler(void) +{ + u32 tmp1, tmp2; + + /* Older bootroms don't create a dummy NMI handler, +* so make one ourselves ASAP in case it fires. +*/ + if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS !ANOMALY_05000219) + return; + + asm volatile ( + %0 = RETS; /* Save current RETS */ + CALL 1f; /* Figure out current PC */ + RTN; /* The simple NMI handler */ + 1: + %1 = RETS; /* Load addr of NMI handler */ + RETS = %0; /* Restore RETS */ + [%2] = %1; /* Write NMI handler */ + : =r(tmp1), =r(tmp2) : ab(EVT2) + ); +} /* Max SCLK can be 133MHz ... dividing that by (2*4) gives * us a freq of 16MHz for SPI which should generally be @@ -640,6 +662,9 @@ void initcode(ADI_BOOT_DATA *bs) { ADI_BOOT_DATA bootstruct_scratch; + /* Setup NMI handler before anything else */ + program_nmi_handler(); + serial_init(); serial_putc('A'); diff --git a/arch/blackfin/cpu/interrupt.S b/arch/blackfin/cpu/interrupt.S index 69bba3f..0e5e59e 100644 --- a/arch/blackfin/cpu/interrupt.S +++ b/arch/blackfin/cpu/interrupt.S @@ -150,3 +150,8 @@ ENTRY(_evt_default) RESTORE_ALL_SYS rti; ENDPROC(_evt_default) + +/* NMI handler */ +ENTRY(_evt_nmi) + rtn; +ENDPROC(_evt_nmi) -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 09/35] Blackfin: unify custom gpio commands
Now that we have a unified gpio layer, the misc partial gpio commands can be unified and made complete (support all possible gpios). Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/Makefile|1 + arch/blackfin/cpu/cmd_gpio.c | 120 ++ board/bf537-stamp/Makefile|2 +- board/bf537-stamp/cmd_bf537led.c | 201 - board/cm-bf527/Makefile |2 +- board/cm-bf527/gpio.c | 74 -- board/cm-bf537e/Makefile |2 +- board/cm-bf537e/flash.c | 34 -- board/cm-bf537u/Makefile |2 +- board/cm-bf537u/flash.c | 34 -- board/tcm-bf537/Makefile |2 +- board/tcm-bf537/flash.c | 37 --- include/configs/bf537-stamp.h |2 - include/configs/bfin_adi_common.h |1 + 14 files changed, 127 insertions(+), 387 deletions(-) create mode 100644 arch/blackfin/cpu/cmd_gpio.c delete mode 100644 board/bf537-stamp/cmd_bf537led.c delete mode 100644 board/cm-bf527/gpio.c delete mode 100644 board/cm-bf537e/flash.c delete mode 100644 board/cm-bf537u/flash.c delete mode 100644 board/tcm-bf537/flash.c diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile index 91797c7..b7f991d 100644 --- a/arch/blackfin/cpu/Makefile +++ b/arch/blackfin/cpu/Makefile @@ -18,6 +18,7 @@ CEXTRA := initcode.o SEXTRA := start.o SOBJS:= interrupt.o cache.o COBJS-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount.o +COBJS-$(CONFIG_CMD_GPIO) += cmd_gpio.o COBJS-y += cpu.o COBJS-y += gpio.o COBJS-y += interrupts.o diff --git a/arch/blackfin/cpu/cmd_gpio.c b/arch/blackfin/cpu/cmd_gpio.c new file mode 100644 index 000..9e505b6 --- /dev/null +++ b/arch/blackfin/cpu/cmd_gpio.c @@ -0,0 +1,120 @@ +/* + * Control GPIO pins on the fly + * + * Copyright (c) 2008-2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include common.h +#include command.h + +#include asm/blackfin.h +#include asm/gpio.h + +enum { + GPIO_INPUT, + GPIO_SET, + GPIO_CLEAR, + GPIO_TOGGLE, +}; + +int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ + if (argc == 2 !strcmp(argv[1], status)) { + bfin_gpio_labels(); + return 0; + } + + if (argc != 3) { + show_usage: + printf(Usage:\n%s\n, cmdtp-usage); + return 1; + } + + /* parse the behavior */ + ulong sub_cmd; + switch (argv[1][0]) { + case 'i': sub_cmd = GPIO_INPUT; break; + case 's': sub_cmd = GPIO_SET;break; + case 'c': sub_cmd = GPIO_CLEAR; break; + case 't': sub_cmd = GPIO_TOGGLE; break; + default: goto show_usage; + } + + /* parse the pin with format: [p][port]# */ + const char *str_pin = argv[2]; + + /* grab the [p]port portion */ + ulong port_base; + if (*str_pin == 'p') ++str_pin; + switch (*str_pin) { +#ifdef GPIO_PA0 + case 'a': port_base = GPIO_PA0; break; +#endif +#ifdef GPIO_PB0 + case 'b': port_base = GPIO_PB0; break; +#endif +#ifdef GPIO_PC0 + case 'c': port_base = GPIO_PC0; break; +#endif +#ifdef GPIO_PD0 + case 'd': port_base = GPIO_PD0; break; +#endif +#ifdef GPIO_PE0 + case 'e': port_base = GPIO_PE0; break; +#endif +#ifdef GPIO_PF0 + case 'f': port_base = GPIO_PF0; break; +#endif +#ifdef GPIO_PG0 + case 'g': port_base = GPIO_PG0; break; +#endif +#ifdef GPIO_PH0 + case 'h': port_base = GPIO_PH0; break; +#endif +#ifdef GPIO_PI0 + case 'i': port_base = GPIO_PI0; break; +#endif +#ifdef GPIO_PJ + case 'j': port_base = GPIO_PJ0; break; +#endif + default: goto show_usage; + } + + /* grab the # portion */ + ulong pin = simple_strtoul(str_pin + 1, NULL, 10); + if (pin 15) + goto show_usage; + + /* grab the pin before we tweak it */ + ulong gpio = port_base + pin; + gpio_request(gpio, cmd_gpio); + + /* finally, let's do it: set direction and exec command */ + if (sub_cmd == GPIO_INPUT) { + gpio_direction_input(gpio); + printf(gpio: pin %lu on port %c set to input\n, pin, *str_pin); + return 0; + } + + ulong value; + switch (sub_cmd) { + case GPIO_SET:value = 1; break; + case GPIO_CLEAR: value = 0; break; + case GPIO_TOGGLE: value = !gpio_get_value(gpio); break; + default: goto show_usage; + } + gpio_direction_output(gpio, value); + printf(gpio: pin %lu on port %c (gpio %lu) value is %lu\n, + pin, *str_pin, gpio, value); + + gpio_free(gpio); + + return 0; +} + +U_BOOT_CMD(gpio, 3, 0, do_gpio, +
[U-Boot] [PATCH 07/35] Blackfin: ibf-dsp561: enable AX88180 net driver
From: Hoan Hoang hnh...@i-syst.com Signed-off-by: Hoan Hoang hnh...@i-syst.com Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/ibf-dsp561/ibf-dsp561.c |8 include/configs/ibf-dsp561.h | 12 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/board/ibf-dsp561/ibf-dsp561.c b/board/ibf-dsp561/ibf-dsp561.c index b5bebd4..d2ac7a5 100644 --- a/board/ibf-dsp561/ibf-dsp561.c +++ b/board/ibf-dsp561/ibf-dsp561.c @@ -7,6 +7,7 @@ */ #include common.h +#include netdev.h DECLARE_GLOBAL_DATA_PTR; @@ -16,3 +17,10 @@ int checkboard(void) printf( Support: http://www.i-syst.com/\n;); return 0; } + +#ifdef CONFIG_DRIVER_AX88180 +int board_eth_init(bd_t *bis) +{ + return ax88180_initialize(bis); +} +#endif diff --git a/include/configs/ibf-dsp561.h b/include/configs/ibf-dsp561.h index 2eef5ef..5601416 100644 --- a/include/configs/ibf-dsp561.h +++ b/include/configs/ibf-dsp561.h @@ -58,6 +58,18 @@ /* + * Network Settings + */ +#define ADI_CMDS_NETWORK 1 +#define CONFIG_NET_MULTI +#define CONFIG_DRIVER_AX88180 1 +#define AX88180_BASE 0x2c00 +#define CONFIG_HOSTNAMEibf-dsp561 +/* Uncomment next line to use fixed MAC address */ +/* #define CONFIG_ETHADDR 02:80:ad:20:31:e8 */ + + +/* * Flash Settings */ #define CONFIG_SYS_FLASH_CFI /* The flash is CFI compatible */ -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 10/35] Blackfin: back out status_led.h stubs
When boards define CONFIG_BOARD_SPECIFIC_LED, the common led definitions are OK for Blackfin boards. So switch the few boards using these over to the common code. Signed-off-by: Mike Frysinger vap...@gentoo.org --- include/configs/bf526-ezbrd.h |6 -- include/configs/bf533-stamp.h |6 -- include/status_led.h |3 --- 3 files changed, 0 insertions(+), 15 deletions(-) diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h index 711fa27..52aeb5c 100644 --- a/include/configs/bf526-ezbrd.h +++ b/include/configs/bf526-ezbrd.h @@ -161,12 +161,6 @@ /* #define CONFIG_STATUS_LED */ #ifdef CONFIG_STATUS_LED #define CONFIG_BOARD_SPECIFIC_LED -#ifndef __ASSEMBLY__ -typedef unsigned int led_id_t; -void __led_init(led_id_t mask, int state); -void __led_set(led_id_t mask, int state); -void __led_toggle(led_id_t mask); -#endif /* use LED0 to indicate booting/alive */ #define STATUS_LED_BOOT 0 #define STATUS_LED_BIT 1 diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index 80c4884..d5e82ca 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -231,12 +231,6 @@ /* #define CONFIG_STATUS_LED */ #ifdef CONFIG_STATUS_LED #define CONFIG_BOARD_SPECIFIC_LED -#ifndef __ASSEMBLY__ -typedef unsigned int led_id_t; -void __led_init(led_id_t mask, int state); -void __led_set(led_id_t mask, int state); -void __led_toggle(led_id_t mask); -#endif /* use LED1 to indicate booting/alive */ #define STATUS_LED_BOOT 0 #define STATUS_LED_BIT 1 diff --git a/include/status_led.h b/include/status_led.h index 9dbf01f..f213595 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -346,9 +346,6 @@ void status_led_set (int led, int state); #elif defined(CONFIG_NIOS2) /* XXX empty just to avoid the error */ // -#elif defined(CONFIG_BLACKFIN) -/* XXX empty just to avoid the error */ -// #elif defined(CONFIG_V38B) # define STATUS_LED_BIT0x0010 /* Timer7 GPIO */ -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 11/35] Blackfin: switch to common GPIO LED driver
Now that we have a unified gpio layer, the different status led implementations can be switched to the common gpio led driver. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf526-ezbrd/Makefile |1 - board/bf526-ezbrd/status-led.c | 56 --- board/bf533-stamp/bf533-stamp.c | 37 - include/configs/bf526-ezbrd.h |6 +++- include/configs/bf533-stamp.h | 10 --- 5 files changed, 10 insertions(+), 100 deletions(-) delete mode 100644 board/bf526-ezbrd/status-led.c diff --git a/board/bf526-ezbrd/Makefile b/board/bf526-ezbrd/Makefile index a9ff760..f2bd2c2 100644 --- a/board/bf526-ezbrd/Makefile +++ b/board/bf526-ezbrd/Makefile @@ -30,7 +30,6 @@ include $(TOPDIR)/config.mk LIB= $(obj)lib$(BOARD).a COBJS-y:= $(BOARD).o -COBJS-$(CONFIG_STATUS_LED) += status-led.o SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) OBJS := $(addprefix $(obj),$(COBJS-y)) diff --git a/board/bf526-ezbrd/status-led.c b/board/bf526-ezbrd/status-led.c deleted file mode 100644 index 6327022..000 --- a/board/bf526-ezbrd/status-led.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * U-boot - status leds - * - * Copyright (c) 2005-2009 Analog Devices Inc. - * - * Licensed under the GPL-2 or later. - */ - -#include common.h -#include config.h -#include command.h -#include status_led.h - -static void set_led_f(int pf, int state) -{ - switch (state) { - case STATUS_LED_OFF: bfin_write_PORTFIO_CLEAR(pf); break; - case STATUS_LED_BLINKING: bfin_write_PORTFIO_TOGGLE(pf); break; - case STATUS_LED_ON: bfin_write_PORTFIO_SET(pf);break; - } -} -static void set_led_g(int pf, int state) -{ - switch (state) { - case STATUS_LED_OFF: bfin_write_PORTGIO_CLEAR(pf); break; - case STATUS_LED_BLINKING: bfin_write_PORTGIO_TOGGLE(pf); break; - case STATUS_LED_ON: bfin_write_PORTGIO_SET(pf);break; - } -} - -static void set_leds(led_id_t mask, int state) -{ - if (mask 0x1) set_led_f(PF8, state); - if (mask 0x2) set_led_g(PG11, state); - if (mask 0x4) set_led_g(PG12, state); -} - -void __led_init(led_id_t mask, int state) -{ - bfin_write_PORTF_FER(bfin_read_PORTF_FER() ~(PF8)); - bfin_write_PORTG_FER(bfin_read_PORTG_FER() ~(PG11 | PG12)); - bfin_write_PORTFIO_INEN(bfin_read_PORTFIO_INEN() ~(PF8)); - bfin_write_PORTGIO_INEN(bfin_read_PORTGIO_INEN() ~(PG11 | PG12)); - bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() | (PF8)); - bfin_write_PORTGIO_DIR(bfin_read_PORTGIO_DIR() | (PG11 | PG12)); -} - -void __led_set(led_id_t mask, int state) -{ - set_leds(mask, state); -} - -void __led_toggle(led_id_t mask) -{ - set_leds(mask, STATUS_LED_BLINKING); -} diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index 4abad08..fd10eae 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -134,43 +134,6 @@ void show_boot_progress(int status) } #endif -#ifdef CONFIG_STATUS_LED -#include status_led.h - -static void set_led(int pf, int state) -{ - switch (state) { - case STATUS_LED_OFF: bfin_write_FIO_FLAG_S(pf); break; - case STATUS_LED_BLINKING: bfin_write_FIO_FLAG_T(pf); break; - case STATUS_LED_ON: bfin_write_FIO_FLAG_C(pf); break; - } -} - -static void set_leds(led_id_t mask, int state) -{ - if (mask 0x1) set_led(PF2, state); - if (mask 0x2) set_led(PF3, state); - if (mask 0x4) set_led(PF4, state); -} - -void __led_init(led_id_t mask, int state) -{ - bfin_write_FIO_INEN(bfin_read_FIO_INEN() ~(PF2 | PF3 | PF4)); - bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4)); -} - -void __led_set(led_id_t mask, int state) -{ - set_leds(mask, state); -} - -void __led_toggle(led_id_t mask) -{ - set_leds(mask, STATUS_LED_BLINKING); -} - -#endif - #ifdef CONFIG_SMC9 int board_eth_init(bd_t *bis) { diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h index 52aeb5c..ecda216 100644 --- a/include/configs/bf526-ezbrd.h +++ b/include/configs/bf526-ezbrd.h @@ -160,17 +160,19 @@ /* define to enable run status via led */ /* #define CONFIG_STATUS_LED */ #ifdef CONFIG_STATUS_LED +#define CONFIG_GPIO_LED #define CONFIG_BOARD_SPECIFIC_LED /* use LED0 to indicate booting/alive */ #define STATUS_LED_BOOT 0 -#define STATUS_LED_BIT 1 +#define STATUS_LED_BIT GPIO_PF8 #define STATUS_LED_STATE STATUS_LED_ON #define STATUS_LED_PERIOD (CONFIG_SYS_HZ / 4) /* use LED1 to indicate crash */ #define STATUS_LED_CRASH 1 -#define STATUS_LED_BIT1 2 +#define STATUS_LED_BIT1 GPIO_PG11 #define STATUS_LED_STATE1 STATUS_LED_ON #define STATUS_LED_PERIOD1 (CONFIG_SYS_HZ / 2) +/* #define STATUS_LED_BIT2 GPIO_PG12 */ #endif diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
[U-Boot] [PATCH 12/35] Blackfin: bf537-stamp: use common spi boot workaround code
The common gpio code provides a function for handling the spi boot workaround logic, so switch over to that rather than bang on the gpio MMRs directly. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf537-stamp/bf537-stamp.c |7 ++- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c index 3911be6..ec888d4 100644 --- a/board/bf537-stamp/bf537-stamp.c +++ b/board/bf537-stamp/bf537-stamp.c @@ -46,11 +46,8 @@ int checkboard(void) void board_reset(void) { /* workaround for weak pull ups on ssel */ - if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER) { - bfin_write_PORTF_FER(bfin_read_PORTF_FER() ~PF10); - bfin_write_PORTFIO_SET(PF10); - udelay(1); - } + if (CONFIG_BFIN_BOOT_MODE == BFIN_BOOT_SPI_MASTER) + bfin_reset_boot_spi_cs(GPIO_PF10); } #ifdef CONFIG_BFIN_MAC -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 15/35] Blackfin: bfin_nand: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/mtd/nand/bfin_nand.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/nand/bfin_nand.c b/drivers/mtd/nand/bfin_nand.c index 6d3d450..3ee060f 100644 --- a/drivers/mtd/nand/bfin_nand.c +++ b/drivers/mtd/nand/bfin_nand.c @@ -26,6 +26,7 @@ #include nand.h #include asm/blackfin.h +#include asm/portmux.h /* Bit masks for NFC_CTL */ @@ -337,6 +338,12 @@ static struct nand_ecclayout bootrom_ecclayout = { */ int board_nand_init(struct nand_chip *chip) { + const unsigned short pins[] = { + P_NAND_CE, P_NAND_RB, P_NAND_D0, P_NAND_D1, P_NAND_D2, + P_NAND_D3, P_NAND_D4, P_NAND_D5, P_NAND_D6, P_NAND_D7, + P_NAND_WE, P_NAND_RE, P_NAND_CLE, P_NAND_ALE, 0, + }; + pr_stamp(); /* set width/ecc/timings/etc... */ @@ -347,14 +354,7 @@ int board_nand_init(struct nand_chip *chip) bfin_write_NFC_IRQSTAT(0x); /* enable GPIO function enable register */ -#ifdef __ADSPBF54x__ - bfin_write_PORTJ_FER(bfin_read_PORTJ_FER() | 6); -#elif defined(__ADSPBF52x__) - bfin_write_PORTH_FER(bfin_read_PORTH_FER() | 0xFCFF); - bfin_write_PORTH_MUX(0); -#else -# error no support for this variant -#endif + peripheral_request_list(pins, bfin_nand); chip-cmd_ctrl = bfin_nfc_cmd_ctrl; chip-read_buf = bfin_nfc_read_buf; -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 14/35] Blackfin: bfin_mac: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. While we're doing this, let boards declare the exact list of pins they need in case there is one or two they don't actually have hooked up. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/net/bfin_mac.c | 47 +++ 1 files changed, 11 insertions(+), 36 deletions(-) diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index 720e126..ee4ad6c 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -16,6 +16,7 @@ #include linux/mii.h #include asm/blackfin.h +#include asm/portmux.h #include asm/mach-common/bits/dma.h #include asm/mach-common/bits/emac.h #include asm/mach-common/bits/pll.h @@ -213,8 +214,17 @@ static int bfin_EMAC_recv(struct eth_device *dev) /* MDC = SCLK / MDC_freq / 2 - 1 */ #define MDC_FREQ_TO_DIV(mdc_freq) (get_sclk() / (mdc_freq) / 2 - 1) +#ifndef CONFIG_BFIN_MAC_PINS +# ifdef CONFIG_RMII +# define CONFIG_BFIN_MAC_PINS P_RMII0 +# else +# define CONFIG_BFIN_MAC_PINS P_MII0 +# endif +#endif + static int bfin_miiphy_init(struct eth_device *dev, int *opmode) { + const unsigned short pins[] = CONFIG_BFIN_MAC_PINS; u16 phydat; size_t count; @@ -222,42 +232,7 @@ static int bfin_miiphy_init(struct eth_device *dev, int *opmode) *pVR_CTL |= CLKBUFOE; /* Set all the pins to peripheral mode */ -#ifdef CONFIG_RMII - /* grab RMII pins */ -# if defined(__ADSPBF51x__) - *pPORTF_MUX = (*pPORTF_MUX \ - ~(PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \ - PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1; - *pPORTF_FER |= PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15; - *pPORTG_MUX = (*pPORTG_MUX ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1; - *pPORTG_FER |= PG0 | PG1 | PG2; -# elif defined(__ADSPBF52x__) - *pPORTG_MUX = (*pPORTG_MUX ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2; - *pPORTG_FER |= PG14 | PG15; - *pPORTH_MUX = (*pPORTH_MUX ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK)) | \ - PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2; - *pPORTH_FER |= PH0 | PH1 | PH2 | PH3 | PH4 | PH5 | PH6 | PH7 | PH8; -# else - *pPORTH_FER |= PH0 | PH1 | PH4 | PH5 | PH6 | PH8 | PH9 | PH14 | PH15; -# endif -#else - /* grab MII RMII pins */ -# if defined(__ADSPBF51x__) - *pPORTF_MUX = (*pPORTF_MUX \ - ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \ - PORT_x_MUX_0_FUNC_1 | PORT_x_MUX_1_FUNC_1 | PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1; - *pPORTF_FER |= PF0 | PF1 | PF2 | PF3 | PF4 | PF5 | PF6 | PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15; - *pPORTG_MUX = (*pPORTG_MUX ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1; - *pPORTG_FER |= PG0 | PG1 | PG2; -# elif defined(__ADSPBF52x__) - *pPORTG_MUX = (*pPORTG_MUX ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2; - *pPORTG_FER |= PG14 | PG15; - *pPORTH_MUX = PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2 | PORT_x_MUX_2_FUNC_2; - *pPORTH_FER = -1; /* all pins */ -# else - *pPORTH_FER = -1; /* all pins */ -# endif -#endif + peripheral_request_list(pins, bfin_mac); /* Odd word alignment for Receive Frame DMA word */ /* Configure checksum support and rcve frame word alignment */ -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 13/35] Blackfin: convert gpio flash logic to common gpio layer
Use the common gpio layer rather than bang on MMRs directly. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/cm-bf527/gpio_cfi_flash.c | 21 + board/cm-bf537e/gpio_cfi_flash.c | 18 -- board/cm-bf537u/gpio_cfi_flash.c | 18 -- board/tcm-bf537/gpio_cfi_flash.c | 20 +--- 4 files changed, 34 insertions(+), 43 deletions(-) diff --git a/board/cm-bf527/gpio_cfi_flash.c b/board/cm-bf527/gpio_cfi_flash.c index 7167680..f8ccc07 100644 --- a/board/cm-bf527/gpio_cfi_flash.c +++ b/board/cm-bf527/gpio_cfi_flash.c @@ -8,12 +8,13 @@ #include common.h #include asm/blackfin.h +#include asm/gpio.h #include asm/io.h #include gpio_cfi_flash.h -#define GPIO_PIN_1 PH9 +#define GPIO_PIN_1 GPIO_PH9 #define GPIO_MASK_1 (1 21) -#define GPIO_PIN_2 PG11 +#define GPIO_PIN_2 GPIO_PG11 #define GPIO_MASK_2 (1 22) #define GPIO_MASK (GPIO_MASK_1 | GPIO_MASK_2) @@ -21,16 +22,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr) { unsigned long addr = (unsigned long)vaddr; - if (addr GPIO_MASK_1) - bfin_write_PORTHIO_SET(GPIO_PIN_1); - else - bfin_write_PORTHIO_CLEAR(GPIO_PIN_1); + gpio_set_value(GPIO_PIN_1, addr GPIO_MASK_1); #ifdef GPIO_MASK_2 - if (addr GPIO_MASK_2) - bfin_write_PORTGIO_SET(GPIO_PIN_2); - else - bfin_write_PORTGIO_CLEAR(GPIO_PIN_2); + gpio_set_value(GPIO_PIN_2, addr GPIO_MASK_2); #endif SSYNC(); @@ -57,7 +52,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */ void gpio_cfi_flash_init(void) { - bfin_write_PORTHIO_DIR(bfin_read_PORTHIO_DIR() | GPIO_PIN_1); - bfin_write_PORTGIO_DIR(bfin_read_PORTGIO_DIR() | GPIO_PIN_2); + gpio_request(GPIO_PIN_1, gpio_cfi_flash); +#ifdef GPIO_MASK_2 + gpio_request(GPIO_PIN_2, gpio_cfi_flash); +#endif gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE); } diff --git a/board/cm-bf537e/gpio_cfi_flash.c b/board/cm-bf537e/gpio_cfi_flash.c index a9e69cf..79ee844 100644 --- a/board/cm-bf537e/gpio_cfi_flash.c +++ b/board/cm-bf537e/gpio_cfi_flash.c @@ -8,10 +8,11 @@ #include common.h #include asm/blackfin.h +#include asm/gpio.h #include asm/io.h #include gpio_cfi_flash.h -#define GPIO_PIN_1 PF4 +#define GPIO_PIN_1 GPIO_PF4 #define GPIO_MASK_1 (1 21) #define GPIO_MASK (GPIO_MASK_1) @@ -19,16 +20,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr) { unsigned long addr = (unsigned long)vaddr; - if (addr GPIO_MASK_1) - bfin_write_PORTFIO_SET(GPIO_PIN_1); - else - bfin_write_PORTFIO_CLEAR(GPIO_PIN_1); + gpio_set_value(GPIO_PIN_1, addr GPIO_MASK_1); #ifdef GPIO_MASK_2 - if (addr GPIO_MASK_2) - bfin_write_PORTGIO_SET(GPIO_PIN_2); - else - bfin_write_PORTGIO_CLEAR(GPIO_PIN_2); + gpio_set_value(GPIO_PIN_2, addr GPIO_MASK_2); #endif SSYNC(); @@ -55,6 +50,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */ void gpio_cfi_flash_init(void) { - bfin_write_PORTFIO_DIR(bfin_read_PORTFIO_DIR() | GPIO_PIN_1); + gpio_request(GPIO_PIN_1, gpio_cfi_flash); +#ifdef GPIO_MASK_2 + gpio_request(GPIO_PIN_2, gpio_cfi_flash); +#endif gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE); } diff --git a/board/cm-bf537u/gpio_cfi_flash.c b/board/cm-bf537u/gpio_cfi_flash.c index 68633ec..416c689 100644 --- a/board/cm-bf537u/gpio_cfi_flash.c +++ b/board/cm-bf537u/gpio_cfi_flash.c @@ -8,10 +8,11 @@ #include common.h #include asm/blackfin.h +#include asm/gpio.h #include asm/io.h #include gpio_cfi_flash.h -#define GPIO_PIN_1 PH0 +#define GPIO_PIN_1 GPIO_PH0 #define GPIO_MASK_1 (1 21) #define GPIO_MASK (GPIO_MASK_1) @@ -19,16 +20,10 @@ void *gpio_cfi_flash_swizzle(void *vaddr) { unsigned long addr = (unsigned long)vaddr; - if (addr GPIO_MASK_1) - bfin_write_PORTHIO_SET(GPIO_PIN_1); - else - bfin_write_PORTHIO_CLEAR(GPIO_PIN_1); + gpio_set_value(GPIO_PIN_1, addr GPIO_MASK_1); #ifdef GPIO_MASK_2 - if (addr GPIO_MASK_2) - bfin_write_PORTGIO_SET(GPIO_PIN_2); - else - bfin_write_PORTGIO_CLEAR(GPIO_PIN_2); + gpio_set_value(GPIO_PIN_2, addr GPIO_MASK_2); #endif SSYNC(); @@ -55,6 +50,9 @@ MAKE_FLASH(64, q) /* flash_write64() flash_read64() */ void gpio_cfi_flash_init(void) { - bfin_write_PORTHIO_DIR(bfin_read_PORTHIO_DIR() | GPIO_PIN_1); + gpio_request(GPIO_PIN_1, gpio_cfi_flash); +#ifdef GPIO_MASK_2 + gpio_request(GPIO_PIN_2, gpio_cfi_flash); +#endif gpio_cfi_flash_swizzle((void *)CONFIG_SYS_FLASH_BASE); } diff --git a/board/tcm-bf537/gpio_cfi_flash.c b/board/tcm-bf537/gpio_cfi_flash.c index ac8587c..08ea7af 100644 --- a/board/tcm-bf537/gpio_cfi_flash.c +++ b/board/tcm-bf537/gpio_cfi_flash.c @@ -8,12 +8,13 @@ #include common.h #include
[U-Boot] [PATCH 16/35] Blackfin: bfin_sdh: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/mmc/bfin_sdh.c | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/bfin_sdh.c b/drivers/mmc/bfin_sdh.c index f9d560a..4a9 100644 --- a/drivers/mmc/bfin_sdh.c +++ b/drivers/mmc/bfin_sdh.c @@ -15,6 +15,7 @@ #include asm/errno.h #include asm/byteorder.h #include asm/blackfin.h +#include asm/portmux.h #include asm/mach-common/bits/sdh.h #include asm/mach-common/bits/dma.h @@ -41,11 +42,15 @@ # define bfin_write_DMA_X_COUNTbfin_write_DMA4_X_COUNT # define bfin_write_DMA_X_MODIFY bfin_write_DMA4_X_MODIFY # define bfin_write_DMA_CONFIG bfin_write_DMA4_CONFIG +# define PORTMUX_PINS \ + { P_RSI_DATA0, P_RSI_DATA1, P_RSI_DATA2, P_RSI_DATA3, P_RSI_CMD, P_RSI_CLK, 0 } #elif defined(__ADSPBF54x__) # define bfin_write_DMA_START_ADDR bfin_write_DMA22_START_ADDR # define bfin_write_DMA_X_COUNTbfin_write_DMA22_X_COUNT # define bfin_write_DMA_X_MODIFY bfin_write_DMA22_X_MODIFY # define bfin_write_DMA_CONFIG bfin_write_DMA22_CONFIG +# define PORTMUX_PINS \ + { P_SD_D0, P_SD_D1, P_SD_D2, P_SD_D3, P_SD_CLK, P_SD_CMD, 0 } #else # error no support for this proc yet #endif @@ -208,18 +213,13 @@ static void bfin_sdh_set_ios(struct mmc *mmc) static int bfin_sdh_init(struct mmc *mmc) { - + const unsigned short pins[] = PORTMUX_PINS; u16 pwr_ctl = 0; -/* Initialize sdh controller */ + + /* Initialize sdh controller */ + peripheral_request_list(pins, bfin_sdh); #if defined(__ADSPBF54x__) bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() | 0x1); - bfin_write_PORTC_FER(bfin_read_PORTC_FER() | 0x3F00); - bfin_write_PORTC_MUX(bfin_read_PORTC_MUX() ~0xFFF); -#elif defined(__ADSPBF51x__) - bfin_write_PORTG_FER(bfin_read_PORTG_FER() | 0x01F8); - bfin_write_PORTG_MUX((bfin_read_PORTG_MUX() ~0x3FC) | 0x154); -#else -# error no portmux for this proc yet #endif bfin_write_SDH_CFG(bfin_read_SDH_CFG() | CLKS_EN); /* Disable card detect pin */ -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 17/35] Blackfin: pata_bfin: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/block/pata_bfin.c | 25 - 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/block/pata_bfin.c b/drivers/block/pata_bfin.c index f16dabe..847c032 100644 --- a/drivers/block/pata_bfin.c +++ b/drivers/block/pata_bfin.c @@ -14,6 +14,7 @@ #include asm/byteorder.h #include asm/io.h #include asm/errno.h +#include asm/portmux.h #include asm/mach-common/bits/pata.h #include ata.h #include libata.h @@ -769,19 +770,17 @@ static int bfin_ata_reset_port(struct ata_port *ap) */ static int bfin_config_atapi_gpio(struct ata_port *ap) { - bfin_write_PORTH_FER(bfin_read_PORTH_FER() | 0x4); - bfin_write_PORTH_MUX(bfin_read_PORTH_MUX() ~0x30); - bfin_write_PORTH_DIR_SET(0x4); - - bfin_write_PORTJ_FER(0x7f8); - bfin_write_PORTJ_MUX(bfin_read_PORTI_MUX() ~0x3fffc0); - bfin_write_PORTJ_DIR_SET(0x5f8); - bfin_write_PORTJ_DIR_CLEAR(0x200); - bfin_write_PORTJ_INEN(0x200); - - bfin_write_PINT2_ASSIGN(0x0707); - bfin_write_PINT2_MASK_SET(0x200); - SSYNC(); + const unsigned short pins[] = { + P_ATAPI_RESET, P_ATAPI_DIOR, P_ATAPI_DIOW, P_ATAPI_CS0, + P_ATAPI_CS1, P_ATAPI_DMACK, P_ATAPI_DMARQ, P_ATAPI_INTRQ, + P_ATAPI_IORDY, P_ATAPI_D0A, P_ATAPI_D1A, P_ATAPI_D2A, + P_ATAPI_D3A, P_ATAPI_D4A, P_ATAPI_D5A, P_ATAPI_D6A, + P_ATAPI_D7A, P_ATAPI_D8A, P_ATAPI_D9A, P_ATAPI_D10A, + P_ATAPI_D11A, P_ATAPI_D12A, P_ATAPI_D13A, P_ATAPI_D14A, + P_ATAPI_D15A, P_ATAPI_A0A, P_ATAPI_A1A, P_ATAPI_A2A, 0, + }; + + peripheral_request_list(pins, pata_bfin); return 0; } -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 18/35] Blackfin: serial: convert to portmux framework
Use the new portmux framework to handle the details when possible. Unfortunately, we cannot yet use this in the standalone initialization logic, so we need to keep around the old portmux writes for now. Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/cpu/serial.h | 19 +++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/arch/blackfin/cpu/serial.h b/arch/blackfin/cpu/serial.h index 5f9be86..f9e311f 100644 --- a/arch/blackfin/cpu/serial.h +++ b/arch/blackfin/cpu/serial.h @@ -26,6 +26,8 @@ #ifndef __ASSEMBLY__ +#include asm/portmux.h + #define LOB(x) ((x) 0xFF) #define HIB(x) (((x) 8) 0xFF) @@ -103,6 +105,23 @@ struct bfin_mmr_serial { __attribute__((always_inline)) static inline void serial_do_portmux(void) { + if (!BFIN_DEBUG_EARLY_SERIAL) { + const unsigned short pins[] = { +#if CONFIG_UART_CONSOLE == 0 + P_UART0_TX, P_UART0_RX, +#elif CONFIG_UART_CONSOLE == 1 + P_UART1_TX, P_UART1_RX, +#elif CONFIG_UART_CONSOLE == 2 + P_UART2_TX, P_UART2_RX, +#elif CONFIG_UART_CONSOLE == 3 + P_UART3_TX, P_UART3_RX, +#endif + 0, + }; + peripheral_request_list(pins, bfin-uart); + return; + } + #if defined(__ADSPBF51x__) # define DO_MUX(port, mux_tx, mux_rx, tx, rx) \ bfin_write_PORT##port##_MUX((bfin_read_PORT##port##_MUX() ~(PORT_x_MUX_##mux_tx##_MASK | PORT_x_MUX_##mux_rx##_MASK)) | PORT_x_MUX_##mux_tx##_FUNC_2 | PORT_x_MUX_##mux_rx##_FUNC_2); \ -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 19/35] Blackfin: bfin_spi: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/spi/bfin_spi.c | 209 1 files changed, 50 insertions(+), 159 deletions(-) diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c index f28d42b..4e008a7 100644 --- a/drivers/spi/bfin_spi.c +++ b/drivers/spi/bfin_spi.c @@ -13,6 +13,7 @@ #include spi.h #include asm/blackfin.h +#include asm/portmux.h #include asm/mach-common/bits/spi.h struct bfin_spi_slave { @@ -81,6 +82,42 @@ void spi_init() { } +#ifdef SPI_CTL +# define SPI0_CTL SPI_CTL +#endif + +#define SPI_PINS(n) \ + [n] = { 0, P_SPI##n##_SCK, P_SPI##n##_MISO, P_SPI##n##_MOSI, 0 } +static unsigned short pins[][5] = { +#ifdef SPI0_CTL + SPI_PINS(0), +#endif +#ifdef SPI1_CTL + SPI_PINS(1), +#endif +#ifdef SPI2_CTL + SPI_PINS(2), +#endif +}; + +#define SPI_CS_PINS(n) \ + [n] = { \ + P_SPI##n##_SSEL1, P_SPI##n##_SSEL2, P_SPI##n##_SSEL3, \ + P_SPI##n##_SSEL4, P_SPI##n##_SSEL5, P_SPI##n##_SSEL6, \ + P_SPI##n##_SSEL7, \ + } +static const unsigned short cs_pins[][7] = { +#ifdef SPI0_CTL + SPI_CS_PINS(0), +#endif +#ifdef SPI1_CTL + SPI_CS_PINS(1), +#endif +#ifdef SPI2_CTL + SPI_CS_PINS(2), +#endif +}; + struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int mode) { @@ -92,11 +129,14 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, if (!spi_cs_is_valid(bus, cs)) return NULL; + if (bus = ARRAY_SIZE(pins) || pins[bus] == NULL) { + debug(%s: invalid bus %u\n, __func__, bus); + return NULL; + } switch (bus) { -#ifdef SPI_CTL -# define SPI0_CTL SPI_CTL -#endif +#ifdef SPI0_CTL case 0: mmr_base = SPI0_CTL; break; +#endif #ifdef SPI1_CTL case 1: mmr_base = SPI1_CTL; break; #endif @@ -142,168 +182,15 @@ void spi_free_slave(struct spi_slave *slave) free(bss); } -static void spi_portmux(struct spi_slave *slave) -{ -#if defined(__ADSPBF51x__) -#define SET_MUX(port, mux, func) port##_mux = ((port##_mux ~PORT_x_MUX_##mux##_MASK) | PORT_x_MUX_##mux##_FUNC_##func) - u16 f_mux = bfin_read_PORTF_MUX(); - u16 f_fer = bfin_read_PORTF_FER(); - u16 g_mux = bfin_read_PORTG_MUX(); - u16 g_fer = bfin_read_PORTG_FER(); - u16 h_mux = bfin_read_PORTH_MUX(); - u16 h_fer = bfin_read_PORTH_FER(); - switch (slave-bus) { - case 0: - /* set SCK/MISO/MOSI */ - SET_MUX(g, 7, 1); - g_fer |= PG12 | PG13 | PG14; - switch (slave-cs) { - case 1: SET_MUX(f, 2, 1); f_fer |= PF7; break; - case 2: /* see G above */ g_fer |= PG15; break; - case 3: SET_MUX(h, 1, 3); f_fer |= PH4; break; - case 4: /* no muxing */ h_fer |= PH8; break; - case 5: SET_MUX(g, 1, 3); h_fer |= PG3; break; - case 6: /* no muxing */ break; - case 7: /* no muxing */ break; - } - case 1: - /* set SCK/MISO/MOSI */ - SET_MUX(h, 0, 2); - h_fer |= PH1 | PH2 | PH3; - switch (slave-cs) { - case 1: SET_MUX(h, 2, 3); h_fer |= PH6; break; - case 2: SET_MUX(f, 0, 3); f_fer |= PF0; break; - case 3: SET_MUX(g, 0, 3); g_fer |= PG0; break; - case 4: SET_MUX(f, 3, 3); f_fer |= PF8; break; - case 5: SET_MUX(g, 6, 3); h_fer |= PG11; break; - case 6: /* no muxing */ break; - case 7: /* no muxing */ break; - } - } - bfin_write_PORTF_MUX(f_mux); - bfin_write_PORTF_FER(f_fer); - bfin_write_PORTG_MUX(g_mux); - bfin_write_PORTG_FER(g_fer); - bfin_write_PORTH_MUX(h_mux); - bfin_write_PORTH_FER(h_fer); -#elif defined(__ADSPBF52x__) -#define SET_MUX(port, mux, func) port##_mux = ((port##_mux ~PORT_x_MUX_##mux##_MASK) | PORT_x_MUX_##mux##_FUNC_##func) - u16 f_mux = bfin_read_PORTF_MUX(); - u16 f_fer = bfin_read_PORTF_FER(); - u16 g_mux = bfin_read_PORTG_MUX(); - u16 g_fer = bfin_read_PORTG_FER(); - u16 h_mux = bfin_read_PORTH_MUX(); - u16 h_fer = bfin_read_PORTH_FER(); - /* set SCK/MISO/MOSI */ - SET_MUX(g, 0, 3); - g_fer |= PG2 | PG3 | PG4; - switch (slave-cs) { - case 1: /* see G above */ g_fer |= PG1; break; - case 2: SET_MUX(f, 4, 3); f_fer |= PF12; break; - case 3: SET_MUX(f, 4, 3); f_fer |= PF13; break; - case 4:
[U-Boot] [PATCH 20/35] Blackfin: bfin_spi: support gpios as chip selects
Rather than only support the pins dedicated as chip selects, utilize the gpio framework to support any gpio pin. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/spi/bfin_spi.c| 85 + include/configs/bfin_adi_common.h |1 + 2 files changed, 58 insertions(+), 28 deletions(-) diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c index 4e008a7..e0ad029 100644 --- a/drivers/spi/bfin_spi.c +++ b/drivers/spi/bfin_spi.c @@ -13,6 +13,7 @@ #include spi.h #include asm/blackfin.h +#include asm/gpio.h #include asm/portmux.h #include asm/mach-common/bits/spi.h @@ -34,48 +35,68 @@ MAKE_SPI_FUNC(SPI_BAUD, 0x14) #define to_bfin_spi_slave(s) container_of(s, struct bfin_spi_slave, slave) -__attribute__((weak)) +#define MAX_CTRL_CS 7 + +#define gpio_cs(cs) ((cs) - MAX_CTRL_CS) +#ifdef CONFIG_BFIN_SPI_GPIO_CS +# define is_gpio_cs(cs) ((cs) MAX_CTRL_CS) +#else +# define is_gpio_cs(cs) 0 +#endif + int spi_cs_is_valid(unsigned int bus, unsigned int cs) { -#if defined(__ADSPBF538__) || defined(__ADSPBF539__) - /* The SPI1/SPI2 buses are weird ... only 1 CS */ - if (bus 0 cs != 1) - return 0; -#endif - return (cs = 1 cs = 7); + if (is_gpio_cs(cs)) + return gpio_is_valid(gpio_cs(cs)); + else + return (cs = 1 cs = MAX_CTRL_CS); } -__attribute__((weak)) void spi_cs_activate(struct spi_slave *slave) { struct bfin_spi_slave *bss = to_bfin_spi_slave(slave); - write_SPI_FLG(bss, - (read_SPI_FLG(bss) - ~((!bss-flg 8) slave-cs)) | - (1 slave-cs)); + + if (is_gpio_cs(slave-cs)) { + unsigned int cs = gpio_cs(slave-cs); + gpio_set_value(cs, bss-flg); + debug(%s: SPI_CS_GPIO:%x\n, __func__, gpio_get_value(cs)); + } else { + write_SPI_FLG(bss, + (read_SPI_FLG(bss) + ~((!bss-flg 8) slave-cs)) | + (1 slave-cs)); + debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); + } + SSYNC(); - debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); } -__attribute__((weak)) void spi_cs_deactivate(struct spi_slave *slave) { struct bfin_spi_slave *bss = to_bfin_spi_slave(slave); - u16 flg; - - /* make sure we force the cs to deassert rather than let the -* pin float back up. otherwise, exact timings may not be -* met some of the time leading to random behavior (ugh). -*/ - flg = read_SPI_FLG(bss) | ((!bss-flg 8) slave-cs); - write_SPI_FLG(bss, flg); - SSYNC(); - debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); - flg = ~(1 slave-cs); - write_SPI_FLG(bss, flg); + if (is_gpio_cs(slave-cs)) { + unsigned int cs = gpio_cs(slave-cs); + gpio_set_value(cs, !bss-flg); + debug(%s: SPI_CS_GPIO:%x\n, __func__, gpio_get_value(cs)); + } else { + u16 flg; + + /* make sure we force the cs to deassert rather than let the +* pin float back up. otherwise, exact timings may not be +* met some of the time leading to random behavior (ugh). +*/ + flg = read_SPI_FLG(bss) | ((!bss-flg 8) slave-cs); + write_SPI_FLG(bss, flg); + SSYNC(); + debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); + + flg = ~(1 slave-cs); + write_SPI_FLG(bss, flg); + debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); + } + SSYNC(); - debug(%s: SPI_FLG:%x\n, __func__, read_SPI_FLG(bss)); } void spi_init() @@ -188,7 +209,13 @@ int spi_claim_bus(struct spi_slave *slave) debug(%s: bus:%i cs:%i\n, __func__, slave-bus, slave-cs); - pins[slave-bus][0] = cs_pins[slave-bus][slave-cs - 1]; + if (is_gpio_cs(slave-cs)) { + unsigned int cs = gpio_cs(slave-cs); + gpio_request(cs, bfin-spi); + gpio_direction_output(cs, !bss-flg); + pins[slave-bus][0] = P_DONTCARE; + } else + pins[slave-bus][0] = cs_pins[slave-bus][slave-cs - 1]; peripheral_request_list(pins[slave-bus], bfin-spi); write_SPI_CTL(bss, bss-ctl); @@ -205,6 +232,8 @@ void spi_release_bus(struct spi_slave *slave) debug(%s: bus:%i cs:%i\n, __func__, slave-bus, slave-cs); peripheral_free_list(pins[slave-bus]); + if (is_gpio_cs(slave-cs)) + gpio_free(gpio_cs(slave-cs)); write_SPI_CTL(bss, 0); SSYNC(); diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index fa1e694..82daeb1 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -254,6 +254,7 @@ /* * Misc Settings */ +#define
[U-Boot] [PATCH 22/35] Blackfin: blackstamp: convert eth/flash swap logic to gpio framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/blackstamp/blackstamp.c | 12 +++- 1 files changed, 3 insertions(+), 9 deletions(-) diff --git a/board/blackstamp/blackstamp.c b/board/blackstamp/blackstamp.c index 6355c10..06d004a 100644 --- a/board/blackstamp/blackstamp.c +++ b/board/blackstamp/blackstamp.c @@ -13,7 +13,7 @@ #include common.h #include netdev.h -#include asm/io.h +#include asm/gpio.h DECLARE_GLOBAL_DATA_PTR; @@ -27,14 +27,8 @@ int checkboard(void) #ifdef SHARED_RESOURCES void swap_to(int device_id) { - bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF0); - SSYNC(); - if (device_id == ETHERNET) - bfin_write_FIO_FLAG_S(PF0); - else if (device_id == FLASH) - bfin_write_FIO_FLAG_C(PF0); - else - printf(Unknown device to switch\n); + gpio_request(GPIO_PF0, eth_flash_swap); + gpio_direction_output(GPIO_PF0, device_id == ETHERNET); SSYNC(); } #endif -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 21/35] Blackfin: bf533-stamp: convert eth/flash swap logic to gpio framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf533-stamp/bf533-stamp.c | 47 -- 1 files changed, 20 insertions(+), 27 deletions(-) diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c index fd10eae..935aad2 100644 --- a/board/bf533-stamp/bf533-stamp.c +++ b/board/bf533-stamp/bf533-stamp.c @@ -27,8 +27,7 @@ #include common.h #include netdev.h -#include asm/io.h -#include bf533-stamp.h +#include asm/gpio.h DECLARE_GLOBAL_DATA_PTR; @@ -46,15 +45,10 @@ int checkboard(void) */ void swap_to(int device_id) { - bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF1 | PF0); - SSYNC(); - bfin_write_FIO_FLAG_C(PF1); - if (device_id == ETHERNET) - bfin_write_FIO_FLAG_S(PF0); - else if (device_id == FLASH) - bfin_write_FIO_FLAG_C(PF0); - else - printf(Unknown device to switch\n); + gpio_request(GPIO_PF0, eth_flash_swap); + gpio_request(GPIO_PF1, eth_flash_swap); + gpio_direction_output(GPIO_PF0, device_id == ETHERNET); + gpio_direction_output(GPIO_PF1, 0); SSYNC(); } @@ -75,24 +69,23 @@ int misc_init_r(void) #define STATUS_LED_OFF 0 #define STATUS_LED_ON 1 +static int gpio_setup; + static void stamp_led_set(int LED1, int LED2, int LED3) { - bfin_write_FIO_INEN(bfin_read_FIO_INEN() ~(PF2 | PF3 | PF4)); - bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4)); - - if (LED1 == STATUS_LED_OFF) - *pFIO_FLAG_S = PF2; - else - *pFIO_FLAG_C = PF2; - if (LED2 == STATUS_LED_OFF) - *pFIO_FLAG_S = PF3; - else - *pFIO_FLAG_C = PF3; - if (LED3 == STATUS_LED_OFF) - *pFIO_FLAG_S = PF4; - else - *pFIO_FLAG_C = PF4; - SSYNC(); + if (!gpio_setup) { + gpio_request(GPIO_PF2, boot_progress); + gpio_request(GPIO_PF3, boot_progress); + gpio_request(GPIO_PF4, boot_progress); + gpio_direction_output(GPIO_PF2, LED1); + gpio_direction_output(GPIO_PF3, LED2); + gpio_direction_output(GPIO_PF4, LED3); + gpio_setup = 1; + } else { + gpio_set_value(GPIO_PF2, LED1); + gpio_set_value(GPIO_PF3, LED2); + gpio_set_value(GPIO_PF4, LED3); + } } void show_boot_progress(int status) -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 24/35] Blackfin: bf518f-ezbrd: handle different PHYs dynamically
The original BF518F-EZBRD's have a Micrel KSZ8893 DSA on them, but newer ones only have a National PHY (which lack a RX Error interrupt line). So in the board eth init code, dynamically detect what is hooked up to the MAC and handle each accordingly. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf518f-ezbrd/bf518f-ezbrd.c | 23 +-- include/configs/bf518f-ezbrd.h| 20 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/board/bf518f-ezbrd/bf518f-ezbrd.c b/board/bf518f-ezbrd/bf518f-ezbrd.c index 85b350f..c2ab598 100644 --- a/board/bf518f-ezbrd/bf518f-ezbrd.c +++ b/board/bf518f-ezbrd/bf518f-ezbrd.c @@ -61,6 +61,7 @@ static void board_init_enetaddr(uchar *mac_addr) #define KSZ_WRITE 0x02 #define KSZ_READ 0x03 +#define KSZ_REG_CHID 0x00 /* Register 0: Chip ID0 */ #define KSZ_REG_STPID 0x01 /* Register 1: Chip ID1 / Start Switch */ #define KSZ_REG_GC9 0x0b /* Register 11: Global Control 9 */ #define KSZ_REG_P3C0 0x30 /* Register 48: Port 3 Control 0 */ @@ -78,15 +79,17 @@ static int ksz8893m_reg_set(struct spi_slave *slave, uchar reg, uchar data) return ksz8893m_transfer(slave, KSZ_WRITE, reg, data, din); } -static int ksz8893m_reg_clear(struct spi_slave *slave, uchar reg, uchar mask) +static int ksz8893m_reg_read(struct spi_slave *slave, uchar reg) { - int ret = 0; + int ret; unsigned char din[3]; + ret = ksz8893m_transfer(slave, KSZ_READ, reg, 0, din); + return ret ? ret : din[2]; +} - ret |= ksz8893m_transfer(slave, KSZ_READ, reg, 0, din); - ret |= ksz8893m_reg_set(slave, reg, din[2] mask); - - return ret; +static int ksz8893m_reg_clear(struct spi_slave *slave, uchar reg, uchar mask) +{ + return ksz8893m_reg_set(slave, reg, ksz8893m_reg_read(slave, reg) mask); } static int ksz8893m_reset(struct spi_slave *slave) @@ -107,16 +110,16 @@ static int ksz8893m_reset(struct spi_slave *slave) int board_eth_init(bd_t *bis) { - static bool switch_is_alive = false; + static bool switch_is_alive = false, phy_is_ksz = true; int ret; if (!switch_is_alive) { struct spi_slave *slave = spi_setup_slave(0, 1, KSZ_MAX_HZ, SPI_MODE_3); if (slave) { if (!spi_claim_bus(slave)) { - ret = ksz8893m_reset(slave); - if (!ret) - switch_is_alive = true; + phy_is_ksz = (ksz8893m_reg_read(slave, KSZ_REG_CHID) == 0x88); + ret = phy_is_ksz ? ksz8893m_reset(slave) : 0; + switch_is_alive = (ret == 0); spi_release_bus(slave); } spi_free_slave(slave); diff --git a/include/configs/bf518f-ezbrd.h b/include/configs/bf518f-ezbrd.h index 1e821d9..7d20b66 100644 --- a/include/configs/bf518f-ezbrd.h +++ b/include/configs/bf518f-ezbrd.h @@ -63,6 +63,26 @@ #if !defined(__ADSPBF512__) !defined(__ADSPBF514__) #define ADI_CMDS_NETWORK 1 #define CONFIG_BFIN_MAC +#define CONFIG_BFIN_MAC_PINS \ + { \ + P_MII0_ETxD0, \ + P_MII0_ETxD1, \ + P_MII0_ETxD2, \ + P_MII0_ETxD3, \ + P_MII0_ETxEN, \ + P_MII0_TxCLK, \ + P_MII0_PHYINT, \ + P_MII0_COL, \ + P_MII0_ERxD0, \ + P_MII0_ERxD1, \ + P_MII0_ERxD2, \ + P_MII0_ERxD3, \ + P_MII0_ERxDV, \ + P_MII0_ERxCLK, \ + P_MII0_CRS, \ + P_MII0_MDC, \ + P_MII0_MDIO, \ + 0 } #define CONFIG_NETCONSOLE 1 #define CONFIG_NET_MULTI 1 #endif -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 23/35] Blackfin: bf533-stamp: scrub unused code
Much of the local bf533-stamp.h header is unused, and the few bits that are are only needed in one file. So move the few used bits out and punt all the rest. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf533-stamp/bf533-stamp.h | 53 --- board/bf533-stamp/ide-cf.c | 10 ++- 2 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 board/bf533-stamp/bf533-stamp.h diff --git a/board/bf533-stamp/bf533-stamp.h b/board/bf533-stamp/bf533-stamp.h deleted file mode 100644 index ebd39c7..000 --- a/board/bf533-stamp/bf533-stamp.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * U-boot - stamp.h - * - * Copyright (c) 2005-2007 Analog Devices Inc. - * - * (C) Copyright 2000-2004 - * Wolfgang Denk, DENX Software Engineering, w...@denx.de. - * - * 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., 51 Franklin St, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#ifndef __STAMP_H__ -#define __STAMP_H__ - -extern void init_Flags(void); - -extern volatile unsigned long *ambctl0; -extern volatile unsigned long *ambctl1; -extern volatile unsigned long *amgctl; - -/* Definitions used in Compact Flash Boot support */ -#define FIO_EDGE_CF_BITS 0x -#define FIO_POLAR_CF_BITS 0x -#defineFIO_EDGE_BITS 0x1E0 -#defineFIO_POLAR_BITS 0x160 - -/* Compact flash status bits in status register */ -#define CF_STAT_BITS 0x0060 - -/* CF Flags used to switch between expansion and external - * memory banks - */ -#define CF_PF0 0x0001 -#define CF_PF1 0x0002 -#define CF_PF1_PF0 0x0003 - -#endif diff --git a/board/bf533-stamp/ide-cf.c b/board/bf533-stamp/ide-cf.c index 23e786b..3e4080e 100644 --- a/board/bf533-stamp/ide-cf.c +++ b/board/bf533-stamp/ide-cf.c @@ -11,7 +11,6 @@ #include common.h #include config.h #include asm/blackfin.h -#include bf533-stamp.h void cf_outb(unsigned char val, volatile unsigned char *addr) { @@ -66,6 +65,15 @@ void cf_outsw(unsigned short *addr, unsigned short *sect_buf, int words) swap_to(FLASH); } +/* Definitions used in Compact Flash Boot support */ +#define FIO_EDGE_CF_BITS 0x +#define FIO_POLAR_CF_BITS 0x +#define FIO_EDGE_BITS 0x1E0 +#define FIO_POLAR_BITS 0x160 + +/* Compact flash status bits in status register */ +#define CF_STAT_BITS 0x0060 + void cf_ide_init(void) { int i, cf_stat; -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 25/35] Blackfin: bf518f-ezbrd: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf518f-ezbrd/bf518f-ezbrd.c | 18 ++ 1 files changed, 6 insertions(+), 12 deletions(-) diff --git a/board/bf518f-ezbrd/bf518f-ezbrd.c b/board/bf518f-ezbrd/bf518f-ezbrd.c index c2ab598..ff1ac4c 100644 --- a/board/bf518f-ezbrd/bf518f-ezbrd.c +++ b/board/bf518f-ezbrd/bf518f-ezbrd.c @@ -14,6 +14,7 @@ #include spi.h #include asm/blackfin.h #include asm/net.h +#include asm/portmux.h #include asm/mach-common/bits/otp.h #include asm/sdh.h @@ -146,18 +147,11 @@ int misc_init_r(void) int board_early_init_f(void) { -#if !defined(CONFIG_SYS_NO_FLASH) - /* setup BF518-EZBRD GPIO pin PG11 to AMS2. */ - bfin_write_PORTG_MUX((bfin_read_PORTG_MUX() ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2); - bfin_write_PORTG_FER(bfin_read_PORTG_FER() | PG11); - -# if !defined(CONFIG_BFIN_SPI) - /* setup BF518-EZBRD GPIO pin PG15 to AMS3. */ - bfin_write_PORTG_MUX((bfin_read_PORTG_MUX() ~PORT_x_MUX_7_MASK) | PORT_x_MUX_7_FUNC_3); - bfin_write_PORTG_FER(bfin_read_PORTG_FER() | PG15); -# endif -#endif - return 0; + /* connect async banks by default */ + const unsigned short pins[] = { + P_AMS2, P_AMS3, 0, + }; + return peripheral_request_list(pins, async); } #ifdef CONFIG_BFIN_SDH -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 26/35] Blackfin: bf548-ezkit: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf548-ezkit/bf548-ezkit.c | 64 +++--- board/bf548-ezkit/video.c | 27 2 files changed, 26 insertions(+), 65 deletions(-) diff --git a/board/bf548-ezkit/bf548-ezkit.c b/board/bf548-ezkit/bf548-ezkit.c index 65fb81a..cb9ee86 100644 --- a/board/bf548-ezkit/bf548-ezkit.c +++ b/board/bf548-ezkit/bf548-ezkit.c @@ -7,10 +7,12 @@ */ #include common.h -#include netdev.h #include config.h #include command.h +#include netdev.h #include asm/blackfin.h +#include asm/gpio.h +#include asm/portmux.h #include asm/sdh.h DECLARE_GLOBAL_DATA_PTR; @@ -24,53 +26,13 @@ int checkboard(void) int board_early_init_f(void) { - /* Port H: PH8 - PH13 == A4 - A9 -* address lines of the parallel asynchronous memory interface -*/ - - / - * configure GPIO* - * set port H function enable register * - * configure PH8-PH13 as peripheral (not GPIO) * - */ - bfin_write_PORTH_FER(0x3F03); - - / - * set port H MUX to configure PH8-PH13 * - * 1st Function (MUX = 00) (bits 16-27 == 0)* - * Set to address signals A4-A9 * - */ - bfin_write_PORTH_MUX(0); - - / - * set port H direction register * - * enable PH8-PH13 as outputs * - */ - bfin_write_PORTH_DIR_SET(0x3F00); - - /* Port I: PI0 - PH14 == A10 - A24 -* address lines of the parallel asynchronous memory interface -*/ - - / - * set port I function enable register * - * configure PI0-PI14 as peripheral (not GPIO) * - */ - bfin_write_PORTI_FER(0x7fff); - - /** - * set PORT I MUX to configure PI14-PI0 as * - * 1st Function (MUX=00) - address signals A10-A24 * - ***/ - bfin_write_PORTI_MUX(0); - - / - * set PORT I direction register * - * enable PI0 - PI14 as outputs * - */ - bfin_write_PORTI_DIR_SET(0x7fff); - - return 0; + /* Set async addr lines as peripheral */ + const unsigned short pins[] = { + P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12, + P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, + P_A21, P_A22, P_A23, P_A24, 0 + }; + return peripheral_request_list(pins, async); } #ifdef CONFIG_SMC911X @@ -96,9 +58,7 @@ void board_musb_init(void) * be low for device mode and high for host mode. We set it high * here because we are in host mode. */ - bfin_write_PORTE_FER(bfin_read_PORTE_FER() ~PE7); - bfin_write_PORTE_DIR_SET(PE7); - bfin_write_PORTE_SET(PE7); - SSYNC(); + gpio_request(GPIO_PE7, musb-vbus); + gpio_direction_output(GPIO_PE7, 1); } #endif diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c index 10b08e2..af3d58b 100644 --- a/board/bf548-ezkit/video.c +++ b/board/bf548-ezkit/video.c @@ -11,6 +11,8 @@ #include config.h #include malloc.h #include asm/blackfin.h +#include asm/gpio.h +#include asm/portmux.h #include asm/mach-common/bits/dma.h #include i2c.h #include linux/types.h @@ -173,22 +175,21 @@ void Init_DMA(void *dst) void Init_Ports(void) { - *pPORTF_MUX = 0x; - *pPORTF_FER |= 0x; /* PPI0..15 */ - - *pPORTG_MUX = ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK); - *pPORTG_FER |= PG0 | PG1 | PG2 | PG3 | PG4; /* CLK, FS1, FS2, PPI16..17 */ - + const unsigned short pins[] = { + P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, P_PPI0_D4, + P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, P_PPI0_D8, P_PPI0_D9, + P_PPI0_D10, P_PPI0_D11, P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, + P_PPI0_D15, P_PPI0_D16, P_PPI0_D17, #if !defined(CONFIG_VIDEO_RGB666) - *pPORTD_MUX = ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK); - *pPORTD_MUX |= (PORT_x_MUX_0_FUNC_4 | PORT_x_MUX_1_FUNC_4 | PORT_x_MUX_2_FUNC_4 | PORT_x_MUX_3_FUNC_4 | PORT_x_MUX_4_FUNC_4 |
[U-Boot] [PATCH 27/35] Blackfin: bf527-ezkit: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/bf527-ezkit/bf527-ezkit.c |7 +++ board/bf527-ezkit/video.c | 13 ++--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/board/bf527-ezkit/bf527-ezkit.c b/board/bf527-ezkit/bf527-ezkit.c index a911880..211cf24 100644 --- a/board/bf527-ezkit/bf527-ezkit.c +++ b/board/bf527-ezkit/bf527-ezkit.c @@ -12,6 +12,7 @@ #include net.h #include netdev.h #include asm/blackfin.h +#include asm/gpio.h #include asm/net.h #include asm/mach-common/bits/otp.h @@ -75,9 +76,7 @@ void board_musb_init(void) /* * BF527 EZ-KITs require PG13 to be high for HOST mode */ - bfin_write_PORTG_FER(bfin_read_PORTG_FER() ~PG13); - bfin_write_PORTGIO_DIR(bfin_read_PORTGIO_DIR() | PG13); - bfin_write_PORTGIO_SET(PG13); - SSYNC(); + gpio_request(GPIO_PG13, musb-vbus); + gpio_direction_output(GPIO_PG13, 1); } #endif diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c index 8f6ea23..891070b 100644 --- a/board/bf527-ezkit/video.c +++ b/board/bf527-ezkit/video.c @@ -11,6 +11,7 @@ #include config.h #include malloc.h #include asm/blackfin.h +#include asm/portmux.h #include asm/mach-common/bits/dma.h #include spi.h #include linux/types.h @@ -171,13 +172,11 @@ void DisablePPI(void) void Init_Ports(void) { - *pPORTF_MUX = ~PORT_x_MUX_0_MASK; - *pPORTF_MUX |= PORT_x_MUX_0_FUNC_1; - *pPORTF_FER |= PF0 | PF1 | PF2 | PF3 | PF4 | PF5 | PF6 | PF7; - - *pPORTG_MUX = ~PORT_x_MUX_1_MASK; - *pPORTG_MUX |= PORT_x_MUX_1_FUNC_1; - *pPORTG_FER |= PG5; + const unsigned short pins[] = { + P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, P_PPI0_D4, + P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, P_PPI0_FS2, 0, + }; + peripheral_request_list(pins, lcd); } void Init_PPI(void) -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 28/35] Blackfin: cm-bf548: convert to portmux framework
Rather than bang MMRs directly, use the new portmux framework to handle the details. Signed-off-by: Mike Frysinger vap...@gentoo.org --- board/cm-bf548/cm-bf548.c | 55 ++-- board/cm-bf548/video.c| 33 +++--- 2 files changed, 22 insertions(+), 66 deletions(-) diff --git a/board/cm-bf548/cm-bf548.c b/board/cm-bf548/cm-bf548.c index 3627586..90ce4c3 100644 --- a/board/cm-bf548/cm-bf548.c +++ b/board/cm-bf548/cm-bf548.c @@ -11,6 +11,7 @@ #include command.h #include netdev.h #include asm/blackfin.h +#include asm/portmux.h DECLARE_GLOBAL_DATA_PTR; @@ -23,53 +24,13 @@ int checkboard(void) int board_early_init_f(void) { - /* Port H: PH8 - PH13 == A4 - A9 -* address lines of the parallel asynchronous memory interface -*/ - - / - * configure GPIO* - * set port H function enable register * - * configure PH8-PH13 as peripheral (not GPIO) * - */ - bfin_write_PORTH_FER(0x3F03); - - / - * set port H MUX to configure PH8-PH13 * - * 1st Function (MUX = 00) (bits 16-27 == 0)* - * Set to address signals A4-A9 * - */ - bfin_write_PORTH_MUX(0); - - / - * set port H direction register * - * enable PH8-PH13 as outputs * - */ - bfin_write_PORTH_DIR_SET(0x3F00); - - /* Port I: PI0 - PH14 == A10 - A24 -* address lines of the parallel asynchronous memory interface -*/ - - / - * set port I function enable register * - * configure PI0-PI14 as peripheral (not GPIO) * - */ - bfin_write_PORTI_FER(0x7fff); - - /** - * set PORT I MUX to configure PI14-PI0 as * - * 1st Function (MUX=00) - address signals A10-A24 * - ***/ - bfin_write_PORTI_MUX(0); - - / - * set PORT I direction register * - * enable PI0 - PI14 as outputs * - */ - bfin_write_PORTI_DIR_SET(0x7fff); - - return 0; + /* Set async addr lines as peripheral */ + const unsigned short pins[] = { + P_A4, P_A5, P_A6, P_A7, P_A8, P_A9, P_A10, P_A11, P_A12, + P_A13, P_A14, P_A15, P_A16, P_A17, P_A18, P_A19, P_A20, + P_A21, P_A22, P_A23, P_A24, 0 + }; + return peripheral_request_list(pins, async); } int board_eth_init(bd_t *bis) diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c index 4097f09..d43f5a1 100644 --- a/board/cm-bf548/video.c +++ b/board/cm-bf548/video.c @@ -11,6 +11,8 @@ #include config.h #include malloc.h #include asm/blackfin.h +#include asm/gpio.h +#include asm/portmux.h #include asm/mach-common/bits/dma.h #include i2c.h #include linux/types.h @@ -174,28 +176,21 @@ void Init_DMA(void *dst) void Init_Ports(void) { - *pPORTF_MUX = 0x; - *pPORTF_FER |= 0x; /* PPI0..15 */ - - *pPORTG_MUX = - ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | - PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK); - *pPORTG_FER |= PG0 | PG1 | PG2 | PG3 | PG4; /* CLK, FS1, FS2, PPI16..17 */ - + const unsigned short pins[] = { + P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, P_PPI0_D4, + P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, P_PPI0_D8, P_PPI0_D9, + P_PPI0_D10, P_PPI0_D11, P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, + P_PPI0_D15, P_PPI0_D16, P_PPI0_D17, #if !defined(CONFIG_VIDEO_RGB666) - *pPORTD_MUX = - ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | - PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK); - *pPORTD_MUX |= - (PORT_x_MUX_0_FUNC_4 | PORT_x_MUX_1_FUNC_4 | PORT_x_MUX_2_FUNC_4 | -PORT_x_MUX_3_FUNC_4 | PORT_x_MUX_4_FUNC_4 | PORT_x_MUX_5_FUNC_4); - *pPORTD_FER |= PD0 | PD1 | PD2 | PD3 | PD4 | PD5; /* PPI18..23 */ + P_PPI0_D18, P_PPI0_D19, P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, + P_PPI0_D23, #endif + P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, 0, + }; + peripheral_request_list(pins, lcd); - *pPORTE_FER = ~PE3;/* DISP */ - *pPORTE_DIR_SET = PE3; - *pPORTE_SET = PE3; - + gpio_request(GPIO_PE3, lcd-disp); +
[U-Boot] [PATCH 30/35] Blackfin: unify default I2C settings for ADI boards
Signed-off-by: Mike Frysinger vap...@gentoo.org --- include/configs/bf518f-ezbrd.h|2 -- include/configs/bf526-ezbrd.h |2 -- include/configs/bf527-ezkit.h |2 -- include/configs/bf533-ezkit.h |2 -- include/configs/bf533-stamp.h |2 -- include/configs/bf537-pnav.h |2 -- include/configs/bf537-stamp.h |2 -- include/configs/bf538f-ezkit.h|2 -- include/configs/bf548-ezkit.h |2 -- include/configs/bf561-ezkit.h |2 -- include/configs/bfin_adi_common.h | 12 include/configs/cm-bf527.h|2 -- include/configs/cm-bf537e.h |2 -- include/configs/cm-bf537u.h |2 -- include/configs/cm-bf548.h|2 -- include/configs/ibf-dsp561.h |2 -- include/configs/tcm-bf518.h |2 -- include/configs/tcm-bf537.h |2 -- 18 files changed, 12 insertions(+), 34 deletions(-) diff --git a/include/configs/bf518f-ezbrd.h b/include/configs/bf518f-ezbrd.h index 7d20b66..6eec1c9 100644 --- a/include/configs/bf518f-ezbrd.h +++ b/include/configs/bf518f-ezbrd.h @@ -137,8 +137,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf526-ezbrd.h b/include/configs/bf526-ezbrd.h index ecda216..82396d0 100644 --- a/include/configs/bf526-ezbrd.h +++ b/include/configs/bf526-ezbrd.h @@ -134,8 +134,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf527-ezkit.h b/include/configs/bf527-ezkit.h index 7800c32..07e4ce8 100644 --- a/include/configs/bf527-ezkit.h +++ b/include/configs/bf527-ezkit.h @@ -138,8 +138,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h index c80ddca..37a7059 100644 --- a/include/configs/bf533-ezkit.h +++ b/include/configs/bf533-ezkit.h @@ -136,8 +136,6 @@ } while (0) #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 #endif diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index 2ec9c42..02c8bc3 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -180,8 +180,6 @@ } while (0) #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 #endif diff --git a/include/configs/bf537-pnav.h b/include/configs/bf537-pnav.h index cf40d06..8daebc8 100644 --- a/include/configs/bf537-pnav.h +++ b/include/configs/bf537-pnav.h @@ -155,8 +155,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h index cba4ac0..3592862 100644 --- a/include/configs/bf537-stamp.h +++ b/include/configs/bf537-stamp.h @@ -137,8 +137,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf538f-ezkit.h b/include/configs/bf538f-ezkit.h index 59e0565..1c14b6b 100644 --- a/include/configs/bf538f-ezkit.h +++ b/include/configs/bf538f-ezkit.h @@ -134,8 +134,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf548-ezkit.h b/include/configs/bf548-ezkit.h index f9c9711..60cca0c 100644 --- a/include/configs/bf548-ezkit.h +++ b/include/configs/bf548-ezkit.h @@ -140,8 +140,6 @@ */ #define CONFIG_BFIN_TWI_I2C1 #define CONFIG_HARD_I2C1 -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 /* diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h index 1e3fdef..036bfe4 100644 --- a/include/configs/bf561-ezkit.h +++ b/include/configs/bf561-ezkit.h @@ -151,8 +151,6 @@ } while (0) #define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ -#define CONFIG_SYS_I2C_SPEED 5 -#define CONFIG_SYS_I2C_SLAVE 0 #endif diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index 82daeb1..57a7309 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -252,6 +252,18 @@ #endif /* + * I2C Settings + */ +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +# ifndef CONFIG_SYS_I2C_SPEED +# define
[U-Boot] [PATCH 29/35] Blackfin: bf561: use DMA for Core B L1 regions
The L1 regions of Core B are not directly accessible from Core A, so we need to use DMA to get at them. Signed-off-by: Mike Frysinger vap...@gentoo.org --- arch/blackfin/include/asm/blackfin_local.h | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/blackfin/include/asm/blackfin_local.h b/arch/blackfin/include/asm/blackfin_local.h index 3fd34b3..48f793a 100644 --- a/arch/blackfin/include/asm/blackfin_local.h +++ b/arch/blackfin/include/asm/blackfin_local.h @@ -75,7 +75,15 @@ extern void blackfin_dcache_flush_invalidate_range(const void *, const void *); * regions can only be accessed via DMA, so if the address in question is in * that region, make sure we attempt to DMA indirectly. */ -# define addr_bfin_on_chip_mem(addr) (((unsigned long)(addr) 0xFFF0) == 0xFFA0) +# ifdef __ADSPBF561__ + /* Core B regions all need dma from Core A */ +# define addr_bfin_on_chip_mem(addr) \ + unsigned long)(addr) 0xFFF0) == 0xFFA0) || \ +(((unsigned long)(addr) 0xFFC0) == 0xFF40)) +# else +# define addr_bfin_on_chip_mem(addr) \ + (((unsigned long)(addr) 0xFFF0) == 0xFFA0) +# endif # include asm/system.h -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 31/35] Blackfin: bfin_mac: remove space from name
Some commands (like 'mii') use this name to select devices, but they break when those names contain spaces. So drop the space from the Blackfin EMAC driver. Signed-off-by: Mike Frysinger vap...@gentoo.org --- drivers/net/bfin_mac.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index ee4ad6c..e691bdf 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c @@ -99,7 +99,7 @@ int bfin_EMAC_initialize(bd_t *bis) hang(); memset(dev, 0, sizeof(*dev)); - sprintf(dev-name, Blackfin EMAC); + strcpy(dev-name, bfin_mac); dev-iobase = 0; dev-priv = 0; -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 32/35] Blackfin: enable IP defrag for ADI boards
Signed-off-by: Mike Frysinger vap...@gentoo.org --- include/configs/bfin_adi_common.h |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h index 57a7309..901a32f 100644 --- a/include/configs/bfin_adi_common.h +++ b/include/configs/bfin_adi_common.h @@ -248,6 +248,7 @@ # define CONFIG_SYS_AUTOLOAD no # endif # endif +# define CONFIG_IP_DEFRAG # define CONFIG_NET_RETRY_COUNT 20 #endif -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 34/35] Blackfin: drop old u-boot.lds clean target
The u-boot.lds CPP unification missed the Blackfin-specific clean target. It is no longer needed, so punt it. Signed-off-by: Mike Frysinger vap...@gentoo.org --- Makefile |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 1d87f37..9c4e3a4 100644 --- a/Makefile +++ b/Makefile @@ -2436,7 +2436,6 @@ clean: $(obj)board/netstar/{eeprom,crcek,crcit,*.srec,*.bin} \ $(obj)board/trab/trab_fkt $(obj)board/voiceblue/eeprom \ $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds \ - $(obj)arch/blackfin/lib/u-boot.lds \ $(obj)u-boot.lds \ $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] @rm -f $(obj)include/bmp_logo.h -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 33/35] Blackfin: bf527-ad7160-eval: new board support
From: Michael Hennerich michael.henner...@analog.com Support the new AD7160 eval board. Signed-off-by: Michael Hennerich michael.henner...@analog.com Signed-off-by: Mike Frysinger vap...@gentoo.org --- MAINTAINERS |2 + MAKEALL |1 + board/bf527-ad7160-eval/Makefile| 54 ++ board/bf527-ad7160-eval/bf527-ad7160-eval.c | 25 + board/bf527-ad7160-eval/config.mk | 33 ++ boards.cfg |1 + include/configs/bf527-ad7160-eval.h | 148 +++ 7 files changed, 264 insertions(+), 0 deletions(-) create mode 100644 board/bf527-ad7160-eval/Makefile create mode 100644 board/bf527-ad7160-eval/bf527-ad7160-eval.c create mode 100644 board/bf527-ad7160-eval/config.mk create mode 100644 include/configs/bf527-ad7160-eval.h diff --git a/MAINTAINERS b/MAINTAINERS index 9485070..7e66e8d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -998,6 +998,8 @@ Blackfin Team u-boot-de...@blackfin.uclinux.org BF548-EZKIT BF548 BF561-EZKIT BF561 + BF527-AD7160-EVAL BF527 + Bluetechnix Tinyboards bluetech...@blackfin.uclinux.org Blackfin Team u-boot-de...@blackfin.uclinux.org diff --git a/MAKEALL b/MAKEALL index 4637390..ebd0ddc 100755 --- a/MAKEALL +++ b/MAKEALL @@ -892,6 +892,7 @@ LIST_avr32=\ LIST_blackfin=\ bf518f-ezbrd\ bf526-ezbrd \ + bf527-ad7160-eval \ bf527-ezkit \ bf527-ezkit-v2 \ bf533-ezkit \ diff --git a/board/bf527-ad7160-eval/Makefile b/board/bf527-ad7160-eval/Makefile new file mode 100644 index 000..f2bd2c2 --- /dev/null +++ b/board/bf527-ad7160-eval/Makefile @@ -0,0 +1,54 @@ +# +# U-boot - Makefile +# +# Copyright (c) 2005-2008 Analog Device Inc. +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, w...@denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB= $(obj)lib$(BOARD).a + +COBJS-y:= $(BOARD).o + +SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS-y)) +SOBJS := $(addprefix $(obj),$(SOBJS-y)) + +$(LIB):$(obj).depend $(OBJS) $(SOBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/board/bf527-ad7160-eval/bf527-ad7160-eval.c b/board/bf527-ad7160-eval/bf527-ad7160-eval.c new file mode 100644 index 000..b06d5ab --- /dev/null +++ b/board/bf527-ad7160-eval/bf527-ad7160-eval.c @@ -0,0 +1,25 @@ +/* + * U-boot - main board file + * + * Copyright (c) 2010 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include common.h +#include asm/blackfin.h +#include asm/mach-common/bits/pll.h + +int checkboard(void) +{ + printf(Board: ADI BF527 AD7160-EVAL board\n); + printf( Support: http://blackfin.uclinux.org/\n;); + return 0; +} + +int misc_init_r(void) +{ + /* CLKIN Buffer Output Enable */ + *pVR_CTL |= CLKBUFOE; + return 0; +} diff --git a/board/bf527-ad7160-eval/config.mk b/board/bf527-ad7160-eval/config.mk new file mode 100644 index 000..f85bef5 --- /dev/null +++ b/board/bf527-ad7160-eval/config.mk @@ -0,0 +1,33 @@ +# +# Copyright (c) 2005-2008 Analog Device Inc. +# +# (C) Copyright 2001 +# Wolfgang Denk, DENX Software Engineering, w...@denx.de. +# +# 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 +#
[U-Boot] [PATCH 35/35] Blackfin: bf561-acvilon: drop unused env redund define
The SPI env code didn't support redundant environments until recently, but this code was written before that. Since it has never been tested (and currently causes a build failure), simply punt it. If the functionality is actually desired, it can be re-added once it has been tested. Signed-off-by: Mike Frysinger vap...@gentoo.org --- include/configs/bf561-acvilon.h |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/include/configs/bf561-acvilon.h b/include/configs/bf561-acvilon.h index 0be170c..44854c7 100644 --- a/include/configs/bf561-acvilon.h +++ b/include/configs/bf561-acvilon.h @@ -131,7 +131,6 @@ #define CONFIG_ENV_SECT_SIZE (1056 * 8) #define CONFIG_ENV_OFFSET ((16 + 256) * 1056) #define CONFIG_ENV_SIZE(8 * 1056) -#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) /* -- 1.7.1.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI)
Dear Eric Xu, In message 4c31770b.1020...@atmel.com you wrote: Could you please rebase your code to master@ git://git.denx.de/u-boot-at91.git ? Why are you requesting this? I do not want a situation that patches need to be submitted agaionst a number of different trees or branches, with the unavoidable result that the majority of readers here on the list cannot test the postings bcause they do not apply against the master repository. Because of that, http://www.denx.de/wiki/U-Boot/Patches states explicitly: Please use the master branch of the mainline U-Boot git repository (git://git.denx.de/u-boot.git) as reference, unless (usually late in a release cycle) there has been an announcement to use the next branch of this repository instead. If your AT91 repository requires a different state, it is your task as custodian to keep it in sync with master, and to resolve any merge conflicts resulting from the remaining differences. Reinhards patch appears to apply cleanly against master, so it should NOT be changed. Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Real computer scientists despise the idea of actual hardware. Hard- ware has limitations, software doesn't. It's a real shame that Turing machines are so poor at I/O. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] net, tsec: add micrel ksz804 phy
net, tsec: add micrel ksz804 phy Signed-off-by: Heiko Schocher h...@denx.de --- drivers/net/tsec.c | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 5fa6f61..bc2707f 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -1631,6 +1631,27 @@ static struct phy_info phy_info_dm9161 = { }, }; +/* micrel KSZ804 */ +static struct phy_info phy_info_ksz804 = { + 0x0022151, + Micrel KSZ804 PHY, + 4, + (struct phy_cmd[]) { /* config */ + {PHY_BMCR, PHY_BMCR_RESET, NULL}, + {PHY_BMCR, PHY_BMCR_AUTON|PHY_BMCR_RST_NEG, NULL}, + {miim_end,} + }, + (struct phy_cmd[]) { /* startup */ + {PHY_BMSR, miim_read, NULL}, + {PHY_BMSR, miim_read, mii_parse_sr}, + {PHY_BMSR, miim_read, mii_parse_link}, + {miim_end,} + }, + (struct phy_cmd[]) { /* shutdown */ + {miim_end,} + } +}; + /* a generic flavor. */ static struct phy_info phy_info_generic = { 0, @@ -1794,6 +1815,7 @@ static struct phy_info *phy_info[] = { phy_info_M88E1145, phy_info_M88E1149S, phy_info_dm9161, + phy_info_ksz804, phy_info_lxt971, phy_info_VSC8211, phy_info_VSC8244, -- 1.6.2.5 -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] 83xx: add support for ve8313 board
This patch add support for the ve8313 board based on Freescale MPC8313 CPU. - serial console on UART 1 - 128 MB DDR RAM - 32 MB NOR Flash - 16 MB NAND Flash - Ethernet MII Mode on TSEC0 - micrel ksz804 phy - Hardware WDT MAX824 Signed-off-by: Heiko Schocher h...@denx.de --- board/ve8313/Makefile| 50 + board/ve8313/config.mk | 10 + board/ve8313/ve8313.c| 212 ++ boards.cfg |1 + include/configs/ve8313.h | 534 ++ 5 files changed, 807 insertions(+), 0 deletions(-) create mode 100644 board/ve8313/Makefile create mode 100644 board/ve8313/config.mk create mode 100644 board/ve8313/ve8313.c create mode 100644 include/configs/ve8313.h diff --git a/board/ve8313/Makefile b/board/ve8313/Makefile new file mode 100644 index 000..c95f90e --- /dev/null +++ b/board/ve8313/Makefile @@ -0,0 +1,50 @@ +# +# (C) Copyright 2006 +# Wolfgang Denk, DENX Software Engineering, w...@denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +LIB= $(obj)lib$(BOARD).a + +COBJS := $(BOARD).o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB):$(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +# + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +# diff --git a/board/ve8313/config.mk b/board/ve8313/config.mk new file mode 100644 index 000..66fbc10 --- /dev/null +++ b/board/ve8313/config.mk @@ -0,0 +1,10 @@ +ifndef NAND_SPL +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp +endif + +ifndef TEXT_BASE +#TEXT_BASE = 0x10 +TEXT_BASE = 0xfe00 +endif + +#PLATFORM_CPPFLAGS += -DDEBUG diff --git a/board/ve8313/ve8313.c b/board/ve8313/ve8313.c new file mode 100644 index 000..b13d1f3 --- /dev/null +++ b/board/ve8313/ve8313.c @@ -0,0 +1,212 @@ +/* + * (C) Copyright 2010 + * Heiko Schocher, DENX Software Engineering, h...@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS for A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include common.h +#if defined(CONFIG_OF_LIBFDT) +#include libfdt.h +#endif +#include pci.h +#include mpc83xx.h +#include ns16550.h +#include nand.h + +#include asm/bitops.h +#include asm/io.h + +DECLARE_GLOBAL_DATA_PTR; + +extern void disable_addr_trans (void); +extern void enable_addr_trans (void); + +int checkboard(void) +{ + puts(Board: ve8313\n); + return 0; +} + +/* Fixed sdram init -- doesn't use serial presence detect. + * + * This is useful for faster booting in configs where the RAM is unlikely + * to be changed, or for things like NAND booting where space is tight. + */ +static long fixed_sdram(void) +{ + u32 msize = CONFIG_SYS_DDR_SIZE * 1024 * 1024; + +#ifndef CONFIG_SYS_RAMBOOT + volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR; + u32 msize_log2 = __ilog2(msize); + + out_be32(im-sysconf.ddrlaw[0].bar, + (CONFIG_SYS_DDR_SDRAM_BASE 0xf000)); + out_be32(im-sysconf.ddrlaw[0].ar, (LBLAWAR_EN | (msize_log2 - 1))); + out_be32(im-sysconf.ddrcdr, CONFIG_SYS_DDRCDR_VALUE); + + /* +* Erratum DDR3 requires a 50ms delay after clearing
[U-Boot] 答复: [PATCH] AT91SAM9260/9XE: a dd support for MultiMedia Card Interfac e (MCI)
Dear Wolfgang, The reason is I tried to apply the patch on top of 1) master branch of the mainline U-Boot 2) current master of u-boot-at91.git 3) The old master of u-boot-at91.git all of them are failed. Since you said the patch is cleanly against master of mainline U-Boot, I'll rework. Thanks. BR, Eric -Original Message- From: Wolfgang Denk [mailto:w...@denx.de] Sent: 2010-7-5 (星期一) 17:59 To: Xu, Hong Cc: reinhard.me...@emk-elektronik.de; u-boot Subject: Re: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI) Dear Eric Xu, In message 4c31770b.1020...@atmel.com you wrote: Could you please rebase your code to master@ git://git.denx.de/u-boot-at91.git ? Why are you requesting this? I do not want a situation that patches need to be submitted agaionst a number of different trees or branches, with the unavoidable result that the majority of readers here on the list cannot test the postings bcause they do not apply against the master repository. Because of that, http://www.denx.de/wiki/U-Boot/Patches states explicitly: Please use the master branch of the mainline U-Boot git repository (git://git.denx.de/u-boot.git) as reference, unless (usually late in a release cycle) there has been an announcement to use the next branch of this repository instead. If your AT91 repository requires a different state, it is your task as custodian to keep it in sync with master, and to resolve any merge conflicts resulting from the remaining differences. Reinhards patch appears to apply cleanly against master, so it should NOT be changed. Thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Real computer scientists despise the idea of actual hardware. Hard- ware has limitations, software doesn't. It's a real shame that Turing machines are so poor at I/O. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 4/4] egiga: add support for orion5x
Prefer subject : Orion5X: add egiga driver support -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 4/4] egiga: add support for orion5x Now that egiga is detached from kirkwood, we can add support for orion5x. This requires making the structures representing egiga registers and descriptors volatile, otherwise writes to them happen in the wrong order -- this did not affect kirkwood but does affect orion5x. Signed-off-by: Albert Aribaud albert.arib...@free.fr --- arch/arm/cpu/arm926ejs/orion5x/cpu.c| 18 +++ arch/arm/include/asm/arch-orion5x/orion5x.h |5 + board/LaCie/edminiv2/edminiv2.c | 36 + board/LaCie/edminiv2/edminiv2.h | 41 ++ drivers/net/egiga.c |4 +- drivers/net/egiga.h | 198 +- include/configs/edminiv2.h | 30 +++- 7 files changed, 225 insertions(+), 107 deletions(-) create mode 100644 board/LaCie/edminiv2/edminiv2.h diff --git a/arch/arm/cpu/arm926ejs/orion5x/cpu.c b/arch/arm/cpu/arm926ejs/orion5x/cpu.c index 03c6d06..a468c4d 100644 --- a/arch/arm/cpu/arm926ejs/orion5x/cpu.c +++ b/arch/arm/cpu/arm926ejs/orion5x/cpu.c @@ -268,3 +268,21 @@ int arch_misc_init(void) return 0; } #endif /* CONFIG_ARCH_MISC_INIT */ + +#ifdef CONFIG_EGIGA +int cpu_eth_init(bd_t *bis) +{ + egiga_initialize(bis); + return 0; +} + +/* + * Generates a non-random hex number just to make egiga.c happy Do not make anybody happy This is misleading for generic code, instead you can eliminate this support under CONFIG_SYS_GEN_RANDOM_MAC macro + * if a MAC address has to be generated + */ +unsigned char get_random_hex(void) +{ + static unsigned char seed = 0; + return seed++; +} +#endif diff --git a/arch/arm/include/asm/arch-orion5x/orion5x.h b/arch/arm/include/asm/arch-orion5x/orion5x.h index 4008c84..ffe26bd 100644 --- a/arch/arm/include/asm/arch-orion5x/orion5x.h +++ b/arch/arm/include/asm/arch-orion5x/orion5x.h @@ -56,6 +56,11 @@ #define ORION5X_USB20_PORT1_BASE (ORION5X_REGISTER(0xA)) #define ORION5X_EGIGA_BASE (ORION5X_REGISTER(0x72000)) +/* EGIGA expects EGIGA0 #define'd */ +#if defined (CONFIG_EGIGA) +#define EGIGA0_BASE ORION5X_EGIGA_BASE +#endif + #define CONFIG_MAX_RAM_BANK_SIZE (64*1024*1024) /* include here SoC variants. 5181, 5281, 6183 should go here when diff --git a/board/LaCie/edminiv2/edminiv2.c b/board/LaCie/edminiv2/edminiv2.c index 54c0ffe..d46ee4a 100644 --- a/board/LaCie/edminiv2/edminiv2.c +++ b/board/LaCie/edminiv2/edminiv2.c @@ -27,6 +27,7 @@ #include common.h #include miiphy.h #include asm/arch/orion5x.h +#include edminiv2.h DECLARE_GLOBAL_DATA_PTR; @@ -90,3 +91,38 @@ int board_init(void) return 0; } Its better if you abstract reset_phy out from here, it is irreverent to patch subject. secondly it should go as patch for board support (will be picked by different custodians) + +#if defined (CONFIG_CMD_NET) defined (CONFIG_RESET_PHY_R) +/* Configure and enable MV88E1116 PHY */ +void reset_phy(void) +{ + u16 reg; + u16 devadr; + char *name = egiga0; + + if (miiphy_set_current_dev(name)) + return; + + /* command to read PHY dev address */ + if (miiphy_read(name, 0xEE, 0xEE, (u16 *) devadr)) { + printf(Err..%s could not read PHY dev address\n, + __FUNCTION__); + return; + } + + /* + * Enable RGMII delay on Tx and Rx for CPU port + * Ref: sec 4.7.2 of chip datasheet + */ + miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); + miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, reg); + reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); + miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); + miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); + + /* reset the phy */ + miiphy_reset(name, devadr); + + printf(88E1116 Initialized on %s\n, name); +} +#endif /* CONFIG_RESET_PHY_R */ diff --git a/board/LaCie/edminiv2/edminiv2.h b/board/LaCie/edminiv2/edminiv2.h new file mode 100644 index 000..88e62b2 --- /dev/null +++ b/board/LaCie/edminiv2/edminiv2.h @@ -0,0 +1,41 @@ +/* + * (C) Copyright 2009 + * Net Insight www.netinsight.net + * Written-by: Simon Kagstrom simon.kagst...@netinsight.net + * + * Based on sheevaplug.h: + * (C) Copyright 2009 + * Marvell Semiconductor www.marvell.com + * Written-by: Prafulla Wadaskar prafu...@marvell.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can
Re: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga The names of the egiga files mention kirkwood even though they are not kirkwood-specific - change them. Signed-off-by: Albert Aribaud albert.arib...@free.fr --- drivers/net/Makefile |2 +- drivers/net/egiga.c | 719 ++ drivers/net/egiga.h | 505 + drivers/net/kirkwood_egiga.c | 719 -- drivers/net/kirkwood_egiga.h | 505 - 5 files changed, 1225 insertions(+), 1225 deletions(-) create mode 100644 drivers/net/egiga.c create mode 100644 drivers/net/egiga.h if it is generic gigabit Ethernet driver abstraction, could be applicable to any kind of SOC then the same egiga is relevant. which is not the case here if it is Marvell specific then the name should be like- mv_egiga I think we should sync on the arch first, that would same lot of coding/review efforts I have below mentioned architecture for this driver - 1. Abstract generic SoC independent driver skeleton into mv_egiga.c/h 2. Abstract and put Kirkwood specific functions is arch/arm/cpu/kirkwood/egiga.c 3. Create and put Orion specific functions is arch/arm/cpu/orion5x/egiga.c 4. Use common APIs/Macros to call SoC specific functions in generic driver 5. same strategy should be applied for header files abstraction. delete mode 100644 drivers/net/kirkwood_egiga.c delete mode 100644 drivers/net/kirkwood_egiga.h diff --git a/drivers/net/Makefile b/drivers/net/Makefile index b75c02f..8853908 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile @@ -46,7 +46,7 @@ COBJS-$(CONFIG_FSLDMAFEC) += fsl_mcdmafec.o mcfmii.o COBJS-$(CONFIG_FTMAC100) += ftmac100.o COBJS-$(CONFIG_GRETH) += greth.o COBJS-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o -COBJS-$(CONFIG_KIRKWOOD_EGIGA) += kirkwood_egiga.o +COBJS-$(CONFIG_KIRKWOOD_EGIGA) += egiga.o there should be generic CONFIG to address this build, and CONFIG_KIRKWOOD_EGIGA should address its SOC specific dependency, you have done this in patch 3/4 COBJS-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o COBJS-$(CONFIG_LAN91C96) += lan91c96.o COBJS-$(CONFIG_MACB) += macb.o diff --git a/drivers/net/egiga.c b/drivers/net/egiga.c As suggested by Ben rest should be rename activity than delete/add for 1/x patch Regards.. Prafulla . . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC Macros, types, variables, functions in egiga refer to kirkwood even though they are not kirkwood-specific. Rename them, across the whole source tree when necessary. NAK, as commented for Patch 1/4 you can address it more like splitting a driver into generic and specific interfaces and then adding new support Regards.. Prafulla .. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood Set DRAM windows by using gd as other drivers do, instead of calling kirkwood-specific functions. Signed-off-by: Albert Aribaud albert.arib...@free.fr --- drivers/net/egiga.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/egiga.c b/drivers/net/egiga.c index 50e8ff3..cbe4748 100644 --- a/drivers/net/egiga.c +++ b/drivers/net/egiga.c @@ -38,6 +38,8 @@ #include asm/arch/kirkwood.h #include egiga.h +DECLARE_GLOBAL_DATA_PTR; + #define KIRKWOOD_PHY_ADR_REQUEST 0xee #define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)-smi) @@ -246,8 +248,8 @@ static void set_dram_access(struct kwgbe_registers *regs) win_param.access_ctrl = EWIN_ACCESS_FULL; win_param.high_addr = 0; /* Get bank base */ - win_param.base_addr = kw_sdram_bar(i); - win_param.size = kw_sdram_bs(i);/* Get bank size */ + win_param.base_addr = gd-bd-bi_dram[i].start; + win_param.size = gd-bd-bi_dram[i].size; if (win_param.size == 0) win_param.enable = 0; else this is good patch indeed to make the driver more generic, which is independent of this activity please post this patch for current version i.e. kirkwood_egiga.c Regards.. Prafulla . . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code
Hello Mike, Mike Frysinger wrote: Use the new common gpio framework to simplify and unify the soft i2c configuration settings. Signed-off-by: Mike Frysinger vap...@gentoo.org --- note: i can run this through the Blackfin tree if you want I actually tried your 2 patches, but this patch doesn;t apply :-( [...@pollux u-boot-i2c]$ git am -i --whitespace=strip \[U-Boot\]\ \[PATCH\ 2_2\]\ Blackfin\:\ bf533_bf561\ boards\:\ convert\ to\ new\ soft\ gpio\ i2c\ code.eml Commit Body is: -- Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code Use the new common gpio framework to simplify and unify the soft i2c configuration settings. Signed-off-by: Mike Frysinger vap...@gentoo.org -- Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y Applying: Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code error: patch failed: include/configs/bf533-ezkit.h:94 error: include/configs/bf533-ezkit.h: patch does not apply error: patch failed: include/configs/bf533-stamp.h:138 error: include/configs/bf533-stamp.h: patch does not apply error: patch failed: include/configs/bf561-ezkit.h:112 error: include/configs/bf561-ezkit.h: patch does not apply error: patch failed: include/configs/ibf-dsp561.h:112 error: include/configs/ibf-dsp561.h: patch does not apply Patch failed at 0001 Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code When you have resolved this problem run git am -i --resolved. If you would prefer to skip this patch, instead run git am -i --skip. To restore the original branch and stop patching run git am -i --abort. [...@pollux u-boot-i2c]$ Beside of this issue, your 2 patches are looking good! So, if you want to pick up this patches in your blackfin tree, you can add my Acked-by: Heiko Schocher h...@denx.de bye Heiko -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga
Le 05/07/2010 13:02, Prafulla Wadaskar a écrit : if it is generic gigabit Ethernet driver abstraction, could be applicable to any kind of SOC then the same egiga is relevant. which is not the case here if it is Marvell specific then the name should be like- mv_egiga As it is Marvell-IP specific, I'll rename it to mv_egiga. I think we should sync on the arch first, that would same lot of coding/review efforts I have below mentioned architecture for this driver - 1. Abstract generic SoC independent driver skeleton into mv_egiga.c/h 2. Abstract and put Kirkwood specific functions is arch/arm/cpu/kirkwood/egiga.c 3. Create and put Orion specific functions is arch/arm/cpu/orion5x/egiga.c 4. Use common APIs/Macros to call SoC specific functions in generic driver 5. same strategy should be applied for header files abstraction. Agree. there should be generic CONFIG to address this build, and CONFIG_KIRKWOOD_EGIGA should address its SOC specific dependency, you have done this in patch 3/4 Yes, I have. Do you mean you would prefer everything--file renaming, symbol renaming--in a single commit? As suggested by Ben rest should be rename activity than delete/add for 1/x patch Ok. Thanks for the feedback. I'll provide an updated patchset once I get your answer to my question above. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC
Le 05/07/2010 13:02, Prafulla Wadaskar a écrit : -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC Macros, types, variables, functions in egiga refer to kirkwood even though they are not kirkwood-specific. Rename them, across the whole source tree when necessary. NAK, as commented for Patch 1/4 you can address it more like splitting a driver into generic and specific interfaces and then adding new support I'm not sure I get your meaning here. Do you suggest I submit not four but only two patches, one with all egiga-out-of-kirkwood changes and one with orion5x support? Or is is something else entirely? Regards.. Prafulla .. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] cmd_date.c error or itention?
Hi, cmd_data.c codes the following: case 2: /* set date time */ if (strcmp(argv[1],reset) == 0) { puts (Reset RTC...\n); rtc_reset (); } else { /* initialize tm with current time */ rcode = rtc_get (tm); if(!rcode) { /* insert new date time */ if (mk_date (argv[1], tm) != 0) { puts (## Bad date format\n); break; } /* and write to RTC */ rcode = rtc_set (tm); if(rcode) puts(## Set date failed\n); } else { puts(## Get date failed\n); } } /* FALL TROUGH */ Now I have implemented rtc_get() such that it returns an error code when the time is corrupt/has never been set. However the if(!rcode) then prevents the time to be set! Is that intentional and rtc_get() should never return an error ?? Or is it an oversight, and a patch would be welcome ? Reinhard ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga
-Original Message- From: Albert ARIBAUD [mailto:albert.arib...@free.fr] Sent: Monday, July 05, 2010 5:06 PM To: Prafulla Wadaskar Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga Le 05/07/2010 13:02, Prafulla Wadaskar a écrit : if it is generic gigabit Ethernet driver abstraction, could be applicable to any kind of SOC then the same egiga is relevant. which is not the case here if it is Marvell specific then the name should be like- mv_egiga As it is Marvell-IP specific, I'll rename it to mv_egiga. I think we should sync on the arch first, that would same lot of coding/review efforts I have below mentioned architecture for this driver - 1. Abstract generic SoC independent driver skeleton into mv_egiga.c/h 2. Abstract and put Kirkwood specific functions is arch/arm/cpu/kirkwood/egiga.c 3. Create and put Orion specific functions is arch/arm/cpu/orion5x/egiga.c 4. Use common APIs/Macros to call SoC specific functions in generic driver 5. same strategy should be applied for header files abstraction. Agree. there should be generic CONFIG to address this build, and CONFIG_KIRKWOOD_EGIGA should address its SOC specific dependency, you have done this in patch 3/4 Yes, I have. Do you mean you would prefer everything--file renaming, symbol renaming--in a single commit? Ideally, patch should be small as per functionality and objective, that gives better understanding even for someone who is not directly related. also it is easier to be get accepted acked faster. I feel you should create a patches as below: standalone patches 1. kirkwood_egiga: Updates: using global data ptr for DRAM configuration and cosmetic fix 2. edbiniv2: board configuration cleanup and enhancements patch series: 1. [1/5] net: rename: kirkwood_egiga as mv_egiga 2. [2/5] net: mv_egiga: Split SoC specific (Kirkwood) code to support other SoCs 3. [3/5] net: mv_egiga: add support for orion5x gigabit Ethernet controller 5. [4/5] net mv_egiga: bugfix: DMA issued fixed using volatile 5. [5/5] edminiv2: add Ethernet support Regards.. Prafulla. . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC
-Original Message- From: Albert ARIBAUD [mailto:albert.arib...@free.fr] Sent: Monday, July 05, 2010 5:12 PM To: Prafulla Wadaskar Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC Le 05/07/2010 13:02, Prafulla Wadaskar a écrit : -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 3/4] egiga: remove references to kirkwood SoC Macros, types, variables, functions in egiga refer to kirkwood even though they are not kirkwood-specific. Rename them, across the whole source tree when necessary. NAK, as commented for Patch 1/4 you can address it more like splitting a driver into generic and specific interfaces and then adding new support I'm not sure I get your meaning here. Do you suggest I submit not four but only two patches, one with all egiga-out-of-kirkwood changes and one with orion5x support? Or is is something else entirely? I have clarified it in earlier email, hope it is clear now Regards.. Prafulla . . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] 答复: [PATCH] AT91SAM9260/9XE: a dd support for MultiMedia Card Interfac e (MCI)
Dear Xu, Hong, In message 0f5f73e36031fd46ad3f2e6948f0c0a0205...@frimb01.corp.atmel.com you wrote: The reason is I tried to apply the patch on top of 1) master branch of the mainline U-Boot 2) current master of u-boot-at91.git 3) The old master of u-boot-at91.git all of them are failed. Since you said the patch is cleanly against master of mainline U-Boot, = I'll rework. It applies indeed without problems on top of the current master branch (i. e. on top of commit v2010.06-73-g54841ab) : - git-am -3 -i -u --whitespace=strip ~/Mail/U-Boot/8433 Commit Body is: -- AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI) This patch adds support for the Atmel MultiMedia Card Interface (MCI) in AT91SAM9260 and AT91SAM9XE SoCs and preserves the original support for the AVR32AP700x SoCs. It patches the original atmel_mci.c driver to remove byte order and toolchain dependencies and makes it a common MCI driver for Atmels AVR32AP7000 and AT91SAM9260 based SoCs. The driver itself is not specific to those SoCs and should work with other Atmel devices having an identical MultiMedia Card Interface (MCI), provided the functions get_mci_clk_rate() and SoC_mci_hw_init() are defined. Tested on AT91SAM9XE-EK (AT91SAM9XE512) Tested on ATNGW100 (AVR32AP7000) Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de -- Apply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all y Applying: AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI) - Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de The project was large enough and management communication poor enough to prompt many members of the team to see themselves as contestants making brownie points, rather than as builders making programming products. Each suboptimized his piece to meet his targets; few stopped to think about the total effect on the customer. - Fred Brooks, The Mythical Man Month ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] cmd_date.c error or itention?
Dear Reinhard Meyer (-VC), In message 4c31c596.5020...@emk-elektronik.de you wrote: cmd_data.c codes the following: ... rcode = rtc_get (tm); if(!rcode) { /* insert new date time */ if (mk_date (argv[1], tm) != 0) { puts (## Bad date format\n); break; } /* and write to RTC */ rcode = rtc_set (tm); if(rcode) puts(## Set date failed\n); } else { puts(## Get date failed\n); } ... Now I have implemented rtc_get() such that it returns an error code when the time is corrupt/has never been set. It is considered kind of normal that a RTC may return corrupt data. This is not an error, as it will be fixed when setting the date. An error condition is something that really makes the RTC unusable, like non-functioning communication on the I2C bus (if your RTC is connected to that), or reading a Low Voltage error status from the RTC status register, etc. However the if(!rcode) then prevents the time to be set! Well, if you cannot eliably communicate with the RTC when reading, there is little sense trying to write to it - on contrary, this might even be dangerous. Is that intentional and rtc_get() should never return an error ?? Or is it an oversight, and a patch would be welcome ? The behaviour is intentional, but rtc_get() can of course return error codes - only your expectation when this is the case is different from mine. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Misquotation is, in fact, the pride and privilege of the learned. A widely-read man never quotes accurately, for the rather obvious reason that he has read too widely. - Hesketh Pearson _Common Misquotations_ introduction ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 1/4] ARM: Rename kirkwood_egiga driver to egiga
Le 05/07/2010 14:01, Prafulla Wadaskar a écrit : I feel you should create a patches as below: standalone patches 1. kirkwood_egiga: Updates: using global data ptr for DRAM configuration and cosmetic fix 2. edbiniv2: board configuration cleanup and enhancements patch series: 1. [1/5] net: rename: kirkwood_egiga as mv_egiga 2. [2/5] net: mv_egiga: Split SoC specific (Kirkwood) code to support other SoCs 3. [3/5] net: mv_egiga: add support for orion5x gigabit Ethernet controller 5. [4/5] net mv_egiga: bugfix: DMA issued fixed using volatile 5. [5/5] edminiv2: add Ethernet support Ok--I'll re-post the independent patches and patch series as suggested later today. Thanks for the guidance! Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] Blackfin: bf533/bf561 boards: convert to new soft gpio i2c code
On Monday, July 05, 2010 07:14:16 Heiko Schocher wrote: Mike Frysinger wrote: Use the new common gpio framework to simplify and unify the soft i2c configuration settings. Signed-off-by: Mike Frysinger vap...@gentoo.org --- note: i can run this through the Blackfin tree if you want I actually tried your 2 patches, but this patch doesn;t apply :-( it might depend on patches that are pending in my tree ... So, if you want to pick up this patches in your blackfin tree, you can add my Acked-by: Heiko Schocher h...@denx.de will do then, thanks -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v3] NAND: environment offset in OOB (CONFIG_ENV_OFFSET_OOB)
Dear Harald, On Thu, Jul 1, 2010 at 3:17 AM, Harald Welte lafo...@gnumonks.org wrote: I think if you add a (C) statement to code that is based on my work, I believei it is fair to add a (C) statement for OpenMoko Inc. for whom I was working at that time. After all, they hold the copyright to the original OOB environment offset (and have licensed the code under GPL) You're right -- I'm sorry for that omission. It was not intentional. Thank you for pointing this out. I will add the (C) Copyright 2006-2007 OpenMoko, Inc. statement found currently in the openmoko u-boot tree [1] with remark 'dynenv' Dynamic environment offset in NAND OOB and post an updated patch shortly. Best Regards, Ben Gardiner [1] http://git.openmoko.org/?p=u-boot.git;a=blob_plain;f=common/cmd_dynenv.c;hb=refs/heads/mokopatches --- Nanometrics Inc. +1 (613) 592-6776 x239 http://www.nanometrics.ca ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI)
Dear Wolfgang, It seems the root cause of my failure of applying Reinhard's patch is the exchange server settings. Some of the space/tabs are converted/expanded in a wrong way. Thanks for the help and hints from you and Mr.Reinhard. BR, Eric -Original Message- From: Wolfgang Denk [mailto:w...@denx.de] Sent: 2010-7-5 (星期一) 20:46 To: Xu, Hong Cc: reinhard.me...@emk-elektronik.de; u-boot Subject: Re: 答复: [U-Boot] [PATCH] AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI) Dear Xu, Hong, In message 0f5f73e36031fd46ad3f2e6948f0c0a0205...@frimb01.corp.atmel.com you wrote: The reason is I tried to apply the patch on top of 1) master branch of the mainline U-Boot 2) current master of u-boot-at91.git 3) The old master of u-boot-at91.git all of them are failed. Since you said the patch is cleanly against master of mainline U-Boot, = I'll rework. It applies indeed without problems on top of the current master branch (i. e. on top of commit v2010.06-73-g54841ab) : - git-am -3 -i -u --whitespace=strip ~/Mail/U-Boot/8433 Commit Body is: -- AT91SAM9260/9XE: add support for MultiMedia Card Interface (MCI) This patch adds support for the Atmel MultiMedia Card Interface (MCI) in AT91SAM9260 and AT91SAM9XE SoCs and preserves the original support for the AVR32AP700x SoCs. It patches the original atmel_mci.c driver to remove byte order and toolchain dependencies and makes it a common MCI driver for Atmels AVR32AP7000 and AT91SAM9260 based SoCs. The driver itself is not specific to those SoCs and should work with other Atmel devices having an identical MultiMedia Card Interface (MCI), [...] ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3 v8] mmc: add generic mmc spi driver
Hi Mike, Thank you very much for the review and testing. On 07/05/2010 03:40 PM, Mike Frysinger wrote: On Wednesday, May 19, 2010 00:37:47 Thomas Chou wrote: --- /dev/null +++ b/common/cmd_mmc_spi.c +printf(%s: %d at %u:%u %u %u\n, mmc-name, mmc-block_dev.dev, + bus, cs, speed, mode); this is a bit terse. how about prefixing the hz output with like hz: and the mode with like mode: ? Yes, I will add them. +U_BOOT_CMD( +mmc_spi,4, 0, do_mmc_spi, +mmc_spi setup, +[bus:]cs [hz] [mode] - setup mmc_spi device on given\n + SPI bus and chip select\n +); there should be no newline at the end of the help string OK. I will remove the last newline. --- /dev/null +++ b/drivers/mmc/mmc_spi.c +struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode) +{ +struct mmc *mmc; +mmc-b_max = MMC_SPI_MAX_BLOCKS; do you have some local modification ? i dont see b_max anywhere in include/mmc.h ... Please apply the multi-blocks patches (1,2,3/4) from Alagu on 05/12, as Andy said he had applied them. unfortunately though, i tried this on my system and it doesnt seem to work. using a simple SPI-MMC card, the old mmc_spi driver works on my board, but booting the new u-boot and running the same things shows: mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp4 1 these last 2 lines repeat for a while Card did not respond to voltage select! It seems the mmc card was not initialized and timed out. Please try remove the OCR_HCS in mmc_send_op_cond() of mmc.c temporarily. cmd.cmdarg = OCR_HCS | mmc-voltages; -^ Best regards, Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2 v2] gpio_led: add gpio_request to __led_init
On 06/16/2010 09:29 AM, Scott McNutt wrote: Applied to: git://git.denx.de/u-boot-nios.git next Thanks, --Scott Dear Scott, Would you please send a pull request to Wolfgang? Best regards, Thomas Thomas Chou wrote: This patch adds the gpio usage request. The polarity is changed to positive as suggested by Mike Frysinger. Signed-off-by: Thomas Chou tho...@wytron.com.tw --- v2: fix typo, change led polarity drivers/misc/gpio_led.c | 12 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index acd6a90..3fedddc 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -2,26 +2,22 @@ * Status LED driver based on GPIO access conventions of Linux * * Copyright (C) 2010 Thomas Chou tho...@wytron.com.tw - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. + * Licensed under the GPL-2 or later. */ #include common.h #include status_led.h #include asm/gpio.h -/* assume led is active low */ - void __led_init(led_id_t mask, int state) { - gpio_direction_output(mask, (state == STATUS_LED_ON) ? 0 : 1); + gpio_request(mask, gpio_led); + gpio_direction_output(mask, state == STATUS_LED_ON); } void __led_set(led_id_t mask, int state) { - gpio_set_value(mask, (state == STATUS_LED_ON) ? 0 : 1); + gpio_set_value(mask, state == STATUS_LED_ON); } void __led_toggle(led_id_t mask) ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] cmd_date.c error or itention?
Wolfgang Denk schrieb: Dear Reinhard Meyer (-VC), In message 4c31c596.5020...@emk-elektronik.de you wrote: cmd_data.c codes the following: ... rcode = rtc_get (tm); if(!rcode) { /* insert new date time */ if (mk_date (argv[1], tm) != 0) { puts (## Bad date format\n); break; } /* and write to RTC */ rcode = rtc_set (tm); if(rcode) puts(## Set date failed\n); } else { puts(## Get date failed\n); } ... Now I have implemented rtc_get() such that it returns an error code when the time is corrupt/has never been set. It is considered kind of normal that a RTC may return corrupt data. This is not an error, as it will be fixed when setting the date. An error condition is something that really makes the RTC unusable, like non-functioning communication on the I2C bus (if your RTC is connected to that), or reading a Low Voltage error status from the RTC status register, etc. However the if(!rcode) then prevents the time to be set! Well, if you cannot eliably communicate with the RTC when reading, there is little sense trying to write to it - on contrary, this might even be dangerous. Is that intentional and rtc_get() should never return an error ?? Or is it an oversight, and a patch would be welcome ? The behaviour is intentional, but rtc_get() can of course return error codes - only your expectation when this is the case is different from mine. Dear Wolfgang, of course that depends on what is considered an error. As well as there is a difference between read error and file not found, there well might be a difference in clock nonfunctional and time invalid... But alas, I will make rtc_get not return an error and zero out the tm structure instead when the driver KNOWS the date is not correct. And btw. a low voltage status error from the clock does not necessaryly mean the clock cannot be set again, that status (and thats exactly what I intended to return) just could mean that the backup voltage was too low during a system unpowered time to guarantee a proper date but since (in our case) the backup power comes from a GoldCap a new set of the clock would heal that status. And if the clock really would be defective /* and write to RTC */ rcode = rtc_set (tm); if(rcode) puts(## Set date failed\n); would still give a proper error message! Reinhard attachment: reinhard_meyer.vcf___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] cmd_date.c error or itention?
Dear Reinhard Meyer, In message 4c31ed2b.1020...@emk-elektronik.de you wrote: As well as there is a difference between read error and file not found, there well might be a difference in clock nonfunctional and time invalid... Indeed. But alas, I will make rtc_get not return an error and zero out the tm structure instead when the driver KNOWS the date is not correct. Why would you do that? This prevents anybody trying to track down problems from seeing what is really going on. When you retrun the real (incorrect) data, I can see if the attempt to set the date shows any affect at all - with your method I don't see anything at all. Did you read my argumentation why I rejected anatolij's patch to fix unaligned bus accesses on the 5200/512x in the md command? That's the same here. Do not hush up errors. Let the user see what is really going on. If I can see a bogus date but repeated calls show increments in the seconds register this is much, much more useful than seing zero values. And btw. a low voltage status error from the clock does not necessaryly mean the clock cannot be set again, that status (and thats exactly what I intended to return) just could mean that the backup voltage was too low during a system unpowered time to guarantee a proper date but since (in our case) the backup power comes from a GoldCap a new set of the clock would heal that status. This may be the case with your RTC and on your board. Other hardware may behave differently. I just tried to come up with an example. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de If I can have honesty, it's easier to overlook mistakes. -- Kirk, Space Seed, stardate 3141.9 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] cmd_date.c error or itention?
Wolfgang Denk schrieb: Dear Reinhard Meyer, In message 4c31ed2b.1020...@emk-elektronik.de you wrote: As well as there is a difference between read error and file not found, there well might be a difference in clock nonfunctional and time invalid... Indeed. But alas, I will make rtc_get not return an error and zero out the tm structure instead when the driver KNOWS the date is not correct. Why would you do that? This prevents anybody trying to track down problems from seeing what is really going on. When you retrun the real (incorrect) data, I can see if the attempt to set the date shows any affect at all - with your method I don't see anything at all. So far no AT91SAM9xxx board has a date command in u-boot. The kernel as it is will not set the system time when the offset register is zero. If the register is non-zero the time will be used. I'm just trying to have the same behaviour in u-boot. Besides your argumentation is flawed: why try to READ the clock when I am going to set it anyway? This reading and the following if just increase the code size :) Now setting the clock still gives the warning (puts() in the driver) that the time is invalid (because the time is read before overwritten). I think that is more irritating. So your suggestions is then to have the driver not say anything at all, just return OK and a bogus value... Reinhard attachment: reinhard_meyer.vcf___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 0/3] AT91: add header files, update cpu.c, add RTC support
This is a series of 3 patches: [PATCH 1/3] AT91: add two new header files for RTT and GPBR - adds at91_rtt.h and at91_gpbr.h - condenses GPBR usage assignment into one file (at91_gpbr.h) - required to compile the following two patches [PATCH 2/3] AT91: update cpu.c to use GPBR definitions from at91_gpbr.h - no functional change, just make use of at91_gpbr.h [PATCH 3/3] AT91: add RTT and GPBR based RTC support - adds kernel compatible RTC handling to u-boot using the RTT and one GPBRegister ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 1/3] AT91: add two new header files for RTT and GPBR
adds at91_rtt.h and at91_gpbr.h condenses GPBR usage assignment into one file (at91_gpbr.h) Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de --- arch/arm/include/asm/arch-at91/at91_gpbr.h | 45 arch/arm/include/asm/arch-at91/at91_rtt.h | 36 ++ 2 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-at91/at91_gpbr.h create mode 100644 arch/arm/include/asm/arch-at91/at91_rtt.h diff --git a/arch/arm/include/asm/arch-at91/at91_gpbr.h b/arch/arm/include/asm/arch-at91/at91_gpbr.h new file mode 100644 index 000..cf1d790 --- /dev/null +++ b/arch/arm/include/asm/arch-at91/at91_gpbr.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 + * Reinhard Meyer, reinhard.me...@emk-elektronik.de + * + * General Purpose Backup Registers + * Based on AT91SAM9XE datasheet + * + * 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. + */ + +#ifndef AT91_GPBR_H +#define AT91_GPBR_H + +/* + * The Atmel AT91SAM9 series has a small resource of 4 nonvolatile + * 32 Bit registers (buffered by the Vbu power). + * + * Please consider carefully before using this resource for tasks + * that do not really need nonvolatile registers. Maybe you can + * store information in EEPROM or FLASH instead. + * + * However, if you use a GPBR please document its use here and + * reference the define in your code! + * + * known typical uses of the GPBRs: + * GPBR[0]: offset for RTT timekeeping (u-boot, kernel) + * GPBR[1]: unused + * GPBR[2]: unused + * GPBR[3]: bootcount (u-boot) + */ +#define AT91_GPBR_INDEX_TIMEOFF 0 +#define AT91_GPBR_INDEX_BOOTCOUNT 3 + +#ifndef __ASSEMBLY__ + +typedef struct at91_gpbr { + u32 reg[4]; +} at91_gpbr_t; + +#endif /* __ASSEMBLY__ */ + +#endif diff --git a/arch/arm/include/asm/arch-at91/at91_rtt.h b/arch/arm/include/asm/arch-at91/at91_rtt.h new file mode 100644 index 000..e0253ef --- /dev/null +++ b/arch/arm/include/asm/arch-at91/at91_rtt.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 + * Reinhard Meyer, reinhard.me...@emk-elektronik.de + * + * Real-time Timer + * Based on AT91SAM9XE datasheet + * + * 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. + */ + +#ifndef AT91_RTT_H +#define AT91_RTT_H + +#ifndef __ASSEMBLY__ + +typedef struct at91_rtt { + u32 mr; /* Mode Register RW 0x8000 */ + u32 ar; /* Alarm Register RW 0x */ + u32 vr; /* Value Register RO 0x */ + u32 sr; /* Status Register RO 0x */ +} at91_rtt_t; + +#endif /* __ASSEMBLY__ */ + +#define AT91_RTT_MR_RTPRES 0x +#define AT91_RTT_MR_ALMIEN 0x0001 +#define AT91_RTT_RTTINCIEN 0x0002 +#define AT91_RTT_RTTRST0x0004 + +#define AT91_RTT_SR_ALMS 0x0001 +#define AT91_RTT_SR_RTTINC 0x0002 + +#endif -- 1.5.6.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 2/3] AT91: update cpu.c to use GPBR definitions from at91_gpbr.h
no functional change, just make use of at91_gpbr.h Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de --- arch/arm/cpu/arm926ejs/at91/cpu.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c index 141a7d1..1a7e99f 100644 --- a/arch/arm/cpu/arm926ejs/at91/cpu.c +++ b/arch/arm/cpu/arm926ejs/at91/cpu.c @@ -28,6 +28,7 @@ #include asm/arch/hardware.h #include asm/arch/at91_pmc.h +#include asm/arch/at91_gpbr.h #include asm/arch/clk.h #include asm/arch/io.h @@ -36,11 +37,10 @@ #endif /* - * The at91sam9260 has 4 GPBR (0-3), we'll use the last one, nr 3, - * to keep track of the bootcount. + * The at91sam9260 has 4 GPBR (0-3). + * For their typical use see at91_gpbr.h ! */ -#define AT91_GPBR_BOOTCOUNT_REGISTER 3 -#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_BOOTCOUNT_REGISTER) +#define AT91_BOOTCOUNT_ADDRESS (AT91_GPBR + 4*AT91_GPBR_INDEX_BOOTCOUNT) int arch_cpu_init(void) { -- 1.5.6.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/3] AT91: add RTT and GPBR based RTC support
adds kernel compatible RTC handling to u-boot using the RTT and one GPBRegister Signed-off-by: Reinhard Meyer reinhard.me...@emk-elektronik.de --- drivers/rtc/Makefile |1 + drivers/rtc/at91sam9.c | 100 2 files changed, 101 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/at91sam9.c diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 772a49a..53db3d0 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -29,6 +29,7 @@ LIB = $(obj)librtc.a COBJS-$(CONFIG_RTC_BFIN) += bfin_rtc.o COBJS-y += date.o +COBJS-$(CONFIG_RTC_AT91SAM9) += at91sam9.o COBJS-$(CONFIG_RTC_DS12887) += ds12887.o COBJS-$(CONFIG_RTC_DS1302) += ds1302.o COBJS-$(CONFIG_RTC_DS1306) += ds1306.o diff --git a/drivers/rtc/at91sam9.c b/drivers/rtc/at91sam9.c new file mode 100644 index 000..6ec8e8e --- /dev/null +++ b/drivers/rtc/at91sam9.c @@ -0,0 +1,100 @@ +/* + * (C) Copyright 2010 + * Reinhard Meyer, reinhard.me...@emk-elektronik.de + * + * 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 + */ + +/* + * Date Time support for the internal Real-time Timer + * of AT91SAM9260 and compatibles. + * Compatible with the LinuX rtc driver workaround: + * The RTT cannot be written to, but only reset. + * The actual time is the sum of RTT and one of + * the four GPBR registers. + * + * The at91sam9260 has 4 GPBR (0-3). + * For their typical use see at91_gpbr.h ! + * + * make sure u-boot and kernel use the same GPBR ! + */ + +#include common.h +#include command.h +#include rtc.h +#include asm/errno.h +#include asm/arch/hardware.h +#include asm/arch/io.h +#include asm/arch/at91_rtt.h +#include asm/arch/at91_gpbr.h + +#if defined(CONFIG_CMD_DATE) + +int rtc_get (struct rtc_time *tmp) +{ + at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; + at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + ulong tim; + ulong tim2; + ulong off; + + do { + tim = readl(rtt-vr); + tim2 = readl(rtt-vr); + } while (tim!=tim2); + off = readl(gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]); + /* off==0 means time is invalid, but we ignore that */ + to_tm (tim+off, tmp); + return 0; +} + +int rtc_set (struct rtc_time *tmp) +{ + at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; + at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + ulong tim; + + tim = mktime (tmp-tm_year, tmp-tm_mon, tmp-tm_mday, + tmp-tm_hour, tmp-tm_min, tmp-tm_sec); + + /* clear alarm, set prescaler to 32768, clear counter */ + writel(32768+AT91_RTT_RTTRST, rtt-mr); + writel(~0, rtt-ar); + writel(tim, gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]); + /* wait for counter clear to happen, takes less than a 1/32768th second */ + while (readl(rtt-vr) != 0) + ; + return 0; +} + +void rtc_reset (void) +{ + at91_rtt_t *rtt = (at91_rtt_t *) AT91_RTT_BASE; + at91_gpbr_t *gpbr = (at91_gpbr_t *) AT91_GPR_BASE; + + /* clear alarm, set prescaler to 32768, clear counter */ + writel(32768+AT91_RTT_RTTRST, rtt-mr); + writel(~0, rtt-ar); + writel(0, gpbr-reg[AT91_GPBR_INDEX_TIMEOFF]); + /* wait for counter clear to happen, takes less than a 1/32768th second */ + while (readl(rtt-vr) != 0) + ; +} + +#endif -- 1.5.6.5 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v4] NAND: environment offset in OOB (CONFIG_ENV_OFFSET_OOB)
This is a re-submission of the patch by Harald Welte lafo...@openmoko.org with minor modifications for rebase and changes as suggested by Scott Wood scottw...@freescale.com [1] [2]. This patch enables the environment partition to have a run-time dynamic location (offset) in the NAND flash. The reason for this is simply that all NAND flashes have factory-default bad blocks, and a fixed compile time offset would mean that sometimes the environment partition would live inside factory bad blocks. Since the number of factory default blocks can be quite high (easily 1.3MBytes in current standard components), it is not economic to keep that many spare blocks inside the environment partition. With this patch and CONFIG_ENV_OFFSET_OOB enabled, the location of the environment partition is stored in the out-of-band (OOB) data of the first block in flash. Since the first block is where most systems boot from, the vendors guarantee that the first block is not a factory default block. This patch introduces the 'nand env.oob' command, which can be called from the u-boot command line. 'nand env.oob get' reads the address of the environment partition from the OOB data, 'nand env.oob set {offset,partition-name}' allows the setting of the marker by specifying a numeric offset or a partition name. [1] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/43916 [2] http://article.gmane.org/gmane.comp.boot-loaders.u-boot/79195 Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca Acked-by: Harald Welte lafo...@gnumonks.org --- Changes in v4: * Added 'Acked-by Harald Welte' with permission. * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git * adding OpenMoko copyright statement as requested by Harald Welte lafo...@gnumonks.org in review * committing forgotten fixes for checkpath errors -- only two warnings remain, both of which are not applicable * fix warning created by passing const pointer to the do_nand_env_oob function which did not declare argv as a const pointer Changes in v3: * updated commit message * rebased to 39ddd10b046fb791f47281ffb2100be01909ad72 of git://git.denx.de/u-boot.git * tested using small config changes to include/configs/da850evm.h Changes in v2: * don't use generic names for the env-offset global and the comand * make a sub-command of the nand command * store the offset in units of eraseblocks * allocate oob write/read buffers on stack * verify write of new offset * make setting new offset affect the live values * update copyright of file * use the global variable instead of the macro in address statements * don't make the oob used bytes configurable * don't undef CONFIG_ENV_OFFSET I verified the patch with checkpath.pl. The checkpatch.pl output follows: WARNING: suspect code indent for conditional statements (8, 14) + if (strcmp(cmd, env.oob) == 0) + return do_nand_env_oob(cmdtp, nand_info[0], argc - 1, argv + 1); WARNING: Use #include linux/errno.h instead of asm/errno.h +#include asm/errno.h total: 0 errors, 2 warnings, 247 lines checked Neither of these warnings appear to be applicable. I tested the binary size and compiler warnings on ARM9 and 8xx with the following commands: #checkout u-boot/master, apply changes to da850evm_config for testing, #commit ./MAKEALL ARM9 21 ../makeall-master.log ./MAKEALL 8xx 21 ../makeall-master.log #apply patch, commit ./MAKEALL ARM9 21 ../makeall-env_oob.log ./MAKEALL 8xx 21 ../makeall-8xx-env_oob.log diff -burp ../makeall-8xx-master.log ../makeall-8xx-env_oob.log diff -burp ../makeall-master.log ../makeall-env_oob.log The only output of the diff commands was in the modified da850evm_config. The diff shows the text section has grown by 1352 bytes with the feature introduced by this patch enabled. @@ -48,7 +48,7 @@ Configuring for da830evm board... 147617 4888 295320 447825 6d551 ./u-boot Configuring for da850evm board... text data bss dec hex filename - 198497 10332 296608 505437 7b65d ./u-boot + 199849 10332 296612 506793 7bba9 ./u-boot Configuring for edb9301 board... text data bss dec hex filename 133899 3772 213400 351071 55b5f ./u-boot --- common/cmd_nand.c | 107 - common/env_nand.c | 46 + include/environment.h | 21 +++--- include/nand.h|9 4 files changed, 176 insertions(+), 7 deletions(-) diff --git a/common/cmd_nand.c b/common/cmd_nand.c index ea80555..a4c67c1 100644 --- a/common/cmd_nand.c +++ b/common/cmd_nand.c @@ -4,6 +4,10 @@ * (c) 1999 Machine Vision Holdings, Inc. * (c) 1999, 2000 David Woodhouse dw...@infradead.org * + * Ported 'dynenv' to 'nand env.oob' command + * (C) 2010 Nanometrics, Inc. + * 'dynenv' -- Dynamic environment offset in NAND OOB + * (C) Copyright 2006-2007 OpenMoko, Inc. * Added 16-bit
Re: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood
Le 05/07/2010 13:03, Prafulla Wadaskar a écrit : -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood Set DRAM windows by using gd as other drivers do, instead of calling kirkwood-specific functions. Signed-off-by: Albert Aribaudalbert.arib...@free.fr --- drivers/net/egiga.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/egiga.c b/drivers/net/egiga.c index 50e8ff3..cbe4748 100644 --- a/drivers/net/egiga.c +++ b/drivers/net/egiga.c @@ -38,6 +38,8 @@ #includeasm/arch/kirkwood.h #include egiga.h +DECLARE_GLOBAL_DATA_PTR; + #define KIRKWOOD_PHY_ADR_REQUEST 0xee #define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)-smi) @@ -246,8 +248,8 @@ static void set_dram_access(struct kwgbe_registers *regs) win_param.access_ctrl = EWIN_ACCESS_FULL; win_param.high_addr = 0; /* Get bank base */ -win_param.base_addr = kw_sdram_bar(i); -win_param.size = kw_sdram_bs(i);/* Get bank size */ +win_param.base_addr = gd-bd-bi_dram[i].start; +win_param.size = gd-bd-bi_dram[i].size; if (win_param.size == 0) win_param.enable = 0; else this is good patch indeed to make the driver more generic, which is independent of this activity please post this patch for current version i.e. kirkwood_egiga.c Regards.. Prafulla . . There is also a similar fix (move from kw_sdram_{bar,bs} to gd) to be done on drivers/usb/host/ehci-kirkwood.c, apparently. As I wasn't planning supporting USB with this patchset, I'd ignored it, but if you want I can submit a separate patch for it too. Amicalement, -- Albert. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] kirkwood_egiga: updates: fix DRAM mapping and typo
DRAM window mapping uses kirkwood-provided functions instead of global gd as do other drivers--fix this. Also, fix a typo in a comment Signed-off-by: Albert Aribaud albert.arib...@free.fr --- drivers/net/kirkwood_egiga.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c index 932792e..b7374b5 100644 --- a/drivers/net/kirkwood_egiga.c +++ b/drivers/net/kirkwood_egiga.c @@ -38,6 +38,8 @@ #include asm/arch/kirkwood.h #include kirkwood_egiga.h +DECLARE_GLOBAL_DATA_PTR; + #define KIRKWOOD_PHY_ADR_REQUEST 0xee #define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)-smi) @@ -245,9 +247,9 @@ static void set_dram_access(struct kwgbe_registers *regs) /* Enable full access */ win_param.access_ctrl = EWIN_ACCESS_FULL; win_param.high_addr = 0; - /* Get bank base */ - win_param.base_addr = kw_sdram_bar(i); - win_param.size = kw_sdram_bs(i);/* Get bank size */ + /* Get bank base and size */ + win_param.base_addr = gd-bd-bi_dram[i].start; + win_param.size = gd-bd-bi_dram[i].size; if (win_param.size == 0) win_param.enable = 0; else @@ -268,7 +270,7 @@ static void set_dram_access(struct kwgbe_registers *regs) win_param.attrib = EBAR_DRAM_CS3; break; default: - /* invalide bank, disable access */ + /* invalid bank, disable access */ win_param.enable = 0; win_param.attrib = 0; break; -- 1.6.4.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] kirkwood_egiga: updates: fix DRAM mapping and typo
-Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Monday, July 05, 2010 11:45 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] kirkwood_egiga: updates: fix DRAM mapping and typo DRAM window mapping uses kirkwood-provided functions instead of global gd as do other drivers--fix this. Also, fix a typo in a comment Signed-off-by: Albert Aribaud albert.arib...@free.fr --- drivers/net/kirkwood_egiga.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/kirkwood_egiga.c b/drivers/net/kirkwood_egiga.c index 932792e..b7374b5 100644 --- a/drivers/net/kirkwood_egiga.c +++ b/drivers/net/kirkwood_egiga.c @@ -38,6 +38,8 @@ #include asm/arch/kirkwood.h #include kirkwood_egiga.h +DECLARE_GLOBAL_DATA_PTR; + #define KIRKWOOD_PHY_ADR_REQUEST 0xee #define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)-smi) @@ -245,9 +247,9 @@ static void set_dram_access(struct kwgbe_registers *regs) /* Enable full access */ win_param.access_ctrl = EWIN_ACCESS_FULL; win_param.high_addr = 0; - /* Get bank base */ - win_param.base_addr = kw_sdram_bar(i); - win_param.size = kw_sdram_bs(i);/* Get bank size */ + /* Get bank base and size */ + win_param.base_addr = gd-bd-bi_dram[i].start; + win_param.size = gd-bd-bi_dram[i].size; if (win_param.size == 0) win_param.enable = 0; else @@ -268,7 +270,7 @@ static void set_dram_access(struct kwgbe_registers *regs) win_param.attrib = EBAR_DRAM_CS3; break; default: - /* invalide bank, disable access */ + /* invalid bank, disable access */ win_param.enable = 0; win_param.attrib = 0; break; -- 1.6.4.4 Acked-by: Prafulla Wadaskar prafu...@marvell.com Regards.. Prafulla . . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood
-Original Message- From: Albert ARIBAUD [mailto:albert.arib...@free.fr] Sent: Monday, July 05, 2010 11:30 PM To: Prafulla Wadaskar Cc: u-boot@lists.denx.de Subject: Re: [PATCH 2/4] egiga: Remove functional dependency on kirkwood Le 05/07/2010 13:03, Prafulla Wadaskar a écrit : -Original Message- From: u-boot-boun...@lists.denx.de [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Albert Aribaud Sent: Friday, July 02, 2010 10:23 PM To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH 2/4] egiga: Remove functional dependency on kirkwood Set DRAM windows by using gd as other drivers do, instead of calling kirkwood-specific functions. Signed-off-by: Albert Aribaudalbert.arib...@free.fr --- drivers/net/egiga.c |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/egiga.c b/drivers/net/egiga.c index 50e8ff3..cbe4748 100644 --- a/drivers/net/egiga.c +++ b/drivers/net/egiga.c @@ -38,6 +38,8 @@ #includeasm/arch/kirkwood.h #include egiga.h +DECLARE_GLOBAL_DATA_PTR; + #define KIRKWOOD_PHY_ADR_REQUEST 0xee #define KWGBE_SMI_REG (((struct kwgbe_registers *)KW_EGIGA0_BASE)-smi) @@ -246,8 +248,8 @@ static void set_dram_access(struct kwgbe_registers *regs) win_param.access_ctrl = EWIN_ACCESS_FULL; win_param.high_addr = 0; /* Get bank base */ - win_param.base_addr = kw_sdram_bar(i); - win_param.size = kw_sdram_bs(i);/* Get bank size */ + win_param.base_addr = gd-bd-bi_dram[i].start; + win_param.size = gd-bd-bi_dram[i].size; if (win_param.size == 0) win_param.enable = 0; else this is good patch indeed to make the driver more generic, which is independent of this activity please post this patch for current version i.e. kirkwood_egiga.c Regards.. Prafulla . . There is also a similar fix (move from kw_sdram_{bar,bs} to gd) to be done on drivers/usb/host/ehci-kirkwood.c, apparently. As I wasn't planning supporting USB with this patchset, I'd ignored it, but if you want I can submit a separate patch for it too. I know, I checked this, I was planning to post patches for the same, if you wish, you are welcomed !!! Regards.. Prafulla . . ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/3 v8] mmc: add generic mmc spi driver
On Monday, July 05, 2010 10:22:45 Thomas Chou wrote: On 07/05/2010 03:40 PM, Mike Frysinger wrote: On Wednesday, May 19, 2010 00:37:47 Thomas Chou wrote: --- /dev/null +++ b/drivers/mmc/mmc_spi.c +struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode) +{ + struct mmc *mmc; + mmc-b_max = MMC_SPI_MAX_BLOCKS; do you have some local modification ? i dont see b_max anywhere in include/mmc.h ... Please apply the multi-blocks patches (1,2,3/4) from Alagu on 05/12, as Andy said he had applied them. those arent required for basic probing functionality, right ? unfortunately though, i tried this on my system and it doesnt seem to work. using a simple SPI-MMC card, the old mmc_spi driver works on my board, but booting the new u-boot and running the same things shows: mmc_spi_request:cmd1 1 4030 0 mmc_spi_sendcmd:cmd1 resp4 1 these last 2 lines repeat for a while Card did not respond to voltage select! It seems the mmc card was not initialized and timed out. Please try remove the OCR_HCS in mmc_send_op_cond() of mmc.c temporarily. cmd.cmdarg = OCR_HCS | mmc-voltages; -^ that does fix the timeout/warning, but the card doesnt probe yet: bfin mmcinfo mmc_spi_init_p: clock 0 mmc_spi_set_ios: clock 0 mmc_spi_set_ios: clock 40 mmc_spi_request:cmd0 0 0 0 mmc_spi_sendcmd:cmd0 resp8 ff Device: MMC_SPI Manufacturer ID: 0 OEM: 0 Name: Tran Speed: 0 Rd Block Len: 0 MMC version 0.0 High Capacity: No Capacity: 0 Bus Width: 1-bit if i boot up the old u-boot and probe the card there, then load up the new u- boot and try again, things get further: bfin mmcinfo mmc_spi_init_p: clock 0 mmc_spi_set_ios: clock 0 mmc_spi_set_ios: clock 40 mmc_spi_request:cmd0 0 0 0 mmc_spi_sendcmd:cmd0 resp6 1 mmc_spi_request:cmd8 15 1aa 0 mmc_spi_sendcmd:cmd8 resp8 ff mmc_spi_request:cmd55 15 0 0 mmc_spi_sendcmd:cmd55 resp6 5 mmc_spi_request:cmd0 0 0 0 mmc_spi_sendcmd:cmd0 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 1 mmc_spi_request:cmd1 1 30 0 mmc_spi_sendcmd:cmd1 resp6 0 mmc_spi_request:cmd58 1 0 0 mmc_spi_sendcmd:cmd58 resp6 0 r32 mmc_spi_request:cmd10 7 0 0 mmc_spi_sendcmd:cmd10 resp6 0 mmc_spi_readdata:tok0 80 r128 0 ff7a fdff 3831f903 mmc_spi_request:cmd9 7 0 0 mmc_spi_sendcmd:cmd9 resp6 0 mmc_spi_readdata:tok1 fe r128 ff4900 263 61726420 1659810 mmc_spi_set_ios: clock 2000 mmc_spi_request:cmd16 15 1 0 mmc_spi_sendcmd:cmd16 resp6 0 mmc_spi_request:cmd17 15 0 0 mmc_spi_sendcmd:cmd17 resp8 ff block read failed: -16 Device: MMC_SPI Manufacturer ID: 0 OEM: 0 Name: Tran Speed: 0 Rd Block Len: 1 MMC version 1.2 High Capacity: Yes Capacity: 2374355968 Bus Width: 1-bit however, in poking the code, i see your mmc_spi_init_p() function calls spi_claim_bus(), but nowhere do i see spi_release_bus(). -mike signature.asc Description: This is a digitally signed message part. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v2] Drop support for GTH board
Dear Thomas, In message 4c310b31.1070...@corelatus.se you wrote: On 2010-07-05 00:07, Wolfgang Denk wrote: V2: Remove remaining references to CONFIG_GTH as pointed out by Thomas. Patch looks fine, except this: diff --git a/common/cmd_ide.c b/common/cmd_ide.c index d486697..c83dcc4 100644 --- a/common/cmd_ide.c +++ b/common/cmd_ide.c @@ -811,7 +811,7 @@ set_pcmcia_timing (int pmode) /* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ -#if defined(__LITTLE_ENDIAN) || ( defined(CONFIG_AU1X00) !defined(CONFIG_GTH2) ) +#if defined(__LITTLE_ENDIAN) || defined(CONFIG_AU1X00) #define input_swap_data(x,y,z) input_data(x,y,z) #else static void This removes code for GTH2 board, not the obsolete GTH board. The GTH2 board is still in production. Grrrgh. Stupid me. Patch v3 on the way... Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de Every little picofarad has a nanohenry all its own. - Don Vonada ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] Add support for NetusG20
Dear Claudio Mignanti, In message 1277651361-26448-1-git-send-email-c.migna...@gmail.com you wrote: Add support for the NetusG20 board by Acmesystems srl. This board is based on AT91SAM9G20 SoC. Signed-off-by: Claudio Mignanti c.migna...@gmail.com --- MAKEALL |1 + Makefile |3 + arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c |5 + board/acmesystems/netusg20/Makefile | 56 +++ board/acmesystems/netusg20/config.mk |1 + board/acmesystems/netusg20/led.c | 40 + board/acmesystems/netusg20/netusg20.c | 152 + board/acmesystems/netusg20/partition.c| 39 + include/configs/netusg20.h| 181 + 9 files changed, 478 insertions(+), 0 deletions(-) create mode 100644 board/acmesystems/netusg20/Makefile create mode 100644 board/acmesystems/netusg20/config.mk create mode 100644 board/acmesystems/netusg20/led.c create mode 100644 board/acmesystems/netusg20/netusg20.c create mode 100644 board/acmesystems/netusg20/partition.c create mode 100644 include/configs/netusg20.h Entry to MAINTAINERS missing. diff --git a/Makefile b/Makefile index 87d5214..b73659f 100644 --- a/Makefile +++ b/Makefile @@ -2867,6 +2867,9 @@ at91sam9g45ekes_config : unconfig fi; @$(MKCONFIG) -a at91sam9m10g45ek arm arm926ejs at91sam9m10g45ek atmel at91 +netusg20_config: unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs netusg20 acmesystems at91 + otc570_config: unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs otc570 esd at91 NAK. Please rebase your patch against current code. We don't add boards to the top level Makefile any more. Add the definition to boards.cfg instead. diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c index 77d49ab..87ec531 100644 --- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c @@ -59,7 +59,12 @@ void at91_serial3_hw_init(void) { at91_pmc_t *pmc= (at91_pmc_t *) AT91_PMC_BASE; +#ifdef CONFIG_NETUSG20 + /* pull-up active on DRXD*/ + at91_set_a_periph(AT91_PIO_PORTB, 14, 1); +#else at91_set_a_periph(AT91_PIO_PORTB, 14, 0); /* DRXD */ +#endif at91_set_a_periph(AT91_PIO_PORTB, 15, 1); /* DTXD */ writel(1 AT91_ID_SYS, pmc-pcer); } Please do not add board specific defines to common code. If really needed, add a feature-specific #define. ... +#ifdef CONFIG_RESET_PHY_R +void reset_phy(void) +{ +#ifdef CONFIG_MACB + /* + * Initialize ethernet HW addr prior to starting Linux, + * needed for nfsroot + */ + eth_init(gd-bd); +#endif +} +#endif This doesn't look right to me. ... +/* + * Hardware drivers + */ +#define CONFIG_AT91_GPIO 1 +#define CONFIG_ATMEL_USART 1 +#undef CONFIG_USART0 +#undef CONFIG_USART1 +#undef CONFIG_USART2 +#define CONFIG_USART31 /* USART 3 is DBGU */ Do not undef what is not defined anyway. +/* LED */ +#define CONFIG_AT91_LED +#define CONFIG_RED_LED AT91_PIN_PA9/* this is the power led */ +#define CONFIG_GREEN_LEDAT91_PIN_PA6/* this is the user led */ Please use consistent code. Either ALWAYS use a TAB after a #define, or (better) always use a SPACE. +/* + * Command line configuration. + */ +#include config_cmd_default.h +#undef CONFIG_CMD_BDI +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMI +#undef CONFIG_CMD_IMLS +#undef CONFIG_CMD_LOADS +#undef CONFIG_CMD_SOURCE What is the exact reason for undefing pretty useful commands like bdi, imi, or source? +/* MMC */ +#define CONFIG_MMC +#define CONFIG_CMD_MMC +#define CONFIG_ATMEL_MCI +#define CONFIG_CMD_AUTOSCRIPT +#define CONFIG_CMD_IMI +#define CONFIG_CMD_SOURCE ...especially, if you enable these later, connected to a completely misleading comment (imi and source are in no way related to MMC support). +#define CONFIG_ENV_IS_IN_DATAFLASH 1 +#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + 0x8400) +#define CONFIG_ENV_OFFSET0x4200 +#define CONFIG_ENV_ADDR (CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1 + CONFIG_ENV_OFFSET) Line too long. Please fix globally. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de 'What shall we do?' said Twoflower. 'Panic?' said Rincewind hope- fully. He always held that panic was the best means of survival; back in the olden days, his theory went, people faced with hungry sabre- toothed tigers
Re: [U-Boot] [PATCH v3] Drop support for GTH board
On 2010-07-05 22:46, Wolfgang Denk wrote: The board maintainer states: The GTH board is obsolete and has not been manufactured for several years. To my knowledge, no recent U-Boot build has been tested on that card. So drop support for this board. Signed-off-by: Wolfgang Denkw...@denx.de Cc: Thomas Langetho...@corelatus.se --- V2: Remove remaining references to CONFIG_GTH as pointed out by Thomas. V3: Fix erroneous deletion of a CONFIG_GTH2 reference. Acked-by: Thomas Langetho...@corelatus.se Regards, /Thomas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 1/4] mtdparts: regroup calls to get_mtd_device_nm
The get_mtd_device_nm function is called in a couple places and the string that is passed to it is not really used after the calls. This patch regroups the calls to this function into a new function, get_mtd_info. Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca Acked-by: Stefan Roese s...@denx.de --- V2: * formatting: add space after 'if' * added acked-by tag as requested by Stefan V3: * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git --- common/cmd_mtdparts.c | 43 --- 1 files changed, 28 insertions(+), 15 deletions(-) diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 447486b..f1bed95 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -286,6 +286,27 @@ static void current_save(void) index_partitions(); } + +/** Produce a mtd_info given a type and num + * @param type mtd type + * @param num mtd number + * @param mtd a pointer to an mtd_info instance (output) + * @return 0 if device is valid, 1 otherwise + */ +static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd) +{ + char mtd_dev[16]; + + sprintf(mtd_dev, %s%d, MTD_DEV_TYPE(type), num); + *mtd = get_mtd_device_nm(mtd_dev); + if (IS_ERR(*mtd)) { + printf(Device %s not found!\n, mtd_dev); + return 1; + } + + return 0; +} + /** * Performs sanity check for supplied flash partition. * Table of existing MTD flash devices is searched and partition device @@ -297,17 +318,12 @@ static void current_save(void) */ static int part_validate_eraseblock(struct mtdids *id, struct part_info *part) { - struct mtd_info *mtd; - char mtd_dev[16]; + struct mtd_info *mtd = NULL; int i, j; ulong start; - sprintf(mtd_dev, %s%d, MTD_DEV_TYPE(id-type), id-num); - mtd = get_mtd_device_nm(mtd_dev); - if (IS_ERR(mtd)) { - printf(Partition %s not found on device %s!\n, part-name, mtd_dev); + if (get_mtd_info(id-type, id-num, mtd)) return 1; - } part-sector_size = mtd-erasesize; @@ -684,20 +700,17 @@ static int part_parse(const char *const partdef, const char **ret, struct part_i /** * Check device number to be within valid range for given device type. * - * @param dev device to validate + * @param type mtd type + * @param num mtd number + * @param size a pointer to the size of the mtd device (output) * @return 0 if device is valid, 1 otherwise */ int mtd_device_validate(u8 type, u8 num, u32 *size) { - struct mtd_info *mtd; - char mtd_dev[16]; + struct mtd_info *mtd = NULL; - sprintf(mtd_dev, %s%d, MTD_DEV_TYPE(type), num); - mtd = get_mtd_device_nm(mtd_dev); - if (IS_ERR(mtd)) { - printf(Device %s not found!\n, mtd_dev); + if (get_mtd_info(type, num, mtd)) return 1; - } *size = mtd-size; -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 0/4] mtdparts: add bad-block skipping
[PATCH v3 1/4] mtdparts: regroup calls to get_mtd_device_nm [PATCH v3 2/4] mtdparts: show net size in mtdparts list [PATCH v3 3/4] mtdparts: add new sub-command spread [PATCH v3 4/4] mtdparts: new add.e: add part skipping bad blocks cmd_mtdparts.c | 256 - 1 file changed, 237 insertions(+), 19 deletions(-) This patch series is based on the idea of Harald Welte lafo...@gnumonks.org and the comments of Wolfgang Denk w...@denx.de [1]. I started with Harald's original patch and migrated it to a new mtdparts sub-command and added an interface to the new functionality via a 'mtdparts add' variant. I tried to keep it at the level of the mtd subsystem. Whereas the dynparts patch was limited to NAND flashes, I believe this patch will work on any mtd device that can report bad blocks. These new commands can be useful when gang programming NAND chips where the gang programmer is capable only of skipping bad blocks. One can use a master image that contains images of each of the partitions padded-out to their spec'd sizes; when u-boot first comes up 'mtdparts default; mtdparts spread' (or a seq of 'mtdpart add.e' commands) will produce a partition table that matches what was put there by the gang-programmer. It can also be useful when doing in-situ programming with u-boot being the flash programmer as demonstrated by the openmoko project's use of the 'dynpart' command [2] upon which this patch series was based. Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca CC: Wolfgang Denk w...@denx.de --- V2: * formating: spaces after 'if' and for * printing net partition sizes feature is now conditional on the new CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES macro; patch 2/4 was adding 264 bytes to the virtlab2 build -- now it adds 0 bytes -- see below for more binary size impact details * changed the net_part_size method to return the net size instead of using an output variable * checking mtd-block_isbad function pointer before dereferencing * there were some trailing whitespace errors when applying 3/4 and 4/4 that I have fixed now V3: * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git * more checkpatch fixes * adding openmoko to the copyright statements in cmd_mtdparts.c NOTE: I'm not sure what to call the new subcommands, I chose 'spread' because of the way it changes the existing mtdparts variable; however, I am open to suggestions for a different name. I chose add.e/add.i because of the behaviour of the write.e/write.i commands; however, I am again open to suggestions. Testing was performed in the u-boot-omap-l1 tree [3]. Here is an example u-boot console session to demonstrate how the commands work: --- U-Boot mtdparts default U-Boot nand bad Device 0 bad blocks: 062c 0a14 128a 12e2 18bc 1ff8 1ffa 1ffc 1ffe U-Boot mtdparts device nand0 davinci_nand.1, # parts = 11 #: namesizenet sizeoffset mask_flags 0: zero0x000c 0x000c 0x 1 1: conf0x0020 0x0020 0x000c 0 2: kernel_a0x0040 0x0040 0x002c 0 3: initrd_a0x0040 0x0040 0x006c 0 4: rootfs_a0x0702 0x0700 (!) 0x00ac 0 5: kernel_b0x0040 0x0040 0x07ae 0 6: initrd_b0x0040 0x0040 0x07ee 0 7: rootfs_b0x0702 0x0700 (!) 0x082e 0 active partition: nand0,0 - (zero) 0x0002 @ 0x defaults: mtdids : nand0=davinci_nand.1 mtdparts: mtdparts=mtdparts=davinci_nand.1:768k(zero)ro,2m(conf),4m(kernel_a), 4m(initrd_a),112m(rootfs_a),4m(kernel_b),4m(initrd_b),112m(rootfs_b) U-Boot U-Boot mtdparts spread U-Boot print mtdparts mtdparts=mtdparts=davinci_nand.1:768k(zero)ro,2m(conf),4m(kernel_a),4m(initrd_a) ,114816k(rootfs_a),4m(kernel_b),4m(initrd_b),114816k(rootfs_b) U-Boot mtdparts device nand0 davinci_nand.1, # parts = 11 #: namesizenet sizeoffset mask_flags 0: zero0x000c 0x000c 0x 1 1: conf0x0020 0x0020 0x000c 0 2: kernel_a0x0040 0x0040 0x002c 0 3: initrd_a0x0040 0x0040 0x006c 0 4: rootfs_a0x0704 0x0702 (!) 0x00ac 0 5: kernel_b0x0040 0x0040 0x07b0 0 6: initrd_b0x0040 0x0040 0x07f0 0 7: rootfs_b0x0704 0x0702 (!) 0x0830 0 active partition: nand0,0 - (zero) 0x0002 @ 0x defaults: mtdids :
[U-Boot] [PATCH v3 2/4] mtdparts: show net size in mtdparts list
This patch adds an additional column to the output of list_partitions. The additional column will contain the net size and a '(!)' beside it if the net size is not equal to the partition size. Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca CC: Wolfgang Denk w...@denx.de --- V2: * formatting: spaces after 'if' and 'for' * the entire new feature is conditional on a macro, there is now a zero-byte binary size impact when the macro is not defined. * return the net parition size directly from net_part_size instead of using an output variable V3: * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git * fix line length over 80 chars * update copyright of cmd_mtdparts.c --- common/cmd_mtdparts.c | 55 +++- 1 files changed, 53 insertions(+), 2 deletions(-) diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index f1bed95..84acd62 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -15,6 +15,10 @@ * Parsing routines are based on driver/mtd/cmdline.c from the linux 2.4 * kernel tree. * + * (C) Copyright 2010 + * Ben Gardiner, Nanometrics Inc., bengardi...@nanometrics.ca + * Added net partition size output to mtdparts list command + * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH * @@ -1213,6 +1217,29 @@ static int generate_mtdparts_save(char *buf, u32 buflen) return ret; } +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) +/** get the net size (w/o bad blocks) of the given partition + * @param mtd the mtd info + * @param part the partition + * @return the calculated net size of this partition + */ +static u32 net_part_size(struct mtd_info *mtd, struct part_info *part) +{ + if (mtd-block_isbad) { + u32 i, bb_delta = 0; + + for (i = 0; i part-size; i += mtd-erasesize) { + if (mtd-block_isbad(mtd, part-offset + i)) + bb_delta += mtd-erasesize; + } + + return part-size - bb_delta; + } else { + return part-size; + } +} +#endif + /** * Format and print out a partition list for each device from global device * list. @@ -1223,6 +1250,10 @@ static void list_partitions(void) struct part_info *part; struct mtd_device *dev; int part_num; +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + struct mtd_info *mtd; + u32 net_size; +#endif debug(\n---list_partitions---\n); list_for_each(dentry, devices) { @@ -1230,14 +1261,34 @@ static void list_partitions(void) printf(\ndevice %s%d %s, # parts = %d\n, MTD_DEV_TYPE(dev-id-type), dev-id-num, dev-id-mtd_id, dev-num_parts); - printf( #: name\t\tsize\t\toffset\t\tmask_flags\n); + printf( #: name\t\tsize\t\t +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + net size\t +#endif + offset\t\tmask_flags\n); + +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + if (get_mtd_info(dev-id-type, dev-id-num, mtd)) + return; +#endif /* list partitions for given device */ part_num = 0; list_for_each(pentry, dev-parts) { part = list_entry(pentry, struct part_info, link); - printf(%2d: %-20s0x%08x\t0x%08x\t%d\n, +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + net_size = net_part_size(mtd, part); +#endif + printf(%2d: %-20s0x%08x\t +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + 0x%08x%s\t +#endif + 0x%08x\t%d\n, part_num, part-name, part-size, +#if defined(CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES) + net_size, + part-size == net_size ? : (!), +#endif part-offset, part-mask_flags); part_num++; -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 4/4] mtdparts: new add.e: add part skipping bad blocks
This patch adds a new 'mtdparts add' variant: add.e (with a synomym add.i). This command variant adds a new partition to the mtdparts variable but also increases the partitions size by skipping bad blocks and aggregating any additional bad blocks found at the end of the partition. Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca --- V2: * formatting: spaces after 'if' and 'for' * trailing whitespace removed V3: * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git * fix more checkpatch errors * updating copyright to include addition of add.e command --- common/cmd_mtdparts.c | 38 +- 1 files changed, 37 insertions(+), 1 deletions(-) diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index c1adbd4..d57f9ad 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -26,6 +26,8 @@ * Added net partition size output to mtdparts list command. * Ported 'dynamic partitions' support to current u-boot 'mtdparts spread' * command. Current mtdparts variable is now used as input. + * Add the 'add.e' mtdparts command. Dynamic partitions can be added one at + * a time -- specified by size only. * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH @@ -1951,9 +1953,14 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* mtdparts add mtd-dev size[@offset] name [ro] */ - if (((argc == 5) || (argc == 6)) (strcmp(argv[1], add) == 0)) { + if (((argc == 5) || (argc == 6)) (strncmp(argv[1], add, 3) == 0)) { #define PART_ADD_DESC_MAXLEN 64 char tmpbuf[PART_ADD_DESC_MAXLEN]; +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) + char *s; + struct mtd_info *mtd; + u32 next_offset; +#endif u8 type, num, len; struct mtd_device *dev; struct mtd_device *dev_tmp; @@ -1988,11 +1995,36 @@ int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) debug(+ %s\t%d\t%s\n, MTD_DEV_TYPE(dev-id-type), dev-id-num, dev-id-mtd_id); +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) + s = strchr(argv[1], '.'); + + if (get_mtd_info(dev-id-type, dev-id-num, mtd)) + return 1; +#endif + if ((dev_tmp = device_find(dev-id-type, dev-id-num)) == NULL) { +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) + if (!strcmp(s, .e) || !strcmp(s, .i)) { + p = list_entry(dev-parts.next, + struct part_info, link); + spread_partition(mtd, p, next_offset); + + debug(increased %s to %d bytes\n, p-name, + p-size); + } +#endif device_add(dev); } else { /* merge new partition with existing ones*/ p = list_entry(dev-parts.next, struct part_info, link); +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) + if (!strcmp(s, .e) || !strcmp(s, .i)) { + spread_partition(mtd, p, next_offset); + + debug(increased %s to %d bytes\n, p-name, + p-size); + } +#endif if (part_add(dev_tmp, p) != 0) { device_del(dev); return 1; @@ -2042,6 +2074,10 @@ U_BOOT_CMD( - delete partition (e.g. part-id = nand0,1)\n mtdparts add mtd-dev size[@offset] [name] [ro]\n - add partition\n +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) + mtdparts add.e mtd-dev size[@offset] [name] [ro]\n + - add partition, padding size by skipping bad blocks\n +#endif mtdparts default\n - reset partition table to defaults\n #if defined(CONFIG_CMD_MTDPARTS_SPREAD) -- 1.7.0.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH v3 3/4] mtdparts: add new sub-command spread
This patch introduces the 'spread' sub-command of the mtdparts command. This command will modify the existing mtdparts variable by increasing the size of the partitions such that 1) each partition's net size is at least as large as the size specified in the mtdparts variable and 2) each partition starts on a good block. The new subcommand is implemented by iterating over the mtd device partitions and collecting a bad blocks count in each -- including any trailing bad blocks -- and then modifying that partitions's part_info structure and checking if the modification affects the next partition. Signed-off-by: Ben Gardiner bengardi...@nanometrics.ca CC: Harald Welte lafo...@gnumonks.org --- V2: * formatting: spaces after 'if' and 'for' * trailing whitespace removed * check for null mtd-block_isbad before dereferencing V3: * rebased to 54841ab50c20d6fa6c9cc3eb826989da3a22d934 of git://git.denx.de/u-boot.git * fix more checkpatch errors * update copyright statement of cmd_mtdparts.c to include openmoko's copyright of the 'dynamic partitions' functionality using commit e05835df019027391f58f9d8ce5e1257d6924798 of git://git.openmoko.org/u-boot.git as reference. --- common/cmd_mtdparts.c | 122 - 1 files changed, 120 insertions(+), 2 deletions(-) diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 84acd62..c1adbd4 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -15,9 +15,17 @@ * Parsing routines are based on driver/mtd/cmdline.c from the linux 2.4 * kernel tree. * + * (C) Copyright 2008 + * Harald Welte, OpenMoko, Inc., Harald Welte lafo...@openmoko.org + * Add support for 'dynamic partitions.' Net partition sizes specified at + * compile time where the layout in flash is adjusted in the presence of bad + * blocks. + * * (C) Copyright 2010 * Ben Gardiner, Nanometrics Inc., bengardi...@nanometrics.ca - * Added net partition size output to mtdparts list command + * Added net partition size output to mtdparts list command. + * Ported 'dynamic partitions' support to current u-boot 'mtdparts spread' + * command. Current mtdparts variable is now used as input. * * $Id: cmdlinepart.c,v 1.17 2004/11/26 11:18:47 lavinen Exp $ * Copyright 2002 SYSGO Real-Time Solutions GmbH @@ -1419,6 +1427,103 @@ static int delete_partition(const char *id) return 1; } +#if defined(CONFIG_CMD_MTDPARTS_SPREAD) +/** Increase the size of the given partition so that it's net size is at least + * as large as the size member and such that the next parition would start on a + * good blcok if it were adjacent to this partition + * @param mtd the mtd device + * @param part the partition + * @param next_offset pointer to the offset of the next partition after this + *partition's size has been modified (output) + */ +static void spread_partition(struct mtd_info *mtd, struct part_info *part, +u32 *next_offset) +{ + if (!mtd-block_isbad) + goto out; + + u32 i, bb_delta = 0; + + for (i = part-offset; + i - bb_delta part-offset + part-size; + i += mtd-erasesize) { + if (mtd-block_isbad(mtd, i)) + bb_delta += mtd-erasesize; + } + + /* Absorb bad blocks immeadiately following this + * partition also into the partition, such that + * the next partition starts with a good block. + */ + while (i mtd-size mtd-block_isbad(mtd, i)) { + bb_delta += mtd-erasesize; + i += mtd-erasesize; + } + + if (part-offset + part-size + bb_delta mtd-size) { + part-size = mtd-size - part-offset - bb_delta; + printf(truncated partition %s to %d bytes\n, part-name, + part-size); + } + + part-size += bb_delta; + +out: + *next_offset = part-offset + part-size; +} + +/** + * Adjust all of the partition sizes, such that all partitions are at least + * as big as their mtdparts environment variable sizes and they each start + * on a good block. + * + * @return 0 on success, 1 otherwise + */ +static int spread_partitions(void) +{ + struct list_head *dentry, *pentry; + struct mtd_device *dev; + struct part_info *part; + struct mtd_info *mtd; + int part_num; + u32 cur_offs; + + list_for_each(dentry, devices) { + dev = list_entry(dentry, struct mtd_device, link); + + if (get_mtd_info(dev-id-type, dev-id-num, mtd)) + return 1; + + part_num = 0; + cur_offs = 0; + list_for_each(pentry, dev-parts) { + part = list_entry(pentry, struct part_info, link); + + debug(spread_partitions: device = %s%d, partition %d = +
Re: [U-Boot] [PATCH] Davinci: SPI: add the missing v2 patch changes
Two Indentation fixes. Catch requests for full-duplex transfers when driver configured for half-duplex operation only. Signed-off-by: Nick Thompson nick.thomp...@ge.com --- drivers/spi/davinci_spi.c |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) Thanks Pushed to u-boot-ti Sandeep ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH v4 0/6] Add support for TI OMAP4 SDP and Panda
Please fix and resubmit. I'm not quite sure what went awry here, but the compile errors are caused by the fix you did to the mmc patch. Perhaps due to applying the patches out of order in your testing branch?? In any event, the patches seem to work here applied to the current master/next in the original order. Here's a pointer to my working git branch: http://www.sakoman.com/cgi-bin/gitweb.cgi?p=u- boot.git;a=shortlog;h=refs/heads/omap4-next-upstream I added your Signed-off-by in case you wanted to just do a pull. But I am also happy to resubmit the patches if you prefer that. Regards, Steve The warnings were due to me making fixes to a patch that would not apply clean. Ran MAKEALL and saw no issues. Pushed the series to u-boot-ti Sandeep ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] add function prototype for mmc_set_dev in mmc.h
Subject: mmc: add function prototype for mmc_set_dev in mmc.h this eliminates compiler warnings when cmd_mmc.c is built with CONFIG_SYS_MMC_SET_DEV the mmc_set_dev implementation in omap3_mmc.c is also tweaked to match the new prototype in parameter naming and type Signed-off-by: Steve Sakoman st...@sakoman.com --- Thanks pushed to u-boot-ti Sandeep ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] boards.cfg: add missing entries for am3517_evm and s5p_goni
both machines seemed to have been dropped in the recent Makefile change Signed-off-by: Steve Sakoman st...@sakoman.com --- Note: this patch assumes the previous application of: [PATCH v4 1/6] ARM: Rename arch/arm/cpu/arm_cortexa8 to armv7 diff --git a/boards.cfg b/boards.cfg index 988ad5d..46d966c 100644 --- a/boards.cfg +++ b/boards.cfg @@ -254,6 +254,7 @@ imx27lite arm arm926ejs imx27lite logicpd mx27 magnesiumarm arm926ejs imx27lite logicpd mx27 omap5912osk arm arm926ejs - ti omap edminiv2 arm arm926ejs - LaCie orion5x +am3517_evm arm armv7 am3517evm logicpd omap3 omap3_overo arm armv7 overo - omap3 omap3_pandoraarm armv7 pandora - omap3 omap3_zoom1 arm armv7 zoom1 logicpd omap3 @@ -264,6 +265,7 @@ omap3_sdp3430 arm armv7 sdp3430 ti omap3 omap4_panda arm armv7 panda ti omap4 omap4_sdp4430arm armv7 sdp4430 ti omap4 devkit8000 arm armv7 devkit8000 timll omap3 +s5p_goni arm armv7 gonisamsung s5pc1xx smdkc100 arm armv7 smdkc100samsung s5pc1xx ixdpg425 arm ixp lpd7a400 arm lh7a40x lpd7a40x Wolfgang has pushed another version of this patch. Sandeep ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Please pull u-boot-ti/master
Wolfgang, Please pull u-boot-ti/master. I ran MAKEALL for all ARMV7 boards and saw one compilation warning. This however was not becuase of the recent updates by Steve Sakoman. The compilation warning was due to a USB patch submitted by TI but got applied to u-boot through u-boot-usb. Will take care of it soon. Regards, Sandeep The following changes since commit 54841ab50c20d6fa6c9cc3eb826989da3a22d934: Wolfgang Denk (1): Make sure that argv[] argument pointers are not modified. are available in the git repository at: git://git.denx.de/u-boot-ti.git master Nick Thompson (1): Davinci: SPI: add the missing v2 patch changes Steve Sakoman (8): OMAP: mmc: add support for second and third mmc channels ARM: Rename arch/arm/cpu/arm_cortexa8 to armv7 ARMV7: Add basic support for TI OMAP4 ARMV7: Restructure OMAP mmc driver to allow code sharing between OMAP3 and OMAP4 ARMV7: Restructure OMAP i2c driver to allow code sharing between OMAP3 and OMAP4 ARMV7: Add support for TI OMAP4430 SDP ARMV7: Add support for TI OMAP4 Panda mmc: add function prototype for mmc_set_dev in mmc.h MAINTAINERS| 24 ++- MAKEALL| 10 +- Makefile |7 + arch/arm/cpu/{arm_cortexa8 = armv7}/Makefile |0 arch/arm/cpu/{arm_cortexa8 = armv7}/config.mk |0 arch/arm/cpu/{arm_cortexa8 = armv7}/cpu.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/Makefile |0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/clock.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/iomux.c |0 .../{arm_cortexa8 = armv7}/mx51/lowlevel_init.S |0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/soc.c|0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/speed.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/mx51/timer.c |0 .../cpu/{arm_cortexa8 = armv7}/mx51/u-boot.lds|2 +- .../mx51 = armv7/omap-common}/Makefile| 10 +- .../{arm_cortexa8 = armv7/omap-common}/config.mk |0 .../omap3 = armv7/omap-common}/reset.S|0 .../omap3 = armv7/omap-common}/timer.c|5 + .../arm/cpu/{arm_cortexa8 = armv7}/omap3/Makefile |2 - arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/board.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/cache.S |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/clock.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/emif4.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/gpio.c |0 .../{arm_cortexa8 = armv7}/omap3/lowlevel_init.S |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/mem.c |0 arch/arm/cpu/{arm_cortexa8 = armv7}/omap3/sdrc.c |0 .../cpu/{arm_cortexa8 = armv7}/omap3/sys_info.c |0 .../arm/cpu/{arm_cortexa8 = armv7}/omap3/syslib.c |0 .../{arm_cortexa8/s5pc1xx = armv7/omap4}/Makefile | 16 +- arch/arm/cpu/armv7/omap4/board.c | 90 .../omap3/reset.S = armv7/omap4/lowlevel_init.S} | 40 +++-- .../omap3/reset.S = armv7/omap4/sys_info.c} | 50 +++-- .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/Makefile |0 .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/cache.S|2 +- .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/clock.c|0 .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/cpu_info.c |0 .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/reset.S|0 .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/sromc.c|0 .../cpu/{arm_cortexa8 = armv7}/s5pc1xx/timer.c|0 arch/arm/cpu/{arm_cortexa8 = armv7}/start.S |0 arch/arm/cpu/{arm_cortexa8 = armv7}/u-boot.lds|2 +- arch/arm/include/asm/arch-mx51/asm-offsets.h |2 +- arch/arm/include/asm/arch-omap3/i2c.h | 149 +- arch/arm/include/asm/arch-omap3/mmc_host_def.h | 15 +- arch/arm/include/asm/arch-omap4/cpu.h | 94 + arch/arm/include/asm/arch-omap4/i2c.h | 74 +++ arch/arm/include/asm/arch-omap4/mmc_host_def.h | 171 +++ arch/arm/include/asm/arch-omap4/omap4.h| 118 +++ .../reset.S = include/asm/arch-omap4/sys_proto.h} | 35 ++-- board/logicpd/zoom2/zoom2.c|2 +- .../cpu/arm_cortexa8 = board/ti/panda}/Makefile | 24 ++- .../cpu/arm_cortexa8 = board/ti/panda}/config.mk | 25 +-- .../u-boot.lds = board/ti/panda/panda.c | 65 +++--- .../cpu/arm_cortexa8 = board/ti/sdp4430}/Makefile | 24 ++- .../arm_cortexa8 = board/ti/sdp4430}/config.mk| 25 +-- .../u-boot.lds = board/ti/sdp4430/sdp.c | 66 +++--- boards.cfg | 26 ++- drivers/i2c/omap24xx_i2c.c | 17 ++- drivers/i2c/omap24xx_i2c.h | 166 +++ drivers/mmc/omap3_mmc.c| 50 - .../arch-omap3/mmc.h = drivers/mmc/omap3_mmc.h|2 +- drivers/spi/davinci_spi.c
[U-Boot] [PATCH 2/5] PXA: Add hardware init helper macros
This patch adds macros for the following purposes: - GPIO configuration - SDRAM configuration - Wakeup - Clock configuration - Interrupt controller configuration These macros are intended to replace numerous copies of the same code. Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/include/asm/arch-pxa/macro.h | 324 + 1 files changed, 324 insertions(+), 0 deletions(-) create mode 100644 arch/arm/include/asm/arch-pxa/macro.h diff --git a/arch/arm/include/asm/arch-pxa/macro.h b/arch/arm/include/asm/arch-pxa/macro.h new file mode 100644 index 000..035a57e --- /dev/null +++ b/arch/arm/include/asm/arch-pxa/macro.h @@ -0,0 +1,324 @@ +/* + * arch/arm/include/asm/arch-pxa/macro.h + * + * Copyright (C) 2010 Marek Vasut marek.va...@gmail.com + * + * 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 __ASM_ARCH_PXA_MACRO_H__ +#define __ASM_ARCH_PXA_MACRO_H__ +#ifdef __ASSEMBLY__ + +#include asm/macro.h +#include asm/arch/pxa-regs.h + +/* + * This macro performs a 32bit write to a memory location and makes sure the + * write operation really happened by performing a read back. + * + * Clobbered regs: r4, r5 + */ +.macro write32rb addr, data + ldr r4, =\addr + ldr r5, =\data + str r5, [r4] + ldr r5, [r4] +.endm + +/* + * This macro waits according to OSCR incrementation + * + * Clobbered regs: r4, r5, r6 + */ +.macro pxa_wait_ticks ticks + ldr r4, =OSCR + mov r5, #0 + str r5, [r4] + ldr r5, =\ticks +1: + ldr r6, [r4] + cmp r5, r6 + bgt 1b +.endm + +/* + * This macro sets up the GPIO pins of the PXA2xx/PXA3xx CPU + * + * Clobbered regs: r4, r5 + */ +.macro pxa_gpio_setup + write32 GPSR0, CONFIG_SYS_GPSR0_VAL + write32 GPSR1, CONFIG_SYS_GPSR1_VAL + write32 GPSR2, CONFIG_SYS_GPSR2_VAL +#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS) + write32 GPSR3, CONFIG_SYS_GPSR3_VAL +#endif + + write32 GPCR0, CONFIG_SYS_GPCR0_VAL + write32 GPCR1, CONFIG_SYS_GPCR1_VAL + write32 GPCR2, CONFIG_SYS_GPCR2_VAL +#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS) + write32 GPCR3, CONFIG_SYS_GPCR3_VAL +#endif + + write32 GPDR0, CONFIG_SYS_GPDR0_VAL + write32 GPDR1, CONFIG_SYS_GPDR1_VAL + write32 GPDR2, CONFIG_SYS_GPDR2_VAL +#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS) + write32 GPDR3, CONFIG_SYS_GPDR3_VAL +#endif + + write32 GAFR0_L, CONFIG_SYS_GAFR0_L_VAL + write32 GAFR0_U, CONFIG_SYS_GAFR0_U_VAL + write32 GAFR1_L, CONFIG_SYS_GAFR1_L_VAL + write32 GAFR1_U, CONFIG_SYS_GAFR1_U_VAL + write32 GAFR2_L, CONFIG_SYS_GAFR2_L_VAL + write32 GAFR2_U, CONFIG_SYS_GAFR2_U_VAL +#if defined(CONFIG_PXA27X) || defined(CONFIG_CPU_MONAHANS) + write32 GAFR3_L, CONFIG_SYS_GAFR3_L_VAL + write32 GAFR3_U, CONFIG_SYS_GAFR3_U_VAL +#endif + + write32 PSSR, CONFIG_SYS_PSSR_VAL +.endm + +/* + * This macro sets up the Memory controller of the PXA2xx CPU + * + * Clobbered regs: r3, r4, r5 + */ +.macro pxa_mem_setup + /* This comes handy when setting MDREFR */ + ldr r3, =MEMC_BASE + + /* +* 1) Initialize Asynchronous static memory controller +*/ + + /* MSC0: nCS(0,1) */ + write32rb (MEMC_BASE + MSC0_OFFSET), CONFIG_SYS_MSC0_VAL + /* MSC1: nCS(2,3) */ + write32rb (MEMC_BASE + MSC1_OFFSET), CONFIG_SYS_MSC1_VAL + /* MSC2: nCS(4,5) */ + write32rb (MEMC_BASE + MSC2_OFFSET), CONFIG_SYS_MSC2_VAL + + /* +* 2) Initialize Card Interface +*/ + + /* MECR: Memory Expansion Card Register */ + write32rb (MEMC_BASE + MECR_OFFSET), CONFIG_SYS_MECR_VAL + /* MCMEM0: Card Interface slot 0 timing */ + write32rb (MEMC_BASE + MCMEM0_OFFSET), CONFIG_SYS_MCMEM0_VAL + /* MCMEM1: Card Interface slot 1 timing */ + write32rb (MEMC_BASE + MCMEM1_OFFSET), CONFIG_SYS_MCMEM1_VAL + /* MCATT0: Card Interface Attribute Space Timing, slot 0 */ + write32rb (MEMC_BASE + MCATT0_OFFSET), CONFIG_SYS_MCATT0_VAL + /* MCATT1: Card Interface Attribute Space
[U-Boot] [PATCH 1/5] Enable PXAFB for PXA27X and PXA3XX
--- arch/arm/cpu/pxa/pxafb.c |9 - common/lcd.c | 12 ++-- include/lcd.h|2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/arm/cpu/pxa/pxafb.c b/arch/arm/cpu/pxa/pxafb.c index d56c5f0..1cb78f0 100644 --- a/arch/arm/cpu/pxa/pxafb.c +++ b/arch/arm/cpu/pxa/pxafb.c @@ -292,7 +292,9 @@ static int pxafb_init_mem (void *lcdbase, vidinfo_t *vid) return 0; } - +#ifdef CONFIG_CPU_MONAHANS +static inline void pxafb_setup_gpio (vidinfo_t *vid) {} +#else static void pxafb_setup_gpio (vidinfo_t *vid) { u_long lccr0; @@ -349,6 +351,7 @@ static void pxafb_setup_gpio (vidinfo_t *vid) printf(pxafb_setup_gpio: unable to determine bits per pixel\n); } } +#endif static void pxafb_enable_controller (vidinfo_t *vid) { @@ -363,7 +366,11 @@ static void pxafb_enable_controller (vidinfo_t *vid) FDADR1 = vid-pxa.fdadr1; LCCR0 |= LCCR0_ENB; +#ifdef CONFIG_CPU_MONAHANS + CKENA |= CKENA_1_LCD; +#else CKEN |= CKEN16_LCD; +#endif debug(FDADR0 = 0x%08x\n, (unsigned int)FDADR0); debug(FDADR1 = 0x%08x\n, (unsigned int)FDADR1); diff --git a/common/lcd.c b/common/lcd.c index 93ddedf..d854c21 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -41,7 +41,7 @@ #include lcd.h #include watchdog.h -#if defined(CONFIG_PXA250) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS #include asm/byteorder.h #endif @@ -503,7 +503,7 @@ void bitmap_plot (int x, int y) uchar *bmap; uchar *fb; ushort *fb16; -#if defined(CONFIG_PXA250) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS struct pxafb_info *fbi = panel_info.pxa; #elif defined(CONFIG_MPC823) volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; @@ -519,7 +519,7 @@ void bitmap_plot (int x, int y) if (NBITS(panel_info.vl_bpix) 12) { /* Leave room for default color map */ -#if defined(CONFIG_PXA250) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS cmap = (ushort *)fbi-palette; #elif defined(CONFIG_MPC823) cmap = (ushort *)(cp-lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]); @@ -615,7 +615,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) unsigned long pwidth = panel_info.vl_col; unsigned colors, bpix, bmp_bpix; unsigned long compression; -#if defined(CONFIG_PXA250) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS struct pxafb_info *fbi = panel_info.pxa; #elif defined(CONFIG_MPC823) volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; @@ -656,7 +656,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) #if !defined(CONFIG_MCC200) /* MCC200 LCD doesn't need CMAP, supports 1bpp bw only */ if (bmp_bpix == 8) { -#if defined(CONFIG_PXA250) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS cmap = (ushort *)fbi-palette; #elif defined(CONFIG_MPC823) cmap = (ushort *)(cp-lcd_cmap[255*sizeof(ushort)]); @@ -745,7 +745,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) WATCHDOG_RESET(); for (j = 0; j width; j++) { if (bpix != 16) { -#if defined(CONFIG_PXA250) || defined(CONFIG_ATMEL_LCD) +#if defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS || defined(CONFIG_ATMEL_LCD) *(fb++) = *(bmap++); #elif defined(CONFIG_MPC823) || defined(CONFIG_MCC200) *(fb++) = 255 - *(bmap++); diff --git a/include/lcd.h b/include/lcd.h index 1f85daa..cd9d49d 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -87,7 +87,7 @@ typedef struct vidinfo { u_char vl_wbf; /* Wait between frames */ } vidinfo_t; -#elif defined CONFIG_PXA250 +#elif defined CONFIG_PXA250 || defined CONFIG_PXA27X || defined CONFIG_CPU_MONAHANS /* * PXA LCD DMA descriptor */ -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 5/5] PXA: PXA3xx NAND Driver
From: Compulab uboot n...@none Signed-off-by: Marek Vasut marek.va...@gmail.com --- drivers/mtd/nand/Makefile |1 + drivers/mtd/nand/pxa3xx_nand.c | 848 2 files changed, 849 insertions(+), 0 deletions(-) create mode 100644 drivers/mtd/nand/pxa3xx_nand.c diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 28f27da..cd840cd 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -50,6 +50,7 @@ COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o +COBJS-$(CONFIG_NAND_PXA3XX) += pxa3xx_nand.o endif COBJS := $(COBJS-y) diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c new file mode 100644 index 000..380c918 --- /dev/null +++ b/drivers/mtd/nand/pxa3xx_nand.c @@ -0,0 +1,848 @@ +/* + * drivers/mtd/nand/pxa3xx_nand.c + * + * Copyright © 2005 Intel Corporation + * Copyright © 2006 Marvell International Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include common.h + +#if defined(CONFIG_CMD_NAND) +#ifdef CONFIG_NEW_NAND_CODE + +#include nand.h +#include asm/arch/pxa-regs.h + +#include linux/mtd/compat.h +#include linux/types.h +#include asm/io.h +#include asm/errno.h + +#define NDCR_RD_ID_CNT_MASK(0x7 16) +#define NDCR_RD_ID_CNT(x) (((x) 16) NDCR_RD_ID_CNT_MASK) + +#define NDSR_MASK (0xfff) + +#define NDCB0_CMD_TYPE_MASK(0x7 21) +#define NDCB0_CMD_TYPE(x) (((x) 21) NDCB0_CMD_TYPE_MASK) + +#define NDCB0_ADDR_CYC_MASK(0x7 16) +#define NDCB0_ADDR_CYC(x) (((x) 16) NDCB0_ADDR_CYC_MASK) +#define NDCB0_CMD2_MASK(0xff 8) +#define NDCB0_CMD1_MASK(0xff) +#define NDCB0_ADDR_CYC_SHIFT (16) + +#define msleep mdelay +#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); }) + +/* error code and state */ +enum { + ERR_NONE= 0, + ERR_SENDCMD = -2, + ERR_DBERR = -3, + ERR_BBERR = -4, +}; + +enum { + STATE_READY = 0, + STATE_CMD_HANDLE, + STATE_PIO_READING, + STATE_PIO_WRITING, +}; + +/* the maximum possible buffer size for large page with OOB data + * is: 2048 + 64 = 2112 bytes, allocate a page here for both the + * data buffer and the DMA descriptor + */ +#define MAX_BUFF_SIZE PAGE_SIZE + +struct pxa3xx_nand_cmdset { + uint16_tread1; + uint16_tread2; + uint16_tprogram; + uint16_tread_status; + uint16_tread_id; + uint16_terase; + uint16_treset; + uint16_tlock; + uint16_tunlock; + uint16_tlock_status; +}; + +struct pxa3xx_nand_flash { + const struct pxa3xx_nand_cmdset *cmdset; + + uint32_t page_per_block;/* Pages per block (PG_PER_BLK) */ + uint32_t page_size; /* Page size in bytes (PAGE_SZ) */ + uint32_t flash_width; /* Width of Flash memory (DWIDTH_M) */ + uint32_t dfc_width; /* Width of flash controller(DWIDTH_C) */ + uint32_t num_blocks;/* Number of physical blocks in Flash */ + uint32_t chip_id; +}; + +struct pxa3xx_nand_info { + const struct pxa3xx_nand_flash *flash_info; + + unsigned intbuf_start; + unsigned intbuf_count; + + unsigned char data_buff[MAX_BUFF_SIZE]; + size_t data_buff_size; + uint32_treg_ndcr; + + /* saved column/page_addr during CMD_SEQIN */ + int seqin_column; + int seqin_page_addr; + + /* relate to the command */ + unsigned intstate; + + int use_ecc;/* use HW ECC ? */ + size_t data_size; /* data size in FIFO */ + int retcode; + + /* generated NDCBx register values */ + uint32_tndcb0; + uint32_tndcb1; + uint32_tndcb2; + + /* calculated from pxa3xx_nand_flash data */ + size_t oob_size; + size_t read_id_bytes; + + unsigned intcol_addr_cycles; + unsigned introw_addr_cycles; +}; + +static struct pxa3xx_nand_info cmx3xx_nand_info = { + .data_buff_size = MAX_BUFF_SIZE, +}; + +static struct pxa3xx_nand_flash default_flash; + +static struct pxa3xx_nand_cmdset smallpage_cmdset = { + .read1 = 0x, + .read2 = 0x0050, + .program= 0x1080, + .read_status= 0x0070, + .read_id= 0x0090, + .erase = 0xD060, + .reset = 0x00FF, +
[U-Boot] [PATCH 4/5] PXA: Add OneNAND booting support to start.S
Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/cpu/pxa/start.S | 48 + 1 files changed, 43 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/pxa/start.S b/arch/arm/cpu/pxa/start.S index e07c8c2..8010b0e 100644 --- a/arch/arm/cpu/pxa/start.S +++ b/arch/arm/cpu/pxa/start.S @@ -34,6 +34,25 @@ .globl _start _start: b reset +#ifdef CONFIG_PRELOADER + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + ldr pc, _hang + +_hang: + .word do_hang + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 + .word 0x12345678 /* now 16*4=64 */ +#else ldr pc, _undefined_instruction ldr pc, _software_interrupt ldr pc, _prefetch_abort @@ -49,6 +68,7 @@ _data_abort: .word data_abort _not_used: .word not_used _irq: .word irq _fiq: .word fiq +#endif /* CONFIG_PRELOADER */ .balignl 16,0xdeadbeef @@ -117,8 +137,10 @@ reset: relocate: /* relocate U-Boot to RAM */ adr r0, _start /* r0 - current position of code */ ldr r1, _TEXT_BASE /* test if we run from flash or RAM */ +#ifndefCONFIG_PRELOADER cmp r0, r1 /* don't reloc during debug */ beq stack_setup +#endif ldr r2, _armboot_start ldr r3, _bss_start @@ -135,28 +157,37 @@ copy_loop: /* Set up the stack */ stack_setup: ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */ - sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */ - sub r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo */ +#ifdef CONFIG_PRELOADER + sub sp, r0, #128/* leave 32 words for abort-stack */ +#else + sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */ + sub r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo */ #ifdef CONFIG_USE_IRQ sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ) #endif /* CONFIG_USE_IRQ */ sub sp, r0, #12 /* leave 3 words for abort-stack*/ bic sp, sp, #7 /* 8-byte alignment for ABI compliance */ +#endif clear_bss: ldr r0, _bss_start /* find start of bss segment*/ ldr r1, _bss_end/* stop here*/ mov r2, #0x /* clear*/ +#ifndef CONFIG_PRELOADER clbss_l:strr2, [r0]/* clear loop...*/ add r0, r0, #4 cmp r0, r1 ble clbss_l +#endif ldr pc, _start_armboot +#ifdef CONFIG_ONENAND_IPL +_start_armboot: .word start_oneboot +#else _start_armboot: .word start_armboot - +#endif // /* */ @@ -296,7 +327,7 @@ setspeed_done: */ mov pc, lr - +#ifndef CONFIG_PRELOADER // /* */ /* Interrupt handling */ @@ -394,6 +425,7 @@ setspeed_done: .macro get_fiq_stack@ setup FIQ stack ldr sp, FIQ_STACK_START .endm +#endif /* CONFIG_PRELOADER */ // @@ -402,6 +434,12 @@ setspeed_done: /* */ // +#ifdef CONFIG_PRELOADER + .align 5 +do_hang: + ldr sp, _TEXT_BASE /* use 32 words abort stack */ + bl hang/* hang and never return */ +#else /* !CONFIG_PRELOADER */ .align 5 undefined_instruction: get_bad_stack @@ -461,7 +499,7 @@ fiq: get_bad_stack bad_save_user_regs bl do_fiq - +#endif /* CONFIG_PRELOADER */ #endif /* CONFIG_USE_IRQ */ // -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/5] PXA: Add PWM2 and PWM3 regs to pxa-regs.h
Signed-off-by: Marek Vasut marek.va...@gmail.com --- arch/arm/include/asm/arch-pxa/pxa-regs.h | 10 +- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/arch-pxa/pxa-regs.h b/arch/arm/include/asm/arch-pxa/pxa-regs.h index cd7b7f9..d442fb0 100644 --- a/arch/arm/include/asm/arch-pxa/pxa-regs.h +++ b/arch/arm/include/asm/arch-pxa/pxa-regs.h @@ -1132,10 +1132,18 @@ typedef void(*ExcpHndlr) (void) ; #define PWM_PWDUTY0__REG(0x40B4) /* PWM 0 Duty Cycle Register */ #define PWM_PERVAL0__REG(0x40B8) /* PWM 0 Period Control Register */ -#define PWM_CTRL1 __REG(0x40C0) /* PWM 1Control Register */ +#define PWM_CTRL1 __REG(0x40C0) /* PWM 1 Control Register */ #define PWM_PWDUTY1__REG(0x40C4) /* PWM 1 Duty Cycle Register */ #define PWM_PERVAL1__REG(0x40C8) /* PWM 1 Period Control Register */ +#define PWM_CTRL2 __REG(0x40B00010) /* PWM 2 Control Register */ +#define PWM_PWDUTY2__REG(0x40B00014) /* PWM 2 Duty Cycle Register */ +#define PWM_PERVAL2__REG(0x40B00018) /* PWM 2 Period Control Register */ + +#define PWM_CTRL3 __REG(0x40C00010) /* PWM 3 Control Register */ +#define PWM_PWDUTY3__REG(0x40C00014) /* PWM 3 Duty Cycle Register */ +#define PWM_PERVAL3__REG(0x40C00018) /* PWM 3 Period Control Register */ + /* * Interrupt Controller */ -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] PXA: New MMC driver
The new driver is a complete rewrite. It uses the MMC framework and should support both pxa2xx and pxa3xx. This driver needs testing though. Signed-off-by: Marek Vasut marek.va...@gmail.com --- drivers/mmc/Makefile |1 + drivers/mmc/pxa_mmc_gen.c | 352 + 2 files changed, 353 insertions(+), 0 deletions(-) create mode 100644 drivers/mmc/pxa_mmc_gen.c diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile index 6fa04b8..01338a4 100644 --- a/drivers/mmc/Makefile +++ b/drivers/mmc/Makefile @@ -32,6 +32,7 @@ COBJS-$(CONFIG_OMAP3_MMC) += omap3_mmc.o COBJS-$(CONFIG_FSL_ESDHC) += fsl_esdhc.o COBJS-$(CONFIG_MXC_MMC) += mxcmmc.o COBJS-$(CONFIG_PXA_MMC) += pxa_mmc.o +COBJS-$(CONFIG_PXA_MMC_GENERIC) += pxa_mmc_gen.o COBJS := $(COBJS-y) SRCS := $(COBJS:.o=.c) diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c new file mode 100644 index 000..1b0a460 --- /dev/null +++ b/drivers/mmc/pxa_mmc_gen.c @@ -0,0 +1,352 @@ +/* + * Copyright (C) 2010 Marek Vasut marek.va...@gmail.com + * + * Loosely based on the old code and Linux's PXA MMC driver + * + * 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 config.h +#include common.h +#include malloc.h + +#include mmc.h +#include asm/errno.h +#include asm/arch/hardware.h + +#include pxa_mmc.h + +#definePXA_MMC_TIMEOUT 100 + +static int pxa_mmc_stop_clock(void) +{ + int timeout = PXA_MMC_TIMEOUT; + + /* If the clock aren't running, exit */ + if (!(MMC_STAT MMC_STAT_CLK_EN)) + return 0; + + /* Tell the controller to turn off the clock */ + MMC_STRPCL = MMC_STRPCL_STOP_CLK; + + /* Wait until the clock are off */ + while ((MMC_STAT MMC_STAT_CLK_EN) --timeout) + udelay(10); + + /* The clock refused to stop, scream and die a painful death */ + if (!timeout) + return -ETIMEDOUT; + + /* The clock stopped correctly */ + return 0; +} + +static int pxa_mmc_start_cmd(struct mmc_cmd *cmd, unsigned long cmdat) +{ + int timeout = PXA_MMC_TIMEOUT; + + /* The card can send a busy response */ + if (cmd-flags MMC_RSP_BUSY) + cmdat |= MMC_CMDAT_BUSY; + + /* Inform the controller about response type */ + switch (cmd-resp_type) { + case MMC_RSP_R1: + case MMC_RSP_R1b: + cmdat |= MMC_CMDAT_R1; + break; + case MMC_RSP_R2: + cmdat |= MMC_CMDAT_R2; + break; + case MMC_RSP_R3: + cmdat |= MMC_CMDAT_R3; + break; + default: + break; + } + + /* Load command and it's arguments into the controller */ + MMC_CMD = cmd-cmdidx; + MMC_ARGH = cmd-cmdarg 16; + MMC_ARGL = cmd-cmdarg 0x; + MMC_CMDAT = cmdat; + + /* Start the controller clock and wait until they are started */ + MMC_STRPCL = MMC_STRPCL_START_CLK; + while (!(MMC_STAT MMC_STAT_CLK_EN) --timeout) + udelay(10); + + /* The clock didn't start, we have a problem */ + if (!timeout) + return -ETIMEDOUT; + + /* Correct and happy end */ + return 0; +} + +static int pxa_mmc_cmd_done(struct mmc_cmd *cmd) +{ + unsigned long a, b, c; + int i; + int stat; + + /* Read the controller status */ + stat = MMC_STAT; + + /* +* Linux says: +* Did I mention this is Sick. We always need to +* discard the upper 8 bits of the first 16-bit word. +*/ + a = MMC_RES 0x; + for (i = 0; i 4; i++) { + b = MMC_RES 0x; + c = MMC_RES 0x; + cmd-response[i] = (a 24) | (b 8) | (c 8); + a = c; + } + + /* The command response didn't arrive */ + if (stat MMC_STAT_TIME_OUT_RESPONSE) + return -ETIMEDOUT; + else if (stat MMC_STAT_RES_CRC_ERROR cmd-flags MMC_RSP_CRC) { +#if defined(CONFIG_PXA27X) + if (cmd-flags MMC_RSP_136 cmd-response[0] 0x8000) + printf(Ignoring CRC, this may be dangerous!\n); +