]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/st/stv0991/stv0991.c
989fb5e558c1937276b62d0e71b64fa8431f7c79
[karo-tx-uboot.git] / board / st / stv0991 / stv0991.c
1 /*
2  * (C) Copyright 2014
3  * Vikas Manocha, ST Micoelectronics, vikas.manocha@st.com.
4  *
5  * SPDX-License-Identifier:     GPL-2.0+
6  */
7
8 #include <common.h>
9 #include <miiphy.h>
10 #include <asm/arch/stv0991_periph.h>
11 #include <asm/arch/stv0991_defs.h>
12 #include <asm/arch/hardware.h>
13 #include <asm/arch/gpio.h>
14 #include <netdev.h>
15 #include <asm/io.h>
16
17 DECLARE_GLOBAL_DATA_PTR;
18
19 struct gpio_regs *const gpioa_regs =
20                 (struct gpio_regs *) GPIOA_BASE_ADDR;
21
22 #ifdef CONFIG_SHOW_BOOT_PROGRESS
23 void show_boot_progress(int progress)
24 {
25         printf("%i\n", progress);
26 }
27 #endif
28
29 void enable_eth_phy(void)
30 {
31         /* Set GPIOA_06 pad HIGH (Appli board)*/
32         writel(readl(&gpioa_regs->dir) | 0x40, &gpioa_regs->dir);
33         writel(readl(&gpioa_regs->data) | 0x40, &gpioa_regs->data);
34 }
35 int board_eth_enable(void)
36 {
37         stv0991_pinmux_config(ETH_GPIOB_10_31_C_0_4);
38         clock_setup(ETH_CLOCK_CFG);
39         enable_eth_phy();
40         return 0;
41 }
42
43 /*
44  * Miscellaneous platform dependent initialisations
45  */
46 int board_init(void)
47 {
48         board_eth_enable();
49         return 0;
50 }
51
52 int board_uart_init(void)
53 {
54         stv0991_pinmux_config(UART_GPIOC_30_31);
55         clock_setup(UART_CLOCK_CFG);
56         return 0;
57 }
58
59 #ifdef CONFIG_BOARD_EARLY_INIT_F
60 int board_early_init_f(void)
61 {
62         board_uart_init();
63         return 0;
64 }
65 #endif
66
67 int dram_init(void)
68 {
69         gd->ram_size = PHYS_SDRAM_1_SIZE;
70         return 0;
71 }
72
73 void dram_init_banksize(void)
74 {
75         gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
76         gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
77 }
78
79 #ifdef CONFIG_CMD_NET
80 int board_eth_init(bd_t *bis)
81 {
82         int ret = 0;
83
84 #if defined(CONFIG_DESIGNWARE_ETH)
85         u32 interface = PHY_INTERFACE_MODE_MII;
86         if (designware_initialize(GMAC_BASE_ADDR, interface) >= 0)
87                 ret++;
88 #endif
89         return ret;
90 }
91 #endif