mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-16 11:54:48 +00:00
use the tulip platform driver
Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 34558
This commit is contained in:
parent
445e77fdb5
commit
40ab1facd2
@ -12,6 +12,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/platform_data/tulip.h>
|
||||
#include <linux/mtd/physmap.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/pci.h>
|
||||
@ -27,6 +28,10 @@
|
||||
#include <asm/io.h>
|
||||
#include <adm8668.h>
|
||||
|
||||
#define ADM8868_UBOOT_ENV 0x20000
|
||||
#define ADM8868_UBOOT_WAN_MAC 0x5ac
|
||||
#define ADM8868_UBOOT_LAN_MAC 0x404
|
||||
|
||||
static void adm8668_uart_set_mctrl(struct amba_device *dev,
|
||||
void __iomem *base,
|
||||
unsigned int mcrtl)
|
||||
@ -66,11 +71,16 @@ static struct resource eth0_resources[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct tulip_platform_data eth0_pdata = {
|
||||
.chip_id = ADM8668,
|
||||
};
|
||||
|
||||
static struct platform_device adm8668_eth0_device = {
|
||||
.name = "adm8668_eth",
|
||||
.name = "tulip",
|
||||
.id = 0,
|
||||
.resource = eth0_resources,
|
||||
.num_resources = ARRAY_SIZE(eth0_resources),
|
||||
.dev.platform_data = ð0_pdata,
|
||||
};
|
||||
|
||||
static struct resource eth1_resources[] = {
|
||||
@ -85,11 +95,16 @@ static struct resource eth1_resources[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct tulip_platform_data eth1_pdata = {
|
||||
.chip_id = ADM8668,
|
||||
};
|
||||
|
||||
static struct platform_device adm8668_eth1_device = {
|
||||
.name = "adm8668_eth",
|
||||
.name = "tulip",
|
||||
.id = 1,
|
||||
.resource = eth1_resources,
|
||||
.num_resources = ARRAY_SIZE(eth1_resources),
|
||||
.dev.platform_data = ð1_pdata,
|
||||
};
|
||||
|
||||
static const char *nor_probe_types[] = { "adm8668part", NULL };
|
||||
@ -121,6 +136,33 @@ static struct platform_device *adm8668_devs[] = {
|
||||
&adm8668_nor_device,
|
||||
};
|
||||
|
||||
static void adm8668_fetch_mac(int unit)
|
||||
{
|
||||
u8 *mac;
|
||||
u32 offset;
|
||||
struct tulip_platform_data *pdata;
|
||||
|
||||
switch (unit) {
|
||||
case -1:
|
||||
case 0:
|
||||
offset = ADM8868_UBOOT_LAN_MAC;
|
||||
pdata = ð0_pdata;
|
||||
break;
|
||||
case 1:
|
||||
offset = ADM8868_UBOOT_WAN_MAC;
|
||||
pdata = ð1_pdata;
|
||||
break;
|
||||
default:
|
||||
pr_err("unsupported ethernet unit: %d\n", unit);
|
||||
return;
|
||||
}
|
||||
|
||||
mac = (u8 *)(KSEG1ADDR(ADM8668_SMEM1_BASE) + ADM8868_UBOOT_ENV + offset);
|
||||
|
||||
memcpy(pdata->mac, mac, sizeof(pdata->mac));
|
||||
}
|
||||
|
||||
|
||||
int __devinit adm8668_devs_register(void)
|
||||
{
|
||||
int ret;
|
||||
@ -129,6 +171,9 @@ int __devinit adm8668_devs_register(void)
|
||||
if (ret)
|
||||
panic("failed to register AMBA UART");
|
||||
|
||||
adm8668_fetch_mac(0);
|
||||
adm8668_fetch_mac(1);
|
||||
|
||||
return platform_add_devices(adm8668_devs, ARRAY_SIZE(adm8668_devs));
|
||||
}
|
||||
arch_initcall(adm8668_devs_register);
|
||||
|
Loading…
Reference in New Issue
Block a user