control.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * OMAP2/3 System Control Module register access
  3. *
  4. * Copyright (C) 2007 Texas Instruments, Inc.
  5. * Copyright (C) 2007 Nokia Corporation
  6. *
  7. * Written by Paul Walmsley
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2 as
  11. * published by the Free Software Foundation.
  12. */
  13. #undef DEBUG
  14. #include <linux/kernel.h>
  15. #include <linux/io.h>
  16. #include <mach/common.h>
  17. #include <mach/control.h>
  18. static void __iomem *omap2_ctrl_base;
  19. #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
  20. void __init omap2_set_globals_control(struct omap_globals *omap2_globals)
  21. {
  22. omap2_ctrl_base = omap2_globals->ctrl;
  23. }
  24. void __iomem *omap_ctrl_base_get(void)
  25. {
  26. return omap2_ctrl_base;
  27. }
  28. u8 omap_ctrl_readb(u16 offset)
  29. {
  30. return __raw_readb(OMAP_CTRL_REGADDR(offset));
  31. }
  32. u16 omap_ctrl_readw(u16 offset)
  33. {
  34. return __raw_readw(OMAP_CTRL_REGADDR(offset));
  35. }
  36. u32 omap_ctrl_readl(u16 offset)
  37. {
  38. return __raw_readl(OMAP_CTRL_REGADDR(offset));
  39. }
  40. void omap_ctrl_writeb(u8 val, u16 offset)
  41. {
  42. __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
  43. }
  44. void omap_ctrl_writew(u16 val, u16 offset)
  45. {
  46. __raw_writew(val, OMAP_CTRL_REGADDR(offset));
  47. }
  48. void omap_ctrl_writel(u32 val, u16 offset)
  49. {
  50. __raw_writel(val, OMAP_CTRL_REGADDR(offset));
  51. }