* Benoit Cousson <b-cousson@xxxxxx> [101019 15:14]: > Add data for OMAP4430 generated from HW pinout & register database. > The data set is split in two partitions for both core and wkup. We should drop patch 3/7 and merge the following patch to your 4/7 patch. Basically let's keep the omap_mux_read/write around for now, by adding omap_mux_get for dealing with the partition information. Regards, Tony From: Tony Lindgren <tony@xxxxxxxxxxx> Date: Wed, 10 Nov 2010 09:55:47 -0800 Subject: [PATCH] omap: mux: Fix support for partitions for dynamic muxing Revert some parts of Benoit's patch to not make omap_mux_read/write static at this point. We may need to do remuxing for system wide idle states, and also for driver specific idle states. So we still need to have omap_mux_read/write around for the platform level driver code. Also add omap_mux_get for getting the partition data so platform level device code can use it. Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx> diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c index 3fec4d6..3fda20d 100644 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c @@ -293,6 +293,8 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = { { .reg_offset = OMAP_MUX_TERMINATOR }, }; +static struct omap_mux_partition *partition; + /* * Current flows to eMMC when eMMC is off and the data lines are pulled up, * so pull them down. N.B. we pull 8 lines because we are using 8 lines. @@ -300,9 +302,9 @@ static struct omap_board_mux rx51_mmc2_off_mux[] = { static void rx51_mmc2_remux(struct device *dev, int slot, int power_on) { if (power_on) - omap_mux_write_array(rx51_mmc2_on_mux); + omap_mux_write_array(partition, rx51_mmc2_on_mux); else - omap_mux_write_array(rx51_mmc2_off_mux); + omap_mux_write_array(partition, rx51_mmc2_off_mux); } static struct omap2_hsmmc_info mmc[] __initdata = { @@ -922,7 +924,11 @@ void __init rx51_peripherals_init(void) rx51_init_wl1251(); spi_register_board_info(rx51_peripherals_spi_board_info, ARRAY_SIZE(rx51_peripherals_spi_board_info)); - omap2_hsmmc_init(mmc); + + partition = omap_mux_get("core"); + if (partition) + omap2_hsmmc_init(mmc); + platform_device_register(&rx51_charger_device); } diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 9b9128e..6d91bb8 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -49,7 +49,19 @@ struct omap_mux_entry { static LIST_HEAD(mux_partitions); static DEFINE_MUTEX(muxmode_mutex); -static u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg) +struct omap_mux_partition * omap_mux_get(const char *name) +{ + struct omap_mux_partition *partition; + + list_for_each_entry(partition, &mux_partitions, node) { + if (!strcmp(name, partition->name)) + return partition; + } + + return NULL; +} + +u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg) { if (partition->flags & OMAP_MUX_REG_8BIT) return __raw_readb(partition->base + reg); @@ -57,7 +69,7 @@ static u16 omap_mux_read(struct omap_mux_partition *partition, u16 reg) return __raw_readw(partition->base + reg); } -static void omap_mux_write(struct omap_mux_partition *partition, u16 val, +void omap_mux_write(struct omap_mux_partition *partition, u16 val, u16 reg) { if (partition->flags & OMAP_MUX_REG_8BIT) @@ -66,7 +78,7 @@ static void omap_mux_write(struct omap_mux_partition *partition, u16 val, __raw_writew(val, partition->base + reg); } -static void omap_mux_write_array(struct omap_mux_partition *partition, +void omap_mux_write_array(struct omap_mux_partition *partition, struct omap_board_mux *board_mux) { while (board_mux->reg_offset != OMAP_MUX_TERMINATOR) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index dad32f6..6656043 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -186,6 +186,40 @@ u16 omap_mux_get_gpio(int gpio); void omap_mux_set_gpio(u16 val, int gpio); /** + * omap_mux_get() - get a mux partition by name + * @name: Name of the mux partition + * + */ +struct omap_mux_partition * omap_mux_get(const char *name); + +/** + * omap_mux_read() - read mux register + * @partition: Mux partition + * @mux_offset: Offset of the mux register + * + */ +u16 omap_mux_read(struct omap_mux_partition *p, u16 mux_offset); + +/** + * omap_mux_write() - write mux register + * @partition: Mux partition + * @val: New mux register value + * @mux_offset: Offset of the mux register + * + * This should be only needed for dynamic remuxing of non-gpio signals. + */ +void omap_mux_write(struct omap_mux_partition *p, u16 val, u16 mux_offset); + +/** + * omap_mux_write_array() - write an array of mux registers + * @partition: Mux partition + * @board_mux: Array of mux registers terminated by MAP_MUX_TERMINATOR + * + * This should be only needed for dynamic remuxing of non-gpio signals. + */ +void omap_mux_write_array(struct omap_mux_partition *p, struct omap_board_mux *board_mux); + +/** * omap2420_mux_init() - initialize mux system with board specific set * @board_mux: Board specific mux table * @flags: OMAP package type used for the board -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html