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