diff for duplicates of <200908181801.41602.florian@openwrt.org> diff --git a/a/1.txt b/N1/1.txt index ceec62c..2e3b5b2 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -16,195 +16,3 @@ Le Tuesday 18 August 2009 16:56:37 Sergei Shtylyov, vous avez écrit : Ok, like I promised, this was the per-board device registration. Do you prefer something like this: -- -From fd75b7c7fa3c05c21122c43e43260d2785475a79 Mon Sep 17 00:00:00 2001 -From: Florian Fainelli <florian@openwrt.org> -Date: Tue, 18 Aug 2009 17:53:21 +0200 -Subject: [PATCH] alchemy: add au1000-eth platform device (v2) - -This patch makes the board code register the au1000-eth -platform device. The au1000-eth platform data can be -overriden with the au1xxx_override_eth0_cfg function -like it has to be done for the Bosporus board. - -Changes from v1: -- remove per-board platform.c file -- add an override function to pass custom eth0 platform_data PHY settings - -Signed-off-by: Florian Fainelli <florian@openwrt.org> ---- -diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c -index 117f99f..559294a 100644 ---- a/arch/mips/alchemy/common/platform.c -+++ b/arch/mips/alchemy/common/platform.c -@@ -19,6 +19,7 @@ - #include <asm/mach-au1x00/au1xxx.h> - #include <asm/mach-au1x00/au1xxx_dbdma.h> - #include <asm/mach-au1x00/au1100_mmc.h> -+#include <asm/mach-au1x00/au1xxx_eth.h> - - #define PORT(_base, _irq) \ - { \ -@@ -331,6 +332,76 @@ static struct platform_device pbdb_smbus_device = { - }; - #endif - -+/* Macro to help defining the Ethernet MAC resources */ -+#define MAC_RES(_base, _enable, _irq) \ -+ { \ -+ .start = CPHYSADDR(_base), \ -+ .end = CPHYSADDR(_base + 0xffff), \ -+ .flags = IORESOURCE_MEM, \ -+ }, \ -+ { \ -+ .start = CPHYSADDR(_enable), \ -+ .end = CPHYSADDR(_enable + 0x3), \ -+ .flags = IORESOURCE_MEM, \ -+ }, \ -+ { \ -+ .start = _irq, \ -+ .end = _irq, \ -+ .flags = IORESOURCE_IRQ \ -+ } -+ -+static struct resource au1xxx_eth0_resources[] = { -+#if defined(CONFIG_SOC_AU1000) -+ MAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT), -+#elif defined(CONFIG_SOC_AU1100) -+ MAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT), -+#elif defined(CONFIG_SOC_AU1550) -+ MAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT), -+#elif defined(CONFIG_SOC_AU1500) -+ MAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT), -+#endif -+}; -+ -+static struct resource au1xxx_eth1_resources[] = { -+#if defined(CONFIG_SOC_AU1000) -+ MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT), -+#elif defined(CONFIG_SOC_AU1550) -+ MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT), -+#elif defined(CONFIG_SOC_AU1500) -+ MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT), -+#endif -+}; -+ -+static struct au1000_eth_platform_data au1xxx_eth0_platform_data = { -+ .phy1_search_mac0 = 1, -+}; -+ -+static struct platform_device au1xxx_eth0_device = { -+ .name = "au1000-eth", -+ .id = 0, -+ .num_resources = ARRAY_SIZE(au1xxx_eth0_resources), -+ .resource = au1xxx_eth0_resources, -+ .dev.platform_data = &au1xxx_eth0_platform_data, -+}; -+ -+#ifndef CONFIG_SOC_AU1100 -+static struct platform_device au1xxx_eth1_device = { -+ .name = "au1000-eth", -+ .id = 1, -+ .num_resources = ARRAY_SIZE(au1xxx_eth1_resources), -+ .resource = au1xxx_eth1_resources, -+}; -+#endif -+ -+void __init au1xxx_override_eth0_cfg(struct au1000_eth_platform_data *eth_data) -+{ -+ if (!eth_data) -+ return; -+ -+ memcpy(&au1xxx_eth0_platform_data, eth_data, -+ sizeof(struct au1000_eth_platform_data)); -+} -+ - static struct platform_device *au1xxx_platform_devices[] __initdata = { - &au1xx0_uart_device, - &au1xxx_usb_ohci_device, -@@ -351,17 +422,25 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = { - #ifdef SMBUS_PSC_BASE - &pbdb_smbus_device, - #endif -+ &au1xxx_eth0_device, - }; - - static int __init au1xxx_platform_init(void) - { - unsigned int uartclk = get_au1x00_uart_baud_base() * 16; -- int i; -+ int i, ni; - - /* Fill up uartclk. */ - for (i = 0; au1x00_uart_data[i].flags; i++) - au1x00_uart_data[i].uartclk = uartclk; - -+ /* Register second MAC if enabled in pinfunc */ -+#ifndef CONFIG_SOC_AU1100 -+ ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4); -+ if (!(ni + 1)) -+ platform_device_register(&au1xxx_eth1_device); -+#endif -+ - return platform_add_devices(au1xxx_platform_devices, - ARRAY_SIZE(au1xxx_platform_devices)); - } -diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c -index de30d8e..4d2d32c 100644 ---- a/arch/mips/alchemy/devboards/db1x00/board_setup.c -+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c -@@ -32,6 +32,7 @@ - - #include <asm/mach-au1x00/au1000.h> - #include <asm/mach-db1x00/db1x00.h> -+#include <asm/mach-au1x00/au1xxx_eth.h> - - #include <prom.h> - -@@ -134,6 +135,22 @@ void __init board_setup(void) - printk(KERN_INFO "AMD Alchemy Au1100/Db1100 Board\n"); - #endif - #ifdef CONFIG_MIPS_BOSPORUS -+ struct au1000_eth_platform_data eth0_pdata; -+ -+ /* -+ * Micrel/Kendin 5 port switch attached to MAC0, -+ * MAC0 is associated with PHY address 5 (== WAN port) -+ * MAC1 is not associated with any PHY, since it's connected directly -+ * to the switch. -+ * no interrupts are used -+ */ -+ eth0_pdata.phy1_search_mac0 = 0; -+ eth0_pdata.phy_static_config = 1; -+ eth0_pdata.phy_addr = 5; -+ eth0_pdata.phy_busid = 0; -+ -+ au1xxx_override_eth0_cfg(ð0_pdata); -+ - printk(KERN_INFO "AMD Alchemy Bosporus Board\n"); - #endif - #ifdef CONFIG_MIPS_MIRAGE -diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h -new file mode 100644 -index 0000000..876187e ---- /dev/null -+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h -@@ -0,0 +1,17 @@ -+#ifndef __AU1X00_ETH_DATA_H -+#define __AU1X00_ETH_DATA_H -+ -+/* Platform specific PHY configuration passed to the MAC driver */ -+struct au1000_eth_platform_data { -+ int phy_static_config; -+ int phy_search_highest_addr; -+ int phy1_search_mac0; -+ int phy_addr; -+ int phy_busid; -+ int phy_irq; -+}; -+ -+void __init au1xxx_override_eth0_cfg(struct au1000_eth_platform_data *eth_data); -+ -+#endif /* __AU1X00_ETH_DATA_H */ -+ --- -1.6.3.rc3 diff --git a/a/content_digest b/N1/content_digest index eb10132..35cdd47 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -28,198 +28,6 @@ "> arch/arm/mach-davinci/usb.c does.\n" "\n" "Ok, like I promised, this was the per-board device registration. Do you prefer something like this:\n" - "--\n" - "From fd75b7c7fa3c05c21122c43e43260d2785475a79 Mon Sep 17 00:00:00 2001\n" - "From: Florian Fainelli <florian@openwrt.org>\n" - "Date: Tue, 18 Aug 2009 17:53:21 +0200\n" - "Subject: [PATCH] alchemy: add au1000-eth platform device (v2)\n" - "\n" - "This patch makes the board code register the au1000-eth\n" - "platform device. The au1000-eth platform data can be\n" - "overriden with the au1xxx_override_eth0_cfg function\n" - "like it has to be done for the Bosporus board.\n" - "\n" - "Changes from v1:\n" - "- remove per-board platform.c file\n" - "- add an override function to pass custom eth0 platform_data PHY settings\n" - "\n" - "Signed-off-by: Florian Fainelli <florian@openwrt.org>\n" - "---\n" - "diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c\n" - "index 117f99f..559294a 100644\n" - "--- a/arch/mips/alchemy/common/platform.c\n" - "+++ b/arch/mips/alchemy/common/platform.c\n" - "@@ -19,6 +19,7 @@\n" - " #include <asm/mach-au1x00/au1xxx.h>\n" - " #include <asm/mach-au1x00/au1xxx_dbdma.h>\n" - " #include <asm/mach-au1x00/au1100_mmc.h>\n" - "+#include <asm/mach-au1x00/au1xxx_eth.h>\n" - " \n" - " #define PORT(_base, _irq)\t\t\t\t\\\n" - " \t{\t\t\t\t\t\t\\\n" - "@@ -331,6 +332,76 @@ static struct platform_device pbdb_smbus_device = {\n" - " };\n" - " #endif\n" - " \n" - "+/* Macro to help defining the Ethernet MAC resources */\n" - "+#define MAC_RES(_base, _enable, _irq)\t\t\t\\\n" - "+\t{\t\t\t\t\t\t\\\n" - "+\t\t.start\t= CPHYSADDR(_base),\t\t\\\n" - "+\t\t.end\t= CPHYSADDR(_base + 0xffff),\t\\\n" - "+\t\t.flags\t= IORESOURCE_MEM,\t\t\\\n" - "+\t},\t\t\t\t\t\t\\\n" - "+\t{\t\t\t\t\t\t\\\n" - "+\t\t.start\t= CPHYSADDR(_enable),\t\t\\\n" - "+\t\t.end\t= CPHYSADDR(_enable + 0x3),\t\\\n" - "+\t\t.flags\t= IORESOURCE_MEM,\t\t\\\n" - "+\t},\t\t\t\t\t\t\\\n" - "+\t{\t\t\t\t\t\t\\\n" - "+\t\t.start\t= _irq,\t\t\t\t\\\n" - "+\t\t.end\t= _irq,\t\t\t\t\\\n" - "+\t\t.flags\t= IORESOURCE_IRQ\t\t\\\n" - "+\t}\n" - "+\n" - "+static struct resource au1xxx_eth0_resources[] = {\n" - "+#if defined(CONFIG_SOC_AU1000)\n" - "+\tMAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT),\n" - "+#elif defined(CONFIG_SOC_AU1100)\n" - "+\tMAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT),\n" - "+#elif defined(CONFIG_SOC_AU1550)\n" - "+\tMAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT),\n" - "+#elif defined(CONFIG_SOC_AU1500)\n" - "+\tMAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT),\n" - "+#endif\n" - "+};\n" - "+\n" - "+static struct resource au1xxx_eth1_resources[] = {\n" - "+#if defined(CONFIG_SOC_AU1000)\n" - "+\tMAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT),\n" - "+#elif defined(CONFIG_SOC_AU1550)\n" - "+\tMAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT),\n" - "+#elif defined(CONFIG_SOC_AU1500)\n" - "+\tMAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT),\n" - "+#endif\n" - "+};\n" - "+\n" - "+static struct au1000_eth_platform_data au1xxx_eth0_platform_data = {\n" - "+\t.phy1_search_mac0 = 1,\n" - "+};\n" - "+\n" - "+static struct platform_device au1xxx_eth0_device = {\n" - "+\t.name\t\t= \"au1000-eth\",\n" - "+\t.id\t\t= 0,\n" - "+\t.num_resources\t= ARRAY_SIZE(au1xxx_eth0_resources),\n" - "+\t.resource\t= au1xxx_eth0_resources,\n" - "+\t.dev.platform_data = &au1xxx_eth0_platform_data,\n" - "+};\n" - "+\n" - "+#ifndef CONFIG_SOC_AU1100\n" - "+static struct platform_device au1xxx_eth1_device = {\n" - "+\t.name\t\t= \"au1000-eth\",\n" - "+\t.id\t\t= 1,\n" - "+\t.num_resources\t= ARRAY_SIZE(au1xxx_eth1_resources),\n" - "+\t.resource\t= au1xxx_eth1_resources,\n" - "+};\n" - "+#endif\n" - "+\n" - "+void __init au1xxx_override_eth0_cfg(struct au1000_eth_platform_data *eth_data)\n" - "+{\n" - "+\tif (!eth_data)\n" - "+\t\treturn;\n" - "+\n" - "+\tmemcpy(&au1xxx_eth0_platform_data, eth_data,\n" - "+\t\tsizeof(struct au1000_eth_platform_data));\n" - "+}\n" - "+\n" - " static struct platform_device *au1xxx_platform_devices[] __initdata = {\n" - " \t&au1xx0_uart_device,\n" - " \t&au1xxx_usb_ohci_device,\n" - "@@ -351,17 +422,25 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {\n" - " #ifdef SMBUS_PSC_BASE\n" - " \t&pbdb_smbus_device,\n" - " #endif\n" - "+\t&au1xxx_eth0_device,\n" - " };\n" - " \n" - " static int __init au1xxx_platform_init(void)\n" - " {\n" - " \tunsigned int uartclk = get_au1x00_uart_baud_base() * 16;\n" - "-\tint i;\n" - "+\tint i, ni;\n" - " \n" - " \t/* Fill up uartclk. */\n" - " \tfor (i = 0; au1x00_uart_data[i].flags; i++)\n" - " \t\tau1x00_uart_data[i].uartclk = uartclk;\n" - " \n" - "+\t/* Register second MAC if enabled in pinfunc */\n" - "+#ifndef CONFIG_SOC_AU1100\n" - "+\tni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4);\n" - "+\tif (!(ni + 1))\n" - "+\t\tplatform_device_register(&au1xxx_eth1_device);\n" - "+#endif\n" - "+\n" - " \treturn platform_add_devices(au1xxx_platform_devices,\n" - " \t\t\t\t ARRAY_SIZE(au1xxx_platform_devices));\n" - " }\n" - "diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c\n" - "index de30d8e..4d2d32c 100644\n" - "--- a/arch/mips/alchemy/devboards/db1x00/board_setup.c\n" - "+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c\n" - "@@ -32,6 +32,7 @@\n" - " \n" - " #include <asm/mach-au1x00/au1000.h>\n" - " #include <asm/mach-db1x00/db1x00.h>\n" - "+#include <asm/mach-au1x00/au1xxx_eth.h>\n" - " \n" - " #include <prom.h>\n" - " \n" - "@@ -134,6 +135,22 @@ void __init board_setup(void)\n" - " \tprintk(KERN_INFO \"AMD Alchemy Au1100/Db1100 Board\\n\");\n" - " #endif\n" - " #ifdef CONFIG_MIPS_BOSPORUS\n" - "+\tstruct au1000_eth_platform_data eth0_pdata;\n" - "+\n" - "+\t/*\n" - "+\t * Micrel/Kendin 5 port switch attached to MAC0,\n" - "+\t * MAC0 is associated with PHY address 5 (== WAN port)\n" - "+\t * MAC1 is not associated with any PHY, since it's connected directly\n" - "+\t * to the switch.\n" - "+\t * no interrupts are used\n" - "+\t */\n" - "+\teth0_pdata.phy1_search_mac0 = 0;\n" - "+\teth0_pdata.phy_static_config = 1;\n" - "+\teth0_pdata.phy_addr = 5;\n" - "+\teth0_pdata.phy_busid = 0;\n" - "+\n" - "+\tau1xxx_override_eth0_cfg(ð0_pdata);\n" - "+\n" - " \tprintk(KERN_INFO \"AMD Alchemy Bosporus Board\\n\");\n" - " #endif\n" - " #ifdef CONFIG_MIPS_MIRAGE\n" - "diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h\n" - "new file mode 100644\n" - "index 0000000..876187e\n" - "--- /dev/null\n" - "+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h\n" - "@@ -0,0 +1,17 @@\n" - "+#ifndef __AU1X00_ETH_DATA_H\n" - "+#define __AU1X00_ETH_DATA_H\n" - "+\n" - "+/* Platform specific PHY configuration passed to the MAC driver */\n" - "+struct au1000_eth_platform_data {\n" - "+\tint phy_static_config;\n" - "+\tint phy_search_highest_addr;\n" - "+\tint phy1_search_mac0;\n" - "+\tint phy_addr;\n" - "+\tint phy_busid;\n" - "+\tint phy_irq;\n" - "+};\n" - "+\n" - "+void __init au1xxx_override_eth0_cfg(struct au1000_eth_platform_data *eth_data);\n" - "+\n" - "+#endif /* __AU1X00_ETH_DATA_H */\n" - "+\n" - "-- \n" - 1.6.3.rc3 + -- -95e8e9a53d4ce40228596a1ed015e01473fcb7cc2c59055e56df2761ef8aa85e +7fbb038bd69519064e623b023e523197c69e110628ce9b8507cb7c77d079aed7
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.