|
|
|
Re: Fwd: Question about SPI of S3c2410 in 2.6.14.1 KERNEL | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Sun, Aug 27, 2006 at 07:07:57PM +0800, TimFeng wrote:
> Dear all,
>
> I have some trouble in using SPI of SMDK2410 in 2.6.14 kernel. In such
> kernel, the spi register is mapped to the virsual address use the code
> below,
Upgrade to 2.6.18-rc4, there's a proper SPI core, and an driver for
the s3c2410 spi.
> /*file s3c2410.c*/
> Firstly, I add the SPI register to be mapped to virsual address:
> static struct map_desc s3c2410_iodesc[] __initdata = {
> IODESC_ENT(USBHOST),
> IODESC_ENT(CLKPWR),
> IODESC_ENT(LCD),
> IODESC_ENT(TIMER),
> IODESC_ENT(ADC),
> IODESC_ENT(WATCHDOG),
> IODESC_ENT(IIS),
> IODESC_ENT(SPI), /*make SPI to be mapped*/
> };
Nope, this is only for items that are _shared_ between various
places in the kernel!
> and add the spi to the device list
> /*File mach-smdk2410.c*/
>
> static struct platform_device *smdk2410_devices[] __initdata = {
> &s3c_device_usb,
> &s3c_device_lcd,
> &s3c_device_wdt,
> &s3c_device_i2c,
> &s3c_device_iis,
> &s3c_device_spi0,
> // &s3c_device_spi1,
> &s3c_device_nand,
> };
>
>
> Secondly, when I access the SPI register using the virsual address
> S3C24XX_VA_SPI or use probe function as follow:
> static int s3c2410_spi_probe(struct device *dev)
> {
> struct platform_device *pdev = to_platform_device(dev);
> struct resource *res;
> int ret;
> static struct resource *s3c2410_spi0_mem;
>
>
> printk("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev);
>
> /* get the memory region */
> res = pdev->resource;
> s3c2410_spi0_mem = request_mem_region(res->start, res->end-res->start+1,
> pdev->name);
>
> if (s3c2410_spi0_mem == NULL) {
> printk( "failed to reserve memory region\n");
> ret = -1;
> goto exit_err;
> }
>
> s3c2410_spi0_base = ioremap(res->start, res->end - res->start + 1);
> if (s3c2410_spi0_base == NULL) {
> printk("failed ioremap()\n");
> ret = -1;
> goto exit_err;
> }
> printk("s3c2410_rtc_base=%p\n", s3c2410_spi0_base);
> printk("PADDR=%x,size=%x\n", s3c2410_spi0_mem->start,
> s3c2410_spi0_mem->end-s3c2410_spi0_mem->start+1);
> printk("rSPCON0-- is %x\n", readl((0x0) + s3c2410_spi0_base));
> printk("rSPSTA0-- is %x\n", readl((0x4) + s3c2410_spi0_base));
> printk("rSPPIN0-- is %x\n", readl((0x8) + s3c2410_spi0_base));
> printk("rSPPRE0-- is %x\n", readl((0xc) + s3c2410_spi0_base));
>
>
> return 0;
>
> exit_err:
> printk("error %d during initialisation\n", ret);
>
> return ret;
> }
> the printk result is:
>
> s3c2410_rtc_base=c1910000
> PADDR=59000000,size=20
> rSPCON0-- is 0
> rSPSTA0-- is 1
> rSPPIN0-- is 0
> rSPPRE0-- is 0
>
> But I found something is very strang,the reset value of rSPPIN0 should be
> 0x00000002 . But now what the value I get is wrong. And when I try to write
> to these
> regester above, but fail, value of such register can not be modify. The
> same
> situation happen when I directory use the visual address But in the loader
> or when system init I can modify the register.
> The same situation happens when I use the S3C24XX_VA_SPI to read/wiret
> the register.
I expect you've forgotten to enable the clock to the relevant spi
unit.
--
Ben
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
[Linux ARM (vger)] [Linux Omap] [Linux Arm] [Fedora ARM] [eCos] [Gcc Help] [Git] [DCCP] [IETF Announce] [Security] [PDAs] [Linux] [Linux Book List] [Linux MIPS] [Yosemite Campsites] [Photos]
![]() |
|