ptp_pch: Use ioread64_hi_lo() / iowrite64_hi_lo()
There is already helper functions to do 64-bit I/O on 32-bit machines or buses, thus we don't need to reinvent the wheel. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220207210730.75252-3-andriy.shevchenko@linux.intel.com Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
8664d49a81
commit
d09adf6100
@ -14,6 +14,7 @@
|
|||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/io-64-nonatomic-lo-hi.h>
|
#include <linux/io-64-nonatomic-lo-hi.h>
|
||||||
|
#include <linux/io-64-nonatomic-hi-lo.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -298,19 +299,16 @@ static irqreturn_t isr(int irq, void *priv)
|
|||||||
struct pch_dev *pch_dev = priv;
|
struct pch_dev *pch_dev = priv;
|
||||||
struct pch_ts_regs __iomem *regs = pch_dev->regs;
|
struct pch_ts_regs __iomem *regs = pch_dev->regs;
|
||||||
struct ptp_clock_event event;
|
struct ptp_clock_event event;
|
||||||
u32 ack = 0, lo, hi, val;
|
u32 ack = 0, val;
|
||||||
|
|
||||||
val = ioread32(®s->event);
|
val = ioread32(®s->event);
|
||||||
|
|
||||||
if (val & PCH_TSE_SNS) {
|
if (val & PCH_TSE_SNS) {
|
||||||
ack |= PCH_TSE_SNS;
|
ack |= PCH_TSE_SNS;
|
||||||
if (pch_dev->exts0_enabled) {
|
if (pch_dev->exts0_enabled) {
|
||||||
hi = ioread32(®s->asms_hi);
|
|
||||||
lo = ioread32(®s->asms_lo);
|
|
||||||
event.type = PTP_CLOCK_EXTTS;
|
event.type = PTP_CLOCK_EXTTS;
|
||||||
event.index = 0;
|
event.index = 0;
|
||||||
event.timestamp = ((u64) hi) << 32;
|
event.timestamp = ioread64_hi_lo(®s->asms_hi);
|
||||||
event.timestamp |= lo;
|
|
||||||
event.timestamp <<= TICKS_NS_SHIFT;
|
event.timestamp <<= TICKS_NS_SHIFT;
|
||||||
ptp_clock_event(pch_dev->ptp_clock, &event);
|
ptp_clock_event(pch_dev->ptp_clock, &event);
|
||||||
}
|
}
|
||||||
@ -319,12 +317,9 @@ static irqreturn_t isr(int irq, void *priv)
|
|||||||
if (val & PCH_TSE_SNM) {
|
if (val & PCH_TSE_SNM) {
|
||||||
ack |= PCH_TSE_SNM;
|
ack |= PCH_TSE_SNM;
|
||||||
if (pch_dev->exts1_enabled) {
|
if (pch_dev->exts1_enabled) {
|
||||||
hi = ioread32(®s->amms_hi);
|
|
||||||
lo = ioread32(®s->amms_lo);
|
|
||||||
event.type = PTP_CLOCK_EXTTS;
|
event.type = PTP_CLOCK_EXTTS;
|
||||||
event.index = 1;
|
event.index = 1;
|
||||||
event.timestamp = ((u64) hi) << 32;
|
event.timestamp = ioread64_hi_lo(®s->asms_hi);
|
||||||
event.timestamp |= lo;
|
|
||||||
event.timestamp <<= TICKS_NS_SHIFT;
|
event.timestamp <<= TICKS_NS_SHIFT;
|
||||||
ptp_clock_event(pch_dev->ptp_clock, &event);
|
ptp_clock_event(pch_dev->ptp_clock, &event);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user