
This patch adds support for MB86R0x SoCs from Fujitsu
Signed-off-by: Matthias Weisser weisserm@arcor.de --- arch/arm/cpu/arm926ejs/mb86r0x/Makefile | 47 +++++++ arch/arm/cpu/arm926ejs/mb86r0x/reset.c | 37 ++++++ arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 129 +++++++++++++++++++ arch/arm/include/asm/arch-mb86r0x/hardware.h | 31 +++++ arch/arm/include/asm/arch-mb86r0x/mb86r0x.h | 170 ++++++++++++++++++++++++++ 5 files changed, 414 insertions(+), 0 deletions(-) create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/Makefile create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/reset.c create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/timer.c create mode 100644 arch/arm/include/asm/arch-mb86r0x/hardware.h create mode 100644 arch/arm/include/asm/arch-mb86r0x/mb86r0x.h
diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/Makefile b/arch/arm/cpu/arm926ejs/mb86r0x/Makefile new file mode 100644 index 0000000..360f046 --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mb86r0x/Makefile @@ -0,0 +1,47 @@ +# +# (C) Copyright 2000-2006 +# Wolfgang Denk, DENX Software Engineering, wd@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/arch/arm/cpu/arm926ejs/mb86r0x/reset.c b/arch/arm/cpu/arm926ejs/mb86r0x/reset.c new file mode 100644 index 0000000..6acb5bb --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mb86r0x/reset.c @@ -0,0 +1,37 @@ +/* + * (C) Copyright 2010 + * Matthias Weisser weisserm@arcor.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, MB86R0x_CRG_PHYS_BASE + CRG_CRSR); + while (1) + /* NOP */; + /* Never reached */ +} diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c new file mode 100644 index 0000000..640b80e --- /dev/null +++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c @@ -0,0 +1,129 @@ +/* + * (C) Copyright 2007-2008 + * Stelian Pop stelian.pop@leadtechdesign.com + * Lead Tech Design <www.leadtechdesign.com> + * + * (C) Copyright 2010 + * Matthias Weisser weisserm@arcor.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 MB86R0x_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_MB86R0x_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/arch/arm/include/asm/arch-mb86r0x/hardware.h b/arch/arm/include/asm/arch-mb86r0x/hardware.h new file mode 100644 index 0000000..d1e57c0 --- /dev/null +++ b/arch/arm/include/asm/arch-mb86r0x/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/mb86r0x.h> + +#endif diff --git a/arch/arm/include/asm/arch-mb86r0x/mb86r0x.h b/arch/arm/include/asm/arch-mb86r0x/mb86r0x.h new file mode 100644 index 0000000..885960f --- /dev/null +++ b/arch/arm/include/asm/arch-mb86r0x/mb86r0x.h @@ -0,0 +1,170 @@ +/* + * (C) Copyright 2007 + * + * mb86r0x definitions + * + * Author : Carsten Schneider, mycable GmbH + * cs@mycable.de + * + * (C) Copyright 2010 + * Matthias Weisser weisserm@arcor.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 MB86R0X_H +#define MB86R0X_H + +#ifndef __ASSEMBLY__ + +/* GPIO registers */ +struct mb86r0x_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 mb86r0x_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 mb86r0x chip control (CCNT) register set. */ +struct mb86r0x_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 MB86R0x_DDR2C_PHYS_BASE 0xf3000000 +#define MB86R0x_GDC_PHYS_BASE 0xf1fc0000 +#define MB86R0x_GDC_DISP0_PHYS_BASE 0xf1fd0000 +#define MB86R0x_GDC_DISP1_PHYS_BASE 0xf1fd2000 +#define MB86R0x_CCNT_PHYS_BASE 0xfff42000 +#define MB86R0x_CAN0_PHYS_BASE 0xfff54000 +#define MB86R0x_CAN1_PHYS_BASE 0xfff55000 +#define MB86R0x_I2C0_PHYS_BASE 0xfff56000 +#define MB86R0x_I2C1_PHYS_BASE 0xfff57000 +#define MB86R0x_EHCI_PHYS_BASE 0xfff80000 +#define MB86R0x_OHCI_PHYS_BASE 0xfff81000 +#define MB86R0x_IRC1_PHYS_BASE 0xfffb0000 +#define MB86R0x_MEMC_PHYS_BASE 0xfffc0000 +#define MB86R0x_TIMER_PHYS_BASE 0xfffe0000 +#define MB86R0x_UART0_PHYS_BASE 0xfffe1000 +#define MB86R0x_UART1_PHYS_BASE 0xfffe2000 +#define MB86R0x_IRCE_PHYS_BASE 0xfffe4000 +#define MB86R0x_CRG_PHYS_BASE 0xfffe7000 +#define MB86R0x_IRC0_PHYS_BASE 0xfffe8000 +#define MB86R0x_GPIO_PHYS_BASE 0xfffe9000 +#define MB86R0x_PWM0_PHYS_BASE 0xfff41000 +#define MB86R0x_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 /* MB86R0X_H */