xref: /kernel/linux/linux-6.6/arch/arm/mach-dove/mpp.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef __ARCH_DOVE_MPP_CODED_H
362306a36Sopenharmony_ci#define __ARCH_DOVE_MPP_CODED_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#define MPP(_num, _sel, _in, _out) ( \
662306a36Sopenharmony_ci	/* MPP number */		((_num) & 0xff) | \
762306a36Sopenharmony_ci	/* MPP select value */		(((_sel) & 0xf) << 8) | \
862306a36Sopenharmony_ci	/* may be input signal */	((!!(_in)) << 12) | \
962306a36Sopenharmony_ci	/* may be output signal */	((!!(_out)) << 13))
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define MPP0_GPIO0		MPP(0, 0x0, 1, 1)
1262306a36Sopenharmony_ci#define MPP0_UA2_RTSn		MPP(0, 0x2, 0, 0)
1362306a36Sopenharmony_ci#define MPP0_SDIO0_CD		MPP(0, 0x3, 0, 0)
1462306a36Sopenharmony_ci#define MPP0_LCD0_PWM		MPP(0, 0xf, 0, 0)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define MPP1_GPIO1		MPP(1, 0x0, 1, 1)
1762306a36Sopenharmony_ci#define MPP1_UA2_CTSn		MPP(1, 0x2, 0, 0)
1862306a36Sopenharmony_ci#define MPP1_SDIO0_WP		MPP(1, 0x3, 0, 0)
1962306a36Sopenharmony_ci#define MPP1_LCD1_PWM		MPP(1, 0xf, 0, 0)
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define MPP2_GPIO2		MPP(2, 0x0, 1, 1)
2262306a36Sopenharmony_ci#define MPP2_SATA_PRESENT	MPP(2, 0x1, 0, 0)
2362306a36Sopenharmony_ci#define MPP2_UA2_TXD		MPP(2, 0x2, 0, 0)
2462306a36Sopenharmony_ci#define MPP2_SDIO0_BUS_POWER	MPP(2, 0x3, 0, 0)
2562306a36Sopenharmony_ci#define MPP2_UA_RTSn1		MPP(2, 0x4, 0, 0)
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define MPP3_GPIO3		MPP(3, 0x0, 1, 1)
2862306a36Sopenharmony_ci#define MPP3_SATA_ACT		MPP(3, 0x1, 0, 0)
2962306a36Sopenharmony_ci#define MPP3_UA2_RXD		MPP(3, 0x2, 0, 0)
3062306a36Sopenharmony_ci#define MPP3_SDIO0_LED_CTRL	MPP(3, 0x3, 0, 0)
3162306a36Sopenharmony_ci#define MPP3_UA_CTSn1		MPP(3, 0x4, 0, 0)
3262306a36Sopenharmony_ci#define MPP3_SPI_LCD_CS1	MPP(3, 0xf, 0, 0)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define MPP4_GPIO4		MPP(4, 0x0, 1, 1)
3562306a36Sopenharmony_ci#define MPP4_UA3_RTSn		MPP(4, 0x2, 0, 0)
3662306a36Sopenharmony_ci#define MPP4_SDIO1_CD		MPP(4, 0x3, 0, 0)
3762306a36Sopenharmony_ci#define MPP4_SPI_1_MISO		MPP(4, 0x4, 0, 0)
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci#define MPP5_GPIO5		MPP(5, 0x0, 1, 1)
4062306a36Sopenharmony_ci#define MPP5_UA3_CTSn		MPP(5, 0x2, 0, 0)
4162306a36Sopenharmony_ci#define MPP5_SDIO1_WP		MPP(5, 0x3, 0, 0)
4262306a36Sopenharmony_ci#define MPP5_SPI_1_CS		MPP(5, 0x4, 0, 0)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define MPP6_GPIO6		MPP(6, 0x0, 1, 1)
4562306a36Sopenharmony_ci#define MPP6_UA3_TXD		MPP(6, 0x2, 0, 0)
4662306a36Sopenharmony_ci#define MPP6_SDIO1_BUS_POWER	MPP(6, 0x3, 0, 0)
4762306a36Sopenharmony_ci#define MPP6_SPI_1_MOSI		MPP(6, 0x4, 0, 0)
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define MPP7_GPIO7		MPP(7, 0x0, 1, 1)
5062306a36Sopenharmony_ci#define MPP7_UA3_RXD		MPP(7, 0x2, 0, 0)
5162306a36Sopenharmony_ci#define MPP7_SDIO1_LED_CTRL	MPP(7, 0x3, 0, 0)
5262306a36Sopenharmony_ci#define MPP7_SPI_1_SCK		MPP(7, 0x4, 0, 0)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define MPP8_GPIO8		MPP(8, 0x0, 1, 1)
5562306a36Sopenharmony_ci#define MPP8_WD_RST_OUT		MPP(8, 0x1, 0, 0)
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci#define MPP9_GPIO9		MPP(9, 0x0, 1, 1)
5862306a36Sopenharmony_ci#define MPP9_PEX1_CLKREQn	MPP(9, 0x5, 0, 0)
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci#define MPP10_GPIO10		MPP(10, 0x0, 1, 1)
6162306a36Sopenharmony_ci#define MPP10_SSP_SCLK		MPP(10, 0x5, 0, 0)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#define MPP11_GPIO11		MPP(11, 0x0, 1, 1)
6462306a36Sopenharmony_ci#define MPP11_SATA_PRESENT	MPP(11, 0x1, 0, 0)
6562306a36Sopenharmony_ci#define MPP11_SATA_ACT		MPP(11, 0x2, 0, 0)
6662306a36Sopenharmony_ci#define MPP11_SDIO0_LED_CTRL	MPP(11, 0x3, 0, 0)
6762306a36Sopenharmony_ci#define MPP11_SDIO1_LED_CTRL	MPP(11, 0x4, 0, 0)
6862306a36Sopenharmony_ci#define MPP11_PEX0_CLKREQn	MPP(11, 0x5, 0, 0)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#define MPP12_GPIO12		MPP(12, 0x0, 1, 1)
7162306a36Sopenharmony_ci#define MPP12_SATA_ACT		MPP(12, 0x1, 0, 0)
7262306a36Sopenharmony_ci#define MPP12_UA2_RTSn		MPP(12, 0x2, 0, 0)
7362306a36Sopenharmony_ci#define MPP12_AD0_I2S_EXT_MCLK	MPP(12, 0x3, 0, 0)
7462306a36Sopenharmony_ci#define MPP12_SDIO1_CD		MPP(12, 0x4, 0, 0)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define MPP13_GPIO13		MPP(13, 0x0, 1, 1)
7762306a36Sopenharmony_ci#define MPP13_UA2_CTSn		MPP(13, 0x2, 0, 0)
7862306a36Sopenharmony_ci#define MPP13_AD1_I2S_EXT_MCLK	MPP(13, 0x3, 0, 0)
7962306a36Sopenharmony_ci#define MPP13_SDIO1WP		MPP(13, 0x4, 0, 0)
8062306a36Sopenharmony_ci#define MPP13_SSP_EXTCLK	MPP(13, 0x5, 0, 0)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define MPP14_GPIO14		MPP(14, 0x0, 1, 1)
8362306a36Sopenharmony_ci#define MPP14_UA2_TXD		MPP(14, 0x2, 0, 0)
8462306a36Sopenharmony_ci#define MPP14_SDIO1_BUS_POWER	MPP(14, 0x4, 0, 0)
8562306a36Sopenharmony_ci#define MPP14_SSP_RXD		MPP(14, 0x5, 0, 0)
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#define MPP15_GPIO15		MPP(15, 0x0, 1, 1)
8862306a36Sopenharmony_ci#define MPP15_UA2_RXD		MPP(15, 0x2, 0, 0)
8962306a36Sopenharmony_ci#define MPP15_SDIO1_LED_CTRL	MPP(15, 0x4, 0, 0)
9062306a36Sopenharmony_ci#define MPP15_SSP_SFRM		MPP(15, 0x5, 0, 0)
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define MPP16_GPIO16		MPP(16, 0x0, 1, 1)
9362306a36Sopenharmony_ci#define MPP16_UA3_RTSn		MPP(16, 0x2, 0, 0)
9462306a36Sopenharmony_ci#define MPP16_SDIO0_CD		MPP(16, 0x3, 0, 0)
9562306a36Sopenharmony_ci#define MPP16_SPI_LCD_CS1	MPP(16, 0x4, 0, 0)
9662306a36Sopenharmony_ci#define MPP16_AC97_SDATA_IN1	MPP(16, 0x5, 0, 0)
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci#define MPP17_GPIO17		MPP(17, 0x0, 1, 1)
9962306a36Sopenharmony_ci#define MPP17_AC97_SYSCLK_OUT	MPP(17, 0x1, 0, 0)
10062306a36Sopenharmony_ci#define MPP17_UA3_CTSn		MPP(17, 0x2, 0, 0)
10162306a36Sopenharmony_ci#define MPP17_SDIO0_WP		MPP(17, 0x3, 0, 0)
10262306a36Sopenharmony_ci#define MPP17_TW_SDA2		MPP(17, 0x4, 0, 0)
10362306a36Sopenharmony_ci#define MPP17_AC97_SDATA_IN2	MPP(17, 0x5, 0, 0)
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define MPP18_GPIO18		MPP(18, 0x0, 1, 1)
10662306a36Sopenharmony_ci#define MPP18_UA3_TXD		MPP(18, 0x2, 0, 0)
10762306a36Sopenharmony_ci#define MPP18_SDIO0_BUS_POWER	MPP(18, 0x3, 0, 0)
10862306a36Sopenharmony_ci#define MPP18_LCD0_PWM		MPP(18, 0x4, 0, 0)
10962306a36Sopenharmony_ci#define MPP18_AC_SDATA_IN3	MPP(18, 0x5, 0, 0)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci#define MPP19_GPIO19		MPP(19, 0x0, 1, 1)
11262306a36Sopenharmony_ci#define MPP19_UA3_RXD		MPP(19, 0x2, 0, 0)
11362306a36Sopenharmony_ci#define MPP19_SDIO0_LED_CTRL	MPP(19, 0x3, 0, 0)
11462306a36Sopenharmony_ci#define MPP19_TW_SCK2		MPP(19, 0x4, 0, 0)
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define MPP20_GPIO20		MPP(20, 0x0, 1, 1)
11762306a36Sopenharmony_ci#define MPP20_AC97_SYSCLK_OUT	MPP(20, 0x1, 0, 0)
11862306a36Sopenharmony_ci#define MPP20_SPI_LCD_MISO	MPP(20, 0x2, 0, 0)
11962306a36Sopenharmony_ci#define MPP20_SDIO1_CD		MPP(20, 0x3, 0, 0)
12062306a36Sopenharmony_ci#define MPP20_SDIO0_CD		MPP(20, 0x5, 0, 0)
12162306a36Sopenharmony_ci#define MPP20_SPI_1_MISO	MPP(20, 0x6, 0, 0)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define MPP21_GPIO21		MPP(21, 0x0, 1, 1)
12462306a36Sopenharmony_ci#define MPP21_UA1_RTSn		MPP(21, 0x1, 0, 0)
12562306a36Sopenharmony_ci#define MPP21_SPI_LCD_CS0	MPP(21, 0x2, 0, 0)
12662306a36Sopenharmony_ci#define MPP21_SDIO1_WP		MPP(21, 0x3, 0, 0)
12762306a36Sopenharmony_ci#define MPP21_SSP_SFRM		MPP(21, 0x4, 0, 0)
12862306a36Sopenharmony_ci#define MPP21_SDIO0_WP		MPP(21, 0x5, 0, 0)
12962306a36Sopenharmony_ci#define MPP21_SPI_1_CS		MPP(21, 0x6, 0, 0)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define MPP22_GPIO22		MPP(22, 0x0, 1, 1)
13262306a36Sopenharmony_ci#define MPP22_UA1_CTSn		MPP(22, 0x1, 0, 0)
13362306a36Sopenharmony_ci#define MPP22_SPI_LCD_MOSI	MPP(22, 0x2, 0, 0)
13462306a36Sopenharmony_ci#define MPP22_SDIO1_BUS_POWER	MPP(22, 0x3, 0, 0)
13562306a36Sopenharmony_ci#define MPP22_SSP_TXD		MPP(22, 0x4, 0, 0)
13662306a36Sopenharmony_ci#define MPP22_SDIO0_BUS_POWER	MPP(22, 0x5, 0, 0)
13762306a36Sopenharmony_ci#define MPP22_SPI_1_MOSI	MPP(22, 0x6, 0, 0)
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci#define MPP23_GPIO23		MPP(23, 0x0, 1, 1)
14062306a36Sopenharmony_ci#define MPP23_SPI_LCD_SCK	MPP(23, 0x2, 0, 0)
14162306a36Sopenharmony_ci#define MPP23_SDIO1_LED_CTRL	MPP(23, 0x3, 0, 0)
14262306a36Sopenharmony_ci#define MPP23_SSP_SCLK		MPP(23, 0x4, 0, 0)
14362306a36Sopenharmony_ci#define MPP23_SDIO0_LED_CTRL	MPP(23, 0x5, 0, 0)
14462306a36Sopenharmony_ci#define MPP23_SPI_1_SCK		MPP(23, 0x6, 0, 0)
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#define MPP_MAX			23
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#define MPP_GRP(_grp, _mode)	MPP((_grp), (_mode), 0, 0)
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci/* for MPP groups _num is a group index */
15162306a36Sopenharmony_cienum dove_mpp_grp_idx {
15262306a36Sopenharmony_ci	MPP_24_39 = 2,
15362306a36Sopenharmony_ci	MPP_40_45 = 0,
15462306a36Sopenharmony_ci	MPP_46_51 = 1,
15562306a36Sopenharmony_ci	MPP_58_61 = 5,
15662306a36Sopenharmony_ci	MPP_62_63 = 4,
15762306a36Sopenharmony_ci	MPP_GRP_MAX = 5,
15862306a36Sopenharmony_ci};
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#define MPP_GRP_24_39_GPIO		MPP_GRP(MPP_24_39, 0x1)
16162306a36Sopenharmony_ci#define MPP_GRP_24_39_CAM		MPP_GRP(MPP_24_39, 0x0)
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci#define MPP_GRP_40_45_GPIO		MPP_GRP(MPP_40_45, 0x1)
16462306a36Sopenharmony_ci#define MPP_GRP_40_45_SD0		MPP_GRP(MPP_40_45, 0x0)
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci#define MPP_GRP_46_51_GPIO		MPP_GRP(MPP_46_51, 0x1)
16762306a36Sopenharmony_ci#define MPP_GRP_46_51_SD1		MPP_GRP(MPP_46_51, 0x0)
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define MPP_GRP_58_61_GPIO		MPP_GRP(MPP_58_61, 0x1)
17062306a36Sopenharmony_ci#define MPP_GRP_58_61_SPI		MPP_GRP(MPP_58_61, 0x0)
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ci#define MPP_GRP_62_63_GPIO		MPP_GRP(MPP_62_63, 0x1)
17362306a36Sopenharmony_ci#define MPP_GRP_62_63_UA1		MPP_GRP(MPP_62_63, 0x0)
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/* The MPP[64:71] control differs from other groups */
17662306a36Sopenharmony_ci#define MPP_GRP_NFC_64_71_GPO		0x1
17762306a36Sopenharmony_ci#define MPP_GRP_NFC_64_71_NFC		0x0
17862306a36Sopenharmony_ci
17962306a36Sopenharmony_ci/*
18062306a36Sopenharmony_ci * The MPP[52:57] functionality is encoded by 4 bits in different
18162306a36Sopenharmony_ci * registers. The _num field in this case encodes those bits in
18262306a36Sopenharmony_ci * correspodence with Table 135 of 88AP510 Functional specification
18362306a36Sopenharmony_ci */
18462306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_AU1		0x0
18562306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_AU1_GPIO57	0x2
18662306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_GPIO		0xa
18762306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_TW_GPIO	0xb
18862306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_AU1_SSP	0xc
18962306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_SSP_GPIO	0xe
19062306a36Sopenharmony_ci#define MPP_GRP_AU1_52_57_SSP_TW	0xf
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_civoid dove_mpp_conf(unsigned int *mpp_list,
19362306a36Sopenharmony_ci		   unsigned int *mpp_grp_list,
19462306a36Sopenharmony_ci		   unsigned int grp_au1_52_57,
19562306a36Sopenharmony_ci		   unsigned int grp_nfc_64_71);
19662306a36Sopenharmony_ci
19762306a36Sopenharmony_ci#endif	/* __ARCH_DOVE_MPP_CODED_H */
198