[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.3-465-g7a78cea
Brought to you by:
sszy
|
From: Nicolas <th...@us...> - 2014-10-30 11:14:51
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 7a78cea47f77b75b8aba64ada816940eb9d05780 (commit)
via bae44b5187fc14f0e1006ac9af2902726e467be2 (commit)
from 18af2eaab184f182adb35a87c42e1c48ea3c1ea5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7a78cea47f77b75b8aba64ada816940eb9d05780
Merge: bae44b5 18af2ea
Author: Nicolas Colombain <nic...@ar...>
Date: Thu Oct 30 12:14:21 2014 +0100
Merge branch 'master' of ssh://git.code.sf.net/p/armadeus/code
commit bae44b5187fc14f0e1006ac9af2902726e467be2
Author: Nicolas Colombain <nic...@ar...>
Date: Thu Oct 30 12:14:05 2014 +0100
[UBOOT] add apf6 fpga initial support
-----------------------------------------------------------------------
Summary of changes:
patches/u-boot/2014.07/503-add-apf6.patch | 277 ++++++++++++++++++++++++++++-
1 files changed, 275 insertions(+), 2 deletions(-)
diff --git a/patches/u-boot/2014.07/503-add-apf6.patch b/patches/u-boot/2014.07/503-add-apf6.patch
index 4cac376..62acd21 100644
--- a/patches/u-boot/2014.07/503-add-apf6.patch
+++ b/patches/u-boot/2014.07/503-add-apf6.patch
@@ -21,13 +21,13 @@ Index: uboot-2014.07/board/armadeus/apf6/Makefile
+# SPDX-License-Identifier: GPL-2.0+
+#
+
-+obj-y := apf6.o
++obj-y := apf6.o fpga.o
+obj-$(CONFIG_SPL_BUILD) += apf6_spl.o
Index: uboot-2014.07/board/armadeus/apf6/apf6.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ uboot-2014.07/board/armadeus/apf6/apf6.c 2014-09-15 15:29:36.671153456 +0200
-@@ -0,0 +1,321 @@
+@@ -0,0 +1,377 @@
+/*
+ * Copyright (C) 2013 Armadeus systems.
+ *
@@ -60,6 +60,7 @@ Index: uboot-2014.07/board/armadeus/apf6/apf6.c
+#include <ipu_pixfmt.h>
+#include <mmc.h>
+#include <linux/fb.h>
++#include "fpga.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
@@ -300,12 +301,44 @@ Index: uboot-2014.07/board/armadeus/apf6/apf6.c
+ return 0;
+}
+
++#define FPGA_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
++ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
++
++
++static iomux_v3_cfg_t const fpga_pads[] = {
++ /* FPGA AS_DATA enet_txd1*/
++ IOMUX_PADS(PAD_ENET_TXD1__GPIO1_IO29 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA DCLK enet_rxd0*/
++ IOMUX_PADS(PAD_ENET_RXD0__GPIO1_IO27 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA CONF_DONE enet_rxd1*/
++ IOMUX_PADS(PAD_ENET_RXD1__GPIO1_IO26 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA NCONFIG EIM_D26*/
++ IOMUX_PADS(PAD_EIM_D26__GPIO3_IO26 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA NSTATUS EIM_D27*/
++ IOMUX_PADS(PAD_EIM_D27__GPIO3_IO27 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA CVP_CONFDONE EIM_D22*/
++ IOMUX_PADS(PAD_EIM_D22__GPIO3_IO22 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++ /* FPGA PERSTL0# EIM_D18*/
++ IOMUX_PADS(PAD_EIM_D18__GPIO3_IO18 | MUX_PAD_CTRL(FPGA_PAD_CTRL)),
++};
++
++
++void setup_fpga(void)
++{
++ SETUP_IOMUX_PADS(fpga_pads);
++}
++
++
+int board_early_init_f(void)
+{
+ setup_iomux_uart();
+#if defined(CONFIG_VIDEO_IPUV3)
+ setup_display();
+#endif
++#ifdef CONFIG_FPGA
++ setup_fpga();
++#endif
++
+ return 0;
+}
+
@@ -320,11 +353,34 @@ Index: uboot-2014.07/board/armadeus/apf6/apf6.c
+
+int board_late_init(void)
+{
++ u_char *firmware_buffer =
++ (u_char *) (CONFIG_SYS_LOAD_ADDR + CONFIG_SYS_MONITOR_LEN);
++ size_t size = 0;
++
+ if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+ setenv("fdt_file", "imx6q-apf6dev.dtb");
+ else if (is_cpu_type(MXC_CPU_MX6DL) || is_cpu_type(MXC_CPU_MX6SOLO))
+ setenv("fdt_file", "imx6dl-apf6dev.dtb");
+
++#if defined(CONFIG_FPGA)
++ /* init and download fpga */
++/* if ((autoload) && (0 == strcmp(autoload, "1"))) {
++ if ((mtdparts_init() == 0) && (find_dev_and_part("firmware",
++ &dev, &pnum, &part) == 0)) {
++ size = part->size;
++ if (nand_read_skip_bad(&nand_info[0], part->offset,
++ &size, firmware_buffer))
++ size = 0;
++ }
++ if (ctrlc()) {
++ printf("Firmware download stopped!\n");
++ size = 0;
++ }
++ }*/
++ APF6_init_fpga(firmware_buffer, size);
++#endif
++
++
+ return 0;
+}
+
@@ -661,3 +717,220 @@ Index: uboot-2014.07/board/armadeus/apf6/clocks.cfg
+ * This sets CKO1 at ahb_clk_root/8 = 132/8 = 16.5 MHz
+ */
+DATA 4, CCM_CCOSR, 0x000000fb
+Index: uboot-2014.07/board/armadeus/apf6/fpga.c
+===================================================================
+--- /dev/null 1970-01-01 01:00:00.000000000 +0100
++++ uboot-2014.07/board/armadeus/apf6/fpga.c 2014-10-22 15:38:38.421753366 +0200
+@@ -0,0 +1,173 @@
++/*
++ * (C) Copyright 2002-2014
++ * Nicolas Colombain <nic...@ar...>
++ * Rich Ireland, Enterasys Networks, rir...@en....
++ * Keith Outwater, kei...@mv....
++ *
++ * 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>
++
++#if defined(CONFIG_FPGA)
++
++#include <asm/gpio.h>
++#include <asm/io.h>
++#include <command.h>
++#include <asm/arch/iomux.h>
++#include "fpga.h"
++#include <fpga.h>
++#include <ACEX1K.h>
++
++#ifdef FPGA_DEBUG
++#define PRINTF(fmt, args...) printf(fmt , ##args)
++#else
++#define PRINTF(fmt, args...)
++#endif
++
++#define FPGA_AS_DATA IMX_GPIO_NR(1, 29)
++#define FPGA_DCLK IMX_GPIO_NR(1, 27)
++#define FPGA_CONF_DONE IMX_GPIO_NR(1, 26)
++#define FPGA_NCONFIG IMX_GPIO_NR(3, 26)
++#define FPGA_NSTATUS IMX_GPIO_NR(3, 27)
++#define FPGA_CVP_CONFDONE IMX_GPIO_NR(3, 22)
++#define FPGA_PERSTL0 IMX_GPIO_NR(3, 18)
++
++
++Altera_CYC2_Passive_Serial_fns altera_fns = {
++ fpga_null_fn,
++ fpga_config_fn,
++ fpga_status_fn,
++ fpga_done_fn,
++ fpga_wr_fn,
++ fpga_null_fn,
++ fpga_null_fn,
++};
++
++Altera_desc fpga = {
++ Altera_CYC2,
++ passive_serial,
++ 320280l / 8, /* C3 IOSCR*/
++ (void *) &altera_fns,
++ NULL,
++ 0
++};
++
++
++int fpga_null_fn(int cookie)
++{
++ return 0;
++}
++
++int fpga_config_fn(int assert, int flush, int cookie)
++{
++ gpio_set_value(FPGA_NCONFIG, assert);
++ return assert;
++}
++
++int fpga_done_fn(int cookie)
++{
++ int result = 0;
++ udelay(10);
++ PRINTF("CONF_DONE check ... ");
++ if (gpio_get_value(FPGA_CONF_DONE) & 1) {
++ PRINTF("high\n");
++ result = 1;
++ } else
++ PRINTF("low\n");
++
++ return result;
++}
++
++int fpga_status_fn(int cookie)
++{
++ int result = 0;
++ PRINTF("STATUS check ... ");
++ if (gpio_get_value(FPGA_NSTATUS) & 1) {
++ PRINTF("high\n");
++ result = 1;
++ } else
++ PRINTF("low\n");
++
++ return result;
++}
++
++int fpga_clk_fn(int assert_clk, int flush, int cookie)
++{
++ PRINTF("CLOCK %s\n", assert_clk ? "high" : "low");
++ gpio_set_value(FPGA_DCLK, assert_clk);
++
++ return assert_clk;
++}
++
++static inline int _write_fpga(u8 val, int dump)
++{
++ int i=0;
++ if (dump)
++ PRINTF(" %02x -> ", val);
++ for (i = 0; i < 8; i++) {
++ gpio_set_value(FPGA_DCLK,0);
++ gpio_set_value(FPGA_AS_DATA,val & 1);
++ gpio_set_value(FPGA_DCLK,1);
++ val >>= 1;
++ }
++ if (dump)
++ PRINTF("\n");
++
++ return 0;
++}
++
++int fpga_wr_fn(const void *buf, size_t len, int flush, int cookie)
++{
++ unsigned char *data = (unsigned char *) buf;
++ int i;
++
++ PRINTF("fpga_wr: buf %p / size %d\n", buf, len);
++ for (i = 0; i < len; i++)
++ _write_fpga(data[i], 0);
++ PRINTF("\n");
++
++ return FPGA_SUCCESS;
++}
++
++int APF6_init_fpga(u_char *buffer, size_t size)
++{
++ PRINTF("Initialize FPGA interface\n");
++
++ gpio_direction_output(FPGA_AS_DATA, 0);
++ gpio_direction_output(FPGA_DCLK, 0);
++ gpio_direction_output(FPGA_NCONFIG, 0);
++
++ fpga_init();
++ fpga_add(fpga_altera, &fpga);
++
++ if ((size >= fpga.size)) {
++ printf("Loading FPGA...");
++ if (FPGA_SUCCESS != fpga_load(0, (void *)buffer, size, BIT_FULL)) {
++ printf("firmware download failed!\n");
++ } else {
++ printf("firmware successfully programmed\n");
++ }
++ }
++
++ return 1;
++}
++
++
++#endif /* CONFIG_FPGA */
+Index: uboot-2014.07/board/armadeus/apf6/fpga.h
+===================================================================
+--- /dev/null 1970-01-01 01:00:00.000000000 +0100
++++ uboot-2014.07/board/armadeus/apf6/fpga.h 2014-10-22 15:38:49.145753388 +0200
+@@ -0,0 +1,34 @@
++/*
++ * (C) Copyright 2002-2010
++ * Eric Jarrige <eri...@ar...>
++ * Rich Ireland, Enterasys Networks, rir...@en....
++ * Keith Outwater, kei...@mv....
++ *
++ * 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
++ *
++ */
++extern int APF6_init_fpga(u_char *buffer, size_t size);
++
++extern int fpga_pgm_fn(int assert_pgm, int flush, int cookie);
++extern int fpga_status_fn(int cookie);
++extern int fpga_config_fn(int assert, int flush, int cookie);
++extern int fpga_done_fn(int cookie);
++extern int fpga_clk_fn(int assert_clk, int flush, int cookie);
++extern int fpga_wr_fn(const void *buf, size_t len, int flush, int cookie);
++extern int fpga_null_fn(int cookie);
hooks/post-receive
--
armadeus
|