]> Git Repo - J-u-boot.git/blame - board/st/stv0991/stv0991.c
common: Drop init.h from common header
[J-u-boot.git] / board / st / stv0991 / stv0991.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
9fa32b12 2/*
1537d386
PC
3 * Copyright (C) 2014, STMicroelectronics - All Rights Reserved
4 * Author(s): Vikas Manocha, <[email protected]> for STMicroelectronics.
9fa32b12
VM
5 */
6
7#include <common.h>
52f24238 8#include <bootstage.h>
9d922450 9#include <dm.h>
691d719d 10#include <init.h>
9fa32b12 11#include <miiphy.h>
90526e9f 12#include <net.h>
9fa32b12
VM
13#include <asm/arch/stv0991_periph.h>
14#include <asm/arch/stv0991_defs.h>
2ce4eaf4
VM
15#include <asm/arch/hardware.h>
16#include <asm/arch/gpio.h>
17#include <netdev.h>
18#include <asm/io.h>
39e4795a 19#include <dm/platform_data/serial_pl01x.h>
9fa32b12
VM
20
21DECLARE_GLOBAL_DATA_PTR;
22
2ce4eaf4
VM
23struct gpio_regs *const gpioa_regs =
24 (struct gpio_regs *) GPIOA_BASE_ADDR;
25
e0320b74 26#ifndef CONFIG_OF_CONTROL
39e4795a
VM
27static const struct pl01x_serial_platdata serial_platdata = {
28 .base = 0x80406000,
29 .type = TYPE_PL011,
30 .clock = 2700 * 1000,
31};
32
33U_BOOT_DEVICE(stv09911_serials) = {
34 .name = "serial_pl01x",
35 .platdata = &serial_platdata,
36};
e0320b74 37#endif
39e4795a 38
9fa32b12
VM
39#ifdef CONFIG_SHOW_BOOT_PROGRESS
40void show_boot_progress(int progress)
41{
42 printf("%i\n", progress);
43}
44#endif
45
2ce4eaf4
VM
46void enable_eth_phy(void)
47{
48 /* Set GPIOA_06 pad HIGH (Appli board)*/
49 writel(readl(&gpioa_regs->dir) | 0x40, &gpioa_regs->dir);
50 writel(readl(&gpioa_regs->data) | 0x40, &gpioa_regs->data);
51}
52int board_eth_enable(void)
53{
54 stv0991_pinmux_config(ETH_GPIOB_10_31_C_0_4);
55 clock_setup(ETH_CLOCK_CFG);
56 enable_eth_phy();
57 return 0;
58}
59
54afb500
VM
60int board_qspi_enable(void)
61{
62 stv0991_pinmux_config(QSPI_CS_CLK_PAD);
63 clock_setup(QSPI_CLOCK_CFG);
64 return 0;
65}
66
9fa32b12
VM
67/*
68 * Miscellaneous platform dependent initialisations
69 */
70int board_init(void)
71{
2ce4eaf4 72 board_eth_enable();
54afb500 73 board_qspi_enable();
9fa32b12
VM
74 return 0;
75}
76
77int board_uart_init(void)
78{
79 stv0991_pinmux_config(UART_GPIOC_30_31);
80 clock_setup(UART_CLOCK_CFG);
81 return 0;
82}
2ce4eaf4 83
9fa32b12
VM
84#ifdef CONFIG_BOARD_EARLY_INIT_F
85int board_early_init_f(void)
86{
87 board_uart_init();
88 return 0;
89}
90#endif
91
92int dram_init(void)
93{
94 gd->ram_size = PHYS_SDRAM_1_SIZE;
95 return 0;
96}
97
76b00aca 98int dram_init_banksize(void)
9fa32b12
VM
99{
100 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
101 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
76b00aca
SG
102
103 return 0;
9fa32b12 104}
2ce4eaf4
VM
105
106#ifdef CONFIG_CMD_NET
107int board_eth_init(bd_t *bis)
108{
109 int ret = 0;
110
ef48f6dd 111#if defined(CONFIG_ETH_DESIGNWARE)
2ce4eaf4
VM
112 u32 interface = PHY_INTERFACE_MODE_MII;
113 if (designware_initialize(GMAC_BASE_ADDR, interface) >= 0)
114 ret++;
115#endif
116 return ret;
117}
118#endif
This page took 0.337029 seconds and 4 git commands to generate.