aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/x300/lib
diff options
context:
space:
mode:
authorBen Hilburn <ben.hilburn@ettus.com>2014-02-14 12:05:07 -0800
committerBen Hilburn <ben.hilburn@ettus.com>2014-02-14 12:05:07 -0800
commitff1546f8137f7f92bb250f685561b0c34cc0e053 (patch)
tree7fa6fd05c8828df256a1b20e2935bd3ba9899e2c /firmware/x300/lib
parent4f691d88123784c2b405816925f1a1aef69d18c1 (diff)
downloaduhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.tar.gz
uhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.tar.bz2
uhd-ff1546f8137f7f92bb250f685561b0c34cc0e053.zip
Pushing the bulk of UHD-3.7.0 code.
Diffstat (limited to 'firmware/x300/lib')
-rw-r--r--firmware/x300/lib/chinch.c19
-rw-r--r--firmware/x300/lib/ethernet.c5
2 files changed, 13 insertions, 11 deletions
diff --git a/firmware/x300/lib/chinch.c b/firmware/x300/lib/chinch.c
index 054845754..e33378851 100644
--- a/firmware/x300/lib/chinch.c
+++ b/firmware/x300/lib/chinch.c
@@ -210,15 +210,18 @@ bool chinch_flash_write_buf(uint32_t offset, uint16_t* buf, uint32_t size)
STATUS_CHAIN(chinch_poke16(base_addr + (i * 2), buf[i]), status);
}
- //Commit write and poll until data is written
+ //Commit write
STATUS_CHAIN(chinch_poke16(CHINCH_FLASH_WINDOW_BASE, 0x0029), status);
- if (status) {
- uint16_t read_data;
- while (true) {
- STATUS_MERGE(chinch_flash_read(base_addr, &read_data), status); //Wait for write to finish
- if ((read_data == buf[0]) || !status) break;
- }
- }
+
+ //Poll for completion
+ //Bit 7 of the data at the final address is the status bit.
+ //It is set to the inverse of bit 7 of the final data to be
+ //written until the final write is completed.
+ uint32_t read_data;
+ do {
+ STATUS_MERGE(chinch_peek16(base_addr + ((size - 1) * 2), &read_data), status);
+ } while (status && (((uint16_t)read_data ^ buf[size - 1]) & (1 << 7)));
+
return status;
}
diff --git a/firmware/x300/lib/ethernet.c b/firmware/x300/lib/ethernet.c
index 806a3840d..fdde9e41b 100644
--- a/firmware/x300/lib/ethernet.c
+++ b/firmware/x300/lib/ethernet.c
@@ -336,9 +336,8 @@ xge_phy_init(const uint8_t eth, const uint32_t mdio_port)
x = read_mdio(eth, 0x0, XGE_MDIO_DEVICE_PMA,mdio_port);
x = x | (1 << 15);
write_mdio(eth, 0x0,XGE_MDIO_DEVICE_PMA,mdio_port,x);
- //FIXME uncomment lines below when 1gigE MDIO works
- //while(x&(1<<15))
- // x = read_mdio(eth, 0x0,XGE_MDIO_DEVICE_PMA,mdio_port);
+ while(x&(1<<15))
+ x = read_mdio(eth, 0x0,XGE_MDIO_DEVICE_PMA,mdio_port);
}
void