Commit b100274c authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pinctrl-v5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control fixes from Linus Walleij:
 "There is an ACPI stubs fix which is ACKed by the ACPI maintainer for
  merging through my tree.

  One item stand out and that is that I delete the <linux/sdb.h> header
  that is used by nothing. I deleted this subsystem (through the GPIO
  tree) a while back so I feel responsible for tidying up the floor.

  Other than that it is the usual mistakes, a bit noisy around build
  issue and Kconfig then driver fixes.

  Specifics:

   - Fix some stubs causing compile issues for ACPI.

   - Fix some wakeups on AMD IRQs shared between GPIO and SCI.

   - Fix a build warning in the Tegra driver.

   - Fix a Kconfig issue in the Qualcomm driver.

   - Add a missing include the RALink driver.

   - Return a valid type for the Apple pinctrl IRQs.

   - Implement some Qualcomm SDM845 dual-edge errata.

   - Remove the unused <linux/sdb.h> header. (The subsystem was once
     deleted by the pinctrl maintainer...)

   - Fix a duplicate initialized in the Tegra driver.

   - Fix register offsets for UFS and SDC in the Qualcomm SM8350 driver"

* tag 'pinctrl-v5.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
  pinctrl: qcom: sm8350: Correct UFS and SDC offsets
  pinctrl: tegra194: remove duplicate initializer again
  Remove unused header <linux/sdb.h>
  pinctrl: qcom: sdm845: Enable dual edge errata
  pinctrl: apple: Always return valid type in apple_gpio_irq_type
  pinctrl: ralink: include 'ralink_regs.h' in 'pinctrl-mt7620.c'
  pinctrl: qcom: fix unmet dependencies on GPIOLIB for GPIOLIB_IRQCHIP
  pinctrl: tegra: Return const pointer from tegra_pinctrl_get_group()
  pinctrl: amd: Fix wakeups when IRQ is shared with SCI
  ACPI: Add stubs for wakeup handler functions
parents 6b38e2fb 62209e80
...@@ -598,14 +598,14 @@ static struct irq_chip amd_gpio_irqchip = { ...@@ -598,14 +598,14 @@ static struct irq_chip amd_gpio_irqchip = {
#define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF)) #define PIN_IRQ_PENDING (BIT(INTERRUPT_STS_OFF) | BIT(WAKE_STS_OFF))
static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) static bool do_amd_gpio_irq_handler(int irq, void *dev_id)
{ {
struct amd_gpio *gpio_dev = dev_id; struct amd_gpio *gpio_dev = dev_id;
struct gpio_chip *gc = &gpio_dev->gc; struct gpio_chip *gc = &gpio_dev->gc;
irqreturn_t ret = IRQ_NONE;
unsigned int i, irqnr; unsigned int i, irqnr;
unsigned long flags; unsigned long flags;
u32 __iomem *regs; u32 __iomem *regs;
bool ret = false;
u32 regval; u32 regval;
u64 status, mask; u64 status, mask;
...@@ -627,6 +627,14 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) ...@@ -627,6 +627,14 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
/* Each status bit covers four pins */ /* Each status bit covers four pins */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
regval = readl(regs + i); regval = readl(regs + i);
/* caused wake on resume context for shared IRQ */
if (irq < 0 && (regval & BIT(WAKE_STS_OFF))) {
dev_dbg(&gpio_dev->pdev->dev,
"Waking due to GPIO %d: 0x%x",
irqnr + i, regval);
return true;
}
if (!(regval & PIN_IRQ_PENDING) || if (!(regval & PIN_IRQ_PENDING) ||
!(regval & BIT(INTERRUPT_MASK_OFF))) !(regval & BIT(INTERRUPT_MASK_OFF)))
continue; continue;
...@@ -650,9 +658,12 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) ...@@ -650,9 +658,12 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
} }
writel(regval, regs + i); writel(regval, regs + i);
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
ret = IRQ_HANDLED; ret = true;
} }
} }
/* did not cause wake on resume context for shared IRQ */
if (irq < 0)
return false;
/* Signal EOI to the GPIO unit */ /* Signal EOI to the GPIO unit */
raw_spin_lock_irqsave(&gpio_dev->lock, flags); raw_spin_lock_irqsave(&gpio_dev->lock, flags);
...@@ -664,6 +675,16 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id) ...@@ -664,6 +675,16 @@ static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
return ret; return ret;
} }
static irqreturn_t amd_gpio_irq_handler(int irq, void *dev_id)
{
return IRQ_RETVAL(do_amd_gpio_irq_handler(irq, dev_id));
}
static bool __maybe_unused amd_gpio_check_wake(void *dev_id)
{
return do_amd_gpio_irq_handler(-1, dev_id);
}
static int amd_get_groups_count(struct pinctrl_dev *pctldev) static int amd_get_groups_count(struct pinctrl_dev *pctldev)
{ {
struct amd_gpio *gpio_dev = pinctrl_dev_get_drvdata(pctldev); struct amd_gpio *gpio_dev = pinctrl_dev_get_drvdata(pctldev);
...@@ -1033,6 +1054,7 @@ static int amd_gpio_probe(struct platform_device *pdev) ...@@ -1033,6 +1054,7 @@ static int amd_gpio_probe(struct platform_device *pdev)
goto out2; goto out2;
platform_set_drvdata(pdev, gpio_dev); platform_set_drvdata(pdev, gpio_dev);
acpi_register_wakeup_handler(gpio_dev->irq, amd_gpio_check_wake, gpio_dev);
dev_dbg(&pdev->dev, "amd gpio driver loaded\n"); dev_dbg(&pdev->dev, "amd gpio driver loaded\n");
return ret; return ret;
...@@ -1050,6 +1072,7 @@ static int amd_gpio_remove(struct platform_device *pdev) ...@@ -1050,6 +1072,7 @@ static int amd_gpio_remove(struct platform_device *pdev)
gpio_dev = platform_get_drvdata(pdev); gpio_dev = platform_get_drvdata(pdev);
gpiochip_remove(&gpio_dev->gc); gpiochip_remove(&gpio_dev->gc);
acpi_unregister_wakeup_handler(amd_gpio_check_wake, gpio_dev);
return 0; return 0;
} }
......
...@@ -258,7 +258,7 @@ static void apple_gpio_irq_ack(struct irq_data *data) ...@@ -258,7 +258,7 @@ static void apple_gpio_irq_ack(struct irq_data *data)
pctl->base + REG_IRQ(irqgrp, data->hwirq)); pctl->base + REG_IRQ(irqgrp, data->hwirq));
} }
static int apple_gpio_irq_type(unsigned int type) static unsigned int apple_gpio_irq_type(unsigned int type)
{ {
switch (type & IRQ_TYPE_SENSE_MASK) { switch (type & IRQ_TYPE_SENSE_MASK) {
case IRQ_TYPE_EDGE_RISING: case IRQ_TYPE_EDGE_RISING:
...@@ -272,7 +272,7 @@ static int apple_gpio_irq_type(unsigned int type) ...@@ -272,7 +272,7 @@ static int apple_gpio_irq_type(unsigned int type)
case IRQ_TYPE_LEVEL_LOW: case IRQ_TYPE_LEVEL_LOW:
return REG_GPIOx_IN_IRQ_LO; return REG_GPIOx_IN_IRQ_LO;
default: default:
return -EINVAL; return REG_GPIOx_IN_IRQ_OFF;
} }
} }
...@@ -288,7 +288,7 @@ static void apple_gpio_irq_unmask(struct irq_data *data) ...@@ -288,7 +288,7 @@ static void apple_gpio_irq_unmask(struct irq_data *data)
{ {
struct apple_gpio_pinctrl *pctl = struct apple_gpio_pinctrl *pctl =
gpiochip_get_data(irq_data_get_irq_chip_data(data)); gpiochip_get_data(irq_data_get_irq_chip_data(data));
int irqtype = apple_gpio_irq_type(irqd_get_trigger_type(data)); unsigned int irqtype = apple_gpio_irq_type(irqd_get_trigger_type(data));
apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE, apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE,
FIELD_PREP(REG_GPIOx_MODE, irqtype)); FIELD_PREP(REG_GPIOx_MODE, irqtype));
...@@ -313,10 +313,10 @@ static int apple_gpio_irq_set_type(struct irq_data *data, ...@@ -313,10 +313,10 @@ static int apple_gpio_irq_set_type(struct irq_data *data,
{ {
struct apple_gpio_pinctrl *pctl = struct apple_gpio_pinctrl *pctl =
gpiochip_get_data(irq_data_get_irq_chip_data(data)); gpiochip_get_data(irq_data_get_irq_chip_data(data));
int irqtype = apple_gpio_irq_type(type); unsigned int irqtype = apple_gpio_irq_type(type);
if (irqtype < 0) if (irqtype == REG_GPIOx_IN_IRQ_OFF)
return irqtype; return -EINVAL;
apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE, apple_gpio_set_reg(pctl, data->hwirq, REG_GPIOx_MODE,
FIELD_PREP(REG_GPIOx_MODE, irqtype)); FIELD_PREP(REG_GPIOx_MODE, irqtype));
......
...@@ -197,6 +197,7 @@ config PINCTRL_QCOM_SPMI_PMIC ...@@ -197,6 +197,7 @@ config PINCTRL_QCOM_SPMI_PMIC
select PINMUX select PINMUX
select PINCONF select PINCONF
select GENERIC_PINCONF select GENERIC_PINCONF
select GPIOLIB
select GPIOLIB_IRQCHIP select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY select IRQ_DOMAIN_HIERARCHY
help help
...@@ -211,6 +212,7 @@ config PINCTRL_QCOM_SSBI_PMIC ...@@ -211,6 +212,7 @@ config PINCTRL_QCOM_SSBI_PMIC
select PINMUX select PINMUX
select PINCONF select PINCONF
select GENERIC_PINCONF select GENERIC_PINCONF
select GPIOLIB
select GPIOLIB_IRQCHIP select GPIOLIB_IRQCHIP
select IRQ_DOMAIN_HIERARCHY select IRQ_DOMAIN_HIERARCHY
help help
......
...@@ -1310,6 +1310,7 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { ...@@ -1310,6 +1310,7 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = {
.ngpios = 151, .ngpios = 151,
.wakeirq_map = sdm845_pdc_map, .wakeirq_map = sdm845_pdc_map,
.nwakeirq_map = ARRAY_SIZE(sdm845_pdc_map), .nwakeirq_map = ARRAY_SIZE(sdm845_pdc_map),
.wakeirq_dual_edge_errata = true,
}; };
static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = { static const struct msm_pinctrl_soc_data sdm845_acpi_pinctrl = {
......
...@@ -1597,10 +1597,10 @@ static const struct msm_pingroup sm8350_groups[] = { ...@@ -1597,10 +1597,10 @@ static const struct msm_pingroup sm8350_groups[] = {
[200] = PINGROUP(200, qdss_gpio, _, _, _, _, _, _, _, _), [200] = PINGROUP(200, qdss_gpio, _, _, _, _, _, _, _, _),
[201] = PINGROUP(201, _, _, _, _, _, _, _, _, _), [201] = PINGROUP(201, _, _, _, _, _, _, _, _, _),
[202] = PINGROUP(202, _, _, _, _, _, _, _, _, _), [202] = PINGROUP(202, _, _, _, _, _, _, _, _, _),
[203] = UFS_RESET(ufs_reset, 0x1d8000), [203] = UFS_RESET(ufs_reset, 0xd8000),
[204] = SDC_PINGROUP(sdc2_clk, 0x1cf000, 14, 6), [204] = SDC_PINGROUP(sdc2_clk, 0xcf000, 14, 6),
[205] = SDC_PINGROUP(sdc2_cmd, 0x1cf000, 11, 3), [205] = SDC_PINGROUP(sdc2_cmd, 0xcf000, 11, 3),
[206] = SDC_PINGROUP(sdc2_data, 0x1cf000, 9, 0), [206] = SDC_PINGROUP(sdc2_data, 0xcf000, 9, 0),
}; };
static const struct msm_gpio_wakeirq_map sm8350_pdc_map[] = { static const struct msm_gpio_wakeirq_map sm8350_pdc_map[] = {
......
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
#include <asm/mach-ralink/ralink_regs.h>
#include <asm/mach-ralink/mt7620.h> #include <asm/mach-ralink/mt7620.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
......
...@@ -275,7 +275,7 @@ static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev, ...@@ -275,7 +275,7 @@ static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev,
return 0; return 0;
} }
static struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctldev, static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctldev,
unsigned int offset) unsigned int offset)
{ {
struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
...@@ -289,7 +289,7 @@ static struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctlde ...@@ -289,7 +289,7 @@ static struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *pctlde
continue; continue;
for (j = 0; j < num_pins; j++) { for (j = 0; j < num_pins; j++) {
if (offset == pins[j]) if (offset == pins[j])
return (struct tegra_pingroup *)&pmx->soc->groups[group]; return &pmx->soc->groups[group];
} }
} }
......
...@@ -1387,7 +1387,6 @@ static struct tegra_function tegra194_functions[] = { ...@@ -1387,7 +1387,6 @@ static struct tegra_function tegra194_functions[] = {
.schmitt_bit = schmitt_b, \ .schmitt_bit = schmitt_b, \
.drvtype_bit = 13, \ .drvtype_bit = 13, \
.lpdr_bit = e_lpdr, \ .lpdr_bit = e_lpdr, \
.drv_reg = -1, \
#define drive_touch_clk_pcc4 DRV_PINGROUP_ENTRY_Y(0x2004, 12, 5, 20, 5, -1, -1, -1, -1, 1) #define drive_touch_clk_pcc4 DRV_PINGROUP_ENTRY_Y(0x2004, 12, 5, 20, 5, -1, -1, -1, -1, 1)
#define drive_uart3_rx_pcc6 DRV_PINGROUP_ENTRY_Y(0x200c, 12, 5, 20, 5, -1, -1, -1, -1, 1) #define drive_uart3_rx_pcc6 DRV_PINGROUP_ENTRY_Y(0x200c, 12, 5, 20, 5, -1, -1, -1, -1, 1)
......
...@@ -974,6 +974,15 @@ static inline int acpi_get_local_address(acpi_handle handle, u32 *addr) ...@@ -974,6 +974,15 @@ static inline int acpi_get_local_address(acpi_handle handle, u32 *addr)
return -ENODEV; return -ENODEV;
} }
static inline int acpi_register_wakeup_handler(int wake_irq,
bool (*wakeup)(void *context), void *context)
{
return -ENXIO;
}
static inline void acpi_unregister_wakeup_handler(
bool (*wakeup)(void *context), void *context) { }
#endif /* !CONFIG_ACPI */ #endif /* !CONFIG_ACPI */
#ifdef CONFIG_ACPI_HOTPLUG_IOAPIC #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC
......
/* SPDX-License-Identifier: GPL-2.0 */
/*
* This is the official version 1.1 of sdb.h
*/
#ifndef __SDB_H__
#define __SDB_H__
#ifdef __KERNEL__
#include <linux/types.h>
#else
#include <stdint.h>
#endif
/*
* All structures are 64 bytes long and are expected
* to live in an array, one for each interconnect.
* Most fields of the structures are shared among the
* various types, and most-specific fields are at the
* beginning (for alignment reasons, and to keep the
* magic number at the head of the interconnect record
*/
/* Product, 40 bytes at offset 24, 8-byte aligned
*
* device_id is vendor-assigned; version is device-specific,
* date is hex (e.g 0x20120501), name is UTF-8, blank-filled
* and not terminated with a 0 byte.
*/
struct sdb_product {
uint64_t vendor_id; /* 0x18..0x1f */
uint32_t device_id; /* 0x20..0x23 */
uint32_t version; /* 0x24..0x27 */
uint32_t date; /* 0x28..0x2b */
uint8_t name[19]; /* 0x2c..0x3e */
uint8_t record_type; /* 0x3f */
};
/*
* Component, 56 bytes at offset 8, 8-byte aligned
*
* The address range is first to last, inclusive
* (for example 0x100000 - 0x10ffff)
*/
struct sdb_component {
uint64_t addr_first; /* 0x08..0x0f */
uint64_t addr_last; /* 0x10..0x17 */
struct sdb_product product; /* 0x18..0x3f */
};
/* Type of the SDB record */
enum sdb_record_type {
sdb_type_interconnect = 0x00,
sdb_type_device = 0x01,
sdb_type_bridge = 0x02,
sdb_type_integration = 0x80,
sdb_type_repo_url = 0x81,
sdb_type_synthesis = 0x82,
sdb_type_empty = 0xFF,
};
/* Type 0: interconnect (first of the array)
*
* sdb_records is the length of the table including this first
* record, version is 1. The bus type is enumerated later.
*/
#define SDB_MAGIC 0x5344422d /* "SDB-" */
struct sdb_interconnect {
uint32_t sdb_magic; /* 0x00-0x03 */
uint16_t sdb_records; /* 0x04-0x05 */
uint8_t sdb_version; /* 0x06 */
uint8_t sdb_bus_type; /* 0x07 */
struct sdb_component sdb_component; /* 0x08-0x3f */
};
/* Type 1: device
*
* class is 0 for "custom device", other values are
* to be standardized; ABI version is for the driver,
* bus-specific bits are defined by each bus (see below)
*/
struct sdb_device {
uint16_t abi_class; /* 0x00-0x01 */
uint8_t abi_ver_major; /* 0x02 */
uint8_t abi_ver_minor; /* 0x03 */
uint32_t bus_specific; /* 0x04-0x07 */
struct sdb_component sdb_component; /* 0x08-0x3f */
};
/* Type 2: bridge
*
* child is the address of the nested SDB table
*/
struct sdb_bridge {
uint64_t sdb_child; /* 0x00-0x07 */
struct sdb_component sdb_component; /* 0x08-0x3f */
};
/* Type 0x80: integration
*
* all types with bit 7 set are meta-information, so
* software can ignore the types it doesn't know. Here we
* just provide product information for an aggregate device
*/
struct sdb_integration {
uint8_t reserved[24]; /* 0x00-0x17 */
struct sdb_product product; /* 0x08-0x3f */
};
/* Type 0x81: Top module repository url
*
* again, an informative field that software can ignore
*/
struct sdb_repo_url {
uint8_t repo_url[63]; /* 0x00-0x3e */
uint8_t record_type; /* 0x3f */
};
/* Type 0x82: Synthesis tool information
*
* this informative record
*/
struct sdb_synthesis {
uint8_t syn_name[16]; /* 0x00-0x0f */
uint8_t commit_id[16]; /* 0x10-0x1f */
uint8_t tool_name[8]; /* 0x20-0x27 */
uint32_t tool_version; /* 0x28-0x2b */
uint32_t date; /* 0x2c-0x2f */
uint8_t user_name[15]; /* 0x30-0x3e */
uint8_t record_type; /* 0x3f */
};
/* Type 0xff: empty
*
* this allows keeping empty slots during development,
* so they can be filled later with minimal efforts and
* no misleading description is ever shipped -- hopefully.
* It can also be used to pad a table to a desired length.
*/
struct sdb_empty {
uint8_t reserved[63]; /* 0x00-0x3e */
uint8_t record_type; /* 0x3f */
};
/* The type of bus, for bus-specific flags */
enum sdb_bus_type {
sdb_wishbone = 0x00,
sdb_data = 0x01,
};
#define SDB_WB_WIDTH_MASK 0x0f
#define SDB_WB_ACCESS8 0x01
#define SDB_WB_ACCESS16 0x02
#define SDB_WB_ACCESS32 0x04
#define SDB_WB_ACCESS64 0x08
#define SDB_WB_LITTLE_ENDIAN 0x80
#define SDB_DATA_READ 0x04
#define SDB_DATA_WRITE 0x02
#define SDB_DATA_EXEC 0x01
#endif /* __SDB_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment