gemini: update ethernet driver, register ethernet on nas4220 board
Signed-off-by: Roman Yeryomin <roman@advem.lv> SVN-Revision: 43501
This commit is contained in:
parent
da988d582f
commit
8a9979e57a
@ -43,7 +43,7 @@ CONFIG_DMADEVICES=y
|
|||||||
CONFIG_DNOTIFY=y
|
CONFIG_DNOTIFY=y
|
||||||
CONFIG_FRAME_POINTER=y
|
CONFIG_FRAME_POINTER=y
|
||||||
CONFIG_GEMINI_MEM_SWAP=y
|
CONFIG_GEMINI_MEM_SWAP=y
|
||||||
CONFIG_GEMINI_NET_ENGINE_GMAC=y
|
CONFIG_GEMINI_SL351X=y
|
||||||
CONFIG_GEMINI_WATCHDOG=y
|
CONFIG_GEMINI_WATCHDOG=y
|
||||||
CONFIG_GENERIC_ATOMIC64=y
|
CONFIG_GENERIC_ATOMIC64=y
|
||||||
CONFIG_GENERIC_BUG=y
|
CONFIG_GENERIC_BUG=y
|
||||||
@ -124,6 +124,7 @@ CONFIG_NEED_DMA_MAP_STATE=y
|
|||||||
CONFIG_NEED_KUSER_HELPERS=y
|
CONFIG_NEED_KUSER_HELPERS=y
|
||||||
CONFIG_NEED_MACH_GPIO_H=y
|
CONFIG_NEED_MACH_GPIO_H=y
|
||||||
CONFIG_NEED_PER_CPU_KM=y
|
CONFIG_NEED_PER_CPU_KM=y
|
||||||
|
CONFIG_NET_VENDOR_GEMINI=y
|
||||||
CONFIG_OLD_SIGACTION=y
|
CONFIG_OLD_SIGACTION=y
|
||||||
CONFIG_OLD_SIGSUSPEND3=y
|
CONFIG_OLD_SIGSUSPEND3=y
|
||||||
CONFIG_PAGEFLAGS_EXTENDED=y
|
CONFIG_PAGEFLAGS_EXTENDED=y
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,82 +0,0 @@
|
|||||||
--- a/arch/arm/mach-gemini/common.h
|
|
||||||
+++ b/arch/arm/mach-gemini/common.h
|
|
||||||
@@ -13,6 +13,7 @@
|
|
||||||
#define __GEMINI_COMMON_H__
|
|
||||||
|
|
||||||
struct mtd_partition;
|
|
||||||
+struct gemini_gmac_platform_data;
|
|
||||||
|
|
||||||
extern void gemini_map_io(void);
|
|
||||||
extern void gemini_init_irq(void);
|
|
||||||
@@ -26,6 +27,7 @@ extern int platform_register_pflash(unsi
|
|
||||||
struct mtd_partition *parts,
|
|
||||||
unsigned int nr_parts);
|
|
||||||
extern int platform_register_watchdog(void);
|
|
||||||
+extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata);
|
|
||||||
|
|
||||||
extern void gemini_restart(char mode, const char *cmd);
|
|
||||||
|
|
||||||
--- a/arch/arm/mach-gemini/devices.c
|
|
||||||
+++ b/arch/arm/mach-gemini/devices.c
|
|
||||||
@@ -17,6 +17,7 @@
|
|
||||||
#include <mach/irqs.h>
|
|
||||||
#include <mach/hardware.h>
|
|
||||||
#include <mach/global_reg.h>
|
|
||||||
+#include <mach/gmac.h>
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
static struct plat_serial8250_port serial_platform_data[] = {
|
|
||||||
@@ -134,3 +135,53 @@ int __init platform_register_watchdog(vo
|
|
||||||
{
|
|
||||||
return platform_device_register(&wdt_device);
|
|
||||||
}
|
|
||||||
+
|
|
||||||
+static struct resource gmac_resources[] = {
|
|
||||||
+ {
|
|
||||||
+ .start = 0x60000000,
|
|
||||||
+ .end = 0x6000ffff,
|
|
||||||
+ .flags = IORESOURCE_MEM,
|
|
||||||
+ },
|
|
||||||
+ {
|
|
||||||
+ .start = IRQ_GMAC0,
|
|
||||||
+ .end = IRQ_GMAC0,
|
|
||||||
+ .flags = IORESOURCE_IRQ,
|
|
||||||
+ },
|
|
||||||
+ {
|
|
||||||
+ .start = IRQ_GMAC1,
|
|
||||||
+ .end = IRQ_GMAC1,
|
|
||||||
+ .flags = IORESOURCE_IRQ,
|
|
||||||
+ },
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static u64 gmac_dmamask = 0xffffffffUL;
|
|
||||||
+
|
|
||||||
+static struct platform_device ethernet_device = {
|
|
||||||
+ .name = "gemini-gmac",
|
|
||||||
+ .id = 0,
|
|
||||||
+ .dev = {
|
|
||||||
+ .dma_mask = &gmac_dmamask,
|
|
||||||
+ .coherent_dma_mask = DMA_BIT_MASK(32),
|
|
||||||
+ },
|
|
||||||
+ .num_resources = ARRAY_SIZE(gmac_resources),
|
|
||||||
+ .resource = gmac_resources,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+int __init platform_register_ethernet(struct gemini_gmac_platform_data *pdata)
|
|
||||||
+{
|
|
||||||
+ unsigned int reg;
|
|
||||||
+
|
|
||||||
+ reg = __raw_readl(IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
|
|
||||||
+ reg &= ~(GMAC_GMII | GMAC_1_ENABLE);
|
|
||||||
+
|
|
||||||
+ if (pdata->bus_id[1])
|
|
||||||
+ reg |= GMAC_1_ENABLE;
|
|
||||||
+ else if (pdata->interface[0] == PHY_INTERFACE_MODE_GMII)
|
|
||||||
+ reg |= GMAC_GMII;
|
|
||||||
+
|
|
||||||
+ __raw_writel(reg, IO_ADDRESS(GEMINI_GLOBAL_BASE) + GLOBAL_MISC_CTRL);
|
|
||||||
+
|
|
||||||
+ ethernet_device.dev.platform_data = pdata;
|
|
||||||
+
|
|
||||||
+ return platform_device_register(ðernet_device);
|
|
||||||
+}
|
|
@ -0,0 +1,79 @@
|
|||||||
|
--- a/arch/arm/mach-gemini/board-nas4220b.c 2011-04-21 13:19:09.878432930 +0200
|
||||||
|
+++ b/arch/arm/mach-gemini/board-nas4220b.c 2011-04-21 13:30:37.555082365 +0200
|
||||||
|
@@ -28,9 +28,27 @@
|
||||||
|
|
||||||
|
#include <mach/hardware.h>
|
||||||
|
#include <mach/global_reg.h>
|
||||||
|
+#include <mach/gmac.h>
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
+static struct mdio_gpio_platform_data ib4220b_mdio = {
|
||||||
|
+ .mdc = 22,
|
||||||
|
+ .mdio = 21,
|
||||||
|
+ .phy_mask = ~(1 << 1),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct platform_device ib4220b_phy_device = {
|
||||||
|
+ .name = "mdio-gpio",
|
||||||
|
+ .id = 0,
|
||||||
|
+ .dev = { .platform_data = &ib4220b_mdio, },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct gemini_gmac_platform_data ib4220b_gmac_data = {
|
||||||
|
+ .bus_id[0] = "gpio-0:01",
|
||||||
|
+ .interface[0] = PHY_INTERFACE_MODE_RGMII,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static struct gpio_led ib4220b_leds[] = {
|
||||||
|
{
|
||||||
|
.name = "nas4220b:orange:hdd",
|
||||||
|
@@ -107,9 +125,39 @@
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
+static void __init ib4220b_gmac_init(void)
|
||||||
|
+{
|
||||||
|
+ unsigned int val;
|
||||||
|
+
|
||||||
|
+ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_IO_DRIVING_CTRL));
|
||||||
|
+ val |= (0x3 << GMAC0_PADS_SHIFT) | (0x3 << GMAC1_PADS_SHIFT);
|
||||||
|
+ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_IO_DRIVING_CTRL));
|
||||||
|
+
|
||||||
|
+ val = (0x0 << GMAC0_RXDV_SKEW_SHIFT) | (0xf << GMAC0_RXC_SKEW_SHIFT) |
|
||||||
|
+ (0x7 << GMAC0_TXEN_SKEW_SHIFT) | (0xb << GMAC0_TXC_SKEW_SHIFT) |
|
||||||
|
+ (0x0 << GMAC1_RXDV_SKEW_SHIFT) | (0xf << GMAC1_RXC_SKEW_SHIFT) |
|
||||||
|
+ (0x7 << GMAC1_TXEN_SKEW_SHIFT) | (0xa << GMAC1_TXC_SKEW_SHIFT);
|
||||||
|
+ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_GMAC_CTRL_SKEW_CTRL));
|
||||||
|
+
|
||||||
|
+ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_GMAC0_DATA_SKEW_CTRL));
|
||||||
|
+ writel(0x77777777, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_GMAC1_DATA_SKEW_CTRL));
|
||||||
|
+
|
||||||
|
+ val = readl((void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_ARBITRATION1_CTRL)) & ~BURST_LENGTH_MASK;
|
||||||
|
+ val |= (0x20 << BURST_LENGTH_SHIFT) | GMAC0_HIGH_PRIO | GMAC1_HIGH_PRIO;
|
||||||
|
+ writel(val, (void __iomem*)(IO_ADDRESS(GEMINI_GLOBAL_BASE) +
|
||||||
|
+ GLOBAL_ARBITRATION1_CTRL));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void __init ib4220b_init(void)
|
||||||
|
{
|
||||||
|
gemini_gpio_init();
|
||||||
|
+ ib4220b_gmac_init();
|
||||||
|
platform_register_uart();
|
||||||
|
platform_register_pflash(SZ_16M, NULL, 0);
|
||||||
|
platform_device_register(&ib4220b_led_device);
|
||||||
|
@@ -96,6 +144,8 @@
|
||||||
|
platform_device_register(&ib4220b_key_device);
|
||||||
|
platform_register_rtc();
|
||||||
|
platform_register_watchdog();
|
||||||
|
+ platform_device_register(&ib4220b_phy_device);
|
||||||
|
+ platform_register_ethernet(&ib4220b_gmac_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
MACHINE_START(NAS4220B, "Raidsonic NAS IB-4220-B")
|
@ -1,9 +1,9 @@
|
|||||||
--- a/arch/arm/mach-gemini/board-nas4220b.c
|
--- a/arch/arm/mach-gemini/board-nas4220b.c
|
||||||
+++ b/arch/arm/mach-gemini/board-nas4220b.c
|
+++ b/arch/arm/mach-gemini/board-nas4220b.c
|
||||||
@@ -96,6 +96,8 @@ static void __init ib4220b_init(void)
|
@@ -146,6 +146,8 @@ static void __init ib4220b_init(void)
|
||||||
platform_device_register(&ib4220b_key_device);
|
|
||||||
platform_register_rtc();
|
|
||||||
platform_register_watchdog();
|
platform_register_watchdog();
|
||||||
|
platform_device_register(&ib4220b_phy_device);
|
||||||
|
platform_register_ethernet(&ib4220b_gmac_data);
|
||||||
+ platform_register_usb(0);
|
+ platform_register_usb(0);
|
||||||
+ platform_register_usb(1);
|
+ platform_register_usb(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user