// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2019 MediaTek Inc.
* Copyright (C) 2024 Collabora Ltd.
* AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#include <linux/module.h>
#include "pinctrl-mtk-mt6893.h"
#include "pinctrl-paris.h"
#define PIN_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
32, 0)
#define PINS_FIELD_BASE(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits) \
PIN_FIELD_CALC(s_pin, e_pin, i_base, s_addr, x_addrs, s_bit, x_bits, \
32, 1)
static const struct mtk_pin_field_calc mt6893_pin_mode_range[] = {
PIN_FIELD(0, 219, 0x0300, 0x10, 0, 4),
};
static const struct mtk_pin_field_calc mt6893_pin_dir_range[] = {
PIN_FIELD(0, 219, 0x0000, 0x10, 0, 1),
};
static const struct mtk_pin_field_calc mt6893_pin_di_range[] = {
PIN_FIELD(0, 219, 0x0200, 0x10, 0, 1),
};
static const struct mtk_pin_field_calc mt6893_pin_do_range[] = {
PIN_FIELD(0, 219, 0x0100, 0x10, 0, 1),
};
static const struct mtk_pin_field_calc mt6893_pin_smt_range[] = {
PINS_FIELD_BASE(0, 9, 2, 0x00f0, 0x10, 7, 1),
PINS_FIELD_BASE(10, 15, 1, 0x0090, 0x10, 4, 1),
PIN_FIELD_BASE(16, 17, 5, 0x00c0, 0x10, 8, 1),
PINS_FIELD_BASE(18, 25, 7, 0x00f0, 0x10, 1, 1),
PINS_FIELD_BASE(26, 30, 6, 0x00e0, 0x10, 6, 1),
PINS_FIELD_BASE(31, 35, 6, 0x00e0, 0x10, 2, 1),
PIN_FIELD_BASE(36, 36, 6, 0x00e0, 0x10, 16, 1),
PINS_FIELD_BASE(37, 39, 6, 0x00e0, 0x10, 15, 1),
PIN_FIELD_BASE(40, 41, 6, 0x00e0, 0x10, 0, 1),
PIN_FIELD_BASE(42, 42, 6, 0x00e0, 0x10, 5, 1),
PIN_FIELD_BASE(43, 44, 6, 0x00e0, 0x10, 3, 1),
PIN_FIELD_BASE(45, 45, 6, 0x00e0, 0x10, 12, 1),
PIN_FIELD_BASE(46, 46, 6, 0x00e0, 0x10, 14, 1),
PIN_FIELD_BASE(47, 47, 6, 0x00e0, 0x10, 13, 1),
PIN_FIELD_BASE(48, 49, 6, 0x00e0, 0x10, 10, 1),
PIN_FIELD_BASE(50, 50, 6, 0x00e0, 0x10, 9, 1),
PIN_FIELD_BASE(51, 52, 3, 0x0090, 0x10, 6, 1),
PINS_FIELD_BASE(53, 56, 3, 0x0090, 0x10, 8, 1),
PIN_FIELD_BASE(57, 60, 3, 0x0090, 0x10, 2, 1),
PIN_FIELD_BASE(61, 61, 3, 0x0090, 0x10, 1, 1),
PIN_FIELD_BASE(62, 62, 4, 0x0050, 0x10, 1, 1),
PINS_FIELD_BASE(63, 73, 3, 0x0090, 0x10, 0, 1),
PINS_FIELD_BASE(74, 84, 4, 0x0050, 0x10, 0, 1),
PIN_FIELD_BASE(85, 86, 4, 0x0050, 0x10, 4, 1),
PIN_FIELD_BASE(87, 88, 4, 0x0050, 0x10, 2, 1),
PIN_FIELD_BASE(89, 90, 2, 0x00f0, 0x10, 26, 1),
PIN_FIELD_BASE(91, 91, 2, 0x00f0, 0x10, 0, 1),
PINS_FIELD_BASE(92, 95, 2, 0x0100, 0x10, 0, 1),
PIN_FIELD_BASE(96, 96, 2, 0x00f0, 0x10, 30, 1),
PIN_FIELD_BASE(97, 97, 2, 0x00f0, 0x10, 28, 1),
PIN_FIELD_BASE(98, 98, 2, 0x00f0, 0x10, 31, 1),
PINS_FIELD_BASE(99, 102, 2, 0x00f0, 0x10, 29, 1),
PINS_FIELD_BASE(103, 105, 2, 0x00f0, 0x10, 24, 1),
PIN_FIELD_BASE(106, 106, 2, 0x00f0, 0x10, 25, 1),
PIN_FIELD_BASE(107, 108, 2, 0x00f0, 0x10, 5, 1),
PINS_FIELD_BASE(109, 113, 2, 0x00f0, 0x10, 8, 1),