Commit ad01b7d4 authored by Giuseppe CAVALLARO's avatar Giuseppe CAVALLARO Committed by David S. Miller

stmmac: make ioaddr 'void __iomem *' rather than unsigned long

This avoids unnecessary casting and adds the ioaddr in the
private structure.
This patch also removes many warning when compile the driver.
Signed-off-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ac75791a
...@@ -167,7 +167,7 @@ struct stmmac_desc_ops { ...@@ -167,7 +167,7 @@ struct stmmac_desc_ops {
int (*get_tx_ls) (struct dma_desc *p); int (*get_tx_ls) (struct dma_desc *p);
/* Return the transmit status looking at the TDES1 */ /* Return the transmit status looking at the TDES1 */
int (*tx_status) (void *data, struct stmmac_extra_stats *x, int (*tx_status) (void *data, struct stmmac_extra_stats *x,
struct dma_desc *p, unsigned long ioaddr); struct dma_desc *p, void __iomem *ioaddr);
/* Get the buffer size from the descriptor */ /* Get the buffer size from the descriptor */
int (*get_tx_len) (struct dma_desc *p); int (*get_tx_len) (struct dma_desc *p);
/* Handle extra events on specific interrupts hw dependent */ /* Handle extra events on specific interrupts hw dependent */
...@@ -182,44 +182,44 @@ struct stmmac_desc_ops { ...@@ -182,44 +182,44 @@ struct stmmac_desc_ops {
struct stmmac_dma_ops { struct stmmac_dma_ops {
/* DMA core initialization */ /* DMA core initialization */
int (*init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx); int (*init) (void __iomem *ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
/* Dump DMA registers */ /* Dump DMA registers */
void (*dump_regs) (unsigned long ioaddr); void (*dump_regs) (void __iomem *ioaddr);
/* Set tx/rx threshold in the csr6 register /* Set tx/rx threshold in the csr6 register
* An invalid value enables the store-and-forward mode */ * An invalid value enables the store-and-forward mode */
void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode); void (*dma_mode) (void __iomem *ioaddr, int txmode, int rxmode);
/* To track extra statistic (if supported) */ /* To track extra statistic (if supported) */
void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x, void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
unsigned long ioaddr); void __iomem *ioaddr);
void (*enable_dma_transmission) (unsigned long ioaddr); void (*enable_dma_transmission) (void __iomem *ioaddr);
void (*enable_dma_irq) (unsigned long ioaddr); void (*enable_dma_irq) (void __iomem *ioaddr);
void (*disable_dma_irq) (unsigned long ioaddr); void (*disable_dma_irq) (void __iomem *ioaddr);
void (*start_tx) (unsigned long ioaddr); void (*start_tx) (void __iomem *ioaddr);
void (*stop_tx) (unsigned long ioaddr); void (*stop_tx) (void __iomem *ioaddr);
void (*start_rx) (unsigned long ioaddr); void (*start_rx) (void __iomem *ioaddr);
void (*stop_rx) (unsigned long ioaddr); void (*stop_rx) (void __iomem *ioaddr);
int (*dma_interrupt) (unsigned long ioaddr, int (*dma_interrupt) (void __iomem *ioaddr,
struct stmmac_extra_stats *x); struct stmmac_extra_stats *x);
}; };
struct stmmac_ops { struct stmmac_ops {
/* MAC core initialization */ /* MAC core initialization */
void (*core_init) (unsigned long ioaddr) ____cacheline_aligned; void (*core_init) (void __iomem *ioaddr) ____cacheline_aligned;
/* Dump MAC registers */ /* Dump MAC registers */
void (*dump_regs) (unsigned long ioaddr); void (*dump_regs) (void __iomem *ioaddr);
/* Handle extra events on specific interrupts hw dependent */ /* Handle extra events on specific interrupts hw dependent */
void (*host_irq_status) (unsigned long ioaddr); void (*host_irq_status) (void __iomem *ioaddr);
/* Multicast filter setting */ /* Multicast filter setting */
void (*set_filter) (struct net_device *dev); void (*set_filter) (struct net_device *dev);
/* Flow control setting */ /* Flow control setting */
void (*flow_ctrl) (unsigned long ioaddr, unsigned int duplex, void (*flow_ctrl) (void __iomem *ioaddr, unsigned int duplex,
unsigned int fc, unsigned int pause_time); unsigned int fc, unsigned int pause_time);
/* Set power management mode (e.g. magic frame) */ /* Set power management mode (e.g. magic frame) */
void (*pmt) (unsigned long ioaddr, unsigned long mode); void (*pmt) (void __iomem *ioaddr, unsigned long mode);
/* Set/Get Unicast MAC addresses */ /* Set/Get Unicast MAC addresses */
void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr, void (*set_umac_addr) (void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n); unsigned int reg_n);
void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr, void (*get_umac_addr) (void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n); unsigned int reg_n);
}; };
...@@ -243,11 +243,11 @@ struct mac_device_info { ...@@ -243,11 +243,11 @@ struct mac_device_info {
struct mac_link link; struct mac_link link;
}; };
struct mac_device_info *dwmac1000_setup(unsigned long addr); struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr);
struct mac_device_info *dwmac100_setup(unsigned long addr); struct mac_device_info *dwmac100_setup(void __iomem *ioaddr);
extern void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6], extern void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
unsigned int high, unsigned int low); unsigned int high, unsigned int low);
extern void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr, extern void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int high, unsigned int low); unsigned int high, unsigned int low);
extern void dwmac_dma_flush_tx_fifo(unsigned long ioaddr); extern void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include "dwmac1000.h" #include "dwmac1000.h"
static void dwmac1000_core_init(unsigned long ioaddr) static void dwmac1000_core_init(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + GMAC_CONTROL); u32 value = readl(ioaddr + GMAC_CONTROL);
value |= GMAC_CORE_INIT; value |= GMAC_CORE_INIT;
...@@ -50,7 +50,7 @@ static void dwmac1000_core_init(unsigned long ioaddr) ...@@ -50,7 +50,7 @@ static void dwmac1000_core_init(unsigned long ioaddr)
#endif #endif
} }
static void dwmac1000_dump_regs(unsigned long ioaddr) static void dwmac1000_dump_regs(void __iomem *ioaddr)
{ {
int i; int i;
pr_info("\tDWMAC1000 regs (base addr = 0x%8x)\n", (unsigned int)ioaddr); pr_info("\tDWMAC1000 regs (base addr = 0x%8x)\n", (unsigned int)ioaddr);
...@@ -62,14 +62,14 @@ static void dwmac1000_dump_regs(unsigned long ioaddr) ...@@ -62,14 +62,14 @@ static void dwmac1000_dump_regs(unsigned long ioaddr)
} }
} }
static void dwmac1000_set_umac_addr(unsigned long ioaddr, unsigned char *addr, static void dwmac1000_set_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n) unsigned int reg_n)
{ {
stmmac_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n), stmmac_set_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
GMAC_ADDR_LOW(reg_n)); GMAC_ADDR_LOW(reg_n));
} }
static void dwmac1000_get_umac_addr(unsigned long ioaddr, unsigned char *addr, static void dwmac1000_get_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n) unsigned int reg_n)
{ {
stmmac_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n), stmmac_get_mac_addr(ioaddr, addr, GMAC_ADDR_HIGH(reg_n),
...@@ -78,7 +78,7 @@ static void dwmac1000_get_umac_addr(unsigned long ioaddr, unsigned char *addr, ...@@ -78,7 +78,7 @@ static void dwmac1000_get_umac_addr(unsigned long ioaddr, unsigned char *addr,
static void dwmac1000_set_filter(struct net_device *dev) static void dwmac1000_set_filter(struct net_device *dev)
{ {
unsigned long ioaddr = dev->base_addr; void __iomem *ioaddr = (void __iomem *) dev->base_addr;
unsigned int value = 0; unsigned int value = 0;
CHIP_DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n", CHIP_DBG(KERN_INFO "%s: # mcasts %d, # unicast %d\n",
...@@ -139,7 +139,7 @@ static void dwmac1000_set_filter(struct net_device *dev) ...@@ -139,7 +139,7 @@ static void dwmac1000_set_filter(struct net_device *dev)
readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW)); readl(ioaddr + GMAC_HASH_HIGH), readl(ioaddr + GMAC_HASH_LOW));
} }
static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex, static void dwmac1000_flow_ctrl(void __iomem *ioaddr, unsigned int duplex,
unsigned int fc, unsigned int pause_time) unsigned int fc, unsigned int pause_time)
{ {
unsigned int flow = 0; unsigned int flow = 0;
...@@ -162,7 +162,7 @@ static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex, ...@@ -162,7 +162,7 @@ static void dwmac1000_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
writel(flow, ioaddr + GMAC_FLOW_CTRL); writel(flow, ioaddr + GMAC_FLOW_CTRL);
} }
static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode) static void dwmac1000_pmt(void __iomem *ioaddr, unsigned long mode)
{ {
unsigned int pmt = 0; unsigned int pmt = 0;
...@@ -178,7 +178,7 @@ static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode) ...@@ -178,7 +178,7 @@ static void dwmac1000_pmt(unsigned long ioaddr, unsigned long mode)
} }
static void dwmac1000_irq_status(unsigned long ioaddr) static void dwmac1000_irq_status(void __iomem *ioaddr)
{ {
u32 intr_status = readl(ioaddr + GMAC_INT_STATUS); u32 intr_status = readl(ioaddr + GMAC_INT_STATUS);
...@@ -211,7 +211,7 @@ struct stmmac_ops dwmac1000_ops = { ...@@ -211,7 +211,7 @@ struct stmmac_ops dwmac1000_ops = {
.get_umac_addr = dwmac1000_get_umac_addr, .get_umac_addr = dwmac1000_get_umac_addr,
}; };
struct mac_device_info *dwmac1000_setup(unsigned long ioaddr) struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr)
{ {
struct mac_device_info *mac; struct mac_device_info *mac;
u32 uid = readl(ioaddr + GMAC_VERSION); u32 uid = readl(ioaddr + GMAC_VERSION);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "dwmac1000.h" #include "dwmac1000.h"
#include "dwmac_dma.h" #include "dwmac_dma.h"
static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
u32 dma_rx) u32 dma_rx)
{ {
u32 value = readl(ioaddr + DMA_BUS_MODE); u32 value = readl(ioaddr + DMA_BUS_MODE);
...@@ -58,7 +58,7 @@ static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, ...@@ -58,7 +58,7 @@ static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx,
return 0; return 0;
} }
static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode, static void dwmac1000_dma_operation_mode(void __iomem *ioaddr, int txmode,
int rxmode) int rxmode)
{ {
u32 csr6 = readl(ioaddr + DMA_CONTROL); u32 csr6 = readl(ioaddr + DMA_CONTROL);
...@@ -111,12 +111,12 @@ static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode, ...@@ -111,12 +111,12 @@ static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode,
/* Not yet implemented --- no RMON module */ /* Not yet implemented --- no RMON module */
static void dwmac1000_dma_diagnostic_fr(void *data, static void dwmac1000_dma_diagnostic_fr(void *data,
struct stmmac_extra_stats *x, unsigned long ioaddr) struct stmmac_extra_stats *x, void __iomem *ioaddr)
{ {
return; return;
} }
static void dwmac1000_dump_dma_regs(unsigned long ioaddr) static void dwmac1000_dump_dma_regs(void __iomem *ioaddr)
{ {
int i; int i;
pr_info(" DMA registers\n"); pr_info(" DMA registers\n");
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <linux/crc32.h> #include <linux/crc32.h>
#include "dwmac100.h" #include "dwmac100.h"
static void dwmac100_core_init(unsigned long ioaddr) static void dwmac100_core_init(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + MAC_CONTROL); u32 value = readl(ioaddr + MAC_CONTROL);
...@@ -42,12 +42,12 @@ static void dwmac100_core_init(unsigned long ioaddr) ...@@ -42,12 +42,12 @@ static void dwmac100_core_init(unsigned long ioaddr)
#endif #endif
} }
static void dwmac100_dump_mac_regs(unsigned long ioaddr) static void dwmac100_dump_mac_regs(void __iomem *ioaddr)
{ {
pr_info("\t----------------------------------------------\n" pr_info("\t----------------------------------------------\n"
"\t DWMAC 100 CSR (base addr = 0x%8x)\n" "\t DWMAC 100 CSR (base addr = 0x%8x)\n"
"\t----------------------------------------------\n", "\t----------------------------------------------\n",
(unsigned int)ioaddr); (unsigned int) ioaddr);
pr_info("\tcontrol reg (offset 0x%x): 0x%08x\n", MAC_CONTROL, pr_info("\tcontrol reg (offset 0x%x): 0x%08x\n", MAC_CONTROL,
readl(ioaddr + MAC_CONTROL)); readl(ioaddr + MAC_CONTROL));
pr_info("\taddr HI (offset 0x%x): 0x%08x\n ", MAC_ADDR_HIGH, pr_info("\taddr HI (offset 0x%x): 0x%08x\n ", MAC_ADDR_HIGH,
...@@ -77,18 +77,18 @@ static void dwmac100_dump_mac_regs(unsigned long ioaddr) ...@@ -77,18 +77,18 @@ static void dwmac100_dump_mac_regs(unsigned long ioaddr)
MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK)); MMC_LOW_INTR_MASK, readl(ioaddr + MMC_LOW_INTR_MASK));
} }
static void dwmac100_irq_status(unsigned long ioaddr) static void dwmac100_irq_status(void __iomem *ioaddr)
{ {
return; return;
} }
static void dwmac100_set_umac_addr(unsigned long ioaddr, unsigned char *addr, static void dwmac100_set_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n) unsigned int reg_n)
{ {
stmmac_set_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW); stmmac_set_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
} }
static void dwmac100_get_umac_addr(unsigned long ioaddr, unsigned char *addr, static void dwmac100_get_umac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int reg_n) unsigned int reg_n)
{ {
stmmac_get_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW); stmmac_get_mac_addr(ioaddr, addr, MAC_ADDR_HIGH, MAC_ADDR_LOW);
...@@ -96,7 +96,7 @@ static void dwmac100_get_umac_addr(unsigned long ioaddr, unsigned char *addr, ...@@ -96,7 +96,7 @@ static void dwmac100_get_umac_addr(unsigned long ioaddr, unsigned char *addr,
static void dwmac100_set_filter(struct net_device *dev) static void dwmac100_set_filter(struct net_device *dev)
{ {
unsigned long ioaddr = dev->base_addr; void __iomem *ioaddr = (void __iomem *) dev->base_addr;
u32 value = readl(ioaddr + MAC_CONTROL); u32 value = readl(ioaddr + MAC_CONTROL);
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC) {
...@@ -145,7 +145,7 @@ static void dwmac100_set_filter(struct net_device *dev) ...@@ -145,7 +145,7 @@ static void dwmac100_set_filter(struct net_device *dev)
readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW)); readl(ioaddr + MAC_HASH_HIGH), readl(ioaddr + MAC_HASH_LOW));
} }
static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex, static void dwmac100_flow_ctrl(void __iomem *ioaddr, unsigned int duplex,
unsigned int fc, unsigned int pause_time) unsigned int fc, unsigned int pause_time)
{ {
unsigned int flow = MAC_FLOW_CTRL_ENABLE; unsigned int flow = MAC_FLOW_CTRL_ENABLE;
...@@ -158,7 +158,7 @@ static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex, ...@@ -158,7 +158,7 @@ static void dwmac100_flow_ctrl(unsigned long ioaddr, unsigned int duplex,
/* No PMT module supported for this Ethernet Controller. /* No PMT module supported for this Ethernet Controller.
* Tested on ST platforms only. * Tested on ST platforms only.
*/ */
static void dwmac100_pmt(unsigned long ioaddr, unsigned long mode) static void dwmac100_pmt(void __iomem *ioaddr, unsigned long mode)
{ {
return; return;
} }
...@@ -174,7 +174,7 @@ struct stmmac_ops dwmac100_ops = { ...@@ -174,7 +174,7 @@ struct stmmac_ops dwmac100_ops = {
.get_umac_addr = dwmac100_get_umac_addr, .get_umac_addr = dwmac100_get_umac_addr,
}; };
struct mac_device_info *dwmac100_setup(unsigned long ioaddr) struct mac_device_info *dwmac100_setup(void __iomem *ioaddr)
{ {
struct mac_device_info *mac; struct mac_device_info *mac;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "dwmac100.h" #include "dwmac100.h"
#include "dwmac_dma.h" #include "dwmac_dma.h"
static int dwmac100_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, u32 dma_tx,
u32 dma_rx) u32 dma_rx)
{ {
u32 value = readl(ioaddr + DMA_BUS_MODE); u32 value = readl(ioaddr + DMA_BUS_MODE);
...@@ -58,7 +58,7 @@ static int dwmac100_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx, ...@@ -58,7 +58,7 @@ static int dwmac100_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx,
/* Store and Forward capability is not used at all.. /* Store and Forward capability is not used at all..
* The transmit threshold can be programmed by * The transmit threshold can be programmed by
* setting the TTC bits in the DMA control register.*/ * setting the TTC bits in the DMA control register.*/
static void dwmac100_dma_operation_mode(unsigned long ioaddr, int txmode, static void dwmac100_dma_operation_mode(void __iomem *ioaddr, int txmode,
int rxmode) int rxmode)
{ {
u32 csr6 = readl(ioaddr + DMA_CONTROL); u32 csr6 = readl(ioaddr + DMA_CONTROL);
...@@ -73,7 +73,7 @@ static void dwmac100_dma_operation_mode(unsigned long ioaddr, int txmode, ...@@ -73,7 +73,7 @@ static void dwmac100_dma_operation_mode(unsigned long ioaddr, int txmode,
writel(csr6, ioaddr + DMA_CONTROL); writel(csr6, ioaddr + DMA_CONTROL);
} }
static void dwmac100_dump_dma_regs(unsigned long ioaddr) static void dwmac100_dump_dma_regs(void __iomem *ioaddr)
{ {
int i; int i;
...@@ -91,7 +91,7 @@ static void dwmac100_dump_dma_regs(unsigned long ioaddr) ...@@ -91,7 +91,7 @@ static void dwmac100_dump_dma_regs(unsigned long ioaddr)
/* DMA controller has two counters to track the number of /* DMA controller has two counters to track the number of
* the receive missed frames. */ * the receive missed frames. */
static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x, static void dwmac100_dma_diagnostic_fr(void *data, struct stmmac_extra_stats *x,
unsigned long ioaddr) void __iomem *ioaddr)
{ {
struct net_device_stats *stats = (struct net_device_stats *)data; struct net_device_stats *stats = (struct net_device_stats *)data;
u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR); u32 csr8 = readl(ioaddr + DMA_MISSED_FRAME_CTR);
......
...@@ -97,12 +97,12 @@ ...@@ -97,12 +97,12 @@
#define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */ #define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */
#define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */ #define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */
extern void dwmac_enable_dma_transmission(unsigned long ioaddr); extern void dwmac_enable_dma_transmission(void __iomem *ioaddr);
extern void dwmac_enable_dma_irq(unsigned long ioaddr); extern void dwmac_enable_dma_irq(void __iomem *ioaddr);
extern void dwmac_disable_dma_irq(unsigned long ioaddr); extern void dwmac_disable_dma_irq(void __iomem *ioaddr);
extern void dwmac_dma_start_tx(unsigned long ioaddr); extern void dwmac_dma_start_tx(void __iomem *ioaddr);
extern void dwmac_dma_stop_tx(unsigned long ioaddr); extern void dwmac_dma_stop_tx(void __iomem *ioaddr);
extern void dwmac_dma_start_rx(unsigned long ioaddr); extern void dwmac_dma_start_rx(void __iomem *ioaddr);
extern void dwmac_dma_stop_rx(unsigned long ioaddr); extern void dwmac_dma_stop_rx(void __iomem *ioaddr);
extern int dwmac_dma_interrupt(unsigned long ioaddr, extern int dwmac_dma_interrupt(void __iomem *ioaddr,
struct stmmac_extra_stats *x); struct stmmac_extra_stats *x);
...@@ -32,43 +32,43 @@ ...@@ -32,43 +32,43 @@
#endif #endif
/* CSR1 enables the transmit DMA to check for new descriptor */ /* CSR1 enables the transmit DMA to check for new descriptor */
void dwmac_enable_dma_transmission(unsigned long ioaddr) void dwmac_enable_dma_transmission(void __iomem *ioaddr)
{ {
writel(1, ioaddr + DMA_XMT_POLL_DEMAND); writel(1, ioaddr + DMA_XMT_POLL_DEMAND);
} }
void dwmac_enable_dma_irq(unsigned long ioaddr) void dwmac_enable_dma_irq(void __iomem *ioaddr)
{ {
writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA);
} }
void dwmac_disable_dma_irq(unsigned long ioaddr) void dwmac_disable_dma_irq(void __iomem *ioaddr)
{ {
writel(0, ioaddr + DMA_INTR_ENA); writel(0, ioaddr + DMA_INTR_ENA);
} }
void dwmac_dma_start_tx(unsigned long ioaddr) void dwmac_dma_start_tx(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + DMA_CONTROL); u32 value = readl(ioaddr + DMA_CONTROL);
value |= DMA_CONTROL_ST; value |= DMA_CONTROL_ST;
writel(value, ioaddr + DMA_CONTROL); writel(value, ioaddr + DMA_CONTROL);
} }
void dwmac_dma_stop_tx(unsigned long ioaddr) void dwmac_dma_stop_tx(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + DMA_CONTROL); u32 value = readl(ioaddr + DMA_CONTROL);
value &= ~DMA_CONTROL_ST; value &= ~DMA_CONTROL_ST;
writel(value, ioaddr + DMA_CONTROL); writel(value, ioaddr + DMA_CONTROL);
} }
void dwmac_dma_start_rx(unsigned long ioaddr) void dwmac_dma_start_rx(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + DMA_CONTROL); u32 value = readl(ioaddr + DMA_CONTROL);
value |= DMA_CONTROL_SR; value |= DMA_CONTROL_SR;
writel(value, ioaddr + DMA_CONTROL); writel(value, ioaddr + DMA_CONTROL);
} }
void dwmac_dma_stop_rx(unsigned long ioaddr) void dwmac_dma_stop_rx(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + DMA_CONTROL); u32 value = readl(ioaddr + DMA_CONTROL);
value &= ~DMA_CONTROL_SR; value &= ~DMA_CONTROL_SR;
...@@ -145,7 +145,7 @@ static void show_rx_process_state(unsigned int status) ...@@ -145,7 +145,7 @@ static void show_rx_process_state(unsigned int status)
} }
#endif #endif
int dwmac_dma_interrupt(unsigned long ioaddr, int dwmac_dma_interrupt(void __iomem *ioaddr,
struct stmmac_extra_stats *x) struct stmmac_extra_stats *x)
{ {
int ret = 0; int ret = 0;
...@@ -219,7 +219,7 @@ int dwmac_dma_interrupt(unsigned long ioaddr, ...@@ -219,7 +219,7 @@ int dwmac_dma_interrupt(unsigned long ioaddr,
return ret; return ret;
} }
void dwmac_dma_flush_tx_fifo(unsigned long ioaddr) void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr)
{ {
u32 csr6 = readl(ioaddr + DMA_CONTROL); u32 csr6 = readl(ioaddr + DMA_CONTROL);
writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL); writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL);
...@@ -227,7 +227,7 @@ void dwmac_dma_flush_tx_fifo(unsigned long ioaddr) ...@@ -227,7 +227,7 @@ void dwmac_dma_flush_tx_fifo(unsigned long ioaddr)
do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF)); do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF));
} }
void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6], void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
unsigned int high, unsigned int low) unsigned int high, unsigned int low)
{ {
unsigned long data; unsigned long data;
...@@ -238,7 +238,7 @@ void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6], ...@@ -238,7 +238,7 @@ void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6],
writel(data, ioaddr + low); writel(data, ioaddr + low);
} }
void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr, void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
unsigned int high, unsigned int low) unsigned int high, unsigned int low)
{ {
unsigned int hi_addr, lo_addr; unsigned int hi_addr, lo_addr;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "common.h" #include "common.h"
static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x, static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,
struct dma_desc *p, unsigned long ioaddr) struct dma_desc *p, void __iomem *ioaddr)
{ {
int ret = 0; int ret = 0;
struct net_device_stats *stats = (struct net_device_stats *)data; struct net_device_stats *stats = (struct net_device_stats *)data;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "common.h" #include "common.h"
static int ndesc_get_tx_status(void *data, struct stmmac_extra_stats *x, static int ndesc_get_tx_status(void *data, struct stmmac_extra_stats *x,
struct dma_desc *p, unsigned long ioaddr) struct dma_desc *p, void __iomem *ioaddr)
{ {
int ret = 0; int ret = 0;
struct net_device_stats *stats = (struct net_device_stats *)data; struct net_device_stats *stats = (struct net_device_stats *)data;
......
...@@ -54,6 +54,7 @@ struct stmmac_priv { ...@@ -54,6 +54,7 @@ struct stmmac_priv {
unsigned int dma_buf_sz; unsigned int dma_buf_sz;
struct device *device; struct device *device;
struct mac_device_info *hw; struct mac_device_info *hw;
void __iomem *ioaddr;
struct stmmac_extra_stats xstats; struct stmmac_extra_stats xstats;
struct napi_struct napi; struct napi_struct napi;
...@@ -65,7 +66,7 @@ struct stmmac_priv { ...@@ -65,7 +66,7 @@ struct stmmac_priv {
int phy_mask; int phy_mask;
int (*phy_reset) (void *priv); int (*phy_reset) (void *priv);
void (*fix_mac_speed) (void *priv, unsigned int speed); void (*fix_mac_speed) (void *priv, unsigned int speed);
void (*bus_setup)(unsigned long ioaddr); void (*bus_setup)(void __iomem *ioaddr);
void *bsp_priv; void *bsp_priv;
int phy_irq; int phy_irq;
......
...@@ -177,21 +177,21 @@ void stmmac_ethtool_gregs(struct net_device *dev, ...@@ -177,21 +177,21 @@ void stmmac_ethtool_gregs(struct net_device *dev,
if (!priv->is_gmac) { if (!priv->is_gmac) {
/* MAC registers */ /* MAC registers */
for (i = 0; i < 12; i++) for (i = 0; i < 12; i++)
reg_space[i] = readl(dev->base_addr + (i * 4)); reg_space[i] = readl(priv->ioaddr + (i * 4));
/* DMA registers */ /* DMA registers */
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++)
reg_space[i + 12] = reg_space[i + 12] =
readl(dev->base_addr + (DMA_BUS_MODE + (i * 4))); readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
reg_space[22] = readl(dev->base_addr + DMA_CUR_TX_BUF_ADDR); reg_space[22] = readl(priv->ioaddr + DMA_CUR_TX_BUF_ADDR);
reg_space[23] = readl(dev->base_addr + DMA_CUR_RX_BUF_ADDR); reg_space[23] = readl(priv->ioaddr + DMA_CUR_RX_BUF_ADDR);
} else { } else {
/* MAC registers */ /* MAC registers */
for (i = 0; i < 55; i++) for (i = 0; i < 55; i++)
reg_space[i] = readl(dev->base_addr + (i * 4)); reg_space[i] = readl(priv->ioaddr + (i * 4));
/* DMA registers */ /* DMA registers */
for (i = 0; i < 22; i++) for (i = 0; i < 22; i++)
reg_space[i + 55] = reg_space[i + 55] =
readl(dev->base_addr + (DMA_BUS_MODE + (i * 4))); readl(priv->ioaddr + (DMA_BUS_MODE + (i * 4)));
} }
} }
...@@ -263,11 +263,9 @@ stmmac_set_pauseparam(struct net_device *netdev, ...@@ -263,11 +263,9 @@ stmmac_set_pauseparam(struct net_device *netdev,
cmd.phy_address = phy->addr; cmd.phy_address = phy->addr;
ret = phy_ethtool_sset(phy, &cmd); ret = phy_ethtool_sset(phy, &cmd);
} }
} else { } else
unsigned long ioaddr = netdev->base_addr; priv->hw->mac->flow_ctrl(priv->ioaddr, phy->duplex,
priv->hw->mac->flow_ctrl(ioaddr, phy->duplex,
priv->flow_ctrl, priv->pause); priv->flow_ctrl, priv->pause);
}
spin_unlock(&priv->lock); spin_unlock(&priv->lock);
return ret; return ret;
} }
...@@ -276,12 +274,11 @@ static void stmmac_get_ethtool_stats(struct net_device *dev, ...@@ -276,12 +274,11 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *dummy, u64 *data) struct ethtool_stats *dummy, u64 *data)
{ {
struct stmmac_priv *priv = netdev_priv(dev); struct stmmac_priv *priv = netdev_priv(dev);
unsigned long ioaddr = dev->base_addr;
int i; int i;
/* Update HW stats if supported */ /* Update HW stats if supported */
priv->hw->dma->dma_diagnostic_fr(&dev->stats, (void *) &priv->xstats, priv->hw->dma->dma_diagnostic_fr(&dev->stats, (void *) &priv->xstats,
ioaddr); priv->ioaddr);
for (i = 0; i < STMMAC_STATS_LEN; i++) { for (i = 0; i < STMMAC_STATS_LEN; i++) {
char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset; char *p = (char *)priv + stmmac_gstrings_stats[i].stat_offset;
......
This diff is collapsed.
...@@ -47,7 +47,6 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) ...@@ -47,7 +47,6 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
{ {
struct net_device *ndev = bus->priv; struct net_device *ndev = bus->priv;
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long ioaddr = ndev->base_addr;
unsigned int mii_address = priv->hw->mii.addr; unsigned int mii_address = priv->hw->mii.addr;
unsigned int mii_data = priv->hw->mii.data; unsigned int mii_data = priv->hw->mii.data;
...@@ -56,12 +55,12 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg) ...@@ -56,12 +55,12 @@ static int stmmac_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
((phyreg << 6) & (0x000007C0))); ((phyreg << 6) & (0x000007C0)));
regValue |= MII_BUSY; /* in case of GMAC */ regValue |= MII_BUSY; /* in case of GMAC */
do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); do {} while (((readl(priv->ioaddr + mii_address)) & MII_BUSY) == 1);
writel(regValue, ioaddr + mii_address); writel(regValue, priv->ioaddr + mii_address);
do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); do {} while (((readl(priv->ioaddr + mii_address)) & MII_BUSY) == 1);
/* Read the data from the MII data register */ /* Read the data from the MII data register */
data = (int)readl(ioaddr + mii_data); data = (int)readl(priv->ioaddr + mii_data);
return data; return data;
} }
...@@ -79,7 +78,6 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, ...@@ -79,7 +78,6 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
{ {
struct net_device *ndev = bus->priv; struct net_device *ndev = bus->priv;
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long ioaddr = ndev->base_addr;
unsigned int mii_address = priv->hw->mii.addr; unsigned int mii_address = priv->hw->mii.addr;
unsigned int mii_data = priv->hw->mii.data; unsigned int mii_data = priv->hw->mii.data;
...@@ -90,14 +88,14 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg, ...@@ -90,14 +88,14 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
value |= MII_BUSY; value |= MII_BUSY;
/* Wait until any existing MII operation is complete */ /* Wait until any existing MII operation is complete */
do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); do {} while (((readl(priv->ioaddr + mii_address)) & MII_BUSY) == 1);
/* Set the MII address register to write */ /* Set the MII address register to write */
writel(phydata, ioaddr + mii_data); writel(phydata, priv->ioaddr + mii_data);
writel(value, ioaddr + mii_address); writel(value, priv->ioaddr + mii_address);
/* Wait until any existing MII operation is complete */ /* Wait until any existing MII operation is complete */
do {} while (((readl(ioaddr + mii_address)) & MII_BUSY) == 1); do {} while (((readl(priv->ioaddr + mii_address)) & MII_BUSY) == 1);
return 0; return 0;
} }
...@@ -111,7 +109,6 @@ static int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -111,7 +109,6 @@ static int stmmac_mdio_reset(struct mii_bus *bus)
{ {
struct net_device *ndev = bus->priv; struct net_device *ndev = bus->priv;
struct stmmac_priv *priv = netdev_priv(ndev); struct stmmac_priv *priv = netdev_priv(ndev);
unsigned long ioaddr = ndev->base_addr;
unsigned int mii_address = priv->hw->mii.addr; unsigned int mii_address = priv->hw->mii.addr;
if (priv->phy_reset) { if (priv->phy_reset) {
...@@ -123,7 +120,7 @@ static int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -123,7 +120,7 @@ static int stmmac_mdio_reset(struct mii_bus *bus)
* It doesn't complete its reset until at least one clock cycle * It doesn't complete its reset until at least one clock cycle
* on MDC, so perform a dummy mdio read. * on MDC, so perform a dummy mdio read.
*/ */
writel(0, ioaddr + mii_address); writel(0, priv->ioaddr + mii_address);
return 0; return 0;
} }
......
...@@ -35,7 +35,7 @@ struct plat_stmmacenet_data { ...@@ -35,7 +35,7 @@ struct plat_stmmacenet_data {
int has_gmac; int has_gmac;
int enh_desc; int enh_desc;
void (*fix_mac_speed)(void *priv, unsigned int speed); void (*fix_mac_speed)(void *priv, unsigned int speed);
void (*bus_setup)(unsigned long ioaddr); void (*bus_setup)(void __iomem *ioaddr);
#ifdef CONFIG_STM_DRIVERS #ifdef CONFIG_STM_DRIVERS
struct stm_pad_config *pad_config; struct stm_pad_config *pad_config;
#endif #endif
......
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