2009-06-29 10:35:55 +00:00
|
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2009 Juergen Beisert, 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
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief a9m2440 Specific Board Initialization routines
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
|
#include <driver.h>
|
|
|
|
|
#include <init.h>
|
|
|
|
|
#include <asm/armlinux.h>
|
2010-09-16 08:28:38 +00:00
|
|
|
|
#include <generated/mach-types.h>
|
2009-06-29 10:35:55 +00:00
|
|
|
|
#include <partition.h>
|
|
|
|
|
#include <nand.h>
|
2011-09-22 17:02:57 +00:00
|
|
|
|
#include <io.h>
|
2012-01-02 11:43:51 +00:00
|
|
|
|
#include <mach/s3c-iomap.h>
|
2012-01-02 11:43:52 +00:00
|
|
|
|
#include <mach/s3c24xx-nand.h>
|
2012-01-02 11:43:51 +00:00
|
|
|
|
#include <mach/s3c-generic.h>
|
2012-01-02 11:44:01 +00:00
|
|
|
|
#include <mach/s3c-busctl.h>
|
2012-01-02 11:44:02 +00:00
|
|
|
|
#include <mach/s3c24xx-gpio.h>
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
2009-10-27 18:57:37 +00:00
|
|
|
|
#include "baseboards.h"
|
|
|
|
|
|
2009-06-29 10:35:55 +00:00
|
|
|
|
static struct s3c24x0_nand_platform_data nand_info = {
|
|
|
|
|
.nand_timing = CALC_NFCONF_TIMING(A9M2440_TACLS, A9M2440_TWRPH0, A9M2440_TWRPH1)
|
|
|
|
|
};
|
|
|
|
|
|
2009-10-27 18:57:36 +00:00
|
|
|
|
static int a9m2440_check_for_ram(uint32_t addr)
|
|
|
|
|
{
|
|
|
|
|
uint32_t tmp1, tmp2;
|
|
|
|
|
int rc = 0;
|
|
|
|
|
|
|
|
|
|
tmp1 = readl(addr);
|
|
|
|
|
tmp2 = readl(addr + sizeof(uint32_t));
|
|
|
|
|
|
|
|
|
|
writel(0xaaaaaaaa, addr);
|
|
|
|
|
writel(0x55555555, addr + sizeof(uint32_t));
|
|
|
|
|
if ((readl(addr) != 0xaaaaaaaa) || (readl(addr + sizeof(uint32_t)) != 0x55555555))
|
|
|
|
|
rc = 1; /* seems no RAM */
|
|
|
|
|
|
|
|
|
|
writel(0x55555555, addr);
|
|
|
|
|
writel(0xaaaaaaaa, addr + sizeof(uint32_t));
|
|
|
|
|
if ((readl(addr) != 0x55555555) || (readl(addr + sizeof(uint32_t)) != 0xaaaaaaaa))
|
|
|
|
|
rc = 1; /* seems no RAM */
|
|
|
|
|
|
|
|
|
|
writel(tmp1, addr);
|
|
|
|
|
writel(tmp2, addr + sizeof(uint32_t));
|
|
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-29 09:43:48 +00:00
|
|
|
|
static int a9m2440_mem_init(void)
|
2009-06-29 10:35:55 +00:00
|
|
|
|
{
|
|
|
|
|
/*
|
2009-10-27 18:57:36 +00:00
|
|
|
|
* The special SDRAM setup code for this machine will always enable
|
|
|
|
|
* both SDRAM banks. But the second SDRAM device may not exists!
|
|
|
|
|
* So we must check here, if the second bank is populated to get the
|
|
|
|
|
* correct RAM size.
|
2009-06-29 10:35:55 +00:00
|
|
|
|
*/
|
2012-01-02 11:44:01 +00:00
|
|
|
|
switch (readl(S3C_BANKSIZE) & 0x7) {
|
2009-06-29 10:35:55 +00:00
|
|
|
|
case 0:
|
2012-01-02 11:44:01 +00:00
|
|
|
|
if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 32 * 1024 * 1024))
|
|
|
|
|
s3c24xx_disable_second_sdram_bank();
|
2009-06-29 10:35:55 +00:00
|
|
|
|
break;
|
|
|
|
|
case 1:
|
2012-01-02 11:44:01 +00:00
|
|
|
|
if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 64 * 1024 * 1024))
|
|
|
|
|
s3c24xx_disable_second_sdram_bank();
|
2009-06-29 10:35:55 +00:00
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2012-01-02 11:44:01 +00:00
|
|
|
|
if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 128 * 1024 * 1024))
|
|
|
|
|
s3c24xx_disable_second_sdram_bank();
|
2009-06-29 10:35:55 +00:00
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
2009-10-27 18:57:36 +00:00
|
|
|
|
case 6: /* not supported on this machine */
|
2009-06-29 10:35:55 +00:00
|
|
|
|
break;
|
2009-10-27 18:57:36 +00:00
|
|
|
|
default:
|
2012-01-02 11:44:01 +00:00
|
|
|
|
if (a9m2440_check_for_ram(S3C_SDRAM_BASE + 16 * 1024 * 1024))
|
|
|
|
|
s3c24xx_disable_second_sdram_bank();
|
2009-06-29 10:35:55 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-02 11:44:01 +00:00
|
|
|
|
arm_add_mem_device("ram0", S3C_SDRAM_BASE, s3c24xx_get_memory_size());
|
2011-07-29 09:43:48 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
mem_initcall(a9m2440_mem_init);
|
|
|
|
|
|
|
|
|
|
static int a9m2440_devices_init(void)
|
|
|
|
|
{
|
|
|
|
|
uint32_t reg;
|
|
|
|
|
|
2009-06-29 10:35:55 +00:00
|
|
|
|
/* ----------- configure the access to the outer space ---------- */
|
2012-01-02 11:44:01 +00:00
|
|
|
|
reg = readl(S3C_BWSCON);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
2009-10-27 18:57:36 +00:00
|
|
|
|
/* CS#5 to access the network controller */
|
|
|
|
|
reg &= ~0x00f00000;
|
|
|
|
|
reg |= 0x00d00000; /* 16 bit */
|
2012-01-02 11:44:01 +00:00
|
|
|
|
writel(0x1f4c, S3C_BANKCON5);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
2012-01-02 11:44:01 +00:00
|
|
|
|
writel(reg, S3C_BWSCON);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
2009-10-27 18:57:37 +00:00
|
|
|
|
#ifdef CONFIG_MACH_A9M2410DEV
|
|
|
|
|
a9m2410dev_devices_init();
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* release the reset signal to external devices */
|
2012-01-02 11:44:02 +00:00
|
|
|
|
reg = readl(S3C_MISCCR);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
reg |= 0x10000;
|
2012-01-02 11:44:02 +00:00
|
|
|
|
writel(reg, S3C_MISCCR);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
|
|
|
|
/* ----------- the devices the boot loader should work with -------- */
|
2011-07-29 05:31:19 +00:00
|
|
|
|
add_generic_device("s3c24x0_nand", -1, NULL, S3C24X0_NAND_BASE, 0,
|
|
|
|
|
IORESOURCE_MEM, &nand_info);
|
|
|
|
|
/*
|
|
|
|
|
* cs8900 network controller onboard
|
|
|
|
|
* Connected to CS line 5 + A24 and interrupt line EINT9,
|
|
|
|
|
* data width is 16 bit
|
|
|
|
|
*/
|
2012-01-02 11:44:01 +00:00
|
|
|
|
add_generic_device("cs8900", -1, NULL, S3C_CS5_BASE + (1 << 24) + 0x300, 16,
|
2011-07-29 05:31:19 +00:00
|
|
|
|
IORESOURCE_MEM, NULL);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_NAND
|
|
|
|
|
/* ----------- add some vital partitions -------- */
|
2009-07-21 14:55:49 +00:00
|
|
|
|
devfs_add_partition("nand0", 0x00000, 0x40000, PARTITION_FIXED, "self_raw");
|
2009-10-27 18:57:34 +00:00
|
|
|
|
dev_add_bb_dev("self_raw", "self0");
|
2009-07-21 14:55:49 +00:00
|
|
|
|
|
2009-10-27 18:57:34 +00:00
|
|
|
|
devfs_add_partition("nand0", 0x40000, 0x20000, PARTITION_FIXED, "env_raw");
|
2009-08-11 14:46:45 +00:00
|
|
|
|
dev_add_bb_dev("env_raw", "env0");
|
2009-06-29 10:35:55 +00:00
|
|
|
|
#endif
|
2012-01-02 11:44:01 +00:00
|
|
|
|
armlinux_set_bootparams((void*)S3C_SDRAM_BASE + 0x100);
|
2009-07-31 10:07:25 +00:00
|
|
|
|
armlinux_set_architecture(MACH_TYPE_A9M2440);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
device_initcall(a9m2440_devices_init);
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_S3C24XX_NAND_BOOT
|
|
|
|
|
void __bare_init nand_boot(void)
|
|
|
|
|
{
|
2011-03-12 19:14:55 +00:00
|
|
|
|
s3c24x0_nand_load_image((void *)TEXT_BASE, 256 * 1024, 0);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static int a9m2440_console_init(void)
|
|
|
|
|
{
|
2012-01-02 11:44:00 +00:00
|
|
|
|
add_generic_device("s3c_serial", -1, NULL, S3C_UART1_BASE, S3C_UART1_SIZE,
|
2011-07-29 05:31:19 +00:00
|
|
|
|
IORESOURCE_MEM, NULL);
|
2009-06-29 10:35:55 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console_initcall(a9m2440_console_init);
|
|
|
|
|
|
|
|
|
|
/** @page a9m2440 DIGI's a9m2440
|
|
|
|
|
|
|
|
|
|
This CPU card is based on a Samsung S3C2440 CPU. The card is shipped with:
|
|
|
|
|
|
|
|
|
|
- S3C2440\@400 MHz or 533 MHz (ARM920T/ARMv4T)
|
|
|
|
|
- 16.9344 MHz crystal reference
|
2009-10-27 18:57:36 +00:00
|
|
|
|
- SDRAM 32/64/128 MiB
|
|
|
|
|
- Samsung K4M563233E-EE1H (one or two devices for 32 MiB or 64 MiB)
|
|
|
|
|
- 2M x 32bit x 4 Banks Mobile SDRAM
|
|
|
|
|
- CL2\@100 MHz (CAS/RAS delay 19ns)
|
|
|
|
|
- 105 MHz max
|
|
|
|
|
- collumn address size is 9 bits
|
|
|
|
|
- Row cycle time: 69ns
|
|
|
|
|
- Samsung K4M513233C-DG75 (one or two devices for 64 MiB or 128 MiB)
|
|
|
|
|
- 4M x 32bit x 4 Banks Mobile SDRAM
|
|
|
|
|
- CL2\@100MHz (CAS/RAS delay 18ns)
|
|
|
|
|
- 111 MHz max
|
|
|
|
|
- collumn address size is 9 bits
|
|
|
|
|
- Row cycle time: 63ns
|
|
|
|
|
- 64ms refresh period (4k)
|
2009-06-29 10:35:55 +00:00
|
|
|
|
- 90 pin FBGA
|
|
|
|
|
- 32 bit data bits
|
|
|
|
|
- Extended temperature range (-25<EFBFBD>C...85<EFBFBD>C)
|
2009-10-27 18:57:36 +00:00
|
|
|
|
- NAND Flash 32/64/128 MiB
|
|
|
|
|
- Samsung KM29U512T (NAND01GW3A0AN6)
|
|
|
|
|
- 64 MiB 3,3V 8-bit
|
|
|
|
|
- ID: 0xEC, 0x76, 0x??, 0xBD
|
|
|
|
|
- Samsung KM29U256T
|
|
|
|
|
- 32 MiB 3,3V 8-bit
|
|
|
|
|
- ID: 0xEC, 0x75, 0x??, 0xBD
|
|
|
|
|
- ST Micro
|
|
|
|
|
- 128 MiB 3,3V 8-bit
|
|
|
|
|
- ID: 0x20, 0x79
|
2009-06-29 10:35:55 +00:00
|
|
|
|
- 30ns/40ns/20ns
|
2009-10-27 18:57:36 +00:00
|
|
|
|
- I2C interface, 100 KHz and 400 KHz
|
2009-06-29 10:35:55 +00:00
|
|
|
|
- Real Time Clock
|
|
|
|
|
- Dallas DS1337
|
2009-07-31 10:04:13 +00:00
|
|
|
|
- address 0x68
|
2009-10-27 18:57:36 +00:00
|
|
|
|
- EEPROM
|
|
|
|
|
- ST M24LC64
|
|
|
|
|
- address 0x50
|
|
|
|
|
- 16bit addressing
|
2009-06-29 10:35:55 +00:00
|
|
|
|
- LCD interface
|
|
|
|
|
- Touch Screen interface
|
|
|
|
|
- Camera interface
|
|
|
|
|
- I2S interface
|
|
|
|
|
- AC97 Audio-CODEC interface
|
|
|
|
|
- SD card interface
|
|
|
|
|
- 3 serial RS232 interfaces
|
|
|
|
|
- Host and device USB interface, USB1.1 compliant
|
|
|
|
|
- Ethernet interface
|
2009-10-27 18:57:36 +00:00
|
|
|
|
- 10Mbps, Cirrus Logic, CS8900A (on the CPU card)
|
2009-06-29 10:35:55 +00:00
|
|
|
|
- SPI interface
|
|
|
|
|
- JTAG interface
|
|
|
|
|
|
2009-07-31 11:03:33 +00:00
|
|
|
|
How to get the binary image:
|
|
|
|
|
|
|
|
|
|
Using the default configuration:
|
|
|
|
|
|
|
|
|
|
@code
|
|
|
|
|
make ARCH=arm a9m2440_defconfig
|
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
|
|
Build the binary image:
|
|
|
|
|
|
|
|
|
|
@code
|
|
|
|
|
make ARCH=arm CROSS_COMPILE=armv4compiler
|
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
|
|
@note replace the armv4compiler with your ARM v4 cross compiler.
|
|
|
|
|
|
2009-06-29 10:35:55 +00:00
|
|
|
|
*/
|