aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorChaithrika U S <chaithrika@ti.com>2009-09-30 17:00:53 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-25 13:21:30 -0500
commit2206771c4359e236308122ad3fed7f5d91586fd7 (patch)
tree8eb60320325d81abc989770578edf59b7e50540b /arch
parent75e2ea643fe43d5aa836475acee5bd97cd9ea4bf (diff)
davinci: RMII support for DA850/OMAP-L138 EVM
DA850/OMAP-L138 EVM has a RMII Ethernet PHY on the UI daughter card. The PHY is enabled by proper programming of the IO Expander (TCA6416) ports. Also for RMII PHY to work, the MDIO clock of MII PHY has to be disabled since both the PHYs have the same address. This is done via the GPIO2[6] pin. This patch adds support for RMII PHY. This patch also adds a menuconfig option to select one or no peripheral connected to expander. Currently, sub-options in this menu are RMII and no peripheral.This menuconfig option is similar to the one present for UI card on DA830/OMAP-L137 EVM. Signed-off-by: Chaithrika U S <chaithrika@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-davinci/Kconfig31
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c68
-rw-r--r--arch/arm/mach-davinci/da850.c17
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h1
-rw-r--r--arch/arm/mach-davinci/include/mach/mux.h9
5 files changed, 123 insertions, 3 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index 84b7c17e5677..330eea0a713f 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -130,6 +130,37 @@ config MACH_DAVINCI_DA850_EVM
130 help 130 help
131 Say Y here to select the TI DA850/OMAP-L138 Evaluation Module. 131 Say Y here to select the TI DA850/OMAP-L138 Evaluation Module.
132 132
133config DA850_UI_EXP
134 bool "DA850/OMAP-L138 UI (User Interface) board expander configuration"
135 depends on MACH_DAVINCI_DA850_EVM
136 select GPIO_PCA953X
137 help
138 Say Y here if you have the DA850/OMAP-L138 UI
139 (User Interface) board installed and you want to
140 enable the peripherals located on User Interface
141 board contorlled by TCA6416 expander.
142
143choice
144 prompt "Select peripherals connected to expander on UI board"
145 depends on DA850_UI_EXP
146
147config DA850_UI_NONE
148 bool "No peripheral is enabled"
149 help
150 Say Y if you do not want to enable any of the peripherals connected
151 to TCA6416 expander on DA850/OMAP-L138 EVM UI card
152
153config DA850_UI_RMII
154 bool "RMII Ethernet PHY"
155 help
156 Say Y if you want to use the RMII PHY on the DA850/OMAP-L138 EVM.
157 This PHY is found on the UI daughter card that is supplied with
158 the EVM.
159 NOTE: Please take care while choosing this option, MII PHY will
160 not be functional if RMII mode is selected.
161
162endchoice
163
133config DAVINCI_MUX 164config DAVINCI_MUX
134 bool "DAVINCI multiplexing support" 165 bool "DAVINCI multiplexing support"
135 depends on ARCH_DAVINCI 166 depends on ARCH_DAVINCI
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 05b2d87d96bd..53e434ba626d 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -45,6 +45,8 @@
45#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) 45#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
46#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) 46#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
47 47
48#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
49
48static struct mtd_partition da850_evm_norflash_partition[] = { 50static struct mtd_partition da850_evm_norflash_partition[] = {
49 { 51 {
50 .name = "NOR filesystem", 52 .name = "NOR filesystem",
@@ -152,6 +154,7 @@ static void da850_evm_setup_nor_nand(void);
152static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio, 154static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
153 unsigned ngpio, void *c) 155 unsigned ngpio, void *c)
154{ 156{
157 struct davinci_soc_info *soc_info = &davinci_soc_info;
155 int sel_a, sel_b, sel_c, ret; 158 int sel_a, sel_b, sel_c, ret;
156 159
157 sel_a = gpio + 7; 160 sel_a = gpio + 7;
@@ -186,6 +189,10 @@ static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
186 189
187 da850_evm_setup_nor_nand(); 190 da850_evm_setup_nor_nand();
188 191
192 if (soc_info->emac_pdata->rmii_en)
193 /* enable RMII */
194 gpio_set_value(sel_a, 0);
195
189 return 0; 196 return 0;
190 197
191exp_setup_selc_fail: 198exp_setup_selc_fail:
@@ -509,6 +516,58 @@ static const short da850_evm_lcdc_pins[] = {
509 -1 516 -1
510}; 517};
511 518
519static int __init da850_evm_config_emac(u8 rmii_en)
520{
521 void __iomem *cfg_chip3_base;
522 int ret;
523 u32 val;
524
525 cfg_chip3_base = DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG);
526
527 /* configure the CFGCHIP3 register for RMII or MII */
528 val = __raw_readl(cfg_chip3_base);
529 if (rmii_en)
530 val |= BIT(8);
531 else
532 val &= ~BIT(8);
533
534 __raw_writel(val, cfg_chip3_base);
535
536 if (!rmii_en)
537 ret = da8xx_pinmux_setup(da850_cpgmac_pins);
538 else
539 ret = da8xx_pinmux_setup(da850_rmii_pins);
540 if (ret)
541 pr_warning("da850_evm_init: cpgmac/rmii mux setup failed: %d\n",
542 ret);
543
544 ret = davinci_cfg_reg(DA850_GPIO2_6);
545 if (ret)
546 pr_warning("da850_evm_init:GPIO(2,6) mux setup "
547 "failed\n");
548
549 ret = gpio_request(DA850_MII_MDIO_CLKEN_PIN, "mdio_clk_en");
550 if (ret) {
551 pr_warning("Cannot open GPIO %d\n",
552 DA850_MII_MDIO_CLKEN_PIN);
553 return ret;
554 }
555
556 if (rmii_en) {
557 /* Disable MII MDIO clock */
558 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 1);
559 pr_info("EMAC: RMII PHY configured, MII PHY will not be"
560 " functional\n");
561 } else {
562 /* Enable MII MDIO clock */
563 gpio_direction_output(DA850_MII_MDIO_CLKEN_PIN, 0);
564 pr_info("EMAC: MII PHY configured, RMII PHY will not be"
565 " functional\n");
566 }
567
568 return 0;
569}
570
512static __init void da850_evm_init(void) 571static __init void da850_evm_init(void)
513{ 572{
514 struct davinci_soc_info *soc_info = &davinci_soc_info; 573 struct davinci_soc_info *soc_info = &davinci_soc_info;
@@ -536,12 +595,15 @@ static __init void da850_evm_init(void)
536 595
537 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK; 596 soc_info->emac_pdata->phy_mask = DA850_EVM_PHY_MASK;
538 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY; 597 soc_info->emac_pdata->mdio_max_freq = DA850_EVM_MDIO_FREQUENCY;
598#ifdef CONFIG_DA850_UI_RMII
599 soc_info->emac_pdata->rmii_en = 1;
600#else
539 soc_info->emac_pdata->rmii_en = 0; 601 soc_info->emac_pdata->rmii_en = 0;
602#endif
540 603
541 ret = da8xx_pinmux_setup(da850_cpgmac_pins); 604 ret = da850_evm_config_emac(soc_info->emac_pdata->rmii_en);
542 if (ret) 605 if (ret)
543 pr_warning("da850_evm_init: cpgmac mux setup failed: %d\n", 606 pr_warning("da850_evm_init: emac setup failed: %d\n", ret);
544 ret);
545 607
546 ret = da8xx_register_emac(); 608 ret = da8xx_register_emac();
547 if (ret) 609 if (ret)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 1d6d8b42a624..b804d5792346 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -422,6 +422,14 @@ static const struct mux_config da850_pins[] = {
422 MUX_CFG(DA850, MII_RXD_0, 3, 28, 15, 8, false) 422 MUX_CFG(DA850, MII_RXD_0, 3, 28, 15, 8, false)
423 MUX_CFG(DA850, MDIO_CLK, 4, 0, 15, 8, false) 423 MUX_CFG(DA850, MDIO_CLK, 4, 0, 15, 8, false)
424 MUX_CFG(DA850, MDIO_D, 4, 4, 15, 8, false) 424 MUX_CFG(DA850, MDIO_D, 4, 4, 15, 8, false)
425 MUX_CFG(DA850, RMII_TXD_0, 14, 12, 15, 8, false)
426 MUX_CFG(DA850, RMII_TXD_1, 14, 8, 15, 8, false)
427 MUX_CFG(DA850, RMII_TXEN, 14, 16, 15, 8, false)
428 MUX_CFG(DA850, RMII_CRS_DV, 15, 4, 15, 8, false)
429 MUX_CFG(DA850, RMII_RXD_0, 14, 24, 15, 8, false)
430 MUX_CFG(DA850, RMII_RXD_1, 14, 20, 15, 8, false)
431 MUX_CFG(DA850, RMII_RXER, 14, 28, 15, 8, false)
432 MUX_CFG(DA850, RMII_MHZ_50_CLK, 15, 0, 15, 0, false)
425 /* McASP function */ 433 /* McASP function */
426 MUX_CFG(DA850, ACLKR, 0, 0, 15, 1, false) 434 MUX_CFG(DA850, ACLKR, 0, 0, 15, 1, false)
427 MUX_CFG(DA850, ACLKX, 0, 4, 15, 1, false) 435 MUX_CFG(DA850, ACLKX, 0, 4, 15, 1, false)
@@ -524,6 +532,7 @@ static const struct mux_config da850_pins[] = {
524 MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false) 532 MUX_CFG(DA850, EMA_WAIT_1, 6, 24, 15, 1, false)
525 MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false) 533 MUX_CFG(DA850, NEMA_CS_2, 7, 0, 15, 1, false)
526 /* GPIO function */ 534 /* GPIO function */
535 MUX_CFG(DA850, GPIO2_6, 6, 4, 15, 8, false)
527 MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false) 536 MUX_CFG(DA850, GPIO2_8, 5, 28, 15, 8, false)
528 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) 537 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false)
529 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false) 538 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false)
@@ -565,6 +574,14 @@ const short da850_cpgmac_pins[] __initdata = {
565 -1 574 -1
566}; 575};
567 576
577const short da850_rmii_pins[] __initdata = {
578 DA850_RMII_TXD_0, DA850_RMII_TXD_1, DA850_RMII_TXEN,
579 DA850_RMII_CRS_DV, DA850_RMII_RXD_0, DA850_RMII_RXD_1,
580 DA850_RMII_RXER, DA850_RMII_MHZ_50_CLK, DA850_MDIO_CLK,
581 DA850_MDIO_D,
582 -1
583};
584
568const short da850_mcasp_pins[] __initdata = { 585const short da850_mcasp_pins[] __initdata = {
569 DA850_AHCLKX, DA850_ACLKX, DA850_AFSX, 586 DA850_AHCLKX, DA850_ACLKX, DA850_AFSX,
570 DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE, 587 DA850_AHCLKR, DA850_ACLKR, DA850_AFSR, DA850_AMUTE,
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index 401bf93fd32f..b4cf8b146e8e 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -124,6 +124,7 @@ extern const short da850_uart2_pins[];
124extern const short da850_i2c0_pins[]; 124extern const short da850_i2c0_pins[];
125extern const short da850_i2c1_pins[]; 125extern const short da850_i2c1_pins[];
126extern const short da850_cpgmac_pins[]; 126extern const short da850_cpgmac_pins[];
127extern const short da850_rmii_pins[];
127extern const short da850_mcasp_pins[]; 128extern const short da850_mcasp_pins[];
128extern const short da850_lcdcntl_pins[]; 129extern const short da850_lcdcntl_pins[];
129extern const short da850_mmcsd0_pins[]; 130extern const short da850_mmcsd0_pins[];
diff --git a/arch/arm/mach-davinci/include/mach/mux.h b/arch/arm/mach-davinci/include/mach/mux.h
index b2c1ad035ce2..16b8a7fc39bd 100644
--- a/arch/arm/mach-davinci/include/mach/mux.h
+++ b/arch/arm/mach-davinci/include/mach/mux.h
@@ -774,6 +774,14 @@ enum davinci_da850_index {
774 DA850_MII_RXD_0, 774 DA850_MII_RXD_0,
775 DA850_MDIO_CLK, 775 DA850_MDIO_CLK,
776 DA850_MDIO_D, 776 DA850_MDIO_D,
777 DA850_RMII_TXD_0,
778 DA850_RMII_TXD_1,
779 DA850_RMII_TXEN,
780 DA850_RMII_CRS_DV,
781 DA850_RMII_RXD_0,
782 DA850_RMII_RXD_1,
783 DA850_RMII_RXER,
784 DA850_RMII_MHZ_50_CLK,
777 785
778 /* McASP function */ 786 /* McASP function */
779 DA850_ACLKR, 787 DA850_ACLKR,
@@ -881,6 +889,7 @@ enum davinci_da850_index {
881 DA850_NEMA_CS_2, 889 DA850_NEMA_CS_2,
882 890
883 /* GPIO function */ 891 /* GPIO function */
892 DA850_GPIO2_6,
884 DA850_GPIO2_8, 893 DA850_GPIO2_8,
885 DA850_GPIO2_15, 894 DA850_GPIO2_15,
886 DA850_GPIO4_0, 895 DA850_GPIO4_0,