From patchwork Thu Feb 23 08:38:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 9587939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 866AE60210 for ; Thu, 23 Feb 2017 08:42:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C92E2832D for ; Thu, 23 Feb 2017 08:42:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F8A728695; Thu, 23 Feb 2017 08:42:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0DE032832D for ; Thu, 23 Feb 2017 08:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XIWW9eJnNnQd7L/BtOrcKwtfoLkoQ2R02Rr+KTqWwOA=; b=oAsWMGV+U3cW8I kpwW15zruDfQrJyoO+stA8FQ9A4qS+dlYWw0YNaRsiKUOfTXgEUkEio/6OeABeanuhcwvi+LdCKNl 6Eu6uqJ/p43E/gz9a0QiZJXrNM9x9VsyaYB9xVP/dNV4rJOCQn27fk4XkcB3wBhC+dZ51Xag858OK UK+ADeR405HKtjO6fAIYqslMY3mR6IergQ2tFC8miDokNpUjINBg47qt2ejGUDlB4CmtEbIYEfagQ b3KvERtV1zVNx9EFM3LDh/KcmME4hD+eHnhPR3T2CT1UzS8P6M3AGvBj6u/REa/6Uhy7EAUOfVBZj bAsBeto1Jcq60kmWCx9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cgoyZ-000145-O9; Thu, 23 Feb 2017 08:42:11 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgoyW-00013q-UP for linux-arm-kernel@bombadil.infradead.org; Thu, 23 Feb 2017 08:42:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kjYhH+nDSlKIsaCfknRv9zc/wmD5kTmXZ2PITN801v4=; b=2Pbifx600LpRpdAhOoLhuONUn ur0s38VmEWSB8CljJL+8pA3p2STewBIXCa7mgqHWRBiyGtm5jnz/s2exVyKSuj+pwJC2LhtqpAqGS 2Qr04aJzSb+wTW6P1LvkcA82YzLH50stcZ548gLLDPN2D5CbASW4VKMfaVpT3ahCUQEbNkMGeoTRX +Ao02YpaBLW2qTLcMWBqCy4sHQ84RTds3YVPjFCiAoX9wV/E6Pi8d9mYigH38F6S3Oe0ViVfZ4MDj NpsS4cVGA3IoIwc85x/ztxl+FHSE5d0Nbgbgagp296YNJFVLrfnwSpn8D3c7ckIp7JnK+nTN3qOkk xpUOoDtMQ==; Received: from smtpout.microchip.com ([198.175.253.82] helo=email.microchip.com) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cgoyU-0002xj-Ic for linux-arm-kernel@lists.infradead.org; Thu, 23 Feb 2017 08:42:08 +0000 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.181.6; Thu, 23 Feb 2017 01:41:42 -0700 From: Claudiu Beznea To: , , , , , , , Subject: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2 Date: Thu, 23 Feb 2017 10:38:39 +0200 Message-ID: <1487839120-13650-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487839120-13650-1-git-send-email-claudiu.beznea@microchip.com> References: <1487839120-13650-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170223_034206_794132_282811B2 X-CRM114-Status: GOOD ( 11.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, Claudiu Beznea , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Enable PWM on sama5d2 by adding atmel_pwm_config_v3(). This, simply, sets the period and duty factor registers. Signed-off-by: Claudiu Beznea Acked-by: Alexandre Belloni --- Documentation/devicetree/bindings/pwm/atmel-pwm.txt | 1 + drivers/pwm/pwm-atmel.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt index 02331b9..c8c831d 100644 --- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt +++ b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt @@ -4,6 +4,7 @@ Required properties: - compatible: should be one of: - "atmel,at91sam9rl-pwm" - "atmel,sama5d3-pwm" + - "atmel,sama5d2-pwm" - reg: physical base address and length of the controller's registers - #pwm-cells: Should be 3. See pwm.txt in this directory for a description of the cells format. diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 0e4bd4e..4406639 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c @@ -207,6 +207,15 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm, } } +static void atmel_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm, + unsigned long dty, unsigned long prd) +{ + struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip); + + atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CDTY, dty); + atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CPRD, prd); +} + static int atmel_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm, enum pwm_polarity polarity) { @@ -295,6 +304,10 @@ static const struct atmel_pwm_data atmel_pwm_data_v2 = { .config = atmel_pwm_config_v2, }; +static const struct atmel_pwm_data atmel_pwm_data_v3 = { + .config = atmel_pwm_config_v3, +}; + static const struct platform_device_id atmel_pwm_devtypes[] = { { .name = "at91sam9rl-pwm", @@ -316,6 +329,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = { .compatible = "atmel,sama5d3-pwm", .data = &atmel_pwm_data_v2, }, { + .compatible = "atmel,sama5d2-pwm", + .data = &atmel_pwm_data_v3, + }, { /* sentinel */ }, };