aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-sunxi.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 14:48:03 -0400
commit3dbde57ad941c55345fd7fac0ee3f70f204b02d8 (patch)
tree237c6de64d05da3f61b9ac1724e37a5c1f014b71 /drivers/pinctrl/pinctrl-sunxi.h
parenta6e6d863cf68bba886acfe47dbdc8f245cce588f (diff)
parent2207a4e1ca6a1bb126360b6d0c236af6664532f2 (diff)
Merge tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl
Pull pin control changes from Linus Walleij: - A large slew of improvements of the Genric pin configuration support, and deployment in four different platforms: Rockchip, Super-H PFC, ABx500 and TZ1090. Support BIAS_BUS_HOLD, get device tree parsing and debugfs support into shape. - We also have device tree support with generic naming conventions for the generic pin configuration. - Delete the unused and confusing direct pinconf API. Now state transitions is *the* way to control pins and multiplexing. - New drivers for Rockchip, TZ1090, and TZ1090 PDC. - Two pin control states related to power management are now handled in the device core: "sleep" and "idle", removing a lot of boilerplate code in drivers. We do not yet know if this is the final word for pin PM, but it already make things a lot easier to handle. - Handle sparse GPIO ranges passing a list of disparate pins, and utilize these in the new BayTrail (x86 Atom SoC) driver. - Make the sunxi (AllWinner) driver handle external interrupts. - Make it possible for pinctrl-single to handle the case where several pins are managed by a single register, and augment it to handle sleep modes. - Cleanups and improvements for the abx500 drivers. - Move Sirf pin control drivers to their own directory, support save/restore of context and add support for the SiRFatlas6 SoC. - PMU muxing for the Dove pinctrl driver. - Finalization and support for VF610 in the i.MX6 pinctrl driver. - Smoothen out various Exynos rough edges. - Generic cleanups of various kinds. * tag 'pinctrl-for-v3.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (82 commits) pinctrl: vt8500: wmt: remove redundant dev_err call in wmt_pinctrl_probe() pinctrl: remove bindings for pinconf options needing more thought pinctrl: remove slew-rate parameter from tz1090 pinctrl: set unit for debounce time pinconfig to usec pinctrl: more clarifications for generic pull configs pinctrl: rip out the direct pinconf API pinctrl-tz1090-pdc: add TZ1090 PDC pinctrl driver pinctrl-tz1090: add TZ1090 pinctrl driver pinctrl: samsung: Staticize drvdata_list pinctrl: rockchip: Add missing irq_gc_unlock() call before return error pinctrl: abx500: rework error path pinctrl: abx500: suppress hardcoded value pinctrl: abx500: factorize code pinctrl: abx500: fix abx500_gpio_get() pinctrl: abx500: fix abx500_pin_config_set() pinctrl: abx500: Add device tree support sh-pfc: Guard DT parsing with #ifdef CONFIG_OF pinctrl: add Intel BayTrail GPIO/pinctrl support pinctrl: fix pinconf_ops::pin_config_dbg_parse_modify kerneldoc pinctrl: Staticize local symbols ... Conflicts: drivers/net/ethernet/ti/davinci_mdio.c drivers/pinctrl/Makefile
Diffstat (limited to 'drivers/pinctrl/pinctrl-sunxi.h')
-rw-r--r--drivers/pinctrl/pinctrl-sunxi.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-sunxi.h b/drivers/pinctrl/pinctrl-sunxi.h
index e921621059ce..d68047d8f699 100644
--- a/drivers/pinctrl/pinctrl-sunxi.h
+++ b/drivers/pinctrl/pinctrl-sunxi.h
@@ -344,9 +344,31 @@
344#define PULL_PINS_BITS 2 344#define PULL_PINS_BITS 2
345#define PULL_PINS_MASK 0x03 345#define PULL_PINS_MASK 0x03
346 346
347#define SUNXI_IRQ_NUMBER 32
348
349#define IRQ_CFG_REG 0x200
350#define IRQ_CFG_IRQ_PER_REG 8
351#define IRQ_CFG_IRQ_BITS 4
352#define IRQ_CFG_IRQ_MASK ((1 << IRQ_CFG_IRQ_BITS) - 1)
353#define IRQ_CTRL_REG 0x210
354#define IRQ_CTRL_IRQ_PER_REG 32
355#define IRQ_CTRL_IRQ_BITS 1
356#define IRQ_CTRL_IRQ_MASK ((1 << IRQ_CTRL_IRQ_BITS) - 1)
357#define IRQ_STATUS_REG 0x214
358#define IRQ_STATUS_IRQ_PER_REG 32
359#define IRQ_STATUS_IRQ_BITS 1
360#define IRQ_STATUS_IRQ_MASK ((1 << IRQ_STATUS_IRQ_BITS) - 1)
361
362#define IRQ_EDGE_RISING 0x00
363#define IRQ_EDGE_FALLING 0x01
364#define IRQ_LEVEL_HIGH 0x02
365#define IRQ_LEVEL_LOW 0x03
366#define IRQ_EDGE_BOTH 0x04
367
347struct sunxi_desc_function { 368struct sunxi_desc_function {
348 const char *name; 369 const char *name;
349 u8 muxval; 370 u8 muxval;
371 u8 irqnum;
350}; 372};
351 373
352struct sunxi_desc_pin { 374struct sunxi_desc_pin {
@@ -378,10 +400,13 @@ struct sunxi_pinctrl {
378 struct gpio_chip *chip; 400 struct gpio_chip *chip;
379 struct sunxi_pinctrl_desc *desc; 401 struct sunxi_pinctrl_desc *desc;
380 struct device *dev; 402 struct device *dev;
403 struct irq_domain *domain;
381 struct sunxi_pinctrl_function *functions; 404 struct sunxi_pinctrl_function *functions;
382 unsigned nfunctions; 405 unsigned nfunctions;
383 struct sunxi_pinctrl_group *groups; 406 struct sunxi_pinctrl_group *groups;
384 unsigned ngroups; 407 unsigned ngroups;
408 int irq;
409 int irq_array[SUNXI_IRQ_NUMBER];
385 struct pinctrl_dev *pctl_dev; 410 struct pinctrl_dev *pctl_dev;
386}; 411};
387 412
@@ -398,6 +423,13 @@ struct sunxi_pinctrl {
398 .muxval = _val, \ 423 .muxval = _val, \
399 } 424 }
400 425
426#define SUNXI_FUNCTION_IRQ(_val, _irq) \
427 { \
428 .name = "irq", \
429 .muxval = _val, \
430 .irqnum = _irq, \
431 }
432
401/* 433/*
402 * The sunXi PIO registers are organized as is: 434 * The sunXi PIO registers are organized as is:
403 * 0x00 - 0x0c Muxing values. 435 * 0x00 - 0x0c Muxing values.
@@ -475,4 +507,40 @@ static inline u32 sunxi_pull_offset(u16 pin)
475 return pin_num * PULL_PINS_BITS; 507 return pin_num * PULL_PINS_BITS;
476} 508}
477 509
510static inline u32 sunxi_irq_cfg_reg(u16 irq)
511{
512 u8 reg = irq / IRQ_CFG_IRQ_PER_REG;
513 return reg + IRQ_CFG_REG;
514}
515
516static inline u32 sunxi_irq_cfg_offset(u16 irq)
517{
518 u32 irq_num = irq % IRQ_CFG_IRQ_PER_REG;
519 return irq_num * IRQ_CFG_IRQ_BITS;
520}
521
522static inline u32 sunxi_irq_ctrl_reg(u16 irq)
523{
524 u8 reg = irq / IRQ_CTRL_IRQ_PER_REG;
525 return reg + IRQ_CTRL_REG;
526}
527
528static inline u32 sunxi_irq_ctrl_offset(u16 irq)
529{
530 u32 irq_num = irq % IRQ_CTRL_IRQ_PER_REG;
531 return irq_num * IRQ_CTRL_IRQ_BITS;
532}
533
534static inline u32 sunxi_irq_status_reg(u16 irq)
535{
536 u8 reg = irq / IRQ_STATUS_IRQ_PER_REG;
537 return reg + IRQ_STATUS_REG;
538}
539
540static inline u32 sunxi_irq_status_offset(u16 irq)
541{
542 u32 irq_num = irq % IRQ_STATUS_IRQ_PER_REG;
543 return irq_num * IRQ_STATUS_IRQ_BITS;
544}
545
478#endif /* __PINCTRL_SUNXI_H */ 546#endif /* __PINCTRL_SUNXI_H */