board_setup.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. *
  3. * BRIEF MODULE DESCRIPTION
  4. * 4G Systems MTX-1 board setup.
  5. *
  6. * Copyright 2003, 2008 MontaVista Software Inc.
  7. * Author: MontaVista Software, Inc. <source@mvista.com>
  8. * Bruno Randolf <bruno.randolf@4g-systems.biz>
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. */
  30. #include <linux/init.h>
  31. #include <asm/mach-au1x00/au1000.h>
  32. #include <prom.h>
  33. extern int (*board_pci_idsel)(unsigned int devsel, int assert);
  34. int mtx1_pci_idsel(unsigned int devsel, int assert);
  35. void board_reset(void)
  36. {
  37. /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
  38. au_writel(0x00000000, 0xAE00001C);
  39. }
  40. void __init board_setup(void)
  41. {
  42. #ifdef CONFIG_SERIAL_8250_CONSOLE
  43. char *argptr;
  44. argptr = prom_getcmdline();
  45. argptr = strstr(argptr, "console=");
  46. if (argptr == NULL) {
  47. argptr = prom_getcmdline();
  48. strcat(argptr, " console=ttyS0,115200");
  49. }
  50. #endif
  51. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  52. /* Enable USB power switch */
  53. au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR);
  54. au_writel(0x100000, GPIO2_OUTPUT);
  55. #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
  56. #ifdef CONFIG_PCI
  57. #if defined(__MIPSEB__)
  58. au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
  59. #else
  60. au_writel(0xf, Au1500_PCI_CFG);
  61. #endif
  62. #endif
  63. /* Initialize sys_pinfunc */
  64. au_writel(SYS_PF_NI2, SYS_PINFUNC);
  65. /* Initialize GPIO */
  66. au_writel(0xFFFFFFFF, SYS_TRIOUTCLR);
  67. au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */
  68. au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */
  69. au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
  70. au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */
  71. /* Enable LED and set it to green */
  72. au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR);
  73. au_writel(0x18000800, GPIO2_OUTPUT);
  74. board_pci_idsel = mtx1_pci_idsel;
  75. printk(KERN_INFO "4G Systems MTX-1 Board\n");
  76. }
  77. int
  78. mtx1_pci_idsel(unsigned int devsel, int assert)
  79. {
  80. #define MTX_IDSEL_ONLY_0_AND_3 0
  81. #if MTX_IDSEL_ONLY_0_AND_3
  82. if (devsel != 0 && devsel != 3) {
  83. printk(KERN_ERR "*** not 0 or 3\n");
  84. return 0;
  85. }
  86. #endif
  87. if (assert && devsel != 0)
  88. /* Suppress signal to Cardbus */
  89. au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */
  90. else
  91. au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
  92. au_sync_udelay(1);
  93. return 1;
  94. }