summaryrefslogtreecommitdiff
path: root/board/scalys/simc-t2081/dragonfruit.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/scalys/simc-t2081/dragonfruit.c')
-rw-r--r--board/scalys/simc-t2081/dragonfruit.c71
1 files changed, 26 insertions, 45 deletions
diff --git a/board/scalys/simc-t2081/dragonfruit.c b/board/scalys/simc-t2081/dragonfruit.c
index a2d6653..e3f1641 100644
--- a/board/scalys/simc-t2081/dragonfruit.c
+++ b/board/scalys/simc-t2081/dragonfruit.c
@@ -6,23 +6,19 @@
*/
#include <common.h>
-#include <asm/gpio.h>
+#include <asm-generic/gpio.h>
#include "dragonfruit.h"
-uint32_t *gpio2_gpdir = (uint32_t *) 0xffe131000;
-uint32_t *gpio2_gpdat = (uint32_t *) 0xffe131008;
-uint32_t regval;
-
/*
* SERDER MUX Configuration pins:
* IFC_A25 : GPIO2_25 : SERDES_CLK_ MUX_SER0_1_SEL
* IFC_A26 : GPIO2_26 : SERDES_CLK_ MUX_SER2_3_SEL
* IFC_A27 : GPIO2_27 : SERDES_CLK_ MUX_SER5_6_SEL
*/
-#define MUX_SER0_1_SEL (0x80000000 >> 25)
-#define MUX_SER2_3_SEL (0x80000000 >> 26)
-#define MUX_SER5_6_SEL (0x80000000 >> 27)
-#define SERDES_CLK_OE (0x80000000 >> 29)
+#define MUX_SER0_1_SEL MPC85XX_GPIO_NR(2, 25)
+#define MUX_SER2_3_SEL MPC85XX_GPIO_NR(2, 26)
+#define MUX_SER5_6_SEL MPC85XX_GPIO_NR(2, 27)
+#define SERDES_CLK_OE MPC85XX_GPIO_NR(2, 29)
/*
* MUX_SER0_1_SEL
@@ -57,8 +53,7 @@ uint32_t regval;
#define SER_5_6_SLOT4 0
#define SER_5_6_SLOT23 4
-
-/*
+/*
* SERDES H => Slot 4, lane 3
*/
@@ -66,14 +61,17 @@ int scalys_carrier_setup_muxing(int serdes_config)
{
int ret = 0;
int mux_config = 0;
+
+
+ mdelay(100);
- ret = gpio_request(MUX_SER0_1_SEL, "mux_ser0_1_sel");
+ ret += gpio_request(MUX_SER0_1_SEL, "mux_ser0_1_sel");
+ ret += gpio_request(MUX_SER2_3_SEL, "mux_ser2_3_sel");
+ ret += gpio_request(MUX_SER5_6_SEL, "mux_ser5_6_sel");
+ ret += gpio_request(SERDES_CLK_OE, "serdes_clk_oe");
if (ret != 0) {
printf("gpio request failed(%i)\n", ret);
}
- gpio_request(MUX_SER2_3_SEL, "mux_ser2_3_sel");
- gpio_request(MUX_SER5_6_SEL, "mux_ser5_6_sel");
- gpio_request(SERDES_CLK_OE, "serdes_clk_oe");
/*
@@ -123,46 +121,34 @@ int scalys_carrier_setup_muxing(int serdes_config)
printf("-----------------------------------------------------\n");
printf("Serdes lane configuration:\n");
- if ((mux_config & 1) > 0) {
- regval = in_be32(gpio2_gpdat);
- regval |= MUX_SER0_1_SEL;
- out_be32(gpio2_gpdat, regval);
+ if ((mux_config & 1) != 0) {
+ gpio_direction_output(MUX_SER0_1_SEL, 1);
printf("A: SFP slot 0 (T2081 only)\n");
- printf("B: SFP slot 1\n");
+ printf("B: SFP slot 1 (T2081 only)\n");
} else {
- regval = in_be32(gpio2_gpdat);
- regval &= ~MUX_SER0_1_SEL;
- out_be32(gpio2_gpdat, regval);
+ gpio_direction_output(MUX_SER0_1_SEL, 0);
printf("A: PCIe slot 1 on lane 0\n");
printf("B: PCIe slot 1 on lane 1\n");
}
- if ((mux_config & 2) > 0) {
- regval = in_be32(gpio2_gpdat);
- regval |= MUX_SER2_3_SEL;
- out_be32(gpio2_gpdat, regval);
+ if ((mux_config & 2) != 0) {
+ gpio_direction_output(MUX_SER2_3_SEL, 1);
printf("C: SFP slot 2\n");
printf("D: SFP slot 3\n");
} else {
- regval = in_be32(gpio2_gpdat);
- regval &= ~MUX_SER2_3_SEL;
- out_be32(gpio2_gpdat, regval);
+ gpio_direction_output(MUX_SER2_3_SEL, 0);
printf("C: PCIe slot 1 on lane 2\n");
printf("D: PCIe slot 1 on lane 3\n");
}
printf("E: PCIe slot 4 on lane 0\n");
- if ((mux_config & 4) > 0) {
- regval = in_be32(gpio2_gpdat);
- regval |= MUX_SER5_6_SEL;
- out_be32(gpio2_gpdat, regval);
+ if ((mux_config & 4) != 0) {
+ gpio_direction_output(MUX_SER5_6_SEL, 1);
printf("F: PCIe slot 2 on lane 0\n");
printf("G: PCIe slot 3 on lane 0\n");
} else {
- regval = in_be32(gpio2_gpdat);
- regval &= ~MUX_SER5_6_SEL;
- out_be32(gpio2_gpdat, regval);
+ gpio_direction_output(MUX_SER5_6_SEL, 0);
printf("F: PCIe slot 4 on lane 1\n");
printf("G: PCIe slot 4 on lane 2\n");
}
@@ -171,14 +157,9 @@ int scalys_carrier_setup_muxing(int serdes_config)
printf("-----------------------------------------------------\n");
/* Enable serdes clock */
- regval = in_be32(gpio2_gpdat);
- regval |= SERDES_CLK_OE;
- out_be32(gpio2_gpdat, regval);
+ gpio_direction_output(SERDES_CLK_OE, 1);
+
+ mdelay(100);
- /* Set outputs to output mode */
- regval = in_be32(gpio2_gpdir);
- regval |= (MUX_SER0_1_SEL | MUX_SER2_3_SEL | MUX_SER5_6_SEL | SERDES_CLK_OE);
- out_be32(gpio2_gpdir, regval);
-
return ret;
}