Changeset 11402


Ignore:
Timestamp:
2008-06-08T08:37:31+02:00 (8 years ago)
Author:
juhosg
Message:

[adm5120] add button devices to several boards

Location:
trunk/target/linux/adm5120/files
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/adm5120/files/arch/mips/adm5120/boards/compex.c

    r10305 r11402  
    44 *  Compex boards 
    55 * 
    6  *  Copyright (C) 2007 OpenWrt.org 
    7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> 
     6 *  Copyright (C) 2007-2008 OpenWrt.org 
     7 *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org> 
    88 * 
    99 *  This program is free software; you can redistribute it and/or modify it 
     
    5858static struct platform_device *wp54_devices[] __initdata = { 
    5959        &adm5120_flash0_device, 
     60        &adm5120_buttons_device, 
    6061}; 
    6162 
     
    133134        adm5120_flash0_data.switch_bank = switch_bank_gpio5; 
    134135 
     136        adm5120_buttons_data.nbuttons = 1; 
     137        adm5120_buttons[0].desc = "reset button"; 
     138        adm5120_buttons[0].gpio = ADM5120_GPIO_PIN2; 
     139 
    135140        /* TODO: setup mac address */ 
    136141} 
     
    138143static void __init wp54_wrt_setup(void) 
    139144{ 
    140         gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */ 
    141         gpio_direction_output(ADM5120_GPIO_PIN5, 0); 
    142  
    143         gpio_request(ADM5120_GPIO_PIN3, NULL); /* for system reset */ 
    144         gpio_direction_output(ADM5120_GPIO_PIN3, 1); 
    145  
    146         /* setup data for flash0 device */ 
    147         adm5120_flash0_data.switch_bank = switch_bank_gpio5; 
     145        wp54_setup(); 
     146 
    148147        adm5120_flash0_data.nr_parts = ARRAY_SIZE(wp54g_wrt_partitions); 
    149148        adm5120_flash0_data.parts = wp54g_wrt_partitions; 
  • trunk/target/linux/adm5120/files/arch/mips/adm5120/boards/edimax.c

    r10305 r11402  
    44 *  Edimax boards 
    55 * 
    6  *  Copyright (C) 2007 OpenWrt.org 
    7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> 
     6 *  Copyright (C) 2007-2008 OpenWrt.org 
     7 *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org> 
    88 * 
    99 *  This program is free software; you can redistribute it and/or modify it 
     
    4747        &adm5120_flash0_device, 
    4848        &adm5120_hcd_device, 
     49        &adm5120_buttons_device, 
    4950}; 
    5051 
     
    5758        adm5120_flash0_data.nr_parts = ARRAY_SIZE(br61xx_partitions); 
    5859        adm5120_flash0_data.parts = br61xx_partitions; 
     60 
     61        adm5120_buttons_data.nbuttons = 1; 
     62        adm5120_buttons[0].desc = "reset button"; 
     63        adm5120_buttons[0].gpio = ADM5120_GPIO_PIN2; 
    5964 
    6065        /* TODO: setup mac addresses, if possible */ 
  • trunk/target/linux/adm5120/files/arch/mips/adm5120/boards/mikrotik.c

    r11376 r11402  
    44 *  Mikrotik RouterBOARD 1xx series 
    55 * 
    6  *  Copyright (C) 2007 OpenWrt.org 
    7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> 
     6 *  Copyright (C) 2007-2008 OpenWrt.org 
     7 *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org> 
    88 * 
    99 *  NAND initialization code was based on a driver for Linux 2.6.19+ which 
     
    249249        adm5120_nand_set_wpn(0); 
    250250 
     251        adm5120_buttons_data.nbuttons = 1; 
     252        adm5120_buttons[0].desc = "reset button"; 
     253        adm5120_buttons[0].gpio = ADM5120_GPIO_PIN7; 
     254 
    251255        rb1xx_flash_setup(); 
    252256        rb1xx_mac_setup(); 
     
    270274        adm5120_nand_data.ctrl.dev_ready = rb150_nand_ready; 
    271275 
     276        adm5120_buttons_data.nbuttons = 1; 
     277        adm5120_buttons[0].desc = "reset button"; 
     278        adm5120_buttons[0].gpio = ADM5120_GPIO_PIN1; 
     279 
    272280        adm5120_flash0_data.window_size = 512*1024; 
    273281 
  • trunk/target/linux/adm5120/files/arch/mips/adm5120/platform.c

    r10313 r11402  
    44 *  Generic ADM5120 platform devices 
    55 * 
    6  *  Copyright (C) 2007 OpenWrt.org 
    7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> 
     6 *  Copyright (C) 2007-2008 OpenWrt.org 
     7 *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org> 
    88 * 
    99 *  This program is free software; you can redistribute it and/or modify it 
     
    178178}; 
    179179 
     180#define ADM5120_BUTTON_THRESHOLD        5 
     181#define ADM5120_BUTTON_INTERVAL         20 
     182 
     183struct gpio_button adm5120_buttons[ADM5120_NUM_BUTTONS] = { 
     184        { 
     185                .type           = EV_KEY, 
     186                .code           = BTN_0, 
     187                .threshold      = ADM5120_BUTTON_THRESHOLD, 
     188        }, { 
     189                .type           = EV_KEY, 
     190                .code           = BTN_1, 
     191                .threshold      = ADM5120_BUTTON_THRESHOLD, 
     192        }, { 
     193                .type           = EV_KEY, 
     194                .code           = BTN_2, 
     195                .threshold      = ADM5120_BUTTON_THRESHOLD, 
     196        }, { 
     197                .type           = EV_KEY, 
     198                .code           = BTN_3, 
     199                .threshold      = ADM5120_BUTTON_THRESHOLD, 
     200        }, { 
     201                .type           = EV_KEY, 
     202                .code           = BTN_4, 
     203                .threshold      = ADM5120_BUTTON_THRESHOLD, 
     204        } 
     205}; 
     206 
     207struct gpio_buttons_platform_data adm5120_buttons_data = { 
     208        .poll_interval  = ADM5120_BUTTON_INTERVAL, 
     209        .nbuttons       = ARRAY_SIZE(adm5120_buttons), 
     210        .buttons        = adm5120_buttons, 
     211}; 
     212 
     213struct platform_device adm5120_buttons_device = { 
     214        .name           = "gpio-buttons", 
     215        .id             = 0, 
     216        .dev.platform_data = &adm5120_buttons_data, 
     217}; 
     218 
    180219void adm5120_uart_set_mctrl(struct amba_device *dev, void __iomem *base, 
    181220                unsigned int mctrl) 
  • trunk/target/linux/adm5120/files/include/asm-mips/mach-adm5120/adm5120_platform.h

    r10327 r11402  
    44 *  ADM5120 specific platform definitions 
    55 * 
    6  *  Copyright (C) 2007 OpenWrt.org 
    7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org> 
     6 *  Copyright (C) 2007-2008 OpenWrt.org 
     7 *  Copyright (C) 2007-2008 Gabor Juhos <juhosg at openwrt.org> 
    88 * 
    99 *  This program is free software; you can redistribute it and/or modify it 
     
    2323#include <linux/mtd/partitions.h> 
    2424#include <linux/mtd/nand.h> 
     25 
     26#include <linux/input.h> 
     27#include <linux/gpio_buttons.h> 
    2528 
    2629#include <linux/amba/bus.h> 
     
    6063#endif 
    6164 
     65#define ADM5120_NUM_BUTTONS     4 
     66 
    6267extern struct adm5120_flash_platform_data adm5120_flash0_data; 
    6368extern struct adm5120_flash_platform_data adm5120_flash1_data; 
    6469extern struct platform_nand_data adm5120_nand_data; 
    6570extern struct adm5120_switch_platform_data adm5120_switch_data; 
     71extern struct gpio_button adm5120_buttons[ADM5120_NUM_BUTTONS]; 
     72extern struct gpio_buttons_platform_data adm5120_buttons_data; 
    6673extern struct amba_pl010_data adm5120_uart0_data; 
    6774extern struct amba_pl010_data adm5120_uart1_data; 
     
    7279extern struct platform_device adm5120_hcd_device; 
    7380extern struct platform_device adm5120_switch_device; 
     81extern struct platform_device adm5120_buttons_device; 
    7482extern struct amba_device adm5120_uart0_device; 
    7583extern struct amba_device adm5120_uart1_device; 
Note: See TracChangeset for help on using the changeset viewer.