19b914727SLuka Perkov /* 29b914727SLuka Perkov * Copyright (C) 2009-2012 39b914727SLuka Perkov * Wojciech Dubowik <wojciech.dubowik@neratec.com> 43fdf7596SLuka Perkov * Luka Perkov <luka@openwrt.org> 59b914727SLuka Perkov * 69b914727SLuka Perkov * See file CREDITS for list of people who contributed to this 79b914727SLuka Perkov * project. 89b914727SLuka Perkov * 99b914727SLuka Perkov * This program is free software; you can redistribute it and/or 109b914727SLuka Perkov * modify it under the terms of the GNU General Public License as 119b914727SLuka Perkov * published by the Free Software Foundation; either version 2 of 129b914727SLuka Perkov * the License, or (at your option) any later version. 139b914727SLuka Perkov * 149b914727SLuka Perkov * This program is distributed in the hope that it will be useful, 159b914727SLuka Perkov * but WITHOUT ANY WARRANTY; without even the implied warranty of 169b914727SLuka Perkov * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 179b914727SLuka Perkov * GNU General Public License for more details. 189b914727SLuka Perkov * 199b914727SLuka Perkov * You should have received a copy of the GNU General Public License 209b914727SLuka Perkov * along with this program. If not, see <http://www.gnu.org/licenses/>. 219b914727SLuka Perkov */ 229b914727SLuka Perkov 239b914727SLuka Perkov #include <common.h> 249b914727SLuka Perkov #include <miiphy.h> 259b914727SLuka Perkov #include <asm/arch/cpu.h> 269b914727SLuka Perkov #include <asm/arch/kirkwood.h> 279b914727SLuka Perkov #include <asm/arch/mpp.h> 289b914727SLuka Perkov #include "iconnect.h" 299b914727SLuka Perkov 309b914727SLuka Perkov DECLARE_GLOBAL_DATA_PTR; 319b914727SLuka Perkov 329b914727SLuka Perkov int board_early_init_f(void) 339b914727SLuka Perkov { 349b914727SLuka Perkov /* 359b914727SLuka Perkov * default gpio configuration 369b914727SLuka Perkov * There are maximum 64 gpios controlled through 2 sets of registers 379b914727SLuka Perkov * the below configuration configures mainly initial LED status 389b914727SLuka Perkov */ 399b914727SLuka Perkov kw_config_gpio(ICONNECT_OE_VAL_LOW, 409b914727SLuka Perkov ICONNECT_OE_VAL_HIGH, 419b914727SLuka Perkov ICONNECT_OE_LOW, ICONNECT_OE_HIGH); 429b914727SLuka Perkov 439b914727SLuka Perkov /* Multi-Purpose Pins Functionality configuration */ 44*9d86f0c3SAlbert ARIBAUD static const u32 kwmpp_config[] = { 459b914727SLuka Perkov MPP0_NF_IO2, 469b914727SLuka Perkov MPP1_NF_IO3, 479b914727SLuka Perkov MPP2_NF_IO4, 489b914727SLuka Perkov MPP3_NF_IO5, 499b914727SLuka Perkov MPP4_NF_IO6, 509b914727SLuka Perkov MPP5_NF_IO7, 519b914727SLuka Perkov MPP6_SYSRST_OUTn, /* Reset signal */ 529b914727SLuka Perkov MPP7_GPO, 539b914727SLuka Perkov MPP8_TW_SDA, /* I2C */ 549b914727SLuka Perkov MPP9_TW_SCK, /* I2C */ 559b914727SLuka Perkov MPP10_UART0_TXD, 569b914727SLuka Perkov MPP11_UART0_RXD, 579b914727SLuka Perkov MPP12_GPO, /* Reset button */ 589b914727SLuka Perkov MPP13_SD_CMD, 599b914727SLuka Perkov MPP14_SD_D0, 609b914727SLuka Perkov MPP15_SD_D1, 619b914727SLuka Perkov MPP16_SD_D2, 629b914727SLuka Perkov MPP17_SD_D3, 639b914727SLuka Perkov MPP18_NF_IO0, 649b914727SLuka Perkov MPP19_NF_IO1, 659b914727SLuka Perkov MPP20_GE1_0, 669b914727SLuka Perkov MPP21_GE1_1, 679b914727SLuka Perkov MPP22_GE1_2, 689b914727SLuka Perkov MPP23_GE1_3, 699b914727SLuka Perkov MPP24_GE1_4, 709b914727SLuka Perkov MPP25_GE1_5, 719b914727SLuka Perkov MPP26_GE1_6, 729b914727SLuka Perkov MPP27_GE1_7, 739b914727SLuka Perkov MPP28_GPIO, 749b914727SLuka Perkov MPP29_GPIO, 759b914727SLuka Perkov MPP30_GE1_10, 769b914727SLuka Perkov MPP31_GE1_11, 779b914727SLuka Perkov MPP32_GE1_12, 789b914727SLuka Perkov MPP33_GE1_13, 799b914727SLuka Perkov MPP34_GE1_14, 809b914727SLuka Perkov MPP35_GPIO, /* OTB button */ 819b914727SLuka Perkov MPP36_AUDIO_SPDIFI, 829b914727SLuka Perkov MPP37_AUDIO_SPDIFO, 839b914727SLuka Perkov MPP38_GPIO, 849b914727SLuka Perkov MPP39_TDM_SPI_CS0, 859b914727SLuka Perkov MPP40_TDM_SPI_SCK, 869b914727SLuka Perkov MPP41_GPIO, /* LED brightness */ 879b914727SLuka Perkov MPP42_GPIO, /* LED power (blue) */ 889b914727SLuka Perkov MPP43_GPIO, /* LED power (red) */ 899b914727SLuka Perkov MPP44_GPIO, /* LED USB 1 */ 909b914727SLuka Perkov MPP45_GPIO, /* LED USB 2 */ 919b914727SLuka Perkov MPP46_GPIO, /* LED USB 3 */ 929b914727SLuka Perkov MPP47_GPIO, /* LED USB 4 */ 939b914727SLuka Perkov MPP48_GPIO, /* LED OTB */ 949b914727SLuka Perkov MPP49_GPIO, 959b914727SLuka Perkov 0 969b914727SLuka Perkov }; 979b914727SLuka Perkov kirkwood_mpp_conf(kwmpp_config, NULL); 989b914727SLuka Perkov return 0; 999b914727SLuka Perkov } 1009b914727SLuka Perkov 1019b914727SLuka Perkov int board_init(void) 1029b914727SLuka Perkov { 1039b914727SLuka Perkov /* adress of boot parameters */ 1049b914727SLuka Perkov gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100; 1059b914727SLuka Perkov 1069b914727SLuka Perkov return 0; 1079b914727SLuka Perkov } 108