mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'pinctrl-v4.18-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 v4.18.
No core changes this time! Just a calm all-over-the-place drivers,
updates and fixes cycle as it seems.
New drivers/subdrivers:
- Actions Semiconductor S900 driver with more Actions variants for
S700, S500 in the pipe. Also generic GPIO support on top of the
same driver and IRQ support is in the pipe.
- Renesas r8a77470 PFC support.
- Renesas r8a77990 PFC support.
- Allwinner Sunxi H6 R_PIO support.
- Rockchip PX30 support.
- Meson Meson8m2 support.
- Remove support for the ill-fated Samsung Exynos 5440 SoC.
Improvements:
- Context save/restore support in pinctrl-single.
- External interrupt support for the Mediatek MT7622.
- Qualcomm ACPI HID QCOM8002 supported.
Fixes:
- Fix up suspend/resume support for Exynos 5433.
- Fix Strago DMI fixes on the Intel Cherryview"
* tag 'pinctrl-v4.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (72 commits)
pinctrl: cherryview: limit Strago DMI workarounds to version 1.0
pinctrl: at91-pio4: add missing of_node_put
pinctrl: armada-37xx: Fix spurious irq management
gpiolib: discourage gpiochip_add_pin[group]_range for DT pinctrls
pinctrl: msm: fix gpio-hog related boot issues
MAINTAINERS: update entry for Mediatek pin controller
pinctrl: mediatek: remove unused fields in struct mtk_eint_hw
pinctrl: mediatek: use generic EINT register maps for each SoC
pinctrl: mediatek: add EINT support to MT7622 SoC
pinctrl: mediatek: refactor EINT related code for all MediaTek pinctrl can fit
dt-bindings: pinctrl: add external interrupt support to MT7622 pinctrl
pinctrl: freescale: Switch to SPDX identifier
pinctrl: samsung: Fix suspend/resume for Exynos5433 GPF1..5 banks
pinctrl: sh-pfc: rcar-gen3: Fix grammar in static pin comments
pinctrl: sh-pfc: r8a77965: Add I2C pin support
pinctrl: sh-pfc: r8a77990: Add EthernetAVB pins, groups and functions
pinctrl: sh-pfc: r8a77990: Add I2C{1,2,4,5,6,7} pins, groups and functions
pinctrl: sh-pfc: r8a77990: Add SCIF pins, groups and functions
pinctrl: sh-pfc: r8a77990: Add bias pinconf support
pinctrl: sh-pfc: Initial R8A77990 PFC support
...
This commit is contained in:
@@ -8,6 +8,17 @@ Required Properties:
|
||||
- reg: Should contain the register base address and size of
|
||||
the pin controller.
|
||||
- clocks: phandle of the clock feeding the pin controller
|
||||
- gpio-controller: Marks the device node as a GPIO controller.
|
||||
- gpio-ranges: Specifies the mapping between gpio controller and
|
||||
pin-controller pins.
|
||||
- #gpio-cells: Should be two. The first cell is the gpio pin number
|
||||
and the second cell is used for optional parameters.
|
||||
- interrupt-controller: Marks the device node as an interrupt controller.
|
||||
- #interrupt-cells: Specifies the number of cells needed to encode an
|
||||
interrupt. Shall be set to 2. The first cell
|
||||
defines the interrupt number, the second encodes
|
||||
the trigger flags described in
|
||||
bindings/interrupt-controller/interrupts.txt
|
||||
|
||||
Please refer to pinctrl-bindings.txt in this directory for details of the
|
||||
common pinctrl bindings used by client devices, including the meaning of the
|
||||
@@ -164,6 +175,11 @@ Example:
|
||||
compatible = "actions,s900-pinctrl";
|
||||
reg = <0x0 0xe01b0000 0x0 0x1000>;
|
||||
clocks = <&cmu CLK_GPIO>;
|
||||
gpio-controller;
|
||||
gpio-ranges = <&pinctrl 0 0 146>;
|
||||
#gpio-cells = <2>;
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
|
||||
uart2-default: uart2-default {
|
||||
pinmux {
|
||||
|
||||
@@ -28,6 +28,7 @@ Required properties:
|
||||
"allwinner,sun50i-a64-r-pinctrl"
|
||||
"allwinner,sun50i-h5-pinctrl"
|
||||
"allwinner,sun50i-h6-pinctrl"
|
||||
"allwinner,sun50i-h6-r-pinctrl"
|
||||
"nextthing,gr8-pinctrl"
|
||||
|
||||
- reg: Should contain the register physical address and length for the
|
||||
|
||||
@@ -36,6 +36,24 @@ listed. In other words, a subnode that lists only a mux function implies no
|
||||
information about any pull configuration. Similarly, a subnode that lists only
|
||||
a pul parameter implies no information about the mux function.
|
||||
|
||||
The BCM2835 pin configuration and multiplexing supports the generic bindings.
|
||||
For details on each properties, you can refer to ./pinctrl-bindings.txt.
|
||||
|
||||
Required sub-node properties:
|
||||
- pins
|
||||
- function
|
||||
|
||||
Optional sub-node properties:
|
||||
- bias-disable
|
||||
- bias-pull-up
|
||||
- bias-pull-down
|
||||
- output-high
|
||||
- output-low
|
||||
|
||||
Legacy pin configuration and multiplexing binding:
|
||||
*** (Its use is deprecated, use generic multiplexing and configuration
|
||||
bindings instead)
|
||||
|
||||
Required subnode-properties:
|
||||
- brcm,pins: An array of cells. Each cell contains the ID of a pin. Valid IDs
|
||||
are the integer GPIO IDs; 0==GPIO0, 1==GPIO1, ... 53==GPIO53.
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
Required properties for the root node:
|
||||
- compatible: one of "amlogic,meson8-cbus-pinctrl"
|
||||
"amlogic,meson8b-cbus-pinctrl"
|
||||
"amlogic,meson8m2-cbus-pinctrl"
|
||||
"amlogic,meson8-aobus-pinctrl"
|
||||
"amlogic,meson8b-aobus-pinctrl"
|
||||
"amlogic,meson8m2-aobus-pinctrl"
|
||||
"amlogic,meson-gxbb-periphs-pinctrl"
|
||||
"amlogic,meson-gxbb-aobus-pinctrl"
|
||||
"amlogic,meson-gxl-periphs-pinctrl"
|
||||
|
||||
@@ -18,7 +18,9 @@ Required properties:
|
||||
removed.
|
||||
- #gpio-cells : Should be two.
|
||||
- first cell is the pin number
|
||||
- second cell is used to specify flags. Flags are currently unused.
|
||||
- second cell is used to specify flags as described in
|
||||
'Documentation/devicetree/bindings/gpio/gpio.txt'. Allowed values defined by
|
||||
'include/dt-bindings/gpio/gpio.h' (e.g. GPIO_ACTIVE_LOW).
|
||||
- gpio-controller : Marks the device node as a GPIO controller.
|
||||
- reg : For an address on its bus. I2C uses this a the I2C address of the chip.
|
||||
SPI uses this to specify the chipselect line which the chip is
|
||||
|
||||
@@ -9,6 +9,16 @@ Required properties for the root node:
|
||||
- #gpio-cells: Should be two. The first cell is the pin number and the
|
||||
second is the GPIO flags.
|
||||
|
||||
Optional properties:
|
||||
- interrupt-controller : Marks the device node as an interrupt controller
|
||||
|
||||
If the property interrupt-controller is defined, following property is required
|
||||
- reg-names: A string describing the "reg" entries. Must contain "eint".
|
||||
- interrupts : The interrupt output from the controller.
|
||||
- #interrupt-cells: Should be two.
|
||||
- interrupt-parent: Phandle of the interrupt parent to which the external
|
||||
GPIO interrupts are forwarded to.
|
||||
|
||||
Please refer to pinctrl-bindings.txt in this directory for details of the
|
||||
common pinctrl bindings used by client devices, including the meaning of the
|
||||
phrase "pin configuration node".
|
||||
|
||||
@@ -15,6 +15,7 @@ Required Properties:
|
||||
- "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1) compatible pin-controller.
|
||||
- "renesas,pfc-r8a7743": for R8A7743 (RZ/G1M) compatible pin-controller.
|
||||
- "renesas,pfc-r8a7745": for R8A7745 (RZ/G1E) compatible pin-controller.
|
||||
- "renesas,pfc-r8a77470": for R8A77470 (RZ/G1C) compatible pin-controller.
|
||||
- "renesas,pfc-r8a7778": for R8A7778 (R-Car M1) compatible pin-controller.
|
||||
- "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller.
|
||||
- "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller.
|
||||
@@ -27,6 +28,7 @@ Required Properties:
|
||||
- "renesas,pfc-r8a77965": for R8A77965 (R-Car M3-N) compatible pin-controller.
|
||||
- "renesas,pfc-r8a77970": for R8A77970 (R-Car V3M) compatible pin-controller.
|
||||
- "renesas,pfc-r8a77980": for R8A77980 (R-Car V3H) compatible pin-controller.
|
||||
- "renesas,pfc-r8a77990": for R8A77990 (R-Car E3) compatible pin-controller.
|
||||
- "renesas,pfc-r8a77995": for R8A77995 (R-Car D3) compatible pin-controller.
|
||||
- "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller.
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ defined as gpio sub-nodes of the pinmux controller.
|
||||
|
||||
Required properties for iomux controller:
|
||||
- compatible: should be
|
||||
"rockchip,px30-pinctrl": for Rockchip PX30
|
||||
"rockchip,rv1108-pinctrl": for Rockchip RV1108
|
||||
"rockchip,rk2928-pinctrl": for Rockchip RK2928
|
||||
"rockchip,rk3066a-pinctrl": for Rockchip RK3066a
|
||||
|
||||
@@ -1135,10 +1135,12 @@ F: arch/arm/mach-actions/
|
||||
F: arch/arm/boot/dts/owl-*
|
||||
F: arch/arm64/boot/dts/actions/
|
||||
F: drivers/clocksource/owl-*
|
||||
F: drivers/pinctrl/actions/*
|
||||
F: drivers/soc/actions/
|
||||
F: include/dt-bindings/power/owl-*
|
||||
F: include/linux/soc/actions/
|
||||
F: Documentation/devicetree/bindings/arm/actions.txt
|
||||
F: Documentation/devicetree/bindings/pinctrl/actions,s900-pinctrl.txt
|
||||
F: Documentation/devicetree/bindings/power/actions,owl-sps.txt
|
||||
F: Documentation/devicetree/bindings/timer/actions,owl-timer.txt
|
||||
|
||||
@@ -11225,6 +11227,7 @@ L: linux-mediatek@lists.infradead.org (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
F: Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
|
||||
F: Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt
|
||||
F: drivers/pinctrl/mediatek/mtk-eint.*
|
||||
F: drivers/pinctrl/mediatek/pinctrl-mtk-common.*
|
||||
F: drivers/pinctrl/mediatek/pinctrl-mt2701.c
|
||||
F: drivers/pinctrl/mediatek/pinctrl-mt7622.c
|
||||
|
||||
@@ -2078,6 +2078,11 @@ EXPORT_SYMBOL_GPL(gpiochip_generic_config);
|
||||
* @pctldev: the pin controller to map to
|
||||
* @gpio_offset: the start offset in the current gpio_chip number space
|
||||
* @pin_group: name of the pin group inside the pin controller
|
||||
*
|
||||
* Calling this function directly from a DeviceTree-supported
|
||||
* pinctrl driver is DEPRECATED. Please see Section 2.1 of
|
||||
* Documentation/devicetree/bindings/gpio/gpio.txt on how to
|
||||
* bind pinctrl and gpio drivers via the "gpio-ranges" property.
|
||||
*/
|
||||
int gpiochip_add_pingroup_range(struct gpio_chip *chip,
|
||||
struct pinctrl_dev *pctldev,
|
||||
@@ -2131,6 +2136,11 @@ EXPORT_SYMBOL_GPL(gpiochip_add_pingroup_range);
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success, or a negative error-code on failure.
|
||||
*
|
||||
* Calling this function directly from a DeviceTree-supported
|
||||
* pinctrl driver is DEPRECATED. Please see Section 2.1 of
|
||||
* Documentation/devicetree/bindings/gpio/gpio.txt on how to
|
||||
* bind pinctrl and gpio drivers via the "gpio-ranges" property.
|
||||
*/
|
||||
int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
|
||||
unsigned int gpio_offset, unsigned int pin_offset,
|
||||
|
||||
@@ -337,6 +337,7 @@ config PINCTRL_OCELOT
|
||||
select GENERIC_PINMUX_FUNCTIONS
|
||||
select REGMAP_MMIO
|
||||
|
||||
source "drivers/pinctrl/actions/Kconfig"
|
||||
source "drivers/pinctrl/aspeed/Kconfig"
|
||||
source "drivers/pinctrl/bcm/Kconfig"
|
||||
source "drivers/pinctrl/berlin/Kconfig"
|
||||
|
||||
@@ -43,6 +43,7 @@ obj-$(CONFIG_PINCTRL_INGENIC) += pinctrl-ingenic.o
|
||||
obj-$(CONFIG_PINCTRL_RK805) += pinctrl-rk805.o
|
||||
obj-$(CONFIG_PINCTRL_OCELOT) += pinctrl-ocelot.o
|
||||
|
||||
obj-y += actions/
|
||||
obj-$(CONFIG_ARCH_ASPEED) += aspeed/
|
||||
obj-y += bcm/
|
||||
obj-$(CONFIG_PINCTRL_BERLIN) += berlin/
|
||||
|
||||
15
drivers/pinctrl/actions/Kconfig
Normal file
15
drivers/pinctrl/actions/Kconfig
Normal file
@@ -0,0 +1,15 @@
|
||||
config PINCTRL_OWL
|
||||
bool "Actions Semi OWL pinctrl driver"
|
||||
depends on (ARCH_ACTIONS || COMPILE_TEST) && OF
|
||||
select PINMUX
|
||||
select PINCONF
|
||||
select GENERIC_PINCONF
|
||||
select GPIOLIB
|
||||
help
|
||||
Say Y here to enable Actions Semi OWL pinctrl driver
|
||||
|
||||
config PINCTRL_S900
|
||||
bool "Actions Semi S900 pinctrl driver"
|
||||
depends on PINCTRL_OWL
|
||||
help
|
||||
Say Y here to enable Actions Semi S900 pinctrl driver
|
||||
2
drivers/pinctrl/actions/Makefile
Normal file
2
drivers/pinctrl/actions/Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
obj-$(CONFIG_PINCTRL_OWL) += pinctrl-owl.o
|
||||
obj-$(CONFIG_PINCTRL_S900) += pinctrl-s900.o
|
||||
785
drivers/pinctrl/actions/pinctrl-owl.c
Normal file
785
drivers/pinctrl/actions/pinctrl-owl.c
Normal file
File diff suppressed because it is too large
Load Diff
162
drivers/pinctrl/actions/pinctrl-owl.h
Normal file
162
drivers/pinctrl/actions/pinctrl-owl.h
Normal file
@@ -0,0 +1,162 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* OWL SoC's Pinctrl definitions
|
||||
*
|
||||
* Copyright (c) 2014 Actions Semi Inc.
|
||||
* Author: David Liu <liuwei@actions-semi.com>
|
||||
*
|
||||
* Copyright (c) 2018 Linaro Ltd.
|
||||
* Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
|
||||
*/
|
||||
|
||||
#ifndef __PINCTRL_OWL_H__
|
||||
#define __PINCTRL_OWL_H__
|
||||
|
||||
#define OWL_PINCONF_SLEW_SLOW 0
|
||||
#define OWL_PINCONF_SLEW_FAST 1
|
||||
|
||||
enum owl_pinconf_pull {
|
||||
OWL_PINCONF_PULL_HIZ,
|
||||
OWL_PINCONF_PULL_DOWN,
|
||||
OWL_PINCONF_PULL_UP,
|
||||
OWL_PINCONF_PULL_HOLD,
|
||||
};
|
||||
|
||||
enum owl_pinconf_drv {
|
||||
OWL_PINCONF_DRV_2MA,
|
||||
OWL_PINCONF_DRV_4MA,
|
||||
OWL_PINCONF_DRV_8MA,
|
||||
OWL_PINCONF_DRV_12MA,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_pullctl - Actions pad pull control register
|
||||
* @reg: offset to the pull control register
|
||||
* @shift: shift value of the register
|
||||
* @width: width of the register
|
||||
*/
|
||||
struct owl_pullctl {
|
||||
int reg;
|
||||
unsigned int shift;
|
||||
unsigned int width;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_st - Actions pad schmitt trigger enable register
|
||||
* @reg: offset to the schmitt trigger enable register
|
||||
* @shift: shift value of the register
|
||||
* @width: width of the register
|
||||
*/
|
||||
struct owl_st {
|
||||
int reg;
|
||||
unsigned int shift;
|
||||
unsigned int width;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_pingroup - Actions pingroup definition
|
||||
* @name: name of the pin group
|
||||
* @pads: list of pins assigned to this pingroup
|
||||
* @npads: size of @pads array
|
||||
* @funcs: list of pinmux functions for this pingroup
|
||||
* @nfuncs: size of @funcs array
|
||||
* @mfpctl_reg: multiplexing control register offset
|
||||
* @mfpctl_shift: multiplexing control register bit mask
|
||||
* @mfpctl_width: multiplexing control register width
|
||||
* @drv_reg: drive control register offset
|
||||
* @drv_shift: drive control register bit mask
|
||||
* @drv_width: driver control register width
|
||||
* @sr_reg: slew rate control register offset
|
||||
* @sr_shift: slew rate control register bit mask
|
||||
* @sr_width: slew rate control register width
|
||||
*/
|
||||
struct owl_pingroup {
|
||||
const char *name;
|
||||
unsigned int *pads;
|
||||
unsigned int npads;
|
||||
unsigned int *funcs;
|
||||
unsigned int nfuncs;
|
||||
|
||||
int mfpctl_reg;
|
||||
unsigned int mfpctl_shift;
|
||||
unsigned int mfpctl_width;
|
||||
|
||||
int drv_reg;
|
||||
unsigned int drv_shift;
|
||||
unsigned int drv_width;
|
||||
|
||||
int sr_reg;
|
||||
unsigned int sr_shift;
|
||||
unsigned int sr_width;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_padinfo - Actions pinctrl pad info
|
||||
* @pad: pad name of the SoC
|
||||
* @pullctl: pull control register info
|
||||
* @st: schmitt trigger register info
|
||||
*/
|
||||
struct owl_padinfo {
|
||||
int pad;
|
||||
struct owl_pullctl *pullctl;
|
||||
struct owl_st *st;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_pinmux_func - Actions pinctrl mux functions
|
||||
* @name: name of the pinmux function.
|
||||
* @groups: array of pin groups that may select this function.
|
||||
* @ngroups: number of entries in @groups.
|
||||
*/
|
||||
struct owl_pinmux_func {
|
||||
const char *name;
|
||||
const char * const *groups;
|
||||
unsigned int ngroups;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_gpio_port - Actions GPIO port info
|
||||
* @offset: offset of the GPIO port.
|
||||
* @pins: number of pins belongs to the GPIO port.
|
||||
* @outen: offset of the output enable register.
|
||||
* @inen: offset of the input enable register.
|
||||
* @dat: offset of the data register.
|
||||
*/
|
||||
struct owl_gpio_port {
|
||||
unsigned int offset;
|
||||
unsigned int pins;
|
||||
unsigned int outen;
|
||||
unsigned int inen;
|
||||
unsigned int dat;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct owl_pinctrl_soc_data - Actions pin controller driver configuration
|
||||
* @pins: array describing all pins of the pin controller.
|
||||
* @npins: number of entries in @pins.
|
||||
* @functions: array describing all mux functions of this SoC.
|
||||
* @nfunction: number of entries in @functions.
|
||||
* @groups: array describing all pin groups of this SoC.
|
||||
* @ngroups: number of entries in @groups.
|
||||
* @padinfo: array describing the pad info of this SoC.
|
||||
* @ngpios: number of pingroups the driver should expose as GPIOs.
|
||||
* @port: array describing all GPIO ports of this SoC.
|
||||
* @nports: number of GPIO ports in this SoC.
|
||||
*/
|
||||
struct owl_pinctrl_soc_data {
|
||||
const struct pinctrl_pin_desc *pins;
|
||||
unsigned int npins;
|
||||
const struct owl_pinmux_func *functions;
|
||||
unsigned int nfunctions;
|
||||
const struct owl_pingroup *groups;
|
||||
unsigned int ngroups;
|
||||
const struct owl_padinfo *padinfo;
|
||||
unsigned int ngpios;
|
||||
const struct owl_gpio_port *ports;
|
||||
unsigned int nports;
|
||||
};
|
||||
|
||||
int owl_pinctrl_probe(struct platform_device *pdev,
|
||||
struct owl_pinctrl_soc_data *soc_data);
|
||||
|
||||
#endif /* __PINCTRL_OWL_H__ */
|
||||
1888
drivers/pinctrl/actions/pinctrl-s900.c
Normal file
1888
drivers/pinctrl/actions/pinctrl-s900.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,7 @@ config PINCTRL_BCM2835
|
||||
bool
|
||||
select PINMUX
|
||||
select PINCONF
|
||||
select GENERIC_PINCONF
|
||||
select GPIOLIB_IRQCHIP
|
||||
|
||||
config PINCTRL_IPROC_GPIO
|
||||
|
||||
@@ -36,11 +36,13 @@
|
||||
#include <linux/pinctrl/pinconf.h>
|
||||
#include <linux/pinctrl/pinctrl.h>
|
||||
#include <linux/pinctrl/pinmux.h>
|
||||
#include <linux/pinctrl/pinconf-generic.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/types.h>
|
||||
#include <dt-bindings/pinctrl/bcm2835.h>
|
||||
|
||||
#define MODULE_NAME "pinctrl-bcm2835"
|
||||
#define BCM2835_NUM_GPIOS 54
|
||||
@@ -72,13 +74,9 @@
|
||||
|
||||
enum bcm2835_pinconf_param {
|
||||
/* argument: bcm2835_pinconf_pull */
|
||||
BCM2835_PINCONF_PARAM_PULL,
|
||||
BCM2835_PINCONF_PARAM_PULL = (PIN_CONFIG_END + 1),
|
||||
};
|
||||
|
||||
#define BCM2835_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_))
|
||||
#define BCM2835_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16)
|
||||
#define BCM2835_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff)
|
||||
|
||||
struct bcm2835_pinctrl {
|
||||
struct device *dev;
|
||||
void __iomem *base;
|
||||
@@ -213,14 +211,6 @@ static const char * const bcm2835_gpio_groups[] = {
|
||||
};
|
||||
|
||||
enum bcm2835_fsel {
|
||||
BCM2835_FSEL_GPIO_IN = 0,
|
||||
BCM2835_FSEL_GPIO_OUT = 1,
|
||||
BCM2835_FSEL_ALT0 = 4,
|
||||
BCM2835_FSEL_ALT1 = 5,
|
||||
BCM2835_FSEL_ALT2 = 6,
|
||||
BCM2835_FSEL_ALT3 = 7,
|
||||
BCM2835_FSEL_ALT4 = 3,
|
||||
BCM2835_FSEL_ALT5 = 2,
|
||||
BCM2835_FSEL_COUNT = 8,
|
||||
BCM2835_FSEL_MASK = 0x7,
|
||||
};
|
||||
@@ -714,7 +704,7 @@ static int bcm2835_pctl_dt_node_to_map_pull(struct bcm2835_pinctrl *pc,
|
||||
configs = kzalloc(sizeof(*configs), GFP_KERNEL);
|
||||
if (!configs)
|
||||
return -ENOMEM;
|
||||
configs[0] = BCM2835_PINCONF_PACK(BCM2835_PINCONF_PARAM_PULL, pull);
|
||||
configs[0] = pinconf_to_config_packed(BCM2835_PINCONF_PARAM_PULL, pull);
|
||||
|
||||
map->type = PIN_MAP_TYPE_CONFIGS_PIN;
|
||||
map->data.configs.group_or_pin = bcm2835_gpio_pins[pin].name;
|
||||
@@ -727,7 +717,7 @@ static int bcm2835_pctl_dt_node_to_map_pull(struct bcm2835_pinctrl *pc,
|
||||
|
||||
static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||
struct device_node *np,
|
||||
struct pinctrl_map **map, unsigned *num_maps)
|
||||
struct pinctrl_map **map, unsigned int *num_maps)
|
||||
{
|
||||
struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
|
||||
struct property *pins, *funcs, *pulls;
|
||||
@@ -736,6 +726,12 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
|
||||
int i, err;
|
||||
u32 pin, func, pull;
|
||||
|
||||
/* Check for generic binding in this node */
|
||||
err = pinconf_generic_dt_node_to_map_all(pctldev, np, map, num_maps);
|
||||
if (err || *num_maps)
|
||||
return err;
|
||||
|
||||
/* Generic binding did not find anything continue with legacy parse */
|
||||
pins = of_find_property(np, "brcm,pins", NULL);
|
||||
if (!pins) {
|
||||
dev_err(pc->dev, "%pOF: missing brcm,pins property\n", np);
|
||||
@@ -917,37 +913,67 @@ static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
static void bcm2835_pull_config_set(struct bcm2835_pinctrl *pc,
|
||||
unsigned int pin, unsigned int arg)
|
||||
{
|
||||
u32 off, bit;
|
||||
|
||||
off = GPIO_REG_OFFSET(pin);
|
||||
bit = GPIO_REG_SHIFT(pin);
|
||||
|
||||
bcm2835_gpio_wr(pc, GPPUD, arg & 3);
|
||||
/*
|
||||
* BCM2835 datasheet say to wait 150 cycles, but not of what.
|
||||
* But the VideoCore firmware delay for this operation
|
||||
* based nearly on the same amount of VPU cycles and this clock
|
||||
* runs at 250 MHz.
|
||||
*/
|
||||
udelay(1);
|
||||
bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), BIT(bit));
|
||||
udelay(1);
|
||||
bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), 0);
|
||||
}
|
||||
|
||||
static int bcm2835_pinconf_set(struct pinctrl_dev *pctldev,
|
||||
unsigned pin, unsigned long *configs,
|
||||
unsigned num_configs)
|
||||
unsigned int pin, unsigned long *configs,
|
||||
unsigned int num_configs)
|
||||
{
|
||||
struct bcm2835_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev);
|
||||
enum bcm2835_pinconf_param param;
|
||||
u16 arg;
|
||||
u32 off, bit;
|
||||
u32 param, arg;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_configs; i++) {
|
||||
param = BCM2835_PINCONF_UNPACK_PARAM(configs[i]);
|
||||
arg = BCM2835_PINCONF_UNPACK_ARG(configs[i]);
|
||||
param = pinconf_to_config_param(configs[i]);
|
||||
arg = pinconf_to_config_argument(configs[i]);
|
||||
|
||||
if (param != BCM2835_PINCONF_PARAM_PULL)
|
||||
switch (param) {
|
||||
/* Set legacy brcm,pull */
|
||||
case BCM2835_PINCONF_PARAM_PULL:
|
||||
bcm2835_pull_config_set(pc, pin, arg);
|
||||
break;
|
||||
|
||||
/* Set pull generic bindings */
|
||||
case PIN_CONFIG_BIAS_DISABLE:
|
||||
bcm2835_pull_config_set(pc, pin, BCM2835_PUD_OFF);
|
||||
break;
|
||||
|
||||
case PIN_CONFIG_BIAS_PULL_DOWN:
|
||||
bcm2835_pull_config_set(pc, pin, BCM2835_PUD_DOWN);
|
||||
break;
|
||||
|
||||
case PIN_CONFIG_BIAS_PULL_UP:
|
||||
bcm2835_pull_config_set(pc, pin, BCM2835_PUD_UP);
|
||||
break;
|
||||
|
||||
/* Set output-high or output-low */
|
||||
case PIN_CONFIG_OUTPUT:
|
||||
bcm2835_gpio_set_bit(pc, arg ? GPSET0 : GPCLR0, pin);
|
||||
break;
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
||||
off = GPIO_REG_OFFSET(pin);
|
||||
bit = GPIO_REG_SHIFT(pin);
|
||||
|
||||
bcm2835_gpio_wr(pc, GPPUD, arg & 3);
|
||||
/*
|
||||
* BCM2835 datasheet say to wait 150 cycles, but not of what.
|
||||
* But the VideoCore firmware delay for this operation
|
||||
* based nearly on the same amount of VPU cycles and this clock
|
||||
* runs at 250 MHz.
|
||||
*/
|
||||
udelay(1);
|
||||
bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), BIT(bit));
|
||||
udelay(1);
|
||||
bcm2835_gpio_wr(pc, GPPUDCLK0 + (off * 4), 0);
|
||||
} /* switch param type */
|
||||
} /* for each config */
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Marvell Berlin BG2 pinctrl driver.
|
||||
*
|
||||
* Copyright (C) 2014 Marvell Technology Group Ltd.
|
||||
*
|
||||
* Antoine Ténart <antoine.tenart@free-electrons.com>
|
||||
*
|
||||
* This file is licensed under the terms of the GNU General Public
|
||||
* License version 2. This program is licensed "as is" without any
|
||||
* warranty of any kind, whether express or implied.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user