#include #include #include #include #include #include #include "../common/board_detect.h" #include "board.h" static struct module_pin_mux mmc0_no_cd_pin_mux_myboard[] = { {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */ {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */ {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */ {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */ {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */ {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */ {-1}, }; static struct module_pin_mux mmc0_pin_mux_sk_evm[] = { {OFFSET(mmc0_dat3), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT3 */ {OFFSET(mmc0_dat2), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT2 */ {OFFSET(mmc0_dat1), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT1 */ {OFFSET(mmc0_dat0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_DAT0 */ {OFFSET(mmc0_clk), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CLK */ {OFFSET(mmc0_cmd), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* MMC0_CMD */ {OFFSET(spi0_cs1), (MODE(5) | RXACTIVE | PULLUP_EN)}, /* MMC0_CD */ {-1}, }; /* * The AM335x GP EVM, if daughter card(s) are connected, can have 8 * different profiles. These profiles determine what peripherals are * valid and need pinmux to be configured. */ #define PROFILE_NONE 0x0 #define PROFILE_0 (1 << 0) #define PROFILE_1 (1 << 1) #define PROFILE_2 (1 << 2) #define PROFILE_3 (1 << 3) #define PROFILE_4 (1 << 4) #define PROFILE_5 (1 << 5) #define PROFILE_6 (1 << 6) #define PROFILE_7 (1 << 7) #define PROFILE_MASK 0x7 #define PROFILE_ALL 0xFF /* CPLD registers */ #define I2C_CPLD_ADDR 0x35 #define CFG_REG 0x10 static unsigned short detect_daughter_board_profile(void) { unsigned short val; if (i2c_probe(I2C_CPLD_ADDR)) return PROFILE_NONE; if (i2c_read(I2C_CPLD_ADDR, CFG_REG, 1, (unsigned char *)(&val), 2)) return PROFILE_NONE; return (1 << (val & PROFILE_MASK)); } void enable_board_pin_mux(void) { /* Do board-specific muxes. */ if (board_is_bone()) { /* Beaglebone pinmux */ configure_module_pin_mux(mii1_pin_mux); configure_module_pin_mux(mmc0_pin_mux); #if defined(CONFIG_NAND) configure_module_pin_mux(nand_pin_mux); #elif defined(CONFIG_NOR) configure_module_pin_mux(bone_norcape_pin_mux); #else configure_module_pin_mux(mmc1_pin_mux); #endif } else if (board_is_evm_sk()) { /* Starter Kit EVM */ configure_module_pin_mux(i2c1_pin_mux); configure_module_pin_mux(gpio0_7_pin_mux); configure_module_pin_mux(rgmii1_pin_mux); configure_module_pin_mux(mmc0_pin_mux_sk_evm); } else if (board_is_myboard()) { /* Myboard */ configure_module_pin_mux(i2c1_pin_mux); configure_module_pin_mux(rgmii1_pin_mux); configure_module_pin_mux(mmc0_no_cd_pin_mux_myboard); } else { /* Unknown board. We might still be able to boot. */ puts("Bad EEPROM or unknown board, cannot configure pinmux."); } }