Hello.
I’m trying to bind the device driver made myself.
My Device Tree is follows:
[common.dtsi]
spi@7000d400 { /* it alias to ‘spi0’ */
status = “okay”;
reg = <0x0>;
nvidia,enable-hw-based-cs;
nvidia,rx-clk-tap-delay = <7>;
};
[eeprom-manager.dtsi]
/ {
eeprom-manager {
bus@0 {
status = “okay”;
spi_bus = <&spi0>;
compatible = “microchip,93LC56B”;
reg = <0>;
spi-max-frequency = <1000000>;
spi-cs-high;
spi-cpha;
spi-3wire;
size = <256>;
};
};
};
and my driver is follows:
include <linux/kernel.h>
include <linux/init.h>
include <linux/module.h>
include <linux/slab.h>
include <linux/delay.h>
include <linux/device.h>
include <linux/sched.h>
include <linux/platform_device.h>
include <linux/printk.h>include <linux/spi/spi.h>
include <linux/spi/eeprom.h>
include <linux/of.h>/*
- NOTE: this is an EEPROM driver. The vagaries of product naming
- mean that some 93L products are EEPROMs.
*/define DRIVER_NAME “M93LC56B”
/*
struct m93l_data {
struct spi_device * spi;
struct memory_accessor mem;
struct mutex lock;
struct spi_eeprom chip;
struct bin_attribute bin;
unsigned addrlen;
};
*/define M93L_ERASE (3)
define M93L_ERAL (0)
define M93L_EWDS (0)
define M93L_READ (2)
define M93L_WRITE (1)
define M93L_WRAL (0)/* ------------------ for DTB ---------------------------------------- */
static const struct of_device_id m93l_of_match_table = {
{
.compatible = “microchip,93LC56B”,
},
{},
} ;MODULE_DEVICE_TABLE(of, m93l_of_match_table);
static struct platform_device_id m93l_spi_idtable = {
{“M93LC56B”,0 },
{}
} ;MODULE_DEVICE_TABLE(spi, m93l_spi_idtable) ;
/* ------------------------------------------------------------------- */
static struct platform_device *spi_dev = NULL ;
static int m93l_spi_probe( struct platform_device *dev )
{
printk(“m93l_spi_probe\n”);
spi_dev = dev ;
return(0);
}static int m93l_spi_remove( struct platform_device *dev )
{
printk(“m93l_spi_remove\n”);
spi_dev = NULL;
return 0;
}/* ------- define driver function table ------------------------------- */
static struct platform_driver m93l_driver = {
.id_table = m93l_spi_idtable,
.probe = m93l_spi_probe,
.remove = m93l_spi_remove,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.pm = NULL,
.of_match_table = of_match_ptr( m93l_of_match_table ),
},
} ;
module_platform_driver(m93l_driver);MODULE_DESCRIPTION(“Microchip EEPROM via API driver.”);
MODULE_LICENSE(“GPL”);
MODULE_ALIAS(“platform:” DRIVER_NAME) ;
I think that the kernel searches my driver from Device Tree by ‘compatible’ palameter.
And It shows folder ‘/dev/’.
But now, It seems my driver is not found and loaded.
Please tell me some advices.
Thank you.