On Wed, Apr 29, 2015 at 09:38:36AM +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 | 324 ++++++++++++++++++++++++---------------- > include/linux/amba/serial.h | 4 + > 2 files changed, 199 insertions(+), 129 deletions(-) > > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 5a4e9d5..14941be 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 > @@ -67,6 +66,8 @@ > #define SERIAL_AMBA_NR UART_NR > > #define AMBA_ISR_PASS_LIMIT 256 > +#define REG_NR 19 > +#define IDX(x) ((x) >> 2) > > #define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE) > #define UART_DUMMY_DR_RX (1 << 16) > @@ -74,8 +75,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 +88,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 [8]=0x2c */ > + [IDX(UART01x_DR)] = UART01x_DR, > + [IDX(UART01x_RSR)] = UART01x_RSR, > + [IDX(ST_UART011_DMAWM)] = ST_UART011_DMAWM, > + [IDX(UART010_LCRM)] = UART010_LCRM, > + [IDX(UART010_LCRL)] = UART010_LCRL, > + [IDX(UART010_CR)] = UART010_CR, > + [IDX(UART01x_FR)] = UART01x_FR, > + [IDX(UART011_LCRH_RX)] = UART011_LCRH, /* remapped */ > + [IDX(UART01x_ILPR)] = UART01x_ILPR, > + [IDX(UART011_IBRD)] = UART011_IBRD, > + [IDX(UART011_FBRD)] = UART011_FBRD, > + [IDX(UART011_LCRH_TX)] = UART011_LCRH_TX, Shouldn't the RHS of this be UART011_LCRH ? > +static u8 st_reg[] = { > + /* All registers offset are in order */ > + [IDX(UART01x_DR)] = UART01x_DR, > + [IDX(UART01x_RSR)] = UART01x_RSR, > + [IDX(ST_UART011_DMAWM)] = ST_UART011_DMAWM, > + [IDX(UART010_LCRM)] = UART010_LCRM, > + [IDX(UART010_LCRL)] = UART010_LCRL, > + [IDX(UART010_CR)] = UART010_CR, > + [IDX(UART01x_FR)] = UART01x_FR, > + [IDX(UART011_LCRH_RX)] = UART011_LCRH_RX, What happened to the ST_xx prefix on this? Please use ST_UART011_LCRH_RX on the RHS here. > @@ -75,6 +77,8 @@ > #define UART01x_RSR_PE 0x02 > #define UART01x_RSR_FE 0x01 > > +#define UART011_FR_TXBUSY 0x100 > +#define UART011_FR_RXBUSY 0x200 This seems to be an unrelated change. Nothing in this patch seems to make use of these. -- 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