alarmDataOperation.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * GPMC support functions
  3. *
  4. * Copyright (C) 2005-2006 Nokia Corporation
  5. *
  6. * Author: Juha Yrjola
  7. *
  8. * Copyright (C) 2009 Texas Instruments
  9. * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #undef DEBUG
  16. #include <linux/irq.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/err.h>
  20. #include <linux/clk.h>
  21. #include <linux/ioport.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/io.h>
  24. #include <linux/module.h>
  25. #include <linux/interrupt.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/platform_data/mtd-nand-omap2.h>
  28. #include <asm/mach-types.h>
  29. #include "soc.h"
  30. #include "common.h"
  31. #include "omap_device.h"
  32. #include "gpmc.h"
  33. #define DEVICE_NAME "omap-gpmc"
  34. /* GPMC register offsets */
  35. #define GPMC_REVISION 0x00
  36. #define GPMC_SYSCONFIG 0x10
  37. #define GPMC_SYSSTATUS 0x14
  38. #define GPMC_IRQSTATUS 0x18
  39. #define GPMC_IRQENABLE 0x1c
  40. #define GPMC_TIMEOUT_CONTROL 0x40
  41. #define GPMC_ERR_ADDRESS 0x44
  42. #define GPMC_ERR_TYPE 0x48
  43. #define GPMC_CONFIG 0x50
  44. #define GPMC_STATUS 0x54
  45. #define GPMC_PREFETCH_CONFIG1 0x1e0
  46. #define GPMC_PREFETCH_CONFIG2 0x1e4
  47. #define GPMC_PREFETCH_CONTROL 0x1ec
  48. #define GPMC_PREFETCH_STATUS 0x1f0
  49. #define GPMC_ECC_CONFIG 0x1f4
  50. #define GPMC_ECC_CONTROL 0x1f8
  51. #define GPMC_ECC_SIZE_CONFIG 0x1fc
  52. #define GPMC_ECC1_RESULT 0x200
  53. #define GPMC_ECC_BCH_RESULT_0 0x240 /* not available on OMAP2 */
  54. #define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
  55. #define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
  56. #define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
  57. /* GPMC ECC control settings */
  58. #define GPMC_ECC_CTRL_ECCCLEAR 0x100
  59. #define GPMC_ECC_CTRL_ECCDISABLE 0x000
  60. #define GPMC_ECC_CTRL_ECCREG1 0x001
  61. #define GPMC_ECC_CTRL_ECCREG2 0x002
  62. #define GPMC_ECC_CTRL_ECCREG3 0x003
  63. #define GPMC_ECC_CTRL_ECCREG4 0x004
  64. #define GPMC_ECC_CTRL_ECCREG5 0x005
  65. #define GPMC_ECC_CTRL_ECCREG6 0x006
  66. #define GPMC_ECC_CTRL_ECCREG7 0x007
  67. #define GPMC_ECC_CTRL_ECCREG8 0x008
  68. #define GPMC_ECC_CTRL_ECCREG9 0x009
  69. #define GPMC_CONFIG2_CSEXTRADELAY BIT(7)
  70. #define GPMC_CONFIG3_ADVEXTRADELAY BIT(7)
  71. #define GPMC_CONFIG4_OEEXTRADELAY BIT(7)
  72. #define GPMC_CONFIG4_WEEXTRADELAY BIT(23)
  73. #define GPMC_CONFIG6_CYCLE2CYCLEDIFFCSEN BIT(6)
  74. #define GPMC_CONFIG6_CYCLE2CYCLESAMECSEN BIT(7)
  75. #define GPMC_CS0_OFFSET 0x60
  76. #define GPMC_CS_SIZE 0x30
  77. #define GPMC_BCH_SIZE 0x10