uboot/arch/arm/mach-rockchip/rk3036/rk3036.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
   4 */
   5
   6#include <common.h>
   7#include <init.h>
   8#include <asm/io.h>
   9#include <asm/arch-rockchip/grf_rk3036.h>
  10#include <asm/arch-rockchip/hardware.h>
  11#include <asm/arch-rockchip/sdram_rk3036.h>
  12
  13DECLARE_GLOBAL_DATA_PTR;
  14
  15#ifdef CONFIG_DEBUG_UART_BOARD_INIT
  16void board_debug_uart_init(void)
  17{
  18#define GRF_BASE        0x20008000
  19        struct rk3036_grf * const grf = (void *)GRF_BASE;
  20        enum {
  21                GPIO1C3_SHIFT           = 6,
  22                GPIO1C3_MASK            = 3 << GPIO1C3_SHIFT,
  23                GPIO1C3_GPIO            = 0,
  24                GPIO1C3_MMC0_D1,
  25                GPIO1C3_UART2_SOUT,
  26
  27                GPIO1C2_SHIFT           = 4,
  28                GPIO1C2_MASK            = 3 << GPIO1C2_SHIFT,
  29                GPIO1C2_GPIO            = 0,
  30                GPIO1C2_MMC0_D0,
  31                GPIO1C2_UART2_SIN,
  32        };
  33        /*
  34         * NOTE: sd card and debug uart use same iomux in rk3036,
  35         * so if you enable uart,
  36         * you can not boot from sdcard
  37         */
  38        rk_clrsetreg(&grf->gpio1c_iomux,
  39                     GPIO1C3_MASK << GPIO1C3_SHIFT |
  40                     GPIO1C2_MASK << GPIO1C2_SHIFT,
  41                     GPIO1C3_UART2_SOUT << GPIO1C3_SHIFT |
  42                     GPIO1C2_UART2_SIN << GPIO1C2_SHIFT);
  43}
  44#endif
  45
  46#if !CONFIG_IS_ENABLED(RAM)
  47/*
  48 * When CONFIG_RAM is enabled, the dram_init() function is implemented
  49 * in sdram.c.
  50 */
  51int dram_init(void)
  52{
  53        gd->ram_size = sdram_size();
  54
  55        return 0;
  56}
  57#endif
  58