diff options
Diffstat (limited to 'board/BuR')
-rw-r--r-- | board/BuR/common/common.c | 125 | ||||
-rw-r--r-- | board/BuR/tseries/board.c | 3 | ||||
-rw-r--r-- | board/BuR/tseries/mux.c | 14 |
3 files changed, 77 insertions, 65 deletions
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c index 13f23fd7ce..23a98e4fdf 100644 --- a/board/BuR/common/common.c +++ b/board/BuR/common/common.c @@ -33,13 +33,14 @@ #endif #include "bur_common.h" #include "../../../drivers/video/am335x-fb.h" +#include <nand.h> static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; DECLARE_GLOBAL_DATA_PTR; #ifdef CONFIG_USE_FDT - #define FDTPROP(a, b, c) fdt_getprop_u32_default((void *)a, b, c, ~0UL) + #define FDTPROP(b, c) fdt_getprop_u32_default(gd->fdt_blob, b, c, ~0UL) #define PATHTIM "/panel/display-timings/default" #define PATHINF "/panel/panel-info" #endif @@ -50,51 +51,50 @@ int load_lcdtiming(struct am335x_lcdpanel *panel) { struct am335x_lcdpanel pnltmp; #ifdef CONFIG_USE_FDT - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); u32 dtbprop; - if (dtbaddr == ~0UL) { - puts("load_lcdtiming: failed to get 'dtbaddr' from env!\n"); + if (gd->fdt_blob == NULL) { + printf("%s: don't have a valid gd->fdt_blob!\n", __func__); return -1; } memcpy(&pnltmp, (void *)panel, sizeof(struct am335x_lcdpanel)); - pnltmp.hactive = FDTPROP(dtbaddr, PATHTIM, "hactive"); - pnltmp.vactive = FDTPROP(dtbaddr, PATHTIM, "vactive"); - pnltmp.bpp = FDTPROP(dtbaddr, PATHINF, "bpp"); - pnltmp.hfp = FDTPROP(dtbaddr, PATHTIM, "hfront-porch"); - pnltmp.hbp = FDTPROP(dtbaddr, PATHTIM, "hback-porch"); - pnltmp.hsw = FDTPROP(dtbaddr, PATHTIM, "hsync-len"); - pnltmp.vfp = FDTPROP(dtbaddr, PATHTIM, "vfront-porch"); - pnltmp.vbp = FDTPROP(dtbaddr, PATHTIM, "vback-porch"); - pnltmp.vsw = FDTPROP(dtbaddr, PATHTIM, "vsync-len"); - pnltmp.pup_delay = FDTPROP(dtbaddr, PATHTIM, "pupdelay"); - pnltmp.pon_delay = FDTPROP(dtbaddr, PATHTIM, "pondelay"); + pnltmp.hactive = FDTPROP(PATHTIM, "hactive"); + pnltmp.vactive = FDTPROP(PATHTIM, "vactive"); + pnltmp.bpp = FDTPROP(PATHINF, "bpp"); + pnltmp.hfp = FDTPROP(PATHTIM, "hfront-porch"); + pnltmp.hbp = FDTPROP(PATHTIM, "hback-porch"); + pnltmp.hsw = FDTPROP(PATHTIM, "hsync-len"); + pnltmp.vfp = FDTPROP(PATHTIM, "vfront-porch"); + pnltmp.vbp = FDTPROP(PATHTIM, "vback-porch"); + pnltmp.vsw = FDTPROP(PATHTIM, "vsync-len"); + pnltmp.pup_delay = FDTPROP(PATHTIM, "pupdelay"); + pnltmp.pon_delay = FDTPROP(PATHTIM, "pondelay"); /* calc. proper clk-divisor */ - dtbprop = FDTPROP(dtbaddr, PATHTIM, "clock-frequency"); + dtbprop = FDTPROP(PATHTIM, "clock-frequency"); if (dtbprop != ~0UL) pnltmp.pxl_clk_div = 192000000 / dtbprop; else pnltmp.pxl_clk_div = ~0UL; /* check polarity of control-signals */ - dtbprop = FDTPROP(dtbaddr, PATHTIM, "hsync-active"); + dtbprop = FDTPROP(PATHTIM, "hsync-active"); if (dtbprop == 0) pnltmp.pol |= HSYNC_INVERT; - dtbprop = FDTPROP(dtbaddr, PATHTIM, "vsync-active"); + dtbprop = FDTPROP(PATHTIM, "vsync-active"); if (dtbprop == 0) pnltmp.pol |= VSYNC_INVERT; - dtbprop = FDTPROP(dtbaddr, PATHINF, "sync-ctrl"); + dtbprop = FDTPROP(PATHINF, "sync-ctrl"); if (dtbprop == 1) pnltmp.pol |= HSVS_CONTROL; - dtbprop = FDTPROP(dtbaddr, PATHINF, "sync-edge"); + dtbprop = FDTPROP(PATHINF, "sync-edge"); if (dtbprop == 1) pnltmp.pol |= HSVS_RISEFALL; - dtbprop = FDTPROP(dtbaddr, PATHTIM, "pixelclk-active"); + dtbprop = FDTPROP(PATHTIM, "pixelclk-active"); if (dtbprop == 0) pnltmp.pol |= PXCLK_INVERT; - dtbprop = FDTPROP(dtbaddr, PATHTIM, "de-active"); + dtbprop = FDTPROP(PATHTIM, "de-active"); if (dtbprop == 0) pnltmp.pol |= DE_INVERT; #else @@ -160,14 +160,24 @@ int load_lcdtiming(struct am335x_lcdpanel *panel) #ifdef CONFIG_USE_FDT static int load_devicetree(void) { + int rc; + loff_t dtbsize; + u32 dtbaddr = getenv_ulong("dtbaddr", 16, 0UL); + + if (dtbaddr == 0) { + printf("%s: don't have a valid <dtbaddr> in env!\n", __func__); + return -1; + } +#ifdef CONFIG_NAND + dtbsize = 0x20000; + rc = nand_read_skip_bad(&nand_info[0], 0x40000, (size_t *)&dtbsize, + NULL, 0x20000, (u_char *)dtbaddr); +#else char *dtbname = getenv("dtb"); char *dtbdev = getenv("dtbdev"); char *dtppart = getenv("dtbpart"); - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); - loff_t dtbsize; - - if (!dtbdev || !dtbdev) { - puts("load_devicetree: <dtbdev>/<dtbpart> missing.\n"); + if (!dtbdev || !dtbdev || !dtbname) { + printf("%s: <dtbdev>/<dtbpart>/<dtb> missing.\n", __func__); return -1; } @@ -175,18 +185,17 @@ static int load_devicetree(void) puts("load_devicetree: set_blk_dev failed.\n"); return -1; } - if (dtbname && dtbaddr != ~0UL) { - if (fs_read(dtbname, dtbaddr, 0, 0, &dtbsize) == 0) { - gd->fdt_blob = (void *)dtbaddr; - gd->fdt_size = dtbsize; - debug("loaded %d bytes of dtb onto 0x%08x\n", - (u32)dtbsize, dtbaddr); - return dtbsize; - } - puts("load_devicetree: load dtb failed,file does not exist!\n"); + rc = fs_read(dtbname, (u32)dtbaddr, 0, 0, &dtbsize); +#endif + if (rc == 0) { + gd->fdt_blob = (void *)dtbaddr; + gd->fdt_size = dtbsize; + debug("loaded %d bytes of dtb onto 0x%08x\n", + (u32)dtbsize, (u32)gd->fdt_blob); + return dtbsize; } - puts("load_devicetree: <dtb>/<dtbaddr> missing!\n"); + printf("%s: load dtb failed!\n", __func__); return -1; } @@ -196,26 +205,25 @@ static const char *dtbmacaddr(u32 ifno) char enet[16]; const char *mac; const char *path; - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); - if (dtbaddr == ~0UL) { - puts("dtbmacaddr: failed to get 'dtbaddr' from env!\n"); + if (gd->fdt_blob == NULL) { + printf("%s: don't have a valid gd->fdt_blob!\n", __func__); return NULL; } - node = fdt_path_offset((void *)dtbaddr, "/aliases"); + node = fdt_path_offset(gd->fdt_blob, "/aliases"); if (node < 0) return NULL; sprintf(enet, "ethernet%d", ifno); - path = fdt_getprop((void *)dtbaddr, node, enet, NULL); + path = fdt_getprop(gd->fdt_blob, node, enet, NULL); if (!path) { printf("no alias for %s\n", enet); return NULL; } - node = fdt_path_offset((void *)dtbaddr, path); - mac = fdt_getprop((void *)dtbaddr, node, "mac-address", &len); + node = fdt_path_offset(gd->fdt_blob, path); + mac = fdt_getprop(gd->fdt_blob, node, "mac-address", &len); if (mac && is_valid_ethaddr((u8 *)mac)) return mac; @@ -226,15 +234,14 @@ static void br_summaryscreen_printdtb(char *prefix, char *name, char *suffix) { - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); char buf[32] = { 0 }; const char *nodep = buf; char *mac = 0; int nodeoffset; int len; - if (dtbaddr == ~0UL) { - puts("br_summaryscreen: failed to get 'dtbaddr' from env!\n"); + if (gd->fdt_blob == NULL) { + printf("%s: don't have a valid gd->fdt_blob!\n", __func__); return; } @@ -247,13 +254,13 @@ static void br_summaryscreen_printdtb(char *prefix, if (mac) sprintf(buf, "%pM", mac); } else { - nodeoffset = fdt_path_offset((void *)dtbaddr, + nodeoffset = fdt_path_offset(gd->fdt_blob, "/factory-settings"); if (nodeoffset < 0) { puts("no 'factory-settings' in dtb!\n"); return; } - nodep = fdt_getprop((void *)dtbaddr, nodeoffset, name, &len); + nodep = fdt_getprop(gd->fdt_blob, nodeoffset, name, &len); } if (nodep && strlen(nodep) > 1) lcd_printf("%s %s %s", prefix, nodep, suffix); @@ -318,13 +325,11 @@ void lcdpower(int on) { u32 pin, swval, i; #ifdef CONFIG_USE_FDT - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); - - if (dtbaddr == ~0UL) { - puts("lcdpower: failed to get 'dtbaddr' from env!\n"); + if (gd->fdt_blob == NULL) { + printf("%s: don't have a valid gd->fdt_blob!\n", __func__); return; } - pin = FDTPROP(dtbaddr, PATHINF, "pwrpin"); + pin = FDTPROP(PATHINF, "pwrpin"); #else pin = getenv_ulong("ds1_pwr", 16, ~0UL); #endif @@ -385,15 +390,13 @@ void lcd_ctrl_init(void *lcdbase) void lcd_enable(void) { #ifdef CONFIG_USE_FDT - u32 dtbaddr = getenv_ulong("dtbaddr", 16, ~0UL); - - if (dtbaddr == ~0UL) { - puts("lcdpower: failed to get 'dtbaddr' from env!\n"); + if (gd->fdt_blob == NULL) { + printf("%s: don't have a valid gd->fdt_blob!\n", __func__); return; } - unsigned int driver = FDTPROP(dtbaddr, PATHINF, "brightdrv"); - unsigned int bright = FDTPROP(dtbaddr, PATHINF, "brightdef"); - unsigned int pwmfrq = FDTPROP(dtbaddr, PATHINF, "brightfdim"); + unsigned int driver = FDTPROP(PATHINF, "brightdrv"); + unsigned int bright = FDTPROP(PATHINF, "brightdef"); + unsigned int pwmfrq = FDTPROP(PATHINF, "brightfdim"); #else unsigned int driver = getenv_ulong("ds1_bright_drv", 16, 0UL); unsigned int bright = getenv_ulong("ds1_bright_def", 10, 50); diff --git a/board/BuR/tseries/board.c b/board/BuR/tseries/board.c index 89e989f246..d1d698e7d2 100644 --- a/board/BuR/tseries/board.c +++ b/board/BuR/tseries/board.c @@ -128,6 +128,9 @@ void am33xx_spl_board_init(void) i2c_set_bus_num(0); i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); pmicsetup(0); + + gpio_direction_output(64+29, 1); /* switch NAND_RnB to GPMC_WAIT1 */ + gpio_direction_output(64+28, 1); /* switch MII2_CRS to GPMC_WAIT0 */ } const struct dpll_params *get_dpll_ddr_params(void) diff --git a/board/BuR/tseries/mux.c b/board/BuR/tseries/mux.c index ac7e885f61..c5dc4b7625 100644 --- a/board/BuR/tseries/mux.c +++ b/board/BuR/tseries/mux.c @@ -17,8 +17,10 @@ #include <i2c.h> static struct module_pin_mux uart0_pin_mux[] = { + /* UART0_RTS */ + {OFFSET(uart0_rtsn), (MODE(0) | PULLUDEN)}, /* UART0_CTS */ - {OFFSET(uart0_ctsn), (MODE(7) | PULLUDEN | PULLUP_EN | RXACTIVE)}, + {OFFSET(uart0_ctsn), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* UART0_RXD */ {OFFSET(uart0_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, /* UART0_TXD */ @@ -26,9 +28,13 @@ static struct module_pin_mux uart0_pin_mux[] = { {-1}, }; static struct module_pin_mux uart1_pin_mux[] = { - /* UART0_RXD */ + /* UART1_RTS as I2C2-SCL */ + {OFFSET(uart1_rtsn), (MODE(3) | PULLUDEN | PULLUP_EN | RXACTIVE)}, + /* UART1_CTS as I2C2-SDA */ + {OFFSET(uart1_ctsn), (MODE(3) | PULLUDEN | PULLUP_EN | RXACTIVE)}, + /* UART1_RXD */ {OFFSET(uart1_rxd), (MODE(0) | PULLUDEN | PULLUP_EN | RXACTIVE)}, - /* UART0_TXD */ + /* UART1_TXD */ {OFFSET(uart1_txd), (MODE(0) | PULLUDEN)}, {-1}, }; @@ -123,7 +129,7 @@ static struct module_pin_mux nand_pin_mux[] = { {OFFSET(gpmc_ad5), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD5 */ {OFFSET(gpmc_ad6), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD6 */ {OFFSET(gpmc_ad7), (MODE(0) | PULLUP_EN | RXACTIVE)}, /* NAND AD7 */ - {OFFSET(gpmc_wait0), (MODE(0) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */ + {OFFSET(gpmc_clk), (MODE(2) | RXACTIVE | PULLUP_EN)}, /* NAND WAIT */ {OFFSET(gpmc_wpn), (MODE(7) | PULLUP_EN | RXACTIVE)}, /* NAND_WPN */ {OFFSET(gpmc_csn0), (MODE(0) | PULLUDEN)}, /* NAND_CS0 */ {OFFSET(gpmc_advn_ale), (MODE(0) | PULLUDEN)}, /* NAND_ADV_ALE */ |