summaryrefslogtreecommitdiff
path: root/board/bf609-ezkit
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2013-02-05 19:05:41 +0800
committerSonic Zhang <sonic.zhang@analog.com>2013-05-13 16:26:12 +0800
commit7d861d95a315852532d581884b3b72536c25032c (patch)
treed3f844e5c0cd5a8b5faafffb961a70faae497fb5 /board/bf609-ezkit
parente7b9aa96b15c589ba0e5236be9bbadd69c8bcace (diff)
blackfin: bf609: add softswitch config command
Add softswitch_output command for bf609-ezkit to enable softswitches. Signed-off-by: Bob Liu <lliubbo@gmail.com> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Diffstat (limited to 'board/bf609-ezkit')
-rw-r--r--board/bf609-ezkit/soft_switch.c11
-rw-r--r--board/bf609-ezkit/soft_switch.h25
2 files changed, 18 insertions, 18 deletions
diff --git a/board/bf609-ezkit/soft_switch.c b/board/bf609-ezkit/soft_switch.c
index 2e1404fa09a..e0c8d93fe77 100644
--- a/board/bf609-ezkit/soft_switch.c
+++ b/board/bf609-ezkit/soft_switch.c
@@ -12,14 +12,6 @@
#include <i2c.h>
#include "soft_switch.h"
-#define SWITCH_ADDR 0x21
-
-#define NUM_SWITCH 3
-#define IODIRA 0x0
-#define IODIRB 0x1
-#define OLATA 0x14
-#define OLATB 0x15
-
struct switch_config {
uchar dir0; /* IODIRA */
uchar dir1; /* IODIRB */
@@ -126,9 +118,8 @@ static int setup_soft_switch(int addr, struct switch_config *config)
return i2c_write(addr, IODIRB, 1, &config->dir1, 1);
}
-int config_switch_bit(int num, int port, int bit, int dir, uchar value)
+int config_switch_bit(int addr, int port, int bit, int dir, uchar value)
{
- int addr = SWITCH_ADDR + num;
int ret, data_reg, dir_reg;
uchar tmp;
diff --git a/board/bf609-ezkit/soft_switch.h b/board/bf609-ezkit/soft_switch.h
index 8da0e44ddf0..d147fe1378c 100644
--- a/board/bf609-ezkit/soft_switch.h
+++ b/board/bf609-ezkit/soft_switch.h
@@ -6,8 +6,10 @@
* Licensed under the GPL-2 or later.
*/
-#ifndef __SOFT_SWITCH_H__
-#define __SOFT_SWITCH_H__
+#ifndef __BOARD_SOFT_SWITCH_H__
+#define __BOARD_SOFT_SWITCH_H__
+
+#include <asm/soft_switch.h>
/* switch 0 port A */
#define CAN_EN 0x1
@@ -61,11 +63,18 @@
#define PD3_SPI0MOSI_EN 0x1
#define PD4_SPI0CK_EN 0x2
-#define IO_PORT_A 0
-#define IO_PORT_B 1
-#define IO_PORT_INPUT 0
-#define IO_PORT_OUTPUT 1
+#ifdef CONFIG_BFIN_BOARD_VERSION_1_0
+#define SWITCH_ADDR 0x21
+#else
+#define SWITCH_ADDR 0x20
+#endif
+
+#define NUM_SWITCH 3
+#define IODIRA 0x0
+#define IODIRB 0x1
+#define OLATA 0x14
+#define OLATB 0x15
-int config_switch_bit(int num, int port, int bit, int dir, uchar value);
int setup_board_switches(void);
-#endif
+
+#endif /* __BOARD_SOFT_SWITCH_H__ */