^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) // Copyright (c) 2008 Ramax Lo <ramaxlo@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) // Based on mach-anubis.c by Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) // and modifications by SBZ <sbz@spgui.org> and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) // Weibing <http://weibing.blogbus.com> and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) // Michel Pollet <buserror@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) // For product information, visit https://code.google.com/p/mini2440/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/timer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/gpio/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/serial_s3c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/dm9000.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/property.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/gpio_keys.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/mmc/host.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #include <linux/platform_data/fb-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include "regs-gpio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <linux/platform_data/leds-s3c24xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include <linux/platform_data/mtd-nand-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include <linux/platform_data/i2c-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <linux/platform_data/mmc-s3cmci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <linux/platform_data/usb-s3c2410_udc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #include <linux/mtd/rawnand.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include <linux/mtd/nand_ecc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #include <sound/s3c24xx_uda134x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #include "s3c24xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define MACH_MINI2440_DM9K_BASE (S3C2410_CS4 + 0x300)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static struct map_desc mini2440_iodesc[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) /* nothing to declare, move along */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define UCON S3C2410_UCON_DEFAULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) static struct s3c2410_uartcfg mini2440_uartcfgs[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .hwport = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .flags = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .ucon = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .ulcon = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .ufcon = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) .hwport = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .flags = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .ucon = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .ulcon = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) .ufcon = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .hwport = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .flags = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .ucon = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .ulcon = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) .ufcon = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /* USB device UDC support */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) static struct s3c2410_udc_mach_info mini2440_udc_cfg __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) .pullup_pin = S3C2410_GPC(5),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /* LCD timing and setup */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) * This macro simplifies the table bellow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #define _LCD_DECLARE(_clock, _xres, margin_left, margin_right, hsync, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) _yres, margin_top, margin_bottom, vsync, refresh) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) .width = _xres, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) .xres = _xres, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) .height = _yres, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) .yres = _yres, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) .left_margin = margin_left, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) .right_margin = margin_right, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .upper_margin = margin_top, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) .lower_margin = margin_bottom, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) .hsync_len = hsync, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) .vsync_len = vsync, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) .pixclock = ((_clock*100000000000LL) / \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) ((refresh) * \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) (hsync + margin_left + _xres + margin_right) * \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) (vsync + margin_top + _yres + margin_bottom))), \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) .bpp = 16,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) .type = (S3C2410_LCDCON1_TFT16BPP |\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) S3C2410_LCDCON1_TFT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) [0] = { /* mini2440 + 3.5" TFT + touchscreen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) _LCD_DECLARE(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 7, /* The 3.5 is quite fast */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 240, 21, 38, 6, /* x timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 320, 4, 4, 2, /* y timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 60), /* refresh rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) S3C2410_LCDCON5_INVVLINE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) S3C2410_LCDCON5_INVVFRAME |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) S3C2410_LCDCON5_INVVDEN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) S3C2410_LCDCON5_PWREN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) [1] = { /* mini2440 + 7" TFT + touchscreen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) _LCD_DECLARE(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 10, /* the 7" runs slower */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 800, 40, 40, 48, /* x timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 480, 29, 3, 3, /* y timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 50), /* refresh rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) S3C2410_LCDCON5_INVVLINE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) S3C2410_LCDCON5_INVVFRAME |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) S3C2410_LCDCON5_PWREN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) /* The VGA shield can outout at several resolutions. All share
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * the same timings, however, anything smaller than 1024x768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * will only be displayed in the top left corner of a 1024x768
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * XGA output unless you add optional dip switches to the shield.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * Therefore timings for other resolutions have been omitted here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) _LCD_DECLARE(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 1024, 1, 2, 2, /* y timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 768, 200, 16, 16, /* x timing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 24), /* refresh rate, maximum stable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * tested with the FPGA shield
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) S3C2410_LCDCON5_HWSWP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) /* mini2440 + 3.5" TFT (LCD-W35i, LQ035Q1DG06 type) + touchscreen*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) [3] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) _LCD_DECLARE(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /* xres, margin_right, margin_left, hsync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 320, 68, 66, 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) /* yres, margin_top, margin_bottom, vsync */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 240, 4, 4, 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /* refresh rate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 60),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) .lcdcon5 = (S3C2410_LCDCON5_FRM565 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) S3C2410_LCDCON5_INVVDEN |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) S3C2410_LCDCON5_INVVFRAME |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) S3C2410_LCDCON5_INVVLINE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) S3C2410_LCDCON5_INVVCLK |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) S3C2410_LCDCON5_HWSWP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) /* todo - put into gpio header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) #define S3C2410_GPCCON_MASK(x) (3 << ((x) * 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) #define S3C2410_GPDCON_MASK(x) (3 << ((x) * 2))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) static struct s3c2410fb_mach_info mini2440_fb_info __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) .displays = &mini2440_lcd_cfg[0], /* not constant! see init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) .num_displays = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) .default_display = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* Enable VD[2..7], VD[10..15], VD[18..23] and VCLK, syncs, VDEN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * and disable the pull down resistors on pins we are using for LCD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) .gpcup = (0xf << 1) | (0x3f << 10),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) .gpccon = (S3C2410_GPC1_VCLK | S3C2410_GPC2_VLINE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) S3C2410_GPC3_VFRAME | S3C2410_GPC4_VM |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) S3C2410_GPC10_VD2 | S3C2410_GPC11_VD3 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) S3C2410_GPC12_VD4 | S3C2410_GPC13_VD5 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) S3C2410_GPC14_VD6 | S3C2410_GPC15_VD7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) .gpccon_mask = (S3C2410_GPCCON_MASK(1) | S3C2410_GPCCON_MASK(2) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) S3C2410_GPCCON_MASK(3) | S3C2410_GPCCON_MASK(4) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) S3C2410_GPCCON_MASK(10) | S3C2410_GPCCON_MASK(11) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) S3C2410_GPCCON_MASK(12) | S3C2410_GPCCON_MASK(13) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) S3C2410_GPCCON_MASK(14) | S3C2410_GPCCON_MASK(15)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) .gpccon_reg = S3C2410_GPCCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) .gpcup_reg = S3C2410_GPCUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) .gpdup = (0x3f << 2) | (0x3f << 10),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) .gpdcon = (S3C2410_GPD2_VD10 | S3C2410_GPD3_VD11 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) S3C2410_GPD4_VD12 | S3C2410_GPD5_VD13 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) S3C2410_GPD6_VD14 | S3C2410_GPD7_VD15 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) S3C2410_GPD10_VD18 | S3C2410_GPD11_VD19 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) S3C2410_GPD12_VD20 | S3C2410_GPD13_VD21 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) S3C2410_GPD14_VD22 | S3C2410_GPD15_VD23),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) .gpdcon_mask = (S3C2410_GPDCON_MASK(2) | S3C2410_GPDCON_MASK(3) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) S3C2410_GPDCON_MASK(4) | S3C2410_GPDCON_MASK(5) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) S3C2410_GPDCON_MASK(6) | S3C2410_GPDCON_MASK(7) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) S3C2410_GPDCON_MASK(10) | S3C2410_GPDCON_MASK(11)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) S3C2410_GPDCON_MASK(12) | S3C2410_GPDCON_MASK(13)|
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) S3C2410_GPDCON_MASK(14) | S3C2410_GPDCON_MASK(15)),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) .gpdcon_reg = S3C2410_GPDCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) .gpdup_reg = S3C2410_GPDUP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /* MMC/SD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static struct s3c24xx_mci_pdata mini2440_mmc_cfg __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .wprotect_invert = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .set_power = s3c24xx_mci_def_set_power,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) .ocr_avail = MMC_VDD_32_33|MMC_VDD_33_34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static struct gpiod_lookup_table mini2440_mmc_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .dev_id = "s3c2410-sdi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) /* Card detect S3C2410_GPG(8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) GPIO_LOOKUP("GPIOG", 8, "cd", GPIO_ACTIVE_LOW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /* Write protect S3C2410_GPH(8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) GPIO_LOOKUP("GPIOH", 8, "wp", GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) /* bus pins */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) GPIO_LOOKUP_IDX("GPIOE", 5, "bus", 0, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) GPIO_LOOKUP_IDX("GPIOE", 6, "bus", 1, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) GPIO_LOOKUP_IDX("GPIOE", 7, "bus", 2, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) GPIO_LOOKUP_IDX("GPIOE", 8, "bus", 3, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) GPIO_LOOKUP_IDX("GPIOE", 9, "bus", 4, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) /* NAND Flash on MINI2440 board */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) static struct mtd_partition mini2440_default_nand_part[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) .name = "u-boot",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .size = SZ_256K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) .offset = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .name = "u-boot-env",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) .size = SZ_128K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) .offset = SZ_256K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) [2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) .name = "kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) /* 5 megabytes, for a kernel with no modules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * or a uImage with a ramdisk attached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) .size = 0x00500000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) .offset = SZ_256K + SZ_128K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) [3] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) .name = "root",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) .offset = SZ_256K + SZ_128K + 0x00500000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) .size = MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) static struct s3c2410_nand_set mini2440_nand_sets[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) .name = "nand",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) .nr_chips = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) .nr_partitions = ARRAY_SIZE(mini2440_default_nand_part),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) .partitions = mini2440_default_nand_part,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) .flash_bbt = 1, /* we use u-boot to create a BBT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) static struct s3c2410_platform_nand mini2440_nand_info __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) .tacls = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) .twrph0 = 25,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) .twrph1 = 15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) .nr_sets = ARRAY_SIZE(mini2440_nand_sets),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) .sets = mini2440_nand_sets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) .ignore_unset_ecc = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) /* DM9000AEP 10/100 ethernet controller */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) static struct resource mini2440_dm9k_resource[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) [0] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE, 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) [1] = DEFINE_RES_MEM(MACH_MINI2440_DM9K_BASE + 4, 4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) [2] = DEFINE_RES_NAMED(IRQ_EINT7, 1, NULL, IORESOURCE_IRQ
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) | IORESOURCE_IRQ_HIGHEDGE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * The DM9000 has no eeprom, and it's MAC address is set by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) * the bootloader before starting the kernel.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) static struct dm9000_plat_data mini2440_dm9k_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) static struct platform_device mini2440_device_eth = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) .name = "dm9000",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) .num_resources = ARRAY_SIZE(mini2440_dm9k_resource),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) .resource = mini2440_dm9k_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) .platform_data = &mini2440_dm9k_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) /* CON5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * +--+ /-----\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * | | | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * | | | BAT |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * | | \_____/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * | | | K5 | | K1 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * | | | K4 | | K2 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * | | | K6 | | K3 |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) * | | +----+ +----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) * .....
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) static struct gpio_keys_button mini2440_buttons[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) .gpio = S3C2410_GPG(0), /* K1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) .code = KEY_F1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) .desc = "Button 1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) .gpio = S3C2410_GPG(3), /* K2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) .code = KEY_F2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) .desc = "Button 2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .gpio = S3C2410_GPG(5), /* K3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .code = KEY_F3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) .desc = "Button 3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) .gpio = S3C2410_GPG(6), /* K4 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) .code = KEY_POWER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .desc = "Power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .gpio = S3C2410_GPG(7), /* K5 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) .code = KEY_F5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) .desc = "Button 5",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) /* this pin is also known as TCLK1 and seems to already
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) * marked as "in use" somehow in the kernel -- possibly wrongly
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) .gpio = S3C2410_GPG(11), /* K6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) .code = KEY_F6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) .desc = "Button 6",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) .active_low = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) static struct gpio_keys_platform_data mini2440_button_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) .buttons = mini2440_buttons,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) .nbuttons = ARRAY_SIZE(mini2440_buttons),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) static struct platform_device mini2440_button_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) .name = "gpio-keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) .platform_data = &mini2440_button_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) /* LEDS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) static struct gpiod_lookup_table mini2440_led1_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) .dev_id = "s3c24xx_led.1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) GPIO_LOOKUP("GPB", 5, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) static struct gpiod_lookup_table mini2440_led2_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) .dev_id = "s3c24xx_led.2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) GPIO_LOOKUP("GPB", 6, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) static struct gpiod_lookup_table mini2440_led3_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) .dev_id = "s3c24xx_led.3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) GPIO_LOOKUP("GPB", 7, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) static struct gpiod_lookup_table mini2440_led4_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) .dev_id = "s3c24xx_led.4",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) GPIO_LOOKUP("GPB", 8, NULL, GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) static struct gpiod_lookup_table mini2440_backlight_gpio_table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) .dev_id = "s3c24xx_led.5",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) .table = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) GPIO_LOOKUP("GPG", 4, NULL, GPIO_ACTIVE_HIGH),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) static struct s3c24xx_led_platdata mini2440_led1_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) .name = "led1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) .def_trigger = "heartbeat",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) static struct s3c24xx_led_platdata mini2440_led2_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) .name = "led2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) .def_trigger = "nand-disk",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) static struct s3c24xx_led_platdata mini2440_led3_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) .name = "led3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) .def_trigger = "mmc0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) static struct s3c24xx_led_platdata mini2440_led4_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) .name = "led4",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) .def_trigger = "",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) static struct s3c24xx_led_platdata mini2440_led_backlight_pdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) .name = "backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) .def_trigger = "backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) static struct platform_device mini2440_led1 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) .name = "s3c24xx_led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) .id = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) .platform_data = &mini2440_led1_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) static struct platform_device mini2440_led2 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) .name = "s3c24xx_led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) .id = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) .platform_data = &mini2440_led2_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) static struct platform_device mini2440_led3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) .name = "s3c24xx_led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) .id = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) .platform_data = &mini2440_led3_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) static struct platform_device mini2440_led4 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) .name = "s3c24xx_led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) .id = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) .platform_data = &mini2440_led4_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) static struct platform_device mini2440_led_backlight = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) .name = "s3c24xx_led",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) .id = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) .platform_data = &mini2440_led_backlight_pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) /* AUDIO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) static struct s3c24xx_uda134x_platform_data mini2440_audio_pins = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .l3_clk = S3C2410_GPB(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) .l3_mode = S3C2410_GPB(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) .l3_data = S3C2410_GPB(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) .model = UDA134X_UDA1341
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) static struct platform_device mini2440_audio = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) .name = "s3c24xx_uda134x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) .platform_data = &mini2440_audio_pins,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) * I2C devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) static const struct property_entry mini2440_at24_properties[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) PROPERTY_ENTRY_U32("pagesize", 16),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) static struct i2c_board_info mini2440_i2c_devs[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) I2C_BOARD_INFO("24c08", 0x50),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) .properties = mini2440_at24_properties,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) static struct uda134x_platform_data s3c24xx_uda134x = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) .l3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) .gpio_clk = S3C2410_GPB(4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) .gpio_data = S3C2410_GPB(3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) .gpio_mode = S3C2410_GPB(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) .use_gpios = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) .data_hold = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) .data_setup = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) .clock_high = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) .mode_hold = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) .mode = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) .mode_setup = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) .model = UDA134X_UDA1341,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) static struct platform_device uda1340_codec = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) .name = "uda134x-codec",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) .id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) .platform_data = &s3c24xx_uda134x,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) static struct platform_device *mini2440_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) &s3c_device_ohci,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) &s3c_device_wdt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579) &s3c_device_i2c0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) &s3c_device_rtc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) &s3c_device_usbgadget,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) &mini2440_device_eth,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583) &mini2440_led1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) &mini2440_led2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) &mini2440_led3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586) &mini2440_led4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) &mini2440_button_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) &s3c_device_nand,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) &s3c_device_sdi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) &s3c2440_device_dma,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) &s3c_device_iis,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) &uda1340_codec,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593) &mini2440_audio,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) static void __init mini2440_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) s3c24xx_init_io(mini2440_iodesc, ARRAY_SIZE(mini2440_iodesc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) static void __init mini2440_init_time(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) s3c2440_init_clocks(12000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606) s3c24xx_timer_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) * mini2440_features string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612) * t = Touchscreen present
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) * b = backlight control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) * c = camera [TODO]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615) * 0-9 LCD configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618) static char mini2440_features_str[12] __initdata = "0tb";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) static int __init mini2440_features_setup(char *str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) if (str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623) strlcpy(mini2440_features_str, str,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) sizeof(mini2440_features_str));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) __setup("mini2440=", mini2440_features_setup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630) #define FEATURE_SCREEN (1 << 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) #define FEATURE_BACKLIGHT (1 << 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) #define FEATURE_TOUCH (1 << 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633) #define FEATURE_CAMERA (1 << 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) struct mini2440_features_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) int count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) int done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) int lcd_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639) struct platform_device *optional[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642) static void __init mini2440_parse_features(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) struct mini2440_features_t *features,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) const char *features_str)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) const char *fp = features_str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) features->count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) features->done = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650) features->lcd_index = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) while (*fp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653) char f = *fp++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) switch (f) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) case '0'...'9': /* tft screen */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657) if (features->done & FEATURE_SCREEN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) pr_info("MINI2440: '%c' ignored, screen type already set\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) int li = f - '0';
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) if (li >= ARRAY_SIZE(mini2440_lcd_cfg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) pr_info("MINI2440: '%c' out of range LCD mode\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) features->optional[features->count++] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) &s3c_device_lcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) features->lcd_index = li;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672) features->done |= FEATURE_SCREEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) case 'b':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) if (features->done & FEATURE_BACKLIGHT)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) pr_info("MINI2440: '%c' ignored, backlight already set\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 677) f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 678) else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 679) features->optional[features->count++] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 680) &mini2440_led_backlight;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 681) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 682) features->done |= FEATURE_BACKLIGHT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 683) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 684) case 't':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 685) pr_info("MINI2440: '%c' ignored, touchscreen not compiled in\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 686) f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 687) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 688) case 'c':
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 689) if (features->done & FEATURE_CAMERA)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 690) pr_info("MINI2440: '%c' ignored, camera already registered\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 691) f);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 692) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 693) features->optional[features->count++] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 694) &s3c_device_camif;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 695) features->done |= FEATURE_CAMERA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 696) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 697) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 698) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 699) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 701) static void __init mini2440_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 702) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 703) struct mini2440_features_t features = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 704) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 705)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 706) pr_info("MINI2440: Option string mini2440=%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 707) mini2440_features_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 708)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 709) /* Parse the feature string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 710) mini2440_parse_features(&features, mini2440_features_str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 711)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 712) /* turn LCD on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 713) s3c_gpio_cfgpin(S3C2410_GPC(0), S3C2410_GPC0_LEND);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 714)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 715) /* Turn the backlight early on */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 716) WARN_ON(gpio_request_one(S3C2410_GPG(4), GPIOF_OUT_INIT_HIGH, NULL));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 717) gpio_free(S3C2410_GPG(4));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 718)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 719) /* remove pullup on optional PWM backlight -- unused on 3.5 and 7"s */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 720) gpio_request_one(S3C2410_GPB(1), GPIOF_IN, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 721) s3c_gpio_setpull(S3C2410_GPB(1), S3C_GPIO_PULL_UP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 722) gpio_free(S3C2410_GPB(1));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 723)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 724) /* mark the key as input, without pullups (there is one on the board) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 725) for (i = 0; i < ARRAY_SIZE(mini2440_buttons); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 726) s3c_gpio_setpull(mini2440_buttons[i].gpio, S3C_GPIO_PULL_UP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 727) s3c_gpio_cfgpin(mini2440_buttons[i].gpio, S3C2410_GPIO_INPUT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 728) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 729)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 730) /* Configure the I2S pins (GPE0...GPE4) in correct mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 731) s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 732) S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 733)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 734) if (features.lcd_index != -1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 735) int li;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 736)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 737) mini2440_fb_info.displays =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 738) &mini2440_lcd_cfg[features.lcd_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 739)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 740) pr_info("MINI2440: LCD");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 741) for (li = 0; li < ARRAY_SIZE(mini2440_lcd_cfg); li++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 742) if (li == features.lcd_index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 743) pr_cont(" [%d:%dx%d]", li,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 744) mini2440_lcd_cfg[li].width,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 745) mini2440_lcd_cfg[li].height);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 746) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 747) pr_cont(" %d:%dx%d", li,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 748) mini2440_lcd_cfg[li].width,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 749) mini2440_lcd_cfg[li].height);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 750) pr_cont("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 751) s3c24xx_fb_set_platdata(&mini2440_fb_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 752) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 753)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 754) s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 755) gpiod_add_lookup_table(&mini2440_mmc_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 756) s3c24xx_mci_set_platdata(&mini2440_mmc_cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 757) s3c_nand_set_platdata(&mini2440_nand_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 758) s3c_i2c0_set_platdata(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 759)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 760) i2c_register_board_info(0, mini2440_i2c_devs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 761) ARRAY_SIZE(mini2440_i2c_devs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 762)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 763) /* Disable pull-up on the LED lines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 764) s3c_gpio_setpull(S3C2410_GPB(5), S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 765) s3c_gpio_setpull(S3C2410_GPB(6), S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 766) s3c_gpio_setpull(S3C2410_GPB(7), S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 767) s3c_gpio_setpull(S3C2410_GPB(8), S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 768) s3c_gpio_setpull(S3C2410_GPG(4), S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 769)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 770) /* Add lookups for the lines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 771) gpiod_add_lookup_table(&mini2440_led1_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 772) gpiod_add_lookup_table(&mini2440_led2_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 773) gpiod_add_lookup_table(&mini2440_led3_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 774) gpiod_add_lookup_table(&mini2440_led4_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 775) gpiod_add_lookup_table(&mini2440_backlight_gpio_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 776)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 777) platform_add_devices(mini2440_devices, ARRAY_SIZE(mini2440_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 778)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 779) if (features.count) /* the optional features */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 780) platform_add_devices(features.optional, features.count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 781)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 782) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 783)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 784)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 785) MACHINE_START(MINI2440, "MINI2440")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 786) /* Maintainer: Michel Pollet <buserror@gmail.com> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 787) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 788) .map_io = mini2440_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 789) .init_machine = mini2440_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 790) .init_irq = s3c2440_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 791) .init_time = mini2440_init_time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 792) MACHINE_END