diff options
author | Nithin Sujir <nsujir@broadcom.com> | 2014-01-03 13:09:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-03 20:59:52 -0500 |
commit | f82995b65c44f353358179f4e2745cf967e00b31 (patch) | |
tree | f410f0c640b0eed466a3cc751cb298e25e2d9efb /drivers | |
parent | e565eec31d9d5b1024311564f6536162df951de4 (diff) |
tg3: Set the MAC clock to the fastest speed during boot code load
On the 5717, 5718 and 5719 devices, the bootcode runs slower when any
port doesn't have a link due to clock speed slowing down as part of the
link-aware feature. This leads to the driver timing out waiting for the
bootcode signature.
This patch overrides the clock policy to the highest frequency just before
reset and restores it after the bootcode is up.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 55 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.h | 3 |
2 files changed, 54 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index c3b12de0b918..7bc8449af262 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c | |||
@@ -8941,6 +8941,49 @@ static void tg3_restore_pci_state(struct tg3 *tp) | |||
8941 | } | 8941 | } |
8942 | } | 8942 | } |
8943 | 8943 | ||
8944 | static void tg3_override_clk(struct tg3 *tp) | ||
8945 | { | ||
8946 | u32 val; | ||
8947 | |||
8948 | switch (tg3_asic_rev(tp)) { | ||
8949 | case ASIC_REV_5717: | ||
8950 | val = tr32(TG3_CPMU_CLCK_ORIDE_ENABLE); | ||
8951 | tw32(TG3_CPMU_CLCK_ORIDE_ENABLE, val | | ||
8952 | TG3_CPMU_MAC_ORIDE_ENABLE); | ||
8953 | break; | ||
8954 | |||
8955 | case ASIC_REV_5719: | ||
8956 | case ASIC_REV_5720: | ||
8957 | tw32(TG3_CPMU_CLCK_ORIDE, CPMU_CLCK_ORIDE_MAC_ORIDE_EN); | ||
8958 | break; | ||
8959 | |||
8960 | default: | ||
8961 | return; | ||
8962 | } | ||
8963 | } | ||
8964 | |||
8965 | static void tg3_restore_clk(struct tg3 *tp) | ||
8966 | { | ||
8967 | u32 val; | ||
8968 | |||
8969 | switch (tg3_asic_rev(tp)) { | ||
8970 | case ASIC_REV_5717: | ||
8971 | val = tr32(TG3_CPMU_CLCK_ORIDE_ENABLE); | ||
8972 | tw32(TG3_CPMU_CLCK_ORIDE_ENABLE, | ||
8973 | val & ~TG3_CPMU_MAC_ORIDE_ENABLE); | ||
8974 | break; | ||
8975 | |||
8976 | case ASIC_REV_5719: | ||
8977 | case ASIC_REV_5720: | ||
8978 | val = tr32(TG3_CPMU_CLCK_ORIDE); | ||
8979 | tw32(TG3_CPMU_CLCK_ORIDE, val & ~CPMU_CLCK_ORIDE_MAC_ORIDE_EN); | ||
8980 | break; | ||
8981 | |||
8982 | default: | ||
8983 | return; | ||
8984 | } | ||
8985 | } | ||
8986 | |||
8944 | /* tp->lock is held. */ | 8987 | /* tp->lock is held. */ |
8945 | static int tg3_chip_reset(struct tg3 *tp) | 8988 | static int tg3_chip_reset(struct tg3 *tp) |
8946 | { | 8989 | { |
@@ -9029,6 +9072,13 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
9029 | tr32(GRC_VCPU_EXT_CTRL) & ~GRC_VCPU_EXT_CTRL_HALT_CPU); | 9072 | tr32(GRC_VCPU_EXT_CTRL) & ~GRC_VCPU_EXT_CTRL_HALT_CPU); |
9030 | } | 9073 | } |
9031 | 9074 | ||
9075 | /* Set the clock to the highest frequency to avoid timeouts. With link | ||
9076 | * aware mode, the clock speed could be slow and bootcode does not | ||
9077 | * complete within the expected time. Override the clock to allow the | ||
9078 | * bootcode to finish sooner and then restore it. | ||
9079 | */ | ||
9080 | tg3_override_clk(tp); | ||
9081 | |||
9032 | /* Manage gphy power for all CPMU absent PCIe devices. */ | 9082 | /* Manage gphy power for all CPMU absent PCIe devices. */ |
9033 | if (tg3_flag(tp, 5705_PLUS) && !tg3_flag(tp, CPMU_PRESENT)) | 9083 | if (tg3_flag(tp, 5705_PLUS) && !tg3_flag(tp, CPMU_PRESENT)) |
9034 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; | 9084 | val |= GRC_MISC_CFG_KEEP_GPHY_POWER; |
@@ -9167,10 +9217,7 @@ static int tg3_chip_reset(struct tg3 *tp) | |||
9167 | tw32(0x7c00, val | (1 << 25)); | 9217 | tw32(0x7c00, val | (1 << 25)); |
9168 | } | 9218 | } |
9169 | 9219 | ||
9170 | if (tg3_asic_rev(tp) == ASIC_REV_5720) { | 9220 | tg3_restore_clk(tp); |
9171 | val = tr32(TG3_CPMU_CLCK_ORIDE); | ||
9172 | tw32(TG3_CPMU_CLCK_ORIDE, val & ~CPMU_CLCK_ORIDE_MAC_ORIDE_EN); | ||
9173 | } | ||
9174 | 9221 | ||
9175 | /* Reprobe ASF enable state. */ | 9222 | /* Reprobe ASF enable state. */ |
9176 | tg3_flag_clear(tp, ENABLE_ASF); | 9223 | tg3_flag_clear(tp, ENABLE_ASF); |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h index e4da9d7834ce..9e31eccc250b 100644 --- a/drivers/net/ethernet/broadcom/tg3.h +++ b/drivers/net/ethernet/broadcom/tg3.h | |||
@@ -1146,6 +1146,9 @@ | |||
1146 | #define TG3_CPMU_CLCK_ORIDE 0x00003624 | 1146 | #define TG3_CPMU_CLCK_ORIDE 0x00003624 |
1147 | #define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 | 1147 | #define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000 |
1148 | 1148 | ||
1149 | #define TG3_CPMU_CLCK_ORIDE_ENABLE 0x00003628 | ||
1150 | #define TG3_CPMU_MAC_ORIDE_ENABLE (1 << 13) | ||
1151 | |||
1149 | #define TG3_CPMU_STATUS 0x0000362c | 1152 | #define TG3_CPMU_STATUS 0x0000362c |
1150 | #define TG3_CPMU_STATUS_FMSK_5717 0x20000000 | 1153 | #define TG3_CPMU_STATUS_FMSK_5717 0x20000000 |
1151 | #define TG3_CPMU_STATUS_FMSK_5719 0xc0000000 | 1154 | #define TG3_CPMU_STATUS_FMSK_5719 0xc0000000 |