mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 14/21] serial: ns16550: Add mmiobase to private data
Date: Tue,  8 Jul 2014 10:50:10 +0200	[thread overview]
Message-ID: <1404809417-21477-15-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1404809417-21477-1-git-send-email-s.hauer@pengutronix.de>

We have a private data struct, so use it for storing the
base address instead of abusing the dev->priv field.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/serial/serial_ns16550.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 709f704..27fae9b 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -50,6 +50,7 @@ struct ns16550_priv {
 	int mmio;
 	struct clk *clk;
 	uint32_t fcrval;
+	void __iomem *mmiobase;
 };
 
 static inline struct ns16550_priv *to_ns16550_priv(struct console_device *cdev)
@@ -157,7 +158,6 @@ static inline void ns16550_sys_writel(uint32_t val, void __iomem *addr,
 static uint32_t ns16550_read(struct console_device *cdev, uint32_t off)
 {
 	struct ns16550_priv *priv = to_ns16550_priv(cdev);
-	struct device_d *dev = cdev->dev;
 	struct NS16550_plat *plat = &priv->plat;
 	int width = priv->access_width;
 
@@ -165,11 +165,11 @@ static uint32_t ns16550_read(struct console_device *cdev, uint32_t off)
 
 	switch (width) {
 	case IORESOURCE_MEM_8BIT:
-		return ns16550_sys_readb(dev->priv + off, priv->mmio);
+		return ns16550_sys_readb(priv->mmiobase + off, priv->mmio);
 	case IORESOURCE_MEM_16BIT:
-		return ns16550_sys_readw(dev->priv + off, priv->mmio);
+		return ns16550_sys_readw(priv->mmiobase + off, priv->mmio);
 	case IORESOURCE_MEM_32BIT:
-		return ns16550_sys_readl(dev->priv + off, priv->mmio);
+		return ns16550_sys_readl(priv->mmiobase + off, priv->mmio);
 	}
 	return -1;
 }
@@ -185,7 +185,6 @@ static void ns16550_write(struct console_device *cdev, uint32_t val,
 			  uint32_t off)
 {
 	struct ns16550_priv *priv = to_ns16550_priv(cdev);
-	struct device_d *dev = cdev->dev;
 	struct NS16550_plat *plat = &priv->plat;
 	int width = priv->access_width;
 
@@ -193,13 +192,13 @@ static void ns16550_write(struct console_device *cdev, uint32_t val,
 
 	switch (width) {
 	case IORESOURCE_MEM_8BIT:
-		ns16550_sys_writeb(val & 0xff, dev->priv + off, priv->mmio);
+		ns16550_sys_writeb(val & 0xff, priv->mmiobase + off, priv->mmio);
 		break;
 	case IORESOURCE_MEM_16BIT:
-		ns16550_sys_writew(val & 0xffff, dev->priv + off, priv->mmio);
+		ns16550_sys_writew(val & 0xffff, priv->mmiobase + off, priv->mmio);
 		break;
 	case IORESOURCE_MEM_32BIT:
-		ns16550_sys_writel(val, dev->priv + off, priv->mmio);
+		ns16550_sys_writel(val, priv->mmiobase + off, priv->mmio);
 		break;
 	}
 }
@@ -395,7 +394,7 @@ static int ns16550_probe(struct device_d *dev)
 	}
 	if (!res)
 		goto err;
-	dev->priv = (void __force __iomem *) res->start;
+	priv->mmiobase = (void __force __iomem *) res->start;
 
 
 	if (plat)
-- 
2.0.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-07-08  8:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08  8:49 Initial EFI Support Sascha Hauer
2014-07-08  8:49 ` [PATCH 01/21] Make IPaddr_t a 32bit type Sascha Hauer
2014-07-08  8:49 ` [PATCH 02/21] oftree command: Use size_t for size Sascha Hauer
2014-07-08  8:49 ` [PATCH 03/21] fat: Use correct format specifier Sascha Hauer
2014-07-08  8:50 ` [PATCH 04/21] readkey: keys are unsugned char Sascha Hauer
2014-07-08  8:50 ` [PATCH 05/21] of: platform: Use PRINTF_CONVERSION_RESOURCE for printing resources Sascha Hauer
2014-07-08  8:50 ` [PATCH 06/21] console: Add puts callback to console devices Sascha Hauer
2014-07-08  8:50 ` [PATCH 07/21] Add hex_byte_pack and hex_byte_pack_upper from kernel Sascha Hauer
2014-07-08  8:50 ` [PATCH 08/21] vsprintf: Support pU for printing UUIDs Sascha Hauer
2014-07-08  8:50 ` [PATCH 09/21] Add beginning wchar support Sascha Hauer
2014-07-11 12:35   ` Antony Pavlov
2014-07-14  6:05     ` Sascha Hauer
2014-07-08  8:50 ` [PATCH 10/21] block: Add flush callback Sascha Hauer
2014-07-08  8:50 ` [PATCH 11/21] Move efi.h to include/ Sascha Hauer
2014-07-08  8:50 ` [PATCH 12/21] filetype: Add DOS EXE file detection support Sascha Hauer
2014-07-08  8:50 ` [PATCH 13/21] efi: Add more error codes Sascha Hauer
2014-07-08  8:50 ` Sascha Hauer [this message]
2014-07-08  8:50 ` [PATCH 15/21] serial: ns16550: Add register read/write function pointers to private data Sascha Hauer
2014-07-08  8:50 ` [PATCH 16/21] Documentation: Add EFI documentation Sascha Hauer
2014-07-08  9:04   ` Jean-Christophe PLAGNIOL-VILLARD
2014-07-08  8:50 ` [PATCH 17/21] Add initial EFI architecture support Sascha Hauer
2014-07-08  8:50 ` [PATCH 18/21] net: Add EFI Simple Network Protocol Driver Sascha Hauer
2014-07-08  8:50 ` [PATCH 19/21] serial: Add EFI stdio driver Sascha Hauer
2014-07-08  8:50 ` [PATCH 20/21] fs: implement EFI filesystem driver Sascha Hauer
2014-07-08  8:50 ` [PATCH 21/21] fs: implement EFI variable " Sascha Hauer
2014-07-08  8:53 ` Initial EFI Support Jean-Christophe PLAGNIOL-VILLARD
2014-07-08  8:59   ` Sascha Hauer
2014-07-08  9:52     ` Sascha Hauer
2014-07-08 10:04 ` Jean-Christophe PLAGNIOL-VILLARD
2014-07-08 16:38 ` [PATCH 1/2] EFI: enable printf UUID support Jean-Christophe PLAGNIOL-VILLARD
2014-07-08 16:38   ` [PATCH 2/2] EFI: introduce efi_strguid to convert GUID to human readable names Jean-Christophe PLAGNIOL-VILLARD
2014-07-11  7:23     ` Sascha Hauer

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=1404809417-21477-15-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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