Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // linux/arch/arm/mach-s3c2440/mach-nexcoder.c
0003 //
0004 // Copyright (c) 2004 Nex Vision
0005 //   Guillaume GOURAT <guillaume.gourat@nexvision.tv>
0006 //
0007 // Modifications:
0008 //     15-10-2004 GG  Created initial version
0009 //     12-03-2005 BJD Updated for release
0010 
0011 #include <linux/kernel.h>
0012 #include <linux/types.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/list.h>
0015 #include <linux/timer.h>
0016 #include <linux/init.h>
0017 #include <linux/gpio.h>
0018 #include <linux/string.h>
0019 #include <linux/serial_core.h>
0020 #include <linux/serial_s3c.h>
0021 #include <linux/platform_device.h>
0022 #include <linux/io.h>
0023 
0024 #include <linux/mtd/map.h>
0025 
0026 #include <asm/mach/arch.h>
0027 #include <asm/mach/map.h>
0028 #include <asm/mach/irq.h>
0029 
0030 #include <asm/setup.h>
0031 #include <asm/irq.h>
0032 #include <asm/mach-types.h>
0033 
0034 //#include <asm/debug-ll.h>
0035 #include "regs-gpio.h"
0036 #include "gpio-samsung.h"
0037 #include <linux/platform_data/i2c-s3c2410.h>
0038 
0039 #include "gpio-cfg.h"
0040 #include "devs.h"
0041 #include "cpu.h"
0042 
0043 #include "s3c24xx.h"
0044 
0045 static struct map_desc nexcoder_iodesc[] __initdata = {
0046     /* nothing here yet */
0047 };
0048 
0049 #define UCON S3C2410_UCON_DEFAULT
0050 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
0051 #define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
0052 
0053 static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = {
0054     [0] = {
0055         .hwport      = 0,
0056         .flags       = 0,
0057         .ucon        = UCON,
0058         .ulcon       = ULCON,
0059         .ufcon       = UFCON,
0060     },
0061     [1] = {
0062         .hwport      = 1,
0063         .flags       = 0,
0064         .ucon        = UCON,
0065         .ulcon       = ULCON,
0066         .ufcon       = UFCON,
0067     },
0068     [2] = {
0069         .hwport      = 2,
0070         .flags       = 0,
0071         .ucon        = UCON,
0072         .ulcon       = ULCON,
0073         .ufcon       = UFCON,
0074     }
0075 };
0076 
0077 /* NOR Flash on NexVision NexCoder 2440 board */
0078 
0079 static struct resource nexcoder_nor_resource[] = {
0080     [0] = DEFINE_RES_MEM(S3C2410_CS0, SZ_8M),
0081 };
0082 
0083 static struct map_info nexcoder_nor_map = {
0084     .bankwidth = 2,
0085 };
0086 
0087 static struct platform_device nexcoder_device_nor = {
0088     .name       = "mtd-flash",
0089     .id     = -1,
0090     .num_resources  = ARRAY_SIZE(nexcoder_nor_resource),
0091     .resource   = nexcoder_nor_resource,
0092     .dev =
0093     {
0094         .platform_data = &nexcoder_nor_map,
0095     }
0096 };
0097 
0098 /* Standard Nexcoder devices */
0099 
0100 static struct platform_device *nexcoder_devices[] __initdata = {
0101     &s3c_device_ohci,
0102     &s3c_device_lcd,
0103     &s3c_device_wdt,
0104     &s3c_device_i2c0,
0105     &s3c_device_iis,
0106     &s3c_device_rtc,
0107     &s3c_device_camif,
0108     &s3c_device_spi0,
0109     &s3c_device_spi1,
0110     &nexcoder_device_nor,
0111 };
0112 
0113 static void __init nexcoder_sensorboard_init(void)
0114 {
0115     /* Initialize SCCB bus */
0116     gpio_request_one(S3C2410_GPE(14), GPIOF_OUT_INIT_HIGH, NULL);
0117     gpio_free(S3C2410_GPE(14)); /* IICSCL */
0118     gpio_request_one(S3C2410_GPE(15), GPIOF_OUT_INIT_HIGH, NULL);
0119     gpio_free(S3C2410_GPE(15)); /* IICSDA */
0120 
0121     /* Power up the sensor board */
0122     gpio_request_one(S3C2410_GPF(1), GPIOF_OUT_INIT_HIGH, NULL);
0123     gpio_free(S3C2410_GPF(1)); /* CAM_GPIO7 => nLDO_PWRDN */
0124     gpio_request_one(S3C2410_GPF(2), GPIOF_OUT_INIT_LOW, NULL);
0125     gpio_free(S3C2410_GPF(2)); /* CAM_GPIO6 => CAM_PWRDN */
0126 }
0127 
0128 static void __init nexcoder_map_io(void)
0129 {
0130     s3c24xx_init_io(nexcoder_iodesc, ARRAY_SIZE(nexcoder_iodesc));
0131     s3c24xx_init_uarts(nexcoder_uartcfgs, ARRAY_SIZE(nexcoder_uartcfgs));
0132     s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0133 
0134     nexcoder_sensorboard_init();
0135 }
0136 
0137 static void __init nexcoder_init_time(void)
0138 {
0139     s3c2440_init_clocks(12000000);
0140     s3c24xx_timer_init();
0141 }
0142 
0143 static void __init nexcoder_init(void)
0144 {
0145     s3c_i2c0_set_platdata(NULL);
0146 
0147     /* Configure the I2S pins (GPE0...GPE4) in correct mode */
0148     s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
0149                   S3C_GPIO_PULL_NONE);
0150 
0151     platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
0152 };
0153 
0154 MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
0155     /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
0156     .atag_offset    = 0x100,
0157     .nr_irqs    = NR_IRQS_S3C2440,
0158     .map_io     = nexcoder_map_io,
0159     .init_machine   = nexcoder_init,
0160     .init_irq   = s3c2440_init_irq,
0161     .init_time  = nexcoder_init_time,
0162 MACHINE_END