Skip to content

Commit

Permalink
gpio: For ARC EM Starterkit, a 4-port GPIO implementation is being added
Browse files Browse the repository at this point in the history
The file gpio_dw_registers.h already had the 4-port GPIO
registers defined, yet the gpio_dw.c implementation didn't
support it properly. There are 4 ports here, not 2, and only
PORTA can support interrupts and debounce.

On the em_starterkit board, for example, PORTA
has 3 bits for buttons: A, L and R. The other 3 ports should not
be used with interrupts & debounce.

I've re-worked this file to derive the port number from the
base address given. The lower 6 bits are divided by 12 to
derive the port number. From this, the registers EXT_PORTA,
EXT_PORTB, EXT_PORTC or EXT_PORTD can be read.

Also, for those ports that don't support interrupts,
set irq_num to 0, and that code will be avoided. I've verified
that I can access GPIO now correctly on the EM Starterkit. The
em_starterkit board support will be submitted soon but I'm
staging in this change first.

Change-Id: I98dbe083e03e046b40e07b4b14a99a39a6d0f0be
Signed-off-by: Chuck Jordan <[email protected]>
  • Loading branch information
cjordan44 authored and Anas Nashif committed May 26, 2016
1 parent 9ec2f3b commit c1e4bcf
Show file tree
Hide file tree
Showing 4 changed files with 335 additions and 44 deletions.
100 changes: 100 additions & 0 deletions drivers/gpio/Kconfig.dw
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,104 @@ config GPIO_DW_1_IRQ_PRI
help
IRQ priority

config GPIO_DW_2
bool "Designware GPIO block 1"
depends on GPIO_DW
default n
help
Include Designware GPIO driver

config GPIO_DW_2_NAME
string "Driver name"
depends on GPIO_DW_2
default "GPIO_2"

config GPIO_DW_2_CLOCK_GATE_SUBSYS
int "Clock controller's subsystem"
depends on GPIO_DW_CLOCK_GATE && GPIO_DW_2

choice
prompt "Port 1 Interrupts via"
default GPIO_DW_2_IRQ_DIRECT
depends on GPIO_DW_2

config GPIO_DW_2_IRQ_DIRECT
bool "Direct Hardware Interrupt"
help
When interrupts fire, the driver's ISR function is being called directly.

config GPIO_DW_2_IRQ_SHARED
bool "Shared IRQ"
depends on SHARED_IRQ
select GPIO_DW_SHARED_IRQ
help
When interrupts fire, the shared IRQ driver is notified. Then the shared IRQ
driver dispatches the interrupt to other drivers.

endchoice

config GPIO_DW_2_IRQ_SHARED_NAME
string "Device name for Shared IRQ"
depends on GPIO_DW_2_IRQ_SHARED
help
Specify the device name for the shared IRQ driver. It is used to register
this driver with the shared IRQ driver, so interrupts can be dispatched
correctly.

config GPIO_DW_2_IRQ_PRI
int "Controller interrupt priority"
depends on GPIO_DW_2 && GPIO_DW_2_IRQ_DIRECT
help
IRQ priority

config GPIO_DW_3
bool "Designware GPIO block 1"
depends on GPIO_DW
default n
help
Include Designware GPIO driver

config GPIO_DW_3_NAME
string "Driver name"
depends on GPIO_DW_3
default "GPIO_3"

config GPIO_DW_3_CLOCK_GATE_SUBSYS
int "Clock controller's subsystem"
depends on GPIO_DW_CLOCK_GATE && GPIO_DW_3

choice
prompt "Port 1 Interrupts via"
default GPIO_DW_3_IRQ_DIRECT
depends on GPIO_DW_3

config GPIO_DW_3_IRQ_DIRECT
bool "Direct Hardware Interrupt"
help
When interrupts fire, the driver's ISR function is being called directly.

config GPIO_DW_3_IRQ_SHARED
bool "Shared IRQ"
depends on SHARED_IRQ
select GPIO_DW_SHARED_IRQ
help
When interrupts fire, the shared IRQ driver is notified. Then the shared IRQ
driver dispatches the interrupt to other drivers.

endchoice

config GPIO_DW_3_IRQ_SHARED_NAME
string "Device name for Shared IRQ"
depends on GPIO_DW_3_IRQ_SHARED
help
Specify the device name for the shared IRQ driver. It is used to register
this driver with the shared IRQ driver, so interrupts can be dispatched
correctly.

config GPIO_DW_3_IRQ_PRI
int "Controller interrupt priority"
depends on GPIO_DW_3 && GPIO_DW_3_IRQ_DIRECT
help
IRQ priority

endif # GPIO_DW
Loading

0 comments on commit c1e4bcf

Please sign in to comment.