aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/hw-me.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-01-08 16:07:31 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-08 19:40:47 -0500
commite7e0c231aaa7a01df28634390381974cb76d3cb2 (patch)
treee6a2233958265dc3efc649563de50fc4e1605b38 /drivers/misc/mei/hw-me.c
parent88eb99f29c0026f4b7d7702652eb529f04c69073 (diff)
mei: make host csr and me csr internal to hw-me
Move csr reading into me hardware functional calls. Since we gave up on registers caching we remove some of the unnecessary queries in mei_hw_init ane mei_reset functions. We add mei_hw_config function to wrap up host buffer depth configuration. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/hw-me.c')
-rw-r--r--drivers/misc/mei/hw-me.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
index 319002797578..93a2a56a5f2c 100644
--- a/drivers/misc/mei/hw-me.c
+++ b/drivers/misc/mei/hw-me.c
@@ -67,7 +67,7 @@ u32 mei_mecbrw_read(const struct mei_device *dev)
67 * 67 *
68 * returns ME_CSR_HA register value (u32) 68 * returns ME_CSR_HA register value (u32)
69 */ 69 */
70u32 mei_mecsr_read(const struct mei_device *dev) 70static inline u32 mei_mecsr_read(const struct mei_device *dev)
71{ 71{
72 return mei_reg_read(dev, ME_CSR_HA); 72 return mei_reg_read(dev, ME_CSR_HA);
73} 73}
@@ -79,7 +79,7 @@ u32 mei_mecsr_read(const struct mei_device *dev)
79 * 79 *
80 * returns H_CSR register value (u32) 80 * returns H_CSR register value (u32)
81 */ 81 */
82u32 mei_hcsr_read(const struct mei_device *dev) 82static inline u32 mei_hcsr_read(const struct mei_device *dev)
83{ 83{
84 return mei_reg_read(dev, H_CSR); 84 return mei_reg_read(dev, H_CSR);
85} 85}
@@ -96,6 +96,18 @@ static inline void mei_hcsr_set(struct mei_device *dev, u32 hcsr)
96 mei_reg_write(dev, H_CSR, hcsr); 96 mei_reg_write(dev, H_CSR, hcsr);
97} 97}
98 98
99
100/**
101 * me_hw_config - configure hw dependent settings
102 *
103 * @dev: mei device
104 */
105void mei_hw_config(struct mei_device *dev)
106{
107 u32 hcsr = mei_hcsr_read(dev);
108 /* Doesn't change in runtime */
109 dev->hbuf_depth = (hcsr & H_CBD) >> 24;
110}
99/** 111/**
100 * mei_clear_interrupts - clear and stop interrupts 112 * mei_clear_interrupts - clear and stop interrupts
101 * 113 *
@@ -183,6 +195,7 @@ void mei_host_set_ready(struct mei_device *dev)
183 */ 195 */
184bool mei_host_is_ready(struct mei_device *dev) 196bool mei_host_is_ready(struct mei_device *dev)
185{ 197{
198 dev->host_hw_state = mei_hcsr_read(dev);
186 return (dev->host_hw_state & H_RDY) == H_RDY; 199 return (dev->host_hw_state & H_RDY) == H_RDY;
187} 200}
188 201
@@ -194,6 +207,7 @@ bool mei_host_is_ready(struct mei_device *dev)
194 */ 207 */
195bool mei_me_is_ready(struct mei_device *dev) 208bool mei_me_is_ready(struct mei_device *dev)
196{ 209{
210 dev->me_hw_state = mei_mecsr_read(dev);
197 return (dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA; 211 return (dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA;
198} 212}
199 213
@@ -313,7 +327,6 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header,
313 327
314 hcsr = mei_hcsr_read(dev) | H_IG; 328 hcsr = mei_hcsr_read(dev) | H_IG;
315 mei_hcsr_set(dev, hcsr); 329 mei_hcsr_set(dev, hcsr);
316 dev->me_hw_state = mei_mecsr_read(dev);
317 if (!mei_me_is_ready(dev)) 330 if (!mei_me_is_ready(dev))
318 return -EIO; 331 return -EIO;
319 332