blob: 900b114213324438d126877e505009f1fd9e4b4e [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/*
2 * (C) Copyright 2013
3 * Marvell Semiconductor <www.marvell.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#ifndef _ASM_ARCH_GPIO_H
9#define _ASM_ARCH_GPIO_H
10
11#include <asm/types.h>
12#include <asm/arch/pxa1928.h>
13#include <mvgpio.h>
14
15#define GPIO_TO_REG(gp) (gp >> 5)
16#define GPIO_TO_BIT(gp) (1 << (gp & 0x1F))
17#define GPIO_VAL(gp, val) ((val >> (gp & 0x1F)) & 0x01)
18
19static inline void *get_gpio_base(int bank)
20{
21 const unsigned long offset[6] = {0, 4, 8, 0x100, 0x104, 0x108};
22 return (struct gpio_reg *)(PXA1928_GPIO_BASE + offset[bank]);
23}
24
25#endif /* _ASM_ARCH_GPIO_H */