]>
Commit | Line | Data |
---|---|---|
de193e8e TR |
1 | /* |
2 | * Copyright (c) 2009 Wind River Systems, Inc. | |
3 | * Tom Rix <Tom.Rix@windriver.com> | |
4 | * | |
1a459660 | 5 | * SPDX-License-Identifier: GPL-2.0+ |
de193e8e TR |
6 | */ |
7 | #include <common.h> | |
8 | #include <asm/arch/cpu.h> | |
9 | #include <asm/io.h> | |
10 | #include <asm/arch/mux.h> | |
84c3b631 | 11 | #include <asm/gpio.h> |
de193e8e TR |
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 | ||
84c3b631 | 22 | if (!gpio_request(158, "")) { |
de193e8e TR |
23 | /* |
24 | * GPIO to query for debug board | |
25 | * 158 db board query | |
26 | */ | |
84c3b631 SP |
27 | gpio_direction_input(158); |
28 | val = gpio_get_value(158); | |
de193e8e TR |
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 | } |