Commit 0ac7ee3d authored by Alessandro Rubini's avatar Alessandro Rubini

kernel modules: fixed init/remap in nic

parent a8379d91
......@@ -10,7 +10,6 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/netdevice.h>
......@@ -64,7 +63,7 @@ static int __devexit wrn_remove(struct platform_device *pdev)
/* This helper is used by probe below */
static int __devinit __wrn_map_resources(struct platform_device *pdev)
{
int i = 0;
int i;
struct resource *res;
void __iomem *ptr;
struct wrn_dev *wrn = pdev->dev.platform_data;
......@@ -73,8 +72,9 @@ static int __devinit __wrn_map_resources(struct platform_device *pdev)
* The memory regions are mapped once for all endpoints.
* We don't populate the whole array, but use the resource list
*/
while ( (res =platform_get_resource(pdev, IORESOURCE_MEM, i)) ) {
if (!res->start)
for (i = 0; i < pdev->num_resources; i++) {
res = platform_get_resource(pdev, IORESOURCE_MEM, i);
if (!res || !res->start)
continue;
ptr = ioremap(res->start, res->end + 1 - res->start);
if (!ptr) {
......@@ -86,8 +86,6 @@ static int __devinit __wrn_map_resources(struct platform_device *pdev)
pr_debug("Remapped %08x (block %i) to %p\n",
res->start, i, ptr);
wrn->bases[i] = ptr;
i++; /* next please */
}
return 0;
}
......@@ -115,7 +113,6 @@ static int __devinit wrn_probe(struct platform_device *pdev)
/* Map our resource list and instantiate the shortcut pointers */
if ( (err = __wrn_map_resources(pdev)) )
goto out;
wrn->regs = wrn->bases[WRN_FB_NIC];
wrn->txtsu_regs = wrn->bases[WRN_FB_TS];
......
......@@ -37,7 +37,7 @@
* 0x20000 - 0x20fff NIC control regs and descriptor area
* 0x28000 - 0x2bfff NIC packet buffer (16k)
* 0x30000 - 0x4ffff: Endpoints
* 0x30000 + N * 0x200 Endpoint N control registers
* 0x30000 + N * 0x400 Endpoint N control registers
* 0x50000 - 0x50fff: VIC
* 0x51000 - 0x51fff: Tstamp unit
* 0x52000 - 0x52fff: PPS gen
......@@ -47,8 +47,8 @@
#define FPGA_SIZE_NIC 0x00010000
#define FPGA_BASE_EP 0x10030000
#define FPGA_SIZE_EP 0x00010000
#define FPGA_SIZE_EACH_EP 0x200
#define FPGA_BASE_VIC 0x10050000
#define FPGA_SIZE_EACH_EP 0x400
#define FPGA_BASE_VIC 0x10050000 /* not used here */
#define FPGA_SIZE_VIC 0x00001000
#define FPGA_BASE_TS 0x10051000
#define FPGA_SIZE_TS 0x00001000
......@@ -58,7 +58,6 @@
enum fpga_blocks {
WRN_FB_NIC,
WRN_FB_EP,
WRN_FB_VIC, /* not mapped here (but in wr-vic.ko) */
WRN_FB_TS,
WRN_FB_PPSG,
WRN_NR_OF_BLOCKS,
......
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