Also revert commit b91d532928df ("ipv6: set rt6i_protocol properly in the route when it is installed") as it breaks the test systems. Changes in 4.9.136 xfrm: Validate address prefix lengths in the xfrm selector. xfrm6: call kfree_skb when skb is toobig mac80211: Always report TX status cfg80211: reg: Init wiphy_idx in regulatory_hint_core() mac80211: fix pending queue hang due to TX_DROP cfg80211: Address some corner cases in scan result channel updating mac80211: TDLS: fix skb queue/priority assignment ARM: 8799/1: mm: fix pci_ioremap_io() offset check xfrm: validate template mode ARM: dts: BCM63xx: Fix incorrect interrupt specifiers net: macb: Clean 64b dma addresses if they are not detected soc: fsl: qbman: qman: avoid allocating from non existing gen_pool soc: fsl: qe: Fix copy/paste bug in ucc_get_tdm_sync_shift() nl80211: Fix possible Spectre-v1 for NL80211_TXRATE_HT mac80211_hwsim: do not omit multicast announce of first added radio Bluetooth: SMP: fix crash in unpairing pxa168fb: prepare the clock qed: Avoid implicit enum conversion in qed_roce_mode_to_flavor qed: Avoid constant logical operation warning in qed_vf_pf_acquire asix: Check for supported Wake-on-LAN modes ax88179_178a: Check for supported Wake-on-LAN modes lan78xx: Check for supported Wake-on-LAN modes sr9800: Check for supported Wake-on-LAN modes r8152: Check for supported Wake-on-LAN Modes smsc75xx: Check for Wake-on-LAN modes smsc95xx: Check for Wake-on-LAN modes perf/ring_buffer: Prevent concurent ring buffer access perf/x86/intel/uncore: Fix PCI BDF address of M3UPI on SKX net: fec: fix rare tx timeout declance: Fix continuation with the adapter identification message net: cxgb3_main: fix a missing-check bug perf symbols: Fix memory corruption because of zero length symbols mm/memory_hotplug.c: fix overflow in test_pages_in_a_zone() MIPS: microMIPS: Fix decoding of swsp16 instruction MIPS: Handle non word sized instructions when examining frame scsi: aacraid: Fix typo in blink status f2fs: fix multiple f2fs_add_link() having same name for inline dentry igb: Remove superfluous reset to PHY and page 0 selection ACPI: sysfs: Make ACPI GPE mask kernel parameter cover all GPEs PCI: Disable MSI for HiSilicon Hip06/Hip07 only in Root Port mode i2c: bcm2835: Avoid possible NULL ptr dereference efi/fb: Correct PCI_STD_RESOURCE_END usage ipv6: set rt6i_protocol properly in the route when it is installed platform/x86: acer-wmi: setup accelerometer when ACPI device was found IB/ipoib: Do not warn if IPoIB debugfs doesn't exist IB/core: Fix the validations of a multicast LID in attach or detach operations orangefs: off by ones in xattr size checks rxe: Fix a sleep-in-atomic bug in post_one_send nvme-pci: fix CMB sysfs file removal in reset path net: phy: marvell: Limit 88m1101 autoneg errata to 88E1145 as well. net/mlx5: Fix command completion after timeout access invalid structure tipc: Fix tipc_sk_reinit handling of -EAGAIN tipc: fix a race condition of releasing subscriber object bnxt_en: Don't use rtnl lock to protect link change logic in workqueue. ath10k: fix NAPI enable/disable symmetry for AHB interface ARM: dts: bcm283x: Reserve first page for firmware btrfs: fiemap: Cache and merge fiemap extent before submit it to user ata: sata_rcar: Handle return value of clk_prepare_enable reset: hi6220: Set module license so that it can be loaded ASoC: Intel: Skylake: Fix to parse consecutive string tkns in manifest arch/sparc: increase CONFIG_NODES_SHIFT on SPARC64 to 5 mac80211: fix TX aggregation start/stop callback race libata: fix error checking in in ata_parse_force_one() net: ethernet: stmmac: Fix altr_tse_pcs SGMII Initialization qlcnic: Fix tunnel offload for 82xx adapters x86/cpu/cyrix: Add alternative Device ID of Geode GX1 SoC ARM: 8677/1: boot/compressed: fix decompressor header layout for v7-M gpu: ipu-v3: Fix CSI selection for VDIC elevator: fix truncation of icq_cache_name net: stmmac: ensure jumbo_frm error return is correctly checked for -ve value Btrfs: clear EXTENT_DEFRAG bits in finish_ordered_io ufs: we need to sync inode before freeing it net/mlx5e: Fix fixpoint divide exception in mlx5e_am_stats_compare ip6_tunnel: Correct tos value in collect_md mode net/mlx5: Fix driver load error flow when firmware is stuck perf evsel: Fix probing of precise_ip level for default cycles event perf probe: Fix probe definition for inlined functions net/mlx5: Fix health work queue spin lock to IRQ safe usb: renesas_usbhs: gadget: fix spin_lock_init() for &uep->lock usb: renesas_usbhs: gadget: fix unused-but-set-variable warning usb: dwc3: omap: remove IRQ_NOAUTOEN used with shared irq clk: samsung: Fix m2m scaler clock on Exynos542x ptr_ring: fix up after recent ptr_ring changes staging: wilc1000: Fix problem with wrong vif index rds: ib: Fix missing call to rds_ib_dev_put in rds_ib_setup_qp iio: adc: Revert "axp288: Drop bogus AXP288_ADC_TS_PIN_CTRL register modifications" qed: Warn PTT usage by wrong hw-function ocfs2: fix deadlock caused by recursive locking in xattr net: cdc_ncm: GetNtbFormat endian fix sctp: use right member as the param of list_for_each_entry ALSA: hda - No loopback on ALC299 codec ath10k: convert warning about non-existent OTP board id to debug message ipv6: fix cleanup ordering for ip6_mr failure IB/ipoib: Fix lockdep issue found on ipoib_ib_dev_heavy_flush IB/rxe: put the pool on allocation failure nbd: only set MSG_MORE when we have more to send mm/frame_vector.c: release a semaphore in 'get_vaddr_frames()' IB/mlx5: Avoid passing an invalid QP type to firmware scsi: qla2xxx: Avoid double completion of abort command drm: bochs: Don't remove uninitialized fbdev framebuffer i40e: avoid NVM acquire deadlock during NVM update Revert "IB/ipoib: Update broadcast object if PKey value was changed in index 0" Btrfs: incremental send, fix invalid memory access drm/msm: Fix possible null dereference on failure of get_pages() module: fix DEBUG_SET_MODULE_RONX typo iio: pressure: zpa2326: Remove always-true check which confuses gcc l2tp: remove configurable payload offset macsec: fix memory leaks when skb_to_sgvec fails perf/core: Fix locking for children siblings group read cifs: Use ULL suffix for 64-bit constant futex: futex_wake_op, do not fail on invalid op ALSA: hda - Fix incorrect usage of IS_REACHABLE() test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches xen-netfront: Update features after registering netdev sparc64: Fix regression in pmdp_invalidate(). xen-netfront: Fix mismatched rtnl_unlock enic: do not overwrite error code bonding: ratelimit failed speed/duplex update warning nvmet: fix space padding in serial number iio: buffer: fix the function signature to match implementation x86/paravirt: Fix some warning messages IB/mlx4: Fix an error handling path in 'mlx4_ib_rereg_user_mr()' libertas: call into generic suspend code before turning off power xhci: Fix USB3 NULL pointer dereference at logical disconnect. perf tests: Fix indexing when invoking subtests ARM: dts: imx53-qsb: disable 1.2GHz OPP rxrpc: Don't check RXRPC_CALL_TX_LAST after calling rxrpc_rotate_tx_window() rxrpc: Only take the rwind and mtu values from latest ACK net: ena: fix NULL dereference due to untimely napi initialization fs/fat/fatent.c: add cond_resched() to fat_count_free_clusters() mtd: spi-nor: Add support for is25wp series chips Revert "netfilter: ipv6: nf_defrag: drop skb dst before queueing" perf tools: Disable parallelism for 'make clean' bridge: do not add port to router list when receives query with source 0.0.0.0 net: bridge: remove ipv6 zero address check in mcast queries ipv6: mcast: fix a use-after-free in inet6_mc_check ipv6/ndisc: Preserve IPv6 control buffer if protocol error handlers are called llc: set SOCK_RCU_FREE in llc_sap_add_socket() net/ipv6: Fix index counter for unicast addresses in in6_dump_addrs net: sched: gred: pass the right attribute to gred_change_table_def() net: socket: fix a missing-check bug net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules net: udp: fix handling of CHECKSUM_COMPLETE packets r8169: fix NAPI handling under high load sctp: fix race on sctp_id2asoc vhost: Fix Spectre V1 vulnerability ethtool: fix a privilege escalation bug bonding: fix length of actor system net: drop skb on failure in ip_check_defrag() net: fix pskb_trim_rcsum_slow() with odd trim offset rtnetlink: Disallow FDB configuration for non-Ethernet device ip6_tunnel: Fix encapsulation layout Revert "x86/mm: Expand static page table for fixmap space" crypto: shash - Fix a sleep-in-atomic bug in shash_setkey_unaligned ahci: don't ignore result code of ahci_reset_controller() gpio: mxs: Get rid of external API call xfs: truncate transaction does not modify the inobt cachefiles: fix the race between cachefiles_bury_object() and rmdir(2) ptp: fix Spectre v1 vulnerability drm/edid: Add 6 bpc quirk for BOE panel in HP Pavilion 15-n233sl RDMA/ucma: Fix Spectre v1 vulnerability IB/ucm: Fix Spectre v1 vulnerability cdc-acm: correct counting of UART states in serial state notification usb: gadget: storage: Fix Spectre v1 vulnerability USB: fix the usbfs flag sanitization for control transfers Input: elan_i2c - add ACPI ID for Lenovo IdeaPad 330-15IGM sched/fair: Fix throttle_list starvation with low CFS quota x86/percpu: Fix this_cpu_read() x86/time: Correct the attribute on jiffies' definition net: fs_enet: do not call phy_stop() in interrupts posix-timers: Sanitize overrun handling Linux 4.9.136 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
377 lines
9.7 KiB
C
377 lines
9.7 KiB
C
/*
|
|
* MXC GPIO support. (c) 2008 Daniel Mack <daniel@caiaq.de>
|
|
* Copyright 2008 Juergen Beisert, kernel@pengutronix.de
|
|
*
|
|
* Based on code from Freescale,
|
|
* Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
* MA 02110-1301, USA.
|
|
*/
|
|
|
|
#include <linux/err.h>
|
|
#include <linux/init.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/io.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/irqdomain.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of_address.h>
|
|
#include <linux/of_device.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/gpio/driver.h>
|
|
#include <linux/module.h>
|
|
|
|
#define MXS_SET 0x4
|
|
#define MXS_CLR 0x8
|
|
|
|
#define PINCTRL_DOUT(p) ((is_imx23_gpio(p) ? 0x0500 : 0x0700) + (p->id) * 0x10)
|
|
#define PINCTRL_DIN(p) ((is_imx23_gpio(p) ? 0x0600 : 0x0900) + (p->id) * 0x10)
|
|
#define PINCTRL_DOE(p) ((is_imx23_gpio(p) ? 0x0700 : 0x0b00) + (p->id) * 0x10)
|
|
#define PINCTRL_PIN2IRQ(p) ((is_imx23_gpio(p) ? 0x0800 : 0x1000) + (p->id) * 0x10)
|
|
#define PINCTRL_IRQEN(p) ((is_imx23_gpio(p) ? 0x0900 : 0x1100) + (p->id) * 0x10)
|
|
#define PINCTRL_IRQLEV(p) ((is_imx23_gpio(p) ? 0x0a00 : 0x1200) + (p->id) * 0x10)
|
|
#define PINCTRL_IRQPOL(p) ((is_imx23_gpio(p) ? 0x0b00 : 0x1300) + (p->id) * 0x10)
|
|
#define PINCTRL_IRQSTAT(p) ((is_imx23_gpio(p) ? 0x0c00 : 0x1400) + (p->id) * 0x10)
|
|
|
|
#define GPIO_INT_FALL_EDGE 0x0
|
|
#define GPIO_INT_LOW_LEV 0x1
|
|
#define GPIO_INT_RISE_EDGE 0x2
|
|
#define GPIO_INT_HIGH_LEV 0x3
|
|
#define GPIO_INT_LEV_MASK (1 << 0)
|
|
#define GPIO_INT_POL_MASK (1 << 1)
|
|
|
|
enum mxs_gpio_id {
|
|
IMX23_GPIO,
|
|
IMX28_GPIO,
|
|
};
|
|
|
|
struct mxs_gpio_port {
|
|
void __iomem *base;
|
|
int id;
|
|
int irq;
|
|
struct irq_domain *domain;
|
|
struct gpio_chip gc;
|
|
enum mxs_gpio_id devid;
|
|
u32 both_edges;
|
|
};
|
|
|
|
static inline int is_imx23_gpio(struct mxs_gpio_port *port)
|
|
{
|
|
return port->devid == IMX23_GPIO;
|
|
}
|
|
|
|
static inline int is_imx28_gpio(struct mxs_gpio_port *port)
|
|
{
|
|
return port->devid == IMX28_GPIO;
|
|
}
|
|
|
|
/* Note: This driver assumes 32 GPIOs are handled in one register */
|
|
|
|
static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
|
|
{
|
|
u32 val;
|
|
u32 pin_mask = 1 << d->hwirq;
|
|
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
|
|
struct mxs_gpio_port *port = gc->private;
|
|
void __iomem *pin_addr;
|
|
int edge;
|
|
|
|
port->both_edges &= ~pin_mask;
|
|
switch (type) {
|
|
case IRQ_TYPE_EDGE_BOTH:
|
|
val = port->gc.get(&port->gc, d->hwirq);
|
|
if (val)
|
|
edge = GPIO_INT_FALL_EDGE;
|
|
else
|
|
edge = GPIO_INT_RISE_EDGE;
|
|
port->both_edges |= pin_mask;
|
|
break;
|
|
case IRQ_TYPE_EDGE_RISING:
|
|
edge = GPIO_INT_RISE_EDGE;
|
|
break;
|
|
case IRQ_TYPE_EDGE_FALLING:
|
|
edge = GPIO_INT_FALL_EDGE;
|
|
break;
|
|
case IRQ_TYPE_LEVEL_LOW:
|
|
edge = GPIO_INT_LOW_LEV;
|
|
break;
|
|
case IRQ_TYPE_LEVEL_HIGH:
|
|
edge = GPIO_INT_HIGH_LEV;
|
|
break;
|
|
default:
|
|
return -EINVAL;
|
|
}
|
|
|
|
/* set level or edge */
|
|
pin_addr = port->base + PINCTRL_IRQLEV(port);
|
|
if (edge & GPIO_INT_LEV_MASK)
|
|
writel(pin_mask, pin_addr + MXS_SET);
|
|
else
|
|
writel(pin_mask, pin_addr + MXS_CLR);
|
|
|
|
/* set polarity */
|
|
pin_addr = port->base + PINCTRL_IRQPOL(port);
|
|
if (edge & GPIO_INT_POL_MASK)
|
|
writel(pin_mask, pin_addr + MXS_SET);
|
|
else
|
|
writel(pin_mask, pin_addr + MXS_CLR);
|
|
|
|
writel(pin_mask,
|
|
port->base + PINCTRL_IRQSTAT(port) + MXS_CLR);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void mxs_flip_edge(struct mxs_gpio_port *port, u32 gpio)
|
|
{
|
|
u32 bit, val, edge;
|
|
void __iomem *pin_addr;
|
|
|
|
bit = 1 << gpio;
|
|
|
|
pin_addr = port->base + PINCTRL_IRQPOL(port);
|
|
val = readl(pin_addr);
|
|
edge = val & bit;
|
|
|
|
if (edge)
|
|
writel(bit, pin_addr + MXS_CLR);
|
|
else
|
|
writel(bit, pin_addr + MXS_SET);
|
|
}
|
|
|
|
/* MXS has one interrupt *per* gpio port */
|
|
static void mxs_gpio_irq_handler(struct irq_desc *desc)
|
|
{
|
|
u32 irq_stat;
|
|
struct mxs_gpio_port *port = irq_desc_get_handler_data(desc);
|
|
|
|
desc->irq_data.chip->irq_ack(&desc->irq_data);
|
|
|
|
irq_stat = readl(port->base + PINCTRL_IRQSTAT(port)) &
|
|
readl(port->base + PINCTRL_IRQEN(port));
|
|
|
|
while (irq_stat != 0) {
|
|
int irqoffset = fls(irq_stat) - 1;
|
|
if (port->both_edges & (1 << irqoffset))
|
|
mxs_flip_edge(port, irqoffset);
|
|
|
|
generic_handle_irq(irq_find_mapping(port->domain, irqoffset));
|
|
irq_stat &= ~(1 << irqoffset);
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Set interrupt number "irq" in the GPIO as a wake-up source.
|
|
* While system is running, all registered GPIO interrupts need to have
|
|
* wake-up enabled. When system is suspended, only selected GPIO interrupts
|
|
* need to have wake-up enabled.
|
|
* @param irq interrupt source number
|
|
* @param enable enable as wake-up if equal to non-zero
|
|
* @return This function returns 0 on success.
|
|
*/
|
|
static int mxs_gpio_set_wake_irq(struct irq_data *d, unsigned int enable)
|
|
{
|
|
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
|
|
struct mxs_gpio_port *port = gc->private;
|
|
|
|
if (enable)
|
|
enable_irq_wake(port->irq);
|
|
else
|
|
disable_irq_wake(port->irq);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int __init mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
|
|
{
|
|
struct irq_chip_generic *gc;
|
|
struct irq_chip_type *ct;
|
|
|
|
gc = irq_alloc_generic_chip("gpio-mxs", 1, irq_base,
|
|
port->base, handle_level_irq);
|
|
if (!gc)
|
|
return -ENOMEM;
|
|
|
|
gc->private = port;
|
|
|
|
ct = gc->chip_types;
|
|
ct->chip.irq_ack = irq_gc_ack_set_bit;
|
|
ct->chip.irq_mask = irq_gc_mask_clr_bit;
|
|
ct->chip.irq_unmask = irq_gc_mask_set_bit;
|
|
ct->chip.irq_set_type = mxs_gpio_set_irq_type;
|
|
ct->chip.irq_set_wake = mxs_gpio_set_wake_irq;
|
|
ct->regs.ack = PINCTRL_IRQSTAT(port) + MXS_CLR;
|
|
ct->regs.mask = PINCTRL_IRQEN(port);
|
|
|
|
irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK,
|
|
IRQ_NOREQUEST, 0);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
|
|
{
|
|
struct mxs_gpio_port *port = gpiochip_get_data(gc);
|
|
|
|
return irq_find_mapping(port->domain, offset);
|
|
}
|
|
|
|
static int mxs_gpio_get_direction(struct gpio_chip *gc, unsigned offset)
|
|
{
|
|
struct mxs_gpio_port *port = gpiochip_get_data(gc);
|
|
u32 mask = 1 << offset;
|
|
u32 dir;
|
|
|
|
dir = readl(port->base + PINCTRL_DOE(port));
|
|
return !(dir & mask);
|
|
}
|
|
|
|
static const struct platform_device_id mxs_gpio_ids[] = {
|
|
{
|
|
.name = "imx23-gpio",
|
|
.driver_data = IMX23_GPIO,
|
|
}, {
|
|
.name = "imx28-gpio",
|
|
.driver_data = IMX28_GPIO,
|
|
}, {
|
|
/* sentinel */
|
|
}
|
|
};
|
|
MODULE_DEVICE_TABLE(platform, mxs_gpio_ids);
|
|
|
|
static const struct of_device_id mxs_gpio_dt_ids[] = {
|
|
{ .compatible = "fsl,imx23-gpio", .data = (void *) IMX23_GPIO, },
|
|
{ .compatible = "fsl,imx28-gpio", .data = (void *) IMX28_GPIO, },
|
|
{ /* sentinel */ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, mxs_gpio_dt_ids);
|
|
|
|
static int mxs_gpio_probe(struct platform_device *pdev)
|
|
{
|
|
const struct of_device_id *of_id =
|
|
of_match_device(mxs_gpio_dt_ids, &pdev->dev);
|
|
struct device_node *np = pdev->dev.of_node;
|
|
struct device_node *parent;
|
|
static void __iomem *base;
|
|
struct mxs_gpio_port *port;
|
|
int irq_base;
|
|
int err;
|
|
|
|
port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
|
|
if (!port)
|
|
return -ENOMEM;
|
|
|
|
port->id = of_alias_get_id(np, "gpio");
|
|
if (port->id < 0)
|
|
return port->id;
|
|
port->devid = (enum mxs_gpio_id) of_id->data;
|
|
port->irq = platform_get_irq(pdev, 0);
|
|
if (port->irq < 0)
|
|
return port->irq;
|
|
|
|
/*
|
|
* map memory region only once, as all the gpio ports
|
|
* share the same one
|
|
*/
|
|
if (!base) {
|
|
parent = of_get_parent(np);
|
|
base = of_iomap(parent, 0);
|
|
of_node_put(parent);
|
|
if (!base)
|
|
return -EADDRNOTAVAIL;
|
|
}
|
|
port->base = base;
|
|
|
|
/*
|
|
* select the pin interrupt functionality but initially
|
|
* disable the interrupts
|
|
*/
|
|
writel(~0U, port->base + PINCTRL_PIN2IRQ(port));
|
|
writel(0, port->base + PINCTRL_IRQEN(port));
|
|
|
|
/* clear address has to be used to clear IRQSTAT bits */
|
|
writel(~0U, port->base + PINCTRL_IRQSTAT(port) + MXS_CLR);
|
|
|
|
irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
|
|
if (irq_base < 0) {
|
|
err = irq_base;
|
|
goto out_iounmap;
|
|
}
|
|
|
|
port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
|
|
&irq_domain_simple_ops, NULL);
|
|
if (!port->domain) {
|
|
err = -ENODEV;
|
|
goto out_irqdesc_free;
|
|
}
|
|
|
|
/* gpio-mxs can be a generic irq chip */
|
|
err = mxs_gpio_init_gc(port, irq_base);
|
|
if (err < 0)
|
|
goto out_irqdomain_remove;
|
|
|
|
/* setup one handler for each entry */
|
|
irq_set_chained_handler_and_data(port->irq, mxs_gpio_irq_handler,
|
|
port);
|
|
|
|
err = bgpio_init(&port->gc, &pdev->dev, 4,
|
|
port->base + PINCTRL_DIN(port),
|
|
port->base + PINCTRL_DOUT(port) + MXS_SET,
|
|
port->base + PINCTRL_DOUT(port) + MXS_CLR,
|
|
port->base + PINCTRL_DOE(port), NULL, 0);
|
|
if (err)
|
|
goto out_irqdomain_remove;
|
|
|
|
port->gc.to_irq = mxs_gpio_to_irq;
|
|
port->gc.get_direction = mxs_gpio_get_direction;
|
|
port->gc.base = port->id * 32;
|
|
|
|
err = gpiochip_add_data(&port->gc, port);
|
|
if (err)
|
|
goto out_irqdomain_remove;
|
|
|
|
return 0;
|
|
|
|
out_irqdomain_remove:
|
|
irq_domain_remove(port->domain);
|
|
out_irqdesc_free:
|
|
irq_free_descs(irq_base, 32);
|
|
out_iounmap:
|
|
iounmap(port->base);
|
|
return err;
|
|
}
|
|
|
|
static struct platform_driver mxs_gpio_driver = {
|
|
.driver = {
|
|
.name = "gpio-mxs",
|
|
.of_match_table = mxs_gpio_dt_ids,
|
|
},
|
|
.probe = mxs_gpio_probe,
|
|
.id_table = mxs_gpio_ids,
|
|
};
|
|
|
|
static int __init mxs_gpio_init(void)
|
|
{
|
|
return platform_driver_register(&mxs_gpio_driver);
|
|
}
|
|
postcore_initcall(mxs_gpio_init);
|
|
|
|
MODULE_AUTHOR("Freescale Semiconductor, "
|
|
"Daniel Mack <danielncaiaq.de>, "
|
|
"Juergen Beisert <kernel@pengutronix.de>");
|
|
MODULE_DESCRIPTION("Freescale MXS GPIO");
|
|
MODULE_LICENSE("GPL");
|