diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-06 10:49:34 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-06 10:49:34 +0100 |
commit | 700ea5e0e0dd70420a04e703ff264cc133834cba (patch) | |
tree | d217b0d90d014953ea10ab7d88809660d2da8a64 /drivers/pinctrl/mvebu/pinctrl-mvebu.h | |
parent | [media] media: ti-vpe: vpe: allow use of user specified stride (diff) | |
parent | Linux 4.11-rc1 (diff) | |
download | linux-700ea5e0e0dd70420a04e703ff264cc133834cba.tar.xz linux-700ea5e0e0dd70420a04e703ff264cc133834cba.zip |
Merge tag 'v4.11-rc1' into patchwork
Linux 4.11-rc1
* tag 'v4.11-rc1': (10730 commits)
Linux 4.11-rc1
strparser: destroy workqueue on module exit
Documentation/sphinx: fix primary_domain configuration
docs: Fix htmldocs build failure
doc/ko_KR/memory-barriers: Update control-dependencies section
pcieaer doc: update the link
Documentation: Update path to sysrq.txt
sfc: fix IPID endianness in TSOv2
sfc: avoid max() in array size
rds: remove unnecessary returned value check
rxrpc: Fix potential NULL-pointer exception
nfp: correct DMA direction in XDP DMA sync
nfp: don't tell FW about the reserved buffer space
net: ethernet: bgmac: mac address change bug
net: ethernet: bgmac: init sequence bug
xen-netback: don't vfree() queues under spinlock
xen-netback: keep a local pointer for vif in backend_disconnect()
netfilter: nf_tables: don't call nfnetlink_set_err() if nfnetlink_send() fails
netfilter: nft_set_rbtree: incorrect assumption on lower interval lookups
netfilter: nf_conntrack_sip: fix wrong memory initialisation
...
Diffstat (limited to 'drivers/pinctrl/mvebu/pinctrl-mvebu.h')
-rw-r--r-- | drivers/pinctrl/mvebu/pinctrl-mvebu.h | 65 |
1 files changed, 37 insertions, 28 deletions
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.h b/drivers/pinctrl/mvebu/pinctrl-mvebu.h index b75a5f4adf3b..c90704e74884 100644 --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.h +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.h @@ -14,6 +14,22 @@ #define __PINCTRL_MVEBU_H__ /** + * struct mvebu_mpp_ctrl_data - private data for the mpp ctrl operations + * @base: base address of pinctrl hardware + * @regmap.map: regmap structure + * @regmap.offset: regmap offset + */ +struct mvebu_mpp_ctrl_data { + union { + void __iomem *base; + struct { + struct regmap *map; + u32 offset; + } regmap; + }; +}; + +/** * struct mvebu_mpp_ctrl - describe a mpp control * @name: name of the control group * @pid: first pin id handled by this control @@ -37,10 +53,13 @@ struct mvebu_mpp_ctrl { u8 pid; u8 npins; unsigned *pins; - int (*mpp_get)(unsigned pid, unsigned long *config); - int (*mpp_set)(unsigned pid, unsigned long config); - int (*mpp_gpio_req)(unsigned pid); - int (*mpp_gpio_dir)(unsigned pid, bool input); + int (*mpp_get)(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long *config); + int (*mpp_set)(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long config); + int (*mpp_gpio_req)(struct mvebu_mpp_ctrl_data *data, unsigned pid); + int (*mpp_gpio_dir)(struct mvebu_mpp_ctrl_data *data, unsigned pid, + bool input); }; /** @@ -93,6 +112,7 @@ struct mvebu_mpp_mode { * struct mvebu_pinctrl_soc_info - SoC specific info passed to pinctrl-mvebu * @variant: variant mask of soc_info * @controls: list of available mvebu_mpp_ctrls + * @control_data: optional array, one entry for each control * @ncontrols: number of available mvebu_mpp_ctrls * @modes: list of available mvebu_mpp_modes * @nmodes: number of available mvebu_mpp_modes @@ -105,7 +125,8 @@ struct mvebu_mpp_mode { */ struct mvebu_pinctrl_soc_info { u8 variant; - struct mvebu_mpp_ctrl *controls; + const struct mvebu_mpp_ctrl *controls; + struct mvebu_mpp_ctrl_data *control_data; int ncontrols; struct mvebu_mpp_mode *modes; int nmodes; @@ -177,30 +198,18 @@ struct mvebu_pinctrl_soc_info { #define MVEBU_MPP_BITS 4 #define MVEBU_MPP_MASK 0xf -static inline int default_mpp_ctrl_get(void __iomem *base, unsigned int pid, - unsigned long *config) -{ - unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; - unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; - - *config = (readl(base + off) >> shift) & MVEBU_MPP_MASK; - - return 0; -} - -static inline int default_mpp_ctrl_set(void __iomem *base, unsigned int pid, - unsigned long config) -{ - unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; - unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; - unsigned long reg; - - reg = readl(base + off) & ~(MVEBU_MPP_MASK << shift); - writel(reg | (config << shift), base + off); - - return 0; -} +int mvebu_mmio_mpp_ctrl_get(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long *config); +int mvebu_mmio_mpp_ctrl_set(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long config); +int mvebu_regmap_mpp_ctrl_get(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long *config); +int mvebu_regmap_mpp_ctrl_set(struct mvebu_mpp_ctrl_data *data, unsigned pid, + unsigned long config); int mvebu_pinctrl_probe(struct platform_device *pdev); +int mvebu_pinctrl_simple_mmio_probe(struct platform_device *pdev); +int mvebu_pinctrl_simple_regmap_probe(struct platform_device *pdev, + struct device *syscon_dev); #endif |