mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 14:23:07 +07:00
43c95d3694
cycle: Core changes: - Device links can optionally be added between a pin control producer and its consumers. This will affect how the system power management is handled: a pin controller will not suspend before all of its consumers have been suspended. This was necessary for the ST Microelectronics STMFX expander and need to be tested on other systems as well: it makes sense to make this default in the long run. Right now it is opt-in per driver. - Drive strength can be specified in microamps. With decreases in silicon technology, milliamps isn't granular enough, let's make it possible to select drive strengths in microamps. Right now the Meson (AMlogic) driver needs this. New drivers: - New subdriver for the Tegra 194 SoC. - New subdriver for the Qualcomm SDM845. - New subdriver for the Qualcomm SM8150. - New subdriver for the Freescale i.MX8MN (Freescale is now a product line of NXP). - New subdriver for Marvell MV98DX1135. Driver improvements: - The Bitmain BM1880 driver now supports pin config in addition to muxing. - The Qualcomm drivers can now reserve some GPIOs as taken aside and not usable for users. This is used in ACPI systems to take out some GPIO lines used by the BIOS so that noone else (neither kernel nor userspace) will play with them by mistake and crash the machine. - A slew of refurbishing around the Aspeed drivers (board management controllers for servers) in preparation for the new Aspeed AST2600 SoC. - A slew of improvements over the SH PFC drivers as usual. - Misc cleanups and fixes. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl0oTPcACgkQQRCzN7AZ XXNTsw//aNPfkJS8gRszv58G56lyuO8h6Cq4m5eDpzhlpjx5qjELgi9h2UNGINqD 7CWxo35ufbKe0fDIcqpXmtuDMtSu6MuKT3SMepuw9uf9wxyndK4RIuyb0lpAJrx2 +NMPxzS+ARlrMmcfvXPRyPWHqAkXsQk6zcCgiuNCPtROkOZgs1YZ3+pemZw2/FMq gSLTO/95p0TPWr6YAlpByqfsA1A/onEm9HOiU2INV7DrAfUj7mnkuC1nZ4IJDFcv Gn6qQVQPah+MBzkwt4WXy5kDRozCIbg7x+FQBw3KAO23TrLDTFuNsYIWGFcP2CN2 eT8iSP3cWrXNUuEgcPD59aO07rhFooT+QBQFt2ih1dJCV1u/795wb57nxSh1YDcO M2tG+AW2EZky65FXwhLW2rq3LvmTM4kiEz3mA/DrcOAKvvQllK+6FKEhNy0StstP yvvlqoXdgH3sfOnWTAyHr35qA/pMuGEXSryWTJPqpflCvZ3wxNk+IV5nyPAtfaFz CK7U0Ya7NaEp/5ZlpE720apJ4uSqmRrLwk5Y1eKQvT46mGOk3rC9ZPIMXc8mB10/ mJ9mTubi1t4uIPnBl/T1T7f8QhNtr9hOY6wjLf1LoMeJ1XVNBqA+2uydOlBJ1iop RQ7y/Jl1SZ/gBzKCmvjPHT2+0Oui9oXGd9bQi0xQKO5Lus/nAIg= =Wdw1 -----END PGP SIGNATURE----- Merge tag 'pinctrl-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control updates from Linus Walleij: "This is the bulk of pin control changes for the v5.3 kernel cycle: Core changes: - Device links can optionally be added between a pin control producer and its consumers. This will affect how the system power management is handled: a pin controller will not suspend before all of its consumers have been suspended. This was necessary for the ST Microelectronics STMFX expander and need to be tested on other systems as well: it makes sense to make this default in the long run. Right now it is opt-in per driver. - Drive strength can be specified in microamps. With decreases in silicon technology, milliamps isn't granular enough, let's make it possible to select drive strengths in microamps. Right now the Meson (AMlogic) driver needs this. New drivers: - New subdriver for the Tegra 194 SoC. - New subdriver for the Qualcomm SDM845. - New subdriver for the Qualcomm SM8150. - New subdriver for the Freescale i.MX8MN (Freescale is now a product line of NXP). - New subdriver for Marvell MV98DX1135. Driver improvements: - The Bitmain BM1880 driver now supports pin config in addition to muxing. - The Qualcomm drivers can now reserve some GPIOs as taken aside and not usable for users. This is used in ACPI systems to take out some GPIO lines used by the BIOS so that noone else (neither kernel nor userspace) will play with them by mistake and crash the machine. - A slew of refurbishing around the Aspeed drivers (board management controllers for servers) in preparation for the new Aspeed AST2600 SoC. - A slew of improvements over the SH PFC drivers as usual. - Misc cleanups and fixes" * tag 'pinctrl-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (106 commits) pinctrl: aspeed: Strip moved macros and structs from private header pinctrl: aspeed: Fix missed include pinctrl: baytrail: Use GENMASK() consistently pinctrl: baytrail: Re-use data structures from pinctrl-intel.h pinctrl: baytrail: Use defined macro instead of magic in byt_get_gpio_mux() pinctrl: qcom: Add SM8150 pinctrl driver dt-bindings: pinctrl: qcom: Add SM8150 pinctrl binding dt-bindings: pinctrl: qcom: Document missing gpio nodes pinctrl: aspeed: Add implementation-related documentation pinctrl: aspeed: Split out pinmux from general pinctrl pinctrl: aspeed: Clarify comment about strapping W1C pinctrl: aspeed: Correct comment that is no longer true MAINTAINERS: Add entry for ASPEED pinctrl drivers dt-bindings: pinctrl: aspeed: Convert AST2500 bindings to json-schema dt-bindings: pinctrl: aspeed: Convert AST2400 bindings to json-schema dt-bindings: pinctrl: aspeed: Split bindings document in two pinctrl: qcom: Add irq_enable callback for msm gpio pinctrl: madera: Fixup SPDX headers pinctrl: qcom: sdm845: Fix CONFIG preprocessor guard pinctrl: tegra: Add bitmask support for parked bits ...
174 lines
4.2 KiB
C
174 lines
4.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Pin controller and GPIO driver for Amlogic Meson SoCs
|
|
*
|
|
* Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com>
|
|
*/
|
|
|
|
#include <linux/gpio/driver.h>
|
|
#include <linux/pinctrl/pinctrl.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/regmap.h>
|
|
#include <linux/types.h>
|
|
|
|
/**
|
|
* struct meson_pmx_group - a pinmux group
|
|
*
|
|
* @name: group name
|
|
* @pins: pins in the group
|
|
* @num_pins: number of pins in the group
|
|
* @is_gpio: whether the group is a single GPIO group
|
|
* @reg: register offset for the group in the domain mux registers
|
|
* @bit bit index enabling the group
|
|
* @domain: index of the domain this group belongs to
|
|
*/
|
|
struct meson_pmx_group {
|
|
const char *name;
|
|
const unsigned int *pins;
|
|
unsigned int num_pins;
|
|
const void *data;
|
|
};
|
|
|
|
/**
|
|
* struct meson_pmx_func - a pinmux function
|
|
*
|
|
* @name: function name
|
|
* @groups: groups in the function
|
|
* @num_groups: number of groups in the function
|
|
*/
|
|
struct meson_pmx_func {
|
|
const char *name;
|
|
const char * const *groups;
|
|
unsigned int num_groups;
|
|
};
|
|
|
|
/**
|
|
* struct meson_reg_desc - a register descriptor
|
|
*
|
|
* @reg: register offset in the regmap
|
|
* @bit: bit index in register
|
|
*
|
|
* The structure describes the information needed to control pull,
|
|
* pull-enable, direction, etc. for a single pin
|
|
*/
|
|
struct meson_reg_desc {
|
|
unsigned int reg;
|
|
unsigned int bit;
|
|
};
|
|
|
|
/**
|
|
* enum meson_reg_type - type of registers encoded in @meson_reg_desc
|
|
*/
|
|
enum meson_reg_type {
|
|
REG_PULLEN,
|
|
REG_PULL,
|
|
REG_DIR,
|
|
REG_OUT,
|
|
REG_IN,
|
|
REG_DS,
|
|
NUM_REG,
|
|
};
|
|
|
|
/**
|
|
* enum meson_pinconf_drv - value of drive-strength supported
|
|
*/
|
|
enum meson_pinconf_drv {
|
|
MESON_PINCONF_DRV_500UA,
|
|
MESON_PINCONF_DRV_2500UA,
|
|
MESON_PINCONF_DRV_3000UA,
|
|
MESON_PINCONF_DRV_4000UA,
|
|
};
|
|
|
|
/**
|
|
* struct meson bank
|
|
*
|
|
* @name: bank name
|
|
* @first: first pin of the bank
|
|
* @last: last pin of the bank
|
|
* @irq: hwirq base number of the bank
|
|
* @regs: array of register descriptors
|
|
*
|
|
* A bank represents a set of pins controlled by a contiguous set of
|
|
* bits in the domain registers. The structure specifies which bits in
|
|
* the regmap control the different functionalities. Each member of
|
|
* the @regs array refers to the first pin of the bank.
|
|
*/
|
|
struct meson_bank {
|
|
const char *name;
|
|
unsigned int first;
|
|
unsigned int last;
|
|
int irq_first;
|
|
int irq_last;
|
|
struct meson_reg_desc regs[NUM_REG];
|
|
};
|
|
|
|
struct meson_pinctrl_data {
|
|
const char *name;
|
|
const struct pinctrl_pin_desc *pins;
|
|
struct meson_pmx_group *groups;
|
|
struct meson_pmx_func *funcs;
|
|
unsigned int num_pins;
|
|
unsigned int num_groups;
|
|
unsigned int num_funcs;
|
|
struct meson_bank *banks;
|
|
unsigned int num_banks;
|
|
const struct pinmux_ops *pmx_ops;
|
|
void *pmx_data;
|
|
};
|
|
|
|
struct meson_pinctrl {
|
|
struct device *dev;
|
|
struct pinctrl_dev *pcdev;
|
|
struct pinctrl_desc desc;
|
|
struct meson_pinctrl_data *data;
|
|
struct regmap *reg_mux;
|
|
struct regmap *reg_pullen;
|
|
struct regmap *reg_pull;
|
|
struct regmap *reg_gpio;
|
|
struct regmap *reg_ds;
|
|
struct gpio_chip chip;
|
|
struct device_node *of_node;
|
|
};
|
|
|
|
#define FUNCTION(fn) \
|
|
{ \
|
|
.name = #fn, \
|
|
.groups = fn ## _groups, \
|
|
.num_groups = ARRAY_SIZE(fn ## _groups), \
|
|
}
|
|
|
|
#define BANK_DS(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib, \
|
|
dsr, dsb) \
|
|
{ \
|
|
.name = n, \
|
|
.first = f, \
|
|
.last = l, \
|
|
.irq_first = fi, \
|
|
.irq_last = li, \
|
|
.regs = { \
|
|
[REG_PULLEN] = { per, peb }, \
|
|
[REG_PULL] = { pr, pb }, \
|
|
[REG_DIR] = { dr, db }, \
|
|
[REG_OUT] = { or, ob }, \
|
|
[REG_IN] = { ir, ib }, \
|
|
[REG_DS] = { dsr, dsb }, \
|
|
}, \
|
|
}
|
|
|
|
#define BANK(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib) \
|
|
BANK_DS(n, f, l, fi, li, per, peb, pr, pb, dr, db, or, ob, ir, ib, 0, 0)
|
|
|
|
#define MESON_PIN(x) PINCTRL_PIN(x, #x)
|
|
|
|
/* Common pmx functions */
|
|
int meson_pmx_get_funcs_count(struct pinctrl_dev *pcdev);
|
|
const char *meson_pmx_get_func_name(struct pinctrl_dev *pcdev,
|
|
unsigned selector);
|
|
int meson_pmx_get_groups(struct pinctrl_dev *pcdev,
|
|
unsigned selector,
|
|
const char * const **groups,
|
|
unsigned * const num_groups);
|
|
|
|
/* Common probe function */
|
|
int meson_pinctrl_probe(struct platform_device *pdev);
|