Frederik Kriewitz | 9939650 | 2009-08-23 12:56:42 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004-2008 |
| 3 | * Texas Instruments, <www.ti.com> |
| 4 | * |
| 5 | * Author : |
| 6 | * Sunil Kumar <sunilsaini05@gmail.com> |
| 7 | * Shashi Ranjan <shashiranjanmca05@gmail.com> |
| 8 | * |
| 9 | * (C) Copyright 2009 |
| 10 | * Frederik Kriewitz <frederik@kriewitz.eu> |
| 11 | * |
| 12 | * Derived from Beagle Board and 3430 SDP code by |
| 13 | * Richard Woodruff <r-woodruff2@ti.com> |
| 14 | * Syed Mohammed Khasim <khasim@ti.com> |
| 15 | * |
| 16 | * |
| 17 | * See file CREDITS for list of people who contributed to this |
| 18 | * project. |
| 19 | * |
| 20 | * This program is free software; you can redistribute it and/or |
| 21 | * modify it under the terms of the GNU General Public License as |
| 22 | * published by the Free Software Foundation; either version 2 of |
| 23 | * the License, or (at your option) any later version. |
| 24 | * |
| 25 | * This program is distributed in the hope that it will be useful, |
| 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 28 | * GNU General Public License for more details. |
| 29 | * |
| 30 | * You should have received a copy of the GNU General Public License |
| 31 | * along with this program; if not, write to the Free Software |
| 32 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 33 | * MA 02111-1307 USA |
| 34 | */ |
| 35 | #include <common.h> |
| 36 | #include <twl4030.h> |
| 37 | #include <asm/io.h> |
| 38 | #include <asm/arch/mux.h> |
| 39 | #include <asm/arch/sys_proto.h> |
| 40 | #include <asm/arch/mem.h> |
| 41 | #include <asm/mach-types.h> |
| 42 | #include "devkit8000.h" |
| 43 | #ifdef CONFIG_DRIVER_DM9000 |
| 44 | #include <net.h> |
| 45 | #include <netdev.h> |
| 46 | #endif |
| 47 | |
| 48 | DECLARE_GLOBAL_DATA_PTR; |
| 49 | |
| 50 | /* |
| 51 | * Routine: board_init |
| 52 | * Description: Early hardware init. |
| 53 | */ |
| 54 | int board_init(void) |
| 55 | { |
| 56 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 57 | /* board id for Linux */ |
| 58 | gd->bd->bi_arch_number = MACH_TYPE_DEVKIT8000; |
| 59 | /* boot param addr */ |
| 60 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 61 | |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | /* |
| 66 | * Routine: misc_init_r |
| 67 | * Description: Configure board specific parts |
| 68 | */ |
| 69 | int misc_init_r(void) |
| 70 | { |
| 71 | struct ctrl_id *id_base = (struct ctrl_id *)OMAP34XX_ID_L4_IO_BASE; |
| 72 | #ifdef CONFIG_DRIVER_DM9000 |
| 73 | uchar enetaddr[6]; |
| 74 | u32 die_id_0; |
| 75 | #endif |
| 76 | |
| 77 | twl4030_power_init(); |
| 78 | #ifdef CONFIG_TWL4030_LED |
Grazvydas Ignotas | 17887bf | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 79 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Frederik Kriewitz | 9939650 | 2009-08-23 12:56:42 +0200 | [diff] [blame] | 80 | #endif |
| 81 | |
| 82 | #ifdef CONFIG_DRIVER_DM9000 |
| 83 | /* Configure GPMC registers for DM9000 */ |
| 84 | writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[6].config1); |
| 85 | writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[6].config2); |
| 86 | writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[6].config3); |
| 87 | writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[6].config4); |
| 88 | writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[6].config5); |
| 89 | writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[6].config6); |
| 90 | writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[6].config7); |
| 91 | |
| 92 | /* Use OMAP DIE_ID as MAC address */ |
| 93 | if (!eth_getenv_enetaddr("ethaddr", enetaddr)) { |
| 94 | printf("ethaddr not set, using Die ID\n"); |
| 95 | die_id_0 = readl(&id_base->die_id_0); |
| 96 | enetaddr[0] = 0x02; /* locally administered */ |
| 97 | enetaddr[1] = readl(&id_base->die_id_1) & 0xff; |
| 98 | enetaddr[2] = (die_id_0 & 0xff000000) >> 24; |
| 99 | enetaddr[3] = (die_id_0 & 0x00ff0000) >> 16; |
| 100 | enetaddr[4] = (die_id_0 & 0x0000ff00) >> 8; |
| 101 | enetaddr[5] = (die_id_0 & 0x000000ff); |
| 102 | eth_setenv_enetaddr("ethaddr", enetaddr); |
| 103 | } |
| 104 | #endif |
| 105 | |
| 106 | dieid_num_r(); |
| 107 | |
| 108 | return 0; |
| 109 | } |
| 110 | |
| 111 | /* |
| 112 | * Routine: set_muxconf_regs |
| 113 | * Description: Setting up the configuration Mux registers specific to the |
| 114 | * hardware. Many pins need to be moved from protect to primary |
| 115 | * mode. |
| 116 | */ |
| 117 | void set_muxconf_regs(void) |
| 118 | { |
| 119 | MUX_DEVKIT8000(); |
| 120 | } |
| 121 | |
| 122 | #ifdef CONFIG_DRIVER_DM9000 |
| 123 | /* |
| 124 | * Routine: board_eth_init |
| 125 | * Description: Setting up the Ethernet hardware. |
| 126 | */ |
| 127 | int board_eth_init(bd_t *bis) |
| 128 | { |
| 129 | return dm9000_initialize(bis); |
| 130 | } |
| 131 | #endif |