From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Kevin Cernekee <cernekee@gmail.com>
Cc: alan@linux.intel.com, gregkh@linuxfoundation.org, jslaby@suse.cz,
linux-serial@vger.kernel.org
Subject: Re: [PATCH 3/3] serial: rp2: New driver for Comtrol RocketPort 2 cards
Date: Fri, 28 Dec 2012 10:56:52 +0000 [thread overview]
Message-ID: <20121228105652.5cd35ef2@pyramind.ukuu.org.uk> (raw)
In-Reply-To: <10876da5ca515a76207af4fe303f1e43@localhost>
> - Systems that have a combination of RocketPort 1 + RocketPort 2 cards
> (the PCI ID table in rocket.c actually matches anything with Comtrol's
> vendor ID)
In which case that will need updating to only include the identifiers for
the original rocket port, or ensuring that if it sees an rp2 it returns
an error on the probe so the other probe occurs. The first is probably
preferable as it avoids an un-needed driver load.
> +static const u8 rp2_ucode[] = {
> + 0xF6, 0x8B, 0xE2, 0x86, 0x30, 0x40, 0x66, 0x19, 0x0A, 0x31, 0x40, 0x67,
> + 0x19, 0x0A, 0x86, 0x01, 0x40, 0x11, 0x19, 0x0A, 0x00, 0x40, 0x13, 0x19,
> + 0x0A, 0xFA, 0x83, 0x01, 0x0A, 0x00, 0x0A, 0x41, 0xFF, 0x89, 0xC2, 0x66,
> + 0x86, 0x81, 0x91, 0x40, 0x65, 0x8E, 0x89, 0xC2, 0x66, 0x86, 0x81, 0x88,
> + 0x40, 0x65, 0x85, 0x84, 0x00, 0x82, 0x0A, 0x08, 0x0A, 0x0A, 0x0A, 0x0A,
> + 0x0A, 0x08, 0x0A,
> +};
If that is firmware so is actually code executed by the hardware on the
RocketPort 2 then it should be dynamically loaded with request_firmware.
That is preferred as it avoids some potential licence funnies with GPLv2
> +static void rp2_rx_chars(struct rp2_uart_port *up)
> +{
> + u16 bytes = readw(up->base + RP2_RX_FIFO_COUNT);
> + struct tty_struct *tty = up->port.state->port.tty;
You need to take a reference here and allow for tty being NULL so
tty = tty_port_tty_get(&up->port.state->port);
if (tty)
> + tty_flip_buffer_push(tty);
tty_kref_put()
(you may need to flush the bytes to clear the interrupt in the tty == NULL
case). This allows for a parallel close/hangup clearing the tty and
ensures the tty itself won't be deleted until your tty_kref_put
> +static inline void rp2_flush_fifos(struct rp2_uart_port *up)
> +{
> + rp2_rmw_set(up, RP2_UART_CTL,
> + RP2_UART_CTL_FLUSH_RX_m | RP2_UART_CTL_FLUSH_TX_m);
> + udelay(10);
> + rp2_rmw_clr(up, RP2_UART_CTL,
> + RP2_UART_CTL_FLUSH_RX_m | RP2_UART_CTL_FLUSH_TX_m);
> +}
This looks wrong. A writel can be posted by the PCI bridge. That means it
may occur after the udelay(10) finishes. However it cannot pass another
read to the same device.
You probably want
rp2_rmw_set(....)
readl(some harmless register)
udelay(10);
rpm2_rmw_clr(....)
> +static void rp2_reset_asic(struct rp2_card *card, unsigned int asic_id)
> +{
> + void __iomem *base = card->bar1 + RP2_ASIC_OFFSET(asic_id);
> + u32 clk_cfg;
> +
> + writew(1, base + RP2_GLOBAL_CMD);
> + msleep(100);
> + writel(0, base + RP2_CLK_PRESCALER);
Same problem here
> +static void rp2_init_port(struct rp2_uart_port *up)
> +{
> + int i;
> +
> + writel(RP2_UART_CTL_RESET_CH_m, up->base + RP2_UART_CTL);
> + udelay(1);
> +
> + writel(0, up->base + RP2_TXRX_CTL);
> + writel(0, up->base + RP2_UART_CTL);
> + udelay(1);
And probably here
Alan
next prev parent reply other threads:[~2012-12-28 10:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-27 4:43 [PATCH 1/3] tty: Fix comments that reference BKL, eventd, old paths Kevin Cernekee
2012-12-27 4:43 ` [PATCH 2/3] tty: Update serial core API documentation Kevin Cernekee
2012-12-28 10:46 ` Alan Cox
2012-12-27 4:43 ` [PATCH 3/3] serial: rp2: New driver for Comtrol RocketPort 2 cards Kevin Cernekee
2012-12-28 10:56 ` Alan Cox [this message]
2012-12-28 10:45 ` [PATCH 1/3] tty: Fix comments that reference BKL, eventd, old paths Alan Cox
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=20121228105652.5cd35ef2@pyramind.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=alan@linux.intel.com \
--cc=cernekee@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-serial@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).