2 * U-boot - main board file for BCT brettl2
4 * Copyright (c) 2010 BCT Electronic GmbH
6 * Licensed under the GPL-2 or later.
12 #include <asm/blackfin.h>
13 #include <asm/portmux.h>
19 #include "../cm-bf537e/gpio_cfi_flash.h"
22 DECLARE_GLOBAL_DATA_PTR;
26 printf("Board: bct-brettl2 board\n");
27 printf(" Support: http://www.bct-electronic.com/\n");
31 #ifdef CONFIG_BFIN_MAC
32 static void board_init_enetaddr(uchar *mac_addr)
34 puts("Warning: Generating 'random' MAC address\n");
35 eth_random_addr(mac_addr);
36 eth_setenv_enetaddr("ethaddr", mac_addr);
39 int board_eth_init(bd_t *bis)
44 ret = bfin_EMAC_initialize(bis);
47 if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
48 printf("setting MAC %pM\n", enetaddr);
52 puts("initialize SMSC LAN9303i ethernet switch\n");
55 if (init_smsc9303i_mii())
63 static void init_tlv320aic31(void)
65 puts("Audio: setup TIMER0 to enable 16.384 MHz clock for tlv320aic31\n");
66 peripheral_request(P_TMR0, "tlv320aic31 clock");
67 bfin_write_TIMER0_CONFIG(0x020d);
68 bfin_write_TIMER0_PERIOD(0x0008);
69 bfin_write_TIMER0_WIDTH(0x0008/2);
70 bfin_write_TIMER_ENABLE(bfin_read_TIMER_ENABLE() | 1);
74 puts(" resetting tlv320aic31\n");
76 gpio_request(GPIO_PF2, "tlv320aic31");
77 gpio_direction_output(GPIO_PF2, 0);
79 gpio_direction_output(GPIO_PF2, 1);
84 static void init_mute_pin(void)
86 printf(" unmute class D amplifier\n");
88 gpio_request(GPIO_PF5, "mute");
89 gpio_direction_output(GPIO_PF5, 1);
93 /* sometimes LEDs (speech, status) are still on after reboot, turn 'em off */
94 static void turn_leds_off(void)
96 printf(" turn LEDs off\n");
98 gpio_request(GPIO_PF6, "led");
99 gpio_direction_output(GPIO_PF6, 0);
102 gpio_request(GPIO_PF15, "led");
103 gpio_direction_output(GPIO_PF15, 0);
104 gpio_free(GPIO_PF15);
107 /* miscellaneous platform dependent initialisations */
108 int misc_init_r(void)
110 #ifdef CONFIG_BFIN_MAC
112 if (!eth_getenv_enetaddr("ethaddr", enetaddr))
113 board_init_enetaddr(enetaddr);
116 gpio_cfi_flash_init();