Re: Problem with SPI on S3C2412

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

 



On Wed, Nov 04, 2009 at 07:14:46PM +0300, Rusev wrote:
> José Miguel Gonçalves wrote:
> > Ben,
> >
> > I attach the current patch that I use for my machine. The machine is a
> > SX-560 module from Silex (
> > http://www.silexeurope.com/en/home/products/embedded-modules/sx-560.html
> > ).
> >
> > Meanwhile I think I've spotted the (first) problem. In
> > arch/arm/mach-s3c2412/s3c2412.c the SPI device is renamed
> > "s3c2412-spi" (it was set in arch/arm/plat-s3c24xx/devs.c with
> > "s3c2410-spi") but the spi_s3c24xx driver expects a platform driver
> > named "s3c2410-spi", so it fails to initialize.
> Do you mean a different name? Yes that's may be the cause of all that.!
> 
> The function matching platfrom_devic-es to their drivers just comparing
> the names due to decide to the probe function of which drived to feed
> the instance of platfrom_device

Yes, this seems to eb something people have missed for a while, will sort
it out soon.
 
> > Commenting the driving renaming I get a little bit further:
> >
> > s3c2410-spi s3c2410-spi.0: No platform data supplied
> > s3c2410-spi: probe of s3c2410-spi.0 failed with error -2
> > modprobe: failed to load module spi_s3c24xx: No such device
> >
> > Now it seems I need some architecture dependent initialization, correct?
> looks like you are right...
> your arcg/arm/s3c2410/<your_board>.c have to register platform_device
> s3c_device_spi0,
> and this device have to hav epointer to platfrom_data to be properly set.
> 
> The platfrom_data is something which the S3Cxxx SPI driver knows about.
> Something likes this:
> 
> struct sc3_spi_platform_data {
>     int base_addr;
>     int irq_num;
>     int min_clk_freq;
>     int max_clk_freq;
>     int enable_puuldown;
>     int what_ever_driver_needs_to_kow_due_to_use_SPI_controller;
> 
> }

Not even close, you're adding stuff in there that is passed via the
platform device resources as well as stuff that is currently part of
the spi device specific information.
 
> The SPI driver probe function casts the "priv" pointer of platfrom
> device to (struct sc3_spi_platform_data*) and uses all that fields above.
> See in the probe function of the drivver and find out what it needs.
 
> The things likes base_addr and irq_num should correspond of the real
> construction of your processor and board.
> You either need to consult the data sheet or set all that fields
> manually bu yourself.

utter rubbish. you clearly (a) didn't bother to go and look at the
real platform data and (b) don't understand how the platform device
resource system works with the resources that can be passed around
with platform devices.
 
> You can declare instance of struct sc3_spi_platform_data as statio
> variable inside the file where the platfrom_device is added
> 
> 
> If the driver is renamed verify that other driver uses the same
> declaration of private platfrom_data  structure   (in my example struct
> sc3_spi_platform_data),
> and uses it's fields for the same purpose.

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.


_______________________________________________
linux-arm mailing list
linux-arm@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/linux-arm


[Index of Archives]     [Linux ARM]     [Linux ARM MSM]     [Linux ARM Kernel]     [Fedora ARM]     [Linux ARM MSM]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux