From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6834F3DE454 for ; Tue, 26 May 2026 10:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779792926; cv=none; b=tN2OBCMCCX6l03qD5W17hSLriM26bJSXDl02kLTX7YAX47xfBd8Fjl5lHvADFPyHHZtHxBQHZJds5zQWc5fMVM5sfVVxSTu/bUf6UqC/7In/uYMKIw9DpLa8axBaRYNGRonzEKik5oAo4V1cKHCa3Bui51aeu64kJxde/fcYzv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779792926; c=relaxed/simple; bh=8In8IGBtkQEcG7Cn8mCKk8jnnCXcLdvp9LUTygtve4c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=adgTHLgQAy1Bt+dDJOhrJjIex5KLS9MFlzns/boh9ZLWNsBje5PjegRCOGoD6ualpeYewGvwIwdZcj1IhV85GMK+tKGjwtrYlYJCQgPEugo6ruRcfcv/k3zno79qrv/ayvQhwOD6pvAVzm192FtdXndU6Wi6CmPOrMpkY+qG+a8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Ojgq0Hs5; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jiBreGo9; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Ojgq0Hs5"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jiBreGo9" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64Q5e6V91802339 for ; Tue, 26 May 2026 10:55:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GsUPoa0QmNgTYmXU3NmCr7LiYIC0Rpfgi2D4aZFzeTE=; b=Ojgq0Hs5FMSctqoe eL+h+vKGJkd0DdLQT/dZo7ZwUSP//P0JpQOdikZTWmuegoQJ0qqQwCIxu4SZesXR rlWSHq8iQedFD8Vk7UwJywtA1Rgckem0Skp+MaJVYms/YtLSIs+QGGsJ3jjRkBpX jJsC6oTVaflJZUV/HahoytsacJ4+qcJSoVQRl/Y14pmAfaz3+dpwg6sG1x50yNBc KYeVw72qtwjwPXLwUVmxuEuRp9Bc5cAL6lptsKyo2vCtACxbbAQAuXo3CNwJ+1Ni DrCh5XEAND+3lF1VFHHkSoXCINXHCZ9wyXkuqIzTkCsmHeHZav+dPBDuOqZfAWuG Qd0QEw== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4eckyqmc7v-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 26 May 2026 10:55:23 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-366015bca9bso8563251a91.1 for ; Tue, 26 May 2026 03:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1779792922; x=1780397722; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GsUPoa0QmNgTYmXU3NmCr7LiYIC0Rpfgi2D4aZFzeTE=; b=jiBreGo9M64GF374P8b+UDDzJgz6RnueM1bARgrCFwJYKpH4/QGWQKqDTDfRMmGE3F oL55svibca/Khb565mhbxq/F9k6lP7gBCQQutGd3E1mZIYk1u7JAO31IquQt0fLaVvqz 92Ct6zoB14nwbttzEO5TKTkyCGzsv2s3fvIgHlkOo5ymlZ6ZIsCppGnbVjzDIDBbiBCK 6UAa+tFK4WHd3WacpAYKE7WK+VIhZrMjvWPtZgreW/oyiJFlET2gl4z+nHZYHfkqKtgJ TC3EXJIi4LUXCep2/7VKekGAsJgWL8BP+R90xNwnOacPfcuJUOy9XYvcgCW4MRvy0xpH 1Tag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779792922; x=1780397722; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=GsUPoa0QmNgTYmXU3NmCr7LiYIC0Rpfgi2D4aZFzeTE=; b=r52O2P1Dug5MmouNsqIVmLwinWiR/H1/lOUrmjAD3mbPxwntB2MiwwSG9uHfvcgnsO ANxB54IDgRmGOIAh7yLMLuT9qolYmJKjEhae/NQAdXEyBPGZfEGfYt6UIGROFq+NtkxT Nxz+LwfubxfPTCDtCeNB5MCPWqSW/zf9j6X5NfmzV997FlBD2SnnU9jV1X4arX/AVobb VsfAVAJL21awt47zocpN6+iLnJKaMn5CJLCate2Y/tLB6+YP0GbDLzWCBlOGH45/SNfX iAicAEFpMeMFYFYXM27b0aNRpQt033RlYpaOi7+LmHXfuNXuHkXZ3kNmxeXW3Zy/72NH 3e1A== X-Forwarded-Encrypted: i=1; AFNElJ8OsE1NyeEBwXHrxwtGfGodzLN8Yg7NNCheC2XsFa10iQLTN7bb6S7gO9309nm47xZpbDUeR5rBYKBKmCo=@vger.kernel.org X-Gm-Message-State: AOJu0YwJ1u0Y67ERKhjWKJoDDLtFVq63648liwOyTF1OowUDW3gENhkz q/QfL73DzGtXlNE0GPCu3SqfTmoDX4o7ksPcHo4LaM5Bg5EWgbJmSDJ30gJZUPQWQvn4GalIaMZ pZNn9Aeb5VGK5EL3dUkr/kll0RgSd0nNX+tb894hro65NqcKBMRSysFZkoIpZPVj38To= X-Gm-Gg: Acq92OGguKfrE8O/z/7PckYy7kCivl/MhLKoXYb+bPFaRzBnLibpVxJ58MTnFKwLTT9 73gr8z6LHOI1s9bhTt+9UHFKTL7mLSFtTFYLi2U6wvE2AqmTA3N/gJiC50mT71e60MFBw2wknlz sNn6qaBSuMrUXxqW1zD5bS5wMbMhvaJP3HUibHO97zfzSncHbr/3mVVRaNukd6Qn5Q4FPb9YLrc eeb7XY5fLVA9vFTU5ViQxwSYDw88bgzO2P4P45WTQaLoiCFMJL7nL82XJKqvO/CRDHo4dSi9ii6 Tq2BvGZoHvxBITt3rc1Ek86vtKydVWZMMy0IgCjnAbdmVwGAncDzo2PTcfSyHqncPCu3tosEf08 7M3fjo26DHUyI2Fk+j4WnzsblY5r4J7rzQi0drjltPLMeCnUYa2/3jM8YHgUA X-Received: by 2002:a17:902:ea09:b0:2bd:d6f1:3388 with SMTP id d9443c01a7336-2bea240dd66mr203168045ad.28.1779792922087; Tue, 26 May 2026 03:55:22 -0700 (PDT) X-Received: by 2002:a17:902:ea09:b0:2bd:d6f1:3388 with SMTP id d9443c01a7336-2bea240dd66mr203167845ad.28.1779792921596; Tue, 26 May 2026 03:55:21 -0700 (PDT) Received: from hu-mkshah-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2beb5695f3dsm120890025ad.1.2026.05.26.03.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 03:55:21 -0700 (PDT) From: Maulik Shah Date: Tue, 26 May 2026 16:24:41 +0530 Subject: [PATCH v2 5/8] irqchip/qcom-pdc: Configure PDC to pass through mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260526-hamoa_pdc-v2-5-f6857af1ce91@oss.qualcomm.com> References: <20260526-hamoa_pdc-v2-0-f6857af1ce91@oss.qualcomm.com> In-Reply-To: <20260526-hamoa_pdc-v2-0-f6857af1ce91@oss.qualcomm.com> To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Gleixner , Linus Walleij Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, Sneh Mankad , Maulik Shah X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779792895; l=9146; i=maulik.shah@oss.qualcomm.com; s=20240109; h=from:subject:message-id; bh=8In8IGBtkQEcG7Cn8mCKk8jnnCXcLdvp9LUTygtve4c=; b=SkXeb4VZC9IzcwTYDko+JnC/qeGoXqtWOxlnriYMF/qHCwzYasgtlRS74xtdMCLPm+P2j/Owp liej6rkXoUTBkctNvXgJN3PDrwqtHol9et+jy+1wjDZQbLa/x1WHVuU X-Developer-Key: i=maulik.shah@oss.qualcomm.com; a=ed25519; pk=bd9h5FIIliUddIk8p3BlQWBlzKEQ/YW5V+fe759hTWQ= X-Authority-Analysis: v=2.4 cv=RMyD2Yi+ c=1 sm=1 tr=0 ts=6a157c1b cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=NGcC8JguVDcA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=Q3n93Wx9duqw9lev3b0A:9 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-ORIG-GUID: AdBav5EtTCaHpD2i7MwSoJupevUalGJD X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTI2MDA5NSBTYWx0ZWRfX2sQZ6MO10HiK ry1FPrbzNQnqGoAa+u8Rk+tRv24BZIy+35J82fURHSry7DHLktd4RmyU1gzBrSLf2oZfZFnVrmN zPHMaEWdnjez79975ZF3Kt56qQ4rewIwCsxDr9NH694E4wbKLy5XLt4gpPHOpZ5j7WQHlQTay9N SnELe736c2sRjnual3BpmxIu2bVfV4AAYXIzuNUDN2Hw3jK0UHZ84VrbcyE+Ef9S9W8A4SIRivG cMkM6Sg6PoQdgh2LrkqaMu+ZXZVXETxE7tNOr4ggs7cDpF+WvXxRVro9imype6Nmi5qCZhwnU/c QTo2feyG2bc385P6nzvXb5NMGZsYSLpcQ2MDE8D3ETmR/vYo/2UjYnhSr+bqBnajeM6XwfvcM3t ZQiJPkH1cD8rNsEi94W6W7SsU/yPEmXbnY2O0IoqHzgnJzET+ySuo2Rjs4LY4Sf/hyDOknPfIW1 vZ76O7yGCgAI7TJ1T1g== X-Proofpoint-GUID: AdBav5EtTCaHpD2i7MwSoJupevUalGJD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-05-26_02,2026-05-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2605130000 definitions=main-2605260095 All PDC irqchip supports pass through mode in which both Direct SPIs and GPIO IRQs (as SPIs) are sent to GIC without latching at PDC. Newer PDCs (v3.0 onwards) also support additional secondary controller mode where PDC latches GPIO IRQs and sends to GIC as level type IRQ. Direct SPIs still works same as pass through mode without latching at PDC even in secondary controller mode. All the SoCs so far default uses pass through mode with the exception of x1e. x1e PDC may be set to secondary controller mode for builds on CRD boards whereas it may be set to pass through mode for IoT-EVK boards. The mode configuration is done in firmware and initially shipped windows firmware did not have SCM interface to read or modify the PDC mode. Later only write access is opened up for non secure world. Using the write access available add changes to modify the PDC mode to pass through mode via SCM write. When the write fails (on older firmware) assume to work in secondary mode. Co-developed-by: Sneh Mankad Signed-off-by: Sneh Mankad Signed-off-by: Maulik Shah --- drivers/irqchip/qcom-pdc.c | 109 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 106 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c index 86379dddc5be..69ddd7d89a83 100644 --- a/drivers/irqchip/qcom-pdc.c +++ b/drivers/irqchip/qcom-pdc.c @@ -20,12 +20,18 @@ #include #include #include +#include #define PDC_MAX_IRQS 256 #define IRQ_ENABLE_BANK_MAX BITS_TO_BYTES(PDC_MAX_IRQS) #define PDC_DRV_SIZE 0x10000 +/* Secure DRV register to configure the PDC mode via qcom_scm_io_writel() */ +#define PDC_GPIO_INT_CTL_ENABLE 0xb2045e8 +#define PDC_PASS_THROUGH_MODE 0x0 +#define PDC_SECONDARY_MODE 0x1 + #define PDC_VERSION_REG 0x1000 #define PDC_VERSION_MAJOR GENMASK(23, 16) #define PDC_VERSION_MINOR GENMASK(15, 8) @@ -85,10 +91,14 @@ struct pdc_regs { /** * struct pdc_cfg: bit fields for PDC IRQ_CFG register * + * @gpio_irq_sts: bit mask for GPIO_STATUS + * @gpio_irq_mask: bit mask for GPIO_MASK * @irq_enable: bit mask for IRQ_ENABLE * @irq_type: bit mask for IRQ_TYPE */ struct pdc_cfg { + u32 gpio_irq_sts; + u32 gpio_irq_mask; u32 irq_enable; u32 irq_type; }; @@ -103,11 +113,14 @@ struct pdc_cfg { * @num_gpios: Total number of GPIOs forwarded as SPI interrupts * @region: PDC interrupt continuous range * @region_cnt: Total PDC ranges + * @mode: PDC_PASS_THROUGH_MODE or PDC_SECONDARY_MODE * @x1e_quirk: x1e H/W Bug handling * @lock: lock for IRQ_ENABLE_BANK protection * @regs: PDC regs (IRQ_ENABLE_BANK and IRQ_CFG) * @cfg: bit masks within for IRQ_CFG reg * @enable_intr: pointer to enable function based on PDC version + * @unmask_gpio: pointer to GPIO irq unmask function + * @clear_gpio: pointer to GPIO irq clear function */ struct pdc_desc { void __iomem *base; @@ -119,6 +132,7 @@ struct pdc_desc { struct pdc_pin_region *region; int region_cnt; + u8 mode; bool x1e_quirk; raw_spinlock_t lock; @@ -127,6 +141,8 @@ struct pdc_desc { const struct pdc_cfg *cfg; void (*enable_intr)(int pin_out, bool on); + void (*unmask_gpio)(int pin_out, bool on); + void (*clear_gpio)(int pin_out); }; static const struct pdc_regs pdc_v3_2 = { @@ -135,6 +151,8 @@ static const struct pdc_regs pdc_v3_2 = { }; static const struct pdc_cfg pdc_cfg_v3_2 = { + .gpio_irq_sts = GENMASK(5, 5), + .gpio_irq_mask = GENMASK(4, 4), .irq_enable = GENMASK(3, 3), .irq_type = GENMASK(2, 0), }; @@ -146,6 +164,8 @@ static const struct pdc_regs pdc_v3_0 = { }; static const struct pdc_cfg pdc_cfg_v3_0 = { + .gpio_irq_sts = GENMASK(4, 4), + .gpio_irq_mask = GENMASK(3, 3), .irq_type = GENMASK(2, 0), }; @@ -184,6 +204,14 @@ static u32 pdc_reg_read(int reg, u32 i) return readl_relaxed(pdc->base + reg + i * sizeof(u32)); } +static inline bool pdc_pin_uses_seconary_mode(int pin_out) +{ + if (pdc->mode == PDC_SECONDARY_MODE && pin_out >= pdc->num_spis) + return true; + + return false; +} + static void pdc_x1e_irq_enable_write(u32 bank, u32 enable) { void __iomem *base; @@ -232,6 +260,36 @@ static void pdc_enable_intr_bank(int pin_out, bool on) pdc_reg_write(pdc->regs->irq_en_reg, index, enable); raw_spin_unlock_irqrestore(&pdc->lock, flags); + + if (pdc_pin_uses_seconary_mode(pin_out)) + pdc->unmask_gpio(pin_out, on); +} + +static void pdc_clear_gpio_cfg(int pin_out) +{ + unsigned long gpio_sts; + + if (pdc->version < PDC_VERSION_3_0) + return; + + gpio_sts = pdc_reg_read(pdc->regs->irq_cfg_reg, pin_out); + gpio_sts &= ~pdc->cfg->gpio_irq_sts; + pdc_reg_write(pdc->regs->irq_cfg_reg, pin_out, gpio_sts); +} + +static void pdc_unmask_gpio_cfg(int pin_out, bool unmask) +{ + unsigned long gpio_mask; + + if (pdc->version < PDC_VERSION_3_0) + return; + + gpio_mask = pdc_reg_read(pdc->regs->irq_cfg_reg, pin_out); + if (unmask) + gpio_mask &= ~pdc->cfg->gpio_irq_mask; + else + gpio_mask |= pdc->cfg->gpio_irq_mask; + pdc_reg_write(pdc->regs->irq_cfg_reg, pin_out, gpio_mask); } static void pdc_enable_intr_cfg(int pin_out, bool on) @@ -244,6 +302,9 @@ static void pdc_enable_intr_cfg(int pin_out, bool on) else enable &= ~pdc->cfg->irq_enable; pdc_reg_write(pdc->regs->irq_cfg_reg, pin_out, enable); + + if (pdc_pin_uses_seconary_mode(pin_out)) + pdc->unmask_gpio(pin_out, on); } static void qcom_pdc_gic_disable(struct irq_data *d) @@ -258,6 +319,20 @@ static void qcom_pdc_gic_enable(struct irq_data *d) irq_chip_enable_parent(d); } +static void qcom_pdc_ack(struct irq_data *d) +{ + if (pdc_pin_uses_seconary_mode(d->hwirq) && !irqd_is_level_type(d)) + pdc->clear_gpio(d->hwirq); +} + +static void qcom_pdc_gic_eoi(struct irq_data *d) +{ + if (pdc_pin_uses_seconary_mode(d->hwirq) && irqd_is_level_type(d)) + pdc->clear_gpio(d->hwirq); + + irq_chip_eoi_parent(d); +} + /* * GIC does not handle falling edge or active low. To allow falling edge and * active low interrupts to be handled at GIC, PDC has an inverter that inverts @@ -291,6 +366,8 @@ enum pdc_irq_config_bits { * takes care of converting falling edge to rising edge signal * If @type is level, then forward that as level high as PDC * takes care of converting falling edge to rising edge signal + * If interrupt is GPIO and PDC is in secondary mode forward that + * as level high as PDC takes care of coverting all types to level high */ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) { @@ -326,6 +403,16 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) pdc_type |= (old_pdc_type & ~pdc->cfg->irq_type); pdc_reg_write(pdc->regs->irq_cfg_reg, d->hwirq, pdc_type); + if (pdc_pin_uses_seconary_mode(d->hwirq)) { + /* + * PDC forwards GPIOs as level high to GIC in secondary + * mode. Update the type and clear any previously latched + * phantom interrupt at PDC. + */ + type = IRQ_TYPE_LEVEL_HIGH; + pdc->clear_gpio(d->hwirq); + } + ret = irq_chip_set_type_parent(d, type); if (ret) return ret; @@ -347,7 +434,8 @@ static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) static struct irq_chip qcom_pdc_gic_chip = { .name = "PDC", - .irq_eoi = irq_chip_eoi_parent, + .irq_ack = qcom_pdc_ack, + .irq_eoi = qcom_pdc_gic_eoi, .irq_mask = irq_chip_mask_parent, .irq_unmask = irq_chip_unmask_parent, .irq_disable = qcom_pdc_gic_disable, @@ -457,8 +545,10 @@ static int pdc_setup_pin_mapping(struct device_node *np) if (ret) return ret; - for (i = 0; i < pdc->region[n].cnt; i++) - pdc->enable_intr(i + pdc->region[n].pin_base, 0); + for (i = 0; i < pdc->region[n].cnt; i++) { + pdc->clear_gpio(i + pdc->region[n].pin_base); + pdc->enable_intr(i + pdc->region[n].pin_base, false); + } } return 0; @@ -510,6 +600,10 @@ static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *pare pdc->enable_intr = pdc_enable_intr_bank; } + pdc->unmask_gpio = pdc_unmask_gpio_cfg; + pdc->clear_gpio = pdc_clear_gpio_cfg; + pdc->mode = PDC_PASS_THROUGH_MODE; + /* * PDC has multiple DRV regions, each one provides the same set of * registers for a particular client in the system. Due to a hardware @@ -528,6 +622,15 @@ static int qcom_pdc_probe(struct platform_device *pdev, struct device_node *pare } pdc->x1e_quirk = true; + + if (!qcom_scm_is_available()) { + ret = -EPROBE_DEFER; + goto fail; + } + + ret = qcom_scm_io_writel(PDC_GPIO_INT_CTL_ENABLE, PDC_PASS_THROUGH_MODE); + if (ret) + pdc->mode = PDC_SECONDARY_MODE; } irq_param = pdc_reg_read(pdc->regs->irq_param_reg, 0); -- 2.43.0