MFC r274412, r274413, r274414: Bugfixes for imx5/6 pinctrl driver.
This commit is contained in:
parent
832ee5dfbd
commit
dda8b6a9a4
@ -99,6 +99,10 @@ struct pincfg {
|
|||||||
uint32_t padconf_val;
|
uint32_t padconf_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PADCONF_NONE (1U << 31) /* Do not configure pad. */
|
||||||
|
#define PADCONF_SION (1U << 30) /* Force SION bit in mux register. */
|
||||||
|
#define PADMUX_SION (1U << 4) /* The SION bit in the mux register. */
|
||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
RD4(struct iomux_softc *sc, bus_size_t off)
|
RD4(struct iomux_softc *sc, bus_size_t off)
|
||||||
{
|
{
|
||||||
@ -120,6 +124,7 @@ iomux_configure_pins(device_t dev, phandle_t cfgxref)
|
|||||||
struct pincfg *cfgtuples, *cfg;
|
struct pincfg *cfgtuples, *cfg;
|
||||||
phandle_t cfgnode;
|
phandle_t cfgnode;
|
||||||
int i, ntuples;
|
int i, ntuples;
|
||||||
|
uint32_t sion;
|
||||||
|
|
||||||
sc = device_get_softc(dev);
|
sc = device_get_softc(dev);
|
||||||
cfgnode = OF_node_from_xref(cfgxref);
|
cfgnode = OF_node_from_xref(cfgxref);
|
||||||
@ -130,9 +135,22 @@ iomux_configure_pins(device_t dev, phandle_t cfgxref)
|
|||||||
if (ntuples == 0)
|
if (ntuples == 0)
|
||||||
return (0); /* Empty property is not an error. */
|
return (0); /* Empty property is not an error. */
|
||||||
for (i = 0, cfg = cfgtuples; i < ntuples; i++, cfg++) {
|
for (i = 0, cfg = cfgtuples; i < ntuples; i++, cfg++) {
|
||||||
WR4(sc, cfg->mux_reg, cfg->mux_val);
|
sion = (cfg->padconf_val & PADCONF_SION) ? PADMUX_SION : 0;
|
||||||
WR4(sc, cfg->input_reg, cfg->input_val);
|
WR4(sc, cfg->mux_reg, cfg->mux_val | sion);
|
||||||
WR4(sc, cfg->padconf_reg, cfg->padconf_val);
|
if (cfg->input_reg != 0)
|
||||||
|
WR4(sc, cfg->input_reg, cfg->input_val);
|
||||||
|
if ((cfg->padconf_val & PADCONF_NONE) == 0)
|
||||||
|
WR4(sc, cfg->padconf_reg, cfg->padconf_val);
|
||||||
|
if (bootverbose) {
|
||||||
|
char name[32];
|
||||||
|
OF_getprop(cfgnode, "name", &name, sizeof(name));
|
||||||
|
printf("%16s: muxreg 0x%04x muxval 0x%02x "
|
||||||
|
"inpreg 0x%04x inpval 0x%02x "
|
||||||
|
"padreg 0x%04x padval 0x%08x\n",
|
||||||
|
name, cfg->mux_reg, cfg->mux_val | sion,
|
||||||
|
cfg->input_reg, cfg->input_val,
|
||||||
|
cfg->padconf_reg, cfg->padconf_val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(cfgtuples, M_OFWPROP);
|
free(cfgtuples, M_OFWPROP);
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -124,15 +124,14 @@ pinctrl_configure_children(device_t pinctrl, phandle_t parent)
|
|||||||
pinctrl_configure_children(pinctrl, node);
|
pinctrl_configure_children(pinctrl, node);
|
||||||
nconfigs = OF_getencprop_alloc(node, "pinctrl-0",
|
nconfigs = OF_getencprop_alloc(node, "pinctrl-0",
|
||||||
sizeof(*configs), (void **)&configs);
|
sizeof(*configs), (void **)&configs);
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
char name[32];
|
|
||||||
OF_getprop(node, "name", &name, sizeof(name));
|
|
||||||
printf("%d items in pinctrl-0 for %s\n", nconfigs, name);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (nconfigs <= 0)
|
if (nconfigs <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
if (bootverbose) {
|
||||||
|
char name[32];
|
||||||
|
OF_getprop(node, "name", &name, sizeof(name));
|
||||||
|
printf("Processing %d pin-config node(s) in pinctrl-0 for %s\n",
|
||||||
|
nconfigs, name);
|
||||||
|
}
|
||||||
for (i = 0; i < nconfigs; i++) {
|
for (i = 0; i < nconfigs; i++) {
|
||||||
if (OF_device_from_xref(configs[i]) == pinctrl)
|
if (OF_device_from_xref(configs[i]) == pinctrl)
|
||||||
FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
|
FDT_PINCTRL_CONFIGURE(pinctrl, configs[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user