[dahdi-commits] dahdi/linux.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Sat Nov 16 16:20:19 CST 2013


branch "master" has been updated
       via  69a716af1a7481a94539f1e9c6dabe671e75339c (commit)
       via  eed2e4e00bad0e8bf2da05c8d05d05d11bde14c4 (commit)
      from  466acea7e028371294849efbafeb7b38334a7fd5 (commit)

Summary of changes:
 drivers/dahdi/firmware/Makefile |    2 +-
 drivers/dahdi/wcaxx-base.c      |    2 +-
 drivers/dahdi/wcxb.c            |   48 +++++++++++++++++++++++++++++++--------
 3 files changed, 40 insertions(+), 12 deletions(-)


- Log -----------------------------------------------------------------
commit 69a716af1a7481a94539f1e9c6dabe671e75339c
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Sat Nov 16 09:33:34 2013 -0600

    wcxb: Update the firmware meta block during flash update.
    
    The meta block contains specific version and checksum information and allows the
    test tools to validate the image in the flash.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/wcxb.c b/drivers/dahdi/wcxb.c
index 4c8f988..6266523 100644
--- a/drivers/dahdi/wcxb.c
+++ b/drivers/dahdi/wcxb.c
@@ -761,6 +761,12 @@ int wcxb_start(struct wcxb *xb)
 	return 0;
 }
 
+struct wcxb_meta_block {
+	__le32 chksum;
+	__le32 version;
+	__le32 size;
+} __packed;
+
 struct wcxb_firm_header {
 	u8	header[6];
 	__le32	chksum;
@@ -786,32 +792,54 @@ static int wcxb_update_firmware(struct wcxb *xb, const struct firmware *fw,
 				const char *filename)
 {
 	u32 tdm_control;
-	int offset = 0x200000;
-	const u8 *data, *end;
+	static const int APPLICATION_ADDRESS = 0x200000;
+	static const int META_BLOCK_OFFSET   = 0x170000;
+	static const int ERASE_BLOCK_SIZE    = 0x010000;
+	static const int END_OFFSET = APPLICATION_ADDRESS + META_BLOCK_OFFSET +
+			 ERASE_BLOCK_SIZE;
 	struct wcxb_spi_master *flash_spi_master;
 	struct wcxb_spi_device *flash_spi_device;
+	struct wcxb_meta_block meta;
+	int offset;
+	struct wcxb_firm_header *head = (struct wcxb_firm_header *)(fw->data);
+
+	if (fw->size > (META_BLOCK_OFFSET + sizeof(*head))) {
+		dev_err(&xb->pdev->dev,
+			"Firmware is too large to fit in available space.\n");
+
+		return -EINVAL;
+	}
+
+	meta.size = cpu_to_le32(fw->size);
+	meta.version = head->version;
+	meta.chksum = head->chksum;
 
 	flash_spi_master = wcxb_spi_master_create(&xb->pdev->dev,
 						  xb->membase + FLASH_SPI_BASE,
 						  false);
+
 	flash_spi_device = wcxb_spi_device_create(flash_spi_master, 0);
 
 	dev_info(&xb->pdev->dev,
 		"Uploading %s. This can take up to 30 seconds.\n", filename);
 
-	data  = &fw->data[sizeof(struct wcxb_firm_header)];
-	end = &fw->data[fw->size];
 
-	while (data < end) {
+	/* First erase all the blocks in the application area. */
+	offset = APPLICATION_ADDRESS;
+	while (offset < END_OFFSET) {
 		wcxb_flash_sector_erase(flash_spi_device, offset);
-		data += 0x10000;
-		offset += 0x10000;
+		offset += ERASE_BLOCK_SIZE;
 	}
 
-	data  = &fw->data[sizeof(struct wcxb_firm_header)];
-	offset = 0x200000;
+	/* Then write the new firmware file. */
+	wcxb_flash_write(flash_spi_device, APPLICATION_ADDRESS,
+			 &fw->data[sizeof(struct wcxb_firm_header)],
+			 fw->size - sizeof(struct wcxb_firm_header));
 
-	wcxb_flash_write(flash_spi_device, offset, data, end-data);
+	/* Finally, update the meta block. */
+	wcxb_flash_write(flash_spi_device,
+			 APPLICATION_ADDRESS + META_BLOCK_OFFSET,
+			 &meta, sizeof(meta));
 
 	/* Reset fpga after loading firmware */
 	dev_info(&xb->pdev->dev, "Firmware load complete. Reseting device.\n");

commit eed2e4e00bad0e8bf2da05c8d05d05d11bde14c4
Author: Shaun Ruffell <sruffell at digium.com>
Date:   Sat Nov 16 09:06:34 2013 -0600

    wcaxx: Update A4B firmware to version 0b0017
    
    Resolves some sporadic issues with invalid underruns.
    
    Signed-off-by: Shaun Ruffell <sruffell at digium.com>

diff --git a/drivers/dahdi/firmware/Makefile b/drivers/dahdi/firmware/Makefile
index 3aec364..06385dd 100644
--- a/drivers/dahdi/firmware/Makefile
+++ b/drivers/dahdi/firmware/Makefile
@@ -37,7 +37,7 @@ TE435_VERSION:=d0017
 A8A_VERSION:=1d0017
 A8B_VERSION:=1d0017
 A4A_VERSION:=a0017
-A4B_VERSION:=a0017
+A4B_VERSION:=b0017
 
 FIRMWARE_URL:=http://downloads.digium.com/pub/telephony/firmware/releases
 
diff --git a/drivers/dahdi/wcaxx-base.c b/drivers/dahdi/wcaxx-base.c
index c198a22..8d5af6b 100644
--- a/drivers/dahdi/wcaxx-base.c
+++ b/drivers/dahdi/wcaxx-base.c
@@ -3915,7 +3915,7 @@ static int wcaxx_check_firmware(struct wcaxx *wc)
 	u32 firmware_version;
 	const bool force_firmware = false;
 	const unsigned int A4A_VERSION = 0x0a0017;
-	const unsigned int A4B_VERSION = 0x0a0017;
+	const unsigned int A4B_VERSION = 0x0b0017;
 	const unsigned int A8A_VERSION = 0x1d0017;
 	const unsigned int A8B_VERSION = 0x1d0017;
 

-----------------------------------------------------------------------


-- 
dahdi/linux.git



More information about the dahdi-commits mailing list