common.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * arch/arm/mach-orion/common.c
  3. *
  4. * Core functions for Marvell Orion System On Chip
  5. *
  6. * Maintainer: Tzachi Perelstein <tzachi@marvell.com>
  7. *
  8. * This file is licensed under the terms of the GNU General Public
  9. * License version 2. This program is licensed "as is" without any
  10. * warranty of any kind, whether express or implied.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <asm/page.h>
  15. #include <asm/timex.h>
  16. #include <asm/mach/map.h>
  17. #include <asm/arch/orion.h>
  18. #include "common.h"
  19. /*****************************************************************************
  20. * I/O Address Mapping
  21. ****************************************************************************/
  22. static struct map_desc orion_io_desc[] __initdata = {
  23. {
  24. .virtual = ORION_REGS_BASE,
  25. .pfn = __phys_to_pfn(ORION_REGS_BASE),
  26. .length = ORION_REGS_SIZE,
  27. .type = MT_DEVICE
  28. },
  29. {
  30. .virtual = ORION_PCIE_IO_BASE,
  31. .pfn = __phys_to_pfn(ORION_PCIE_IO_BASE),
  32. .length = ORION_PCIE_IO_SIZE,
  33. .type = MT_DEVICE
  34. },
  35. {
  36. .virtual = ORION_PCI_IO_BASE,
  37. .pfn = __phys_to_pfn(ORION_PCI_IO_BASE),
  38. .length = ORION_PCI_IO_SIZE,
  39. .type = MT_DEVICE
  40. },
  41. {
  42. .virtual = ORION_PCIE_WA_BASE,
  43. .pfn = __phys_to_pfn(ORION_PCIE_WA_BASE),
  44. .length = ORION_PCIE_WA_SIZE,
  45. .type = MT_DEVICE
  46. },
  47. };
  48. void __init orion_map_io(void)
  49. {
  50. iotable_init(orion_io_desc, ARRAY_SIZE(orion_io_desc));
  51. }
  52. /*****************************************************************************
  53. * General
  54. ****************************************************************************/
  55. /*
  56. * Identify device ID and rev from PCIE configuration header space '0'.
  57. */
  58. static void orion_id(u32 *dev, u32 *rev, char **dev_name)
  59. {
  60. orion_pcie_id(dev, rev);
  61. if (*dev == MV88F5281_DEV_ID) {
  62. if (*rev == MV88F5281_REV_D2) {
  63. *dev_name = "MV88F5281-D2";
  64. } else if (*rev == MV88F5281_REV_D1) {
  65. *dev_name = "MV88F5281-D1";
  66. } else {
  67. *dev_name = "MV88F5281-Rev-Unsupported";
  68. }
  69. } else if (*dev == MV88F5182_DEV_ID) {
  70. if (*rev == MV88F5182_REV_A2) {
  71. *dev_name = "MV88F5182-A2";
  72. } else {
  73. *dev_name = "MV88F5182-Rev-Unsupported";
  74. }
  75. } else {
  76. *dev_name = "Device-Unknown";
  77. }
  78. }
  79. void __init orion_init(void)
  80. {
  81. char *dev_name;
  82. u32 dev, rev;
  83. orion_id(&dev, &rev, &dev_name);
  84. printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, ORION_TCLK);
  85. /*
  86. * Setup Orion address map
  87. */
  88. orion_setup_cpu_wins();
  89. orion_setup_usb_wins();
  90. orion_setup_eth_wins();
  91. orion_setup_pci_wins();
  92. orion_setup_pcie_wins();
  93. if (dev == MV88F5182_DEV_ID)
  94. orion_setup_sata_wins();
  95. }