Skip to contentSkip to conversation

sh: Add support for r0p7734 board

PATCH New Nobuhiro Iwamatsu 2 participants 8 messages Feb 3, 2012 – Feb 22, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: Add support for r0p7734 board

The r0p7734 board has SH7734, 128MB DDR2-SDRAM, USB, Ethernet, and more.

This patch supports the following functions:
- 128MB DDR2-SDRAM
- 32MB NOR Flash memory
- Serial console (SCIF)
- Ethernet (SH-Ether/SMSC)

---
 MAINTAINERS                           |    1 +
 board/renesas/r0p7734/Makefile        |   40 +++
 board/renesas/r0p7734/lowlevel_init.S |  606 +++++++++++++++++++++++++++++++++
 board/renesas/r0p7734/r0p7734.c       |   78 +++++
 boards.cfg                            |    1 +
 include/configs/r0p7734.h             |  167 +++++++++
 6 files changed, 893 insertions(+), 0 deletions(-)
 create mode 100644 board/renesas/r0p7734/Makefile
 create mode 100644 board/renesas/r0p7734/lowlevel_init.S
 create mode 100644 board/renesas/r0p7734/r0p7734.c
 create mode 100644 include/configs/r0p7734.h
MAINTAINERS +1 -0
index 4bf12b5..44394a8 100644
@@ -1069,6 +1069,7 @@ Nobuhiro Iwamatsu <[email protected]>
 	AP325RXA	SH7723
 	SHMIN		SH7706
 	ECOVEC		SH7724
+	R0P7734     SH7734
 
 Mark Jonas <[email protected]>
 
board/renesas/r0p7734/Makefile new file +40 -0
new file mode 100644
index 0000000..b8c0353
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2011 Nobuhiro Iwamatsu <[email protected]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).o
+
+COBJS	:= r0p7734.o
+SOBJS	:= lowlevel_init.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+	$(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
board/renesas/r0p7734/lowlevel_init.S new file +606 -0

606 lines not on this page · raw message

board/renesas/r0p7734/r0p7734.c new file +78 -0

78 lines not on this page · raw message

boards.cfg +1 -0
index 0b32532..71f0502 100644
@@ -1005,6 +1005,7 @@ sh7757lcr                    sh          sh4         sh7757lcr           renesas
 sh7763rdp                    sh          sh4         sh7763rdp           renesas        -
 sh7785lcr                    sh          sh4         sh7785lcr           renesas        -
 sh7785lcr_32bit              sh          sh4         sh7785lcr           renesas        -           sh7785lcr:SH_32BIT=1
+r0p7734                      sh          sh4         r0p7734             renesas        -
 grsim_leon2                  sparc       leon2       -                   gaisler
 gr_cpci_ax2000               sparc       leon3       -                   gaisler
 gr_ep2s60                    sparc       leon3       -                   gaisler
include/configs/r0p7734.h new file +167 -0

167 lines not on this page · raw message

Signature · 1 line
1.7.7.3
#1 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

---
 drivers/net/sh_eth.c |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)
drivers/net/sh_eth.c +21 -6
index c1abe7c..e29061c 100644
@@ -60,7 +60,8 @@ int sh_eth_send(struct eth_device *dev, volatile void *packet, int len)
 
 	/* packet must be a 4 byte boundary */
 	if ((int)packet & 3) {
-		printf(SHETHER_NAME ": %s: packet not 4 byte alligned\n", __func__);
+		printf(SHETHER_NAME
+			": %s: packet not 4 byte alligned\n" , __func__);
 		ret = -EFAULT;
 		goto err;
 	}
@@ -141,6 +142,8 @@ static int sh_eth_reset(struct sh_eth_dev *eth)
 #if defined(CONFIG_CPU_SH7763) || defined(CONFIG_CPU_SH7734)
 	int ret = 0, i;
 
+	port = eth->port;
+
 	/* Start e-dmac transmitter and receiver */
 	outl(EDSR_ENALL, EDSR(port));
 
@@ -159,6 +162,8 @@ static int sh_eth_reset(struct sh_eth_dev *eth)
 
 	return ret;
 #else
+	port = eth->port;
+
 	outl(inl(EDMR(port)) | EDMR_SRST, EDMR(port));
 	udelay(3000);
 	outl(inl(EDMR(port)) & ~EDMR_SRST, EDMR(port));
@@ -564,8 +569,10 @@ static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) | PIR_MMD, PIR(port));
 
@@ -574,8 +581,10 @@ static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
 
@@ -584,8 +593,10 @@ static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
 		outl(inl(PIR(port)) | PIR_MDO, PIR(port));
@@ -597,8 +608,10 @@ static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 
 static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	*v = (inl(PIR(port)) & PIR_MDI) >> 3;
 
@@ -607,8 +620,10 @@ static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 
 static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
 		outl(inl(PIR(port)) | PIR_MDC, PIR(port));
Signature · 1 line
1.7.7.3
#2 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

Quoted 63 lines · On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
drivers/net/sh_eth.c +9 -3
@@ -564,8 +569,10 @@ static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
 
 static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) | PIR_MMD, PIR(port));
 
@@ -574,8 +581,10 @@ static int sh_eth_bb_mdio_active(struct bb_miiphy_bus
 *bus)
 
 static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
@@ -584,8 +593,10 @@ static int sh_eth_bb_mdio_tristate(struct
 bb_miiphy_bus *bus)
 
 static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
drivers/net/sh_eth.c +6 -2
 		outl(inl(PIR(port)) | PIR_MDO, PIR(port));
@@ -597,8 +608,10 @@ static int sh_eth_bb_set_mdio(struct bb_miiphy_bus
 *bus, int v)
 
 static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	*v = (inl(PIR(port)) & PIR_MDI) >> 3;
@@ -607,8 +620,10 @@ static int sh_eth_bb_get_mdio(struct bb_miiphy_bus
 *bus, int *v)
 
 static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
 {
+	int port;
 	struct sh_eth_dev *eth = bus->priv;
-	int port = eth->port;
+
+	port = eth->port;
 
 	if (v)
Quoted 1 line

outl(inl(PIR(port)) | PIR_MDC, PIR(port));

i don't see why any of these changes are necessary ... the old code looks fine to me (from a warning and style pov)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120203/9e3c7869/attachment.pgp>

#3 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

Hi,

2012/2/3 Mike Frysinger <[email protected]>:

Quoted 63 lines · On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
Quoted 62 lines
(quoted diff) +9 -3
@@ -564,8 +569,10 @@ static int sh_eth_bb_init(struct bb_miiphy_bus *bus)
 
 ?static int sh_eth_bb_mdio_active(struct bb_miiphy_bus *bus)
 ?{
+ ? ? int port;
 ? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;
 
 ? ? ? outl(inl(PIR(port)) | PIR_MMD, PIR(port));
 
@@ -574,8 +581,10 @@ static int sh_eth_bb_mdio_active(struct bb_miiphy_bus
 *bus)
 
 ?static int sh_eth_bb_mdio_tristate(struct bb_miiphy_bus *bus)
 ?{
+ ? ? int port;
 ? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;
 
 ? ? ? outl(inl(PIR(port)) & ~PIR_MMD, PIR(port));
@@ -584,8 +593,10 @@ static int sh_eth_bb_mdio_tristate(struct
 bb_miiphy_bus *bus)
 
 ?static int sh_eth_bb_set_mdio(struct bb_miiphy_bus *bus, int v)
 ?{
+ ? ? int port;
 ? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;
 
 ? ? ? if (v)

? ? ? ? ? ? ? outl(inl(PIR(port)) | PIR_MDO, PIR(port));

(quoted diff) +6 -2
@@ -597,8 +608,10 @@ static int sh_eth_bb_set_mdio(struct bb_miiphy_bus
 *bus, int v)
 
 ?static int sh_eth_bb_get_mdio(struct bb_miiphy_bus *bus, int *v)
 ?{
+ ? ? int port;
 ? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;
 
 ? ? ? *v = (inl(PIR(port)) & PIR_MDI) >> 3;
@@ -607,8 +620,10 @@ static int sh_eth_bb_get_mdio(struct bb_miiphy_bus
 *bus, int *v)
 
 ?static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v)
 ?{
+ ? ? int port;
 ? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;
 
Quoted 6 lines
Quoted 2 lines
(quoted diff) +0 -0
 ? ? ? if (v)

? ? ? ? ? ? ? outl(inl(PIR(port)) | PIR_MDC, PIR(port));

i don't see why any of these changes are necessary ... the old code looks fine to me (from a warning and style pov)
-mike

I do not seem to have any problem with the former cord, too either. But when I dont apply this patch, I get the following warning.
-----
sh4-linux-gnu-gcc -g -Os -ffixed-r13 -D__KERNEL__
-DCONFIG_SYS_TEXT_BASE=0x8FFC0000 -I/home/iwamatsu/work/u-boot/u-boot-sh/include -fno-builtin -ffreestanding -nostdinc -isystem /usr/lib/gcc/sh4-linux-gnu/4.4.6/include -pipe -DCONFIG_SH -D__SH__ -m4-nofpu -Wall -Wstrict-prototypes -fno-stack-protector
-Wno-format-nonliteral -Wno-format-security -o sh_eth.o sh_eth.c
-c
sh_eth.c: In function ?sh_eth_reset?:
sh_eth.c:140: warning: unused variable ?port?
sh_eth.c: In function ?sh_eth_bb_mdio_active?:
sh_eth.c:568: warning: unused variable ?port?
sh_eth.c: In function ?sh_eth_bb_mdio_tristate?:
sh_eth.c:578: warning: unused variable ?port?
sh_eth.c: In function ?sh_eth_bb_set_mdio?:
sh_eth.c:588: warning: unused variable ?port?
sh_eth.c: In function ?sh_eth_bb_get_mdio?:
sh_eth.c:601: warning: unused variable ?port?
sh_eth.c: In function ?sh_eth_bb_set_mdc?:
sh_eth.c:611: warning: unused variable ?port? sh4-linux-gnu-ld -e 0x8FFC0000 --defsym reloc_dst=0x8FFC0000 -r -o libnet.o sh_eth.o
-----

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu
#4 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

Quoted 13 lines · On Wednesday 15 February 2012 02:51:40 Nobuhiro Iwamatsu wrote:

2012/2/3 Mike Frysinger:

Quoted 12 lines · On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
Quoted 10 lines

static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v) {

drivers/net/sh_eth.c +3 -1
+     int port;
      struct sh_eth_dev *eth = bus->priv;
-     int port = eth->port;
+
+     port = eth->port;
 
      if (v)
              outl(inl(PIR(port)) | PIR_MDC, PIR(port));
Quoted 8 lines
Quoted 2 lines

i don't see why any of these changes are necessary ... the old code looks fine to me (from a warning and style pov)

I do not seem to have any problem with the former cord, too either. But when I dont apply this patch, I get the following warning.

sh_eth.c: In function ?sh_eth_bb_set_mdc?:
sh_eth.c:611: warning: unused variable ?port?

you've got a different problem then and modifying the sh_eth driver ignores it

what board are you building for exactly ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120215/d96245aa/attachment.pgp>

#5 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

Hi,

I built with ecovec board.

you can check command following :
make CROSS_COMPILE=sh-linux-gnu- ecovec_config
make CROSS_COMPILE=sh-linux-gnu-

Best regards,
Nobuhiro

2012/2/16 Mike Frysinger <[email protected]>:

Quoted 33 lines · On Wednesday 15 February 2012 02:51:40 Nobuhiro Iwamatsu wrote:
Quoted 13 lines

2012/2/3 Mike Frysinger:

Quoted 12 lines · On Friday 03 February 2012 02:30:48 Nobuhiro Iwamatsu wrote:
Quoted 10 lines

?static int sh_eth_bb_set_mdc(struct bb_miiphy_bus *bus, int v) ?{
+ ? ? int port;
? ? ? struct sh_eth_dev *eth = bus->priv;
- ? ? int port = eth->port;
+
+ ? ? port = eth->port;

? ? ? if (v)
? ? ? ? ? ? ? outl(inl(PIR(port)) | PIR_MDC, PIR(port));

Quoted 8 lines
Quoted 2 lines

i don't see why any of these changes are necessary ... the old code looks fine to me (from a warning and style pov)

I do not seem to have any problem with the former cord, too either. But when I dont apply this patch, I get the following warning.

sh_eth.c: In function ?sh_eth_bb_set_mdc?:
sh_eth.c:611: warning: unused variable ?port?

you've got a different problem then and modifying the sh_eth driver ignores it

what board are you building for exactly ?
-mike

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 1 line
Nobuhiro Iwamatsu
#6 lore raw

PATCH 1/1 net: sh_eth: Fix build warnings and whitespace for sh_eth

Quoted 5 lines · On Tuesday 21 February 2012 20:20:39 Nobuhiro Iwamatsu wrote:

I built with ecovec board.

you can check command following :
make CROSS_COMPILE=sh-linux-gnu- ecovec_config
make CROSS_COMPILE=sh-linux-gnu-

that board doesn't build for me:

$ make CROSS_COMPILE=sh4-gentoo-linux-gnu- ecovec -s -j4
Configuring for ecovec board...
Generating include/generated/asm-offsets.h
time.c: In function 'get_ticks':
time.c:111:16: warning: variable 'ticks' set but not used [-Wunused-but-set-
variable]
sh_i2c.c:55:13: warning: 'irq_wait' defined but not used [-Wunused-function]
sh_eth.c: In function 'sh_eth_send':
sh_eth.c:79:2: warning: implicit declaration of function 'EDTRR' [-Wimplicit-
function-declaration]
sh_eth.c: In function 'sh_eth_recv':
sh_eth.c:133:2: warning: implicit declaration of function 'EDRRR' [-Wimplicit-
function-declaration]
....

and indeed, when i look at sh_eth.h in mainline, there is logic for CONFIG_CPU_SH7763 and CONFIG_CPU_SH7757, but not for CONFIG_CPU_SH7724. i guess you're using changes that aren't in mainline yet to make this board build.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120222/eda75b82/attachment.pgp>

#7 lore raw

PATCH 1/1 sh: r0p7734: Add support I2C and set MAC address

In reply to Nobuhiro Iwamatsu

r0p7734 board stores away MAC address in EEPROM. This sets an MAC address to reading, environment variable from an EEPROM by supporting I2C.

---
 board/renesas/r0p7734/r0p7734.c |   19 ++++++++++++++++++-
 include/configs/r0p7734.h       |   16 ++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletions(-)
board/renesas/r0p7734/r0p7734.c +18 -1
index 80f4329..656b9ee 100644
@@ -24,6 +24,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <i2c.h>
 #include <netdev.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -50,11 +51,28 @@ int checkboard(void)
 
 int board_init(void)
 {
+	u8 mac[6];
+	char env_mac[17];
+	int i;
+
 #if defined(CONFIG_SH_ETHER)
 	u32 r = readl(MSTPSR1);
 	if (r & MSTPSR1_GETHER)
 		writel((r & ~MSTPSR1_GETHER), MSTPCR1);
 #endif
+
+	/* Read MAC address */
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_set_bus_num(CONFIG_SYS_I2C_MODULE); /* Use I2C 0 */
+
+	i2c_read(0x50, 0x10, 0, mac, 6);
+
+	/* Set MAC address */
+	printf("%02X:%02X:%02X:%02X:%02X:%02X\n",
+		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+	sprintf(env_mac, "%02X:%02X:%02X:%02X:%02X:%02X",
+		mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+
 	return 0;
 }
 
@@ -75,4 +93,3 @@ int board_eth_init(bd_t *bis)
 	return rc;
 }
 #endif
-
include/configs/r0p7734.h +16 -0
index d73cc4d..22c1ef7 100644
@@ -34,6 +34,7 @@
 #define CONFIG_400MHZ_MODE	1
 /* #define CONFIG_533MHZ_MODE	1 */
 
+#define BOARD_LATE_INIT		1
 #define CONFIG_SYS_TEXT_BASE 0x8FFC0000
 
 #define CONFIG_CMD_FLASH
@@ -53,6 +54,21 @@
 #define CONFIG_VERSION_VARIABLE
 #undef  CONFIG_SHOW_BOOT_PROGRESS
 
+/* I2C */
+#define CONFIG_CMD_I2C
+#define CONFIG_SH_SH7734_I2C 1
+#define CONFIG_HARD_I2C     1
+#define CONFIG_I2C_MULTI_BUS    1  
+#define CONFIG_SYS_MAX_I2C_BUS  2
+#define CONFIG_SYS_I2C_MODULE   0
+#define CONFIG_SYS_I2C_SPEED    100000 /* 100 kHz */
+#define CONFIG_SYS_I2C_SLAVE    0x50
+#define CONFIG_SH_I2C_DATA_HIGH 4
+#define CONFIG_SH_I2C_DATA_LOW  5
+#define CONFIG_SH_I2C_CLOCK     500000000
+#define CONFIG_SH_I2C_BASE0     0xFFC70000
+#define CONFIG_SH_I2C_BASE1     0xFFC71000
+
 /* Ether */
 #define CONFIG_SH_ETHER 1
 #define CONFIG_SH_ETHER_USE_PORT (0)
Signature · 1 line
1.7.7.3