2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2014-11-18 18:42:22 +00:00
|
|
|
/*
|
2017-10-23 07:53:59 +00:00
|
|
|
* Copyright (C) 2014, STMicroelectronics - All Rights Reserved
|
|
|
|
* Author(s): Vikas Manocha, <vikas.manocha@st.com> for STMicroelectronics.
|
2014-11-18 18:42:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:00 +00:00
|
|
|
#include <bootstage.h>
|
2017-05-17 23:18:03 +00:00
|
|
|
#include <dm.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2014-11-18 18:42:22 +00:00
|
|
|
#include <miiphy.h>
|
2020-05-10 17:39:56 +00:00
|
|
|
#include <net.h>
|
2014-11-18 18:42:22 +00:00
|
|
|
#include <asm/arch/stv0991_periph.h>
|
|
|
|
#include <asm/arch/stv0991_defs.h>
|
2014-11-18 18:42:23 +00:00
|
|
|
#include <asm/arch/hardware.h>
|
|
|
|
#include <asm/arch/gpio.h>
|
|
|
|
#include <netdev.h>
|
2020-10-31 03:38:53 +00:00
|
|
|
#include <asm/global_data.h>
|
2014-11-18 18:42:23 +00:00
|
|
|
#include <asm/io.h>
|
2014-12-01 20:27:54 +00:00
|
|
|
#include <dm/platform_data/serial_pl01x.h>
|
2014-11-18 18:42:22 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2014-11-18 18:42:23 +00:00
|
|
|
struct gpio_regs *const gpioa_regs =
|
|
|
|
(struct gpio_regs *) GPIOA_BASE_ADDR;
|
|
|
|
|
2015-05-03 21:10:35 +00:00
|
|
|
#ifndef CONFIG_OF_CONTROL
|
2020-12-03 23:55:23 +00:00
|
|
|
static const struct pl01x_serial_plat serial_plat = {
|
2014-12-01 20:27:54 +00:00
|
|
|
.base = 0x80406000,
|
|
|
|
.type = TYPE_PL011,
|
|
|
|
.clock = 2700 * 1000,
|
|
|
|
};
|
|
|
|
|
2020-12-29 03:34:54 +00:00
|
|
|
U_BOOT_DRVINFO(stv09911_serials) = {
|
2014-12-01 20:27:54 +00:00
|
|
|
.name = "serial_pl01x",
|
2020-12-03 23:55:23 +00:00
|
|
|
.plat = &serial_plat,
|
2014-12-01 20:27:54 +00:00
|
|
|
};
|
2015-05-03 21:10:35 +00:00
|
|
|
#endif
|
2014-12-01 20:27:54 +00:00
|
|
|
|
2014-11-18 18:42:22 +00:00
|
|
|
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
|
|
|
void show_boot_progress(int progress)
|
|
|
|
{
|
|
|
|
printf("%i\n", progress);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-11-18 18:42:23 +00:00
|
|
|
void enable_eth_phy(void)
|
|
|
|
{
|
|
|
|
/* Set GPIOA_06 pad HIGH (Appli board)*/
|
|
|
|
writel(readl(&gpioa_regs->dir) | 0x40, &gpioa_regs->dir);
|
|
|
|
writel(readl(&gpioa_regs->data) | 0x40, &gpioa_regs->data);
|
|
|
|
}
|
|
|
|
int board_eth_enable(void)
|
|
|
|
{
|
|
|
|
stv0991_pinmux_config(ETH_GPIOB_10_31_C_0_4);
|
|
|
|
clock_setup(ETH_CLOCK_CFG);
|
|
|
|
enable_eth_phy();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-07-03 01:29:40 +00:00
|
|
|
int board_qspi_enable(void)
|
|
|
|
{
|
|
|
|
stv0991_pinmux_config(QSPI_CS_CLK_PAD);
|
|
|
|
clock_setup(QSPI_CLOCK_CFG);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-11-18 18:42:22 +00:00
|
|
|
/*
|
|
|
|
* Miscellaneous platform dependent initialisations
|
|
|
|
*/
|
|
|
|
int board_init(void)
|
|
|
|
{
|
2014-11-18 18:42:23 +00:00
|
|
|
board_eth_enable();
|
2015-07-03 01:29:40 +00:00
|
|
|
board_qspi_enable();
|
2014-11-18 18:42:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int board_uart_init(void)
|
|
|
|
{
|
|
|
|
stv0991_pinmux_config(UART_GPIOC_30_31);
|
|
|
|
clock_setup(UART_CLOCK_CFG);
|
|
|
|
return 0;
|
|
|
|
}
|
2014-11-18 18:42:23 +00:00
|
|
|
|
2014-11-18 18:42:22 +00:00
|
|
|
#ifdef CONFIG_BOARD_EARLY_INIT_F
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
|
|
|
board_uart_init();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int dram_init(void)
|
|
|
|
{
|
|
|
|
gd->ram_size = PHYS_SDRAM_1_SIZE;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-31 14:40:32 +00:00
|
|
|
int dram_init_banksize(void)
|
2014-11-18 18:42:22 +00:00
|
|
|
{
|
|
|
|
gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
|
|
|
gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
2017-03-31 14:40:32 +00:00
|
|
|
|
|
|
|
return 0;
|
2014-11-18 18:42:22 +00:00
|
|
|
}
|
2014-11-18 18:42:23 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_CMD_NET
|
2020-06-26 06:13:33 +00:00
|
|
|
int board_eth_init(struct bd_info *bis)
|
2014-11-18 18:42:23 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
2015-04-05 22:07:34 +00:00
|
|
|
#if defined(CONFIG_ETH_DESIGNWARE)
|
2014-11-18 18:42:23 +00:00
|
|
|
u32 interface = PHY_INTERFACE_MODE_MII;
|
|
|
|
if (designware_initialize(GMAC_BASE_ADDR, interface) >= 0)
|
|
|
|
ret++;
|
|
|
|
#endif
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|