]> Git Repo - u-boot.git/commitdiff
arm: socfpga: reset: Add EMAC reset functions
authorMarek Vasut <[email protected]>
Mon, 8 Sep 2014 12:08:45 +0000 (14:08 +0200)
committerMarek Vasut <[email protected]>
Mon, 6 Oct 2014 15:46:49 +0000 (17:46 +0200)
Add functions to reset the EMAC ethernet blocks. We cannot handle
two EMAC ethernet blocks yet, therefore the ifdefs. Once there is
hardware using both EMAC blocks, this ifdef will have to go.

Signed-off-by: Marek Vasut <[email protected]>
Cc: Chin Liang See <[email protected]>
Cc: Dinh Nguyen <[email protected]>
Cc: Albert Aribaud <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Wolfgang Denk <[email protected]>
Cc: Pavel Machek <[email protected]>
Acked-by: Pavel Machek <[email protected]>
arch/arm/cpu/armv7/socfpga/reset_manager.c
arch/arm/include/asm/arch-socfpga/reset_manager.h

index 5d7aba467f70af05e83ceda8cebb945b8a892b1b..badc569582046294ed4576e9072232452e66c9ad 100644 (file)
@@ -49,3 +49,20 @@ void reset_deassert_peripherals_handoff(void)
 {
        writel(0, &reset_manager_base->per_mod_reset);
 }
+
+/* Change the reset state for EMAC 0 and EMAC 1 */
+void socfpga_emac_reset(int enable)
+{
+       const void *reset = &reset_manager_base->per_mod_reset;
+
+       if (enable) {
+               setbits_le32(reset, 1 << RSTMGR_PERMODRST_EMAC0_LSB);
+               setbits_le32(reset, 1 << RSTMGR_PERMODRST_EMAC1_LSB);
+       } else {
+#if (CONFIG_EMAC_BASE == SOCFPGA_EMAC0_ADDRESS)
+               clrbits_le32(reset, 1 << RSTMGR_PERMODRST_EMAC0_LSB);
+#elif (CONFIG_EMAC_BASE == SOCFPGA_EMAC1_ADDRESS)
+               clrbits_le32(reset, 1 << RSTMGR_PERMODRST_EMAC1_LSB);
+#endif
+       }
+}
index 18506e69fd1fd20bad516d19dec3f3d0ee67ad9d..3c5ab401e1ed94a8e896e5120e00ebdd5cff697f 100644 (file)
@@ -10,6 +10,7 @@
 void reset_cpu(ulong addr);
 void reset_deassert_peripherals_handoff(void);
 
+void socfpga_emac_reset(int enable);
 void socfpga_watchdog_reset(void);
 
 struct socfpga_reset_manager {
@@ -29,6 +30,8 @@ struct socfpga_reset_manager {
 #define RSTMGR_CTRL_SWWARMRSTREQ_LSB 1
 #endif
 
+#define RSTMGR_PERMODRST_EMAC0_LSB     0
+#define RSTMGR_PERMODRST_EMAC1_LSB     1
 #define RSTMGR_PERMODRST_L4WD0_LSB     6
 
 #endif /* _RESET_MANAGER_H_ */
This page took 0.030953 seconds and 4 git commands to generate.