Hao Zhang | d68bb7e | 2014-07-09 19:48:43 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Keystone EVM : Board initialization |
| 3 | * |
| 4 | * (C) Copyright 2014 |
| 5 | * Texas Instruments Incorporated, <www.ti.com> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <asm/io.h> |
| 12 | #include <asm/arch/hardware.h> |
| 13 | |
| 14 | /** |
| 15 | * cpu_to_bus - swap bytes of the 32-bit data if the device is BE |
| 16 | * @ptr - array of data |
| 17 | * @length - lenght of data array |
| 18 | */ |
| 19 | int cpu_to_bus(u32 *ptr, u32 length) |
| 20 | { |
| 21 | u32 i; |
| 22 | |
| 23 | if (!(readl(K2HK_DEVSTAT) & 0x1)) |
| 24 | for (i = 0; i < length; i++, ptr++) |
| 25 | *ptr = cpu_to_be32(*ptr); |
| 26 | |
| 27 | return 0; |
| 28 | } |