|
@@ -894,7 +894,8 @@ void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id)
|
|
static int
|
|
static int
|
|
ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
|
|
ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
|
|
{
|
|
{
|
|
- u32 temp = 0, counter = 1000;
|
|
|
|
|
|
+ u32 counter = 1000;
|
|
|
|
+ struct temp_sensor_registers *tsr;
|
|
|
|
|
|
/* Select single conversion mode */
|
|
/* Select single conversion mode */
|
|
if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
|
|
if (TI_BANDGAP_HAS(bgp, MODE_CONFIG))
|
|
@@ -902,16 +903,27 @@ ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id)
|
|
|
|
|
|
/* Start of Conversion = 1 */
|
|
/* Start of Conversion = 1 */
|
|
RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 1);
|
|
RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 1);
|
|
- /* Wait until DTEMP is updated */
|
|
|
|
- temp = ti_bandgap_read_temp(bgp, id);
|
|
|
|
|
|
|
|
- while ((temp == 0) && --counter)
|
|
|
|
- temp = ti_bandgap_read_temp(bgp, id);
|
|
|
|
- /* REVISIT: Check correct condition for end of conversion */
|
|
|
|
|
|
+ /* Wait for EOCZ going up */
|
|
|
|
+ tsr = bgp->conf->sensors[id].registers;
|
|
|
|
+
|
|
|
|
+ while (--counter) {
|
|
|
|
+ if (ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) &
|
|
|
|
+ tsr->bgap_eocz_mask)
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
/* Start of Conversion = 0 */
|
|
/* Start of Conversion = 0 */
|
|
RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 0);
|
|
RMW_BITS(bgp, id, temp_sensor_ctrl, bgap_soc_mask, 0);
|
|
|
|
|
|
|
|
+ /* Wait for EOCZ going down */
|
|
|
|
+ counter = 1000;
|
|
|
|
+ while (--counter) {
|
|
|
|
+ if (!(ti_bandgap_readl(bgp, tsr->temp_sensor_ctrl) &
|
|
|
|
+ tsr->bgap_eocz_mask))
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|