*/
#include <version.h>
#include <common.h>
-#include <environment.h>
-#include <errno.h>
-#include <asm/arch/cpu.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/omap.h>
-#include <asm/arch/clock.h>
-#include <asm/arch/gpio.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/mmc_host_def.h>
-#include <asm/io.h>
-#include <asm/gpio.h>
+#include <fdtdec.h>
#include <i2c.h>
-#include <miiphy.h>
-#include <cpsw.h>
-#include <power/tps65217.h>
#include <lcd.h>
#include "bur_common.h"
-#include "../../../drivers/video/am335x-fb.h"
-
-static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
DECLARE_GLOBAL_DATA_PTR;
/* --------------------------------------------------------------------------*/
#if defined(CONFIG_LCD) && defined(CONFIG_AM335X_LCD) && \
!defined(CONFIG_SPL_BUILD)
+#include <asm/arch/hardware.h>
+#include <asm/arch/cpu.h>
+#include <asm/gpio.h>
+#include <power/tps65217.h>
+#include "../../../drivers/video/am335x-fb.h"
+
void lcdbacklight(int on)
{
unsigned int driver = env_get_ulong("ds1_bright_drv", 16, 0UL);
return 0;
}
-int ft_board_setup(void *blob, bd_t *bd)
-{
- int nodeoffset;
-
- nodeoffset = fdt_path_offset(blob, "/factory-settings");
- if (nodeoffset < 0) {
- puts("set bootloader version 'factory-settings' not in dtb!\n");
- return -1;
- }
- if (fdt_setprop(blob, nodeoffset, "bl-version",
- PLAIN_VERSION, strlen(PLAIN_VERSION)) != 0) {
- puts("set bootloader version 'bl-version' prop. not in dtb!\n");
- return -1;
- }
-
- return 0;
-}
-
static void br_summaryscreen_printenv(char *prefix,
char *name, char *altname,
char *suffix)
{
br_summaryscreen_printenv(" - B&R -", "br_orderno", 0, "-\n");
br_summaryscreen_printenv(" Serial/Rev :", "br_serial", 0, "\n");
- br_summaryscreen_printenv(" MAC (IF1) :", "br_mac1", "ethaddr", "\n");
- br_summaryscreen_printenv(" MAC (IF2) :", "br_mac2", 0, "\n");
+ br_summaryscreen_printenv(" MAC1 :", "br_mac1", "ethaddr", "\n");
+ br_summaryscreen_printenv(" MAC2 :", "br_mac2", 0, "\n");
lcd_puts(" Bootloader : " PLAIN_VERSION "\n");
lcd_puts("\n");
}
void lcdpower(int on)
{
u32 pin, swval, i;
+ char buf[16] = { 0 };
pin = env_get_ulong("ds1_pwr", 16, ~0UL);
for (i = 0; i < 3; i++) {
if (pin != 0) {
+ snprintf(buf, sizeof(buf), "ds1_pwr#%d", i);
+ if (gpio_request(pin & 0x7F, buf) != 0) {
+ printf("%s: not able to request gpio %s",
+ __func__, buf);
+ continue;
+ }
swval = pin & 0x80 ? 0 : 1;
if (on)
gpio_direction_output(pin & 0x7F, swval);
br_summaryscreen();
lcdbacklight(1);
}
-#elif CONFIG_SPL_BUILD
-#else
-#error "LCD-support with a suitable FB-Driver is mandatory !"
#endif /* CONFIG_LCD */
-#ifdef CONFIG_SPL_BUILD
-void pmicsetup(u32 mpupll)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+ int nodeoffset;
+
+ nodeoffset = fdt_path_offset(blob, "/factory-settings");
+ if (nodeoffset < 0) {
+ printf("%s: cannot find /factory-settings, trying /fset\n",
+ __func__);
+ nodeoffset = fdt_path_offset(blob, "/fset");
+ if (nodeoffset < 0) {
+ printf("%s: cannot find /fset.\n", __func__);
+ return 0;
+ }
+ }
+
+ if (fdt_setprop(blob, nodeoffset, "bl-version",
+ PLAIN_VERSION, strlen(PLAIN_VERSION)) != 0) {
+ printf("%s: no 'bl-version' prop in fdt!\n", __func__);
+ return 0;
+ }
+ return 0;
+}
+
+int overwrite_console(void)
+{
+ return 1;
+}
+
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_AM33XX)
+#include <asm/arch/hardware.h>
+#include <asm/arch/omap.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
+#include <power/tps65217.h>
+
+static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
+
+void pmicsetup(u32 mpupll, unsigned int bus)
{
int mpu_vdd;
int usb_cur_lim;
- if (i2c_probe(TPS65217_CHIP_PM)) {
- puts("PMIC (0x24) not found! skip further initalization.\n");
+ if (power_tps65217_init(bus)) {
+ printf("WARN: cannot setup PMIC 0x24 @ bus #%d, not found!.\n",
+ bus);
return;
}
printf("detected max. frequency: %d - ", dpll_mpu_opp100.m);
if (0 != mpupll) {
- dpll_mpu_opp100.m = MPUPLL_M_1000;
+ dpll_mpu_opp100.m = mpupll;
printf("retuning MPU-PLL to: %d MHz.\n", dpll_mpu_opp100.m);
} else {
puts("ok.\n");
enable_board_pin_mux();
}
-#endif /* CONFIG_SPL_BUILD */
-
-#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
- (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
-static void cpsw_control(int enabled)
-{
- /* VTP can be added here */
- return;
-}
-
-/* describing port offsets of TI's CPSW block */
-static struct cpsw_slave_data cpsw_slaves[] = {
- {
- .slave_reg_ofs = 0x208,
- .sliver_reg_ofs = 0xd80,
- .phy_addr = 1,
- },
- {
- .slave_reg_ofs = 0x308,
- .sliver_reg_ofs = 0xdc0,
- .phy_addr = 2,
- },
-};
-
-static struct cpsw_platform_data cpsw_data = {
- .mdio_base = CPSW_MDIO_BASE,
- .cpsw_base = CPSW_BASE,
- .mdio_div = 0xff,
- .channels = 8,
- .cpdma_reg_ofs = 0x800,
- .slaves = 1,
- .slave_data = cpsw_slaves,
- .ale_reg_ofs = 0xd00,
- .ale_entries = 1024,
- .host_port_reg_ofs = 0x108,
- .hw_stats_reg_ofs = 0x900,
- .bd_ram_ofs = 0x2000,
- .mac_control = (1 << 5),
- .control = cpsw_control,
- .host_port_num = 0,
- .version = CPSW_CTRL_VERSION_2,
-};
-#endif /* CONFIG_DRIVER_TI_CPSW, ... */
-
-#if defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)
-int board_eth_init(bd_t *bis)
-{
- int rv = 0;
- char mac_addr[6];
- const char *mac = 0;
- uint32_t mac_hi, mac_lo;
- /* try reading mac address from efuse */
- mac_lo = readl(&cdev->macid0l);
- mac_hi = readl(&cdev->macid0h);
- mac_addr[0] = mac_hi & 0xFF;
- mac_addr[1] = (mac_hi & 0xFF00) >> 8;
- mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
- mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
- mac_addr[4] = mac_lo & 0xFF;
- mac_addr[5] = (mac_lo & 0xFF00) >> 8;
-
- if (!env_get("ethaddr")) {
- if (!mac) {
- printf("<ethaddr> not set. validating E-fuse MAC ... ");
- if (is_valid_ethaddr((const u8 *)mac_addr))
- mac = (const char *)mac_addr;
- }
-
- if (mac) {
- printf("using: %pM on ", mac);
- eth_env_set_enetaddr("ethaddr", (const u8 *)mac);
- }
- }
- writel(MII_MODE_ENABLE, &cdev->miisel);
- cpsw_slaves[0].phy_if = PHY_INTERFACE_MODE_MII;
- cpsw_slaves[1].phy_if = PHY_INTERFACE_MODE_MII;
-
- rv = cpsw_register(&cpsw_data);
- if (rv < 0) {
- printf("Error %d registering CPSW switch\n", rv);
- return 0;
- }
- return rv;
-}
-#endif /* defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD) */
-#if defined(CONFIG_MMC)
-int board_mmc_init(bd_t *bis)
-{
- int rc = 0;
-
- rc |= omap_mmc_init(0, 0, 0, -1, -1);
- rc |= omap_mmc_init(1, 0, 0, -1, -1);
-
- return rc;
-}
-#endif
-int overwrite_console(void)
-{
- return 1;
-}
+#endif /* CONFIG_SPL_BUILD && CONFIG_AM33XX */