X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2Fdavinci%2Fda8xxevm%2Fomapl138_lcdk.c;h=84603cb117104dfc3f4800a3948609c58bc34045;hb=5575f79bdaa824a90747d5a3d063b5219521b066;hp=bef2570af6e0fca617dae6b0af2177dff3245a01;hpb=d8c1d5d5fb6eafbc532982125f006e49f2c40e71;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c index bef2570..84603cb 100644 --- a/board/davinci/da8xxevm/omapl138_lcdk.c +++ b/board/davinci/da8xxevm/omapl138_lcdk.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ * @@ -5,34 +6,22 @@ * * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. * Copyright (C) 2007 Sergey Kubushyn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include +#include #include +#include #include -#include -#include -#include #include #include #include -#include +#include +#include +#include +#include #include -#ifdef CONFIG_DAVINCI_MMC +#ifdef CONFIG_MMC_DAVINCI #include #include #endif @@ -41,7 +30,7 @@ DECLARE_GLOBAL_DATA_PTR; #define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) -#ifdef CONFIG_DAVINCI_MMC +#ifdef CONFIG_MMC_DAVINCI /* MMC0 pin muxer settings */ const struct pinmux_config mmc0_pins[] = { /* GP0[11] is required for SD to work on Rev 3 EVMs */ @@ -142,7 +131,7 @@ const struct lpsc_resource lpsc[] = { { DAVINCI_LPSC_EMAC }, /* image download */ { DAVINCI_LPSC_UART2 }, /* console */ { DAVINCI_LPSC_GPIO }, -#ifdef CONFIG_DAVINCI_MMC +#ifdef CONFIG_MMC_DAVINCI { DAVINCI_LPSC_MMC_SD }, #endif }; @@ -183,9 +172,7 @@ int board_early_init_f(void) int board_init(void) { -#ifndef CONFIG_USE_IRQ irq_init(); -#endif /* arch number of the board */ gd->bd->bi_arch_number = MACH_TYPE_OMAPL138_LCDK; @@ -222,7 +209,7 @@ int board_init(void) #endif -#ifdef CONFIG_DAVINCI_MMC +#ifdef CONFIG_MMC_DAVINCI if (davinci_configure_pin_mux(mmc0_pins, ARRAY_SIZE(mmc0_pins)) != 0) return 1; #endif @@ -241,23 +228,6 @@ int board_init(void) return 0; } -#ifdef CONFIG_DRIVER_TI_EMAC - -/* - * Initializes on-board ethernet controllers. - */ -int board_eth_init(bd_t *bis) -{ - if (!davinci_emac_initialize()) { - printf("Error: Ethernet init failed!\n"); - return -1; - } - - return 0; -} - -#endif /* CONFIG_DRIVER_TI_EMAC */ - #define CFG_MAC_ADDR_SPI_BUS 0 #define CFG_MAC_ADDR_SPI_CS 0 #define CFG_MAC_ADDR_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED @@ -306,7 +276,7 @@ static void dspwake(void) if ((REG(CHIP_REV_ID_REG) & 0x3f) == 0x10) return; - if (!strcmp(getenv("dspwake"), "no")) + if (!strcmp(env_get("dspwake"), "no")) return; *resetvect++ = 0x1E000; /* DSP Idle */ @@ -336,7 +306,7 @@ int misc_init_r(void) uint8_t tmp[20], addr[10]; - if (getenv("ethaddr") == NULL) { + if (env_get("ethaddr") == NULL) { /* Read Ethernet MAC address from EEPROM */ if (dvevm_read_mac_address(addr)) { /* Set Ethernet MAC address from EEPROM */ @@ -345,15 +315,17 @@ int misc_init_r(void) get_mac_addr(addr); } - if (is_multicast_ethaddr(addr) || is_zero_ethaddr(addr)) { + if (!is_multicast_ethaddr(addr) && !is_zero_ethaddr(addr)) { + sprintf((char *)tmp, "%02x:%02x:%02x:%02x:%02x:%02x", + addr[0], addr[1], addr[2], addr[3], addr[4], + addr[5]); + + env_set("ethaddr", (char *)tmp); + } else { printf("Invalid MAC address read.\n"); - return -EINVAL; } - sprintf((char *)tmp, "%02x:%02x:%02x:%02x:%02x:%02x", addr[0], - addr[1], addr[2], addr[3], addr[4], addr[5]); - - setenv("ethaddr", (char *)tmp); } + #ifdef CONFIG_DRIVER_TI_EMAC_USE_RMII /* Select RMII fucntion through the expander */ if (rmii_hw_init()) @@ -365,12 +337,12 @@ int misc_init_r(void) return 0; } -#ifdef CONFIG_DAVINCI_MMC +#if !CONFIG_IS_ENABLED(DM_MMC) +#ifdef CONFIG_MMC_DAVINCI static struct davinci_mmc mmc_sd0 = { .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE, .host_caps = MMC_MODE_4BIT, /* DA850 supports only 4-bit SD/MMC */ .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, - .version = MMC_CTLR_VERSION_2, }; int board_mmc_init(bd_t *bis) @@ -381,3 +353,39 @@ int board_mmc_init(bd_t *bis) return davinci_mmc_init(bis, &mmc_sd0); } #endif +#endif + +#ifdef CONFIG_SPL_BUILD +static const struct ns16550_platdata serial_pdata = { + .base = DAVINCI_UART2_BASE, + .reg_shift = 2, + .clock = 228000000, + .fcr = UART_FCR_DEFVAL, +}; + +U_BOOT_DEVICE(omapl138_uart) = { + .name = "ns16550_serial", + .platdata = &serial_pdata, +}; + +static const struct davinci_mmc_plat mmc_platdata = { + .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE, + .cfg = { + .f_min = 200000, + .f_max = 25000000, + .voltages = MMC_VDD_32_33 | MMC_VDD_33_34, + .host_caps = MMC_MODE_4BIT, + .b_max = DAVINCI_MAX_BLOCKS, + .name = "da830-mmc", + }, +}; +U_BOOT_DEVICE(omapl138_mmc) = { + .name = "davinci_mmc", + .platdata = &mmc_platdata, +}; + +void spl_board_init(void) +{ + davinci_configure_pin_mux(mmc0_pins, ARRAY_SIZE(mmc0_pins)); +} +#endif