add spi slave device to device tree (MT6595 & MT6797)
时间:10-02
整理:3721RD
点击:
請問各位高手,小的最近在了解device tree的使用方法,並且想在6595跟6795上來作實驗,但是都一直失敗,希望能有高手協助。
首先我在MT6595.dtsi、MT6795.dtsi中的SPI node增加一個slave device,詳細如下。
SPI1@0x1100A000 {
compatible = "mediatek,SPI1";
reg = <0x1100A000 0x1000>;
interrupts = <0 110 0x8>;
cell-index = <0>;
#address-cells = <1>;
#size-cells = <0>;
//add a slave node
spidev{
compatible = "spidev";
reg = <0>;
};
};
並且在driver中呼叫spi_register_driver(詳細程式碼如下)。
static const struct of_device_id spidev_table[] = {
{ .compatible = "spidev", },
{},
};
MODULE_DEVICE_TABLE(of, spidev_table);
static struct spi_driver spidev_driver= {
.driver = {
.name = "spi_dev",
.owner = THIS_MODULE,
.of_match_table = spidev_table,
},
.probe = spidev_probe,
.remove = spidev_remove,
};
spi_register_driver(&spidev_driver);
結果卻沒有觸發probe事件,在adb中的/sys/class/spi_master/spi0中也沒有看到任何裝置。
希望高手指點,謝謝
首先我在MT6595.dtsi、MT6795.dtsi中的SPI node增加一個slave device,詳細如下。
SPI1@0x1100A000 {
compatible = "mediatek,SPI1";
reg = <0x1100A000 0x1000>;
interrupts = <0 110 0x8>;
cell-index = <0>;
#address-cells = <1>;
#size-cells = <0>;
//add a slave node
spidev{
compatible = "spidev";
reg = <0>;
};
};
並且在driver中呼叫spi_register_driver(詳細程式碼如下)。
static const struct of_device_id spidev_table[] = {
{ .compatible = "spidev", },
{},
};
MODULE_DEVICE_TABLE(of, spidev_table);
static struct spi_driver spidev_driver= {
.driver = {
.name = "spi_dev",
.owner = THIS_MODULE,
.of_match_table = spidev_table,
},
.probe = spidev_probe,
.remove = spidev_remove,
};
spi_register_driver(&spidev_driver);
結果卻沒有觸發probe事件,在adb中的/sys/class/spi_master/spi0中也沒有看到任何裝置。
希望高手指點,謝謝
有人知道相關的資訊嗎?^^自頂一下