From 600e61eed037eb27df6301db9e7dab0a86cc1012 Mon Sep 17 00:00:00 2001
From: Bo Shen <voice.shen@gmail.com>
Date: Sat, 12 Apr 2014 07:42:11 +0800
Subject: [PATCH] bananapi: add bananapi board support

BananaPi is A20 based board. More information:
  www.banana-pi.org

The bananapi.h is original from sun7i.h + sunxi-common.h
The dram_bananapi.c is original from dram_cubieboard2.c

Signed-off-by: Bo Shen <voice.shen@gmail.com>
---
 arch/arm/cpu/armv7/sunxi/board.c |   3 +
 board/sunxi/Makefile             |   1 +
 board/sunxi/dram_bananapi.c      |  31 +++
 boards.cfg                       |   1 +
 include/configs/bananapi.h       | 432 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 468 insertions(+)
 create mode 100644 board/sunxi/dram_bananapi.c
 create mode 100644 include/configs/bananapi.h

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index 9b3d5a2..2df7704 100644
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
index bed033b..bbe73f6 100644
--- a/board/sunxi/Makefile
+++ b/board/sunxi/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_AUXTEK_T003)	+= dram_auxtek_t003.o
 # This is not a typo, uses the same mem settings as the a10s-olinuxino-m
 obj-$(CONFIG_AUXTEK_T004)	+= dram_a10s_olinuxino_m.o
 obj-$(CONFIG_BA10_TV_BOX)	+= dram_sun4i_384_1024_iow8.o
+obj-$(CONFIG_BANANAPI)		+= dram_bananapi.o
 obj-$(CONFIG_COBY_MID7042)	+= dram_sun4i_408_1024_iow16.o
 obj-$(CONFIG_COBY_MID8042)	+= dram_sun4i_360_1024_iow16.o
 obj-$(CONFIG_COBY_MID9742)	+= dram_sun4i_408_1024_iow16.o
diff --git a/board/sunxi/dram_bananapi.c b/board/sunxi/dram_bananapi.c
new file mode 100644
index 0000000..9e75367
--- /dev/null
+++ b/board/sunxi/dram_bananapi.c
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include <common.h>
+#include <asm/arch/dram.h>
+
+static struct dram_para dram_para = {
+	.clock = 480,
+	.type = 3,
+	.rank_num = 1,
+	.density = 4096,
+	.io_width = 16,
+	.bus_width = 32,
+	.cas = 9,
+	.zq = 0x7f,
+	.odt_en = 0,
+	.size = 1024,
+	.tpr0 = 0x42d899b7,
+	.tpr1 = 0xa090,
+	.tpr2 = 0x22a00,
+	.tpr3 = 0x0,
+	.tpr4 = 0x1,
+	.tpr5 = 0x0,
+	.emr1 = 0x4,
+	.emr2 = 0x10,
+	.emr3 = 0x0,
+};
+
+unsigned long sunxi_dram_init(void)
+{
+	return dramc_init(&dram_para);
+}
diff --git a/boards.cfg b/boards.cfg
index f1a5d07..5073644 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -381,6 +381,7 @@ Active  arm         armv7          sunxi       -               sunxi
 Active  arm         armv7          sunxi       -               sunxi               Auxtek-T003                          sun5i:AUXTEK_T003,SPL,AXP152_POWER,STATUSLED=34                                                                                   -
 Active  arm         armv7          sunxi       -               sunxi               Auxtek-T004                          sun5i:AUXTEK_T004,SPL,AXP152_POWER,STATUSLED=34                                                                                   -
 Active  arm         armv7          sunxi       -               sunxi               ba10_tv_box                          sun4i:BA10_TV_BOX,SPL,SUNXI_EMAC                                                                                                  -
+Active  arm         armv7          sunxi       -               sunxi               bananapi                             sun7i:BANANAPI,SPL,SUNXI_GMAC,STATUSLED=248                                                                                                  -
 Active  arm         armv7          sunxi       -               sunxi               Coby_MID7042                         sun4i:COBY_MID7042,SPL                                                                                                            -
 Active  arm         armv7          sunxi       -               sunxi               Coby_MID8042                         sun4i:COBY_MID8042,SPL                                                                                                            -
 Active  arm         armv7          sunxi       -               sunxi               Coby_MID9742                         sun4i:COBY_MID9742,SPL                                                                                                            -
diff --git a/include/configs/bananapi.h b/include/configs/bananapi.h
new file mode 100644
index 0000000..5e70e63
-- 
1.9.3

