Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 2 | /* |
Tony Dinh | 670fffd | 2022-02-08 18:56:22 -0800 | [diff] [blame] | 3 | * Copyright (C) 2022 Tony Dinh <mibodhi@gmail.com> |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 4 | * Copyright (C) 2012 |
| 5 | * David Purdy <david.c.purdy@gmail.com> |
| 6 | * |
| 7 | * Based on Kirkwood support: |
| 8 | * (C) Copyright 2009 |
| 9 | * Marvell Semiconductor <www.marvell.com> |
| 10 | * Written-by: Prafulla Wadaskar <prafulla@marvell.com> |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 14 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 15 | #include <log.h> |
Tony Dinh | 670fffd | 2022-02-08 18:56:22 -0800 | [diff] [blame] | 16 | #include <netdev.h> |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 17 | #include <asm/arch/cpu.h> |
Stefan Roese | c243784 | 2014-10-22 12:13:06 +0200 | [diff] [blame] | 18 | #include <asm/arch/soc.h> |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 19 | #include <asm/arch/mpp.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 20 | #include <asm/global_data.h> |
Tony Dinh | 670fffd | 2022-02-08 18:56:22 -0800 | [diff] [blame] | 21 | #include <linux/bitops.h> |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 22 | |
| 23 | DECLARE_GLOBAL_DATA_PTR; |
| 24 | |
Tony Dinh | 670fffd | 2022-02-08 18:56:22 -0800 | [diff] [blame] | 25 | /* GPIO configuration */ |
| 26 | #define POGO_E02_OE_LOW (~(0)) |
| 27 | #define POGO_E02_OE_HIGH (~(0)) |
| 28 | #define POGO_E02_OE_VAL_LOW BIT(29) |
| 29 | #define POGO_E02_OE_VAL_HIGH 0 |
| 30 | |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 31 | int board_early_init_f(void) |
| 32 | { |
| 33 | /* |
| 34 | * default gpio configuration |
| 35 | * There are maximum 64 gpios controlled through 2 sets of registers |
| 36 | * the below configuration configures mainly initial LED status |
| 37 | */ |
Stefan Roese | c50ab39 | 2014-10-22 12:13:11 +0200 | [diff] [blame] | 38 | mvebu_config_gpio(POGO_E02_OE_VAL_LOW, |
| 39 | POGO_E02_OE_VAL_HIGH, |
| 40 | POGO_E02_OE_LOW, POGO_E02_OE_HIGH); |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 41 | |
| 42 | /* Multi-Purpose Pins Functionality configuration */ |
Albert ARIBAUD | 4d42431 | 2012-11-26 11:27:36 +0000 | [diff] [blame] | 43 | static const u32 kwmpp_config[] = { |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 44 | MPP0_NF_IO2, |
| 45 | MPP1_NF_IO3, |
| 46 | MPP2_NF_IO4, |
| 47 | MPP3_NF_IO5, |
| 48 | MPP4_NF_IO6, |
| 49 | MPP5_NF_IO7, |
| 50 | MPP6_SYSRST_OUTn, |
| 51 | MPP7_GPO, |
| 52 | MPP8_UART0_RTS, |
| 53 | MPP9_UART0_CTS, |
| 54 | MPP10_UART0_TXD, |
| 55 | MPP11_UART0_RXD, |
| 56 | MPP12_SD_CLK, |
| 57 | MPP13_SD_CMD, |
| 58 | MPP14_SD_D0, |
| 59 | MPP15_SD_D1, |
| 60 | MPP16_SD_D2, |
| 61 | MPP17_SD_D3, |
| 62 | MPP18_NF_IO0, |
| 63 | MPP19_NF_IO1, |
| 64 | MPP29_TSMP9, /* USB Power Enable */ |
| 65 | MPP48_GPIO, /* LED green */ |
| 66 | MPP49_GPIO, /* LED orange */ |
| 67 | 0 |
| 68 | }; |
Valentin Longchamp | 7d0d502 | 2012-06-01 01:31:00 +0000 | [diff] [blame] | 69 | kirkwood_mpp_conf(kwmpp_config, NULL); |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 70 | return 0; |
| 71 | } |
| 72 | |
Tony Dinh | 670fffd | 2022-02-08 18:56:22 -0800 | [diff] [blame] | 73 | int board_eth_init(struct bd_info *bis) |
| 74 | { |
| 75 | return cpu_eth_init(bis); |
| 76 | } |
| 77 | |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 78 | int board_init(void) |
| 79 | { |
| 80 | /* Boot parameters address */ |
Stefan Roese | 0b74175 | 2014-10-22 12:13:13 +0200 | [diff] [blame] | 81 | gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; |
David Purdy | 415d07e | 2012-03-27 16:01:09 +0000 | [diff] [blame] | 82 | |
| 83 | return 0; |
| 84 | } |