Commit 779219ca authored by Kevin Hilman's avatar Kevin Hilman

Merge ../../omap/pristine

parents 2a9b5560 e809ae28
......@@ -13,6 +13,8 @@
#include <linux/init.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/ioport.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#include <asm/arch/gpmc.h>
......@@ -41,6 +43,19 @@
#define GPMC_CS0 0x60
#define GPMC_CS_SIZE 0x30
#define GPMC_CS_NUM 8
#define GPMC_MEM_START 0x00000000
#define GPMC_MEM_END 0x3FFFFFFF
#define BOOT_ROM_SPACE 0x100000 /* 1MB */
#define GPMC_CHUNK_SHIFT 24 /* 16 MB */
#define GPMC_SECTION_SHIFT 28 /* 128 MB */
static struct resource gpmc_mem_root;
static struct resource gpmc_cs_mem[GPMC_CS_NUM];
static spinlock_t gpmc_mem_lock = SPIN_LOCK_UNLOCKED;
static unsigned gpmc_cs_map;
static void __iomem *gpmc_base =
(void __iomem *) IO_ADDRESS(GPMC_BASE);
static void __iomem *gpmc_cs_base =
......@@ -187,9 +202,168 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t)
return 0;
}
unsigned long gpmc_cs_get_base_addr(int cs)
static void gpmc_cs_enable_mem(int cs, u32 base, u32 size)
{
u32 l;
u32 mask;
mask = (1 << GPMC_SECTION_SHIFT) - size;
l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
l &= ~0x3f;
l = (base >> GPMC_CHUNK_SHIFT) & 0x3f;
l &= ~(0x0f << 8);
l |= ((mask >> GPMC_CHUNK_SHIFT) & 0x0f) << 8;
l |= 1 << 6; /* CSVALID */
gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
}
static void gpmc_cs_disable_mem(int cs)
{
u32 l;
l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
l &= ~(1 << 6); /* CSVALID */
gpmc_cs_write_reg(cs, GPMC_CS_CONFIG7, l);
}
static void gpmc_cs_get_memconf(int cs, u32 *base, u32 *size)
{
u32 l;
u32 mask;
l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
*base = (l & 0x3f) << GPMC_CHUNK_SHIFT;
mask = (l >> 8) & 0x0f;
*size = (1 << GPMC_SECTION_SHIFT) - (mask << GPMC_CHUNK_SHIFT);
}
static int gpmc_cs_mem_enabled(int cs)
{
u32 l;
l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
return l & (1 << 6);
}
static void gpmc_cs_set_reserved(int cs, int reserved)
{
return (gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7) & 0x1f) << 24;
gpmc_cs_map &= ~(1 << cs);
gpmc_cs_map |= (reserved ? 1 : 0) << cs;
}
static int gpmc_cs_reserved(int cs)
{
return gpmc_cs_map & (1 << cs);
}
static unsigned long gpmc_mem_align(unsigned long size)
{
int order;
size = (size - 1) >> (GPMC_CHUNK_SHIFT - 1);
order = GPMC_CHUNK_SHIFT - 1;
do {
size >>= 1;
order++;
} while (size);
size = 1 << order;
return size;
}
static int gpmc_cs_insert_mem(int cs, unsigned long base, unsigned long size)
{
struct resource *res = &gpmc_cs_mem[cs];
int r;
size = gpmc_mem_align(size);
spin_lock(&gpmc_mem_lock);
res->start = base;
res->end = base + size - 1;
r = request_resource(&gpmc_mem_root, res);
spin_unlock(&gpmc_mem_lock);
return r;
}
int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
{
struct resource *res = &gpmc_cs_mem[cs];
int r = -1;
if (cs > GPMC_CS_NUM)
return -ENODEV;
size = gpmc_mem_align(size);
if (size > (1 << GPMC_SECTION_SHIFT))
return -ENOMEM;
spin_lock(&gpmc_mem_lock);
if (gpmc_cs_reserved(cs)) {
r = -EBUSY;
goto out;
}
if (gpmc_cs_mem_enabled(cs))
r = adjust_resource(res, res->start & ~(size - 1), size);
if (r < 0)
r = allocate_resource(&gpmc_mem_root, res, size, 0, ~0,
size, NULL, NULL);
if (r < 0)
goto out;
gpmc_cs_enable_mem(cs, res->start, res->end - res->start + 1);
*base = res->start;
gpmc_cs_set_reserved(cs, 1);
out:
spin_unlock(&gpmc_mem_lock);
return r;
}
void gpmc_cs_free(int cs)
{
spin_lock(&gpmc_mem_lock);
if (cs >= GPMC_CS_NUM || !gpmc_cs_reserved(cs)) {
printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs);
BUG();
spin_unlock(&gpmc_mem_lock);
return;
}
gpmc_cs_disable_mem(cs);
release_resource(&gpmc_cs_mem[cs]);
gpmc_cs_set_reserved(cs, 0);
spin_unlock(&gpmc_mem_lock);
}
void __init gpmc_mem_init(void)
{
int cs;
unsigned long boot_rom_space = 0;
if (cpu_is_omap242x()) {
u32 l;
l = omap_readl(OMAP242X_CONTROL_STATUS);
/* In case of internal boot the 1st MB is redirected to the
* boot ROM memory space.
*/
if (l & (1 << 3))
boot_rom_space = BOOT_ROM_SPACE;
} else
/* We assume internal boot if the mode can't be
* determined.
*/
boot_rom_space = BOOT_ROM_SPACE;
gpmc_mem_root.start = GPMC_MEM_START + boot_rom_space;
gpmc_mem_root.end = GPMC_MEM_END;
/* Reserve all regions that has been set up by bootloader */
for (cs = 0; cs < GPMC_CS_NUM; cs++) {
u32 base, size;
if (!gpmc_cs_mem_enabled(cs))
continue;
gpmc_cs_get_memconf(cs, &base, &size);
if (gpmc_cs_insert_mem(cs, base, size) < 0)
BUG();
}
}
void __init gpmc_init(void)
......@@ -206,4 +380,6 @@ void __init gpmc_init(void)
l &= 0x03 << 3;
l |= (0x02 << 3) | (1 << 0);
gpmc_write_reg(GPMC_SYSCONFIG, l);
gpmc_mem_init();
}
......@@ -28,9 +28,9 @@
#include <asm/arch/clock.h>
static LIST_HEAD(clocks);
LIST_HEAD(clocks);
DEFINE_SPINLOCK(clockfw_lock);
static DEFINE_MUTEX(clocks_mutex);
static DEFINE_SPINLOCK(clockfw_lock);
static struct clk_functions *arch_clock;
......
......@@ -24,13 +24,21 @@
#include <asm/arch/irqs.h>
#include <asm/arch/mux.h>
#include <asm/arch/board.h>
#include <asm/arch/gpio-switch.h>
struct gpio_switch {
char name[14];
u16 gpio;
int flags;
int type;
int state;
unsigned flags:4;
unsigned type:4;
unsigned state:1;
unsigned both_edges:1;
u16 debounce_rising;
u16 debounce_falling;
void (* notify)(void *data, int state);
void *notify_data;
struct work_struct work;
struct timer_list timer;
......@@ -43,14 +51,17 @@ static LIST_HEAD(gpio_switches);
static struct platform_device *gpio_sw_platform_dev;
static struct device_driver gpio_sw_driver;
static const struct omap_gpio_switch *board_gpio_sw_table;
static int board_gpio_sw_count;
static const char *cover_str[2] = { "open", "closed" };
static const char *connection_str[2] = { "disconnected", "connected" };
static const char *activity_str[2] = { "inactive", "active" };
/*
* GPIO switch state debounce delay in ms
* GPIO switch state default debounce delay in ms
*/
#define OMAP_GPIO_SW_DEBOUNCE_DELAY 10
#define OMAP_GPIO_SW_DEFAULT_DEBOUNCE 10
static const char **get_sw_str(struct gpio_switch *sw)
{
......@@ -174,8 +185,28 @@ static DEVICE_ATTR(direction, S_IRUGO, gpio_sw_direction_show, NULL);
static irqreturn_t gpio_sw_irq_handler(int irq, void *arg, struct pt_regs *regs)
{
struct gpio_switch *sw = arg;
unsigned long timeout;
int state;
mod_timer(&sw->timer, jiffies + msecs_to_jiffies(OMAP_GPIO_SW_DEBOUNCE_DELAY));
if (!sw->both_edges) {
if (omap_get_gpio_datain(sw->gpio))
set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_FALLING);
else
set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_RISING);
}
state = gpio_sw_get_state(sw);
if (sw->state == state)
return IRQ_HANDLED;
if (state)
timeout = sw->debounce_rising;
else
timeout = sw->debounce_falling;
if (!timeout)
schedule_work(&sw->work);
else
mod_timer(&sw->timer, jiffies + msecs_to_jiffies(timeout));
return IRQ_HANDLED;
}
......@@ -197,14 +228,26 @@ static void gpio_sw_handler(void *data)
return;
sw->state = state;
if (omap_get_gpio_datain(sw->gpio))
set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_FALLING);
else
set_irq_type(OMAP_GPIO_IRQ(sw->gpio), IRQT_RISING);
if (sw->notify != NULL)
sw->notify(sw->notify_data, state);
sysfs_notify(&sw->pdev.dev.kobj, NULL, "state");
print_sw_state(sw, state);
}
static int __init can_do_both_edges(struct gpio_switch *sw)
{
if (!cpu_class_is_omap1())
return 1;
if (OMAP_GPIO_IS_MPUIO(sw->gpio))
return 0;
else
return 1;
}
static void gpio_sw_release(struct device *dev)
{
}
static int __init new_switch(struct gpio_switch *sw)
{
int r, direction, trigger;
......@@ -224,11 +267,14 @@ static int __init new_switch(struct gpio_switch *sw)
sw->pdev.dev.parent = &gpio_sw_platform_dev->dev;
sw->pdev.dev.driver = &gpio_sw_driver;
sw->pdev.dev.release = gpio_sw_release;
r = platform_device_register(&sw->pdev);
if (r)
if (r) {
printk(KERN_ERR "gpio-switch: platform device registration "
"failed for %s", sw->name);
return r;
}
dev_set_drvdata(&sw->pdev.dev, sw);
r = omap_request_gpio(sw->gpio);
......@@ -241,24 +287,29 @@ static int __init new_switch(struct gpio_switch *sw)
direction = !(sw->flags & OMAP_GPIO_SWITCH_FLAG_OUTPUT);
omap_set_gpio_direction(sw->gpio, direction);
sw->state = gpio_sw_get_state(sw);
device_create_file(&sw->pdev.dev, &dev_attr_state);
device_create_file(&sw->pdev.dev, &dev_attr_type);
device_create_file(&sw->pdev.dev, &dev_attr_direction);
list_add(&sw->node, &gpio_switches);
if (!direction)
return 0;
if (omap_get_gpio_datain(sw->gpio))
trigger = SA_TRIGGER_FALLING;
else
trigger = SA_TRIGGER_RISING;
if (can_do_both_edges(sw)) {
trigger = SA_TRIGGER_FALLING | SA_TRIGGER_RISING;
sw->both_edges = 1;
} else {
if (omap_get_gpio_datain(sw->gpio))
trigger = SA_TRIGGER_FALLING;
else
trigger = SA_TRIGGER_RISING;
}
r = request_irq(OMAP_GPIO_IRQ(sw->gpio), gpio_sw_irq_handler,
SA_SHIRQ | trigger, sw->name, sw);
if (r < 0) {
printk(KERN_ERR "gpio-switch: request_irq() failed "
"for GPIO %d\n", sw->gpio);
"for GPIO %d\n", sw->gpio);
platform_device_unregister(&sw->pdev);
omap_free_gpio(sw->gpio);
return r;
......@@ -270,6 +321,8 @@ static int __init new_switch(struct gpio_switch *sw)
sw->timer.function = gpio_sw_timer;
sw->timer.data = (unsigned long)sw;
list_add(&sw->node, &gpio_switches);
return 0;
}
......@@ -284,17 +337,91 @@ static int __init add_atag_switches(void)
struct omap_gpio_switch_config, i);
if (cfg == NULL)
break;
sw = kmalloc(sizeof(*sw), GFP_KERNEL);
sw = kzalloc(sizeof(*sw), GFP_KERNEL);
if (sw == NULL) {
printk(KERN_ERR "gpio-switch: kmalloc failed\n");
return -ENOMEM;
}
memset(sw, 0, sizeof(*sw));
strncpy(sw->name, cfg->name, sizeof(cfg->name));
sw->gpio = cfg->gpio;
sw->flags = cfg->flags;
sw->type = cfg->type;
sw->state = gpio_sw_get_state(sw);
sw->debounce_rising = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
sw->debounce_falling = OMAP_GPIO_SW_DEFAULT_DEBOUNCE;
if ((r = new_switch(sw)) < 0) {
kfree(sw);
return r;
}
}
return 0;
}
static struct gpio_switch * __init find_switch(int gpio, const char *name)
{
struct gpio_switch *sw;
list_for_each_entry(sw, &gpio_switches, node) {
if ((gpio < 0 || sw->gpio != gpio) &&
(name == NULL || strcmp(sw->name, name) != 0))
continue;
if (gpio < 0 || name == NULL)
goto no_check;
if (strcmp(sw->name, name) != 0)
printk("gpio-switch: name mismatch for %d (%s, %s)\n",
gpio, name, sw->name);
else if (sw->gpio != gpio)
printk("gpio-switch: GPIO mismatch for %s (%d, %d)\n",
name, gpio, sw->gpio);
no_check:
return sw;
}
return NULL;
}
static int __init add_board_switches(void)
{
int i;
for (i = 0; i < board_gpio_sw_count; i++) {
const struct omap_gpio_switch *cfg;
struct gpio_switch *sw;
int r;
cfg = board_gpio_sw_table + i;
if (strlen(cfg->name) > sizeof(sw->name) - 1)
return -EINVAL;
/* Check whether we only update an existing switch
* or add a new switch. */
sw = find_switch(cfg->gpio, cfg->name);
if (sw != NULL) {
sw->debounce_rising = cfg->debounce_rising;
sw->debounce_falling = cfg->debounce_falling;
sw->notify = cfg->notify;
sw->notify_data = cfg->notify_data;
continue;
} else {
if (cfg->gpio < 0 || cfg->name == NULL) {
printk("gpio-switch: required switch not "
"found (%d, %s)\n", cfg->gpio,
cfg->name);
continue;
}
}
sw = kzalloc(sizeof(*sw), GFP_KERNEL);
if (sw == NULL) {
printk(KERN_ERR "gpio-switch: kmalloc failed\n");
return -ENOMEM;
}
strlcpy(sw->name, cfg->name, sizeof(sw->name));
sw->gpio = cfg->gpio;
sw->flags = cfg->flags;
sw->type = cfg->type;
sw->debounce_rising = cfg->debounce_rising;
sw->debounce_falling = cfg->debounce_falling;
sw->notify = cfg->notify;
sw->notify_data = cfg->notify_data;
if ((r = new_switch(sw)) < 0) {
kfree(sw);
return r;
......@@ -308,8 +435,8 @@ static void gpio_sw_cleanup(void)
struct gpio_switch *sw = NULL, *old = NULL;
list_for_each_entry(sw, &gpio_switches, node) {
kfree(old);
if (old != NULL)
kfree(old);
flush_scheduled_work();
del_timer_sync(&sw->timer);
......@@ -323,8 +450,7 @@ static void gpio_sw_cleanup(void)
omap_free_gpio(sw->gpio);
old = sw;
}
kfree(sw);
kfree(old);
}
static void __init report_initial_state(void)
......@@ -337,6 +463,8 @@ static void __init report_initial_state(void)
state = omap_get_gpio_datain(sw->gpio);
if (sw->flags & OMAP_GPIO_SWITCH_FLAG_INVERTED)
state = !state;
if (sw->notify != NULL)
sw->notify(sw->notify_data, state);
print_sw_state(sw, state);
}
}
......@@ -351,6 +479,15 @@ static struct device_driver gpio_sw_driver = {
.shutdown = gpio_sw_shutdown,
};
void __init omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
int count)
{
BUG_ON(board_gpio_sw_table != NULL);
board_gpio_sw_table = tbl;
board_gpio_sw_count = count;
}
static int __init gpio_sw_init(void)
{
int r;
......@@ -364,21 +501,27 @@ static int __init gpio_sw_init(void)
gpio_sw_platform_dev = platform_device_register_simple("gpio-switch",
-1, NULL, 0);
if (IS_ERR(gpio_sw_platform_dev)) {
driver_unregister(&gpio_sw_driver);
return PTR_ERR(gpio_sw_platform_dev);
r = PTR_ERR(gpio_sw_platform_dev);
goto err1;
}
r = add_atag_switches();
if (r < 0) {
platform_device_unregister(gpio_sw_platform_dev);
driver_unregister(&gpio_sw_driver);
gpio_sw_cleanup();
return r;
}
if (r < 0)
goto err2;
r = add_board_switches();
if (r < 0)
goto err2;
report_initial_state();
return 0;
err2:
gpio_sw_cleanup();
platform_device_unregister(gpio_sw_platform_dev);
err1:
driver_unregister(&gpio_sw_driver);
return r;
}
static void __exit gpio_sw_exit(void)
......
......@@ -110,8 +110,6 @@
#define OMAP24XX_GPIO_CLEARDATAOUT 0x0090
#define OMAP24XX_GPIO_SETDATAOUT 0x0094
#define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff)
struct gpio_bank {
void __iomem *base;
u16 irq;
......@@ -216,11 +214,13 @@ static inline int gpio_valid(int gpio)
{
if (gpio < 0)
return -1;
#ifndef CONFIG_ARCH_OMAP24XX
if (OMAP_GPIO_IS_MPUIO(gpio)) {
if ((gpio & OMAP_MPUIO_MASK) > 16)
if (gpio >= MAX_GPIO_LINES + 16)
return -1;
return 0;
}
#endif
#ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap15xx() && gpio < 16)
return 0;
......
/* drivers/leds/leds-omap.c
*
* (C) 2006 Samsung Electronics
* Kyungmin Park <kyungmin.park@samsung.com>
*
* OMAP - LEDs GPIO driver
*
* 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/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/leds.h>
#include <asm/arch/gpio.h>
#include <asm/arch/hardware.h>
#include <asm/arch/led.h>
/* our context */
static void omap_set_led_gpio(struct led_classdev *led_cdev,
enum led_brightness value)
{
struct omap_led_config *led_dev;
led_dev = container_of(led_cdev, struct omap_led_config, cdev);
if (value)
omap_set_gpio_dataout(led_dev->gpio, 1);
else
omap_set_gpio_dataout(led_dev->gpio, 0);
}
static void omap_configure_led_gpio(int gpio)
{
if (omap_request_gpio(gpio) < 0) {
printk(KERN_ERR "Failed to request GPIO%d for LEDs\n", gpio);
return;
}
omap_set_gpio_direction(gpio, 0); /* OUT */
}
static int omap_led_probe(struct platform_device *dev)
{
struct omap_led_platform_data *pdata = dev->dev.platform_data;
struct omap_led_config *leds = pdata->leds;
int i, ret = 0;
for (i = 0; ret >= 0 && i < pdata->nr_leds; i++) {
omap_configure_led_gpio(leds[i].gpio);
if (!leds[i].cdev.brightness_set)
leds[i].cdev.brightness_set = omap_set_led_gpio;
ret = led_classdev_register(&dev->dev, &leds[i].cdev);
}
if (ret < 0 && i > 1) {
for (i = i - 2; i >= 0; i--)
led_classdev_unregister(&leds[i].cdev);
}
return ret;
}
static int omap_led_remove(struct platform_device *dev)
{
struct omap_led_platform_data *pdata = dev->dev.platform_data;
struct omap_led_config *leds = pdata->leds;
int i;
for (i = 0; i < pdata->nr_leds; i++)
led_classdev_unregister(&leds[i].cdev);
return 0;
}
#ifdef CONFIG_PM
static int omap_led_suspend(struct platform_device *dev, pm_message_t state)
{
struct omap_led_platform_data *pdata = dev->dev.platform_data;
struct omap_led_config *leds = pdata->leds;
int i;
for (i = 0; i < pdata->nr_leds; i++)
led_classdev_suspend(&leds[i].cdev);
return 0;
}
static int omap_led_resume(struct platform_device *dev)
{
struct omap_led_platform_data *pdata = dev->dev.platform_data;
struct omap_led_config *leds = pdata->leds;
int i;
for (i = 0; i < pdata->nr_leds; i++)
led_classdev_resume(&leds[i].cdev);
return 0;
}
#else
#define omap_led_suspend NULL
#define omap_led_resume NULL
#endif
static struct platform_driver omap_led_driver = {
.probe = omap_led_probe,
.remove = omap_led_remove,
.suspend = omap_led_suspend,
.resume = omap_led_resume,
.driver = {
.name = "omap-led",
.owner = THIS_MODULE,
},
};
static int __init omap_led_init(void)
{
return platform_driver_register(&omap_led_driver);
}
static void __exit omap_led_exit(void)
{
platform_driver_unregister(&omap_led_driver);
}
module_init(omap_led_init);
module_exit(omap_led_exit);
MODULE_AUTHOR("Kyungmin Park<kyungmin.park@samsung.com>");
MODULE_DESCRIPTION("OMAP LED driver");
MODULE_LICENSE("GPL");
......@@ -12,6 +12,8 @@
#include <linux/types.h>
#include <asm/arch/gpio-switch.h>
/* Different peripheral ids */
#define OMAP_TAG_CLOCK 0x4f01
#define OMAP_TAG_MMC 0x4f02
......@@ -115,22 +117,7 @@ struct omap_pwm_led_platform_data {
void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
};
/* Cover:
* high -> closed
* low -> open
* Connection:
* high -> connected
* low -> disconnected
* Activity:
* high -> active
* low -> inactive
*
*/
#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
/* See include/asm-arm/arch-omap/gpio-switch.h for definitions */
struct omap_gpio_switch_config {
char name[12];
u16 gpio;
......
......@@ -49,6 +49,8 @@ struct clk_functions {
};
extern unsigned int mpurate;
extern struct list_head clocks;
extern spinlock_t clockfw_lock;
extern int clk_init(struct clk_functions * custom_clocks);
extern int clk_register(struct clk *clk);
......
/*
* GPIO switch definitions
*
* Copyright (C) 2006 Nokia Corporation
*
* 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.
*/
#ifndef __ASM_ARCH_OMAP_GPIO_SWITCH_H
#define __ASM_ARCH_OMAP_GPIO_SWITCH_H
#include <linux/types.h>
/* Cover:
* high -> closed
* low -> open
* Connection:
* high -> connected
* low -> disconnected
* Activity:
* high -> active
* low -> inactive
*
*/
#define OMAP_GPIO_SWITCH_TYPE_COVER 0x0000
#define OMAP_GPIO_SWITCH_TYPE_CONNECTION 0x0001
#define OMAP_GPIO_SWITCH_TYPE_ACTIVITY 0x0002
#define OMAP_GPIO_SWITCH_FLAG_INVERTED 0x0001
#define OMAP_GPIO_SWITCH_FLAG_OUTPUT 0x0002
struct omap_gpio_switch {
const char *name;
s16 gpio;
unsigned flags:4;
unsigned type:4;
/* Time in ms to debounce when transitioning from
* inactive state to active state. */
u16 debounce_rising;
/* Same for transition from active to inactive state. */
u16 debounce_falling;
/* notify board-specific code about state changes */
void (* notify)(void *data, int state);
void *notify_data;
};
/* Call at init time only */
extern void omap_register_gpio_switches(const struct omap_gpio_switch *tbl,
int count);
#endif
......@@ -85,7 +85,7 @@ extern void gpmc_cs_write_reg(int cs, int idx, u32 val);
extern u32 gpmc_cs_read_reg(int cs, int idx);
extern int gpmc_cs_calc_divider(int cs, unsigned int sync_clk);
extern int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t);
extern unsigned long gpmc_cs_get_base_addr(int cs);
extern int gpmc_cs_request(int cs, unsigned long size, unsigned long *base);
extern void gpmc_cs_free(int cs);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment