colibri_pxa270.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Toradex Colibri PXA270 Support
  4. *
  5. * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com>
  6. * Copyright (C) 2016 Marcel Ziswiler <marcel.ziswiler@toradex.com>
  7. */
  8. #include <common.h>
  9. #include <dm.h>
  10. #include <asm/arch/hardware.h>
  11. #include <asm/arch/pxa.h>
  12. #include <asm/arch/regs-mmc.h>
  13. #include <asm/arch/regs-uart.h>
  14. #include <asm/io.h>
  15. #include <dm/platdata.h>
  16. #include <dm/platform_data/serial_pxa.h>
  17. #include <netdev.h>
  18. #include <serial.h>
  19. #include <usb.h>
  20. #include <asm/mach-types.h>
  21. #include "../common/tdx-common.h"
  22. DECLARE_GLOBAL_DATA_PTR;
  23. int board_init(void)
  24. {
  25. /* We have RAM, disable cache */
  26. dcache_disable();
  27. icache_disable();
  28. /* arch number of Toradex Colibri PXA270 */
  29. gd->bd->bi_arch_number = MACH_TYPE_COLIBRI;
  30. /* adress of boot parameters */
  31. gd->bd->bi_boot_params = 0xa0000100;
  32. return 0;
  33. }
  34. int checkboard(void)
  35. {
  36. puts("Model: Toradex Colibri PXA270\n");
  37. return 0;
  38. }
  39. #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
  40. int ft_board_setup(void *blob, bd_t *bd)
  41. {
  42. return ft_common_board_setup(blob, bd);
  43. }
  44. #endif
  45. int dram_init(void)
  46. {
  47. pxa2xx_dram_init();
  48. gd->ram_size = PHYS_SDRAM_1_SIZE;
  49. return 0;
  50. }
  51. #ifdef CONFIG_CMD_USB
  52. int board_usb_init(int index, enum usb_init_type init)
  53. {
  54. writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) &
  55. ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE),
  56. UHCHR);
  57. writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR);
  58. while (UHCHR & UHCHR_FSBIR)
  59. ;
  60. writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR);
  61. writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE);
  62. /* Clear any OTG Pin Hold */
  63. if (readl(PSSR) & PSSR_OTGPH)
  64. writel(readl(PSSR) | PSSR_OTGPH, PSSR);
  65. writel(readl(UHCRHDA) & ~(0x200), UHCRHDA);
  66. writel(readl(UHCRHDA) | 0x100, UHCRHDA);
  67. /* Set port power control mask bits, only 3 ports. */
  68. writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB);
  69. /* enable port 2 */
  70. writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS |
  71. UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR);
  72. return 0;
  73. }
  74. int board_usb_cleanup(int index, enum usb_init_type init)
  75. {
  76. return 0;
  77. }
  78. void usb_board_stop(void)
  79. {
  80. writel(readl(UHCHR) | UHCHR_FHR, UHCHR);
  81. udelay(11);
  82. writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR);
  83. writel(readl(UHCCOMS) | 1, UHCCOMS);
  84. udelay(10);
  85. writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN);
  86. return;
  87. }
  88. #endif
  89. #ifdef CONFIG_DRIVER_DM9000
  90. int board_eth_init(bd_t *bis)
  91. {
  92. return dm9000_initialize(bis);
  93. }
  94. #endif
  95. #ifdef CONFIG_CMD_MMC
  96. int board_mmc_init(bd_t *bis)
  97. {
  98. pxa_mmc_register(0);
  99. return 0;
  100. }
  101. #endif
  102. static const struct pxa_serial_platdata serial_platdata = {
  103. .base = (struct pxa_uart_regs *)FFUART_BASE,
  104. .port = FFUART_INDEX,
  105. .baudrate = CONFIG_BAUDRATE,
  106. };
  107. U_BOOT_DEVICE(pxa_serials) = {
  108. .name = "serial_pxa",
  109. .platdata = &serial_platdata,
  110. };