From e45eb6b960e4ae062a533c960f2dab557637cecd Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Mon, 18 Nov 2013 14:01:38 +0800 Subject: blackfin: Use ADI_GPIO2 driver other than the default ADI_GPIO1 Signed-off-by: Sonic Zhang diff --git a/include/configs/cm-bf548.h b/include/configs/cm-bf548.h index 3c9eeb5..7f27eda 100644 --- a/include/configs/cm-bf548.h +++ b/include/configs/cm-bf548.h @@ -118,6 +118,8 @@ #define CONFIG_BOOTCOMMAND "run flashboot" #define FLASHBOOT_ENV_SETTINGS "flashboot=bootm 0x20040000\0" +#define CONFIG_ADI_GPIO2 + #ifndef __ADSPBF542__ /* Don't waste time transferring a logo over the UART */ # if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_UART) -- cgit v0.10.2 From 76db0fde5bc8e61ebfd04a940cd28ea331874104 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Mon, 18 Nov 2013 14:12:39 +0800 Subject: blackfin: If none ADI_GPIOX macro is defined, use ADI_GPIO1 as default Signed-off-by: Sonic Zhang diff --git a/arch/blackfin/cpu/gpio.c b/arch/blackfin/cpu/gpio.c index 5e9c68a..86da706 100644 --- a/arch/blackfin/cpu/gpio.c +++ b/arch/blackfin/cpu/gpio.c @@ -12,7 +12,7 @@ #include #include -#ifdef CONFIG_ADI_GPIO1 +#ifndef CONFIG_ADI_GPIO2 #if ANOMALY_05000311 || ANOMALY_05000323 enum { AWA_data = SYSCR, diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index 376ec02..6ebcf01 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h @@ -72,7 +72,7 @@ #ifndef __ASSEMBLY__ -#ifdef CONFIG_ADI_GPIO1 +#ifndef CONFIG_ADI_GPIO2 void set_gpio_dir(unsigned, unsigned short); void set_gpio_inen(unsigned, unsigned short); void set_gpio_polar(unsigned, unsigned short); -- cgit v0.10.2 From 7a58eb96862d6112b094a7ce78637c4d60461679 Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Mon, 18 Nov 2013 14:50:19 +0800 Subject: blackfin: Add missing macro CONFIG_BFIN_SERIAL Signed-off-by: Sonic Zhang diff --git a/include/configs/bf506f-ezkit.h b/include/configs/bf506f-ezkit.h index 77b6735..5ad3ee7 100644 --- a/include/configs/bf506f-ezkit.h +++ b/include/configs/bf506f-ezkit.h @@ -94,6 +94,7 @@ #define CONFIG_DCACHE_OFF #define CONFIG_UART_CONSOLE 0 #define CONFIG_BAUDRATE 115200 +#define CONFIG_BFIN_SERIAL #define CONFIG_CMD_MEMORY #undef CONFIG_GZIP diff --git a/include/configs/bf525-ucr2.h b/include/configs/bf525-ucr2.h index 1f65130..008f4b5 100644 --- a/include/configs/bf525-ucr2.h +++ b/include/configs/bf525-ucr2.h @@ -85,6 +85,7 @@ #define CONFIG_UART_CONSOLE 0 #define CONFIG_BAUDRATE 115200 +#define CONFIG_BFIN_SERIAL #define CONFIG_BOOTARGS "root=/dev/mtdblock0 rw" #define CONFIG_BOOTCOMMAND "run sfboot" #define CONFIG_BOOTDELAY 5 diff --git a/include/configs/bf537-minotaur.h b/include/configs/bf537-minotaur.h index feb9d73..156eeab 100644 --- a/include/configs/bf537-minotaur.h +++ b/include/configs/bf537-minotaur.h @@ -136,6 +136,7 @@ #define CONFIG_BAUDRATE 57600 #define CONFIG_UART_CONSOLE 0 +#define CONFIG_BFIN_SERIAL #define CONFIG_PANIC_HANG 1 #define CONFIG_RTC_BFIN 1 diff --git a/include/configs/bf537-srv1.h b/include/configs/bf537-srv1.h index 1de8ffe..e12d761 100644 --- a/include/configs/bf537-srv1.h +++ b/include/configs/bf537-srv1.h @@ -136,6 +136,7 @@ #define CONFIG_BAUDRATE 115200 #define CONFIG_UART_CONSOLE 0 +#define CONFIG_BFIN_SERIAL #define CONFIG_PANIC_HANG 1 #define CONFIG_RTC_BFIN 1 diff --git a/include/configs/blackstamp.h b/include/configs/blackstamp.h index 5b3aac7..7de4253 100644 --- a/include/configs/blackstamp.h +++ b/include/configs/blackstamp.h @@ -195,6 +195,7 @@ #define CONFIG_BAUDRATE 57600 #define CONFIG_LOADS_ECHO 1 #define CONFIG_UART_CONSOLE 0 +#define CONFIG_BFIN_SERIAL /* * I2C settings diff --git a/include/configs/dnp5370.h b/include/configs/dnp5370.h index d0e72e3..4f2c742 100644 --- a/include/configs/dnp5370.h +++ b/include/configs/dnp5370.h @@ -103,6 +103,7 @@ #define CONFIG_DNP5370_EXT_WD_DISABLE 1 #define CONFIG_UART_CONSOLE 0 +#define CONFIG_BFIN_SERIAL #define CONFIG_BAUDRATE 115200 #define CONFIG_BOOTCOMMAND "bootm 0x20030000" #define CONFIG_BOOTARGS "console=ttyBF0,115200 root=/dev/mtdblock3 rootfstype=ext2" -- cgit v0.10.2 From e5cb60a033502ab24fef15fa005835b2e46f90eb Mon Sep 17 00:00:00 2001 From: Sonic Zhang Date: Mon, 18 Nov 2013 18:59:18 +0800 Subject: blackfin: soft-i2c: No need to define blackfin specific soft i2c operations Use default GPIO operations. Signed-off-by: Sonic Zhang Acked-by: Heiko Schocher diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h index a22c868..f5b9658 100644 --- a/include/configs/bf533-stamp.h +++ b/include/configs/bf533-stamp.h @@ -80,33 +80,8 @@ /* * Software (bit-bang) I2C driver configuration */ -#define PF_SCL PF3 -#define PF_SDA PF2 -#define I2C_INIT (*pFIO_DIR |= PF_SCL); asm("ssync;") -#define I2C_ACTIVE (*pFIO_DIR |= PF_SDA); \ - *pFIO_INEN &= ~PF_SDA; asm("ssync;") -#define I2C_TRISTATE (*pFIO_DIR &= ~PF_SDA); \ - *pFIO_INEN |= PF_SDA; asm("ssync;") -#define I2C_READ ((volatile)(*pFIO_FLAG_D & PF_SDA) != 0); \ - asm("ssync;") -#define I2C_SDA(bit) if (bit) { \ - *pFIO_FLAG_S = PF_SDA; \ - asm("ssync;"); \ - } \ - else { \ - *pFIO_FLAG_C = PF_SDA; \ - asm("ssync;"); \ - } -#define I2C_SCL(bit) if (bit) { \ - *pFIO_FLAG_S = PF_SCL; \ - asm("ssync;"); \ - } \ - else { \ - *pFIO_FLAG_C = PF_SCL; \ - asm("ssync;"); \ - } -#define I2C_DELAY udelay(5) /* 1/4 I2C clock duration */ - +#define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF3 +#define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF2 /* * Flash Settings -- cgit v0.10.2 From 727cbe14b25b492bc9b96ad9d1f5f881d833028e Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 2 Dec 2013 12:57:33 +0800 Subject: spi: bfin_spi: Remove unnecessary test for bus and pins[bus] For invalid bus number, current code returns NULL in the default case of switch-case statements. In additional, pins[bus] is always not NULL because it is the address of specific row of the two-dimensional array. Thus this patch removes these unnecessary test. Signed-off-by: Axel Lin Acked-by: Scott Jiang Signed-off-by: Sonic Zhang diff --git a/drivers/spi/bfin_spi.c b/drivers/spi/bfin_spi.c index bb88f30..aa89d89 100644 --- a/drivers/spi/bfin_spi.c +++ b/drivers/spi/bfin_spi.c @@ -162,21 +162,22 @@ 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 SPI0_CTL - case 0: mmr_base = SPI0_CTL; break; + case 0: + mmr_base = SPI0_CTL; break; #endif #ifdef SPI1_CTL - case 1: mmr_base = SPI1_CTL; break; + case 1: + mmr_base = SPI1_CTL; break; #endif #ifdef SPI2_CTL - case 2: mmr_base = SPI2_CTL; break; + case 2: + mmr_base = SPI2_CTL; break; #endif - default: return NULL; + default: + debug("%s: invalid bus %u\n", __func__, bus); + return NULL; } bss = spi_alloc_slave(struct bfin_spi_slave, bus, cs); -- cgit v0.10.2 From 9bac8f77698771165def23b9eebad536d5b5cd6d Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 2 Dec 2013 12:57:44 +0800 Subject: spi: bfin_spi6xx: Remove unnecessary test for bus and pins[bus] For invalid bus number, current code returns NULL in the default case of switch-case statements. In additional, pins[bus] is always not NULL because it is the address of specific row of the two-dimensional array. Thus this patch removes these unnecessary test. Signed-off-by: Axel Lin Acked-by: Scott Jiang Signed-off-by: Sonic Zhang diff --git a/drivers/spi/bfin_spi6xx.c b/drivers/spi/bfin_spi6xx.c index c25c4a9..07b833d 100644 --- a/drivers/spi/bfin_spi6xx.c +++ b/drivers/spi/bfin_spi6xx.c @@ -154,10 +154,6 @@ 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 SPI0_REGBASE case 0: @@ -175,6 +171,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, break; #endif default: + debug("%s: invalid bus %u\n", __func__, bus); return NULL; } -- cgit v0.10.2 From 985e18d14e0cb3933311945d30de6357cf8be9df Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 29 Nov 2013 15:34:16 +0900 Subject: blackfin: Do not generate unused header bootrom-asm-offsets.h Signed-off-by: Masahiro Yamada Signed-off-by: Sonic Zhang diff --git a/Makefile b/Makefile index 8b86913..e693f7f 100644 --- a/Makefile +++ b/Makefile @@ -807,7 +807,6 @@ clean: $(obj)board/matrix_vision/*/bootscript.img \ $(obj)board/voiceblue/eeprom \ $(obj)u-boot.lds \ - $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs] \ $(obj)arch/blackfin/cpu/init.{lds,elf} @rm -f $(obj)include/bmp_logo.h @rm -f $(obj)include/bmp_logo_data.h diff --git a/arch/blackfin/cpu/.gitignore b/arch/blackfin/cpu/.gitignore index ba986d8..3df1fa2 100644 --- a/arch/blackfin/cpu/.gitignore +++ b/arch/blackfin/cpu/.gitignore @@ -1,4 +1,2 @@ -bootrom-asm-offsets.[chs] - init.lds init.elf diff --git a/arch/blackfin/cpu/Makefile b/arch/blackfin/cpu/Makefile index 243dc22..a61594a 100644 --- a/arch/blackfin/cpu/Makefile +++ b/arch/blackfin/cpu/Makefile @@ -23,16 +23,6 @@ obj-y += traps.o extra-y += check_initcode -extra-y += bootrom-asm-offsets.h -$(obj)bootrom-asm-offsets.c: bootrom-asm-offsets.c.in bootrom-asm-offsets.awk - echo '#include ' | $(CPP) $(CPPFLAGS) - | gawk -f ./bootrom-asm-offsets.awk > $@.tmp - mv $@.tmp $@ -$(obj)bootrom-asm-offsets.s: $(obj)bootrom-asm-offsets.c - $(CC) $(CFLAGS) -S $^ -o $@.tmp - mv $@.tmp $@ -$(obj)bootrom-asm-offsets.h: $(obj)bootrom-asm-offsets.s - sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}" $^ > $@ - # make sure our initcode (which goes into LDR) does not # have relocs or external references $(obj)initcode.o: CFLAGS += -fno-function-sections -fno-data-sections diff --git a/arch/blackfin/cpu/bootrom-asm-offsets.awk b/arch/blackfin/cpu/bootrom-asm-offsets.awk deleted file mode 100644 index 1d61824..0000000 --- a/arch/blackfin/cpu/bootrom-asm-offsets.awk +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/gawk -f -BEGIN { - print "/* DO NOT EDIT: AUTOMATICALLY GENERATED" - print " * Input files: bootrom-asm-offsets.awk bootrom-asm-offsets.c.in" - print " * DO NOT EDIT: AUTOMATICALLY GENERATED" - print " */" - print "" - system("cat bootrom-asm-offsets.c.in") - print "{" -} - -{ - /* find a structure definition */ - if ($0 ~ /typedef struct .* {/) { - delete members; - i = 0; - - /* extract each member of the structure */ - while (1) { - getline - if ($1 == "}") - break; - gsub(/[*;]/, ""); - members[i++] = $NF; - } - - /* grab the structure's name */ - struct = $NF; - sub(/;$/, "", struct); - - /* output the DEFINE() macros */ - while (i-- > 0) - print "\tDEFINE(" struct ", " members[i] ");" - print "" - } -} - -END { - print "\treturn 0;" - print "}" -} diff --git a/arch/blackfin/cpu/bootrom-asm-offsets.c.in b/arch/blackfin/cpu/bootrom-asm-offsets.c.in deleted file mode 100644 index 64c2f24..0000000 --- a/arch/blackfin/cpu/bootrom-asm-offsets.c.in +++ /dev/null @@ -1,12 +0,0 @@ -/* A little trick taken from the kernel asm-offsets.h where we convert - * the C structures automatically into a bunch of defines for use in - * the assembly files. - */ - -#include -#include - -#define _DEFINE(sym, val) asm volatile("\n->" #sym " %0 " #val : : "i" (val)) -#define DEFINE(s, m) _DEFINE(offset_##s##_##m, offsetof(s, m)) - -int main(int argc, char * const argv[]) -- cgit v0.10.2