blob: d018b5738242c6f131a446f5c4cde5c5cd2e25c9 [file] [log] [blame]
Tom Rini299f8f82021-07-07 22:55:41 -04001// SPDX-License-Identifier: GPL-2.0+
2/*
Tony Dinh64eb7492022-04-17 13:42:42 -07003 * Copyright (C) 2015, 2021-2022 Tony Dinh <mibodhi@gmail.com>
Tony Dinhde3ab5e2021-07-07 02:06:47 -07004 * Copyright (C) 2015 Gerald Kerma <dreagle@doukki.net>
Tom Rini299f8f82021-07-07 22:55:41 -04005 */
6
Tom Rini299f8f82021-07-07 22:55:41 -04007#include <init.h>
Tony Dinh64eb7492022-04-17 13:42:42 -07008#include <netdev.h>
Tom Rini299f8f82021-07-07 22:55:41 -04009#include <asm/arch/cpu.h>
10#include <asm/arch/soc.h>
11#include <asm/arch/mpp.h>
12#include <asm/global_data.h>
13#include <asm/io.h>
Tony Dinh64eb7492022-04-17 13:42:42 -070014#include <linux/bitops.h>
Tom Rini299f8f82021-07-07 22:55:41 -040015
16DECLARE_GLOBAL_DATA_PTR;
17
Tony Dinh64eb7492022-04-17 13:42:42 -070018/*
19 * low GPIO's
20 */
21#define HDD1_GREEN_LED BIT(16)
22#define HDD1_RED_LED BIT(13)
23#define USB_GREEN_LED BIT(15)
24#define USB_POWER BIT(21)
25#define SYS_GREEN_LED BIT(28)
26#define SYS_ORANGE_LED BIT(29)
27
28#define COPY_GREEN_LED BIT(22)
29#define COPY_RED_LED BIT(23)
30
31#define PIN_USB_GREEN_LED 15
32#define PIN_USB_POWER 21
33
34#define NSA310S_OE_LOW (~(0))
35#define NSA310S_VAL_LOW (SYS_GREEN_LED | USB_POWER)
36
37/*
38 * high GPIO's
39 */
40#define HDD2_GREEN_LED BIT(2)
41#define HDD2_POWER BIT(1)
42
43#define NSA310S_OE_HIGH (~(0))
44#define NSA310S_VAL_HIGH (HDD2_POWER)
45
Tom Rini299f8f82021-07-07 22:55:41 -040046int board_early_init_f(void)
47{
48 /*
49 * default gpio configuration
50 * There are maximum 64 gpios controlled through 2 sets of registers
51 * the below configuration configures mainly initial LED status
52 */
53 mvebu_config_gpio(NSA310S_VAL_LOW, NSA310S_VAL_HIGH,
54 NSA310S_OE_LOW, NSA310S_OE_HIGH);
55
56 /* (all LEDs & power off active high) */
57 /* Multi-Purpose Pins Functionality configuration */
58 static const u32 kwmpp_config[] = {
59 MPP0_NF_IO2,
60 MPP1_NF_IO3,
61 MPP2_NF_IO4,
62 MPP3_NF_IO5,
63 MPP4_NF_IO6,
64 MPP5_NF_IO7,
65 MPP6_SYSRST_OUTn,
66 MPP7_GPO,
67 MPP8_TW_SDA,
68 MPP9_TW_SCK,
69 MPP10_UART0_TXD,
70 MPP11_UART0_RXD,
71 MPP12_GPO,
72 MPP13_GPIO,
73 MPP14_GPIO,
74 MPP15_GPIO,
75 MPP16_GPIO,
76 MPP17_GPIO,
77 MPP18_NF_IO0,
78 MPP19_NF_IO1,
79 MPP20_GPIO,
80 MPP21_GPIO,
81 MPP22_GPIO,
82 MPP23_GPIO,
83 MPP24_GPIO,
84 MPP25_GPIO,
85 MPP26_GPIO,
86 MPP27_GPIO,
87 MPP28_GPIO,
88 MPP29_GPIO,
89 MPP30_GPIO,
90 MPP31_GPIO,
91 MPP32_GPIO,
92 MPP33_GPIO,
93 MPP34_GPIO,
94 MPP35_GPIO,
95 0
96 };
97 kirkwood_mpp_conf(kwmpp_config, NULL);
98 return 0;
99}
100
101int board_init(void)
102{
103 /* address of boot parameters */
104 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
105
106 return 0;
107}
108
Tony Dinh64eb7492022-04-17 13:42:42 -0700109int board_eth_init(struct bd_info *bis)
Tom Rini299f8f82021-07-07 22:55:41 -0400110{
Tony Dinh64eb7492022-04-17 13:42:42 -0700111 return cpu_eth_init(bis);
Tom Rini299f8f82021-07-07 22:55:41 -0400112}