mirror of
https://github.com/Fishwaldo/build.git
synced 2025-03-21 22:31:51 +00:00
114 lines
3.6 KiB
Diff
114 lines
3.6 KiB
Diff
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
|
|
index 1b3096d..b29ba6f
|
|
--- a/arch/arm/kernel/setup.c
|
|
+++ b/arch/arm/kernel/setup.c
|
|
@@ -31,6 +31,7 @@
|
|
#include <linux/bug.h>
|
|
#include <linux/compiler.h>
|
|
#include <linux/sort.h>
|
|
+#include <linux/io.h>
|
|
|
|
#include <asm/unified.h>
|
|
#include <asm/cp15.h>
|
|
@@ -1103,6 +1104,13 @@ static int c_show(struct seq_file *m, void *v)
|
|
seq_printf(m, "Serial\t\t: %08x%08x\n",
|
|
system_serial_high, system_serial_low);
|
|
|
|
+ #define SW_VA_SID_IO_BASE 0xf1c23800
|
|
+ seq_printf(m, "Chipid\t\t: %08x-%08x-%08x-%08x\n",
|
|
+ readl(SW_VA_SID_IO_BASE),
|
|
+ readl(SW_VA_SID_IO_BASE + 0x4),
|
|
+ readl(SW_VA_SID_IO_BASE + 0x8),
|
|
+ readl(SW_VA_SID_IO_BASE + 0xc)
|
|
+ );
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/drivers/net/ethernet/allwinner/gmac/gmac_core.c b/drivers/net/ethernet/allwinner/gmac/gmac_core.c
|
|
index 44619cf..55f9860
|
|
--- a/drivers/net/ethernet/allwinner/gmac/gmac_core.c
|
|
+++ b/drivers/net/ethernet/allwinner/gmac/gmac_core.c
|
|
@@ -38,6 +38,7 @@
|
|
#include <linux/gpio.h>
|
|
|
|
#include <plat/sys_config.h>
|
|
+#include <plat/platform.h>
|
|
#include <mach/gpio.h>
|
|
#include <mach/clock.h>
|
|
|
|
@@ -78,8 +79,7 @@
|
|
#define GMAC_ALIGN(x) L1_CACHE_ALIGN(x)
|
|
#define JUMBO_LEN 9000
|
|
|
|
-#define GMAC_MAC_ADDRESS "00:00:00:00:00:00"
|
|
-static char *mac_str = GMAC_MAC_ADDRESS;
|
|
+static char *mac_str = ":";
|
|
module_param(mac_str, charp, S_IRUGO | S_IWUSR);
|
|
MODULE_PARM_DESC(mac_str, "MAC Address String.(xx:xx:xx:xx:xx:xx)");
|
|
|
|
@@ -773,21 +773,45 @@ static void gmac_dma_interrupt(struct gmac_priv *priv)
|
|
|
|
static void gmac_check_ether_addr(struct gmac_priv *priv)
|
|
{
|
|
- int i;
|
|
- char *p = mac_str;
|
|
+
|
|
+
|
|
/* verify if the MAC address is valid, in case of failures it
|
|
* generates a random MAC address */
|
|
if (!is_valid_ether_addr(priv->ndev->dev_addr)) {
|
|
- if (!is_valid_ether_addr(priv->ndev->dev_addr)) {
|
|
+
|
|
+ if (strlen(mac_str) == 17) {
|
|
+ int i;
|
|
+ char *p = mac_str;
|
|
+
|
|
+ pr_info("gmac: use mac address from mac_str\n");
|
|
for (i=0; i<6; i++,p++)
|
|
priv->ndev->dev_addr[i] = simple_strtoul(p, &p, 16);
|
|
}
|
|
|
|
- if (!is_valid_ether_addr(priv->ndev->dev_addr))
|
|
- random_ether_addr(priv->ndev->dev_addr);
|
|
+ if (!is_valid_ether_addr(priv->ndev->dev_addr)) {
|
|
+ unsigned int reg_val;
|
|
+
|
|
+ reg_val = readl(SW_VA_SID_IO_BASE);
|
|
+ pr_info("gmac: use mac address from chipid\n");
|
|
+ priv->ndev->dev_addr[0] = 0x02; /* Non OUI / registered MAC address */
|
|
+ priv->ndev->dev_addr[1] = (reg_val >> 0) & 0xff;
|
|
+ reg_val = readl(SW_VA_SID_IO_BASE + 0x0c);
|
|
+ priv->ndev->dev_addr[2] = (reg_val >> 24) & 0xff;
|
|
+ priv->ndev->dev_addr[3] = (reg_val >> 16) & 0xff;
|
|
+ priv->ndev->dev_addr[4] = (reg_val >> 8) & 0xff;
|
|
+ priv->ndev->dev_addr[5] = (reg_val >> 0) & 0xff;
|
|
+
|
|
+ if (!is_valid_ether_addr(priv->ndev->dev_addr)) {
|
|
+ random_ether_addr(priv->ndev->dev_addr);
|
|
+ pr_info("gmac: use random mac address\n");
|
|
+ }
|
|
+ }
|
|
+ } else {
|
|
+ pr_info("gmac: use mac address from cmdline\n");
|
|
}
|
|
- printk(KERN_WARNING "%s: device MAC address %pM\n", priv->ndev->name,
|
|
- priv->ndev->dev_addr);
|
|
+
|
|
+ pr_info("gmac: device MAC address %pM\n", priv->ndev->dev_addr);
|
|
+
|
|
}
|
|
|
|
/**
|
|
diff --git a/drivers/net/ethernet/allwinner/gmac/gmac_desc.c b/drivers/net/ethernet/allwinner/gmac/gmac_desc.c
|
|
index 57ae52f..bfa4d76
|
|
--- a/drivers/net/ethernet/allwinner/gmac/gmac_desc.c
|
|
+++ b/drivers/net/ethernet/allwinner/gmac/gmac_desc.c
|
|
@@ -49,7 +49,7 @@ int desc_get_tx_status(void *data, struct gmac_extra_stats *x,
|
|
}
|
|
|
|
if (p->desc0.tx.vlan_tag) {
|
|
- pr_debug("GMAC TX status: VLAN frame\n");
|
|
+/* pr_debug("GMAC TX status: VLAN frame\n");*/
|
|
x->tx_vlan++;
|
|
}
|
|
|