linux下的spi设备树配置,Linux kernel 有关 spi 设备树参数解析

  • Post author:
  • Post category:linux


// drivers/spi/spi.c

2772 postcore_initcall(spi_init); // spi_init

2733 static int __init spi_init(void)

2734 {

2735 int status;

2736

2737 buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL);

2738 if (!buf) {

2739 status = -ENOMEM;

2740 goto err0;

2741 }

2742

2743 status = bus_register(&spi_bus_type);

2744 if (status < 0)

2745 goto err1;

2746

2747 status = class_register(&spi_master_class);

2748 if (status < 0)

2749 goto err2;

2750

2751 if (IS_ENABLED(CONFIG_OF_DYNAMIC))

2752 WARN_ON(of_reconfig_notifier_register(&spi_of_notifier)); // 这里要注册 主机和从机

2753

2754 return 0;

2755

2756 err2:

2757 bus_unregister(&spi_bus_type);

2758 err1:

2759 kfree(buf);

2760 buf &