2007-02-11 17:31:01 +00:00
|
|
|
/* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
|
2006-09-21 21:57:12 +00:00
|
|
|
*
|
|
|
|
* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006 American Microsystems Limited
|
|
|
|
* David Anders <danders@amltd.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
|
|
|
|
*
|
|
|
|
* @History:
|
|
|
|
* derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
|
|
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/init.h>
|
2009-05-13 21:52:24 +00:00
|
|
|
#include <linux/gpio.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/proc_fs.h>
|
2007-02-11 17:56:03 +00:00
|
|
|
#include <linux/serial_core.h>
|
2014-02-14 01:32:45 +00:00
|
|
|
#include <linux/serial_s3c.h>
|
2008-09-06 11:10:45 +00:00
|
|
|
#include <linux/io.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/map.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
#include <asm/mach/flash.h>
|
|
|
|
|
2008-08-05 15:14:15 +00:00
|
|
|
#include <mach/hardware.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/mach-types.h>
|
2008-08-05 15:14:15 +00:00
|
|
|
#include <mach/fb.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
|
2008-08-05 15:14:15 +00:00
|
|
|
#include <mach/regs-lcd.h>
|
|
|
|
#include <mach/regs-gpio.h>
|
2014-01-14 13:24:24 +00:00
|
|
|
#include <mach/gpio-samsung.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
|
2012-08-24 13:22:12 +00:00
|
|
|
#include <linux/platform_data/i2c-s3c2410.h>
|
2008-10-07 21:26:09 +00:00
|
|
|
#include <plat/devs.h>
|
|
|
|
#include <plat/cpu.h>
|
2010-05-04 05:38:49 +00:00
|
|
|
#include <plat/gpio-cfg.h>
|
2006-09-21 21:57:12 +00:00
|
|
|
|
|
|
|
#include <linux/mtd/mtd.h>
|
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
#include <linux/mtd/map.h>
|
|
|
|
#include <linux/mtd/physmap.h>
|
|
|
|
|
2013-01-10 02:47:04 +00:00
|
|
|
#include <plat/samsung-time.h>
|
|
|
|
|
2012-01-03 13:02:03 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2012-05-12 07:12:20 +00:00
|
|
|
static struct resource amlm5900_nor_resource =
|
|
|
|
DEFINE_RES_MEM(0x00000000, SZ_16M);
|
2006-09-21 21:57:12 +00:00
|
|
|
|
|
|
|
static struct mtd_partition amlm5900_mtd_partitions[] = {
|
|
|
|
{
|
|
|
|
.name = "System",
|
|
|
|
.size = 0x240000,
|
|
|
|
.offset = 0,
|
|
|
|
.mask_flags = MTD_WRITEABLE, /* force read-only */
|
|
|
|
}, {
|
|
|
|
.name = "Kernel",
|
|
|
|
.size = 0x100000,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}, {
|
|
|
|
.name = "Ramdisk",
|
|
|
|
.size = 0x300000,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}, {
|
|
|
|
.name = "JFFS2",
|
|
|
|
.size = 0x9A0000,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}, {
|
|
|
|
.name = "Settings",
|
|
|
|
.size = MTDPART_SIZ_FULL,
|
|
|
|
.offset = MTDPART_OFS_APPEND,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct physmap_flash_data amlm5900_flash_data = {
|
|
|
|
.width = 2,
|
|
|
|
.parts = amlm5900_mtd_partitions,
|
|
|
|
.nr_parts = ARRAY_SIZE(amlm5900_mtd_partitions),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device amlm5900_device_nor = {
|
|
|
|
.name = "physmap-flash",
|
|
|
|
.id = 0,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &amlm5900_flash_data,
|
|
|
|
},
|
|
|
|
.num_resources = 1,
|
|
|
|
.resource = &amlm5900_nor_resource,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct map_desc amlm5900_iodesc[] __initdata = {
|
|
|
|
};
|
|
|
|
|
|
|
|
#define UCON S3C2410_UCON_DEFAULT
|
|
|
|
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
|
|
|
|
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
|
|
|
|
|
|
|
|
static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
|
|
|
|
[0] = {
|
|
|
|
.hwport = 0,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.hwport = 1,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
},
|
|
|
|
[2] = {
|
|
|
|
.hwport = 2,
|
|
|
|
.flags = 0,
|
|
|
|
.ucon = UCON,
|
|
|
|
.ulcon = ULCON,
|
|
|
|
.ufcon = UFCON,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct platform_device *amlm5900_devices[] __initdata = {
|
|
|
|
#ifdef CONFIG_FB_S3C2410
|
|
|
|
&s3c_device_lcd,
|
|
|
|
#endif
|
|
|
|
&s3c_device_adc,
|
|
|
|
&s3c_device_wdt,
|
2008-10-31 16:14:40 +00:00
|
|
|
&s3c_device_i2c0,
|
2009-11-23 00:13:39 +00:00
|
|
|
&s3c_device_ohci,
|
2006-09-21 21:57:12 +00:00
|
|
|
&s3c_device_rtc,
|
|
|
|
&s3c_device_usbgadget,
|
|
|
|
&s3c_device_sdi,
|
|
|
|
&amlm5900_device_nor,
|
|
|
|
};
|
|
|
|
|
2007-05-28 17:57:31 +00:00
|
|
|
static void __init amlm5900_map_io(void)
|
2006-09-21 21:57:12 +00:00
|
|
|
{
|
|
|
|
s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
|
|
|
|
s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
|
2013-01-10 02:47:04 +00:00
|
|
|
samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
|
2006-09-21 21:57:12 +00:00
|
|
|
}
|
|
|
|
|
2014-05-08 20:49:29 +00:00
|
|
|
static void __init amlm5900_init_time(void)
|
|
|
|
{
|
|
|
|
s3c2410_init_clocks(12000000);
|
|
|
|
samsung_timer_init();
|
|
|
|
}
|
|
|
|
|
2006-09-21 21:57:12 +00:00
|
|
|
#ifdef CONFIG_FB_S3C2410
|
2007-10-16 08:28:56 +00:00
|
|
|
static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
|
2006-09-21 21:57:12 +00:00
|
|
|
.width = 160,
|
|
|
|
.height = 160,
|
|
|
|
|
2007-10-16 08:28:57 +00:00
|
|
|
.type = S3C2410_LCDCON1_STN4,
|
|
|
|
|
2007-10-16 08:29:06 +00:00
|
|
|
.pixclock = 680000, /* HCLK = 100MHz */
|
2007-10-16 08:28:56 +00:00
|
|
|
.xres = 160,
|
|
|
|
.yres = 160,
|
|
|
|
.bpp = 4,
|
2007-10-16 08:28:57 +00:00
|
|
|
.left_margin = 1 << (4 + 3),
|
|
|
|
.right_margin = 8 << 3,
|
2007-10-16 08:29:00 +00:00
|
|
|
.hsync_len = 48,
|
2007-10-16 08:28:59 +00:00
|
|
|
.upper_margin = 0,
|
|
|
|
.lower_margin = 0,
|
2007-10-16 08:28:56 +00:00
|
|
|
|
2007-10-16 08:28:58 +00:00
|
|
|
.lcdcon5 = 0x00000001,
|
2007-10-16 08:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
|
|
|
|
|
|
|
|
.displays = &amlm5900_lcd_info,
|
|
|
|
.num_displays = 1,
|
|
|
|
.default_display = 0,
|
|
|
|
|
2006-09-21 21:57:12 +00:00
|
|
|
.gpccon = 0xaaaaaaaa,
|
|
|
|
.gpccon_mask = 0xffffffff,
|
|
|
|
.gpcup = 0x0000ffff,
|
|
|
|
.gpcup_mask = 0xffffffff,
|
|
|
|
|
|
|
|
.gpdcon = 0xaaaaaaaa,
|
|
|
|
.gpdcon_mask = 0xffffffff,
|
|
|
|
.gpdup = 0x0000ffff,
|
|
|
|
.gpdup_mask = 0xffffffff,
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2006-09-26 16:46:00 +00:00
|
|
|
static irqreturn_t
|
2006-10-06 17:53:39 +00:00
|
|
|
amlm5900_wake_interrupt(int irq, void *ignored)
|
2006-09-21 21:57:12 +00:00
|
|
|
{
|
2006-09-26 16:46:00 +00:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
2006-09-21 21:57:12 +00:00
|
|
|
|
2006-09-26 16:46:00 +00:00
|
|
|
static void amlm5900_init_pm(void)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
|
|
|
|
IRQF_TRIGGER_RISING | IRQF_SHARED,
|
|
|
|
"amlm5900_wakeup", &amlm5900_wake_interrupt);
|
|
|
|
if (ret != 0) {
|
|
|
|
printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
|
|
|
|
} else {
|
|
|
|
enable_irq_wake(IRQ_EINT9);
|
|
|
|
/* configure the suspend/resume status pin */
|
2010-05-04 05:38:49 +00:00
|
|
|
s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
|
2010-05-06 02:03:50 +00:00
|
|
|
s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
|
2006-09-26 16:46:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
static void __init amlm5900_init(void)
|
|
|
|
{
|
|
|
|
amlm5900_init_pm();
|
2006-09-21 21:57:12 +00:00
|
|
|
#ifdef CONFIG_FB_S3C2410
|
2007-10-16 08:28:56 +00:00
|
|
|
s3c24xx_fb_set_platdata(&amlm5900_fb_info);
|
2006-09-21 21:57:12 +00:00
|
|
|
#endif
|
2008-10-31 16:14:40 +00:00
|
|
|
s3c_i2c0_set_platdata(NULL);
|
2007-04-20 10:19:16 +00:00
|
|
|
platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
|
2006-09-21 21:57:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(AML_M5900, "AML_M5900")
|
2011-07-06 02:38:17 +00:00
|
|
|
.atag_offset = 0x100,
|
2006-09-21 21:57:12 +00:00
|
|
|
.map_io = amlm5900_map_io,
|
2013-03-07 03:38:19 +00:00
|
|
|
.init_irq = s3c2410_init_irq,
|
2006-09-21 21:57:12 +00:00
|
|
|
.init_machine = amlm5900_init,
|
2014-05-08 20:49:29 +00:00
|
|
|
.init_time = amlm5900_init_time,
|
2012-01-03 13:02:03 +00:00
|
|
|
.restart = s3c2410_restart,
|
2006-09-21 21:57:12 +00:00
|
|
|
MACHINE_END
|