From patchwork Tue Aug 24 11:54:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugen Hristev X-Patchwork-Id: 12454861 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F9FC4320E for ; Tue, 24 Aug 2021 11:58:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AEE8061246 for ; Tue, 24 Aug 2021 11:58:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AEE8061246 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=szd0O3Xr3B59RSiJlwdsxsAL/sofRmP3HOICJ3MJ71o=; b=XjoV1otadwidSS cTT8uJHcHT00i6dQPsC+9D8lIp9jEiJf0TAbhFTHbDFkpfGUBoB/4zLT92nTFLyD82XG7t/hBoDk3 F7AgmV3T5P4F/WEtv52YIfm2+Ebwc5xiuP9h+k2nnqP1Lm+jronVgaaiBOKS4aNId7aMtX3PvU6u8 r0Tu+27aRT7d5dfc3dOWqHFOiAh6JmWnq766Z9qhqG7CDP1pWdtc+nZHOGnNCHMVw9I0b6bO2jXhA HRhSRdarXQPtvLyTxvwcIx784LV63ysXKqeC0ekK6ogpEaG2vWnLK2nJVPVoA7cffGe5L/akuhd63 xmu8acJ2U8ea4DM444EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIV1t-002rUi-7R; Tue, 24 Aug 2021 11:55:45 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIV1f-002rQt-MH for linux-arm-kernel@lists.infradead.org; Tue, 24 Aug 2021 11:55:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1629806132; x=1661342132; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nvQXMiaPy2VuNQO50RLteRfILBr98vNnCM+YLfLiMik=; b=tCDd66ywu3sQPH5HJ7QrCHRng350HT4NrxakK56R1Z6wDHFRXDHDk1ER yXfo80nZV2g6OkchvYCsJOpPIeQBhftIBE59U0B6jgx7TDnLxQ0n46JJ9 IVLlYEVj32fv20ilaLboYd6R8iWhZi/WO2rzJe8s+gDwgtoiQRihg/Vgt 2hKKqnp4kS/0SUxEEJLQRfWOZNBIoBkgJghYghsZvlLf7U8kl9YZRAB1u R9+YofNMhc0fXn8tjLBjLrcbd6q+BFKE1qCySmR9Ls9azTHd6QLIHWjma IHd/c77kn9hkzw2d2kRwNSs6fpjC1qrYa+kODcjDV/K4yQp4nqnAb1efu Q==; IronPort-SDR: 6nPG1Al6NEDaXSpPdGdoVRRm6Hi4pWaBvvs6si5FpIn+sJSk/P6n4jbLO1f2vgB4Edld59Va2K 3LAgxeMLWOw/huylvtwDj8zSVrPfPqWTiZSSEdXv65nGffvxP0M7DSaPfSDa7lDPsyKVzfZZaF 4pGLEkzzeYrORjjwTx5zgbEHQquYFEW4c+t/4y/eCXmwx6LzIY0Riq+eboTIjqkK8eNcu+Neto bj071yJsx50L34yivs1QsdYqbuqH9SmjnWBsPyanNgSGO3RkO1Ltyzvg0QuFkhSApEgrZNHxai JWtd9X7OFfQOW2j2sWwWN/aV X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="133408028" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Aug 2021 04:55:30 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 24 Aug 2021 04:55:29 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 24 Aug 2021 04:55:18 -0700 From: Eugen Hristev To: , , , CC: , , , , Eugen Hristev Subject: [PATCH v2 02/10] iio: adc: at91-sama5d2_adc: initialize hardware after clock is started Date: Tue, 24 Aug 2021 14:54:33 +0300 Message-ID: <20210824115441.681253-3-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210824115441.681253-1-eugen.hristev@microchip.com> References: <20210824115441.681253-1-eugen.hristev@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210824_045531_783993_952AFEED X-CRM114-Status: GOOD ( 10.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The hw_init hardware init call must happen after the clock is prepared and enabled. Otherwise, writing to the registers might lead to a block or external abort. Signed-off-by: Eugen Hristev --- drivers/iio/adc/at91-sama5d2_adc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ea5ca163d879..1f4d461c2c18 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1833,12 +1833,12 @@ static int at91_adc_probe(struct platform_device *pdev) goto vref_disable; } - at91_adc_hw_init(indio_dev); - ret = clk_prepare_enable(st->per_clk); if (ret) goto vref_disable; + at91_adc_hw_init(indio_dev); + platform_set_drvdata(pdev, indio_dev); ret = at91_adc_buffer_and_trigger_init(&pdev->dev, indio_dev);