是否可以在一个平台驱动程序(设备树节点)中使用多个不同的平台设备

发布于 2025-02-13 13:21:32 字数 894 浏览 1 评论 0原文

我正在为Beaglebone撰写内核驱动程序c。我的作业:编写一个UART驱动程序,该驱动程序从GPYO接收数据并将其发送给用户我有设备树,我必须使用两个平台设备: uart gpio 这是DT的摘录:

uarts{
    pinctrl-names = "default";
    pinctrl-0 = <&user_uarts_s0>;

    compatible = "serial";
:
:
&gpio_pins {
        compatible = "gpio_device";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio_pins>;
     };

我可以使用一个平台设备(下面附有代码),但是我该如何使用两个?我应该在哪里放置“ gpio_device”

static struct platform_driver serial8250_driver = {
    .driver = {
        .name = "serial",
        .owner = THIS_MODULE,
        .of_match_table = hw_match_table},
    .probe = Serial_probe,
    .remove = Serial_remove
};
static struct of_device_id hw_match_table[] =
{
        {
            .compatible = "serial",
        },
};

这是我的第一个驱动程序,所以请不要太严厉地判断并帮助我!

I am writing a kernel driver for beaglebone c. My assignment: write a uart driver that receives data from the gpyo and sends it to the user I have Device Tree and I have to use two platform devices: uart and gpio
here is an excerpt from DT:

uarts{
    pinctrl-names = "default";
    pinctrl-0 = <&user_uarts_s0>;

    compatible = "serial";
:
:
&gpio_pins {
        compatible = "gpio_device";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio_pins>;
     };

I can use one platform devices (code is attached below), but how can I use two? where should I put "gpio_device"

static struct platform_driver serial8250_driver = {
    .driver = {
        .name = "serial",
        .owner = THIS_MODULE,
        .of_match_table = hw_match_table},
    .probe = Serial_probe,
    .remove = Serial_remove
};
static struct of_device_id hw_match_table[] =
{
        {
            .compatible = "serial",
        },
};

this is my first driver so please don't judge too harshly and help me!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文