All pastes #990611 Raw Edit

Miscellany

public text v1 · immutable
#990611 ·published 2008-04-20 08:19 UTC
rendered paste body
#include <asm/arch/spi100k.h>

#define OMAP_SPI1_BASE               0xfffc0800
#define OMAP_SPI2_BASE               0xfffc1000

static struct omap_spi100k_platform_config omap_spi1_config = {
        .num_cs         = 2,
};

static struct resource omap_spi1_resources[] = {
        {
                .start          = OMAP_SPI1_BASE,
                .end            = OMAP_SPI1_BASE + 0xff,
                .flags          = IORESOURCE_MEM,
        },
};

struct platform_device omap_spi1 = {
        .name           = "omap1_spi100k",
        .id             = 1,
        .num_resources  = ARRAY_SIZE(omap_spi1_resources),
        .resource       = omap_spi1_resources,
        .dev            = {
                .platform_data = &omap_spi1_config,
        },
};

static struct omap_spi100k_platform_config omap_spi2_config = {
        .num_cs         = 2,
};

static struct resource omap_spi2_resources[] = {
        {
                .start          = OMAP_SPI2_BASE,
                .end            = OMAP_SPI2_BASE + 0xff,
                .flags          = IORESOURCE_MEM,
        },
};

struct platform_device omap_spi2 = {
        .name           = "omap1_spi100k",
        .id             = 2,
        .num_resources  = ARRAY_SIZE(omap_spi2_resources),
        .resource       = omap_spi2_resources,
        .dev            = {
                .platform_data = &omap_spi2_config,
        },
};

static void omap_init_spi100k(void)
{
        platform_device_register(&omap_spi1);
        platform_device_register(&omap_spi2);
}

#else
static inline void omap_init_spi100k(void) {}
#endif
static int __init omap1_init_devices(void)
{
        /* please keep these calls, and their implementations above,
         * in alphabetical order so they're easier to sort through.
         */

        omap_init_mbox();
        omap_init_rtc();
        omap_init_sti();
        omap_init_spi100k();

        return 0;
}