Skip to content

Commit

Permalink
ARM: OMAP2+: Add quirks support for n8x0
Browse files Browse the repository at this point in the history
This allows us to keep things working when booted with
device tree. Note that we still need to initialize most
things with platform data as the drivers are lacking
support for device tree.

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Tony Lindgren committed Nov 25, 2013
1 parent 810ac2a commit fa590c9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
23 changes: 21 additions & 2 deletions arch/arm/mach-omap2/board-n8x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ static void n8x0_mmc_cleanup(struct device *dev)
* MMC controller2 is not in use.
*/
static struct omap_mmc_platform_data mmc1_data = {
.nr_slots = 2,
.nr_slots = 0,
.switch_slot = n8x0_mmc_switch_slot,
.init = n8x0_mmc_late_init,
.cleanup = n8x0_mmc_cleanup,
Expand Down Expand Up @@ -596,12 +596,13 @@ static void __init n8x0_mmc_init(void)
}
}

mmc1_data.nr_slots = 2;
mmc_data[0] = &mmc1_data;
if (!of_have_populated_dt())
omap242x_init_mmc(mmc_data);
}
#else

static struct omap_mmc_platform_data mmc1_data;
void __init n8x0_mmc_init(void)
{
}
Expand Down Expand Up @@ -746,6 +747,24 @@ static int __init n8x0_late_initcall(void)
}
omap_late_initcall(n8x0_late_initcall);

/*
* Legacy init pdata init for n8x0. Note that we want to follow the
* I2C bus numbering starting at 0 for device tree like other omaps.
*/
void * __init n8x0_legacy_init(void)
{
board_check_revision();
spi_register_board_info(n800_spi_board_info,
ARRAY_SIZE(n800_spi_board_info));
i2c_register_board_info(0, n8x0_i2c_board_info_1,
ARRAY_SIZE(n8x0_i2c_board_info_1));
if (board_is_n810())
i2c_register_board_info(1, n810_i2c_board_info_2,
ARRAY_SIZE(n810_i2c_board_info_2));

return &mmc1_data;
}

static void __init n8x0_init_machine(void)
{
board_check_revision();
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-omap2/common-board-devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ struct ads7846_platform_data;

void omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
struct ads7846_platform_data *board_pdata);
void *n8x0_legacy_init(void);

#endif /* __OMAP_COMMON_BOARD_DEVICES__ */
16 changes: 16 additions & 0 deletions arch/arm/mach-omap2/pdata-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ struct pdata_init {
void (*fn)(void);
};

struct of_dev_auxdata omap_auxdata_lookup[];

/*
* Create alias for USB host PHY clock.
* Remove this when clock phandle can be provided via DT
Expand Down Expand Up @@ -68,6 +70,15 @@ static inline void legacy_init_wl12xx(unsigned ref_clock,
}
#endif

#ifdef CONFIG_MACH_NOKIA_N8X0
static void __init omap2420_n8x0_legacy_init(void)
{
omap_auxdata_lookup[0].platform_data = n8x0_legacy_init();
}
#else
#define omap2420_n8x0_legacy_init NULL
#endif

#ifdef CONFIG_ARCH_OMAP3
static void __init hsmmc2_internal_input_clk(void)
{
Expand Down Expand Up @@ -130,6 +141,11 @@ void omap_pcs_legacy_init(int irq, void (*rearm)(void))
* the dev entries in of_platform_populate().
*/
static struct pdata_init auxdata_quirks[] __initdata = {
#ifdef CONFIG_SOC_OMAP2420
{ "nokia,n800", omap2420_n8x0_legacy_init, },
{ "nokia,n810", omap2420_n8x0_legacy_init, },
{ "nokia,n810-wimax", omap2420_n8x0_legacy_init, },
#endif
{ /* sentinel */ },
};

Expand Down

0 comments on commit fa590c9

Please sign in to comment.