]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/logicpd/zoom2/debug_board.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / board / logicpd / zoom2 / debug_board.c
1 /*
2 * Copyright (c) 2009 Wind River Systems, Inc.
3 * Tom Rix <Tom.Rix@windriver.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7 #include <common.h>
8 #include <asm/arch/cpu.h>
9 #include <asm/io.h>
10 #include <asm/arch/mux.h>
11 #include <asm/gpio.h>
12
13 #define DEBUG_BOARD_CONNECTED 1
14 #define DEBUG_BOARD_NOT_CONNECTED 0
15
16 static int debug_board_connected = DEBUG_BOARD_CONNECTED;
17
18 static void zoom2_debug_board_detect (void)
19 {
20 int val = 0;
21
22 if (!gpio_request(158, "")) {
23 /*
24 * GPIO to query for debug board
25 * 158 db board query
26 */
27 gpio_direction_input(158);
28 val = gpio_get_value(158);
29 }
30
31 if (!val)
32 debug_board_connected = DEBUG_BOARD_NOT_CONNECTED;
33 }
34
35 int zoom2_debug_board_connected (void)
36 {
37 static int first_time = 1;
38
39 if (first_time) {
40 zoom2_debug_board_detect ();
41 first_time = 0;
42 }
43 return debug_board_connected;
44 }