arm: am33xx: Add CPSW MII mac select support
authorChandan Nath <chandan.nath@ti.com>
Wed, 11 Jan 2012 12:05:47 +0000 (17:35 +0530)
committerVaibhav Hiremath <hvaibhav@ti.com>
Mon, 23 Jan 2012 19:14:47 +0000 (00:44 +0530)
This patch fixes missing configuration for MII interface
configuration in device control register. MII mode selection
should be done depending up on the board/phy type.
This was missing in linux, however without this also it was
working as it was configured in uboot. This is required in
linux also in order to remove any dependency on uboot.

Signed-off-by: Chandan Nath <chandan.nath@ti.com>
arch/arm/mach-omap2/board-am335xevm.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/include/mach/board-am335xevm.h

index f8b93e0d2387fa0003342efde4f01497466b91d1..5c47764931bd68f03e5c7556e3eab683ccbee697 100644 (file)
@@ -1545,6 +1545,9 @@ static void setup_beaglebone_old(void)
 
        phy_register_fixup_for_uid(BBB_PHY_ID, BBB_PHY_MASK,
                                        beaglebone_phy_fixup);
+
+       /* Fill up global evmid */
+       am33xx_evmid_fillup(BEAGLE_BONE_OLD);
 }
 
 /* BeagleBone after Rev A3 */
@@ -1556,6 +1559,9 @@ static void setup_beaglebone(void)
        am335x_mmc[0].gpio_wp = -EINVAL;
 
        _configure_device(LOW_COST_EVM, beaglebone_dev_cfg, PROFILE_NONE);
+
+       /* Fill up global evmid */
+       am33xx_evmid_fillup(BEAGLE_BONE_A3);
 }
 
 
index e896e7b3885e9812e700af863dfb53757b734929..bf5d54c44fda7f1fb1aa74b23d74a1c0b91ba739 100644 (file)
@@ -1314,6 +1314,11 @@ void am33xx_cpsw_macidfillup(char *eeprommacid0, char *eeprommacid1)
        return;
 }
 
+#define MII_MODE_ENABLE                0x0
+#define RMII_MODE_ENABLE       0x5
+#define RGMII_MODE_ENABLE      0xA
+#define MAC_MII_SEL            0x650
+
 void am33xx_cpsw_init(unsigned int gigen)
 {
        u32 mac_lo, mac_hi;
@@ -1349,9 +1354,18 @@ void am33xx_cpsw_init(unsigned int gigen)
                        am33xx_cpsw_slaves[1].mac_addr[i] = am33xx_macid1[i];
        }
 
-       if (am33xx_evmid == IND_AUT_MTR_EVM) {
+       if (am33xx_evmid == BEAGLE_BONE_OLD) {
+               __raw_writel(RMII_MODE_ENABLE,
+                               AM33XX_CTRL_REGADDR(MAC_MII_SEL));
+       } else if (am33xx_evmid == BEAGLE_BONE_A3) {
+               __raw_writel(MII_MODE_ENABLE,
+                               AM33XX_CTRL_REGADDR(MAC_MII_SEL));
+       } else if (am33xx_evmid == IND_AUT_MTR_EVM) {
                am33xx_cpsw_slaves[0].phy_id = "0:1e";
                am33xx_cpsw_slaves[1].phy_id = "0:00";
+       } else {
+               __raw_writel(RGMII_MODE_ENABLE,
+                               AM33XX_CTRL_REGADDR(MAC_MII_SEL));
        }
 
        am33xx_cpsw_pdata.gigabit_en = gigen;
index 521b872c677b882965a4aa11826d3493eddff483..a8fe93a223d01cf9d13b0d6549f1d57b64319406 100644 (file)
@@ -23,7 +23,9 @@
 #define LOW_COST_EVM           0
 #define GEN_PURP_EVM           1
 #define IND_AUT_MTR_EVM                2
-#define IP_PHN_EVM                     3
+#define IP_PHN_EVM             3
+#define BEAGLE_BONE_OLD                4
+#define BEAGLE_BONE_A3         5
 
 /* REVIST : check posibility of PROFILE_(x) syntax usage */
 #define PROFILE_NONE   -1      /* Few EVM doesn't have profiles */