soc_common.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * linux/drivers/pcmcia/soc_common.h
  4. *
  5. * Copyright (C) 2000 John G Dorsey <[email protected]>
  6. *
  7. * This file contains definitions for the PCMCIA support code common to
  8. * integrated SOCs like the SA-11x0 and PXA2xx microprocessors.
  9. */
  10. #ifndef _ASM_ARCH_PCMCIA
  11. #define _ASM_ARCH_PCMCIA
  12. /* include the world */
  13. #include <linux/clk.h>
  14. #include <linux/cpufreq.h>
  15. #include <pcmcia/cistpl.h>
  16. #include <pcmcia/soc_common.h>
  17. struct device;
  18. struct gpio_desc;
  19. struct pcmcia_low_level;
  20. struct regulator;
  21. struct skt_dev_info {
  22. int nskt;
  23. struct soc_pcmcia_socket skt[];
  24. };
  25. struct soc_pcmcia_timing {
  26. unsigned short io;
  27. unsigned short mem;
  28. unsigned short attr;
  29. };
  30. extern void soc_common_pcmcia_get_timing(struct soc_pcmcia_socket *, struct soc_pcmcia_timing *);
  31. void soc_pcmcia_init_one(struct soc_pcmcia_socket *skt,
  32. const struct pcmcia_low_level *ops, struct device *dev);
  33. void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt);
  34. int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt);
  35. int soc_pcmcia_request_gpiods(struct soc_pcmcia_socket *skt);
  36. void soc_common_cf_socket_state(struct soc_pcmcia_socket *skt,
  37. struct pcmcia_state *state);
  38. int soc_pcmcia_regulator_set(struct soc_pcmcia_socket *skt,
  39. struct soc_pcmcia_regulator *r, int v);
  40. #ifdef CONFIG_PCMCIA_DEBUG
  41. extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func,
  42. int lvl, const char *fmt, ...);
  43. #define debug(skt, lvl, fmt, arg...) \
  44. soc_pcmcia_debug(skt, __func__, lvl, fmt , ## arg)
  45. #else
  46. #define debug(skt, lvl, fmt, arg...) do { } while (0)
  47. #endif
  48. /*
  49. * The PC Card Standard, Release 7, section 4.13.4, says that twIORD
  50. * has a minimum value of 165ns. Section 4.13.5 says that twIOWR has
  51. * a minimum value of 165ns, as well. Section 4.7.2 (describing
  52. * common and attribute memory write timing) says that twWE has a
  53. * minimum value of 150ns for a 250ns cycle time (for 5V operation;
  54. * see section 4.7.4), or 300ns for a 600ns cycle time (for 3.3V
  55. * operation, also section 4.7.4). Section 4.7.3 says that taOE
  56. * has a maximum value of 150ns for a 300ns cycle time (for 5V
  57. * operation), or 300ns for a 600ns cycle time (for 3.3V operation).
  58. *
  59. * When configuring memory maps, Card Services appears to adopt the policy
  60. * that a memory access time of "0" means "use the default." The default
  61. * PCMCIA I/O command width time is 165ns. The default PCMCIA 5V attribute
  62. * and memory command width time is 150ns; the PCMCIA 3.3V attribute and
  63. * memory command width time is 300ns.
  64. */
  65. #define SOC_PCMCIA_IO_ACCESS (165)
  66. #define SOC_PCMCIA_5V_MEM_ACCESS (150)
  67. #define SOC_PCMCIA_3V_MEM_ACCESS (300)
  68. #define SOC_PCMCIA_ATTR_MEM_ACCESS (300)
  69. /*
  70. * The socket driver actually works nicely in interrupt-driven form,
  71. * so the (relatively infrequent) polling is "just to be sure."
  72. */
  73. #define SOC_PCMCIA_POLL_PERIOD (2*HZ)
  74. /* I/O pins replacing memory pins
  75. * (PCMCIA System Architecture, 2nd ed., by Don Anderson, p.75)
  76. *
  77. * These signals change meaning when going from memory-only to
  78. * memory-or-I/O interface:
  79. */
  80. #define iostschg bvd1
  81. #define iospkr bvd2
  82. #endif