Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Nov 2019 08:43:14 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>, Milan Obuch <freebsd-hackers@dino.sk>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: UART driver as kld - how?
Message-ID:  <b7ddc97daa323edb12fa0a9f35a547c245434bc6.camel@freebsd.org>
In-Reply-To: <CANCZdfoJV1s%2B9pfMvR-C5N9nDKeQe6o718zdpNjOQXzRAuydrw@mail.gmail.com>
References:  <20191027214209.712d62ca@zeta.dino.sk> <CAPQ4ffuoHRFghwo=okFoNVHw9TYdwFw_wgUxa5_rm6FqjsNVsg@mail.gmail.com> <20191027232956.28b11772@zeta.dino.sk> <20191028191005.GA89835@bluezbox.com> <20191028201952.20a92307@zeta.dino.sk> <20191102214100.500ba493@zeta.dino.sk> <20191103042321.GA49790@bluezbox.com> <20191103130118.36fa6eec@zeta.dino.sk> <20191104122816.63647120@zeta.dino.sk> <CANCZdfoJV1s%2B9pfMvR-C5N9nDKeQe6o718zdpNjOQXzRAuydrw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2019-11-04 at 08:32 -0700, Warner Losh wrote:
> On Mon, Nov 4, 2019 at 4:35 AM Milan Obuch <freebsd-hackers@dino.sk> wrote:
> 
> > On Sun, 3 Nov 2019 13:01:18 +0100
> > Milan Obuch <freebsd-hackers@dino.sk> wrote:
> > 
> > > On Sat, 2 Nov 2019 21:23:21 -0700
> > > Oleksandr Tymoshenko <gonzo@bluezbox.com> wrote:
> > > 
> > > > Milan Obuch (freebsd-hackers@dino.sk) wrote:
> > 
> > 
[...]
> > > Back to testing... probe function now does work, so I am going to
> > > analyze what should be done in attach... and why I am getting now
> > > panic... I'll write again when I find another obstacle I do not
> > > understand or I have working driver, whatever comes first :)
> > > 
> > 
> > Now I am getting further... attach works now, device nodes expected are
> > being created, but there are some warnings mentioning locks on detach.
> > Also, my hardware design currently does not use interrupts. Do we have
> > any example of uart device being polled?
> > 
> 
> All UARTS have interrupts. It's the nature of UARTS. At least that's the
> nature of the model that uart(4) uses: there's a number of conditions that
> we notice from time to time and make a note in the ipend mask so that we
> can call uart specific code later to deal with that condition. Your system
> may not connect those uart signals to a system interrupt, but the internal
> model is the same.
> 
> I'd just use callouts to poll. Then call what would be the interrupt
> routines from there. Since we have a separation between noting a condition
> and processing it, that should work well. However, I'd also expect issues
> at higher data rates unless you have very deep FIFOs and some kind of
> hardware-assist for flow control.
> 

Polling support is built into uart(4) already.  Just set
debug.uart_force_poll=1 in loader.conf or via sysctl.  You can also set
debug.uart_poll_freq (default is 50hz).

-- Ian






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b7ddc97daa323edb12fa0a9f35a547c245434bc6.camel>