2 * Modified for Hawkboard - Syed Mohammed Khasim <khasim@beagleboard.org>
4 * Copyright (C) 2008 Sekhar Nori, Texas Instruments, Inc. <nsekhar@ti.com>
5 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
6 * Copyright (C) 2004 Texas Instruments.
7 * Copyright (C) 2012 Sughosh Ganu <urwithsughosh@gmail.com>.
9 * ----------------------------------------------------------------------------
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 * ----------------------------------------------------------------------------
27 #include <asm/errno.h>
28 #include <asm/arch/hardware.h>
30 #include <asm/arch/davinci_misc.h>
31 #include <asm/arch/pinmux_defs.h>
32 #include <asm/arch/da8xx-usb.h>
35 DECLARE_GLOBAL_DATA_PTR
;
37 const struct pinmux_resource pinmuxes
[] = {
38 PINMUX_ITEM(emac_pins_mii
),
39 PINMUX_ITEM(emac_pins_mdio
),
40 PINMUX_ITEM(emifa_pins_cs3
),
41 PINMUX_ITEM(emifa_pins_cs4
),
42 PINMUX_ITEM(emifa_pins_nand
),
43 PINMUX_ITEM(uart2_pins_txrx
),
44 PINMUX_ITEM(uart2_pins_rtscts
),
47 const int pinmuxes_size
= ARRAY_SIZE(pinmuxes
);
49 const struct lpsc_resource lpsc
[] = {
50 { DAVINCI_LPSC_AEMIF
}, /* NAND, NOR */
51 { DAVINCI_LPSC_SPI1
}, /* Serial Flash */
52 { DAVINCI_LPSC_EMAC
}, /* image download */
53 { DAVINCI_LPSC_UART2
}, /* console */
54 { DAVINCI_LPSC_GPIO
},
57 const int lpsc_size
= ARRAY_SIZE(lpsc
);
61 /* arch number of the board */
62 gd
->bd
->bi_arch_number
= MACH_TYPE_OMAPL138_HAWKBOARD
;
64 /* address of boot parameters */
65 gd
->bd
->bi_boot_params
= LINUX_BOOT_PARAM_ADDR
;
70 int board_early_init_f(void)
73 * Kick Registers need to be set to allow access to Pin Mux registers
75 writel(DV_SYSCFG_KICK0_UNLOCK
, &davinci_syscfg_regs
->kick0
);
76 writel(DV_SYSCFG_KICK1_UNLOCK
, &davinci_syscfg_regs
->kick1
);
78 /* set cfgchip3 to select mii */
79 writel(readl(&davinci_syscfg_regs
->cfgchip3
) &
80 ~(1 << 8), &davinci_syscfg_regs
->cfgchip3
);
89 printf("ARM Clock : %s MHz\n",
90 strmhz(buf
, clk_get(DAVINCI_ARM_CLKID
)));
100 cfgchip2
= readl(&davinci_syscfg_regs
->cfgchip2
);
102 cfgchip2
&= ~(CFGCHIP2_RESET
| CFGCHIP2_PHYPWRDN
| CFGCHIP2_OTGPWRDN
|
103 CFGCHIP2_OTGMODE
| CFGCHIP2_REFFREQ
|
104 CFGCHIP2_USB1PHYCLKMUX
);
105 cfgchip2
|= CFGCHIP2_SESENDEN
| CFGCHIP2_VBDTCTEN
| CFGCHIP2_PHY_PLLON
|
106 CFGCHIP2_REFFREQ_24MHZ
| CFGCHIP2_USB2PHYCLKMUX
|
107 CFGCHIP2_USB1SUSPENDM
;
109 writel(cfgchip2
, &davinci_syscfg_regs
->cfgchip2
);
111 /* wait until the usb phy pll locks */
112 timeout
= DA8XX_USB_OTG_TIMEOUT
;
114 if (readl(&davinci_syscfg_regs
->cfgchip2
) & CFGCHIP2_PHYCLKGD
)
117 /* USB phy was not turned on */
121 void usb_phy_off(void)
126 * Power down the on-chip PHY.
128 cfgchip2
= readl(&davinci_syscfg_regs
->cfgchip2
);
129 cfgchip2
&= ~(CFGCHIP2_PHY_PLLON
| CFGCHIP2_USB1SUSPENDM
);
130 cfgchip2
|= CFGCHIP2_PHYPWRDN
| CFGCHIP2_OTGPWRDN
| CFGCHIP2_RESET
;
131 writel(cfgchip2
, &davinci_syscfg_regs
->cfgchip2
);