net/fman: add a fm_enable_port function
authorValentin Longchamp <valentin.longchamp@keymile.com>
Fri, 18 Oct 2013 09:47:21 +0000 (11:47 +0200)
committerYork Sun <yorksun@freescale.com>
Thu, 24 Oct 2013 16:35:59 +0000 (09:35 -0700)
This can be useful if one wants to disable an interface in u-boot
because u-boot should not manage it but then later reenable it for FDT
fixing or if the kernel uses this interface.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
[York Sun: fix conflict in fm_eth.h]
Acked-by: York Sun <yorksun@freescale.com>
drivers/net/fm/b4860.c
drivers/net/fm/fm.h
drivers/net/fm/init.c
drivers/net/fm/p1023.c
drivers/net/fm/p4080.c
drivers/net/fm/p5020.c
drivers/net/fm/p5040.c
drivers/net/fm/t4240.c
include/fm_eth.h

index 9b3d5324e0e432df5da80baaf5ad6a4a134ebadb..373cc4f4242cd28ee55512786adb139a4f807b66 100644 (file)
@@ -37,6 +37,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr2, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr2, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        if (is_device_disabled(port))
index 5f197a982958bc09ed4ff8b87b1a44ec23cc4a16..3ec49a4f3b0dd7eccfefd52eec63a87c761efd82 100644 (file)
@@ -99,6 +99,7 @@ int fm_init_common(int index, struct ccsr_fman *reg);
 int fm_eth_initialize(struct ccsr_fman *reg, struct fm_eth_info *info);
 phy_interface_t fman_port_enet_if(enum fm_port port);
 void fman_disable_port(enum fm_port port);
+void fman_enable_port(enum fm_port port);
 
 struct fsl_enet_mac {
        void *base; /* MAC controller registers base address */
index 2d13145f1434ec7763d71559d4f51f574c725676..35edd7ad94017ff7cb0f69064d76d0e8ca560da7 100644 (file)
@@ -145,6 +145,14 @@ void fm_disable_port(enum fm_port port)
        fman_disable_port(port);
 }
 
+void fm_enable_port(enum fm_port port)
+{
+       int i = fm_port_to_index(port);
+
+       fm_info[i].enabled = 1;
+       fman_enable_port(port);
+}
+
 void fm_info_set_mdio(enum fm_port port, struct mii_dev *bus)
 {
        int i = fm_port_to_index(port);
index 0eaad0f45d1e442f2295dea5c15c3082b447f91c..b25d10ae0f37cbbd7d3ae64c4a4ddf9bf689aad2 100644 (file)
@@ -34,6 +34,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
index febfdd4e874a285095ba38fe4a02ac1eb71bdf09..de71911355fa8bd1df933adf3278cc792ac89ddb 100644 (file)
@@ -42,6 +42,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr2, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr2, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
index 8d49c7bc1fdd8e96c6ce269080224bf59fd50828..5c158cd5dffc643780a7f22d61fdfe274de51584 100644 (file)
@@ -38,6 +38,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr2, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr2, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
index 546ebce56707175542203f1da0c80f2639d5a827..403d7d7948edb9b5db6f986e9b7cd95f5e690177 100644 (file)
@@ -44,6 +44,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr2, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr2, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
index 6253f22f75de8b938c7aeb25db8e0ae958aae49a..1eacb22841e855f527d886213a7de134dad8d7e2 100644 (file)
@@ -49,6 +49,13 @@ void fman_disable_port(enum fm_port port)
        setbits_be32(&gur->devdisr2, port_to_devdisr[port]);
 }
 
+void fman_enable_port(enum fm_port port)
+{
+       ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+       clrbits_be32(&gur->devdisr2, port_to_devdisr[port]);
+}
+
 phy_interface_t fman_port_enet_if(enum fm_port port)
 {
        ccsr_gur_t *gur = (void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
index 114bb8cf25e8acbec129c3fdc601733c7346b1dd..5a4fb70dfa4fe824c192a55ef15aec095169fe58 100644 (file)
@@ -149,6 +149,7 @@ void fm_info_set_phy_address(enum fm_port port, int address);
 int fm_info_get_phy_address(enum fm_port port);
 void fm_info_set_mdio(enum fm_port port, struct mii_dev *bus);
 void fm_disable_port(enum fm_port port);
+void fm_enable_port(enum fm_port port);
 void set_sgmii_phy(struct mii_dev *bus, enum fm_port base_port,
                unsigned int port_num, int phy_base_addr);
 int is_qsgmii_riser_card(struct mii_dev *bus, int phy_base_addr,