aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-01-08 16:07:30 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-08 19:40:47 -0500
commit88eb99f29c0026f4b7d7702652eb529f04c69073 (patch)
treec2e41a33c1757c77a8d1b6f39ea9030e3bc4565e
parent115ba28c5e075c6bffd8106a2b5e23db88d0c3b5 (diff)
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>
-rw-r--r--drivers/misc/mei/hw-me.c38
-rw-r--r--drivers/misc/mei/mei_dev.h1
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)
90 * 90 *
91 * @dev: the device structure 91 * @dev: the device structure
92 */ 92 */
93void mei_hcsr_set(struct mei_device *dev) 93static inline void mei_hcsr_set(struct mei_device *dev, u32 hcsr)
94{ 94{
95 95 hcsr &= ~H_IS;
96 if ((dev->host_hw_state & H_IS) == H_IS) 96 mei_reg_write(dev, H_CSR, hcsr);
97 dev->host_hw_state &= ~H_IS;
98 mei_reg_write(dev, H_CSR, dev->host_hw_state);
99 dev->host_hw_state = mei_hcsr_read(dev);
100} 97}
101 98
102/** 99/**
@@ -120,8 +117,7 @@ void mei_enable_interrupts(struct mei_device *dev)
120{ 117{
121 u32 hcsr = mei_hcsr_read(dev); 118 u32 hcsr = mei_hcsr_read(dev);
122 hcsr |= H_IE; 119 hcsr |= H_IE;
123 hcsr &= ~H_IS; 120 mei_hcsr_set(dev, hcsr);
124 mei_reg_write(dev, H_CSR, hcsr);
125} 121}
126 122
127/** 123/**
@@ -133,8 +129,7 @@ void mei_disable_interrupts(struct mei_device *dev)
133{ 129{
134 u32 hcsr = mei_hcsr_read(dev); 130 u32 hcsr = mei_hcsr_read(dev);
135 hcsr &= ~H_IE; 131 hcsr &= ~H_IE;
136 hcsr &= ~H_IS; 132 mei_hcsr_set(dev, hcsr);
137 mei_reg_write(dev, H_CSR, hcsr);
138} 133}
139 134
140/** 135/**
@@ -156,16 +151,12 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable)
156 else 151 else
157 hcsr &= ~H_IE; 152 hcsr &= ~H_IE;
158 153
159 hcsr &= ~H_IS; 154 mei_hcsr_set(dev, hcsr);
160
161 mei_reg_write(dev, H_CSR, hcsr);
162 hcsr = mei_hcsr_read(dev);
163 155
156 hcsr = mei_hcsr_read(dev) | H_IG;
164 hcsr &= ~H_RST; 157 hcsr &= ~H_RST;
165 hcsr |= H_IG;
166 hcsr &= ~H_IS;
167 158
168 mei_reg_write(dev, H_CSR, hcsr); 159 mei_hcsr_set(dev, hcsr);
169 160
170 hcsr = mei_hcsr_read(dev); 161 hcsr = mei_hcsr_read(dev);
171 162
@@ -182,7 +173,7 @@ void mei_hw_reset(struct mei_device *dev, bool intr_enable)
182void mei_host_set_ready(struct mei_device *dev) 173void mei_host_set_ready(struct mei_device *dev)
183{ 174{
184 dev->host_hw_state |= H_IE | H_IG | H_RDY; 175 dev->host_hw_state |= H_IE | H_IG | H_RDY;
185 mei_hcsr_set(dev); 176 mei_hcsr_set(dev, dev->host_hw_state);
186} 177}
187/** 178/**
188 * mei_host_is_ready - check whether the host has turned ready 179 * 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,
295 unsigned long rem, dw_cnt; 286 unsigned long rem, dw_cnt;
296 unsigned long length = header->length; 287 unsigned long length = header->length;
297 u32 *reg_buf = (u32 *)buf; 288 u32 *reg_buf = (u32 *)buf;
289 u32 hcsr;
298 int i; 290 int i;
299 int empty_slots; 291 int empty_slots;
300 292
@@ -319,9 +311,8 @@ int mei_write_message(struct mei_device *dev, struct mei_msg_hdr *header,
319 mei_reg_write(dev, H_CB_WW, reg); 311 mei_reg_write(dev, H_CB_WW, reg);
320 } 312 }
321 313
322 dev->host_hw_state = mei_hcsr_read(dev); 314 hcsr = mei_hcsr_read(dev) | H_IG;
323 dev->host_hw_state |= H_IG; 315 mei_hcsr_set(dev, hcsr);
324 mei_hcsr_set(dev);
325 dev->me_hw_state = mei_mecsr_read(dev); 316 dev->me_hw_state = mei_mecsr_read(dev);
326 if (!mei_me_is_ready(dev)) 317 if (!mei_me_is_ready(dev))
327 return -EIO; 318 return -EIO;
@@ -366,6 +357,7 @@ void mei_read_slots(struct mei_device *dev, unsigned char *buffer,
366 unsigned long buffer_length) 357 unsigned long buffer_length)
367{ 358{
368 u32 *reg_buf = (u32 *)buffer; 359 u32 *reg_buf = (u32 *)buffer;
360 u32 hcsr;
369 361
370 for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32)) 362 for (; buffer_length >= sizeof(u32); buffer_length -= sizeof(u32))
371 *reg_buf++ = mei_mecbrw_read(dev); 363 *reg_buf++ = mei_mecbrw_read(dev);
@@ -375,7 +367,7 @@ void mei_read_slots(struct mei_device *dev, unsigned char *buffer,
375 memcpy(reg_buf, &reg, buffer_length); 367 memcpy(reg_buf, &reg, buffer_length);
376 } 368 }
377 369
378 dev->host_hw_state |= H_IG; 370 hcsr = mei_hcsr_read(dev) | H_IG;
379 mei_hcsr_set(dev); 371 mei_hcsr_set(dev, hcsr);
380} 372}
381 373
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);
387 387
388void mei_hw_reset(struct mei_device *dev, bool intr_enable); 388void mei_hw_reset(struct mei_device *dev, bool intr_enable);
389u32 mei_hcsr_read(const struct mei_device *dev); 389u32 mei_hcsr_read(const struct mei_device *dev);
390void mei_hcsr_set(struct mei_device *dev);
391u32 mei_mecsr_read(const struct mei_device *dev); 390u32 mei_mecsr_read(const struct mei_device *dev);
392u32 mei_mecbrw_read(const struct mei_device *dev); 391u32 mei_mecbrw_read(const struct mei_device *dev);
393 392