diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-01-08 22:07:30 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-09 01:40:47 +0100 |
commit | 88eb99f29c0026f4b7d7702652eb529f04c69073 (patch) | |
tree | c2e41a33c1757c77a8d1b6f39ea9030e3bc4565e /drivers/misc | |
parent | mei: abstract host and device readieness (diff) | |
download | linux-88eb99f29c0026f4b7d7702652eb529f04c69073.tar.xz linux-88eb99f29c0026f4b7d7702652eb529f04c69073.zip |
mei: reenable mei_hcsr_set abstraction
Now when mei_hcsr_set is local to hw-me.c
we can benefit form the fact that it wraps
H_IS removal from the host csr.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/hw-me.c | 38 | ||||
-rw-r--r-- | drivers/misc/mei/mei_dev.h | 1 |
2 files changed, 15 insertions, 24 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c index 49b558ddf5b5..319002797578 100644 --- a/drivers/misc/mei/hw-me.c +++ b/drivers/misc/mei/hw-me.c @@ -90,13 +90,10 @@ u32 mei_hcsr_read(const struct mei_device *dev) * * @dev: the device structure */ -void mei_hcsr_set(struct mei_device *dev) +static inline void mei_hcsr_set(struct mei_device *dev, u32 hcsr) { - - if ((dev->host_hw_state & H_IS) == H_IS) - dev->host_hw_state &= ~H_IS; - mei_reg_write(dev, H_CSR, dev->host_hw_state); - dev->host_hw_state = mei_hcsr_read(dev); + hcsr &= ~H_IS; + mei_reg_write(dev, H_CSR, hcsr); } /** @@ -120,8 +117,7 @@ void mei_enable_interrupts(struct mei_device *dev) { u32 hcsr = mei_hcsr_read(dev); hcsr |= H_IE; - hcsr &= ~H_IS; - mei_reg_write(dev, H_CSR, hcsr); + mei_hcsr_set(dev, hcsr); } /** @@ -133,8 +129,7 @@ void mei_disable_interrupts(struct mei_device *dev) { u32 hcsr = mei_hcsr_read(dev); hcsr &= ~H_IE; - hcsr &= ~H_IS; - mei_reg_write(dev, H_CSR, hcsr); + mei_hcsr_set(dev, hcsr); } /** @@ -156,16 +151,12 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable) else hcsr &= ~H_IE; - hcsr &= ~H_IS; - - mei_reg_write(dev, H_CSR, hcsr); - hcsr = mei_hcsr_read(dev); + mei_hcsr_set(dev, hcsr); + hcsr = mei_hcsr_read(dev) | H_IG; hcsr &= ~H_RST; - hcsr |= H_IG; - hcsr &= ~H_IS; - mei_reg_write(dev, H_CSR, hcsr); + mei_hcsr_set(dev, hcsr); hcsr = mei_hcsr_read(dev); @@ -182,7 +173,7 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable) void mei_host_set_ready(struct mei_device *dev) { dev->host_hw_state |= H_IE | H_IG | H_RDY; - mei_hcsr_set(dev); + mei_hcsr_set(dev, dev->host_hw_state); } /** * mei_host_is_ready - check whether the host has turned ready @@ -295,6 +286,7 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header, unsigned long rem, dw_cnt; unsigned long length = header->length; u32 *reg_buf = (u32 *)buf; + u32 hcsr; int i; int empty_slots; @@ -319,9 +311,8 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header, mei_reg_write(dev, H_CB_WW, reg); } - dev->host_hw_state = mei_hcsr_read(dev); - dev->host_hw_state |= H_IG; - mei_hcsr_set(dev); + hcsr = mei_hcsr_read(dev) | H_IG; + mei_hcsr_set(dev, hcsr); dev->me_hw_state = mei_mecsr_read(dev); if (!mei_me_is_ready(dev)) return -EIO; @@ -366,6 +357,7 @@ void mei_read_slots(struct mei_device *dev, unsigned char *buffer, unsigned long buffer_length) { u32 *reg_buf = (u32 *)buffer; + u32 hcsr; for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32)) *reg_buf++ = mei_mecbrw_read(dev); @@ -375,7 +367,7 @@ void mei_read_slots(struct mei_device *dev, unsigned char *buffer, memcpy(reg_buf, ®, buffer_length); } - dev->host_hw_state |= H_IG; - mei_hcsr_set(dev); + hcsr = mei_hcsr_read(dev) | H_IG; + mei_hcsr_set(dev, hcsr); } diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index 7b4365952be5..ae4c5ffc712b 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h @@ -387,7 +387,6 @@ void mei_watchdog_unregister(struct mei_device *dev); void mei_hw_reset(struct mei_device *dev, bool intr_enable); u32 mei_hcsr_read(const struct mei_device *dev); -void mei_hcsr_set(struct mei_device *dev); u32 mei_mecsr_read(const struct mei_device *dev); u32 mei_mecbrw_read(const struct mei_device *dev); |