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

Re: [microblaze-uclinux] drivers/mtd/chips/jedec_probe.c MTD M25P16 SPI Flash Problems



Hi John,


> Upon removing the XILINX_VIRTEX dependency, you've oprobably got now an 
> option under drivers->SPI submenu to choose xilinx-spi.  Enable that, 
> and rebuild.
> 

I removed the dependency and was able to choose Xilinx SPI within SPI submenu. Therefore I uncommented also the line

"config SPI_MASTER"

in /drivers/spi/Kconfig which was commented before. Building the image.bin then was possible. 


> Finally, you'll need to create a new file in 
> arch/microblaze/platform/common, to create a platform device initialiser 
> for the device.  You can see the pattern from the xgpio.c, xuarlite.c 
> and friends.
> 
> You'll want to create a new platform device with name "xilinx_spi" so it 
> is picked up by the driver at boot time.
> 


I created a platform device initialiser (xilspi.c) which is very similar to xgpio.c and xuarlite.c. I derived it from the existing file xspi.c by removing and modifying some lines. This file is posted below:   

***************************************************************
/*
* arch/microblaze/platform/common/xilspi.c
*
* platform device initialisation for Xilinx SPI devices
*
* Based on arch/microblaze/platform/common/xspi.c
*/

#include <linux/autoconf.h>
#include <linux/init.h>
#include <linux/resource.h>
#include <linux/xilinx_devices.h>
#include <linux/serial_8250.h>


#define XSPI_PLATFORM_DEVICE_INITIALISER(n)                \
{                                                        \
        .name = "xilinx_spi",                                \
        .id = (n),                                        \
        .dev.platform_data = 0,                \
        .num_resources = 2,                                \
        .resource = (struct resource[]) {                \
                {                                        \
                        .start        = CONFIG_XILINX_SPI_##n##_BASEADDR,        \
                        .end        = CONFIG_XILINX_SPI_##n##_HIGHADDR,        \
                        .flags        = IORESOURCE_MEM                        \
                },                                                        \
                {                                                        \
                        .start        = CONFIG_XILINX_SPI_##n##_IRQ,                \
                        .end        = CONFIG_XILINX_SPI_##n##_IRQ,                \
                        .flags        = IORESOURCE_IRQ                        \
                }                                        \
        }                                                \
}

static struct platform_device xilinx_spi_device[] = {
#ifdef CONFIG_XILINX_SPI_0_INSTANCE
XSPI_PLATFORM_DEVICE_INITIALISER(0),
#endif
#ifdef CONFIG_XILINX_SPI_1_INSTANCE
XSPI_PLATFORM_DEVICE_INITIALISER(1),
#endif
#ifdef CONFIG_XILINX_SPI_2_INSTANCE
XSPI_PLATFORM_DEVICE_INITIALISER(2),
#endif
};

static int __init xspi_platform_init(void)
{
        int i;

        for(i=0;i<aRRAY_SIZE(xilinx_spi_device); i++)
                platform_device_register(&xilinx_spi_device[i]);

        return 0;
}

device_initcall(xspi_platform_init);
***************************************************************

Building the image again compiles also this file and xilspi.o object file is generated also. But it seems to be not complete/correct because the SPI Flash is not detected when booting Petalinux again. What could be the reason therefore? I post you also the boot-output below so you maybe can evaluate the problem better:

Boot-Output:
***************************************************************
Found romfs @ 0x4c195000 (0x000c1000)

#### klimit 4c1a8000 ####

Moving 0x000c1000 bytes from 0x4c195000 to 0x4c1a7da0

New klimit: 0x4c269000

Linux version 2.6.20-uc0 (root@uCLinuxHost) (gcc version 3.4.1 ( PetaLinux 0.20 Build -rc1 050607 )) #92 Fri Feb 29 15:59:16 CET 2008
setup_cpuinfo: initialising
setup_cpuinfo: No PVR support in CPU.  Using static compile-time info
set_cpuinfo_static: Using static CPU info.
setup_memory: max_mapnr: 0x4ffff
setup_memory: min_low_pfn: 0x4c000
setup_memory: max_low_pfn: 0x4000
On node 0 totalpages: 16384
  DMA zone: 128 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 16256 pages, LIFO batch:3
  Normal zone: 0 pages used for memmap
Built 1 zonelists.  Total pages: 16256
Kernel command line: 
OPB INTC #0 at 0x81800000
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 62432k/65536k available
Calibrating delay loop... 32.76 BogoMIPS (lpj=163840)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 2048 bind 1024)
TCP reno registered
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
xgpio0 #0 at 0x81400000 mapped to 0x81400000 device: 10,185 not using IRQ

uartlite.0: ttyS0 at MMIO 0x84000000 (irq = 4) is a uartlite
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
eth0: using fifo mode.
eth0: No PHY detected.  Assuming a PHY at address 0.
eth0: Xilinx EMACLite #0 at 0x81000000 mapped to 0x81000000, irq=3
uclinux[mtd]: RAM probe address=0x4c1a7da0 size=0xc1000
Creating 1 MTD partitions on "RAM":
0x00000000-0x000c1000 : "ROMfs"
uclinux[mtd]: set ROMfs to be root filesystem index=0
block2mtd: version $Revision: 1.30 $
i8042.c: i8042 controller self test timeout.
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
VFS: Mounted root (cramfs filesystem) readonly.
Freeing unused kernel memory: 92k freed
Mounting proc: 
Mounting var: 
Populating /var: 
Running local start scripts.
Mounting /etc/config: 
Populating /etc/config: 
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 5 configuration files (387 bytes)
Mounting sysfs:
Setting hostname: 
Setting up interface lo: 
Setting up interface eth0: 

petalinux login: root
Password: 
# ls
bin   dev   etc   home  lib   mnt   proc  sys   tmp   usr   var
# cd dev
# ls
console     mtd14       mtdblock3   mtdr5       ptypa       ttyp4
fb0         mtd2        mtdblock4   mtdr6       ptypb       ttyp5
flash       mtd3        mtdblock5   mtdr7       ptypc       ttyp6
gpio        mtd4        mtdblock6   mtdr8       ptypd       ttyp7
gpio0       mtd5        mtdblock7   mtdr9       ptype       ttyp8
gpio1       mtd6        mtdblock8   null        ptypf       ttyp9
gpio2       mtd7        mtdblock9   nvram       random      ttypa
gpio3       mtd8        mtdr0       ptyp0       rtc         ttypb
gpio4       mtd9        mtdr1       ptyp1       tty         ttypc
kmem        mtdblock0   mtdr10      ptyp2       ttyS0       ttypd
mem         mtdblock1   mtdr11      ptyp3       ttyS1       ttype
mtd0        mtdblock10  mtdr12      ptyp4       ttyS2       ttypf
mtd1        mtdblock11  mtdr13      ptyp5       ttyS3       urandom
mtd10       mtdblock12  mtdr14      ptyp6       ttyp0       zero
mtd11       mtdblock13  mtdr2       ptyp7       ttyp1
mtd12       mtdblock14  mtdr3       ptyp8       ttyp2
mtd13       mtdblock2   mtdr4       ptyp9       ttyp3
***************************************************************

I mean the question now is, how the SPI Flash could be mapped eg. to one of the mtdblockXX blockdevices? My feeling says that I'm not far away from the solution...but I really don't know what to change exactly in order to take this final step. It would be very nice if you could give me a hint?

Thank you very much!

Best Regards,
Eldin

-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/