All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthias Weisser <matthias.weisser@graf-syteco.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Add support for MB86R01 from Fujitsu
Date: Mon, 11 Jan 2010 18:18:47 +0100	[thread overview]
Message-ID: <1263230330-19728-2-git-send-email-matthias.weisser@graf-syteco.de> (raw)
In-Reply-To: <1263230330-19728-1-git-send-email-matthias.weisser@graf-syteco.de>

Signed-off-by: Matthias Weisser <matthias.weisser@graf-syteco.de>
---
 common/serial.c                      |    3 +-
 cpu/arm926ejs/jade/Makefile          |   47 +++++++++
 cpu/arm926ejs/jade/reset.c           |   37 ++++++++
 cpu/arm926ejs/jade/timer.c           |  127 +++++++++++++++++++++++++
 include/asm-arm/arch-jade/hardware.h |   31 ++++++
 include/asm-arm/arch-jade/jade.h     |  170 ++++++++++++++++++++++++++++++++++
 include/serial.h                     |    3 +-
 7 files changed, 416 insertions(+), 2 deletions(-)
 create mode 100644 cpu/arm926ejs/jade/Makefile
 create mode 100644 cpu/arm926ejs/jade/reset.c
 create mode 100644 cpu/arm926ejs/jade/timer.c
 create mode 100644 include/asm-arm/arch-jade/hardware.h
 create mode 100644 include/asm-arm/arch-jade/jade.h

diff --git a/common/serial.c b/common/serial.c
index 5f9ffd7..7397608 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,7 +41,8 @@ struct serial_device *__default_serial_console (void)
 #elif defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) \
    || defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) \
    || defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) \
-   || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+   || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) \
+   || defined(CONFIG_JADE)
 #if defined(CONFIG_CONS_INDEX) && defined(CONFIG_SYS_NS16550_SERIAL)
 #if (CONFIG_CONS_INDEX==1)
 	return &eserial1_device;
diff --git a/cpu/arm926ejs/jade/Makefile b/cpu/arm926ejs/jade/Makefile
new file mode 100644
index 0000000..360f046
--- /dev/null
+++ b/cpu/arm926ejs/jade/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS	= timer.o reset.o
+SOBJS	=
+
+SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS) $(SOBJS))
+START	:= $(addprefix $(obj),$(START))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/cpu/arm926ejs/jade/reset.c b/cpu/arm926ejs/jade/reset.c
new file mode 100644
index 0000000..820c3a1
--- /dev/null
+++ b/cpu/arm926ejs/jade/reset.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Matthias Weisser <matthias.weisser@graf-syteco.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/arch/hardware.h>
+
+/*
+ * Reset the cpu by setting software reset request bit
+ */
+void reset_cpu(ulong ignored)
+{
+	writel(0x00000002, JADE_CRG_PHYS_BASE + CRG_CRSR);
+	while (1)
+		/* NOP */;
+	/* Never reached */
+}
diff --git a/cpu/arm926ejs/jade/timer.c b/cpu/arm926ejs/jade/timer.c
new file mode 100644
index 0000000..bc20f37
--- /dev/null
+++ b/cpu/arm926ejs/jade/timer.c
@@ -0,0 +1,127 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop <stelian.pop@leadtechdesign.com>
+ * Lead Tech Design <www.leadtechdesign.com>
+ * Matthias Weisser <matthias.weisser@graf-syteco.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 <div64.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+
+#define TIMER_LOAD_VAL		0xffffffff
+#define TIMER_BASE		JADE_TIMER_PHYS_BASE
+
+#define TIMER_REG_LOAD		(TIMER_BASE + 0)
+#define TIMER_REG_VALUE		(TIMER_BASE + 4)
+#define TIMER_REG_CONTROL	(TIMER_BASE + 8)
+
+#define TIMER_FREQ		(CONFIG_JADE_IOCLK  / 16)
+
+static ulong timestamp;
+static ulong lastdec;
+
+static inline unsigned long long tick_to_time(unsigned long long tick)
+{
+	tick *= CONFIG_SYS_HZ;
+	do_div(tick, TIMER_FREQ);
+
+	return tick;
+}
+
+static inline unsigned long long usec_to_tick(unsigned long long usec)
+{
+	usec *= TIMER_FREQ;
+	do_div(usec, 1000000);
+
+	return usec;
+}
+
+/* nothing really to do with interrupts, just starts up a counter. */
+int timer_init(void)
+{
+	writel(TIMER_LOAD_VAL, TIMER_REG_LOAD);
+	writel(0x86, TIMER_REG_CONTROL);
+
+	reset_timer_masked();
+
+	return 0;
+}
+
+/*
+ * timer without interrupts
+ */
+unsigned long long get_ticks(void)
+{
+	ulong now = readl(TIMER_REG_VALUE);
+
+	if (now <= lastdec)	/* normal mode (non roll) */
+		/* move stamp forward with absolut diff ticks */
+		timestamp += (lastdec - now);
+	else			/* we have rollover of incrementer */
+		timestamp += lastdec + TIMER_LOAD_VAL - now;
+	lastdec = now;
+	return timestamp;
+}
+
+void reset_timer_masked(void)
+{
+	/* reset time */
+	lastdec = readl(TIMER_REG_VALUE);
+	timestamp = 0;
+}
+
+ulong get_timer_masked(void)
+{
+	return tick_to_time(get_ticks());
+}
+
+void __udelay(unsigned long usec)
+{
+	unsigned long long tmp;
+	ulong tmo;
+
+	tmo = usec_to_tick(usec);
+	tmp = get_ticks() + tmo;	/* get current timestamp */
+
+	while (get_ticks() < tmp)	/* loop till event */
+		/*NOP*/;
+}
+
+void reset_timer(void)
+{
+	reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+	return get_timer_masked() - base;
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+	return CONFIG_SYS_HZ;
+}
diff --git a/include/asm-arm/arch-jade/hardware.h b/include/asm-arm/arch-jade/hardware.h
new file mode 100644
index 0000000..a26bdca
--- /dev/null
+++ b/include/asm-arm/arch-jade/hardware.h
@@ -0,0 +1,31 @@
+/*
+ * (C) Copyright 2007
+ *
+ * Author : Carsten Schneider, mycable GmbH
+ *          <cs@mycable.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
+ */
+#ifndef __ASM_ARCH_HARDWARE_H
+#define __ASM_ARCH_HARDWARE_H
+
+#include <asm/sizes.h>
+#include <asm/arch/jade.h>
+
+#endif
diff --git a/include/asm-arm/arch-jade/jade.h b/include/asm-arm/arch-jade/jade.h
new file mode 100644
index 0000000..8640a62
--- /dev/null
+++ b/include/asm-arm/arch-jade/jade.h
@@ -0,0 +1,170 @@
+/*
+ * (C) Copyright 2007
+ *
+ * jade definitions
+ *
+ * Author : Carsten Schneider, mycable GmbH
+ *          <cs@mycable.de>
+ *
+ * (C) Copyright 2009
+ * Matthias Weisser <matthias.weisser@graf-syteco.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
+ */
+
+#ifndef JADE_H
+#define JADE_H
+
+#ifndef __ASSEMBLY__
+
+/* GPIO registers */
+struct jade_gpio{
+	uint32_t gpdr0;
+	uint32_t gpdr1;
+	uint32_t gpdr2;
+	uint32_t res;
+	uint32_t gpddr0;
+	uint32_t gpddr1;
+	uint32_t gpddr2;
+};
+
+/* PWM registers */
+struct jade_pwm{
+	uint32_t bcr;
+	uint32_t tpr;
+	uint32_t pr;
+	uint32_t dr;
+	uint32_t cr;
+	uint32_t sr;
+	uint32_t ccr;
+	uint32_t ir;
+};
+
+/* The jade chip control (CCNT) register set. */
+struct jade_ccnt{
+	uint32_t ccid;
+	uint32_t csrst;
+	uint32_t pad0[2];
+	uint32_t cist;
+	uint32_t cistm;
+	uint32_t cgpio_ist;
+	uint32_t cgpio_istm;
+	uint32_t cgpio_ip;
+	uint32_t cgpio_im;
+	uint32_t caxi_bw;
+	uint32_t caxi_ps;
+	uint32_t cmux_md;
+	uint32_t cex_pin_st;
+	uint32_t cmlb;
+	uint32_t pad1[1];
+	uint32_t cusb;
+	uint32_t pad2[41];
+	uint32_t cbsc;
+	uint32_t cdcrc;
+	uint32_t cmsr0;
+	uint32_t cmsr1;
+	uint32_t pad3[2];
+};
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Physical Address Defines
+ */
+#define JADE_DDR2C_PHYS_BASE		0xf3000000
+#define JADE_GDC_PHYS_BASE		0xf1fc0000
+#define JADE_GDC_DISP0_PHYS_BASE	0xf1fd0000
+#define JADE_GDC_DISP1_PHYS_BASE	0xf1fd2000
+#define JADE_CCNT_PHYS_BASE		0xfff42000
+#define JADE_CAN0_PHYS_BASE		0xfff54000
+#define JADE_CAN1_PHYS_BASE		0xfff55000
+#define JADE_I2C0_PHYS_BASE		0xfff56000
+#define JADE_I2C1_PHYS_BASE		0xfff57000
+#define JADE_EHCI_PHYS_BASE		0xfff80000
+#define JADE_OHCI_PHYS_BASE		0xfff81000
+#define JADE_IRC1_PHYS_BASE		0xfffb0000
+#define JADE_MEMC_PHYS_BASE		0xfffc0000
+#define JADE_TIMER_PHYS_BASE		0xfffe0000
+#define JADE_UART0_PHYS_BASE		0xfffe1000
+#define JADE_UART1_PHYS_BASE		0xfffe2000
+#define JADE_IRCE_PHYS_BASE		0xfffe4000
+#define JADE_CRG_PHYS_BASE		0xfffe7000
+#define JADE_IRC0_PHYS_BASE		0xfffe8000
+#define JADE_GPIO_PHYS_BASE		0xfffe9000
+#define JADE_PWM0_PHYS_BASE		0xfff41000
+#define JADE_PWM1_PHYS_BASE		0xfff41100
+
+/*
+ * Offset definitions for DRAM controller
+ */
+#define DDR2C_DRIC		0x00
+#define DDR2C_DRIC1		0x02
+#define DDR2C_DRIC2		0x04
+#define DDR2C_DRCA		0x06
+#define DDR2C_DRCM		0x08
+#define DDR2C_DRCST1		0x0a
+#define DDR2C_DRCST2		0x0c
+#define DDR2C_DRCR		0x0e
+#define DDR2C_DRCF		0x20
+#define DDR2C_DRASR		0x30
+#define DDR2C_DRIMS		0x50
+#define DDR2C_DROS		0x60
+#define DDR2C_DRIBSLI		0x62
+#define DDR2C_DRIBSODT1		0x64
+#define DDR2C_DRIBSOCD		0x66
+#define DDR2C_DRIBSOCD2		0x68
+#define DDR2C_DROABA		0x70
+#define DDR2C_DROBV		0x80
+#define DDR2C_DROBS		0x84
+#define DDR2C_DROBSR1		0x86
+#define DDR2C_DROBSR2		0x88
+#define DDR2C_DROBSR3		0x8a
+#define DDR2C_DROBSR4		0x8c
+#define DDR2C_DRIMR1		0x90
+#define DDR2C_DRIMR2		0x92
+#define DDR2C_DRIMR3		0x94
+#define DDR2C_DRIMR4		0x96
+#define DDR2C_DROISR1		0x98
+#define DDR2C_DROISR2		0x9a
+
+/*
+ * Offset definitions Chip Control Module
+ */
+#define CCNT_CCID		0x00
+#define CCNT_CSRST		0x1c
+#define CCNT_CIST		0x20
+#define CCNT_CISTM		0x24
+#define CCNT_CMUX_MD		0x30
+#define CCNT_CDCRC		0xec
+
+/*
+ * Offset definitions clock reset generator
+ */
+#define CRG_CRPR		0x00
+#define CRG_CRWR		0x08
+#define CRG_CRSR		0x0c
+#define CRG_CRDA		0x10
+#define CRG_CRDB		0x14
+#define CRG_CRHA		0x18
+#define CRG_CRPA		0x1c
+#define CRG_CRPB		0x20
+#define CRG_CRHB		0x24
+#define CRG_CRAM		0x28
+
+#endif /* jade_H */
diff --git a/include/serial.h b/include/serial.h
index f2638ec..a560c71 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -25,7 +25,8 @@ extern struct serial_device * default_serial_console (void);
 #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || defined(CONFIG_440) || \
     defined(CONFIG_405EP) || defined(CONFIG_405EZ) || defined(CONFIG_405EX) || \
     defined(CONFIG_MPC5xxx) || defined(CONFIG_MPC83xx) || \
-    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+    defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx) || \
+    defined(CONFIG_JADE)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
 #if defined(CONFIG_SYS_NS16550_SERIAL)
-- 
1.5.6.3

  reply	other threads:[~2010-01-11 17:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 17:18 [U-Boot] Adding support for MB86R01 Matthias Weisser
2010-01-11 17:18 ` Matthias Weisser [this message]
2010-01-11 17:18   ` [U-Boot] [PATCH] Add support for Jade display controller Matthias Weisser
2010-01-11 17:18     ` [U-Boot] [PATCH] Adding new vendor logo Matthias Weisser
2010-01-11 17:18       ` [U-Boot] [PATCH] Add support for jadecpu board Matthias Weisser
2010-01-16 19:18         ` Tom
2010-01-16 20:11           ` Wolfgang Denk
2010-01-18  7:05             ` [U-Boot] Antw: " Matthias Weisser
2010-01-18  7:57               ` Wolfgang Denk
2010-01-18  8:21                 ` Matthias Weißer
2010-01-18  8:55                   ` Wolfgang Denk
2010-01-18  7:54           ` [U-Boot] " Matthias Weißer
2010-01-18  8:52             ` Wolfgang Denk
2010-01-18 12:10               ` Matthias Weißer
2010-01-18 13:11                 ` Tom
2010-01-21 19:52                 ` Tom
2010-01-16 16:43       ` [U-Boot] [PATCH] Adding new vendor logo Tom
2010-01-18 13:55         ` Matthias Weißer
2010-01-16 16:30     ` [U-Boot] [PATCH] Add support for Jade display controller Tom
2010-01-18 14:06       ` Matthias Weißer
2010-01-16 15:39   ` [U-Boot] [PATCH] Add support for MB86R01 from Fujitsu Tom
2010-01-18 14:01     ` Matthias Weißer
2010-01-16 15:40 ` [U-Boot] Adding support for MB86R01 Tom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263230330-19728-2-git-send-email-matthias.weisser@graf-syteco.de \
    --to=matthias.weisser@graf-syteco.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.