Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 1 | /* |
| 2 | * am3517evm.c - board file for TI's AM3517 family of devices. |
| 3 | * |
| 4 | * Author: Vaibhav Hiremath <hvaibhav@ti.com> |
| 5 | * |
| 6 | * Based on ti/evm/evm.c |
| 7 | * |
| 8 | * Copyright (C) 2010 |
| 9 | * Texas Instruments Incorporated - http://www.ti.com/ |
| 10 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 11 | * SPDX-License-Identifier: GPL-2.0+ |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <asm/io.h> |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 16 | #include <asm/omap_musb.h> |
| 17 | #include <asm/arch/am35x_def.h> |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 18 | #include <asm/arch/mem.h> |
| 19 | #include <asm/arch/mux.h> |
| 20 | #include <asm/arch/sys_proto.h> |
Vaibhav Hiremath | 122e6e0 | 2011-09-03 21:47:44 -0400 | [diff] [blame] | 21 | #include <asm/arch/mmc_host_def.h> |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 22 | #include <asm/arch/musb.h> |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 23 | #include <asm/mach-types.h> |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 24 | #include <asm/errno.h> |
| 25 | #include <linux/usb/ch9.h> |
| 26 | #include <linux/usb/gadget.h> |
| 27 | #include <linux/usb/musb.h> |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 28 | #include <i2c.h> |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 29 | #include <netdev.h> |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 30 | #include "am3517evm.h" |
| 31 | |
| 32 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | |
| 34 | /* |
| 35 | * Routine: board_init |
| 36 | * Description: Early hardware init. |
| 37 | */ |
| 38 | int board_init(void) |
| 39 | { |
| 40 | gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ |
| 41 | /* board id for Linux */ |
| 42 | gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM; |
| 43 | /* boot param addr */ |
| 44 | gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100); |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 49 | #ifdef CONFIG_USB_MUSB_AM35X |
| 50 | static struct musb_hdrc_config musb_config = { |
| 51 | .multipoint = 1, |
| 52 | .dyn_fifo = 1, |
| 53 | .num_eps = 16, |
| 54 | .ram_bits = 12, |
| 55 | }; |
| 56 | |
| 57 | static struct omap_musb_board_data musb_board_data = { |
| 58 | .set_phy_power = am35x_musb_phy_power, |
| 59 | .clear_irq = am35x_musb_clear_irq, |
| 60 | .reset = am35x_musb_reset, |
| 61 | }; |
| 62 | |
| 63 | static struct musb_hdrc_platform_data musb_plat = { |
| 64 | #if defined(CONFIG_MUSB_HOST) |
| 65 | .mode = MUSB_HOST, |
| 66 | #elif defined(CONFIG_MUSB_GADGET) |
| 67 | .mode = MUSB_PERIPHERAL, |
| 68 | #else |
| 69 | #error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET" |
| 70 | #endif |
| 71 | .config = &musb_config, |
| 72 | .power = 250, |
| 73 | .platform_ops = &am35x_ops, |
| 74 | .board_data = &musb_board_data, |
| 75 | }; |
| 76 | |
| 77 | static void am3517_evm_musb_init(void) |
| 78 | { |
| 79 | /* |
| 80 | * Set up USB clock/mode in the DEVCONF2 register. |
| 81 | * USB2.0 PHY reference clock is 13 MHz |
| 82 | */ |
| 83 | clrsetbits_le32(&am35x_scm_general_regs->devconf2, |
| 84 | CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE, |
| 85 | CONF2_REFFREQ_13MHZ | CONF2_SESENDEN | |
| 86 | CONF2_VBDTCTEN | CONF2_DATPOL); |
| 87 | |
| 88 | musb_register(&musb_plat, &musb_board_data, |
| 89 | (void *)AM35XX_IPSS_USBOTGSS_BASE); |
| 90 | } |
| 91 | #else |
| 92 | #define am3517_evm_musb_init() do {} while (0) |
| 93 | #endif |
| 94 | |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 95 | /* |
| 96 | * Routine: misc_init_r |
| 97 | * Description: Init i2c, ethernet, etc... (done here so udelay works) |
| 98 | */ |
| 99 | int misc_init_r(void) |
| 100 | { |
| 101 | #ifdef CONFIG_DRIVER_OMAP34XX_I2C |
| 102 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
| 103 | #endif |
| 104 | |
| 105 | dieid_num_r(); |
| 106 | |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 107 | am3517_evm_musb_init(); |
| 108 | |
Vaibhav Hiremath | ed01e45 | 2010-06-07 15:20:43 -0400 | [diff] [blame] | 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | /* |
| 113 | * Routine: set_muxconf_regs |
| 114 | * Description: Setting up the configuration Mux registers specific to the |
| 115 | * hardware. Many pins need to be moved from protect to primary |
| 116 | * mode. |
| 117 | */ |
| 118 | void set_muxconf_regs(void) |
| 119 | { |
| 120 | MUX_AM3517EVM(); |
| 121 | } |
Vaibhav Hiremath | 122e6e0 | 2011-09-03 21:47:44 -0400 | [diff] [blame] | 122 | |
Tom Rini | 5059a2a | 2011-11-18 12:48:10 +0000 | [diff] [blame] | 123 | #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) |
Vaibhav Hiremath | 122e6e0 | 2011-09-03 21:47:44 -0400 | [diff] [blame] | 124 | int board_mmc_init(bd_t *bis) |
| 125 | { |
Nikita Kiryanov | e3913f5 | 2012-12-03 02:19:47 +0000 | [diff] [blame] | 126 | return omap_mmc_init(0, 0, 0, -1, -1); |
Vaibhav Hiremath | 122e6e0 | 2011-09-03 21:47:44 -0400 | [diff] [blame] | 127 | } |
| 128 | #endif |
Ilya Yanok | 88919ff | 2012-11-06 13:48:28 +0000 | [diff] [blame] | 129 | |
| 130 | #if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET) |
| 131 | int board_eth_init(bd_t *bis) |
| 132 | { |
| 133 | int rv, n = 0; |
| 134 | |
| 135 | rv = cpu_eth_init(bis); |
| 136 | if (rv > 0) |
| 137 | n += rv; |
| 138 | |
| 139 | rv = usb_eth_initialize(bis); |
| 140 | if (rv > 0) |
| 141 | n += rv; |
| 142 | |
| 143 | return n; |
| 144 | } |
| 145 | #endif |