Skip to content

Commit

Permalink
net: qcom/emac: extend DMA mask to 46bits
Browse files Browse the repository at this point in the history
Bit TPD3[31] is used as a timestamp bit if PTP is enabled, but
it's used as an address bit if PTP is disabled.  Since PTP isn't
supported by the driver, we can extend the DMA address to 46 bits.

Signed-off-by: Wang Dongsheng <dongsheng.wang@hxt-semitech.com>
Acked-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wang Dongsheng authored and David S. Miller committed Jan 24, 2018
1 parent 5c38bd1 commit df262db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/qualcomm/emac/emac-mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ struct emac_tpd {
#define TPD_INSTC_SET(tpd, val) BITS_SET((tpd)->word[3], 17, 17, val)
/* High-14bit Buffer Address, So, the 64b-bit address is
* {DESC_CTRL_11_TX_DATA_HIADDR[17:0],(register) BUFFER_ADDR_H, BUFFER_ADDR_L}
* Extend TPD_BUFFER_ADDR_H to [31, 18], because we never enable timestamping.
*/
#define TPD_BUFFER_ADDR_H_SET(tpd, val) BITS_SET((tpd)->word[3], 18, 30, val)
#define TPD_BUFFER_ADDR_H_SET(tpd, val) BITS_SET((tpd)->word[3], 18, 31, val)
/* Format D. Word offset from the 1st byte of this packet to start to calculate
* the custom checksum.
*/
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/ethernet/qualcomm/emac/emac.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,11 @@ static int emac_probe(struct platform_device *pdev)
u32 reg;
int ret;

/* The TPD buffer address is limited to 45 bits. */
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(45));
/* The TPD buffer address is limited to:
* 1. PTP: 45bits. (Driver doesn't support yet.)
* 2. NON-PTP: 46bits.
*/
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(46));
if (ret) {
dev_err(&pdev->dev, "could not set DMA mask\n");
return ret;
Expand Down

0 comments on commit df262db

Please sign in to comment.