All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4] mpq101: initial support for Mercury Computer Systems MPQ101 board
Date: Fri, 14 Jan 2011 05:51:12 -0600	[thread overview]
Message-ID: <1575B4A8-A839-4C05-AA54-B625CDAAE982@kernel.crashing.org> (raw)
In-Reply-To: <101603.97416.qm@web37606.mail.mud.yahoo.com>


On Jan 14, 2011, at 3:10 AM, Alex Dubov wrote:

> Mpq101 is a RapidIO development board in AMC form factor, featuring MPC8548
> processor, 512MB of hardwired DDR2 RAM, 128MB of hardwired NAND flash
> memory, real time clock and additional serial EEPROM on i2c bus (enabled).
> USB controller is available, but not presently enabled.
> 
> Additional board information is available at:
> http://www.mc.com/products/boards/ensemble_mpq101_rapidio_powerquicc_iii.aspx
> 
> Environment is configured to precede the actual u-boot image so that it's
> located at the beginning of flash erase block (made necessary by the recent
> changes to the embedded environment handling).
> 
> Signed-off-by: Alex Dubov <oakad@yahoo.com>
> ---
> Changes for v4:
>   - Replace config.mk supplied linker flags with custom linker script.
>   - Fix checkpatch errors.
> Changes for v3:
>   - Use io accessor functions for all mmio accesses.
>   - Add configuration options for RTC and EEPROM on I2C buses.
> Changes for v2:
>   - Remove some stale configuration code from board initialization functions.
> 
> MAINTAINERS                     |    3 +
> board/mercury/mpq101/Makefile   |   53 +++++
> board/mercury/mpq101/law.c      |   55 ++++++
> board/mercury/mpq101/mpq101.c   |  140 ++++++++++++++
> board/mercury/mpq101/tlb.c      |   82 ++++++++
> board/mercury/mpq101/u-boot.lds |  132 +++++++++++++
> boards.cfg                      |    1 +
> include/configs/mpq101.h        |  398 +++++++++++++++++++++++++++++++++++++++
> 8 files changed, 864 insertions(+), 0 deletions(-)
> create mode 100644 board/mercury/mpq101/Makefile
> create mode 100644 board/mercury/mpq101/law.c
> create mode 100644 board/mercury/mpq101/mpq101.c
> create mode 100644 board/mercury/mpq101/tlb.c
> create mode 100644 board/mercury/mpq101/u-boot.lds
> create mode 100644 include/configs/mpq101.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d7cd09c..220c39d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -138,6 +138,9 @@ Jon Diekema <jon.diekema@smiths-aerospace.com>
> 
> 	sbc8260		MPC8260
> 
> +Alex Dubov <oakad@yahoo.com>
> +	mpq101		MPC8548
> +
> Dirk Eibach <eibach@gdsys.de>
> 
> 	devconcenter	PPC460EX
> diff --git a/board/mercury/mpq101/Makefile b/board/mercury/mpq101/Makefile
> new file mode 100644
> index 0000000..58bc1b3
> --- /dev/null
> +++ b/board/mercury/mpq101/Makefile
> @@ -0,0 +1,53 @@
> +#
> +# Copyright 2007 Freescale Semiconductor, Inc.
> +# (C) Copyright 2001-2006
> +# Wolfgang Denk, DENX Software Engineering, wd at denx.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 $(TOPDIR)/config.mk
> +
> +LIB	= $(obj)lib$(BOARD).o
> +
> +COBJS-y	+= $(BOARD).o
> +COBJS-y	+= law.o
> +COBJS-y	+= tlb.o
> +
> +SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
> +OBJS	:= $(addprefix $(obj),$(COBJS-y))
> +SOBJS	:= $(addprefix $(obj),$(SOBJS))
> +
> +$(LIB):	$(obj).depend $(OBJS) $(SOBJS)
> +	$(call cmd_link_o_target, $(OBJS))
> +
> +clean:
> +	rm -f $(OBJS) $(SOBJS)
> +
> +distclean:	clean
> +	rm -f $(LIB) core *.bak .depend
> +
> +#########################################################################
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#########################################################################
> diff --git a/board/mercury/mpq101/law.c b/board/mercury/mpq101/law.c
> new file mode 100644
> index 0000000..726b5c2
> --- /dev/null
> +++ b/board/mercury/mpq101/law.c
> @@ -0,0 +1,55 @@
> +/*
> + * Copyright 2008 Freescale Semiconductor, Inc.
> + *
> + * (C) Copyright 2000
> + * Wolfgang Denk, DENX Software Engineering, wd at denx.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 <asm/fsl_law.h>
> +#include <asm/mmu.h>
> +
> +/*
> + * LAW(Local Access Window) configuration:
> + *
> + * 0x0000_0000     0x1fff_ffff     DDR                     SYS_SDRAM_SIZE
> + * 0xc000_0000     0xdfff_ffff     RapidIO                 512M
> + * 0xe000_0000     0xe000_ffff     CCSR                    1M
> + * 0xf000_0000     0xffff_ffff     LBC options + FLASH     256M
> + *
> + * Notes:
> + *    CCSRBAR and L2-as-SRAM don't need a configured Local Access Window.
> + *    If flash is 8M at default position (last 8M), no LAW needed.
> + *
> + * LAW 0 is reserved for boot mapping
> + */
> +
> +struct law_entry law_table[] = {
> +	SET_LAW(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_SIZE_LOG - 1,
> +		LAW_TRGT_IF_DDR_1),
> +#ifdef CONFIG_SYS_RIO_MEM_PHYS
> +	SET_LAW(CONFIG_SYS_RIO_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_RIO),
> +#endif
> +	SET_LAW(CONFIG_SYS_LBC_OPTION_BASE_PHYS, LAW_SIZE_256M,
> +		LAW_TRGT_IF_LBC)
> +};
> +
> +int num_law_entries = ARRAY_SIZE(law_table);
> diff --git a/board/mercury/mpq101/mpq101.c b/board/mercury/mpq101/mpq101.c
> new file mode 100644
> index 0000000..8d9b518
> --- /dev/null
> +++ b/board/mercury/mpq101/mpq101.c
> @@ -0,0 +1,140 @@
> +/*
> + * (C) Copyright 2011 Alex Dubov <oakad@yahoo.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
> + */
> +
> +#include <common.h>
> +#include <asm/processor.h>
> +#include <asm/mmu.h>
> +#include <asm/immap_85xx.h>
> +#include <asm/fsl_law.h>
> +#include <asm/io.h>
> +#include <miiphy.h>
> +#include <libfdt.h>
> +#include <fdt_support.h>
> +
> +unsigned long get_clock_freq(void)
> +{
> +	return 33000000;
> +}
> +
> +/*
> + * Initialize Local Bus
> + */
> +void local_bus_init(void)
> +{
> +	fsl_lbc_t *lbc = LBC_BASE_ADDR;
> +
> +	out_be32(&lbc->ltesr, 0xffffffff); /* Clear LBC error interrupts */
> +	out_be32(&lbc->lteir, 0xffffffff); /* Enable LBC error interrupts */
> +}
> +
> +int checkboard(void)
> +{
> +	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> +	ccsr_local_ecm_t *ecm = (void *)(CONFIG_SYS_MPC85xx_ECM_ADDR);
> +
> +	puts("Board: Mercury Computer Systems, Inc. MPQ-101 ");
> +#ifdef CONFIG_PHYS_64BIT
> +	puts("(36-bit addrmap) ");
> +#endif
> +	putc('\n');
> +
> +	/*
> +	 * Initialize local bus.
> +	 */
> +	local_bus_init();
> +
> +	/*
> +	 * Hack TSEC 3 and 4 IO voltages.
> +	 */
> +	out_be32(&gur->tsec34ioovcr, 0xe7e0); /*  1110 0111 1110 0xxx */
> +
> +	out_be32(&ecm->eedr, 0xffffffff); /* clear ecm errors */
> +	out_be32(&ecm->eeer, 0xffffffff); /* enable ecm errors */
> +	return 0;
> +}
> +
> +phys_size_t initdram(int board_type)
> +{
> +	ccsr_ddr_t *ddr = (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
> +	phys_size_t dram_size = 0;
> +	const char *p_mode = getenv("perf_mode");
> +
> +	puts("Initializing....");
> +
> +	out_be32(&ddr->cs0_bnds, CONFIG_SYS_DDR_CS0_BNDS);
> +	out_be32(&ddr->cs0_config, CONFIG_SYS_DDR_CS0_CONFIG);
> +
> +	out_be32(&ddr->timing_cfg_3, CONFIG_SYS_DDR_TIMING_3);
> +	out_be32(&ddr->timing_cfg_0, CONFIG_SYS_DDR_TIMING_0);
> +
> +	if (p_mode && !strcmp("performance", p_mode)) {
> +		out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1_PERF);
> +		out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2_PERF);
> +		out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1_PERF);
> +		out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2_PERF);
> +		out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL_PERF);
> +	} else {
> +		out_be32(&ddr->timing_cfg_1, CONFIG_SYS_DDR_TIMING_1);
> +		out_be32(&ddr->timing_cfg_2, CONFIG_SYS_DDR_TIMING_2);
> +		out_be32(&ddr->sdram_mode, CONFIG_SYS_DDR_MODE_1);
> +		out_be32(&ddr->sdram_mode_2, CONFIG_SYS_DDR_MODE_2);
> +		out_be32(&ddr->sdram_interval, CONFIG_SYS_DDR_INTERVAL);
> +	}
> +
> +	out_be32(&ddr->sdram_clk_cntl, CONFIG_SYS_DDR_CLK_CTRL);
> +	out_be32(&ddr->sdram_cfg_2, CONFIG_SYS_DDR_CONTROL2);
> +
> +	asm("sync;isync");
> +	udelay(500);
> +
> +	out_be32(&ddr->sdram_cfg, CONFIG_SYS_DDR_CONTROL);
> +	asm("sync; isync");
> +	udelay(500);
> +
> +	dram_size = setup_ddr_tlbs(1ull << (CONFIG_SYS_SDRAM_SIZE_LOG - 20));
> +
> +	puts("    DDR: ");
> +
> +	return get_ram_size(0, dram_size << 20);
> +}
> +
> +
> +void pci_init_board(void)
> +{
> +	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
> +
> +	/* PCI is disabled */
> +	out_be32(&gur->devdisr, in_be32(&gur->devdisr)
> +				| MPC85xx_DEVDISR_PCI1
> +				| MPC85xx_DEVDISR_PCI2
> +				| MPC85xx_DEVDISR_PCIE);
> +}

> diff --git a/include/configs/mpq101.h b/include/configs/mpq101.h
> new file mode 100644
> index 0000000..33d6b69
> --- /dev/null
> +++ b/include/configs/mpq101.h
> @@ -0,0 +1,398 @@
> +/*
> + * Copyright 2011 Alex Dubov <oakad@yahoo.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
> + */
> +
> +/*
> + * Merury Computers MPQ101 board configuration file
> + *
> + */
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#ifdef CONFIG_36BIT
> +# define CONFIG_PHYS_64BIT 1
> +#endif
> +
> +/* High Level Configuration Options */
> +#define CONFIG_BOOKE      1 /* BOOKE */
> +#define CONFIG_E500       1 /* BOOKE e500 family */
> +#define CONFIG_MPC85xx    1 /* MPC8540/60/55/41/48 */
> +#define CONFIG_MPC8548    1 /* MPC8548 specific */
> +#define CONFIG_MPQ101     1 /* MPQ101 board specific */
> +
> +#define CONFIG_RIO        1
> +#define CONFIG_TSEC_ENET  1 /* tsec ethernet support */
> +#define CONFIG_INTERRUPTS 1 /* enable pci, srio, ddr interrupts */
> +#define CONFIG_FSL_LAW    1 /* Use common FSL init code */
> +
> +/*
> + * These can be toggled for performance analysis, otherwise use default.
> + */
> +#define CONFIG_L2_CACHE   1 /* toggle L2 cache */
> +#define CONFIG_BTB        1 /* toggle branch predition */
> +
> +#define CONFIG_PANIC_HANG 1
> +
> +/*
> + * Only possible on E500 Version 2 or newer cores.
> + */
> +#define CONFIG_ENABLE_36BIT_PHYS 1
> +
> +#ifdef CONFIG_PHYS_64BIT
> +# define CONFIG_ADDR_MAP         1
> +# define CONFIG_SYS_NUM_ADDR_MAP 16 /* number of TLB1 entries */
> +#endif
> +
> +#ifndef __ASSEMBLY__
> +extern unsigned long get_clock_freq(void);
> +#endif
> +
> +#define CONFIG_SYS_CLK_FREQ get_clock_freq() /* sysclk for MPC85xx */
> +
> +/*

You don't really need a function here for get_clock_freq() you can just:

#define CONFIG_SYS_CLK_FREQ 33000000

- k

      parent reply	other threads:[~2011-01-14 11:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27  6:22 [U-Boot] [PATCH] mpq101: initial support for Mercury Computer Systems MPQ101 board Alex Dubov
2010-12-27 12:12 ` Wolfgang Denk
2010-12-28  4:42   ` Alex Dubov
2011-01-10 22:43     ` Wolfgang Denk
2011-01-11  3:14       ` Alex Dubov
2011-01-11  5:43         ` Wolfgang Denk
2011-01-11  7:32           ` Alex Dubov
2011-01-17 22:38             ` Wolfgang Denk
2011-01-18  4:32               ` Kumar Gala
2010-12-28  5:53   ` Alex Dubov
2011-01-10 22:49     ` Wolfgang Denk
2011-01-07  7:16   ` [U-Boot] [PATCH v3] " Alex Dubov
2011-01-10 22:56     ` Wolfgang Denk
2011-01-11  2:44       ` Alex Dubov
2011-01-11  7:43         ` Wolfgang Denk
2011-01-13  2:42           ` Alex Dubov
2011-01-14  9:10       ` [U-Boot] [PATCH v4] " Alex Dubov
2011-01-14 11:49         ` Kumar Gala
2011-01-17  3:07           ` Alex Dubov
2011-01-17  7:26           ` [U-Boot] [PATCH v5] " Alex Dubov
2011-01-18  5:15             ` Kumar Gala
2011-01-18  8:03               ` [U-Boot] [PATCH v6] " Alex Dubov
2011-01-18  9:42                 ` Kumar Gala
2011-01-19  9:50                   ` Alex Dubov
2011-01-20  5:02                   ` [U-Boot] [PATCH v7] " Alex Dubov
2011-01-20  7:50                     ` Kumar Gala
2011-01-24  5:59                       ` [U-Boot] [PATCH v8] " Alex Dubov
2011-01-27  5:45                         ` Kumar Gala
2011-01-27  8:41                           ` Alex Dubov
2011-01-20  8:46                     ` [U-Boot] [PATCH v7] " Wolfgang Denk
2011-01-22  7:27                       ` Alex Dubov
2011-01-14 11:51         ` Kumar Gala [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1575B4A8-A839-4C05-AA54-B625CDAAE982@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.