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 02/11] serial s3c: get rid of map_base
Date: Thu, 28 Jul 2011 15:41:55 +0200	[thread overview]
Message-ID: <1311860524-28566-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1311860524-28566-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/serial/serial_s3c24x0.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 0a17967..21bca12 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -44,11 +44,12 @@
 static int s3c24x0_serial_setbaudrate(struct console_device *cdev, int baudrate)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 	unsigned val;
 
 	/* value is calculated so : PCLK / (16 * baudrate) -1 */
 	val = s3c24xx_get_pclk() / (16 * baudrate) - 1;
-	writew(val, dev->map_base + UBRDIV);
+	writew(val, base + UBRDIV);
 
 	return 0;
 }
@@ -56,21 +57,22 @@ static int s3c24x0_serial_setbaudrate(struct console_device *cdev, int baudrate)
 static int s3c24x0_serial_init_port(struct console_device *cdev)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 
 	/* FIFO enable, Tx/Rx FIFO clear */
-	writeb(0x07, dev->map_base + UFCON);
-	writeb(0x00, dev->map_base + UMCON);
+	writeb(0x07, base + UFCON);
+	writeb(0x00, base + UMCON);
 
 	/* Normal,No parity,1 stop,8 bit */
-	writeb(0x03, dev->map_base + ULCON);
+	writeb(0x03, base + ULCON);
 	/*
 	 * tx=level,rx=edge,disable timeout int.,enable rx error int.,
 	 * normal,interrupt or polling
 	 */
-	writew(0x0245, dev->map_base + UCON);
+	writew(0x0245, base + UCON);
 
 #ifdef CONFIG_DRIVER_SERIAL_S3C24X0_AUTOSYNC
-	writeb(0x01, dev->map_base + UMCON); /* RTS up */
+	writeb(0x01, base + UMCON); /* RTS up */
 #endif
 
 	return 0;
@@ -79,20 +81,22 @@ static int s3c24x0_serial_init_port(struct console_device *cdev)
 static void s3c24x0_serial_putc(struct console_device *cdev, char c)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 
 	/* Wait for Tx FIFO not full */
-	while (!(readb(dev->map_base + UTRSTAT) & 0x2))
+	while (!(readb(base + UTRSTAT) & 0x2))
 		;
 
-	writeb(c, dev->map_base + UTXH);
+	writeb(c, base + UTXH);
 }
 
 static int s3c24x0_serial_tstc(struct console_device *cdev)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 
 	/* If receive fifo is empty, return false */
-	if (readb(dev->map_base + UTRSTAT) & 0x1)
+	if (readb(base + UTRSTAT) & 0x1)
 		return 1;
 
 	return 0;
@@ -101,19 +105,21 @@ static int s3c24x0_serial_tstc(struct console_device *cdev)
 static int s3c24x0_serial_getc(struct console_device *cdev)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 
 	/* wait for a character */
-	while (!(readb(dev->map_base + UTRSTAT) & 0x1))
+	while (!(readb(base + UTRSTAT) & 0x1))
 		;
 
-	return readb(dev->map_base + URXH);
+	return readb(base + URXH);
 }
 
 static void s3c24x0_serial_flush(struct console_device *cdev)
 {
 	struct device_d *dev = cdev->dev;
+	void __iomem *base = dev->priv;
 
-	while (!(readb(dev->map_base + UTRSTAT) & 0x4))
+	while (!(readb(base + UTRSTAT) & 0x4))
 		;
 }
 
@@ -123,6 +129,7 @@ static int s3c24x0_serial_probe(struct device_d *dev)
 
 	cdev = xmalloc(sizeof(struct console_device));
 	dev->type_data = cdev;
+	dev->priv = dev_request_mem_region(dev, 0);
 	cdev->dev = dev;
 	cdev->f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR;
 	cdev->tstc = s3c24x0_serial_tstc;
-- 
1.7.5.4


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

  parent reply	other threads:[~2011-07-28 13:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28 13:41 more switches to resources Sascha Hauer
2011-07-28 13:41 ` [PATCH 01/11] serial netx: get rid of map_base Sascha Hauer
2011-07-28 13:41 ` Sascha Hauer [this message]
2011-07-28 13:41 ` [PATCH 03/11] serial pl010: " Sascha Hauer
2011-07-28 13:41 ` [PATCH 04/11] serial stm: " Sascha Hauer
2011-07-28 13:41 ` [PATCH 05/11] serial mpc5xxx: " Sascha Hauer
2011-07-28 13:41 ` [PATCH 06/11] smc911x: use dev_* instead of printf Sascha Hauer
2011-07-28 13:42 ` [PATCH 07/11] smc911x: switch to use resources Sascha Hauer
2011-07-28 13:42 ` [PATCH 08/11] smc911x: embed eth_device into priv Sascha Hauer
2011-07-28 13:42 ` [PATCH 09/11] ARM pcm037: Fix wrong sdram base Sascha Hauer
2011-07-28 13:42 ` [PATCH 10/11] smc91111: switch to resources Sascha Hauer
2011-07-28 13:42 ` [PATCH 11/11] fec_mpc5200: " 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=1311860524-28566-3-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