You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(9) |
Aug
(16) |
Sep
(11) |
Oct
(113) |
Nov
(136) |
Dec
(123) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(61) |
Feb
(42) |
Mar
(114) |
Apr
(34) |
May
(5) |
Jun
(26) |
Jul
(4) |
Aug
(29) |
Sep
(62) |
Oct
(24) |
Nov
(3) |
Dec
(9) |
2005 |
Jan
(23) |
Feb
(8) |
Mar
(36) |
Apr
(75) |
May
(10) |
Jun
(109) |
Jul
(54) |
Aug
(135) |
Sep
(163) |
Oct
(83) |
Nov
(32) |
Dec
(44) |
2006 |
Jan
(134) |
Feb
(78) |
Mar
(27) |
Apr
(10) |
May
(16) |
Jun
(5) |
Jul
(6) |
Aug
(3) |
Sep
(6) |
Oct
(2) |
Nov
|
Dec
(9) |
2007 |
Jan
(8) |
Feb
(4) |
Mar
(2) |
Apr
|
May
(7) |
Jun
(14) |
Jul
(16) |
Aug
(4) |
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
(27) |
Jun
(2) |
Jul
(29) |
Aug
(5) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(5) |
2009 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(3) |
Nov
|
Dec
|
2010 |
Jan
(9) |
Feb
|
Mar
(7) |
Apr
(5) |
May
(2) |
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(152) |
May
(248) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(8) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
(2) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(4) |
Nov
|
Dec
|
From: Oliver W. <oli...@ol...> - 2012-05-06 10:56:53
|
Hi Jim, Ok, the series's are applied and pushed! Thanks a lot :)! Great, how the merge is progressing :)! The push contains also different changes and commits from my side. You'll see again. Now I just see another bunch incoming ;) - overlapping while I'm typing this. I need to see, when I can pull these in. Maybe still today, but I need to see. G+, Oliver On 05/05/2012 10:56 PM, Jim Cromie wrote: > hi Oliver, > > This continues the set some more, on top of master at: > 8cce1c7 mem-inlines.h: Initialize acxmem_lock_flags=0 > > 1-27 as sent previously. > > 0028-pci.c-banish-acxpci_reset_dev.patch > 0029-merge-acx-mem-pci-_read_cmd_type_status.patch > 0030-merge-acx-mem-pci-_write_cmd_type_status.patch > 0031-merge-acx-mem-pci-_init_mboxes.patch > 0032-merge.c-acx-mem-pci-_write_fw-compile-test.patch > 0033-merge-use-merged-acx_write_fw.patch > 0034-merge.c-acx-mem-pci-_validate_fw-compile-test.patch > 0035-merge-use-merged-acx_validate_fw.patch > 0036-merge-use-merged-acxmem_upload_fw-for-mem-driver.patch |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:45
|
Add #if/#else/#endif on CONFIG_ACX_MAC80211_MEM, with static inline stub functions to provide the right fn-protos. Added an #if guard to 1 func in merge.c, and stub in merge.h; the func should probably be moved back to mem.c Signed-off-by: Jim Cromie <jim...@gm...> --- mem.h | 83 +++++++++++++++++++++++++++++++++++++++++++++++++------------- merge.c | 6 ++++- merge.h | 24 ++++++------------ 3 files changed, 78 insertions(+), 35 deletions(-) diff --git a/mem.h b/mem.h index 17c8bad..1db3d6b 100644 --- a/mem.h +++ b/mem.h @@ -8,12 +8,16 @@ #define STATick /* ick: suppress static, let linker find fns in mem.o pci.o */ +#if defined(CONFIG_ACX_MAC80211_MEM) + #define DUMP_MEM_DEFINED 1 // to insure export of dump* fns too // Logging #if DUMP_MEM_DEFINED > 0 void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); +#else +inline void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) { } #endif void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, @@ -23,26 +27,18 @@ void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -// Firmware, EEPROM, Phy - -int acxmem_upload_radio(acx_device_t *adev); +// in merge.c ! +// int acxmem_upload_radio(acx_device_t *adev); int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -// CMDs (Control Path) - void acxmem_reset_mac(acx_device_t *adev); -// Other (Control Path) - -// Proc, Debug int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -// Rx Path -// Tx Path tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); @@ -50,16 +46,67 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); void acxmem_init_acx_txbuf2(acx_device_t *adev); -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); - -// Irq Handling, Timer -// Helpers -// Ioctls -// Driver, Module - int __init acxmem_init_module(void); void __exit acxmem_cleanup_module(void); void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acxmem_init_mboxes(acx_device_t *adev); - + + +#else // CONFIG_ACX_MAC80211_MEM + + +static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) { } + +static inline void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, + u8 *source, int count) +{ } + +static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, + u32 destination, u8 *source, int count) +{ } + +static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, + u8 *destination, u32 source, int count) +{ } + +//inline int acxmem_upload_radio(acx_device_t *adev) +//{ return 0; } + +static inline int acxmem_write_fw(acx_device_t *adev, + const firmware_image_t *fw_image, u32 offset) +{ return 0; } + +static inline int acxmem_validate_fw(acx_device_t *adev, + const firmware_image_t *fw_image, u32 offset) +{ return 0; } + +static inline void acxmem_reset_mac(acx_device_t *adev) { } + +static inline int acxmem_proc_diag_output(struct seq_file *file, + acx_device_t *adev) +{ return 0; } + +static inline tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) +{ return (tx_t*) NULL; } + +static inline void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) +{ } + +static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, + int count) +{ return 0; } + +static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) { } + +static inline int __init acxmem_init_module(void) { return 0; } +static inline void __exit acxmem_cleanup_module(void) { } + +static inline void acxmem_write_cmd_type_status(acx_device_t *adev, + u16 type, u16 status) +{ } + +static inline void acxmem_init_mboxes(acx_device_t *adev) { } + + +#endif // CONFIG_ACX_MAC80211_MEM diff --git a/merge.c b/merge.c index b3a8fad..dbef0c6 100644 --- a/merge.c +++ b/merge.c @@ -3489,7 +3489,10 @@ void acx_clean_txdesc_emergency(acx_device_t *adev) FN_EXIT0; } -void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { +#if defined(CONFIG_ACX_MAC80211_MEM) +// probly should move this back to merge.c +void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) +{ #ifdef USING_MORE_THAN_ONE_TRANSMIT_QUEUE u32 indicator; unsigned long flags; @@ -3549,6 +3552,7 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { local_irq_restore (flags); #endif } +#endif // CONFIG_ACX_MAC80211_MEM) acxmem_update_queue_indicator() // OW TODO See if this is usable with mac80211 #if 0 diff --git a/merge.h b/merge.h index 8cb48e2..009df61 100644 --- a/merge.h +++ b/merge.h @@ -76,26 +76,18 @@ int acxmem_upload_fw(acx_device_t *adev); void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start); +/* wrappers on acx_upload_radio(adev, filename */ +int acxmem_upload_radio(acx_device_t *adev); +int acxpci_upload_radio(acx_device_t *adev); -#if !defined(CONFIG_ACX_MAC80211_MEM) +#if defined(CONFIG_ACX_MAC80211_MEM) -static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, - int count) -{ return 0; } +void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, - u32 destination, u8 *source, int count) -{ } - -static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, - u8 *destination, u32 source, int count) -{ } - -static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) -{ } +#else -static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, - int length) +static inline void acxmem_update_queue_indicator(acx_device_t *adev, + int txqueue) { } #endif -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:43
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 83 +++++--------------------------------------------------------- 1 files changed, 7 insertions(+), 76 deletions(-) diff --git a/merge.c b/merge.c index 1d1c462..b3a8fad 100644 --- a/merge.c +++ b/merge.c @@ -1840,48 +1840,12 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, #define REG_ACX_VENDOR_ID 0x900 #define ACX_VENDOR_ID 0x8400104c -#if 0 // unused yet, review before #if1 -static int acxmem_verify_init(acx_device_t *adev) { - int result = NOT_OK; - unsigned long timeout; - u32 irqstat; - - acxmem_lock_flags; - - FN_ENTER; - - timeout = jiffies + 2 * HZ; - for (;;) { - acxmem_lock(); - irqstat = read_reg32(adev, IO_ACX_IRQ_STATUS_NON_DES); - if ((irqstat != 0xFFFFFFFF) - && (irqstat & HOST_INT_FCS_THRESHOLD)) { - result = OK; - write_reg32(adev, IO_ACX_IRQ_ACK, - HOST_INT_FCS_THRESHOLD); - acxmem_unlock(); - break; - } - acxmem_unlock(); - - if (time_after(jiffies, timeout)) - break; - /* Init may take up to ~0.5 sec total */ - acx_mwait(50); - } - - FN_EXIT1(result); - return result; -} -#endif // acxmem_verify_init() /* * BOM Init, Configure (Control Path) * ================================================== */ - - /* * acxmem_l_reset_mac * @@ -2209,7 +2173,7 @@ static void acxmem_init_acx_txbuf(acx_device_t *adev) { * reset, so the ACX memory is in the state we want. */ } -#endif +#endif // acxmem_init_acx_txbuf() /* * Most of the acx specific pieces of hardware reset. @@ -2271,7 +2235,7 @@ static int acxmem_complete_hw_reset(acx_device_t *adev) return 0; } -#endif +#endif // acxmem_complete_hw_reset() #if 0 /*********************************************************************** @@ -2701,7 +2665,7 @@ static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len) { return (blocks_needed); } -#if 0 +#if 0 // acxmem_get_txdesc() static inline txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) { @@ -2719,6 +2683,7 @@ txdesc_t* acxmem_get_txdesc(acx_device_t *adev, int index) * sufficiently many. */ // OW TODO Align with pci.c +#if 1 // acxmem_alloc_tx() tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { struct txdesc *txdesc; unsigned head; @@ -2833,6 +2798,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { return (tx_t*) txdesc; } +#endif // acxmem_alloc_tx() /* * acxmem_l_dealloc_tx @@ -2844,6 +2810,7 @@ tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len) { * state and move the queue head pointer back. * */ +#if 1 // acxmem_dealloc_tx() void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { /* * txdesc is the address of the descriptor on the ACX. @@ -2878,6 +2845,7 @@ void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque) { acxmem_unlock(); } +#endif // acxmem_dealloc_tx() #endif // CONFIG_ACX_MAC80211_MEM /* @@ -2991,43 +2959,6 @@ static void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } -/* Re-initialize tx-buffer list - */ -#if 0 // none in pci, doesnt belong here -void acxmem_init_acx_txbuf2(acx_device_t *adev) { - - int i; - u32 adr, next_adr; - - adr = adev->acx_txbuf_start; - for (i = 0; i < adev->acx_txbuf_numblocks; i++) { - next_adr = adr + adev->memblocksize; - - // Last block is marked with 0x02000000 - if (i == adev->acx_txbuf_numblocks - 1) { - write_slavemem32(adev, adr, 0x02000000); - } - // Else write pointer to next block - else { - write_slavemem32(adev, adr, (next_adr >> 5)); - } - adr = next_adr; - } - - adev->acx_txbuf_free = adev->acx_txbuf_start; - adev->acx_txbuf_blocks_free = adev->acx_txbuf_numblocks; - -} -#endif - -#if 0 // replaced by merge.h:acx_advance_txdesc() -// static inline -txdesc_t* -acxmem_advance_txdesc(acx_device_t *adev, txdesc_t* txdesc, int inc) { - return (txdesc_t*) (((u8*) txdesc) + inc * adev->txdesc_size); -} -#endif // acxmem_advance_txdesc() - static txhostdesc_t *acx_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc) { int index = (u8 *) txdesc - (u8 *) adev->txdesc_start; -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:42
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.h | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/merge.h b/merge.h index 5c1e50e..8cb48e2 100644 --- a/merge.h +++ b/merge.h @@ -68,9 +68,9 @@ u32 acx_read_cmd_type_status(acx_device_t *adev); void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acx_init_mboxes(acx_device_t *adev); int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); + u32 offset); int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, - u32 offset); + u32 offset); int acxmem_upload_fw(acx_device_t *adev); void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, @@ -79,26 +79,23 @@ void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, #if !defined(CONFIG_ACX_MAC80211_MEM) -static inline -u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) +static inline u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, + int count) { return 0; } -static inline -void acxmem_chaincopy_to_slavemem(acx_device_t *adev, +static inline void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count) { } -static inline -void acxmem_chaincopy_from_slavemem(acx_device_t *adev, +static inline void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count) { } -static inline -void acxmem_init_acx_txbuf2(acx_device_t *adev) +static inline void acxmem_init_acx_txbuf2(acx_device_t *adev) { } -static inline -void acxmem_dump_mem(acx_device_t *adev, u32 start, int length) +static inline void acxmem_dump_mem(acx_device_t *adev, u32 start, + int length) { } #endif -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:40
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 733 ----------------------------------------------------------------- pci.c | 575 --------------------------------------------------- 2 files changed, 0 insertions(+), 1308 deletions(-) diff --git a/mem.c b/mem.c index 4e326d1..a77489b 100644 --- a/mem.c +++ b/mem.c @@ -420,68 +420,6 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, } } -/* - * acxmem_s_create_rx_host_desc_queue - * - * the whole size of a data buffer (header plus data body) plus 32 - * bytes safety offset at the end - */ -//static -#if 0 // acxmem_create_rx_host_desc_queue() -int acxmem_create_rx_host_desc_queue(acx_device_t *adev) -{ - rxhostdesc_t *hostdesc; - rxbuffer_t *rxbuf; - int i; - - FN_ENTER; - - /* allocate the RX host descriptor queue pool */ - adev->rxhostdesc_area_size = RX_CNT * sizeof(*hostdesc); - - adev->rxhostdesc_start = acx_allocate(adev, - adev->rxhostdesc_area_size, - &adev->rxhostdesc_startphy, "rxhostdesc_start"); - if (!adev->rxhostdesc_start) - goto fail; - - /* check for proper alignment of RX host descriptor pool */ - if ((long) adev->rxhostdesc_start & 3) { - pr_acx("driver bug: dma alloc returns unaligned address\n"); - goto fail; - } - - /* allocate Rx buffer pool which will be used by the acx to - * store the whole content of the received frames in it */ - adev->rxbuf_area_size = RX_CNT * RX_BUFFER_SIZE; - - adev->rxbuf_start - = acx_allocate(adev, adev->rxbuf_area_size, - &adev->rxbuf_startphy, "rxbuf_start"); - if (!adev->rxbuf_start) - goto fail; - - rxbuf = adev->rxbuf_start; - hostdesc = adev->rxhostdesc_start; - - /* don't make any popular C programming pointer arithmetic - * mistakes here, otherwise I'll kill you... (and don't dare - * asking me why I'm warning you about that...) */ - for (i = 0; i < RX_CNT; i++) { - hostdesc->data = rxbuf; - hostdesc->hd.length = cpu_to_le16(RX_BUFFER_SIZE); - rxbuf++; - hostdesc++; - } - hostdesc--; - FN_EXIT1(OK); - return OK; - fail: pr_acx("create_rx_host_desc_queue FAILED\n"); - /* dealloc will be done by free function on error case */ - FN_EXIT1(NOT_OK); - return NOT_OK; -} -#endif // acxmem_create_rx_host_desc_queue() /* * In the generic slave memory access mode, most of the stuff in the @@ -492,50 +430,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) * way out. */ -#if 0 // acxmem_create_desc_queues() -void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start) -{ - u32 *p; - int i; - - acxmem_lock_flags; - acxmem_lock(); - - acx_create_tx_desc_queue(adev, tx_queue_start); - acx_create_rx_desc_queue(adev, rx_queue_start); - p = (u32 *) adev->acx_queue_indicator; - for (i = 0; i < 4; i++) { - write_slavemem32(adev, (u32) p, 0); - p++; - } - acxmem_unlock(); -} -#endif // acxmem_create_desc_queues() -#if 0 -STATick void acxmem_delete_dma_regions(acx_device_t *adev) { - - //unsigned long flags; - - FN_ENTER; - /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's - * no longer possible here? */ - /* - * slave memory interface really doesn't like this. - */ - /* - write_reg16(adev, IO_ACX_ENABLE, 0); - */ - - acx_mwait(100); - - acx_free_desc_queues(adev); - - FN_EXIT0; -} -#endif // acxmem_delete_dma_regions() /* * BOM Firmware, EEPROM, Phy @@ -651,328 +546,7 @@ STATick inline void acxmem_read_eeprom_area(acx_device_t *adev) { #endif } -#if 0 // copied to merge.c -int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { - int count; - acxmem_lock_flags; - - FN_ENTER; - acxmem_lock(); - /* mprusko said that 32bit accesses result in distorted - * sensitivity on his card. Unconfirmed, looks like it's not - * true (most likely since we now properly flush writes). */ - write_reg32(adev, IO_ACX_PHY_DATA, value); - write_reg32(adev, IO_ACX_PHY_ADDR, reg); - write_flush(adev); - write_reg32(adev, IO_ACX_PHY_CTL, 1); - write_flush(adev); - - count = 0xffff; - while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop doesn't - * seem to work here at all: awful delay, sometimes - * also failure. Doesn't matter anyway (only small - * delay). */ - if (unlikely(!--count)) { - pr_acx("%s: timeout waiting for phy read\n", - wiphy_name(adev->ieee->wiphy)); - goto fail; - } - cpu_relax(); - } - - log(L_DEBUG, "radio PHY write 0x%02X at 0x%04X\n", value, reg); - fail: - - acxmem_unlock(); - FN_EXIT1(OK); - return OK; -} -#endif - -/* - * acxmem_s_write_fw - * - * Write the firmware image into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * 1 firmware image corrupted - * 0 success - */ - -#if 0 // acxmem_write_fw() - copied to merge, but needs work -- test now -// static - probly could restore, but.. -int acxmem_write_fw(acx_device_t *adev, - const firmware_image_t *fw_image, u32 offset) { - int len, size, checkMismatch = -1; - u32 sum, v32, tmp, id; - - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8*) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ - write_flush(adev); -#endif -#endif - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32*)p); - sum += p[0] + p[1] + p[2] + p[3]; - p += 4; - len += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); - write_flush(adev); -#endif - write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32); - write_flush(adev); -#endif - write_slavemem32(adev, offset + len - 4, v32); - - id = read_id_register(adev); - - /* - * check the data written - */ - tmp = read_slavemem32(adev, offset + len - 4); - if (checkMismatch && (tmp != v32)) { - pr_info("first data mismatch at 0x%08x good 0x%08x" - " bad 0x%08x id 0x%08x\n", - offset + len - 4, v32, tmp, id); - checkMismatch = 0; - } - } - log(L_DEBUG, "firmware written, size:%d sum1:%x sum2:%x\n", - size, sum, le32_to_cpu(fw_image->chksum)); - - /* compare our checksum with the stored image checksum */ - FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); - return (sum != le32_to_cpu(fw_image->chksum)); -} -#endif // - -/* - * acxmem_s_validate_fw - * - * Compare the firmware image given with - * the firmware image written into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * NOT_OK firmware image corrupted or not correctly written - * OK success - */ -// static -#if 0 // acxmem_validate_fw() -int acxmem_validate_fw(acx_device_t *adev, - const firmware_image_t *fw_image, u32 offset) -{ - u32 sum, v32, w32; - int len, size; - int result = OK; - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8*) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ -#endif - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32*)p); - p += 4; - len += 4; - -#ifdef NOPE -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); -#endif - udelay(10); - w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); -#endif - - w32 = read_slavemem32(adev, offset + len - 4); - - if (unlikely(w32 != v32)) { - pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " - "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", - len, v32, w32); - result = NOT_OK; - break; - } - - sum += (u8) w32 - + (u8) (w32 >> 8) - + (u8) (w32 >> 16) - + (u8) (w32 >> 24); - } - - /* sum control verification */ - if (result != NOT_OK) { - if (sum != le32_to_cpu(fw_image->chksum)) { - pr_acx("FATAL: firmware upload: " - "checksums don't match!\n"); - result = NOT_OK; - } - } - - FN_EXIT1(result); - return result; -} -#endif // acxmem_validate_fw() - -#if 0 // acxmem_upload_fw() -STATick int acxmem_upload_fw(acx_device_t *adev) { - firmware_image_t *fw_image = NULL; - int res = NOT_OK; - int try; - u32 file_size; - char *filename = "WLANGEN.BIN"; - - acxmem_lock_flags; - -#ifdef PATCH_AROUND_BAD_SPOTS - u32 offset; - int i; - /* - * arm-linux-objdump -d patch.bin, or - * od -Ax -t x4 patch.bin after finding the bounds - * of the .text section with arm-linux-objdump -s patch.bin - */ - u32 patch[] = { 0xe584c030, 0xe59fc008, 0xe92d1000, 0xe59fc004, 0xe8bd8000, - 0x0000080c, 0x0000aa68, 0x605a2200, 0x2c0a689c, 0x2414d80a, - 0x2f00689f, 0x1c27d007, 0x06241e7c, 0x2f000e24, 0xe000d1f6, - 0x602e6018, 0x23036468, 0x480203db, 0x60ca6003, 0xbdf0750a, - 0xffff0808 }; -#endif - - FN_ENTER; - - /* No combined image; tell common we need the radio firmware, too */ - adev->need_radio_fw = 1; - - fw_image = acx_read_fw(adev->bus_dev, filename, &file_size); - if (!fw_image) { - FN_EXIT1(NOT_OK); - return NOT_OK; - } - - for (try = 1; try <= 5; try++) { - - acxmem_lock(); - res = acx_write_fw(adev, fw_image, 0); - log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); - if (OK == res) { - res = acx_validate_fw(adev, fw_image, 0); - log(L_DEBUG|L_INIT, "acx_validate_fw " - "(main): %d\n", res); - } - acxmem_unlock(); - - if (OK == res) { - SET_BIT(adev->dev_state_mask, ACX_STATE_FW_LOADED); - break; - } - pr_acx("firmware upload attempt #%d FAILED, " - "retrying...\n", try); - acx_mwait(1000); /* better wait for a while... */ - } - -#ifdef PATCH_AROUND_BAD_SPOTS - acxmem_lock(); - /* - * Only want to do this if the firmware is exactly what we - * expect for an iPaq 4700; otherwise, bad things would ensue. - */ - if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum) - || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) { - /* - * Put the patch after the main firmware image. - * 0x950c contains the ACX's idea of the end of the - * firmware. Use that location to load ours (which - * depends on that location being 0xab58) then update - * that location to point to after ours. - */ - - offset = read_slavemem32(adev, 0x950c); - - log (L_DEBUG, "patching in at 0x%04x\n", offset); - - for (i = 0; i < sizeof(patch) / sizeof(patch[0]); i++) { - write_slavemem32(adev, offset, patch[i]); - offset += sizeof(u32); - } - - /* - * Patch the instruction at 0x0804 to branch to our - * ARM patch at 0xab58 - */ - write_slavemem32(adev, 0x0804, 0xea000000 + (0xab58 - 0x0804 - 8) / 4); - - /* - * Patch the instructions at 0x1f40 to branch to our - * Thumb patch at 0xab74 - * - * 4a00 ldr r2, [pc, #0] - * 4710 bx r2 - * .data 0xab74+1 - */ - write_slavemem32(adev, 0x1f40, 0x47104a00); - write_slavemem32(adev, 0x1f44, 0x0000ab74 + 1); - - /* - * Bump the end of the firmware up to beyond our patch. - */ - write_slavemem32(adev, 0x950c, offset); - - } - acxmem_unlock(); -#endif - - vfree(fw_image); - - FN_EXIT1(res); - return res; -} -#endif // acxmem_upload_fw() /* * BOM CMDs (Control Path) @@ -1211,223 +785,12 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } #endif -#if 0 // acxmem_write_cmd_type_status() -void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) -{ - FN_ENTER; - write_slavemem32(adev, (u32) adev->cmd_area, type | (status << 16)); - write_flush(adev); - FN_EXIT0; -} -#endif // acxmem_write_cmd_type_status() - -#if 0 // acxmem_read_cmd_type_status() -STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { - u32 cmd_type, cmd_status; - - FN_ENTER; - - cmd_type = read_slavemem32(adev, (u32) adev->cmd_area); - - cmd_status = (cmd_type >> 16); - cmd_type = (u16) cmd_type; - - log(L_DEBUG, "%s: " - "cmd_type:%04X cmd_status:%04X [%s]\n", - __func__, - cmd_type, cmd_status, - acx_cmd_status_str(cmd_status)); - - FN_EXIT1(cmd_status); - return cmd_status; -} -#endif // acxmem_read_cmd_type_status() - -//STATick inline -#if 0 // acxmem_init_mboxes() -void acxmem_init_mboxes(acx_device_t *adev) -{ - u32 cmd_offs, info_offs; - - FN_ENTER; - - cmd_offs = read_reg32(adev, IO_ACX_CMD_MAILBOX_OFFS); - info_offs = read_reg32(adev, IO_ACX_INFO_MAILBOX_OFFS); - adev->cmd_area = (u8*) cmd_offs; - adev->info_area = (u8*) info_offs; - - // OW iobase2 not used in mem.c, in pci.c it is - /* - log(L_DEBUG, "iobase2=%p\n" - */ - log(L_DEBUG, "cmd_mbox_offset=%X cmd_area=%p\n" - "acx: info_mbox_offset=%X info_area=%p\n", - cmd_offs, adev->cmd_area, - info_offs, adev->info_area); - - FN_EXIT0; -} -#endif // acxmem_init_mboxes() /* * BOM Init, Configure (Control Path) * ================================================== */ -/* - * acxmem_s_reset_dev - * - * Arguments: - * netdevice that contains the adev variable - * Returns: - * NOT_OK on fail - * OK on success - * Side effects: - * device is hard reset - * Call context: - * acxmem_e_probe - * Comment: - * This resets the device using low level hardware calls - * as well as uploads and verifies the firmware to the card - */ -#if 0 // copied to merge, but needs work -int acxmem_reset_dev(acx_device_t *adev) -{ - const char* msg = ""; - int result = NOT_OK; - u16 hardware_info; - u16 ecpu_ctrl; - int count; - u32 tmp; - acxmem_lock_flags; - - FN_ENTER; - acxmem_lock(); - - /* - write_reg32 (adev, IO_ACX_SLV_MEM_CP, 0); - */ - /* reset the device to make sure the eCPU is stopped to upload - * the firmware correctly */ - - /* Windows driver does some funny things here */ - /* - * clear bit 0x200 in register 0x2A0 - */ - clear_regbits(adev, 0x2A0, 0x200); - - /* - * Set bit 0x200 in ACX_GPIO_OUT - */ - set_regbits(adev, IO_ACX_GPIO_OUT, 0x200); - - /* - * read register 0x900 until its value is 0x8400104C, sleeping - * in between reads if it's not immediate - */ - tmp = read_reg32(adev, REG_ACX_VENDOR_ID); - count = 500; - while (count-- && (tmp != ACX_VENDOR_ID)) { - mdelay (10); - tmp = read_reg32(adev, REG_ACX_VENDOR_ID); - } - - /* end what Windows driver does */ - - acxmem_reset_mac(adev); - - ecpu_ctrl = read_reg32(adev, IO_ACX_ECPU_CTRL) & 1; - if (!ecpu_ctrl) { - msg = "acx: eCPU is already running. "; - goto end_fail; - } - -#if 0 - if (read_reg16(adev, IO_ACX_SOR_CFG) & 2) { - /* eCPU most likely means "embedded CPU" */ - msg = "acx: eCPU did not start after boot from flash. "; - goto end_unlock; - } - - /* check sense on reset flags */ - if (read_reg16(adev, IO_ACX_SOR_CFG) & 0x10) { - pr_acx("%s: eCPU did not start after boot (SOR), " - "is this fatal?\n", adev->ndev->name); - } -#endif - - /* scan, if any, is stopped now, setting corresponding IRQ bit */ - adev->irq_status |= HOST_INT_SCAN_COMPLETE; - - /* need to know radio type before fw load */ - /* Need to wait for arrival of this information in a loop, - * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also sets the - * radio type ID */ - - count = 0xffff; - do { - hardware_info = read_reg16(adev, IO_ACX_EEPROM_INFORMATION); - if (!--count) { - msg = "acx: eCPU didn't indicate radio type"; - goto end_fail; - } - cpu_relax(); - } while (!(hardware_info & 0xff00)); /* radio type still zero? */ - - pr_acx("ACX radio type 0x%02x\n", (hardware_info >> 8) & 0xff); - /* printk("DEBUG: count %d\n", count); */ - adev->form_factor = hardware_info & 0xff; - adev->radio_type = hardware_info >> 8; - - acxmem_unlock(); - /* load the firmware */ - if (OK != acxmem_upload_fw(adev)) - goto end_fail; - acxmem_lock(); - - /* acx_s_mwait(10); this one really shouldn't be required */ - - /* now start eCPU by clearing bit */ - clear_regbits(adev, IO_ACX_ECPU_CTRL, 0x1); - log(L_DEBUG, "booted eCPU up and waiting for completion...\n"); - - /* Windows driver clears bit 0x200 in register 0x2A0 here */ - clear_regbits(adev, 0x2A0, 0x200); - - /* Windows driver sets bit 0x200 in ACX_GPIO_OUT here */ - set_regbits(adev, IO_ACX_GPIO_OUT, 0x200); - - acxmem_unlock(); - /* wait for eCPU bootup */ - if (OK != acxmem_verify_init(adev)) { - msg = "acx: timeout waiting for eCPU. "; - goto end_fail; - } - acxmem_lock(); - - log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - acx_init_mboxes(adev); - acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); - - /* test that EEPROM is readable */ - acxmem_read_eeprom_area(adev); - - result = OK; - goto end; - - /* Finish error message. Indicate which function failed */ - end_fail: - - pr_acx("%sreset_dev() FAILED\n", msg); - - end: - - acxmem_unlock(); - FN_EXIT1(result); - return result; -} -#endif // acxmem_reset_dev() STATick int acxmem_verify_init(acx_device_t *adev) { int result = NOT_OK; @@ -2285,102 +1648,6 @@ STATick void acxmem_i_tx_timeout(struct net_device *ndev) { } #endif -/* Interrupt handler bottom-half */ -// OW TODO Copy of pci: possible merging. -#if 0 // copied to merge -void acxmem_irq_work(struct work_struct *work) -{ - acx_device_t *adev = container_of(work, struct acx_device, irq_work); - int irqreason; - int irqmasked; - acxmem_lock_flags; - - FN_ENTER; - - acx_sem_lock(adev); - acxmem_lock(); - - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq - * reasons. However masked irq reasons we still read with - * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES - */ - irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); - irqmasked = irqreason & ~adev->irq_mask; - log(L_IRQ, "acxpci: irqstatus=%04X, irqmasked==%04X\n", irqreason, irqmasked); - - /* HOST_INT_CMD_COMPLETE handling */ - if (irqmasked & HOST_INT_CMD_COMPLETE) { - log(L_IRQ, "got Command_Complete IRQ\n"); - /* save the state for the running issue_cmd() */ - SET_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); - } - - /* Tx reporting */ - if (irqmasked & HOST_INT_TX_COMPLETE) { - log(L_IRQ, "got Tx_Complete IRQ\n"); - acxmem_tx_clean_txdesc(adev); - - // Restart queue if stopped and enough tx-descr free - if ((adev->tx_free >= TX_START_QUEUE) && acx_queue_stopped(adev->ieee)) { - log(L_BUF, "tx: wake queue (avail. Tx desc %u)\n", - adev->tx_free); - acx_wake_queue(adev->ieee, NULL); - ieee80211_queue_work(adev->ieee, &adev->tx_work); - } - - } - - /* Rx processing */ - if (irqmasked & HOST_INT_RX_DATA) { - log(L_IRQ, "got Rx_Complete IRQ\n"); - acxmem_process_rxdesc(adev); - } - - /* HOST_INT_INFO */ - if (irqmasked & HOST_INT_INFO) { - acx_handle_info_irq(adev); - } - - /* HOST_INT_SCAN_COMPLETE */ - if (irqmasked & HOST_INT_SCAN_COMPLETE) { - log(L_IRQ, "got Scan_Complete IRQ\n"); - /* need to do that in process context */ - /* remember that fw is not scanning anymore */ - SET_BIT(adev->irq_status, - HOST_INT_SCAN_COMPLETE); - } - - /* These we just log, but either they happen rarely - * or we keep them masked out */ - if (acx_debug & L_IRQ) - { - acx_log_irq(irqreason); - } - - /* Routine to perform blink with range FIXME: - * update_link_quality_led is a stub - add proper code and - * enable this again: if (unlikely(adev->led_power == 2)) - * update_link_quality_led(adev); - */ - - // Renable irq-signal again for irqs we are interested in - write_reg16(adev, IO_ACX_IRQ_MASK, adev->irq_mask); - write_flush(adev); - - acxmem_unlock(); - - // after_interrupt_jobs: need to be done outside acx_lock (Sleeping required. None atomic) - if (adev->after_interrupt_jobs){ - acx_after_interrupt_task(adev); - } - - acx_sem_unlock(adev); - - FN_EXIT0; - return; - -} -#endif /* * acxmem_handle_info_irq diff --git a/pci.c b/pci.c index 67d5ea6..8d8ae03 100644 --- a/pci.c +++ b/pci.c @@ -141,37 +141,6 @@ static void vlynq_remove(struct vlynq_device *vdev); * plus 32 bytes safety offset at the end */ -#if 0 // acxpci_create_desc_queues() -void -acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, - u32 rx_queue_start) -{ - acx_create_tx_desc_queue(adev, tx_queue_start); - acx_create_rx_desc_queue(adev, rx_queue_start); -} -#endif // acxpci_create_desc_queues() - -//static -#if 0 // -void acxpci_delete_dma_regions(acx_device_t * adev) -{ - FN_ENTER; - /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's - * no longer possible here? */ - write_reg16(adev, IO_ACX_ENABLE, 0); - - acx_mwait(100); - - /* NO locking for all parts of acxpci_free_desc_queues - * because: while calling dma_free_coherent() interrupts need - * to be 'free' but if you spinlock the whole function - * (acxpci_free_desc_queues) you'll get an error */ - acx_free_desc_queues(adev); - - FN_EXIT0; -} -#endif // acxpci_delete_dma_regions() // static inline void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, @@ -295,179 +264,6 @@ inline void acxpci_read_eeprom_area(acx_device_t * adev) #endif // ACX_DEBUG > 1 acxpci_read_eeprom_area() body } -#if 0 // acxpci_write_phy_reg() -int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value) -{ - FN_ENTER; - - /* mprusko said that 32bit accesses result in distorted - * sensitivity on his card. Unconfirmed, looks like it's not - * true (most likely since we now properly flush writes). */ - write_reg32(adev, IO_ACX_PHY_DATA, value); - write_reg32(adev, IO_ACX_PHY_ADDR, reg); - write_flush(adev); - write_reg32(adev, IO_ACX_PHY_CTL, 1); - write_flush(adev); - log(L_DEBUG, "radio PHY write 0x%02X at 0x%04X\n", value, reg); - - FN_EXIT0; - return OK; -} -#endif // acxpci_write_phy_reg() - - -/* - * acxpci_s_write_fw - * - * Write the firmware image into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * 1 firmware image corrupted - * 0 success - * - * Standard csum implementation + write to IO - */ -// static -#if 0 // acxpci_write_fw() -int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, - u32 offset) -{ - int len, size; - u32 sum, v32; - /* we skip the first four bytes which contain the control sum */ - - const u8 *p = (u8 *) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ - write_flush(adev); -#endif // FW_NO_AUTO_INCREMENT - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32 *) p); - sum += p[0] + p[1] + p[2] + p[3]; - p += 4; - len += 4; - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); - write_flush(adev); -#endif - write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32); - } - - log(L_DEBUG, "firmware written, size:%d sum1:%x sum2:%x\n", - size, sum, le32_to_cpu(fw_image->chksum)); - - /* compare our checksum with the stored image checksum */ - FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); - return (sum != le32_to_cpu(fw_image->chksum)); -} -#endif // acxpci_write_fw() - -/* - * acxpci_s_validate_fw - * - * Compare the firmware image given with - * the firmware image written into the card. - * - * Arguments: - * adev wlan device structure - * fw_image firmware image. - * - * Returns: - * NOT_OK firmware image corrupted or not correctly written - * OK success - * - * Origin: Standard csum + Read IO - */ -// static -#if 0 // acxpci_validate_fw() -int -acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, - u32 offset) -{ - u32 sum, v32, w32; - int len, size; - int result = OK; - /* we skip the first four bytes which contain the control sum */ - const u8 *p = (u8 *) fw_image + 4; - - FN_ENTER; - - /* start the image checksum by adding the image size value */ - sum = p[0] + p[1] + p[2] + p[3]; - p += 4; - - write_reg32(adev, IO_ACX_SLV_END_CTL, 0); - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ -#else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ -#endif - - len = 0; - size = le32_to_cpu(fw_image->size) & (~3); - - while (likely(len < size)) { - v32 = be32_to_cpu(*(u32 *) p); - p += 4; - len += 4; - -#if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); -#endif - w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); - - if (unlikely(w32 != v32)) { - pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " - "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", - len, v32, w32); - result = NOT_OK; - break; - } - - sum += (u8) w32 - + (u8) (w32 >> 8) - + (u8) (w32 >> 16) - + (u8) (w32 >> 24); - } - - /* sum control verification */ - if (result != NOT_OK) { - if (sum != le32_to_cpu(fw_image->chksum)) { - pr_acx("FATAL: firmware upload: " - "checksums don't match!\n"); - result = NOT_OK; - } - } - - FN_EXIT1(result); - return result; -} -#endif // acxpci_validate_fw() /* * acxpci_s_upload_fw @@ -764,202 +560,12 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, return NOT_OK; } -// static inline -#if 0 // acxpci_write_cmd_type_status() -void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status) -{ - FN_ENTER; - acx_writel(type | (status << 16), adev->cmd_area); - write_flush(adev); - FN_EXIT0; -} -#endif // acxpci_write_cmd_type_status() - -#if 0 // acxpci_read_cmd_type_status() -//static -u32 acxpci_read_cmd_type_status(acx_device_t *adev) -{ - u32 cmd_type, cmd_status; - - FN_ENTER; - - cmd_type = acx_readl(adev->cmd_area); - cmd_status = (cmd_type >> 16); - cmd_type = (u16) cmd_type; - - logf1(L_DEBUG, "cmd_type=%04X cmd_status=%04X [%s]\n", - cmd_type, cmd_status, acx_cmd_status_str(cmd_status)); - - FN_EXIT1(cmd_status); - return cmd_status; -} -#endif // acxpci_read_cmd_type_status() - -// static -#if 0 // acxpci_init_mboxes() -inline void acxpci_init_mboxes(acx_device_t * adev) -{ - u32 cmd_offs, info_offs; - - FN_ENTER; - - cmd_offs = read_reg32(adev, IO_ACX_CMD_MAILBOX_OFFS); - info_offs = read_reg32(adev, IO_ACX_INFO_MAILBOX_OFFS); - adev->cmd_area = (u8 *) adev->iobase2 + cmd_offs; - adev->info_area = (u8 *) adev->iobase2 + info_offs; - log(L_DEBUG, "iobase2=%p\n" - "acx: cmd_mbox_offset=%X cmd_area=%p\n" - "acx: info_mbox_offset=%X info_area=%p\n", - adev->iobase2, - cmd_offs, adev->cmd_area, info_offs, adev->info_area); - FN_EXIT0; -} -#endif // acxpci_init_mboxes() /* * BOM Init, Configuration (Control Path) * ================================================== */ -/* - * acxpci_s_reset_dev - * - * Arguments: - * netdevice that contains the adev variable - * Returns: - * NOT_OK on fail - * OK on success - * Side effects: - * device is hard reset - * Call context: - * acxpci_e_probe - * Comment: - * This resets the device using low level hardware calls - * as well as uploads and verifies the firmware to the card - */ -#if 0 // acxpci_reset_dev() -int acxpci_reset_dev(acx_device_t *adev) -{ - const char *msg = ""; - int result = NOT_OK; - u16 hardware_info; - u16 ecpu_ctrl; - int count; - - FN_ENTER; - - /* reset the device to make sure the eCPU is stopped to upload - * the firmware correctly */ - -#ifdef CONFIG_PCI - acxpci_reset_mac(adev); -#endif - - ecpu_ctrl = read_reg16(adev, IO_ACX_ECPU_CTRL) & 1; - if (!ecpu_ctrl) { - msg = "acx: eCPU is already running. "; - goto end_unlock; - } -#if 0 - if (read_reg16(adev, IO_ACX_SOR_CFG) & 2) { - /* eCPU most likely means "embedded CPU" */ - msg = "acx: eCPU did not start after boot from flash. "; - goto end_unlock; - } - - /* check sense on reset flags */ - if (read_reg16(adev, IO_ACX_SOR_CFG) & 0x10) { - pr_acx("%s: eCPU did not start after boot (SOR), " - "is this fatal?\n", wiphy_name(adev->ieee->wiphy)); - } -#endif - /* scan, if any, is stopped now, setting corresponding IRQ bit */ - SET_BIT(adev->irq_status, HOST_INT_SCAN_COMPLETE); - - /* need to know radio type before fw load */ - /* Need to wait for arrival of this information in a loop, - * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also sets the - * radio type ID */ - - count = 0xffff; - do { - hardware_info = read_reg16(adev, IO_ACX_EEPROM_INFORMATION); - if (!--count) { - msg = "acx: eCPU didn't indicate radio type"; - goto end_fail; - } - cpu_relax(); - } while (!(hardware_info & 0xff00)); /* radio type still zero? */ - - /* pr_acx("DEBUG: count %d\n", count); */ - adev->form_factor = hardware_info & 0xff; - adev->radio_type = hardware_info >> 8; - - /* load the firmware */ - if (OK != acxpci_upload_fw(adev)) - goto end_fail; - - /* acx_s_mwait(10); this one really shouldn't be required */ - - /* now start eCPU by clearing bit */ - write_reg16(adev, IO_ACX_ECPU_CTRL, ecpu_ctrl & ~0x1); - log(L_DEBUG, "booted eCPU up and waiting for completion...\n"); - - /* wait for eCPU bootup */ - if (OK != acx_verify_init(adev)) { - msg = "acx: timeout waiting for eCPU. "; - goto end_fail; - } - log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - - acx_init_mboxes(adev); - acx_write_cmd_type_status(adev, 0, 0); - - /* test that EEPROM is readable */ - acxpci_read_eeprom_area(adev); - - result = OK; - goto end; - -/* Finish error message. Indicate which function failed */ - end_unlock: - - end_fail: - pr_acx("%sreset_dev() FAILED\n", msg); - end: - FN_EXIT1(result); - return result; -} -#endif // acxpci_reset_dev() - -#if 0 // !unused -static int acxpci_verify_init(acx_device_t * adev) -{ - int result = NOT_OK; - unsigned long timeout; - - FN_ENTER; - - timeout = jiffies + 2 * HZ; - for (;;) { - u16 irqstat = read_reg16(adev, IO_ACX_IRQ_STATUS_NON_DES); - if (irqstat & HOST_INT_FCS_THRESHOLD) { - result = OK; - write_reg16(adev, IO_ACX_IRQ_ACK, - HOST_INT_FCS_THRESHOLD); - break; - } - if (time_after(jiffies, timeout)) - break; - /* Init may take up to ~0.5 sec total */ - acx_mwait(50); - } - - FN_EXIT1(result); - return result; -} -#endif // unused acxpci_verify_init() /* * acxpci_l_reset_mac @@ -1168,32 +774,6 @@ tx_t* acxpci_alloc_tx(acx_device_t * adev) } -/* clean *all* Tx descriptors, and regardless of their previous state. - * Used for brute-force reset handling. */ -#if 0 // acxpci_clean_txdesc_emergency() -void acxpci_clean_txdesc_emergency(acx_device_t * adev) -{ - txdesc_t *txdesc; - int i; - - FN_ENTER; - - for (i = 0; i < TX_CNT; i++) { - txdesc = acx_get_txdesc(adev, i); - - /* free it */ - txdesc->ack_failures = 0; - txdesc->rts_failures = 0; - txdesc->rts_ok = 0; - txdesc->error = 0; - txdesc->Ctl_8 = DESC_CTL_HOSTOWN; - } - - adev->tx_free = TX_CNT; - - FN_EXIT0; -} -#endif // acxpci_clean_txdesc_emergency() /* * BOM Irq Handling, Timer @@ -1201,161 +781,6 @@ void acxpci_clean_txdesc_emergency(acx_device_t * adev) */ -/* Interrupt handler bottom-half */ -#define IRQ_ITERATE 0 -#if 0 // acxpci_irq_work() -void acxpci_irq_work(struct work_struct *work) -{ - acx_device_t *adev = container_of(work, struct acx_device, irq_work); - int irqreason; - int irqmasked; -#if IRQ_ITERATE - unsigned int irqcnt=10; -#endif - - FN_ENTER; - - acx_sem_lock(adev); - - /* OW, 20100611: Iterating and latency: - * - * IRQ iteration can improve latency, by avoiding waiting for the schedling - * of the tx worklet. - */ -#if IRQ_ITERATE - while(irqcnt--) { -#endif - - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq - * reasons. However masked irq reasons we still read with - * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES - */ - irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); - irqmasked = irqreason & ~adev->irq_mask; - log(L_IRQ, "irqstatus=%04X, irqmasked==%04X\n", irqreason, irqmasked); - -#if IRQ_ITERATE - if (!irqmasked) break; -#endif - - /* HOST_INT_CMD_COMPLETE handling */ - if (irqmasked & HOST_INT_CMD_COMPLETE) { - log(L_IRQ, "got Command_Complete IRQ\n"); - - /* save the state for the running issue_cmd() */ - SET_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); - } - - /* First report tx status. Just a guess, but it might - * be better in AP mode with hostapd, because tx - * status reporting of previous tx and new rx - * receiving are now in sequence. */ - if (irqmasked & HOST_INT_TX_COMPLETE) { - log(L_IRQ, "got Tx_Complete IRQ\n"); - - /* The condition on TX_START_CLEAN was - * removed, because if was creating a race, - * sequencing problem in AP mode during WPA - * association with different STAs. - * - * The result were many WPA assoc retries of - * the STA, until assoc finally succeeded. It - * happens sporadically, but still often. I - * oberserved this with a ath5k and acx STA. - * - * It manifested as followed: - * 1) STA authenticates and associates - * 2) And then hostapd reported reception of a - * Data/PS-poll frame of an unassociated STA - * 3) hostapd sends disassoc frame - * 4) And then it was looping in retrying this seq, - * until it succeed 'by accident' - * - * Removing the TX_START_CLEAN check and - * always report directly on the tx status - * resolved this problem. Now WPA assoc - * succeeds directly and robust. - */ - acx_tx_clean_txdesc(adev); - - // Restart queue if stopped and enough tx-descr free - if ((adev->tx_free >= TX_START_QUEUE) - && acx_queue_stopped(adev->ieee)) { - - log(L_BUF, - "tx: wake queue (avail. Tx desc %u)\n", - adev->tx_free); - acx_wake_queue(adev->ieee, NULL); - // Schedule the tx. Doesn't harm. Required in case of irq-iteration. - ieee80211_queue_work(adev->ieee, - &adev->tx_work); - } - - } - - /* Now do Rx processing */ - if (irqmasked & HOST_INT_RX_COMPLETE) { - log(L_IRQ, "got Rx_Complete IRQ\n"); - acx_process_rxdesc(adev); - } - - -#if IRQ_ITERATE - /* Tx new frames, after rx processing. If queue is - * running. We indirectly use this as indicator, that - * tx_free >= TX_START_QUEUE */ - if (!acx_queue_stopped(adev->ieee)) - acx_tx_queue_go(adev); -#endif - - /* HOST_INT_INFO */ - if (irqmasked & HOST_INT_INFO) { - acx_handle_info_irq(adev); - } - - /* HOST_INT_SCAN_COMPLETE */ - if (irqmasked & HOST_INT_SCAN_COMPLETE) { - log(L_IRQ, "got Scan_Complete IRQ\n"); - /* need to do that in process context */ - /* remember that fw is not scanning anymore */ - SET_BIT(adev->irq_status, - HOST_INT_SCAN_COMPLETE); - } - - /* These we just log, but either they happen rarely - * or we keep them masked out */ - if (acx_debug & L_IRQ) - { - acx_log_irq(irqreason); - } - -#if IRQ_ITERATE - } -#endif - - /* Routine to perform blink with range FIXME: - * update_link_quality_led is a stub - add proper code and - * enable this again: if (unlikely(adev->led_power == 2)) - * update_link_quality_led(adev); - */ - - // Renable irq-signal again for irqs we are interested in - write_reg16(adev, IO_ACX_IRQ_MASK, adev->irq_mask); - write_flush(adev); - - /* after_interrupt_jobs: need to be done outside acx_lock - * (Sleeping required. None atomic) */ - if (adev->after_interrupt_jobs){ - acx_after_interrupt_task(adev); - } - - acx_sem_unlock(adev); - - FN_EXIT0; - return; -} -#endif // acxpci_irq_work() - /* * acxpci_handle_info_irq */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:40
|
This was in #if0d code, so it didnt get picked up by the compiler. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/mem.c b/mem.c index a77489b..871a8ce 100644 --- a/mem.c +++ b/mem.c @@ -2186,7 +2186,7 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, txdesc->Ctl2_8, txdesc->error, txdesc->u.r1.rate); - txdesc = acxmem_advance_txdesc(adev, txdesc, 1); + txdesc = acx_advance_txdesc(adev, txdesc, 1); } /* dump host tx descriptor ring buffer */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:39
|
Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/merge.c b/merge.c index 18ea9a5..1d1c462 100644 --- a/merge.c +++ b/merge.c @@ -238,8 +238,13 @@ void *acx_allocate(acx_device_t * adev, size_t size, } #define RX_BUFFER_SIZE (sizeof(rxbuffer_t) + 32) -static -int acx_create_rx_host_desc_queue(acx_device_t * adev) +/* + * acx_create_rx_host_desc_queue() + * + * the whole size of a data buffer (header plus data body) plus 32 + * bytes safety offset at the end + */ +static int acx_create_rx_host_desc_queue(acx_device_t * adev) { rxhostdesc_t *hostdesc; rxbuffer_t *rxbuf; @@ -1104,7 +1109,7 @@ fail: #endif // acxmem_write_phy_reg() /* - * acxmem_s_write_fw + * acx_write_fw * * Write the firmware image into the card. * @@ -1951,7 +1956,7 @@ void acx_up(struct ieee80211_hw *hw) } /* - * acxmem_s_reset_dev + * acx_reset_dev * * Arguments: * netdevice that contains the adev variable -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:38
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 117 ++--------------------------------------------------------------- pci.c | 99 ------------------------------------------------------- 2 files changed, 3 insertions(+), 213 deletions(-) diff --git a/mem.c b/mem.c index 64595b0..4e326d1 100644 --- a/mem.c +++ b/mem.c @@ -107,128 +107,17 @@ * ================================================== */ -// Logging -// static void acxmem_log_rxbuffer(const acx_device_t *adev); -// static void acxmem_log_txbuffer(acx_device_t *adev); #if DUMP_MEM_DEFINED > 0 //= static void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); #endif -// Data Access -//= static -void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -//= static -//- void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); -//=static -//- void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); -//=static -//- void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); - -// int acxmem_create_hostdesc_queues(acx_device_t *adev); -// static -//- int acxmem_create_rx_host_desc_queue(acx_device_t *adev); -// static -//= int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -//- void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start); -//=STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); -//= STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -//= void acxmem_free_desc_queues(acx_device_t *adev); -//= STATick void acxmem_delete_dma_regions(acx_device_t *adev); -//= STATick void *acxmem_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); - -// Firmware, EEPROM, Phy -//= int acxmem_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -#ifdef UNUSED -//- int acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 *charbuf); -#endif -//- STATick inline void acxmem_read_eeprom_area(acx_device_t *adev); -//- int acxmem_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//=int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); -//STATick -//- int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//static -//- int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//- STATick int acxmem_upload_fw(acx_device_t *adev); - -#if defined(NONESSENTIAL_FEATURES) -//- STATick void acx_show_card_eeprom_id(acx_device_t *adev); -#endif +void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, + u32 source, int count); -// CMDs (Control Path) -//- int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char* cmdstr); -//- STATick inline void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//= u32 acxmem_read_cmd_type_status(acx_device_t *adev); -//- STATick inline void acxmem_init_mboxes(acx_device_t *adev); - -// Init, Configure (Control Path) -//=int acxmem_reset_dev(acx_device_t *adev); -//- STATick int acxmem_verify_init(acx_device_t *adev); -//- STATick int acxmem_complete_hw_reset(acx_device_t *adev); -//- STATick void acxmem_reset_mac(acx_device_t *adev); -//= STATick void acxmem_up(struct ieee80211_hw *hw); -//static void acxmem_i_set_multicast_list(struct net_device *ndev); - -// Other (Control Path) - -// Proc, Debug -//- int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//= char *acxmem_proc_eeprom_output(int *len, acx_device_t *adev); - -// Rx Path -//- STATick void acxmem_process_rxdesc(acx_device_t *adev); - -// Tx Path -//- tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); -//- void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); - -//- void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//- static int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int //- len); -//- STATick u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); -//- STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr); static void acxmem_init_acx_txbuf(acx_device_t *adev); -//= static void acxmem_init_acx_txbuf2(acx_device_t *adev); -//- STATick inline txdesc_t *acxmem_get_txdesc(acx_device_t *adev, int index); -// static inline -//= txdesc_t *acxmem_advance_txdesc(acx_device_t *adev, txdesc_t* txdesc, int inc); txhostdesc_t *acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t* txdesc); - -//= void acxmem_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxmem_tx_clean_txdesc(acx_device_t *adev); -//= void acxmem_clean_txdesc_emergency(acx_device_t *adev); - -//- void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -//- int acx100mem_set_tx_level(acx_device_t *adev, u8 level_dbm); -//static void acxmem_i_tx_timeout(struct net_device *ndev); - -// Irq Handling, Timer -//= STATick void acxmem_irq_enable(acx_device_t *adev); -//= STATick void acxmem_irq_disable(acx_device_t *adev); -//=void acxmem_irq_work(struct work_struct *work); -// STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//= STATick void acxmem_handle_info_irq(acx_device_t *adev); -//= void acxmem_set_interrupt_mask(acx_device_t *adev); - -// Helpers -//- void acxmem_power_led(acx_device_t *adev, int enable); -//- INLINE_IO int acxmem_adev_present(acx_device_t *adev); -STATick char acxmem_printable(char c); -//static void update_link_quality_led(acx_device_t *adev); - -// Ioctls -//int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - -// Driver, Module -//- STATick int __devinit acxmem_probe(struct platform_device *pdev); -//- STATick int __devexit acxmem_remove(struct platform_device *pdev); -#ifdef CONFIG_PM -//- STATick int acxmem_e_suspend(struct platform_device *pdev, pm_message_t state); -//- STATick int acxmem_e_resume(struct platform_device *pdev); -#endif -//- int __init acxmem_init_module(void); -//- void __exit acxmem_cleanup_module(void); +char acxmem_printable(char c); /* * BOM Defines, static vars, etc. diff --git a/pci.c b/pci.c index 1116e8e..67d5ea6 100644 --- a/pci.c +++ b/pci.c @@ -70,110 +70,11 @@ * ================================================== */ -// Logging -// static void acxpci_log_rxbuffer(const acx_device_t * adev); -// static void acxpci_log_txbuffer(acx_device_t * adev); - -// Data Access - -// int acxpci_create_hostdesc_queues(acx_device_t * adev); -//static -//- int acxpci_create_rx_host_desc_queue(acx_device_t * adev); -//static -//- int acxpci_create_tx_host_desc_queue(acx_device_t * adev); - -//- void acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, u32 rx_queue_start); -//= static void acxpci_create_rx_desc_queue(acx_device_t * adev, u32 rx_queue_start); -//= static void acxpci_create_tx_desc_queue(acx_device_t * adev, u32 tx_queue_start); - -//= void acxpci_free_desc_queues(acx_device_t * adev); -//= static void acxpci_delete_dma_regions(acx_device_t * adev); -//=static inline -//- void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); -//= static void *acxpci_allocate(acx_device_t * adev, size_t size, dma_addr_t * phy, const char *msg); - -// Firmware, EEPROM, Phy -//=int acxpci_read_eeprom_byte(acx_device_t * adev, u32 addr, u8 * charbuf); -// int acxpci_s_write_eeprom(acx_device_t * adev, u32 addr, u32 len, const u8 * charbuf); -//= static inline void acxpci_read_eeprom_area(acx_device_t * adev); -//int acxpci_read_phy_reg(acx_device_t * adev, u32 reg, u8 * charbuf); -//=int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value); -// static -//- int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, u32 offset); -// static -//- int acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, u32 offset); -//= static int acxpci_upload_fw(acx_device_t * adev); -// static void acx_show_card_eeprom_id(acx_device_t * adev); - -// CMDs (Control Path) -//- int acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char *cmdstr); -//=static inline void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status); -//= static -//- u32 acxpci_read_cmd_type_status(acx_device_t *adev); -//= static inline void acxpci_init_mboxes(acx_device_t * adev); - -// Init, Configuration (Control Path) -//- int acxpci_reset_dev(acx_device_t * adev); -//= static int acxpci_verify_init(acx_device_t * adev); -//= static void acxpci_reset_mac(acx_device_t * adev); -//= static void acxpci_up(struct ieee80211_hw *hw); - -// Other (Control Path) - -// Proc, Debug -//- int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//=char *acxpci_proc_eeprom_output(int *len, acx_device_t * adev); - -// Rx Path -//= static void acxpci_process_rxdesc(acx_device_t * adev); - -// Tx Path -//- tx_t *acxpci_alloc_tx(acx_device_t * adev); -//= void *acxpci_get_txbuf(acx_device_t * adev, tx_t * tx_opaque); -//- void acxpci_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct ieee80211_tx_info *info, struct sk_buff *skb); -//= unsigned int acxpci_tx_clean_txdesc(acx_device_t * adev); -//=void acxpci_clean_txdesc_emergency(acx_device_t * adev); -//= static inline txdesc_t *acxpci_get_txdesc(acx_device_t * adev, int index); -// static inline -//= txdesc_t *acxpci_advance_txdesc(acx_device_t * adev, txdesc_t * txdesc, int inc); -//= static txhostdesc_t *acxpci_get_txhostdesc(acx_device_t * adev, txdesc_t * txdesc); - -// Irq Handling, Timer -//= static void acxpci_irq_enable(acx_device_t * adev); -//= static void acxpci_irq_disable(acx_device_t * adev); -//=void acxpci_irq_work(struct work_struct *work); -// static irqreturn_t acxpci_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//= static void acxpci_handle_info_irq(acx_device_t * adev); -//= void acxpci_set_interrupt_mask(acx_device_t * adev); - -// Helpers -//- void acxpci_power_led(acx_device_t * adev, int enable); -//- INLINE_IO int acxpci_adev_present(acx_device_t *adev); - -// Ioctls -//- int acx111pci_ioctl_info(struct net_device *ndev, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//- int acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev, struct //- iw_request_info *info, struct iw_param *vwrq, char *extra); - -// Driver, Module -#ifdef CONFIG_PCI -//= static int __devinit acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id); -//= static void __devexit acxpci_remove(struct pci_dev *pdev); -#ifdef CONFIG_PM -//= static int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state); -//= static int acxpci_e_resume(struct pci_dev *pdev); -#endif // CONFIG_PM -#endif // CONFIG_PCI - #ifdef CONFIG_VLYNQ static int vlynq_probe(struct vlynq_device *vdev, struct vlynq_device_id *id); static void vlynq_remove(struct vlynq_device *vdev); #endif // CONFIG_VLYNQ -//- int __init acxpci_init_module(void); -//- void __exit acxpci_cleanup_module(void); - - /* * BOM Defines, static vars, etc. * ================================================== -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:38
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.h | 103 ++++++---------------------------------------------------------- pci.h | 75 ++++++----------------------------------------- 2 files changed, 19 insertions(+), 159 deletions(-) diff --git a/mem.h b/mem.h index 5c6c0ec..17c8bad 100644 --- a/mem.h +++ b/mem.h @@ -1,12 +1,9 @@ -/* purpose of this file is to aid in unification of appropriate - * functions from mem.c and pci.c into merge.c. It borrows fn-sigs - * from pci.c, and changes them from static to public to suppress - * warnings like: - - warning: 'acxpci_op_stop' declared 'static' but never defined [-Wunused-function] - Later, we'll drop it. -*/ +/* this file provides prototypes for functions defined in mem.c that + * are used by common.c etc, and is thus the internal API. It also + * forward declares some of the functions used in mem.c, reducing the + * set of forward declarations in mem.c + */ #define STATick /* ick: suppress static, let linker find fns in mem.o pci.o */ @@ -14,13 +11,11 @@ #define DUMP_MEM_DEFINED 1 // to insure export of dump* fns too // Logging -//- STATick void acxmem_log_rxbuffer(const acx_device_t *adev); -//- STATick void acxmem_log_txbuffer(acx_device_t *adev); + #if DUMP_MEM_DEFINED > 0 void acxmem_dump_mem(acx_device_t *adev, u32 start, int length); #endif -//- STATick void acxmem_copy_from_slavemem(acx_device_t *adev, u8 //- *destination, u32 source, int count); void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, u8 *source, int count); void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, @@ -28,121 +23,43 @@ void acxmem_chaincopy_to_slavemem(acx_device_t *adev, u32 destination, void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, int count); -//- int acxmem_create_hostdesc_queues(acx_device_t *adev); -//- STATick int acxmem_create_rx_host_desc_queue(acx_device_t *adev); -//- STATick int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -//! void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, -//! u32 rx_queue_start); -//- STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 //- rx_queue_start); -//- STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 //- tx_queue_start); -//- void acxmem_free_desc_queues(acx_device_t *adev); -//- STATick void acxmem_delete_dma_regions(acx_device_t *adev); -//- STATick void *acxmem_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); - // Firmware, EEPROM, Phy + int acxmem_upload_radio(acx_device_t *adev); -//- int acxmem_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -//- #ifdef UNUSED -//- int acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 //- *charbuf); -//- #endif -//- STATick inline void acxmem_read_eeprom_area(acx_device_t *adev); -//- int acxmem_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//- int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); + int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -//a int acxmem_upload_fw(acx_device_t *adev); -//- -#if defined(NONESSENTIAL_FEATURES) -//- STATick void acx_show_card_eeprom_id(acx_device_t *adev); -#endif // CMDs (Control Path) -//- int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, -//- void *buffer, unsigned buflen, -//- unsigned cmd_timeout, const char *cmdstr); - -// STATick inline void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//= copied to merge.c -//= STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev); - -// Init, Configure (Control Path) -//= int acxmem_reset_dev(acx_device_t *adev); -//= STATick int acxmem_verify_init(acx_device_t *adev); -// STATick int acxmem_complete_hw_reset(acx_device_t *adev); void acxmem_reset_mac(acx_device_t *adev); -// STATick void acxmem_up(struct ieee80211_hw *hw); -//STATick void acxmem_i_set_multicast_list(struct net_device *ndev); // Other (Control Path) // Proc, Debug int acxmem_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//- char *acxmem_proc_eeprom_output(int *len, acx_device_t *adev); // Rx Path -//= STATick void acxmem_process_rxdesc(acx_device_t *adev); - // Tx Path tx_t *acxmem_alloc_tx(acx_device_t *adev, unsigned int len); void acxmem_dealloc_tx(acx_device_t *adev, tx_t *tx_opaque); -//- void *acxmem_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//= STATick int acxmem_get_txbuf_space_needed(acx_device_t *adev, unsigned int len); u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); -//= STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr); -//= STATick void acxmem_init_acx_txbuf(acx_device_t *adev); -void acxmem_init_acx_txbuf2(acx_device_t *adev); -//= STATick inline txdesc_t *acxmem_get_txdesc(acx_device_t *adev, int index); -//- STATick inline txdesc_t *acxmem_advance_txdesc(acx_device_t *adev, txdesc_t *txdesc, int inc); -//= STATick txhostdesc_t *acxmem_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc); -//- void acxmem_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct //- ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxmem_tx_clean_txdesc(acx_device_t *adev); -//- void acxmem_clean_txdesc_emergency(acx_device_t *adev); +void acxmem_init_acx_txbuf2(acx_device_t *adev); void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue); -//- int acx100mem_set_tx_level(acx_device_t *adev, u8 level_dbm); -//STATick void acxmem_i_tx_timeout(struct net_device *ndev); // Irq Handling, Timer -//= STATick void acxmem_irq_enable(acx_device_t *adev); -//= STATick void acxmem_irq_disable(acx_device_t *adev); -//- void acxmem_irq_work(struct work_struct *work); -// STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//- STATick void acxmem_handle_info_irq(acx_device_t *adev); -//- void acxmem_set_interrupt_mask(acx_device_t *adev); - // Helpers -//- void acxmem_power_led(acx_device_t *adev, int enable); -// INLINE_IO int acxmem_adev_present(acx_device_t *adev); -//= STATick char acxmem_printable(char c); -//STATick void update_link_quality_led(acx_device_t *adev); - // Ioctls -//int acx111pci_ioctl_info(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); -//int acx100mem_ioctl_set_phy_amp_bias(struct ieee80211_hw *hw, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - // Driver, Module -//= STATick int __devinit acxmem_probe(struct platform_device *pdev); -//= STATick int __devexit acxmem_remove(struct platform_device *pdev); -#ifdef CONFIG_PM -//= STATick int acxmem_e_suspend(struct platform_device *pdev, pm_message_t state); -//= STATick int acxmem_e_resume(struct platform_device *pdev); -#endif + int __init acxmem_init_module(void); void __exit acxmem_cleanup_module(void); -// for merge of tx_data -//- u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count); - -// for merge of acx_reset_dev -//- void acxmem_reset_mac(acx_device_t *adev); -//- u32 acxmem_read_cmd_type_status(acx_device_t *adev); void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acxmem_init_mboxes(acx_device_t *adev); -//- inline void acxmem_init_mboxes(acx_device_t *adev); diff --git a/pci.h b/pci.h index ca0c0d9..eca8a7f 100644 --- a/pci.h +++ b/pci.h @@ -1,115 +1,58 @@ -/* purpose of this file is to aid in unification of appropriate - * functions from mem.c and pci.c into merge.c. It borrows fn-sigs - * from pci.c, and changes them from static to public to suppress - * warnings like: - - warning: 'acxpci_op_stop' declared 'static' but never defined [-Wunused-function] - Later, we'll drop it. -*/ +/* This file provides prototypes for functions defined in pci.c which + * are used by common.c etc. It also forward declares functions + * inside pci.c, thus reducing set of forward declarations needed there. + */ #define STATick /* ick - suppress static, and thus a raft of warnings let linker find the fns in mem.o, pci.o */ // Logging -//= STATick void acxpci_log_rxbuffer(const acx_device_t *adev); -//= STATick void acxpci_log_txbuffer(acx_device_t *adev); - -//=int acxpci_create_hostdesc_queues(acx_device_t *adev); -//= STATick int acxpci_create_rx_host_desc_queue(acx_device_t *adev); -//=STATick int acxpci_create_tx_host_desc_queue(acx_device_t *adev); - -//! void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, -//! u32 rx_queue_start); -//=STATick void acxpci_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); -//= STATick void acxpci_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -//= void acxpci_free_desc_queues(acx_device_t *adev); -//- STATick void acxpci_delete_dma_regions(acx_device_t *adev); void acxpci_free_coherent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle); -//= STATick void *acxpci_allocate(acx_device_t *adev, size_t size, dma_addr_t *phy, const char *msg); // Firmware, EEPROM, Phy int acxpci_upload_radio(acx_device_t *adev); -//- int acxpci_read_eeprom_byte(acx_device_t *adev, u32 addr, u8 *charbuf); -// int acxpci_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, const u8 *charbuf); -//- STATick inline void acxpci_read_eeprom_area(acx_device_t *adev); -//- int acxpci_read_phy_reg(acx_device_t *adev, u32 reg, u8 *charbuf); -//- int acxpci_write_phy_reg(acx_device_t *adev, u32 reg, u8 value); + int acxpci_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxpci_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxpci_upload_fw(acx_device_t *adev); -// STATick void acx_show_card_eeprom_id(acx_device_t *adev); // CMDs (Control Path) int acxpci_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char *cmdstr); -// coplied to merge.c -// STATick inline void acxpci_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//- STATick u32 acxpci_read_cmd_type_status(acx_device_t *adev); + void acxpci_init_mboxes(acx_device_t *adev); // Init, Configuration (Control Path) int acxpci_reset_dev(acx_device_t *adev); -//= STATick int acxpci_verify_init(acx_device_t *adev); void acxpci_reset_mac(acx_device_t *adev); -//- STATick void acxpci_up(struct ieee80211_hw *hw); // Other (Control Path) // Proc, Debug int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev); -//- char *acxpci_proc_eeprom_output(int *len, acx_device_t *adev); // Rx Path -//- STATick void acxpci_process_rxdesc(acx_device_t *adev); - // Tx Path tx_t *acxpci_alloc_tx(acx_device_t *adev); -//- void *acxpci_get_txbuf(acx_device_t *adev, tx_t *tx_opaque); -//- void acxpci_tx_data(acx_device_t *adev, tx_t *tx_opaque, int len, struct //- ieee80211_tx_info *info, struct sk_buff *skb); -//- unsigned int acxpci_tx_clean_txdesc(acx_device_t *adev); -//- void acxpci_clean_txdesc_emergency(acx_device_t *adev); -//- //= STATick inline txdesc_t *acxpci_get_txdesc(acx_device_t *adev, int //- index); -//= STATick inline txdesc_t *acxpci_advance_txdesc(acx_device_t *adev, txdesc_t *txdesc, int inc); -//- STATick txhostdesc_t *acxpci_get_txhostdesc(acx_device_t *adev, txdesc_t *txdesc); // Irq Handling, Timer -//- STATick void acxpci_irq_enable(acx_device_t *adev); -//- STATick void acxpci_irq_disable(acx_device_t *adev); -//- void acxpci_irq_work(struct work_struct *work); -//- // STATick irqreturn_t acxpci_interrupt(int irq, void *dev_id); -//- irqreturn_t acx_interrupt(int irq, void *dev_id); -//- STATick void acxpci_handle_info_irq(acx_device_t *adev); -//- void acxpci_set_interrupt_mask(acx_device_t *adev); -//- + // Helpers void acxpci_power_led(acx_device_t *adev, int enable); -// INLINE_IO int acxpci_adev_present(acx_device_t *adev); // Ioctls -//- int acx111pci_ioctl_info(struct net_device *ndev, struct iw_request_info //- *info, struct iw_param *vwrq, char *extra); -//- int acx100pci_ioctl_set_phy_amp_bias(struct net_device *ndev, struct iw_request_info *info, struct iw_param *vwrq, char *extra); - // Driver, Module -//- STATick int __devinit acxpci_probe(struct pci_dev *pdev, const struct //- pci_device_id *id); -//- STATick void __devexit acxpci_remove(struct pci_dev *pdev); -//- #ifdef CONFIG_PM -//- STATick int acxpci_e_suspend(struct pci_dev *pdev, pm_message_t state); -//- STATick int acxpci_e_resume(struct pci_dev *pdev); -//- #endif -//- + int __init acxpci_init_module(void); void __exit acxpci_cleanup_module(void); -//- -//- // for merge of acx_reset_dev + void acxpci_reset_mac(acx_device_t *adev); u32 acxpci_read_cmd_type_status(acx_device_t *adev); void acxpci_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -//- void acxpci_init_mboxes(acx_device_t *adev); -//- -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:37
|
Merge 2 fns together in merge.c, #if0 old fn-defns in mem.c, pci.c, fix 4 calls (and fold 2 of them together) in common.c, //! fn-protos in mem.h, pci.h Signed-off-by: Jim Cromie <jim...@gm...> --- common.c | 9 +++------ mem.c | 4 ++-- mem.h | 4 ++-- merge.c | 24 ++++++++++++++++++++++++ merge.h | 3 +++ pci.c | 3 ++- pci.h | 4 ++-- 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/common.c b/common.c index 1168204..e27dc8a 100644 --- a/common.c +++ b/common.c @@ -1109,7 +1109,7 @@ static int acx100_create_dma_regions(acx_device_t * adev) /* sets the beginning of the rx descriptor queue, after the tx descrs */ if (OK != acx_create_hostdesc_queues(adev)) goto fail; - acxpci_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); } #ifdef CONFIG_ACX_MAC80211_MEM else if (IS_MEM(adev)) { @@ -1119,7 +1119,7 @@ static int acx100_create_dma_regions(acx_device_t * adev) if (OK != acx_create_hostdesc_queues(adev)) goto fail; - acxmem_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); } #endif @@ -1240,10 +1240,7 @@ static int acx111_create_dma_regions(acx_device_t * adev) le32_to_cpu(queueconf.rx_memory_block_address), tx_queue_start, rx_queue_start); - if (IS_PCI(adev)) - acxpci_create_desc_queues(adev, tx_queue_start, rx_queue_start); - else if (IS_MEM(adev)) - acxmem_create_desc_queues(adev, tx_queue_start, rx_queue_start); + acx_create_desc_queues(adev, tx_queue_start, rx_queue_start); FN_EXIT1(OK); return OK; diff --git a/mem.c b/mem.c index 322245a..d9597f3 100644 --- a/mem.c +++ b/mem.c @@ -600,6 +600,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) * on the way out. */ +#if 0 // acxmem_create_desc_queues() void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, u32 rx_queue_start) { @@ -617,9 +618,8 @@ void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, p++; } acxmem_unlock(); - } - +#endif // acxmem_create_desc_queues() #if 0 STATick void acxmem_delete_dma_regions(acx_device_t *adev) { diff --git a/mem.h b/mem.h index 9c608c0..5c6c0ec 100644 --- a/mem.h +++ b/mem.h @@ -31,8 +31,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, //- int acxmem_create_hostdesc_queues(acx_device_t *adev); //- STATick int acxmem_create_rx_host_desc_queue(acx_device_t *adev); //- STATick int acxmem_create_tx_host_desc_queue(acx_device_t *adev); -void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); +//! void acxmem_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, +//! u32 rx_queue_start); //- STATick void acxmem_create_rx_desc_queue(acx_device_t *adev, u32 //- rx_queue_start); //- STATick void acxmem_create_tx_desc_queue(acx_device_t *adev, u32 //- tx_queue_start); //- void acxmem_free_desc_queues(acx_device_t *adev); diff --git a/merge.c b/merge.c index 9eb4f8b..18ea9a5 100644 --- a/merge.c +++ b/merge.c @@ -438,6 +438,30 @@ fail: return NOT_OK; } +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start) +{ + u32 *p; + int i; + + acxmem_lock_flags; + acxmem_lock(); + + acx_create_tx_desc_queue(adev, tx_queue_start); + acx_create_rx_desc_queue(adev, rx_queue_start); + + if (IS_PCI(adev)) + goto out; + + p = (u32 *) adev->acx_queue_indicator; + for (i = 0; i < 4; i++) { + write_slavemem32(adev, (u32) p, 0); + p++; + } +out: + acxmem_unlock(); +} + int acx_create_hostdesc_queues(acx_device_t *adev) { int result; diff --git a/merge.h b/merge.h index f6784ea..5c1e50e 100644 --- a/merge.h +++ b/merge.h @@ -73,6 +73,9 @@ int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_upload_fw(acx_device_t *adev); +void acx_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, + u32 rx_queue_start); + #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index dcc84fe..1f4ffee 100644 --- a/pci.c +++ b/pci.c @@ -240,7 +240,7 @@ static void vlynq_remove(struct vlynq_device *vdev); * plus 32 bytes safety offset at the end */ - +#if 0 // acxpci_create_desc_queues() void acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, u32 rx_queue_start) @@ -248,6 +248,7 @@ acxpci_create_desc_queues(acx_device_t * adev, u32 tx_queue_start, acx_create_tx_desc_queue(adev, tx_queue_start); acx_create_rx_desc_queue(adev, rx_queue_start); } +#endif // acxpci_create_desc_queues() //static #if 0 // diff --git a/pci.h b/pci.h index 6b04c5f..ca0c0d9 100644 --- a/pci.h +++ b/pci.h @@ -19,8 +19,8 @@ //= STATick int acxpci_create_rx_host_desc_queue(acx_device_t *adev); //=STATick int acxpci_create_tx_host_desc_queue(acx_device_t *adev); -void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, - u32 rx_queue_start); +//! void acxpci_create_desc_queues(acx_device_t *adev, u32 tx_queue_start, +//! u32 rx_queue_start); //=STATick void acxpci_create_rx_desc_queue(acx_device_t *adev, u32 rx_queue_start); //= STATick void acxpci_create_tx_desc_queue(acx_device_t *adev, u32 tx_queue_start); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:37
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 548 ++++++++++++++++++++++++++++++++++------------------------------- pci.c | 252 ++++++++++++++++-------------- 2 files changed, 423 insertions(+), 377 deletions(-) diff --git a/mem.c b/mem.c index d9597f3..64595b0 100644 --- a/mem.c +++ b/mem.c @@ -298,8 +298,8 @@ void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, ACXMEM_WARN_NOT_SPIN_LOCKED; /* - * Right now I'm making the assumption that the destination is aligned, but - * I'd better check. + * Right now I'm making the assumption that the destination is + * aligned, but I'd better check. */ if ((u32) destination & 3) { pr_acx("copy_from_slavemem: warning! destination not word-aligned!\n"); @@ -315,8 +315,9 @@ void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, } /* - * If the word reads above didn't satisfy the count, read one more word - * and transfer a byte at a time until the request is satisfied. + * If the word reads above didn't satisfy the count, read one + * more word and transfer a byte at a time until the request + * is satisfied. */ if (count) { write_reg32(adev, IO_ACX_SLV_MEM_ADDR, source); @@ -366,8 +367,8 @@ void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, } /* - * If there are leftovers read the next word from the acx and merge in - * what they want to write. + * If there are leftovers read the next word from the acx and + * merge in what they want to write. */ if (count) { write_reg32(adev, IO_ACX_SLV_MEM_ADDR, destination); @@ -377,7 +378,8 @@ void acxmem_copy_to_slavemem(acx_device_t *adev, u32 destination, *ptmp++ = *source++; } /* - * reset address in case we're currently in auto-increment mode + * reset address in case we're currently in + * auto-increment mode */ write_reg32(adev, IO_ACX_SLV_MEM_ADDR, destination); udelay (10); @@ -511,8 +513,9 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, acx_writel (val, &adev->iobase[ACX_SLV_MEM_ADDR]); /* - * Read the data from the slave data register, rounding up to the end - * of the word containing the last byte (hence the > 0) + * Read the data from the slave data register, rounding up to + * the end of the word containing the last byte (hence the > + * 0) */ while (count > 0) { *data++ = acx_readl (&adev->iobase[ACX_SLV_MEM_DATA]); @@ -520,8 +523,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, } /* - * If the destination wasn't aligned, we would have saved it in - * the aligned buffer, so copy it where it should go. + * If the destination wasn't aligned, we would have saved it + * in the aligned buffer, so copy it where it should go. */ if ((u32) destination & 3) { memcpy(destination, aligned_destination, saved_count); @@ -531,8 +534,8 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, /* * acxmem_s_create_rx_host_desc_queue * - * the whole size of a data buffer (header plus data body) - * plus 32 bytes safety offset at the end + * the whole size of a data buffer (header plus data body) plus 32 + * bytes safety offset at the end */ //static #if 0 // acxmem_create_rx_host_desc_queue() @@ -559,8 +562,8 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) goto fail; } - /* allocate Rx buffer pool which will be used by the acx - * to store the whole content of the received frames in it */ + /* allocate Rx buffer pool which will be used by the acx to + * store the whole content of the received frames in it */ adev->rxbuf_area_size = RX_CNT * RX_BUFFER_SIZE; adev->rxbuf_start @@ -572,9 +575,9 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) rxbuf = adev->rxbuf_start; hostdesc = adev->rxhostdesc_start; - /* don't make any popular C programming pointer arithmetic mistakes - * here, otherwise I'll kill you... - * (and don't dare asking me why I'm warning you about that...) */ + /* don't make any popular C programming pointer arithmetic + * mistakes here, otherwise I'll kill you... (and don't dare + * asking me why I'm warning you about that...) */ for (i = 0; i < RX_CNT; i++) { hostdesc->data = rxbuf; hostdesc->hd.length = cpu_to_le16(RX_BUFFER_SIZE); @@ -592,12 +595,12 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) #endif // acxmem_create_rx_host_desc_queue() /* - * In the generic slave memory access mode, most of the stuff in - * the txhostdesc_t is unused. It's only here because the rest of - * the ACX driver expects it to be since the PCI version uses indirect - * host memory organization with DMA. Since we're not using DMA the - * only use we have for the host descriptors is to store the packets - * on the way out. + * In the generic slave memory access mode, most of the stuff in the + * txhostdesc_t is unused. It's only here because the rest of the ACX + * driver expects it to be since the PCI version uses indirect host + * memory organization with DMA. Since we're not using DMA the only + * use we have for the host descriptors is to store the packets on the + * way out. */ #if 0 // acxmem_create_desc_queues() @@ -628,8 +631,8 @@ STATick void acxmem_delete_dma_regions(acx_device_t *adev) { FN_ENTER; /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's no - * longer possible here? */ + * here instead? Or are we that much down the road that it's + * no longer possible here? */ /* * slave memory interface really doesn't like this. */ @@ -683,12 +686,11 @@ acxmem_s_write_eeprom(acx_device_t *adev, u32 addr, u32 len, goto end; } - /* first we need to enable the OE (EEPROM Output Enable) GPIO line - * to be able to write to the EEPROM. - * NOTE: an EEPROM writing success has been reported, - * but you probably have to modify GPIO_OUT, too, - * and you probably need to activate a different GPIO - * line instead! */ + /* first we need to enable the OE (EEPROM Output Enable) GPIO + * line to be able to write to the EEPROM. NOTE: an EEPROM + * writing success has been reported, but you probably have to + * modify GPIO_OUT, too, and you probably need to activate a + * different GPIO line instead! */ gpio_orig = read_reg16(adev, IO_ACX_GPIO_OE); write_reg16(adev, IO_ACX_GPIO_OE, gpio_orig & ~1); write_flush(adev); @@ -768,9 +770,9 @@ int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { FN_ENTER; acxmem_lock(); - /* mprusko said that 32bit accesses result in distorted sensitivity - * on his card. Unconfirmed, looks like it's not true (most likely since we - * now properly flush writes). */ + /* mprusko said that 32bit accesses result in distorted + * sensitivity on his card. Unconfirmed, looks like it's not + * true (most likely since we now properly flush writes). */ write_reg32(adev, IO_ACX_PHY_DATA, value); write_reg32(adev, IO_ACX_PHY_ADDR, reg); write_flush(adev); @@ -779,13 +781,13 @@ int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { count = 0xffff; while (read_reg32(adev, IO_ACX_PHY_CTL)) { - /* scheduling away instead of CPU burning loop - * doesn't seem to work here at all: - * awful delay, sometimes also failure. - * Doesn't matter anyway (only small delay). */ + /* scheduling away instead of CPU burning loop doesn't + * seem to work here at all: awful delay, sometimes + * also failure. Doesn't matter anyway (only small + * delay). */ if (unlikely(!--count)) { - pr_acx("%s: timeout waiting for phy read\n", wiphy_name( - adev->ieee->wiphy)); + pr_acx("%s: timeout waiting for phy read\n", + wiphy_name(adev->ieee->wiphy)); goto fail; } cpu_relax(); @@ -1028,16 +1030,17 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { #ifdef PATCH_AROUND_BAD_SPOTS acxmem_lock(); /* - * Only want to do this if the firmware is exactly what we expect for an - * iPaq 4700; otherwise, bad things would ensue. + * Only want to do this if the firmware is exactly what we + * expect for an iPaq 4700; otherwise, bad things would ensue. */ if ((HX4700_FIRMWARE_CHECKSUM == fw_image->chksum) || (HX4700_ALTERNATE_FIRMWARE_CHECKSUM == fw_image->chksum)) { /* - * Put the patch after the main firmware image. 0x950c contains - * the ACX's idea of the end of the firmware. Use that location to - * load ours (which depends on that location being 0xab58) then - * update that location to point to after ours. + * Put the patch after the main firmware image. + * 0x950c contains the ACX's idea of the end of the + * firmware. Use that location to load ours (which + * depends on that location being 0xab58) then update + * that location to point to after ours. */ offset = read_slavemem32(adev, 0x950c); @@ -1050,12 +1053,14 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { } /* - * Patch the instruction at 0x0804 to branch to our ARM patch at 0xab58 + * Patch the instruction at 0x0804 to branch to our + * ARM patch at 0xab58 */ write_slavemem32(adev, 0x0804, 0xea000000 + (0xab58 - 0x0804 - 8) / 4); /* - * Patch the instructions at 0x1f40 to branch to our Thumb patch at 0xab74 + * Patch the instructions at 0x1f40 to branch to our + * Thumb patch at 0xab74 * * 4a00 ldr r2, [pc, #0] * 4710 bx r2 @@ -1092,14 +1097,15 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { * * OW, 20100630: * - * The mem device is quite sensible to data access operations, therefore - * we may not sleep during the command handling. + * The mem device is quite sensible to data access operations, + * therefore we may not sleep during the command handling. * - * This has manifested as problem during sw-scan while if up. The acx got - * stuck - most probably due to concurrent data access collision. + * This has manifested as problem during sw-scan while if up. The acx + * got stuck - most probably due to concurrent data access collision. * - * By not sleeping anymore and doing the entire operation completely under - * spinlock (thus with irqs disabled), the sw scan problem was solved. + * By not sleeping anymore and doing the entire operation completely + * under spinlock (thus with irqs disabled), the sw scan problem was + * solved. * * We can now run repeating sw scans, under load, without that the acx * device gets stuck. @@ -1192,9 +1198,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* wait for firmware to process command */ - /* Ensure nonzero and not too large timeout. - ** Also converts e.g. 100->99, 200->199 - ** which is nice but not essential */ + /* Ensure nonzero and not too large timeout. Also converts + * e.g. 100->99, 200->199 which is nice but not essential */ cmd_timeout = (cmd_timeout - 1) | 1; if (unlikely(cmd_timeout> 1199)) cmd_timeout = 1199; @@ -1259,8 +1264,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, if (cmd_status != 1) { /* it is not a 'Success' */ /* zero out result buffer - * WARNING: this will trash stack in case of illegally large input - * length! */ + * WARNING: this will trash stack in case of illegally + * large input length! */ if (buflen > 388) { /* @@ -1302,8 +1307,8 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, return OK; bad: - /* Give enough info so that callers can avoid - ** printing their own diagnostic messages */ + /* Give enough info so that callers can avoid printing their + * own diagnostic messages */ logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n", devname, cmdstr, buflen, cmd_timeout, @@ -1413,8 +1418,8 @@ int acxmem_reset_dev(acx_device_t *adev) /* write_reg32 (adev, IO_ACX_SLV_MEM_CP, 0); */ - /* reset the device to make sure the eCPU is stopped - * to upload the firmware correctly */ + /* reset the device to make sure the eCPU is stopped to upload + * the firmware correctly */ /* Windows driver does some funny things here */ /* @@ -1468,8 +1473,8 @@ int acxmem_reset_dev(acx_device_t *adev) /* need to know radio type before fw load */ /* Need to wait for arrival of this information in a loop, * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also - * sets the radio type ID */ + * (started burst read in reset_mac()) which also sets the + * radio type ID */ count = 0xffff; do { @@ -1573,16 +1578,17 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { acx111_ie_configoption_t co; acxmem_lock_flags; - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large parts of the I/O registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ if (OK != acx_reset_dev(adev)) return -1; acxmem_lock(); if (IS_ACX100(adev)) { - /* ACX100: configopt struct in cmd mailbox - directly after reset */ + /* ACX100: configopt struct in cmd mailbox - directly + * after reset */ acxmem_copy_from_slavemem(adev, (u8*) &co, (u32) adev->cmd_area, sizeof(co)); } acxmem_unlock(); @@ -1591,7 +1597,8 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { return -3; if (IS_ACX111(adev)) { - /* ACX111: configopt struct needs to be queried after full init */ + /* ACX111: configopt struct needs to be queried after + * full init */ acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS); } @@ -1602,15 +1609,17 @@ STATick int acxmem_complete_hw_reset(acx_device_t *adev) { acxmem_lock(); /* - * Windows driver writes 0x01000000 to register 0x288, RADIO_CTL, if the form factor - * is 3. It also write protects the EEPROM by writing 1<<9 to GPIO_OUT + * Windows driver writes 0x01000000 to register 0x288, + * RADIO_CTL, if the form factor is 3. It also write protects + * the EEPROM by writing 1<<9 to GPIO_OUT */ if (adev->form_factor == 3) { set_regbits(adev, 0x288, 0x01000000); set_regbits(adev, 0x298, 1 << 9); } - /* TODO: merge them into one function, they are called just once and are the same for pci & usb */ + /* TODO: merge them into one function, they are called just + * once and are the same for pci & usb */ if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version)) return -2; @@ -1753,34 +1762,34 @@ int acxmem_proc_diag_output(struct seq_file *file, acxmem_copy_from_slavemem(adev, (u8 *) &rxd, (u32) rxdesc, sizeof(rxd)); seq_printf(file, - "%04x: %04x %04x %04x %04x %04x %04x %04x Ctl_8=%04x %04x %04x %04x %04x %04x %04x %04x\n", - (u32) rxdesc, - rxd.pNextDesc.v, - rxd.HostMemPtr.v, - rxd.ACXMemPtr.v, - rxd.rx_time, - rxd.total_length, - rxd.WEP_length, - rxd.WEP_ofs, - rxd.Ctl_8, - rxd.rate, - rxd.error, - rxd.SNR, - rxd.RxLevel, - rxd.queue_ctrl, - rxd.unknown, - rxd.unknown2); + "%04x: %04x %04x %04x %04x %04x %04x %04x Ctl_8=%04x %04x %04x %04x %04x %04x %04x %04x\n", + (u32) rxdesc, + rxd.pNextDesc.v, + rxd.HostMemPtr.v, + rxd.ACXMemPtr.v, + rxd.rx_time, + rxd.total_length, + rxd.WEP_length, + rxd.WEP_ofs, + rxd.Ctl_8, + rxd.rate, + rxd.error, + rxd.SNR, + rxd.RxLevel, + rxd.queue_ctrl, + rxd.unknown, + rxd.unknown2); rxdesc++; } seq_printf(file, "** Tx buf (free %d, Ieee80211 queue: %s) **\n", - adev->acx_txbuf_free, acx_queue_stopped(adev->ieee) ? "STOPPED" - : "Running"); + adev->acx_txbuf_free, acx_queue_stopped(adev->ieee) + ? "STOPPED" : "Running"); seq_printf(file, - "** Tx buf %d blocks total, %d available, free list head %04x\n", - adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, - adev->acx_txbuf_free); + "** Tx buf %d blocks total, %d available, free list head %04x\n", + adev->acx_txbuf_numblocks, adev->acx_txbuf_blocks_free, + adev->acx_txbuf_free); txdesc = adev->txdesc_start; if (txdesc) { @@ -1796,18 +1805,18 @@ int acxmem_proc_diag_output(struct seq_file *file, seq_printf(file, "%02u available (%02X)%-7s%-7s", i, Ctl_8, thd, ttl); else seq_printf(file, "%02u busy (%02X)%-7s%-7s", i, Ctl_8, thd, ttl); - + seq_printf(file, - "%04x: %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %02x %02x %02x %02x " - "%02x %02x %02x %02x %04x: ", (u32) txdesc, - txd.pNextDesc.v, txd.HostMemPtr.v, txd.AcxMemPtr.v, - txd.tx_time, txd.total_length, txd.Reserved, - txd.dummy[0], txd.dummy[1], txd.dummy[2], - txd.dummy[3], txd.Ctl_8, txd.Ctl2_8, txd.error, - txd.ack_failures, txd.rts_failures, - txd.rts_ok, txd.u.r1.rate, - txd.u.r1.queue_ctrl, txd.queue_info); - + "%04x: %04x %04x %04x %04x %04x %04x %04x %04x %04x %04x %02x %02x %02x %02x " + "%02x %02x %02x %02x %04x: ", (u32) txdesc, + txd.pNextDesc.v, txd.HostMemPtr.v, txd.AcxMemPtr.v, + txd.tx_time, txd.total_length, txd.Reserved, + txd.dummy[0], txd.dummy[1], txd.dummy[2], + txd.dummy[3], txd.Ctl_8, txd.Ctl2_8, txd.error, + txd.ack_failures, txd.rts_failures, + txd.rts_ok, txd.u.r1.rate, + txd.u.r1.queue_ctrl, txd.queue_info); + tmp = read_slavemem32(adev, (u32) & (txdesc->AcxMemPtr)); seq_printf(file, " %04x: ", tmp); @@ -1920,7 +1929,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { /* First, have a loop to determine the first descriptor that's * full, just in case there's a mismatch between our current - * rx_tail and the full descriptor we're supposed to handle. */ + * rx_tail and the full descriptor we're supposed to + * handle. */ tail = adev->rx_tail; count = RX_CNT; while (1) { @@ -1930,11 +1940,12 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { tail = (tail + 1) % RX_CNT; /* - * Unlike the PCI interface, where the ACX can write directly to - * the host descriptors, on the slave memory interface we have to - * pull these. All we really need to do is check the Ctl_8 field - * in the rx descriptor on the ACX, which should be 0x11000000 if - * we should process it. + * Unlike the PCI interface, where the ACX can write + * directly to the host descriptors, on the slave + * memory interface we have to pull these. All we + * really need to do is check the Ctl_8 field in the + * rx descriptor on the ACX, which should be + * 0x11000000 if we should process it. */ Ctl_8 = hostdesc->hd.Ctl_16 = read_slavemem8(adev, (u32) &(rxdesc->Ctl_8)); if ((Ctl_8 & DESC_CTL_HOSTOWN) && (Ctl_8 & DESC_CTL_ACXDONE)) @@ -1948,9 +1959,9 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { while (1) { log(L_BUFR, "%s: rx: tail=%u Ctl_8=%02X\n", __func__, tail, Ctl_8); /* - * If the ACX has CTL_RECLAIM set on this descriptor there - * is no buffer associated; it just wants us to tell it to - * reclaim the memory. + * If the ACX has CTL_RECLAIM set on this descriptor + * there is no buffer associated; it just wants us to + * tell it to reclaim the memory. */ if (!(Ctl_8 & DESC_CTL_RECLAIM)) { @@ -1961,15 +1972,19 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { (u32) &(rxdesc->total_length)); /* - * hostdesc->data is an rxbuffer_t, which includes header information, - * but the length in the data packet doesn't. The header information - * takes up an additional 12 bytes, so add that to the length we copy. + * hostdesc->data is an rxbuffer_t, which + * includes header information, but the length + * in the data packet doesn't. The header + * information takes up an additional 12 + * bytes, so add that to the length we copy. */ addr = read_slavemem32(adev, (u32) &(rxdesc->ACXMemPtr)); if (addr) { /* - * How can &(rxdesc->ACXMemPtr) above ever be zero? Looks like we - * get that now and then - try to trap it for debug. + * How can &(rxdesc->ACXMemPtr) above + * ever be zero? Looks like we get + * that now and then - try to trap it + * for debug. */ if (addr & 0xffff0000) { log(L_ANY, "%s: rxdesc 0x%08x\n", __func__, (u32) rxdesc); @@ -1996,8 +2011,8 @@ STATick void acxmem_process_rxdesc(acx_device_t *adev) { write_slavemem8(adev, (u32) &rxdesc->Ctl_8, Ctl_8); /* - * Now tell the ACX we've finished with the receive buffer so - * it can finish the reclaim. + * Now tell the ACX we've finished with the receive + * buffer so it can finish the reclaim. */ write_reg16(adev, IO_ACX_INT_TRIG, INT_TRIG_RXPRC); @@ -2047,8 +2062,8 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) int blocks_needed; /* - * Take 4 off the memory block size to account for the reserved word at the start of - * the block. + * Take 4 off the memory block size to account for the + * reserved word at the start of the block. */ blocks_needed = acxmem_get_txbuf_space_needed(adev, count); @@ -2059,8 +2074,9 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) last_block = block = adev->acx_txbuf_free; /* - * Follow block pointers through the requested number of blocks both to - * find the new head of the free list and to set the flags for the blocks + * Follow block pointers through the requested number + * of blocks both to find the new head of the free + * list and to set the flags for the blocks * appropriately. */ while (blocks_needed--) { @@ -2084,13 +2100,14 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) } /* - * Flag the last block both by clearing out the next pointer - * and marking the control field. + * Flag the last block both by clearing out the next + * pointer and marking the control field. */ write_slavemem32(adev, last_block, 0x02000000); /* - * If we're out of buffers make sure the free list pointer is NULL + * If we're out of buffers make sure the free list + * pointer is NULL */ if (!adev->acx_txbuf_blocks_free) { adev->acx_txbuf_free = 0; @@ -2103,11 +2120,12 @@ u32 acxmem_allocate_acx_txbuf_space(acx_device_t *adev, int count) } /* - * Return buffer space back to the pool by following the next pointers until we find - * the block marked as the end. Point the last block to the head of the free list, - * then update the head of the free list to point to the newly freed memory. - * This routine gets called in interrupt context, so it shouldn't block to protect - * the integrity of the linked list. The ISR already holds the lock. + * Return buffer space back to the pool by following the next pointers + * until we find the block marked as the end. Point the last block to + * the head of the free list, then update the head of the free list to + * point to the newly freed memory. This routine gets called in + * interrupt context, so it shouldn't block to protect the integrity + * of the linked list. The ISR already holds the lock. */ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { u32 cur, last, next; @@ -2132,10 +2150,12 @@ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } while (!(next & 0x02000000)); /* - * last now points to the last block of that allocation. Update the pointer - * in that block to point to the free list and reset the free list to the - * first block of the free call. If there were no free blocks, make sure - * the new end of the list marks itself as truly the end. + * last now points to the last block of that + * allocation. Update the pointer in that block to + * point to the free list and reset the free list to + * the first block of the free call. If there were no + * free blocks, make sure the new end of the list + * marks itself as truly the end. */ if (adev->acx_txbuf_free) { write_slavemem32(adev, last, adev->acx_txbuf_free >> 5); @@ -2148,25 +2168,28 @@ STATick void acxmem_reclaim_acx_txbuf_space(acx_device_t *adev, u32 blockptr) { } /* - * Initialize the pieces managing the transmit buffer pool on the ACX. The transmit - * buffer is a circular queue with one 32 bit word reserved at the beginning of each - * block. The upper 13 bits are a control field, of which only 0x02000000 has any - * meaning. The lower 19 bits are the address of the next block divided by 32. + * Initialize the pieces managing the transmit buffer pool on the ACX. + * The transmit buffer is a circular queue with one 32 bit word + * reserved at the beginning of each block. The upper 13 bits are a + * control field, of which only 0x02000000 has any meaning. The lower + * 19 bits are the address of the next block divided by 32. */ static void acxmem_init_acx_txbuf(acx_device_t *adev) { /* - * acx100_s_init_memory_pools set up txbuf_start and txbuf_numblocks for us. - * All we need to do is reset the rest of the bookeeping. + * acx100_s_init_memory_pools set up txbuf_start and + * txbuf_numblocks for us. All we need to do is reset the + * rest of the bookeeping. */ adev->acx_txbuf_free = adev->acx_txbuf_start; adev->acx_txbuf_blocks_free = adev->acx_txbuf_numblocks; /* - * Initialization leaves the last transmit pool block without a pointer back to - * the head of the list, but marked as the end of the list. That's how we want - * to see it, too, so leave it alone. This is only ever called after a firmware + * Initialization leaves the last transmit pool block without + * a pointer back to the head of the list, but marked as the + * end of the list. That's how we want to see it, too, so + * leave it alone. This is only ever called after a firmware * reset, so the ACX memory is in the state we want. */ @@ -2240,7 +2263,8 @@ void acxmem_clean_txdesc_emergency(acx_device_t *adev) #if 0 u32 acxmem; /* - * Clean up the memory allocated on the ACX for this transmit descriptor. + * Clean up the memory allocated on the ACX for this + * transmit descriptor. */ acxmem = read_slavemem32(adev, (u32) &(txdesc->AcxMemPtr)); @@ -2266,9 +2290,9 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { int count; /* - * Can't handle an interrupt while we're fiddling with the ACX's lock, - * according to TI. The ACX is supposed to hold fw_lock for at most - * 500ns. + * Can't handle an interrupt while we're fiddling with the + * ACX's lock, according to TI. The ACX is supposed to hold + * fw_lock for at most 500ns. */ local_irq_save(flags); @@ -2283,8 +2307,8 @@ void acxmem_update_queue_indicator(acx_device_t *adev, int txqueue) { if (count < 50) { /* - * Take out the host lock - anything non-zero will work, so don't worry about - * be/le + * Take out the host lock - anything non-zero will + * work, so don't worry about be/le */ write_slavemem16 (adev, (u32) &(adev->acx_queue_indicator->host_lock), 1); @@ -2342,9 +2366,9 @@ STATick void acxmem_i_tx_timeout(struct net_device *ndev) { tx_num_cleaned = acxmem_tx_clean_txdesc(adev); /* nothing cleaned, yet (almost) no free buffers available? - * --> clean all tx descs, no matter which status!! - * Note that I strongly suspect that doing emergency cleaning - * may confuse the firmware. This is a last ditch effort to get + * --> clean all tx descs, no matter which status!! Note that + * I strongly suspect that doing emergency cleaning may + * confuse the firmware. This is a last ditch effort to get * ANYTHING to work again... * * TODO: it's best to simply reset & reinit hw from scratch... @@ -2387,9 +2411,9 @@ void acxmem_irq_work(struct work_struct *work) acx_sem_lock(adev); acxmem_lock(); - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); irqmasked = irqreason & ~adev->irq_mask; @@ -2444,10 +2468,10 @@ void acxmem_irq_work(struct work_struct *work) acx_log_irq(irqreason); } - /* Routine to perform blink with range - * FIXME: update_link_quality_led is a stub - add proper code and enable this again: - if (unlikely(adev->led_power == 2)) - update_link_quality_led(adev); + /* Routine to perform blink with range FIXME: + * update_link_quality_led is a stub - add proper code and + * enable this again: if (unlikely(adev->led_power == 2)) + * update_link_quality_led(adev); */ // Renable irq-signal again for irqs we are interested in @@ -2543,8 +2567,8 @@ STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id) adev->irq_last_jiffies = jiffies; } - /* safety condition; we'll normally abort loop below - * in case no IRQ type occurred */ + /* safety condition; we'll normally abort loop below in case + * no IRQ type occurred */ while (likely(--irqcount)) { #endif /* ACK all IRQs ASAP */ @@ -2565,12 +2589,14 @@ STATick irqreturn_t acxmem_interrupt(int irq, void *dev_id) if (irqtype & HOST_INT_TX_COMPLETE) { log(L_IRQ, "got Tx_Complete IRQ\n"); - /* don't clean up on each Tx complete, wait a bit - * unless we're going towards full, in which case - * we do it immediately, too (otherwise we might lockup - * with a full Tx buffer if we go into - * acxmem_l_clean_txdesc() at a time when we won't wakeup - * the net queue in there for some reason...) */ + /* don't clean up on each Tx complete, wait a + * bit unless we're going towards full, in + * which case we do it immediately, too + * (otherwise we might lockup with a full Tx + * buffer if we go into + * acxmem_l_clean_txdesc() at a time when we + * won't wakeup the net queue in there for + * some reason...) */ if (adev->tx_free <= TX_START_CLEAN) { #if TX_CLEANUP_IN_SOFTIRQ acx_schedule_task(adev, ACX_AFTER_IRQ_TX_CLEANUP); @@ -2958,21 +2984,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (rxhostdesc) for (i = 0; i < RX_CNT; i++) { pr_acx("\ndump host rxdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - rxhostdesc, - acx2cpu(rxhostdesc->data_phy), - rxhostdesc->data_offset, - le16_to_cpu(rxhostdesc->hd.Ctl_16), - le16_to_cpu(rxhostdesc->hd.length), - acx2cpu(rxhostdesc->desc_phy_next), - rxhostdesc->Status); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + rxhostdesc, + acx2cpu(rxhostdesc->data_phy), + rxhostdesc->data_offset, + le16_to_cpu(rxhostdesc->hd.Ctl_16), + le16_to_cpu(rxhostdesc->hd.length), + acx2cpu(rxhostdesc->desc_phy_next), + rxhostdesc->Status); rxhostdesc++; } @@ -2983,27 +3009,27 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (txdesc) for (i = 0; i < TX_CNT; i++) { pr_acx("\ndump internal txdesc %d:\n" - "size 0x%X\n" - "mem pos %p\n" - "next 0x%X\n" - "acx mem pointer (dynamic) 0x%X\n" - "host mem pointer (dynamic) 0x%X\n" - "length (dynamic) 0x%X\n" - "CTL (dynamic) 0x%X\n" - "CTL2 (dynamic) 0x%X\n" - "Status (dynamic) 0x%X\n" - "Rate (dynamic) 0x%X\n", - i, - (int) sizeof(struct txdesc), - txdesc, - acx2cpu(txdesc->pNextDesc), - acx2cpu(txdesc->AcxMemPtr), - acx2cpu(txdesc->HostMemPtr), - le16_to_cpu(txdesc->total_length), - txdesc->Ctl_8, - txdesc->Ctl2_8, - txdesc->error, - txdesc->u.r1.rate); + "size 0x%X\n" + "mem pos %p\n" + "next 0x%X\n" + "acx mem pointer (dynamic) 0x%X\n" + "host mem pointer (dynamic) 0x%X\n" + "length (dynamic) 0x%X\n" + "CTL (dynamic) 0x%X\n" + "CTL2 (dynamic) 0x%X\n" + "Status (dynamic) 0x%X\n" + "Rate (dynamic) 0x%X\n", + i, + (int) sizeof(struct txdesc), + txdesc, + acx2cpu(txdesc->pNextDesc), + acx2cpu(txdesc->AcxMemPtr), + acx2cpu(txdesc->HostMemPtr), + le16_to_cpu(txdesc->total_length), + txdesc->Ctl_8, + txdesc->Ctl2_8, + txdesc->error, + txdesc->u.r1.rate); txdesc = acxmem_advance_txdesc(adev, txdesc, 1); } @@ -3015,21 +3041,21 @@ int acx111pci_ioctl_info(struct ieee80211_hw *hw, if (txhostdesc) for (i = 0; i < TX_CNT * 2; i++) { pr_acx("\ndump host txdesc %d:\n" - "mem pos %p\n" - "buffer mem pos 0x%X\n" - "buffer mem offset 0x%X\n" - "CTL 0x%X\n" - "Length 0x%X\n" - "next 0x%X\n" - "Status 0x%X\n", - i, - txhostdesc, - acx2cpu(txhostdesc->data_phy), - txhostdesc->data_offset, - le16_to_cpu(txhostdesc->hd.Ctl_16), - le16_to_cpu(txhostdesc->hd.length), - acx2cpu(txhostdesc->desc_phy_next), - le32_to_cpu(txhostdesc->Status)); + "mem pos %p\n" + "buffer mem pos 0x%X\n" + "buffer mem offset 0x%X\n" + "CTL 0x%X\n" + "Length 0x%X\n" + "next 0x%X\n" + "Status 0x%X\n", + i, + txhostdesc, + acx2cpu(txhostdesc->data_phy), + txhostdesc->data_offset, + le16_to_cpu(txhostdesc->hd.Ctl_16), + le16_to_cpu(txhostdesc->hd.length), + acx2cpu(txhostdesc->desc_phy_next), + le32_to_cpu(txhostdesc->Status)); txhostdesc++; } @@ -3144,21 +3170,24 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { ieee->queues = 1; // OW TODO Check if RTS/CTS threshold can be included here - /* TODO: although in the original driver the maximum value was 100, - * the OpenBSD driver assigns maximum values depending on the type of - * radio transceiver (i.e. Radia, Maxim, etc.). This value is always a - * positive integer which most probably indicates the gain of the AGC - * in the rx path of the chip, in dB steps (0.625 dB, for example?). - * The mapping of this rssi value to dBm is still unknown, but it can - * nevertheless be used as a measure of relative signal strength. The - * other two values, i.e. max_signal and max_noise, do not seem to be - * supported on my acx111 card (they are always 0), although iwconfig - * reports them (in dBm) when using ndiswrapper with the Windows XP - * driver. The GPL-licensed part of the AVM FRITZ!WLAN USB Stick - * driver sources (for the TNETW1450, though) seems to also indicate - * that only the RSSI is supported. In conclusion, the max_signal and - * max_noise values will not be initialised by now, as they do not - * seem to be supported or how to acquire them is still unknown. */ + /* TODO: although in the original driver the maximum value was + * 100, the OpenBSD driver assigns maximum values depending on + * the type of radio transceiver (i.e. Radia, Maxim, + * etc.). This value is always a positive integer which most + * probably indicates the gain of the AGC in the rx path of + * the chip, in dB steps (0.625 dB, for example?). The + * mapping of this rssi value to dBm is still unknown, but it + * can nevertheless be used as a measure of relative signal + * strength. The other two values, i.e. max_signal and + * max_noise, do not seem to be supported on my acx111 card + * (they are always 0), although iwconfig reports them (in + * dBm) when using ndiswrapper with the Windows XP driver. The + * GPL-licensed part of the AVM FRITZ!WLAN USB Stick driver + * sources (for the TNETW1450, though) seems to also indicate + * that only the RSSI is supported. In conclusion, the + * max_signal and max_noise values will not be initialised by + * now, as they do not seem to be supported or how to acquire + * them is still unknown. */ // We base signal quality on winlevel approach of previous driver // TODO OW 20100615 This should into a common init code @@ -3172,8 +3201,9 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { spin_lock_init(&adev->spinlock); /* initial state: unlocked */ /* We do not start with downed sem: we want PARANOID_LOCKING to work */ mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->pdev = pdev; @@ -3187,7 +3217,7 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { platform_set_drvdata(pdev, ieee); /* chiptype is u8 but id->driver_data is ulong - ** Works for now (possible values are 1 and 2) */ + * Works for now (possible values are 1 and 2) */ chip_type = CHIPTYPE_ACX100; /* acx100 and acx111 have different PCI memory regions */ if (chip_type == CHIPTYPE_ACX100) { @@ -3223,13 +3253,13 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { adev->irq = i; log(L_ANY, "found an %s-based wireless network card, " - "irq:%d, " - "membase:0x%p, mem_size:%ld, " - "iobase:0x%p", - chip_name, - adev->irq, - adev->membase, addr_size, - adev->iobase); + "irq:%d, " + "membase:0x%p, mem_size:%ld, " + "iobase:0x%p", + chip_name, + adev->irq, + adev->membase, addr_size, + adev->iobase); log(L_ANY, "the initial debug setting is 0x%04X\n", acx_debug); if (adev->irq == 0) { @@ -3286,13 +3316,15 @@ STATick int __devinit acxmem_probe(struct platform_device *pdev) { /* Register the card, AFTER everything else has been set up, * since otherwise an ioctl could step on our feet due to - * firmware operations happening in parallel or uninitialized data */ + * firmware operations happening in parallel or uninitialized + * data */ if (acx_proc_register_entries(ieee) != OK) goto fail_proc_register_entries; /* Now we have our device, so make sure the kernel doesn't try - * to send packets even though we're not associated to a network yet */ + * to send packets even though we're not associated to a + * network yet */ // OW FIXME Check if acx_stop_queue, acx_carrier_off should be included // OW Rest can be cleaned up @@ -3401,9 +3433,9 @@ STATick int __devexit acxmem_remove(struct platform_device *pdev) { } #ifdef REDUNDANT - /* put the eCPU to sleep to save power - * Halting is not possible currently, - * since not supported by all firmware versions */ + /* put the eCPU to sleep to save power Halting is not + * possible currently, since not supported by all + * firmware versions */ acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0); #endif @@ -3450,9 +3482,8 @@ STATick int __devexit acxmem_remove(struct platform_device *pdev) { /* remove dev registration */ platform_set_drvdata(pdev, NULL); - /* Free netdev (quite late, - * since otherwise we might get caught off-guard - * by a netdev timeout handler execution + /* Free netdev (quite late, since otherwise we might get + * caught off-guard by a netdev timeout handler execution * expecting to see a working dev...) */ ieee80211_free_hw(adev->ieee); @@ -3543,8 +3574,9 @@ STATick int acxmem_e_resume(struct platform_device *pdev) { acx_up(hw); pr_acx("rsm: acx up done\n"); - /* now even reload all card parameters as they were before suspend, - * and possibly be back in the network again already :-) + /* now even reload all card parameters as they were before + * suspend, and possibly be back in the network again already + * :-) */ /* - most settings updated in acxmem_s_up() */ if (ACX_STATE_IFACE_UP & adev->dev_state_mask) { diff --git a/pci.c b/pci.c index 1f4ffee..1116e8e 100644 --- a/pci.c +++ b/pci.c @@ -256,16 +256,16 @@ void acxpci_delete_dma_regions(acx_device_t * adev) { FN_ENTER; /* disable radio Tx/Rx. Shouldn't we use the firmware commands - * here instead? Or are we that much down the road that it's no - * longer possible here? */ + * here instead? Or are we that much down the road that it's + * no longer possible here? */ write_reg16(adev, IO_ACX_ENABLE, 0); acx_mwait(100); - /* NO locking for all parts of acxpci_free_desc_queues because: - * while calling dma_free_coherent() interrupts need to be 'free' - * but if you spinlock the whole function (acxpci_free_desc_queues) - * you'll get an error */ + /* NO locking for all parts of acxpci_free_desc_queues + * because: while calling dma_free_coherent() interrupts need + * to be 'free' but if you spinlock the whole function + * (acxpci_free_desc_queues) you'll get an error */ acx_free_desc_queues(adev); FN_EXIT0; @@ -313,12 +313,11 @@ acxpci_s_write_eeprom(acx_device_t * adev, u32 addr, u32 len, FN_ENTER; - /* first we need to enable the OE (EEPROM Output Enable) GPIO line - * to be able to write to the EEPROM. - * NOTE: an EEPROM writing success has been reported, - * but you probably have to modify GPIO_OUT, too, - * and you probably need to activate a different GPIO - * line instead! */ + /* first we need to enable the OE (EEPROM Output Enable) GPIO + * line to be able to write to the EEPROM. NOTE: an EEPROM + * writing success has been reported, but you probably have to + * modify GPIO_OUT, too, and you probably need to activate a + * different GPIO line instead! */ gpio_orig = read_reg16(adev, IO_ACX_GPIO_OE); write_reg16(adev, IO_ACX_GPIO_OE, gpio_orig & ~1); write_flush(adev); @@ -400,9 +399,9 @@ int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value) { FN_ENTER; - /* mprusko said that 32bit accesses result in distorted sensitivity - * on his card. Unconfirmed, looks like it's not true (most likely since we - * now properly flush writes). */ + /* mprusko said that 32bit accesses result in distorted + * sensitivity on his card. Unconfirmed, looks like it's not + * true (most likely since we now properly flush writes). */ write_reg32(adev, IO_ACX_PHY_DATA, value); write_reg32(adev, IO_ACX_PHY_ADDR, reg); write_flush(adev); @@ -587,9 +586,10 @@ int acxpci_upload_fw(acx_device_t *adev) FN_ENTER; - /* print exact chipset and radio ID to make sure people - * really get a clue on which files exactly they need to provide. - * Firmware loading is a frequent end-user PITA with these chipsets. + /* print exact chipset and radio ID to make sure people really + * get a clue on which files exactly they need to provide. + * Firmware loading is a frequent end-user PITA with these + * chipsets. */ pr_acx("need firmware for acx1%02d chipset with radio ID %02X\n" "Please provide via firmware hotplug:\n" @@ -602,9 +602,11 @@ int acxpci_upload_fw(acx_device_t *adev) IS_ACX111(adev)*11, adev->radio_type ); - /* print exact chipset and radio ID to make sure people really get a clue on which files exactly they are supposed to provide, - * since firmware loading is the biggest enduser PITA with these chipsets. - * Not printing radio ID in 0xHEX in order to not confuse them into wrong file naming */ + /* print exact chipset and radio ID to make sure people really + * get a clue on which files exactly they are supposed to + * provide, since firmware loading is the biggest enduser PITA + * with these chipsets. Not printing radio ID in 0xHEX in + * order to not confuse them into wrong file naming */ pr_acx("need to load firmware for acx1%02d chipset with radio ID %02x, please provide via firmware hotplug:\n" "acx: either one file only (<c>ombined firmware image file, radio-specific) or two files (radio-less base image file *plus* separate <r>adio-specific extension file)\n", IS_ACX111(adev)*11, adev->radio_type); @@ -734,8 +736,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, /* now write the parameters of the command if needed */ if (buffer && buflen) { - /* if it's an INTERROGATE command, just pass the length - * of parameters to read, as data */ + /* if it's an INTERROGATE command, just pass the + * length of parameters to read, as data */ #if CMD_DISCOVERY if (cmd == ACX1xx_CMD_INTERROGATE) memset_io(adev->cmd_area + 4, 0xAA, buflen); @@ -756,9 +758,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, /* wait for firmware to process command */ - /* Ensure nonzero and not too large timeout. - ** Also converts e.g. 100->99, 200->199 - ** which is nice but not essential */ + /* Ensure nonzero and not too large timeout. Also converts + * e.g. 100->99, 200->199 which is nice but not essential */ cmd_timeout = (cmd_timeout - 1) | 1; if (unlikely(cmd_timeout > 1199)) cmd_timeout = 1199; @@ -825,8 +826,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, if (1 != cmd_status) { /* it is not a 'Success' */ /* zero out result buffer - * WARNING: this will trash stack in case of illegally large input - * length! */ + * WARNING: this will trash stack in case of illegally + * large input length! */ if (buffer && buflen) memset(buffer, 0, buflen); goto bad; @@ -848,8 +849,8 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, return OK; bad: - /* Give enough info so that callers can avoid - ** printing their own diagnostic messages */ + /* Give enough info so that callers can avoid printing their + * own diagnostic messages */ logf1(L_ANY, "%s: cmd=%s, buflen=%u, timeout=%ums, type=0x%04X, status=%s: FAILED\n", devname, cmdstr, buflen, cmd_timeout, @@ -946,8 +947,8 @@ int acxpci_reset_dev(acx_device_t *adev) FN_ENTER; - /* reset the device to make sure the eCPU is stopped - * to upload the firmware correctly */ + /* reset the device to make sure the eCPU is stopped to upload + * the firmware correctly */ #ifdef CONFIG_PCI acxpci_reset_mac(adev); @@ -977,8 +978,8 @@ int acxpci_reset_dev(acx_device_t *adev) /* need to know radio type before fw load */ /* Need to wait for arrival of this information in a loop, * most probably since eCPU runs some init code from EEPROM - * (started burst read in reset_mac()) which also - * sets the radio type ID */ + * (started burst read in reset_mac()) which also sets the + * radio type ID */ count = 0xffff; do { @@ -1178,24 +1179,24 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) txdesc = acx_advance_txdesc(adev, txdesc, 1); } seq_printf(file, - "\n" - "** PCI data **\n" - "txbuf_start %p, txbuf_area_size %u, txbuf_startphy %08llx\n" - "txdesc_size %u, txdesc_start %p\n" - "txhostdesc_start %p, txhostdesc_area_size %u, txhostdesc_startphy %08llx\n" - "rxdesc_start %p\n" - "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" - "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", - adev->txbuf_start, adev->txbuf_area_size, - (unsigned long long)adev->txbuf_startphy, - adev->txdesc_size, adev->txdesc_start, - adev->txhostdesc_start, adev->txhostdesc_area_size, - (unsigned long long)adev->txhostdesc_startphy, - adev->rxdesc_start, - adev->rxhostdesc_start, adev->rxhostdesc_area_size, - (unsigned long long)adev->rxhostdesc_startphy, - adev->rxbuf_start, adev->rxbuf_area_size, - (unsigned long long)adev->rxbuf_startphy); + "\n" + "** PCI data **\n" + "txbuf_start %p, txbuf_area_size %u, txbuf_startphy %08llx\n" + "txdesc_size %u, txdesc_start %p\n" + "txhostdesc_start %p, txhostdesc_area_size %u, txhostdesc_startphy %08llx\n" + "rxdesc_start %p\n" + "rxhostdesc_start %p, rxhostdesc_area_size %u, rxhostdesc_startphy %08llx\n" + "rxbuf_start %p, rxbuf_area_size %u, rxbuf_startphy %08llx\n", + adev->txbuf_start, adev->txbuf_area_size, + (unsigned long long)adev->txbuf_startphy, + adev->txdesc_size, adev->txdesc_start, + adev->txhostdesc_start, adev->txhostdesc_area_size, + (unsigned long long)adev->txhostdesc_startphy, + adev->rxdesc_start, + adev->rxhostdesc_start, adev->rxhostdesc_area_size, + (unsigned long long)adev->rxhostdesc_startphy, + adev->rxbuf_start, adev->rxbuf_area_size, + (unsigned long long)adev->rxbuf_startphy); FN_EXIT0; return 0; @@ -1216,8 +1217,8 @@ int acxpci_proc_diag_output(struct seq_file *file, acx_device_t *adev) * acxpci_l_alloc_tx * Actually returns a txdesc_t* ptr * - * FIXME: in case of fragments, should allocate multiple descrs - * after figuring out how many we need and whether we still have + * FIXME: in case of fragments, should allocate multiple descrs after + * figuring out how many we need and whether we still have * sufficiently many. */ tx_t* acxpci_alloc_tx(acx_device_t * adev) @@ -1238,13 +1239,13 @@ tx_t* acxpci_alloc_tx(acx_device_t * adev) txdesc = acx_get_txdesc(adev, head); ctl8 = txdesc->Ctl_8; - /* 2005-10-11: there were several bug reports on this happening - ** but now cause seems to be understood & fixed */ + /* 2005-10-11: there were several bug reports on this + * happening but now cause seems to be understood & fixed */ // TODO OW Check if this is correct if (unlikely(DESC_CTL_HOSTOWN != (ctl8 & DESC_CTL_ACXDONE_HOSTOWN))) { - /* whoops, descr at current index is not free, so probably - * ring buffer already full */ + /* whoops, descr at current index is not free, so + * probably ring buffer already full */ pr_acx("BUG: tx_head:%d Ctl8:0x%02X - failed to find " "free txdesc\n", head, ctl8); txdesc = NULL; @@ -1324,9 +1325,9 @@ void acxpci_irq_work(struct work_struct *work) while(irqcnt--) { #endif - /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq reasons. - * However masked irq reasons we still read with IO_ACX_IRQ_REASON or - * IO_ACX_IRQ_STATUS_NON_DES + /* We only get an irq-signal for IO_ACX_IRQ_MASK unmasked irq + * reasons. However masked irq reasons we still read with + * IO_ACX_IRQ_REASON or IO_ACX_IRQ_STATUS_NON_DES */ irqreason = read_reg16(adev, IO_ACX_IRQ_REASON); irqmasked = irqreason & ~adev->irq_mask; @@ -1512,8 +1513,8 @@ void acxpci_power_led(acx_device_t * adev, int enable) { u16 gpio_pled = IS_ACX111(adev) ? 0x0040 : 0x0800; - /* A hack. Not moving message rate limiting to adev->xxx - * (it's only a debug message after all) */ + /* A hack. Not moving message rate limiting to adev->xxx (it's + * only a debug message after all) */ static int rate_limit = 0; if (rate_limit++ < 3) @@ -1529,8 +1530,8 @@ void acxpci_power_led(acx_device_t * adev, int enable) INLINE_IO int acxpci_adev_present(acx_device_t *adev) { - /* fast version (accesses the first register, IO_ACX_SOFT_RESET, - * which should be safe): */ + /* fast version (accesses the first register, + * IO_ACX_SOFT_RESET, which should be safe): */ return acx_readl(adev->iobase) != 0xffffffff; } @@ -1575,8 +1576,8 @@ acx111pci_ioctl_info(struct net_device *ndev, /* get Acx111 Memory Configuration */ memset(&memconf, 0, sizeof(memconf)); - /* BTW, fails with 12 (Write only) error code. - ** Retained for easy testing of issue_cmd error handling :) */ + /* BTW, fails with 12 (Write only) error code. Retained for + * easy testing of issue_cmd error handling :) */ acx_interrogate(adev, &memconf, ACX1xx_IE_QUEUE_CONFIG); /* get Acx111 Queue Configuration */ @@ -2009,21 +2010,24 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) ieee->queues = 1; // OW TODO Check if RTS/CTS threshold can be included here - /* TODO: although in the original driver the maximum value was 100, - * the OpenBSD driver assigns maximum values depending on the type of - * radio transceiver (i.e. Radia, Maxim, etc.). This value is always a - * positive integer which most probably indicates the gain of the AGC - * in the rx path of the chip, in dB steps (0.625 dB, for example?). - * The mapping of this rssi value to dBm is still unknown, but it can - * nevertheless be used as a measure of relative signal strength. The - * other two values, i.e. max_signal and max_noise, do not seem to be - * supported on my acx111 card (they are always 0), although iwconfig - * reports them (in dBm) when using ndiswrapper with the Windows XP - * driver. The GPL-licensed part of the AVM FRITZ!WLAN USB Stick - * driver sources (for the TNETW1450, though) seems to also indicate - * that only the RSSI is supported. In conclusion, the max_signal and - * max_noise values will not be initialised by now, as they do not - * seem to be supported or how to acquire them is still unknown. */ + /* TODO: although in the original driver the maximum value was + * 100, the OpenBSD driver assigns maximum values depending on + * the type of radio transceiver (i.e. Radia, Maxim, + * etc.). This value is always a positive integer which most + * probably indicates the gain of the AGC in the rx path of + * the chip, in dB steps (0.625 dB, for example?). The + * mapping of this rssi value to dBm is still unknown, but it + * can nevertheless be used as a measure of relative signal + * strength. The other two values, i.e. max_signal and + * max_noise, do not seem to be supported on my acx111 card + * (they are always 0), although iwconfig reports them (in + * dBm) when using ndiswrapper with the Windows XP driver. The + * GPL-licensed part of the AVM FRITZ!WLAN USB Stick driver + * sources (for the TNETW1450, though) seems to also indicate + * that only the RSSI is supported. In conclusion, the + * max_signal and max_noise values will not be initialised by + * now, as they do not seem to be supported or how to acquire + * them is still unknown. */ // We base signal quality on winlevel approach of previous driver // TODO OW 20100615 This should into a common init code @@ -2038,8 +2042,9 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* We do not start with downed sem: we want PARANOID_LOCKING to work */ pr_acx("mutex_init(&adev->mutex); // adev = 0x%px\n", adev); mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->pdev = pdev; @@ -2061,11 +2066,12 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* enable busmastering (required for CardBus) */ pci_set_master(pdev); - /* Specify DMA mask 30-bit. Problem was triggered from >=2.6.33 on x86_64 */ + /* Specify DMA mask 30-bit. Problem was triggered from + * >=2.6.33 on x86_64 */ adev->bus_dev->coherent_dma_mask = DMA_BIT_MASK(30); - /* chiptype is u8 but id->driver_data is ulong - ** Works for now (possible values are 1 and 2) */ + /* chiptype is u8 but id->driver_data is ulong Works for now + * (possible values are 1 and 2) */ chip_type = (u8) id->driver_data; /* acx100 and acx111 have different PCI memory regions */ if (chip_type == CHIPTYPE_ACX100) { @@ -2111,8 +2117,8 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* * We got them? Map them! * - * We pass 0 as the third argument to pci_iomap(): it will map the full - * region in this case, which is what we want. + * We pass 0 as the third argument to pci_iomap(): it will map + * the full region in this case, which is what we want. */ mem1 = pci_iomap(pdev, mem_region1, 0); @@ -2178,15 +2184,16 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) INIT_WORK(&adev->tx_work, acx_tx_work); skb_queue_head_init(&adev->tx_queue); - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large parts of the I/O registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ if (OK != acx_reset_dev(adev)) goto fail_reset_dev; if (IS_ACX100(adev)) { - /* ACX100: configopt struct in cmd mailbox - directly after reset */ + /* ACX100: configopt struct in cmd mailbox - directly + * after reset */ memcpy_fromio(&co, adev->cmd_area, sizeof(co)); } @@ -2194,11 +2201,13 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto fail_init_mac; if (IS_ACX111(adev)) { - /* ACX111: configopt struct needs to be queried after full init */ + /* ACX111: configopt struct needs to be queried after + * full init */ acx_interrogate(adev, &co, ACX111_IE_CONFIG_OPTIONS); } - /* TODO: merge them into one function, they are called just once and are the same for pci & usb */ + /* TODO: merge them into one function, they are called just + * once and are the same for pci & usb */ if (OK != acx_read_eeprom_byte(adev, 0x05, &adev->eeprom_version)) goto fail_read_eeprom_byte; @@ -2209,7 +2218,8 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) /* Register the card, AFTER everything else has been set up, * since otherwise an ioctl could step on our feet due to - * firmware operations happening in parallel or uninitialized data */ + * firmware operations happening in parallel or uninitialized + * data */ if (acx_proc_register_entries(ieee) != OK) goto fail_proc_register_entries; @@ -2352,9 +2362,9 @@ void __devexit acxpci_remove(struct pci_dev *pdev) } #ifdef REDUNDANT - /* put the eCPU to sleep to save power - * Halting is not possible currently, - * since not supported by all firmware versions */ + /* put the eCPU to sleep to save power Halting is not + * possible currently, since not supported by all + * firmware versions */ acx_issue_cmd(adev, ACX100_CMD_SLEEP, NULL, 0); #endif /* disable power LED to save power :-) */ @@ -2362,8 +2372,8 @@ void __devexit acxpci_remove(struct pci_dev *pdev) acxpci_power_led(adev, 0); /* stop our eCPU */ if (IS_ACX111(adev)) { - /* FIXME: does this actually keep halting the eCPU? - * I don't think so... + /* FIXME: does this actually keep halting the + * eCPU? I don't think so... */ acxpci_reset_mac(adev); } else { @@ -2408,9 +2418,8 @@ void __devexit acxpci_remove(struct pci_dev *pdev) /* remove dev registration */ pci_set_drvdata(pdev, NULL); - /* Free netdev (quite late, - * since otherwise we might get caught off-guard - * by a netdev timeout handler execution + /* Free netdev (quite late, since otherwise we might get + * caught off-guard by a netdev timeout handler execution * expecting to see a working dev...) */ ieee80211_free_hw(adev->ieee); @@ -2492,8 +2501,9 @@ int acxpci_e_resume(struct pci_dev *pdev) acx_up(hw); pr_acx("rsm: acx up done\n"); - /* now even reload all card parameters as they were before suspend, - * and possibly be back in the network again already :-) */ + /* now even reload all card parameters as they were before + * suspend, and possibly be back in the network again already + * :-) */ if (ACX_STATE_IFACE_UP & adev->dev_state_mask) { adev->set_mask = GETSET_ALL; //acx_update_card_settings(adev); @@ -2681,8 +2691,9 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev, spin_lock_init(&adev->spinlock); /* initial state: unlocked */ /* We do not start with downed sem: we want PARANOID_LOCKING to work */ mutex_init(&adev->mutex); - /* since nobody can see new netdev yet, we can as well - ** just _presume_ that we're under sem (instead of actually taking it): */ + /* since nobody can see new netdev yet, we can as well just + * _presume_ that we're under sem (instead of actually taking + * it): */ /* acx_sem_lock(adev); */ adev->ieee = ieee; adev->vdev = vdev; @@ -2782,9 +2793,9 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev, INIT_WORK(&adev->tx_work, acx_tx_work); skb_queue_head_init(&adev->tx_queue); - /* NB: read_reg() reads may return bogus data before reset_dev(), - * since the firmware which directly controls large parts of the I/O - * registers isn't initialized yet. + /* NB: read_reg() reads may return bogus data before + * reset_dev(), since the firmware which directly controls + * large ... [truncated message content] |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:36
|
Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/mem.c b/mem.c index 1cae358..322245a 100644 --- a/mem.c +++ b/mem.c @@ -535,6 +535,7 @@ void acxmem_chaincopy_from_slavemem(acx_device_t *adev, u8 *destination, * plus 32 bytes safety offset at the end */ //static +#if 0 // acxmem_create_rx_host_desc_queue() int acxmem_create_rx_host_desc_queue(acx_device_t *adev) { rxhostdesc_t *hostdesc; @@ -588,6 +589,7 @@ int acxmem_create_rx_host_desc_queue(acx_device_t *adev) FN_EXIT1(NOT_OK); return NOT_OK; } +#endif // acxmem_create_rx_host_desc_queue() /* * In the generic slave memory access mode, most of the stuff in -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-06 10:43:35
|
hi Oliver, This continues the set some more, on top of master at: 8cce1c7 mem-inlines.h: Initialize acxmem_lock_flags=0 1-36 as sent previously. 0037-mem.c-if0-unused-acxmem_create_rx_host_desc_queue.patch 0038-merge-acx-mem-pci-_create_desc_queues.patch 0039-merge-clean-out-commented-fn-protos.patch 0040-merge.c-update-comments.patch 0041-rewrap-comments-reindent-to-help-sdiffing.patch 0042-cleanup-remove-d-forward-decl-fn-protos.patch 0043-cleanup-drop-if0d-functions-and-their-comments.patch 0044-mem.c-fix-stray-acxmem_advance_txdesc-ref.patch 0045-merge.h-put-static-inline-in-fn-proto-line.patch 0046-merge.c-drop-if0d-funcs.patch 0047-merge-fix-no-mem-build-probs.patch Lots of #if0d code removed. Somewhere in this stack (or earlier) I broke the non-MEM build, 47 fixes it, and suggests resuffling of a few funcs. Further review of merge opportunities may suggest fewer or more. |
From: Oliver W. <oli...@ol...> - 2012-05-06 05:08:48
|
Hi Jim, Ok, good, yesterday evening I still still worked on some changes myself (of the mem-inlines.h) ... now I'm going to pull them all in ;)! -Oliver On 05/05/2012 10:56 PM, Jim Cromie wrote: > hi Oliver, > > This continues the set some more, on top of master at: > 8cce1c7 mem-inlines.h: Initialize acxmem_lock_flags=0 > > 1-27 as sent previously. > > 0028-pci.c-banish-acxpci_reset_dev.patch > 0029-merge-acx-mem-pci-_read_cmd_type_status.patch > 0030-merge-acx-mem-pci-_write_cmd_type_status.patch > 0031-merge-acx-mem-pci-_init_mboxes.patch > 0032-merge.c-acx-mem-pci-_write_fw-compile-test.patch > 0033-merge-use-merged-acx_write_fw.patch > 0034-merge.c-acx-mem-pci-_validate_fw-compile-test.patch > 0035-merge-use-merged-acx_validate_fw.patch > 0036-merge-use-merged-acxmem_upload_fw-for-mem-driver.patch > > Referring to: > 1- probably more merge opportunities still > 2- removal of all the //= and //- commented lines > 3- removal of #if0d function bodies > 4- make "un-exported" functions static > 5- rearrange functions to eliminate forward-decls |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:12
|
Fix acxmem_upload_fw() previously copied to merge.c, and use it for mem driver only (theres a bunch of stuff to do for pci). Changes are: - #if0 mem.c copy, #if1 merge.c copy - move patch[] array off stack, make static const, (keep ifdef) - add static int _acx_upload_fw(), accepting filename - add IS_MEM {...} block to aid pci integration - add acxmem_upload_fw() wrapper to call _acx_upload_fw() - add acxmem_upload_fw() to merge.h, //a it in mem.h Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 3 ++- mem.h | 2 +- merge.c | 44 +++++++++++++++++++++++++++++--------------- merge.h | 1 + 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/mem.c b/mem.c index e994bf2..1cae358 100644 --- a/mem.c +++ b/mem.c @@ -966,6 +966,7 @@ int acxmem_validate_fw(acx_device_t *adev, } #endif // acxmem_validate_fw() +#if 0 // acxmem_upload_fw() STATick int acxmem_upload_fw(acx_device_t *adev) { firmware_image_t *fw_image = NULL; int res = NOT_OK; @@ -1075,7 +1076,7 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { FN_EXIT1(res); return res; } - +#endif // acxmem_upload_fw() /* * BOM CMDs (Control Path) diff --git a/mem.h b/mem.h index e7447e4..9c608c0 100644 --- a/mem.h +++ b/mem.h @@ -52,7 +52,7 @@ int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); -int acxmem_upload_fw(acx_device_t *adev); +//a int acxmem_upload_fw(acx_device_t *adev); //- #if defined(NONESSENTIAL_FEATURES) //- STATick void acx_show_card_eeprom_id(acx_device_t *adev); diff --git a/merge.c b/merge.c index afa8f9a..9eb4f8b 100644 --- a/merge.c +++ b/merge.c @@ -1280,30 +1280,35 @@ int acx_validate_fw(acx_device_t *adev, } #endif // acxmem_validate_fw() -#if 0 // defer, -static int acxmem_upload_fw(acx_device_t *adev, char *filename) +#if 1 // use for mem.c only + +#ifdef PATCH_AROUND_BAD_SPOTS +/* + * arm-linux-objdump -d patch.bin, or + * od -Ax -t x4 patch.bin after finding the bounds + * of the .text section with arm-linux-objdump -s patch.bin + */ +static const u32 patch[] = { + 0xe584c030, 0xe59fc008, 0xe92d1000, 0xe59fc004, 0xe8bd8000, + 0x0000080c, 0x0000aa68, 0x605a2200, 0x2c0a689c, 0x2414d80a, + 0x2f00689f, 0x1c27d007, 0x06241e7c, 0x2f000e24, 0xe000d1f6, + 0x602e6018, 0x23036468, 0x480203db, 0x60ca6003, 0xbdf0750a, + 0xffff0808 +}; +#endif // PATCH_AROUND_BAD_SPOTS + +static int _acx_upload_fw(acx_device_t *adev, char *filename) { firmware_image_t *fw_image = NULL; int res = NOT_OK; int try; u32 file_size; - char *filename = "WLANGEN.BIN"; acxmem_lock_flags; #ifdef PATCH_AROUND_BAD_SPOTS u32 offset; int i; - /* - * arm-linux-objdump -d patch.bin, or - * od -Ax -t x4 patch.bin after finding the bounds - * of the .text section with arm-linux-objdump -s patch.bin - */ - u32 patch[] = { 0xe584c030, 0xe59fc008, 0xe92d1000, 0xe59fc004, 0xe8bd8000, - 0x0000080c, 0x0000aa68, 0x605a2200, 0x2c0a689c, 0x2414d80a, - 0x2f00689f, 0x1c27d007, 0x06241e7c, 0x2f000e24, 0xe000d1f6, - 0x602e6018, 0x23036468, 0x480203db, 0x60ca6003, 0xbdf0750a, - 0xffff0808 }; #endif FN_ENTER; @@ -1338,6 +1343,8 @@ static int acxmem_upload_fw(acx_device_t *adev, char *filename) acx_mwait(1000); /* better wait for a while... */ } + if (IS_MEM(adev)) { + #ifdef PATCH_AROUND_BAD_SPOTS acxmem_lock(); /* @@ -1384,13 +1391,20 @@ static int acxmem_upload_fw(acx_device_t *adev, char *filename) } acxmem_unlock(); -#endif +#endif // PATCH_AROUND_BAD_SPOTS + } // IS_MEM + vfree(fw_image); FN_EXIT1(res); return res; } -#endif // defer +int acxmem_upload_fw(acx_device_t *adev) +{ + char *filename = "WLANGEN.BIN"; + return _acx_upload_fw(adev, filename); +} +#endif // acx_upload_fw() #if defined(NONESSENTIAL_FEATURES) diff --git a/merge.h b/merge.h index 83116e1..f6784ea 100644 --- a/merge.h +++ b/merge.h @@ -71,6 +71,7 @@ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); +int acxmem_upload_fw(acx_device_t *adev); #if !defined(CONFIG_ACX_MAC80211_MEM) -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:10
|
Use merged acx_validate_fw(). Its ugly, but it works on pci. dmesg shows its actually used too !! acx.acxpci_upload_fw: acx_validate_fw (main/combined): 0 acx.acxpci_upload_fw: need firmware for acx111 chipset with radio ID 16 acx.acxpci_upload_fw: need to load firmware for acx111 chipset with radio ID 16, please provide via firmware hotplug: acx.acx_read_fw: requesting firmware image 'tiacx111c16' acx.acxpci_upload_fw: acx_write_fw (main/combined): 0 acx.acxpci_upload_fw: acx_validate_fw (main/combined): 0 Note: dont need "need to load" log-entry Tested-by: jimc on pci, ifups, wifi-probe script output looks ok Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 4 ++-- merge.c | 9 ++------- merge.h | 3 +++ pci.c | 5 +++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mem.c b/mem.c index f939292..e994bf2 100644 --- a/mem.c +++ b/mem.c @@ -893,7 +893,7 @@ int acxmem_write_fw(acx_device_t *adev, * OK success */ // static -#if 1 // acxmem_validate_fw() +#if 0 // acxmem_validate_fw() int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset) { @@ -1007,7 +1007,7 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); if (OK == res) { - res = acxmem_validate_fw(adev, fw_image, 0); + res = acx_validate_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_validate_fw " "(main): %d\n", res); } diff --git a/merge.c b/merge.c index 286e37b..afa8f9a 100644 --- a/merge.c +++ b/merge.c @@ -151,12 +151,7 @@ static int acx_upload_radio(acx_device_t *adev, char *filename) log(L_DEBUG|L_INIT, "acx_write_fw (radio): %d\n", res); if (OK == res) { - // JC: merge mem vs pci here. - if (IS_MEM(adev)) - res = acxmem_validate_fw(adev, radio_image, offset); - else if (IS_PCI(adev)) - res = acxpci_validate_fw(adev, radio_image, offset); - else BUG(); + res = acx_validate_fw(adev, radio_image, offset); log(L_DEBUG|L_INIT, "acx_validate_fw (radio): %d\n", res); } acxmem_unlock(); @@ -1328,7 +1323,7 @@ static int acxmem_upload_fw(acx_device_t *adev, char *filename) res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); if (OK == res) { - res = acxmem_validate_fw(adev, fw_image, 0); + res = acx_validate_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_validate_fw " "(main): %d\n", res); } diff --git a/merge.h b/merge.h index 9206788..83116e1 100644 --- a/merge.h +++ b/merge.h @@ -69,6 +69,9 @@ void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acx_init_mboxes(acx_device_t *adev); int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset); +int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, + u32 offset); + #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index fe21829..dcc84fe 100644 --- a/pci.c +++ b/pci.c @@ -499,6 +499,7 @@ int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, * Origin: Standard csum + Read IO */ // static +#if 0 // acxpci_validate_fw() int acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, u32 offset) @@ -565,7 +566,7 @@ acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, FN_EXIT1(result); return result; } - +#endif // acxpci_validate_fw() /* * acxpci_s_upload_fw @@ -628,7 +629,7 @@ int acxpci_upload_fw(acx_device_t *adev) res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG | L_INIT, "acx_write_fw (main/combined): %d\n", res); if (OK == res) { - res = acxpci_validate_fw(adev, fw_image, 0); + res = acx_validate_fw(adev, fw_image, 0); log(L_DEBUG | L_INIT, "acx_validate_fw " "(main/combined): %d\n", res); } -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:09
|
Merge pci code into merge.c copy of mem.c code, #if0 old ones, strip "static", add to merge.h, and change callers. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 5 +++-- merge.c | 30 +++++++++++++++++------------- merge.h | 1 + pci.c | 4 +++- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/mem.c b/mem.c index c7b54d1..ab5c162 100644 --- a/mem.c +++ b/mem.c @@ -1342,6 +1342,7 @@ STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { #endif // acxmem_read_cmd_type_status() //STATick inline +#if 0 // acxmem_init_mboxes() void acxmem_init_mboxes(acx_device_t *adev) { u32 cmd_offs, info_offs; @@ -1364,7 +1365,7 @@ void acxmem_init_mboxes(acx_device_t *adev) FN_EXIT0; } - +#endif // acxmem_init_mboxes() /* * BOM Init, Configure (Control Path) @@ -1504,7 +1505,7 @@ int acxmem_reset_dev(acx_device_t *adev) acxmem_lock(); log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - acxmem_init_mboxes(adev); + acx_init_mboxes(adev); acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); /* test that EEPROM is readable */ diff --git a/merge.c b/merge.c index e4958f3..e176222 100644 --- a/merge.c +++ b/merge.c @@ -1492,8 +1492,9 @@ void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) FN_EXIT0; } -#if 0 // -static inline void acxmem_init_mboxes(acx_device_t *adev) +#if 1 // +// static inline +void acx_init_mboxes(acx_device_t *adev) { u32 cmd_offs, info_offs; @@ -1501,16 +1502,19 @@ static inline void acxmem_init_mboxes(acx_device_t *adev) cmd_offs = read_reg32(adev, IO_ACX_CMD_MAILBOX_OFFS); info_offs = read_reg32(adev, IO_ACX_INFO_MAILBOX_OFFS); - adev->cmd_area = (u8*) cmd_offs; - adev->info_area = (u8*) info_offs; - + if (IS_MEM(adev)) { + adev->cmd_area = (u8*) cmd_offs; + adev->info_area = (u8*) info_offs; + if (adev->iobase2) + pr_notice("adev->iobase2 != 0 for MEM dev\n"); + } else { + adev->cmd_area = (u8 *) adev->iobase2 + cmd_offs; + adev->info_area = (u8 *) adev->iobase2 + info_offs; + } // OW iobase2 not used in mem.c, in pci.c it is - /* - log(L_DEBUG, "iobase2=%p\n" - */ - log(L_DEBUG, "cmd_mbox_offset=%X cmd_area=%p\n" - "acx: info_mbox_offset=%X info_area=%p\n", - cmd_offs, adev->cmd_area, + log(L_DEBUG, "iobase2=%p cmd_mbox_offset=%X cmd_area=%p" + "info_mbox_offset=%X info_area=%p\n", + adev->iobase2, cmd_offs, adev->cmd_area, info_offs, adev->info_area); FN_EXIT0; @@ -2038,10 +2042,10 @@ int acx_reset_dev(acx_device_t *adev) log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); if (IS_MEM(adev)) { - acxmem_init_mboxes(adev); + acx_init_mboxes(adev); acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); } else { - acxpci_init_mboxes(adev); + acx_init_mboxes(adev); acx_write_cmd_type_status(adev, 0, 0); } /* test that EEPROM is readable */ diff --git a/merge.h b/merge.h index 63e58ec..1cfbd43 100644 --- a/merge.h +++ b/merge.h @@ -66,6 +66,7 @@ void acx_irq_work(struct work_struct *work); u32 acx_read_cmd_type_status(acx_device_t *adev); void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); +void acx_init_mboxes(acx_device_t *adev); #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index 5bf8d45..434e066 100644 --- a/pci.c +++ b/pci.c @@ -890,6 +890,7 @@ u32 acxpci_read_cmd_type_status(acx_device_t *adev) #endif // acxpci_read_cmd_type_status() // static +#if 0 // acxpci_init_mboxes() inline void acxpci_init_mboxes(acx_device_t * adev) { u32 cmd_offs, info_offs; @@ -907,6 +908,7 @@ inline void acxpci_init_mboxes(acx_device_t * adev) cmd_offs, adev->cmd_area, info_offs, adev->info_area); FN_EXIT0; } +#endif // acxpci_init_mboxes() /* * BOM Init, Configuration (Control Path) @@ -1005,7 +1007,7 @@ int acxpci_reset_dev(acx_device_t *adev) } log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); - acxpci_init_mboxes(adev); + acx_init_mboxes(adev); acx_write_cmd_type_status(adev, 0, 0); /* test that EEPROM is readable */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:09
|
Merge acx(mem|pci)_validate_fw() together and rename, but dont use yet. Repeating pattern for acx_write_fw(), this is simple compile-test of an ugly if-def mess. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 10 +++++++--- merge.c | 19 +++++++++++++------ pci.c | 7 ++++--- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/mem.c b/mem.c index 5517eb7..f939292 100644 --- a/mem.c +++ b/mem.c @@ -938,14 +938,18 @@ int acxmem_validate_fw(acx_device_t *adev, if (unlikely(w32 != v32)) { pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match\n(0x%08X vs. 0x%08X)!\n" + "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", len, v32, w32); + "ACX_IO_WIDTH=16 may help. Please report\n", + len, v32, w32); result = NOT_OK; break; } - sum += (u8) w32 + (u8) (w32 >> 8) + (u8) (w32 >> 16) + (u8) (w32 >> 24); + sum += (u8) w32 + + (u8) (w32 >> 8) + + (u8) (w32 >> 16) + + (u8) (w32 >> 24); } /* sum control verification */ diff --git a/merge.c b/merge.c index e701744..286e37b 100644 --- a/merge.c +++ b/merge.c @@ -1205,8 +1205,8 @@ int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, * OK success */ // static -#if 0 // needs work -int acxmem_validate_fw(acx_device_t *adev, +#if 1 // compiles +int acx_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset) { u32 sum, v32, w32; @@ -1238,7 +1238,14 @@ int acxmem_validate_fw(acx_device_t *adev, p += 4; len += 4; + if (IS_PCI(adev)) { +#if FW_NO_AUTO_INCREMENT + write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); +#endif + w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); + + } else { #ifdef NOPE // mem.c only #if FW_NO_AUTO_INCREMENT write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); @@ -1246,14 +1253,14 @@ int acxmem_validate_fw(acx_device_t *adev, udelay(10); w32 = read_reg32(adev, IO_ACX_SLV_MEM_DATA); #endif - w32 = read_slavemem32(adev, offset + len - 4); - + } if (unlikely(w32 != v32)) { pr_acx("FATAL: firmware upload: " - "data parts at offset %d don't match\n(0x%08X vs. 0x%08X)!\n" + "data parts at offset %d don't match (0x%08X vs. 0x%08X)! " "I/O timing issues or defective memory, with DWL-xx0+? " - "ACX_IO_WIDTH=16 may help. Please report\n", len, v32, w32); + "ACX_IO_WIDTH=16 may help. Please report\n", + len, v32, w32); result = NOT_OK; break; } diff --git a/pci.c b/pci.c index a7d482f..fe21829 100644 --- a/pci.c +++ b/pci.c @@ -547,9 +547,10 @@ acxpci_validate_fw(acx_device_t * adev, const firmware_image_t *fw_image, break; } - sum += - (u8) w32 + (u8) (w32 >> 8) + (u8) (w32 >> 16) + - (u8) (w32 >> 24); + sum += (u8) w32 + + (u8) (w32 >> 8) + + (u8) (w32 >> 16) + + (u8) (w32 >> 24); } /* sum control verification */ -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:08
|
Use merged acx_write_fw(). Its ugly, but it works on pci Tested-by: jimc on pci, ifups Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 9 +++++---- merge.c | 6 +++--- merge.h | 2 ++ pci.c | 9 +++++---- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/mem.c b/mem.c index ab5c162..5517eb7 100644 --- a/mem.c +++ b/mem.c @@ -812,7 +812,7 @@ int acxmem_write_phy_reg(acx_device_t *adev, u32 reg, u8 value) { * 0 success */ -#if 1 // copied to merge, but needs work +#if 0 // acxmem_write_fw() - copied to merge, but needs work -- test now // static - probly could restore, but.. int acxmem_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset) { @@ -876,6 +876,7 @@ int acxmem_write_fw(acx_device_t *adev, FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); return (sum != le32_to_cpu(fw_image->chksum)); } +#endif // /* * acxmem_s_validate_fw @@ -892,6 +893,7 @@ int acxmem_write_fw(acx_device_t *adev, * OK success */ // static +#if 1 // acxmem_validate_fw() int acxmem_validate_fw(acx_device_t *adev, const firmware_image_t *fw_image, u32 offset) { @@ -958,8 +960,7 @@ int acxmem_validate_fw(acx_device_t *adev, FN_EXIT1(result); return result; } - -#endif +#endif // acxmem_validate_fw() STATick int acxmem_upload_fw(acx_device_t *adev) { firmware_image_t *fw_image = NULL; @@ -999,7 +1000,7 @@ STATick int acxmem_upload_fw(acx_device_t *adev) { for (try = 1; try <= 5; try++) { acxmem_lock(); - res = acxmem_write_fw(adev, fw_image, 0); + res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); if (OK == res) { res = acxmem_validate_fw(adev, fw_image, 0); diff --git a/merge.c b/merge.c index cee3d84..e701744 100644 --- a/merge.c +++ b/merge.c @@ -144,9 +144,9 @@ static int acx_upload_radio(acx_device_t *adev, char *filename) // JC: merge mem vs pci here. acxmem_lock(); if (IS_MEM(adev)) - res = acxmem_write_fw(adev, radio_image, offset); + res = acx_write_fw(adev, radio_image, offset); else if (IS_PCI(adev)) - res = acxpci_write_fw(adev, radio_image, offset); + res = acx_write_fw(adev, radio_image, offset); else BUG(); log(L_DEBUG|L_INIT, "acx_write_fw (radio): %d\n", res); @@ -1318,7 +1318,7 @@ static int acxmem_upload_fw(acx_device_t *adev, char *filename) for (try = 1; try <= 5; try++) { acxmem_lock(); - res = acxmem_write_fw(adev, fw_image, 0); + res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG|L_INIT, "acx_write_fw (main): %d\n", res); if (OK == res) { res = acxmem_validate_fw(adev, fw_image, 0); diff --git a/merge.h b/merge.h index 1cfbd43..9206788 100644 --- a/merge.h +++ b/merge.h @@ -67,6 +67,8 @@ void acx_irq_work(struct work_struct *work); u32 acx_read_cmd_type_status(acx_device_t *adev); void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); void acx_init_mboxes(acx_device_t *adev); +int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, + u32 offset); #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index 434e066..a7d482f 100644 --- a/pci.c +++ b/pci.c @@ -431,8 +431,9 @@ int acxpci_write_phy_reg(acx_device_t * adev, u32 reg, u8 value) * Standard csum implementation + write to IO */ // static -int acxpci_write_fw(acx_device_t * adev, - const firmware_image_t *fw_image, u32 offset) +#if 0 // acxpci_write_fw() +int acxpci_write_fw(acx_device_t * adev, const firmware_image_t *fw_image, + u32 offset) { int len, size; u32 sum, v32; @@ -479,7 +480,7 @@ int acxpci_write_fw(acx_device_t * adev, FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); return (sum != le32_to_cpu(fw_image->chksum)); } - +#endif // acxpci_write_fw() /* * acxpci_s_validate_fw @@ -623,7 +624,7 @@ int acxpci_upload_fw(acx_device_t *adev) } for (try = 1; try <= 5; try++) { - res = acxpci_write_fw(adev, fw_image, 0); + res = acx_write_fw(adev, fw_image, 0); log(L_DEBUG | L_INIT, "acx_write_fw (main/combined): %d\n", res); if (OK == res) { res = acxpci_validate_fw(adev, fw_image, 0); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:07
|
Merge pci code into merge.c copy of mem.c code, #if0 old ones, strip "static", add to merge.h, and change callers. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 8 +++++--- merge.c | 36 ++++++++++++++++++++++-------------- merge.h | 1 + pci.c | 8 +++++--- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/mem.c b/mem.c index 058641d..c7b54d1 100644 --- a/mem.c +++ b/mem.c @@ -1173,7 +1173,7 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, == ACX1xx_CMD_INTERROGATE) ? 4 : buflen); } /* now write the actual command type */ - acxmem_write_cmd_type_status(adev, cmd, 0); + acx_write_cmd_type_status(adev, cmd, 0); /* clear CMD_COMPLETE bit. can be set only by IRQ handler: */ CLEAR_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); @@ -1211,7 +1211,7 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, cmd_status = acx_read_cmd_type_status(adev); /* put the card in IDLE state */ - acxmem_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); + acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); /* Timed out! */ if (counter == 0) { @@ -1309,6 +1309,7 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } #endif +#if 0 // acxmem_write_cmd_type_status() void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) { FN_ENTER; @@ -1316,6 +1317,7 @@ void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) write_flush(adev); FN_EXIT0; } +#endif // acxmem_write_cmd_type_status() #if 0 // acxmem_read_cmd_type_status() STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { @@ -1503,7 +1505,7 @@ int acxmem_reset_dev(acx_device_t *adev) log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); acxmem_init_mboxes(adev); - acxmem_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); + acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); /* test that EEPROM is readable */ acxmem_read_eeprom_area(adev); diff --git a/merge.c b/merge.c index 830ee4b..e4958f3 100644 --- a/merge.c +++ b/merge.c @@ -1477,6 +1477,21 @@ u32 acx_read_cmd_type_status(acx_device_t *adev) } #endif // acxmem_read_cmd_type_status() +// static inline +void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) +{ + FN_ENTER; + + if (IS_MEM(adev)) + write_slavemem32(adev, (u32) adev->cmd_area, + type | (status << 16)); + else + acx_writel(type | (status << 16), adev->cmd_area); + + write_flush(adev); + FN_EXIT0; +} + #if 0 // static inline void acxmem_init_mboxes(acx_device_t *adev) { @@ -1570,9 +1585,7 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, timeout += jiffies; do { - cmd_status = (IS_MEM(adev)) - ? acxmem_read_cmd_type_status(adev) - : acxpci_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* Test for IDLE state */ // pci.c had more complicated timeout code here. if (!cmd_status) @@ -1612,10 +1625,7 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } } /* now write the actual command type */ - if (IS_MEM(adev)) - acxmem_write_cmd_type_status(adev, cmd, 0); - else - acxpci_write_cmd_type_status(adev, cmd, 0); + acx_write_cmd_type_status(adev, cmd, 0); /* clear CMD_COMPLETE bit. can be set only by IRQ handler: */ CLEAR_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); @@ -1651,14 +1661,12 @@ int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } while (likely(--counter)); /* save state for debugging */ - cmd_status = (IS_MEM(adev)) - ? acxmem_read_cmd_type_status(adev) - : acxpci_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* put the card in IDLE state */ (IS_MEM(adev)) - ? acxmem_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0) - : acxpci_write_cmd_type_status(adev, 0, 0); + ? acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0) + : acx_write_cmd_type_status(adev, 0, 0); /* Timed out! */ if (counter == 0) { @@ -2031,10 +2039,10 @@ int acx_reset_dev(acx_device_t *adev) log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); if (IS_MEM(adev)) { acxmem_init_mboxes(adev); - acxmem_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); + acx_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); } else { acxpci_init_mboxes(adev); - acxpci_write_cmd_type_status(adev, 0, 0); + acx_write_cmd_type_status(adev, 0, 0); } /* test that EEPROM is readable */ acx_read_eeprom_area(adev); diff --git a/merge.h b/merge.h index 872e2c6..63e58ec 100644 --- a/merge.h +++ b/merge.h @@ -65,6 +65,7 @@ void acx_clean_txdesc_emergency(acx_device_t *adev); void acx_irq_work(struct work_struct *work); u32 acx_read_cmd_type_status(acx_device_t *adev); +void acx_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index 513a7ec..5bf8d45 100644 --- a/pci.c +++ b/pci.c @@ -741,7 +741,7 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, (cmd == ACX1xx_CMD_INTERROGATE) ? 4 : buflen); } /* now write the actual command type */ - acxpci_write_cmd_type_status(adev, cmd, 0); + acx_write_cmd_type_status(adev, cmd, 0); /* clear CMD_COMPLETE bit. can be set only by IRQ handler: */ CLEAR_BIT(adev->irq_status, HOST_INT_CMD_COMPLETE); @@ -790,7 +790,7 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, cmd_status = acx_read_cmd_type_status(adev); /* put the card in IDLE state */ - acxpci_write_cmd_type_status(adev, 0, 0); + acx_write_cmd_type_status(adev, 0, 0); /* Timed out! */ if (counter == -1) { @@ -859,6 +859,7 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, } // static inline +#if 0 // acxpci_write_cmd_type_status() void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status) { FN_ENTER; @@ -866,6 +867,7 @@ void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status) write_flush(adev); FN_EXIT0; } +#endif // acxpci_write_cmd_type_status() #if 0 // acxpci_read_cmd_type_status() //static @@ -1004,7 +1006,7 @@ int acxpci_reset_dev(acx_device_t *adev) log(L_DEBUG, "eCPU has woken up, card is ready to be configured\n"); acxpci_init_mboxes(adev); - acxpci_write_cmd_type_status(adev, 0, 0); + acx_write_cmd_type_status(adev, 0, 0); /* test that EEPROM is readable */ acxpci_read_eeprom_area(adev); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:06
|
Merge acx(mem|pci)_write_fw() together and rename, but dont use yet. This is simple compile-test of an ugly if-def mess. The presence of NOPE and FW_NO_AUTO_INCREMENT suggest uncertainty in the use of the feature, so cautious step-by-step changes seem warranted. Im entertaining converting these ifdefs to module parameters/options, which would look cleaner, and thus be easier to read, and would allow testing of both variations with same module. But 1st, finish the merge, as is. Your view on this ?? Signed-off-by: Jim Cromie <jim...@gm...> --- merge.c | 41 +++++++++++++++++++++++++++++++---------- 1 files changed, 31 insertions(+), 10 deletions(-) diff --git a/merge.c b/merge.c index e176222..cee3d84 100644 --- a/merge.c +++ b/merge.c @@ -1098,9 +1098,9 @@ fail: * 0 success */ // static -#if 0 // needs work -int acxmem_write_fw(acx_device_t *adev, - const firmware_image_t *fw_image, u32 offset) +#if 1 // needs work, but it compiles +int acx_write_fw(acx_device_t *adev, const firmware_image_t *fw_image, + u32 offset) { int len, size; u32 sum, v32; @@ -1117,15 +1117,25 @@ int acxmem_write_fw(acx_device_t *adev, sum = p[0] + p[1] + p[2] + p[3]; p += 4; + if (IS_MEM(adev)) { #ifdef NOPE // mem.c only, all else same #if FW_NO_AUTO_INCREMENT - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ + write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ #else - write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ - write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ - write_flush(adev); + write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ + write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ + write_flush(adev); +#endif #endif + } else { +#if FW_NO_AUTO_INCREMENT + write_reg32(adev, IO_ACX_SLV_MEM_CTL, 0); /* use basic mode */ +#else + write_reg32(adev, IO_ACX_SLV_MEM_CTL, 1); /* use autoincrement mode */ + write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset); /* configure start address */ + write_flush(adev); #endif + } len = 0; size = le32_to_cpu(fw_image->size) & (~3); @@ -1135,6 +1145,15 @@ int acxmem_write_fw(acx_device_t *adev, p += 4; len += 4; + if (IS_PCI(adev)) { +#if FW_NO_AUTO_INCREMENT + write_reg32(adev, IO_ACX_SLV_MEM_ADDR, + offset + len - 4); + write_flush(adev); +#endif + write_reg32(adev, IO_ACX_SLV_MEM_DATA, v32); + write_flush(adev); + } else { #ifdef NOPE // mem.c #if FW_NO_AUTO_INCREMENT write_reg32(adev, IO_ACX_SLV_MEM_ADDR, offset + len - 4); @@ -1158,10 +1177,12 @@ int acxmem_write_fw(acx_device_t *adev, offset + len - 4, v32, tmp, id); checkMismatch = 0; } - } -// ... here + } // ! IS_PCI + + } // while (likely(len < size) + log(L_DEBUG, "firmware written, size:%d sum1:%x sum2:%x\n", - size, sum, le32_to_cpu(fw_image->chksum)); + size, sum, le32_to_cpu(fw_image->chksum)); /* compare our checksum with the stored image checksum */ FN_EXIT1(sum != le32_to_cpu(fw_image->chksum)); -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:06
|
Merge pci code into merge.c copy of mem.c code, #if0 old ones, strip "static", add to merge.h, and change callers. Signed-off-by: Jim Cromie <jim...@gm...> --- mem.c | 8 +++++--- merge.c | 13 ++++++------- merge.h | 1 + pci.c | 6 ++++-- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/mem.c b/mem.c index 81fed25..058641d 100644 --- a/mem.c +++ b/mem.c @@ -158,7 +158,7 @@ void acxmem_copy_from_slavemem(acx_device_t *adev, u8 *destination, u32 source, // CMDs (Control Path) //- int acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, void *buffer, unsigned buflen, unsigned cmd_timeout, const char* cmdstr); //- STATick inline void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status); -u32 acxmem_read_cmd_type_status(acx_device_t *adev); +//= u32 acxmem_read_cmd_type_status(acx_device_t *adev); //- STATick inline void acxmem_init_mboxes(acx_device_t *adev); // Init, Configure (Control Path) @@ -1140,7 +1140,7 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, /* wait for firmware to become idle for our command submission */ counter = 199; /* in ms */ do { - cmd_status = acxmem_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* Test for IDLE state */ if (!cmd_status) break; @@ -1208,7 +1208,7 @@ acxmem_issue_cmd_timeo_debug(acx_device_t *adev, unsigned cmd, } while (likely(--counter)); /* save state for debugging */ - cmd_status = acxmem_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* put the card in IDLE state */ acxmem_write_cmd_type_status(adev, ACX1xx_CMD_RESET, 0); @@ -1317,6 +1317,7 @@ void acxmem_write_cmd_type_status(acx_device_t *adev, u16 type, u16 status) FN_EXIT0; } +#if 0 // acxmem_read_cmd_type_status() STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { u32 cmd_type, cmd_status; @@ -1336,6 +1337,7 @@ STATick u32 acxmem_read_cmd_type_status(acx_device_t *adev) { FN_EXIT1(cmd_status); return cmd_status; } +#endif // acxmem_read_cmd_type_status() //STATick inline void acxmem_init_mboxes(acx_device_t *adev) diff --git a/merge.c b/merge.c index bacaa6b..830ee4b 100644 --- a/merge.c +++ b/merge.c @@ -1455,21 +1455,20 @@ static inline void acx_show_card_eeprom_id(acx_device_t *adev) {} * ================================================== */ -#if 0 // slavemem resolve before merge -static u32 acxmem_read_cmd_type_status(acx_device_t *adev) +#if 1 // +u32 acx_read_cmd_type_status(acx_device_t *adev) { u32 cmd_type, cmd_status; FN_ENTER; - cmd_type = read_slavemem32(adev, (u32) adev->cmd_area); - + cmd_type = (IS_MEM(adev)) + ? read_slavemem32(adev, (u32) adev->cmd_area) + : acx_readl(adev->cmd_area); cmd_status = (cmd_type >> 16); cmd_type = (u16) cmd_type; - log(L_DEBUG, "%s: " - "cmd_type:%04X cmd_status:%04X [%s]\n", - __func__, + log(L_DEBUG, "cmd_type:%04X cmd_status:%04X [%s]\n", cmd_type, cmd_status, acx_cmd_status_str(cmd_status)); diff --git a/merge.h b/merge.h index bddfec5..872e2c6 100644 --- a/merge.h +++ b/merge.h @@ -64,6 +64,7 @@ int acx_verify_init(acx_device_t *adev); void acx_clean_txdesc_emergency(acx_device_t *adev); void acx_irq_work(struct work_struct *work); +u32 acx_read_cmd_type_status(acx_device_t *adev); #if !defined(CONFIG_ACX_MAC80211_MEM) diff --git a/pci.c b/pci.c index a1ab0ff..513a7ec 100644 --- a/pci.c +++ b/pci.c @@ -703,7 +703,7 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, counter = (timeout * 1000 / HZ) - 1; /* in ms */ timeout += jiffies; do { - cmd_status = acxpci_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* Test for IDLE state */ if (!cmd_status) break; @@ -787,7 +787,7 @@ acxpci_issue_cmd_timeo_debug(acx_device_t * adev, unsigned cmd, } while (likely(--counter)); /* save state for debugging */ - cmd_status = acxpci_read_cmd_type_status(adev); + cmd_status = acx_read_cmd_type_status(adev); /* put the card in IDLE state */ acxpci_write_cmd_type_status(adev, 0, 0); @@ -867,6 +867,7 @@ void acxpci_write_cmd_type_status(acx_device_t * adev, u16 type, u16 status) FN_EXIT0; } +#if 0 // acxpci_read_cmd_type_status() //static u32 acxpci_read_cmd_type_status(acx_device_t *adev) { @@ -884,6 +885,7 @@ u32 acxpci_read_cmd_type_status(acx_device_t *adev) FN_EXIT1(cmd_status); return cmd_status; } +#endif // acxpci_read_cmd_type_status() // static inline void acxpci_init_mboxes(acx_device_t * adev) -- 1.7.8.1 |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:04
|
hi Oliver, This continues the set some more, on top of master at: 8cce1c7 mem-inlines.h: Initialize acxmem_lock_flags=0 1-27 as sent previously. 0028-pci.c-banish-acxpci_reset_dev.patch 0029-merge-acx-mem-pci-_read_cmd_type_status.patch 0030-merge-acx-mem-pci-_write_cmd_type_status.patch 0031-merge-acx-mem-pci-_init_mboxes.patch 0032-merge.c-acx-mem-pci-_write_fw-compile-test.patch 0033-merge-use-merged-acx_write_fw.patch 0034-merge.c-acx-mem-pci-_validate_fw-compile-test.patch 0035-merge-use-merged-acx_validate_fw.patch 0036-merge-use-merged-acxmem_upload_fw-for-mem-driver.patch Referring to: 1- probably more merge opportunities still 2- removal of all the //= and //- commented lines 3- removal of #if0d function bodies 4- make "un-exported" functions static 5- rearrange functions to eliminate forward-decls These are all 1's It may be useful to defer (by rebase -i) patches which drop/remove #if0d functions, they may have compromised the readability of sdiff output. That said, its not worth it if they cause rejects/rework during rebase, and sdiff was useful enough to aid this batch of merges. |
From: Jim C. <jim...@gm...> - 2012-05-05 20:57:04
|
This fn had been merged, but old code was overlooked, and called. Fix by #if0g fn-defn, seeing 'symbol undefined' err, and changing callers. Signed-off-by: Jim Cromie <jim...@gm...> --- pci.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pci.c b/pci.c index 7b44f81..a1ab0ff 100644 --- a/pci.c +++ b/pci.c @@ -925,6 +925,7 @@ inline void acxpci_init_mboxes(acx_device_t * adev) * This resets the device using low level hardware calls * as well as uploads and verifies the firmware to the card */ +#if 0 // acxpci_reset_dev() int acxpci_reset_dev(acx_device_t *adev) { const char *msg = ""; @@ -1018,6 +1019,7 @@ int acxpci_reset_dev(acx_device_t *adev) FN_EXIT1(result); return result; } +#endif // acxpci_reset_dev() #if 0 // !unused static int acxpci_verify_init(acx_device_t * adev) @@ -2170,7 +2172,7 @@ acxpci_probe(struct pci_dev *pdev, const struct pci_device_id *id) * since the firmware which directly controls large parts of the I/O * registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ - if (OK != acxpci_reset_dev(adev)) + if (OK != acx_reset_dev(adev)) goto fail_reset_dev; if (IS_ACX100(adev)) { @@ -2470,7 +2472,7 @@ int acxpci_e_resume(struct pci_dev *pdev) pci_restore_state(pdev); pr_acx("rsm: PCI state restored\n"); - if (OK != acxpci_reset_dev(adev)) + if (OK != acx_reset_dev(adev)) goto end_unlock; pr_acx("rsm: device reset done\n"); if (OK != acx_init_mac(adev)) @@ -2774,7 +2776,7 @@ static __devinit int vlynq_probe(struct vlynq_device *vdev, * since the firmware which directly controls large parts of the I/O * registers isn't initialized yet. * acx100 seems to be more affected than acx111 */ - if (OK != acxpci_reset_dev(adev)) + if (OK != acx_reset_dev(adev)) goto fail_vlynq_reset_dev; if (OK != acx_init_mac(adev)) -- 1.7.8.1 |
From: Oliver W. <oli...@ol...> - 2012-05-05 10:32:36
|
Hi Jim, Ok, Thanks a lot! I'll try to check the series(s) the weekend. Cheers, Oliver On 05/05/2012 11:26 AM, Jim Cromie wrote: > hi Oliver, > > This continues the set, on top of master at: > 8cce1c7 mem-inlines.h: Initialize acxmem_lock_flags=0 > > 1-15 as sent previously. > > 0016-merge-fixup-acx_verify_dev-clean-out-acxpci_verify_d.patch > 0017-cleanup-minor-tweak-to-NONESSENTIAL_FEATURES.patch > 0018-acx_func.h-fn-protos-to-compile-common.c-interim.patch > 0019-acx_func.h-fn-protos-to-compile-pci.c-interim.patch > 0020-acx_func.h-fn-protos-to-compile-usb.c-mem.c-interim.patch > 0021-acx_func.h-fn-protos-to-compile-merge.c-complete.patch > 0022-acx_func.h-whitespace-cleanup.patch > 0023-pci.h-fn-protos-to-compile-common.c-pci.c-maybe-some.patch > 0024-pci.h-comment-out-unneeded-fn-protos.patch > 0025-mem.h-cleanup-fn-protos-to-minimum-needed-by-others.patch > 0026-mem.c-reduce-fn-protos-to-those-needed.patch > 0027-pci.c-reduce-fn-protos-list-to-those-needed-to-compi.patch > > With this, we're getting close to done with the merge. > heres whats left: > > 1- probably more merge opportunities still > 2- removal of all the //= and //- commented lines > 3- removal of #if0d function bodies > 4- make "un-exported" functions static > 5- rearrange functions to eliminate forward-decls > > Im waiting on 2,3 for a while, at least until you test and accept > them, and probably a bit longer to let them settle, and to see if > anything in 1 adds new dependencies (copy-paste would work too, but > stripping //- comments seems to better show the evolution) > > Maybe 4,5 gets some help from sparse, but the list is long. > I havent looked past the length yet. > > acx-mac80211$ make C=2 2>&1 | wc > 768 5795 82427 > > acx-mac80211$ make C=2 > echo "make is "standalone build"" > make is standalone build > make -C /lib/modules/3.4.0-rc5-ske+/build M=/home/jimc/projects/lx/acx-mac80211 CONFIG_ACX_MAC80211=m CONFIG_ACX_MAC80211_PCI=y CONFIG_ACX_MAC80211_USB=m CONFIG_ACX_MAC80211_MEM=m EXTRA_CFLAGS=" -DCONFIG_ACX_MAC80211=1 -DCONFIG_ACX_MAC80211_USB=1 -DCONFIG_ACX_MAC80211_MEM=1 -DCONFIG_ACX_MAC80211_PCI=1 -DACX_GIT_VERSION=\\\"v20120429-49-gb883c5e\\\"" modules > make[1]: Entering directory `/home/jimc/projects/lx/build-ske' > CHECK /home/jimc/projects/lx/acx-mac80211/common.c > /home/jimc/projects/lx/acx-mac80211/common.c:6273:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:6275:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:6277:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:6327:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:6329:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:6331:1: error: directive in argument list > /home/jimc/projects/lx/acx-mac80211/common.c:4512:22: error: subtraction of different types can't work (different address spaces) > /home/jimc/projects/lx/acx-mac80211/common.c:4684:29: error: subtraction of different types can't work (different address spaces) > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Acx100-devel mailing list > Acx...@li... > https://lists.sourceforge.net/lists/listinfo/acx100-devel > |