* Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 @ 2013-06-26 15:25 Angelo Butti 2013-10-15 13:48 ` Angelo Butti 0 siblings, 1 reply; 7+ messages in thread From: Angelo Butti @ 2013-06-26 15:25 UTC (permalink / raw) To: linux-serial Hi all, my name is Angelo and I have a problem with some Pericom Serial boards. This hardware is compatible to 16C550 but is not working good. Now I can workaround the problem, I understand it but I'm not able to make some patch for the serial driver inside the linux kernel. So, now I want try to explain the problems and if you can adjust the driver also for this device will be great; or if you can explain me with some example how I can do it and send to you the patch ..... Anyway, the problem is related to Pericom serial boards, pci-id: 12d8:7952 (2 serials) 12d8:7954 (4 serials) 12d8:7958 (8 serials) The first problem is related to the kind of the serial ports. This hardware can be 232-422-4852W-4854W mode, and must be set inside the PCI express registers at the offset b4h. For example if you have a 2 serial port 485-2W board, before use it you must set that register to 0xFF ( I make this with setpci command and all is ok) Te second problem, more critical for me, is the bps setting. The board that I want use have on board a 14.7456 Mhz, and there are a table inside datasheet with the configuration example and the formula to set proper bps settings. The problem is related to the standard linux driver that use the clock equal to 1.8432 MHz. So every time that I open the serial, this bps isn't correct. I must adjust it writing inside the registers (after open) to fix the problem. Is possible add this kind of board inside the standard linux driver to have a good bps setting ? En example, to set 115200bps: Standard linux driver: DLL:0x1 DLH:0x0 Pericom formula: DLL:0x8 DLH:0x0 (Ref. PI7C9X7952/4/8 (Datasheet)) Thanks, best regards Angelo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-06-26 15:25 Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 Angelo Butti @ 2013-10-15 13:48 ` Angelo Butti 2013-10-15 14:09 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Angelo Butti @ 2013-10-15 13:48 UTC (permalink / raw) To: linux-serial Hi all, I'm here again to try to solve and add support to Pericom serial devices. To solve is really simple, but I don't know if I make the correct procedure. The solution is change the clock value from 1.8432 to 14.7456. To do this I add a new setup specific for pericom devices, and I add this 3 devices inside the Master list of serial port. Now, is possible add this to the standard linux kernel, so also the Pericom device will be ok ? Below the patch for the 3.10.11 kernel .... 1311,1333d1310 < static int pci_pericom_setup(struct serial_private *priv, < const struct pciserial_board *board, < struct uart_8250_port *port, int idx) < { < unsigned int bar, offset = board->first_offset, maxnr; < < bar = FL_GET_BASE(board->flags); < if (board->flags & FL_BASE_BARS) < bar += idx; < else < offset += idx * board->uart_offset; < < maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >> < (board->reg_shift + 3); < < if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr) < return 1; < < port->port.uartclk = 14745600; < < return setup_port(priv, port, bar, offset, board->reg_shift); < } < 1850,1874d1826 < /* < * Pericom < */ < { < .vendor = 0x12d8, < .device = 0x7952, < .subvendor = PCI_ANY_ID, < .subdevice = PCI_ANY_ID, < .setup = pci_pericom_setup, < }, < { < .vendor = 0x12d8, < .device = 0x7954, < .subvendor = PCI_ANY_ID, < .subdevice = PCI_ANY_ID, < .setup = pci_pericom_setup, < }, < { < .vendor = 0x12d8, < .device = 0x7958, < .subvendor = PCI_ANY_ID, < .subdevice = PCI_ANY_ID, < .setup = pci_pericom_setup, < }, < Regards, Angelo 2013/6/26 Angelo Butti <buttiangelo@alice.it>: > Hi all, > my name is Angelo and I have a problem with some Pericom Serial boards. > This hardware is compatible to 16C550 but is not working good. > > Now I can workaround the problem, I understand it but I'm not able to make some > patch for the serial driver inside the linux kernel. So, now I want > try to explain the > problems and if you can adjust the driver also for this device will be > great; or if you can > explain me with some example how I can do it and send to you the patch ..... > > Anyway, the problem is related to Pericom serial boards, pci-id: > 12d8:7952 (2 serials) > 12d8:7954 (4 serials) > 12d8:7958 (8 serials) > > The first problem is related to the kind of the serial ports. This > hardware can be > 232-422-4852W-4854W mode, and must be set inside the PCI express > registers at the offset b4h. > For example if you have a 2 serial port 485-2W board, before use it > you must set that > register to 0xFF ( I make this with setpci command and all is ok) > > Te second problem, more critical for me, is the bps setting. The board > that I want use have > on board a 14.7456 Mhz, and there are a table inside datasheet with > the configuration example > and the formula to set proper bps settings. The problem is related to > the standard linux driver that use the clock equal to 1.8432 MHz. > So every time that I open the serial, this bps isn't correct. I must > adjust it writing inside the registers (after open) to fix the > problem. > Is possible add this kind of board inside the standard linux driver to > have a good bps setting ? > > En example, to set 115200bps: > Standard linux driver: DLL:0x1 DLH:0x0 > Pericom formula: DLL:0x8 DLH:0x0 > > (Ref. PI7C9X7952/4/8 (Datasheet)) > > Thanks, best regards > Angelo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-10-15 13:48 ` Angelo Butti @ 2013-10-15 14:09 ` Greg KH 2013-10-15 17:20 ` Angelo Butti 0 siblings, 1 reply; 7+ messages in thread From: Greg KH @ 2013-10-15 14:09 UTC (permalink / raw) To: Angelo Butti; +Cc: linux-serial On Tue, Oct 15, 2013 at 03:48:55PM +0200, Angelo Butti wrote: > Hi all, > I'm here again to try to solve and add support to Pericom serial devices. > > To solve is really simple, but I don't know if I make the correct > procedure. The solution is change the clock value from 1.8432 to > 14.7456. > To do this I add a new setup specific for pericom devices, and I add > this 3 devices inside the Master list of serial port. > > Now, is possible add this to the standard linux kernel, so also the > Pericom device will be ok ? > > Below the patch for the 3.10.11 kernel .... Can you generate the patch with 'diff -u' so that it is in a format that I can apply it to the kernel tree? Specifics on how to create the patch, and what you need to include in it is in the Documentation/SubmittingPatches file. If you have any problems or questions after reading that file, please let us know. thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-10-15 14:09 ` Greg KH @ 2013-10-15 17:20 ` Angelo Butti 2013-10-15 17:28 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Angelo Butti @ 2013-10-15 17:20 UTC (permalink / raw) To: linux-serial I'm really sorry for my mistake. Also, maybe that there is a simple way to change the clock without rewrite the standard serial setup procedure, but I cannot find it .... Below the correct one: --- linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c.orig 2013-09-16 20:13:52.918548000 +0300 +++ linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c 2013-10-15 16:20:18.566685996 +0300 @@ -1308,6 +1308,29 @@ static int pci_default_setup(struct seri return setup_port(priv, port, bar, offset, board->reg_shift); } +static int pci_pericom_setup(struct serial_private *priv, + const struct pciserial_board *board, + struct uart_8250_port *port, int idx) +{ + unsigned int bar, offset = board->first_offset, maxnr; + + bar = FL_GET_BASE(board->flags); + if (board->flags & FL_BASE_BARS) + bar += idx; + else + offset += idx * board->uart_offset; + + maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >> + (board->reg_shift + 3); + + if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr) + return 1; + + port->port.uartclk = 14745600; + + return setup_port(priv, port, bar, offset, board->reg_shift); +} + static int ce4100_serial_setup(struct serial_private *priv, const struct pciserial_board *board, @@ -1825,6 +1848,31 @@ static struct pci_serial_quirk pci_seria .exit = pci_plx9050_exit, }, /* + * Pericom + */ + { + .vendor = 0x12d8, + .device = 0x7952, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = 0x12d8, + .device = 0x7954, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = 0x12d8, + .device = 0x7958, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + + /* * PLX */ { 2013/10/15 Greg KH <gregkh@linuxfoundation.org>: > On Tue, Oct 15, 2013 at 03:48:55PM +0200, Angelo Butti wrote: >> Hi all, >> I'm here again to try to solve and add support to Pericom serial devices. >> >> To solve is really simple, but I don't know if I make the correct >> procedure. The solution is change the clock value from 1.8432 to >> 14.7456. >> To do this I add a new setup specific for pericom devices, and I add >> this 3 devices inside the Master list of serial port. >> >> Now, is possible add this to the standard linux kernel, so also the >> Pericom device will be ok ? >> >> Below the patch for the 3.10.11 kernel .... > > Can you generate the patch with 'diff -u' so that it is in a format that > I can apply it to the kernel tree? Specifics on how to create the > patch, and what you need to include in it is in the > Documentation/SubmittingPatches file. > > If you have any problems or questions after reading that file, please > let us know. > > thanks, > > greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-10-15 17:20 ` Angelo Butti @ 2013-10-15 17:28 ` Greg KH 2013-10-15 19:41 ` Angelo Butti 0 siblings, 1 reply; 7+ messages in thread From: Greg KH @ 2013-10-15 17:28 UTC (permalink / raw) To: Angelo Butti; +Cc: linux-serial On Tue, Oct 15, 2013 at 07:20:18PM +0200, Angelo Butti wrote: > I'm really sorry for my mistake. No worries, but your email client turned all tabs into spaces, and made the patch imposible to apply :( > Also, maybe that there is a simple way to change the clock without > rewrite the standard serial setup procedure, but I cannot find it .... > Below the correct one: > > --- linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c.orig > 2013-09-16 20:13:52.918548000 +0300 > +++ linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c > 2013-10-15 16:20:18.566685996 +0300 > @@ -1308,6 +1308,29 @@ static int pci_default_setup(struct seri > return setup_port(priv, port, bar, offset, board->reg_shift); > } > > +static int pci_pericom_setup(struct serial_private *priv, > + const struct pciserial_board *board, > + struct uart_8250_port *port, int idx) See? Also, we need a "Signed-off-by:" line as per the instructions in the Documentation/SubmittingPatches file (take a look at it for what that means.) Care to try again? thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-10-15 17:28 ` Greg KH @ 2013-10-15 19:41 ` Angelo Butti 2013-10-20 2:51 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Angelo Butti @ 2013-10-15 19:41 UTC (permalink / raw) To: linux-serial On 10/15/2013 08:28 PM, Greg KH wrote: > On Tue, Oct 15, 2013 at 07:20:18PM +0200, Angelo Butti wrote: >> I'm really sorry for my mistake. > > No worries, but your email client turned all tabs into spaces, and made > the patch imposible to apply :( > >> Also, maybe that there is a simple way to change the clock without >> rewrite the standard serial setup procedure, but I cannot find it .... >> Below the correct one: >> >> --- linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c.orig >> 2013-09-16 20:13:52.918548000 +0300 >> +++ linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c >> 2013-10-15 16:20:18.566685996 +0300 >> @@ -1308,6 +1308,29 @@ static int pci_default_setup(struct seri >> return setup_port(priv, port, bar, offset, board->reg_shift); >> } >> >> +static int pci_pericom_setup(struct serial_private *priv, >> + const struct pciserial_board *board, >> + struct uart_8250_port *port, int idx) > > See? > > Also, we need a "Signed-off-by:" line as per the instructions in the > Documentation/SubmittingPatches file (take a look at it for what that > means.) > > Care to try again? > > thanks, > > greg k-h > Ok, I change the email client .... I hope .... Signed-off-by: Angelo Butti <buttiangelo@gmail.com> Regards, Angelo --- linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c.orig 2013-09-16 20:13:52.918548000 +0300 +++ linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c 2013-10-15 16:20:18.566685996 +0300 @@ -1308,6 +1308,29 @@ static int pci_default_setup(struct seri return setup_port(priv, port, bar, offset, board->reg_shift); } +static int pci_pericom_setup(struct serial_private *priv, + const struct pciserial_board *board, + struct uart_8250_port *port, int idx) +{ + unsigned int bar, offset = board->first_offset, maxnr; + + bar = FL_GET_BASE(board->flags); + if (board->flags & FL_BASE_BARS) + bar += idx; + else + offset += idx * board->uart_offset; + + maxnr = (pci_resource_len(priv->dev, bar) - board->first_offset) >> + (board->reg_shift + 3); + + if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr) + return 1; + + port->port.uartclk = 14745600; + + return setup_port(priv, port, bar, offset, board->reg_shift); +} + static int ce4100_serial_setup(struct serial_private *priv, const struct pciserial_board *board, @@ -1825,6 +1848,31 @@ static struct pci_serial_quirk pci_seria .exit = pci_plx9050_exit, }, /* + * Pericom + */ + { + .vendor = 0x12d8, + .device = 0x7952, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = 0x12d8, + .device = 0x7954, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + { + .vendor = 0x12d8, + .device = 0x7958, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .setup = pci_pericom_setup, + }, + + /* * PLX */ { ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 2013-10-15 19:41 ` Angelo Butti @ 2013-10-20 2:51 ` Greg KH 0 siblings, 0 replies; 7+ messages in thread From: Greg KH @ 2013-10-20 2:51 UTC (permalink / raw) To: Angelo Butti; +Cc: linux-serial On Tue, Oct 15, 2013 at 10:41:10PM +0300, Angelo Butti wrote: > On 10/15/2013 08:28 PM, Greg KH wrote: > > On Tue, Oct 15, 2013 at 07:20:18PM +0200, Angelo Butti wrote: > >> I'm really sorry for my mistake. > > > > No worries, but your email client turned all tabs into spaces, and made > > the patch imposible to apply :( > > > >> Also, maybe that there is a simple way to change the clock without > >> rewrite the standard serial setup procedure, but I cannot find it .... > >> Below the correct one: > >> > >> --- linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c.orig > >> 2013-09-16 20:13:52.918548000 +0300 > >> +++ linux-3.10.11-200.fc19.i686/drivers/tty/serial/8250/8250_pci.c > >> 2013-10-15 16:20:18.566685996 +0300 > >> @@ -1308,6 +1308,29 @@ static int pci_default_setup(struct seri > >> return setup_port(priv, port, bar, offset, board->reg_shift); > >> } > >> > >> +static int pci_pericom_setup(struct serial_private *priv, > >> + const struct pciserial_board *board, > >> + struct uart_8250_port *port, int idx) > > > > See? > > > > Also, we need a "Signed-off-by:" line as per the instructions in the > > Documentation/SubmittingPatches file (take a look at it for what that > > means.) > > > > Care to try again? > > > > thanks, > > > > greg k-h > > > > Ok, I change the email client .... I hope .... The patch was a bit whitespace dammaged, but I fixed it up by hand and applied it. thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-20 7:38 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-06-26 15:25 Pericom PCIe Serial board Support (12d8:7952/4/8) - Chip PI7C9X7952/4/8 Angelo Butti 2013-10-15 13:48 ` Angelo Butti 2013-10-15 14:09 ` Greg KH 2013-10-15 17:20 ` Angelo Butti 2013-10-15 17:28 ` Greg KH 2013-10-15 19:41 ` Angelo Butti 2013-10-20 2:51 ` Greg KH
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).