linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org,
	linux-rt-users <linux-rt-users@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Carsten Emde <C.Emde@osadl.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	John Kacur <jkacur@redhat.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Felipe Balbi <balbi@ti.com>
Subject: [PATCH RT 05/20] usb: gadget: atmel: access the PMC using regmap
Date: Tue, 12 Jul 2016 10:24:10 -0400	[thread overview]
Message-ID: <20160712142418.093829390@goodmis.org> (raw)
In-Reply-To: 20160712142405.634544943@goodmis.org

[-- Attachment #1: 0005-usb-gadget-atmel-access-the-PMC-using-regmap.patch --]
[-- Type: text/plain, Size: 2916 bytes --]

4.1.27-rt31-rc1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Use regmap to access the PMC to avoid using at91_pmc_read and
at91_pmc_write.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 20 ++++++++++----------
 drivers/usb/gadget/udc/atmel_usba_udc.h |  2 ++
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index d6ca3697d3c8..ee6bc64f9656 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -17,7 +17,9 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/list.h>
+#include <linux/mfd/syscon.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/atmel_usba_udc.h>
@@ -1889,20 +1891,15 @@ static int atmel_usba_stop(struct usb_gadget *gadget)
 #ifdef CONFIG_OF
 static void at91sam9rl_toggle_bias(struct usba_udc *udc, int is_on)
 {
-	unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
-
-	if (is_on)
-		at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
-	else
-		at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN));
+	regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN,
+			   is_on ? AT91_PMC_BIASEN : 0);
 }
 
 static void at91sam9g45_pulse_bias(struct usba_udc *udc)
 {
-	unsigned int uckr = at91_pmc_read(AT91_CKGR_UCKR);
-
-	at91_pmc_write(AT91_CKGR_UCKR, uckr & ~(AT91_PMC_BIASEN));
-	at91_pmc_write(AT91_CKGR_UCKR, uckr | AT91_PMC_BIASEN);
+	regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN, 0);
+	regmap_update_bits(udc->pmc, AT91_CKGR_UCKR, AT91_PMC_BIASEN,
+			   AT91_PMC_BIASEN);
 }
 
 static const struct usba_udc_errata at91sam9rl_errata = {
@@ -1939,6 +1936,9 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
 		return ERR_PTR(-EINVAL);
 
 	udc->errata = match->data;
+	udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
+	if (udc->errata && IS_ERR(udc->pmc))
+		return ERR_CAST(udc->pmc);
 
 	udc->num_ep = 0;
 
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.h b/drivers/usb/gadget/udc/atmel_usba_udc.h
index ea448a344767..3e1c9d589dfa 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.h
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.h
@@ -354,6 +354,8 @@ struct usba_udc {
 	struct dentry *debugfs_root;
 	struct dentry *debugfs_regs;
 #endif
+
+	struct regmap *pmc;
 };
 
 static inline struct usba_ep *to_usba_ep(struct usb_ep *ep)
-- 
2.8.1

  parent reply	other threads:[~2016-07-12 14:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 14:24 [PATCH RT 00/20] Linux 4.1.27-rt31-rc1 Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 01/20] ARM: at91: pm: simply call at91_pm_init Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 02/20] ARM: at91: pm: find and remap the pmc Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 03/20] ARM: at91: pm: move idle functions to pm.c Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 04/20] ARM: at91: remove useless includes and function prototypes Steven Rostedt
2016-07-12 14:24 ` Steven Rostedt [this message]
2016-07-12 14:24 ` [PATCH RT 06/20] kvm, rt: change async pagefault code locking for PREEMPT_RT Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 07/20] mm/zsmalloc: Use get/put_cpu_light in zs_map_object()/zs_unmap_object() Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 08/20] net: dev: always take qdiscs busylock in __dev_xmit_skb() Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 09/20] drivers/block/zram: Replace bit spinlocks with rtmutex for -rt Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 10/20] list_bl: fixup bogus lockdep warning Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 11/20] ARM: imx: always use TWD on IMX6Q Steven Rostedt
2016-07-12 20:04   ` Sebastian Andrzej Siewior
2016-07-12 20:25     ` Steven Rostedt
2016-07-18 17:18     ` Grygorii Strashko
2016-07-12 14:24 ` [PATCH RT 12/20] drivers/block/zram: fixup compile for !RT Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 13/20] perf/x86/intel/rapl: Make PMU lock raw Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 14/20] sched,preempt: Fix preempt_count manipulations Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 15/20] kernel/printk: Dont try to print from IRQ/NMI region Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 16/20] arm: lazy preempt: correct resched condition Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 17/20] locallock: add local_lock_on() Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 18/20] mm: perform lru_add_drain_all() remotely Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 19/20] trace: correct off by one while recording the trace-event Steven Rostedt
2016-07-12 14:24 ` [PATCH RT 20/20] Linux 4.1.27-rt31-rc1 Steven Rostedt
2016-07-12 23:18 ` Linux 4.1.27-rt31-rc2 Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160712142418.093829390@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=C.Emde@osadl.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=boris.brezillon@free-electrons.com \
    --cc=jkacur@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).