Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2009 |
| 3 | * Marvell Semiconductor <www.marvell.com> |
| 4 | * Prafulla Wadaskar <prafulla@marvell.com> |
| 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 22 | * MA 02110-1301 USA |
| 23 | */ |
| 24 | |
| 25 | #ifndef _MV88E61XX_H |
| 26 | #define _MV88E61XX_H |
| 27 | |
| 28 | #include <miiphy.h> |
| 29 | |
| 30 | #define MV88E61XX_CPU_PORT 0x5 |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 31 | |
| 32 | #define MV88E61XX_PHY_TIMEOUT 100000 |
| 33 | |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 34 | /* port dev-addr (= port + 0x10) */ |
| 35 | #define MV88E61XX_PRT_OFST 0x10 |
| 36 | /* port registers */ |
| 37 | #define MV88E61XX_PCS_CTRL_REG 0x1 |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 38 | #define MV88E61XX_PRT_CTRL_REG 0x4 |
| 39 | #define MV88E61XX_PRT_VMAP_REG 0x6 |
| 40 | #define MV88E61XX_PRT_VID_REG 0x7 |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 41 | #define MV88E61XX_RGMII_TIMECTRL_REG 0x1A |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 42 | |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 43 | /* global registers dev-addr */ |
| 44 | #define MV88E61XX_GLBREG_DEVADR 0x1B |
| 45 | /* global registers */ |
| 46 | #define MV88E61XX_SGSR 0x00 |
| 47 | #define MV88E61XX_SGCR 0x04 |
| 48 | |
| 49 | /* global 2 registers dev-addr */ |
| 50 | #define MV88E61XX_GLB2REG_DEVADR 0x1C |
| 51 | /* global 2 registers */ |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 52 | #define MV88E61XX_PHY_CMD 0x18 |
| 53 | #define MV88E61XX_PHY_DATA 0x19 |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 54 | /* global 2 phy commands */ |
| 55 | #define MV88E61XX_PHY_WRITE_CMD 0x9400 |
| 56 | #define MV88E61XX_PHY_READ_CMD 0x9800 |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 57 | |
| 58 | #define MV88E61XX_BUSY_OFST 15 |
| 59 | #define MV88E61XX_MODE_OFST 12 |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 60 | #define MV88E61XX_OP_OFST 10 |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 61 | #define MV88E61XX_ADDR_OFST 5 |
| 62 | |
| 63 | #ifdef CONFIG_MV88E61XX_MULTICHIP_ADRMODE |
Prafulla Wadaskar | 0a3a923 | 2009-07-16 20:58:02 +0530 | [diff] [blame] | 64 | static int mv88e61xx_busychk_multic(char *name, u32 devaddr); |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 65 | static void mv88e61xx_switch_write(char *name, u32 phy_adr, |
| 66 | u32 reg_ofs, u16 data); |
| 67 | static void mv88e61xx_switch_read(char *name, u32 phy_adr, |
| 68 | u32 reg_ofs, u16 *data); |
| 69 | #define wr_switch_reg mv88e61xx_switch_write |
| 70 | #define rd_switch_reg mv88e61xx_switch_read |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 71 | #else |
Albert ARIBAUD | 1368b08 | 2012-11-26 11:27:35 +0000 | [diff] [blame] | 72 | /* switch appears a s simple PHY and can thus use miiphy */ |
| 73 | #define wr_switch_reg miiphy_write |
| 74 | #define rd_switch_reg miiphy_read |
Prafulla Wadaskar | a055ce0 | 2009-05-19 01:40:16 +0530 | [diff] [blame] | 75 | #endif /* CONFIG_MV88E61XX_MULTICHIP_ADRMODE */ |
| 76 | |
| 77 | #endif /* _MV88E61XX_H */ |