Re: [U-Boot] [PATCH 06/16] Blackfin: Bf609-ezkit: implement soft switch

2012-08-22 Thread Mike Frysinger
On Monday 20 August 2012 04:11:17 Bob Liu wrote:
 On Wed, Aug 8, 2012 at 12:59 PM, Mike Frysinger vap...@gentoo.org wrote:
  start with the address that the newest boards are using, and then
  fallback to the older ones.  this way there's no runtime penalty on
  newer boards, but older ones continue to work.
  
  shouldn't there be a new u-boot command here so people can toggle
  peripherals themselves ?  i thought that was the intention when we first
  discussed this idea with the firmware team.
 
 I don't know whether a blackfin specific u-boot command can be accepted.

sure it will.  we've got some already (like bootldr and otp and cplbinfo 
and ldrinfo).  if it's board specific (i suspect it will be), then just add 
it to the bf609-ezkit board dir.  you can add u-boot commands in there just as 
easily as the common/ directory.

common/cmd_cplbinfo.c is probably the easiest example to get you up and 
running

 What about merge these series with the default setting first?
 Because it's already a little big, let's make it simple at first.

sure, setting up sane defaults is OK, but we'll still want the command :)
-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 06/16] Blackfin: Bf609-ezkit: implement soft switch

2012-08-20 Thread Bob Liu
On Wed, Aug 8, 2012 at 12:59 PM, Mike Frysinger vap...@gentoo.org wrote:
 On Tuesday 07 August 2012 04:07:45 Bob Liu wrote:
 --- a/board/bf609-ezkit/Makefile
 +++ b/board/bf609-ezkit/Makefile

 +COBJS-$(CONFIG_BFIN_SOFT_SWITCH)   += soft_switch.o

 is there any reason we *wouldn't* want to build this ?  i would just skip
 making this an option and always enable it.

 also, any reason for not just squashing into the initial bf609-ezkit board
 port ?  there's quite a bit of rudimentary code in bf609-ezkit.c before to
 support this.

Okay.


 --- a/board/bf609-ezkit/bf609-ezkit.c
 +++ b/board/bf609-ezkit/bf609-ezkit.c

 +/* miscellaneous platform dependent initialisations */
 +int misc_init_r(void)
 +{
 + printf(other init\n);

 useless display - delete

Will be deleted.


 --- /dev/null
 +++ b/board/bf609-ezkit/soft_switch.c

 +#ifdef CONFIG_BFIN_BOARD_VERSION_1_0
 +#define SWITCH_ADDR 0x21
 +#else
 +#define SWITCH_ADDR 0x20
 +#endif

 must this be a runtime define ?  can't you probe the slave address at runtime
 to figure out which one to use ?

This will be removed. We only support board version above 1.0.

 start with the address that the newest boards are using, and then fallback to
 the older ones.  this way there's no runtime penalty on newer boards, but
 older ones continue to work.

 shouldn't there be a new u-boot command here so people can toggle peripherals
 themselves ?  i thought that was the intention when we first discussed this
 idea with the firmware team.

I don't know whether a blackfin specific u-boot command can be accepted.
What about merge these series with the default setting first?
Because it's already a little big, let's make it simple at first.

And then we can consider to add a new command in a separated patch in future.
Thank you.

-- 
Regards,
--Bob
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 06/16] Blackfin: Bf609-ezkit: implement soft switch

2012-08-07 Thread Bob Liu
From: Sonic Zhang sonic.zh...@analog.com

Set up soft switch pins properly in board init code.

Signed-off-by: Sonic Zhang sonic.zh...@analog.com
Signed-off-by: Bob Liu lliu...@gmail.com
---
 board/bf609-ezkit/Makefile  |1 +
 board/bf609-ezkit/bf609-ezkit.c |   22 +++--
 board/bf609-ezkit/soft_switch.c |  173 +++
 board/bf609-ezkit/soft_switch.h |   71 
 include/configs/bf609-ezkit.h   |6 +-
 5 files changed, 260 insertions(+), 13 deletions(-)
 create mode 100644 board/bf609-ezkit/soft_switch.c
 create mode 100644 board/bf609-ezkit/soft_switch.h

diff --git a/board/bf609-ezkit/Makefile b/board/bf609-ezkit/Makefile
index cde8168..0bb8fe6 100644
--- a/board/bf609-ezkit/Makefile
+++ b/board/bf609-ezkit/Makefile
@@ -30,6 +30,7 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(BOARD).o
 
 COBJS-y:= $(BOARD).o
+COBJS-$(CONFIG_BFIN_SOFT_SWITCH)   += soft_switch.o
 
 SRCS   := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
diff --git a/board/bf609-ezkit/bf609-ezkit.c b/board/bf609-ezkit/bf609-ezkit.c
index d701c36..d54906b 100644
--- a/board/bf609-ezkit/bf609-ezkit.c
+++ b/board/bf609-ezkit/bf609-ezkit.c
@@ -11,6 +11,7 @@
 #include asm/blackfin.h
 #include asm/io.h
 #include asm/portmux.h
+#include soft_switch.h
 
 int checkboard(void)
 {
@@ -32,30 +33,20 @@ int board_early_init_f(void)
 }
 
 #ifdef CONFIG_DESIGNWARE_ETH
-#define TWI_ADDR 0x20
 int board_eth_init(bd_t *bis)
 {
int ret = 0;
-   uchar idira = 0x0;
-   uchar lata = 0xff;
 
if (CONFIG_DW_PORTS  1) {
static const unsigned short pins[] = P_RMII0;
if (!peripheral_request_list(pins, emac0)) {
-   /* enable phy clk */
-   ret = i2c_write(TWI_ADDR, 0x0, 1, idira, 1);
-   if (!ret) {
-   ret = i2c_write(TWI_ADDR, 0x14, 1, lata, 1);
-   if (!ret)
-   ret += designware_initialize(0, 
EMAC0_MACCFG, 1, 0);
-   }
+   ret += designware_initialize(0, EMAC0_MACCFG, 1, 0);
}
}
-
if (CONFIG_DW_PORTS  2) {
static const unsigned short pins[] = P_RMII1;
if (!peripheral_request_list(pins, emac1))
-   ret += designware_initialize(1, EMAC1_MACCFG, 1, 0, 1);
+   ret += designware_initialize(1, EMAC1_MACCFG, 1, 0);
}
 
return ret;
@@ -68,3 +59,10 @@ int board_mmc_init(bd_t *bis)
return bfin_mmc_init(bis);
 }
 #endif
+
+/* miscellaneous platform dependent initialisations */
+int misc_init_r(void)
+{
+   printf(other init\n);
+   return setup_board_switches();
+}
diff --git a/board/bf609-ezkit/soft_switch.c b/board/bf609-ezkit/soft_switch.c
new file mode 100644
index 000..9e2265a
--- /dev/null
+++ b/board/bf609-ezkit/soft_switch.c
@@ -0,0 +1,173 @@
+/*
+ * U-boot - main board file
+ *
+ * Copyright (c) 2008-2011 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include common.h
+#include asm/blackfin.h
+#include asm/io.h
+#include i2c.h
+#include soft_switch.h
+
+#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
+
+struct switch_config {
+   uchar dir0; /* IODIRA */
+   uchar dir1; /* IODIRB */
+   uchar value0; /* OLATA */
+   uchar value1; /* OLATB */
+};
+
+static struct switch_config switch_config_array[NUM_SWITCH] = {
+   {
+/*
+   U45 Port A  U45 Port B
+
+   7---  RMII_CLK_EN   |   7--- 
~TEMP_THERM_EN
+   | 6- ~CNT0ZM_EN |   | 6- 
~TEMP_IRQ_EN
+   | | 5--- ~CNT0DG_EN |   | | 5--- 
~UART0CTS_146_EN
+   | | | 4- ~CNT0UD_EN |   | | | 4- 
~UART0CTS_RST_EN
+   | | | | 3--- ~CAN0RX_EN |   | | | | 3--- 
~UART0CTS_RTS_LPBK
+   | | | | | 2- ~CAN0_ERR_EN   |   | | | | | 2- 
~UART0CTS_EN
+   | | | | | | 1--- ~CAN_STB   |   | | | | | | 1--- ~UART0RX_EN
+   | | | | | | | 0-  CAN_EN|   | | | | | | | 0- 
~UART0RTS_EN
+   | | | | | | | | |   | | | | | | | |
+   O O O O O O O O |   O O O O O O O O ( I/O 
direction )
+   1 0 0 0 0 0 1 1 |   1 1 1 1 1 0 0 0 ( value 
being set )
+*/
+   .dir0 = 0x0, /* all output */
+   .dir1 = 0x0, /* all output */
+   .value0 = RMII_CLK_EN | CAN_STB | CAN_EN,
+   .value1 = TEMP_THERM_EN | TEMP_IRQ_EN | UART0CTS_146_EN
+   

Re: [U-Boot] [PATCH 06/16] Blackfin: Bf609-ezkit: implement soft switch

2012-08-07 Thread Mike Frysinger
On Tuesday 07 August 2012 04:07:45 Bob Liu wrote:
 --- a/board/bf609-ezkit/Makefile
 +++ b/board/bf609-ezkit/Makefile

 +COBJS-$(CONFIG_BFIN_SOFT_SWITCH)   += soft_switch.o

is there any reason we *wouldn't* want to build this ?  i would just skip 
making this an option and always enable it.

also, any reason for not just squashing into the initial bf609-ezkit board 
port ?  there's quite a bit of rudimentary code in bf609-ezkit.c before to 
support this.

 --- a/board/bf609-ezkit/bf609-ezkit.c
 +++ b/board/bf609-ezkit/bf609-ezkit.c

 +/* miscellaneous platform dependent initialisations */
 +int misc_init_r(void)
 +{
 + printf(other init\n);

useless display - delete

 --- /dev/null
 +++ b/board/bf609-ezkit/soft_switch.c

 +#ifdef CONFIG_BFIN_BOARD_VERSION_1_0
 +#define SWITCH_ADDR 0x21
 +#else
 +#define SWITCH_ADDR 0x20
 +#endif

must this be a runtime define ?  can't you probe the slave address at runtime 
to figure out which one to use ?

start with the address that the newest boards are using, and then fallback to 
the older ones.  this way there's no runtime penalty on newer boards, but 
older ones continue to work.

shouldn't there be a new u-boot command here so people can toggle peripherals 
themselves ?  i thought that was the intention when we first discussed this 
idea with the firmware team.
-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