blob: 7da0060cd49af5963f03dfe966db1e576810136b [file] [log] [blame]
Sandeep Paulraj00e16652009-09-29 10:02:38 -04001/*
2 * Copyright (C) 2009 Texas Instruments Incorporated
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Sandeep Paulraj00e16652009-09-29 10:02:38 -04005 */
6#ifndef _GPIO_DEFS_H_
7#define _GPIO_DEFS_H_
8
Ajay Kumar Gupta0b232312009-12-22 10:56:12 +05309#ifndef CONFIG_SOC_DA8XX
Sandeep Paulraj00e16652009-09-29 10:02:38 -040010#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 Gupta0b232312009-12-22 10:56:12 +053016#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 Schocher198a7fc2011-09-14 19:59:35 +000022#define DAVINCI_GPIO_BANK8 0x01E260B0
Ajay Kumar Gupta0b232312009-12-22 10:56:12 +053023#endif /* CONFIG_SOC_DA8XX */
24
Sandeep Paulraj00e16652009-09-29 10:02:38 -040025struct 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
38struct 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 Gupta0b232312009-12-22 10:56:12 +053046#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 Schocher198a7fc2011-09-14 19:59:35 +000050#define davinci_gpio_bank8 ((struct davinci_gpio *)DAVINCI_GPIO_BANK8)
Ajay Kumar Gupta0b232312009-12-22 10:56:12 +053051
Laurence Withersf517afd2011-07-18 09:26:01 -040052#define gpio_status() gpio_info()
53#define GPIO_NAME_SIZE 20
Holger Hans Peter Freyther03414ac2013-02-07 23:41:01 +000054#if defined(CONFIG_SOC_DM644X)
55/* GPIO0 to GPIO53, omit the V3.3 volts one */
56#define MAX_NUM_GPIOS 70
Tom Rini76b40ab2013-03-11 12:02:40 -040057#elif defined(CONFIG_SOC_DA8XX) && !defined(CONFIG_SOC_DA850)
Tomas Novotnyb9f56692013-02-01 06:46:00 +000058#define MAX_NUM_GPIOS 128
59#else
Laurence Withersf517afd2011-07-18 09:26:01 -040060#define MAX_NUM_GPIOS 144
Tomas Novotnyb9f56692013-02-01 06:46:00 +000061#endif
Laurence Withersf517afd2011-07-18 09:26:01 -040062#define GPIO_BANK(gp) (davinci_gpio_bank01 + ((gp) >> 5))
63#define GPIO_BIT(gp) ((gp) & 0x1F)
64
65void gpio_info(void);
66
Sandeep Paulraj00e16652009-09-29 10:02:38 -040067#endif