int amlogic_gpio_name_map_num(const char *name) { return gpio_amlogic_name_to_num(name); }
//#define gpio_dump //#define pull_dump //#define dire_dump static int amlogic_gpio_probe(struct platform_device *pdev) { #ifdef CONFIG_OF_GPIO amlogic_gpio_chip.of_node = pdev->dev.of_node; #endif amlogic_gpio_chip.base=0; amlogic_gpio_chip.ngpio=ARRAY_SIZE(amlogic_pins); gpiochip_add(&amlogic_gpio_chip); pullup_ops.meson_set_pullup=m8b_set_pullup; dev_info(&pdev->dev, "Probed amlogic GPIO driver\n"); #ifdef gpio_dump int gi; for(gi=0;gi<GPIO_MAX;gi++) printk("%s,amlogic_pins[%d]=%d,%d,out en reg=%x,bit=%d,out val reg=%x,bit=%d,input reg=%x,bit=%d\n", amlogic_pins[gi].name,gi,amlogic_pins[gi].num, gpio_amlogic_name_to_num(amlogic_pins[gi].name), (p_gpio_oen_addr[GPIO_REG(amlogic_pins[gi].out_en_reg_bit)]&0xffff)>>2, GPIO_BIT(amlogic_pins[gi].out_en_reg_bit), (p_gpio_output_addr[GPIO_REG(amlogic_pins[gi].out_value_reg_bit)]&0xffff)>>2, GPIO_BIT(amlogic_pins[gi].out_value_reg_bit), (p_gpio_input_addr[GPIO_REG(amlogic_pins[gi].input_value_reg_bit)]&0xffff)>>2, GPIO_BIT(amlogic_pins[gi].input_value_reg_bit) ); #endif #ifdef irq_dump for(i=GPIO_IRQ0;i<GPIO_IRQ7+1;i++){ gpio_flag=AML_GPIO_IRQ(i,FILTER_NUM7,GPIO_IRQ_HIGH); gpio_amlogic_to_irq(NULL,50); } for(i=GPIO_IRQ_HIGH;i<GPIO_IRQ_FALLING+1;i++){ gpio_flag=AML_GPIO_IRQ(GPIO_IRQ0,FILTER_NUM7,i); gpio_amlogic_to_irq(NULL,50); } #endif #ifdef pull_dump int preg,pbit,penbit,pi; for(pi=0;pi<GPIO_TEST_N;pi++){ m8b_pin_to_pullup(pi,&preg,&pbit,&penbit); printk("%s \t,pull up en reg:%x \t,enbit:%d \t,==,pull up reg:%x \t,bit:%d \t\n", amlogic_pins[pi].name, (p_pull_upen_addr[preg]&0xffff)>>2, penbit, (p_pull_up_addr[preg]&0xffff)>>2, pbit); } #endif #ifdef dire_dump extern int m8b_pin_map_to_direction(unsigned int pin,unsigned int *reg,unsigned int *bit); int dreg,dbit,di; for(di=0;di<GPIO_TEST_N;di++){ m8b_pin_map_to_direction(di,&dreg,&dbit); printk("%s \t,output en reg:%x \t,enbit:%d \t\n", amlogic_pins[di].name, (p_gpio_oen_addr[dreg]&0xffff)>>2, dbit); } #endif return 0; }