// SPDX-License-Identifier: GPL-2.0-only/* * linux/drivers/pinctrl/pinmux-xway.c * based on linux/drivers/pinctrl/pinmux-pxa910.c * * Copyright (C) 2012 John Crispin <john@phrozen.org> * Copyright (C) 2015 Martin Schiller <mschiller@tdt.de> */#include<linux/err.h>#include<linux/gpio/driver.h>#include<linux/slab.h>#include<linux/module.h>#include<linux/of.h>#include<linux/ioport.h>#include<linux/io.h>#include<linux/device.h>#include<linux/platform_device.h>#include<linux/property.h>#include"pinctrl-lantiq.h"#include<lantiq_soc.h>/* we have up to 4 banks of 16 bit each */#define PINS 16#define PORT3 3#define PORT(x) (x / PINS)#define PORT_PIN(x) (x % PINS)/* we have 2 mux bits that can be set for each pin */#define MUX_ALT0 0x1#define MUX_ALT1 0x2/* * each bank has this offset apart from the 4th bank that is mixed into the * other 3 ranges */#define REG_OFF 0x30/* these are the offsets to our registers */#define GPIO_BASE(p) (REG_OFF * PORT(p))#define GPIO_OUT(p) GPIO_BASE(p)#define GPIO_IN(p) (GPIO_BASE(p) + 0x04)#define GPIO_DIR(p) (GPIO_BASE(p) + 0x08)