ns87308.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * (C) Copyright 2000
  3. * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <config.h>
  24. #include <ns87308.h>
  25. void initialise_ns87308 (void)
  26. {
  27. #ifdef CONFIG_SYS_NS87308_PS2MOD
  28. unsigned char data;
  29. /*
  30. * Switch floppy drive to PS/2 mode.
  31. */
  32. read_pnp_config(SUPOERIO_CONF1, &data);
  33. data &= 0xFB;
  34. write_pnp_config(SUPOERIO_CONF1, data);
  35. #endif
  36. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_KBC1)
  37. PNP_SET_DEVICE_BASE(LDEV_KBC1, CONFIG_SYS_NS87308_KBC1_BASE);
  38. write_pnp_config(LUN_CONFIG_REG, 0);
  39. write_pnp_config(CBASE_HIGH, 0x00);
  40. write_pnp_config(CBASE_LOW, 0x64);
  41. #endif
  42. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_MOUSE)
  43. PNP_ACTIVATE_DEVICE(LDEV_MOUSE);
  44. #endif
  45. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RTC_APC)
  46. PNP_SET_DEVICE_BASE(LDEV_RTC_APC, CONFIG_SYS_NS87308_RTC_BASE);
  47. #endif
  48. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_FDC)
  49. PNP_SET_DEVICE_BASE(LDEV_FDC, CONFIG_SYS_NS87308_FDC_BASE);
  50. write_pnp_config(LUN_CONFIG_REG, 0x40);
  51. #endif
  52. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_RARP)
  53. PNP_SET_DEVICE_BASE(LDEV_PARP, CONFIG_SYS_NS87308_LPT_BASE);
  54. #endif
  55. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART1)
  56. PNP_SET_DEVICE_BASE(LDEV_UART1, CONFIG_SYS_NS87308_UART1_BASE);
  57. #endif
  58. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_UART2)
  59. PNP_SET_DEVICE_BASE(LDEV_UART2, CONFIG_SYS_NS87308_UART2_BASE);
  60. #endif
  61. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_GPIO)
  62. PNP_SET_DEVICE_BASE(LDEV_GPIO, CONFIG_SYS_NS87308_GPIO_BASE);
  63. #endif
  64. #if (CONFIG_SYS_NS87308_DEVS & CONFIG_SYS_NS87308_POWRMAN)
  65. #ifndef CONFIG_SYS_NS87308_PWMAN_BASE
  66. PNP_ACTIVATE_DEVICE(LDEV_POWRMAN);
  67. #else
  68. PNP_SET_DEVICE_BASE(LDEV_POWRMAN, CONFIG_SYS_NS87308_PWMAN_BASE);
  69. /*
  70. * Enable all units
  71. */
  72. write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER1, 0x7d);
  73. write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_FER2, 0x87);
  74. #ifdef CONFIG_SYS_NS87308_PMC1
  75. write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC1, CONFIG_SYS_NS87308_PMC1);
  76. #endif
  77. #ifdef CONFIG_SYS_NS87308_PMC2
  78. write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC2, CONFIG_SYS_NS87308_PMC2);
  79. #endif
  80. #ifdef CONFIG_SYS_NS87308_PMC3
  81. write_pm_reg(CONFIG_SYS_NS87308_PWMAN_BASE, PWM_PMC3, CONFIG_SYS_NS87308_PMC3);
  82. #endif
  83. #endif
  84. #endif
  85. #ifdef CONFIG_SYS_NS87308_CS0_BASE
  86. PNP_PGCS_CSLINE_BASE(0, CONFIG_SYS_NS87308_CS0_BASE);
  87. PNP_PGCS_CSLINE_CONF(0, CONFIG_SYS_NS87308_CS0_CONF);
  88. #endif
  89. #ifdef CONFIG_SYS_NS87308_CS1_BASE
  90. PNP_PGCS_CSLINE_BASE(1, CONFIG_SYS_NS87308_CS1_BASE);
  91. PNP_PGCS_CSLINE_CONF(1, CONFIG_SYS_NS87308_CS1_CONF);
  92. #endif
  93. #ifdef CONFIG_SYS_NS87308_CS2_BASE
  94. PNP_PGCS_CSLINE_BASE(2, CONFIG_SYS_NS87308_CS2_BASE);
  95. PNP_PGCS_CSLINE_CONF(2, CONFIG_SYS_NS87308_CS2_CONF);
  96. #endif
  97. }