iPXE
dwgpio.h
Go to the documentation of this file.
1#ifndef _DWGPIO_H
2#define _DWGPIO_H
3
4/** @file
5 *
6 * Synopsys DesignWare GPIO driver
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12/** Maximum number of GPIOs per port */
13#define DWGPIO_MAX_COUNT 32
14
15/** Software port
16 *
17 * This is the register bank containing the DR, DDR, and CTL bits.
18 */
19#define DWGPIO_SWPORT( x ) ( 0x00 + ( (x) * 0x0c ) )
20
21/** Data register
22 *
23 * Bits written to this register are output if the corresponding DDR
24 * bit is set to 1 (output) and the corresponding CTL bit is set to 0
25 * (software control).
26 *
27 * Bits read from this register reflect the most recently written
28 * value, and do not reflect the actual status of the GPIO pin.
29 */
30#define DWGPIO_SWPORT_DR 0x00
31
32/** Data direction register
33 *
34 * The GPIO is an output if the corresponding bit in this register is
35 * set to 1.
36 */
37#define DWGPIO_SWPORT_DDR 0x04
38
39/** Control register
40 *
41 * The GPIO is under software control (i.e. is functioning as a GPIO,
42 * rather than being controlled by a separate functional block) if the
43 * corresponding bit in this register is set to 0.
44 */
45#define DWGPIO_SWPORT_CTL 0x08
46
47/** External port
48 *
49 * Bits read from this register reflect the current status of the GPIO
50 * pin.
51 */
52#define DWGPIO_EXT_PORT( x ) ( 0x50 + ( (x) * 0x04 ) )
53
54/** A DesignWare GPIO port group */
56 /** Registers */
57 void *regs;
58};
59
60/** A DesignWare GPIO port */
61struct dwgpio {
62 /** Device name */
63 const char *name;
64 /** Port index */
65 unsigned int port;
66 /** Software port registers */
67 void *swport;
68 /** External port register */
69 void *ext;
70
71 /** Original data register value */
73 /** Original data direction register value */
75 /** Original control register value */
77};
78
79#endif /* _DWGPIO_H */
unsigned int uint32_t
Definition stdint.h:12
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
A DesignWare GPIO port group.
Definition dwgpio.h:55
void * regs
Registers.
Definition dwgpio.h:57
A DesignWare GPIO port.
Definition dwgpio.h:61
unsigned int port
Port index.
Definition dwgpio.h:65
void * ext
External port register.
Definition dwgpio.h:69
uint32_t ctl
Original control register value.
Definition dwgpio.h:76
const char * name
Device name.
Definition dwgpio.h:63
void * swport
Software port registers.
Definition dwgpio.h:67
uint32_t ddr
Original data direction register value.
Definition dwgpio.h:74
uint32_t dr
Original data register value.
Definition dwgpio.h:72