mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
adm5120: merge 3.3 patches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31511 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
@@ -33,7 +33,7 @@ static struct clk uart_clk = {
|
||||
|
||||
struct clk *clk_get(struct device *dev, const char *id)
|
||||
{
|
||||
char *name = dev_name(dev);
|
||||
const char *name = dev_name(dev);
|
||||
|
||||
if (!strcmp(name, "apb:uart0") || !strcmp(name, "apb:uart1"))
|
||||
return &uart_clk;
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#include <asm/mach-adm5120/adm5120_defs.h>
|
||||
|
||||
static void adm5120_intc_irq_unmask(unsigned int irq);
|
||||
static void adm5120_intc_irq_mask(unsigned int irq);
|
||||
static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type);
|
||||
static void adm5120_intc_irq_unmask(struct irq_data *d);
|
||||
static void adm5120_intc_irq_mask(struct irq_data *d);
|
||||
static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type);
|
||||
|
||||
static inline void intc_write_reg(unsigned int reg, u32 val)
|
||||
{
|
||||
@@ -43,10 +43,10 @@ static inline u32 intc_read_reg(unsigned int reg)
|
||||
|
||||
static struct irq_chip adm5120_intc_irq_chip = {
|
||||
.name = "INTC",
|
||||
.unmask = adm5120_intc_irq_unmask,
|
||||
.mask = adm5120_intc_irq_mask,
|
||||
.mask_ack = adm5120_intc_irq_mask,
|
||||
.set_type = adm5120_intc_irq_set_type
|
||||
.irq_unmask = adm5120_intc_irq_unmask,
|
||||
.irq_mask = adm5120_intc_irq_mask,
|
||||
.irq_mask_ack = adm5120_intc_irq_mask,
|
||||
.irq_set_type = adm5120_intc_irq_set_type
|
||||
};
|
||||
|
||||
static struct irqaction adm5120_intc_irq_action = {
|
||||
@@ -54,20 +54,19 @@ static struct irqaction adm5120_intc_irq_action = {
|
||||
.name = "cascade [INTC]"
|
||||
};
|
||||
|
||||
static void adm5120_intc_irq_unmask(unsigned int irq)
|
||||
static void adm5120_intc_irq_unmask(struct irq_data *d)
|
||||
{
|
||||
irq -= ADM5120_INTC_IRQ_BASE;
|
||||
intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << irq);
|
||||
intc_write_reg(INTC_REG_IRQ_ENABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
|
||||
}
|
||||
|
||||
static void adm5120_intc_irq_mask(unsigned int irq)
|
||||
static void adm5120_intc_irq_mask(struct irq_data *d)
|
||||
{
|
||||
irq -= ADM5120_INTC_IRQ_BASE;
|
||||
intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << irq);
|
||||
intc_write_reg(INTC_REG_IRQ_DISABLE, 1 << (d->irq - ADM5120_INTC_IRQ_BASE));
|
||||
}
|
||||
|
||||
static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type)
|
||||
static int adm5120_intc_irq_set_type(struct irq_data *d, unsigned int flow_type)
|
||||
{
|
||||
unsigned int irq = d->irq;
|
||||
unsigned int sense;
|
||||
unsigned long mode;
|
||||
int err = 0;
|
||||
@@ -105,10 +104,6 @@ static int adm5120_intc_irq_set_type(unsigned int irq, unsigned int flow_type)
|
||||
mode &= ~(1 << (irq - ADM5120_INTC_IRQ_BASE));
|
||||
|
||||
intc_write_reg(INTC_REG_INT_MODE, mode);
|
||||
/* fallthrough */
|
||||
default:
|
||||
irq_desc[irq].status &= ~IRQ_TYPE_SENSE_MASK;
|
||||
irq_desc[irq].status |= sense;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -162,8 +157,7 @@ static void __init adm5120_intc_irq_init(void)
|
||||
for (i = ADM5120_INTC_IRQ_BASE;
|
||||
i <= ADM5120_INTC_IRQ_BASE + INTC_IRQ_LAST;
|
||||
i++) {
|
||||
irq_desc[i].status = INTC_IRQ_STATUS;
|
||||
set_irq_chip_and_handler(i, &adm5120_intc_irq_chip,
|
||||
irq_set_chip_and_handler(i, &adm5120_intc_irq_chip,
|
||||
handle_level_irq);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
#include <asm/bootinfo.h>
|
||||
|
||||
@@ -244,31 +245,44 @@ void __init adm5120_add_device_uart(unsigned id)
|
||||
/*
|
||||
* GPIO buttons
|
||||
*/
|
||||
#define ADM5120_BUTTON_INTERVAL 20
|
||||
struct gpio_buttons_platform_data adm5120_gpio_buttons_data = {
|
||||
.poll_interval = ADM5120_BUTTON_INTERVAL,
|
||||
};
|
||||
|
||||
struct platform_device adm5120_gpio_buttons_device = {
|
||||
.name = "gpio-buttons",
|
||||
.id = -1,
|
||||
.dev.platform_data = &adm5120_gpio_buttons_data,
|
||||
};
|
||||
|
||||
void __init adm5120_add_device_gpio_buttons(unsigned nbuttons,
|
||||
struct gpio_button *buttons)
|
||||
void __init adm5120_register_gpio_buttons(int id,
|
||||
unsigned poll_interval,
|
||||
unsigned nbuttons,
|
||||
struct gpio_keys_button *buttons)
|
||||
{
|
||||
struct gpio_button *p;
|
||||
struct platform_device *pdev;
|
||||
struct gpio_keys_platform_data pdata;
|
||||
struct gpio_keys_button *p;
|
||||
int err;
|
||||
|
||||
p = kmalloc(nbuttons * sizeof(*p), GFP_KERNEL);
|
||||
p = kmemdup(buttons, nbuttons * sizeof(*p), GFP_KERNEL);
|
||||
if (!p)
|
||||
return;
|
||||
|
||||
memcpy(p, buttons, nbuttons * sizeof(*p));
|
||||
adm5120_gpio_buttons_data.nbuttons = nbuttons;
|
||||
adm5120_gpio_buttons_data.buttons = p;
|
||||
pdev = platform_device_alloc("gpio-keys-polled", id);
|
||||
if (!pdev)
|
||||
goto err_free_buttons;
|
||||
|
||||
platform_device_register(&adm5120_gpio_buttons_device);
|
||||
memset(&pdata, 0, sizeof(pdata));
|
||||
pdata.poll_interval = poll_interval;
|
||||
pdata.nbuttons = nbuttons;
|
||||
pdata.buttons = p;
|
||||
|
||||
err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
|
||||
if (err)
|
||||
goto err_put_pdev;
|
||||
|
||||
err = platform_device_add(pdev);
|
||||
if (err)
|
||||
goto err_put_pdev;
|
||||
|
||||
return;
|
||||
|
||||
err_put_pdev:
|
||||
platform_device_put(pdev);
|
||||
|
||||
err_free_buttons:
|
||||
kfree(p);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user