X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=board%2Fgateworks%2Fgw_ventana%2Fgw_ventana.c;h=3c40a4a8922476b09f09446b369fa0cc8f8782a4;hb=9fb625ce05539fe6876a59ce1dcadb76b33c6f6e;hp=332c506dfef7dc214d7b56668bd5cb7e1009be89;hpb=844fb498cc978608ec88bdf29913c0d46c85bfff;p=oweals%2Fu-boot.git diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c index 332c506dfe..3c40a4a892 100644 --- a/board/gateworks/gw_ventana/gw_ventana.c +++ b/board/gateworks/gw_ventana/gw_ventana.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2013 Gateworks Corporation * * Author: Tim Harvey - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -22,11 +21,12 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include #include @@ -156,6 +156,7 @@ int board_ehci_hcd_init(int port) switch (board_type) { case GW53xx: case GW552x: + case GW5906: gpio = (IMX_GPIO_NR(1, 9)); break; case GW54proto: @@ -268,11 +269,11 @@ int mv88e61xx_hw_reset(struct phy_device *phydev) phydev->speed = SPEED_1000; phydev->duplex = DUPLEX_FULL; - /* LED configuration: 7:4-green (8=Activity) 3:0 amber (9=10Link) */ - bus->write(bus, 0x10, 0, 0x16, 0x8089); - bus->write(bus, 0x11, 0, 0x16, 0x8089); - bus->write(bus, 0x12, 0, 0x16, 0x8089); - bus->write(bus, 0x13, 0, 0x16, 0x8089); + /* LED configuration: 7:4-green (8=Activity) 3:0 amber (8=Link) */ + bus->write(bus, 0x10, 0, 0x16, 0x8088); + bus->write(bus, 0x11, 0, 0x16, 0x8088); + bus->write(bus, 0x12, 0, 0x16, 0x8088); + bus->write(bus, 0x13, 0, 0x16, 0x8088); return 0; } @@ -385,8 +386,8 @@ struct display_info_t const displays[] = {{ .vmode = FB_VMODE_NONINTERLACED } }, { /* DLC700JMG-T-4 */ - .bus = 0, - .addr = 0, + .bus = 2, + .addr = 0x38, .detect = NULL, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, @@ -406,8 +407,8 @@ struct display_info_t const displays[] = {{ .vmode = FB_VMODE_NONINTERLACED } }, { /* DLC800FIG-T-3 */ - .bus = 0, - .addr = 0, + .bus = 2, + .addr = 0x14, .detect = NULL, .enable = enable_lvds, .pixfmt = IPU_PIX_FMT_LVDS666, @@ -425,7 +426,29 @@ struct display_info_t const displays[] = {{ .vsync_len = 10, .sync = FB_SYNC_EXT, .vmode = FB_VMODE_NONINTERLACED -} } }; +} }, { + .bus = 2, + .addr = 0x5d, + .detect = detect_i2c, + .enable = enable_lvds, + .pixfmt = IPU_PIX_FMT_LVDS666, + .mode = { + .name = "Z101WX01", + .refresh = 60, + .xres = 1280, + .yres = 800, + .pixclock = 15385, /* 64MHz */ + .left_margin = 220, + .right_margin = 40, + .upper_margin = 21, + .lower_margin = 7, + .hsync_len = 60, + .vsync_len = 10, + .sync = FB_SYNC_EXT, + .vmode = FB_VMODE_NONINTERLACED + } +}, +}; size_t display_count = ARRAY_SIZE(displays); static void setup_display(void) @@ -626,19 +649,23 @@ int board_init(void) /* address of linux boot parameters */ gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; + /* read Gateworks EEPROM into global struct (used later) */ + setup_ventana_i2c(0); + board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info); + #ifdef CONFIG_CMD_NAND - setup_gpmi_nand(); + if (gpio_cfg[board_type].nand) + setup_gpmi_nand(); #endif #ifdef CONFIG_MXC_SPI setup_spi(); #endif - setup_ventana_i2c(); + setup_ventana_i2c(1); + setup_ventana_i2c(2); #ifdef CONFIG_SATA setup_sata(); #endif - /* read Gateworks EEPROM into global struct (used later) */ - board_type = read_eeprom(CONFIG_I2C_GSC, &ventana_info); setup_iomux_gpio(board_type, &ventana_info); @@ -708,7 +735,7 @@ static const struct boot_mode board_boot_modes[] = { /* NAND: 64pages per block, 3 row addr cycles, 2 copies of FCB/DBBT */ { "nand", MAKE_CFGVAL(0x80, 0x02, 0x00, 0x00) }, { "emmc2", MAKE_CFGVAL(0x60, 0x48, 0x00, 0x00) }, /* GW5600 */ - { "emmc3", MAKE_CFGVAL(0x60, 0x50, 0x00, 0x00) }, /* GW5903/GW5904 */ + { "emmc3", MAKE_CFGVAL(0x60, 0x50, 0x00, 0x00) }, /* GW5903/4/5 */ { NULL, 0 }, }; #endif @@ -853,34 +880,12 @@ static int ft_sethdmiinfmt(void *blob, char *mode) return 0; } -/* enable a property of a node if the node is found */ -static inline void ft_enable_path(void *blob, const char *path) -{ - int i = fdt_path_offset(blob, path); - if (i >= 0) { - debug("enabling %s\n", path); - fdt_status_okay(blob, i); - } -} - -/* remove a property of a node if the node is found */ -static inline void ft_delprop_path(void *blob, const char *path, - const char *name) -{ - int i = fdt_path_offset(blob, path); - if (i) { - debug("removing %s/%s\n", path, name); - fdt_delprop(blob, i, name); - } -} - #if defined(CONFIG_CMD_PCI) #define PCI_ID(x) ( \ (PCI_BUS(x->devfn)<<16)| \ (PCI_DEV(x->devfn)<<11)| \ (PCI_FUNC(x->devfn)<<8) \ ) -#define PCIE_PATH "/soc/pcie@0x01000000" int fdt_add_pci_node(void *blob, int par, struct pci_dev *dev) { uint32_t reg[5]; @@ -913,7 +918,7 @@ int fdt_add_pci_path(void *blob, struct pci_dev *dev) int k, np; /* build list of parents */ - np = fdt_path_offset(blob, PCIE_PATH); + np = fdt_node_offset_by_compatible(blob, -1, "fsl,imx6q-pcie"); if (np < 0) return np; @@ -950,7 +955,7 @@ int fdt_fixup_gw16082(void *blob, int np, struct pci_dev *dev) int i; /* build irq-map based on host controllers map */ - host = fdt_path_offset(blob, PCIE_PATH); + host = fdt_node_offset_by_compatible(blob, -1, "fsl,imx6q-pcie"); if (host < 0) { printf(" %s failed: missing host\n", __func__); return host; @@ -1092,10 +1097,14 @@ void ft_board_pci_fixup(void *blob, bd_t *bd) } #endif /* if defined(CONFIG_CMD_PCI) */ -void ft_board_wdog_fixup(void *blob, const char *path) +void ft_board_wdog_fixup(void *blob, phys_addr_t addr) { - ft_delprop_path(blob, path, "ext-reset-output"); - ft_delprop_path(blob, path, "fsl,ext-reset-output"); + int off = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-wdt", addr); + + if (off) { + fdt_delprop(blob, off, "ext-reset-output"); + fdt_delprop(blob, off, "fsl,ext-reset-output"); + } } /* @@ -1107,15 +1116,16 @@ void ft_board_wdog_fixup(void *blob, const char *path) * - board (full model from EEPROM) * - peripherals removed from DTB if not loaded on board (per EEPROM config) */ -#define UART1_PATH "/soc/aips-bus@02100000/serial@021ec000" -#define WDOG1_PATH "/soc/aips-bus@02000000/wdog@020bc000" -#define WDOG2_PATH "/soc/aips-bus@02000000/wdog@020c0000" -#define GPIO3_PATH "/soc/aips-bus@02000000/gpio@020a4000" +#define WDOG1_ADDR 0x20bc000 +#define WDOG2_ADDR 0x20c0000 +#define GPIO3_ADDR 0x20a4000 +#define USDHC3_ADDR 0x2198000 +#define PWM0_ADDR 0x2080000 int ft_board_setup(void *blob, bd_t *bd) { struct ventana_board_info *info = &ventana_info; struct ventana_eeprom_config *cfg; - struct node_info nodes[] = { + static const struct node_info nodes[] = { { "sst,w25q256", MTD_DEV_TYPE_NOR, }, /* SPI flash */ { "fsl,imx6q-gpmi-nand", MTD_DEV_TYPE_NAND, }, /* NAND flash */ }; @@ -1173,14 +1183,15 @@ int ft_board_setup(void *blob, bd_t *bd) * errata causing wdog timer to be unreliable. */ if (rev >= 'A' && rev < 'C') { - i = fdt_path_offset(blob, WDOG1_PATH); + i = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-wdt", + WDOG1_ADDR); if (i) fdt_status_disabled(blob, i); } /* GW51xx-E adds WDOG1_B external reset */ if (rev < 'E') - ft_board_wdog_fixup(blob, WDOG1_PATH); + ft_board_wdog_fixup(blob, WDOG1_ADDR); break; case GW52xx: @@ -1196,7 +1207,8 @@ int ft_board_setup(void *blob, bd_t *bd) "reset-gpio", NULL); if (range) { - i = fdt_path_offset(blob, GPIO3_PATH); + i = fdt_node_offset_by_compat_reg(blob, + "fsl,imx6q-gpio", GPIO3_ADDR); if (i) handle = fdt_get_phandle(blob, i); if (handle) { @@ -1211,18 +1223,19 @@ int ft_board_setup(void *blob, bd_t *bd) gpio_cfg[board_type].usd_vsel = 0; /* GW522x-B adds WDOG1_B external reset */ - ft_board_wdog_fixup(blob, WDOG1_PATH); + if (rev < 'B') + ft_board_wdog_fixup(blob, WDOG1_ADDR); } /* GW520x-E adds WDOG1_B external reset */ else if (info->model[4] == '0' && rev < 'E') - ft_board_wdog_fixup(blob, WDOG1_PATH); + ft_board_wdog_fixup(blob, WDOG1_ADDR); break; case GW53xx: /* GW53xx-E adds WDOG1_B external reset */ if (rev < 'E') - ft_board_wdog_fixup(blob, WDOG1_PATH); + ft_board_wdog_fixup(blob, WDOG1_ADDR); break; case GW54xx: @@ -1230,13 +1243,12 @@ int ft_board_setup(void *blob, bd_t *bd) * disable serial2 node for GW54xx for compatibility with older * 3.10.x kernel that improperly had this node enabled in the DT */ - i = fdt_path_offset(blob, UART1_PATH); - if (i) - fdt_del_node(blob, i); + fdt_set_status_by_alias(blob, "serial2", FDT_STATUS_DISABLED, + 0); /* GW54xx-E adds WDOG2_B external reset */ if (rev < 'E') - ft_board_wdog_fixup(blob, WDOG2_PATH); + ft_board_wdog_fixup(blob, WDOG2_ADDR); break; case GW551x: @@ -1285,7 +1297,13 @@ int ft_board_setup(void *blob, bd_t *bd) /* GW551x-C adds WDOG1_B external reset */ if (rev < 'C') - ft_board_wdog_fixup(blob, WDOG1_PATH); + ft_board_wdog_fixup(blob, WDOG1_ADDR); + break; + case GW5901: + case GW5902: + /* GW5901/GW5901 revB adds WDOG1_B as an external reset */ + if (rev < 'B') + ft_board_wdog_fixup(blob, WDOG1_ADDR); break; } @@ -1299,20 +1317,27 @@ int ft_board_setup(void *blob, bd_t *bd) continue; if (hwconfig_subarg_cmp(arg, "mode", "pwm") && cfg->pwm_param) { - char path[48]; - sprintf(path, "/soc/aips-bus@02000000/pwm@%08x", - 0x02080000 + (0x4000 * (cfg->pwm_param - 1))); + phys_addr_t addr; + int off; + printf(" Enabling pwm%d for DIO%d\n", cfg->pwm_param, i); - ft_enable_path(blob, path); + addr = PWM0_ADDR + (0x4000 * (cfg->pwm_param - 1)); + off = fdt_node_offset_by_compat_reg(blob, + "fsl,imx6q-pwm", + addr); + if (off) + fdt_status_okay(blob, off); } } /* remove no-1-8-v if UHS-I support is present */ if (gpio_cfg[board_type].usd_vsel) { debug("Enabling UHS-I support\n"); - ft_delprop_path(blob, "/soc/aips-bus@02100000/usdhc@02198000", - "no-1-8-v"); + i = fdt_node_offset_by_compat_reg(blob, "fsl,imx6q-usdhc", + USDHC3_ADDR); + if (i) + fdt_delprop(blob, i, "no-1-8-v"); } #if defined(CONFIG_CMD_PCI)