U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
March 2011
- 238 participants
- 485 discussions
Implementation of receive-transmit mode for
omap3 MCSPI.
Introduces full duplex communication, needed by
some spi devices (such as enc28j60).
Signed-off-by: jacopo mondi <mondi(a)cs.unibo.it> <j.mondi(a)voltaelectronics.com>
---
drivers/spi/omap3_spi.c | 66 ++++++++++++++++++++++++++++++++++++++++++++--
drivers/spi/omap3_spi.h | 2 +
2 files changed, 65 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index af12c0e..9346c0b 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -297,6 +297,65 @@ int omap3_spi_read(struct spi_slave *slave,
unsigned int len, u8 *rxp,
return 0;
}
+/*McSPI Transmit Receive Mode*/
+int omap3_spi_txrx(struct spi_slave *slave,
+ unsigned int len, const u8 *txp, u8 *rxp, unsigned long flags)
+{
+ struct omap3_spi_slave *ds = to_omap3_spi(slave);
+ int timeout = SPI_WAIT_TIMEOUT;
+ int chconf = readl(&ds->regs->channel[ds->slave.cs].chconf);
+ int irqstatus = readl(&ds->regs->irqstatus);
+ int i=0;
+
+ /*Enable SPI channel*/
+ if (flags & SPI_XFER_BEGIN)
+ writel(OMAP3_MCSPI_CHCTRL_EN,
+ &ds->regs->channel[ds->slave.cs].chctrl);
+
+ /*set TRANSMIT-RECEIVE Mode*/
+ chconf &= ~OMAP3_MCSPI_CHCONF_TRM_MASK;
+ chconf |= OMAP3_MCSPI_CHCONF_FORCE;
+ writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
+
+ /*Shift in and out 1 byte at time*/
+ for (i=0; i < len; i++){
+ /* Write: wait for TX empty (TXS == 1)*/
+ irqstatus |= (1<< (4*(ds->slave.bus)));
+ while (!(readl(&ds->regs->channel[ds->slave.cs].chstat) &
+ OMAP3_MCSPI_CHSTAT_TXS)) {
+ if (--timeout <= 0) {
+ printf("SPI TXS timed out, status=0x%08x\n",
+ readl(&ds->regs->channel[ds->slave.cs].chstat));
+ return -1;
+ }
+ }
+ /* Write the data */
+ writel(txp[i], &ds->regs->channel[ds->slave.cs].tx);
+
+ /*Read: wait for RX containing data (RXS == 1)*/
+ while (!(readl(&ds->regs->channel[ds->slave.cs].chstat) &
+ OMAP3_MCSPI_CHSTAT_RXS)) {
+ if (--timeout <= 0) {
+ printf("SPI RXS timed out, status=0x%08x\n",
+ readl(&ds->regs->channel[ds->slave.cs].chstat));
+ return -1;
+ }
+ }
+ /* Read the data */
+ rxp[i] = readl(&ds->regs->channel[ds->slave.cs].rx);
+ }
+
+ /*if transfer must be terminated disable the channel*/
+ if (flags & SPI_XFER_END) {
+ chconf &= ~OMAP3_MCSPI_CHCONF_FORCE;
+ writel(chconf, &ds->regs->channel[ds->slave.cs].chconf);
+
+ writel(0, &ds->regs->channel[ds->slave.cs].chctrl);
+ }
+
+ return 0;
+}
+
int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
const void *dout, void *din, unsigned long flags)
{
@@ -329,10 +388,11 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
}
ret = 0;
} else {
- if (dout != NULL)
+ if (dout != NULL && din != NULL)
+ ret = omap3_spi_txrx(slave, len, txp, rxp, flags);
+ else if (dout != NULL)
ret = omap3_spi_write(slave, len, txp, flags);
-
- if (din != NULL)
+ else if (din != NULL)
ret = omap3_spi_read(slave, len, rxp, flags);
}
return ret;
diff --git a/drivers/spi/omap3_spi.h b/drivers/spi/omap3_spi.h
index b8e3a4c..0ac801c 100644
--- a/drivers/spi/omap3_spi.h
+++ b/drivers/spi/omap3_spi.h
@@ -109,6 +109,8 @@ static inline struct omap3_spi_slave
*to_omap3_spi(struct spi_slave *slave)
return container_of(slave, struct omap3_spi_slave, slave);
}
+int omap3_spi_txrx(struct spi_slave *slave, unsigned int len, const u8 *txp,
+ u8 *rxp, unsigned long flags);
int omap3_spi_write(struct spi_slave *slave, unsigned int len, const u8 *txp,
unsigned long flags);
int omap3_spi_read(struct spi_slave *slave, unsigned int len, u8 *rxp,
--
1.7.4
1
0
Hi all,
I'm trying enabling enc2j60 in order to use tftp with SPI-Ethernet
enc28j60 and beagleboard rev C3.
When building u-boot some functions referred by enc28j60.c remain
undefined.
drivers/net/libnet.o: In function `enc28j60_initialize':
u-boot/drivers/net/enc28j60.c:973:
undefined reference to `eth_register' drivers/net/libnet.o: In function
`enc_receive': u-boot/drivers/net/enc28j60.c:489:
undefined reference to `NetReceive' drivers/net/libnet.o: In function
`enc_recv': u-boot/drivers/net/enc28j60.c:868:
undefined reference to `NetRxPackets'
Driver gets compiled and linked without warnings nor errors:
arm-angstrom-linux-gnueabi-gcc -g -Os -fno-common -ffixed-r8
-msoft-float -D__KERNEL__ -DCONFIG_SYS_TEXT_BASE=0x80008000
-Iu-boot/include -fno-builtin
-ffreestanding -nostdinc
-isystem cross/armv7a/lib/gcc/arm-angstrom-linux-gnueabi/4.3.1/include
-pipe -DCONFIG_ARM -D__ARM__ -marm -mabi=aapcs-linux
-mno-thumb-interwork -march=armv5 -Wall -Wstrict-prototypes
-fno-stack-protector -o enc28j60.o enc28j60.c -c
arm-angstrom-linux-gnueabi-ld -r -o libnet.o enc28j60.o
I'm using last u-boot, cloned from master branch yesterday.
Is my toolchain broken?
thank you
j
6
12
This part EDOSK2674 support
more infomation is
http://www.renesas.eu/products/tools/introductory_evaluation_tools/evaluati…
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
---
board/edosk2674/Makefile | 48 ++++++++++++++++++
board/edosk2674/config.mk | 25 +++++++++
board/edosk2674/edosk2674.c | 63 +++++++++++++++++++++++
board/edosk2674/lowlevel_init.S | 84 +++++++++++++++++++++++++++++++
board/edosk2674/u-boot.lds | 84 +++++++++++++++++++++++++++++++
boards.cfg | 1 +
drivers/net/lan91c96.h | 21 ++++++++
include/configs/edosk2674.h | 104 +++++++++++++++++++++++++++++++++++++++
8 files changed, 430 insertions(+), 0 deletions(-)
create mode 100644 board/edosk2674/Makefile
create mode 100644 board/edosk2674/config.mk
create mode 100644 board/edosk2674/edosk2674.c
create mode 100644 board/edosk2674/lowlevel_init.S
create mode 100644 board/edosk2674/u-boot.lds
create mode 100644 include/configs/edosk2674.h
diff --git a/board/edosk2674/Makefile b/board/edosk2674/Makefile
new file mode 100644
index 0000000..5f74665
--- /dev/null
+++ b/board/edosk2674/Makefile
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+#
+# u-boot/board/edosk2674/Makefile
+#
+# 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 = lib$(BOARD).o
+
+OBJS := edosk2674.o
+SOBJS := lowlevel_init.o
+
+LIB := $(addprefix $(obj),$(LIB))
+OBJS := $(addprefix $(obj),$(OBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+ rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/edosk2674/config.mk b/board/edosk2674/config.mk
new file mode 100644
index 0000000..966f893
--- /dev/null
+++ b/board/edosk2674/config.mk
@@ -0,0 +1,25 @@
+#
+# Copyright 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+#
+# 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
+
+#
+# TEXT_BASE refers to image _after_ relocation.
+#
+# NOTE: Must match value used in u-boot.lds (in this directory).
+#
+
+TEXT_BASE = 0xBC0000
diff --git a/board/edosk2674/edosk2674.c b/board/edosk2674/edosk2674.c
new file mode 100644
index 0000000..1e8ab00
--- /dev/null
+++ b/board/edosk2674/edosk2674.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2010 (C) Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * 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 <common.h>
+#include <net.h>
+#include <netdev.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+
+int checkboard(void)
+{
+ puts("BOARD: Renesas EDOSK2674R\n");
+ return 0;
+}
+
+int board_init(void)
+{
+ /* timer and SCI enable */
+ __raw_writeb(__raw_readb(0xffff41) & 0xf0, 0xffff41);
+ return 0;
+}
+
+int dram_init(void)
+{
+ DECLARE_GLOBAL_DATA_PTR;
+ gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+ gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+
+ printf("SDRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
+ return 0;
+}
+
+void led_set_state(unsigned short value)
+{
+}
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bis)
+{
+ int rc = 0;
+#ifdef CONFIG_LAN91C96
+ rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE);
+#endif
+ return rc;
+}
+#endif
+
diff --git a/board/edosk2674/lowlevel_init.S b/board/edosk2674/lowlevel_init.S
new file mode 100644
index 0000000..21c4a42
--- /dev/null
+++ b/board/edosk2674/lowlevel_init.S
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * 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 <config.h>
+
+ .h8300s
+ .global _lowlevel_init
+
+ .text
+ .align 2
+
+/*
+This function call to before relocate
+So not refer to absolute address
+*/
+_lowlevel_init:
+ bsr 1f
+1: mov.l @sp+,er4
+ mov.l #init_table,er5
+ sub.l #1b,er5
+ add.l er5,er4
+ mov.w #0xffff,e5
+2: mov.w @er4+,r5
+ beq 3f
+ mov.w @er4+,r0
+ mov.b r0l,@er5
+ bra 2b
+3:
+ sub.w r0,r0
+ mov.w r0,@0xfed2:16
+ mov.w #0x188,r0
+ mov.w r0,@0xfed4:16
+ mov.w #0x85b4,r0
+ mov.w r0,@0xfed0:16
+ mov.b #0,r1l
+ mov.b r1l,@0x400040
+ mov.w #0x84b4,r0
+ mov.w r0,@0xfed0:16
+ rts
+
+ .align 2
+init_table:
+ .word 0xfec1,0x00fb
+ .word 0xfec6,0x0000
+ .word 0xfec0,0x0080
+ .word 0xfec2,0x0027
+ .word 0xfec3,0x0077
+ .word 0xfec4,0x0071
+ .word 0xfec5,0x0022
+ .word 0xfec8,0x0080
+ .word 0xfec9,0x0080
+ .word 0xfeca,0x00a0
+ .word 0xfecb,0x00a0
+ .word 0xfe22,0x003a
+ .word 0xfe3c,0x0006
+ .word 0xfe29,0x00ff
+ .word 0xfe2e,0x00fe
+ .word 0xfe2f,0x000f
+ .word 0xff74,0x000f
+ .word 0xfe32,0x00ff
+ .word 0xfe34,0x000d
+ .word 0xfe31,0x0028
+ .word 0xfe16,0x00ff
+ .word 0xfe17,0x00ff
+ .word 0xfe1c,0x0055
+ .word 0xfe1d,0x0055
+ .word 0
+
+ .end
diff --git a/board/edosk2674/u-boot.lds b/board/edosk2674/u-boot.lds
new file mode 100644
index 0000000..7ed1ded
--- /dev/null
+++ b/board/edosk2674/u-boot.lds
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2000, 2001
+ * Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <config.h>
+
+OUTPUT_ARCH(h8300s)
+ENTRY(_start)
+
+SECTIONS
+{
+ . = CONFIG_SYS_TEXT_BASE - 0x200;
+ .vector :
+ {
+ *(.vector)
+ }
+
+ PROVIDE (__start = .);
+ PROVIDE (__ftext = .);
+
+ .text :
+ {
+ arch/h8300/cpu/h8300s/start.o (.text)
+ . = ALIGN(4);
+ *(.text)
+ . = ALIGN(4);
+ }
+ PROVIDE (__ecode = .);
+ .rodata :
+ {
+ *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+ . = ALIGN(4);
+ }
+ PROVIDE (__etext = .);
+
+ PROVIDE (___u_boot_cmd_start = .);
+ .u_boot_cmd :
+ {
+ *(.u_boot_cmd)
+ . = ALIGN(4);
+ }
+ PROVIDE (___u_boot_cmd_end = .);
+
+ .data :
+ {
+ PROVIDE (__ram_data = .);
+
+ *(.data)
+ . = ALIGN(4);
+ }
+ PROVIDE (__edata = .);
+
+ PROVIDE (_bss_start = .);
+ PROVIDE (___bss_start = .);
+ .bss :
+ {
+ *(.bss)
+ . = ALIGN(4);
+ }
+ PROVIDE (_bss_end = .);
+
+ PROVIDE (__end = .);
+ PROVIDE (__ram_vec = 0xffbe00);
+ PROVIDE (__init_stack = 0xffc000);
+}
diff --git a/boards.cfg b/boards.cfg
index 45c3102..f64c88e 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -202,6 +202,7 @@ ibf-dsp561 blackfin blackfin
ip04 blackfin blackfin
tcm-bf518 blackfin blackfin
tcm-bf537 blackfin blackfin
+edosk2674 h8300 h8300s edosk2674 - -
eNET i386 i386 eNET - sc520 eNET:SYS_TEXT_BASE=0x38040000
eNET_SRAM i386 i386 eNET - sc520 eNET:SYS_TEXT_BASE=0x19000000
idmr m68k mcf52x2
diff --git a/drivers/net/lan91c96.h b/drivers/net/lan91c96.h
index 6fbb0e3..ea2a7ef 100644
--- a/drivers/net/lan91c96.h
+++ b/drivers/net/lan91c96.h
@@ -146,6 +146,27 @@ typedef unsigned long int dword;
}; \
})
+#elif defined(CONFIG_EDOSK2674)
+/* 8bit bus */
+#define SMC_inb(edev, r) (*(volatile byte *)((edev)->iobase+(r)))
+#define SMC_outb(edev, d, r) (*(volatile byte *)((edev)->iobase+(r)) = d)
+#define SMC_inw(edev, r) (*(volatile byte *)((edev)->iobase+(r)) | *(volatile byte *)((edev)->iobase+(r)+1) << 8)
+#define SMC_outw(edev, d, r) ({ *(volatile byte *)((edev)->iobase+(r)) = (d) & 0xff; \
+ *(volatile byte *)((edev)->iobase+(r)+1) = (d) >> 8; })
+#define SMC_insw(edev, r, b, l) ({ int __i; \
+ char *__b = (char *)b; \
+ for (__i = 0; __i < l; __i++) { \
+ *__b++ = SMC_inb(edev, r); \
+ *__b++ = SMC_inb(edev, r+1); \
+ } \
+ })
+#define SMC_outsw(edev, r, b, l) ({ int __i; \
+ char *__b = (char *)b; \
+ for (__i = 0; __i < l; __i++) { \
+ SMC_outb(edev, *__b, r); __b++; \
+ SMC_outb(edev, *__b, r+1); __b++; \
+ } \
+ })
#else /* if not CONFIG_PXA250 */
/*
diff --git a/include/configs/edosk2674.h b/include/configs/edosk2674.h
new file mode 100644
index 0000000..786592e
--- /dev/null
+++ b/include/configs/edosk2674.h
@@ -0,0 +1,104 @@
+/*
+ * Configuation settings for the Renesas EDOSK2674R
+ *
+ * Copyright (C) 2010 Yoshinori Sato
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#ifndef __EDOSK2674_H
+#define __EDOSK2674_H
+
+#undef DEBUG
+#define CONFIG_H8300 1
+#define CONFIG_H8300S 1
+#define CONFIG_CPU_H8S2678 1
+#define CONFIG_EDOSK2674 1
+
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_NFS
+#undef CONFIG_CMD_CACHE
+#define CONFIG_CMD_DHCP
+
+#define CONFIG_BAUDRATE 38400
+#define CONFIG_BOOTARGS "console=ttySC0,115200"
+
+#define CONFIG_VERSION_VARIABLE
+#undef CONFIG_SHOW_BOOT_PROGRESS
+
+/* MEMORY */
+#define EDOSK2674_FLASH_BASE 0x000000
+#define EDOSK2674_SDRAM_BASE 0x400000
+
+#define CONFIG_SYS_MONITOR_BASE EDOSK2674_FLASH_BASE
+#define CONFIG_SYS_LONGHELP /* undef to save memory */
+#define CONFIG_SYS_PROMPT "=> " /* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE 256 /* Buffer size for input from the Console */
+#define CONFIG_SYS_PBSIZE 256 /* Buffer size for Console output */
+#define CONFIG_SYS_MAXARGS 16 /* max args accepted for monitor commands */
+
+/* Buffer size for Boot Arguments passed to kernel */
+#define CONFIG_SYS_BARGSIZE 512
+/* List of legal baudrate settings for this board */
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400 }
+
+/* SCI */
+#define CONFIG_SCI 1
+#define CONFIG_SCIF_CONSOLE 1
+#define CONFIG_CONS_SCIF2 1
+
+/* TIMER */
+#define CONFIG_TIMER_BASE 0xffffb0 /* CH0-1 */
+
+/* SDRAM */
+#define CONFIG_SYS_MEMTEST_START EDOSK2674_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (7 * 1024 * 1024))
+
+#define CONFIG_SYS_SDRAM_BASE EDOSK2674_SDRAM_BASE
+#define CONFIG_SYS_SDRAM_SIZE (8 * 1024 * 1024)
+
+#define CONFIG_SYS_LOAD_ADDR EDOSK2674_SDRAM_BASE
+#define CONFIG_SYS_TEXT_BASE 0xbc0000
+
+#define CONFIG_SYS_MALLOC_LEN (256 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE 256
+
+#define CONFIG_ENV_SIZE (128 * 1024)
+#define CONFIG_ENV_IS_IN_FLASH 1
+#define CONFIG_ENV_ADDR 0x3e0000
+
+/* Board Clock */
+#define CONFIG_SYS_CLK_FREQ 33333333
+#define CONFIG_SYS_HZ CONFIG_SYS_CLK_FREQ
+
+/* Ether */
+#define CONFIG_LAN91C96 1
+#define CONFIG_LAN91C96_BASE 0xf80000
+#define CONFIG_NET_MULTI 1
+
+/* Flash */
+#define CONFIG_SYS_MAX_FLASH_BANKS 1
+#define CONFIG_SYS_MAX_FLASH_SECT 32
+#define CONFIG_SYS_FLASH_BASE EDOSK2674_FLASH_BASE
+#define CONFIG_SYS_FLASH_CFI 1
+#define CONFIG_FLASH_CFI_DRIVER 1
+#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_16BIT
+
+#endif /* __EDOSK2674_H */
--
1.7.2.3
1
0
This part h8300 cpu support (3/3)
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
---
common/cmd_bdinfo.c | 20 ++++++++++++++++++++
common/cmd_bootm.c | 2 ++
examples/standalone/Makefile | 3 +--
examples/standalone/stubs.c | 20 ++++++++++++++++++--
include/image.h | 5 +++++
5 files changed, 46 insertions(+), 4 deletions(-)
diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c
index bba7374..4c8494d 100644
--- a/common/cmd_bdinfo.c
+++ b/common/cmd_bdinfo.c
@@ -410,6 +410,26 @@ int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
}
+#elif defined(CONFIG_H8300)
+
+int do_bdinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ bd_t *bd = gd->bd;
+ print_num ("mem start ", (ulong)bd->bi_memstart);
+ print_lnum ("mem size ", (u64)bd->bi_memsize);
+#if !defined(CONFIG_SYS_NO_FLASH)
+ print_num ("flash start ", (ulong)bd->bi_flashstart);
+ print_num ("flash size ", (ulong)bd->bi_flashsize);
+ print_num ("flash offset ", (ulong)bd->bi_flashoffset);
+#endif
+
+#if defined(CONFIG_CMD_NET)
+ print_eth(0);
+ printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
+#endif
+ printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
+ return 0;
+}
#else
#error "a case for this architecture does not exist!"
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 18019d6..08321e7 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -187,6 +187,8 @@ void arch_preboot_os(void) __attribute__((weak, alias("__arch_preboot_os")));
#define IH_INITRD_ARCH IH_ARCH_SH
#elif defined(__sparc__)
#define IH_INITRD_ARCH IH_ARCH_SPARC
+#elif defined(__H8300H__) || defined(__H8300S__)
+ #define IH_INITRD_ARCH IH_ARCH_H8300
#else
# error Unknown CPU type
#endif
diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile
index c1dfdce..e5eaf5b 100644
--- a/examples/standalone/Makefile
+++ b/examples/standalone/Makefile
@@ -68,8 +68,6 @@ ELF := $(addprefix $(obj),$(ELF))
BIN := $(addprefix $(obj),$(BIN))
SREC := $(addprefix $(obj),$(SREC))
-gcclibdir := $(shell dirname `$(CC) -print-libgcc-file-name`)
-
CPPFLAGS += -I..
# For PowerPC there's no need to compile standalone applications as a
@@ -86,6 +84,7 @@ endif
# application's entry point will be the first function in the application's
# source file.
CFLAGS += $(call cc-option,-fno-toplevel-reorder)
+gcclibdir := $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`)
all: $(obj).depend $(OBJS) $(LIB) $(SREC) $(BIN) $(ELF)
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 2d2e709..957326f 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -167,7 +167,20 @@ gd_t *global_data;
" jmp %%g1\n" \
" nop\n" \
: : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "g1" );
-
+#elif defined(CONFIG_H8300)
+/*
+ * er5 holds the pointer to the global_data. er0 is call clobbered.
+ */
+#define EXPORT_FUNC(x) \
+ asm volatile( \
+ " .globl\t_" #x "\n" \
+ "_" #x ":\n" \
+ " mov.l er5,er0\n" \
+ " add.l %0,er0\n" \
+ " add.l %1,er0\n" \
+ " mov.l @er0,er0\n" \
+ " jmp @er0\n" \
+ : : "i"(offsetof(gd_t, jt)), "i"(XF_ ## x * sizeof(void *)) : "er0" );
#else
#error stubs definition missing for this architecture
#endif
@@ -186,7 +199,10 @@ void __attribute__((unused)) dummy(void)
{
#include <_exports.h>
}
-
+#if defined(CONFIG_H8300)
+#define __bss_start _bss_start
+#define _end end
+#endif
extern unsigned long __bss_start, _end;
void app_startup(char * const *argv)
diff --git a/include/image.h b/include/image.h
index 005e0d2..8cee0fc 100644
--- a/include/image.h
+++ b/include/image.h
@@ -106,6 +106,7 @@
#define IH_ARCH_BLACKFIN 16 /* Blackfin */
#define IH_ARCH_AVR32 17 /* AVR32 */
#define IH_ARCH_ST200 18 /* STMicroelectronics ST200 */
+#define IH_ARCH_H8300 19 /* H8/300 */
/*
* Image Types
@@ -504,6 +505,8 @@ static inline int image_check_target_arch (const image_header_t *hdr)
if (!image_check_arch (hdr, IH_ARCH_SH))
#elif defined(__sparc__)
if (!image_check_arch (hdr, IH_ARCH_SPARC))
+#elif defined(__H8300H__) || defined(__H8300S__)
+ if (!image_check_arch (hdr, IH_ARCH_H8300))
#else
# error Unknown CPU type
#endif
@@ -656,6 +659,8 @@ static inline int fit_image_check_target_arch (const void *fdt, int node)
if (!fit_image_check_arch (fdt, node, IH_ARCH_SH))
#elif defined(__sparc__)
if (!fit_image_check_arch (fdt, node, IH_ARCH_SPARC))
+#elif defined(__H8300H__) || defined(__H8300S__)
+ if (!image_check_arch (hdr, IH_ARCH_H8300))
#else
# error Unknown CPU type
#endif
--
1.7.2.3
1
0
This part h8300 cpu support (2/3).
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
---
arch/h8300/include/asm/bitops.h | 186 ++++++++++++++++++++++++++++++++++
arch/h8300/include/asm/byteorder.h | 6 +
arch/h8300/include/asm/config.h | 26 +++++
arch/h8300/include/asm/global_data.h | 55 ++++++++++
arch/h8300/include/asm/io.h | 178 ++++++++++++++++++++++++++++++++
arch/h8300/include/asm/posix_types.h | 123 ++++++++++++++++++++++
arch/h8300/include/asm/processor.h | 4 +
arch/h8300/include/asm/ptrace.h | 64 ++++++++++++
arch/h8300/include/asm/string.h | 41 ++++++++
arch/h8300/include/asm/types.h | 62 +++++++++++
arch/h8300/include/asm/u-boot.h | 41 ++++++++
arch/h8300/include/asm/unaligned.h | 10 ++
12 files changed, 796 insertions(+), 0 deletions(-)
create mode 100644 arch/h8300/include/asm/bitops.h
create mode 100644 arch/h8300/include/asm/byteorder.h
create mode 100644 arch/h8300/include/asm/config.h
create mode 100644 arch/h8300/include/asm/global_data.h
create mode 100644 arch/h8300/include/asm/io.h
create mode 100644 arch/h8300/include/asm/posix_types.h
create mode 100644 arch/h8300/include/asm/processor.h
create mode 100644 arch/h8300/include/asm/ptrace.h
create mode 100644 arch/h8300/include/asm/string.h
create mode 100644 arch/h8300/include/asm/types.h
create mode 100644 arch/h8300/include/asm/u-boot.h
create mode 100644 arch/h8300/include/asm/unaligned.h
diff --git a/arch/h8300/include/asm/bitops.h b/arch/h8300/include/asm/bitops.h
new file mode 100644
index 0000000..c647ae1
--- /dev/null
+++ b/arch/h8300/include/asm/bitops.h
@@ -0,0 +1,186 @@
+#ifndef _H8300_BITOPS_H
+#define _H8300_BITOPS_H
+
+/*
+ * Copyright 1992, Linus Torvalds.
+ * Copyright 2002, Yoshinori Sato
+ */
+
+/*
+ * Function prototypes to keep gcc -Wall happy
+ */
+
+/*
+ * ffz = Find First Zero in word. Undefined if no zero exists,
+ * so code should check against ~0UL first..
+ */
+static __inline__ unsigned long ffz(unsigned long word)
+{
+ unsigned long result;
+
+ result = -1;
+ __asm__("1:\n\t"
+ "shlr.l %2\n\t"
+ "adds #1,%0\n\t"
+ "bcs 1b"
+ : "=r" (result)
+ : "0" (result),"r" (word));
+ return result;
+}
+
+#define H8300_GEN_BITOP_CONST(OP,BIT) \
+ case BIT: \
+ __asm__(OP " #" #BIT ",@%0"::"r"(b_addr):"memory"); \
+ break;
+
+#define H8300_GEN_BITOP(FNAME,OP) \
+static __inline__ void FNAME(int nr, volatile unsigned long* addr) \
+{ \
+ volatile unsigned char *b_addr; \
+ b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
+ if (__builtin_constant_p(nr)) { \
+ switch(nr & 7) { \
+ H8300_GEN_BITOP_CONST(OP,0) \
+ H8300_GEN_BITOP_CONST(OP,1) \
+ H8300_GEN_BITOP_CONST(OP,2) \
+ H8300_GEN_BITOP_CONST(OP,3) \
+ H8300_GEN_BITOP_CONST(OP,4) \
+ H8300_GEN_BITOP_CONST(OP,5) \
+ H8300_GEN_BITOP_CONST(OP,6) \
+ H8300_GEN_BITOP_CONST(OP,7) \
+ } \
+ } else { \
+ __asm__(OP " %w0,@%1"::"r"(nr),"r"(b_addr):"memory"); \
+ } \
+}
+
+/*
+ * clear_bit() doesn't provide any barrier for the compiler.
+ */
+#define smp_mb__before_clear_bit() barrier()
+#define smp_mb__after_clear_bit() barrier()
+
+H8300_GEN_BITOP(set_bit ,"bset")
+H8300_GEN_BITOP(clear_bit ,"bclr")
+H8300_GEN_BITOP(change_bit,"bnot")
+
+#undef H8300_GEN_BITOP
+#undef H8300_GEN_BITOP_CONST
+
+static __inline__ int test_bit(int nr, const unsigned long* addr)
+{
+ return (*((volatile unsigned char *)addr +
+ ((nr >> 3) ^ 3)) & (1UL << (nr & 7))) != 0;
+}
+
+#define __test_bit(nr, addr) test_bit(nr, addr)
+
+#define H8300_GEN_TEST_BITOP_CONST_INT(OP,BIT) \
+ case BIT: \
+ __asm__("stc ccr,%w1\n\t" \
+ "orc #0x80,ccr\n\t" \
+ "bld #" #BIT ",@%4\n\t" \
+ OP " #" #BIT ",@%4\n\t" \
+ "rotxl.l %0\n\t" \
+ "ldc %w1,ccr" \
+ : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
+ : "0" (retval),"r" (b_addr) \
+ : "memory"); \
+ break;
+
+#define H8300_GEN_TEST_BITOP_CONST(OP,BIT) \
+ case BIT: \
+ __asm__("bld #" #BIT ",@%3\n\t" \
+ OP " #" #BIT ",@%3\n\t" \
+ "rotxl.l %0\n\t" \
+ : "=r"(retval),"=m"(*b_addr) \
+ : "0" (retval),"r" (b_addr) \
+ : "memory"); \
+ break;
+
+#define H8300_GEN_TEST_BITOP(FNNAME,OP) \
+static __inline__ int FNNAME(int nr, volatile void * addr) \
+{ \
+ int retval = 0; \
+ char ccrsave; \
+ volatile unsigned char *b_addr; \
+ b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
+ if (__builtin_constant_p(nr)) { \
+ switch(nr & 7) { \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,0) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,1) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,2) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,3) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,4) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,5) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,6) \
+ H8300_GEN_TEST_BITOP_CONST_INT(OP,7) \
+ } \
+ } else { \
+ __asm__("stc ccr,%w1\n\t" \
+ "orc #0x80,ccr\n\t" \
+ "btst %w5,@%4\n\t" \
+ OP " %w5,@%4\n\t" \
+ "beq 1f\n\t" \
+ "inc.l #1,%0\n" \
+ "1:\n\t" \
+ "ldc %w1,ccr" \
+ : "=r"(retval),"=&r"(ccrsave),"=m"(*b_addr) \
+ : "0" (retval),"r" (b_addr),"r"(nr) \
+ : "memory"); \
+ } \
+ return retval; \
+} \
+ \
+static __inline__ int __ ## FNNAME(int nr, volatile void * addr) \
+{ \
+ int retval = 0; \
+ volatile unsigned char *b_addr; \
+ b_addr = (volatile unsigned char *)addr + ((nr >> 3) ^ 3); \
+ if (__builtin_constant_p(nr)) { \
+ switch(nr & 7) { \
+ H8300_GEN_TEST_BITOP_CONST(OP,0) \
+ H8300_GEN_TEST_BITOP_CONST(OP,1) \
+ H8300_GEN_TEST_BITOP_CONST(OP,2) \
+ H8300_GEN_TEST_BITOP_CONST(OP,3) \
+ H8300_GEN_TEST_BITOP_CONST(OP,4) \
+ H8300_GEN_TEST_BITOP_CONST(OP,5) \
+ H8300_GEN_TEST_BITOP_CONST(OP,6) \
+ H8300_GEN_TEST_BITOP_CONST(OP,7) \
+ } \
+ } else { \
+ __asm__("btst %w4,@%3\n\t" \
+ OP " %w4,@%3\n\t" \
+ "beq 1f\n\t" \
+ "inc.l #1,%0\n" \
+ "1:" \
+ : "=r"(retval),"=m"(*b_addr) \
+ : "0" (retval),"r" (b_addr),"r"(nr) \
+ : "memory"); \
+ } \
+ return retval; \
+}
+
+H8300_GEN_TEST_BITOP(test_and_set_bit, "bset")
+H8300_GEN_TEST_BITOP(test_and_clear_bit, "bclr")
+H8300_GEN_TEST_BITOP(test_and_change_bit,"bnot")
+#undef H8300_GEN_TEST_BITOP_CONST
+#undef H8300_GEN_TEST_BITOP_CONST_INT
+#undef H8300_GEN_TEST_BITOP
+
+static __inline__ unsigned long __ffs(unsigned long word)
+{
+ unsigned long result;
+
+ result = -1;
+ __asm__("1:\n\t"
+ "shlr.l %2\n\t"
+ "adds #1,%0\n\t"
+ "bcc 1b"
+ : "=r" (result)
+ : "0"(result),"r"(word));
+ return result;
+}
+
+
+#endif /* _H8300_BITOPS_H */
diff --git a/arch/h8300/include/asm/byteorder.h b/arch/h8300/include/asm/byteorder.h
new file mode 100644
index 0000000..13539da
--- /dev/null
+++ b/arch/h8300/include/asm/byteorder.h
@@ -0,0 +1,6 @@
+#ifndef _H8300_BYTEORDER_H
+#define _H8300_BYTEORDER_H
+
+#include <linux/byteorder/big_endian.h>
+
+#endif /* _H8300_BYTEORDER_H */
diff --git a/arch/h8300/include/asm/config.h b/arch/h8300/include/asm/config.h
new file mode 100644
index 0000000..1952de7
--- /dev/null
+++ b/arch/h8300/include/asm/config.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2009 Freescale Semiconductor, Inc.
+ *
+ * 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
+ *
+ */
+
+#ifndef _ASM_CONFIG_H_
+#define _ASM_CONFIG_H_
+
+#define CONFIG_RELOC_FIXUP_WORKS
+
+#endif
diff --git a/arch/h8300/include/asm/global_data.h b/arch/h8300/include/asm/global_data.h
new file mode 100644
index 0000000..b4a31c2
--- /dev/null
+++ b/arch/h8300/include/asm/global_data.h
@@ -0,0 +1,55 @@
+/*
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+ *
+ * (C) Copyright 2010
+ * Yoshinori Sato <ysato(a)Users.sourceforge.jp>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#ifndef __ASM_RX_GLOBALDATA_H_
+#define __ASM_RX_GLOBALDATA_H_
+
+typedef struct global_data
+{
+ bd_t *bd;
+ unsigned long flags;
+ unsigned long baudrate;
+ unsigned long cpu_clk; /* CPU clock in Hz! */
+ unsigned long have_console; /* serial_init() was called */
+ phys_size_t ram_size; /* RAM size */
+ unsigned long env_addr; /* Address of Environment struct */
+ unsigned long env_valid; /* Checksum of Environment valid */
+ void **jt; /* Standalone app jump table */
+ char env_buf[32]; /* buffer for getenv() before reloc. */
+}gd_t;
+
+#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
+#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
+#define GD_FLG_SILENT 0x00004 /* Silent mode */
+#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
+#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
+#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
+#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
+#define GD_FLG_ENV_READY 0x00080 /* Environment imported into hash table */
+
+#define DECLARE_GLOBAL_DATA_PTR extern gd_t *gd;
+
+#endif /* __ASM_RX_GLOBALDATA_H_ */
diff --git a/arch/h8300/include/asm/io.h b/arch/h8300/include/asm/io.h
new file mode 100644
index 0000000..94d1959
--- /dev/null
+++ b/arch/h8300/include/asm/io.h
@@ -0,0 +1,178 @@
+#ifndef __ASM_H8300_IO_H
+#define __ASM_H8300_IO_H
+
+#ifdef __KERNEL__
+
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+/*
+ * Generic virtual read/write. Note that we don't support half-word
+ * read/writes. We define __arch_*[bl] here, and leave __arch_*w
+ * to the architecture specific code.
+ */
+#define __arch_getb(a) (*(volatile unsigned char *)(a))
+#define __arch_getw(a) (*(volatile unsigned short *)(a))
+#define __arch_getl(a) (*(volatile unsigned int *)(a))
+
+#define __arch_putb(v, a) (*(volatile unsigned char *)(a) = (v))
+#define __arch_putw(v, a) (*(volatile unsigned short *)(a) = (v))
+#define __arch_putl(v, a) (*(volatile unsigned int *)(a) = (v))
+
+extern void __raw_writesb(unsigned int addr, const void *data, int bytelen);
+extern void __raw_writesw(unsigned int addr, const void *data, int wordlen);
+extern void __raw_writesl(unsigned int addr, const void *data, int longlen);
+
+extern void __raw_readsb(unsigned int addr, void *data, int bytelen);
+extern void __raw_readsw(unsigned int addr, void *data, int wordlen);
+extern void __raw_readsl(unsigned int addr, void *data, int longlen);
+
+#define __raw_writeb(v, a) __arch_putb(v, a)
+#define __raw_writew(v, a) __arch_putw(v, a)
+#define __raw_writel(v, a) __arch_putl(v, a)
+
+#define __raw_readb(a) __arch_getb(a)
+#define __raw_readw(a) __arch_getw(a)
+#define __raw_readl(a) __arch_getl(a)
+
+/*
+ * The compiler seems to be incapable of optimising constants
+ * properly. Spell it out to the compiler in some cases.
+ * These are only valid for small values of "off" (< 1<<12)
+ */
+#define __raw_base_writeb(val, base, off) __arch_base_putb(val, base, off)
+#define __raw_base_writew(val, base, off) __arch_base_putw(val, base, off)
+#define __raw_base_writel(val, base, off) __arch_base_putl(val, base, off)
+
+#define __raw_base_readb(base, off) __arch_base_getb(base, off)
+#define __raw_base_readw(base, off) __arch_base_getw(base, off)
+#define __raw_base_readl(base, off) __arch_base_getl(base, off)
+
+#define outb(v, p) __raw_writeb(v, p)
+#define outw(v, p) __raw_writew(cpu_to_le16(v), p)
+#define outl(v, p) __raw_writel(cpu_to_le32(v), p)
+
+#define inb(p) ({ unsigned int __v = __raw_readb(p); __v; })
+#define inw(p) ({ unsigned int __v = __le16_to_cpu(__raw_readw(p)); __v; })
+#define inl(p) ({ unsigned int __v = __le32_to_cpu(__raw_readl(p)); __v; })
+
+#define outsb(p, d, l) __raw_writesb(p, d, l)
+#define outsw(p, d, l) __raw_writesw(p, d, l)
+#define outsl(p, d, l) __raw_writesl(p, d, l)
+
+#define insb(p, d, l) __raw_readsb(p, d, l)
+#define insw(p, d, l) __raw_readsw(p, d, l)
+#define insl(p, d, l) __raw_readsl(p, d, l)
+
+#define readb(p) __raw_readb(p)
+#define readw(p) __raw_readw(p)
+#define writeb(v, p) __raw_writeb(v, p)
+#define writew(v, p) __raw_writew(v, p)
+
+#define outb_p(val, port) outb((val), (port))
+#define outw_p(val, port) outw((val), (port))
+#define outl_p(val, port) outl((val), (port))
+#define inb_p(port) inb((port))
+#define inw_p(port) inw((port))
+#define inl_p(port) inl((port))
+
+#define outsb_p(port, from, len) outsb(port, from, len)
+#define outsw_p(port, from, len) outsw(port, from, len)
+#define outsl_p(port, from, len) outsl(port, from, len)
+#define insb_p(port, to, len) insb(port, to, len)
+#define insw_p(port, to, len) insw(port, to, len)
+#define insl_p(port, to, len) insl(port, to, len)
+
+/* for U-Boot PCI */
+#define out_8(port, val) outb(val, port)
+#define out_le16(port, val) outw(val, port)
+#define out_le32(port, val) outl(val, port)
+#define in_8(port) inb(port)
+#define in_le16(port) inw(port)
+#define in_le32(port) inl(port)
+/*
+ * ioremap and friends.
+ *
+ * ioremap takes a PCI memory address, as specified in
+ * linux/Documentation/IO-mapping.txt. If you want a
+ * physical address, use __ioremap instead.
+ */
+extern void *__ioremap(unsigned long offset, size_t size, unsigned long flags);
+extern void __iounmap(void *addr);
+
+/*
+ * Generic ioremap support.
+ *
+ * Define:
+ * iomem_valid_addr(off,size)
+ * iomem_to_phys(off)
+ */
+#ifdef iomem_valid_addr
+#define __arch_ioremap(off, sz, nocache) \
+ ({ \
+ unsigned long _off = (off), _size = (sz); \
+ void *_ret = (void *)0; \
+ if (iomem_valid_addr(_off, _size)) \
+ _ret = __ioremap(iomem_to_phys(_off), _size, 0); \
+ _ret; \
+ })
+
+#define __arch_iounmap __iounmap
+#endif
+
+#define ioremap(off, sz) __arch_ioremap((off), (sz), 0)
+#define ioremap_nocache(off, sz) __arch_ioremap((off), (sz), 1)
+#define iounmap(_addr) __arch_iounmap(_addr)
+
+/*
+ * DMA-consistent mapping functions. These allocate/free a region of
+ * uncached, unwrite-buffered mapped memory space for use with DMA
+ * devices. This is the "generic" version. The PCI specific version
+ * is in pci.h
+ */
+extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
+extern void consistent_free(void *vaddr, size_t size, dma_addr_t handle);
+extern void consistent_sync(void *vaddr, size_t size, int rw);
+
+/*
+ * String version of IO memory access ops:
+ */
+extern void _memcpy_fromio(void *, unsigned long, size_t);
+extern void _memcpy_toio(unsigned long, const void *, size_t);
+extern void _memset_io(unsigned long, int, size_t);
+
+static inline void sync(void)
+{
+}
+
+/*
+ * Given a physical address and a length, return a virtual address
+ * that can be used to access the memory range with the caching
+ * properties specified by "flags".
+ */
+#define MAP_NOCACHE (0)
+#define MAP_WRCOMBINE (0)
+#define MAP_WRBACK (0)
+#define MAP_WRTHROUGH (0)
+
+static inline void *
+map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
+{
+ return (void *)paddr;
+}
+
+/*
+ * Take down a mapping set up by map_physmem().
+ */
+static inline void unmap_physmem(void *vaddr, unsigned long flags)
+{
+
+}
+
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+ return (phys_addr_t)(vaddr);
+}
+
+#endif /* __KERNEL__ */
+#endif /* __ASM_H8300_IO_H */
diff --git a/arch/h8300/include/asm/posix_types.h b/arch/h8300/include/asm/posix_types.h
new file mode 100644
index 0000000..3a3e434
--- /dev/null
+++ b/arch/h8300/include/asm/posix_types.h
@@ -0,0 +1,123 @@
+#ifndef __ASM_H8300_POSIX_TYPES_H
+#define __ASM_H8300_POSIX_TYPES_H
+
+/*
+ * This file is generally used by user-level software, so you need to
+ * be a little careful about namespace pollution etc. Also, we cannot
+ * assume GCC is being used.
+ */
+
+typedef unsigned short __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned short __kernel_mode_t;
+typedef unsigned short __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __kernel_gid_t;
+typedef unsigned int __kernel_size_t;
+typedef int __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_timer_t;
+typedef int __kernel_clockid_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+typedef unsigned short __kernel_old_dev_t;
+
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__KERNEL__) || defined(__USE_ALL)
+ int val[2];
+#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+ int __val[2];
+#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
+} __kernel_fsid_t;
+
+#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
+
+#undef __FD_SET
+static __inline__ void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
+}
+
+#undef __FD_CLR
+static __inline__ void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
+}
+
+
+#undef __FD_ISSET
+static __inline__ int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
+{
+ unsigned long __tmp = __fd / __NFDBITS;
+ unsigned long __rem = __fd % __NFDBITS;
+ return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
+}
+
+/*
+ * This will unroll the loop for the normal constant case (8 ints,
+ * for a 256-bit fd_set)
+ */
+#undef __FD_ZERO
+static __inline__ void __FD_ZERO(__kernel_fd_set *__p)
+{
+ unsigned long *__tmp = __p->fds_bits;
+ int __i;
+
+ if (__builtin_constant_p(__FDSET_LONGS)) {
+ switch (__FDSET_LONGS) {
+ case 16:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ __tmp[ 4] = 0; __tmp[ 5] = 0;
+ __tmp[ 6] = 0; __tmp[ 7] = 0;
+ __tmp[ 8] = 0; __tmp[ 9] = 0;
+ __tmp[10] = 0; __tmp[11] = 0;
+ __tmp[12] = 0; __tmp[13] = 0;
+ __tmp[14] = 0; __tmp[15] = 0;
+ return;
+
+ case 8:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ __tmp[ 4] = 0; __tmp[ 5] = 0;
+ __tmp[ 6] = 0; __tmp[ 7] = 0;
+ return;
+
+ case 4:
+ __tmp[ 0] = 0; __tmp[ 1] = 0;
+ __tmp[ 2] = 0; __tmp[ 3] = 0;
+ return;
+ }
+ }
+ __i = __FDSET_LONGS;
+ while (__i) {
+ __i--;
+ *__tmp = 0;
+ __tmp++;
+ }
+}
+
+#endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */
+
+#endif /* __ASM_H8300_POSIX_TYPES_H */
diff --git a/arch/h8300/include/asm/processor.h b/arch/h8300/include/asm/processor.h
new file mode 100644
index 0000000..e659370
--- /dev/null
+++ b/arch/h8300/include/asm/processor.h
@@ -0,0 +1,4 @@
+#ifndef __ASM_H8300_PROCESSOR_H
+#define __ASM_H8300_PROCESSOR_H
+
+#endif
diff --git a/arch/h8300/include/asm/ptrace.h b/arch/h8300/include/asm/ptrace.h
new file mode 100644
index 0000000..c2e05e4
--- /dev/null
+++ b/arch/h8300/include/asm/ptrace.h
@@ -0,0 +1,64 @@
+#ifndef _H8300_PTRACE_H
+#define _H8300_PTRACE_H
+
+#ifndef __ASSEMBLY__
+
+#define PT_ER1 0
+#define PT_ER2 1
+#define PT_ER3 2
+#define PT_ER4 3
+#define PT_ER5 4
+#define PT_ER6 5
+#define PT_ER0 6
+#define PT_ORIG_ER0 7
+#define PT_CCR 8
+#define PT_PC 9
+#define PT_USP 10
+#define PT_EXR 12
+
+/* this struct defines the way the registers are stored on the
+ stack during a system call. */
+
+struct pt_regs {
+ long retpc;
+ long er4;
+ long er5;
+ long er6;
+ long er3;
+ long er2;
+ long er1;
+ long orig_er0;
+ unsigned short ccr;
+ long er0;
+ long vector;
+#if defined(CONFIG_CPU_H8S)
+ unsigned short exr;
+#endif
+ unsigned long pc;
+} __attribute__((aligned(2),packed));
+
+#define PTRACE_GETREGS 12
+#define PTRACE_SETREGS 13
+
+#ifdef __KERNEL__
+#ifndef PS_S
+#define PS_S (0x10)
+#endif
+
+#if defined(__H8300H__)
+#define H8300_REGS_NO 11
+#endif
+#if defined(__H8300S__)
+#define H8300_REGS_NO 12
+#endif
+
+/* Find the stack offset for a register, relative to thread.esp0. */
+#define PT_REG(reg) ((long)&((struct pt_regs *)0)->reg)
+
+#define user_mode(regs) (!((regs)->ccr & PS_S))
+#define instruction_pointer(regs) ((regs)->pc)
+#define profile_pc(regs) instruction_pointer(regs)
+extern void show_regs(struct pt_regs *);
+#endif /* __KERNEL__ */
+#endif /* __ASSEMBLY__ */
+#endif /* _H8300_PTRACE_H */
diff --git a/arch/h8300/include/asm/string.h b/arch/h8300/include/asm/string.h
new file mode 100644
index 0000000..6db6fef
--- /dev/null
+++ b/arch/h8300/include/asm/string.h
@@ -0,0 +1,41 @@
+#ifndef __ASM_SH_STRING_H
+#define __ASM_SH_STRING_H
+
+/*
+ * Copyright (C) 1999 Niibe Yutaka
+ * But consider these trivial functions to be public domain.
+ *
+ * from linux kernel code.
+ */
+
+#ifdef __KERNEL__ /* only set these up for kernel code */
+
+#else /* KERNEL */
+
+/*
+ * let user libraries deal with these,
+ * IMHO the kernel has no place defining these functions for user apps
+ */
+
+#define __HAVE_ARCH_STRCPY 1
+#define __HAVE_ARCH_STRNCPY 1
+#define __HAVE_ARCH_STRCAT 1
+#define __HAVE_ARCH_STRNCAT 1
+#define __HAVE_ARCH_STRCMP 1
+#define __HAVE_ARCH_STRNCMP 1
+#define __HAVE_ARCH_STRNICMP 1
+#define __HAVE_ARCH_STRCHR 1
+#define __HAVE_ARCH_STRRCHR 1
+#define __HAVE_ARCH_STRSTR 1
+#define __HAVE_ARCH_STRLEN 1
+#define __HAVE_ARCH_STRNLEN 1
+#define __HAVE_ARCH_MEMSET 1
+#define __HAVE_ARCH_MEMCPY 1
+#define __HAVE_ARCH_MEMMOVE 1
+#define __HAVE_ARCH_MEMSCAN 1
+#define __HAVE_ARCH_MEMCMP 1
+#define __HAVE_ARCH_MEMCHR 1
+#define __HAVE_ARCH_STRTOK 1
+
+#endif /* KERNEL */
+#endif /* __ASM_SH_STRING_H */
diff --git a/arch/h8300/include/asm/types.h b/arch/h8300/include/asm/types.h
new file mode 100644
index 0000000..b298d84
--- /dev/null
+++ b/arch/h8300/include/asm/types.h
@@ -0,0 +1,62 @@
+#ifndef __ASM_H8300_TYPES_H
+#define __ASM_H8300_TYPES_H
+
+#ifndef __ASSEMBLY__
+
+typedef unsigned short umode_t;
+
+/*
+ * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
+ * header files exported to user space
+ */
+
+typedef __signed__ char __s8;
+typedef unsigned char __u8;
+
+typedef __signed__ short __s16;
+typedef unsigned short __u16;
+
+typedef __signed__ int __s32;
+typedef unsigned int __u32;
+
+#if defined(__GNUC__)
+__extension__ typedef __signed__ long long __s64;
+__extension__ typedef unsigned long long __u64;
+#endif
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * These aren't exported outside the kernel to avoid name space clashes
+ */
+#ifdef __KERNEL__
+
+#define BITS_PER_LONG 32
+
+#ifndef __ASSEMBLY__
+
+
+typedef __signed__ char s8;
+typedef unsigned char u8;
+
+typedef __signed__ short s16;
+typedef unsigned short u16;
+
+typedef __signed__ int s32;
+typedef unsigned int u32;
+
+typedef __signed__ long long s64;
+typedef unsigned long long u64;
+
+/* Dma addresses are 32-bits wide. */
+
+typedef u32 dma_addr_t;
+
+typedef unsigned long phys_addr_t;
+typedef unsigned long phys_size_t;
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* __KERNEL__ */
+
+#endif /* __ASM_H8300_TYPES_H */
diff --git a/arch/h8300/include/asm/u-boot.h b/arch/h8300/include/asm/u-boot.h
new file mode 100644
index 0000000..e0fbef3
--- /dev/null
+++ b/arch/h8300/include/asm/u-boot.h
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ ********************************************************************
+ * NOTE: This header file defines an interface to U-Boot. Including
+ * this (unmodified) header file in another file is considered normal
+ * use of U-Boot, and does *not* fall under the heading of "derived
+ * work".
+ ********************************************************************
+ */
+
+#ifndef __ASM_H8300_U_BOOT_H_
+#define __ASM_H8300_U_BOOT_H_
+
+typedef struct bd_info {
+ unsigned long bi_memstart; /* start of DRAM memory */
+ phys_size_t bi_memsize; /* size of DRAM memory in bytes */
+ unsigned long bi_flashstart; /* start of FLASH memory */
+ unsigned long bi_flashsize; /* size of FLASH memory */
+ unsigned long bi_flashoffset; /* reserved area for startup monitor */
+ unsigned long bi_sramstart; /* start of SRAM memory */
+ unsigned long bi_sramsize; /* size of SRAM memory */
+ unsigned long bi_ip_addr; /* IP Address */
+ unsigned long bi_baudrate; /* Console Baudrate */
+ unsigned long bi_boot_params; /* where this board expects params */
+} bd_t;
+
+#endif
diff --git a/arch/h8300/include/asm/unaligned.h b/arch/h8300/include/asm/unaligned.h
new file mode 100644
index 0000000..3864882
--- /dev/null
+++ b/arch/h8300/include/asm/unaligned.h
@@ -0,0 +1,10 @@
+#ifndef _ASM_H8300_UNALIGNED_H
+#define _ASM_H8300_UNALIGNED_H
+
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+
+#define get_unaligned __get_unaligned_be
+#define put_unaligned __put_unaligned_be
+
+#endif /* _ASM_H8300_UNALIGNED_H */
--
1.7.2.3
1
0
This part of h8300 cpu support
Signed-off-by: Yoshinori Sato <ysato(a)users.sourceforge.jp>
---
arch/h8300/config.mk | 35 ++++++++
arch/h8300/cpu/h8300s/Makefile | 53 ++++++++++++
arch/h8300/cpu/h8300s/config.mk | 26 ++++++
arch/h8300/cpu/h8300s/cpu.c | 83 +++++++++++++++++++
arch/h8300/cpu/h8300s/interrupts.c | 38 +++++++++
arch/h8300/cpu/h8300s/start.S | 87 ++++++++++++++++++++
arch/h8300/cpu/h8300s/watchdog.c | 36 ++++++++
arch/h8300/lib/Makefile | 43 ++++++++++
arch/h8300/lib/board.c | 158 ++++++++++++++++++++++++++++++++++++
arch/h8300/lib/bootm.c | 70 ++++++++++++++++
arch/h8300/lib/time.c | 87 ++++++++++++++++++++
11 files changed, 716 insertions(+), 0 deletions(-)
create mode 100644 arch/h8300/config.mk
create mode 100644 arch/h8300/cpu/h8300s/Makefile
create mode 100644 arch/h8300/cpu/h8300s/config.mk
create mode 100644 arch/h8300/cpu/h8300s/cpu.c
create mode 100644 arch/h8300/cpu/h8300s/interrupts.c
create mode 100644 arch/h8300/cpu/h8300s/start.S
create mode 100644 arch/h8300/cpu/h8300s/watchdog.c
create mode 100644 arch/h8300/lib/Makefile
create mode 100644 arch/h8300/lib/board.c
create mode 100644 arch/h8300/lib/bootm.c
create mode 100644 arch/h8300/lib/time.c
diff --git a/arch/h8300/config.mk b/arch/h8300/config.mk
new file mode 100644
index 0000000..11c6a01
--- /dev/null
+++ b/arch/h8300/config.mk
@@ -0,0 +1,35 @@
+#
+# (C) Copyright 2000-2002
+# Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+
+ifneq ($(CONFIG_H8300S),)
+PLATFORM_CPPFLAGS += -ms -mint32
+PLATFORM_LDFLAGS += -mh8300self
+STANDALONE_LOAD_ADDR = 0x00000000 -mh8300self
+endif
+ifneq ($(CONFIG_H8300H),)
+PLATFORM_CPPFLAGS += -mh -mint32
+PLATFORM_LDFLAGS += -mh8300helf
+STANDALONE_LOAD_ADDR = 0x00000000 -mh8300helf
+endif
+
+SYM_PREFIX = _
\ No newline at end of file
diff --git a/arch/h8300/cpu/h8300s/Makefile b/arch/h8300/cpu/h8300s/Makefile
new file mode 100644
index 0000000..4f2ee79
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/Makefile
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+#
+# Copyright (C) 2011 Yoshinori Sato
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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$(CPU).o
+
+SOBJS = start.o
+COBJS = cpu.o interrupts.o watchdog.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(OBJS) $(SOBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+ rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/h8300/cpu/h8300s/config.mk b/arch/h8300/cpu/h8300s/config.mk
new file mode 100644
index 0000000..eee3234
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/config.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+#
+PLATFORM_CPPFLAGS += -ms
+USE_PRIVATE_LIBGCC = $(shell dirname `$(CC) $(CFLAGS) -ms -mint32 -print-libgcc-file-name`)
+LDEMUL = -mh8300self
+LDFLAGS += $(LDEMUL)
diff --git a/arch/h8300/cpu/h8300s/cpu.c b/arch/h8300/cpu/h8300s/cpu.c
new file mode 100644
index 0000000..dfae6db
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/cpu.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <command.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+
+int checkcpu(void)
+{
+ puts("CPU: H8300S\n");
+ return 0;
+}
+
+int cpu_init(void)
+{
+ /* TMR and SCI enable */
+ outb(0xf0, 0xffff41);
+ return 0;
+}
+
+int cleanup_before_linux(void)
+{
+ disable_interrupts();
+ return 0;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ disable_interrupts();
+ reset_cpu(0);
+ return 0;
+}
+
+void flush_cache(unsigned long addr, unsigned long size)
+{
+
+}
+
+void icache_enable(void)
+{
+}
+
+void icache_disable(void)
+{
+}
+
+int icache_status(void)
+{
+ return 0;
+}
+
+void dcache_enable(void)
+{
+}
+
+void dcache_disable(void)
+{
+}
+
+int dcache_status(void)
+{
+ return 0;
+}
diff --git a/arch/h8300/cpu/h8300s/interrupts.c b/arch/h8300/cpu/h8300s/interrupts.c
new file mode 100644
index 0000000..7e3adb5
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/interrupts.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+
+int interrupt_init(void)
+{
+ return 0;
+}
+
+void enable_interrupts(void)
+{
+
+}
+
+int disable_interrupts(void)
+{
+ return 0;
+}
diff --git a/arch/h8300/cpu/h8300s/start.S b/arch/h8300/cpu/h8300s/start.S
new file mode 100644
index 0000000..620c147
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/start.S
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+
+ * 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 <config.h>
+#include <version.h>
+
+ .h8300s
+
+ .section .vector,"ax"
+ .long 0x200
+ .long 0x200
+vector = 2
+ .rept 126
+ .long __ram_vec + (vector * 4)
+vector = vector + 1
+ .endr
+
+ .global _start
+ .text
+ .align 2
+_start:
+ mov.l #__init_stack,sp
+ bsr 1f
+1:
+ mov.l @sp+,er0
+ mov.l #_lowlevel_init,er1
+ sub.l #1b,er1
+ add.l er1,er0
+ jsr @er0
+
+#if !defined(CONFIG_H8300_SIM)
+#if defined(CONFIG_SYS_NO_FLASH)
+ /* .data setup */
+ mov.l #__fdata,er5
+ mov.l #__ram_data,er6
+ mov.l #__sizeof_data,er4
+ eepmov.w
+#else
+ /* relocate */
+ bsr 1f
+1:
+ mov.l @sp+,er5
+ sub.l #1b-_start,er5
+ mov.l #CONFIG_SYS_TEXT_BASE,er6
+ mov.l #_bss_start,er4
+ sub.l er6,er4
+ shlr #2,er4
+1: mov.l @er5,er0
+ mov.l er0,@er6
+ adds #4,er5
+ adds #4,er6
+ dec.l #1,er4
+ bne 1b
+#endif
+ mov.l #_bss_start,er4
+ mov.l #_bss_end,er5
+ sub er4,er5
+ shlr.l #2,er5
+ mov #0,er0
+1: mov.l er0,@er4 /* bss clear */
+ adds #4,er4
+ dec.l #1,er5
+ bne 1b
+#endif
+ mov.l #CONFIG_SYS_LOAD_ADDR - CONFIG_SYS_GBL_DATA_SIZE - CONFIG_SYS_MALLOC_LEN,er0
+ mov.l er0,sp
+ jsr @_h8300_generic_init
+ bra .
+
+ .end
+
diff --git a/arch/h8300/cpu/h8300s/watchdog.c b/arch/h8300/cpu/h8300s/watchdog.c
new file mode 100644
index 0000000..77ce264
--- /dev/null
+++ b/arch/h8300/cpu/h8300s/watchdog.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * 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 <common.h>
+#include <asm/processor.h>
+#include <asm/io.h>
+
+int watchdog_init(void)
+{
+ return 0;
+}
+
+void reset_cpu(unsigned long ignored)
+{
+ __raw_writew(0x5a80, 0xffffbc);
+ __raw_writew(0x5a40, 0xffffbe);
+ __raw_writew(0xa578, 0xffffbc);
+ while (1)
+ ;
+}
diff --git a/arch/h8300/lib/Makefile b/arch/h8300/lib/Makefile
new file mode 100644
index 0000000..14f93e5
--- /dev/null
+++ b/arch/h8300/lib/Makefile
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+#
+# 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$(ARCH).o
+
+SOBJS-y +=
+
+COBJS-y += board.o
+COBJS-y += bootm.o
+COBJS-y += time.o
+
+SRCS := $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+
+$(LIB): $(obj).depend $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/h8300/lib/board.c b/arch/h8300/lib/board.c
new file mode 100644
index 0000000..54df901
--- /dev/null
+++ b/arch/h8300/lib/board.c
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * 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 <common.h>
+#include <command.h>
+#include <malloc.h>
+#include <stdio_dev.h>
+#include <timestamp.h>
+#include <version.h>
+#include <watchdog.h>
+#include <net.h>
+#include <environment.h>
+
+extern int cpu_init(void);
+extern int board_init(void);
+extern int dram_init(void);
+extern int timer_init(void);
+
+const char version_string[] = U_BOOT_VERSION" ("U_BOOT_DATE" - "U_BOOT_TIME")";
+
+#ifndef CONFIG_SYS_NO_FLASH
+extern int __bss_start;
+unsigned long monitor_flash_len = &__bss_start;
+#endif
+
+#if defined(CONFIG_WATCHDOG)
+extern int watchdog_init(void);
+extern int watchdog_disable(void);
+# define INIT_FUNC_WATCHDOG_INIT watchdog_init,
+# define WATCHDOG_DISABLE watchdog_disable
+#else
+# define INIT_FUNC_WATCHDOG_INIT
+# define WATCHDOG_DISABLE
+#endif /* CONFIG_WATCHDOG */
+
+#if defined(CONFIG_CMD_IDE)
+# include <ide.h>
+# define INIT_FUNC_IDE_INIT ide_init,
+#else
+# define INIT_FUNC_IDE_INIT
+#endif /* CONFIG_CMD_IDE */
+
+gd_t *gd;
+
+typedef int (init_fnc_t) (void);
+
+static init_fnc_t * const init_sequence[] =
+{
+ cpu_init, /* basic cpu dependent setup */
+ board_init, /* basic board dependent setup */
+ interrupt_init, /* set up exceptions */
+ env_init, /* event init */
+ serial_init, /* SCI init */
+ INIT_FUNC_WATCHDOG_INIT /* watchdog init */
+ console_init_f,
+ display_options,
+ checkcpu,
+ checkboard, /* Check support board */
+ dram_init,
+ timer_init,
+ interrupt_init,
+ NULL /* Terminate this list */
+};
+
+
+void h8300_generic_init(gd_t *_gd)
+{
+ bd_t *bd;
+ init_fnc_t * const *init_fnc_ptr;
+ gd = _gd;
+ memset(gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
+
+ gd->bd = (bd_t *)(gd + 1); /* At end of global data */
+ gd->flags = GD_FLG_RELOC;
+ gd->baudrate = CONFIG_BAUDRATE;
+
+ gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
+
+ bd = gd->bd;
+#if defined(CONFIG_SYS_SDRAM_BASE)
+ bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+ bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
+#else
+ bd->bi_memstart = CONFIG_SYS_DRAM_BASE;
+ bd->bi_memsize = CONFIG_SYS_DRAM_SIZE;
+#endif
+#if defined(CONFIG_SYS_SRAM_BASE) && defined(CONFIG_SYS_SRAM_SIZE)
+ bd->bi_sramstart = CONFIG_SYS_SRAM_BASE;
+ bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE;
+#endif
+ bd->bi_baudrate = CONFIG_BAUDRATE;
+
+ mem_malloc_init((unsigned long)gd + CONFIG_SYS_GBL_DATA_SIZE,
+ CONFIG_SYS_MALLOC_LEN);
+ for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
+ WATCHDOG_RESET();
+ if ((*init_fnc_ptr) () != 0)
+ hang();
+ }
+#if !defined(CONFIG_SYS_NO_FLASH)
+ bd->bi_flashsize = flash_init();
+#endif
+ env_relocate();
+ stdio_init();
+ console_init_r();
+
+#ifdef CONFIG_WATCHDOG
+ /* disable watchdog if environment is set */
+ {
+ char *s = getenv("watchdog");
+ if (s != NULL)
+ if (strncmp(s, "off", 3) == 0)
+ WATCHDOG_DISABLE();
+ }
+#endif /* CONFIG_WATCHDOG*/
+
+#if defined(CONFIG_CMD_NET)
+ {
+ char *s;
+ puts("Net: ");
+ eth_initialize(gd->bd);
+
+ s = getenv("bootfile");
+ if (s != NULL)
+ copy_filename(BootFile, s, sizeof(BootFile));
+ }
+#endif /* CONFIG_CMD_NET */
+
+ while (1) {
+ WATCHDOG_RESET();
+ main_loop();
+ }
+}
+
+/***********************************************************************/
+
+void hang(void)
+{
+ puts("Board ERROR\n");
+ for (;;)
+ ;
+}
diff --git a/arch/h8300/lib/bootm.c b/arch/h8300/lib/bootm.c
new file mode 100644
index 0000000..ae1f869
--- /dev/null
+++ b/arch/h8300/lib/bootm.c
@@ -0,0 +1,70 @@
+/*
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+ *
+ * (c) Copyright 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro(a)renesas.com>
+ * (c) Copyright 2008 Renesas Solutions Corp.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <command.h>
+#include <asm/byteorder.h>
+
+#ifdef CONFIG_SYS_DEBUG
+static void hexdump(unsigned char *buf, int len)
+{
+ int i;
+
+ for (i = 0; i < len; i++) {
+ if ((i % 16) == 0)
+ printf("%s%08x: ", i ? "\n" : "",
+ (unsigned int)&buf[i]);
+ printf("%02x ", buf[i]);
+ }
+ printf("\n");
+}
+#endif
+
+int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
+{
+ /* Linux kernel load address */
+ void (*kernel) (void) = (void (*)(void))images->ep;
+ /* empty_zero_page */
+ unsigned char *param
+ = (unsigned char *)image_get_load(images->legacy_hdr_os);
+ /* Linux kernel command line */
+ char *cmdline = (char *)param + 0x100;
+ /* PAGE_SIZE */
+ unsigned long size = images->ep - (unsigned long)param;
+ char *bootargs = getenv("bootargs");
+
+ if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
+ return 1;
+
+ /* Setup parameters */
+ memset(param, 0, size); /* Clear zero page */
+ strcpy(cmdline, bootargs);
+
+ kernel();
+ /* does not return */
+
+ return 1;
+}
diff --git a/arch/h8300/lib/time.c b/arch/h8300/lib/time.c
new file mode 100644
index 0000000..5f741a6
--- /dev/null
+++ b/arch/h8300/lib/time.c
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Yoshinori Sato <ysato(a)users.sourceforge.jp>
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <asm/io.h>
+#include <asm/processor.h>
+
+#define TCR0 (CONFIG_TIMER_BASE + 0)
+#define TCR1 (CONFIG_TIMER_BASE + 1)
+#define TCSR0 (CONFIG_TIMER_BASE + 2)
+#define TCSR1 (CONFIG_TIMER_BASE + 3)
+#define TCNT0 (CONFIG_TIMER_BASE + 8)
+#define TCNT1 (CONFIG_TIMER_BASE + 9)
+
+static unsigned long long tick;
+static unsigned short last;
+
+int timer_init(void)
+{
+ outb(0x04, TCR0); /* 16bit free running */
+ outb(0x01, TCR1); /* clk / 8 */
+ return 0;
+}
+
+unsigned long long get_ticks(void)
+{
+ unsigned short now = inw(TCNT0);
+ if (now < last)
+ tick += (0x10000 - last) + now;
+ else
+ tick += now - last;
+ last = now;
+ return tick;
+}
+
+ulong get_timer(ulong base)
+{
+ return get_ticks() / (CONFIG_SYS_CLK_FREQ / 1000) - base;
+}
+
+void set_timer(ulong t)
+{
+ outw((u16) t, TCNT0);
+}
+
+void reset_timer(void)
+{
+ last = 0;
+ outb(0x00, TCR1);
+ outw(0, TCNT0);
+ outb(0x01, TCR1);
+}
+
+void __udelay(unsigned long usec)
+{
+ unsigned long long end = get_ticks() +
+ (usec * (CONFIG_SYS_CLK_FREQ / 8000000));
+
+ while (get_ticks() < end);
+}
+
+unsigned long get_tbclk(void)
+{
+ return CONFIG_SYS_CLK_FREQ / 8;
+}
--
1.7.2.3
1
0

[U-Boot] [PATCH 2/3] arm: add _end to linker scripts for end of u-boot image
by Po-Yu Chuang 02 Mar '11
by Po-Yu Chuang 02 Mar '11
02 Mar '11
From: Po-Yu Chuang <ratbert(a)faraday-tech.com>
Signed-off-by: Po-Yu Chuang <ratbert(a)faraday-tech.com>
---
arch/arm/cpu/arm1136/u-boot.lds | 2 ++
arch/arm/cpu/arm1176/u-boot.lds | 2 ++
arch/arm/cpu/arm720t/u-boot.lds | 2 ++
arch/arm/cpu/arm920t/ep93xx/u-boot.lds | 2 ++
arch/arm/cpu/arm920t/u-boot.lds | 2 ++
arch/arm/cpu/arm925t/u-boot.lds | 2 ++
arch/arm/cpu/arm926ejs/u-boot.lds | 2 ++
arch/arm/cpu/arm946es/u-boot.lds | 2 ++
arch/arm/cpu/arm_intcm/u-boot.lds | 2 ++
arch/arm/cpu/armv7/u-boot.lds | 2 ++
arch/arm/cpu/ixp/u-boot.lds | 2 ++
arch/arm/cpu/lh7a40x/u-boot.lds | 2 ++
arch/arm/cpu/pxa/u-boot.lds | 2 ++
arch/arm/cpu/s3c44b0/u-boot.lds | 2 ++
arch/arm/cpu/sa1100/u-boot.lds | 2 ++
15 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/arch/arm/cpu/arm1136/u-boot.lds b/arch/arm/cpu/arm1136/u-boot.lds
index 1e0e90b..d1e2851 100644
--- a/arch/arm/cpu/arm1136/u-boot.lds
+++ b/arch/arm/cpu/arm1136/u-boot.lds
@@ -72,6 +72,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm1176/u-boot.lds b/arch/arm/cpu/arm1176/u-boot.lds
index 170e516..27d6638 100644
--- a/arch/arm/cpu/arm1176/u-boot.lds
+++ b/arch/arm/cpu/arm1176/u-boot.lds
@@ -61,6 +61,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm720t/u-boot.lds b/arch/arm/cpu/arm720t/u-boot.lds
index deda9fb..9370fad 100644
--- a/arch/arm/cpu/arm720t/u-boot.lds
+++ b/arch/arm/cpu/arm720t/u-boot.lds
@@ -62,6 +62,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
index 4cc82a5..dc6ba34 100644
--- a/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
+++ b/arch/arm/cpu/arm920t/ep93xx/u-boot.lds
@@ -56,4 +56,6 @@ SECTIONS
__bss_start = .;
.bss : { *(.bss) }
__bss_end__ = .;
+
+ _end = .;
}
diff --git a/arch/arm/cpu/arm920t/u-boot.lds b/arch/arm/cpu/arm920t/u-boot.lds
index d6dc21c..17ba604 100644
--- a/arch/arm/cpu/arm920t/u-boot.lds
+++ b/arch/arm/cpu/arm920t/u-boot.lds
@@ -71,6 +71,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm925t/u-boot.lds b/arch/arm/cpu/arm925t/u-boot.lds
index 4ad1f8e..64e76f5 100644
--- a/arch/arm/cpu/arm925t/u-boot.lds
+++ b/arch/arm/cpu/arm925t/u-boot.lds
@@ -66,6 +66,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm926ejs/u-boot.lds b/arch/arm/cpu/arm926ejs/u-boot.lds
index b7a5b9e..1480e0c 100644
--- a/arch/arm/cpu/arm926ejs/u-boot.lds
+++ b/arch/arm/cpu/arm926ejs/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm946es/u-boot.lds b/arch/arm/cpu/arm946es/u-boot.lds
index fe4a646..ff938e4 100644
--- a/arch/arm/cpu/arm946es/u-boot.lds
+++ b/arch/arm/cpu/arm946es/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/arm_intcm/u-boot.lds b/arch/arm/cpu/arm_intcm/u-boot.lds
index 899fab0..f4a146c 100644
--- a/arch/arm/cpu/arm_intcm/u-boot.lds
+++ b/arch/arm/cpu/arm_intcm/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/armv7/u-boot.lds b/arch/arm/cpu/armv7/u-boot.lds
index de80244..dbae54d 100644
--- a/arch/arm/cpu/armv7/u-boot.lds
+++ b/arch/arm/cpu/armv7/u-boot.lds
@@ -66,6 +66,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/ixp/u-boot.lds b/arch/arm/cpu/ixp/u-boot.lds
index 7029c6c..3587f8a 100644
--- a/arch/arm/cpu/ixp/u-boot.lds
+++ b/arch/arm/cpu/ixp/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/lh7a40x/u-boot.lds b/arch/arm/cpu/lh7a40x/u-boot.lds
index b15ab1e..30934ff 100644
--- a/arch/arm/cpu/lh7a40x/u-boot.lds
+++ b/arch/arm/cpu/lh7a40x/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/pxa/u-boot.lds b/arch/arm/cpu/pxa/u-boot.lds
index dfb9b77..e163369 100644
--- a/arch/arm/cpu/pxa/u-boot.lds
+++ b/arch/arm/cpu/pxa/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/s3c44b0/u-boot.lds b/arch/arm/cpu/s3c44b0/u-boot.lds
index 797edbc..74a259c 100644
--- a/arch/arm/cpu/s3c44b0/u-boot.lds
+++ b/arch/arm/cpu/s3c44b0/u-boot.lds
@@ -63,6 +63,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
diff --git a/arch/arm/cpu/sa1100/u-boot.lds b/arch/arm/cpu/sa1100/u-boot.lds
index 0ac1329..e6381da 100644
--- a/arch/arm/cpu/sa1100/u-boot.lds
+++ b/arch/arm/cpu/sa1100/u-boot.lds
@@ -66,6 +66,8 @@ SECTIONS
*(.dynsym)
}
+ _end = .;
+
.bss __rel_dyn_start (OVERLAY) : {
__bss_start = .;
*(.bss)
--
1.6.3.3
1
0
This is common pwm driver version2 of S5P.
Signed-off-by: Donghwa Lee <dh09.lee(a)samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park(a)samsung.com>
---
arch/arm/cpu/armv7/s5p-common/Makefile | 1 +
arch/arm/cpu/armv7/s5p-common/pwm.c | 218 +++++++++++++++++++++++++++++++
arch/arm/include/asm/arch-s5pc1xx/pwm.h | 14 ++
arch/arm/include/asm/arch-s5pc2xx/pwm.h | 14 ++
include/pwm.h | 32 +++++
5 files changed, 279 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/cpu/armv7/s5p-common/pwm.c
create mode 100644 include/pwm.h
diff --git a/arch/arm/cpu/armv7/s5p-common/Makefile b/arch/arm/cpu/armv7/s5p-common/Makefile
index 922cd95..da5623d 100644
--- a/arch/arm/cpu/armv7/s5p-common/Makefile
+++ b/arch/arm/cpu/armv7/s5p-common/Makefile
@@ -28,6 +28,7 @@ LIB = $(obj)libs5p-common.o
COBJS-y += cpu_info.o
COBJS-y += timer.o
+COBJS-$(CONFIG_PWM) += pwm.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y) $(SOBJS))
diff --git a/arch/arm/cpu/armv7/s5p-common/pwm.c b/arch/arm/cpu/armv7/s5p-common/pwm.c
new file mode 100644
index 0000000..2e0601a
--- /dev/null
+++ b/arch/arm/cpu/armv7/s5p-common/pwm.c
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Donghwa Lee <dh09.lee(a)samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <common.h>
+#include <errno.h>
+#include <pwm.h>
+#include <asm/io.h>
+#include <asm/arch/pwm.h>
+#include <asm/arch/clk.h>
+
+#define PRESCALER_0 (8 - 1) /* prescaler of timer 0, 1 */
+#define PRESCALER_1 (16 - 1) /* prescaler of timer 2, 3, 4 */
+#define MUX_DIV_1 0 /* 1/1 period */
+#define MUX_DIV_2 1 /* 1/2 period */
+#define MUX_DIV_4 2 /* 1/4 period */
+#define MUX_DIV_8 3 /* 1/8 period */
+#define MUX_DIV_16 4 /* 1/16 period */
+
+#define MUX_DIV_SHIFT(x) ((x) * 4)
+
+#define TCON0_TIMER_SHIFT 0
+#define TCON_TIMER_SHIFT(x) (8 + ((x - 1) * 4))
+
+int pwm_enable(int pwm_id)
+{
+ const struct s5p_timer *pwm = (struct s5p_timer *)samsung_get_base_timer();
+ unsigned long tcon;
+
+ tcon = readl(&pwm->tcon);
+
+ if (pwm_id == 0)
+ tcon |= TCON0_START;
+ else
+ tcon |= TCON_START(pwm_id);
+ writel(tcon, &pwm->tcon);
+
+ return 0;
+}
+
+void pwm_disable(int pwm_id)
+{
+ const struct s5p_timer *pwm = (struct s5p_timer *)samsung_get_base_timer();
+ unsigned long tcon;
+
+ tcon = readl(&pwm->tcon);
+ if (pwm_id == 0)
+ tcon &= ~TCON0_START;
+ else
+ tcon &= ~TCON_START(pwm_id);
+
+ writel(tcon, &pwm->tcon);
+
+}
+
+static unsigned long pwm_calc_tin(int pwm_id, unsigned long freq)
+{
+ unsigned long tin_parent_rate;
+ unsigned int div;
+
+ tin_parent_rate = get_pwm_clk();
+
+ for (div = 2; div <= 16; div *= 2) {
+ if ((tin_parent_rate / (div << 16)) < freq)
+ return tin_parent_rate / div;
+ }
+
+ return tin_parent_rate / 16;
+}
+
+#define NS_IN_HZ (1000000000UL)
+
+int pwm_config(int pwm_id, int duty_ns, int period_ns)
+{
+ const struct s5p_timer *pwm = (struct s5p_timer *)samsung_get_base_timer();
+ unsigned int offset;
+ unsigned long tin_rate;
+ unsigned long tin_ns;
+ unsigned long period;
+ unsigned long tcon;
+ unsigned long tcnt;
+ unsigned long timer_rate_hz;
+ unsigned long tcmp;
+
+ /*
+ * We currently avoid using 64bit arithmetic by using the
+ * fact that anything faster than 1GHz is easily representable
+ * by 32bits.
+ */
+ if (period_ns > NS_IN_HZ || duty_ns > NS_IN_HZ)
+ return -ERANGE;
+
+ if (duty_ns > period_ns)
+ return -EINVAL;
+
+ period = NS_IN_HZ / period_ns;
+
+ /* Check to see if we are changing the clock rate of the PWM */
+ tin_rate = pwm_calc_tin(pwm_id, period);
+ timer_rate_hz = tin_rate;
+
+ tin_ns = NS_IN_HZ / tin_rate;
+ tcnt = period_ns / tin_ns;
+
+ /* Note, counters count down */
+ tcmp = duty_ns / tin_ns;
+ tcmp = tcnt - tcmp;
+
+ /*
+ * the pwm hw only checks the compare register after a decrement,
+ * so the pin never toggles if tcmp = tcnt
+ */
+ if (tcmp == tcnt)
+ tcmp--;
+
+ if (tcmp < 0)
+ tcmp = 0;
+
+ /* Update the PWM register block. */
+ offset = pwm_id * 0xc;
+ if (pwm_id < 4)
+ writel(tcmp, &pwm->tcmpb0 + offset);
+
+ writel(tcnt, &pwm->tcntb0 + offset);
+
+ tcon = readl(&pwm->tcon);
+ if (pwm_id == 0) {
+ tcon |= TCON0_UPDATE;
+ tcon |= TCON0_AUTO_RELOAD;
+ } else {
+ tcon |= TCON_UPDATE(pwm_id);
+ tcon |= TCON_AUTO_RELOAD(pwm_id);
+ }
+
+ writel(tcon, &pwm->tcon);
+
+ if (pwm_id == 0)
+ tcon &= ~TCON0_UPDATE;
+ else
+ tcon &= ~TCON_UPDATE(pwm_id);
+
+ writel(tcon, &pwm->tcon);
+
+ return 0;
+}
+
+int pwm_init(int pwm_id, int div, int invert)
+{
+ u32 val;
+ const struct s5p_timer *pwm = (struct s5p_timer *)samsung_get_base_timer();
+ unsigned long timer_rate_hz;
+ unsigned int offset, prescaler;
+
+ /*
+ * Timer Freq(HZ) =
+ * PWM_CLK / { (prescaler_value + 1) * (divider_value) }
+ */
+
+ val = readl(&pwm->tcfg0);
+ if (pwm_id < 2) {
+ prescaler = PRESCALER_0;
+ val &= ~0xff;
+ val |= (prescaler & 0xff);
+ } else {
+ prescaler = PRESCALER_1;
+ val &= ~(0xff << 8);
+ val |= (prescaler & 0xff) << 8;
+ }
+ writel(val, &pwm->tcfg0);
+ val = readl(&pwm->tcfg1);
+ val &= ~(0xf << MUX_DIV_SHIFT(pwm_id));
+ val |= (div & 0xf) << MUX_DIV_SHIFT(pwm_id);
+ writel(val, &pwm->tcfg1);
+
+ timer_rate_hz = get_pwm_clk() / ((prescaler + 1) *
+ (div + 1));
+
+ timer_rate_hz = timer_rate_hz / 100;
+
+ /* set count value */
+ offset = pwm_id * 0xc;
+ writel(timer_rate_hz, &pwm->tcntb0 + offset);
+
+ if (pwm_id == 0) {
+ val = readl(&pwm->tcon) & ~(0xf << TCON0_TIMER_SHIFT);
+ if (invert)
+ val |= TCON0_INVERTER;
+ } else {
+ val = readl(&pwm->tcon) & ~(0xf << TCON_TIMER_SHIFT(pwm_id));
+ if (invert)
+ val |= TCON_INVERTER(pwm_id);
+ }
+
+ writel(val, &pwm->tcon);
+ pwm_enable(pwm_id);
+
+ return 0;
+}
diff --git a/arch/arm/include/asm/arch-s5pc1xx/pwm.h b/arch/arm/include/asm/arch-s5pc1xx/pwm.h
index 0369968..843d66d 100644
--- a/arch/arm/include/asm/arch-s5pc1xx/pwm.h
+++ b/arch/arm/include/asm/arch-s5pc1xx/pwm.h
@@ -29,6 +29,20 @@
/* start bit of PWM Timer 4 */
#define TCON4_START (1 << 20)
+/* Interval mode(Auto Reload) of PWM Timer 0 */
+#define TCON0_AUTO_RELOAD (1 << 3)
+/* Inverter On/Off */
+#define TCON0_INVERTER (1 << 2)
+/* Update TCNTB0 */
+#define TCON0_UPDATE (1 << 1)
+/* start bit of PWM Timer 0 */
+#define TCON0_START (1 << 0)
+
+#define TCON_AUTO_RELOAD(x) (1 << (((x + 1) * 4) + 3))
+#define TCON_INVERTER(x) (1 << (((x + 1) * 4) + 2))
+#define TCON_UPDATE(x) (1 << (((x + 1) * 4) + 1))
+#define TCON_START(x) (1 << (((x + 1) * 4)))
+
#ifndef __ASSEMBLY__
struct s5p_timer {
unsigned int tcfg0;
diff --git a/arch/arm/include/asm/arch-s5pc2xx/pwm.h b/arch/arm/include/asm/arch-s5pc2xx/pwm.h
index 0369968..843d66d 100644
--- a/arch/arm/include/asm/arch-s5pc2xx/pwm.h
+++ b/arch/arm/include/asm/arch-s5pc2xx/pwm.h
@@ -29,6 +29,20 @@
/* start bit of PWM Timer 4 */
#define TCON4_START (1 << 20)
+/* Interval mode(Auto Reload) of PWM Timer 0 */
+#define TCON0_AUTO_RELOAD (1 << 3)
+/* Inverter On/Off */
+#define TCON0_INVERTER (1 << 2)
+/* Update TCNTB0 */
+#define TCON0_UPDATE (1 << 1)
+/* start bit of PWM Timer 0 */
+#define TCON0_START (1 << 0)
+
+#define TCON_AUTO_RELOAD(x) (1 << (((x + 1) * 4) + 3))
+#define TCON_INVERTER(x) (1 << (((x + 1) * 4) + 2))
+#define TCON_UPDATE(x) (1 << (((x + 1) * 4) + 1))
+#define TCON_START(x) (1 << (((x + 1) * 4)))
+
#ifndef __ASSEMBLY__
struct s5p_timer {
unsigned int tcfg0;
diff --git a/include/pwm.h b/include/pwm.h
new file mode 100644
index 0000000..714a237
--- /dev/null
+++ b/include/pwm.h
@@ -0,0 +1,32 @@
+/*
+ * header file for pwm driver.
+ *
+ * copyright (c) 2011 samsung electronics
+ * donghwa lee <dh09.lee(a)samsung.com>
+ *
+ * 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
+ */
+
+#ifndef _pwm_h_
+#define _pwm_h_
+
+int pwm_init (int pwm_id, int div, int invert);
+int pwm_config (int pwm_id, int duty_ns, int period_ns);
+int pwm_enable (int pwm_id);
+void pwm_disable (int pwm_id);
+
+#endif /* _pwm_h_ */
+
--
1.6.0.4
2
1

[U-Boot] [PATCH][v3] fsl_esdhc: Correcting esdhc timeout counter calculation
by Priyanka Jain 02 Mar '11
by Priyanka Jain 02 Mar '11
02 Mar '11
- Timeout counter value is set as DTOCV bits in SYSCTL register
For counter value set as timeout,
Timeout period = (2^(timeout + 13)) SD Clock cycles
- As per 4.6.2.2 section of SD Card specification v2.00, host should
cofigure timeout period value to minimum 0.25 sec.
- Number of SD Clock cycles for 0.25sec should be minimum
(SD Clock/sec * 0.25 sec) SD Clock cycles
= (mmc->tran_speed * 1/4) SD Clock cycles
- Calculating timeout based on
(2^(timeout + 13)) >= mmc->tran_speed * 1/4
Taking log2 both the sides and rounding up to next power of 2
=> timeout + 13 = log2(mmc->tran_speed/4) + 1
Signed-off-by: Priyanka Jain <Priyanka.Jain(a)freescale.com>
Signed-off-by: Andy Fleming <afleming(a)freescale.com>
Signed-off-by: Kumar Gala <galak(a)kernel.crashing.org>
Acked-by: Mingkai Hu <Mingkai.Hu(a)freescale.com>
---
Changes for v3:
Including code changes of v1 as suggested by Stefano Babic
Changes for v2:
Added proper description as suggested by Wolfgang Denk
drivers/mmc/fsl_esdhc.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index a368fe6..359d939 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -207,7 +207,21 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
esdhc_write32(®s->blkattr, data->blocks << 16 | data->blocksize);
/* Calculate the timeout period for data transactions */
- timeout = fls(mmc->tran_speed/10) - 1;
+ /*
+ * 1)Timeout period = (2^(timeout+13)) SD Clock cycles
+ * 2)Timeout period should be minimum 0.250sec as per SD Card spec
+ * So, Number of SD Clock cycles for 0.25sec should be minimum
+ * (SD Clock/sec * 0.25 sec) SD Clock cycles
+ * = (mmc->tran_speed * 1/4) SD Clock cycles
+ * As 1) >= 2)
+ * => (2^(timeout+13)) >= mmc->tran_speed * 1/4
+ * Taking log2 both the sides
+ * => timeout + 13 >= log2(mmc->tran_speed/4)
+ * Rounding up to next power of 2
+ * => timeout + 13 = log2(mmc->tran_speed/4) + 1
+ * => timeout + 13 = fls(mmc->tran_speed/4)
+ */
+ timeout = fls(mmc->tran_speed/4);
timeout -= 13;
if (timeout > 14)
--
1.6.5.6
1
0
Hi all,
I am using relocation fixed a320evb (arm) u-boot.
I noticed something weird about the output of
command flinfo.
The size of u-boot.bin is 129156 (0x1F884), but the
protected range is only 0 ~ 0x1bfff.
I guess that it is because u-boot protects _start ~ __bss_start,
but there are some other things in u-boot.bin after __bss_start,
e.g. .rel.dyn section and .dynsym section
That is quite strange.
According to arch/arm/cpu/arm920t/u-boot.lds,
.rel.dyn and .dynsym sections should be placed before __bss_start.
However, objdump shows that they are not at where they should be.
Do I understand correctly?
Does anybody have similar situation?
BTW, the toolchain I am using is
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2010q1-202) 4.4.1.
0001be8c g O .u_boot_cmd 00000018 __u_boot_cmd_printenv
0001bea4 g O .u_boot_cmd 00000018 __u_boot_cmd_setenv
0001bebc g O .u_boot_cmd 00000018 __u_boot_cmd_run
0001bed4 g O .u_boot_cmd 00000018 __u_boot_cmd_source
0001beec g O .u_boot_cmd 00000018 __u_boot_cmd_version
0001bf04 g O .u_boot_cmd 00000018 __u_boot_cmd_imxtract
0001bf1c g *ABS* 00000000 __u_boot_cmd_end
0001bf1c g .bss 00000000 __bss_start
0001bf1c g O .bss 00000004 monitor_flash_len
0001bf1c g .rel.dyn 00000000 __rel_dyn_start
0001bf1c l d .bss 00000000 .bss
0001bf1c l d .rel.dyn 00000000 .rel.dyn
0001bf20 l O .bss 0000012c images
0001c04c l O .bss 00000004 os_data_state
0001c050 l O .bss 00000004 os_data_addr
0001c054 l O .bss 00000004 bin_start_address
0001c058 l O .bss 00000004 k_data_escape
0001c05c g O .bss 00000004 os_data_init
0001c060 l O .bss 00000004 k_data_escape_saved
0001c064 l O .bss 00000004 os_data_state_saved
[snip]
0001dcac l O .bss 00000004 NetRestarted
0001dcb0 g O .bss 00000004 NetRestartWrap
0001dcb4 l O .bss 00000004 NetDevExists
0001dcb8 g O .bss 00001e20 PktBuf
0001f73c g .dynsym 00000000 __dynsym_start
0001f73c g .rel.dyn 00000000 __rel_dyn_end
0001f73c l d .dynsym 00000000 .dynsym
0001fad8 g O .bss 00000010 NetRxPackets
0001fae8 g O .bss 00000620 NetArpWaitPacketBuf
00020108 l O .bss 00000004 env_changed_id.3244
U-Boot 2011.03-rc1-00134-ga898a11 (Feb 23 2011 - 16:53:13)
DRAM: 64 MiB
Flash: 32.5 MiB
In: serial
Out: serial
Err: serial
Net: FTMAC100
Hit any key to stop autoboot: 0
A320 # fli 1
Bank # 1: SST 39LF040 flash (8 x 8) Size: 512 kB in 128 Sectors
AMD Legacy command set, Manufacturer ID: 0xBF, Device ID: 0xD7
Erase timeout: 30000 ms, write timeout: 100 ms
Sector Start Addresses:
00000000 RO 00001000 RO 00002000 RO 00003000 RO 00004000 RO
00005000 RO 00006000 RO 00007000 RO 00008000 RO 00009000 RO
0000A000 RO 0000B000 RO 0000C000 RO 0000D000 RO 0000E000 RO
0000F000 RO 00010000 RO 00011000 RO 00012000 RO 00013000 RO
00014000 RO 00015000 RO 00016000 RO 00017000 RO 00018000 RO
00019000 RO 0001A000 RO 0001B000 RO 0001C000 0001D000
0001E000 0001F000 00020000 00021000 00022000
00023000 00024000 00025000 00026000 00027000
00028000 00029000 0002A000 0002B000 0002C000
0002D000 0002E000 0002F000 00030000 00031000
00032000 00033000 00034000 00035000 00036000
00037000 00038000 00039000 0003A000 0003B000
0003C000 0003D000 0003E000 0003F000 00040000
00041000 00042000 00043000 00044000 00045000
00046000 00047000 00048000 00049000 0004A000
0004B000 0004C000 0004D000 0004E000 0004F000
00050000 00051000 00052000 00053000 00054000
00055000 00056000 00057000 00058000 00059000
0005A000 0005B000 0005C000 0005D000 0005E000
0005F000 00060000 RO 00061000 RO 00062000 RO 00063000 RO
00064000 RO 00065000 RO 00066000 RO 00067000 RO 00068000 RO
00069000 RO 0006A000 RO 0006B000 RO 0006C000 RO 0006D000 RO
0006E000 RO 0006F000 RO 00070000 RO 00071000 RO 00072000 RO
00073000 RO 00074000 RO 00075000 RO 00076000 RO 00077000 RO
00078000 RO 00079000 RO 0007A000 RO 0007B000 RO 0007C000 RO
0007D000 RO 0007E000 RO 0007F000 RO
best regards,
Po-Yu Chuang
4
22