linux/arch/arm/mach-s3c24xx/mach-amlm5900.c
<<
>>
Prefs
   1/* linux/arch/arm/mach-s3c2410/mach-amlm5900.c
   2 *
   3 * linux/arch/arm/mach-s3c2410/mach-amlm5900.c
   4 *
   5 * Copyright (c) 2006 American Microsystems Limited
   6 *      David Anders <danders@amltd.com>
   7
   8 * This program is free software; you can redistribute it and/or
   9 * modify it under the terms of the GNU General Public License as
  10 * published by the Free Software Foundation; either version 2 of
  11 * the License, or (at your option) any later version.
  12 *
  13 * This program is distributed in the hope that it will be useful,
  14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16 * GNU General Public License for more details.
  17 *
  18 * You should have received a copy of the GNU General Public License
  19 * along with this program; if not, write to the Free Software
  20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21 * MA 02111-1307 USA
  22 *
  23 * @History:
  24 * derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
  25 * Ben Dooks <ben@simtec.co.uk>
  26 *
  27 ***********************************************************************/
  28
  29#include <linux/kernel.h>
  30#include <linux/types.h>
  31#include <linux/interrupt.h>
  32#include <linux/list.h>
  33#include <linux/timer.h>
  34#include <linux/init.h>
  35#include <linux/gpio.h>
  36#include <linux/device.h>
  37#include <linux/platform_device.h>
  38#include <linux/proc_fs.h>
  39#include <linux/serial_core.h>
  40#include <linux/io.h>
  41
  42#include <asm/mach/arch.h>
  43#include <asm/mach/map.h>
  44#include <asm/mach/irq.h>
  45#include <asm/mach/flash.h>
  46
  47#include <mach/hardware.h>
  48#include <asm/irq.h>
  49#include <asm/mach-types.h>
  50#include <mach/fb.h>
  51
  52#include <plat/regs-serial.h>
  53#include <mach/regs-lcd.h>
  54#include <mach/regs-gpio.h>
  55
  56#include <plat/iic.h>
  57#include <plat/devs.h>
  58#include <plat/cpu.h>
  59#include <plat/gpio-cfg.h>
  60
  61#include <linux/mtd/mtd.h>
  62#include <linux/mtd/partitions.h>
  63#include <linux/mtd/map.h>
  64#include <linux/mtd/physmap.h>
  65
  66#include "common.h"
  67
  68static struct resource amlm5900_nor_resource =
  69                        DEFINE_RES_MEM(0x00000000, SZ_16M);
  70
  71static struct mtd_partition amlm5900_mtd_partitions[] = {
  72        {
  73                .name           = "System",
  74                .size           = 0x240000,
  75                .offset         = 0,
  76                .mask_flags     = MTD_WRITEABLE,  /* force read-only */
  77        }, {
  78                .name           = "Kernel",
  79                .size           = 0x100000,
  80                .offset         = MTDPART_OFS_APPEND,
  81        }, {
  82                .name           = "Ramdisk",
  83                .size           = 0x300000,
  84                .offset         = MTDPART_OFS_APPEND,
  85        }, {
  86                .name           = "JFFS2",
  87                .size           = 0x9A0000,
  88                .offset         = MTDPART_OFS_APPEND,
  89        }, {
  90                .name           = "Settings",
  91                .size           = MTDPART_SIZ_FULL,
  92                .offset         = MTDPART_OFS_APPEND,
  93        }
  94};
  95
  96static struct physmap_flash_data amlm5900_flash_data = {
  97        .width          = 2,
  98        .parts          = amlm5900_mtd_partitions,
  99        .nr_parts       = ARRAY_SIZE(amlm5900_mtd_partitions),
 100};
 101
 102static struct platform_device amlm5900_device_nor = {
 103        .name           = "physmap-flash",
 104        .id             = 0,
 105        .dev = {
 106                        .platform_data = &amlm5900_flash_data,
 107                },
 108        .num_resources  = 1,
 109        .resource       = &amlm5900_nor_resource,
 110};
 111
 112static struct map_desc amlm5900_iodesc[] __initdata = {
 113};
 114
 115#define UCON S3C2410_UCON_DEFAULT
 116#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
 117#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
 118
 119static struct s3c2410_uartcfg amlm5900_uartcfgs[] = {
 120        [0] = {
 121                .hwport      = 0,
 122                .flags       = 0,
 123                .ucon        = UCON,
 124                .ulcon       = ULCON,
 125                .ufcon       = UFCON,
 126        },
 127        [1] = {
 128                .hwport      = 1,
 129                .flags       = 0,
 130                .ucon        = UCON,
 131                .ulcon       = ULCON,
 132                .ufcon       = UFCON,
 133        },
 134        [2] = {
 135                .hwport      = 2,
 136                .flags       = 0,
 137                .ucon        = UCON,
 138                .ulcon       = ULCON,
 139                .ufcon       = UFCON,
 140        }
 141};
 142
 143
 144static struct platform_device *amlm5900_devices[] __initdata = {
 145#ifdef CONFIG_FB_S3C2410
 146        &s3c_device_lcd,
 147#endif
 148        &s3c_device_adc,
 149        &s3c_device_wdt,
 150        &s3c_device_i2c0,
 151        &s3c_device_ohci,
 152        &s3c_device_rtc,
 153        &s3c_device_usbgadget,
 154        &s3c_device_sdi,
 155        &amlm5900_device_nor,
 156};
 157
 158static void __init amlm5900_map_io(void)
 159{
 160        s3c24xx_init_io(amlm5900_iodesc, ARRAY_SIZE(amlm5900_iodesc));
 161        s3c24xx_init_clocks(0);
 162        s3c24xx_init_uarts(amlm5900_uartcfgs, ARRAY_SIZE(amlm5900_uartcfgs));
 163}
 164
 165#ifdef CONFIG_FB_S3C2410
 166static struct s3c2410fb_display __initdata amlm5900_lcd_info = {
 167        .width          = 160,
 168        .height         = 160,
 169
 170        .type           = S3C2410_LCDCON1_STN4,
 171
 172        .pixclock       = 680000, /* HCLK = 100MHz */
 173        .xres           = 160,
 174        .yres           = 160,
 175        .bpp            = 4,
 176        .left_margin    = 1 << (4 + 3),
 177        .right_margin   = 8 << 3,
 178        .hsync_len      = 48,
 179        .upper_margin   = 0,
 180        .lower_margin   = 0,
 181
 182        .lcdcon5        = 0x00000001,
 183};
 184
 185static struct s3c2410fb_mach_info __initdata amlm5900_fb_info = {
 186
 187        .displays = &amlm5900_lcd_info,
 188        .num_displays = 1,
 189        .default_display = 0,
 190
 191        .gpccon =       0xaaaaaaaa,
 192        .gpccon_mask =  0xffffffff,
 193        .gpcup =        0x0000ffff,
 194        .gpcup_mask =   0xffffffff,
 195
 196        .gpdcon =       0xaaaaaaaa,
 197        .gpdcon_mask =  0xffffffff,
 198        .gpdup =        0x0000ffff,
 199        .gpdup_mask =   0xffffffff,
 200};
 201#endif
 202
 203static irqreturn_t
 204amlm5900_wake_interrupt(int irq, void *ignored)
 205{
 206        return IRQ_HANDLED;
 207}
 208
 209static void amlm5900_init_pm(void)
 210{
 211        int ret = 0;
 212
 213        ret = request_irq(IRQ_EINT9, &amlm5900_wake_interrupt,
 214                                IRQF_TRIGGER_RISING | IRQF_SHARED,
 215                                "amlm5900_wakeup", &amlm5900_wake_interrupt);
 216        if (ret != 0) {
 217                printk(KERN_ERR "AML-M5900: no wakeup irq, %d?\n", ret);
 218        } else {
 219                enable_irq_wake(IRQ_EINT9);
 220                /* configure the suspend/resume status pin */
 221                s3c_gpio_cfgpin(S3C2410_GPF(2), S3C2410_GPIO_OUTPUT);
 222                s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_UP);
 223        }
 224}
 225static void __init amlm5900_init(void)
 226{
 227        amlm5900_init_pm();
 228#ifdef CONFIG_FB_S3C2410
 229        s3c24xx_fb_set_platdata(&amlm5900_fb_info);
 230#endif
 231        s3c_i2c0_set_platdata(NULL);
 232        platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
 233}
 234
 235MACHINE_START(AML_M5900, "AML_M5900")
 236        .atag_offset    = 0x100,
 237        .map_io         = amlm5900_map_io,
 238        .init_irq       = s3c24xx_init_irq,
 239        .init_machine   = amlm5900_init,
 240        .timer          = &s3c24xx_timer,
 241        .restart        = s3c2410_restart,
 242MACHINE_END
 243