• Konstantin Porotchkin's avatar
    plat: marvell: Add support for Armada-37xx SoC platform · 1e66bacb
    Konstantin Porotchkin authored
    
    Add supprot for Marvell platforms based on Armada-37xx SoC.
    This includes support for the official Armada-3720 modular
    development board and EspressoBin community board.
    The Armada-37xx SoC contains dual Cortex-A53 Application CPU,
    single secure CPU (Cortex-M3) and the following interfaces:
    - SATA 3.0
    - USB 3.0 and USB 2.0
    - PCIe
    - SDIO (supports boot from eMMC)
    - SPI
    - UART
    - I2c
    - Gigabit Ethernet
    Signed-off-by: default avatarKonstantin Porotchkin <kostap@marvell.com>
    1e66bacb
mvebu.h 1.24 KB
/*
 * Copyright (C)  2018 Marvell International Ltd.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 * https://spdx.org/licenses
 */

#ifndef _MVEBU_H_
#define _MVEBU_H_

/* Use this functions only when printf is allowed */
#define debug_enter()	VERBOSE("----> Enter %s\n", __func__)
#define debug_exit()	VERBOSE("<---- Exit  %s\n", __func__)

/* Macro for testing alignment. Positive if number is NOT aligned */
#define IS_NOT_ALIGN(number, align)	((number) & ((align) - 1))

/* Macro for alignment up. For example, ALIGN_UP(0x0330, 0x20) = 0x0340 */
#define ALIGN_UP(number, align) (((number) & ((align) - 1)) ? \
		(((number) + (align)) & ~((align)-1)) : (number))

/* Macro for testing whether a number is a power of 2. Positive if so */
#define IS_POWER_OF_2(number)	((number) != 0 && \
				(((number) & ((number) - 1)) == 0))

/*
 * Macro for ronding up to next power of 2
 * it is done by count leading 0 (clz assembly opcode) and see msb set bit.
 * then you can shift it left and get number which power of 2
 * Note: this Macro is for 32 bit number
 */
#define ROUND_UP_TO_POW_OF_2(number)	(1 << \
					(32 - __builtin_clz((number) - 1)))

#define _1MB_				(1024ULL * 1024ULL)
#define _1GB_				(_1MB_ * 1024ULL)
#define _2GB_				(2 * _1GB_)

#endif	/* MVEBU_H */