Message ID | 1341373400-15763-2-git-send-email-Barry.Song@csr.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wednesday 04 July 2012, Barry Song wrote: > +/* Padmux settings */ > +static struct pinctrl_map prima2_padmux_map[] = { > + PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"), > + PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"), > + PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"), > +}; > + > static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { > { .compatible = "simple-bus", }, > {}, > @@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { > void __init sirfsoc_mach_init(void) > { > of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL); > + pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map)); > } I haven't been following pinctrl too closely, but isn't this something that would normally be represented by putting the lookup table into the device tree? Arnd
2012/7/4 Arnd Bergmann <arnd@arndb.de>: > On Wednesday 04 July 2012, Barry Song wrote: >> +/* Padmux settings */ >> +static struct pinctrl_map prima2_padmux_map[] = { >> + PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"), >> + PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"), >> + PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"), >> +}; >> + >> static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { >> { .compatible = "simple-bus", }, >> {}, >> @@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { >> void __init sirfsoc_mach_init(void) >> { >> of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL); >> + pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map)); >> } > > I haven't been following pinctrl too closely, but isn't this something > that would normally be represented by putting the lookup table into the > device tree? i'd like to see that. i am not sure whether i have missed anything since i only saw the pinctrl_register_mappings samples. would linus clarify? > > Arnd > -barry
On Wed, Jul 4, 2012 at 4:25 PM, Barry Song <21cnbao@gmail.com> wrote: > 2012/7/4 Arnd Bergmann <arnd@arndb.de>: >> On Wednesday 04 July 2012, Barry Song wrote: >>> of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL); >>> + pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map)); >>> } >> >> I haven't been following pinctrl too closely, but isn't this something >> that would normally be represented by putting the lookup table into the >> device tree? > > i'd like to see that. i am not sure whether i have missed anything > since i only saw the pinctrl_register_mappings samples. > would linus clarify? You can do it either way, but for a DT:ed platform it makes sense to have it in device tree. Check drivers/pinctrl/devicetree.c for how that code works, the bindings are in Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt There are example usecases in arch/arm/boot/dts/* This was all implemented by Stephen Warren so he's the reference to this codepath. Yours, Linus Walleij
diff --git a/arch/arm/mach-prima2/prima2.c b/arch/arm/mach-prima2/prima2.c index 82f5c0d..b2bb33d 100644 --- a/arch/arm/mach-prima2/prima2.c +++ b/arch/arm/mach-prima2/prima2.c @@ -33,6 +33,13 @@ struct of_dev_auxdata prima2_auxdata_lookup[] __initdata = { {}, }; +/* Padmux settings */ +static struct pinctrl_map prima2_padmux_map[] = { + PIN_MAP_MUX_GROUP_DEFAULT("uart1", "pinctrl0", NULL, "uart1"), + PIN_MAP_MUX_GROUP_DEFAULT("spi0", "pinctrl0", NULL, "spi0"), + PIN_MAP_MUX_GROUP_DEFAULT("spi1", "pinctrl0", NULL, "spi1"), +}; + static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { { .compatible = "simple-bus", }, {}, @@ -41,6 +48,7 @@ static struct of_device_id sirfsoc_of_bus_ids[] __initdata = { void __init sirfsoc_mach_init(void) { of_platform_populate(NULL, sirfsoc_of_bus_ids, prima2_auxdata_lookup, NULL); + pinctrl_register_mappings(prima2_padmux_map, ARRAY_SIZE(prima2_padmux_map)); } void __init sirfsoc_init_late(void)