summaryrefslogtreecommitdiff
path: root/common/include/asm/arch/gpio.h
blob: 465dd41f0bd67f0ff292abfdaab158e88eb3421e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 *  include/asm/arch/gpio.h
 *
 *  Copyright (C) 2012 MStar Semiconductor.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 */
#ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H

#include <asm/arch/ips/gpio.h>

#if !defined (CONFIG_CHIP_MSE500DINI_200) && !defined (CONFIG_CHIP_MSE500_200)
#include <asm/arch/nvram.h>

/* SPC300 GPIOs will use GENERIC_GPIO and GPIO_LIB */

#ifndef __ASSEMBLY__

/** MAX allowed GPIOs */
#define ARCH_NR_GPIOS MAX_INTERNAL_GPIOS

/** Use GPIO library */
#include <asm-generic/gpio.h>

#define gpio_get_value  __gpio_get_value
#define gpio_set_value  __gpio_set_value

static inline int gpio_to_irq(unsigned gpio)
{
    return gpio;
}

static inline int irq_to_gpio(unsigned irq)
{
    return irq;
}

extern int spc300_gpio_direction_input(struct gpio_chip *chip, unsigned offset);
extern int spc300_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value);
extern int spc300_gpio_get_value(struct gpio_chip *chip, unsigned offset);
extern void spc300_gpio_set_value(struct gpio_chip *chip, unsigned offset, int value);
extern uint32_t
spc300_gpio_get_interrupt_enable (void);
extern void
spc300_gpio_interrupt_disable (int num);
extern uint32_t
spc300_gpio_get_interrupt_mask (void);
extern void
spc300_gpio_interrupt_mask (int num);
extern void
spc300_gpio_interrupt_unmask (int num);
extern uint32_t
spc300_gpio_get_interrupt_level (void);
extern uint32_t
spc300_gpio_get_interrupt_polarity (void);
extern void
spc300_gpio_set_interrupt (int num, int level, int polarity);
extern uint32_t
spc300_gpio_get_interrupt_status (int num);
extern uint32_t
spc300_gpio_get_interrupt_raw_status (void);
extern void
spc300_gpio_clear_interrupts (int mask);

extern void spc300_gpio_setup(void);

#endif /* __ASSEMBLY__ */

#endif /* !CONFIG_CHIP_MSE500DINI_200 */

#endif /* __ASM_ARCH_GPIO_H */