Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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) // mach-hmt.c - Platform code for Airgoo HMT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) // Copyright 2009 Peter Korsgaard <jacmet@sunsite.dk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/serial_core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/serial_s3c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/fb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/leds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/pwm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/pwm_backlight.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <video/samsung_fimd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "map.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <mach/irqs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <linux/platform_data/i2c-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "fb.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <linux/platform_data/mtd-nand-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include "cpu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include "s3c64xx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define UCON S3C2410_UCON_DEFAULT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		.hwport	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		.hwport	     = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 		.hwport	     = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		.flags	     = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 		.ucon	     = UCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 		.ulcon	     = ULCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		.ufcon	     = UFCON,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) static struct pwm_lookup hmt_pwm_lookup[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) static int hmt_bl_init(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	ret = gpio_request(S3C64XX_GPB(4), "lcd backlight enable");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	if (!ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		ret = gpio_direction_output(S3C64XX_GPB(4), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) static int hmt_bl_notify(struct device *dev, int brightness)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	 * translate from CIELUV/CIELAB L*->brightness, E.G. from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	 * perceived luminance to light output. Assumes range 0..25600
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	if (brightness < 0x800) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		/* Y = Yn * L / 903.3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		brightness = (100*256 * brightness + 231245/2) / 231245;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		/* Y = Yn * ((L + 16) / 116 )^3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		int t = (brightness*4 + 16*1024 + 58)/116;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		brightness = 25 * ((t * t * t + 0x100000/2) / 0x100000);
^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) 	gpio_set_value(S3C64XX_GPB(4), brightness);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	return brightness;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static void hmt_bl_exit(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	gpio_free(S3C64XX_GPB(4));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static struct platform_pwm_backlight_data hmt_backlight_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	.max_brightness	= 100 * 256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	.dft_brightness	= 40 * 256,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	.init		= hmt_bl_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	.notify		= hmt_bl_notify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.exit		= hmt_bl_exit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static struct platform_device hmt_backlight_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	.name		= "pwm-backlight",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	.dev		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		.parent	= &samsung_device_pwm.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		.platform_data = &hmt_backlight_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static struct s3c_fb_pd_win hmt_fb_win0 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.max_bpp	= 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	.default_bpp	= 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	.xres		= 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	.yres		= 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static struct fb_videomode hmt_lcd_timing = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.left_margin	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.right_margin	= 13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	.upper_margin	= 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	.lower_margin	= 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.hsync_len	= 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.vsync_len	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	.xres		= 800,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	.yres		= 480,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static struct s3c_fb_platdata hmt_lcd_pdata __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	.setup_gpio	= s3c64xx_fb_gpio_setup_24bpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	.vtiming	= &hmt_lcd_timing,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.win[0]		= &hmt_fb_win0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static struct mtd_partition hmt_nand_part[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		.name	= "uboot",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		.size	= SZ_512K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		.offset	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	[1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		.name	= "uboot-env1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		.size	= SZ_256K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		.offset	= SZ_512K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	[2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		.name	= "uboot-env2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		.size	= SZ_256K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		.offset	= SZ_512K + SZ_256K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	[3] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		.name	= "kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		.size	= SZ_2M,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		.offset	= SZ_1M,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	[4] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		.name	= "rootfs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		.size	= MTDPART_SIZ_FULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		.offset	= SZ_1M + SZ_2M,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	},
^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) static struct s3c2410_nand_set hmt_nand_sets[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		.name		= "nand",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		.nr_chips	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		.nr_partitions	= ARRAY_SIZE(hmt_nand_part),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		.partitions	= hmt_nand_part,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) static struct s3c2410_platform_nand hmt_nand_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	.tacls		= 25,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	.twrph0		= 55,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.twrph1		= 40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	.nr_sets	= ARRAY_SIZE(hmt_nand_sets),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	.sets		= hmt_nand_sets,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	.engine_type	= NAND_ECC_ENGINE_TYPE_SOFT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static struct gpio_led hmt_leds[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	{ /* left function keys */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		.name			= "left:blue",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		.gpio			= S3C64XX_GPO(12),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		.default_trigger	= "default-on",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	{ /* right function keys - red */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		.name			= "right:red",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		.gpio			= S3C64XX_GPO(13),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	{ /* right function keys - green */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		.name			= "right:green",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		.gpio			= S3C64XX_GPO(14),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	{ /* right function keys - blue */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		.name			= "right:blue",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		.gpio			= S3C64XX_GPO(15),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 		.default_trigger	= "default-on",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) static struct gpio_led_platform_data hmt_led_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.num_leds = ARRAY_SIZE(hmt_leds),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	.leds = hmt_leds,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) static struct platform_device hmt_leds_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	.name			= "leds-gpio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.id			= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.dev.platform_data	= &hmt_led_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) static struct map_desc hmt_iodesc[] = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static struct platform_device *hmt_devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	&s3c_device_i2c0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	&s3c_device_nand,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	&s3c_device_fb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 	&s3c_device_ohci,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	&samsung_device_pwm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	&hmt_backlight_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	&hmt_leds_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) static void __init hmt_map_io(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	s3c64xx_set_xtal_freq(12000000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) static void __init hmt_machine_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	s3c_i2c0_set_platdata(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	s3c_fb_set_platdata(&hmt_lcd_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	s3c_nand_set_platdata(&hmt_nand_info);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	gpio_request(S3C64XX_GPC(7), "usb power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	gpio_direction_output(S3C64XX_GPC(7), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 	gpio_request(S3C64XX_GPM(0), "usb power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	gpio_direction_output(S3C64XX_GPM(0), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 	gpio_request(S3C64XX_GPK(7), "usb power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	gpio_direction_output(S3C64XX_GPK(7), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	gpio_request(S3C64XX_GPF(13), "usb power");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	gpio_direction_output(S3C64XX_GPF(13), 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) MACHINE_START(HMT, "Airgoo-HMT")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	/* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	.nr_irqs	= S3C64XX_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 	.init_irq	= s3c6410_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	.map_io		= hmt_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 	.init_machine	= hmt_machine_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	.init_time	= s3c64xx_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) MACHINE_END