io.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * iop3xx custom ioremap implementation
  3. * Copyright (c) 2006, Intel Corporation.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms and conditions of the GNU General Public License,
  7. * version 2, as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
  16. * Place - Suite 330, Boston, MA 02111-1307 USA.
  17. *
  18. */
  19. #include <linux/kernel.h>
  20. #include <linux/module.h>
  21. #include <asm/hardware.h>
  22. #include <asm/io.h>
  23. void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size,
  24. unsigned long flags)
  25. {
  26. void __iomem * retval;
  27. switch (cookie) {
  28. case IOP3XX_PCI_LOWER_IO_PA ... IOP3XX_PCI_UPPER_IO_PA:
  29. retval = (void *) IOP3XX_PCI_IO_PHYS_TO_VIRT(cookie);
  30. break;
  31. case IOP3XX_PERIPHERAL_PHYS_BASE ... IOP3XX_PERIPHERAL_UPPER_PA:
  32. retval = (void *) IOP3XX_PMMR_PHYS_TO_VIRT(cookie);
  33. break;
  34. default:
  35. retval = __ioremap(cookie, size, flags);
  36. }
  37. return retval;
  38. }
  39. EXPORT_SYMBOL(__iop3xx_ioremap);
  40. void __iop3xx_iounmap(void __iomem *addr)
  41. {
  42. extern void __iounmap(volatile void __iomem *addr);
  43. switch ((u32) addr) {
  44. case IOP3XX_PCI_LOWER_IO_VA ... IOP3XX_PCI_UPPER_IO_VA:
  45. case IOP3XX_PERIPHERAL_VIRT_BASE ... IOP3XX_PERIPHERAL_UPPER_VA:
  46. goto skip;
  47. }
  48. __iounmap(addr);
  49. skip:
  50. return;
  51. }
  52. EXPORT_SYMBOL(__iop3xx_iounmap);