|
@@ -0,0 +1,164 @@
|
|
|
+/*
|
|
|
+ * linux/arch/arm/mach-s3c64xx/mach-smartq.c
|
|
|
+ *
|
|
|
+ * Copyright (C) 2010 Maurus Cuelenaere
|
|
|
+ *
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
+ * it under the terms of the GNU General Public License version 2 as
|
|
|
+ * published by the Free Software Foundation.
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+#include <linux/delay.h>
|
|
|
+#include <linux/fb.h>
|
|
|
+#include <linux/gpio.h>
|
|
|
+#include <linux/init.h>
|
|
|
+#include <linux/platform_device.h>
|
|
|
+#include <linux/pwm_backlight.h>
|
|
|
+#include <linux/serial_core.h>
|
|
|
+#include <linux/spi/spi_gpio.h>
|
|
|
+#include <linux/usb/gpio_vbus.h>
|
|
|
+#include <linux/platform_data/s3c-hsotg.h>
|
|
|
+
|
|
|
+#include <asm/mach-types.h>
|
|
|
+#include <asm/mach/map.h>
|
|
|
+
|
|
|
+#include <mach/map.h>
|
|
|
+#include <mach/regs-gpio.h>
|
|
|
+#include <mach/regs-modem.h>
|
|
|
+
|
|
|
+#include <plat/clock.h>
|
|
|
+#include <plat/cpu.h>
|
|
|
+#include <plat/devs.h>
|
|
|
+#include <linux/platform_data/i2c-s3c2410.h>
|
|
|
+#include <plat/gpio-cfg.h>
|
|
|
+#include <linux/platform_data/hwmon-s3c.h>
|
|
|
+#include <plat/regs-serial.h>
|
|
|
+#include <linux/platform_data/usb-ohci-s3c2410.h>
|
|
|
+#include <plat/sdhci.h>
|
|
|
+#include <linux/platform_data/touchscreen-s3c2410.h>
|
|
|
+
|
|
|
+#include <video/platform_lcd.h>
|
|
|
+
|
|
|
+#include "common.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 smartq_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 void smartq_usb_host_powercontrol(int port, int to)
|
|
|
+{
|
|
|
+ pr_debug("%s(%d, %d)\n", __func__, port, to);
|
|
|
+
|
|
|
+ if (port == 0) {
|
|
|
+ gpio_set_value(S3C64XX_GPL(0), to);
|
|
|
+ gpio_set_value(S3C64XX_GPL(1), to);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static irqreturn_t smartq_usb_host_ocirq(int irq, void *pw)
|
|
|
+{
|
|
|
+ struct s3c2410_hcd_info *info = pw;
|
|
|
+
|
|
|
+ if (gpio_get_value(S3C64XX_GPL(10)) == 0) {
|
|
|
+ pr_debug("%s: over-current irq (oc detected)\n", __func__);
|
|
|
+ s3c2410_usb_report_oc(info, 3);
|
|
|
+ } else {
|
|
|
+ pr_debug("%s: over-current irq (oc cleared)\n", __func__);
|
|
|
+ s3c2410_usb_report_oc(info, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ return IRQ_HANDLED;
|
|
|
+}
|
|
|
+
|
|
|
+static void smartq_usb_host_enableoc(struct s3c2410_hcd_info *info, int on)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ /* This isn't present on a SmartQ 5 board */
|
|
|
+ if (machine_is_smartq5())
|
|
|
+ return;
|
|
|
+
|
|
|
+ if (on) {
|
|
|
+ ret = request_irq(gpio_to_irq(S3C64XX_GPL(10)),
|
|
|
+ smartq_usb_host_ocirq, IRQF_DISABLED |
|
|
|
+ IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
|
|
|
+ "USB host overcurrent", info);
|
|
|
+ if (ret != 0)
|
|
|
+ pr_err("failed to request usb oc irq: %d\n", ret);
|
|
|
+ } else {
|
|
|
+ free_irq(gpio_to_irq(S3C64XX_GPL(10)), info);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static struct s3c2410_hcd_info smartq_usb_host_info = {
|
|
|
+ .port[0] = {
|
|
|
+ .flags = S3C_HCDFLG_USED
|
|
|
+ },
|
|
|
+ .port[1] = {
|
|
|
+ .flags = 0
|
|
|
+ },
|
|
|
+
|
|
|
+ .power_control = smartq_usb_host_powercontrol,
|
|
|
+ .enable_oc = smartq_usb_host_enableoc,
|
|
|
+};
|
|
|
+
|
|
|
+static struct gpio_vbus_mach_info smartq_usb_otg_vbus_pdata = {
|
|
|
+ .gpio_vbus = S3C64XX_GPL(9),
|
|
|
+ .gpio_pullup = -1,
|
|
|
+ .gpio_vbus_inverted = true,
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device smartq_usb_otg_vbus_dev = {
|
|
|
+ .name = "gpio-vbus",
|
|
|
+ .dev.platform_data = &smartq_usb_otg_vbus_pdata,
|
|
|
+};
|
|
|
+
|
|
|
+static int smartq_bl_init(struct device *dev)
|
|
|
+{
|
|
|
+ s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static struct platform_pwm_backlight_data smartq_backlight_data = {
|
|
|
+ .pwm_id = 1,
|
|
|
+ .max_brightness = 1000,
|
|
|
+ .dft_brightness = 600,
|
|
|
+ .pwm_period_ns = 1000000000 / (1000 * 20),
|
|
|
+ .init = smartq_bl_init,
|
|
|
+};
|
|
|
+
|
|
|
+static struct platform_device smartq_backlight_device = {
|
|
|
+ .name = "pwm-backlight",
|
|
|
+ .dev = {
|
|
|
+ .parent = &s3c_device_timer[1].dev,
|
|
|
+ .platform_data = &smartq_backlight_data,
|
|
|
+ },
|
|
|
+};
|
|
|
+
|
|
|
+static struct s3c2410_ts_mach_info smartq_touchscreen_pdata __initdata = {
|