Commit a0b68486 authored by Jon Mason's avatar Jon Mason Committed by David S. Miller

net: ethernet: bgmac: add dma_dev pointer

The dma buffer allocation, etc references a dma_dev device pointer from
the bcma core.  In anticipation of removing the bcma requirement for
this driver, these must be changed to not reference that struct.  Add a
dma_dev device pointer to the bgmac stuct and reference that instead.
Signed-off-by: default avatarJon Mason <jon.mason@broadcom.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d00a8281
...@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, ...@@ -152,7 +152,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
struct bgmac_dma_ring *ring, struct bgmac_dma_ring *ring,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
struct net_device *net_dev = bgmac->net_dev; struct net_device *net_dev = bgmac->net_dev;
int index = ring->end % BGMAC_TX_RING_SLOTS; int index = ring->end % BGMAC_TX_RING_SLOTS;
struct bgmac_slot_info *slot = &ring->slots[index]; struct bgmac_slot_info *slot = &ring->slots[index];
...@@ -254,7 +254,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac, ...@@ -254,7 +254,7 @@ static netdev_tx_t bgmac_dma_tx_add(struct bgmac *bgmac,
/* Free transmitted packets */ /* Free transmitted packets */
static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
int empty_slot; int empty_slot;
bool freed = false; bool freed = false;
unsigned bytes_compl = 0, pkts_compl = 0; unsigned bytes_compl = 0, pkts_compl = 0;
...@@ -352,7 +352,7 @@ static void bgmac_dma_rx_enable(struct bgmac *bgmac, ...@@ -352,7 +352,7 @@ static void bgmac_dma_rx_enable(struct bgmac *bgmac,
static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac, static int bgmac_dma_rx_skb_for_slot(struct bgmac *bgmac,
struct bgmac_slot_info *slot) struct bgmac_slot_info *slot)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
dma_addr_t dma_addr; dma_addr_t dma_addr;
struct bgmac_rx_header *rx; struct bgmac_rx_header *rx;
void *buf; void *buf;
...@@ -441,7 +441,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring, ...@@ -441,7 +441,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
end_slot /= sizeof(struct bgmac_dma_desc); end_slot /= sizeof(struct bgmac_dma_desc);
while (ring->start != end_slot) { while (ring->start != end_slot) {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
struct bgmac_slot_info *slot = &ring->slots[ring->start]; struct bgmac_slot_info *slot = &ring->slots[ring->start];
struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET; struct bgmac_rx_header *rx = slot->buf + BGMAC_RX_BUF_OFFSET;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -544,7 +544,7 @@ static bool bgmac_dma_unaligned(struct bgmac *bgmac, ...@@ -544,7 +544,7 @@ static bool bgmac_dma_unaligned(struct bgmac *bgmac,
static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
struct bgmac_dma_ring *ring) struct bgmac_dma_ring *ring)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
struct bgmac_dma_desc *dma_desc = ring->cpu_base; struct bgmac_dma_desc *dma_desc = ring->cpu_base;
struct bgmac_slot_info *slot; struct bgmac_slot_info *slot;
int i; int i;
...@@ -570,7 +570,7 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac, ...@@ -570,7 +570,7 @@ static void bgmac_dma_tx_ring_free(struct bgmac *bgmac,
static void bgmac_dma_rx_ring_free(struct bgmac *bgmac, static void bgmac_dma_rx_ring_free(struct bgmac *bgmac,
struct bgmac_dma_ring *ring) struct bgmac_dma_ring *ring)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
struct bgmac_slot_info *slot; struct bgmac_slot_info *slot;
int i; int i;
...@@ -591,7 +591,7 @@ static void bgmac_dma_ring_desc_free(struct bgmac *bgmac, ...@@ -591,7 +591,7 @@ static void bgmac_dma_ring_desc_free(struct bgmac *bgmac,
struct bgmac_dma_ring *ring, struct bgmac_dma_ring *ring,
int num_slots) int num_slots)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
int size; int size;
if (!ring->cpu_base) if (!ring->cpu_base)
...@@ -629,7 +629,7 @@ static void bgmac_dma_free(struct bgmac *bgmac) ...@@ -629,7 +629,7 @@ static void bgmac_dma_free(struct bgmac *bgmac)
static int bgmac_dma_alloc(struct bgmac *bgmac) static int bgmac_dma_alloc(struct bgmac *bgmac)
{ {
struct device *dma_dev = bgmac->core->dma_dev; struct device *dma_dev = bgmac->dma_dev;
struct bgmac_dma_ring *ring; struct bgmac_dma_ring *ring;
static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1, static const u16 ring_base[] = { BGMAC_DMA_BASE0, BGMAC_DMA_BASE1,
BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, }; BGMAC_DMA_BASE2, BGMAC_DMA_BASE3, };
...@@ -1703,6 +1703,7 @@ static int bgmac_probe(struct bcma_device *core) ...@@ -1703,6 +1703,7 @@ static int bgmac_probe(struct bcma_device *core)
net_dev->ethtool_ops = &bgmac_ethtool_ops; net_dev->ethtool_ops = &bgmac_ethtool_ops;
bgmac = netdev_priv(net_dev); bgmac = netdev_priv(net_dev);
bgmac->dev = &core->dev; bgmac->dev = &core->dev;
bgmac->dma_dev = core->dma_dev;
bgmac->net_dev = net_dev; bgmac->net_dev = net_dev;
bgmac->core = core; bgmac->core = core;
bcma_set_drvdata(core, bgmac); bcma_set_drvdata(core, bgmac);
......
...@@ -429,6 +429,7 @@ struct bgmac { ...@@ -429,6 +429,7 @@ struct bgmac {
struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */ struct bcma_device *cmn; /* Reference to CMN core for BCM4706 */
struct device *dev; struct device *dev;
struct device *dma_dev;
struct net_device *net_dev; struct net_device *net_dev;
struct napi_struct napi; struct napi_struct napi;
struct mii_bus *mii_bus; struct mii_bus *mii_bus;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment