1 /* 2 * Copyright (C) 2015 Atmel Corporation. 3 * Wenyou Yang <wenyou.yang@atmel.com> 4 * 5 * SPDX-License-Identifier: GPL-2.0+ 6 */ 7 8 #ifndef __ATMEL_PIO4_H 9 #define __ATMEL_PIO4_H 10 11 #ifndef __ASSEMBLY__ 12 13 struct atmel_pio4_port { 14 u32 mskr; /* 0x00 PIO Mask Register */ 15 u32 cfgr; /* 0x04 PIO Configuration Register */ 16 u32 pdsr; /* 0x08 PIO Pin Data Status Register */ 17 u32 locksr; /* 0x0C PIO Lock Status Register */ 18 u32 sodr; /* 0x10 PIO Set Output Data Register */ 19 u32 codr; /* 0x14 PIO Clear Output Data Register */ 20 u32 odsr; /* 0x18 PIO Output Data Status Register */ 21 u32 reserved0; 22 u32 ier; /* 0x20 PIO Interrupt Enable Register */ 23 u32 idr; /* 0x24 PIO Interrupt Disable Register */ 24 u32 imr; /* 0x28 PIO Interrupt Mask Register */ 25 u32 isr; /* 0x2C PIO Interrupt Status Register */ 26 u32 reserved1[3]; 27 u32 iofr; /* 0x3C PIO I/O Freeze Register */ 28 }; 29 30 #endif 31 32 #define AT91_PIO_PORTA 0x0 33 #define AT91_PIO_PORTB 0x1 34 #define AT91_PIO_PORTC 0x2 35 #define AT91_PIO_PORTD 0x3 36 37 int atmel_pio4_set_gpio(u32 port, u32 pin, u32 use_pullup); 38 int atmel_pio4_set_a_periph(u32 port, u32 pin, u32 use_pullup); 39 int atmel_pio4_set_b_periph(u32 port, u32 pin, u32 use_pullup); 40 int atmel_pio4_set_c_periph(u32 port, u32 pin, u32 use_pullup); 41 int atmel_pio4_set_d_periph(u32 port, u32 pin, u32 use_pullup); 42 int atmel_pio4_set_e_periph(u32 port, u32 pin, u32 use_pullup); 43 int atmel_pio4_set_f_periph(u32 port, u32 pin, u32 use_pullup); 44 int atmel_pio4_set_g_periph(u32 port, u32 pin, u32 use_pullup); 45 int atmel_pio4_set_pio_output(u32 port, u32 pin, u32 value); 46 int atmel_pio4_get_pio_input(u32 port, u32 pin); 47 48 #endif 49