1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2012
4 * Philippe Reynes <tremyfr@yahoo.fr>
5 */
6
7
8#ifndef __ASM_ARCH_MX27_GPIO_H
9#define __ASM_ARCH_MX27_GPIO_H
10
11/* GPIO registers */
12struct gpio_regs {
13	u32 gpio_dir; /* DDIR */
14	u32 ocr1;
15	u32 ocr2;
16	u32 iconfa1;
17	u32 iconfa2;
18	u32 iconfb1;
19	u32 iconfb2;
20	u32 gpio_dr; /* DR */
21	u32 gius;
22	u32 gpio_psr; /* SSR */
23	u32 icr1;
24	u32 icr2;
25	u32 imr;
26	u32 isr;
27	u32 gpr;
28	u32 swr;
29	u32 puen;
30	u32 res[0x2f];
31};
32
33/* This structure is used by the function imx_gpio_mode */
34struct gpio_port_regs {
35	struct gpio_regs port[6];
36};
37
38/*
39 *  GPIO Module and I/O Multiplexer
40 */
41#define PORTA 0
42#define PORTB 1
43#define PORTC 2
44#define PORTD 3
45#define PORTE 4
46#define PORTF 5
47
48#define GPIO_PIN_MASK		0x1f
49#define GPIO_PORT_SHIFT		5
50#define GPIO_PORT_MASK		(0x7 << GPIO_PORT_SHIFT)
51#define GPIO_PORTA		(PORTA << GPIO_PORT_SHIFT)
52#define GPIO_PORTB		(PORTB << GPIO_PORT_SHIFT)
53#define GPIO_PORTC		(PORTC << GPIO_PORT_SHIFT)
54#define GPIO_PORTD		(PORTD << GPIO_PORT_SHIFT)
55#define GPIO_PORTE		(PORTE << GPIO_PORT_SHIFT)
56#define GPIO_PORTF		(PORTF << GPIO_PORT_SHIFT)
57
58#endif
59