On Wed, Nov 11, 2009 at 3:19 PM, John Linn <john.l...@xilinx.com> wrote: >> -----Original Message----- >> From: Richard Röjfors [mailto:richard.rojf...@mocean-labs.com] >> Sent: Wednesday, November 11, 2009 7:39 AM [...] >> -static void xspi_init_hw(void __iomem *regs_base) >> +/* to follow are some functions that does little of big endian read and >> + * write depending on the config of the device. >> + */ >> +static inline void xspi_write8(struct xilinx_spi *xspi, u32 offs, u8 val) >> +{ >> + iowrite8(val, xspi->regs + offs + ((xspi->big_endian) ? 3 : 0)); >> +} >> + >> +static inline void xspi_write16(struct xilinx_spi *xspi, u32 offs, u16 val) >> +{ >> + if (xspi->big_endian) >> + iowrite16be(val, xspi->regs + offs + 2); >> + else >> + iowrite16(val, xspi->regs + offs); >> +} >> + >> +static inline void xspi_write32(struct xilinx_spi *xspi, u32 offs, u32 val) >> +{ >> + if (xspi->big_endian) >> + iowrite32be(val, xspi->regs + offs); >> + else >> + iowrite32(val, xspi->regs + offs); >> +} >> + >> +static inline u8 xspi_read8(struct xilinx_spi *xspi, u32 offs) >> +{ >> + return ioread8(xspi->regs + offs + ((xspi->big_endian) ? 3 : 0)); >> +} >> + >> +static inline u16 xspi_read16(struct xilinx_spi *xspi, u32 offs) >> +{ >> + if (xspi->big_endian) >> + return ioread16be(xspi->regs + offs + 2); >> + else >> + return ioread16(xspi->regs + offs); >> +} >> + >> +static inline u32 xspi_read32(struct xilinx_spi *xspi, u32 offs) >> +{ >> + if (xspi->big_endian) >> + return ioread32be(xspi->regs + offs); >> + else >> + return ioread32(xspi->regs + offs); >> +} >> + > > Hi Richard, > > The registers of the device should all be accessible as 32 bit operations. > > It seems like it would be simpler to do that.
If all register accesses can be converted to 32bits, then definitely you should just do that and make your patch simpler. g. -- Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev