From patchwork Wed Oct 21 15:48:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 55139 Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9LFqu8P031260 for ; Wed, 21 Oct 2009 15:52:56 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9LFmTwj010919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 21 Oct 2009 10:48:30 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n9LFmSl7006418; Wed, 21 Oct 2009 10:48:29 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id C23A980627; Wed, 21 Oct 2009 10:48:28 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp31.itg.ti.com (dbdp31.itg.ti.com [172.24.170.98]) by linux.omap.com (Postfix) with ESMTP id 2256580626 for ; Wed, 21 Oct 2009 10:48:27 -0500 (CDT) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id n9LFmO6a027401; Wed, 21 Oct 2009 21:18:25 +0530 (IST) Received: from psplinux051.india.ti.com (localhost [127.0.0.1]) by psplinux051.india.ti.com (8.13.1/8.13.1) with ESMTP id n9LFmO9P015713; Wed, 21 Oct 2009 21:18:24 +0530 Received: (from a0875516@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id n9LFmO0c015710; Wed, 21 Oct 2009 21:18:24 +0530 From: Sekhar Nori To: davinci-linux-open-source@linux.davincidsp.com Date: Wed, 21 Oct 2009 21:18:22 +0530 Message-Id: <1256140104-15606-3-git-send-email-nsekhar@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1256140104-15606-2-git-send-email-nsekhar@ti.com> References: <1256140104-15606-1-git-send-email-nsekhar@ti.com> <1256140104-15606-2-git-send-email-nsekhar@ti.com> Cc: Subject: [PATCH 3/5] davinci: DA850/OMAP-L138 EVM: implement autodetect of RMII PHY X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 23e2024..fd6f780 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -148,10 +148,21 @@ static struct platform_device da850_evm_nandflash_device = { static u32 ui_card_detected; static void da850_evm_setup_nor_nand(void); +#ifdef CONFIG_DA850_UI_RMII +static inline void da850_evm_setup_emac_rmii(int rmii_sel) +{ + struct davinci_soc_info *soc_info = &davinci_soc_info; + + soc_info->emac_pdata->rmii_en = 1; + gpio_set_value(rmii_sel, 0); +} +#else +static inline void da850_evm_setup_emac_rmii(int rmii_sel) { } +#endif + static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, unsigned ngpio, void *c) { - struct davinci_soc_info *soc_info = &davinci_soc_info; int sel_a, sel_b, sel_c, ret; sel_a = gpio + 7; @@ -186,9 +197,7 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, da850_evm_setup_nor_nand(); - if (soc_info->emac_pdata->rmii_en) - /* enable RMII */ - gpio_set_value(sel_a, 0); + da850_evm_setup_emac_rmii(sel_a); return 0; @@ -513,11 +522,16 @@ static const short da850_evm_lcdc_pins[] = { -1 }; -static int __init da850_evm_config_emac(u8 rmii_en) +static int __init da850_evm_config_emac(void) { void __iomem *cfg_chip3_base; int ret; u32 val; + struct davinci_soc_info *soc_info = &davinci_soc_info; + u8 rmii_en = soc_info->emac_pdata->rmii_en; + + if (!machine_is_davinci_da850_evm()) + return 0; cfg_chip3_base = DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG); @@ -562,12 +576,20 @@ static int __init da850_evm_config_emac(u8 rmii_en) " functional\n"); } + soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; + soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY; + + ret = da8xx_register_emac(); + if (ret) + pr_warning("da850_evm_init: emac registration failed: %d\n", + ret); + return 0; } +device_initcall(da850_evm_config_emac); static __init void da850_evm_init(void) { - struct davinci_soc_info *soc_info = &davinci_soc_info; int ret; ret = pmic_tps65070_init(); @@ -590,22 +612,6 @@ static __init void da850_evm_init(void) pr_warning("da850_evm_init: i2c0 registration failed: %d\n", ret); - soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; - soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY; -#ifdef CONFIG_DA850_UI_RMII - soc_info->emac_pdata->rmii_en = 1; -#else - soc_info->emac_pdata->rmii_en = 0; -#endif - - ret = da850_evm_config_emac(soc_info->emac_pdata->rmii_en); - if (ret) - pr_warning("da850_evm_init: emac setup failed: %d\n", ret); - - ret = da8xx_register_emac(); - if (ret) - pr_warning("da850_evm_init: emac registration failed: %d\n", - ret); ret = da8xx_register_watchdog(); if (ret)