From patchwork Thu Mar 11 14:24:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sriram X-Patchwork-Id: 84899 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2BERGEo017235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Mar 2010 14:27:52 GMT Received: from dlep34.itg.ti.com ([157.170.170.115]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id o2BEOxBC008290 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 11 Mar 2010 08:24:59 -0600 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id o2BEOxpC008792; Thu, 11 Mar 2010 08:24:59 -0600 (CST) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id B5E068062B; Thu, 11 Mar 2010 08:24:58 -0600 (CST) 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 08D0D80627 for ; Thu, 11 Mar 2010 08:24:55 -0600 (CST) 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 o2BEOpP0022550; Thu, 11 Mar 2010 19:54:52 +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 o2BEOp8M003955; Thu, 11 Mar 2010 19:54:51 +0530 Received: (from a0875517@localhost) by psplinux051.india.ti.com (8.13.1/8.13.1/Submit) id o2BEOpT4003951; Thu, 11 Mar 2010 19:54:51 +0530 From: Sriramakrishnan To: netdev@vger.kernel.org, davinci-linux-open-source@linux.davincidsp.com Subject: [PATCH 2/2] davinci: introduce EMAC PHY clock usage Date: Thu, 11 Mar 2010 19:54:51 +0530 Message-Id: <1268317491-3822-3-git-send-email-srk@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1268317491-3822-2-git-send-email-srk@ti.com> References: <1268317491-3822-1-git-send-email-srk@ti.com> <1268317491-3822-2-git-send-email-srk@ti.com> X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com X-Greylist: Sender succeeded STARTTLS authentication, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 11 Mar 2010 14:27:52 +0000 (UTC) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index dc19870..54e8567 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -20,9 +20,11 @@ #include #include #include +#include #include #include +#include #include #include @@ -30,6 +32,8 @@ #include #include +#include "clock.h" + #define DA830_EVM_PHY_MASK 0x0 #define DA830_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ @@ -557,9 +561,24 @@ static __init void da830_evm_irq_init(void) soc_info->intc_irq_prios); } +#define EMAC_PHY_CLK_RATE 50000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init da830_evm_map_io(void) { da830_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137 EVM") diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 411284d..c43ae45 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -32,6 +33,9 @@ #include #include #include +#include + +#include "clock.h" #define DA850_EVM_PHY_MASK 0x1 #define DA850_EVM_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ @@ -551,6 +555,18 @@ static const short da850_evm_lcdc_pins[] = { -1 }; +#define EMAC_MII_PHY_CLK_RATE 25000000 +#define EMAC_RMII_PHY_CLK_RATE 50000000 + +static struct clk emac_phy = { + .name = "emac_phy", +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static int __init da850_evm_config_emac(void) { void __iomem *cfg_chip3_base; @@ -571,17 +587,22 @@ static int __init da850_evm_config_emac(void) ret = da8xx_pinmux_setup(da850_rmii_pins); pr_info("EMAC: RMII PHY configured, MII PHY will not be" " functional\n"); + emac_phy.rate = EMAC_RMII_PHY_CLK_RATE; } else { val &= ~BIT(8); ret = da8xx_pinmux_setup(da850_cpgmac_pins); pr_info("EMAC: MII PHY configured, RMII PHY will not be" " functional\n"); + emac_phy.rate = EMAC_MII_PHY_CLK_RATE; } if (ret) pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n", ret); + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); + /* configure the CFGCHIP3 register for RMII or MII */ __raw_writel(val, cfg_chip3_base); diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index d15bece..c36e034 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -38,9 +38,12 @@ #include #include #include +#include #include +#include "clock.h" + static inline int have_imager(void) { /* REVISIT when it's supported, trigger via Kconfig */ @@ -566,11 +569,26 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +#define EMAC_PHY_CLK_RATE 25000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init dm365_evm_map_io(void) { /* setup input configuration for VPFE input devices */ dm365_set_vpfe_config(&vpfe_cfg); dm365_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } static struct spi_eeprom at25640 = { diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index 976e11b..ba90181 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -37,6 +37,9 @@ #include #include #include +#include + +#include "clock.h" #define DM644X_EVM_PHY_MASK (0x2) #define DM644X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ @@ -649,12 +652,27 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +#define EMAC_PHY_CLK_RATE 25000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init davinci_evm_map_io(void) { /* setup input configuration for VPFE input devices */ dm644x_set_vpfe_config(&vpfe_cfg); dm644x_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } static int davinci_phy_fixup(struct phy_device *phydev) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 5ba3cb2..6241893 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -711,10 +711,25 @@ static void __init cdce_clk_init(void) } } +#define EMAC_PHY_CLK_RATE 25000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init davinci_map_io(void) { dm646x_init(); cdce_clk_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } static struct davinci_uart_config uart_config __initdata = { diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c index bd9ca07..075962c 100644 --- a/arch/arm/mach-davinci/board-neuros-osd2.c +++ b/arch/arm/mach-davinci/board-neuros-osd2.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,9 @@ #include #include #include +#include + +#include "clock.h" #define NEUROS_OSD2_PHY_MASK 0x2 #define NEUROS_OSD2_MDIO_FREQUENCY 2200000 /* PHY bus frequency */ @@ -188,9 +192,24 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +#define EMAC_PHY_CLK_RATE 25000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init davinci_ntosd2_map_io(void) { dm644x_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } /* diff --git a/arch/arm/mach-davinci/board-sffsdr.c b/arch/arm/mach-davinci/board-sffsdr.c index 08d373b..7faa6cf 100644 --- a/arch/arm/mach-davinci/board-sffsdr.c +++ b/arch/arm/mach-davinci/board-sffsdr.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,9 @@ #include #include #include +#include + +#include "clock.h" #define SFFSDR_PHY_MASK (0x2) #define SFFSDR_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ @@ -133,9 +137,24 @@ static struct davinci_uart_config uart_config __initdata = { .enabled_uarts = (1 << 0), }; +#define EMAC_PHY_CLK_RATE 25000000 + +static struct clk emac_phy = { + .name = "emac_phy", + .rate = EMAC_PHY_CLK_RATE, +}; + +static struct clk_lookup emac_phy_clks[] = { + CLK("davinci_emac.1", "phy_clk", &emac_phy), + CLK(NULL, NULL, NULL), +}; + static void __init davinci_sffsdr_map_io(void) { dm644x_init(); + + clkdev_add(emac_phy_clks); + clk_register(&emac_phy); } static __init void davinci_sffsdr_init(void) diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 122e61a..31903e2 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -414,7 +414,7 @@ static struct clk_lookup da830_clks[] = { CLK(NULL, "aemif", &aemif_clk), CLK(NULL, "aintc", &aintc_clk), CLK(NULL, "secu_mgr", &secu_mgr_clk), - CLK("davinci_emac.1", NULL, &emac_clk), + CLK("davinci_emac.1", "emac_clk", &emac_clk), CLK(NULL, "gpio", &gpio_clk), CLK("i2c_davinci.2", NULL, &i2c1_clk), CLK(NULL, "usb11", &usb11_clk), diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index d0fd756..4fd92d9 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -371,7 +371,7 @@ static struct clk_lookup da850_clks[] = { CLK(NULL, "emif3", &emif3_clk), CLK(NULL, "arm", &arm_clk), CLK(NULL, "rmii", &rmii_clk), - CLK("davinci_emac.1", NULL, &emac_clk), + CLK("davinci_emac.1", "emac_clk", &emac_clk), CLK("davinci-mcasp.0", NULL, &mcasp_clk), CLK("da8xx_lcdc.0", NULL, &lcdc_clk), CLK("davinci_mmc.0", NULL, &mmcsd_clk), diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 27772e1..71f773c 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -457,7 +457,7 @@ static struct clk_lookup dm365_clks[] = { CLK("watchdog", NULL, &timer2_clk), CLK(NULL, "timer3", &timer3_clk), CLK(NULL, "usb", &usb_clk), - CLK("davinci_emac.1", NULL, &emac_clk), + CLK("davinci_emac.1", "emac_clk", &emac_clk), CLK("davinci_voicecodec", NULL, &voicecodec_clk), CLK("davinci-asp.0", NULL, &asp0_clk), CLK(NULL, "rto", &rto_clk), diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 2f2ae8b..70948d4 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -299,7 +299,7 @@ struct clk_lookup dm644x_clks[] = { CLK(NULL, "uart0", &uart0_clk), CLK(NULL, "uart1", &uart1_clk), CLK(NULL, "uart2", &uart2_clk), - CLK("davinci_emac.1", NULL, &emac_clk), + CLK("davinci_emac.1", "emac_clk", &emac_clk), CLK("i2c_davinci.1", NULL, &i2c_clk), CLK("palm_bk3710", NULL, &ide_clk), CLK("davinci-asp", NULL, &asp_clk), diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 893baf4..464cebc 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -342,7 +342,7 @@ struct clk_lookup dm646x_clks[] = { CLK("davinci-mcasp.0", NULL, &mcasp0_clk), CLK("davinci-mcasp.1", NULL, &mcasp1_clk), CLK(NULL, "aemif", &aemif_clk), - CLK("davinci_emac.1", NULL, &emac_clk), + CLK("davinci_emac.1", "emac_clk", &emac_clk), CLK(NULL, "pwm0", &pwm0_clk), CLK(NULL, "pwm1", &pwm1_clk), CLK(NULL, "timer0", &timer0_clk),