cpci405.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Board setup routines for the esd CPCI-405 cPCI Board.
  3. *
  4. * Author: Stefan Roese
  5. * stefan.roese@esd-electronics.com
  6. *
  7. * Copyright 2001 esd electronic system design - hannover germany
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. */
  15. #include <linux/config.h>
  16. #include <linux/init.h>
  17. #include <linux/pci.h>
  18. #include <asm/system.h>
  19. #include <asm/pci-bridge.h>
  20. #include <asm/machdep.h>
  21. #include <asm/todc.h>
  22. #include <asm/ocp.h>
  23. void *cpci405_nvram;
  24. /*
  25. * Some IRQs unique to CPCI-405.
  26. */
  27. int __init
  28. ppc405_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
  29. {
  30. static char pci_irq_table[][4] =
  31. /*
  32. * PCI IDSEL/INTPIN->INTLINE
  33. * A B C D
  34. */
  35. {
  36. {28, 28, 28, 28}, /* IDSEL 15 - cPCI slot 8 */
  37. {29, 29, 29, 29}, /* IDSEL 16 - cPCI slot 7 */
  38. {30, 30, 30, 30}, /* IDSEL 17 - cPCI slot 6 */
  39. {27, 27, 27, 27}, /* IDSEL 18 - cPCI slot 5 */
  40. {28, 28, 28, 28}, /* IDSEL 19 - cPCI slot 4 */
  41. {29, 29, 29, 29}, /* IDSEL 20 - cPCI slot 3 */
  42. {30, 30, 30, 30}, /* IDSEL 21 - cPCI slot 2 */
  43. };
  44. const long min_idsel = 15, max_idsel = 21, irqs_per_slot = 4;
  45. return PCI_IRQ_TABLE_LOOKUP;
  46. };
  47. void __init
  48. cpci405_setup_arch(void)
  49. {
  50. ppc4xx_setup_arch();
  51. ibm_ocp_set_emac(0, 0);
  52. TODC_INIT(TODC_TYPE_MK48T35, cpci405_nvram, cpci405_nvram, cpci405_nvram, 8);
  53. }
  54. void __init
  55. cpci405_map_io(void)
  56. {
  57. ppc4xx_map_io();
  58. cpci405_nvram = ioremap(CPCI405_NVRAM_PADDR, CPCI405_NVRAM_SIZE);
  59. }
  60. void __init
  61. platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
  62. unsigned long r6, unsigned long r7)
  63. {
  64. ppc4xx_init(r3, r4, r5, r6, r7);
  65. ppc_md.setup_arch = cpci405_setup_arch;
  66. ppc_md.setup_io_mappings = cpci405_map_io;
  67. ppc_md.time_init = todc_time_init;
  68. ppc_md.set_rtc_time = todc_set_rtc_time;
  69. ppc_md.get_rtc_time = todc_get_rtc_time;
  70. ppc_md.nvram_read_val = todc_direct_read_val;
  71. ppc_md.nvram_write_val = todc_direct_write_val;
  72. }