Dom Storey <dstorey%40barossafarm.com>
[2010-02-28 07:08:38]:
> This location should be done in the probe routine of the driver. Yet on
all
> the other drivers I have examined, I can't see how they locate specific
> locations in memory.
Take a look at Matthieu's patches[1], for example at his 0006-ts72xx_ts_ser1.patch.
> Most drivers seem to have
>
> r_data = platform_get_resource(pdev, IORESOURCE_MEM, 0);
but to use this, you would need to define resource first:
static struct resource ts72xx_mydrv_resources[] = {
{
.start = TS72XX_PC104_8BIT_IO_PHYS_BASE,
.end = TS72XX_PC104_8BIT_IO_PHYS_BASE + TS72XX_PC104_8BIT_IO_SIZE,
.flags = IORESOURCE_MEM,
}
then assign the resource to your platform_device:
static struct platform_device ts72xx_mydrv_device = {
.resource = ts72xx_mydrv_resources,
.num_resources = ARRAY_SIZE(ts72xx_mydrv_resources),
}
then register it:
platform_device_register(&ts72xx_mydrv_device);
and now you can do:
mem_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
But I think, that you can do it easily using ioremap, __raw{read, write}b as
Matthieu is doing in his ts_ser1 driver.
1. http://mcrapet.free.fr/
-- ynezz