@@ -35,11 +35,10 @@
#include <linux/irq.h>
#include <linux/interrupt.h>
-
#include "omap_hwmod.h"
-
#include "soc.h"
#include "control.h"
+#include "id.h"
#include "mux.h"
#include "prm.h"
#include "common.h"
@@ -505,17 +504,17 @@ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state)
#define OMAP_MUX_TEST_FLAG(val, mask) \
if (((val) & (mask)) == (mask)) { \
i++; \
- flags[i] = #mask; \
+ flags[i] = #mask + sizeof("OMAP_") - 1; \
}
/* REVISIT: Add checking for non-optimal mux settings */
static inline void omap_mux_decode(struct seq_file *s, u16 val)
{
char *flags[OMAP_MUX_MAX_NR_FLAGS];
- char mode[sizeof("OMAP_MUX_MODE") + 1];
+ char mode[sizeof("MUX_MODE") + 1];
int i = -1;
- sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);
+ sprintf(mode, "MUX_MODE%d", val & 0x7);
i++;
flags[i] = mode;
@@ -553,7 +552,7 @@ static inline void omap_mux_decode(struct seq_file *s, u16 val)
}
} else {
i++;
- flags[i] = "OMAP_PIN_OUTPUT";
+ flags[i] = "PIN_OUTPUT";
}
do {
@@ -568,15 +567,26 @@ static inline void omap_mux_decode(struct seq_file *s, u16 val)
static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
{
struct omap_mux_partition *partition = s->private;
+ int pbase = (int)partition->base;
struct omap_mux_entry *e;
- u8 omap_gen = omap_rev() >> 28;
+
+ if (!(pbase & 0xfff))
+ pbase = 0x40;
+ else
+ pbase = 0;
+
+ seq_printf(s, "\t\tpinctrl-single,pins = <\n");
list_for_each_entry(e, &partition->muxmodes, node) {
struct omap_mux *m = &e->mux;
char m0_def[OMAP_MUX_DEFNAME_LEN];
char *m0_name = m->muxnames[0];
u16 val;
- int i, mode;
+ int padconf_offset, i, mode;
+
+ padconf_offset = m->reg_offset - pbase;
+ if (cpu_is_omap3630() && padconf_offset > 0x5ca)
+ continue;
if (!m0_name)
continue;
@@ -591,18 +601,18 @@ static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
}
val = omap_mux_read(partition, m->reg_offset);
mode = val & OMAP_MUX_MODE7;
- if (mode != 0)
- seq_printf(s, "/* %s */\n", m->muxnames[mode]);
-
- /*
- * XXX: Might be revisited to support differences across
- * same OMAP generation.
- */
- seq_printf(s, "OMAP%d_MUX(%s, ", omap_gen, m0_def);
+ seq_printf(s, "\t\t\t0x%x (",
+ padconf_offset);
omap_mux_decode(s, val);
- seq_printf(s, "),\n");
+ seq_printf(s, ")\t/* %s.%s */",
+ m->muxnames[0], m->muxnames[mode]);
+ seq_printf(s, " //0x%x gpio%i",
+ val, m->gpio);
+ seq_printf(s, "\n");
}
+ seq_printf(s, "\t\t>;\n");
+
return 0;
}
@@ -22,6 +22,7 @@
#include "common-board-devices.h"
#include "dss-common.h"
#include "control.h"
+#include "mux.h"
struct pdata_init {
const char *compatible;
@@ -277,6 +278,39 @@ static struct pdata_init pdata_quirks[] __initdata = {
{ /* sentinel */ },
};
+struct board_package {
+ const char *compatible;
+ int (*fn)(struct omap_board_mux *board_mux, int flags);
+ int flags;
+};
+
+static struct board_package packages[] __initdata = {
+ { "nokia,n800", omap2420_mux_init, OMAP_PACKAGE_ZAC, },
+ { "nokia,n810", omap2420_mux_init, OMAP_PACKAGE_ZAC, },
+ { "ti,omap2430-sdp", omap2430_mux_init, OMAP_PACKAGE_ZAC, },
+ { "nokia,omap3-n900", omap3_mux_init, OMAP_PACKAGE_CBB, },
+ { "ti,omap3-evm-37xx", omap3_mux_init, OMAP_PACKAGE_CBB, },
+ { "ti,omap3-ldp", omap3_mux_init, OMAP_PACKAGE_CBB, },
+ { "ti,omap3-zoom3", omap3_mux_init, OMAP_PACKAGE_CBP, },
+ { "ti,omap4-sdp", omap4_mux_init, OMAP_PACKAGE_CBS, },
+ { "ti,omap4-panda", omap4_mux_init, OMAP_PACKAGE_CBS, },
+ { /* sentinel */ },
+};
+
+static void legacy_mux_init(void)
+{
+ struct board_package *pkg = packages;
+
+ while (pkg->compatible) {
+ if (of_machine_is_compatible(pkg->compatible)) {
+ if (pkg->fn)
+ pkg->fn(NULL, pkg->flags);
+ break;
+ }
+ pkg++;
+ }
+}
+
static void pdata_quirks_check(struct pdata_init *quirks)
{
while (quirks->compatible) {
@@ -296,4 +330,5 @@ void __init pdata_quirks_init(struct of_device_id *omap_dt_match_table)
of_platform_populate(NULL, omap_dt_match_table,
omap_auxdata_lookup, NULL);
pdata_quirks_check(pdata_quirks);
+ legacy_mux_init();
}