Skip to contentSkip to conversation

blackfin: i2c: Missing the patch to define GPIO I2C pins.

PATCH New Sonic Zhang 2 participants 6 messages Nov 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 blackfin: i2c: Missing the patch to define GPIO I2C pins.

From: Sonic Zhang <[email protected]>

---
 include/configs/bf533-stamp.h | 48 +++++--------------------------------------
 1 file changed, 5 insertions(+), 43 deletions(-)
include/configs/bf533-stamp.h +5 -43
index a22c868..26a140e 100644
@@ -14,6 +14,7 @@
 #define CONFIG_BFIN_CPU             bf533-0.3
 #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_BYPASS
 
+
 /*
  * Clock Settings
  *	CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
@@ -37,6 +38,7 @@
 /* Values can range from 1-15						*/
 #define CONFIG_SCLK_DIV			6 /* note: 1.2 boards can go faster */
 
+
 /*
  * Memory Settings
  */
@@ -72,42 +74,6 @@
 /* #define CONFIG_ETHADDR	02:80:ad:20:31:b8 */
 
 
-/* I2C */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
-#define CONFIG_SYS_I2C_SOFT_SPEED	50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE	0
-/*
- * 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 */
-
-
 /*
  * Flash Settings
  */
@@ -118,6 +84,7 @@
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
 #define CONFIG_SYS_MAX_FLASH_SECT	67
 
+
 /*
  * SPI Settings
  */
@@ -165,15 +132,10 @@
 /*
  * I2C Settings
  */
-#define CONFIG_SYS_I2C_SOFT
-#ifdef CONFIG_SYS_I2C_SOFT
-#define CONFIG_SYS_I2C
+#define CONFIG_SOFT_I2C
 #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF3
 #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF2
-#define I2C_DELAY		udelay(5)	/* 1/4 I2C clock duration */
-#define CONFIG_SYS_I2C_SOFT_SPEED	50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE	0
-#endif
+
 
 /*
  * Compact Flash / IDE / ATA Settings
Signature · 1 line
1.8.2.3
#1 lore raw

PATCH 2/4 blackfin: Use ADI_GPIO2 driver other than the default ADI_GPIO1.

From: Sonic Zhang <[email protected]>

---
 include/configs/cm-bf548.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/cm-bf548.h +2 -0
index 3c9eeb5..7f27eda 100644
@@ -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)
Signature · 1 line
1.8.2.3
#2 lore raw

PATCH 3/4 blackfin: If none ADI_GPIOX macro is defined, use ADI_GPIO1 as default.

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

---
 arch/blackfin/cpu/gpio.c         | 2 +-
 arch/blackfin/include/asm/gpio.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/blackfin/cpu/gpio.c +1 -1
index 5e9c68a..86da706 100644
@@ -12,7 +12,7 @@
 #include <asm/gpio.h>
 #include <asm/portmux.h>
 
-#ifdef CONFIG_ADI_GPIO1
+#ifndef CONFIG_ADI_GPIO2
 #if ANOMALY_05000311 || ANOMALY_05000323
 enum {
 	AWA_data = SYSCR,
arch/blackfin/include/asm/gpio.h +1 -1
index 376ec02..6ebcf01 100644
@@ -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);
Signature · 1 line
1.8.2.3
#3 lore raw

PATCH 4/4 blackfin: Add missing macro CONFIG_BFIN_SERIAL

In reply to Sonic Zhang

From: Sonic Zhang <[email protected]>

---
 include/configs/bf506f-ezkit.h   | 1 +
 include/configs/bf525-ucr2.h     | 1 +
 include/configs/bf537-minotaur.h | 1 +
 include/configs/bf537-srv1.h     | 1 +
 include/configs/blackstamp.h     | 1 +
 include/configs/dnp5370.h        | 1 +
 6 files changed, 6 insertions(+)
include/configs/bf506f-ezkit.h +1 -0
index 77b6735..5ad3ee7 100644
@@ -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
include/configs/bf525-ucr2.h +1 -0
index 1f65130..008f4b5 100644
@@ -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
include/configs/bf537-minotaur.h +1 -0
index feb9d73..156eeab 100644
@@ -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
include/configs/bf537-srv1.h +1 -0
index 1de8ffe..e12d761 100644
@@ -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
include/configs/blackstamp.h +1 -0
index 5b3aac7..7de4253 100644
@@ -195,6 +195,7 @@
 #define CONFIG_BAUDRATE		57600
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_UART_CONSOLE	0
+#define CONFIG_BFIN_SERIAL
 
 /*
  * I2C settings
include/configs/dnp5370.h +1 -0
index d0e72e3..4f2c742 100644
@@ -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"
Signature · 1 line
1.8.2.3
#4 lore raw

PATCH 1/4 blackfin: i2c: Missing the patch to define GPIO I2C pins.

In reply to Sonic Zhang

Hello Sonic Zhang,

Am 18.11.2013 08:12, schrieb Sonic Zhang:

Quoted 12 lines

From: Sonic Zhang<[email protected]>

---
  include/configs/bf533-stamp.h | 48 +++++--------------------------------------
  1 file changed, 5 insertions(+), 43 deletions(-)
include/configs/bf533-stamp.h +0 -0
index a22c868..26a140e 100644

include/configs/bf533-stamp.h line 17

Quoted 4 lines
include/configs/bf533-stamp.h +1 -0
@@ -14,6 +14,7 @@
  #define CONFIG_BFIN_CPU             bf533-0.3
  #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_BYPASS
 
+

Not needed, please remove.

include/configs/bf533-stamp.h line 41

Quoted 8 lines
include/configs/bf533-stamp.h +1 -0
  /*
   * Clock Settings
   *	CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
@@ -37,6 +38,7 @@
  /* Values can range from 1-15						*/
  #define CONFIG_SCLK_DIV			6 /* note: 1.2 boards can go faster */
 
+

Here too...

include/configs/bf533-stamp.h line 79

Quoted 12 lines
include/configs/bf533-stamp.h +0 -5
  /*
   * Memory Settings
   */
@@ -72,42 +74,6 @@
  /* #define CONFIG_ETHADDR	02:80:ad:20:31:b8 */
 
 
-/* I2C */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_SOFT		/* I2C bit-banged */
-#define CONFIG_SYS_I2C_SOFT_SPEED	50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE	0

Why do you remove the soft i2c driver?

Quoted 43 lines
include/configs/bf533-stamp.h +1 -31
-/*
- * 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 */
-
-
  /*
   * Flash Settings
   */
@@ -118,6 +84,7 @@
  #define CONFIG_SYS_MAX_FLASH_BANKS	1
  #define CONFIG_SYS_MAX_FLASH_SECT	67
 
+
  /*
   * SPI Settings
   */

include/configs/bf533-stamp.h line 135

Quoted 7 lines
include/configs/bf533-stamp.h +1 -3
@@ -165,15 +132,10 @@
  /*
   * I2C Settings
   */
-#define CONFIG_SYS_I2C_SOFT
-#ifdef CONFIG_SYS_I2C_SOFT
-#define CONFIG_SYS_I2C
+#define CONFIG_SOFT_I2C

NAK. This define is not existent in current mainline code ...

include/configs/bf533-stamp.h line 141

Quoted 10 lines
include/configs/bf533-stamp.h +1 -4
  #define CONFIG_SOFT_I2C_GPIO_SCL GPIO_PF3
  #define CONFIG_SOFT_I2C_GPIO_SDA GPIO_PF2
-#define I2C_DELAY		udelay(5)	/* 1/4 I2C clock duration */
-#define CONFIG_SYS_I2C_SOFT_SPEED	50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE	0
-#endif
+
 
  /*
   * Compact Flash / IDE / ATA Settings

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#5 lore raw

PATCH 1/4 blackfin: i2c: Missing the patch to define GPIO I2C pins.

bHi Heiko,

Quoted 47 lines · Heiko Schocher

Hello Sonic Zhang,

Am 18.11.2013 08:12, schrieb Sonic Zhang:

Quoted 13 lines

From: Sonic Zhang<[email protected]>

---
  include/configs/bf533-stamp.h | 48
+++++--------------------------------------
  1 file changed, 5 insertions(+), 43 deletions(-)
include/configs/bf533-stamp.h +0 -0
index a22c868..26a140e 100644

include/configs/bf533-stamp.h line 17

Quoted 4 lines
include/configs/bf533-stamp.h +1 -0
@@ -14,6 +14,7 @@
  #define CONFIG_BFIN_CPU             bf533-0.3
  #define CONFIG_BFIN_BOOT_MODE       BFIN_BOOT_BYPASS
 
+

Not needed, please remove.

Quoted 9 lines
include/configs/bf533-stamp.h +0 -0
  /*
   * Clock Settings
   *    CCLK = (CLKIN * VCO_MULT) / CCLK_DIV
@@ -37,6 +38,7 @@
  /* Values can range from 1-15                                         */
  #define CONFIG_SCLK_DIV                       6 /* note: 1.2 boards can

go faster */

+

Here too...

Quoted 7 lines

/*
* Memory Settings
*/

include/configs/bf533-stamp.h +0 -0
@@ -72,42 +74,6 @@
  /* #define CONFIG_ETHADDR     02:80:ad:20:31:b8 */
 
 
Quoted 8 lines

include/configs/bf533-stamp.h line 79

Quoted 5 lines
include/configs/bf533-stamp.h +0 -5
-/* I2C */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_SOFT            /* I2C bit-banged */
-#define CONFIG_SYS_I2C_SOFT_SPEED      50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE      0

Why do you remove the soft i2c driver?

You should access GPIO register such via macro bfin_read_XXX other than macro pFIO_XXX directly. So do the macro PFX. They don't exist in head files and cause building failure.

I missed these code are from your patch "soft-i2c: switch to new multibus/multiadapter support". I will try to send a new fix.

Regards,

Sonic Zhang