On Mon, Apr 27, 2015 at 04:41:49PM +0800, Jun Nie wrote: > Both ARM and ST uart use the same pl011 IP, but some registers > have different offset. Support the different offset with look > up table. > > Signed-off-by: Jun Nie <jun.nie@xxxxxxxxxx> > --- > drivers/tty/serial/amba-pl011.c | 320 ++++++++++++++++++++++++---------------- > include/linux/amba/serial.h | 2 + > 2 files changed, 193 insertions(+), 129 deletions(-) > > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 5a4e9d5..6f01748 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -29,7 +29,6 @@ > * and hooked into this driver. > */ > > - > #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) > #define SUPPORT_SYSRQ > #endif > @@ -74,8 +73,7 @@ > /* There is by now at least one vendor with differing details, so handle it */ > struct vendor_data { > unsigned int ifls; > - unsigned int lcrh_tx; > - unsigned int lcrh_rx; > + u8 *reg_lut; > bool oversampling; > bool dma_threshold; > bool cts_event_workaround; > @@ -88,10 +86,32 @@ static unsigned int get_fifosize_arm(struct amba_device *dev) > return amba_rev(dev) < 3 ? 16 : 32; > } > > +static u8 arm_reg[] = { > + /* All registers offset are in order except LCRH as comment */ > + [0] = UART01x_DR, > + [1] = UART01x_RSR, > + [2] = ST_UART011_DMAWM, > + [3] = UART010_LCRM, > + [4] = UART010_LCRL, > + [5] = UART010_CR, > + [6] = UART01x_FR, > + [7] = UART011_LCRH_TX, /* remapped */ > + [8] = UART01x_ILPR, > + [9] = UART011_IBRD, > + [10] = UART011_FBRD, > + [11] = UART011_LCRH_TX, I thought I commented that *both* of these (entry 7 and 11) _should_ be UART011_LCRH. I've no idea why you've gone to using constants in the array initialisation either. If you're going to do that, then please use the enum approach right from the start, or go back to what you were doing. Thanks. -- FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net. -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html