Sandeep Paulraj | 7f507e8 | 2009-09-29 10:02:38 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Texas Instruments Incorporated |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Sandeep Paulraj | 7f507e8 | 2009-09-29 10:02:38 -0400 | [diff] [blame] | 5 | */ |
| 6 | #ifndef _GPIO_DEFS_H_ |
| 7 | #define _GPIO_DEFS_H_ |
| 8 | |
Ajay Kumar Gupta | bae61dd | 2009-12-22 10:56:12 +0530 | [diff] [blame] | 9 | #ifndef CONFIG_SOC_DA8XX |
Sandeep Paulraj | 7f507e8 | 2009-09-29 10:02:38 -0400 | [diff] [blame] | 10 | #define DAVINCI_GPIO_BINTEN 0x01C67008 |
| 11 | #define DAVINCI_GPIO_BANK01 0x01C67010 |
| 12 | #define DAVINCI_GPIO_BANK23 0x01C67038 |
| 13 | #define DAVINCI_GPIO_BANK45 0x01C67060 |
| 14 | #define DAVINCI_GPIO_BANK67 0x01C67088 |
| 15 | |
Ajay Kumar Gupta | bae61dd | 2009-12-22 10:56:12 +0530 | [diff] [blame] | 16 | #else /* CONFIG_SOC_DA8XX */ |
| 17 | #define DAVINCI_GPIO_BINTEN 0x01E26008 |
| 18 | #define DAVINCI_GPIO_BANK01 0x01E26010 |
| 19 | #define DAVINCI_GPIO_BANK23 0x01E26038 |
| 20 | #define DAVINCI_GPIO_BANK45 0x01E26060 |
| 21 | #define DAVINCI_GPIO_BANK67 0x01E26088 |
Heiko Schocher | 8d510c5 | 2011-09-14 19:59:35 +0000 | [diff] [blame] | 22 | #define DAVINCI_GPIO_BANK8 0x01E260B0 |
Ajay Kumar Gupta | bae61dd | 2009-12-22 10:56:12 +0530 | [diff] [blame] | 23 | #endif /* CONFIG_SOC_DA8XX */ |
| 24 | |
Sandeep Paulraj | 7f507e8 | 2009-09-29 10:02:38 -0400 | [diff] [blame] | 25 | struct davinci_gpio { |
| 26 | unsigned int dir; |
| 27 | unsigned int out_data; |
| 28 | unsigned int set_data; |
| 29 | unsigned int clr_data; |
| 30 | unsigned int in_data; |
| 31 | unsigned int set_rising; |
| 32 | unsigned int clr_rising; |
| 33 | unsigned int set_falling; |
| 34 | unsigned int clr_falling; |
| 35 | unsigned int intstat; |
| 36 | }; |
| 37 | |
| 38 | struct davinci_gpio_bank { |
| 39 | int num_gpio; |
| 40 | unsigned int irq_num; |
| 41 | unsigned int irq_mask; |
| 42 | unsigned long *in_use; |
| 43 | unsigned long base; |
| 44 | }; |
| 45 | |
Ajay Kumar Gupta | bae61dd | 2009-12-22 10:56:12 +0530 | [diff] [blame] | 46 | #define davinci_gpio_bank01 ((struct davinci_gpio *)DAVINCI_GPIO_BANK01) |
| 47 | #define davinci_gpio_bank23 ((struct davinci_gpio *)DAVINCI_GPIO_BANK23) |
| 48 | #define davinci_gpio_bank45 ((struct davinci_gpio *)DAVINCI_GPIO_BANK45) |
| 49 | #define davinci_gpio_bank67 ((struct davinci_gpio *)DAVINCI_GPIO_BANK67) |
Heiko Schocher | 8d510c5 | 2011-09-14 19:59:35 +0000 | [diff] [blame] | 50 | #define davinci_gpio_bank8 ((struct davinci_gpio *)DAVINCI_GPIO_BANK8) |
Ajay Kumar Gupta | bae61dd | 2009-12-22 10:56:12 +0530 | [diff] [blame] | 51 | |
Laurence Withers | 3ffd968 | 2011-07-18 09:26:01 -0400 | [diff] [blame] | 52 | #define gpio_status() gpio_info() |
| 53 | #define GPIO_NAME_SIZE 20 |
Holger Hans Peter Freyther | 1356f8e | 2013-02-07 23:41:01 +0000 | [diff] [blame] | 54 | #if defined(CONFIG_SOC_DM644X) |
| 55 | /* GPIO0 to GPIO53, omit the V3.3 volts one */ |
| 56 | #define MAX_NUM_GPIOS 70 |
Tom Rini | 9dbc836 | 2013-03-11 12:02:40 -0400 | [diff] [blame] | 57 | #elif defined(CONFIG_SOC_DA8XX) && !defined(CONFIG_SOC_DA850) |
Tomas Novotny | 5903287 | 2013-02-01 06:46:00 +0000 | [diff] [blame] | 58 | #define MAX_NUM_GPIOS 128 |
| 59 | #else |
Laurence Withers | 3ffd968 | 2011-07-18 09:26:01 -0400 | [diff] [blame] | 60 | #define MAX_NUM_GPIOS 144 |
Tomas Novotny | 5903287 | 2013-02-01 06:46:00 +0000 | [diff] [blame] | 61 | #endif |
Laurence Withers | 3ffd968 | 2011-07-18 09:26:01 -0400 | [diff] [blame] | 62 | #define GPIO_BANK(gp) (davinci_gpio_bank01 + ((gp) >> 5)) |
| 63 | #define GPIO_BIT(gp) ((gp) & 0x1F) |
| 64 | |
| 65 | void gpio_info(void); |
| 66 | |
Sandeep Paulraj | 7f507e8 | 2009-09-29 10:02:38 -0400 | [diff] [blame] | 67 | #endif |