dm355leopard.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*
  2. * Copyright (C) 2009 Texas Instruments Incorporated
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #include <common.h>
  19. #include <nand.h>
  20. #include <asm/io.h>
  21. #include <asm/arch/hardware.h>
  22. #include <asm/arch/gpio_defs.h>
  23. #include <asm/arch/nand_defs.h>
  24. #include "../common/misc.h"
  25. #include <net.h>
  26. #include <netdev.h>
  27. DECLARE_GLOBAL_DATA_PTR;
  28. int board_init(void)
  29. {
  30. struct davinci_gpio *gpio01_base =
  31. (struct davinci_gpio *)DAVINCI_GPIO_BANK01;
  32. struct davinci_gpio *gpio23_base =
  33. (struct davinci_gpio *)DAVINCI_GPIO_BANK23;
  34. struct davinci_gpio *gpio67_base =
  35. (struct davinci_gpio *)DAVINCI_GPIO_BANK67;
  36. gd->bd->bi_arch_number = MACH_TYPE_DM355_LEOPARD;
  37. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  38. /* GIO 9 & 10 are used for IO */
  39. writel((readl(PINMUX3) & 0XF8FFFFFF), PINMUX3);
  40. /* Interrupt set GIO 9 */
  41. writel((readl(DAVINCI_GPIO_BINTEN) | 0x1), DAVINCI_GPIO_BINTEN);
  42. /* set GIO 9 input */
  43. writel((readl(&gpio01_base->dir) | (1 << 9)), &gpio01_base->dir);
  44. /* Both edge trigger GIO 9 */
  45. writel((readl(&gpio01_base->set_rising) | (1 << 9)),
  46. &gpio01_base->set_rising);
  47. writel((readl(&gpio01_base->dir) & ~(1 << 5)), &gpio01_base->dir);
  48. /* output low */
  49. writel((readl(&gpio01_base->set_data) & ~(1 << 5)),
  50. &gpio01_base->set_data);
  51. /* set GIO 10 output */
  52. writel((readl(&gpio01_base->dir) & ~(1 << 10)), &gpio01_base->dir);
  53. /* output high */
  54. writel((readl(&gpio01_base->set_data) | (1 << 10)),
  55. &gpio01_base->set_data);
  56. /* set GIO 32 output */
  57. writel((readl(&gpio23_base->dir) & ~(1 << 0)), &gpio23_base->dir);
  58. /* output High */
  59. writel((readl(&gpio23_base->set_data) | (1 << 0)),
  60. &gpio23_base->set_data);
  61. /* Enable UART1 MUX Lines */
  62. writel((readl(PINMUX0) & ~3), PINMUX0);
  63. writel((readl(&gpio67_base->dir) & ~(1 << 6)), &gpio67_base->dir);
  64. writel((readl(&gpio67_base->set_data) | (1 << 6)),
  65. &gpio67_base->set_data);
  66. return 0;
  67. }
  68. #ifdef CONFIG_DRIVER_DM9000
  69. int board_eth_init(bd_t *bis)
  70. {
  71. return dm9000_initialize(bis);
  72. }
  73. #endif
  74. #ifdef CONFIG_NAND_DAVINCI
  75. int board_nand_init(struct nand_chip *nand)
  76. {
  77. davinci_nand_init(nand);
  78. return 0;
  79. }
  80. #endif