Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-24 Thread Alistair Francis
On Mon, Oct 24, 2016 at 6:25 AM, P J P wrote: > +-- On Mon, 24 Oct 2016, Alistair Francis wrote --+ > | > | > http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf > | > | Did the TRM have enough detail for you to figure out how the hardware > behaves? > > Yes, it def

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-24 Thread P J P
+-- On Mon, 24 Oct 2016, Alistair Francis wrote --+ | > | http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf | | Did the TRM have enough detail for you to figure out how the hardware behaves? Yes, it defines range for 'Baud rate generator' and 'Baud rate divider'

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-24 Thread Alistair Francis
On Fri, Oct 21, 2016 at 9:47 AM, P J P wrote: > +-- On Thu, 20 Oct 2016, Edgar E. Iglesias wrote --+ > | The UART is described in the Zynq TRMs, I think you can just > | google for zynq TRM and a reference to UG585 and UG1085 will come up. > > Unlikely for a novice to think 'zynq TRM' as search

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-21 Thread P J P
+-- On Thu, 20 Oct 2016, Edgar E. Iglesias wrote --+ | The UART is described in the Zynq TRMs, I think you can just | google for zynq TRM and a reference to UG585 and UG1085 will come up. Unlikely for a novice to think 'zynq TRM' as search term for cadence UART. I went with Xilinx Cadence UART

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-20 Thread Edgar E. Iglesias
On Thu, Oct 20, 2016 at 11:25:47AM +0530, P J P wrote: > +-- On Wed, 19 Oct 2016, Alistair Francis wrote --+ > | I don't think the Cadence datasheets are public. If you can't find it > | from a simple Google search I don't think you have access. > > I see, okay. > > I think it'll greatly help i

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-19 Thread P J P
+-- On Wed, 19 Oct 2016, Alistair Francis wrote --+ | I don't think the Cadence datasheets are public. If you can't find it | from a simple Google search I don't think you have access. I see, okay. I think it'll greatly help if device emulator writers include a link to its specification/datash

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-19 Thread Alistair Francis
On Wed, Oct 19, 2016 at 12:11 PM, P J P wrote: > Hello Alistair, > > +-- On Wed, 19 Oct 2016, Alistair Francis wrote --+ > | Generally these types of IP just say 'undefined' in invalid situations > | like this. If that is the case we shouldn't return but just set some > | default value and allow

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-19 Thread P J P
Hello Alistair, +-- On Wed, 19 Oct 2016, Alistair Francis wrote --+ | Generally these types of IP just say 'undefined' in invalid situations | like this. If that is the case we shouldn't return but just set some | default value and allow the other functions in the setup to continue | on. Coul

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-19 Thread Alistair Francis
On Tue, Oct 18, 2016 at 8:46 PM, P J P wrote: > +-- On Tue, 18 Oct 2016, Peter Maydell wrote --+ > | > +if (!s->r[R_BRGR] || !(s->r[R_BDIV] + 1) > | > +|| baud_rate < (s->r[R_BRGR] * (s->r[R_BDIV] + 1))) { > | > +return; > | > +} > | > ssp.speed = baud_rate / (s->r[R_B

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-18 Thread P J P
+-- On Tue, 18 Oct 2016, Peter Maydell wrote --+ | > +if (!s->r[R_BRGR] || !(s->r[R_BDIV] + 1) | > +|| baud_rate < (s->r[R_BRGR] * (s->r[R_BDIV] + 1))) { | > +return; | > +} | > ssp.speed = baud_rate / (s->r[R_BRGR] * (s->r[R_BDIV] + 1)); | > packet_size = 1; | |

Re: [Qemu-devel] [Qemu-arm] [PATCH] char: cadence: check divider against baud rate

2016-10-18 Thread Peter Maydell
On 18 October 2016 at 10:47, P J P wrote: > From: Prasad J Pandit > > The Cadence UART device emulator calculates speed by dividing the > baud rate by a divider. If this divider was to be zero or if baud > rate was to be lesser than the divider, it could lead to a divide > by zero error. Add chec