diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-06-02 12:37:01 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-06-02 16:28:04 +0200 |
commit | 89fd7e44dbe754366354cee37395f7fc11cce50e (patch) | |
tree | 4eb451caf7f2f789ae9e381b48b012d61c6407c5 /arch | |
parent | 064fdcec9f72fa6616dc4d3bcf340705f27e5fe1 (diff) | |
parent | 7286acab6715691c1262b320e9d22a480804ba49 (diff) | |
download | barebox-89fd7e44dbe754366354cee37395f7fc11cce50e.tar.gz barebox-89fd7e44dbe754366354cee37395f7fc11cce50e.tar.xz |
Merge branch 'for-next/marvell'
Conflicts:
arch/arm/Makefile
Diffstat (limited to 'arch')
44 files changed, 1173 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0a4f821814..cfb82b0515 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -79,6 +79,12 @@ config ARCH_IMX select WATCHDOG_IMX_RESET_SOURCE select HAS_DEBUG_LL +config ARCH_MVEBU + bool "Marvell EBU platforms" + select COMMON_CLK + select CLKDEV_LOOKUP + select HAS_DEBUG_LL + config ARCH_MXS bool "Freescale i.MX23/28 (mxs) based" select GENERIC_GPIO @@ -161,6 +167,7 @@ source arch/arm/mach-ep93xx/Kconfig source arch/arm/mach-highbank/Kconfig source arch/arm/mach-imx/Kconfig source arch/arm/mach-mxs/Kconfig +source arch/arm/mach-mvebu/Kconfig source arch/arm/mach-netx/Kconfig source arch/arm/mach-nomadik/Kconfig source arch/arm/mach-omap/Kconfig diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 761d4a0de2..32bdd65a21 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -58,6 +58,7 @@ machine-$(CONFIG_ARCH_EP93XX) := ep93xx machine-$(CONFIG_ARCH_HIGHBANK) := highbank machine-$(CONFIG_ARCH_IMX) := imx machine-$(CONFIG_ARCH_MXS) := mxs +machine-$(CONFIG_ARCH_MVEBU) := mvebu machine-$(CONFIG_ARCH_NOMADIK) := nomadik machine-$(CONFIG_ARCH_NETX) := netx machine-$(CONFIG_ARCH_OMAP) := omap @@ -70,6 +71,7 @@ machine-$(CONFIG_ARCH_ZYNQ) := zynq # Board directory name. This list is sorted alphanumerically # by CONFIG_* macro name. + board-$(CONFIG_MACH_A9M2410) += a9m2410 board-$(CONFIG_MACH_A9M2440) += a9m2440 board-$(CONFIG_MACH_ANIMEO_IP) += animeo_ip @@ -110,12 +112,15 @@ board-$(CONFIG_MACH_FREESCALE_MX51_PDK) += freescale-mx51-pdk board-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += freescale-mx53-loco board-$(CONFIG_MACH_FREESCALE_MX53_SMD) += freescale-mx53-smd board-$(CONFIG_MACH_GE863) += telit-evk-pro3 +board-$(CONFIG_MACH_GLOBALSCALE_GURUPLUG) += globalscale-guruplug +board-$(CONFIG_MACH_GLOBALSCALE_MIRABOX) += globalscale-mirabox board-$(CONFIG_MACH_GUF_CUPID) += guf-cupid board-$(CONFIG_MACH_GUF_VINCELL) += guf-vincell board-$(CONFIG_MACH_HIGHBANK) += highbank board-$(CONFIG_MACH_IMX21ADS) += imx21ads board-$(CONFIG_MACH_IMX233_OLINUXINO) += imx233-olinuxino board-$(CONFIG_MACH_IMX27ADS) += imx27ads +board-$(CONFIG_MACH_MARVELL_ARMADA_XP_GP) += marvell-armada-xp-gp board-$(CONFIG_MACH_MINI2440) += friendlyarm-mini2440 board-$(CONFIG_MACH_MINI6410) += friendlyarm-mini6410 board-$(CONFIG_MACH_MIOA701) += mioa701 @@ -138,6 +143,7 @@ board-$(CONFIG_MACH_PCM038) += pcm038 board-$(CONFIG_MACH_PCM043) += pcm043 board-$(CONFIG_MACH_PCM049) += pcm049 board-$(CONFIG_MACH_PCM051) += pcm051 +board-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += plathome-openblocks-ax3 board-$(CONFIG_MACH_PM9261) += pm9261 board-$(CONFIG_MACH_PM9263) += pm9263 board-$(CONFIG_MACH_PM9G45) += pm9g45 @@ -149,6 +155,7 @@ board-$(CONFIG_MACH_SABRELITE) += freescale-mx6-sabrelite board-$(CONFIG_MACH_SABRESD) += freescale-mx6-sabresd board-$(CONFIG_MACH_SAMA5D3XEK) += sama5d3xek board-$(CONFIG_MACH_SCB9328) += scb9328 +board-$(CONFIG_MACH_SOLIDRUN_CUBOX) += solidrun-cubox board-$(CONFIG_MACH_TINY210) += friendlyarm-tiny210 board-$(CONFIG_MACH_TINY6410) += friendlyarm-tiny6410 board-$(CONFIG_MACH_TNY_A9260) += tny-a926x @@ -265,6 +272,27 @@ ifeq ($(CONFIG_ARCH_IMX_INTERNAL_BOOT_USE_IMXIMAGE),y) KBUILD_IMAGE := barebox.imx endif +KWBIMAGE_OPTS = \ + -c -i $(srctree)/$(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE) + +quiet_cmd_kwbimage = KWB $@ + cmd_kwbimage = scripts/kwbimage -p $< $(KWBIMAGE_OPTS) -o $@ || \ + echo "WARNING: Couldn't create KWB image due to previous errors." + +quiet_cmd_kwbimage_uart = KWBUART $@ + cmd_kwbimage_uart = scripts/kwbimage -m uart -p $< $(KWBIMAGE_OPTS) -o $@ || \ + echo "WARNING Couldn't create KWB image due to previous errors." + +barebox.kwb: $(KBUILD_BINARY) FORCE + $(call if_changed,kwbimage) + +barebox.kwbuart: $(KBUILD_BINARY) FORCE + $(call if_changed,kwbimage_uart) + +ifeq ($(CONFIG_ARCH_MVEBU),y) +KBUILD_IMAGE := barebox.kwb barebox.kwbuart +endif + pbl := arch/arm/pbl $(pbl)/zbarebox.S $(pbl)/zbarebox.bin $(pbl)/zbarebox: barebox.bin FORCE $(Q)$(MAKE) $(build)=$(pbl) $@ diff --git a/arch/arm/boards/globalscale-guruplug/Makefile b/arch/arm/boards/globalscale-guruplug/Makefile new file mode 100644 index 0000000000..dcfc2937d3 --- /dev/null +++ b/arch/arm/boards/globalscale-guruplug/Makefile @@ -0,0 +1 @@ +obj-y += board.o diff --git a/arch/arm/boards/globalscale-guruplug/board.c b/arch/arm/boards/globalscale-guruplug/board.c new file mode 100644 index 0000000000..9c800c5410 --- /dev/null +++ b/arch/arm/boards/globalscale-guruplug/board.c @@ -0,0 +1,17 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +/* empty */ diff --git a/arch/arm/boards/globalscale-guruplug/config.h b/arch/arm/boards/globalscale-guruplug/config.h new file mode 100644 index 0000000000..ca15136817 --- /dev/null +++ b/arch/arm/boards/globalscale-guruplug/config.h @@ -0,0 +1,4 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/globalscale-guruplug/kwbimage.cfg b/arch/arm/boards/globalscale-guruplug/kwbimage.cfg new file mode 100644 index 0000000000..d0f3bdb01f --- /dev/null +++ b/arch/arm/boards/globalscale-guruplug/kwbimage.cfg @@ -0,0 +1,27 @@ +VERSION 0 +BOOT_FROM nand +NAND_ECCMODE default +NAND_PAGESZ 00000800 +DATA ffd100e0 1b1b9b9b +DATA ffd01400 43000c30 +DATA ffd01404 37543000 +DATA ffd01408 22125451 +DATA ffd0140c 00000a33 +DATA ffd01410 000000cc +DATA ffd01414 00000000 +DATA ffd01418 00000000 +DATA ffd0141c 00000c52 +DATA ffd01420 00000040 +DATA ffd01424 0000f17f +DATA ffd01428 00085520 +DATA ffd0147c 00008552 +DATA ffd01500 00000000 +DATA ffd01504 0ffffff1 +DATA ffd01508 10000000 +DATA ffd0150c 0ffffff5 +DATA ffd01514 00000000 +DATA ffd0151c 00000000 +DATA ffd01494 00030000 +DATA ffd01498 00000000 +DATA ffd0149c 0000e803 +DATA ffd01480 00000001 diff --git a/arch/arm/boards/globalscale-mirabox/Makefile b/arch/arm/boards/globalscale-mirabox/Makefile new file mode 100644 index 0000000000..9320510bab --- /dev/null +++ b/arch/arm/boards/globalscale-mirabox/Makefile @@ -0,0 +1 @@ +obj-y += board.c diff --git a/arch/arm/boards/globalscale-mirabox/board.c b/arch/arm/boards/globalscale-mirabox/board.c new file mode 100644 index 0000000000..9c800c5410 --- /dev/null +++ b/arch/arm/boards/globalscale-mirabox/board.c @@ -0,0 +1,17 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +/* empty */ diff --git a/arch/arm/boards/globalscale-mirabox/config.h b/arch/arm/boards/globalscale-mirabox/config.h new file mode 100644 index 0000000000..ca15136817 --- /dev/null +++ b/arch/arm/boards/globalscale-mirabox/config.h @@ -0,0 +1,4 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/globalscale-mirabox/kwbimage.cfg b/arch/arm/boards/globalscale-mirabox/kwbimage.cfg new file mode 100644 index 0000000000..72283d9b69 --- /dev/null +++ b/arch/arm/boards/globalscale-mirabox/kwbimage.cfg @@ -0,0 +1,5 @@ +VERSION 1 +BOOT_FROM nand +NAND_BLKSZ 00020000 +NAND_BADBLK_LOCATION 01 +BINARY globalscale-mirabox-binary.0 0000005b 00000068 diff --git a/arch/arm/boards/marvell-armada-xp-gp/Makefile b/arch/arm/boards/marvell-armada-xp-gp/Makefile new file mode 100644 index 0000000000..dcfc2937d3 --- /dev/null +++ b/arch/arm/boards/marvell-armada-xp-gp/Makefile @@ -0,0 +1 @@ +obj-y += board.o diff --git a/arch/arm/boards/marvell-armada-xp-gp/board.c b/arch/arm/boards/marvell-armada-xp-gp/board.c new file mode 100644 index 0000000000..9c800c5410 --- /dev/null +++ b/arch/arm/boards/marvell-armada-xp-gp/board.c @@ -0,0 +1,17 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +/* empty */ diff --git a/arch/arm/boards/marvell-armada-xp-gp/config.h b/arch/arm/boards/marvell-armada-xp-gp/config.h new file mode 100644 index 0000000000..ca15136817 --- /dev/null +++ b/arch/arm/boards/marvell-armada-xp-gp/config.h @@ -0,0 +1,4 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg b/arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg new file mode 100644 index 0000000000..db75969fe0 --- /dev/null +++ b/arch/arm/boards/marvell-armada-xp-gp/kwbimage.cfg @@ -0,0 +1,3 @@ +VERSION 1 +BOOT_FROM spi +BINARY marvell-armada-xp-gp-binary.0 0000005b 00000068 diff --git a/arch/arm/boards/plathome-openblocks-ax3/Makefile b/arch/arm/boards/plathome-openblocks-ax3/Makefile new file mode 100644 index 0000000000..dcfc2937d3 --- /dev/null +++ b/arch/arm/boards/plathome-openblocks-ax3/Makefile @@ -0,0 +1 @@ +obj-y += board.o diff --git a/arch/arm/boards/plathome-openblocks-ax3/board.c b/arch/arm/boards/plathome-openblocks-ax3/board.c new file mode 100644 index 0000000000..9c800c5410 --- /dev/null +++ b/arch/arm/boards/plathome-openblocks-ax3/board.c @@ -0,0 +1,17 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +/* empty */ diff --git a/arch/arm/boards/plathome-openblocks-ax3/config.h b/arch/arm/boards/plathome-openblocks-ax3/config.h new file mode 100644 index 0000000000..ca15136817 --- /dev/null +++ b/arch/arm/boards/plathome-openblocks-ax3/config.h @@ -0,0 +1,4 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg b/arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg new file mode 100644 index 0000000000..69fd1fd1c1 --- /dev/null +++ b/arch/arm/boards/plathome-openblocks-ax3/kwbimage.cfg @@ -0,0 +1,3 @@ +VERSION 1 +BOOT_FROM spi +BINARY plathome-openblocks-ax3-binary.0 0000005b 00000068 diff --git a/arch/arm/boards/solidrun-cubox/Makefile b/arch/arm/boards/solidrun-cubox/Makefile new file mode 100644 index 0000000000..9320510bab --- /dev/null +++ b/arch/arm/boards/solidrun-cubox/Makefile @@ -0,0 +1 @@ +obj-y += board.c diff --git a/arch/arm/boards/solidrun-cubox/board.c b/arch/arm/boards/solidrun-cubox/board.c new file mode 100644 index 0000000000..a28f4197df --- /dev/null +++ b/arch/arm/boards/solidrun-cubox/board.c @@ -0,0 +1,17 @@ +/* + * Copyright (C) 2013 + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +/* empty */ diff --git a/arch/arm/boards/solidrun-cubox/config.h b/arch/arm/boards/solidrun-cubox/config.h new file mode 100644 index 0000000000..ca15136817 --- /dev/null +++ b/arch/arm/boards/solidrun-cubox/config.h @@ -0,0 +1,4 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#endif /* __CONFIG_H */ diff --git a/arch/arm/boards/solidrun-cubox/kwbimage.cfg b/arch/arm/boards/solidrun-cubox/kwbimage.cfg new file mode 100644 index 0000000000..db35acacd4 --- /dev/null +++ b/arch/arm/boards/solidrun-cubox/kwbimage.cfg @@ -0,0 +1,37 @@ +VERSION 0 +BOOT_FROM spi +DATA d0020104 00000000 +DATA d0800020 00022430 +DATA d0800030 00022430 +DATA d0800050 911500c3 +DATA d0800060 646602c4 +DATA d0800190 c2003053 +DATA d08001c0 34f4a187 +DATA d0800650 000f0121 +DATA d0800660 04040200 +DATA d0800080 00000000 +DATA d0800090 00080000 +DATA d08000f0 c0000000 +DATA d08001a0 20c0c009 +DATA d0800280 010e0202 +DATA d0800760 00000000 +DATA d0800770 0000000a +DATA d0800140 20004044 +DATA d08001d0 133c2339 +DATA d08001e0 07700330 +DATA d08001f0 00000033 +DATA d0800200 0011311c +DATA d0800210 00300000 +DATA d0800240 80000000 +DATA d0800510 010e0101 +DATA d0800230 2028006a +DATA d0800e10 00280062 +DATA d0800e20 00280062 +DATA d0800e30 00280062 +DATA d0800100 000d0001 +DATA d0800110 200d0001 +DATA d0020104 00000000 +DATA d0020104 00000000 +DATA d0020104 00000000 +DATA d0020104 00000000 +DATA d0020104 00000000 diff --git a/arch/arm/configs/globalscale_guruplug_defconfig b/arch/arm/configs/globalscale_guruplug_defconfig new file mode 100644 index 0000000000..d21de45c5d --- /dev/null +++ b/arch/arm/configs/globalscale_guruplug_defconfig @@ -0,0 +1,6 @@ +CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_KIRKWOOD=y +CONFIG_TEXT_BASE=0x2000000 +CONFIG_DEBUG_LL=y +CONFIG_CMD_RESET=y +CONFIG_DRIVER_SERIAL_NS16550=y diff --git a/arch/arm/configs/globalscale_mirabox_defconfig b/arch/arm/configs/globalscale_mirabox_defconfig new file mode 100644 index 0000000000..ed9d94d867 --- /dev/null +++ b/arch/arm/configs/globalscale_mirabox_defconfig @@ -0,0 +1,8 @@ +CONFIG_ARCH_MVEBU=y +CONFIG_AEABI=y +CONFIG_DEBUG_LL=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_RESET=y +CONFIG_CMD_CLK=y +CONFIG_DRIVER_SERIAL_NS16550=y diff --git a/arch/arm/configs/marvell_armada_xp_gp_defconfig b/arch/arm/configs/marvell_armada_xp_gp_defconfig new file mode 100644 index 0000000000..5a7ef52b5f --- /dev/null +++ b/arch/arm/configs/marvell_armada_xp_gp_defconfig @@ -0,0 +1,10 @@ +CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_ARMADA_XP=y +CONFIG_MACH_MARVELL_ARMADA_XP_GP=y +CONFIG_AEABI=y +CONFIG_DEBUG_LL=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_RESET=y +CONFIG_CMD_CLK=y +CONFIG_DRIVER_SERIAL_NS16550=y diff --git a/arch/arm/configs/plathome_openblocks_ax3_defconfig b/arch/arm/configs/plathome_openblocks_ax3_defconfig new file mode 100644 index 0000000000..95449c9741 --- /dev/null +++ b/arch/arm/configs/plathome_openblocks_ax3_defconfig @@ -0,0 +1,9 @@ +CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_ARMADA_XP=y +CONFIG_AEABI=y +CONFIG_DEBUG_LL=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_RESET=y +CONFIG_CMD_CLK=y +CONFIG_DRIVER_SERIAL_NS16550=y diff --git a/arch/arm/configs/solidrun_cubox_defconfig b/arch/arm/configs/solidrun_cubox_defconfig new file mode 100644 index 0000000000..1a27d815a6 --- /dev/null +++ b/arch/arm/configs/solidrun_cubox_defconfig @@ -0,0 +1,9 @@ +CONFIG_ARCH_MVEBU=y +CONFIG_ARCH_DOVE=y +CONFIG_AEABI=y +CONFIG_DEBUG_LL=y +CONFIG_CMD_LOADY=y +CONFIG_CMD_LOADS=y +CONFIG_CMD_RESET=y +CONFIG_CMD_CLK=y +CONFIG_DRIVER_SERIAL_NS16550=y diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig index 86bc174101..aed4cb7c63 100644 --- a/arch/arm/cpu/Kconfig +++ b/arch/arm/cpu/Kconfig @@ -39,6 +39,14 @@ config CPU_ARM926T Say Y if you want support for the ARM926T processor. Otherwise, say N. +# Feroceon +config CPU_FEROCEON + bool + select CPU_32v5 + help + This is a Marvell implementation of an ARMv5TE compatible + ARM core, used in the Marvell Kirkwood SoC family. + # ARMv6 config CPU_V6 bool diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig new file mode 100644 index 0000000000..11e4550ec5 --- /dev/null +++ b/arch/arm/mach-mvebu/Kconfig @@ -0,0 +1,124 @@ +if ARCH_MVEBU + +config ARCH_TEXT_BASE + hex + default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3 + default 0x2000000 if MACH_GLOBALSCALE_MIRABOX + default 0x2000000 if MACH_GLOBALSCALE_GURUPLUG + default 0x2000000 if MACH_MARVELL_ARMADA_XP_GP + default 0x2000000 if MACH_SOLIDRUN_CUBOX + +config BOARDINFO + default "PlatHome OpenBlocks AX3" if MACH_PLATHOME_OPENBLOCKS_AX3 + default "Globalscale Mirabox" if MACH_GLOBALSCALE_MIRABOX + default "Globalscale Guruplug" if MACH_GLOBALSCALE_GURUPLUG + default "Marvell Armada XP GP" if MACH_MARVELL_ARMADA_XP_GP + default "SolidRun CuBox" if MACH_SOLIDRUN_CUBOX + +choice + prompt "Marvell EBU Processor" + +config ARCH_ARMADA_370 + bool "Armada 370" + select CPU_V7 + select CLOCKSOURCE_MVEBU + +config ARCH_ARMADA_XP + bool "Armada XP" + select CPU_V7 + select CLOCKSOURCE_MVEBU + +config ARCH_DOVE + bool "Dove 88AP510" + select CPU_V7 + select CLOCKSOURCE_ORION + +config ARCH_KIRKWOOD + bool "Kirkwood" + select CPU_FEROCEON + select CLOCKSOURCE_ORION + +endchoice + +# +# Armada 370 SoC boards +# + +if ARCH_ARMADA_370 + +choice + prompt "Armada 370 Board Type" + +config MACH_GLOBALSCALE_MIRABOX + bool "Globalscale Mirabox" + +endchoice + +endif # ARCH_ARMADA_370 + +# +# Armada XP SoC boards +# + +if ARCH_ARMADA_XP + +choice + prompt "Armada XP Board Type" + +config MACH_PLATHOME_OPENBLOCKS_AX3 + bool "PlatHome OpenBlocks AX3" + +config MACH_MARVELL_ARMADA_XP_GP + bool "Marvell Armada XP GP" + +endchoice + +endif # ARCH_ARMADA_XP + +# +# Dove 88AP510 SoC boards +# + +if ARCH_DOVE + +choice + prompt "Dove 88AP510 Board Type" + +config MACH_SOLIDRUN_CUBOX + bool "SolidRun CuBox" + +endchoice + +endif # ARCH_DOVE + +# +# Kirkwood SoC boards +# + +if ARCH_KIRKWOOD + +choice + prompt "Kirkwood Board Type" + +config MACH_GLOBALSCALE_GURUPLUG + bool "Guruplug" + +endchoice + +endif # ARCH_KIRKWOOD + +# +# Common options +# + +config MVEBU_CONSOLE_UART + int "UART number for console" + default 0 + range 0 1 if ARCH_ARMADA_370 + range 0 1 if ARCH_ARMADA_XP + range 0 3 if ARCH_DOVE + range 0 1 if ARCH_KIRKWOOD + help + Select the UART number the barebox console will sit on. + +endif # ARCH_MVEBU diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile new file mode 100644 index 0000000000..80b3947cc8 --- /dev/null +++ b/arch/arm/mach-mvebu/Makefile @@ -0,0 +1,6 @@ +lwl-y += lowlevel.o +obj-y += common.o +obj-$(CONFIG_ARCH_ARMADA_370) += armada-370-xp.o +obj-$(CONFIG_ARCH_ARMADA_XP) += armada-370-xp.o +obj-$(CONFIG_ARCH_DOVE) += dove.o +obj-$(CONFIG_ARCH_KIRKWOOD) += kirkwood.o diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c new file mode 100644 index 0000000000..2cdc3b0cbc --- /dev/null +++ b/arch/arm/mach-mvebu/armada-370-xp.c @@ -0,0 +1,121 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#include <common.h> +#include <init.h> +#include <io.h> +#include <ns16550.h> +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <asm/memory.h> +#include <mach/armada-370-xp-regs.h> + +#define CONSOLE_UART_BASE \ + ARMADA_370_XP_UARTn_BASE(CONFIG_MVEBU_CONSOLE_UART) + +static struct clk *tclk; + +static inline void armada_370_xp_memory_find(unsigned long *phys_base, + unsigned long *phys_size) +{ + int cs; + + *phys_base = ~0; + *phys_size = 0; + + for (cs = 0; cs < 4; cs++) { + u32 base = readl(ARMADA_370_XP_SDRAM_BASE + DDR_BASE_CSn(cs)); + u32 ctrl = readl(ARMADA_370_XP_SDRAM_BASE + DDR_SIZE_CSn(cs)); + + /* Skip non-enabled CS */ + if ((ctrl & DDR_SIZE_ENABLED) != DDR_SIZE_ENABLED) + continue; + + base &= DDR_BASE_CS_LOW_MASK; + if (base < *phys_base) + *phys_base = base; + *phys_size += (ctrl | ~DDR_SIZE_MASK) + 1; + } +} + +static struct NS16550_plat uart_plat = { + .shift = 2, +}; + +static int armada_370_xp_add_uart(void) +{ + uart_plat.clock = clk_get_rate(tclk); + if (!add_ns16550_device(DEVICE_ID_DYNAMIC, + (unsigned int)CONSOLE_UART_BASE, 32, + IORESOURCE_MEM_32BIT, &uart_plat)) + return -ENODEV; + return 0; +} + +#if defined(CONFIG_ARCH_ARMADA_370) +static int armada_370_init_clocks(void) +{ + u32 val = readl(ARMADA_370_XP_SAR_BASE + SAR_LOW); + unsigned int rate; + + /* + * On Armada 370, the TCLK frequency can be either + * 166 Mhz or 200 Mhz + */ + if ((val & SAR_TCLK_FREQ) == SAR_TCLK_FREQ) + rate = 200000000; + else + rate = 166000000; + + tclk = clk_fixed("tclk", rate); + return clk_register_clkdev(tclk, NULL, "mvebu-timer"); +} +#define armada_370_xp_init_clocks() armada_370_init_clocks() +#endif + +#if defined(CONFIG_ARCH_ARMADA_XP) +static int armada_xp_init_clocks(void) +{ + /* On Armada XP, the TCLK frequency is always 250 Mhz */ + tclk = clk_fixed("tclk", 250000000); + return clk_register_clkdev(tclk, NULL, "mvebu-timer"); +} +#define armada_370_xp_init_clocks() armada_xp_init_clocks() +#endif + +static int armada_370_xp_init_soc(void) +{ + unsigned long phys_base, phys_size; + + armada_370_xp_init_clocks(); + add_generic_device("mvebu-timer", DEVICE_ID_SINGLE, NULL, + (unsigned int)ARMADA_370_XP_TIMER_BASE, 0x30, + IORESOURCE_MEM, NULL); + armada_370_xp_memory_find(&phys_base, &phys_size); + arm_add_mem_device("ram0", phys_base, phys_size); + armada_370_xp_add_uart(); + return 0; +} +postcore_initcall(armada_370_xp_init_soc); + +void __noreturn reset_cpu(unsigned long addr) +{ + writel(0x1, ARMADA_370_XP_SYSCTL_BASE + 0x60); + writel(0x1, ARMADA_370_XP_SYSCTL_BASE + 0x64); + while (1) + ; +} +EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-mvebu/common.c b/arch/arm/mach-mvebu/common.c new file mode 100644 index 0000000000..e2092c8705 --- /dev/null +++ b/arch/arm/mach-mvebu/common.c @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2013 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#include <common.h> +#include <io.h> +#include <sizes.h> +#include <asm/barebox-arm.h> +#include <mach/common.h> + +/* + * All MVEBU SoCs start with internal registers at 0xd0000000. + * To get more contiguous address space and as Linux expects them + * there, we remap them early to 0xf1000000. + * + * There is no way to determine internal registers base address + * safely later on, as the remap register itself is within the + * internal registers. + */ +#define MVEBU_BOOTUP_INT_REG_BASE 0xd0000000 +#define MVEBU_BRIDGE_REG_BASE 0x20000 +#define DEVICE_INTERNAL_BASE_ADDR (MVEBU_BRIDGE_REG_BASE + 0x80) + +static void mvebu_remap_registers(void) +{ + writel(MVEBU_REMAP_INT_REG_BASE, + IOMEM(MVEBU_BOOTUP_INT_REG_BASE) + DEVICE_INTERNAL_BASE_ADDR); +} + +/* + * Determining the actual memory size is highly SoC dependent, + * but for all SoCs RAM starts at 0x00000000. Therefore, we start + * with a minimal memory setup of 64M and probe correct memory size + * later. + */ +#define MVEBU_BOOTUP_MEMORY_BASE 0x00000000 +#define MVEBU_BOOTUP_MEMORY_SIZE SZ_64M + +void __naked __noreturn mvebu_barebox_entry(void) +{ + mvebu_remap_registers(); + barebox_arm_entry(MVEBU_BOOTUP_MEMORY_BASE, + MVEBU_BOOTUP_MEMORY_SIZE, 0); +} diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c new file mode 100644 index 0000000000..6e8e1130ec --- /dev/null +++ b/arch/arm/mach-mvebu/dove.c @@ -0,0 +1,145 @@ +/* + * Copyright + * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#include <common.h> +#include <init.h> +#include <io.h> +#include <ns16550.h> +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <asm/memory.h> +#include <mach/dove-regs.h> + +#define CONSOLE_UART_BASE DOVE_UARTn_BASE(CONFIG_MVEBU_CONSOLE_UART) + +static struct clk *tclk; + +static inline void dove_remap_mc_regs(void) +{ + void __iomem *mcboot = IOMEM(DOVE_BOOTUP_MC_REGS); + uint32_t val; + + /* remap ahb slave base */ + val = readl(DOVE_CPU_CTRL) & 0xffff0000; + val |= (DOVE_REMAP_MC_REGS & 0xffff0000) >> 16; + writel(val, DOVE_CPU_CTRL); + + /* remap axi bridge address */ + val = readl(DOVE_AXI_CTRL) & 0x007fffff; + val |= DOVE_REMAP_MC_REGS & 0xff800000; + writel(val, DOVE_AXI_CTRL); + + /* remap memory controller base address */ + val = readl(mcboot + SDRAM_REGS_BASE_DECODE) & 0x0000ffff; + val |= DOVE_REMAP_MC_REGS & 0xffff0000; + writel(val, mcboot + SDRAM_REGS_BASE_DECODE); +} + +static inline void dove_memory_find(unsigned long *phys_base, + unsigned long *phys_size) +{ + int n; + + *phys_base = ~0; + *phys_size = 0; + + for (n = 0; n < 2; n++) { + uint32_t map = readl(DOVE_SDRAM_BASE + SDRAM_MAPn(n)); + uint32_t base, size; + + /* skip disabled areas */ + if ((map & SDRAM_MAP_VALID) != SDRAM_MAP_VALID) + continue; + + base = map & SDRAM_START_MASK; + if (base < *phys_base) + *phys_base = base; + + /* real size is encoded as ld(2^(16+length)) */ + size = (map & SDRAM_LENGTH_MASK) >> SDRAM_LENGTH_SHIFT; + *phys_size += 1 << (16 + size); + } +} + +static struct NS16550_plat uart_plat = { + .shift = 2, +}; + +static int dove_add_uart(void) +{ + uart_plat.clock = clk_get_rate(tclk); + if (!add_ns16550_device(DEVICE_ID_DYNAMIC, + (unsigned int)CONSOLE_UART_BASE, 32, + IORESOURCE_MEM_32BIT, &uart_plat)) + return -ENODEV; + return 0; +} + +/* + * Dove TCLK sample-at-reset configuation + * + * SAR0[24:23] : TCLK frequency + * 0 = 166 MHz + * 1 = 125 MHz + * others reserved. + */ +static int dove_init_clocks(void) +{ + uint32_t strap, sar = readl(DOVE_SAR_BASE + SAR0); + unsigned int rate; + + strap = (sar & TCLK_FREQ_MASK) >> TCLK_FREQ_SHIFT; + switch (strap) { + case 0: + rate = 166666667; + break; + case 1: + rate = 125000000; + break; + default: + panic("Unknown TCLK strapping %d\n", strap); + } + + tclk = clk_fixed("tclk", rate); + return clk_register_clkdev(tclk, NULL, "orion-timer"); +} + +static int dove_init_soc(void) +{ + unsigned long phys_base, phys_size; + + dove_remap_mc_regs(); + dove_init_clocks(); + add_generic_device("orion-timer", DEVICE_ID_SINGLE, NULL, + (unsigned int)DOVE_TIMER_BASE, 0x30, + IORESOURCE_MEM, NULL); + dove_memory_find(&phys_base, &phys_size); + arm_add_mem_device("ram0", phys_base, phys_size); + dove_add_uart(); + + return 0; +} +postcore_initcall(dove_init_soc); + +void __noreturn reset_cpu(unsigned long addr) +{ + /* enable and assert RSTOUTn */ + writel(SOFT_RESET_OUT_EN, DOVE_BRIDGE_BASE + BRIDGE_RSTOUT_MASK); + writel(SOFT_RESET_EN, DOVE_BRIDGE_BASE + BRIDGE_SYS_SOFT_RESET); + while (1) + ; +} +EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h new file mode 100644 index 0000000000..5fd16e5733 --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/armada-370-xp-regs.h @@ -0,0 +1,47 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#ifndef __MACH_MVEBU_ARMADA_370_XP_REGS_H +#define __MACH_MVEBU_ARMADA_370_XP_REGS_H + +#include <mach/common.h> + +#define ARMADA_370_XP_INT_REGS_BASE IOMEM(MVEBU_REMAP_INT_REG_BASE) +#define ARMADA_370_XP_UART_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x12000) +#define ARMADA_370_XP_UARTn_BASE(n) \ + (ARMADA_370_XP_UART_BASE + ((n) * 0x100)) + +#define ARMADA_370_XP_SYSCTL_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x18200) +#define ARMADA_370_XP_SAR_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x18230) +#define SAR_LOW 0x00 +#define SAR_TCLK_FREQ BIT(20) +#define SAR_HIGH 0x04 + +#define ARMADA_370_XP_SDRAM_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x20000) +#define DDR_BASE_CS 0x180 +#define DDR_BASE_CSn(n) (DDR_BASE_CS + ((n) * 0x8)) +#define DDR_BASE_CS_HIGH_MASK 0x0000000f +#define DDR_BASE_CS_LOW_MASK 0xff000000 +#define DDR_SIZE_CS 0x184 +#define DDR_SIZE_CSn(n) (DDR_SIZE_CS + ((n) * 0x8)) +#define DDR_SIZE_ENABLED BIT(0) +#define DDR_SIZE_CS_MASK 0x0000001c +#define DDR_SIZE_CS_SHIFT 2 +#define DDR_SIZE_MASK 0xff000000 + +#define ARMADA_370_XP_TIMER_BASE (ARMADA_370_XP_INT_REGS_BASE + 0x20300) + +#endif /* __MACH_MVEBU_DOVE_REGS_H */ diff --git a/arch/arm/mach-mvebu/include/mach/common.h b/arch/arm/mach-mvebu/include/mach/common.h new file mode 100644 index 0000000000..3cc1bf71c0 --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/common.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#ifndef __MACH_COMMON_H__ +#define __MACH_COMMON_H__ + +#define MVEBU_REMAP_INT_REG_BASE 0xf1000000 + +#endif diff --git a/arch/arm/mach-mvebu/include/mach/debug_ll.h b/arch/arm/mach-mvebu/include/mach/debug_ll.h new file mode 100644 index 0000000000..1cf821ee2a --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/debug_ll.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2013 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#ifndef __MACH_DEBUG_LL_H__ +#define __MACH_DEBUG_LL_H__ + +#include <io.h> + +#define UART_BASE 0xf1012000 +#define UARTn_BASE(n) (UART_BASE + ((n) * 0x100)) +#define UART_THR 0x00 +#define UART_LSR 0x14 +#define LSR_THRE BIT(5) + +#define EARLY_UART UARTn_BASE(CONFIG_MVEBU_CONSOLE_UART) + +static inline void PUTC_LL(char c) +{ + /* Wait until there is space in the FIFO */ + while (!(readl(EARLY_UART + UART_LSR) & LSR_THRE)) + ; + + /* Send the character */ + writel(c, EARLY_UART + UART_THR); + + /* Wait to make sure it hits the line */ + while (!(readl(EARLY_UART + UART_LSR) & LSR_THRE)) + ; +} +#endif diff --git a/arch/arm/mach-mvebu/include/mach/dove-regs.h b/arch/arm/mach-mvebu/include/mach/dove-regs.h new file mode 100644 index 0000000000..519457e3d4 --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/dove-regs.h @@ -0,0 +1,62 @@ +/* + * Copyright + * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#ifndef __MACH_MVEBU_DOVE_REGS_H +#define __MACH_MVEBU_DOVE_REGS_H + +#include <mach/common.h> + +/* + * Even after MVEBU SoC internal register base remap. Dove MC + * registers are still at 0xd0800000. We remap it right after + * internal registers to 0xf1800000. +*/ +#define DOVE_BOOTUP_MC_REGS 0xd0800000 +#define DOVE_REMAP_MC_REGS 0xf1800000 + +#define DOVE_INT_REGS_BASE IOMEM(MVEBU_REMAP_INT_REG_BASE) +#define DOVE_MC_REGS_BASE IOMEM(DOVE_REMAP_MC_REGS) + +#define DOVE_UART_BASE (DOVE_INT_REGS_BASE + 0x12000) +#define DOVE_UARTn_BASE(n) (DOVE_UART_BASE + ((n) * 0x100)) + +#define DOVE_BRIDGE_BASE (DOVE_INT_REGS_BASE + 0x20000) +#define INT_REGS_BASE_MAP 0x080 +#define BRIDGE_RSTOUT_MASK 0x108 +#define SOFT_RESET_OUT_EN BIT(2) +#define BRIDGE_SYS_SOFT_RESET 0x10c +#define SOFT_RESET_EN BIT(0) +#define DOVE_TIMER_BASE (DOVE_INT_REGS_BASE + 0x20300) + +#define DOVE_SAR_BASE (DOVE_INT_REGS_BASE + 0xd0214) +#define SAR0 0x000 +#define TCLK_FREQ_SHIFT 23 +#define TCLK_FREQ_MASK (0x3 << TCLK_FREQ_SHIFT) +#define SAR1 0x004 + +#define DOVE_AXI_CTRL (DOVE_INT_REGS_BASE + 0xd0224) +#define DOVE_CPU_CTRL (DOVE_INT_REGS_BASE + 0xd025c) + +#define DOVE_SDRAM_BASE (DOVE_MC_REGS_BASE) +#define SDRAM_REGS_BASE_DECODE 0x010 +#define SDRAM_MAPn(n) (0x100 + ((n) * 0x10)) +#define SDRAM_START_MASK (0x1ff << 23) +#define SDRAM_LENGTH_SHIFT 16 +#define SDRAM_LENGTH_MASK (0x00f << SDRAM_LENGTH_SHIFT) +#define SDRAM_ADDRESS_MASK (0x1ff << 7) +#define SDRAM_MAP_VALID BIT(0) + +#endif /* __MACH_MVEBU_DOVE_REGS_H */ diff --git a/arch/arm/mach-mvebu/include/mach/dove.h b/arch/arm/mach-mvebu/include/mach/dove.h new file mode 100644 index 0000000000..1712fa7a1d --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/dove.h @@ -0,0 +1,23 @@ +/* + * Copyright + * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#ifndef __MACH_MVEBU_DOVE_H +#define __MACH_MVEBU_DOVE_H + +int dove_add_uart(int num); +void __naked __noreturn dove_barebox_entry(void); + +#endif /* __MACH_MVEBU_DOVE_H */ diff --git a/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h b/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h new file mode 100644 index 0000000000..39fa37900b --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h @@ -0,0 +1,50 @@ +/* + * Copyright + * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#ifndef __MACH_MVEBU_KIRKWOOD_REGS_H +#define __MACH_MVEBU_KIRKWOOD_REGS_H + +#include <mach/common.h> + +#define KIRKWOOD_INT_REGS_BASE IOMEM(MVEBU_REMAP_INT_REG_BASE) + +#define KIRKWOOD_SDRAM_BASE (KIRKWOOD_INT_REGS_BASE + 0x00000) +#define DDR_BASE_CS 0x1500 +#define DDR_BASE_CSn(n) (DDR_BASE_CS + ((n) * 0x8)) +#define DDR_BASE_CS_HIGH_MASK 0x0000000f +#define DDR_BASE_CS_LOW_MASK 0xff000000 +#define DDR_SIZE_CS 0x1504 +#define DDR_SIZE_CSn(n) (DDR_SIZE_CS + ((n) * 0x8)) +#define DDR_SIZE_ENABLED BIT(0) +#define DDR_SIZE_CS_MASK 0x1c +#define DDR_SIZE_CS_SHIFT 2 +#define DDR_SIZE_MASK 0xff000000 + +#define KIRKWOOD_SAR_BASE (KIRKWOOD_INT_REGS_BASE + 0x10030) +#define SAR_TCLK_FREQ BIT(21) + +#define KIRKWOOD_UART_BASE (KIRKWOOD_INT_REGS_BASE + 0x12000) +#define KIRKWOOD_UARTn_BASE(n) (KIRKWOOD_UART_BASE + ((n) * 0x100)) + +#define KIRKWOOD_BRIDGE_BASE (KIRKWOOD_INT_REGS_BASE + 0x20000) +#define BRIDGE_RSTOUT_MASK 0x108 +#define SOFT_RESET_OUT_EN BIT(2) +#define BRIDGE_SYS_SOFT_RESET 0x10c +#define SOFT_RESET_EN BIT(0) + +#define KIRKWOOD_TIMER_BASE (KIRKWOOD_INT_REGS_BASE + 0x20300) + +#endif /* __MACH_MVEBU_KIRKWOOD_REGS_H */ diff --git a/arch/arm/mach-mvebu/include/mach/kirkwood.h b/arch/arm/mach-mvebu/include/mach/kirkwood.h new file mode 100644 index 0000000000..7fe002d44d --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/kirkwood.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#ifndef __MACH_KIRKWOOD_H +#define __MACH_KIRKWOOD_H + +int kirkwood_add_uart0(void); +void __naked __noreturn kirkwood_barebox_entry(void); + +#endif /* __MACH_KIRKWOOD_H */ diff --git a/arch/arm/mach-mvebu/include/mach/lowlevel.h b/arch/arm/mach-mvebu/include/mach/lowlevel.h new file mode 100644 index 0000000000..e86d928f63 --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/lowlevel.h @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2013 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#ifndef __MACH_LOWLEVEL_H__ +#define __MACH_LOWLEVEL_H__ + +void mvebu_barebox_entry(void); + +#endif diff --git a/arch/arm/mach-mvebu/include/mach/mvebu.h b/arch/arm/mach-mvebu/include/mach/mvebu.h new file mode 100644 index 0000000000..e13a446fca --- /dev/null +++ b/arch/arm/mach-mvebu/include/mach/mvebu.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#ifndef __MACH_MVEBU_H +#define __MACH_MVEBU_H + +int mvebu_add_uart0(void); +void __naked __noreturn mvebu_barebox_entry(void); + +#endif /* __MACH_MVEBU_H */ diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c new file mode 100644 index 0000000000..3e16f410be --- /dev/null +++ b/arch/arm/mach-mvebu/kirkwood.c @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.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. + * + */ + +#include <common.h> +#include <init.h> +#include <io.h> +#include <ns16550.h> +#include <linux/clk.h> +#include <linux/clkdev.h> +#include <asm/memory.h> +#include <mach/kirkwood-regs.h> + +#define CONSOLE_UART_BASE KIRKWOOD_UARTn_BASE(CONFIG_MVEBU_CONSOLE_UART) + +static struct clk *tclk; + +static inline void kirkwood_memory_find(unsigned long *phys_base, + unsigned long *phys_size) +{ + int cs; + + *phys_base = ~0; + *phys_size = 0; + + for (cs = 0; cs < 4; cs++) { + u32 base = readl(KIRKWOOD_SDRAM_BASE + DDR_BASE_CSn(cs)); + u32 ctrl = readl(KIRKWOOD_SDRAM_BASE + DDR_SIZE_CSn(cs)); + + /* Skip non-enabled CS */ + if ((ctrl & DDR_SIZE_ENABLED) != DDR_SIZE_ENABLED) + continue; + + base &= DDR_BASE_CS_LOW_MASK; + if (base < *phys_base) + *phys_base = base; + *phys_size += (ctrl | ~DDR_SIZE_MASK) + 1; + } +} + +static struct NS16550_plat uart_plat = { + .shift = 2, +}; + +static int kirkwood_add_uart(void) +{ + uart_plat.clock = clk_get_rate(tclk); + if (!add_ns16550_device(DEVICE_ID_DYNAMIC, + (unsigned int)CONSOLE_UART_BASE, 32, + IORESOURCE_MEM_32BIT, &uart_plat)) + return -ENODEV; + return 0; +} + +static int kirkwood_init_clocks(void) +{ + u32 val = readl(KIRKWOOD_SAR_BASE); + unsigned int rate; + + /* + * On Kirkwood, the TCLK frequency can be either + * 166 Mhz or 200 Mhz + */ + if ((val & SAR_TCLK_FREQ) == SAR_TCLK_FREQ) + rate = 166666667; + else + rate = 200000000; + + tclk = clk_fixed("tclk", rate); + return clk_register_clkdev(tclk, NULL, "orion-timer"); +} + +static int kirkwood_init_soc(void) +{ + unsigned long phys_base, phys_size; + + kirkwood_init_clocks(); + add_generic_device("orion-timer", DEVICE_ID_SINGLE, NULL, + (unsigned int)KIRKWOOD_TIMER_BASE, 0x30, + IORESOURCE_MEM, NULL); + kirkwood_memory_find(&phys_base, &phys_size); + arm_add_mem_device("ram0", phys_base, phys_size); + kirkwood_add_uart(); + + return 0; +} +postcore_initcall(kirkwood_init_soc); + +void __noreturn reset_cpu(unsigned long addr) +{ + writel(SOFT_RESET_OUT_EN, KIRKWOOD_BRIDGE_BASE + BRIDGE_RSTOUT_MASK); + writel(SOFT_RESET_EN, KIRKWOOD_BRIDGE_BASE + BRIDGE_SYS_SOFT_RESET); + for(;;) + ; +} +EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-mvebu/lowlevel.c b/arch/arm/mach-mvebu/lowlevel.c new file mode 100644 index 0000000000..3f64c4a5b4 --- /dev/null +++ b/arch/arm/mach-mvebu/lowlevel.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2013 + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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. + * + */ + +#include <common.h> +#include <sizes.h> +#include <asm/barebox-arm.h> +#include <asm/barebox-arm-head.h> +#include <mach/lowlevel.h> + +void __naked barebox_arm_reset_vector(void) +{ + arm_cpu_lowlevel_init(); + mvebu_barebox_entry(); +} |