* [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
@ 2021-11-23 13:13 Shubhrajyoti Datta
2021-11-24 10:07 ` Greg KH
0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2021-11-23 13:13 UTC (permalink / raw)
To: linux-serial; +Cc: jirislaby, gregkh, jacmet, git, Shubhrajyoti Datta
The control register is a writeonly register that's why reading it
doesn't make any sense.
The manual states "This is a write-only register. Issuing a read request
to the control register generates the read acknowledgment with zero data."
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2:
Update the description
https://www.xilinx.com/support/documentation/ip_documentation/axi_uartlite/v2_0/pg142-axi-uartlite.pdf
drivers/tty/serial/uartlite.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index dfc1ba4e1572..0df471eddb0e 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -297,7 +297,6 @@ static void ulite_shutdown(struct uart_port *port)
struct uartlite_data *pdata = port->private_data;
uart_out32(0, ULITE_CONTROL, port);
- uart_in32(ULITE_CONTROL, port); /* dummy */
free_irq(port->irq, port);
clk_disable(pdata->clk);
}
@@ -368,7 +367,6 @@ static int ulite_request_port(struct uart_port *port)
}
pdata->reg_ops = &uartlite_be;
- ret = uart_in32(ULITE_CONTROL, port);
uart_out32(ULITE_CONTROL_RST_TX, ULITE_CONTROL, port);
ret = uart_in32(ULITE_STATUS, port);
/* Endianess detection */
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
2021-11-23 13:13 [PATCH v2] serial-uartlite: Remove an un-necessary read of control register Shubhrajyoti Datta
@ 2021-11-24 10:07 ` Greg KH
2021-11-24 12:37 ` Shubhrajyoti Datta
0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2021-11-24 10:07 UTC (permalink / raw)
To: Shubhrajyoti Datta; +Cc: linux-serial, jirislaby, jacmet, git
On Tue, Nov 23, 2021 at 06:43:48PM +0530, Shubhrajyoti Datta wrote:
> The control register is a writeonly register that's why reading it
> doesn't make any sense.
> The manual states "This is a write-only register. Issuing a read request
> to the control register generates the read acknowledgment with zero data."
Are you sure this is ok to remove? Usually you have to do a read after
a write to ensure that the write succeeded.
What ensures that the write succeeded now if you remove this read?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
2021-11-24 10:07 ` Greg KH
@ 2021-11-24 12:37 ` Shubhrajyoti Datta
2021-11-24 12:45 ` Greg KH
2021-11-26 14:07 ` Maarten Brock
0 siblings, 2 replies; 6+ messages in thread
From: Shubhrajyoti Datta @ 2021-11-24 12:37 UTC (permalink / raw)
To: Greg KH; +Cc: linux-serial, jirislaby, jacmet, git
> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Wednesday, November 24, 2021 3:38 PM
> To: Shubhrajyoti Datta <shubhraj@xilinx.com>
> Cc: linux-serial@vger.kernel.org; jirislaby@kernel.org; jacmet@sunsite.dk; git
> <git@xilinx.com>
> Subject: Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control
> register
>
> On Tue, Nov 23, 2021 at 06:43:48PM +0530, Shubhrajyoti Datta wrote:
> > The control register is a writeonly register that's why reading it
> > doesn't make any sense.
> > The manual states "This is a write-only register. Issuing a read
> > request to the control register generates the read acknowledgment with zero
> data."
>
> Are you sure this is ok to remove? Usually you have to do a read after a write to
> ensure that the write succeeded.
>
> What ensures that the write succeeded now if you remove this read?
I do not find the mention of a read requirement in the manual.
Also in the current code in ulite_console_write and in ulite_startup we are writing without a
read.
Thanks and Regards,
Shubhrajyoti
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
2021-11-24 12:37 ` Shubhrajyoti Datta
@ 2021-11-24 12:45 ` Greg KH
2021-11-26 14:07 ` Maarten Brock
1 sibling, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-11-24 12:45 UTC (permalink / raw)
To: Shubhrajyoti Datta; +Cc: linux-serial, jirislaby, jacmet, git
On Wed, Nov 24, 2021 at 12:37:00PM +0000, Shubhrajyoti Datta wrote:
>
>
> > -----Original Message-----
> > From: Greg KH <gregkh@linuxfoundation.org>
> > Sent: Wednesday, November 24, 2021 3:38 PM
> > To: Shubhrajyoti Datta <shubhraj@xilinx.com>
> > Cc: linux-serial@vger.kernel.org; jirislaby@kernel.org; jacmet@sunsite.dk; git
> > <git@xilinx.com>
> > Subject: Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control
> > register
> >
> > On Tue, Nov 23, 2021 at 06:43:48PM +0530, Shubhrajyoti Datta wrote:
> > > The control register is a writeonly register that's why reading it
> > > doesn't make any sense.
> > > The manual states "This is a write-only register. Issuing a read
> > > request to the control register generates the read acknowledgment with zero
> > data."
> >
> > Are you sure this is ok to remove? Usually you have to do a read after a write to
> > ensure that the write succeeded.
> >
> > What ensures that the write succeeded now if you remove this read?
>
> I do not find the mention of a read requirement in the manual.
Look at your hardware bus documentation.
> Also in the current code in ulite_console_write and in ulite_startup we are writing without a
> read.
So is that a bug there?
I am _very_ loath to remove reads like until you can guarantee that it
will not break anything. Please work with your hardware designers to
ensure this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
2021-11-24 12:37 ` Shubhrajyoti Datta
2021-11-24 12:45 ` Greg KH
@ 2021-11-26 14:07 ` Maarten Brock
2021-12-15 11:56 ` Michal Simek
1 sibling, 1 reply; 6+ messages in thread
From: Maarten Brock @ 2021-11-26 14:07 UTC (permalink / raw)
To: Shubhrajyoti Datta
Cc: Greg KH, linux-serial, jirislaby, jacmet, git, michal.simek
+ Michal
On 2021-11-24 13:37, Shubhrajyoti Datta wrote:
>> -----Original Message-----
>> From: Greg KH <gregkh@linuxfoundation.org>
>> Sent: Wednesday, November 24, 2021 3:38 PM
>> To: Shubhrajyoti Datta <shubhraj@xilinx.com>
>> Cc: linux-serial@vger.kernel.org; jirislaby@kernel.org;
>> jacmet@sunsite.dk; git
>> <git@xilinx.com>
>> Subject: Re: [PATCH v2] serial-uartlite: Remove an un-necessary read
>> of control
>> register
>>
>> On Tue, Nov 23, 2021 at 06:43:48PM +0530, Shubhrajyoti Datta wrote:
>> > The control register is a writeonly register that's why reading it
>> > doesn't make any sense.
>> > The manual states "This is a write-only register. Issuing a read
>> > request to the control register generates the read acknowledgment with zero
>> data."
>>
>> Are you sure this is ok to remove? Usually you have to do a read
>> after a write to
>> ensure that the write succeeded.
>>
>> What ensures that the write succeeded now if you remove this read?
>
> I do not find the mention of a read requirement in the manual.
> Also in the current code in ulite_console_write and in ulite_startup
> we are writing without a read.
>
> Thanks and Regards,
> Shubhrajyoti
I suggest to confer with Michal Simek. He introduced the read in
ulite_request_port()
in the past. The other one in ulite_shutdown() has been there since its
inception in
2006.
Maarten
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control register
2021-11-26 14:07 ` Maarten Brock
@ 2021-12-15 11:56 ` Michal Simek
0 siblings, 0 replies; 6+ messages in thread
From: Michal Simek @ 2021-12-15 11:56 UTC (permalink / raw)
To: Maarten Brock, Shubhrajyoti Datta
Cc: Greg KH, linux-serial, jirislaby, jacmet, git, michal.simek
On 11/26/21 15:07, Maarten Brock wrote:
> + Michal
>
> On 2021-11-24 13:37, Shubhrajyoti Datta wrote:
>>> -----Original Message-----
>>> From: Greg KH <gregkh@linuxfoundation.org>
>>> Sent: Wednesday, November 24, 2021 3:38 PM
>>> To: Shubhrajyoti Datta <shubhraj@xilinx.com>
>>> Cc: linux-serial@vger.kernel.org; jirislaby@kernel.org; jacmet@sunsite.dk; git
>>> <git@xilinx.com>
>>> Subject: Re: [PATCH v2] serial-uartlite: Remove an un-necessary read of control
>>> register
>>>
>>> On Tue, Nov 23, 2021 at 06:43:48PM +0530, Shubhrajyoti Datta wrote:
>>> > The control register is a writeonly register that's why reading it
>>> > doesn't make any sense.
>>> > The manual states "This is a write-only register. Issuing a read
>>> > request to the control register generates the read acknowledgment with zero
>>> data."
>>>
>>> Are you sure this is ok to remove? Usually you have to do a read after a
>>> write to
>>> ensure that the write succeeded.
>>>
>>> What ensures that the write succeeded now if you remove this read?
>>
>> I do not find the mention of a read requirement in the manual.
>> Also in the current code in ulite_console_write and in ulite_startup
>> we are writing without a read.
>>
>> Thanks and Regards,
>> Shubhrajyoti
>
> I suggest to confer with Michal Simek. He introduced the read in
> ulite_request_port()
From my perspective that read is not needed and can be removed.
> in the past. The other one in ulite_shutdown() has been there since its
> inception in
> 2006.
I confirm this. It was originally developed for PPC systems that's why not sure
if there was any issue on PLB bus. But I expect Grant wanted to make sure that
disabling port reached IP that's why he read it back that irq can be freed and
clock disabled.
This is better to keep it there for sure.
Thanks,
Michal
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-12-15 11:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 13:13 [PATCH v2] serial-uartlite: Remove an un-necessary read of control register Shubhrajyoti Datta
2021-11-24 10:07 ` Greg KH
2021-11-24 12:37 ` Shubhrajyoti Datta
2021-11-24 12:45 ` Greg KH
2021-11-26 14:07 ` Maarten Brock
2021-12-15 11:56 ` Michal Simek
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.