iomap_copy.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright 2006 PathScale, Inc. All Rights Reserved.
  3. *
  4. * This file is free software; you can redistribute it and/or modify
  5. * it under the terms of version 2 of the GNU General Public License
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software Foundation,
  15. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  16. */
  17. #include <linux/module.h>
  18. #include <linux/io.h>
  19. /**
  20. * __iowrite32_copy - copy data to MMIO space, in 32-bit units
  21. * @to: destination, in MMIO space (must be 32-bit aligned)
  22. * @from: source (must be 32-bit aligned)
  23. * @count: number of 32-bit quantities to copy
  24. *
  25. * Copy data from kernel space to MMIO space, in units of 32 bits at a
  26. * time. Order of access is not guaranteed, nor is a memory barrier
  27. * performed afterwards.
  28. */
  29. void __attribute__((weak)) __iowrite32_copy(void __iomem *to,
  30. const void *from,
  31. size_t count)
  32. {
  33. u32 __iomem *dst = to;
  34. const u32 *src = from;
  35. const u32 *end = src + count;
  36. while (src < end)
  37. __raw_writel(*src++, dst++);
  38. }
  39. EXPORT_SYMBOL_GPL(__iowrite32_copy);