summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBeniamino Galvani <b.galvani@gmail.com>2014-04-27 11:30:44 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-29 08:15:41 +0200
commit3bef9916a3610e5323c0297ad78471d331c332d5 (patch)
treea2b10ad415c9920dbac9741b1f2a27cb2347d12c /arch
parenta9c8371a85eaac326946727c6eaa5ae49933f564 (diff)
downloadbarebox-3bef9916a3610e5323c0297ad78471d331c332d5.tar.gz
barebox-3bef9916a3610e5323c0297ad78471d331c332d5.tar.xz
ARM: rockchip: add radxa-rock board
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/Makefile1
-rw-r--r--arch/arm/boards/radxa-rock/Makefile2
-rw-r--r--arch/arm/boards/radxa-rock/board.c78
-rw-r--r--arch/arm/boards/radxa-rock/env/config-board6
-rw-r--r--arch/arm/boards/radxa-rock/lowlevel.c23
-rw-r--r--arch/arm/configs/radxa-rock_defconfig62
-rw-r--r--arch/arm/mach-rockchip/Kconfig8
7 files changed, 180 insertions, 0 deletions
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 16742d9138..e760f2a576 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_MACH_PM9263) += pm9263/
obj-$(CONFIG_MACH_PM9G45) += pm9g45/
obj-$(CONFIG_MACH_QIL_A9260) += qil-a926x/
obj-$(CONFIG_MACH_QIL_A9G20) += qil-a926x/
+obj-$(CONFIG_MACH_RADXA_ROCK) += radxa-rock/
obj-$(CONFIG_MACH_REALQ7) += datamodul-edm-qmx6/
obj-$(CONFIG_MACH_RPI) += raspberry-pi/
obj-$(CONFIG_MACH_SABRELITE) += freescale-mx6-sabrelite/
diff --git a/arch/arm/boards/radxa-rock/Makefile b/arch/arm/boards/radxa-rock/Makefile
new file mode 100644
index 0000000000..79c8aec199
--- /dev/null
+++ b/arch/arm/boards/radxa-rock/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_MACH_RADXA_ROCK) += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/radxa-rock/board.c b/arch/arm/boards/radxa-rock/board.c
new file mode 100644
index 0000000000..55b4d23ef3
--- /dev/null
+++ b/arch/arm/boards/radxa-rock/board.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 <i2c/i2c.h>
+#include <i2c/i2c-gpio.h>
+#include <mach/rockchip-pll.h>
+#include <mfd/act8846.h>
+
+static struct i2c_board_info radxa_rock_i2c_devices[] = {
+ {
+ I2C_BOARD_INFO("act8846", 0x5a)
+ },
+};
+
+static struct i2c_gpio_platform_data i2c_gpio_pdata = {
+ .sda_pin = 58,
+ .scl_pin = 59,
+ .udelay = 5,
+};
+
+static void radxa_rock_pmic_init(void)
+{
+ struct act8846 *pmic;
+
+ pmic = act8846_get();
+ if (pmic == NULL)
+ return;
+
+ /* Power on ethernet PHY */
+ act8846_set_bits(pmic, ACT8846_LDO9_CTRL, BIT(7), BIT(7));
+}
+
+static int setup_plls(void)
+{
+ /* Codec PLL frequency: 594 MHz */
+ rk3188_pll_set_parameters(RK3188_CPLL, 2, 198, 4);
+ /* General PLL frequency: 300 MHz */
+ rk3188_pll_set_parameters(RK3188_GPLL, 1, 50, 4);
+
+ return 0;
+}
+coredevice_initcall(setup_plls);
+
+static int devices_init(void)
+{
+ i2c_register_board_info(0, radxa_rock_i2c_devices,
+ ARRAY_SIZE(radxa_rock_i2c_devices));
+ add_generic_device_res("i2c-gpio", 0, NULL, 0, &i2c_gpio_pdata);
+
+ radxa_rock_pmic_init();
+
+ /* Set mac_pll divisor to 6 (50MHz output) */
+ writel((5 << 8) | (0x1f << 24), 0x20000098);
+
+ return 0;
+}
+device_initcall(devices_init);
+
+static int hostname_init(void)
+{
+ barebox_set_hostname("radxa-rock");
+
+ return 0;
+}
+core_initcall(hostname_init);
diff --git a/arch/arm/boards/radxa-rock/env/config-board b/arch/arm/boards/radxa-rock/env/config-board
new file mode 100644
index 0000000000..d986e305dc
--- /dev/null
+++ b/arch/arm/boards/radxa-rock/env/config-board
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# board defaults, do not change in running system. Change /env/config
+# instead
+
+global.linux.bootargs.base="console=ttyS2,115200" \ No newline at end of file
diff --git a/arch/arm/boards/radxa-rock/lowlevel.c b/arch/arm/boards/radxa-rock/lowlevel.c
new file mode 100644
index 0000000000..c68d229858
--- /dev/null
+++ b/arch/arm/boards/radxa-rock/lowlevel.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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-head.h>
+#include <asm/barebox-arm.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+ arm_cpu_lowlevel_init();
+ barebox_arm_entry(0x60000000, SZ_2G, 0);
+}
diff --git a/arch/arm/configs/radxa-rock_defconfig b/arch/arm/configs/radxa-rock_defconfig
new file mode 100644
index 0000000000..ab45cb9df8
--- /dev/null
+++ b/arch/arm/configs/radxa-rock_defconfig
@@ -0,0 +1,62 @@
+CONFIG_BUILTIN_DTB=y
+CONFIG_BUILTIN_DTB_NAME="rk3188-radxarock"
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_AEABI=y
+CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_MALLOC_SIZE=0x4000000
+CONFIG_MALLOC_TLSF=y
+CONFIG_MMU=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/radxa-rock/env"
+CONFIG_PROMPT="radxa-rock:"
+CONFIG_LONGHELP=y
+CONFIG_GLOB=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_ECHO_E=y
+CONFIG_CMD_LOADB=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_IOMEM=y
+CONFIG_CMD_MM=y
+CONFIG_NET_CMD_IFUP=y
+CONFIG_CMD_BOOTM=y
+CONFIG_CMD_BOOTU=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_OF_PROPERTY=y
+CONFIG_CMD_OF_NODE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_TFTP=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_UNCOMPRESS=y
+CONFIG_CMD_LED=y
+CONFIG_CMD_MIITOOL=y
+CONFIG_CMD_CLK=y
+CONFIG_OFDEVICE=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_LED_GPIO_OF=y
+CONFIG_NET=y
+CONFIG_NET_PING=y
+CONFIG_NET_DHCP=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_ROCKCHIP=y
+CONFIG_I2C=y
+CONFIG_I2C_GPIO=y
+CONFIG_MFD_ACT8846=y
+CONFIG_DRIVER_NET_ARC_EMAC=y
+CONFIG_SMSC_PHY=y
+CONFIG_FS_TFTP=y
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index dfaf146a69..9348651d2e 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -4,4 +4,12 @@ config ARCH_TEXT_BASE
hex
default 0x68000000
+choice
+ prompt "Board type"
+
+config MACH_RADXA_ROCK
+ bool "Radxa rock board"
+
+endchoice
+
endif