Skip to content

Commit 12c6b1b

Browse files
committed
MIMXRT1050EVK: Add ENET support
Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent 82f195c commit 12c6b1b

File tree

12 files changed

+1138
-64
lines changed

12 files changed

+1138
-64
lines changed

features/lwipstack/mbed_lib.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
},
141141
"ARCH_PRO": {
142142
"mem-size": 16362
143-
},
143+
},
144144
"LPC546XX": {
145145
"mem-size": 36496
146146
},
@@ -157,6 +157,9 @@
157157
"tcp-wnd": "(TCP_MSS * 8)",
158158
"pbuf-pool-size": 16,
159159
"mem-size": 51200
160+
},
161+
"MIMXRT1050_EVK": {
162+
"mem-size": 36560
160163
}
161164
}
162165
}
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
/*
2+
* Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without modification,
6+
* are permitted provided that the following conditions are met:
7+
*
8+
* o Redistributions of source code must retain the above copyright notice, this list
9+
* of conditions and the following disclaimer.
10+
*
11+
* o Redistributions in binary form must reproduce the above copyright notice, this
12+
* list of conditions and the following disclaimer in the documentation and/or
13+
* other materials provided with the distribution.
14+
*
15+
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16+
* contributors may be used to endorse or promote products derived from this
17+
* software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
#include "fsl_gpio.h"
32+
#include "fsl_iomuxc.h"
33+
#include "fsl_clock.h"
34+
#include "mbed_wait_api.h"
35+
36+
/*******************************************************************************
37+
* Code
38+
******************************************************************************/
39+
static void BOARD_InitModuleClock(void)
40+
{
41+
const clock_enet_pll_config_t config = {true, false, 1};
42+
CLOCK_InitEnetPll(&config);
43+
}
44+
45+
void kinetis_init_eth_hardware(void)
46+
{
47+
gpio_pin_config_t gpio_config = {kGPIO_DigitalOutput, 0, kGPIO_NoIntmode};
48+
49+
CLOCK_EnableClock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
50+
51+
IOMUXC_SetPinMux(
52+
IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 is configured as GPIO1_IO09 */
53+
0U); /* Software Input On Field: Input Path is determined by functionality */
54+
IOMUXC_SetPinMux(
55+
IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 is configured as GPIO1_IO10 */
56+
0U); /* Software Input On Field: Input Path is determined by functionality */
57+
IOMUXC_SetPinMux(
58+
IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 is configured as ENET_RX_DATA00 */
59+
0U); /* Software Input On Field: Input Path is determined by functionality */
60+
IOMUXC_SetPinMux(
61+
IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 is configured as ENET_RX_DATA01 */
62+
0U); /* Software Input On Field: Input Path is determined by functionality */
63+
IOMUXC_SetPinMux(
64+
IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 is configured as ENET_RX_EN */
65+
0U); /* Software Input On Field: Input Path is determined by functionality */
66+
IOMUXC_SetPinMux(
67+
IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 is configured as ENET_TX_DATA00 */
68+
0U); /* Software Input On Field: Input Path is determined by functionality */
69+
IOMUXC_SetPinMux(
70+
IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 is configured as ENET_TX_DATA01 */
71+
0U); /* Software Input On Field: Input Path is determined by functionality */
72+
IOMUXC_SetPinMux(
73+
IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 is configured as ENET_TX_EN */
74+
0U); /* Software Input On Field: Input Path is determined by functionality */
75+
IOMUXC_SetPinMux(
76+
IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 is configured as ENET_REF_CLK */
77+
1U); /* Software Input On Field: Force input path of pad GPIO_B1_10 */
78+
IOMUXC_SetPinMux(
79+
IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 is configured as ENET_RX_ER */
80+
0U); /* Software Input On Field: Input Path is determined by functionality */
81+
IOMUXC_SetPinMux(
82+
IOMUXC_GPIO_EMC_40_ENET_MDC, /* GPIO_EMC_40 is configured as ENET_MDC */
83+
0U); /* Software Input On Field: Input Path is determined by functionality */
84+
IOMUXC_SetPinMux(
85+
IOMUXC_GPIO_EMC_41_ENET_MDIO, /* GPIO_EMC_41 is configured as ENET_MDIO */
86+
0U); /* Software Input On Field: Input Path is determined by functionality */
87+
IOMUXC_SetPinConfig(
88+
IOMUXC_GPIO_AD_B0_09_GPIO1_IO09, /* GPIO_AD_B0_09 PAD functional properties : */
89+
0xB0A9u); /* Slew Rate Field: Fast Slew Rate
90+
Drive Strength Field: R0/5
91+
Speed Field: medium(100MHz)
92+
Open Drain Enable Field: Open Drain Disabled
93+
Pull / Keep Enable Field: Pull/Keeper Enabled
94+
Pull / Keep Select Field: Pull
95+
Pull Up / Down Config. Field: 100K Ohm Pull Up
96+
Hyst. Enable Field: Hysteresis Disabled */
97+
IOMUXC_SetPinConfig(
98+
IOMUXC_GPIO_AD_B0_10_GPIO1_IO10, /* GPIO_AD_B0_10 PAD functional properties : */
99+
0xB0A9u); /* Slew Rate Field: Fast Slew Rate
100+
Drive Strength Field: R0/5
101+
Speed Field: medium(100MHz)
102+
Open Drain Enable Field: Open Drain Disabled
103+
Pull / Keep Enable Field: Pull/Keeper Enabled
104+
Pull / Keep Select Field: Pull
105+
Pull Up / Down Config. Field: 100K Ohm Pull Up
106+
Hyst. Enable Field: Hysteresis Disabled */
107+
IOMUXC_SetPinConfig(
108+
IOMUXC_GPIO_B1_04_ENET_RX_DATA00, /* GPIO_B1_04 PAD functional properties : */
109+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
110+
Drive Strength Field: R0/5
111+
Speed Field: max(200MHz)
112+
Open Drain Enable Field: Open Drain Disabled
113+
Pull / Keep Enable Field: Pull/Keeper Enabled
114+
Pull / Keep Select Field: Pull
115+
Pull Up / Down Config. Field: 100K Ohm Pull Up
116+
Hyst. Enable Field: Hysteresis Disabled */
117+
IOMUXC_SetPinConfig(
118+
IOMUXC_GPIO_B1_05_ENET_RX_DATA01, /* GPIO_B1_05 PAD functional properties : */
119+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
120+
Drive Strength Field: R0/5
121+
Speed Field: max(200MHz)
122+
Open Drain Enable Field: Open Drain Disabled
123+
Pull / Keep Enable Field: Pull/Keeper Enabled
124+
Pull / Keep Select Field: Pull
125+
Pull Up / Down Config. Field: 100K Ohm Pull Up
126+
Hyst. Enable Field: Hysteresis Disabled */
127+
IOMUXC_SetPinConfig(
128+
IOMUXC_GPIO_B1_06_ENET_RX_EN, /* GPIO_B1_06 PAD functional properties : */
129+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
130+
Drive Strength Field: R0/5
131+
Speed Field: max(200MHz)
132+
Open Drain Enable Field: Open Drain Disabled
133+
Pull / Keep Enable Field: Pull/Keeper Enabled
134+
Pull / Keep Select Field: Pull
135+
Pull Up / Down Config. Field: 100K Ohm Pull Up
136+
Hyst. Enable Field: Hysteresis Disabled */
137+
IOMUXC_SetPinConfig(
138+
IOMUXC_GPIO_B1_07_ENET_TX_DATA00, /* GPIO_B1_07 PAD functional properties : */
139+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
140+
Drive Strength Field: R0/5
141+
Speed Field: max(200MHz)
142+
Open Drain Enable Field: Open Drain Disabled
143+
Pull / Keep Enable Field: Pull/Keeper Enabled
144+
Pull / Keep Select Field: Pull
145+
Pull Up / Down Config. Field: 100K Ohm Pull Up
146+
Hyst. Enable Field: Hysteresis Disabled */
147+
IOMUXC_SetPinConfig(
148+
IOMUXC_GPIO_B1_08_ENET_TX_DATA01, /* GPIO_B1_08 PAD functional properties : */
149+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
150+
Drive Strength Field: R0/5
151+
Speed Field: max(200MHz)
152+
Open Drain Enable Field: Open Drain Disabled
153+
Pull / Keep Enable Field: Pull/Keeper Enabled
154+
Pull / Keep Select Field: Pull
155+
Pull Up / Down Config. Field: 100K Ohm Pull Up
156+
Hyst. Enable Field: Hysteresis Disabled */
157+
IOMUXC_SetPinConfig(
158+
IOMUXC_GPIO_B1_09_ENET_TX_EN, /* GPIO_B1_09 PAD functional properties : */
159+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
160+
Drive Strength Field: R0/5
161+
Speed Field: max(200MHz)
162+
Open Drain Enable Field: Open Drain Disabled
163+
Pull / Keep Enable Field: Pull/Keeper Enabled
164+
Pull / Keep Select Field: Pull
165+
Pull Up / Down Config. Field: 100K Ohm Pull Up
166+
Hyst. Enable Field: Hysteresis Disabled */
167+
IOMUXC_SetPinConfig(
168+
IOMUXC_GPIO_B1_10_ENET_REF_CLK, /* GPIO_B1_10 PAD functional properties : */
169+
0x31u); /* Slew Rate Field: Fast Slew Rate
170+
Drive Strength Field: R0/6
171+
Speed Field: low(50MHz)
172+
Open Drain Enable Field: Open Drain Disabled
173+
Pull / Keep Enable Field: Pull/Keeper Disabled
174+
Pull / Keep Select Field: Keeper
175+
Pull Up / Down Config. Field: 100K Ohm Pull Down
176+
Hyst. Enable Field: Hysteresis Disabled */
177+
IOMUXC_SetPinConfig(
178+
IOMUXC_GPIO_B1_11_ENET_RX_ER, /* GPIO_B1_11 PAD functional properties : */
179+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
180+
Drive Strength Field: R0/5
181+
Speed Field: max(200MHz)
182+
Open Drain Enable Field: Open Drain Disabled
183+
Pull / Keep Enable Field: Pull/Keeper Enabled
184+
Pull / Keep Select Field: Pull
185+
Pull Up / Down Config. Field: 100K Ohm Pull Up
186+
Hyst. Enable Field: Hysteresis Disabled */
187+
IOMUXC_SetPinConfig(
188+
IOMUXC_GPIO_EMC_40_ENET_MDC, /* GPIO_EMC_40 PAD functional properties : */
189+
0xB0E9u); /* Slew Rate Field: Fast Slew Rate
190+
Drive Strength Field: R0/5
191+
Speed Field: max(200MHz)
192+
Open Drain Enable Field: Open Drain Disabled
193+
Pull / Keep Enable Field: Pull/Keeper Enabled
194+
Pull / Keep Select Field: Pull
195+
Pull Up / Down Config. Field: 100K Ohm Pull Up
196+
Hyst. Enable Field: Hysteresis Disabled */
197+
IOMUXC_SetPinConfig(
198+
IOMUXC_GPIO_EMC_41_ENET_MDIO, /* GPIO_EMC_41 PAD functional properties : */
199+
0xB829u); /* Slew Rate Field: Fast Slew Rate
200+
Drive Strength Field: R0/5
201+
Speed Field: low(50MHz)
202+
Open Drain Enable Field: Open Drain Enabled
203+
Pull / Keep Enable Field: Pull/Keeper Enabled
204+
Pull / Keep Select Field: Pull
205+
Pull Up / Down Config. Field: 100K Ohm Pull Up
206+
Hyst. Enable Field: Hysteresis Disabled */
207+
208+
209+
BOARD_InitModuleClock();
210+
211+
IOMUXC_EnableMode(IOMUXC_GPR, kIOMUXC_GPR_ENET1TxClkOutputDir, true);
212+
213+
GPIO_PinInit(GPIO1, 9, &gpio_config);
214+
GPIO_PinInit(GPIO1, 10, &gpio_config);
215+
/* pull up the ENET_INT before RESET. */
216+
GPIO_WritePinOutput(GPIO1, 10, 1);
217+
GPIO_WritePinOutput(GPIO1, 9, 0);
218+
wait_ms(1);
219+
GPIO_WritePinOutput(GPIO1, 9, 1);
220+
}
221+
222+
/*******************************************************************************
223+
* EOF
224+
******************************************************************************/
225+
226+

0 commit comments

Comments
 (0)