board-omapl138-hawk.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Hawkboard.org based on TI's OMAP-L138 Platform
  3. *
  4. * Initial code: Syed Mohammed Khasim
  5. *
  6. * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com
  7. *
  8. * This file is licensed under the terms of the GNU General Public License
  9. * version 2. This program is licensed "as is" without any warranty of
  10. * any kind, whether express or implied.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/console.h>
  15. #include <linux/gpio.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <mach/cp_intc.h>
  19. #include <mach/da8xx.h>
  20. #include <mach/mux.h>
  21. #define HAWKBOARD_PHY_ID "0:07"
  22. static short omapl138_hawk_mii_pins[] __initdata = {
  23. DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
  24. DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
  25. DA850_MII_CRS, DA850_MII_RXCLK, DA850_MII_RXDV, DA850_MII_RXD_3,
  26. DA850_MII_RXD_2, DA850_MII_RXD_1, DA850_MII_RXD_0, DA850_MDIO_CLK,
  27. DA850_MDIO_D,
  28. -1
  29. };
  30. static __init void omapl138_hawk_config_emac(void)
  31. {
  32. void __iomem *cfgchip3 = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
  33. int ret;
  34. u32 val;
  35. struct davinci_soc_info *soc_info = &davinci_soc_info;
  36. val = __raw_readl(cfgchip3);
  37. val &= ~BIT(8);
  38. ret = davinci_cfg_reg_list(omapl138_hawk_mii_pins);
  39. if (ret) {
  40. pr_warning("%s: cpgmac/mii mux setup failed: %d\n",
  41. __func__, ret);
  42. return;
  43. }
  44. /* configure the CFGCHIP3 register for MII */
  45. __raw_writel(val, cfgchip3);
  46. pr_info("EMAC: MII PHY configured\n");
  47. soc_info->emac_pdata->phy_id = HAWKBOARD_PHY_ID;
  48. ret = da8xx_register_emac();
  49. if (ret)
  50. pr_warning("%s: emac registration failed: %d\n",
  51. __func__, ret);
  52. }
  53. static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
  54. .enabled_uarts = 0x7,
  55. };
  56. static __init void omapl138_hawk_init(void)
  57. {
  58. int ret;
  59. davinci_serial_init(&omapl138_hawk_uart_config);
  60. omapl138_hawk_config_emac();
  61. ret = da8xx_register_watchdog();
  62. if (ret)
  63. pr_warning("omapl138_hawk_init: "
  64. "watchdog registration failed: %d\n",
  65. ret);
  66. }
  67. #ifdef CONFIG_SERIAL_8250_CONSOLE
  68. static int __init omapl138_hawk_console_init(void)
  69. {
  70. if (!machine_is_omapl138_hawkboard())
  71. return 0;
  72. return add_preferred_console("ttyS", 2, "115200");
  73. }
  74. console_initcall(omapl138_hawk_console_init);
  75. #endif
  76. static void __init omapl138_hawk_map_io(void)
  77. {
  78. da850_init();
  79. }
  80. MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
  81. .boot_params = (DA8XX_DDR_BASE + 0x100),
  82. .map_io = omapl138_hawk_map_io,
  83. .init_irq = cp_intc_init,
  84. .timer = &davinci_timer,
  85. .init_machine = omapl138_hawk_init,
  86. MACHINE_END