lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54784ADE.6010602@gmail.com>
Date:	Fri, 28 Nov 2014 18:13:50 +0800
From:	Orson Zhai <orsonzhai@...il.com>
To:	One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>,
	Chunyan Zhang <chunyan.zhang@...eadtrum.com>
CC:	grant.likely@...aro.org, robh+dt@...nel.org,
	catalin.marinas@....com, gregkh@...uxfoundation.org,
	ijc+devicetree@...lion.org.uk, jslaby@...e.cz,
	galak@...eaurora.org, broonie@...aro.org, mark.rutland@....com,
	m-karicheri2@...com, pawel.moll@....com, artagnon@...il.com,
	rrichter@...ium.com, will.deacon@....com, arnd@...db.de,
	corbet@....net, jason@...edaemon.net, broonie@...nel.org,
	heiko@...ech.de, shawn.guo@...escale.com, florian.vaussard@...l.ch,
	andrew@...n.ch, hytszk@...il.com, geng.ren@...eadtrum.com,
	zhizhou.zhang@...eadtrum.com, lanqing.liu@...eadtrum.com,
	zhang.lyra@...il.com, wei.qiao@...eadtrum.com,
	devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org, sprdlinux@...elists.org,
	linux-doc@...r.kernel.org, linux-serial@...r.kernel.org,
	linux-api@...r.kernel.org
Subject: Re: [PATCH v3 5/5] tty/serial: Add Spreadtrum sc9836-uart driver
 support

Hi, Alan,

Thanks for your comments!
Some question for them below,

On 2014年11月26日 20:33, One Thousand Gnomes wrote:
>> +		 213 = /dev/ttySPX0		SPRD serial port 0
>> +		    ...
>> +		 216 = /dev/ttySPX3		SPRD serial port 3
> Please use dynamic allocation or give a very very good reason why you
> can't
do we just leave the .major & .minor as NULL in struct uart_driver for 
dynamic allocation?
>> +config SERIAL_SPRD_NR
>> +        int "Maximum number of sprd serial ports"
>> +        depends on SERIAL_SPRD
>> +        default "4"
> If you are doing dynamic allocation this should pretty much go away
I think you mean getting the number of uarts from dt and dynamically 
allocate their port structure?
>
>> +static int sprd_startup(struct uart_port *port)
>> +{
>> +	int ret = 0;
>> +	unsigned int ien, ctrl1;
>> +	struct sprd_uart_port *sp;
>> +
>> +	serial_out(port, SPRD_CTL2, ((THLD_TX_EMPTY << 8) | THLD_RX_FULL));
>> +
>> +	/* clear rx fifo */
>> +	while (serial_in(port, SPRD_STS1) & 0x00ff)
>> +		serial_in(port, SPRD_RXD);
>> +
>> +	/* clear tx fifo */
>> +	while (serial_in(port, SPRD_STS1) & 0xff00)
>> +		;
> Missing a cpu_relax and I would have thought a timeout on both of these.
We will add in V4
>
>
>> +static void sprd_set_termios(struct uart_port *port,
>> +				    struct ktermios *termios,
>> +				    struct ktermios *old)
>> +{
>> +	unsigned int baud, quot;
>> +	/* calculate parity */
>> +	lcr &= ~SPRD_LCR_PARITY;
>> +	if (termios->c_cflag & PARENB) {
>> +		lcr |= SPRD_LCR_PARITY_EN;
>> +		if (termios->c_cflag & PARODD)
>> +			lcr |= SPRD_LCR_ODD_PAR;
>> +		else
>> +			lcr |= SPRD_LCR_EVEN_PAR;
>> +	}
> If you don't support mark/space parity then also clear CMSPAR in
> termios->c_cflag.
just simply use code like "termios->c_cflag &= ~CMSPAR" ?

> If you do then it ought to be handled above.
>
>> +
>> +	/* clock divider bit16~bit20 */
>> +	serial_out(port, SPRD_CLKD1, (quot & 0x1f0000) >> 16);
>> +	serial_out(port, SPRD_LCR, lcr);
>> +	fc |= 0x3e00 | THLD_RX_FULL;
>> +	serial_out(port, SPRD_CTL1, fc);
> Also set the resulting baud back into the termios (see the 8250 termios
> for an example)
you mean something like this part ?

/* Don't rewrite B0 */
if (tty_termios_baud_rate(termios))
tty_termios_encode_baud_rate(termios, baud, baud);


>
>
>> +static int __init sprd_console_setup(struct console *co, char *options)
>> +{
>> +	struct uart_port *port;
>> +	int baud = 115200;
>> +	int bits = 8;
>> +	int parity = 'n';
>> +	int flow = 'n';
>> +
>> +	if (unlikely(co->index >= UART_NR_MAX || co->index < 0))
>> +		co->index = 0;
>> +
>> +	port = (struct uart_port *)sprd_port[co->index];
>> +	if (port == NULL) {
>> +		pr_info("srial port %d not yet initialized\n", co->index);
> Typo
it will be fixed :)

Thanks,
Orson
> Looks basically sound to me
>
> Alan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ