[i.MX]: Basic board support for the Freescale i.MX27 eval board
This commit is contained in:
parent
d5caf5ec5b
commit
7b4e9c4a82
|
@ -10,6 +10,7 @@ ARM type:
|
|||
|
||||
- @subpage pcm037
|
||||
- @subpage pcm038
|
||||
- @subpage imx27ads
|
||||
- @subpage scb9328
|
||||
- @subpage netx
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ config ARCH_TEXT_BASE
|
|||
default 0x81f00000 if MACH_NXDB500
|
||||
default 0x21e00000 if MACH_ECO920
|
||||
default 0xa0000000 if MACH_PCM038
|
||||
default 0xa0000000 if MACH_IMX27ADS
|
||||
default 0x87f00000 if MACH_PCM037
|
||||
#
|
||||
#
|
||||
|
@ -21,6 +22,9 @@ config BOARDINFO
|
|||
config BOARDINFO
|
||||
default "Phytec phyCORE-i.MX27" if MACH_PCM038
|
||||
|
||||
config BOARDINFO
|
||||
default "Freescale i.MX27 ADS" if MACH_IMX27ADS
|
||||
|
||||
config BOARDINFO
|
||||
default "Phytec phyCORE-i.MX31" if MACH_PCM037
|
||||
|
||||
|
@ -98,6 +102,14 @@ config MACH_PCM038
|
|||
Say Y here if you are using Phytec's phyCORE-i.MX27 (pcm038) equipped
|
||||
with a Freescale i.MX27 Processor
|
||||
|
||||
config MACH_IMX27ADS
|
||||
bool "Freescale i.MX27ADS"
|
||||
select HAS_CFI
|
||||
select ARCH_IMX27
|
||||
help
|
||||
Say Y here if you are using the Freescale i.MX27ads board equipped
|
||||
with a Freescale i.MX27 Processor
|
||||
|
||||
config MACH_ECO920
|
||||
bool "eco920"
|
||||
select HAS_AT91_ETHER
|
||||
|
|
|
@ -10,6 +10,7 @@ board-$(CONFIG_MACH_MX1ADS) := mx1ads
|
|||
board-$(CONFIG_MACH_ECO920) := eco920
|
||||
board-$(CONFIG_MACH_SCB9328) := scb9328
|
||||
board-$(CONFIG_MACH_PCM038) := pcm038
|
||||
board-$(CONFIG_MACH_IMX27ADS) := imx27ads
|
||||
board-$(CONFIG_MACH_NXDB500) := netx
|
||||
board-$(CONFIG_MACH_PCM037) := pcm037
|
||||
# FIXME "cpu-y" never used on ARM!
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
obj-y += lowlevel_init.o
|
||||
obj-y += imx27ads.o
|
|
@ -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
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /env/config
|
||||
|
||||
if [ x$1 = xflash ]; then
|
||||
root=flash
|
||||
kernel=flash
|
||||
fi
|
||||
|
||||
if [ x$1 = xnet ]; then
|
||||
root=net
|
||||
kernel=net
|
||||
fi
|
||||
|
||||
if [ x$ip = xdhcp ]; then
|
||||
bootargs="$bootargs ip=dhcp"
|
||||
else
|
||||
bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
|
||||
fi
|
||||
|
||||
if [ x$root = xflash ]; then
|
||||
bootargs="$bootargs root=$rootpart rootfstype=jffs2"
|
||||
else
|
||||
bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp"
|
||||
fi
|
||||
|
||||
bootargs="$bootargs mtdparts=physmap-flash.0:$mtdparts"
|
||||
|
||||
if [ $kernel = net ]; then
|
||||
if [ x$ip = xdhcp ]; then
|
||||
dhcp
|
||||
fi
|
||||
tftp $uimage uImage
|
||||
bootm uImage
|
||||
else
|
||||
bootm /dev/nor0.kernel
|
||||
fi
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
|
||||
PATH=/env/bin
|
||||
export PATH
|
||||
|
||||
. /env/config
|
||||
addpart /dev/nor0 $mtdparts
|
||||
|
||||
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 udate_root [<imagename>] to update rootfs into flash"
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
|
||||
boot
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /env/config
|
||||
|
||||
image=$uimage
|
||||
part=/dev/nor0.kernel
|
||||
|
||||
. /env/bin/_update $1
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /env/config
|
||||
|
||||
image=$jffs2
|
||||
part=/dev/nor0.root
|
||||
|
||||
. /env/bin/_update $1
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
# can be either 'net' or 'flash'
|
||||
kernel=net
|
||||
root=net
|
||||
|
||||
# use 'dhcp' todo dhcp in uboot and in kernel
|
||||
ip=dhcp
|
||||
|
||||
eth0.ipaddr=192.168.23.164
|
||||
eth0.netmask=255.255.255.0
|
||||
eth0.gateway=192.168.23.2
|
||||
eth0.serverip=192.168.23.2
|
||||
eth0.ethaddr=00:50:c2:72:a7:4a
|
||||
|
||||
uimage=uImage-pcm038
|
||||
jffs2=root-pcm038.jffs2
|
||||
|
||||
autoboot_timeout=3
|
||||
|
||||
nfsroot="/tmp/imx27ads"
|
||||
bootargs="console=ttymxc0,115200"
|
||||
|
||||
mtdparts="128k(uboot)ro,128k(ubootenv),1536k(kernel),-(root)"
|
||||
rootpart="/dev/mtdblock3"
|
||||
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright (C) 2007 Sascha Hauer, Pengutronix
|
||||
*
|
||||
* 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 <net.h>
|
||||
#include <cfi_flash.h>
|
||||
#include <init.h>
|
||||
#include <environment.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
#include <asm/io.h>
|
||||
#include <fec.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <partition.h>
|
||||
#include <fs.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static struct device_d cfi_dev = {
|
||||
.name = "cfi_flash",
|
||||
.id = "nor0",
|
||||
|
||||
.map_base = 0xC0000000,
|
||||
.size = 32 * 1024 * 1024,
|
||||
};
|
||||
|
||||
static struct device_d sdram_dev = {
|
||||
.name = "ram",
|
||||
.id = "ram0",
|
||||
|
||||
.map_base = 0xa0000000,
|
||||
.size = 128 * 1024 * 1024,
|
||||
|
||||
.type = DEVICE_TYPE_DRAM,
|
||||
};
|
||||
|
||||
static struct fec_platform_data fec_info = {
|
||||
.xcv_type = MII100,
|
||||
};
|
||||
|
||||
static struct device_d fec_dev = {
|
||||
.name = "fec_imx27",
|
||||
.id = "eth0",
|
||||
.map_base = 0x1002b000,
|
||||
.platform_data = &fec_info,
|
||||
.type = DEVICE_TYPE_ETHER,
|
||||
};
|
||||
|
||||
static void fec_cpld_init(void)
|
||||
{
|
||||
/* Select FEC data through data path */
|
||||
writew(0x0020, IMX_CS4_BASE + 0x10);
|
||||
|
||||
/* Enable CPLD FEC data path */
|
||||
writew(0x0010, IMX_CS4_BASE + 0x14);
|
||||
}
|
||||
|
||||
static int pcm038_devices_init(void)
|
||||
{
|
||||
int i;
|
||||
unsigned int mode[] = {
|
||||
PD0_AIN_FEC_TXD0,
|
||||
PD1_AIN_FEC_TXD1,
|
||||
PD2_AIN_FEC_TXD2,
|
||||
PD3_AIN_FEC_TXD3,
|
||||
PD4_AOUT_FEC_RX_ER,
|
||||
PD5_AOUT_FEC_RXD1,
|
||||
PD6_AOUT_FEC_RXD2,
|
||||
PD7_AOUT_FEC_RXD3,
|
||||
PD8_AF_FEC_MDIO,
|
||||
PD9_AIN_FEC_MDC | GPIO_PUEN,
|
||||
PD10_AOUT_FEC_CRS,
|
||||
PD11_AOUT_FEC_TX_CLK,
|
||||
PD12_AOUT_FEC_RXD0,
|
||||
PD13_AOUT_FEC_RX_DV,
|
||||
PD14_AOUT_FEC_CLR,
|
||||
PD15_AOUT_FEC_COL,
|
||||
PD16_AIN_FEC_TX_ER,
|
||||
PF23_AIN_FEC_TX_EN,
|
||||
PE12_PF_UART1_TXD,
|
||||
PE13_PF_UART1_RXD,
|
||||
PE14_PF_UART1_CTS,
|
||||
PE15_PF_UART1_RTS,
|
||||
};
|
||||
|
||||
/* initizalize gpios */
|
||||
for (i = 0; i < ARRAY_SIZE(mode); i++)
|
||||
imx_gpio_mode(mode[i]);
|
||||
|
||||
fec_cpld_init();
|
||||
|
||||
register_device(&cfi_dev);
|
||||
register_device(&sdram_dev);
|
||||
register_device(&fec_dev);
|
||||
|
||||
dev_add_partition(&cfi_dev, 0x00000, 0x20000, PARTITION_FIXED, "self");
|
||||
dev_add_partition(&cfi_dev, 0x20000, 0x20000, PARTITION_FIXED, "env");
|
||||
dev_protect(&cfi_dev, 0x20000, 0, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
device_initcall(pcm038_devices_init);
|
||||
|
||||
static struct device_d pcm038_serial_device = {
|
||||
.name = "imx_serial",
|
||||
.id = "cs0",
|
||||
.map_base = IMX_UART1_BASE,
|
||||
.size = 4096,
|
||||
.type = DEVICE_TYPE_CONSOLE,
|
||||
};
|
||||
|
||||
static int pcm038_console_init(void)
|
||||
{
|
||||
register_device(&pcm038_serial_device);
|
||||
return 0;
|
||||
}
|
||||
|
||||
console_initcall(pcm038_console_init);
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
/** @page imx27ads Freescale i.MX27ads
|
||||
|
||||
This is the Freescale evaluation board for the i.MX27 Processor
|
||||
|
||||
*/
|
|
@ -0,0 +1,182 @@
|
|||
/*
|
||||
* For clock initialization, see chapter 3 of the "MCIMX27 Multimedia
|
||||
* Applications Processor Reference Manual, Rev. 0.2".
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <asm/arch/imx-regs.h>
|
||||
|
||||
#define writel(val, reg) \
|
||||
ldr r0, =reg; \
|
||||
ldr r1, =val; \
|
||||
str r1, [r0];
|
||||
|
||||
#define CRM_PLL_PCTL_PARAM(pd, fd, fi, fn) (((pd-1)<<26) + ((fd-1)<<16) + (fi<<10) + (fn<<0))
|
||||
|
||||
.macro sdram_init_sha
|
||||
/*
|
||||
* DDR on CSD0
|
||||
*/
|
||||
writel(0x00000008, 0xD8001010)
|
||||
writel(0x55555555, 0x10027828)
|
||||
writel(0x55555555, 0x10027830)
|
||||
writel(0x55555555, 0x10027834)
|
||||
writel(0x00005005, 0x10027838)
|
||||
writel(0x15555555, 0x1002783C)
|
||||
writel(0x00000004, 0xD8001010)
|
||||
writel(0x006ac73a, 0xD8001004)
|
||||
writel(0x92100000, 0xD8001000)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0xA2100000, 0xD8001000)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0xA2200000, 0xD8001000)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0x00000000, 0xA0000F00)
|
||||
writel(0xb2100000, 0xD8001000)
|
||||
ldr r0, =0xA0000033
|
||||
mov r1, #0xda
|
||||
strb r1, [r0]
|
||||
ldr r0, =0xA1000000
|
||||
mov r1, #0xff
|
||||
strb r1, [r0]
|
||||
writel(0x82226080, 0xD8001000)
|
||||
.endm
|
||||
|
||||
.macro sdram_init_mx27_manual
|
||||
/*
|
||||
* sdram init sequence, as defined in 18.5.4 of the i.MX27 reference manual
|
||||
*/
|
||||
1:
|
||||
ldr r2, =ESD_ESDCTL0 /* base address of registers */
|
||||
ldr r3, =PRE_ALL_CMD /* SMODE=001 */
|
||||
str r3,(r2,#0x0) /* put CSD0 in precharge command mode */
|
||||
ldr r4, =SDRAM_CSD0 /* CSD0 precharge address (A10=1) */
|
||||
str r1,(r4,#0x0) /* precharge CSD0 all banks */
|
||||
ldr r3, =AUTO_REF_CMD /* SMODE=010 */
|
||||
str r3,(r2,#0x0) /* put array 0 in auto-refresh mode */
|
||||
ldr r4, =SDRAM_CSD0_BASE /* CSD0 base address */
|
||||
ldr r6,=0x7 /* load loop counter */
|
||||
1: ldr r5,(r4,#0x0) /* run auto-refresh cycle to array 0 */
|
||||
subs r6,r6,#1 /* decrease counter value */
|
||||
bne 1b
|
||||
ldr r3, =SET_MODE_REG_CMD /* SMODE=011 */
|
||||
str r3,(r2,#0x0) /* setup CSD0 for mode register write */
|
||||
ldr r3, =MODE_REG_VAL0 /* array 0 mode register value */
|
||||
ldrb r5,(r3,#0x0) /* New mode register value on address bus */
|
||||
ldr r3, =NORMAL_MODE /* SMODE=000 */
|
||||
str r3,(r2,#0x0) /* setup CSD0 for normal operation */
|
||||
|
||||
ESD_ESDCTL0 .long 0xD8001000 // system/external device dependent data
|
||||
SDRAM_CSD0 .long 0x00000000 // system/external device dependent data
|
||||
SDRAM_CSD0_BASE .long 0x00000000 // system/external device dependent data
|
||||
PRE_ALL_CMD .long 0x00000000 // system/external device dependent data (SMODE=001)
|
||||
AUTO_REF_CMD .long 0x00000000 // system/external device dependent data (SMODE=010)
|
||||
SET_MODE_REG_CMD .long 0x00000000 // system/external device dependent data (SMODE=011)
|
||||
MODE_REG_VAL0 .long 0x00000000 // system/external device dependent data
|
||||
NORMAL_MODE .long 0x00000000 // system/external device dependent data (SMODE=000)
|
||||
.endm
|
||||
|
||||
.macro sdram_init_uboot
|
||||
/* configure 16 bit nor flash on cs0 */
|
||||
writel(0x0000CC03, 0xd8002000)
|
||||
writel(0xa0330D01, 0xd8002004)
|
||||
writel(0x00220800, 0xd8002008)
|
||||
|
||||
/* ddr on csd0 - initial reset */
|
||||
writel(0x00000008, 0xD8001010)
|
||||
|
||||
/* configure ddr on csd0 - wait 5000 cycles */
|
||||
writel(0x00000004, 0xD8001010)
|
||||
writel(0x006ac73a, 0xD8001004)
|
||||
writel(0x92100000, 0xD8001000)
|
||||
writel(0x12344321, 0xA0000f00)
|
||||
writel(0xa2100000, 0xD8001000)
|
||||
writel(0x12344321, 0xA0000000)
|
||||
writel(0x12344321, 0xA0000000)
|
||||
writel(0xb2100000, 0xD8001000)
|
||||
ldr r0, =0xA0000033
|
||||
mov r1, #0xda
|
||||
strb r1, [r0]
|
||||
ldr r0, =0xA1000000
|
||||
mov r1, #0xff
|
||||
strb r1, [r0]
|
||||
writel(0x82226080, 0xD8001000)
|
||||
writel(0xDEADBEEF, 0xA0000000)
|
||||
writel(0x0000000c, 0xD8001010)
|
||||
.endm
|
||||
|
||||
.globl board_init_lowlevel
|
||||
board_init_lowlevel:
|
||||
|
||||
mov r10, lr
|
||||
|
||||
/* ahb lite ip interface */
|
||||
writel(0x20040304, AIPI1_PSR0)
|
||||
writel(0xDFFBFCFB, AIPI1_PSR1)
|
||||
writel(0x00000000, AIPI2_PSR0)
|
||||
writel(0xFFFFFFFF, AIPI2_PSR1)
|
||||
|
||||
/* disable mpll/spll */
|
||||
ldr r0, =CSCR
|
||||
ldr r1, [r0]
|
||||
bic r1, r1, #0x03
|
||||
str r1, [r0]
|
||||
|
||||
/*
|
||||
* pll clock initialization - see section 3.4.3 of the i.MX27 manual
|
||||
*
|
||||
* FIXME: Using the 399*2 MHz values from table 3-8 doens't work
|
||||
* with 1.2 V core voltage! Find out if this is
|
||||
* documented somewhere.
|
||||
*/
|
||||
writel(0x00191403, MPCTL0) /* MPLL = 199.5*2 MHz */
|
||||
writel(0x040C2403, SPCTL0) /* SPLL = FIXME (needs review) */
|
||||
|
||||
/*
|
||||
* ARM clock = (399 MHz / 2) / (ARM divider = 1) = 200 MHz
|
||||
* AHB clock = (399 MHz / 3) / (AHB divider = 2) = 66.5 MHz
|
||||
* System clock (HCLK) = 133 MHz
|
||||
*/
|
||||
writel(0x33F30307 | CSCR_MPLL_RESTART | CSCR_SPLL_RESTART, CSCR)
|
||||
|
||||
/* add some delay here */
|
||||
mov r1, #0x1000
|
||||
1: subs r1, r1, #0x1
|
||||
bne 1b
|
||||
|
||||
/* clock gating enable */
|
||||
writel(0x00050f08, GPCR)
|
||||
|
||||
/* peripheral clock divider */
|
||||
writel(0x23C8F403, PCDR0) /* FIXME */
|
||||
writel(0x09030913, PCDR1) /* PERDIV1=08 @133 MHz */
|
||||
/* PERDIV1=04 @266 MHz */
|
||||
|
||||
/* configure 16 bit nor flash on cs0 */
|
||||
writel(0x0000CC03, CS0U)
|
||||
writel(0xa0330D01, CS0L)
|
||||
writel(0x00220800, CS0A)
|
||||
|
||||
/* configure cpld on cs4 */
|
||||
writel(0x0000DCF6, CS4U)
|
||||
writel(0x444A4541, CS4L)
|
||||
writel(0x44443302, CS4A)
|
||||
|
||||
/* skip sdram initialization if we run from ram */
|
||||
cmp pc, #0xa0000000
|
||||
bls 1f
|
||||
cmp pc, #0xc0000000
|
||||
bhi 1f
|
||||
|
||||
mov pc,r10
|
||||
1:
|
||||
sdram_init_sha
|
||||
|
||||
mov pc,r10
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* @file
|
||||
* @brief Global defintions for the ARM i.MX27 based pcm038
|
||||
*
|
||||
* 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
|
||||
|
||||
/* FIXME: ugly....should be simply part of the BSP file */
|
||||
|
||||
#include <asm/mach-types.h>
|
||||
|
||||
#define CONFIG_ARCH_NUMBER MACH_TYPE_MX27ADS
|
||||
#define CONFIG_BOOT_PARAMS 0xa0000100
|
||||
#define CFG_MALLOC_LEN (4096 << 10)
|
||||
#define CONFIG_STACKSIZE ( 120 << 10) /* stack size */
|
||||
|
||||
#endif /* __CONFIG_H */
|
Loading…
Reference in New Issue