Skip to contentSkip to conversation

arm nomadik: add gpio support

PATCH Superseded Alessandro Rubini 2 participants 3 messages Jul 19, 2009 – Jul 23, 2009 2 messages not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 arm nomadik: add gpio support

In reply to a message not in the archive

From: Alessandro Rubini <[email protected]>

---
 board/st/nhk8815/Makefile |    2 +-
 board/st/nhk8815/gpio.c   |   99 +++++++++++++++++++++++++++++++++++++++++++++
 board/st/nhk8815/gpio.h   |   42 +++++++++++++++++++
 3 files changed, 142 insertions(+), 1 deletions(-)
 create mode 100644 board/st/nhk8815/gpio.c
 create mode 100644 board/st/nhk8815/gpio.h
board/st/nhk8815/Makefile +1 -1
index b37fe53..80a1ab6 100644
@@ -29,7 +29,7 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).a
 
-COBJS	:= nhk8815.o
+COBJS	:= nhk8815.o gpio.o
 SOBJS	:= platform.o
 
 SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/st/nhk8815/gpio.c new file +99 -0

99 lines not on this page · raw message

board/st/nhk8815/gpio.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/2 arm nomadik: add i2c

In reply to a message not in the archive

From: Alessandro Rubini <[email protected]>

---
 board/st/nhk8815/nhk8815.c |   16 ++++++++++++++--
 include/configs/nhk8815.h  |   18 +++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)
board/st/nhk8815/nhk8815.c +14 -2
index 085a5e0..2215ef9 100644
@@ -27,6 +27,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include "gpio.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -61,9 +62,20 @@ int board_init(void)
 	return 0;
 }
 
-int misc_init_r(void)
+int board_late_init(void)
 {
-	setenv("verify", "n");
+	/* Set the two I2C gpio lines to be gpio high */
+	nmk_gpio_set(__SCL, 1);	nmk_gpio_set(__SDA, 1);
+	nmk_gpio_dir(__SCL, 1);	nmk_gpio_dir(__SDA, 1);
+	nmk_gpio_af(__SCL, GPIO_GPIO); nmk_gpio_af(__SDA, GPIO_GPIO);
+
+	/* Reset the I2C port expander, on GPIO77 */
+	nmk_gpio_af(77, GPIO_GPIO);
+	nmk_gpio_dir(77, 1);
+	nmk_gpio_set(77, 0);
+	udelay(10);
+	nmk_gpio_set(77, 1);
+
 	return 0;
 }
 
include/configs/nhk8815.h +17 -1
index 3e2e09f..165d465 100644
@@ -93,7 +93,7 @@
 #define CONFIG_SYS_GBL_DATA_SIZE	128	/* for initial data */
 #define CONFIG_SYS_64BIT_VSPRINTF	/* mtd desires this */
 
-#define CONFIG_MISC_INIT_R	/* call misc_init_r during start up */
+#define BOARD_LATE_INIT		/* call board_late_init during start up */
 
 /* timing informazion */
 #define CONFIG_SYS_HZ		1000 /* Mandatory... */
@@ -110,6 +110,22 @@
 #define CONFIG_PL01x_PORTS	{ (void *)CFG_SERIAL0, (void *)CFG_SERIAL1 }
 #define CONFIG_PL011_CLOCK	48000000
 
+/* i2c, for the port extenders (uses gpio.c in board directory) */
+#ifndef __ASSEMBLY__
+#include "../board/st/nhk8815/gpio.h"
+#define CONFIG_CMD_I2C
+#define CONFIG_SOFT_I2C
+#define CONFIG_SYS_I2C_SPEED	400000
+#define __SDA			63
+#define __SCL			62
+#define I2C_SDA(x)		nmk_gpio_set(__SDA, x)
+#define I2C_SCL(x)		nmk_gpio_set(__SCL, x)
+#define I2C_READ		(nmk_gpio_get(__SDA)!=0)
+#define I2C_ACTIVE		nmk_gpio_dir(__SDA, 1)
+#define I2C_TRISTATE		nmk_gpio_dir(__SDA, 0)
+#define I2C_DELAY     (udelay(2))
+#endif /* __ASSEMBLY__ */
+
 /* Ethernet */
 #define PCI_MEMORY_VADDR	0xe8000000
 #define PCI_IO_VADDR		0xee000000
Signature · 1 line
1.6.0.2
#4 lore raw

PATCH 1/2 arm nomadik: add gpio support

In reply to a message not in the archive
Quoted 11 lines · Alessandro Rubini

From: Alessandro Rubini <[email protected]>

---
 board/st/nhk8815/Makefile |    2 +-
 board/st/nhk8815/gpio.c   |   99 +++++++++++++++++++++++++++++++++++++++++++++
 board/st/nhk8815/gpio.h   |   42 +++++++++++++++++++
 3 files changed, 142 insertions(+), 1 deletions(-)
 create mode 100644 board/st/nhk8815/gpio.c
 create mode 100644 board/st/nhk8815/gpio.h

I guess this is soc dependent so please move it to cpu/arm926ejs/nomadik for .c and to include/asm-arm/arch-nomadik

otherwise fine

Best Regards,
J.