Alexey Brodkin | 511ab04 | 2014-02-04 12:56:19 +0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dwmmc.h> |
| 9 | #include <malloc.h> |
| 10 | #include <netdev.h> |
| 11 | #include <phy.h> |
Alexey Brodkin | f8f13b1 | 2015-04-09 19:50:58 +0300 | [diff] [blame] | 12 | #include "axs10x.h" |
Alexey Brodkin | 511ab04 | 2014-02-04 12:56:19 +0400 | [diff] [blame] | 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | int board_mmc_init(bd_t *bis) |
| 17 | { |
| 18 | struct dwmci_host *host = NULL; |
| 19 | |
| 20 | host = malloc(sizeof(struct dwmci_host)); |
| 21 | if (!host) { |
| 22 | printf("dwmci_host malloc fail!\n"); |
| 23 | return 1; |
| 24 | } |
| 25 | |
| 26 | memset(host, 0, sizeof(struct dwmci_host)); |
| 27 | host->name = "Synopsys Mobile storage"; |
| 28 | host->ioaddr = (void *)ARC_DWMMC_BASE; |
| 29 | host->buswidth = 4; |
| 30 | host->dev_index = 0; |
Alexey Brodkin | 95417cf | 2015-04-02 10:19:12 +0300 | [diff] [blame] | 31 | host->bus_hz = 50000000; |
Alexey Brodkin | 511ab04 | 2014-02-04 12:56:19 +0400 | [diff] [blame] | 32 | |
Alexey Brodkin | 95417cf | 2015-04-02 10:19:12 +0300 | [diff] [blame] | 33 | add_dwmci(host, host->bus_hz, 400000); |
Alexey Brodkin | 511ab04 | 2014-02-04 12:56:19 +0400 | [diff] [blame] | 34 | |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | int board_eth_init(bd_t *bis) |
| 39 | { |
Alexey Brodkin | b4d2ad0 | 2014-02-08 10:24:35 +0400 | [diff] [blame] | 40 | if (designware_initialize(ARC_DWGMAC_BASE, |
Alexey Brodkin | 511ab04 | 2014-02-04 12:56:19 +0400 | [diff] [blame] | 41 | PHY_INTERFACE_MODE_RGMII) >= 0) |
| 42 | return 1; |
| 43 | |
| 44 | return 0; |
| 45 | } |
Alexey Brodkin | f8f13b1 | 2015-04-09 19:50:58 +0300 | [diff] [blame] | 46 | |
| 47 | |
| 48 | #define AXS_MB_CREG 0xE0011000 |
| 49 | |
| 50 | int board_early_init_f(void) |
| 51 | { |
| 52 | if (readl((void __iomem *)AXS_MB_CREG + 0x234) & (1 << 28)) |
| 53 | gd->board_type = AXS_MB_V3; |
| 54 | else |
| 55 | gd->board_type = AXS_MB_V2; |
| 56 | |
| 57 | return 0; |
| 58 | } |