diff options
author | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-04-07 21:49:05 +0000 |
---|---|---|
committer | florian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-04-07 21:49:05 +0000 |
commit | c26ad84f74fc5ea27f6ce2a0f99478c72d9b71e1 (patch) | |
tree | f34d07904c8fc021caed0d2135562906f0e57797 /target/linux/rb532/files/drivers/block | |
parent | c8748126906b1a7c3571d2b17d69ea3e0d3e4cae (diff) |
GPIO code updates, make the cf-mips driver compile against this gpio version
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10768 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/rb532/files/drivers/block')
-rw-r--r-- | target/linux/rb532/files/drivers/block/rb500/ata.c | 30 | ||||
-rw-r--r-- | target/linux/rb532/files/drivers/block/rb500/bdev.c | 3 |
2 files changed, 13 insertions, 20 deletions
diff --git a/target/linux/rb532/files/drivers/block/rb500/ata.c b/target/linux/rb532/files/drivers/block/rb500/ata.c index fc5f97b6c8..e4085c27ad 100644 --- a/target/linux/rb532/files/drivers/block/rb500/ata.c +++ b/target/linux/rb532/files/drivers/block/rb500/ata.c @@ -15,6 +15,8 @@ #include <linux/sched.h> #include <linux/pci.h> #include <linux/ioport.h> /* request_mem_region() */ + +#include <asm/gpio.h> #include <asm/unaligned.h> /* ioremap() */ #include <asm/io.h> /* ioremap() */ #include <asm/rc32434/rb.h> @@ -55,25 +57,15 @@ static inline u8 rareg(unsigned reg, struct cf_mips_dev* dev) return readb(dev->baddr + ATA_REG_OFFSET + reg); } -static inline int get_gpio_bit(gpio_func ofs, struct cf_mips_dev *dev) -{ - return (gpio_get(ofs) >> dev->pin) & 1; -} - -static inline void set_gpio_bit(int bit, gpio_func ofs, struct cf_mips_dev *dev) -{ - gpio_set(ofs, (1 << dev->pin), ((bit & 1) << dev->pin)); -} - static inline int cfrdy(struct cf_mips_dev *dev) { - return get_gpio_bit(DATA, dev); + return gpio_get_value(dev->pin); } static inline void prepare_cf_irq(struct cf_mips_dev *dev) { - set_gpio_bit(1, ILEVEL, dev); /* interrupt on cf ready (not busy) */ - set_gpio_bit(0, ISTAT, dev); /* clear interrupt status */ + rb500_gpio_set_int_level(1, dev->pin); /* interrupt on cf ready (not busy) */ + rb500_gpio_set_int_status(0, dev->pin); /* clear interrupt status */ } static inline int cf_present(struct cf_mips_dev* dev) @@ -85,8 +77,8 @@ static inline int cf_present(struct cf_mips_dev* dev) int i; /* setup CFRDY GPIO as input */ - set_gpio_bit(0, FUNC, dev); - set_gpio_bit(0, CFG, dev); + rb500_gpio_set_func(dev->pin, 0); + gpio_direction_input(dev->pin); for (i = 0; i < 0x10; ++i) { if (rareg(i,dev) != 0xff) @@ -151,9 +143,9 @@ static irqreturn_t cf_irq_handler(int irq, void *dev_id) * To avoid this, we change ILEVEL to 0. */ struct cf_mips_dev *dev=dev_id; - - set_gpio_bit(0, ILEVEL, dev); - set_gpio_bit(0, ISTAT, dev); + + rb500_gpio_set_int_level(0, dev->pin); + rb500_gpio_set_int_status(0, dev->pin); del_timer(&dev->to_timer); tasklet_schedule(&dev->tasklet); @@ -393,7 +385,7 @@ static int do_identify(struct cf_mips_dev *dev) tstr[16]=0; printk(KERN_INFO "cf-mips: %s detected, C/H/S=%d/%d/%d sectors=%u (%uMB) Serial=%s\n", (sbuf[0] == 0x848A ? "CF card" : "ATA drive"), dev->cyl, dev->head, - dev->spt, dev->sectors, dev->sectors >> 11,tstr); + dev->spt, dev->sectors, dev->sectors >> 11, tstr); return 1; } diff --git a/target/linux/rb532/files/drivers/block/rb500/bdev.c b/target/linux/rb532/files/drivers/block/rb500/bdev.c index e4532739b9..f8a9b02d70 100644 --- a/target/linux/rb532/files/drivers/block/rb500/bdev.c +++ b/target/linux/rb532/files/drivers/block/rb500/bdev.c @@ -23,6 +23,7 @@ #include <asm/uaccess.h> #include <asm/io.h> +#include <asm/gpio.h> #include <asm/rc32434/rb.h> @@ -242,7 +243,7 @@ static int cf_open(struct inode *inode, struct file *filp) /* dirty workaround to set CFRDY GPIO as an input when some other program sets it as an output */ - gpio_set(CFG, (1 << dev->pin), 0); + gpio_set_value(dev->pin, 0); return 0; /* success */ } |