]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/davinci/sonata/sonata.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / board / davinci / sonata / sonata.c
CommitLineData
c74b2108
SK
1/*
2 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
3 *
4 * Parts are shamelessly stolen from various TI sources, original copyright
5 * follows:
6 * -----------------------------------------------------------------
7 *
8 * Copyright (C) 2004 Texas Instruments.
9 *
10 * ----------------------------------------------------------------------------
1a459660 11 * SPDX-License-Identifier: GPL-2.0+
c74b2108
SK
12 * ----------------------------------------------------------------------------
13 */
14
15#include <common.h>
154b5484
DB
16#include <nand.h>
17#include <asm/arch/nand_defs.h>
c74b2108 18#include <asm/arch/hardware.h>
d7f9b503 19#include <asm/arch/davinci_misc.h>
c74b2108 20
66b3f24d
DB
21DECLARE_GLOBAL_DATA_PTR;
22
c74b2108
SK
23int board_init(void)
24{
c74b2108
SK
25 /* address of boot parameters */
26 gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
27
0cd18fa9
HV
28 /* Configure AEMIF pins (although this should be configured at boot time
29 * with pull-up/pull-down resistors) */
30 REG(PINMUX0) = 0x00000c1f;
31
32 davinci_errata_workarounds();
c74b2108
SK
33
34 /* Power on required peripherals */
c74b2108
SK
35 lpsc_on(DAVINCI_LPSC_GPIO);
36
6d0f6bcf 37#if !defined(CONFIG_SYS_USE_DSPLINK)
c74b2108
SK
38 /* Powerup the DSP */
39 dsp_on();
6d0f6bcf 40#endif /* CONFIG_SYS_USE_DSPLINK */
c74b2108 41
0cd18fa9
HV
42 davinci_enable_uart0();
43 davinci_enable_emac();
44 davinci_enable_i2c();
c74b2108 45
0cd18fa9 46 lpsc_on(DAVINCI_LPSC_TIMER1);
c74b2108
SK
47 timer_init();
48
49 return(0);
50}
51
264bbdd1 52int misc_init_r(void)
c74b2108 53{
264bbdd1 54 uint8_t eeprom_enetaddr[6];
c74b2108 55
264bbdd1
HV
56 /* Read Ethernet MAC address from EEPROM if available. */
57 if (dvevm_read_mac_address(eeprom_enetaddr))
7b37a27e 58 davinci_sync_env_enetaddr(eeprom_enetaddr);
c74b2108 59
c74b2108
SK
60 return(0);
61}
154b5484
DB
62
63#ifdef CONFIG_NAND_DAVINCI
64
65/* Set WP on deselect, write enable on select */
66static void nand_sonata_select_chip(struct mtd_info *mtd, int chip)
67{
68#define GPIO_SET_DATA01 0x01c67018
69#define GPIO_CLR_DATA01 0x01c6701c
70#define GPIO_NAND_WP (1 << 4)
71#ifdef SONATA_BOARD_GPIOWP
72 if (chip < 0) {
73 REG(GPIO_CLR_DATA01) |= GPIO_NAND_WP;
74 } else {
75 REG(GPIO_SET_DATA01) |= GPIO_NAND_WP;
76 }
77#endif
78}
79
80int board_nand_init(struct nand_chip *nand)
81{
82 davinci_nand_init(nand);
83 nand->select_chip = nand_sonata_select_chip;
84 return 0;
85}
86
87#endif /* CONFIG_NAND_DAVINCI */