blob: bdf460b5920aa8d6a84ce5baf99840fc29ff0181 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Heiko Schocher499c4982013-08-19 16:39:01 +02002/*
3 * pinmux setup for siemens pxm2 board
4 *
5 * (C) Copyright 2013 Siemens Schweiz AG
6 * (C) Heiko Schocher, DENX Software Engineering, hs@denx.de.
7 *
8 * Based on:
9 * u-boot:/board/ti/am335x/mux.c
10 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -050011 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
Heiko Schocher499c4982013-08-19 16:39:01 +020012 */
13
Enrico Letofce91792024-01-24 15:43:54 +010014#include <asm/io.h>
Heiko Schocher499c4982013-08-19 16:39:01 +020015#include <asm/arch/sys_proto.h>
16#include <asm/arch/hardware.h>
17#include <asm/arch/mux.h>
Enrico Leto32f433f2024-01-24 15:43:50 +010018#include "eeprom.h"
Heiko Schocher499c4982013-08-19 16:39:01 +020019
20static struct module_pin_mux uart0_pin_mux[] = {
21 {OFFSET(uart0_rxd), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */
22 {OFFSET(uart0_txd), (MODE(0) | PULLUDEN)}, /* UART0_TXD */
23 {OFFSET(nnmi), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* UART0_TXD */
24 {-1},
25};
26
Miquel Raynald0935362019-10-03 19:50:03 +020027#ifdef CONFIG_MTD_RAW_NAND
Heiko Schocher499c4982013-08-19 16:39:01 +020028static struct module_pin_mux nand_pin_mux[] = {
29 {OFFSET(gpmc_ad0), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD0 */
30 {OFFSET(gpmc_ad1), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD1 */
31 {OFFSET(gpmc_ad2), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD2 */
32 {OFFSET(gpmc_ad3), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD3 */
33 {OFFSET(gpmc_ad4), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD4 */
34 {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */
35 {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */
36 {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */
37 {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */
38 {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */
39 {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */
40 {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */
41 {OFFSET(gpmc_oen_ren), (MODE(0) | PULLUDEN)}, /* NAND_OE */
42 {OFFSET(gpmc_wen), (MODE(0) | PULLUDEN)}, /* NAND_WEN */
43 {OFFSET(gpmc_be0n_cle), (MODE(0) | PULLUDEN)}, /* NAND_BE_CLE */
44 {OFFSET(gpmc_a11), MODE(7) | RXACTIVE | PULLUP_EN}, /* RGMII2_RD0 */
45 {OFFSET(mcasp0_ahclkx), MODE(7) | PULLUDEN}, /* MCASP0_AHCLKX */
46 {-1},
47};
48#endif
49
50static struct module_pin_mux i2c0_pin_mux[] = {
51 {OFFSET(i2c0_sda), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
52 {OFFSET(i2c0_scl), (MODE(0) | RXACTIVE | PULLUDEN | SLEWCTRL)},
53 {-1},
54};
55
56static struct module_pin_mux i2c1_pin_mux[] = {
57 {OFFSET(spi0_d1), (MODE(2) | RXACTIVE | PULLUDEN | SLEWCTRL)},
58 {OFFSET(spi0_cs0), (MODE(2) | RXACTIVE | PULLUDEN | SLEWCTRL)},
59 {-1},
60};
61
62#ifndef CONFIG_NO_ETH
63static struct module_pin_mux rgmii1_pin_mux[] = {
64 {OFFSET(mii1_txen), MODE(2)}, /* RGMII1_TCTL */
65 {OFFSET(mii1_rxdv), MODE(2) | RXACTIVE}, /* RGMII1_RCTL */
66 {OFFSET(mii1_txd3), MODE(2)}, /* RGMII1_TD3 */
67 {OFFSET(mii1_txd2), MODE(2)}, /* RGMII1_TD2 */
68 {OFFSET(mii1_txd1), MODE(2)}, /* RGMII1_TD1 */
69 {OFFSET(mii1_txd0), MODE(2)}, /* RGMII1_TD0 */
70 {OFFSET(mii1_txclk), MODE(2)}, /* RGMII1_TCLK */
71 {OFFSET(mii1_rxclk), MODE(2) | RXACTIVE}, /* RGMII1_RCLK */
72 {OFFSET(mii1_rxd3), MODE(2) | RXACTIVE}, /* RGMII1_RD3 */
73 {OFFSET(mii1_rxd2), MODE(2) | RXACTIVE}, /* RGMII1_RD2 */
74 {OFFSET(mii1_rxd1), MODE(2) | RXACTIVE}, /* RGMII1_RD1 */
75 {OFFSET(mii1_rxd0), MODE(2) | RXACTIVE}, /* RGMII1_RD0 */
76 {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
77 {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
78 {-1},
79};
80
81static struct module_pin_mux rgmii2_pin_mux[] = {
82 {OFFSET(gpmc_a0), MODE(2)}, /* RGMII2_TCTL */
83 {OFFSET(gpmc_a1), MODE(2) | RXACTIVE}, /* RGMII2_RCTL */
84 {OFFSET(gpmc_a2), MODE(2)}, /* RGMII2_TD3 */
85 {OFFSET(gpmc_a3), MODE(2)}, /* RGMII2_TD2 */
86 {OFFSET(gpmc_a4), MODE(2)}, /* RGMII2_TD1 */
87 {OFFSET(gpmc_a5), MODE(2)}, /* RGMII2_TD0 */
88 {OFFSET(gpmc_a6), MODE(7)}, /* RGMII2_TCLK */
89 {OFFSET(gpmc_a7), MODE(2) | RXACTIVE}, /* RGMII2_RCLK */
90 {OFFSET(gpmc_a8), MODE(2) | RXACTIVE}, /* RGMII2_RD3 */
91 {OFFSET(gpmc_a9), MODE(7)}, /* RGMII2_RD2 */
92 {OFFSET(gpmc_a10), MODE(2) | RXACTIVE}, /* RGMII2_RD1 */
93 {OFFSET(mdio_data), MODE(0) | RXACTIVE | PULLUP_EN}, /* MDIO_DATA */
94 {OFFSET(mdio_clk), MODE(0) | PULLUP_EN}, /* MDIO_CLK */
95 {-1},
96};
97#endif
98
99#ifdef CONFIG_MMC
100static struct module_pin_mux mmc0_pin_mux[] = {
101 {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */
102 {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */
103 {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */
104 {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */
105 {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */
106 {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */
107 {OFFSET(mcasp0_aclkr), (MODE(4) | RXACTIVE)}, /* MMC0_WP */
108 {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUDEN)}, /* MMC0_CD */
109 {-1},
110};
111#endif
112
113static struct module_pin_mux lcdc_pin_mux[] = {
114 {OFFSET(lcd_data0), (MODE(0) | PULLUDDIS)}, /* LCD_DAT0 */
115 {OFFSET(lcd_data1), (MODE(0) | PULLUDDIS)}, /* LCD_DAT1 */
116 {OFFSET(lcd_data2), (MODE(0) | PULLUDDIS)}, /* LCD_DAT2 */
117 {OFFSET(lcd_data3), (MODE(0) | PULLUDDIS)}, /* LCD_DAT3 */
118 {OFFSET(lcd_data4), (MODE(0) | PULLUDDIS)}, /* LCD_DAT4 */
119 {OFFSET(lcd_data5), (MODE(0) | PULLUDDIS)}, /* LCD_DAT5 */
120 {OFFSET(lcd_data6), (MODE(0) | PULLUDDIS)}, /* LCD_DAT6 */
121 {OFFSET(lcd_data7), (MODE(0) | PULLUDDIS)}, /* LCD_DAT7 */
122 {OFFSET(lcd_data8), (MODE(0) | PULLUDDIS)}, /* LCD_DAT8 */
123 {OFFSET(lcd_data9), (MODE(0) | PULLUDDIS)}, /* LCD_DAT9 */
124 {OFFSET(lcd_data10), (MODE(0) | PULLUDDIS)}, /* LCD_DAT10 */
125 {OFFSET(lcd_data11), (MODE(0) | PULLUDDIS)}, /* LCD_DAT11 */
126 {OFFSET(lcd_data12), (MODE(0) | PULLUDDIS)}, /* LCD_DAT12 */
127 {OFFSET(lcd_data13), (MODE(0) | PULLUDDIS)}, /* LCD_DAT13 */
128 {OFFSET(lcd_data14), (MODE(0) | PULLUDDIS)}, /* LCD_DAT14 */
129 {OFFSET(lcd_data15), (MODE(0) | PULLUDDIS)}, /* LCD_DAT15 */
130 {OFFSET(gpmc_ad8), (MODE(1))}, /* LCD_DAT16 */
131 {OFFSET(gpmc_ad9), (MODE(1))}, /* LCD_DAT17 */
132 {OFFSET(gpmc_ad10), (MODE(1))}, /* LCD_DAT18 */
133 {OFFSET(gpmc_ad11), (MODE(1))}, /* LCD_DAT19 */
134 {OFFSET(gpmc_ad12), (MODE(1))}, /* LCD_DAT20 */
135 {OFFSET(gpmc_ad13), (MODE(1))}, /* LCD_DAT21 */
136 {OFFSET(gpmc_ad14), (MODE(1))}, /* LCD_DAT22 */
137 {OFFSET(gpmc_ad15), (MODE(1))}, /* LCD_DAT23 */
138 {OFFSET(lcd_vsync), (MODE(0))}, /* LCD_VSYNC */
139 {OFFSET(lcd_hsync), (MODE(0))}, /* LCD_HSYNC */
140 {OFFSET(lcd_pclk), (MODE(0))}, /* LCD_PCLK */
141 {OFFSET(lcd_ac_bias_en), (MODE(0))}, /* LCD_AC_BIAS_EN */
142 {-1},
143};
144
145static struct module_pin_mux ecap0_pin_mux[] = {
146 {OFFSET(ecap0_in_pwm0_out), (MODE(0))},
147 {-1},
148};
149
150static struct module_pin_mux gpio_pin_mux[] = {
151 {OFFSET(mcasp0_fsx), MODE(7)}, /* GPIO3_15 LCD power*/
152 {OFFSET(mcasp0_axr0), MODE(7)}, /* GPIO3_16 Backlight */
153 {OFFSET(gpmc_a9), MODE(7)}, /* GPIO1_25 Touch power */
154 {-1},
155};
156void enable_i2c0_pin_mux(void)
157{
158 configure_module_pin_mux(i2c0_pin_mux);
159}
160
161void enable_uart0_pin_mux(void)
162{
163 configure_module_pin_mux(uart0_pin_mux);
164}
165
166void enable_board_pin_mux(void)
167{
168 configure_module_pin_mux(uart0_pin_mux);
169 configure_module_pin_mux(i2c1_pin_mux);
Miquel Raynald0935362019-10-03 19:50:03 +0200170#ifdef CONFIG_MTD_RAW_NAND
Heiko Schocher499c4982013-08-19 16:39:01 +0200171 configure_module_pin_mux(nand_pin_mux);
172#endif
173#ifndef CONFIG_NO_ETH
174 configure_module_pin_mux(rgmii1_pin_mux);
175 configure_module_pin_mux(rgmii2_pin_mux);
176#endif
177#ifdef CONFIG_MMC
178 configure_module_pin_mux(mmc0_pin_mux);
179#endif
180 configure_module_pin_mux(lcdc_pin_mux);
181 configure_module_pin_mux(gpio_pin_mux);
182 configure_module_pin_mux(ecap0_pin_mux);
183}