summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2012-08-08 09:03:07 -0700
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-09-01 14:58:18 +0200
commit036fd65a8c71f0dcc7edcbd12ba33b7d645b5677 (patch)
treec83fe47978d127c2c8dbf68a2cc9e7af80b151d9
parent38d4a6042b92d30d74012c3c91142bca2a249e92 (diff)
downloadu-boot-imx-036fd65a8c71f0dcc7edcbd12ba33b7d645b5677.zip
u-boot-imx-036fd65a8c71f0dcc7edcbd12ba33b7d645b5677.tar.gz
u-boot-imx-036fd65a8c71f0dcc7edcbd12ba33b7d645b5677.tar.bz2
am335x evm: Initial support for AM335x GP EVM Profiles
The AM335x GP EVM can have one of 8 different profiles selected. Each profile has a different set of peripherals and requires different pinmux configurations that conflict with other profiles. i2c1 is an example of a conflicted mux currently. Signed-off-by: Tom Rini <trini@ti.com>
-rw-r--r--board/ti/am335x/mux.c46
1 files changed, 42 insertions, 4 deletions
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index c7460eb..5e902ab 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -17,6 +17,7 @@
#include <asm/arch/sys_proto.h>
#include <asm/arch/hardware.h>
#include <asm/io.h>
+#include <i2c.h>
#define MUX_CFG(value, offset) \
__raw_writel(value, (CTRL_BASE + offset));
@@ -364,22 +365,59 @@ void enable_i2c0_pin_mux(void)
configure_module_pin_mux(i2c0_pin_mux);
}
-void enable_board_pin_mux(struct am335x_baseboard_id *header)
+/*
+ * 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)
{
- /* Enable pinmux that is common to all TI boards. */
- configure_module_pin_mux(i2c1_pin_mux);
+ unsigned short val;
+
+ if (i2c_probe(I2C_CPLD_ADDR))
+ return PROFILE_NONE;
- /* Now do board-specific muxes. */
+ 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(struct am335x_baseboard_id *header)
+{
+ /* Do board-specific muxes. */
if (!strncmp(header->name, "A335BONE", HDR_NAME_LEN)) {
/* Beaglebone pinmux */
+ configure_module_pin_mux(i2c1_pin_mux);
configure_module_pin_mux(mii1_pin_mux);
configure_module_pin_mux(mmc0_pin_mux);
} else if (!strncmp(header->config, "SKU#01", 6)) {
/* General Purpose EVM */
+ unsigned short profile = detect_daughter_board_profile();
configure_module_pin_mux(rgmii1_pin_mux);
configure_module_pin_mux(mmc0_pin_mux);
+ /* In profile #2 i2c1 and spi0 conflict. */
+ if (profile & ~PROFILE_2)
+ configure_module_pin_mux(i2c1_pin_mux);
} else if (!strncmp(header->name, "A335X_SK", HDR_NAME_LEN)) {
/* 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);