]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/qualcomm/dragonboard410c/dragonboard410c.c
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 int 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
;
31 int board_prepare_usb(enum usb_init_type type
)
33 static struct udevice
*pmic_gpio
;
34 static struct gpio_desc hub_reset
, usb_sel
;
38 ret
= uclass_get_device_by_name(UCLASS_GPIO
,
42 printf("Failed to find pm8916_gpios@c000 node.\n");
47 /* Try to request gpios needed to start usb host on dragonboard */
48 if (!dm_gpio_is_valid(&hub_reset
)) {
49 node
= fdt_subnode_offset(gd
->fdt_blob
,
50 dev_of_offset(pmic_gpio
),
53 printf("Failed to find usb_hub_reset_pm dt node.\n");
56 ret
= gpio_request_by_name_nodev(gd
->fdt_blob
, node
, "gpios", 0,
59 printf("Failed to request usb_hub_reset_pm gpio.\n");
64 if (!dm_gpio_is_valid(&usb_sel
)) {
65 node
= fdt_subnode_offset(gd
->fdt_blob
,
66 dev_of_offset(pmic_gpio
),
69 printf("Failed to find usb_sw_sel_pm dt node.\n");
72 ret
= gpio_request_by_name_nodev(gd
->fdt_blob
, node
, "gpios", 0,
75 printf("Failed to request usb_sw_sel_pm gpio.\n");
80 if (type
== USB_INIT_HOST
) {
82 dm_gpio_set_dir_flags(&hub_reset
,
83 GPIOD_IS_OUT
| GPIOD_IS_OUT_ACTIVE
);
85 /* Switch usb to host connectors */
86 dm_gpio_set_dir_flags(&usb_sel
,
87 GPIOD_IS_OUT
| GPIOD_IS_OUT_ACTIVE
);
91 dm_gpio_set_dir_flags(&hub_reset
, GPIOD_IS_OUT
);
92 /* Switch back to device connector */
93 dm_gpio_set_dir_flags(&usb_sel
, GPIOD_IS_OUT
);
104 /* Check for vol- button - if pressed - stop autoboot */
105 int misc_init_r(void)
108 struct gpio_desc resin
;
111 ret
= uclass_get_device_by_name(UCLASS_GPIO
, "pm8916_pon@800", &pon
);
113 printf("Failed to find PMIC pon node. Check device tree\n");
117 node
= fdt_subnode_offset(gd
->fdt_blob
, dev_of_offset(pon
),
120 printf("Failed to find key_vol_down node. Check device tree\n");
124 if (gpio_request_by_name_nodev(gd
->fdt_blob
, node
, "gpios", 0, &resin
,
126 printf("Failed to request key_vol_down button.\n");
130 if (dm_gpio_get_value(&resin
)) {
131 setenv("bootdelay", "-1");
132 printf("Power button pressed - dropping to console.\n");