Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004-2008 |
| 3 | * Texas Instruments, <www.ti.com> |
| 4 | * |
| 5 | * Author : |
| 6 | * Nishanth Menon <nm@ti.com> |
| 7 | * |
| 8 | * Derived from Beagle Board and 3430 SDP code by |
| 9 | * Sunil Kumar <sunilsaini05@gmail.com> |
| 10 | * Shashi Ranjan <shashiranjanmca05@gmail.com> |
| 11 | * Richard Woodruff <r-woodruff2@ti.com> |
| 12 | * Syed Mohammed Khasim <khasim@ti.com> |
| 13 | * |
| 14 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 15 | * SPDX-License-Identifier: GPL-2.0+ |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 16 | */ |
| 17 | #include <common.h> |
Simon Glass | b3f4ca1 | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 18 | #include <dm.h> |
| 19 | #include <ns16550.h> |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 20 | #include <netdev.h> |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 21 | #include <twl4030.h> |
Ladislav Michl | 0568dd0 | 2016-07-12 20:28:16 +0200 | [diff] [blame] | 22 | #include <linux/mtd/omap_gpmc.h> |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 23 | #include <asm/io.h> |
Nishanth Menon | c2800b1 | 2014-04-08 09:50:52 -0500 | [diff] [blame] | 24 | #include <asm/arch/mem.h> |
Tom Rini | d6906cb | 2011-09-03 21:50:35 -0400 | [diff] [blame] | 25 | #include <asm/arch/mmc_host_def.h> |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 26 | #include <asm/arch/mux.h> |
| 27 | #include <asm/arch/sys_proto.h> |
| 28 | #include <asm/mach-types.h> |
| 29 | #include "zoom1.h" |
| 30 | |
John Rigby | 2956532 | 2010-12-20 18:27:51 -0700 | [diff] [blame] | 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Ladislav Michl | 0568dd0 | 2016-07-12 20:28:16 +0200 | [diff] [blame] | 33 | /* |
| 34 | * gpmc_cfg is initialized by gpmc_init and we use it here. |
| 35 | * GPMC definitions for Ethenet Controller LAN9211 |
| 36 | */ |
Nishanth Menon | c2800b1 | 2014-04-08 09:50:52 -0500 | [diff] [blame] | 37 | static const u32 gpmc_lab_enet[] = { |
| 38 | ZOOM1_ENET_GPMC_CONF1, |
| 39 | ZOOM1_ENET_GPMC_CONF2, |
| 40 | ZOOM1_ENET_GPMC_CONF3, |
| 41 | ZOOM1_ENET_GPMC_CONF4, |
| 42 | ZOOM1_ENET_GPMC_CONF5, |
| 43 | ZOOM1_ENET_GPMC_CONF6, |
| 44 | /*CONF7- computed as params */ |
| 45 | }; |
| 46 | |
Simon Glass | b3f4ca1 | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 47 | static const struct ns16550_platdata zoom1_serial = { |
Adam Ford | 2f6ed3b | 2016-03-07 21:08:49 -0600 | [diff] [blame] | 48 | .base = OMAP34XX_UART3, |
| 49 | .reg_shift = 2, |
| 50 | .clock = V_NS16550_CLK |
Simon Glass | b3f4ca1 | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 51 | }; |
| 52 | |
| 53 | U_BOOT_DEVICE(zoom1_uart) = { |
Thomas Chou | c7b9686 | 2015-11-19 21:48:12 +0800 | [diff] [blame] | 54 | "ns16550_serial", |
Simon Glass | b3f4ca1 | 2014-10-22 21:37:15 -0600 | [diff] [blame] | 55 | &zoom1_serial |
| 56 | }; |
| 57 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 58 | /* |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 59 | * Routine: board_init |
| 60 | * Description: Early hardware init. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 61 | */ |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 62 | int board_init(void) |
| 63 | { |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 64 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
Nishanth Menon | c2800b1 | 2014-04-08 09:50:52 -0500 | [diff] [blame] | 65 | /* CS1 is Ethernet LAN9211 */ |
| 66 | enable_gpmc_cs_config(gpmc_lab_enet, &gpmc_cfg->cs[1], |
| 67 | DEBUG_BASE, GPMC_SIZE_16M); |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 68 | /* board id for Linux */ |
| 69 | gd->bd->bi_arch_number = MACH_TYPE_OMAP_LDP; |
| 70 | /* boot param addr */ |
| 71 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 72 | |
| 73 | return 0; |
| 74 | } |
| 75 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 76 | /* |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 77 | * Routine: misc_init_r |
| 78 | * Description: Configure zoom board specific configurations |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 79 | */ |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 80 | int misc_init_r(void) |
| 81 | { |
Tom Rix | 2c15513 | 2009-06-28 12:52:30 -0500 | [diff] [blame] | 82 | twl4030_power_init(); |
Grazvydas Ignotas | ead39d7 | 2009-12-10 17:10:21 +0200 | [diff] [blame] | 83 | twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON); |
Paul Kocialkowski | 679f82c | 2015-08-27 19:37:13 +0200 | [diff] [blame] | 84 | omap_die_id_display(); |
Tom Rix | cd78263 | 2009-06-28 12:52:29 -0500 | [diff] [blame] | 85 | |
| 86 | /* |
| 87 | * Board Reset |
| 88 | * The board is reset by holding the red button on the |
| 89 | * top right front face for eight seconds. |
| 90 | */ |
| 91 | twl4030_power_reset_init(); |
| 92 | |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 93 | return 0; |
| 94 | } |
| 95 | |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 96 | /* |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 97 | * Routine: set_muxconf_regs |
| 98 | * Description: Setting up the configuration Mux registers specific to the |
| 99 | * hardware. Many pins need to be moved from protect to primary |
| 100 | * mode. |
Tom Rix | 5891151 | 2009-04-01 22:02:20 -0500 | [diff] [blame] | 101 | */ |
Dirk Behme | 7379f45 | 2009-01-28 21:40:16 +0100 | [diff] [blame] | 102 | void set_muxconf_regs(void) |
| 103 | { |
| 104 | /* platform specific muxes */ |
| 105 | MUX_ZOOM1_MDK(); |
| 106 | } |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 107 | |
Tom Rini | d6906cb | 2011-09-03 21:50:35 -0400 | [diff] [blame] | 108 | #ifdef CONFIG_GENERIC_MMC |
| 109 | int board_mmc_init(bd_t *bis) |
| 110 | { |
Nikita Kiryanov | e3913f5 | 2012-12-03 02:19:47 +0000 | [diff] [blame] | 111 | return omap_mmc_init(0, 0, 0, -1, -1); |
Tom Rini | d6906cb | 2011-09-03 21:50:35 -0400 | [diff] [blame] | 112 | } |
Paul Kocialkowski | aac5450 | 2014-11-08 20:55:47 +0100 | [diff] [blame] | 113 | |
| 114 | void board_mmc_power_init(void) |
| 115 | { |
| 116 | twl4030_power_mmc_init(0); |
| 117 | } |
Tom Rini | d6906cb | 2011-09-03 21:50:35 -0400 | [diff] [blame] | 118 | #endif |
| 119 | |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 120 | #ifdef CONFIG_CMD_NET |
| 121 | int board_eth_init(bd_t *bis) |
| 122 | { |
| 123 | int rc = 0; |
Nishanth Menon | 9d70e77 | 2014-04-08 09:50:53 -0500 | [diff] [blame] | 124 | |
| 125 | #ifdef CONFIG_SMC911X |
| 126 | #define STR_ENV_ETHADDR "ethaddr" |
| 127 | |
| 128 | struct eth_device *dev; |
| 129 | uchar eth_addr[6]; |
| 130 | |
| 131 | rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); |
| 132 | if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) { |
| 133 | dev = eth_get_dev_by_index(0); |
| 134 | if (dev) { |
| 135 | eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr); |
| 136 | } else { |
| 137 | printf("zoom1: Couldn't get eth device\n"); |
| 138 | rc = -1; |
| 139 | } |
| 140 | } |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 141 | #endif |
Nishanth Menon | 9d70e77 | 2014-04-08 09:50:53 -0500 | [diff] [blame] | 142 | |
Ben Warren | 1ab70f6 | 2009-12-14 16:30:39 -0800 | [diff] [blame] | 143 | return rc; |
| 144 | } |
| 145 | #endif |