[U-Boot-Users] [PATCH] add MPC8343 based board mvBlueLYNX-M7 aka mvblm7

MPC8343 based stereo camera system with Cyclone-II FPGA and miniPCI Slot. CPU utilizes dual 10/100/1000 Ethernet using Vitesse VSC8601 RGMII Phys and USB over ULPI. 512MB Micron DDR-II memory, 8MB Flash on LocalBus, SD over SPU and 32MB NAND @ FPGA.
Signed-off-by: Andre Schwarz andre.schwarz@matrix-vision.de --
diff --git a/CREDITS b/CREDITS index e84ef38..713f58a 100644 --- a/CREDITS +++ b/CREDITS @@ -424,6 +424,11 @@ N: Paolo Scaffardi E: arsenio@tin.it D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots more
+N: Andre Schwarz +E: andre.schwarz@matrix-vision.de +D: Support for BlueLYNX and BlueCOUGAR series +W: www.matrix-vision.com + N: Robert Schwebel E: r.schwebel@pengutronix.de D: Support for csb226, logodl and innokom boards (PXA2xx) diff --git a/MAKEALL b/MAKEALL index 2a872ac..f21c34e 100755 --- a/MAKEALL +++ b/MAKEALL @@ -327,6 +327,7 @@ LIST_83xx=" \ MPC8360ERDK_66 \ MPC837XEMDS \ MPC837XERDB \ + MVBLM7 \ sbc8349 \ TQM834x \ " diff --git a/Makefile b/Makefile index a7f886b..3f217fe 100644 --- a/Makefile +++ b/Makefile @@ -2084,6 +2084,9 @@ sbc8349_config: unconfig TQM834x_config: unconfig @$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x
+MVBLM7_config: unconfig + @$(MKCONFIG) $(@:_config=) ppc mpc83xx mvblm7 +
######################################################################### ## MPC85xx Systems diff --git a/board/mvblm7/Makefile b/board/mvblm7/Makefile new file mode 100644 index 0000000..84cd14a --- /dev/null +++ b/board/mvblm7/Makefile @@ -0,0 +1,48 @@ +# +# Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved. +# +# 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$(BOARD).a + +COBJS := $(BOARD).o pci.o fpga.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +######################################################################### + +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/mvblm7/config.mk b/board/mvblm7/config.mk new file mode 100644 index 0000000..a659203 --- /dev/null +++ b/board/mvblm7/config.mk @@ -0,0 +1,29 @@ +# +# Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved. +# +# 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 +# + +# +# MPC8349E-mITX and MPC8349E-mITX-GP +# + +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp + +TEXT_BASE = 0xFFF00000 diff --git a/board/mvblm7/fpga.c b/board/mvblm7/fpga.c new file mode 100644 index 0000000..d286ef1 --- /dev/null +++ b/board/mvblm7/fpga.c @@ -0,0 +1,185 @@ +/* + * (C) Copyright 2002 + * Rich Ireland, Enterasys Networks, rireland@enterasys.com. + * Keith Outwater, keith_outwater@mvis.com. + * + * (C) Copyright 2006 + * Andre Schwarz, Matrix Vision GmbH, andre.schwarz@matrix-vision.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 <ACEX1K.h> +#include <command.h> +#include "fpga.h" +#include "mvblm7.h" + +#if (CONFIG_FPGA) + +#ifdef FPGA_DEBUG +#define fpga_debug(fmt,args...) printf (fmt ,##args) +#else +#define fpga_debug(fmt,args...) +#endif + +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, + 0 +}; + +Altera_desc cyclone2 = { + Altera_CYC2, + passive_serial, + Altera_EP2C20_SIZE, + (void *) &altera_fns, + NULL, + 0 +}; + +int mvblm7_init_fpga (void) +{ + DECLARE_GLOBAL_DATA_PTR; + + fpga_debug("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n", + __FUNCTION__, __LINE__, gd->reloc_off); + fpga_init (gd->reloc_off); + + fpga_debug("%s:%d: Adding fpga 0\n", __FUNCTION__, __LINE__); + fpga_add (fpga_altera, &cyclone2); + return 1; +} + +int fpga_null_fn (int cookie) +{ + return 0; +} + +int fpga_config_fn (int assert, int flush, int cookie) +{ + volatile immap_t *im = (volatile immap_t *)CFG_IMMR; + volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0]; + + u32 dvo = gpio->dat; + fpga_debug("SET config : %s\n", assert ? "low" : "high"); + if ( assert ) + dvo |= FPGA_CONFIG; + else + dvo &= ~FPGA_CONFIG; + + if ( flush ) + gpio->dat = dvo; + return assert; +} + +int fpga_done_fn (int cookie) +{ + volatile immap_t *im = (volatile immap_t *)CFG_IMMR; + volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0]; + + udelay(10); + fpga_debug("CONF_DONE check ... "); + if ( gpio->dat & FPGA_CONF_DONE ) { + fpga_debug("high\n"); + return 1; + } else { + fpga_debug("low\n"); + return 0; + } +} + +int fpga_status_fn (int cookie) +{ + volatile immap_t *im = (volatile immap_t *)CFG_IMMR; + volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0]; + + fpga_debug("STATUS check ... "); + if ( gpio->dat & FPGA_STATUS ) { + fpga_debug("high\n"); + return 1; + } else { + fpga_debug("low\n"); + return 0; + } +} + +int fpga_clk_fn (int assert_clk, int flush, int cookie) +{ + volatile immap_t *im = (volatile immap_t *)CFG_IMMR; + volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0]; + + u32 dvo = gpio->dat; + fpga_debug("CLOCK %s\n", assert_clk ? "high" : "low"); + if ( assert_clk ) + dvo |= FPGA_CCLK; + else + dvo &= ~FPGA_CCLK; + + if ( flush ) + gpio->dat = dvo; + return assert_clk; +} + +static inline int _write_fpga( u8 val, int dump ) +{ + volatile immap_t *im = (volatile immap_t *)CFG_IMMR; + volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0]; + + u32 dvo = gpio->dat; + int i; + + if ( dump ) + fpga_debug( " %02x -> ", val ); + for ( i=0; i<8; i++ ) { + dvo &= ~FPGA_CCLK; + gpio->dat = dvo; + dvo &= ~FPGA_DIN; + if ( dump ) + fpga_debug("%d ", val&1); + if (val & 1) + dvo |= FPGA_DIN; + gpio->dat = dvo; + dvo |= FPGA_CCLK; + gpio->dat = dvo; + val >>= 1; + } + if ( dump ) + fpga_debug( "\n" ); + return 0; +} + +int fpga_wr_fn (void *buf, size_t len, int flush, int cookie) +{ + unsigned char *data = (unsigned char *) buf; + int i; + + fpga_debug( "fpga_wr: buf %p / size %d\n", buf, len ); + for ( i=0; i<len; i++ ) + _write_fpga( data[i], 0 ); + fpga_debug( "\n" ); + return FPGA_SUCCESS; +} +#endif diff --git a/board/mvblm7/fpga.h b/board/mvblm7/fpga.h new file mode 100644 index 0000000..e84ff06 --- /dev/null +++ b/board/mvblm7/fpga.h @@ -0,0 +1,34 @@ +/* + * (C) Copyright 2002 + * Rich Ireland, Enterasys Networks, rireland@enterasys.com. + * Keith Outwater, keith_outwater@mvis.com. + * + * 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 mvblm7_init_fpga(void); + +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 (void *buf, size_t len, int flush, int cookie); +extern int fpga_null_fn (int cookie); diff --git a/board/mvblm7/mvblm7.c b/board/mvblm7/mvblm7.c new file mode 100644 index 0000000..7e6b847 --- /dev/null +++ b/board/mvblm7/mvblm7.c @@ -0,0 +1,128 @@ +/* + * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved. + * + * 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 <ioports.h> +#include <mpc83xx.h> +#include <asm/mpc8349_pci.h> +#include <pci.h> +#include <asm/mmu.h> +#if defined(CONFIG_OF_LIBFDT) +#include <libfdt.h> +#endif + +#include "mvblm7.h" + +int fixed_sdram(void) +{ + volatile immap_t *im = (immap_t *)CFG_IMMR; + u32 msize = 0; + u32 ddr_size; + u32 ddr_size_log2; + + msize = CFG_DDR_SIZE; + for (ddr_size = msize << 20, ddr_size_log2 = 0; + (ddr_size > 1); + ddr_size = ddr_size>>1, ddr_size_log2++) { + if (ddr_size & 1) { + return -1; + } + } + im->sysconf.ddrlaw[0].bar = ((CFG_DDR_SDRAM_BASE>>12) & 0xfffff); + im->sysconf.ddrlaw[0].ar = LAWAR_EN | ((ddr_size_log2 - 1) & LAWAR_SIZE); + + im->ddr.csbnds[0].csbnds = CFG_DDR_CS0_BNDS; + im->ddr.cs_config[0] = CFG_DDR_CS0_CONFIG; + im->ddr.timing_cfg_0 = CFG_DDR_TIMING_0; + im->ddr.timing_cfg_1 = CFG_DDR_TIMING_1; + im->ddr.timing_cfg_2 = CFG_DDR_TIMING_2; + im->ddr.timing_cfg_3 = CFG_DDR_TIMING_3; + im->ddr.sdram_cfg = CFG_DDR_SDRAM_CFG; + im->ddr.sdram_cfg2 = CFG_DDR_SDRAM_CFG2; + im->ddr.sdram_mode = CFG_DDR_MODE; + im->ddr.sdram_interval = CFG_DDR_INTERVAL; + im->ddr.sdram_clk_cntl = CFG_DDR_CLK_CNTL; + + udelay(300); + + im->ddr.sdram_cfg |= SDRAM_CFG_MEM_EN; + + return CFG_DDR_SIZE; +} + +long int initdram(int board_type) +{ + volatile immap_t *im = (immap_t *) CFG_IMMR; + u32 msize = 0; + + if ((im->sysconf.immrbar & IMMRBAR_BASE_ADDR) != (u32) im) + return -1; + + im->sysconf.ddrlaw[0].bar = CFG_DDR_BASE & LAWBAR_BAR; + msize = fixed_sdram(); + + /* return total bus RAM size(bytes) */ + return msize * 1024 * 1024; +} + +int checkboard(void) +{ + puts("Board: Matrix Vision mvBlueLYNX-M7 " MV_VERSION "\n"); + return 0; +} + +u8 *dhcp_vendorex_prep (u8 * e) +{ + char *ptr; + +/* DHCP vendor-class-identifier = 60 */ + if ((ptr = getenv ("dhcp_vendor-class-identifier"))) { + *e++ = 60; + *e++ = strlen (ptr); + while (*ptr) + *e++ = *ptr++; + } +/* DHCP_CLIENT_IDENTIFIER = 61 */ + if ((ptr = getenv ("dhcp_client_id"))) { + *e++ = 61; + *e++ = strlen (ptr); + while (*ptr) + *e++ = *ptr++; + } + return e; +} + +u8 *dhcp_vendorex_proc (u8 * popt) +{ + return NULL; +} + +#if defined(CONFIG_OF_BOARD_SETUP) +void ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup(blob, bd); +#ifdef CONFIG_PCI + ft_pci_setup(blob, bd); +#endif +} + +#endif diff --git a/board/mvblm7/mvblm7.h b/board/mvblm7/mvblm7.h new file mode 100644 index 0000000..eb1d2a3 --- /dev/null +++ b/board/mvblm7/mvblm7.h @@ -0,0 +1,20 @@ +#ifndef __MVBC_H__ +#define __MVBC_H__ + +#define MV_GPIO + +#define FPGA_DIN 0x20000000 +#define FPGA_CCLK 0x40000000 +#define FPGA_CONF_DONE 0x08000000 +#define FPGA_CONFIG 0x80000000 +#define FPGA_STATUS 0x10000000 + +#define MAN_RST 0x00100000 +#define WD_TS 0x00200000 +#define WD_WDI 0x00400000 + +#define MV_GPIO_DAT (WD_TS) +#define MV_GPIO_OUT (FPGA_DIN|FPGA_CCLK|WD_TS|WD_WDI) +#define MV_GPIO_ODE (FPGA_CONFIG|MAN_RST) + +#endif diff --git a/board/mvblm7/mvblm7_autoscript b/board/mvblm7/mvblm7_autoscript new file mode 100644 index 0000000..8ebb4ca --- /dev/null +++ b/board/mvblm7/mvblm7_autoscript @@ -0,0 +1,38 @@ +echo +echo "==== running autoscript ====" +echo +setenv bootdtb bootm ${kernel_boot} ${mv_initrd_addr_ram} ${mv_dtb_addr_ram} +setenv ramkernel setenv kernel_boot ${mv_kernel_addr_ram} +setenv flashkernel setenv kernel_boot ${mv_kernel_addr} +setenv cpinitrd cp ${mv_initrd_addr} ${mv_initrd_addr_ram} ${mv_initrd_length} +setenv bootfromflash run flashkernel cpinitrd ramparam +setenv getdtb tftp ${mv_dtb_addr_ram} ${dtb_name} +setenv cpdtb cp ${mv_dtb_addr} ${mv_dtb_addr_ram} 0x2000 +setenv rundtb fdt addr ${mv_dtb_addr_ram};fdt boardsetup;fdt print +setenv bootfromnet tftp ${mv_initrd_addr_ram} ${initrd_name};run ramkernel +setenv addcons setenv bootargs ${bootargs} console=ttyS${console_nr},${baudrate}N8 +setenv set_static_ip setenv ipaddr ${static_ipaddr} +setenv set_static_nm setenv netmask ${static_netmask} +setenv set_static_gw setenv gatewayip ${static_gateway} +setenv set_ip setenv ip ${ipaddr}::${gatewayip}:${netmask} +setenv ramparam setenv bootargs root=/dev/ram ro rootfstype=squashfs +if test ${autoscr_boot} != no; +then + if test ${netboot} = yes; + then + bootp + if test $? = 0; + then + echo "=== bootp succeeded -> netboot ===" + run set_ip + run getdtb rundtb bootfromnet ramparam bootdtb + else + echo "=== netboot failed ===" + fi + fi + run set_static_ip set_static_nm set_static_gw set_ip + echo "=== bootfromflash ===" + run cpdtb rundtb bootfromflash +else + echo "=== boot stopped with autoscr_boot no ===" +fi diff --git a/board/mvblm7/pci.c b/board/mvblm7/pci.c new file mode 100644 index 0000000..3e85b91 --- /dev/null +++ b/board/mvblm7/pci.c @@ -0,0 +1,264 @@ +/* + * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved. + * + * 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/mmu.h> +#include <asm/global_data.h> +#include <pci.h> +#include <asm/mpc8349_pci.h> +#include <i2c.h> +#if defined(CONFIG_OF_LIBFDT) +#include <libfdt.h> +#include <fdt_support.h> +#endif +#include "mvblm7.h" + +DECLARE_GLOBAL_DATA_PTR; + +/* System RAM mapped to PCI space */ +#define CONFIG_PCI_SYS_MEM_BUS CFG_SDRAM_BASE +#define CONFIG_PCI_SYS_MEM_PHYS CFG_SDRAM_BASE + +#define SLOT0_IRQ 3 +#define SLOT1_IRQ 4 +void pci_mvblm7_fixup_irq (struct pci_controller *hose, pci_dev_t dev) +{ + unsigned char line = 0xff; + + if (PCI_BUS (dev) == 0) { + switch (PCI_DEV (dev)) { + case 0x0: + return; + case 0xb: + line = 0; + break; + case 0xc: + line = 1; + break; + default: + printf ("***pci_scan: illegal dev = 0x%08x\n", + PCI_DEV (dev)); + line = 0xff; + break; + } + pci_hose_write_config_byte (hose, dev, PCI_INTERRUPT_LINE, + line); + } +} + + +static struct pci_controller pci_hose = { + fixup_irq:pci_mvblm7_fixup_irq +}; + +int mvblm7_load_fpga(void) +{ + size_t data_size = 0; + void *fpga_data = NULL; + char *datastr = getenv ("fpgadata"); + char *sizestr = getenv ("fpgadatasize"); + + if (datastr) + fpga_data = (void *) simple_strtoul (datastr, NULL, 16); + if (sizestr) + data_size = (size_t) simple_strtoul (sizestr, NULL, 16); + return fpga_load (0, fpga_data, data_size); +} + +void pci_init_board(void) +{ + volatile immap_t *immr; + volatile gpio83xx_t *gpio; + volatile clk83xx_t *clk; + volatile law83xx_t *pci_law; + volatile pot83xx_t *pci_pot; + volatile pcictrl83xx_t *pci_ctrl; + volatile pciconf83xx_t *pci_conf; + u16 reg16; + u32 reg32; + u32 dev; + struct pci_controller *hose; + char *s; + + immr = (immap_t *) CFG_IMMR; + clk = (clk83xx_t *) & immr->clk; + pci_law = immr->sysconf.pcilaw; + pci_pot = immr->ios.pot; + pci_ctrl = immr->pci_ctrl; + pci_conf = immr->pci_conf; + gpio = (volatile gpio83xx_t *)&immr->gpio[0]; + hose = &pci_hose; + + gpio->dat = MV_GPIO_DAT; + gpio->odr = MV_GPIO_ODE; + gpio->dir = MV_GPIO_OUT; +#if defined(CONFIG_FPGA) + mvblm7_init_fpga(); + s = getenv("skip_fpga"); + if ( !s || *s == '0' ) + mvblm7_load_fpga(); +#endif + + /* + * Configure PCI controller and PCI_CLK_OUTPUT both in 66M mode + */ + + reg32 = clk->occr; + udelay(2000); + + clk->occr = 0xff000000; /* 66 MHz PCI */ + + udelay(2000); + + /* + * Release PCI RST Output signal + */ + pci_ctrl[0].gcr = 0; + udelay(2000); + pci_ctrl[0].gcr = 1; + + /* We need to wait at least a 1sec based on PCI specs */ + { + int i; + + for (i = 0; i < 1000; i++) + udelay(1000); + } + + /* + * Configure PCI Local Access Windows + */ + pci_law[0].bar = CFG_PCI1_MEM_PHYS & LAWBAR_BAR; + pci_law[0].ar = LAWAR_EN | LAWAR_SIZE_1G; + + pci_law[1].bar = CFG_PCI1_IO_PHYS & LAWBAR_BAR; + pci_law[1].ar = LAWAR_EN | LAWAR_SIZE_32M; + + /* + * Configure PCI Outbound Translation Windows + */ + + /* PCI1 mem space - prefetch */ + pci_pot[0].potar = (CFG_PCI1_MEM_BASE >> 12) & POTAR_TA_MASK; + pci_pot[0].pobar = (CFG_PCI1_MEM_PHYS >> 12) & POBAR_BA_MASK; + pci_pot[0].pocmr = POCMR_EN | POCMR_PREFETCH_EN | POCMR_CM_256M; + + /* PCI1 IO space */ + pci_pot[1].potar = (CFG_PCI1_IO_BASE >> 12) & POTAR_TA_MASK; + pci_pot[1].pobar = (CFG_PCI1_IO_PHYS >> 12) & POBAR_BA_MASK; + pci_pot[1].pocmr = POCMR_EN | POCMR_IO | POCMR_CM_16M; + + /* PCI1 mmio - non-prefetch mem space */ + pci_pot[2].potar = (CFG_PCI1_MMIO_BASE >> 12) & POTAR_TA_MASK; + pci_pot[2].pobar = (CFG_PCI1_MMIO_PHYS >> 12) & POBAR_BA_MASK; + pci_pot[2].pocmr = POCMR_EN | POCMR_CM_256M; + + /* + * Configure PCI Inbound Translation Windows + */ + + /* we need RAM mapped to PCI space for the devices to + * access main memory */ + pci_ctrl[0].pitar1 = 0x0; + pci_ctrl[0].pibar1 = 0x0; + pci_ctrl[0].piebar1 = 0x0; + pci_ctrl[0].piwar1 = PIWAR_EN | PIWAR_PF | PIWAR_RTT_SNOOP | + PIWAR_WTT_SNOOP | (__ilog2(gd->ram_size) - 1); + + hose->first_busno = 0; + hose->last_busno = 0xff; + + /* PCI memory prefetch space */ + pci_set_region(hose->regions + 0, + CFG_PCI1_MEM_BASE, + CFG_PCI1_MEM_PHYS, + CFG_PCI1_MEM_SIZE, PCI_REGION_MEM | PCI_REGION_PREFETCH); + + /* PCI memory space */ + pci_set_region(hose->regions + 1, + CFG_PCI1_MMIO_BASE, + CFG_PCI1_MMIO_PHYS, CFG_PCI1_MMIO_SIZE, PCI_REGION_MEM); + + /* PCI IO space */ + pci_set_region(hose->regions + 2, + CFG_PCI1_IO_BASE, + CFG_PCI1_IO_PHYS, CFG_PCI1_IO_SIZE, PCI_REGION_IO); + + /* System memory space */ + pci_set_region(hose->regions + 3, + CONFIG_PCI_SYS_MEM_BUS, + CONFIG_PCI_SYS_MEM_PHYS, + gd->ram_size, PCI_REGION_MEM | PCI_REGION_MEMORY); + + hose->region_count = 4; + + pci_setup_indirect(hose, + (CFG_IMMR + 0x8300), (CFG_IMMR + 0x8304)); + + pci_register_hose(hose); + + /* + * Write to Command register + */ + reg16 = 0xff; + dev = PCI_BDF(hose->first_busno, 0, 0); + pci_hose_read_config_word(hose, dev, PCI_COMMAND, ®16); + reg16 |= PCI_COMMAND_SERR | PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; + pci_hose_write_config_word(hose, dev, PCI_COMMAND, reg16); + + /* + * Clear non-reserved bits in status register. + */ + pci_hose_write_config_word(hose, dev, PCI_STATUS, 0xffff); + pci_hose_write_config_byte(hose, dev, PCI_LATENCY_TIMER, 0x80); + pci_hose_write_config_byte(hose, dev, PCI_CACHE_LINE_SIZE, 0x08); + +#ifdef CONFIG_PCI_SCAN_SHOW + printf("PCI: Bus Dev VenId DevId Class Int\n"); +#endif + hose->last_busno = pci_hose_scan(hose); +} + +#if defined(CONFIG_OF_LIBFDT) +void ft_pci_setup(void *blob, bd_t *bd) +{ + int nodeoffset; + int tmp[2]; + const char *path; + + nodeoffset = fdt_path_offset(blob, "/aliases"); + if (nodeoffset >= 0) { + path = fdt_getprop(blob, nodeoffset, "pci0", NULL); + if (path) { + tmp[0] = cpu_to_be32(pci_hose.first_busno); + tmp[1] = cpu_to_be32(pci_hose.last_busno); + do_fixup_by_path(blob, path, "bus-range", + &tmp, sizeof(tmp), 1); + + tmp[0] = cpu_to_be32(gd->pci_clk); + do_fixup_by_path(blob, path, "clock-frequency", + &tmp, sizeof(tmp[0]), 1); + } + } +} +#endif diff --git a/include/configs/MVBLM7.h b/include/configs/MVBLM7.h new file mode 100644 index 0000000..d56bf11 --- /dev/null +++ b/include/configs/MVBLM7.h @@ -0,0 +1,467 @@ +/* + * Copyright (C) Matrix Vision GmbH 2008 + * + * based on Freescale's MPC8349ITX. + * + * 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 __CONFIG_H +#define __CONFIG_H + +#define MV_VERSION "v0.7.0" + +/* + * High Level Configuration Options + */ +#define CONFIG_E300 1 +#define CONFIG_MPC83XX 1 +#define CONFIG_MPC834X 1 +#define CONFIG_MPC8343 1 + +#define CFG_IMMR 0xE0000000 + +#define CONFIG_PCI +#define CONFIG_PCI_SKIP_HOST_BRIDGE +#define CONFIG_HARD_I2C +#define CONFIG_TSEC_ENET +#define CONFIG_MPC8XXX_SPI +#define CONFIG_HARD_SPI + +/* I2C */ +#define CONFIG_FSL_I2C +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_I2C_CMD_TREE +#define CFG_I2C_OFFSET 0x3000 +#define CFG_I2C2_OFFSET 0x3100 + +#define CFG_I2C_EEPROM_ADDR 0x50 + +#define CFG_I2C_SPEED 100000 +#define CFG_I2C_SLAVE 0x7F + +/* + * DDR Setup + */ +#define CFG_DDR_BASE 0x00000000 +#define CFG_SDRAM_BASE CFG_DDR_BASE +#define CFG_DDR_SDRAM_BASE CFG_DDR_BASE +#define CFG_83XX_DDR_USES_CS0 1 +#define CFG_MEMTEST_START 0x100000 +#define CFG_MEMTEST_END 0x800000 + +#define CFG_DDR_SDRAM_CLK_CNTL (DDR_SDRAM_CLK_CNTL_SS_EN | \ + DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05 + +#define CFG_DDR_SIZE 512 + +/* HC, 75Ohm, DDR-II, DRQ */ +#define CFG_DDRCDR 0x80000001 +/* EN, ODT_WR, 3BA, 14row, 10col */ +#define CFG_DDR_CS0_CONFIG 0x80014202 +#define CFG_DDR_CS1_CONFIG 0x0 +#define CFG_DDR_CS2_CONFIG 0x0 +#define CFG_DDR_CS3_CONFIG 0x0 + +/* 512MByte */ +#define CFG_DDR_CS0_BNDS 0x0000001f +#define CFG_DDR_CS1_BNDS 0x0 +#define CFG_DDR_CS2_BNDS 0x0 +#define CFG_DDR_CS3_BNDS 0x0 + +#define CFG_DDR_CLK_CNTL 0x02000000 + +#define CFG_DDR_TIMING_0 0x00260802 +#define CFG_DDR_TIMING_1 0x2625b221 +#define CFG_DDR_TIMING_2 0x1f9820c7 +#define CFG_DDR_TIMING_3 0x00000000 + +/* ~MEM_EN, SREN, DDR-II, 32_BE */ +#define CFG_DDR_SDRAM_CFG 0x43080000 +#define CFG_DDR_SDRAM_CFG2 0x00401000 +#define CFG_DDR_INTERVAL 0x04060100 + +#define CFG_DDR_MODE 0x078e0232 + +/* Flash */ +#define CFG_FLASH_CFI +#define CFG_FLASH_CFI_DRIVER +#define CFG_FLASH_CFI_WIDTH FLASH_CFI_16BIT + +#define CFG_FLASH_BASE 0xFF800000 +#define CFG_FLASH_SIZE 8 +#define CFG_FLASH_SIZE_SHIFT 3 +#define CFG_FLASH_EMPTY_INFO +#define CFG_FLASH_ERASE_TOUT 60000 +#define CFG_FLASH_WRITE_TOUT 500 +#define CFG_MAX_FLASH_BANKS 1 +#define CFG_MAX_FLASH_SECT 256 + +#define CFG_BR0_PRELIM (CFG_FLASH_BASE | BR_PS_16 | BR_V) +#define CFG_OR0_PRELIM ((~(CFG_FLASH_SIZE - 1) << 20) | OR_UPM_XAM | \ + OR_GPCM_CSNT | OR_GPCM_ACS_0b11 | OR_GPCM_XACS | OR_GPCM_SCY_15 | \ + OR_GPCM_TRLX | OR_GPCM_EHTR | OR_GPCM_EAD) +#define CFG_LBLAWBAR0_PRELIM CFG_FLASH_BASE +#define CFG_LBLAWAR0_PRELIM (LBLAWAR_EN | (0x13 + CFG_FLASH_SIZE_SHIFT)) + +/* + * U-Boot memory configuration + */ +#define CFG_MONITOR_BASE TEXT_BASE +#undef CFG_RAMBOOT + +#define CONFIG_L1_INIT_RAM +#define CFG_INIT_RAM_LOCK +#define CFG_INIT_RAM_ADDR 0xFD000000 /* Initial RAM address */ +#define CFG_INIT_RAM_END 0x1000 /* End of used area in RAM*/ + +#define CFG_GBL_DATA_SIZE 0x100 /* num bytes initial data */ +#define CFG_GBL_DATA_OFFSET (CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE) +#define CFG_INIT_SP_OFFSET CFG_GBL_DATA_OFFSET + +/* CFG_MONITOR_LEN must be a multiple of CFG_ENV_SECT_SIZE */ +#define CFG_MONITOR_LEN (512 * 1024) +#define CFG_MALLOC_LEN (512 * 1024) + +/* + * Local Bus LCRR and LBCR regs + * LCRR: DLL bypass, Clock divider is 4 + * External Local Bus rate is + * CLKIN * HRCWL_CSB_TO_CLKIN / HRCWL_LCL_BUS_TO_SCB_CLK / LCRR_CLKDIV + */ +#define CFG_LCRR (LCRR_DBYP | LCRR_CLKDIV_4) +#define CFG_LBC_LBCR 0x00000000 + +#define CFG_LBC_LSRT 0x32000000 /* LB sdram refresh timer, about 6us */ +#define CFG_LBC_MRTPR 0x20000000 /* LB refresh timer prescal, 266MHz/32*/ + +/* + * Serial Port + */ +#define CONFIG_CONS_INDEX 1 +#undef CONFIG_SERIAL_SOFTWARE_FIFO +#define CFG_NS16550 +#define CFG_NS16550_SERIAL +#define CFG_NS16550_REG_SIZE 1 +#define CFG_NS16550_CLK get_bus_freq(0) + +#define CFG_BAUDRATE_TABLE \ + {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 115200} + +#define CONFIG_CONSOLE ttyS0 +#define CONFIG_BAUDRATE 115200 + +#define CFG_NS16550_COM1 (CFG_IMMR + 0x4500) +#define CFG_NS16550_COM2 (CFG_IMMR + 0x4600) + +/* pass open firmware flat tree */ +#define CONFIG_OF_LIBFDT 1 +#define CONFIG_OF_BOARD_SETUP 1 +#define CONFIG_OF_STDOUT_VIA_ALIAS 1 +#define MV_DTB_NAME "mvblm7.dtb" + +/* + * PCI + */ +#define CFG_PCI1_MEM_BASE 0x80000000 +#define CFG_PCI1_MEM_PHYS CFG_PCI1_MEM_BASE +#define CFG_PCI1_MEM_SIZE 0x10000000 +#define CFG_PCI1_MMIO_BASE (CFG_PCI1_MEM_BASE + CFG_PCI1_MEM_SIZE) +#define CFG_PCI1_MMIO_PHYS CFG_PCI1_MMIO_BASE +#define CFG_PCI1_MMIO_SIZE 0x10000000 +#define CFG_PCI1_IO_BASE 0x00000000 +#define CFG_PCI1_IO_PHYS 0xE2000000 +#define CFG_PCI1_IO_SIZE 0x01000000 + +#define _IO_BASE 0x00000000 + +#define CONFIG_NET_MULTI 1 +#define CONFIG_NET_RETRY_COUNT 3 +#define CONFIG_PCI_PNP + +#define CONFIG_PCI_SCAN_SHOW + +#define PCI_66M +#define CONFIG_83XX_CLKIN 66666666 /* in Hz */ + +/* TSEC */ +#define CONFIG_GMII +#define CFG_VSC8601_SKEWFIX + +#define CONFIG_TSEC1 +#define CONFIG_TSEC2 + +#define CONFIG_HAS_ETH0 +#define CONFIG_ETHADDR B6:B4:45:EB:FB:C0 +#define CONFIG_TSEC1_NAME "TSEC0" +#define CONFIG_FEC1_PHY_NORXERR +#define CFG_TSEC1_OFFSET 0x24000 +#define CFG_TSEC1 (CFG_IMMR+CFG_TSEC1_OFFSET) +#define TSEC1_PHY_ADDR 0x10 +#define TSEC1_PHYIDX 0 +#define TSEC1_FLAGS (TSEC_GIGABIT|TSEC_REDUCED) + +#define CONFIG_HAS_ETH1 +#define CONFIG_ETH1ADDR B6:B4:45:EB:FB:C2 +#define CONFIG_TSEC2_NAME "TSEC1" +#define CONFIG_FEC2_PHY_NORXERR +#define CFG_TSEC2_OFFSET 0x25000 +#define CFG_TSEC2 (CFG_IMMR+CFG_TSEC2_OFFSET) +#define TSEC2_PHY_ADDR 0x11 +#define TSEC2_PHYIDX 0 +#define TSEC2_FLAGS (TSEC_GIGABIT|TSEC_REDUCED) + +#define CONFIG_ETHPRIME "TSEC0" + +#define CONFIG_BOOTP_VENDOREX +#define CONFIG_BOOTP_SUBNETMASK +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_DNS +#define CONFIG_BOOTP_DNS2 +#define CONFIG_BOOTP_HOSTNAME +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_NTPSERVER +#define CONFIG_BOOTP_RANDOM_DELAY +#define CONFIG_BOOTP_SEND_HOSTNAME + +/* + * Environment + */ +#undef CFG_FLASH_PROTECTION +#define CONFIG_ENV_OVERWRITE + +#define CFG_ENV_IS_IN_FLASH 1 +#define CFG_ENV_ADDR 0xFF800000 +#define CFG_ENV_SIZE 0x2000 +#define CFG_ENV_SECT_SIZE 0x2000 +#define CFG_ENV_ADDR_REDUND (CFG_ENV_ADDR+CFG_ENV_SIZE) +#define CFG_ENV_SIZE_REDUND CFG_ENV_SIZE + +#define CONFIG_LOADS_ECHO +#define CFG_LOADS_BAUD_CHANGE + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> + +#define CONFIG_CMD_CACHE +#define CONFIG_CMD_IRQ +#define CONFIG_CMD_NET +#define CONFIG_CMD_MII +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_SDRAM +#define CONFIG_CMD_PCI +#define CONFIG_CMD_I2C +#define CONFIG_CMD_FPGA + +#undef CONFIG_WATCHDOG + +/* + * Miscellaneous configurable options + */ +#define CFG_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CFG_HUSH_PARSER +#define CFG_PROMPT_HUSH_PS2 "> " + +#define CFG_LOAD_ADDR 0x2000000 /* default load address */ +#define CONFIG_LOADADDR 200000 /* default location for tftp and bootm */ + +#define CFG_PROMPT "mvBL-M7> " + +#if defined(CONFIG_CMD_KGDB) + #define CFG_CBSIZE 1024 +#else + #define CFG_CBSIZE 256 +#endif + +#define CFG_PBSIZE (CFG_CBSIZE + sizeof(CFG_PROMPT) + 16) /* Print Buffer Size */ +#define CFG_MAXARGS 16 /* max number of command args */ +#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */ +#define CFG_HZ 1000 /* decrementer freq: 1ms ticks */ + +/* + * For booting Linux, the board info and command line data + * have to be in the first 8 MB of memory, since this is + * the maximum mapped by the Linux kernel during initialization. + */ +#define CFG_BOOTMAPSZ (8 << 20) /* Initial Memory map for Linux*/ + +#define CFG_HRCW_LOW 0x0 +#define CFG_HRCW_HIGH 0x0 + +/* + * System performance + */ +#define CFG_ACR_PIPE_DEP 3 /* Arbiter pipeline depth (0-3) */ +#define CFG_ACR_RPTCNT 3 /* Arbiter repeat count (0-7) */ +#define CFG_SPCR_TSEC1EP 3 /* TSEC1 emergency priority (0-3) */ +#define CFG_SPCR_TSEC2EP 3 /* TSEC2 emergency priority (0-3) */ +#define CFG_SCCR_TSEC1CM 1 /* TSEC1 clock mode (0-3) */ +#define CFG_SCCR_TSEC2CM 1 /* TSEC2 & I2C0 clock mode (0-3) */ + +/* + * System IO Config + */ +#define CFG_SICRH SICRH_TSOBI1 /* Needed for gigabit to work on TSEC 1 */ +#define CFG_SICRL (SICRL_LDP_A | SICRL_USB1) + +#define CFG_HID0_INIT 0x000000000 +#define CFG_HID0_FINAL CFG_HID0_INIT + +#define CFG_HID2 HID2_HBE + +/* DDR */ +#define CFG_IBAT0L (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE) +#define CFG_IBAT0U (CFG_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP) +#define CFG_IBAT7L ((CFG_SDRAM_BASE + (256<<20)) | BATL_PP_10 | BATL_MEMCOHERENCE) +#define CFG_IBAT7U ((CFG_SDRAM_BASE + (256<<20)) | BATU_BL_256M | BATU_VS | BATU_VP) + +/* PCI */ +#define CFG_IBAT1L (CFG_PCI1_MEM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE) +#define CFG_IBAT1U (CFG_PCI1_MEM_BASE | BATU_BL_256M | BATU_VS | BATU_VP) +#define CFG_IBAT2L (CFG_PCI1_MMIO_BASE | BATL_PP_10 | BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE) +#define CFG_IBAT2U (CFG_PCI1_MMIO_BASE | BATU_BL_256M | BATU_VS | BATU_VP) + +/* no PCI2 */ +#define CFG_IBAT3L 0 +#define CFG_IBAT3U 0 +#define CFG_IBAT4L 0 +#define CFG_IBAT4U 0 + +/* IMMRBAR @ 0xE0000000, PCI IO @ 0xE2000000 & BCSR @ 0xE2400000 */ +#define CFG_IBAT5L (CFG_IMMR | BATL_PP_10 | BATL_CACHEINHIBIT | BATL_GUARDEDSTORAGE) +#define CFG_IBAT5U (CFG_IMMR | BATU_BL_256M | BATU_VS | BATU_VP) + +/* stack in DCACHE 0xFDF00000 & FLASH @ 0xFF800000 */ +#define CFG_IBAT6L (0xF0000000 | BATL_PP_10 | BATL_MEMCOHERENCE) +#define CFG_IBAT6U (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP) + +#define CFG_DBAT0L CFG_IBAT0L +#define CFG_DBAT0U CFG_IBAT0U +#define CFG_DBAT1L CFG_IBAT1L +#define CFG_DBAT1U CFG_IBAT1U +#define CFG_DBAT2L CFG_IBAT2L +#define CFG_DBAT2U CFG_IBAT2U +#define CFG_DBAT3L CFG_IBAT3L +#define CFG_DBAT3U CFG_IBAT3U +#define CFG_DBAT4L CFG_IBAT4L +#define CFG_DBAT4U CFG_IBAT4U +#define CFG_DBAT5L CFG_IBAT5L +#define CFG_DBAT5U CFG_IBAT5U +#define CFG_DBAT6L CFG_IBAT6L +#define CFG_DBAT6U CFG_IBAT6U +#define CFG_DBAT7L CFG_IBAT7L +#define CFG_DBAT7U CFG_IBAT7U + +/* + * Internal Definitions + * + * Boot Flags + */ +#define BOOTFLAG_COLD 0x01 /* Normal Power-On: Boot from FLASH */ +#define BOOTFLAG_WARM 0x02 /* Software reboot */ + + +/* + * Environment Configuration + */ +#define CONFIG_ENV_OVERWRITE + +#define CONFIG_NETDEV eth0 + +/* Default path and filenames */ +#define CONFIG_BOOTDELAY 5 +#define CONFIG_AUTOBOOT_KEYED +#define CONFIG_AUTOBOOT_STOP_STR "s" +#define CONFIG_ZERO_BOOTDELAY_CHECK +#define CONFIG_RESET_TO_RETRY 1000 + +#define MV_CI "mvBlueLYNX-M7" +#define MV_VCI "mvBlueLYNX-M7" +#define MV_FPGA_DATA "0xfff80000" +#define MV_FPGA_SIZE "0x76ca2" +#define MV_KERNEL_ADDR "0xff810000" +#define MV_INITRD_ADDR "0xffc00000" +#define MV_AUTOSCR_ADDR "0xff804000" +#define MV_AUTOSCR_ADDR2 "0xff806000" +#define MV_DTB_ADDR "0xff808000" +#define MV_INITRD_LENGTH "0x00300000" + +#define CONFIG_SHOW_BOOT_PROGRESS 1 + +#define MV_KERNEL_ADDR_RAM "0x00100000" +#define MV_DTB_ADDR_RAM "0x00600000" +#define MV_INITRD_ADDR_RAM "0x01000000" + +#define CONFIG_BOOTCOMMAND "if imi ${autoscr_addr}; then autoscr ${autoscr_addr}; else autoscr ${autoscr_addr2}; fi;" +#define CONFIG_BOOTARGS "root=/dev/ram ro rootfstype=squashfs" + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "console_nr=0\0" \ + "stdin=serial\0" \ + "stdout=serial\0" \ + "stderr=serial\0" \ + "fpga=0\0" \ + "fpgadata=" MV_FPGA_DATA "\0" \ + "fpgadatasize=" MV_FPGA_SIZE "\0" \ + "autoscr_addr=" MV_AUTOSCR_ADDR "\0" \ + "autoscr_addr2=" MV_AUTOSCR_ADDR2 "\0" \ + "mv_kernel_addr=" MV_KERNEL_ADDR "\0" \ + "mv_kernel_addr_ram=" MV_KERNEL_ADDR_RAM "\0" \ + "mv_initrd_addr=" MV_INITRD_ADDR "\0" \ + "mv_initrd_addr_ram=" MV_INITRD_ADDR_RAM "\0" \ + "mv_initrd_length=" MV_INITRD_LENGTH "\0" \ + "mv_dtb_addr=" MV_DTB_ADDR "\0" \ + "mv_dtb_addr_ram=" MV_DTB_ADDR_RAM "\0" \ + "dtb_name=" MV_DTB_NAME "\0" \ + "mv_version=" MV_VERSION "\0" \ + "dhcp_client_id=" MV_CI "\0" \ + "dhcp_vendor-class-identifier=" MV_VCI "\0" \ + "netretry=no\0" \ + "use_static_ipaddr=no\0" \ + "static_ipaddr=192.168.90.10\0" \ + "static_netmask=255.255.255.0\0" \ + "static_gateway=0.0.0.0\0" \ + "initrd_name=uInitrd.mvbc-1G-rfs\0" \ + "zcip=no\0" \ + "netboot=no\0" \ + "mvtest=Ff\0" \ + "tried_bootfromflash=no\0" \ + "tried_bootfromnet=no\0" \ + "bootfile=mvblm72625.boot\0" \ + "use_dhcp=no\0" \ + "gev_start=no\0" \ + "mvbcdma_debug=0\0" \ + "mvbcia_debug=0\0" \ + "propdev_debug=0\0" \ + "gevss_debug=0\0" \ + "watchdog=0\0" \ + "skip_fpga=0\0" \ + "" +#define CONFIG_FPGA_COUNT 1 +#define CONFIG_FPGA CFG_ALTERA_CYCLON2 +#define CONFIG_FPGA_ALTERA +#define CONFIG_FPGA_CYCLON2 + +#endif
MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler - Registergericht: Amtsgericht Stuttgart, HRB 271090 Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

On Wed, 09 Apr 2008 16:16:28 +0200 Andre Schwarz andre.schwarz@matrix-vision.de wrote:
MPC8343 based stereo camera system with Cyclone-II FPGA and miniPCI Slot. CPU utilizes dual 10/100/1000 Ethernet using Vitesse VSC8601 RGMII Phys and USB over ULPI. 512MB Micron DDR-II memory, 8MB Flash on LocalBus, SD over SPU and 32MB NAND @ FPGA.
Signed-off-by: Andre Schwarz andre.schwarz@matrix-vision.de
Wolfgang, I believe the window for new board support is closed; would you rather I maintain this on a "next" branch on mpc83xx, or are you willing to let this in for 1.3.3?
Andre, thanks for the new board contribution - please include diffstats in your patches.
diff --git a/CREDITS b/CREDITS index e84ef38..713f58a 100644 --- a/CREDITS +++ b/CREDITS @@ -424,6 +424,11 @@ N: Paolo Scaffardi E: arsenio@tin.it D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots more
+N: Andre Schwarz +E: andre.schwarz@matrix-vision.de +D: Support for BlueLYNX and BlueCOUGAR series +W: www.matrix-vision.com
N: Robert Schwebel E: r.schwebel@pengutronix.de D: Support for csb226, logodl and innokom boards (PXA2xx) diff --git a/MAKEALL b/MAKEALL index 2a872ac..f21c34e 100755 --- a/MAKEALL +++ b/MAKEALL @@ -327,6 +327,7 @@ LIST_83xx=" \ MPC8360ERDK_66 \ MPC837XEMDS \ MPC837XERDB \
- MVBLM7 \ sbc8349 \ TQM834x \
" diff --git a/Makefile b/Makefile index a7f886b..3f217fe 100644 --- a/Makefile +++ b/Makefile @@ -2084,6 +2084,9 @@ sbc8349_config: unconfig TQM834x_config: unconfig @$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x
+MVBLM7_config: unconfig
- @$(MKCONFIG) $(@:_config=) ppc mpc83xx mvblm7
I believe intra-family targets are kept in alpha order in the Makefile (as you did in MAKEALL).
please add a MAINTAINERS entry. A doc/README.mvblm7 would be nice.
<snip>
diff --git a/board/mvblm7/config.mk b/board/mvblm7/config.mk new file mode 100644 index 0000000..a659203 --- /dev/null +++ b/board/mvblm7/config.mk
<snip>
+# +# MPC8349E-mITX and MPC8349E-mITX-GP +#
I'd leave this out :)
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+TEXT_BASE = 0xFFF00000 diff --git a/board/mvblm7/fpga.c b/board/mvblm7/fpga.c new file mode 100644 index 0000000..d286ef1 --- /dev/null +++ b/board/mvblm7/fpga.c
<snip>
+#if (CONFIG_FPGA)
#if defined?
<snip>
+int mvblm7_init_fpga (void)
we don't put spaces between function name and open parenthesis, do we?
All your functions are like this.
+{
- DECLARE_GLOBAL_DATA_PTR;
this needs to be put somewhere global.
- fpga_debug("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n",
__FUNCTION__, __LINE__, gd->reloc_off);
- fpga_init (gd->reloc_off);
- fpga_debug("%s:%d: Adding fpga 0\n", __FUNCTION__, __LINE__);
- fpga_add (fpga_altera, &cyclone2);
- return 1;
+}
+int fpga_null_fn (int cookie) +{
return 0;
+}
+int fpga_config_fn (int assert, int flush, int cookie) +{
volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
fix indentation; use tabs, not spaces.
- u32 dvo = gpio->dat;
keep declarations together, leave blank space between declarations and code - i.e, mv above blank line to before this line:
- fpga_debug("SET config : %s\n", assert ? "low" : "high");
- if ( assert )
no spaces around assert
dvo |= FPGA_CONFIG;
- else
dvo &= ~FPGA_CONFIG;
- if ( flush )
gpio->dat = dvo;
- return assert;
can you also get in the habit of leaving blank lines before return statements? thanks.
<snipped more code that gets above comments also>
- for ( i=0; i<8; i++ ) {
please read CodingStyle! this should look like:
for (i = 0; i < 8; i++) {
<snip similar cases>
diff --git a/board/mvblm7/mvblm7.c b/board/mvblm7/mvblm7.c
<snip>
im->ddr.sdram_interval = CFG_DDR_INTERVAL;
im->ddr.sdram_clk_cntl = CFG_DDR_CLK_CNTL;
use tabs, not spaces.
<snip>
+u8 *dhcp_vendorex_prep (u8 * e)
u8 *dhcp_vendorex_prep(u8 *e)
+{
- char *ptr;
+/* DHCP vendor-class-identifier = 60 */
- if ((ptr = getenv ("dhcp_vendor-class-identifier"))) {
fix indentation. Use tabs, not spaces.
*e++ = 60;
*e++ = strlen (ptr);
strlen(ptr);
while (*ptr)
*e++ = *ptr++;
- }
+/* DHCP_CLIENT_IDENTIFIER = 61 */
- if ((ptr = getenv ("dhcp_client_id"))) {
..
<snip>
diff --git a/board/mvblm7/pci.c b/board/mvblm7/pci.c
<sniiiiip>
tmp[0] = cpu_to_be32(gd->pci_clk);
do_fixup_by_path(blob, path, "clock-frequency",
&tmp, sizeof(tmp[0]), 1);
}
- }
+} +#endif
please use generic 83xx pci code (cpu/mpc83xx/pci.c). See the mpc8313erdb board implementation for an example use-case.
Again, thanks for your contribution!
Kim

Dear Kim,
in message 20080410111158.e7379fe3.kim.phillips@freescale.com you wrote:
Wolfgang, I believe the window for new board support is closed; would
Correct.
you rather I maintain this on a "next" branch on mpc83xx, or are you willing to let this in for 1.3.3?
It's all new stuff, so it should go to "next".
Thanks.
Best regards,
Wolfgang Denk

Wolfgang,
that's absolutely fine since there are some open issues regarding docs and coding style. I didn't dare to believe getting the board in in the first run anyway ;-)
Sometimes the rules are a bit annoying - but they are definitely necessary !
Cheers, André
Wolfgang Denk wrote:
Dear Kim,
in message 20080410111158.e7379fe3.kim.phillips@freescale.com you wrote:
Wolfgang, I believe the window for new board support is closed; would
Correct.
you rather I maintain this on a "next" branch on mpc83xx, or are you willing to let this in for 1.3.3?
It's all new stuff, so it should go to "next".
Thanks.
Best regards,
Wolfgang Denk
MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler - Registergericht: Amtsgericht Stuttgart, HRB 271090 Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner

Kim,
I'll fix all your issues mentioned below in the next days. We're not in a hurry. Getting the board into 1.3.3 is absolutely fine.
Thanks, André
Kim Phillips wrote:
On Wed, 09 Apr 2008 16:16:28 +0200 Andre Schwarz andre.schwarz@matrix-vision.de wrote:
MPC8343 based stereo camera system with Cyclone-II FPGA and miniPCI Slot. CPU utilizes dual 10/100/1000 Ethernet using Vitesse VSC8601 RGMII Phys and USB over ULPI. 512MB Micron DDR-II memory, 8MB Flash on LocalBus, SD over SPU and 32MB NAND @ FPGA.
Signed-off-by: Andre Schwarz andre.schwarz@matrix-vision.de
Wolfgang, I believe the window for new board support is closed; would you rather I maintain this on a "next" branch on mpc83xx, or are you willing to let this in for 1.3.3?
Andre, thanks for the new board contribution - please include diffstats in your patches.
diff --git a/CREDITS b/CREDITS index e84ef38..713f58a 100644 --- a/CREDITS +++ b/CREDITS @@ -424,6 +424,11 @@ N: Paolo Scaffardi E: arsenio@tin.it D: FADS823 configuration, MPC823 video support, I2C, wireless keyboard, lots more
+N: Andre Schwarz +E: andre.schwarz@matrix-vision.de +D: Support for BlueLYNX and BlueCOUGAR series +W: www.matrix-vision.com
N: Robert Schwebel E: r.schwebel@pengutronix.de D: Support for csb226, logodl and innokom boards (PXA2xx) diff --git a/MAKEALL b/MAKEALL index 2a872ac..f21c34e 100755 --- a/MAKEALL +++ b/MAKEALL @@ -327,6 +327,7 @@ LIST_83xx=" \ MPC8360ERDK_66 \ MPC837XEMDS \ MPC837XERDB \
- MVBLM7 \ sbc8349 \ TQM834x \
" diff --git a/Makefile b/Makefile index a7f886b..3f217fe 100644 --- a/Makefile +++ b/Makefile @@ -2084,6 +2084,9 @@ sbc8349_config: unconfig TQM834x_config: unconfig @$(MKCONFIG) $(@:_config=) ppc mpc83xx tqm834x
+MVBLM7_config: unconfig
- @$(MKCONFIG) $(@:_config=) ppc mpc83xx mvblm7
I believe intra-family targets are kept in alpha order in the Makefile (as you did in MAKEALL).
please add a MAINTAINERS entry. A doc/README.mvblm7 would be nice.
<snip>
diff --git a/board/mvblm7/config.mk b/board/mvblm7/config.mk new file mode 100644 index 0000000..a659203 --- /dev/null +++ b/board/mvblm7/config.mk
<snip>
+# +# MPC8349E-mITX and MPC8349E-mITX-GP +#
I'd leave this out :)
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+TEXT_BASE = 0xFFF00000 diff --git a/board/mvblm7/fpga.c b/board/mvblm7/fpga.c new file mode 100644 index 0000000..d286ef1 --- /dev/null +++ b/board/mvblm7/fpga.c
<snip>
+#if (CONFIG_FPGA)
#if defined?
<snip>
+int mvblm7_init_fpga (void)
we don't put spaces between function name and open parenthesis, do we?
All your functions are like this.
+{
- DECLARE_GLOBAL_DATA_PTR;
this needs to be put somewhere global.
- fpga_debug("%s:%d: Initialize FPGA interface (relocation offset = 0x%.8lx)\n",
__FUNCTION__, __LINE__, gd->reloc_off);
- fpga_init (gd->reloc_off);
- fpga_debug("%s:%d: Adding fpga 0\n", __FUNCTION__, __LINE__);
- fpga_add (fpga_altera, &cyclone2);
- return 1;
+}
+int fpga_null_fn (int cookie) +{
return 0;
+}
+int fpga_config_fn (int assert, int flush, int cookie) +{
volatile immap_t *im = (volatile immap_t *)CFG_IMMR;
volatile gpio83xx_t *gpio = (volatile gpio83xx_t *)&im->gpio[0];
fix indentation; use tabs, not spaces.
- u32 dvo = gpio->dat;
keep declarations together, leave blank space between declarations and code - i.e, mv above blank line to before this line:
- fpga_debug("SET config : %s\n", assert ? "low" : "high");
- if ( assert )
no spaces around assert
dvo |= FPGA_CONFIG;
- else
dvo &= ~FPGA_CONFIG;
- if ( flush )
gpio->dat = dvo;
- return assert;
can you also get in the habit of leaving blank lines before return statements? thanks.
<snipped more code that gets above comments also>
- for ( i=0; i<8; i++ ) {
please read CodingStyle! this should look like:
for (i = 0; i < 8; i++) {
<snip similar cases>
diff --git a/board/mvblm7/mvblm7.c b/board/mvblm7/mvblm7.c
<snip>
im->ddr.sdram_interval = CFG_DDR_INTERVAL;
im->ddr.sdram_clk_cntl = CFG_DDR_CLK_CNTL;
use tabs, not spaces.
<snip>
+u8 *dhcp_vendorex_prep (u8 * e)
u8 *dhcp_vendorex_prep(u8 *e)
+{
- char *ptr;
+/* DHCP vendor-class-identifier = 60 */
- if ((ptr = getenv ("dhcp_vendor-class-identifier"))) {
fix indentation. Use tabs, not spaces.
*e++ = 60;
*e++ = strlen (ptr);
strlen(ptr);
while (*ptr)
*e++ = *ptr++;
- }
+/* DHCP_CLIENT_IDENTIFIER = 61 */
- if ((ptr = getenv ("dhcp_client_id"))) {
..
<snip>
diff --git a/board/mvblm7/pci.c b/board/mvblm7/pci.c
<sniiiiip>
tmp[0] = cpu_to_be32(gd->pci_clk);
do_fixup_by_path(blob, path, "clock-frequency",
&tmp, sizeof(tmp[0]), 1);
}
- }
+} +#endif
please use generic 83xx pci code (cpu/mpc83xx/pci.c). See the mpc8313erdb board implementation for an example use-case.
Again, thanks for your contribution!
Kim
MATRIX VISION GmbH, Talstraße 16, DE-71570 Oppenweiler - Registergericht: Amtsgericht Stuttgart, HRB 271090 Geschäftsführer: Gerhard Thullner, Werner Armingeon, Uwe Furtner
participants (4)
-
Andre Schwarz
-
André Schwarz
-
Kim Phillips
-
Wolfgang Denk