/*
* Copyright (C) 2008-2009 ST-Ericsson
*
* Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
*
* 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/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/gpio.h>
#include <linux/amba/bus.h>
#include <linux/amba/pl022.h>
#include <linux/amba/serial.h>
#include <linux/spi/spi.h>
#include <linux/mfd/abx500/ab8500.h>
#include <linux/regulator/ab8500.h>
#include <linux/mfd/tc3589x.h>
#include <linux/mfd/tps6105x.h>
#include <linux/mfd/abx500/ab8500-gpio.h>
#include <linux/leds-lp5521.h>
#include <linux/input.h>
#include <linux/smsc911x.h>
#include <linux/gpio_keys.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/leds.h>
#include <linux/pinctrl/consumer.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/hardware/gic.h>
#include <plat/i2c.h>
#include <plat/ste_dma40.h>
#include <plat/gpio-nomadik.h>
#include <mach/hardware.h>
#include <mach/setup.h>
#include <mach/devices.h>
#include <mach/irqs.h>
#include <mach/crypto-ux500.h>
#include "ste-dma40-db8500.h"
#include "devices-db8500.h"
#include "board-mop500.h"
#include "board-mop500-regulators.h"
#include "board-mop500-msp.h"
static struct gpio_led snowball_led_array[] = {
{
.name = "user_led",
.default_trigger = "none",
.gpio = 142,
},
};
static struct gpio_led_platform_data snowball_led_data = {
.leds = snowball_led_array,
.num_leds = ARRAY_SIZE(snowball_led_array),
};
static struct platform_device snowball_led_dev = {
.name = "leds-gpio",
.dev = {
.platform_data = &snowball_led_data,
},
};
static struct ab8500_gpio_platform_data ab8500_gpio_pdata = {
.gpio_base = MOP500_AB8500_PIN_GPIO(1),
.irq_base = MOP500_AB8500_VIR_GPIO_IRQ_BASE,
/* config_reg is the initial configuration of ab8500 pins.
* The pins can be configured as GPIO or alt functions based
* on value present in GpioSel1 to GpioSel6 and AlternatFunction
* register. This is the array of 7 configuration settings.
* One has to compile time decide these settings. Below is the
* explanation of these setting
* GpioSel1 = 0x00 => Pins GPIO1 to GPIO8 are not used as GPIO
* GpioSel2 = 0x1E => Pins GPIO10 to GPIO13 are configured as GPIO
* GpioSel3 = 0x80 => Pin GPIO24 is configured as GPIO
* GpioSel4 = 0x01 => Pin GPIo25 is configured as GPIO
* GpioSel5 = 0x7A => Pins GPIO34, GPIO36 to GPIO39 are conf as GPIO
* GpioSel6 = 0x00 => Pins GPIO41 & GPIo42 are not configured as GPIO
* AlternaFunction = 0x00 => If Pins GPIO10 to 13 are not configured
* as GPIO then this register selectes the alternate fucntions
*/
.config_reg = {0x00, 0x1E, 0x80, 0x01,
0x7A, 0x00, 0x00},
};
static struct gpio_keys_button snowball_key_array[] = {
{
.gpio = 32,
.type = EV_KEY,
.code = KEY_1,
.desc = "userpb",
.active_low = 1,
.debounce_interval = 50,
.wakeup = 1,
},
{
.gpio = 151,
.type = EV_KEY,
.code = KEY_2,
.desc = "extkb1",
.active_low = 1,
.debounce_interval = 50,
.wakeup = 1,
},
{
.gpio = 152,
.type = EV_KEY,
.code = KEY_3,
.desc = "extkb2",
.active_low = 1,
.debounce_interval = 50,
.wakeup = 1,
},
{
.gpio = 161,
.type = EV_KEY,
.code = KEY_4,
.desc = "extkb3",
.active_low = 1,
.debounce_interval = 50,
.wakeup = 1,
},
{
.gpio = 162,
.type = EV_KEY,
.code = KEY_5,
.desc = "extkb4",
.active_low = 1,
.debounce_interval = 50,
.wakeup = 1,
},
};
static struct gpio_keys_platform_data snowball_key_data = {
.buttons = snowball_key_array,
.nbuttons = ARRAY_SIZE(snowball_key_array),
};
static struct platform_device snowball_key_dev = {
.name = "gpio-keys",
.id = -1,
.dev = {
.platform_data = &snowball_key_data,
}
};
static struct smsc911x_platform_config snowball_sbnet_cfg = {
.irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
.irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
.flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
.shift = 1,
};
static struct resource sbnet_res[] = {
{
.name = "smsc911x-memory",
.start = (0x5000 << 16),
.end = (0x5000 << 16) + 0xffff,
.flags = IORESOURCE_MEM,
},
{
.start = NOMADIK_GPIO_TO_IRQ(140),
.end = NOMADIK_GPIO_TO_IRQ(140),
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
},
};
static struct platform_device snowball_sbnet_dev = {
.name =