arcnet: com20020: Use arcnet_<I/O> routines

Simplify and make consistent the current uses of inb/outb
by using the newly introduced arcnet_<I/O> equivalents.

o Add new #defines for register offsets
  There is an register offset, 8, that is unnamed and used as-is.
o Remove old #defines that included the ioaddr
o Remove obfuscating macros by expanding them in-place where appropriate
o Create static inline com20020_set_subaddress for the SET_SUBADR macro

There is an unused arcnet config entry CONFIGSA100_CT6001 which added a
special #define BUS_ALIGN which was introduced but never used in fullhist git
tree commit 22cfce4b82b0 ("[ARCNET]: Fixes.") in Nov 2004 for Linux v2.6.10.

This BUS_ALIGN #define tries to allow 8 bit devices to work on a 16 bit
bus by aligning addresses to 16 bit boundaries.

Move this currently unused CONFIG_SA1100_CT6001 BUS_ALIGN macro from
com20020.h to arcdevice.h.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
Joe Perches
2015-05-05 10:06:06 -07:00
committed by Michael Grzeschik
parent e5fcfc1f8d
commit 0fec65130b
6 changed files with 114 additions and 122 deletions

View File

@@ -344,28 +344,34 @@ void arcnet_timeout(struct net_device *dev);
/* I/O equivalents */
#ifdef CONFIG_SA1100_CT6001
#define BUS_ALIGN 2 /* 8 bit device on a 16 bit bus - needs padding */
#else
#define BUS_ALIGN 1
#endif
/* addr and offset allow register like names to define the actual IO address.
* A configuration option multiplies the offset for alignment.
*/
#define arcnet_inb(addr, offset) \
inb((addr) + (offset))
inb((addr) + BUS_ALIGN * (offset))
#define arcnet_outb(value, addr, offset) \
outb(value, (addr) + (offset))
outb(value, (addr) + BUS_ALIGN * (offset))
#define arcnet_insb(addr, offset, buffer, count) \
insb((addr) + (offset), buffer, count)
insb((addr) + BUS_ALIGN * (offset), buffer, count)
#define arcnet_outsb(addr, offset, buffer, count) \
outsb((addr) + (offset), buffer, count)
outsb((addr) + BUS_ALIGN * (offset), buffer, count)
#define arcnet_inw(addr, offset) \
inw((addr) + (offset))
inw((addr) + BUS_ALIGN * (offset))
#define arcnet_outw(value, addr, offset) \
outw(value, (addr) + (offset))
outw(value, (addr) + BUS_ALIGN * (offset))
#define arcnet_insw(addr, offset, buffer, count) \
insw((addr) + (offset), buffer, count)
insw((addr) + BUS_ALIGN * (offset), buffer, count)
#define arcnet_outsw(addr, offset, buffer, count) \
outsw((addr) + (offset), buffer, count)
outsw((addr) + BUS_ALIGN * (offset), buffer, count)
#endif /* __KERNEL__ */
#endif /* _LINUX_ARCDEVICE_H */