1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-24 04:17:11 +02:00

[adm5120] experimental gpiodev support (closes #3613)

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12134 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
juhosg 2008-08-05 11:16:46 +00:00
parent 677508fba0
commit 33bca57f01
8 changed files with 64 additions and 0 deletions

View File

@ -93,6 +93,11 @@ static int __init adm5120_board_setup(void)
/* register built-in ethernet switch */
platform_device_register(&adm5120_switch_device);
if (adm5120_package_pqfp())
adm5120_gpiodev_resource.start &= ~0xf0;
platform_device_register(&adm5120_gpiodev_device);
/* setup PCI irq map */
adm5120_pci_set_irq_map(board->pci_nr_irqs, board->pci_irq_map);

View File

@ -22,6 +22,10 @@
#include <adm5120_platform.h>
#include <adm5120_irq.h>
#define CAS6XX_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
#define CAS7XX_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
#define NFS_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
static void switch_bank_gpio5(unsigned bank)
{
switch (bank) {
@ -104,6 +108,8 @@ static void __init cas6xx_setup(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
adm5120_flash0_data.parts = cas6xx_partitions;
adm5120_gpiodev_resource.start &= ~CAS6XX_GPIO_DEV_MASK;
/* TODO: setup mac address */
}
@ -117,6 +123,8 @@ static void __init cas7xx_setup(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas7xx_partitions);
adm5120_flash0_data.parts = cas7xx_partitions;
adm5120_gpiodev_resource.start &= ~CAS7XX_GPIO_DEV_MASK;
/* TODO: setup mac address */
}
@ -130,6 +138,8 @@ static void __init nfs_setup(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(cas6xx_partitions);
adm5120_flash0_data.parts = cas6xx_partitions;
adm5120_gpiodev_resource.start &= ~NFS_GPIO_DEV_MASK;
/* TODO: setup mac address */
}

View File

@ -22,6 +22,13 @@
#include <adm5120_platform.h>
#include <adm5120_irq.h>
#define NP27G_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
#define NP28G_GPIO_DEV_MASK ( 1 << ADM5120_GPIO_PIN5 \
| 1 << ADM5120_GPIO_PIN4)
#define WP54_GPIO_DEV_MASK ( 1 << ADM5120_GPIO_PIN5 \
| 1 << ADM5120_GPIO_PIN3)
static struct adm5120_pci_irq wp54_pci_irqs[] __initdata = {
PCIIRQ(2, 0, 1, ADM5120_IRQ_PCI0),
};
@ -104,6 +111,7 @@ static void __init np27g_setup(void)
/* setup data for flash0 device */
adm5120_flash0_data.switch_bank = switch_bank_gpio5;
adm5120_gpiodev_resource.start &= ~NP27G_GPIO_DEV_MASK;
/* TODO: setup mac address */
}
@ -119,6 +127,8 @@ static void __init np28g_setup(void)
/* setup data for flash0 device */
adm5120_flash0_data.switch_bank = switch_bank_gpio5;
adm5120_gpiodev_resource.start &= ~NP28G_GPIO_DEV_MASK;
/* TODO: setup mac address */
}
@ -137,6 +147,8 @@ static void __init wp54_setup(void)
adm5120_buttons[0].desc = "reset button";
adm5120_buttons[0].gpio = ADM5120_GPIO_PIN2;
adm5120_gpiodev_resource.start &= ~WP54_GPIO_DEV_MASK;
/* TODO: setup mac address */
}

View File

@ -24,6 +24,9 @@
#include <adm5120_platform.h>
#include <adm5120_info.h>
#define EASY_PQFP_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN3)
#define EASY_BGA_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
static void switch_bank_gpio3(unsigned bank)
{
switch (bank) {
@ -99,6 +102,8 @@ static void __init easy_setup_pqfp(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
adm5120_flash0_data.parts = easy_partitions;
adm5120_gpiodev_resource.start &= ~EASY_PQFP_GPIO_DEV_MASK;
/* TODO: setup mac addresses */
}
@ -112,6 +117,8 @@ static void __init easy_setup_bga(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
adm5120_flash0_data.parts = easy_partitions;
adm5120_gpiodev_resource.start &= ~EASY_BGA_GPIO_DEV_MASK;
/* TODO: setup mac addresses */
}

View File

@ -44,12 +44,20 @@
#define RB150_GPIO_NAND_NCE ADM5120_GPIO_PIN1
#define RB150_GPIO_NAND_CLE ADM5120_GPIO_P2L2
#define RB150_GPIO_NAND_ALE ADM5120_GPIO_P3L2
#define RB150_GPIO_DEV_MASK ( 1 << RB150_GPIO_NAND_READY \
| 1 << RB150_GPIO_NAND_NCE \
| 1 << RB150_GPIO_NAND_CLE \
| 1 << RB150_GPIO_NAND_ALE)
#define RB150_NAND_DELAY 100
#define RB150_NAND_WRITE(v) \
writeb((v), (void __iomem *)KSEG1ADDR(RB150_NAND_BASE))
#define RB153_GPIO_DEV_MASK ( 1 << ADM5120_GPIO_PIN0 \
| 1 << ADM5120_GPIO_PIN3 \
| 1 << ADM5120_GPIO_PIN4 )
/*--------------------------------------------------------------------------*/
static struct adm5120_pci_irq rb1xx_pci_irqs[] __initdata = {
@ -279,6 +287,8 @@ static void __init rb150_setup(void)
adm5120_buttons[0].desc = "reset button";
adm5120_buttons[0].gpio = ADM5120_GPIO_PIN1; /* FIXME: valid? */
adm5120_gpiodev_resource.start &= ~RB150_GPIO_DEV_MASK;
adm5120_flash0_data.window_size = 512*1024;
rb1xx_flash_setup();
@ -293,6 +303,8 @@ static void __init rb153_setup(void)
adm5120_gpio_ew_enable();
rb1xx_setup();
adm5120_gpiodev_resource.start &= ~RB153_GPIO_DEV_MASK;
}
/*--------------------------------------------------------------------------*/

View File

@ -22,6 +22,8 @@
#include <adm5120_platform.h>
#include <adm5120_irq.h>
#define P33X_GPIO_DEV_MASK (1 << ADM5120_GPIO_PIN5)
static void switch_bank_gpio5(unsigned bank)
{
switch (bank) {
@ -83,6 +85,7 @@ static void __init p33x_setup(void)
adm5120_flash0_data.nr_parts = ARRAY_SIZE(p33x_partitions);
adm5120_flash0_data.parts = p33x_partitions;
adm5120_gpiodev_resource.start &= ~P33X_GPIO_DEV_MASK;
/* TODO: setup mac address */
}

View File

@ -216,6 +216,18 @@ struct platform_device adm5120_buttons_device = {
.dev.platform_data = &adm5120_buttons_data,
};
/* GPIO char device */
struct resource adm5120_gpiodev_resource = {
.start = 0x3fffff,
};
struct platform_device adm5120_gpiodev_device = {
.name = "GPIODEV",
.id = -1,
.num_resources = 1,
.resource = &adm5120_gpiodev_resource,
};
void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base,
unsigned int mctrl)
{

View File

@ -64,6 +64,8 @@ static inline void adm5120_pci_set_irq_map(unsigned int nr_irqs,
#define ADM5120_NUM_BUTTONS 5
extern struct resource adm5120_gpiodev_resource;
extern struct adm5120_flash_platform_data adm5120_flash0_data;
extern struct adm5120_flash_platform_data adm5120_flash1_data;
extern struct platform_nand_data adm5120_nand_data;
@ -79,6 +81,7 @@ extern struct platform_device adm5120_nand_device;
extern struct platform_device adm5120_hcd_device;
extern struct platform_device adm5120_switch_device;
extern struct platform_device adm5120_buttons_device;
extern struct platform_device adm5120_gpiodev_device;
extern struct amba_device adm5120_uart0_device;
extern struct amba_device adm5120_uart1_device;