Date: Mon, 28 Oct 2019 20:19:52 +0100 From: Milan Obuch <freebsd-hackers@dino.sk> To: Oleksandr Tymoshenko <gonzo@bluezbox.com> Cc: freebsd-hackers@freebsd.org, Oliver Pinter <oliver.pinter@hardenedbsd.org> Subject: Re: UART driver as kld - how? Message-ID: <20191028201952.20a92307@zeta.dino.sk> In-Reply-To: <20191028191005.GA89835@bluezbox.com> References: <20191027214209.712d62ca@zeta.dino.sk> <CAPQ4ffuoHRFghwo=okFoNVHw9TYdwFw_wgUxa5_rm6FqjsNVsg@mail.gmail.com> <20191027232956.28b11772@zeta.dino.sk> <20191028191005.GA89835@bluezbox.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 28 Oct 2019 12:10:05 -0700 Oleksandr Tymoshenko <gonzo@bluezbox.com> wrote: > Milan Obuch (freebsd-hackers@dino.sk) wrote: [ snip ] > > Hi, > > > > my problem is somewhere else - I am able to build kld, load and > > unload it, but in all uart_dev_xxxx.c files I saw there are no > > attach and detach function, so there must be something more to do. > > On the other side, uart_core.o is already present in kernel, but > > how should I make it work with newly loaded module? uart_bus_fdt.o > > is linked in kernel too, and there are attach and detach function, > > but how can my tables be added in list for it? > > From what I see in source code, UART drivers with FDT support are > tied to the UART subsystem using UART_FDT_CLASS_AND_DEVICE macro, > that adds compat data (list of compatible strings for the driver > with pointer to respective uart_class instance) to > uart_fdt_class_and_device_set dataset. This dataset is then traversed > by uart_fdt_find_device in uart_fdt_probe function. > > You need: > > - Add FDT node to device tree, with unique compatible property value > and "status" property set to "okay" > - In you driver do something like: > > static struct ofw_compat_data compat_data[] = { > {"xlnx,axilite", (uintptr_t)&uart_axilite_class}, > {NULL, (uintptr_t)NULL}, > }; > UART_FDT_CLASS_AND_DEVICE(compat_data); > > xlnx,axilite in this case is just something I've just made up, you > need to get the value from the vendor's DTS bindings documentation. > Hi, I found uart_dev_snps.c being somewhat near what I need. I am trying to extract necessary bits from this and other files (what you wrote is just one bit), it seems our docs are lacking in this area. Regards, Milan
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191028201952.20a92307>