All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Stefan Kisdaroczi <kisda@domain.hid>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] RFC: 16550A pci serial board support
Date: Tue, 04 Jan 2011 20:49:59 +0100	[thread overview]
Message-ID: <4D2379E7.6050307@domain.hid> (raw)
In-Reply-To: <4D23435B.70603@domain.hid>

Stefan Kisdaroczi wrote:
> Hi,
> 
> the attached patch adds pci support to the 16550A serial driver. I have
> a Moxa CP-132 board and the first tests are looking good. If there is a
> chance to get the patch applied I kindly request you to review it. I'll
> add support for more Moxa boards if there is a interest to apply the patch.
> 
> thanks
> Stefan

Looks fine to me, however, nit-picking a bit, could we do this differently:

+static const struct rt_16550_pci_board rt_16550_pci_boards[] = {
+/*  0 */ { 0 },
+/*  1 */ { "Moxa C104H/PCI",	2, 4, 8, 921600, 16 },
+/*  2 */ { "Moxa C168H/PCI",	2, 8, 8, 921600, 16 },
+/*  3 */ { "Moxa CP-114",	2, 4, 8, 921600, 16 },
+/*  4 */ { "Moxa CP-132",	2, 2, 8, 921600, 16 },
+};
+
+/* driver_data correspond to the line in the structure above */
+DEFINE_PCI_DEVICE_TABLE( rt_16550_pci_tbl ) = {
+#if defined(CONFIG_XENO_DRIVERS_16550A_PCI_MOXA)
+	{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104),  .driver_data = 1 },
+	{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C168),  .driver_data = 2 },
+	{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114), .driver_data = 3 },
+	{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132), .driver_data = 4 },
+#endif
+	{ 0 }
+};

For instance:

static const struct rt_16550_pci_board rt_16550_moxa_c104 = {
	.name = "Moxa C104H/PCI",
	.resource_base_addr = 2,
	.nports = 4,
	.port_ofs = 8,
	.baud_base = 921600,
	.tx_fifo = 16,
};

/* ... */

DEFINE_PCI_DEVICE_TABLE( rt_16550_pci_tbl ) = {
#if defined(CONFIG_XENO_DRIVERS_16550A_PCI_MOXA)
	{ PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_C104),  .driver_data = &rt_16550_moxa_c104 },

/* ... */
};

static int __devinit rt_16550_pci_probe(       struct pci_dev *pdev,
					 const struct pci_device_id *ent )
{
	struct rt_16550_pci_board *board;
	int err;
	int i;
	int port = 0;
	int base_addr;
	int max_devices = 0;

	if (!ent->driver_data)
		return -ENODEV;

	board = (struct rt_16550_pci_board *)ent->driver_data;


> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 
                                                                Gilles.


  reply	other threads:[~2011-01-04 19:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-04 15:57 [Xenomai-help] RFC: 16550A pci serial board support Stefan Kisdaroczi
2011-01-04 19:49 ` Gilles Chanteperdrix [this message]
2011-01-05 19:40   ` Stefan Kisdaroczi
2011-01-05 19:55     ` Jan Kiszka
2011-01-05 20:07       ` Gilles Chanteperdrix
2011-01-05 20:18         ` Jan Kiszka
2011-01-05 22:03       ` Stefan Kisdaroczi
2011-01-07  8:28         ` Jan Kiszka
2011-01-07 22:21           ` Stefan Kisdaroczi
2011-01-07 23:04             ` Gilles Chanteperdrix

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=4D2379E7.6050307@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=kisda@domain.hid \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.