*
* @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);
}
/**
{
u32 hcsr = mei_hcsr_read(dev);
hcsr |= H_IE;
- hcsr &= ~H_IS;
- mei_reg_write(dev, H_CSR, hcsr);
+ mei_hcsr_set(dev, hcsr);
}
/**
{
u32 hcsr = mei_hcsr_read(dev);
hcsr &= ~H_IE;
- hcsr &= ~H_IS;
- mei_reg_write(dev, H_CSR, hcsr);
+ mei_hcsr_set(dev, hcsr);
}
/**
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);
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
unsigned long rem, dw_cnt;
unsigned long length = header->length;
u32 *reg_buf = (u32 *)buf;
+ u32 hcsr;
int i;
int empty_slots;
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;
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);
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);
}