From: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
To: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 8/9] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors
Date: Fri, 23 Jul 2010 13:57:42 -0700 [thread overview]
Message-ID: <e8b3593c-3be3-4b4e-aabd-e3baeb4e792a@VA3EHSMHS026.ehs.local> (raw)
In-Reply-To: <1279918663-29960-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
out_be32 and in_be32 are mainly powerpc-isms. Switch
to using ioread32be and iowrite32be instead. This allows
the code to be used on x86 or ARM, for instance.
Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
---
drivers/char/xilinx_hwicap/buffer_icap.c | 16 +++++-----
drivers/char/xilinx_hwicap/fifo_icap.c | 39 +++++++++++++--------------
drivers/char/xilinx_hwicap/xilinx_hwicap.c | 1 +
3 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/char/xilinx_hwicap/buffer_icap.c b/drivers/char/xilinx_hwicap/buffer_icap.c
index 05d8977..bc361fc 100644
--- a/drivers/char/xilinx_hwicap/buffer_icap.c
+++ b/drivers/char/xilinx_hwicap/buffer_icap.c
@@ -87,7 +87,7 @@
**/
u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
{
- return in_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET);
+ return ioread32be(drvdata->base_address + XHI_STATUS_REG_OFFSET);
}
/**
@@ -101,7 +101,7 @@ u32 buffer_icap_get_status(struct hwicap_drvdata *drvdata)
static inline u32 buffer_icap_get_bram(void __iomem *base_address,
u32 offset)
{
- return in_be32(base_address + (offset << 2));
+ return ioread32be(base_address + (offset << 2));
}
/**
@@ -114,7 +114,7 @@ static inline u32 buffer_icap_get_bram(void __iomem *base_address,
**/
static inline bool buffer_icap_busy(void __iomem *base_address)
{
- u32 status = in_be32(base_address + XHI_STATUS_REG_OFFSET);
+ u32 status = ioread32be(base_address + XHI_STATUS_REG_OFFSET);
return (status & 1) == XHI_NOT_FINISHED;
}
@@ -129,7 +129,7 @@ static inline bool buffer_icap_busy(void __iomem *base_address)
static inline void buffer_icap_set_size(void __iomem *base_address,
u32 data)
{
- out_be32(base_address + XHI_SIZE_REG_OFFSET, data);
+ iowrite32be(data, base_address + XHI_SIZE_REG_OFFSET);
}
/**
@@ -143,7 +143,7 @@ static inline void buffer_icap_set_size(void __iomem *base_address,
static inline void buffer_icap_set_offset(void __iomem *base_address,
u32 data)
{
- out_be32(base_address + XHI_BRAM_OFFSET_REG_OFFSET, data);
+ iowrite32be(data, base_address + XHI_BRAM_OFFSET_REG_OFFSET);
}
/**
@@ -159,7 +159,7 @@ static inline void buffer_icap_set_offset(void __iomem *base_address,
static inline void buffer_icap_set_rnc(void __iomem *base_address,
u32 data)
{
- out_be32(base_address + XHI_RNC_REG_OFFSET, data);
+ iowrite32be(data, base_address + XHI_RNC_REG_OFFSET);
}
/**
@@ -174,7 +174,7 @@ static inline void buffer_icap_set_rnc(void __iomem *base_address,
static inline void buffer_icap_set_bram(void __iomem *base_address,
u32 offset, u32 data)
{
- out_be32(base_address + (offset << 2), data);
+ iowrite32be(data, base_address + (offset << 2));
}
/**
@@ -255,7 +255,7 @@ static int buffer_icap_device_write(struct hwicap_drvdata *drvdata,
**/
void buffer_icap_reset(struct hwicap_drvdata *drvdata)
{
- out_be32(drvdata->base_address + XHI_STATUS_REG_OFFSET, 0xFEFE);
+ iowrite32be(0xFEFE, drvdata->base_address + XHI_STATUS_REG_OFFSET);
}
/**
diff --git a/drivers/char/xilinx_hwicap/fifo_icap.c b/drivers/char/xilinx_hwicap/fifo_icap.c
index 02225eb..062df1d 100644
--- a/drivers/char/xilinx_hwicap/fifo_icap.c
+++ b/drivers/char/xilinx_hwicap/fifo_icap.c
@@ -94,7 +94,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
u32 data)
{
dev_dbg(drvdata->dev, "fifo_write: %x\n", data);
- out_be32(drvdata->base_address + XHI_WF_OFFSET, data);
+ iowrite32be(data, drvdata->base_address + XHI_WF_OFFSET);
}
/**
@@ -105,7 +105,7 @@ static inline void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata,
**/
static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
{
- u32 data = in_be32(drvdata->base_address + XHI_RF_OFFSET);
+ u32 data = ioread32be(drvdata->base_address + XHI_RF_OFFSET);
dev_dbg(drvdata->dev, "fifo_read: %x\n", data);
return data;
}
@@ -118,7 +118,7 @@ static inline u32 fifo_icap_fifo_read(struct hwicap_drvdata *drvdata)
static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
u32 data)
{
- out_be32(drvdata->base_address + XHI_SZ_OFFSET, data);
+ iowrite32be(data, drvdata->base_address + XHI_SZ_OFFSET);
}
/**
@@ -127,7 +127,7 @@ static inline void fifo_icap_set_read_size(struct hwicap_drvdata *drvdata,
**/
static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
{
- out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_WRITE_MASK);
+ iowrite32be(XHI_CR_WRITE_MASK, drvdata->base_address + XHI_CR_OFFSET);
dev_dbg(drvdata->dev, "configuration started\n");
}
@@ -137,7 +137,7 @@ static inline void fifo_icap_start_config(struct hwicap_drvdata *drvdata)
**/
static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
{
- out_be32(drvdata->base_address + XHI_CR_OFFSET, XHI_CR_READ_MASK);
+ iowrite32be(XHI_CR_READ_MASK, drvdata->base_address + XHI_CR_OFFSET);
dev_dbg(drvdata->dev, "readback started\n");
}
@@ -159,7 +159,7 @@ static inline void fifo_icap_start_readback(struct hwicap_drvdata *drvdata)
**/
u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
{
- u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
+ u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
dev_dbg(drvdata->dev, "Getting status = %x\n", status);
return status;
}
@@ -170,7 +170,7 @@ u32 fifo_icap_get_status(struct hwicap_drvdata *drvdata)
**/
static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
{
- u32 status = in_be32(drvdata->base_address + XHI_SR_OFFSET);
+ u32 status = ioread32be(drvdata->base_address + XHI_SR_OFFSET);
return (status & XHI_SR_DONE_MASK) ? 0 : 1;
}
@@ -183,7 +183,7 @@ static inline u32 fifo_icap_busy(struct hwicap_drvdata *drvdata)
static inline u32 fifo_icap_write_fifo_vacancy(
struct hwicap_drvdata *drvdata)
{
- return in_be32(drvdata->base_address + XHI_WFV_OFFSET);
+ return ioread32be(drvdata->base_address + XHI_WFV_OFFSET);
}
/**
@@ -195,7 +195,7 @@ static inline u32 fifo_icap_write_fifo_vacancy(
static inline u32 fifo_icap_read_fifo_occupancy(
struct hwicap_drvdata *drvdata)
{
- return in_be32(drvdata->base_address + XHI_RFO_OFFSET);
+ return ioread32be(drvdata->base_address + XHI_RFO_OFFSET);
}
/**
@@ -361,13 +361,12 @@ void fifo_icap_reset(struct hwicap_drvdata *drvdata)
* Reset the device by setting/clearing the RESET bit in the
* Control Register.
*/
- reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
+ reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
- out_be32(drvdata->base_address + XHI_CR_OFFSET,
- reg_data | XHI_CR_SW_RESET_MASK);
-
- out_be32(drvdata->base_address + XHI_CR_OFFSET,
- reg_data & (~XHI_CR_SW_RESET_MASK));
+ iowrite32be(reg_data | XHI_CR_SW_RESET_MASK,
+ drvdata->base_address + XHI_CR_OFFSET);
+ iowrite32be(reg_data & (~XHI_CR_SW_RESET_MASK),
+ drvdata->base_address + XHI_CR_OFFSET);
}
@@ -382,12 +381,12 @@ void fifo_icap_flush_fifo(struct hwicap_drvdata *drvdata)
* Flush the FIFO by setting/clearing the FIFO Clear bit in the
* Control Register.
*/
- reg_data = in_be32(drvdata->base_address + XHI_CR_OFFSET);
+ reg_data = ioread32be(drvdata->base_address + XHI_CR_OFFSET);
- out_be32(drvdata->base_address + XHI_CR_OFFSET,
- reg_data | XHI_CR_FIFO_CLR_MASK);
+ iowrite32be(reg_data | XHI_CR_FIFO_CLR_MASK,
+ drvdata->base_address + XHI_CR_OFFSET);
- out_be32(drvdata->base_address + XHI_CR_OFFSET,
- reg_data & (~XHI_CR_FIFO_CLR_MASK));
+ iowrite32be(reg_data & (~XHI_CR_FIFO_CLR_MASK),
+ drvdata->base_address + XHI_CR_OFFSET);
}
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 6172689..7d0f0fb 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -95,6 +95,7 @@
/* For open firmware. */
#include <linux/of_device.h>
#include <linux/of_platform.h>
+#include <linux/of_address.h>
#endif
#include "xilinx_hwicap.h"
--
1.5.6.6
This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.
next prev parent reply other threads:[~2010-07-23 20:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1279918663-29960-1-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-1-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 1/9] drivers/of: Make device tree code work on any arch Stephen Neuendorffer
[not found] ` <7e773827-71eb-47a5-826c-cd255b4ce02c-RaUQJvECHiusiP+nND6G/7jjLBE8jN/0@public.gmane.org>
2010-08-10 17:22 ` Grant Likely
2010-07-23 21:39 ` [PATCH 0/9] Xilinx PCI endpoint driver Stephen Neuendorffer
[not found] ` <0f773b9c-7bf4-4795-93e1-64b1f81dd286-+Ck8Kgl/v08NTaRkHJHP0bjjLBE8jN/0@public.gmane.org>
2010-08-10 17:15 ` Grant Likely
[not found] ` <AANLkTim81JjUYzRaiz_X3sh1evKSEfUia39_Lzjr7H-o-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 17:27 ` Stephen Neuendorffer
[not found] ` <1279918663-29960-2-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-2-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 2/9] of/fdt: Add unflatten_partial_device_tree Stephen Neuendorffer
[not found] ` <39f3d9ca-1943-43b8-a1f6-eba8fb2aeeec-RaUQJvECHiuXHCJdrdq+zrjjLBE8jN/0@public.gmane.org>
2010-08-10 17:46 ` Grant Likely
[not found] ` <AANLkTimPsDWcW_3z46mMFCxkui+3v6q64F2EMLBr6mNK-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 17:54 ` Stephen Neuendorffer
[not found] ` <1279918663-29960-3-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-3-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 3/9] of/base.c: export property access/modification functions Stephen Neuendorffer
[not found] ` <ceba5315-090d-4776-9315-0cbca209b5af-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 18:14 ` Grant Likely
[not found] ` <1279918663-29960-4-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-4-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 4/9] drivers/of: Allow IRQ code to work properly on architectures without NO_IRQ Stephen Neuendorffer
[not found] ` <1279918663-29960-5-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-5-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 5/9] arch/x86: Add support for device tree code Stephen Neuendorffer
[not found] ` <a85fdc9c-4a93-4381-b01e-5b9bc7666863-RaUQJvECHitCYczPSvLbDrjjLBE8jN/0@public.gmane.org>
2010-08-10 18:00 ` Grant Likely
[not found] ` <1279918663-29960-6-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-6-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 6/9] [Xilinx] xilinx_pcipr: Added Xilinx reconfigurable PCI endpoint driver Stephen Neuendorffer
[not found] ` <fad5faaa-1fab-4d9f-b41e-236b874e9c08-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 18:14 ` Grant Likely
[not found] ` <1279918663-29960-7-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-7-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 7/9] [Xilinx] xilinx_hwicap: use linux/io.h instead of asm/io.h Stephen Neuendorffer
[not found] ` <bd5961af-2af1-4f6d-a220-a03fdbb19453-+Ck8Kgl/v0+44QFJ4H5SYbjjLBE8jN/0@public.gmane.org>
2010-08-10 18:16 ` Grant Likely
[not found] ` <1279918663-29960-8-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-8-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` Stephen Neuendorffer [this message]
[not found] ` <e8b3593c-3be3-4b4e-aabd-e3baeb4e792a-+Ck8Kgl/v0/VOT3FKhN2rLjjLBE8jN/0@public.gmane.org>
2010-08-10 18:17 ` [PATCH 8/9] [Xilinx] xilinx_hwicap: Update driver to use generic io accessors Grant Likely
[not found] ` <1279918663-29960-9-git-send-email-stephen.neuendorffer@xilinx.com>
[not found] ` <1279918663-29960-9-git-send-email-stephen.neuendorffer-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org>
2010-07-23 20:57 ` [PATCH 9/9] [Xilinx] xilinx_hwicap: Enable whenever OF/device trees are available Stephen Neuendorffer
[not found] ` <d3cc257d-ca6f-40cd-82d4-5941e5fbc1d0-RaUQJvECHitZbvUCbuG1mrjjLBE8jN/0@public.gmane.org>
2010-08-10 18:18 ` Grant Likely
[not found] ` <AANLkTimxkhWtnwViKj=3rEXcwZ7rPNezTe39Ef3Q5-WO-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-10 19:01 ` Stephen Neuendorffer
[not found] ` <5817abce-3f51-4e8e-a8ba-f95ea13a3536-RaUQJvECHiv5op9OF0Koj7jjLBE8jN/0@public.gmane.org>
2010-08-10 19:19 ` Grant Likely
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=e8b3593c-3be3-4b4e-aabd-e3baeb4e792a@VA3EHSMHS026.ehs.local \
--to=stephen.neuendorffer-gjffaj9ahvfqt0dzr+alfa@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.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