]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | // SPDX-License-Identifier: GPL-2.0+ |
f9727161 MV |
2 | /* |
3 | * PPC-AG BG0900 board | |
4 | * | |
5 | * Copyright (C) 2013 Marek Vasut <[email protected]> | |
f9727161 MV |
6 | */ |
7 | ||
8 | #include <common.h> | |
691d719d | 9 | #include <init.h> |
90526e9f | 10 | #include <net.h> |
401d1c4f | 11 | #include <asm/global_data.h> |
f9727161 MV |
12 | #include <asm/gpio.h> |
13 | #include <asm/io.h> | |
14 | #include <asm/arch/imx-regs.h> | |
15 | #include <asm/arch/iomux-mx28.h> | |
16 | #include <asm/arch/clock.h> | |
17 | #include <asm/arch/sys_proto.h> | |
c05ed00a | 18 | #include <linux/delay.h> |
f9727161 MV |
19 | #include <linux/mii.h> |
20 | #include <miiphy.h> | |
21 | #include <netdev.h> | |
22 | #include <errno.h> | |
23 | ||
24 | DECLARE_GLOBAL_DATA_PTR; | |
25 | ||
26 | /* | |
27 | * Functions | |
28 | */ | |
29 | int board_early_init_f(void) | |
30 | { | |
31 | /* IO0 clock at 480MHz */ | |
32 | mxs_set_ioclk(MXC_IOCLK0, 480000); | |
33 | /* IO1 clock at 480MHz */ | |
34 | mxs_set_ioclk(MXC_IOCLK1, 480000); | |
35 | ||
36 | /* SSP2 clock at 160MHz */ | |
37 | mxs_set_sspclk(MXC_SSPCLK2, 160000, 0); | |
38 | ||
39 | return 0; | |
40 | } | |
41 | ||
42 | int dram_init(void) | |
43 | { | |
44 | return mxs_dram_init(); | |
45 | } | |
46 | ||
47 | int board_init(void) | |
48 | { | |
49 | /* Adress of boot parameters */ | |
50 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; | |
51 | ||
52 | return 0; | |
53 | } | |
54 | ||
55 | #ifdef CONFIG_CMD_NET | |
b75d8dc5 | 56 | int board_eth_init(struct bd_info *bis) |
f9727161 MV |
57 | { |
58 | struct mxs_clkctrl_regs *clkctrl_regs = | |
59 | (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE; | |
60 | struct eth_device *dev; | |
61 | int ret; | |
62 | ||
63 | ret = cpu_eth_init(bis); | |
64 | ||
65 | /* BG0900 uses ENET_CLK PAD to drive FEC clock */ | |
66 | writel(CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN, | |
67 | &clkctrl_regs->hw_clkctrl_enet); | |
68 | ||
69 | /* Reset FEC PHYs */ | |
70 | gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0); | |
71 | udelay(200); | |
72 | gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1); | |
73 | ||
74 | ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE); | |
75 | if (ret) { | |
76 | puts("FEC MXS: Unable to init FEC0\n"); | |
77 | return ret; | |
78 | } | |
79 | ||
80 | dev = eth_get_dev_by_name("FEC0"); | |
81 | if (!dev) { | |
82 | puts("FEC MXS: Unable to get FEC0 device entry\n"); | |
83 | return -EINVAL; | |
84 | } | |
85 | ||
86 | return ret; | |
87 | } | |
88 | ||
89 | #endif |