2 * Board init file for Dragonboard 410C
4 * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
6 * SPDX-License-Identifier: GPL-2.0+
14 DECLARE_GLOBAL_DATA_PTR;
18 gd->ram_size = PHYS_SDRAM_1_SIZE;
22 void dram_init_banksize(void)
24 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
25 gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
29 int board_prepare_usb(enum usb_init_type type)
31 static struct udevice *pmic_gpio;
32 static struct gpio_desc hub_reset, usb_sel;
36 ret = uclass_get_device_by_name(UCLASS_GPIO,
40 printf("Failed to find pm8916_gpios@c000 node.\n");
45 /* Try to request gpios needed to start usb host on dragonboard */
46 if (!dm_gpio_is_valid(&hub_reset)) {
47 node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
50 printf("Failed to find usb_hub_reset_pm dt node.\n");
53 ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0,
56 printf("Failed to request usb_hub_reset_pm gpio.\n");
61 if (!dm_gpio_is_valid(&usb_sel)) {
62 node = fdt_subnode_offset(gd->fdt_blob, pmic_gpio->of_offset,
65 printf("Failed to find usb_sw_sel_pm dt node.\n");
68 ret = gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0,
71 printf("Failed to request usb_sw_sel_pm gpio.\n");
76 if (type == USB_INIT_HOST) {
78 dm_gpio_set_dir_flags(&hub_reset,
79 GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
81 /* Switch usb to host connectors */
82 dm_gpio_set_dir_flags(&usb_sel,
83 GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
87 dm_gpio_set_dir_flags(&hub_reset, GPIOD_IS_OUT);
88 /* Switch back to device connector */
89 dm_gpio_set_dir_flags(&usb_sel, GPIOD_IS_OUT);
100 /* Check for vol- button - if pressed - stop autoboot */
101 int misc_init_r(void)
104 struct gpio_desc resin;
107 ret = uclass_get_device_by_name(UCLASS_GPIO, "pm8916_pon@800", &pon);
109 printf("Failed to find PMIC pon node. Check device tree\n");
113 node = fdt_subnode_offset(gd->fdt_blob, pon->of_offset, "key_vol_down");
115 printf("Failed to find key_vol_down node. Check device tree\n");
119 if (gpio_request_by_name_nodev(gd->fdt_blob, node, "gpios", 0, &resin,
121 printf("Failed to request key_vol_down button.\n");
125 if (dm_gpio_get_value(&resin)) {
126 setenv("bootdelay", "-1");
127 printf("Power button pressed - dropping to console.\n");