work_92105.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * WORK Microwave work_92105 board support
  4. *
  5. * (C) Copyright 2014 DENX Software Engineering GmbH
  6. * Written-by: Albert ARIBAUD <albert.aribaud@3adev.fr>
  7. */
  8. #include <common.h>
  9. #include <init.h>
  10. #include <asm/global_data.h>
  11. #include <asm/io.h>
  12. #include <asm/arch/sys_proto.h>
  13. #include <asm/arch/cpu.h>
  14. #include <asm/arch/clk.h>
  15. #include <asm/arch/emc.h>
  16. #include <asm/arch/wdt.h>
  17. #include <asm/gpio.h>
  18. #include <spl.h>
  19. #include <linux/delay.h>
  20. #include "work_92105_display.h"
  21. DECLARE_GLOBAL_DATA_PTR;
  22. static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE;
  23. static struct wdt_regs *wdt = (struct wdt_regs *)WDT_BASE;
  24. void reset_periph(void)
  25. {
  26. setbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  27. writel(WDTIM_MCTRL_RESFRC1, &wdt->mctrl);
  28. udelay(150);
  29. writel(0, &wdt->mctrl);
  30. clrbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  31. }
  32. int board_early_init_f(void)
  33. {
  34. /* initialize serial port for console */
  35. lpc32xx_uart_init(CONFIG_CONS_INDEX);
  36. /* enable I2C, SSP, MAC, NAND */
  37. lpc32xx_i2c_init(1); /* only I2C1 has devices, I2C2 has none */
  38. lpc32xx_ssp_init();
  39. lpc32xx_mac_init();
  40. lpc32xx_mlc_nand_init();
  41. /* Display must wait until after relocation and devices init */
  42. return 0;
  43. }
  44. #define GPO_19 115
  45. int board_early_init_r(void)
  46. {
  47. /* Set NAND !WP to 1 through GPO_19 */
  48. gpio_request(GPO_19, "NAND_nWP");
  49. gpio_direction_output(GPO_19, 1);
  50. #ifdef CONFIG_DEPRECATED
  51. /* initialize display */
  52. work_92105_display_init();
  53. #endif
  54. return 0;
  55. }
  56. int board_init(void)
  57. {
  58. reset_periph();
  59. /* adress of boot parameters */
  60. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  61. return 0;
  62. }
  63. int dram_init(void)
  64. {
  65. gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
  66. CONFIG_SYS_SDRAM_SIZE);
  67. return 0;
  68. }