How to create driver for EEPROM (AT25256A) using SPI interface with LPC3250
Hi,
I am working on ARM9 based LPC3250 controller with kernel version 2.6.34 using FDI3250 board. In my board LPC3250 has interfaced with EEPROM (AT25256A) using SPI protocol.
I want to make driver for slave and want to perform read and write operations from EEPROM. For that i have made below changes in kernel
1.changes done in kernel menuconfig for SPI driver are:
Enabled device drivers -> misc devices -> EEPROM support -> SPI EEPROM from most vendors
2.Added slave registration on board file
/home/mohan/bani/projects/lpc32x0/kernel/linux-2.6.34/arch/arm/mach-lpc32xx/fdi3250.c
/* AT25 driver registration */
static int __init fdi3250_spi_devices_register(void)
{
#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
static struct spi_board_info info[] = {
{
.modalias = "spidev",
.max_speed_hz = 5000000,
.bus_num = 0,
.chip_select = 0,
.controller_data = &spi0_chip_info,
},
};
#else
static struct spi_eeprom eeprom = {
.name = "at25256a",
.byte_len = 0x8000,
.page_size = 64,
.flags = EE_ADDR2,
};
static struct spi_board_info info[] = {
{
.modalias = "at25",
.max_speed_hz = 5000000,
.bus_num = 0,
.chip_select = 0,
.platform_data = &eeprom,
.controller_data = &spi0_chip_info,
},
};
#endif
return spi_register_board_info(info, ARRAY_SIZE(info));
}
Then i have ported the uImage in kernel and after kernel booting i mount the sysfs using below commands
mkdir /sys
mount -t sysfs sysfs sys
After that i found that EEPROM folder has not created at below path
/sys/bus/spi/device/spi0.0
From the observations what i have to conclude? is driver installed successfully or not?
If not installed what other changes i have do to make install?
If installed then what could be the other problems?
Please help me.
Thanks & Regards,
MOHAMMAD BIYABANI.
|