mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-29 10:02:23 +00:00
CF driver cleanup
SVN-Revision: 9473
This commit is contained in:
parent
772c6488da
commit
647541a1a0
@ -59,6 +59,9 @@
|
||||
#define RB150_NAND_WRITE(v) \
|
||||
writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
|
||||
|
||||
#define RB153_GPIO_CF_RDY ADM5120_GPIO_P1L1
|
||||
#define RB153_GPIO_CF_WT ADM5120_GPIO_P0L0
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
|
||||
@ -233,6 +236,15 @@ static void __init rb1xx_flash_setup(void)
|
||||
adm5120_nand_data.chip.options = NAND_NO_AUTOINCR;
|
||||
}
|
||||
|
||||
static void __init rb153_cf_setup(void)
|
||||
{
|
||||
gpio_request(RB153_GPIO_CF_RDY, "cf-ready");
|
||||
gpio_direction_input(RB153_GPIO_CF_RDY);
|
||||
gpio_request(RB153_GPIO_CF_WT, "cf-wait");
|
||||
gpio_direction_output(RB153_GPIO_CF_WT, 1);
|
||||
gpio_direction_input(RB153_GPIO_CF_WT);
|
||||
}
|
||||
|
||||
static void __init rb1xx_setup(void)
|
||||
{
|
||||
/* enable NAND flash interface */
|
||||
@ -269,6 +281,12 @@ static void __init rb150_setup(void)
|
||||
rb1xx_mac_setup();
|
||||
}
|
||||
|
||||
static void __init rb153_setup(void)
|
||||
{
|
||||
rb150_setup();
|
||||
rb153_cf_setup();
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
ADM5120_BOARD_START(RB_111, "Mikrotik RouterBOARD 111")
|
||||
@ -320,7 +338,7 @@ ADM5120_BOARD_START(RB_150, "Mikrotik RouterBOARD 150")
|
||||
ADM5120_BOARD_END
|
||||
|
||||
ADM5120_BOARD_START(RB_153, "Mikrotik RouterBOARD 153")
|
||||
.board_setup = rb1xx_setup,
|
||||
.board_setup = rb153_setup,
|
||||
.eth_num_ports = 5,
|
||||
.eth_vlans = rb15x_vlans,
|
||||
.num_devices = ARRAY_SIZE(rb153_devices),
|
||||
|
@ -16,8 +16,9 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/ioport.h> /* request_mem_region() */
|
||||
|
||||
#include <asm/unaligned.h> /* ioremap() */
|
||||
#include <asm/io.h> /* ioremap() */
|
||||
#include <asm/unaligned.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/gpio.h>
|
||||
|
||||
#include <gpio.h>
|
||||
#include <adm5120_defs.h>
|
||||
@ -69,7 +70,7 @@ static inline u8 rareg(unsigned reg, struct cf_mips_dev* dev)
|
||||
|
||||
static inline int cfrdy(struct cf_mips_dev *dev)
|
||||
{
|
||||
return (SW_READ_REG(GPIO_CONF0) & (1 << 12));
|
||||
return gpio_get_value(12);
|
||||
}
|
||||
|
||||
static inline void prepare_cf_irq(struct cf_mips_dev *dev)
|
||||
@ -92,7 +93,7 @@ static inline int cf_present(struct cf_mips_dev* dev)
|
||||
int i;
|
||||
|
||||
/* on RB100 WAIT is LOW all the time => read will hang */
|
||||
if (SW_READ_REG(GPIO_CONF0) & (1 << 8))
|
||||
if (gpio_read_value(8))
|
||||
cmd |= EXTIO_WAIT_EN;
|
||||
|
||||
SW_WRITE_REG(GPIO_CONF2, cmd);
|
||||
|
@ -93,10 +93,10 @@ int cf_mips_probe(struct platform_device *pdev)
|
||||
return reg_result;
|
||||
}
|
||||
|
||||
dev = (struct cf_mips_dev *)kmalloc(sizeof(struct cf_mips_dev),GFP_KERNEL);
|
||||
dev = (struct cf_mips_dev *)kzalloc(sizeof(struct cf_mips_dev),GFP_KERNEL);
|
||||
if (!dev)
|
||||
goto out_err;
|
||||
memset(dev, 0, sizeof(struct cf_mips_dev));
|
||||
|
||||
cdev->dev = dev;
|
||||
|
||||
dev->pin = cdev->gpio_pin;
|
||||
@ -104,8 +104,9 @@ int cf_mips_probe(struct platform_device *pdev)
|
||||
r = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cf_membase");
|
||||
dev->base = (void *) r->start;
|
||||
|
||||
if (cf_init(dev)) goto out_err;
|
||||
printk("init done");
|
||||
if (cf_init(dev))
|
||||
goto out_err;
|
||||
printk(KERN_INFO "cf-mips: init done");
|
||||
|
||||
spin_lock_init(&dev->lock);
|
||||
dev->queue = blk_init_queue(cf_request,&dev->lock);
|
||||
@ -125,7 +126,9 @@ int cf_mips_probe(struct platform_device *pdev)
|
||||
dev->gd = alloc_disk(CF_MAX_PART);
|
||||
cf_gendisk = dev->gd;
|
||||
cdev->gd = dev->gd;
|
||||
if (!cf_gendisk) goto out_err; /* Last of these goto's */
|
||||
|
||||
if (!cf_gendisk)
|
||||
goto out_err; /* Last of these goto's */
|
||||
|
||||
cf_gendisk->major = MAJOR_NR;
|
||||
cf_gendisk->first_minor = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user