diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-04 22:01:42 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-08-04 22:01:42 +0300 |
commit | 723c188d5cd42a07344f997b0b7e1d83b4173c8d (patch) | |
tree | cef57b1fa3dfe7fe8ff68d8827fe00da6314d46a /drivers/staging/vt6655/mac.c | |
parent | 78acd4ca433425e6dd4032cfc2156c60e34931f2 (diff) | |
parent | 87f600af59e8cf6abb04bac15328bcb517e26485 (diff) | |
download | linux-723c188d5cd42a07344f997b0b7e1d83b4173c8d.tar.xz |
Merge tag 'staging-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging driver updates from Greg KH:
"Here is the big set of staging driver patches for 6.0-rc1.
Another round where we removed more lines of code than added, always a
nice progression. Some of that came from the movement of the vme code
back into staging, and removal of some other of the vme driver code as
there are no known users and it is very obsolete and unmaintained. It
can be added back easily if someone offers to maintain it.
Other than that this merge has lots of little things:
- huge cleanups for r8188eu driver
- minor cleanups for other wifi drivers
- tiny loop fixes for greybus code
- other small coding style fixes
All of these have been in linux-next for a while with no reported
issues"
* tag 'staging-6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (191 commits)
staging: r8188eu: fix potential uninitialised variable use in rtw_pwrctrl.c
staging: r8188eu: remove initializer from ret in rtw_pwr_wakeup
staging: vt6655: Convert macro vt6655_mac_clear_stck_ds to function
staging: vt6655: Rename MACvClearStckDS
staging: fbtft: core: set smem_len before fb_deferred_io_init call
staging: r8188eu: convert rtw_pwr_wakeup to correct error code semantics
staging: r8188eu: make dump_chip_info() static
staging: r8188eu: remove DoReserved prototype
staging: r8188eu: remove OnAtim prototype
staging: r8188eu: remove SetHwReg8188EU()
staging: r8188eu: make update_TSF() and correct_TSF() static
staging: r8188eu: remove unused parameter from update_TSF()
staging: r8188eu: remove unused parameter from correct_TSF()
staging: r8188eu: remove HW_VAR_SET_OPMODE from SetHwReg8188EU()
staging: pi433: remove duplicated comments
staging: qlge: refine variable name
staging: vt6655: Convert macro vt6655_mac_word_reg_bits_off to function
staging: vt6655: Convert macro vt6655_mac_reg_bits_off to function
staging: vt6655: Convert macro vt6655_mac_word_reg_bits_on to function
staging: vt6655: Convert macro vt6655_mac_reg_bits_on to function
...
Diffstat (limited to 'drivers/staging/vt6655/mac.c')
-rw-r--r-- | drivers/staging/vt6655/mac.c | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/drivers/staging/vt6655/mac.c b/drivers/staging/vt6655/mac.c index 88ddd0676463..dcc649532737 100644 --- a/drivers/staging/vt6655/mac.c +++ b/drivers/staging/vt6655/mac.c @@ -38,6 +38,47 @@ #include "mac.h" +void vt6655_mac_reg_bits_on(void __iomem *iobase, const u8 reg_offset, const u8 bit_mask) +{ + unsigned char reg_value; + + reg_value = ioread8(iobase + reg_offset); + iowrite8(reg_value | bit_mask, iobase + reg_offset); +} + +void vt6655_mac_word_reg_bits_on(void __iomem *iobase, const u8 reg_offset, const u16 bit_mask) +{ + unsigned short reg_value; + + reg_value = ioread16(iobase + reg_offset); + iowrite16(reg_value | (bit_mask), iobase + reg_offset); +} + +void vt6655_mac_reg_bits_off(void __iomem *iobase, const u8 reg_offset, const u8 bit_mask) +{ + unsigned char reg_value; + + reg_value = ioread8(iobase + reg_offset); + iowrite8(reg_value & ~(bit_mask), iobase + reg_offset); +} + +void vt6655_mac_word_reg_bits_off(void __iomem *iobase, const u8 reg_offset, const u16 bit_mask) +{ + unsigned short reg_value; + + reg_value = ioread16(iobase + reg_offset); + iowrite16(reg_value & ~(bit_mask), iobase + reg_offset); +} + +static void vt6655_mac_clear_stck_ds(void __iomem *iobase) +{ + u8 reg_value; + + reg_value = ioread8(iobase + MAC_REG_STICKHW); + reg_value = reg_value & 0xFC; + iowrite8(reg_value, iobase + MAC_REG_STICKHW); +} + /* * Description: * Test if all test bits off @@ -337,7 +378,7 @@ bool MACbSafeRxOff(struct vnt_private *priv) } /* try to safe shutdown RX */ - MACvRegBitsOff(io_base, MAC_REG_HOSTCR, HOSTCR_RXON); + vt6655_mac_reg_bits_off(io_base, MAC_REG_HOSTCR, HOSTCR_RXON); /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { if (!(ioread8(io_base + MAC_REG_HOSTCR) & HOSTCR_RXONST)) @@ -392,7 +433,7 @@ bool MACbSafeTxOff(struct vnt_private *priv) } /* try to safe shutdown TX */ - MACvRegBitsOff(io_base, MAC_REG_HOSTCR, HOSTCR_TXON); + vt6655_mac_reg_bits_off(io_base, MAC_REG_HOSTCR, HOSTCR_TXON); /* W_MAX_TIMEOUT is the timeout period */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { @@ -423,7 +464,7 @@ bool MACbSafeStop(struct vnt_private *priv) { void __iomem *io_base = priv->port_offset; - MACvRegBitsOff(io_base, MAC_REG_TCR, TCR_AUTOBCNTX); + vt6655_mac_reg_bits_off(io_base, MAC_REG_TCR, TCR_AUTOBCNTX); if (!MACbSafeRxOff(priv)) { pr_debug(" MACbSafeRxOff == false)\n"); @@ -436,7 +477,7 @@ bool MACbSafeStop(struct vnt_private *priv) return false; } - MACvRegBitsOff(io_base, MAC_REG_HOSTCR, HOSTCR_MACEN); + vt6655_mac_reg_bits_off(io_base, MAC_REG_HOSTCR, HOSTCR_MACEN); return true; } @@ -458,7 +499,7 @@ bool MACbShutdown(struct vnt_private *priv) { void __iomem *io_base = priv->port_offset; /* disable MAC IMR */ - MACvIntDisable(io_base); + iowrite32(0, io_base + MAC_REG_IMR); MACvSetLoopbackMode(priv, MAC_LB_INTERNAL); /* stop the adapter */ if (!MACbSafeStop(priv)) { @@ -486,7 +527,7 @@ void MACvInitialize(struct vnt_private *priv) { void __iomem *io_base = priv->port_offset; /* clear sticky bits */ - MACvClearStckDS(io_base); + vt6655_mac_clear_stck_ds(io_base); /* disable force PME-enable */ iowrite8(PME_OVR, io_base + MAC_REG_PMC1); /* only 3253 A */ @@ -730,7 +771,7 @@ bool MACbPSWakeup(struct vnt_private *priv) return true; /* Disable PS */ - MACvRegBitsOff(io_base, MAC_REG_PSCTL, PSCTL_PSEN); + vt6655_mac_reg_bits_off(io_base, MAC_REG_PSCTL, PSCTL_PSEN); /* Check if SyncFlushOK */ for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { |