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>
20 #include "../cm-bf537e/gpio_cfi_flash.h"
23 DECLARE_GLOBAL_DATA_PTR;
27 printf("Board: bct-brettl2 board\n");
28 printf(" Support: http://www.bct-electronic.com/\n");
32 #ifdef CONFIG_BFIN_MAC
33 static void board_init_enetaddr(uchar *mac_addr)
35 puts("Warning: Generating 'random' MAC address\n");
36 bfin_gen_rand_mac(mac_addr);
37 eth_setenv_enetaddr("ethaddr", mac_addr);
40 int board_eth_init(bd_t *bis)
45 ret = bfin_EMAC_initialize(bis);
48 if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
49 printf("setting MAC %pM\n", enetaddr);
53 puts("initialize SMSC LAN9303i ethernet switch\n");
56 if (init_smsc9303i_mii())
64 static void init_tlv320aic31(void)
66 puts("Audio: setup TIMER0 to enable 16.384 MHz clock for tlv320aic31\n");
67 peripheral_request(P_TMR0, "tlv320aic31 clock");
68 bfin_write_TIMER0_CONFIG(0x020d);
69 bfin_write_TIMER0_PERIOD(0x0008);
70 bfin_write_TIMER0_WIDTH(0x0008/2);
71 bfin_write_TIMER_ENABLE(bfin_read_TIMER_ENABLE() | 1);
75 puts(" resetting tlv320aic31\n");
77 gpio_request(GPIO_PF2, "tlv320aic31");
78 gpio_direction_output(GPIO_PF2, 0);
80 gpio_direction_output(GPIO_PF2, 1);
85 static void init_mute_pin(void)
87 printf(" unmute class D amplifier\n");
89 gpio_request(GPIO_PF5, "mute");
90 gpio_direction_output(GPIO_PF5, 1);
94 /* sometimes LEDs (speech, status) are still on after reboot, turn 'em off */
95 static void turn_leds_off(void)
97 printf(" turn LEDs off\n");
99 gpio_request(GPIO_PF6, "led");
100 gpio_direction_output(GPIO_PF6, 0);
103 gpio_request(GPIO_PF15, "led");
104 gpio_direction_output(GPIO_PF15, 0);
105 gpio_free(GPIO_PF15);
108 /* miscellaneous platform dependent initialisations */
109 int misc_init_r(void)
111 #ifdef CONFIG_BFIN_MAC
113 if (!eth_getenv_enetaddr("ethaddr", enetaddr))
114 board_init_enetaddr(enetaddr);
117 gpio_cfi_flash_init();