diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-03 13:06:39 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-03 13:06:39 +0200 |
commit | f2abce53362ea43ef2432b6c9bd444812ff4f7ec (patch) | |
tree | df7c92a5b760dbb1c7d3f4627149e440d82fb4d2 /board | |
parent | 7f37262ee5b28f5c08377188d3a9e6167d480989 (diff) | |
parent | e9a966e0ef432ca09db25de3c4dd7a7e8da6fdb7 (diff) | |
download | barebox-f2abce53362ea43ef2432b6c9bd444812ff4f7ec.tar.gz barebox-f2abce53362ea43ef2432b6c9bd444812ff4f7ec.tar.xz |
Merge branch 'next'
Diffstat (limited to 'board')
-rw-r--r-- | board/eukrea_cpuimx25/Makefile | 24 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/config.h | 27 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/_update | 36 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/boot | 53 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/hush_hack | 1 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/init | 38 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/update_kernel | 8 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/bin/update_root | 8 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/env/config | 27 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/eukrea_cpuimx25.c | 275 | ||||
-rw-r--r-- | board/eukrea_cpuimx25/lowlevel.c | 130 | ||||
-rw-r--r-- | board/eukrea_cpuimx27/env/bin/boot | 10 | ||||
-rw-r--r-- | board/eukrea_cpuimx27/env/config | 14 | ||||
-rw-r--r-- | board/eukrea_cpuimx27/eukrea_cpuimx27.c | 67 | ||||
-rw-r--r-- | board/freescale-mx35-3-stack/3stack.c | 57 |
15 files changed, 756 insertions, 19 deletions
diff --git a/board/eukrea_cpuimx25/Makefile b/board/eukrea_cpuimx25/Makefile new file mode 100644 index 0000000000..406c6f32f7 --- /dev/null +++ b/board/eukrea_cpuimx25/Makefile @@ -0,0 +1,24 @@ +# +# (C) 2010 Eukrea Electromatique, Eric Bénard <eric@eukrea.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 +# + +obj-y += lowlevel.o +obj-y += eukrea_cpuimx25.o diff --git a/board/eukrea_cpuimx25/config.h b/board/eukrea_cpuimx25/config.h new file mode 100644 index 0000000000..efff909eed --- /dev/null +++ b/board/eukrea_cpuimx25/config.h @@ -0,0 +1,27 @@ +/* + * (c) 2010 Eukrea Electromatique, Eric Bénard <eric@eukrea.com> + * + * 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 CONFIG_MX25_HCLK_FREQ 24000000 + +#endif + +/* nothing to do here yet */ diff --git a/board/eukrea_cpuimx25/env/bin/_update b/board/eukrea_cpuimx25/env/bin/_update new file mode 100644 index 0000000000..014bce3512 --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/_update @@ -0,0 +1,36 @@ +#!/bin/sh + +if [ -z "$part" -o -z "$image" ]; then + echo "define \$part and \$image" + exit 1 +fi + +if [ ! -e "$part" ]; then + echo "Partition $part does not exist" + exit 1 +fi + +if [ $# = 1 ]; then + image=$1 +fi + +if [ x$ip = xdhcp ]; then + dhcp +fi + +ping $eth0.serverip +if [ $? -ne 0 ] ; then + echo "update aborted" + exit 1 +fi + +unprotect $part + +echo +echo "erasing partition $part" +erase $part + +echo +echo "flashing $image to $part" +echo +tftp $image $part diff --git a/board/eukrea_cpuimx25/env/bin/boot b/board/eukrea_cpuimx25/env/bin/boot new file mode 100644 index 0000000000..2d9b3af01c --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/boot @@ -0,0 +1,53 @@ +#!/bin/sh + +. /env/config + +if [ x$1 = xjffS2 ]; then + root=jffs2 + kernel=nand +fi + +if [ x$1 = xubifs ]; then + root=ubifs + kernel=nand +fi + +if [ x$1 = xnet ]; then + root=net + kernel=net +fi + +if [ x$ip = xdhcp ]; then + bootargs="$bootargs ip=dhcp" +else + if [ x$ip = xoff ]; then + bootargs="$bootargs ip=off" + else + bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" + fi +fi + +if [ x$root = xjffs2 ]; then + bootargs="$bootargs root=/dev/mtdblock$rootpartnum_nand rootfstype=jffs2" +fi + +if [ x$root = xubifs ]; then + bootargs="$bootargs root=ubi0:$ubiroot ubi.mtd=$rootpartnum_nand rootfstype=ubifs" +fi + +if [ x$root = xnet ]; then + bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp" +fi + +bootargs="$bootargs mtdparts=mxc_nand:$nand_parts" + +if [ $kernel = net ]; then + if [ x$ip = xdhcp ]; then + dhcp + fi + tftp $uimage uImage || exit 1 + bootm uImage +else + bootm /dev/nand0.kernel.bb +fi + diff --git a/board/eukrea_cpuimx25/env/bin/hush_hack b/board/eukrea_cpuimx25/env/bin/hush_hack new file mode 100644 index 0000000000..5fffa92ecd --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/hush_hack @@ -0,0 +1 @@ +nand -a /dev/nand0.* diff --git a/board/eukrea_cpuimx25/env/bin/init b/board/eukrea_cpuimx25/env/bin/init new file mode 100644 index 0000000000..8bcc732a40 --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/init @@ -0,0 +1,38 @@ +#!/bin/sh + +PATH=/env/bin +export PATH + +. /env/config +if [ -e /dev/nand0 ]; then + addpart /dev/nand0 $nand_parts + + # Uh, oh, hush first expands wildcards and then starts executing + # commands. What a bug! + source /env/bin/hush_hack +fi + +if [ -f /env/logo.bmp ]; then + bmp /env/logo.bmp +fi + +if [ -z $eth0.ethaddr ]; then + while [ -z $eth0.ethaddr ]; do + readline "no MAC address set for eth0. please enter the one found on your board: " eth0.ethaddr + done + echo -a /env/config "eth0.ethaddr=$eth0.ethaddr" + saveenv +fi + +echo +echo -n "Hit any key to stop autoboot: " +timeout -a $autoboot_timeout +if [ $? != 0 ]; then + echo + echo "type update_kernel [<imagename>] to update kernel into flash" + echo "type update_root [<imagename>] to update rootfs into flash" + echo + exit +fi + +boot diff --git a/board/eukrea_cpuimx25/env/bin/update_kernel b/board/eukrea_cpuimx25/env/bin/update_kernel new file mode 100644 index 0000000000..c2d2cc3fa9 --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/update_kernel @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$uimage +part=/dev/nand0.kernel.bb + +. /env/bin/_update $1 diff --git a/board/eukrea_cpuimx25/env/bin/update_root b/board/eukrea_cpuimx25/env/bin/update_root new file mode 100644 index 0000000000..dd89a5afad --- /dev/null +++ b/board/eukrea_cpuimx25/env/bin/update_root @@ -0,0 +1,8 @@ +#!/bin/sh + +. /env/config + +image=$rootfs +part=/dev/nand0.root.bb + +. /env/bin/_update $1 diff --git a/board/eukrea_cpuimx25/env/config b/board/eukrea_cpuimx25/env/config new file mode 100644 index 0000000000..9217ca17be --- /dev/null +++ b/board/eukrea_cpuimx25/env/config @@ -0,0 +1,27 @@ +#!/bin/sh + +# can be either 'net' or 'jffs2' or 'ubifs' +kernel=nand +root=ubifs + +basedir=cpuimx25 +uimage=$basedir/uImage +rootfs=$basedir/rootfs + +autoboot_timeout=1 + +nfsroot="" +bootargs="console=ttymxc0,115200" + +nand_parts="256k(barebox)ro,128k(bareboxenv),2176k(kernel),-(root)" +rootpartnum_nand=3 +ubiroot="eukrea-cpuimx25-rootfs" + +# use 'dhcp' to do dhcp in barebox and in kernel +ip=off + +# or set your networking parameters here +#eth0.ipaddr=a.b.c.d +#eth0.netmask=a.b.c.d +#eth0.gateway=a.b.c.d +#eth0.serverip=a.b.c.d diff --git a/board/eukrea_cpuimx25/eukrea_cpuimx25.c b/board/eukrea_cpuimx25/eukrea_cpuimx25.c new file mode 100644 index 0000000000..8cbbc4fc57 --- /dev/null +++ b/board/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -0,0 +1,275 @@ +/* + * (C) 2009 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> + * (c) 2010 Eukrea Electromatique, Eric Bénard <eric@eukrea.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 <init.h> +#include <driver.h> +#include <environment.h> +#include <mach/imx-regs.h> +#include <asm/armlinux.h> +#include <mach/gpio.h> +#include <asm/io.h> +#include <asm/mmu.h> + +#include <partition.h> +#include <asm/mach-types.h> +#include <mach/imx-nand.h> +#include <mach/imxfb.h> +#include <fec.h> +#include <nand.h> +#include <mach/imx-flash-header.h> +#include <mach/iomux-mx25.h> + +extern unsigned long _stext; + +void __naked __flash_header_start go(void) +{ + __asm__ __volatile__("b exception_vectors\n"); +} + +struct imx_dcd_entry __dcd_entry_0x400 dcd_entry[] = { + { .ptr_type = 4, .addr = 0xb8001010, .val = 0x00000004, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0x92100000, }, + { .ptr_type = 1, .addr = 0x80000400, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0xa2100000, }, + { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0x80000000, .val = 0x12344321, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0xb2100000, }, + { .ptr_type = 1, .addr = 0x80000033, .val = 0xda, }, + { .ptr_type = 1, .addr = 0x81000000, .val = 0xff, }, + { .ptr_type = 4, .addr = 0xb8001000, .val = 0x82216080, }, + { .ptr_type = 4, .addr = 0xb8001004, .val = 0x00295729, }, + { .ptr_type = 4, .addr = 0x53f80008, .val = 0x20034000, }, +}; + +#define APP_DEST 0x80000000 + +struct imx_flash_header __flash_header_0x400 eukrea_cpuimx25_header = { + .app_code_jump_vector = TEXT_BASE + 0x2000, + .app_code_barker = APP_CODE_BARKER, + .app_code_csf = 0, + .dcd_ptr_ptr = TEXT_BASE + 0x400 + offsetof(struct imx_flash_header, dcd), + .super_root_key = 0, + .dcd = TEXT_BASE + 0x400 + offsetof(struct imx_flash_header, dcd_barker), + .app_dest = TEXT_BASE, + .dcd_barker = DCD_BARKER, + .dcd_block_len = sizeof(dcd_entry), +}; + +extern unsigned long __bss_start; + +unsigned long __image_len_0x400 barebox_len = 0x40000; + +static struct fec_platform_data fec_info = { + .xcv_type = RMII, + .phy_addr = 1, +}; + +static struct device_d fec_dev = { + .name = "fec_imx", + .map_base = IMX_FEC_BASE, + .platform_data = &fec_info, +}; + +static struct memory_platform_data sdram_pdata = { + .name = "ram0", + .flags = DEVFS_RDWR, +}; + +static struct device_d sdram0_dev = { + .name = "mem", + .map_base = IMX_SDRAM_CS0, + .size = 64 * 1024 * 1024, + .platform_data = &sdram_pdata, +}; + +struct imx_nand_platform_data nand_info = { + .width = 1, + .hw_ecc = 1, +}; + +static struct device_d nand_dev = { + .name = "imx_nand", + .map_base = IMX_NFC_BASE, + .platform_data = &nand_info, +}; + +static struct imx_fb_videomode imxfb_mode = { + .mode = { + .name = "CMO-QVGA", + .refresh = 60, + .xres = 320, + .yres = 240, + .pixclock = KHZ2PICOS(6500), + .hsync_len = 30, + .left_margin = 38, + .right_margin = 20, + .vsync_len = 3, + .upper_margin = 15, + .lower_margin = 4, + }, + .pcr = 0xCAD08B80, + .bpp = 16, +}; + +static struct imx_fb_platform_data eukrea_cpuimx25_fb_data = { + .mode = &imxfb_mode, + .pwmr = 0x00A903FF, + .lscr1 = 0x00120300, + .dmacr = 0x80040060, +}; + + +static struct device_d imxfb_dev = { + .name = "imxfb", + .map_base = 0x53fbc000, + .size = 0x1000, + .platform_data = &eukrea_cpuimx25_fb_data, +}; + +#ifdef CONFIG_MMU +static void eukrea_cpuimx25_mmu_init(void) +{ + mmu_init(); + + arm_create_section(0x80000000, 0x80000000, 128, PMD_SECT_DEF_CACHED); + arm_create_section(0x90000000, 0x80000000, 128, PMD_SECT_DEF_UNCACHED); + + setup_dma_coherent(0x10000000); + + mmu_enable(); +} +#else +static void eukrea_cpuimx25_mmu_init(void) +{ +} +#endif + +static struct pad_desc eukrea_cpuimx25_pads[] = { + MX25_PAD_FEC_MDC__MDC, + MX25_PAD_FEC_MDIO__MDIO, + MX25_PAD_FEC_RDATA0__RDATA0, + MX25_PAD_FEC_RDATA1__RDATA1, + MX25_PAD_FEC_RX_DV__RX_DV, + MX25_PAD_FEC_TDATA0__TDATA0, + MX25_PAD_FEC_TDATA1__TDATA1, + MX25_PAD_FEC_TX_CLK__TX_CLK, + MX25_PAD_FEC_TX_EN__TX_EN, + /* UART1 */ + MX25_PAD_UART1_RXD__RXD_MUX, + MX25_PAD_UART1_TXD__TXD_MUX, + MX25_PAD_UART1_RTS__RTS, + MX25_PAD_UART1_CTS__CTS, + /* LCDC */ + MX25_PAD_LD0__LCDC_LD0, + MX25_PAD_LD1__LCDC_LD1, + MX25_PAD_LD2__LCDC_LD2, + MX25_PAD_LD3__LCDC_LD3, + MX25_PAD_LD4__LCDC_LD4, + MX25_PAD_LD5__LCDC_LD5, + MX25_PAD_LD6__LCDC_LD6, + MX25_PAD_LD7__LCDC_LD7, + MX25_PAD_LD8__LCDC_LD8, + MX25_PAD_LD9__LCDC_LD9, + MX25_PAD_LD10__LCDC_LD10, + MX25_PAD_LD11__LCDC_LD11, + MX25_PAD_LD12__LCDC_LD12, + MX25_PAD_LD13__LCDC_LD13, + MX25_PAD_LD14__LCDC_LD14, + MX25_PAD_LD15__LCDC_LD15, + MX25_PAD_GPIO_E__LCDC_LD16, + MX25_PAD_GPIO_F__LCDC_LD17, + MX25_PAD_LSCLK__LCDC_LSCLK, + MX25_PAD_OE_ACD__LCDC_OE_ACD, + MX25_PAD_VSYNC__LCDC_VSYN, + MX25_PAD_HSYNC__LCDC_HSYN, + /* BACKLIGHT CONTROL */ + MX25_PAD_PWM__GPIO26, +}; + +static int eukrea_cpuimx25_devices_init(void) +{ + eukrea_cpuimx25_mmu_init(); + + mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads, + ARRAY_SIZE(eukrea_cpuimx25_pads)); + register_device(&fec_dev); + + nand_info.width = 1; + register_device(&nand_dev); + + devfs_add_partition("nand0", 0x00000, 0x40000, + PARTITION_FIXED, "self_raw"); + dev_add_bb_dev("self_raw", "self0"); + + devfs_add_partition("nand0", 0x40000, 0x40000, + PARTITION_FIXED, "env_raw"); + dev_add_bb_dev("env_raw", "env0"); + + register_device(&sdram0_dev); + + /* enable LCD */ + gpio_direction_output(26, 1); + gpio_set_value(26, 1); + + register_device(&imxfb_dev); + + armlinux_add_dram(&sdram0_dev); + armlinux_set_bootparams((void *)0x80000100); + armlinux_set_architecture(MACH_TYPE_EUKREA_CPUIMX25); + + return 0; +} + +device_initcall(eukrea_cpuimx25_devices_init); + +static struct device_d eukrea_cpuimx25_serial_device = { + .name = "imx_serial", + .map_base = IMX_UART1_BASE, + .size = 16 * 1024, +}; + +static int eukrea_cpuimx25_console_init(void) +{ + writel(0x03010101, IMX_CCM_BASE + CCM_PCDR3); + register_device(&eukrea_cpuimx25_serial_device); + return 0; +} + +console_initcall(eukrea_cpuimx25_console_init); + +#ifdef CONFIG_NAND_IMX_BOOT +void __bare_init nand_boot(void) +{ + imx_nand_load_image((void *)TEXT_BASE, 256 * 1024); +} +#endif + +static int eukrea_cpuimx25_core_setup(void) +{ + writel(0x01010103, IMX_CCM_BASE + CCM_PCDR2); + return 0; + +} +core_initcall(eukrea_cpuimx25_core_setup); diff --git a/board/eukrea_cpuimx25/lowlevel.c b/board/eukrea_cpuimx25/lowlevel.c new file mode 100644 index 0000000000..b9d3ce57bb --- /dev/null +++ b/board/eukrea_cpuimx25/lowlevel.c @@ -0,0 +1,130 @@ +/* + * + * (c) 2007 Pengutronix, Sascha Hauer <s.hauer@pengutronix.de> + * (c) 2010 Eukrea Electromatique, Eric Bénard <eric@eukrea.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 <init.h> +#include <mach/imx-regs.h> +#include <mach/imx-pll.h> +#include <mach/esdctl.h> +#include <asm/cache-l2x0.h> +#include <asm/io.h> +#include <mach/imx-nand.h> +#include <asm/barebox-arm.h> +#include <asm-generic/memory_layout.h> +#include <asm/system.h> + +static void __bare_init __naked insdram(void) +{ + uint32_t r; + + /* setup a stack to be able to call imx_nand_load_image() */ + r = STACK_BASE + STACK_SIZE - 12; + __asm__ __volatile__("mov sp, %0" : : "r"(r)); + + imx_nand_load_image((void *)TEXT_BASE, 256 * 1024); + + board_init_lowlevel_return(); +} + +#define MX25_CCM_MCR 0x64 +#define MX25_CCM_CGR0 0x0c +#define MX25_CCM_CGR1 0x10 +#define MX25_CCM_CGR2 0x14 + +void __bare_init __naked board_init_lowlevel(void) +{ + uint32_t r; + unsigned int *trg, *src; + int i; + + /* AIPS setup - Only setup MPROTx registers. The PACR default values are good. + * Set all MPROTx to be non-bufferable, trusted for R/W, + * not forced to user-mode. + */ + writel(0x77777777, 0x43f00000); + writel(0x77777777, 0x43f00004); + writel(0x77777777, 0x53f00000); + writel(0x77777777, 0x53f00004); + + /* MAX (Multi-Layer AHB Crossbar Switch) setup + * MPR - priority for MX25 is (SDHC2/SDMA)>USBOTG>RTIC>IAHB>DAHB + */ + writel(0x00002143, 0x43f04000); + writel(0x00002143, 0x43f04100); + writel(0x00002143, 0x43f04200); + writel(0x00002143, 0x43f04300); + writel(0x00002143, 0x43f04400); + /* SGPCR - always park on last master */ + writel(0x10, 0x43f04010); + writel(0x10, 0x43f04110); + writel(0x10, 0x43f04210); + writel(0x10, 0x43f04310); + writel(0x10, 0x43f04410); + /* MGPCR - restore default values */ + writel(0x0, 0x43f04800); + writel(0x0, 0x43f04900); + writel(0x0, 0x43f04a00); + writel(0x0, 0x43f04b00); + writel(0x0, 0x43f04c00); + + /* Configure M3IF registers + * M3IF Control Register (M3IFCTL) for MX25 + * MRRP[0] = LCDC on priority list (1 << 0) = 0x00000001 + * MRRP[1] = MAX1 not on priority list (0 << 1) = 0x00000000 + * MRRP[2] = MAX0 not on priority list (0 << 2) = 0x00000000 + * MRRP[3] = USB HOST not on priority list (0 << 3) = 0x00000000 + * MRRP[4] = SDMA not on priority list (0 << 4) = 0x00000000 + * MRRP[5] = SD/ATA/FEC not on priority list (0 << 5) = 0x00000000 + * MRRP[6] = SCMFBC not on priority list (0 << 6) = 0x00000000 + * MRRP[7] = CSI not on priority list (0 << 7) = 0x00000000 + * ---------- + * 0x00000001 + */ + writel(0x1, 0xb8003000); + + /* enable all the clocks */ + writel(0x038A81A2, IMX_CCM_BASE + MX25_CCM_CGR0); + writel(0x24788F00, IMX_CCM_BASE + MX25_CCM_CGR1); + writel(0x00004438, IMX_CCM_BASE + MX25_CCM_CGR2); + writel(0x00, IMX_CCM_BASE + MX25_CCM_MCR); + +#ifdef CONFIG_NAND_IMX_BOOT + /* skip NAND boot if not running from NFC space */ + r = get_pc(); + if (r < IMX_NFC_BASE || r > IMX_NFC_BASE + 0x1000) + board_init_lowlevel_return(); + + src = (unsigned int *)IMX_NFC_BASE; + trg = (unsigned int *)TEXT_BASE; + + /* Move ourselves out of NFC SRAM */ + for (i = 0; i < 0x1000 / sizeof(int); i++) + *trg++ = *src++; + + /* Jump to SDRAM */ + r = (unsigned int)&insdram; + __asm__ __volatile__("mov pc, %0" : : "r"(r)); +#else + board_init_lowlevel_return(); +#endif +} diff --git a/board/eukrea_cpuimx27/env/bin/boot b/board/eukrea_cpuimx27/env/bin/boot index 7bbff2d1f6..7272e56763 100644 --- a/board/eukrea_cpuimx27/env/bin/boot +++ b/board/eukrea_cpuimx27/env/bin/boot @@ -17,10 +17,14 @@ if [ x$1 = xnor ]; then kernel=nor fi -if [ x$ip = xdhcp ]; then - bootargs="$bootargs ip=dhcp" +if [ x$root = xnet ]; then + if [ x$ip = xdhcp ]; then + bootargs="$bootargs ip=dhcp" + else + bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" + fi else - bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::" + bootargs="$bootargs ip=off" fi if [ x$root = xnand ]; then diff --git a/board/eukrea_cpuimx27/env/config b/board/eukrea_cpuimx27/env/config index 183787e5ca..505ada39c7 100644 --- a/board/eukrea_cpuimx27/env/config +++ b/board/eukrea_cpuimx27/env/config @@ -4,16 +4,16 @@ kernel=nor root=nor -uimage=cpuimx27/uImage -jffs2=cpuimx27/rootfs.jffs2 +uimage=mx27/uImage +jffs2=mx27/rootfs.jffs2 -autoboot_timeout=3 +autoboot_timeout=1 -# TFP410-SVGA TFP410-VGA CMO-QVGA Optrex-WVGA Sharp-QVGA-EK +# DVI-SVGA DVI-VGA CMO-QVGA video="CMO-QVGA" -bootargs="console=ttymxc0,115200 fec_mac=$eth0.ethaddr rtc-pcf8563.probe=0,0x51 video=mxcfb:$video" +bootargs="console=ttymxc0,115200 fec_mac=$eth0.ethaddr video=mxcfb:$video" -nor_parts="256k(barebox)ro,128k(bareboxenv),1792k(kernel),-(root)" +nor_parts="256k(barebox)ro,128k(bareboxenv),2176k(kernel),-(root)" rootpart_nor="/dev/mtdblock3" nand_parts="-(nand)" @@ -28,4 +28,4 @@ ip=dhcp #eth0.ipaddr=a.b.c.d #eth0.netmask=a.b.c.d #eth0.gateway=a.b.c.d -eth0.serverip=192.168.1.15 +#eth0.serverip=a.b.c.d diff --git a/board/eukrea_cpuimx27/eukrea_cpuimx27.c b/board/eukrea_cpuimx27/eukrea_cpuimx27.c index ef57a969f2..e40c260320 100644 --- a/board/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/board/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -40,6 +40,7 @@ #include <asm/io.h> #include <mach/imx-nand.h> #include <mach/imx-pll.h> +#include <mach/imxfb.h> #include <ns16550.h> #include <asm/mmu.h> #include <i2c/i2c.h> @@ -176,6 +177,39 @@ static void eukrea_cpuimx27_mmu_init(void) } #endif +#ifdef CONFIG_DRIVER_VIDEO_IMX +static struct imx_fb_videomode imxfb_mode = { + .mode = { + .name = "CMO-QVGA", + .refresh = 60, + .xres = 320, + .yres = 240, + .pixclock = 156000, + .hsync_len = 30, + .left_margin = 38, + .right_margin = 20, + .vsync_len = 3, + .upper_margin = 15, + .lower_margin = 4, + }, + .pcr = 0xFAD08B80, + .bpp = 16,}; + +static struct imx_fb_platform_data eukrea_cpuimx27_fb_data = { + .mode = &imxfb_mode, + .pwmr = 0x00A903FF, + .lscr1 = 0x00120300, + .dmacr = 0x00020010, +}; + +static struct device_d imxfb_dev = { + .name = "imxfb", + .map_base = 0x10021000, + .size = 0x1000, + .platform_data = &eukrea_cpuimx27_fb_data, +}; +#endif + static int eukrea_cpuimx27_devices_init(void) { char *envdev = "no"; @@ -208,6 +242,31 @@ static int eukrea_cpuimx27_devices_init(void) PE14_PF_UART1_CTS, PE15_PF_UART1_RTS, #endif +#ifdef CONFIG_DRIVER_VIDEO_IMX + PA5_PF_LSCLK, + PA6_PF_LD0, + PA7_PF_LD1, + PA8_PF_LD2, + PA9_PF_LD3, + PA10_PF_LD4, + PA11_PF_LD5, + PA12_PF_LD6, + PA13_PF_LD7, + PA14_PF_LD8, + PA15_PF_LD9, + PA16_PF_LD10, + PA17_PF_LD11, + PA18_PF_LD12, + PA19_PF_LD13, + PA20_PF_LD14, + PA21_PF_LD15, + PA22_PF_LD16, + PA23_PF_LD17, + PA28_PF_HSYNC, + PA29_PF_VSYNC, + PA31_PF_OE_ACD, + GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT, +#endif }; eukrea_cpuimx27_mmu_init(); @@ -217,7 +276,7 @@ static int eukrea_cpuimx27_devices_init(void) CS0L = 0xA0330D01; CS0A = 0x002208C0; - /* initizalize gpios */ + /* initialize gpios */ for (i = 0; i < ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); @@ -239,6 +298,12 @@ static int eukrea_cpuimx27_devices_init(void) printf("Using environment in %s Flash\n", envdev); +#ifdef CONFIG_DRIVER_VIDEO_IMX + register_device(&imxfb_dev); + gpio_direction_output(GPIO_PORTE | 5, 0); + gpio_set_value(GPIO_PORTE | 5, 1); +#endif + armlinux_add_dram(&sdram_dev); armlinux_set_bootparams((void *)0xa0000100); armlinux_set_architecture(MACH_TYPE_CPUIMX27); diff --git a/board/freescale-mx35-3-stack/3stack.c b/board/freescale-mx35-3-stack/3stack.c index fcb87cfb6e..9a66976f9d 100644 --- a/board/freescale-mx35-3-stack/3stack.c +++ b/board/freescale-mx35-3-stack/3stack.c @@ -47,11 +47,17 @@ #include <mach/iomux-v3.h> #include <mach/pmic.h> #include <mach/imx-ipu-fb.h> +#include <mach/generic.h> #include <i2c/i2c.h> #include <i2c/mc13892.h> #include <i2c/mc9sdz60.h> + +/* Board rev for the PDK 3stack */ +#define MX35PDK_BOARD_REV_1 0 +#define MX35PDK_BOARD_REV_2 1 + static struct device_d cfi_dev = { .name = "cfi_flash", .map_base = IMX_CS0_BASE, @@ -144,6 +150,32 @@ static struct device_d imxfb_dev = { .platform_data = &ipu_fb_data, }; +/* + * Revision to be passed to kernel. The kernel provided + * by freescale relies on this. + * + * C --> CPU type + * S --> Silicon revision + * B --> Board rev + * + * 31 20 16 12 8 4 0 + * | Cmaj | Cmin | B | Smaj | Smin| + * + * e.g 0x00035120 --> i.MX35, Cpu silicon rev 2.0, Board rev 2 +*/ +static unsigned int imx35_3ds_system_rev = 0x00035000; + +static void set_silicon_rev( int rev) +{ + imx35_3ds_system_rev = imx35_3ds_system_rev | (rev & 0xFF); +} + +static void set_board_rev(int rev) +{ + imx35_3ds_system_rev = (imx35_3ds_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8; +} + + static int f3s_devices_init(void) { uint32_t reg; @@ -181,6 +213,8 @@ static int f3s_devices_init(void) break; } + set_silicon_rev(imx_silicon_revision()); + i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices)); register_device(&i2c_dev); @@ -201,10 +235,8 @@ device_initcall(f3s_devices_init); static int f3s_enable_display(void) { - gpio_direction_output(1, 1); - /* Enable power to the LCD. (bit 6 hi.) */ - mc9sdz60_set_bits( mc9sdz60_get(), MC9SDZ60_REG_GPIO_1, 0x40, 0x40); + mc9sdz60_set_bits(mc9sdz60_get(), MC9SDZ60_REG_GPIO_1, 0x40, 0x40); return 0; } @@ -248,6 +280,8 @@ static struct pad_desc f3s_pads[] = { MX35_PAD_I2C1_DAT__I2C1_SDA, MX35_PAD_WDOG_RST__GPIO1_6, + MX35_PAD_COMPARE__GPIO1_5, + /* Display */ MX35_PAD_LD0__IPU_DISPB_DAT_0, MX35_PAD_LD1__IPU_DISPB_DAT_1, @@ -270,7 +304,7 @@ static struct pad_desc f3s_pads[] = { MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC, MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK, MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY, - MX35_PAD_CONTRAST__GPIO1_1, + MX35_PAD_CONTRAST__IPU_DISPB_CONTR, MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, MX35_PAD_D3_REV__IPU_DISPB_D3_REV, MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, @@ -374,13 +408,16 @@ static int f3s_get_rev(struct mc13892 *mc13892) if (rev == 0x00ffffff) return -ENODEV; - return ((rev >> 6) & 0x7) ? 20 : 10; + return ((rev >> 6) & 0x7) ? MX35PDK_BOARD_REV_2 : MX35PDK_BOARD_REV_1; } static int f3s_pmic_init_v2(struct mc13892 *mc13892) { int err = 0; + /* COMPARE pin (GPIO1_5) as output and set high */ + gpio_direction_output( 32*0 + 5 , 1); + err |= mc13892_set_bits(mc13892, MC13892_REG_SETTING_0, 0x03, 0x03); err |= mc13892_set_bits(mc13892, MC13892_REG_MODE_0, 0x01, 0x01); if (err) @@ -421,16 +458,18 @@ static int f3s_pmic_init(void) rev = f3s_get_rev(mc13892); switch (rev) { - case 10: + case MX35PDK_BOARD_REV_1: break; - case 20: + case MX35PDK_BOARD_REV_2: f3s_pmic_init_v2(mc13892); break; default: printf("FAILED to identify board revision!\n"); return 0; } - printf("i.MX35 PDK CPU board version %d.%d\n", rev / 10, rev % 10); + + set_board_rev(rev); + printf("i.MX35 PDK CPU board version %d.\n", rev ); mc9sdz60 = mc9sdz60_get(); if (!mc9sdz60) { @@ -440,6 +479,8 @@ static int f3s_pmic_init(void) f3s_pmic_init_all(mc9sdz60); + armlinux_set_revision(imx35_3ds_system_rev); + return 0; } |