aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/am35xx-emac.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 16:01:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-23 16:01:01 -0700
commitb85c14fb833e6da127188aa61b0a2aec8111bf59 (patch)
tree059a0f91819a8e4f6dc26d75b6ee6e42d29e4fbe /arch/arm/mach-omap2/am35xx-emac.c
parentMerge tag 'upstream-3.6-rc1' of git://git.infradead.org/linux-ubi (diff)
parentMerge tag 'ep93xx-fixes-for-3.6' of git://github.com/RyanMallon/linux-ep93xx into next/fixes-non-critical (diff)
downloadlinux-dev-b85c14fb833e6da127188aa61b0a2aec8111bf59.tar.xz
linux-dev-b85c14fb833e6da127188aa61b0a2aec8111bf59.zip
Merge tag 'fixes-non-critical' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull non-critical arm-soc bug fixes from Arnd Bergmann: "These were submitted as bug fixes before v3.5 but not considered important enough to be included in it." * tag 'fixes-non-critical' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (29 commits) ARM:vt8500: Convert to use .restart and remove arch_reset() ARM: davinci: da8xx: fix interrupt handling ARM: OMAP2+: fix CONFIG_CPU_IDLE dependency on CONFIG_PM ARM: mxs/tx28: fix odd include ARM: OMAP: remove unused cpu detection macros ARM: OMAP: fix typos related to OMAP330 ARM: OMAP7XX: Remove omap730.h and omap850.h ARM: OMAP2+: fix naming collision of variable nr_irqs ARM: OMAP: omap2plus_defconfig: Enable EXT4 support ARM: OMAP depends on MMU arm: omap3: am35x: Set proper powerdomain states ARM: OMAP AM35x: clockdomain data: Fix clockdomain dependencies ARM: OMAP AM35x: EMAC/MDIO integration: Add Davinci EMAC/MDIO hwmod support ARM: OMAP: AM35xx: fix UART4 softreset ARM: OMAP AM35xx: clock and hwmod data: fix UART4 data ARM: OMAP AM35xx: clock and hwmod data: fix AM35xx HSOTGUSB hwmod ARM: OMAP: Fix dts files w/ status property: "disable" -> "disabled" ARM: OMAP: beagle: Set USB Host Port 1 to OMAP_USBHS_PORT_MODE_UNUSED ARM: OMAP2: twl-common: Fix compiler warning ARM: OMAP: fix the ads7846 init code ...
Diffstat (limited to 'arch/arm/mach-omap2/am35xx-emac.c')
-rw-r--r--arch/arm/mach-omap2/am35xx-emac.c90
1 files changed, 46 insertions, 44 deletions
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c
index 447682c4e11c..2c90ac686686 100644
--- a/arch/arm/mach-omap2/am35xx-emac.c
+++ b/arch/arm/mach-omap2/am35xx-emac.c
@@ -15,27 +15,13 @@
* General Public License for more details.
*/
-#include <linux/clk.h>
+#include <linux/err.h>
#include <linux/davinci_emac.h>
-#include <linux/platform_device.h>
-#include <plat/irqs.h>
+#include <asm/system.h>
+#include <plat/omap_device.h>
#include <mach/am35xx.h>
-
#include "control.h"
-
-static struct mdio_platform_data am35xx_emac_mdio_pdata;
-
-static struct resource am35xx_emac_mdio_resources[] = {
- DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET, SZ_4K),
-};
-
-static struct platform_device am35xx_emac_mdio_device = {
- .name = "davinci_mdio",
- .id = 0,
- .num_resources = ARRAY_SIZE(am35xx_emac_mdio_resources),
- .resource = am35xx_emac_mdio_resources,
- .dev.platform_data = &am35xx_emac_mdio_pdata,
-};
+#include "am35xx-emac.h"
static void am35xx_enable_emac_int(void)
{
@@ -69,41 +55,57 @@ static struct emac_platform_data am35xx_emac_pdata = {
.interrupt_disable = am35xx_disable_emac_int,
};
-static struct resource am35xx_emac_resources[] = {
- DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE, 0x30000),
- DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RXTHRESH_IRQ),
- DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RX_PULSE_IRQ),
- DEFINE_RES_IRQ(INT_35XX_EMAC_C0_TX_PULSE_IRQ),
- DEFINE_RES_IRQ(INT_35XX_EMAC_C0_MISC_PULSE_IRQ),
-};
+static struct mdio_platform_data am35xx_mdio_pdata;
-static struct platform_device am35xx_emac_device = {
- .name = "davinci_emac",
- .id = -1,
- .num_resources = ARRAY_SIZE(am35xx_emac_resources),
- .resource = am35xx_emac_resources,
- .dev = {
- .platform_data = &am35xx_emac_pdata,
- },
-};
+static int __init omap_davinci_emac_dev_init(struct omap_hwmod *oh,
+ void *pdata, int pdata_len)
+{
+ struct platform_device *pdev;
+
+ pdev = omap_device_build(oh->class->name, 0, oh, pdata, pdata_len,
+ NULL, 0, false);
+ if (IS_ERR(pdev)) {
+ WARN(1, "Can't build omap_device for %s:%s.\n",
+ oh->class->name, oh->name);
+ return PTR_ERR(pdev);
+ }
+
+ return 0;
+}
void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en)
{
+ struct omap_hwmod *oh;
u32 v;
- int err;
+ int ret;
- am35xx_emac_pdata.rmii_en = rmii_en;
- am35xx_emac_mdio_pdata.bus_freq = mdio_bus_freq;
- err = platform_device_register(&am35xx_emac_device);
- if (err) {
- pr_err("AM35x: failed registering EMAC device: %d\n", err);
+ oh = omap_hwmod_lookup("davinci_mdio");
+ if (!oh) {
+ pr_err("Could not find davinci_mdio hwmod\n");
+ return;
+ }
+
+ am35xx_mdio_pdata.bus_freq = mdio_bus_freq;
+
+ ret = omap_davinci_emac_dev_init(oh, &am35xx_mdio_pdata,
+ sizeof(am35xx_mdio_pdata));
+ if (ret) {
+ pr_err("Could not build davinci_mdio hwmod device\n");
return;
}
- err = platform_device_register(&am35xx_emac_mdio_device);
- if (err) {
- pr_err("AM35x: failed registering EMAC MDIO device: %d\n", err);
- platform_device_unregister(&am35xx_emac_device);
+ oh = omap_hwmod_lookup("davinci_emac");
+ if (!oh) {
+ pr_err("Could not find davinci_emac hwmod\n");
+ return;
+ }
+
+ am35xx_emac_pdata.rmii_en = rmii_en;
+
+ ret = omap_davinci_emac_dev_init(oh, &am35xx_emac_pdata,
+ sizeof(am35xx_emac_pdata));
+ if (ret) {
+ pr_err("Could not build davinci_emac hwmod device\n");
return;
}