Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1959550imm; Thu, 20 Sep 2018 05:45:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbFA+5I1e1NY/dfp+dC3IsSG7PRYlvGjD1D0Me4Uro2DArIWsMkHliRKbDjhkN9v+48R3ml X-Received: by 2002:a17:902:b283:: with SMTP id u3-v6mr38608445plr.2.1537447538525; Thu, 20 Sep 2018 05:45:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537447538; cv=none; d=google.com; s=arc-20160816; b=K3znsRI0f+jzjBHDet8ujiK81dNrxuBkmYtFHgA4Ij0q1PhKJskyBa1ry8OL+vIuEN FcMkLH/DYWf+Rfa1mxS9KyX3fuJYegR7I94sA4jw5ix753R1KLReRNrlEdCghgBz4wEi Ajj3J02bwlykM9t/IJO4B2YaCjJBAFmOhhYsoe7LJIxoBw8okkek/YPTTuVMpdkm/LKT HUxU9i7AHVJY4lLMIjFCTW7HjTBr9AGv4E1grDRuId2fal5cSnAVobZBU+ApfmFIwO28 W6Wp4dyEpxSH+YdvebXruMR6vVZNZ8frMmbf4N55yun32aLxGReNkQdz8lwXfC28yTkX Whsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=fO5e1i2dE/0GxQ4T88snt+0A0Fcg68/YE9UrS4gtFZU=; b=Vxq/aY59im8KGQsexWe+XGAE1sjowrR+ONWmnbH03vIWZQEuyP6rQMI/s0P1VOn3Qt IczGxLoxQ6BQHNfOOcxlCY1J2Rv3UbL5z3/ZXN0/olDeS/+/6+3hkgGkbt89nLkL5szD Sqqy0EsJmjwsKGLmALckXFIQXkP66U+y6XwrrnxLzLG5QANY8nac1IiZt/7t1SlZquiv yNkFotb4pApuqqwB0IqpwjWsbuU1SrFzg5c1fKqrNTzhYGai7fF5klkkZD4GlqOe5Vnr 7BwNYCz/INNqv3r8K53xjw1lg+LWxp1Ph6oDUHAkUibHC9mOLw8juuTz/bQcAr+NqujL vr9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i16-v6si23586675pgi.660.2018.09.20.05.45.22; Thu, 20 Sep 2018 05:45:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387684AbeITS2T (ORCPT + 99 others); Thu, 20 Sep 2018 14:28:19 -0400 Received: from esa1.microchip.iphmx.com ([68.232.147.91]:12618 "EHLO esa1.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387552AbeITS2T (ORCPT ); Thu, 20 Sep 2018 14:28:19 -0400 X-IronPort-AV: E=Sophos;i="5.53,398,1531810800"; d="scan'208";a="21047112" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa1.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Sep 2018 05:44:59 -0700 Received: from eh-station.microchip.com (10.10.76.4) by chn-sv-exch05.mchp-main.com (10.10.76.106) with Microsoft SMTP Server id 14.3.352.0; Thu, 20 Sep 2018 05:44:58 -0700 From: Eugen Hristev To: , , , , CC: , Eugen Hristev , Maxime Ripard , Subject: [PATCH 1/2] iio: adc: at91: fix acking DRDY irq on simple conversions Date: Thu, 20 Sep 2018 15:40:37 +0300 Message-ID: <1537447238-18674-1-git-send-email-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When doing simple conversions, the driver did not acknowledge the DRDY irq. If this irq is not acked, it will be left pending, and as soon as a trigger is enabled, the irq handler will be called, it doesn't know why this irq has occurred because no channel is pending, and then we will have irq loop and board will hang. Fixes 0e589d5fb ("ARM: AT91: IIO: Add AT91 ADC driver.") Cc: Maxime Ripard Cc: Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91_adc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 44b5168..e85f859 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -712,6 +712,11 @@ static int at91_adc_read_raw(struct iio_dev *idev, at91_adc_writel(st, AT91_ADC_CHDR, AT91_ADC_CH(chan->channel)); at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); + /* + * we need to ack the DRDY irq, otherwise it will be + * left pending and irq handler will be confused + */ + at91_adc_readl(st, AT91_ADC_LCDR); st->last_value = 0; st->done = false; -- 2.7.4