From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Parker Newman <parker@finest.io>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
Parker Newman <pnewman@connecttech.com>
Subject: Re: [PATCH v4 6/7] serial: exar: add CTI specific setup code
Date: Thu, 18 Apr 2024 19:29:44 +0300 (EEST) [thread overview]
Message-ID: <8c91f3a5-e124-aa28-06bb-2e6a699d4998@linux.intel.com> (raw)
In-Reply-To: <20240418102153.554d56ba@SWDEV2.connecttech.local>
[-- Attachment #1: Type: text/plain, Size: 4014 bytes --]
On Thu, 18 Apr 2024, Parker Newman wrote:
> On Thu, 18 Apr 2024 16:20:15 +0300 (EEST)
> Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> wrote:
>
> > On Wed, 17 Apr 2024, Parker Newman wrote:
> > > From: Parker Newman <pnewman@connecttech.com>
> > >
> > > This is a large patch but is only additions. All changes and removals
> > > are made in previous patches in this series.
> > >
> > > - Add CTI board_init and port setup functions for each UART type
> > > - Add CTI_EXAR_DEVICE() and CTI_PCI_DEVICE() macros
> > > - Add support for reading a word from the Exar EEPROM.
> > > - Add support for configuring and setting a single MPIO
> > > - Add various helper functions for CTI boards.
> > > - Add osc_freq to struct exar8250
> > >
> > > Signed-off-by: Parker Newman <pnewman@connecttech.com>
> > > @@ -192,11 +252,201 @@ struct exar8250_board {
> > >
> > > struct exar8250 {
> > > unsigned int nr;
> > > + unsigned int osc_freq;
> > > struct exar8250_board *board;
> > > void __iomem *virt;
> > > int line[];
> > > };
> > >
> > > +static inline void exar_write_reg(struct exar8250 *priv,
> > > + unsigned int reg, u8 value)
> > > +{
> > > + writeb(value, priv->virt + reg);
> > > +}
> > > +
> > > +static inline u8 exar_read_reg(struct exar8250 *priv, unsigned int reg)
> > > +{
> > > + return readb(priv->virt + reg);
> > > +}
> >
> > I tried to understand what is going on with this priv->virt in 8250_exar
> > in general and why it exists but I failed. It seems to BAR0 is mapped
> > there but also serial8250_pci_setup_port() does map the same BAR and
> > sets it up into the usual place in membase.
> >
>
> Exar PCI/PCIe UARTs have global configuration registers from 0x80-0x9B.
> These registers are for reading the EEPROM, configuring the MPIO, etc.
> As these registers are only at 0x80, and not port specific, the driver maps
> BAR0 to priv->virt for accessing them.
Okay, thanks for explaining. The naming & lack of comments wasn't exactly
making it easy to follow this bit (this is not your fault in anyway but
a pre-existing problem in the driver's code).
I've a follow up question now that it's confirmed they're different,
see below...
> > > + exar_write_reg(priv, (offset + UART_EXAR_8XMODE), 0x00);
> > > + exar_write_reg(priv, (offset + UART_EXAR_FCTR), UART_FCTR_EXAR_TRGD);
> > > + exar_write_reg(priv, (offset + UART_EXAR_TXTRG), 128);
> > > + exar_write_reg(priv, (offset + UART_EXAR_RXTRG), 128);
> >
> > Unnecessary parenthesis.
> > > + exar_write_reg(priv, (offset + UART_EXAR_8XMODE), 0x00);
> > > + exar_write_reg(priv, (offset + UART_EXAR_FCTR), UART_FCTR_EXAR_TRGD);
> > > + exar_write_reg(priv, (offset + UART_EXAR_TXTRG), 32);
> > > + exar_write_reg(priv, (offset + UART_EXAR_RXTRG), 32);
> >
> > Unnecessary parenthesis.
> >
>
> I will fix these in my cleanup patches.
Based on the wording in your response, I'm not sure you got this right. It
is code you're adding in this patch so the parenthesis should be removed
from this change so they never appear in the commit history.
> > I recommend you add a helper for this as it is repeated twice. Are the
> > values 32 and 128 literal or do they have some specific meaning? If the
> > latter case, they should be using named defines (this likely applies to
> > the existing trigger code in the driver too).
> >
> >
>
> They are the FIFO trigger levels so they are literally 128 and 32.
Okay, no problem then if its 128 characters and 32 characters.
> These 4 writes come from Exar's out-of-tree driver and are in
> pci_xr17v35x_setup() and some other vendor specific functions.
>
> I am not sure why/if these are needed.
...So the follow-up question. I see the existing code in
pci_fastcom335_setup() and pci_xr17v35x_setup() writes into membase
based address but your code uses exar_write_reg() which is priv->virt
based. Is this difference intentional?
--
i.
next prev parent reply other threads:[~2024-04-18 16:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 20:31 [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Parker Newman
2024-04-17 20:31 ` [PATCH v4 1/7] serial: exar: remove old Connect Tech setup Parker Newman
2024-04-17 20:31 ` [PATCH v4 2/7] serial: exar: added a exar_get_nr_ports function Parker Newman
2024-04-18 11:32 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 3/7] serial: exar: add optional board_init function Parker Newman
2024-04-18 11:32 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 4/7] serial: exar: moved generic_rs485 further up in 8250_exar.c Parker Newman
2024-04-18 11:37 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 5/7] serial: exar: add CTI cards to exar_get_nr_ports Parker Newman
2024-04-18 11:43 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 6/7] serial: exar: add CTI specific setup code Parker Newman
2024-04-18 5:29 ` kernel test robot
2024-04-18 5:42 ` Greg Kroah-Hartman
2024-04-18 13:20 ` Ilpo Järvinen
2024-04-18 14:21 ` Parker Newman
2024-04-18 16:29 ` Ilpo Järvinen [this message]
2024-04-18 17:03 ` Parker Newman
2024-04-18 17:25 ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 7/7] serial: exar: fix checkpach warnings Parker Newman
2024-04-18 6:25 ` [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Greg Kroah-Hartman
2024-04-18 12:40 ` Parker Newman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c91f3a5-e124-aa28-06bb-2e6a699d4998@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=parker@finest.io \
--cc=pnewman@connecttech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox