Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Igor Grinberg | 3c5dc28 | 2014-11-03 11:32:18 +0200 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2014 CompuLab, Ltd. <www.compulab.co.il> |
| 4 | * |
| 5 | * Authors: Igor Grinberg <grinberg@compulab.co.il> |
Igor Grinberg | 3c5dc28 | 2014-11-03 11:32:18 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/bootm.h> |
Igor Grinberg | 9c687fd | 2014-11-03 11:32:19 +0200 | [diff] [blame] | 10 | #include <asm/gpio.h> |
Simon Glass | d9a766f | 2017-05-17 08:23:00 -0600 | [diff] [blame] | 11 | #include <asm/setup.h> |
Igor Grinberg | 3c5dc28 | 2014-11-03 11:32:18 +0200 | [diff] [blame] | 12 | |
| 13 | #include "common.h" |
| 14 | #include "eeprom.h" |
| 15 | |
| 16 | void cl_print_pcb_info(void) |
| 17 | { |
| 18 | u32 board_rev = get_board_rev(); |
| 19 | u32 rev_major = board_rev / 100; |
| 20 | u32 rev_minor = board_rev - (rev_major * 100); |
| 21 | |
| 22 | if ((rev_minor / 10) * 10 == rev_minor) |
| 23 | rev_minor = rev_minor / 10; |
| 24 | |
| 25 | printf("PCB: %u.%u\n", rev_major, rev_minor); |
| 26 | } |
Igor Grinberg | 9c687fd | 2014-11-03 11:32:19 +0200 | [diff] [blame] | 27 | |
Igor Grinberg | b9e27fa | 2014-11-03 11:32:22 +0200 | [diff] [blame] | 28 | #ifdef CONFIG_SERIAL_TAG |
| 29 | void __weak get_board_serial(struct tag_serialnr *serialnr) |
| 30 | { |
| 31 | /* |
| 32 | * This corresponds to what happens when we can communicate with the |
| 33 | * eeprom but don't get a valid board serial value. |
| 34 | */ |
| 35 | serialnr->low = 0; |
| 36 | serialnr->high = 0; |
| 37 | }; |
| 38 | #endif |
| 39 | |
Igor Grinberg | 9c687fd | 2014-11-03 11:32:19 +0200 | [diff] [blame] | 40 | #ifdef CONFIG_CMD_USB |
| 41 | int cl_usb_hub_init(int gpio, const char *label) |
| 42 | { |
| 43 | if (gpio_request(gpio, label)) { |
| 44 | printf("Error: can't obtain GPIO%d for %s", gpio, label); |
| 45 | return -1; |
| 46 | } |
| 47 | |
| 48 | gpio_direction_output(gpio, 0); |
| 49 | udelay(10); |
| 50 | gpio_set_value(gpio, 1); |
| 51 | udelay(1000); |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | void cl_usb_hub_deinit(int gpio) |
| 56 | { |
| 57 | gpio_free(gpio); |
| 58 | } |
| 59 | #endif |