When I originally wrote the w1c helper funcs, I used it in a few places.
Then I forgot how it worked and when I later documented it, I described
the 3rd arg in the exact opposite way it is actually used. This error
propagated to a bunch of devices registers that were not explicitly
tested (a bunch of the devices are stubs which merely exist to say "no
device is connected" to make device drivers happy).
So once the documentation is unscrewed, fix all of the broken call sites.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+2011-03-23 Mike Frysinger <vapier@gentoo.org>
+
+ * devices.h (dv_w1c): Fix typos in documentation of "bits" arg.
+ * dv-bfin_cec.c (bfin_cec_io_write_buffer): Pass 0xffee to dv_w1c_4.
+ * dv-bfin_emac.c (bfin_emac_io_write_buffer): Pass 0xe1 to dv_w1c_4
+ for systat MMR and -1 to dv_w1c_4 for [rt]x_stky/mmc_[rt]irqs MMRs.
+ * dv-bfin_eppi.c (bfin_eppi_io_write_buffer): Pass 0x1ff to dv_w1c_2.
+ * dv-bfin_gpio.c (bfin_gpio_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_jtag.c (bfin_jtag_io_write_buffer): Invert bits to dv_w1c_4.
+ * dv-bfin_nfc.c (bfin_nfc_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_otp.c (bfin_otp_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_ppi.c (bfin_ppi_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_rtc.c (bfin_rtc_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_spi.c (bfin_spi_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_twi.c (bfin_twi_io_write_buffer): Invert bits to dv_w1c_2.
+ * dv-bfin_uart2.c (bfin_uart_io_write_buffer): Invert bits to dv_w1c_2.
+
2011-03-23 Mike Frysinger <vapier@gentoo.org>
* dv-bfin_uart.h (TFI, BI, FE, PE, OE): Define.
dv_store_2 (ptr, val);
}
\f
-/* Helpers for MMRs where all bits are W1C except for the specified
- bits -- those ones are RO. */
+/* Helpers for MMRs where only the specified bits are W1C. The
+ rest are left unmodified. */
#define dv_w1c(ptr, val, bits) (*(ptr) &= ~((val) & (bits)))
static inline void dv_w1c_2 (bu16 *ptr, bu16 val, bu16 bits)
{
/* Read-only register. */
break;
case mmr_offset(ilat):
- dv_w1c_4 (&cec->ilat, value, 0);
+ dv_w1c_4 (&cec->ilat, value, 0xffee);
break;
case mmr_offset(iprio):
cec->iprio = (value & IVG_UNMASKABLE_B);
dv_w1c_4_partial (valuep, value, 0xf20);
break;
case mmr_offset(systat):
- dv_w1c_4 (valuep, value, 0x1e);
+ dv_w1c_4 (valuep, value, 0xe1);
break;
case mmr_offset(staadd):
*valuep = value | STABUSY;
case mmr_offset(tx_stky):
case mmr_offset(mmc_rirqs):
case mmr_offset(mmc_tirqs):
- dv_w1c_4 (valuep, value, 0);
+ dv_w1c_4 (valuep, value, -1);
break;
case mmr_offset(mmc_ctl):
/* Writing to bit 0 clears all counters. */
{
case mmr_offset(status):
dv_bfin_mmr_require_16 (me, addr, nr_bytes, true);
- dv_w1c_2 (value16p, value, 0);
+ dv_w1c_2 (value16p, value, 0x1ff);
break;
case mmr_offset(hcount):
case mmr_offset(hdelay):
case mmr_offset(clear):
case mmr_offset(maska_clear):
case mmr_offset(maskb_clear):
- dv_w1c_2 (valuep, value, 0);
+ dv_w1c_2 (valuep, value, -1);
break;
case mmr_offset(set):
case mmr_offset(maska_set):
switch (mmr_off)
{
case mmr_offset(dbgstat):
- dv_w1c_4 (valuep, value, ~0xc);
+ dv_w1c_4 (valuep, value, 0xc);
break;
case mmr_offset(dspid):
/* Discard writes to these. */
*valuep = value;
break;
case mmr_offset(irqstat):
- dv_w1c_2 (valuep, value, 0);
+ dv_w1c_2 (valuep, value, -1);
break;
default:
dv_bfin_mmr_invalid (me, addr, nr_bytes, true);
case mmr_offset(status):
dv_bfin_mmr_require_16 (me, addr, nr_bytes, true);
/* XXX: All bits seem to be W1C. */
- dv_w1c_2 (value16p, value, 0);
+ dv_w1c_2 (value16p, value, -1);
break;
case mmr_offset(timing):
case mmr_offset(data0):
*valuep = value;
break;
case mmr_offset(status):
- dv_w1c_2 (valuep, value, (1 << 10));
+ dv_w1c_2 (valuep, value, ~(1 << 10));
break;
default:
dv_bfin_mmr_invalid (me, addr, nr_bytes, true);
/* XXX: Ignore these since we are wired to host. */
break;
case mmr_offset(istat):
- dv_w1c_2 (value16p, value, 1 << 14);
+ dv_w1c_2 (value16p, value, ~(1 << 14));
break;
case mmr_offset(alarm):
break;
switch (mmr_off)
{
case mmr_offset(stat):
- dv_w1c_2 (valuep, value, SPIF | TXS | RXS);
+ dv_w1c_2 (valuep, value, ~(SPIF | TXS | RXS));
break;
case mmr_offset(tdbr):
*valuep = value;
*valuep = value;
break;
case mmr_offset(int_stat):
- dv_w1c_2 (valuep, value, 0);
+ dv_w1c_2 (valuep, value, -1);
break;
case mmr_offset(master_stat):
- dv_w1c_2 (valuep, value, MPROG | SDASEN | SCLSEN | BUSBUSY);
+ dv_w1c_2 (valuep, value, BUFWRERR | BUFRDERR | DNAK | ANAK | LOSTARB);
break;
case mmr_offset(slave_stat):
case mmr_offset(fifo_stat):
uart->ier |= value;
break;
case mmr_offset(ier_clear):
- dv_w1c_2 (&uart->ier, value, 0);
+ dv_w1c_2 (&uart->ier, value, -1);
break;
case mmr_offset(lsr):
- dv_w1c_2 (valuep, value, TEMT | THRE | DR);
+ dv_w1c_2 (valuep, value, TFI | BI | FE | PE | OE);
break;
case mmr_offset(rbr):
/* XXX: Writes are ignored ? */