blob: 889ce70d758ce7fa49d138f9d8ff45621c2623f2 [file] [log] [blame]
Chris Packhamc6408d12018-06-25 22:34:57 +12001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2010, 2018
4 * Allied Telesis <www.alliedtelesis.com>
5 */
6
7#include <common.h>
8#include <miiphy.h>
Simon Glass0c364412019-12-28 10:44:48 -07009#include <net.h>
Chris Packhamc6408d12018-06-25 22:34:57 +120010#include <netdev.h>
11#include <led.h>
12#include <linux/io.h>
13#include <asm/arch/cpu.h>
14#include <asm/arch/soc.h>
15#include <asm/arch/mpp.h>
16#include <asm/arch/gpio.h>
17
18#define SBX81LIFXCAT_OE_LOW (~0)
19#define SBX81LIFXCAT_OE_HIGH (~BIT(11))
20#define SBX81LIFXCAT_OE_VAL_LOW (0)
21#define SBX81LIFXCAT_OE_VAL_HIGH (BIT(11))
22
23DECLARE_GLOBAL_DATA_PTR;
24
25int board_early_init_f(void)
26{
27 /*
28 * default gpio configuration
29 * There are maximum 64 gpios controlled through 2 sets of registers
30 * the below configuration configures mainly initial LED status
31 */
32 mvebu_config_gpio(SBX81LIFXCAT_OE_VAL_LOW,
33 SBX81LIFXCAT_OE_VAL_HIGH,
34 SBX81LIFXCAT_OE_LOW, SBX81LIFXCAT_OE_HIGH);
35
36 /* Multi-Purpose Pins Functionality configuration */
37 static const u32 kwmpp_config[] = {
38 MPP0_SPI_SCn,
39 MPP1_SPI_MOSI,
40 MPP2_SPI_SCK,
41 MPP3_SPI_MISO,
42 MPP4_NF_IO6,
43 MPP5_NF_IO7,
44 MPP6_SYSRST_OUTn,
45 MPP7_GPO,
46 MPP8_TW_SDA,
47 MPP9_TW_SCK,
48 MPP10_UART0_TXD,
49 MPP11_UART0_RXD,
50 MPP12_GPO,
51 MPP13_UART1_TXD,
52 MPP14_UART1_RXD,
53 MPP15_GPIO,
54 MPP16_GPIO,
55 MPP17_GPIO,
56 MPP18_NF_IO0,
57 MPP19_NF_IO1,
58 MPP20_GE1_0,
59 MPP21_GE1_1,
60 MPP22_GE1_2,
61 MPP23_GE1_3,
62 MPP24_GE1_4,
63 MPP25_GE1_5,
64 MPP26_GE1_6,
65 MPP27_GE1_7,
66 MPP28_GE1_8,
67 MPP29_GE1_9,
68 MPP30_GE1_10,
69 MPP31_GE1_11,
70 MPP32_GE1_12,
71 MPP33_GE1_13,
72 MPP34_GPIO,
73 MPP35_GPIO,
74 MPP36_GPIO,
75 MPP37_GPIO,
76 MPP38_GPIO,
77 MPP39_GPIO,
78 MPP40_GPIO,
79 MPP41_GPIO,
80 MPP42_GPIO,
81 MPP43_GPIO,
82 MPP44_GPIO,
83 MPP45_GPIO,
84 MPP46_GPIO,
85 MPP47_GPIO,
86 MPP48_GPIO,
87 MPP49_GPIO,
88 0
89 };
90
91 kirkwood_mpp_conf(kwmpp_config, NULL);
92 return 0;
93}
94
95int board_init(void)
96{
97 /* address of boot parameters */
98 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
99
100 return 0;
101}
102
103#ifdef CONFIG_RESET_PHY_R
104/* automatically defined by kirkwood config.h */
105void reset_phy(void)
106{
107}
108#endif
109
110#ifdef CONFIG_MV88E61XX_SWITCH
111int mv88e61xx_hw_reset(struct phy_device *phydev)
112{
113 phydev->advertising = ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full;
114
115 return 0;
116}
117#endif
118
119#ifdef CONFIG_MISC_INIT_R
120int misc_init_r(void)
121{
122 struct udevice *dev;
123 int ret;
124
125 ret = led_get_by_label("status:ledp", &dev);
126 if (!ret)
127 led_set_state(dev, LEDST_ON);
128
129 ret = led_get_by_label("status:ledn", &dev);
130 if (!ret)
131 led_set_state(dev, LEDST_OFF);
132
133 return 0;
134}
135#endif