18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/* Include file for the EP93XX GPIO controller machine specifics */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __GPIO_EP93XX_H
58c2ecf20Sopenharmony_ci#define __GPIO_EP93XX_H
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <mach/ep93xx-regs.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define EP93XX_GPIO_PHYS_BASE		EP93XX_APB_PHYS(0x00040000)
108c2ecf20Sopenharmony_ci#define EP93XX_GPIO_BASE		EP93XX_APB_IOMEM(0x00040000)
118c2ecf20Sopenharmony_ci#define EP93XX_GPIO_REG(x)		(EP93XX_GPIO_BASE + (x))
128c2ecf20Sopenharmony_ci#define EP93XX_GPIO_F_INT_STATUS	EP93XX_GPIO_REG(0x5c)
138c2ecf20Sopenharmony_ci#define EP93XX_GPIO_A_INT_STATUS	EP93XX_GPIO_REG(0xa0)
148c2ecf20Sopenharmony_ci#define EP93XX_GPIO_B_INT_STATUS	EP93XX_GPIO_REG(0xbc)
158c2ecf20Sopenharmony_ci#define EP93XX_GPIO_EEDRIVE		EP93XX_GPIO_REG(0xc8)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* GPIO port A.  */
188c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_A(x)		((x) + 0)
198c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO0		EP93XX_GPIO_LINE_A(0)
208c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO1		EP93XX_GPIO_LINE_A(1)
218c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO2		EP93XX_GPIO_LINE_A(2)
228c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO3		EP93XX_GPIO_LINE_A(3)
238c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO4		EP93XX_GPIO_LINE_A(4)
248c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO5		EP93XX_GPIO_LINE_A(5)
258c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO6		EP93XX_GPIO_LINE_A(6)
268c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO7		EP93XX_GPIO_LINE_A(7)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* GPIO port B.  */
298c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_B(x)		((x) + 8)
308c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO8		EP93XX_GPIO_LINE_B(0)
318c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO9		EP93XX_GPIO_LINE_B(1)
328c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO10	EP93XX_GPIO_LINE_B(2)
338c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO11	EP93XX_GPIO_LINE_B(3)
348c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO12	EP93XX_GPIO_LINE_B(4)
358c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO13	EP93XX_GPIO_LINE_B(5)
368c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO14	EP93XX_GPIO_LINE_B(6)
378c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EGPIO15	EP93XX_GPIO_LINE_B(7)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* GPIO port C.  */
408c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_C(x)		((x) + 40)
418c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW0		EP93XX_GPIO_LINE_C(0)
428c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW1		EP93XX_GPIO_LINE_C(1)
438c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW2		EP93XX_GPIO_LINE_C(2)
448c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW3		EP93XX_GPIO_LINE_C(3)
458c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW4		EP93XX_GPIO_LINE_C(4)
468c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW5		EP93XX_GPIO_LINE_C(5)
478c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW6		EP93XX_GPIO_LINE_C(6)
488c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_ROW7		EP93XX_GPIO_LINE_C(7)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* GPIO port D.  */
518c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_D(x)		((x) + 24)
528c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL0		EP93XX_GPIO_LINE_D(0)
538c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL1		EP93XX_GPIO_LINE_D(1)
548c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL2		EP93XX_GPIO_LINE_D(2)
558c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL3		EP93XX_GPIO_LINE_D(3)
568c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL4		EP93XX_GPIO_LINE_D(4)
578c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL5		EP93XX_GPIO_LINE_D(5)
588c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL6		EP93XX_GPIO_LINE_D(6)
598c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_COL7		EP93XX_GPIO_LINE_D(7)
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci/* GPIO port E.  */
628c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_E(x)		((x) + 32)
638c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_GRLED		EP93XX_GPIO_LINE_E(0)
648c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_RDLED		EP93XX_GPIO_LINE_E(1)
658c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DIORn		EP93XX_GPIO_LINE_E(2)
668c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_IDECS1n	EP93XX_GPIO_LINE_E(3)
678c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_IDECS2n	EP93XX_GPIO_LINE_E(4)
688c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_IDEDA0		EP93XX_GPIO_LINE_E(5)
698c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_IDEDA1		EP93XX_GPIO_LINE_E(6)
708c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_IDEDA2		EP93XX_GPIO_LINE_E(7)
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/* GPIO port F.  */
738c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_F(x)		((x) + 16)
748c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_WP		EP93XX_GPIO_LINE_F(0)
758c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MCCD1		EP93XX_GPIO_LINE_F(1)
768c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MCCD2		EP93XX_GPIO_LINE_F(2)
778c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MCBVD1		EP93XX_GPIO_LINE_F(3)
788c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MCBVD2		EP93XX_GPIO_LINE_F(4)
798c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_VS1		EP93XX_GPIO_LINE_F(5)
808c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_READY		EP93XX_GPIO_LINE_F(6)
818c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_VS2		EP93XX_GPIO_LINE_F(7)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* GPIO port G.  */
848c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_G(x)		((x) + 48)
858c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EECLK		EP93XX_GPIO_LINE_G(0)
868c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_EEDAT		EP93XX_GPIO_LINE_G(1)
878c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_SLA0		EP93XX_GPIO_LINE_G(2)
888c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_SLA1		EP93XX_GPIO_LINE_G(3)
898c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD12		EP93XX_GPIO_LINE_G(4)
908c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD13		EP93XX_GPIO_LINE_G(5)
918c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD14		EP93XX_GPIO_LINE_G(6)
928c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD15		EP93XX_GPIO_LINE_G(7)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* GPIO port H.  */
958c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_H(x)		((x) + 56)
968c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD0		EP93XX_GPIO_LINE_H(0)
978c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD1		EP93XX_GPIO_LINE_H(1)
988c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD2		EP93XX_GPIO_LINE_H(2)
998c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD3		EP93XX_GPIO_LINE_H(3)
1008c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD4		EP93XX_GPIO_LINE_H(4)
1018c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD5		EP93XX_GPIO_LINE_H(5)
1028c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD6		EP93XX_GPIO_LINE_H(6)
1038c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_DD7		EP93XX_GPIO_LINE_H(7)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/* maximum value for gpio line identifiers */
1068c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MAX		EP93XX_GPIO_LINE_H(7)
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* maximum value for irq capable line identifiers */
1098c2ecf20Sopenharmony_ci#define EP93XX_GPIO_LINE_MAX_IRQ	EP93XX_GPIO_LINE_F(7)
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci#endif /* __GPIO_EP93XX_H */
112