public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places
@ 2015-04-26  2:32 Axel Lin
  2015-04-27 17:03 ` Kamil Lulko
  2015-05-10 14:08 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2015-04-26  2:32 UTC (permalink / raw)
  To: u-boot

Use clrsetbits_le32() to replace clrbits_le32() + setbits_le32().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
v2: Conver one more place (updating &gpio_regs->afr[dsc->pin >> 3] register)
    to use clrsetbits_le32().
 drivers/gpio/stm32_gpio.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c
index d3497e9..6d6fdb0 100644
--- a/drivers/gpio/stm32_gpio.c
+++ b/drivers/gpio/stm32_gpio.c
@@ -69,22 +69,14 @@ int stm32_gpio_config(const struct stm32_gpio_dsc *dsc,
 	setbits_le32(&STM32_RCC->ahb1enr, 1 << dsc->port);
 
 	i = (dsc->pin & 0x07) * 4;
-	clrbits_le32(&gpio_regs->afr[dsc->pin >> 3], (0xF << i));
-	setbits_le32(&gpio_regs->afr[dsc->pin >> 3], ctl->af << i);
+	clrsetbits_le32(&gpio_regs->afr[dsc->pin >> 3], 0xF << i, ctl->af << i);
 
 	i = dsc->pin * 2;
 
-	clrbits_le32(&gpio_regs->moder, (0x3 << i));
-	setbits_le32(&gpio_regs->moder, ctl->mode << i);
-
-	clrbits_le32(&gpio_regs->otyper, (0x3 << i));
-	setbits_le32(&gpio_regs->otyper, ctl->otype << i);
-
-	clrbits_le32(&gpio_regs->ospeedr, (0x3 << i));
-	setbits_le32(&gpio_regs->ospeedr, ctl->speed << i);
-
-	clrbits_le32(&gpio_regs->pupdr, (0x3 << i));
-	setbits_le32(&gpio_regs->pupdr, ctl->pupd << i);
+	clrsetbits_le32(&gpio_regs->moder, 0x3 << i, ctl->mode << i);
+	clrsetbits_le32(&gpio_regs->otyper, 0x3 << i, ctl->otype << i);
+	clrsetbits_le32(&gpio_regs->ospeedr, 0x3 << i, ctl->speed << i);
+	clrsetbits_le32(&gpio_regs->pupdr, 0x3 << i, ctl->pupd << i);
 
 	rv = 0;
 out:
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places
  2015-04-26  2:32 [U-Boot] [PATCH v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places Axel Lin
@ 2015-04-27 17:03 ` Kamil Lulko
  2015-05-10 14:08 ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Kamil Lulko @ 2015-04-27 17:03 UTC (permalink / raw)
  To: u-boot

On 26/04/15 04:32, Axel Lin wrote:
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Reviewed-by:Kamil Lulko <rev13@wp.pl  <http://lists.denx.de/mailman/listinfo/u-boot>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [U-Boot, v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places
  2015-04-26  2:32 [U-Boot] [PATCH v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places Axel Lin
  2015-04-27 17:03 ` Kamil Lulko
@ 2015-05-10 14:08 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2015-05-10 14:08 UTC (permalink / raw)
  To: u-boot

On Sun, Apr 26, 2015 at 10:32:36AM +0800, Axel Lin wrote:

> Use clrsetbits_le32() to replace clrbits_le32() + setbits_le32().
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150510/fecc8187/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-10 14:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-26  2:32 [U-Boot] [PATCH v2] gpio: stm32_gpio: Use clrsetbits_le32() at appropriate places Axel Lin
2015-04-27 17:03 ` Kamil Lulko
2015-05-10 14:08 ` [U-Boot] [U-Boot, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox