Commit 743c8fbb authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

ARM: s3c: remove most s3c64xx board support



All traditional board files except for MACH_WLF_CRAGG_6410 were
marked as unused, so remove them now.

Cc: Kwangwoo Lee <kwangwoo.lee@gmail.com>
Cc: Peter Korsgaard <jacmet@sunsite.dk>
Cc: Darius Augulis <augulis.darius@gmail.com>
Cc: Maurus Cuelenaere <mcuelenaere@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 1ea35b35
Loading
Loading
Loading
Loading
+0 −206
Original line number Diff line number Diff line
@@ -54,17 +54,6 @@ config S3C64XX_SETUP_SDHCI
	  Internal configuration for default SDHCI setup for S3C6400 and
	  S3C6410 SoCs.

config S3C64XX_DEV_ONENAND1
	bool
	help
	  Compile in platform device definition for OneNAND1 controller

config SAMSUNG_DEV_BACKLIGHT
	bool
	depends on SAMSUNG_DEV_PWM
	help
	  Compile in platform device definition LCD backlight with PWM Timer

# platform specific device setup

config S3C64XX_SETUP_I2C0
@@ -113,201 +102,6 @@ config S3C64XX_SETUP_USB_PHY

# S36400 Macchine support

config MACH_SMDK6400
	bool "SMDK6400"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6400
	select S3C64XX_SETUP_SDHCI
	select S3C_DEV_HSMMC1
	help
	  Machine support for the Samsung SMDK6400

# S3C6410 machine support

config MACH_ANW6410
	bool "A&W6410"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C_DEV_FB
	help
	  Machine support for the A&W6410

config MACH_MINI6410
	bool "MINI6410"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C64XX_SETUP_SDHCI
	select S3C_DEV_FB
	select S3C_DEV_HSMMC
	select S3C_DEV_HSMMC1
	select S3C_DEV_NAND
	select S3C_DEV_USB_HOST
	select SAMSUNG_DEV_ADC
	select SAMSUNG_DEV_TS
	help
	  Machine support for the FriendlyARM MINI6410

config MACH_REAL6410
	bool "REAL6410"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C64XX_SETUP_SDHCI
	select S3C_DEV_FB
	select S3C_DEV_HSMMC
	select S3C_DEV_HSMMC1
	select S3C_DEV_NAND
	select S3C_DEV_USB_HOST
	select SAMSUNG_DEV_ADC
	select SAMSUNG_DEV_TS
	help
	  Machine support for the CoreWind REAL6410

config MACH_SMDK6410
	bool "SMDK6410"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C64XX_SETUP_I2C1
	select S3C64XX_SETUP_IDE
	select S3C64XX_SETUP_KEYPAD
	select S3C64XX_SETUP_SDHCI
	select S3C64XX_SETUP_USB_PHY
	select S3C_DEV_FB
	select S3C_DEV_HSMMC
	select S3C_DEV_HSMMC1
	select S3C_DEV_I2C1
	select S3C_DEV_RTC
	select S3C_DEV_USB_HOST
	select S3C_DEV_USB_HSOTG
	select S3C_DEV_WDT
	select SAMSUNG_DEV_ADC
	select SAMSUNG_DEV_BACKLIGHT
	select SAMSUNG_DEV_IDE
	select SAMSUNG_DEV_KEYPAD
	select SAMSUNG_DEV_PWM
	select SAMSUNG_DEV_TS
	help
	  Machine support for the Samsung SMDK6410

# At least some of the SMDK6410s were shipped with the card detect
# for the MMC/SD slots connected to the same input. This means that
# either the boards need to be altered to have channel0 to an alternate
# configuration or that only one slot can be used.

choice
	prompt "SMDK6410 MMC/SD slot setup"
	depends on MACH_SMDK6410

config SMDK6410_SD_CH0
	bool "Use channel 0 only"
	depends on MACH_SMDK6410
	help
	  Select CON7 (channel 0) as the MMC/SD slot, as
	  at least some SMDK6410 boards come with the
	  resistors fitted so that the card detects for
	  channels 0 and 1 are the same.

config SMDK6410_SD_CH1
	bool "Use channel 1 only"
	depends on MACH_SMDK6410
	help
	  Select CON6 (channel 1) as the MMC/SD slot, as
	  at least some SMDK6410 boards come with the
	  resistors fitted so that the card detects for
	  channels 0 and 1 are the same.

endchoice

config SMDK6410_WM1190_EV1
	bool "Support Wolfson Microelectronics 1190-EV1 PMIC card"
	depends on MACH_SMDK6410
	depends on I2C=y
	select MFD_WM8350_I2C
	select REGULATOR
	select REGULATOR_WM8350
	help
	  The Wolfson Microelectronics 1190-EV1 is a WM835x based PMIC
	  and audio daughtercard for the Samsung SMDK6410 reference
	  platform.  Enabling this option will build support for this
	  module into the kernel.  The presence of the module will be
	  detected at runtime so the resulting kernel can be used
	  with or without the 1190-EV1 fitted.

config SMDK6410_WM1192_EV1
	bool "Support Wolfson Microelectronics 1192-EV1 PMIC card"
	depends on MACH_SMDK6410
	depends on I2C=y
	select MFD_WM831X
	select MFD_WM831X_I2C
	select REGULATOR
	select REGULATOR_WM831X
	help
	  The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
	  daughtercard for the Samsung SMDK6410 reference platform.
	  Enabling this option will build support for this module into
	  the kernel.  The presence of the daughtercard will be
	  detected at runtime so the resulting kernel can be used
	  with or without the 1192-EV1 fitted.

config MACH_NCP
	bool "NCP"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_I2C1
	select S3C_DEV_HSMMC1
	select S3C_DEV_I2C1
	help
	  Machine support for the Samsung NCP

config MACH_HMT
	bool "Airgoo HMT"
	depends on ATAGS && UNUSED_BOARD_FILES
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C_DEV_FB
	select S3C_DEV_NAND
	select S3C_DEV_USB_HOST
	select SAMSUNG_DEV_PWM
	help
	  Machine support for the Airgoo HMT

config MACH_SMARTQ
	bool
	select CPU_S3C6410
	select S3C64XX_SETUP_FB_24BPP
	select S3C64XX_SETUP_SDHCI
	select S3C64XX_SETUP_USB_PHY
	select S3C_DEV_FB
	select S3C_DEV_HSMMC
	select S3C_DEV_HSMMC1
	select S3C_DEV_HSMMC2
	select S3C_DEV_HWMON
	select S3C_DEV_RTC
	select S3C_DEV_USB_HOST
	select S3C_DEV_USB_HSOTG
	select SAMSUNG_DEV_ADC
	select SAMSUNG_DEV_PWM
	select SAMSUNG_DEV_TS
	help
	  Shared machine support for SmartQ 5/7

config MACH_SMARTQ5
	bool "SmartQ 5"
	depends on ATAGS && UNUSED_BOARD_FILES
	select MACH_SMARTQ
	help
	  Machine support for the SmartQ 5

config MACH_SMARTQ7
	bool "SmartQ 7"
	depends on ATAGS && UNUSED_BOARD_FILES
	select MACH_SMARTQ
	help
	  Machine support for the SmartQ 7

config MACH_WLF_CRAGG_6410
	bool "Wolfson Cragganmore 6410"
	depends on ATAGS
+0 −13
Original line number Diff line number Diff line
@@ -39,20 +39,7 @@ obj-$(CONFIG_S3C64XX_SETUP_SDHCI_GPIO) += setup-sdhci-gpio-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_SPI)		+= setup-spi-s3c64xx.o
obj-$(CONFIG_S3C64XX_SETUP_USB_PHY) += setup-usb-phy-s3c64xx.o

obj-$(CONFIG_SAMSUNG_DEV_BACKLIGHT)	+= dev-backlight-s3c64xx.o

# Machine support

obj-$(CONFIG_MACH_ANW6410)		+= mach-anw6410.o
obj-$(CONFIG_MACH_HMT)			+= mach-hmt.o
obj-$(CONFIG_MACH_MINI6410)		+= mach-mini6410.o
obj-$(CONFIG_MACH_NCP)			+= mach-ncp.o
obj-$(CONFIG_MACH_REAL6410)		+= mach-real6410.o
obj-$(CONFIG_MACH_SMARTQ)		+= mach-smartq.o
obj-$(CONFIG_MACH_SMARTQ5)		+= mach-smartq5.o
obj-$(CONFIG_MACH_SMARTQ7)		+= mach-smartq7.o
obj-$(CONFIG_MACH_SMDK6400)		+= mach-smdk6400.o
obj-$(CONFIG_MACH_SMDK6410)		+= mach-smdk6410.o
obj-$(CONFIG_MACH_WLF_CRAGG_6410)	+= mach-crag6410.o mach-crag6410-module.o
endif

+0 −137
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// Copyright (c) 2011 Samsung Electronics Co., Ltd.
//              http://www.samsung.com
//
// Common infrastructure for PWM Backlight for Samsung boards

#include <linux/gpio.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/pwm_backlight.h>

#include "devs.h"
#include "gpio-cfg.h"

#include "backlight-s3c64xx.h"

struct samsung_bl_drvdata {
	struct platform_pwm_backlight_data plat_data;
	struct samsung_bl_gpio_info *gpio_info;
};

static int samsung_bl_init(struct device *dev)
{
	int ret = 0;
	struct platform_pwm_backlight_data *pdata = dev->platform_data;
	struct samsung_bl_drvdata *drvdata = container_of(pdata,
					struct samsung_bl_drvdata, plat_data);
	struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;

	ret = gpio_request(bl_gpio_info->no, "Backlight");
	if (ret) {
		printk(KERN_ERR "failed to request GPIO for LCD Backlight\n");
		return ret;
	}

	/* Configure GPIO pin with specific GPIO function for PWM timer */
	s3c_gpio_cfgpin(bl_gpio_info->no, bl_gpio_info->func);

	return 0;
}

static void samsung_bl_exit(struct device *dev)
{
	struct platform_pwm_backlight_data *pdata = dev->platform_data;
	struct samsung_bl_drvdata *drvdata = container_of(pdata,
					struct samsung_bl_drvdata, plat_data);
	struct samsung_bl_gpio_info *bl_gpio_info = drvdata->gpio_info;

	s3c_gpio_cfgpin(bl_gpio_info->no, S3C_GPIO_OUTPUT);
	gpio_free(bl_gpio_info->no);
}

/* Initialize few important fields of platform_pwm_backlight_data
 * structure with default values. These fields can be overridden by
 * board-specific values sent from machine file.
 * For ease of operation, these fields are initialized with values
 * used by most samsung boards.
 * Users has the option of sending info about other parameters
 * for their specific boards
 */

static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
	.plat_data = {
		.max_brightness = 255,
		.dft_brightness = 255,
		.init           = samsung_bl_init,
		.exit           = samsung_bl_exit,
	},
};

static struct platform_device samsung_dfl_bl_device __initdata = {
	.name		= "pwm-backlight",
};

/* samsung_bl_set - Set board specific data (if any) provided by user for
 * PWM Backlight control and register specific PWM and backlight device.
 * @gpio_info:	structure containing GPIO info for PWM timer
 * @bl_data:	structure containing Backlight control data
 */
void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
	struct platform_pwm_backlight_data *bl_data)
{
	int ret = 0;
	struct platform_device *samsung_bl_device;
	struct samsung_bl_drvdata *samsung_bl_drvdata;
	struct platform_pwm_backlight_data *samsung_bl_data;

	samsung_bl_device = kmemdup(&samsung_dfl_bl_device,
			sizeof(struct platform_device), GFP_KERNEL);
	if (!samsung_bl_device)
		return;

	samsung_bl_drvdata = kmemdup(&samsung_dfl_bl_data,
				sizeof(samsung_dfl_bl_data), GFP_KERNEL);
	if (!samsung_bl_drvdata)
		goto err_data;

	samsung_bl_device->dev.platform_data = &samsung_bl_drvdata->plat_data;
	samsung_bl_drvdata->gpio_info = gpio_info;
	samsung_bl_data = &samsung_bl_drvdata->plat_data;

	/* Copy board specific data provided by user */
	samsung_bl_device->dev.parent = &samsung_device_pwm.dev;

	if (bl_data->max_brightness)
		samsung_bl_data->max_brightness = bl_data->max_brightness;
	if (bl_data->dft_brightness)
		samsung_bl_data->dft_brightness = bl_data->dft_brightness;
	if (bl_data->lth_brightness)
		samsung_bl_data->lth_brightness = bl_data->lth_brightness;
	if (bl_data->init)
		samsung_bl_data->init = bl_data->init;
	if (bl_data->notify)
		samsung_bl_data->notify = bl_data->notify;
	if (bl_data->notify_after)
		samsung_bl_data->notify_after = bl_data->notify_after;
	if (bl_data->exit)
		samsung_bl_data->exit = bl_data->exit;
	if (bl_data->check_fb)
		samsung_bl_data->check_fb = bl_data->check_fb;

	/* Register the Backlight dev */
	ret = platform_device_register(samsung_bl_device);
	if (ret) {
		printk(KERN_ERR "failed to register backlight device: %d\n", ret);
		goto err_plat_reg2;
	}

	return;

err_plat_reg2:
	kfree(samsung_bl_data);
err_data:
	kfree(samsung_bl_device);
}

arch/arm/mach-s3c/mach-anw6410.c

deleted100644 → 0
+0 −230
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// Copyright 2008 Openmoko, Inc.
// Copyright 2008 Simtec Electronics
//	Ben Dooks <ben@simtec.co.uk>
//	http://armlinux.simtec.co.uk/
// Copyright 2009 Kwangwoo Lee
//	Kwangwoo Lee <kwangwoo.lee@gmail.com>

#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/fb.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/dm9000.h>

#include <video/platform_lcd.h>
#include <video/samsung_fimd.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>

#include "map.h"

#include <asm/irq.h>
#include <asm/mach-types.h>

#include <linux/platform_data/i2c-s3c2410.h>
#include "fb.h"

#include "devs.h"
#include "cpu.h"
#include "irqs.h"
#include "regs-gpio.h"
#include "gpio-samsung.h"

#include "s3c64xx.h"
#include "regs-modem-s3c64xx.h"

/* DM9000 */
#define ANW6410_PA_DM9000	(0x18000000)

/* A hardware buffer to control external devices is mapped at 0x30000000.
 * It can not be read. So current status must be kept in anw6410_extdev_status.
 */
#define ANW6410_VA_EXTDEV	S3C_ADDR(0x02000000)
#define ANW6410_PA_EXTDEV	(0x30000000)

#define ANW6410_EN_DM9000	(1<<11)
#define ANW6410_EN_LCD		(1<<14)

static __u32 anw6410_extdev_status;

static struct s3c2410_uartcfg anw6410_uartcfgs[] __initdata = {
	[0] = {
		.hwport	     = 0,
		.flags	     = 0,
		.ucon	     = 0x3c5,
		.ulcon	     = 0x03,
		.ufcon	     = 0x51,
	},
	[1] = {
		.hwport	     = 1,
		.flags	     = 0,
		.ucon	     = 0x3c5,
		.ulcon	     = 0x03,
		.ufcon	     = 0x51,
	},
};

/* framebuffer and LCD setup. */
static void __init anw6410_lcd_mode_set(void)
{
	u32 tmp;

	/* set the LCD type */
	tmp = __raw_readl(S3C64XX_SPCON);
	tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
	tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
	__raw_writel(tmp, S3C64XX_SPCON);

	/* remove the LCD bypass */
	tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
	tmp &= ~MIFPCON_LCD_BYPASS;
	__raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
}

/* GPF1 = LCD panel power
 * GPF4 = LCD backlight control
 */
static void anw6410_lcd_power_set(struct plat_lcd_data *pd,
				   unsigned int power)
{
	if (power) {
		anw6410_extdev_status |= (ANW6410_EN_LCD << 16);
		__raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);

		gpio_direction_output(S3C64XX_GPF(1), 1);
		gpio_direction_output(S3C64XX_GPF(4), 1);
	} else {
		anw6410_extdev_status &= ~(ANW6410_EN_LCD << 16);
		__raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);

		gpio_direction_output(S3C64XX_GPF(1), 0);
		gpio_direction_output(S3C64XX_GPF(4), 0);
	}
}

static struct plat_lcd_data anw6410_lcd_power_data = {
	.set_power	= anw6410_lcd_power_set,
};

static struct platform_device anw6410_lcd_powerdev = {
	.name			= "platform-lcd",
	.dev.parent		= &s3c_device_fb.dev,
	.dev.platform_data	= &anw6410_lcd_power_data,
};

static struct s3c_fb_pd_win anw6410_fb_win0 = {
	.max_bpp	= 32,
	.default_bpp	= 16,
	.xres		= 800,
	.yres		= 480,
};

static struct fb_videomode anw6410_lcd_timing = {
	.left_margin	= 8,
	.right_margin	= 13,
	.upper_margin	= 7,
	.lower_margin	= 5,
	.hsync_len	= 3,
	.vsync_len	= 1,
	.xres		= 800,
	.yres		= 480,
};

/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
static struct s3c_fb_platdata anw6410_lcd_pdata __initdata = {
	.setup_gpio	= s3c64xx_fb_gpio_setup_24bpp,
	.vtiming	= &anw6410_lcd_timing,
	.win[0]		= &anw6410_fb_win0,
	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
};

/* DM9000AEP 10/100 ethernet controller */
static void __init anw6410_dm9000_enable(void)
{
	anw6410_extdev_status |= (ANW6410_EN_DM9000 << 16);
	__raw_writel(anw6410_extdev_status, ANW6410_VA_EXTDEV);
}

static struct resource anw6410_dm9000_resource[] = {
	[0] = DEFINE_RES_MEM(ANW6410_PA_DM9000, 4),
	[1] = DEFINE_RES_MEM(ANW6410_PA_DM9000 + 4, 501),
	[2] = DEFINE_RES_NAMED(IRQ_EINT(15), 1, NULL, IORESOURCE_IRQ \
					| IRQF_TRIGGER_HIGH),
};

static struct dm9000_plat_data anw6410_dm9000_pdata = {
	.flags	  = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
	/* dev_addr can be set to provide hwaddr. */
};

static struct platform_device anw6410_device_eth = {
	.name	= "dm9000",
	.id	= -1,
	.num_resources	= ARRAY_SIZE(anw6410_dm9000_resource),
	.resource	= anw6410_dm9000_resource,
	.dev	= {
		.platform_data  = &anw6410_dm9000_pdata,
	},
};

static struct map_desc anw6410_iodesc[] __initdata = {
	{
		.virtual	= (unsigned long)ANW6410_VA_EXTDEV,
		.pfn		= __phys_to_pfn(ANW6410_PA_EXTDEV),
		.length		= SZ_64K,
		.type		= MT_DEVICE,
	},
};

static struct platform_device *anw6410_devices[] __initdata = {
	&s3c_device_fb,
	&anw6410_lcd_powerdev,
	&anw6410_device_eth,
};

static void __init anw6410_map_io(void)
{
	s3c64xx_init_io(anw6410_iodesc, ARRAY_SIZE(anw6410_iodesc));
	s3c64xx_set_xtal_freq(12000000);
	s3c24xx_init_uarts(anw6410_uartcfgs, ARRAY_SIZE(anw6410_uartcfgs));
	s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);

	anw6410_lcd_mode_set();
}

static void __init anw6410_machine_init(void)
{
	s3c_fb_set_platdata(&anw6410_lcd_pdata);

	gpio_request(S3C64XX_GPF(1), "panel power");
	gpio_request(S3C64XX_GPF(4), "LCD backlight");

	anw6410_dm9000_enable();

	platform_add_devices(anw6410_devices, ARRAY_SIZE(anw6410_devices));
}

MACHINE_START(ANW6410, "A&W6410")
	/* Maintainer: Kwangwoo Lee <kwangwoo.lee@gmail.com> */
	.atag_offset	= 0x100,
	.nr_irqs	= S3C64XX_NR_IRQS,
	.init_irq	= s3c6410_init_irq,
	.map_io		= anw6410_map_io,
	.init_machine	= anw6410_machine_init,
	.init_time	= s3c64xx_timer_init,
MACHINE_END

arch/arm/mach-s3c/mach-hmt.c

deleted100644 → 0
+0 −282
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
//
// mach-hmt.c - Platform code for Airgoo HMT
//
// Copyright 2009 Peter Korsgaard <jacmet@sunsite.dk>

#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/fb.h>
#include <linux/gpio.h>
#include <linux/delay.h>
#include <linux/leds.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>

#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>

#include <video/samsung_fimd.h>
#include "map.h"
#include "irqs.h"

#include <asm/irq.h>
#include <asm/mach-types.h>

#include <linux/platform_data/i2c-s3c2410.h>
#include "gpio-samsung.h"
#include "fb.h"
#include <linux/platform_data/mtd-nand-s3c2410.h>

#include "devs.h"
#include "cpu.h"

#include "s3c64xx.h"

#define UCON S3C2410_UCON_DEFAULT
#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)

static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
	[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 pwm_lookup hmt_pwm_lookup[] = {
	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
};

static int hmt_bl_init(struct device *dev)
{
	int ret;

	ret = gpio_request(S3C64XX_GPB(4), "lcd backlight enable");
	if (!ret)
		ret = gpio_direction_output(S3C64XX_GPB(4), 0);

	return ret;
}

static int hmt_bl_notify(struct device *dev, int brightness)
{
	/*
	 * translate from CIELUV/CIELAB L*->brightness, E.G. from
	 * perceived luminance to light output. Assumes range 0..25600
	 */
	if (brightness < 0x800) {
		/* Y = Yn * L / 903.3 */
		brightness = (100*256 * brightness + 231245/2) / 231245;
	} else {
		/* Y = Yn * ((L + 16) / 116 )^3 */
		int t = (brightness*4 + 16*1024 + 58)/116;
		brightness = 25 * ((t * t * t + 0x100000/2) / 0x100000);
	}

	gpio_set_value(S3C64XX_GPB(4), brightness);

	return brightness;
}

static void hmt_bl_exit(struct device *dev)
{
	gpio_free(S3C64XX_GPB(4));
}

static struct platform_pwm_backlight_data hmt_backlight_data = {
	.max_brightness	= 100 * 256,
	.dft_brightness	= 40 * 256,
	.init		= hmt_bl_init,
	.notify		= hmt_bl_notify,
	.exit		= hmt_bl_exit,

};

static struct platform_device hmt_backlight_device = {
	.name		= "pwm-backlight",
	.dev		= {
		.parent	= &samsung_device_pwm.dev,
		.platform_data = &hmt_backlight_data,
	},
};

static struct s3c_fb_pd_win hmt_fb_win0 = {
	.max_bpp	= 32,
	.default_bpp	= 16,
	.xres		= 800,
	.yres		= 480,
};

static struct fb_videomode hmt_lcd_timing = {
	.left_margin	= 8,
	.right_margin	= 13,
	.upper_margin	= 7,
	.lower_margin	= 5,
	.hsync_len	= 3,
	.vsync_len	= 1,
	.xres		= 800,
	.yres		= 480,
};

/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
static struct s3c_fb_platdata hmt_lcd_pdata __initdata = {
	.setup_gpio	= s3c64xx_fb_gpio_setup_24bpp,
	.vtiming	= &hmt_lcd_timing,
	.win[0]		= &hmt_fb_win0,
	.vidcon0	= VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
	.vidcon1	= VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
};

static struct mtd_partition hmt_nand_part[] = {
	[0] = {
		.name	= "uboot",
		.size	= SZ_512K,
		.offset	= 0,
	},
	[1] = {
		.name	= "uboot-env1",
		.size	= SZ_256K,
		.offset	= SZ_512K,
	},
	[2] = {
		.name	= "uboot-env2",
		.size	= SZ_256K,
		.offset	= SZ_512K + SZ_256K,
	},
	[3] = {
		.name	= "kernel",
		.size	= SZ_2M,
		.offset	= SZ_1M,
	},
	[4] = {
		.name	= "rootfs",
		.size	= MTDPART_SIZ_FULL,
		.offset	= SZ_1M + SZ_2M,
	},
};

static struct s3c2410_nand_set hmt_nand_sets[] = {
	[0] = {
		.name		= "nand",
		.nr_chips	= 1,
		.nr_partitions	= ARRAY_SIZE(hmt_nand_part),
		.partitions	= hmt_nand_part,
	},
};

static struct s3c2410_platform_nand hmt_nand_info = {
	.tacls		= 25,
	.twrph0		= 55,
	.twrph1		= 40,
	.nr_sets	= ARRAY_SIZE(hmt_nand_sets),
	.sets		= hmt_nand_sets,
	.engine_type	= NAND_ECC_ENGINE_TYPE_SOFT,
};

static struct gpio_led hmt_leds[] = {
	{ /* left function keys */
		.name			= "left:blue",
		.gpio			= S3C64XX_GPO(12),
		.default_trigger	= "default-on",
	},
	{ /* right function keys - red */
		.name			= "right:red",
		.gpio			= S3C64XX_GPO(13),
	},
	{ /* right function keys - green */
		.name			= "right:green",
		.gpio			= S3C64XX_GPO(14),
	},
	{ /* right function keys - blue */
		.name			= "right:blue",
		.gpio			= S3C64XX_GPO(15),
		.default_trigger	= "default-on",
	},
};

static struct gpio_led_platform_data hmt_led_data = {
	.num_leds = ARRAY_SIZE(hmt_leds),
	.leds = hmt_leds,
};

static struct platform_device hmt_leds_device = {
	.name			= "leds-gpio",
	.id			= -1,
	.dev.platform_data	= &hmt_led_data,
};

static struct map_desc hmt_iodesc[] = {};

static struct platform_device *hmt_devices[] __initdata = {
	&s3c_device_i2c0,
	&s3c_device_nand,
	&s3c_device_fb,
	&s3c_device_ohci,
	&samsung_device_pwm,
	&hmt_backlight_device,
	&hmt_leds_device,
};

static void __init hmt_map_io(void)
{
	s3c64xx_init_io(hmt_iodesc, ARRAY_SIZE(hmt_iodesc));
	s3c64xx_set_xtal_freq(12000000);
	s3c24xx_init_uarts(hmt_uartcfgs, ARRAY_SIZE(hmt_uartcfgs));
	s3c64xx_set_timer_source(S3C64XX_PWM3, S3C64XX_PWM4);
}

static void __init hmt_machine_init(void)
{
	s3c_i2c0_set_platdata(NULL);
	s3c_fb_set_platdata(&hmt_lcd_pdata);
	s3c_nand_set_platdata(&hmt_nand_info);

	gpio_request(S3C64XX_GPC(7), "usb power");
	gpio_direction_output(S3C64XX_GPC(7), 0);
	gpio_request(S3C64XX_GPM(0), "usb power");
	gpio_direction_output(S3C64XX_GPM(0), 1);
	gpio_request(S3C64XX_GPK(7), "usb power");
	gpio_direction_output(S3C64XX_GPK(7), 1);
	gpio_request(S3C64XX_GPF(13), "usb power");
	gpio_direction_output(S3C64XX_GPF(13), 1);

	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
}

MACHINE_START(HMT, "Airgoo-HMT")
	/* Maintainer: Peter Korsgaard <jacmet@sunsite.dk> */
	.atag_offset	= 0x100,
	.nr_irqs	= S3C64XX_NR_IRQS,
	.init_irq	= s3c6410_init_irq,
	.map_io		= hmt_map_io,
	.init_machine	= hmt_machine_init,
	.init_time	= s3c64xx_timer_init,
MACHINE_END
Loading