Re: [PATCH v2 4/6] ARM: Samsung: Modify s3c64xx_spi{0|1|2}_set_platdata function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31 May 2012 19:36, Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, May 31, 2012 at 10:05:42AM +0800, Thomas Abraham wrote:
>> On 30 May 2012 18:13, Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
>> > No there isn't.  You've got things like s3c64xx_device_spi0 in
>> > arch/arm/plat-samsung/devs.c (which you'd expect since the resources
>> > that are passed in for memory mapping, DMA and interrupt vary with the
>> > SoC).  The bit of code I was querying just changes "s3c64xx-spi" to
>> > "s3c6410-spi" at runtime in that structure which seems like a waste of
>> > time.
>
>> So is the concern only with the change of device name from
>> "s3c64xx-spi" to "s3c6410-spi"? Is there any concern with changing the
>> name of the static spi platform device (s3c64xx_device_spi0/1/2) at
>> runtime which then is used to select a driver data?
>
> No, you're not getting it at all.  The changing at runtime is the
> problem, it's achieving nothing except making the code more fragile and
> obscure.  Those devices will always come out with exactly the same name
> so we should just assign that name statically.

Yes, I am not able to understand your point. So I am listing out my
understanding of the issue here. Please let me know which of these you
think needs to be changed.

1. There is one instance of 'struct platform_device' for each of the
spi controller instances (0/1/2) named "s3c64xx-spi" (in
arch/arm/plat-samsung/devs.c).

2. These instances of platform device is then statically assigned the
resources (mem/irq/dma) based on the SoC for which it is being
compiled (IRQ_SPI0, S3C_PA_SPI0, DMACH_SPI0_TX and DMACH_SPI0_RX).
These macros have different values for different SoC's.

3. Board files based on Samsung SoC's includes the static 'struct
platform_device' for spi in the list of platform devices that are
registered. Which means, the spi platform device is registered with
the name "s3c64xx-spi" for all s3c, s5p and Exynos series SoC's.

4. So, in order to use a "struct platform_device_id" table in the spi
driver (drivers/spi/spi-s3c64xx.c), the '.name' in spi's "struct
platform_device" is changed at runtime, to indicate the SoC on which
it is being used, and correspondingly, match with one of the entries
in the "struct platform_device_id" table in the driver.

5. If point 4 is not correct, the other option is to create a separate
instances of 'struct platform_device' for each of the s3c, s5p and
Exynos4/5 SoC's. Is this the correct way, and if yes, could you please
help me understand the issues in setting the name of the platform
device at runtime.

Sorry to prolong this for so long, but I want to understand your point on this.

Thanks,
Thomas.
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux