Skip to contentSkip to conversation

how to initialize resource on linux 2.4

DISCUSSION Mildred Frisco 1 participant 1 message Dec 30, 2004

lore
Share & tools
lore
#0 lore raw

Hi,

I am porting for mx1 board and I am wondering how to initialize device resources or adding 'struct resource' in linux 2.4.20. In 2.6 kernel, this is done in generic.c by

--------------------------------
...
...
static struct platform_device imx_uart2_device = {

       .name           = "imx-uart",
       .id             = 1,
       .num_resources  = ARRAY_SIZE(imx_uart2_resources),
       .resource       = imx_uart2_resources,

};

static struct imxfb_mach_info imx_fb_info;

void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)

{
       memcpy(&imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info));
}

EXPORT_SYMBOL(set_imx_fb_info);

static struct resource imxfb_resources[] = {
       [0] = {
               .start  = 0x00205000,
               .end    = 0x002050FF,
               .flags  = IORESOURCE_MEM,
       },
       [1] = {
               .start  = LCDC_INT,
               .end    = LCDC_INT,
               .flags  = IORESOURCE_IRQ,
       },
};

static u64 fb_dma_mask = ~(u64)0;

static struct platform_device imxfb_device = {

       .name           = "imx-fb",
       .id             = 0,
       .dev            = {

.platform_data = &imx_fb_info,
.dma_mask = &fb_dma_mask,
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(imxfb_resources),
.resource = imxfb_resources,
};

static struct platform_device *devices[] __initdata = {
       &imx_mmc_device,
       &imxfb_device,
       &imx_uart1_device,
       &imx_uart2_device,
};

void __init
imx_map_io(void)

{
       iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
}

static int __init imx_init(void)

{
       return platform_add_devices(devices, ARRAY_SIZE(devices));
}

subsys_initcall(imx_init);

-------------------------------------------------

'struct platform_device' doesn't seem to exist in 2.4. On what part of the code should I create a 'struct resource' for a particular device so that the driver can use it?

Thanks,
Mildred