Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 1 | /* |
Nikita Kiryanov | ce15ec9 | 2012-01-02 04:01:31 +0000 | [diff] [blame] | 2 | * (C) Copyright 2011 CompuLab, Ltd. <www.compulab.co.il> |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 3 | * |
Igor Grinberg | dccd9a0 | 2011-04-18 17:48:31 -0400 | [diff] [blame] | 4 | * Authors: Mike Rapoport <mike@compulab.co.il> |
| 5 | * Igor Grinberg <grinberg@compulab.co.il> |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 6 | * |
| 7 | * Derived from omap3evm and Beagle Board by |
| 8 | * Manikandan Pillai <mani.pillai@ti.com> |
| 9 | * Richard Woodruff <r-woodruff2@ti.com> |
| 10 | * Syed Mohammed Khasim <x0khasim@ti.com> |
| 11 | * |
| 12 | * See file CREDITS for list of people who contributed to this |
| 13 | * project. |
| 14 | * |
| 15 | * This program is free software; you can redistribute it and/or |
| 16 | * modify it under the terms of the GNU General Public License as |
| 17 | * published by the Free Software Foundation; either version 2 of |
| 18 | * the License, or (at your option) any later version. |
| 19 | * |
| 20 | * This program is distributed in the hope that it will be useful, |
| 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 23 | * GNU General Public License for more details. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License |
| 26 | * along with this program; if not, write to the Free Software |
Igor Grinberg | dccd9a0 | 2011-04-18 17:48:31 -0400 | [diff] [blame] | 27 | * Foundation, Inc. |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 28 | */ |
| 29 | |
| 30 | #include <common.h> |
Igor Grinberg | 2b8754b | 2011-04-18 17:54:33 -0400 | [diff] [blame] | 31 | #include <status_led.h> |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 32 | #include <netdev.h> |
| 33 | #include <net.h> |
| 34 | #include <i2c.h> |
| 35 | #include <twl4030.h> |
Nikita Kiryanov | 8230925 | 2012-01-12 03:26:30 +0000 | [diff] [blame] | 36 | #include <linux/compiler.h> |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 37 | |
| 38 | #include <asm/io.h> |
| 39 | #include <asm/arch/mem.h> |
| 40 | #include <asm/arch/mux.h> |
| 41 | #include <asm/arch/mmc_host_def.h> |
| 42 | #include <asm/arch/sys_proto.h> |
| 43 | #include <asm/mach-types.h> |
| 44 | |
Nikita Kiryanov | e4e2bf5 | 2012-01-12 03:28:09 +0000 | [diff] [blame] | 45 | #include "eeprom.h" |
| 46 | |
Igor Grinberg | 557aa15 | 2011-04-18 17:43:26 -0400 | [diff] [blame] | 47 | DECLARE_GLOBAL_DATA_PTR; |
| 48 | |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 49 | const omap3_sysinfo sysinfo = { |
| 50 | DDR_DISCRETE, |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 51 | "CM-T3x board", |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 52 | "NAND", |
| 53 | }; |
| 54 | |
| 55 | static u32 gpmc_net_config[GPMC_MAX_REG] = { |
| 56 | NET_GPMC_CONFIG1, |
| 57 | NET_GPMC_CONFIG2, |
| 58 | NET_GPMC_CONFIG3, |
| 59 | NET_GPMC_CONFIG4, |
| 60 | NET_GPMC_CONFIG5, |
| 61 | NET_GPMC_CONFIG6, |
| 62 | 0 |
| 63 | }; |
| 64 | |
| 65 | static u32 gpmc_nand_config[GPMC_MAX_REG] = { |
| 66 | SMNAND_GPMC_CONFIG1, |
| 67 | SMNAND_GPMC_CONFIG2, |
| 68 | SMNAND_GPMC_CONFIG3, |
| 69 | SMNAND_GPMC_CONFIG4, |
| 70 | SMNAND_GPMC_CONFIG5, |
| 71 | SMNAND_GPMC_CONFIG6, |
| 72 | 0, |
| 73 | }; |
| 74 | |
| 75 | /* |
| 76 | * Routine: board_init |
| 77 | * Description: Early hardware init. |
| 78 | */ |
| 79 | int board_init(void) |
| 80 | { |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 81 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 82 | |
| 83 | enable_gpmc_cs_config(gpmc_nand_config, &gpmc_cfg->cs[0], |
| 84 | CONFIG_SYS_NAND_BASE, GPMC_SIZE_16M); |
| 85 | |
| 86 | /* board id for Linux */ |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 87 | if (get_cpu_family() == CPU_OMAP34XX) |
| 88 | gd->bd->bi_arch_number = MACH_TYPE_CM_T35; |
| 89 | else |
| 90 | gd->bd->bi_arch_number = MACH_TYPE_CM_T3730; |
| 91 | |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 92 | /* boot param addr */ |
| 93 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 94 | |
Igor Grinberg | 2b8754b | 2011-04-18 17:54:33 -0400 | [diff] [blame] | 95 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 96 | status_led_set(STATUS_LED_BOOT, STATUS_LED_ON); |
| 97 | #endif |
| 98 | |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | /* |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 103 | * Routine: set_muxconf_regs |
| 104 | * Description: Setting up the configuration Mux registers specific to the |
| 105 | * hardware. Many pins need to be moved from protect to primary |
| 106 | * mode. |
| 107 | */ |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 108 | static void cm_t3x_set_common_muxconf(void) |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 109 | { |
| 110 | /* SDRC */ |
| 111 | MUX_VAL(CP(SDRC_D0), (IEN | PTD | DIS | M0)); /*SDRC_D0*/ |
| 112 | MUX_VAL(CP(SDRC_D1), (IEN | PTD | DIS | M0)); /*SDRC_D1*/ |
| 113 | MUX_VAL(CP(SDRC_D2), (IEN | PTD | DIS | M0)); /*SDRC_D2*/ |
| 114 | MUX_VAL(CP(SDRC_D3), (IEN | PTD | DIS | M0)); /*SDRC_D3*/ |
| 115 | MUX_VAL(CP(SDRC_D4), (IEN | PTD | DIS | M0)); /*SDRC_D4*/ |
| 116 | MUX_VAL(CP(SDRC_D5), (IEN | PTD | DIS | M0)); /*SDRC_D5*/ |
| 117 | MUX_VAL(CP(SDRC_D6), (IEN | PTD | DIS | M0)); /*SDRC_D6*/ |
| 118 | MUX_VAL(CP(SDRC_D7), (IEN | PTD | DIS | M0)); /*SDRC_D7*/ |
| 119 | MUX_VAL(CP(SDRC_D8), (IEN | PTD | DIS | M0)); /*SDRC_D8*/ |
| 120 | MUX_VAL(CP(SDRC_D9), (IEN | PTD | DIS | M0)); /*SDRC_D9*/ |
| 121 | MUX_VAL(CP(SDRC_D10), (IEN | PTD | DIS | M0)); /*SDRC_D10*/ |
| 122 | MUX_VAL(CP(SDRC_D11), (IEN | PTD | DIS | M0)); /*SDRC_D11*/ |
| 123 | MUX_VAL(CP(SDRC_D12), (IEN | PTD | DIS | M0)); /*SDRC_D12*/ |
| 124 | MUX_VAL(CP(SDRC_D13), (IEN | PTD | DIS | M0)); /*SDRC_D13*/ |
| 125 | MUX_VAL(CP(SDRC_D14), (IEN | PTD | DIS | M0)); /*SDRC_D14*/ |
| 126 | MUX_VAL(CP(SDRC_D15), (IEN | PTD | DIS | M0)); /*SDRC_D15*/ |
| 127 | MUX_VAL(CP(SDRC_D16), (IEN | PTD | DIS | M0)); /*SDRC_D16*/ |
| 128 | MUX_VAL(CP(SDRC_D17), (IEN | PTD | DIS | M0)); /*SDRC_D17*/ |
| 129 | MUX_VAL(CP(SDRC_D18), (IEN | PTD | DIS | M0)); /*SDRC_D18*/ |
| 130 | MUX_VAL(CP(SDRC_D19), (IEN | PTD | DIS | M0)); /*SDRC_D19*/ |
| 131 | MUX_VAL(CP(SDRC_D20), (IEN | PTD | DIS | M0)); /*SDRC_D20*/ |
| 132 | MUX_VAL(CP(SDRC_D21), (IEN | PTD | DIS | M0)); /*SDRC_D21*/ |
| 133 | MUX_VAL(CP(SDRC_D22), (IEN | PTD | DIS | M0)); /*SDRC_D22*/ |
| 134 | MUX_VAL(CP(SDRC_D23), (IEN | PTD | DIS | M0)); /*SDRC_D23*/ |
| 135 | MUX_VAL(CP(SDRC_D24), (IEN | PTD | DIS | M0)); /*SDRC_D24*/ |
| 136 | MUX_VAL(CP(SDRC_D25), (IEN | PTD | DIS | M0)); /*SDRC_D25*/ |
| 137 | MUX_VAL(CP(SDRC_D26), (IEN | PTD | DIS | M0)); /*SDRC_D26*/ |
| 138 | MUX_VAL(CP(SDRC_D27), (IEN | PTD | DIS | M0)); /*SDRC_D27*/ |
| 139 | MUX_VAL(CP(SDRC_D28), (IEN | PTD | DIS | M0)); /*SDRC_D28*/ |
| 140 | MUX_VAL(CP(SDRC_D29), (IEN | PTD | DIS | M0)); /*SDRC_D29*/ |
| 141 | MUX_VAL(CP(SDRC_D30), (IEN | PTD | DIS | M0)); /*SDRC_D30*/ |
| 142 | MUX_VAL(CP(SDRC_D31), (IEN | PTD | DIS | M0)); /*SDRC_D31*/ |
| 143 | MUX_VAL(CP(SDRC_CLK), (IEN | PTD | DIS | M0)); /*SDRC_CLK*/ |
| 144 | MUX_VAL(CP(SDRC_DQS0), (IEN | PTD | DIS | M0)); /*SDRC_DQS0*/ |
| 145 | MUX_VAL(CP(SDRC_DQS1), (IEN | PTD | DIS | M0)); /*SDRC_DQS1*/ |
| 146 | MUX_VAL(CP(SDRC_DQS2), (IEN | PTD | DIS | M0)); /*SDRC_DQS2*/ |
| 147 | MUX_VAL(CP(SDRC_DQS3), (IEN | PTD | DIS | M0)); /*SDRC_DQS3*/ |
| 148 | MUX_VAL(CP(SDRC_CKE0), (IDIS | PTU | EN | M0)); /*SDRC_CKE0*/ |
| 149 | MUX_VAL(CP(SDRC_CKE1), (IDIS | PTD | DIS | M7)); /*SDRC_CKE1*/ |
| 150 | |
| 151 | /* GPMC */ |
| 152 | MUX_VAL(CP(GPMC_A1), (IDIS | PTU | EN | M0)); /*GPMC_A1*/ |
| 153 | MUX_VAL(CP(GPMC_A2), (IDIS | PTU | EN | M0)); /*GPMC_A2*/ |
| 154 | MUX_VAL(CP(GPMC_A3), (IDIS | PTU | EN | M0)); /*GPMC_A3*/ |
| 155 | MUX_VAL(CP(GPMC_A4), (IDIS | PTU | EN | M0)); /*GPMC_A4*/ |
| 156 | MUX_VAL(CP(GPMC_A5), (IDIS | PTU | EN | M0)); /*GPMC_A5*/ |
| 157 | MUX_VAL(CP(GPMC_A6), (IDIS | PTU | EN | M0)); /*GPMC_A6*/ |
| 158 | MUX_VAL(CP(GPMC_A7), (IDIS | PTU | EN | M0)); /*GPMC_A7*/ |
| 159 | MUX_VAL(CP(GPMC_A8), (IDIS | PTU | EN | M0)); /*GPMC_A8*/ |
| 160 | MUX_VAL(CP(GPMC_A9), (IDIS | PTU | EN | M0)); /*GPMC_A9*/ |
| 161 | MUX_VAL(CP(GPMC_A10), (IDIS | PTU | EN | M0)); /*GPMC_A10*/ |
| 162 | MUX_VAL(CP(GPMC_D0), (IEN | PTU | EN | M0)); /*GPMC_D0*/ |
| 163 | MUX_VAL(CP(GPMC_D1), (IEN | PTU | EN | M0)); /*GPMC_D1*/ |
| 164 | MUX_VAL(CP(GPMC_D2), (IEN | PTU | EN | M0)); /*GPMC_D2*/ |
| 165 | MUX_VAL(CP(GPMC_D3), (IEN | PTU | EN | M0)); /*GPMC_D3*/ |
| 166 | MUX_VAL(CP(GPMC_D4), (IEN | PTU | EN | M0)); /*GPMC_D4*/ |
| 167 | MUX_VAL(CP(GPMC_D5), (IEN | PTU | EN | M0)); /*GPMC_D5*/ |
| 168 | MUX_VAL(CP(GPMC_D6), (IEN | PTU | EN | M0)); /*GPMC_D6*/ |
| 169 | MUX_VAL(CP(GPMC_D7), (IEN | PTU | EN | M0)); /*GPMC_D7*/ |
| 170 | MUX_VAL(CP(GPMC_D8), (IEN | PTU | EN | M0)); /*GPMC_D8*/ |
| 171 | MUX_VAL(CP(GPMC_D9), (IEN | PTU | EN | M0)); /*GPMC_D9*/ |
| 172 | MUX_VAL(CP(GPMC_D10), (IEN | PTU | EN | M0)); /*GPMC_D10*/ |
| 173 | MUX_VAL(CP(GPMC_D11), (IEN | PTU | EN | M0)); /*GPMC_D11*/ |
| 174 | MUX_VAL(CP(GPMC_D12), (IEN | PTU | EN | M0)); /*GPMC_D12*/ |
| 175 | MUX_VAL(CP(GPMC_D13), (IEN | PTU | EN | M0)); /*GPMC_D13*/ |
| 176 | MUX_VAL(CP(GPMC_D14), (IEN | PTU | EN | M0)); /*GPMC_D14*/ |
| 177 | MUX_VAL(CP(GPMC_D15), (IEN | PTU | EN | M0)); /*GPMC_D15*/ |
| 178 | MUX_VAL(CP(GPMC_NCS0), (IDIS | PTU | EN | M0)); /*GPMC_nCS0*/ |
| 179 | |
| 180 | /* SB-T35 Ethernet */ |
| 181 | MUX_VAL(CP(GPMC_NCS4), (IEN | PTU | EN | M0)); /*GPMC_nCS4*/ |
| 182 | |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 183 | /* CM-T3x Ethernet */ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 184 | MUX_VAL(CP(GPMC_NCS5), (IDIS | PTU | DIS | M0)); /*GPMC_nCS5*/ |
| 185 | MUX_VAL(CP(GPMC_CLK), (IEN | PTD | DIS | M4)); /*GPIO_59*/ |
| 186 | MUX_VAL(CP(GPMC_NADV_ALE), (IDIS | PTD | DIS | M0)); /*nADV_ALE*/ |
| 187 | MUX_VAL(CP(GPMC_NOE), (IDIS | PTD | DIS | M0)); /*nOE*/ |
| 188 | MUX_VAL(CP(GPMC_NWE), (IDIS | PTD | DIS | M0)); /*nWE*/ |
| 189 | MUX_VAL(CP(GPMC_NBE0_CLE), (IDIS | PTU | EN | M0)); /*nBE0_CLE*/ |
| 190 | MUX_VAL(CP(GPMC_NBE1), (IDIS | PTD | DIS | M4)); /*GPIO_61*/ |
| 191 | MUX_VAL(CP(GPMC_NWP), (IEN | PTD | DIS | M0)); /*nWP*/ |
| 192 | MUX_VAL(CP(GPMC_WAIT0), (IEN | PTU | EN | M0)); /*WAIT0*/ |
| 193 | |
| 194 | /* DSS */ |
| 195 | MUX_VAL(CP(DSS_PCLK), (IDIS | PTD | DIS | M0)); /*DSS_PCLK*/ |
| 196 | MUX_VAL(CP(DSS_HSYNC), (IDIS | PTD | DIS | M0)); /*DSS_HSYNC*/ |
| 197 | MUX_VAL(CP(DSS_VSYNC), (IDIS | PTD | DIS | M0)); /*DSS_VSYNC*/ |
| 198 | MUX_VAL(CP(DSS_ACBIAS), (IDIS | PTD | DIS | M0)); /*DSS_ACBIAS*/ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 199 | MUX_VAL(CP(DSS_DATA6), (IDIS | PTD | DIS | M0)); /*DSS_DATA6*/ |
| 200 | MUX_VAL(CP(DSS_DATA7), (IDIS | PTD | DIS | M0)); /*DSS_DATA7*/ |
| 201 | MUX_VAL(CP(DSS_DATA8), (IDIS | PTD | DIS | M0)); /*DSS_DATA8*/ |
| 202 | MUX_VAL(CP(DSS_DATA9), (IDIS | PTD | DIS | M0)); /*DSS_DATA9*/ |
| 203 | MUX_VAL(CP(DSS_DATA10), (IDIS | PTD | DIS | M0)); /*DSS_DATA10*/ |
| 204 | MUX_VAL(CP(DSS_DATA11), (IDIS | PTD | DIS | M0)); /*DSS_DATA11*/ |
| 205 | MUX_VAL(CP(DSS_DATA12), (IDIS | PTD | DIS | M0)); /*DSS_DATA12*/ |
| 206 | MUX_VAL(CP(DSS_DATA13), (IDIS | PTD | DIS | M0)); /*DSS_DATA13*/ |
| 207 | MUX_VAL(CP(DSS_DATA14), (IDIS | PTD | DIS | M0)); /*DSS_DATA14*/ |
| 208 | MUX_VAL(CP(DSS_DATA15), (IDIS | PTD | DIS | M0)); /*DSS_DATA15*/ |
| 209 | MUX_VAL(CP(DSS_DATA16), (IDIS | PTD | DIS | M0)); /*DSS_DATA16*/ |
| 210 | MUX_VAL(CP(DSS_DATA17), (IDIS | PTD | DIS | M0)); /*DSS_DATA17*/ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 211 | |
| 212 | /* serial interface */ |
| 213 | MUX_VAL(CP(UART3_RX_IRRX), (IEN | PTD | DIS | M0)); /*UART3_RX*/ |
| 214 | MUX_VAL(CP(UART3_TX_IRTX), (IDIS | PTD | DIS | M0)); /*UART3_TX*/ |
| 215 | |
| 216 | /* mUSB */ |
| 217 | MUX_VAL(CP(HSUSB0_CLK), (IEN | PTD | DIS | M0)); /*HSUSB0_CLK*/ |
| 218 | MUX_VAL(CP(HSUSB0_STP), (IDIS | PTU | EN | M0)); /*HSUSB0_STP*/ |
| 219 | MUX_VAL(CP(HSUSB0_DIR), (IEN | PTD | DIS | M0)); /*HSUSB0_DIR*/ |
| 220 | MUX_VAL(CP(HSUSB0_NXT), (IEN | PTD | DIS | M0)); /*HSUSB0_NXT*/ |
| 221 | MUX_VAL(CP(HSUSB0_DATA0), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA0*/ |
| 222 | MUX_VAL(CP(HSUSB0_DATA1), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA1*/ |
| 223 | MUX_VAL(CP(HSUSB0_DATA2), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA2*/ |
| 224 | MUX_VAL(CP(HSUSB0_DATA3), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA3*/ |
| 225 | MUX_VAL(CP(HSUSB0_DATA4), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA4*/ |
| 226 | MUX_VAL(CP(HSUSB0_DATA5), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA5*/ |
| 227 | MUX_VAL(CP(HSUSB0_DATA6), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA6*/ |
| 228 | MUX_VAL(CP(HSUSB0_DATA7), (IEN | PTD | DIS | M0)); /*HSUSB0_DATA7*/ |
| 229 | |
| 230 | /* I2C1 */ |
| 231 | MUX_VAL(CP(I2C1_SCL), (IEN | PTU | EN | M0)); /*I2C1_SCL*/ |
| 232 | MUX_VAL(CP(I2C1_SDA), (IEN | PTU | EN | M0)); /*I2C1_SDA*/ |
Nikita Kiryanov | 79874ae | 2012-04-02 02:29:31 +0000 | [diff] [blame^] | 233 | /* I2C2 */ |
| 234 | MUX_VAL(CP(I2C2_SCL), (IEN | PTU | EN | M0)); /*I2C2_SCL*/ |
| 235 | MUX_VAL(CP(I2C2_SDA), (IEN | PTU | EN | M0)); /*I2C2_SDA*/ |
| 236 | /* I2C3 */ |
| 237 | MUX_VAL(CP(I2C3_SCL), (IEN | PTU | EN | M0)); /*I2C3_SCL*/ |
| 238 | MUX_VAL(CP(I2C3_SDA), (IEN | PTU | EN | M0)); /*I2C3_SDA*/ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 239 | |
| 240 | /* control and debug */ |
| 241 | MUX_VAL(CP(SYS_32K), (IEN | PTD | DIS | M0)); /*SYS_32K*/ |
| 242 | MUX_VAL(CP(SYS_CLKREQ), (IEN | PTD | DIS | M0)); /*SYS_CLKREQ*/ |
| 243 | MUX_VAL(CP(SYS_NIRQ), (IEN | PTU | EN | M0)); /*SYS_nIRQ*/ |
| 244 | MUX_VAL(CP(SYS_OFF_MODE), (IEN | PTD | DIS | M0)); /*OFF_MODE*/ |
| 245 | MUX_VAL(CP(SYS_CLKOUT1), (IEN | PTD | DIS | M0)); /*CLKOUT1*/ |
Igor Grinberg | 2b8754b | 2011-04-18 17:54:33 -0400 | [diff] [blame] | 246 | MUX_VAL(CP(SYS_CLKOUT2), (IDIS | PTU | DIS | M4)); /*green LED*/ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 247 | MUX_VAL(CP(JTAG_nTRST), (IEN | PTD | DIS | M0)); /*JTAG_nTRST*/ |
| 248 | MUX_VAL(CP(JTAG_TCK), (IEN | PTD | DIS | M0)); /*JTAG_TCK*/ |
| 249 | MUX_VAL(CP(JTAG_TMS), (IEN | PTD | DIS | M0)); /*JTAG_TMS*/ |
| 250 | MUX_VAL(CP(JTAG_TDI), (IEN | PTD | DIS | M0)); /*JTAG_TDI*/ |
Igor Grinberg | eec70c2 | 2011-04-18 17:50:07 -0400 | [diff] [blame] | 251 | |
| 252 | /* MMC1 */ |
| 253 | MUX_VAL(CP(MMC1_CLK), (IDIS | PTU | EN | M0)); /*MMC1_CLK*/ |
| 254 | MUX_VAL(CP(MMC1_CMD), (IEN | PTU | EN | M0)); /*MMC1_CMD*/ |
| 255 | MUX_VAL(CP(MMC1_DAT0), (IEN | PTU | EN | M0)); /*MMC1_DAT0*/ |
| 256 | MUX_VAL(CP(MMC1_DAT1), (IEN | PTU | EN | M0)); /*MMC1_DAT1*/ |
| 257 | MUX_VAL(CP(MMC1_DAT2), (IEN | PTU | EN | M0)); /*MMC1_DAT2*/ |
| 258 | MUX_VAL(CP(MMC1_DAT3), (IEN | PTU | EN | M0)); /*MMC1_DAT3*/ |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 259 | } |
| 260 | |
| 261 | static void cm_t35_set_muxconf(void) |
| 262 | { |
| 263 | /* DSS */ |
| 264 | MUX_VAL(CP(DSS_DATA0), (IDIS | PTD | DIS | M0)); /*DSS_DATA0*/ |
| 265 | MUX_VAL(CP(DSS_DATA1), (IDIS | PTD | DIS | M0)); /*DSS_DATA1*/ |
| 266 | MUX_VAL(CP(DSS_DATA2), (IDIS | PTD | DIS | M0)); /*DSS_DATA2*/ |
| 267 | MUX_VAL(CP(DSS_DATA3), (IDIS | PTD | DIS | M0)); /*DSS_DATA3*/ |
| 268 | MUX_VAL(CP(DSS_DATA4), (IDIS | PTD | DIS | M0)); /*DSS_DATA4*/ |
| 269 | MUX_VAL(CP(DSS_DATA5), (IDIS | PTD | DIS | M0)); /*DSS_DATA5*/ |
| 270 | |
| 271 | MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M0)); /*DSS_DATA18*/ |
| 272 | MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M0)); /*DSS_DATA19*/ |
| 273 | MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M0)); /*DSS_DATA20*/ |
| 274 | MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M0)); /*DSS_DATA21*/ |
| 275 | MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M0)); /*DSS_DATA22*/ |
| 276 | MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M0)); /*DSS_DATA23*/ |
| 277 | |
| 278 | /* MMC1 */ |
Igor Grinberg | eec70c2 | 2011-04-18 17:50:07 -0400 | [diff] [blame] | 279 | MUX_VAL(CP(MMC1_DAT4), (IEN | PTU | EN | M0)); /*MMC1_DAT4*/ |
| 280 | MUX_VAL(CP(MMC1_DAT5), (IEN | PTU | EN | M0)); /*MMC1_DAT5*/ |
| 281 | MUX_VAL(CP(MMC1_DAT6), (IEN | PTU | EN | M0)); /*MMC1_DAT6*/ |
| 282 | MUX_VAL(CP(MMC1_DAT7), (IEN | PTU | EN | M0)); /*MMC1_DAT7*/ |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 283 | } |
| 284 | |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 285 | static void cm_t3730_set_muxconf(void) |
| 286 | { |
| 287 | /* DSS */ |
| 288 | MUX_VAL(CP(DSS_DATA18), (IDIS | PTD | DIS | M3)); /*DSS_DATA0*/ |
| 289 | MUX_VAL(CP(DSS_DATA19), (IDIS | PTD | DIS | M3)); /*DSS_DATA1*/ |
| 290 | MUX_VAL(CP(DSS_DATA20), (IDIS | PTD | DIS | M3)); /*DSS_DATA2*/ |
| 291 | MUX_VAL(CP(DSS_DATA21), (IDIS | PTD | DIS | M3)); /*DSS_DATA3*/ |
| 292 | MUX_VAL(CP(DSS_DATA22), (IDIS | PTD | DIS | M3)); /*DSS_DATA4*/ |
| 293 | MUX_VAL(CP(DSS_DATA23), (IDIS | PTD | DIS | M3)); /*DSS_DATA5*/ |
| 294 | |
| 295 | MUX_VAL(CP(SYS_BOOT0), (IDIS | PTD | DIS | M3)); /*DSS_DATA18*/ |
| 296 | MUX_VAL(CP(SYS_BOOT1), (IDIS | PTD | DIS | M3)); /*DSS_DATA19*/ |
| 297 | MUX_VAL(CP(SYS_BOOT3), (IDIS | PTD | DIS | M3)); /*DSS_DATA20*/ |
| 298 | MUX_VAL(CP(SYS_BOOT4), (IDIS | PTD | DIS | M3)); /*DSS_DATA21*/ |
| 299 | MUX_VAL(CP(SYS_BOOT5), (IDIS | PTD | DIS | M3)); /*DSS_DATA22*/ |
| 300 | MUX_VAL(CP(SYS_BOOT6), (IDIS | PTD | DIS | M3)); /*DSS_DATA23*/ |
| 301 | } |
| 302 | |
| 303 | void set_muxconf_regs(void) |
| 304 | { |
| 305 | cm_t3x_set_common_muxconf(); |
| 306 | |
| 307 | if (get_cpu_family() == CPU_OMAP34XX) |
| 308 | cm_t35_set_muxconf(); |
| 309 | else |
| 310 | cm_t3730_set_muxconf(); |
| 311 | } |
| 312 | |
Tom Rini | 28fed36 | 2011-09-03 21:49:24 -0400 | [diff] [blame] | 313 | #ifdef CONFIG_GENERIC_MMC |
| 314 | int board_mmc_init(bd_t *bis) |
| 315 | { |
Jonathan Solnit | bbbc1ae | 2012-02-24 11:30:18 +0000 | [diff] [blame] | 316 | return omap_mmc_init(0, 0, 0); |
Tom Rini | 28fed36 | 2011-09-03 21:49:24 -0400 | [diff] [blame] | 317 | } |
| 318 | #endif |
| 319 | |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 320 | /* |
| 321 | * Routine: setup_net_chip_gmpc |
| 322 | * Description: Setting up the configuration GPMC registers specific to the |
| 323 | * Ethernet hardware. |
| 324 | */ |
| 325 | static void setup_net_chip_gmpc(void) |
| 326 | { |
| 327 | struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; |
| 328 | |
| 329 | enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[5], |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 330 | CM_T3X_SMC911X_BASE, GPMC_SIZE_16M); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 331 | enable_gpmc_cs_config(gpmc_net_config, &gpmc_cfg->cs[4], |
| 332 | SB_T35_SMC911X_BASE, GPMC_SIZE_16M); |
| 333 | |
| 334 | /* Enable off mode for NWE in PADCONF_GPMC_NWE register */ |
| 335 | writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe); |
| 336 | |
| 337 | /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */ |
| 338 | writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe); |
| 339 | |
| 340 | /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ |
| 341 | writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00, |
| 342 | &ctrl_base->gpmc_nadv_ale); |
| 343 | } |
| 344 | |
| 345 | #ifdef CONFIG_DRIVER_OMAP34XX_I2C |
| 346 | /* |
| 347 | * Routine: reset_net_chip |
| 348 | * Description: reset the Ethernet controller via TPS65930 GPIO |
| 349 | */ |
| 350 | static void reset_net_chip(void) |
| 351 | { |
| 352 | /* Set GPIO1 of TPS65930 as output */ |
| 353 | twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02, |
Igor Grinberg | 07277e7 | 2012-04-02 20:12:58 +0000 | [diff] [blame] | 354 | TWL4030_BASEADD_GPIO + 0x03); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 355 | /* Send a pulse on the GPIO pin */ |
| 356 | twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02, |
Igor Grinberg | 07277e7 | 2012-04-02 20:12:58 +0000 | [diff] [blame] | 357 | TWL4030_BASEADD_GPIO + 0x0C); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 358 | udelay(1); |
| 359 | twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02, |
Igor Grinberg | 07277e7 | 2012-04-02 20:12:58 +0000 | [diff] [blame] | 360 | TWL4030_BASEADD_GPIO + 0x09); |
| 361 | mdelay(40); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 362 | twl4030_i2c_write_u8(TWL4030_CHIP_GPIO, 0x02, |
Igor Grinberg | 07277e7 | 2012-04-02 20:12:58 +0000 | [diff] [blame] | 363 | TWL4030_BASEADD_GPIO + 0x0C); |
| 364 | mdelay(1); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 365 | } |
| 366 | #else |
| 367 | static inline void reset_net_chip(void) {} |
| 368 | #endif |
| 369 | |
Nikita Kiryanov | ce15ec9 | 2012-01-02 04:01:31 +0000 | [diff] [blame] | 370 | #ifdef CONFIG_SMC911X |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 371 | /* |
| 372 | * Routine: handle_mac_address |
| 373 | * Description: prepare MAC address for on-board Ethernet. |
| 374 | */ |
| 375 | static int handle_mac_address(void) |
| 376 | { |
| 377 | unsigned char enetaddr[6]; |
| 378 | int rc; |
| 379 | |
| 380 | rc = eth_getenv_enetaddr("ethaddr", enetaddr); |
| 381 | if (rc) |
| 382 | return 0; |
| 383 | |
Nikita Kiryanov | e4e2bf5 | 2012-01-12 03:28:09 +0000 | [diff] [blame] | 384 | rc = cm_t3x_eeprom_read_mac_addr(enetaddr); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 385 | if (rc) |
| 386 | return rc; |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 387 | |
| 388 | if (!is_valid_ether_addr(enetaddr)) |
| 389 | return -1; |
| 390 | |
| 391 | return eth_setenv_enetaddr("ethaddr", enetaddr); |
| 392 | } |
| 393 | |
| 394 | |
| 395 | /* |
| 396 | * Routine: board_eth_init |
| 397 | * Description: initialize module and base-board Ethernet chips |
| 398 | */ |
| 399 | int board_eth_init(bd_t *bis) |
| 400 | { |
| 401 | int rc = 0, rc1 = 0; |
| 402 | |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 403 | setup_net_chip_gmpc(); |
| 404 | reset_net_chip(); |
| 405 | |
| 406 | rc1 = handle_mac_address(); |
| 407 | if (rc1) |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 408 | printf("CM-T3x: No MAC address found\n"); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 409 | |
Igor Grinberg | b65a77a | 2011-04-18 17:55:21 -0400 | [diff] [blame] | 410 | rc1 = smc911x_initialize(0, CM_T3X_SMC911X_BASE); |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 411 | if (rc1 > 0) |
| 412 | rc++; |
| 413 | |
| 414 | rc1 = smc911x_initialize(1, SB_T35_SMC911X_BASE); |
| 415 | if (rc1 > 0) |
| 416 | rc++; |
Mike Rapoport | 36b4e2d | 2010-12-18 17:43:19 -0500 | [diff] [blame] | 417 | |
| 418 | return rc; |
| 419 | } |
Nikita Kiryanov | ce15ec9 | 2012-01-02 04:01:31 +0000 | [diff] [blame] | 420 | #endif |
Nikita Kiryanov | 8230925 | 2012-01-12 03:26:30 +0000 | [diff] [blame] | 421 | |
| 422 | void __weak get_board_serial(struct tag_serialnr *serialnr) |
| 423 | { |
| 424 | /* |
| 425 | * This corresponds to what happens when we can communicate with the |
| 426 | * eeprom but don't get a valid board serial value. |
| 427 | */ |
| 428 | serialnr->low = 0; |
| 429 | serialnr->high = 0; |
| 430 | }; |