linux/drivers/net/ethernet/altera/altera_utils.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0-only
   2/* Altera TSE SGDMA and MSGDMA Linux driver
   3 * Copyright (C) 2014 Altera Corporation. All rights reserved
   4 */
   5
   6#include "altera_tse.h"
   7#include "altera_utils.h"
   8
   9void tse_set_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask)
  10{
  11        u32 value = csrrd32(ioaddr, offs);
  12        value |= bit_mask;
  13        csrwr32(value, ioaddr, offs);
  14}
  15
  16void tse_clear_bit(void __iomem *ioaddr, size_t offs, u32 bit_mask)
  17{
  18        u32 value = csrrd32(ioaddr, offs);
  19        value &= ~bit_mask;
  20        csrwr32(value, ioaddr, offs);
  21}
  22
  23int tse_bit_is_set(void __iomem *ioaddr, size_t offs, u32 bit_mask)
  24{
  25        u32 value = csrrd32(ioaddr, offs);
  26        return (value & bit_mask) ? 1 : 0;
  27}
  28
  29int tse_bit_is_clear(void __iomem *ioaddr, size_t offs, u32 bit_mask)
  30{
  31        u32 value = csrrd32(ioaddr, offs);
  32        return (value & bit_mask) ? 0 : 1;
  33}
  34