Changeset 18278


Ignore:
Timestamp:
01/22/12 19:18:09 (17 months ago)
Author:
BrainSlayer
Message:

gpio stp interface for lantiq and usb led func

Location:
src/linux/universal/linux-3.2
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-3.2/arch/mips/lantiq/Makefile

    r18232 r18278  
    55# by the Free Software Foundation. 
    66 
    7 obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o proc_lantiqgpio.o 
     7obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o proc_lantiqgpio.o proc_lantiqgpiostp.o 
    88 
    99obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 
  • src/linux/universal/linux-3.2/arch/mips/lantiq/proc_lantiqgpio.c

    r18233 r18278  
    5757{ 
    5858        void __iomem *membase = (void *)KSEG1ADDR(LQ_GPIO0_BASE_ADDR); 
    59                  
     59 
    6060        if (pin >= PINS_PER_PORT) { 
    6161                pin -= PINS_PER_PORT; 
     
    134134        return lq_gpio_getbit(membase, LQ_GPIO_OUT, pin); 
    135135} 
     136 
    136137static void set_dir(int pin, int dir) 
    137138{ 
     
    149150                membase += LQ_GPIO_SIZE; 
    150151        } 
    151 if (dir) 
    152 { 
    153         lq_gpio_setbit(membase, LQ_GPIO_OD, pin); 
    154         lq_gpio_setbit(membase, LQ_GPIO_DIR, pin); 
    155 } 
    156 else 
    157 { 
    158         lq_gpio_clearbit(membase, LQ_GPIO_OD, pin); 
    159         lq_gpio_clearbit(membase, LQ_GPIO_DIR, pin); 
    160 } 
    161  
    162 } 
    163  
    164 void set_gpio(int pin,int val) 
    165 { 
    166         if (pin>=200) 
    167         { 
    168                 ltq_stp_set(NULL,pin-200,val); 
     152        if (dir) { 
     153                lq_gpio_setbit(membase, LQ_GPIO_OD, pin); 
     154                lq_gpio_setbit(membase, LQ_GPIO_DIR, pin); 
     155        } else { 
     156                lq_gpio_clearbit(membase, LQ_GPIO_OD, pin); 
     157                lq_gpio_clearbit(membase, LQ_GPIO_DIR, pin); 
     158        } 
     159 
     160} 
     161 
     162 
     163void set_gpio(int pin, int val) 
     164{ 
     165        if (pin >= 200) { 
     166                ltq_stp_set(NULL, pin - 200, val); 
    169167                return; 
    170168        } 
    171 set_dir(pin,1); 
    172 set_gpio_out(pin,val); 
    173 } 
     169        set_dir(pin, 1); 
     170        set_gpio_out(pin, val); 
     171} 
     172 
    174173EXPORT_SYMBOL(set_gpio); 
    175174 
     175int usb_led_pin = -1; 
     176 
     177void ap_usb_led_on(void) 
     178{ 
     179        if (usb_led_pin >= 0) 
     180                set_gpio(usb_led_pin, usb_led_pin & 0xf00 ? 0 : 1); 
     181} 
     182 
     183EXPORT_SYMBOL(ap_usb_led_on); 
     184 
     185void ap_usb_led_off(void) 
     186{ 
     187        if (usb_led_pin >= 0) 
     188                set_gpio(usb_led_pin, usb_led_pin & 0xf00 ? 1 : 0); 
     189} 
     190 
     191EXPORT_SYMBOL(ap_usb_led_off); 
    176192 
    177193static int get_dir(int pin) 
    178194{ 
    179195        void __iomem *membase = (void *)KSEG1ADDR(LQ_GPIO0_BASE_ADDR); 
    180         int val=0; 
    181         if (pin >= PINS_PER_PORT) { 
    182                 pin -= PINS_PER_PORT; 
    183                 membase += LQ_GPIO_SIZE; 
    184         } 
    185         if (pin >= PINS_PER_PORT) { 
    186                 pin -= PINS_PER_PORT; 
    187                 membase += LQ_GPIO_SIZE; 
    188         } 
    189         if (pin >= PINS_PER_PORT) { 
    190                 pin -= PINS_PER_PORT; 
    191                 membase += LQ_GPIO_SIZE; 
    192  
    193         } 
    194  
    195 val|=lq_gpio_getbit(membase, LQ_GPIO_IN, pin); 
    196 val|=lq_gpio_getbit(membase, LQ_GPIO_OD, pin); 
    197 return val; 
     196        int val = 0; 
     197        if (pin >= PINS_PER_PORT) { 
     198                pin -= PINS_PER_PORT; 
     199                membase += LQ_GPIO_SIZE; 
     200        } 
     201        if (pin >= PINS_PER_PORT) { 
     202                pin -= PINS_PER_PORT; 
     203                membase += LQ_GPIO_SIZE; 
     204        } 
     205        if (pin >= PINS_PER_PORT) { 
     206                pin -= PINS_PER_PORT; 
     207                membase += LQ_GPIO_SIZE; 
     208 
     209        } 
     210 
     211        val |= lq_gpio_getbit(membase, LQ_GPIO_IN, pin); 
     212        val |= lq_gpio_getbit(membase, LQ_GPIO_OD, pin); 
     213        return val; 
    198214 
    199215} 
     
    217233        u32 reg = 0; 
    218234        if ((unsigned int)data & GPIO_IN) { 
    219             reg = get_gpio_in(((unsigned int)data)&PIN_MASK); 
     235                reg = get_gpio_in(((unsigned int)data) & PIN_MASK); 
    220236        } 
    221237        if ((unsigned int)data & GPIO_OUT) { 
    222             reg = get_gpio_out(((unsigned int)data)&PIN_MASK); 
     238                reg = get_gpio_out(((unsigned int)data) & PIN_MASK); 
    223239        } 
    224240        if ((unsigned int)data & GPIO_DIR) { 
    225             reg = get_dir(((unsigned int)data)&PIN_MASK); 
     241                reg = get_dir(((unsigned int)data) & PIN_MASK); 
    226242        } 
    227243 
     
    262278 
    263279        if ((unsigned int)data & GPIO_IN) { 
    264                 set_gpio_in(((unsigned int)data)&PIN_MASK, reg); 
     280                set_gpio_in(((unsigned int)data) & PIN_MASK, reg); 
    265281        } 
    266282        if ((unsigned int)data & GPIO_OUT) { 
    267                 set_gpio_out(((unsigned int)data)&PIN_MASK, reg); 
     283                set_gpio_out(((unsigned int)data) & PIN_MASK, reg); 
    268284        } 
    269285        if ((unsigned int)data & GPIO_DIR) { 
    270                 set_dir(((unsigned int)data)&PIN_MASK, reg); 
    271         } 
    272  
     286                set_dir(((unsigned int)data) & PIN_MASK, reg); 
     287        } 
    273288 
    274289        return procfs_buffer_size; 
  • src/linux/universal/linux-3.2/arch/mips/lantiq/xway/mach-gigasx76x.c

    r18236 r18278  
    5858        }, 
    5959}; 
    60  
     60extern int usb_led_pin; 
    6161static struct gpio_led 
    6262gigasx76x_gpio_leds[] __initdata = { 
     
    231231#define GIGASX76X_USB           29 
    232232#define GIGASX76X_MADWIFI_ADDR  0xb07f0000 
     233        usb_led_pin = 218; 
    233234        ltq_register_gpio_stp(); 
    234235        ltq_register_nor(&gigasx76x_flash_data); 
  • src/linux/universal/linux-3.2/arch/mips/lantiq/xway/mach-wbmr.c

    r18225 r18278  
    5555}; 
    5656 
     57extern int usb_led_pin; 
    5758static struct gpio_led 
    5859wbmr_gpio_leds[] __initdata = { 
     
    104105{ 
    105106#define WMBR_BRN_MAC                    0x1fd0024 
     107        usb_led_pin = 28|0xf00; 
    106108 
    107109        ltq_add_device_gpio_leds(-1, ARRAY_SIZE(wbmr_gpio_leds), wbmr_gpio_leds); 
  • src/linux/universal/linux-3.2/drivers/usb/core/hub.c

    r18224 r18278  
    12931293        hdev = interface_to_usbdev(intf); 
    12941294 
    1295 #if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) 
     1295#if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) || defined(CONFIG_LANTIQ) 
    12961296        ap_usb_led_off(); 
    12971297#endif 
     
    16581658                        udev->devnum); 
    16591659 
    1660 #if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) 
     1660#if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) || defined(CONFIG_LANTIQ) 
    16611661        /* Turn USB LED off only if its a last device attached to root hub */ 
    16621662        if(udev->parent == udev->bus->root_hub) 
     
    28982898 
    28992899        retval = -ENODEV; 
    2900 #if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) 
     2900#if defined(CONFIG_MACH_AR7100) || defined(CONFIG_MACH_AR7240) || defined(CONFIG_LANTIQ) 
    29012901        ap_usb_led_on(); 
    29022902#endif 
  • src/linux/universal/linux-3.2/drivers/usb/dwc_otg/dwc_otg_hcd.c

    r18224 r18278  
    15871587} 
    15881588#endif /* DWC_HS_ELECT_TST */ 
     1589 
     1590 
    15891591 
    15901592/** Handles hub class-specific requests.*/ 
Note: See TracChangeset for help on using the changeset viewer.