Date:2010-01-11 03:18:33 (3 years 4 months ago)
Author:Lars C.
Commit:f6544e59e19ffff711ce757597838c5ece27691d
Message:jz4740: gpio.c: More cleanup

Files: target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c (5 diffs)

Change Details

target/linux/xburst/files-2.6.31/arch/mips/jz4740/gpio.c
11/*
2 * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ74xx platform GPIO support
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform GPIO support
44 *
55 * This program is free software; you can redistribute it and/or modify it
66 * under the terms of the GNU General Public License as published by the
...... 
2222#include <linux/io.h>
2323#include <linux/gpio.h>
2424#include <linux/delay.h>
25#include <linux/irq.h>
2625#include <linux/interrupt.h>
2726#include <linux/bitops.h>
2827
29
30#include <asm/mach-jz4740/regs.h>
31
3228#define JZ_GPIO_BASE_A (32*0)
3329#define JZ_GPIO_BASE_B (32*1)
3430#define JZ_GPIO_BASE_C (32*2)
...... 
9995
10096static inline void jz_gpio_write_bit(unsigned int gpio, unsigned int reg)
10197{
102    writel(GPIO_TO_BIT(gpio), GPIO_TO_REG(gpio, reg));
98    writel(GPIO_TO_BIT(gpio), GPIO_TO_REG(gpio, reg));
10399}
104100
105101int jz_gpio_set_function(int gpio, enum jz_gpio_function function)
...... 
183179}
184180EXPORT_SYMBOL_GPL(jz_gpio_bulk_resume);
185181
186
187182void jz_gpio_enable_pullup(unsigned gpio)
188183{
189184    jz_gpio_write_bit(gpio, JZ_REG_GPIO_PULL_CLEAR);
...... 
258253#define IRQ_TO_GPIO(irq) (irq - JZ_IRQ_GPIO(0))
259254#define IRQ_TO_BIT(irq) BIT(IRQ_TO_GPIO(irq) & 0x1f)
260255
261
262256#define IRQ_TO_REG(irq, reg) GPIO_TO_REG(IRQ_TO_GPIO(irq), reg)
263#define IRQ_TO_PIN_REG(irq) IRQ_TO_REG(irq, 0x00)
264#define IRQ_TO_MASK_REG(irq) IRQ_TO_REG(irq, 0x20)
265#define IRQ_TO_MASK_SET_REG(irq) IRQ_TO_REG(irq, 0x24)
266#define IRQ_TO_MASK_CLEAR_REG(irq) IRQ_TO_REG(irq, 0x28)
267#define IRQ_TO_SELECT_REG(irq) IRQ_TO_REG(irq, 0x50)
268#define IRQ_TO_SELECT_SET_REG(irq) IRQ_TO_REG(irq, 0x54)
269#define IRQ_TO_SELECT_CLEAR_REG(irq) IRQ_TO_REG(irq, 0x58)
270#define IRQ_TO_DIRECTION_REG(irq) IRQ_TO_REG(irq, 0x60)
271#define IRQ_TO_DIRECTION_SET_REG(irq) IRQ_TO_REG(irq, 0x64)
272#define IRQ_TO_DIRECTION_CLEAR_REG(irq) IRQ_TO_REG(irq, 0x68)
273#define IRQ_TO_TRIGGER_REG(irq) IRQ_TO_REG(irq, 0x70)
274#define IRQ_TO_TRIGGER_SET_REG(irq) IRQ_TO_REG(irq, 0x74)
275#define IRQ_TO_TRIGGER_CLEAR_REG(irq) IRQ_TO_REG(irq, 0x78)
276#define IRQ_TO_FLAG_REG(irq) IRQ_TO_REG(irq, 0x80)
277#define IRQ_TO_FLAG_CLEAR_REG(irq) IRQ_TO_REG(irq, 0x14)
278
279257
280258static void jz_gpio_irq_demux_handler(unsigned int irq, struct irq_desc *desc)
281259{

Archive Download the corresponding diff file



interactive