Skip to content

Commit f07c985

Browse files
gorazdadbridge
authored andcommitted
ff_lpc546xx: add enet
fsl_phy.c/.h move to ../drivers to reuse it lwip: add hardware_init.c
1 parent 1ca129a commit f07c985

File tree

5 files changed

+227
-1
lines changed

5 files changed

+227
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2017 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
#include "fsl_iocon.h"
18+
19+
#define IOCON_PIO_DIGITAL_EN 0x0100u /*!<@brief Enables digital function */
20+
#define IOCON_PIO_FUNC0 0x00u /*!<@brief Selects pin function 0 */
21+
#define IOCON_PIO_FUNC1 0x01u /*!<@brief Selects pin function 1 */
22+
#define IOCON_PIO_FUNC6 0x06u /*!<@brief Selects pin function 6 */
23+
#define IOCON_PIO_FUNC7 0x07u /*!<@brief Selects pin function 7 */
24+
#define IOCON_PIO_INPFILT_OFF 0x0200u /*!<@brief Input filter disabled */
25+
#define IOCON_PIO_INV_DI 0x00u /*!<@brief Input function is not inverted */
26+
#define IOCON_PIO_MODE_INACT 0x00u /*!<@brief No addition pin function */
27+
#define IOCON_PIO_MODE_PULLUP 0x20u /*!<@brief Selects pull-up function */
28+
#define IOCON_PIO_OPENDRAIN_DI 0x00u /*!<@brief Open drain is disabled */
29+
#define IOCON_PIO_SLEW_FAST 0x0400u /*!<@brief Fast mode, slew rate control is disabled */
30+
#define IOCON_PIO_SLEW_STANDARD 0x00u /*!<@brief Standard mode, output slew rate control is enabled */
31+
32+
/*******************************************************************************
33+
* Code
34+
******************************************************************************/
35+
void lpc546xx_init_eth_hardware(void)
36+
{
37+
CLOCK_EnableClock(kCLOCK_InputMux);
38+
39+
/* Enables the clock for the IOCON block. 0 = Disable; 1 = Enable.: 0x01u */
40+
CLOCK_EnableClock(kCLOCK_Iocon);
41+
42+
const uint32_t port0_pin10_config = (/* Pin is configured as SWO */
43+
IOCON_PIO_FUNC6 |
44+
/* No addition pin function */
45+
IOCON_PIO_MODE_INACT |
46+
/* Input function is not inverted */
47+
IOCON_PIO_INV_DI |
48+
/* Enables digital function */
49+
IOCON_PIO_DIGITAL_EN |
50+
/* Input filter disabled */
51+
IOCON_PIO_INPFILT_OFF |
52+
/* Open drain is disabled */
53+
IOCON_PIO_OPENDRAIN_DI);
54+
/* PORT0 PIN10 (coords: P2) is configured as SWO */
55+
IOCON_PinMuxSet(IOCON, 0U, 10U, port0_pin10_config);
56+
57+
const uint32_t port1_pin10_config = (/* Pin is configured as ENET_TXD1 */
58+
IOCON_PIO_FUNC1 /* IOCON_PIO_FUNC1 */ |
59+
/* No addition pin function */
60+
IOCON_PIO_MODE_INACT |
61+
/* Input function is not inverted */
62+
IOCON_PIO_INV_DI |
63+
/* Enables digital function */
64+
IOCON_PIO_DIGITAL_EN |
65+
/* Input filter disabled */
66+
IOCON_PIO_INPFILT_OFF |
67+
/* Standard mode, output slew rate control is enabled */
68+
IOCON_PIO_SLEW_STANDARD |
69+
/* Open drain is disabled */
70+
IOCON_PIO_OPENDRAIN_DI);
71+
/* PORT1 PIN10 (coords: E14) is configured as ENET_TXD1 */
72+
IOCON_PinMuxSet(IOCON, 1U, 10U, port1_pin10_config);
73+
74+
75+
const uint32_t port1_pin18_config = (/* Pin is configured as ENET_PHY_RST */
76+
IOCON_PIO_FUNC0 |
77+
/* Selects pull-up function */
78+
IOCON_PIO_MODE_PULLUP |
79+
/* Input function is not inverted */
80+
IOCON_PIO_INV_DI |
81+
/* Enables digital function */
82+
IOCON_PIO_DIGITAL_EN |
83+
/* Input filter disabled */
84+
IOCON_PIO_INPFILT_OFF |
85+
/* Standard mode, output slew rate control is enabled */
86+
IOCON_PIO_SLEW_STANDARD |
87+
/* Open drain is disabled */
88+
IOCON_PIO_OPENDRAIN_DI);
89+
/* PORT1 PIN18 (coords: H11) is configured as ENET_PHY_RST */
90+
IOCON_PinMuxSet(IOCON, 1U, 18U, port1_pin18_config);
91+
92+
const uint32_t port1_pin14_config = (/* Pin is configured as ENET_RX_DV */
93+
IOCON_PIO_FUNC1 |
94+
/* No addition pin function */
95+
IOCON_PIO_MODE_INACT |
96+
/* Input function is not inverted */
97+
IOCON_PIO_INV_DI |
98+
/* Enables digital function */
99+
IOCON_PIO_DIGITAL_EN |
100+
/* Input filter disabled */
101+
IOCON_PIO_INPFILT_OFF |
102+
/* Standard mode, output slew rate control is enabled */
103+
IOCON_PIO_SLEW_STANDARD |
104+
/* Open drain is disabled */
105+
IOCON_PIO_OPENDRAIN_DI);
106+
/* PORT1 PIN14 (coords: B9) is configured as ENET_RX_DV */
107+
IOCON_PinMuxSet(IOCON, 1U, 14U, port1_pin14_config);
108+
109+
const uint32_t port1_pin12_config = (/* Pin is configured as ENET_RXD0 */
110+
IOCON_PIO_FUNC1 |
111+
/* No addition pin function */
112+
IOCON_PIO_MODE_INACT |
113+
/* Input function is not inverted */
114+
IOCON_PIO_INV_DI |
115+
/* Enables digital function */
116+
IOCON_PIO_DIGITAL_EN |
117+
/* Input filter disabled */
118+
IOCON_PIO_INPFILT_OFF |
119+
/* Standard mode, output slew rate control is enabled */
120+
IOCON_PIO_SLEW_STANDARD |
121+
/* Open drain is disabled */
122+
IOCON_PIO_OPENDRAIN_DI);
123+
/* PORT1 PIN12 (coords: A9) is configured as ENET_RXD0 */
124+
IOCON_PinMuxSet(IOCON, 1U, 12U, port1_pin12_config);
125+
126+
const uint32_t port1_pin13_config = (/* Pin is configured as ENET_RXD1 */
127+
IOCON_PIO_FUNC1 |
128+
/* No addition pin function */
129+
IOCON_PIO_MODE_INACT |
130+
/* Input function is not inverted */
131+
IOCON_PIO_INV_DI |
132+
/* Enables digital function */
133+
IOCON_PIO_DIGITAL_EN |
134+
/* Input filter disabled */
135+
IOCON_PIO_INPFILT_OFF |
136+
/* Standard mode, output slew rate control is enabled */
137+
IOCON_PIO_SLEW_STANDARD |
138+
/* Open drain is disabled */
139+
IOCON_PIO_OPENDRAIN_DI);
140+
/* PORT4 PIN12 (coords: A6) is configured as ENET_RXD1 */
141+
IOCON_PinMuxSet(IOCON, 1U, 13U, port1_pin13_config);
142+
143+
const uint32_t port1_pin11_config = (/* Pin is configured as ENET_TX_EN */
144+
IOCON_PIO_FUNC1 |
145+
/* No addition pin function */
146+
IOCON_PIO_MODE_INACT |
147+
/* Input function is not inverted */
148+
IOCON_PIO_INV_DI |
149+
/* Enables digital function */
150+
IOCON_PIO_DIGITAL_EN |
151+
/* Input filter disabled */
152+
IOCON_PIO_INPFILT_OFF |
153+
/* Standard mode, output slew rate control is enabled */
154+
IOCON_PIO_SLEW_STANDARD |
155+
/* Open drain is disabled */
156+
IOCON_PIO_OPENDRAIN_DI);
157+
/* PORT4 PIN13 (coords: B6) is configured as ENET_TX_EN */
158+
IOCON_PinMuxSet(IOCON, 1U, 11U, port1_pin11_config);
159+
160+
const uint32_t port1_pin15_config = (/* Pin is configured as ENET_RX_CLK */
161+
IOCON_PIO_FUNC1 |
162+
/* No addition pin function */
163+
IOCON_PIO_MODE_INACT |
164+
/* Input function is not inverted */
165+
IOCON_PIO_INV_DI |
166+
/* Enables digital function */
167+
IOCON_PIO_DIGITAL_EN |
168+
/* Input filter disabled */
169+
IOCON_PIO_INPFILT_OFF |
170+
/* Standard mode, output slew rate control is enabled */
171+
IOCON_PIO_SLEW_STANDARD |
172+
/* Open drain is disabled */
173+
IOCON_PIO_OPENDRAIN_DI);
174+
/* PORT4 PIN14 (coords: B5) is configured as ENET_RX_CLK */
175+
IOCON_PinMuxSet(IOCON, 1U, 15U, port1_pin15_config);
176+
177+
const uint32_t port1_pin16_config = (/* Pin is configured as ENET_MDC */
178+
IOCON_PIO_FUNC1 |
179+
/* No addition pin function */
180+
IOCON_PIO_MODE_INACT |
181+
/* Input function is not inverted */
182+
IOCON_PIO_INV_DI |
183+
/* Enables digital function */
184+
IOCON_PIO_DIGITAL_EN |
185+
/* Input filter disabled */
186+
IOCON_PIO_INPFILT_OFF |
187+
/* Standard mode, output slew rate control is enabled */
188+
IOCON_PIO_SLEW_STANDARD |
189+
/* Open drain is disabled */
190+
IOCON_PIO_OPENDRAIN_DI);
191+
/* PORT4 PIN15 (coords: A4) is configured as ENET_MDC */
192+
IOCON_PinMuxSet(IOCON, 1U, 16U, port1_pin16_config);
193+
194+
const uint32_t port1_pin17_config = (/* Pin is configured as ENET_MDIO */
195+
IOCON_PIO_FUNC1 |
196+
/* No addition pin function */
197+
IOCON_PIO_MODE_INACT |
198+
/* Input function is not inverted */
199+
IOCON_PIO_INV_DI |
200+
/* Enables digital function */
201+
IOCON_PIO_DIGITAL_EN |
202+
/* Input filter disabled */
203+
IOCON_PIO_INPFILT_OFF |
204+
/* Standard mode, output slew rate control is enabled */
205+
IOCON_PIO_SLEW_STANDARD |
206+
/* Open drain is disabled */
207+
IOCON_PIO_OPENDRAIN_DI);
208+
/* PORT4 PIN16 (coords: C4) is configured as ENET_MDIO */
209+
IOCON_PinMuxSet(IOCON, 1U, 17U, port1_pin17_config);
210+
211+
const uint32_t port1_pin9_config = (/* Pin is configured as ENET_TXD0 */
212+
IOCON_PIO_FUNC1 |
213+
/* No addition pin function */
214+
IOCON_PIO_MODE_INACT |
215+
/* Input function is not inverted */
216+
IOCON_PIO_INV_DI |
217+
/* Enables digital function */
218+
IOCON_PIO_DIGITAL_EN |
219+
/* Input filter disabled */
220+
IOCON_PIO_INPFILT_OFF |
221+
/* Standard mode, output slew rate control is enabled */
222+
IOCON_PIO_SLEW_STANDARD |
223+
/* Open drain is disabled */
224+
IOCON_PIO_OPENDRAIN_DI);
225+
/* PORT4 PIN8 (coords: B14) is configured as ENET_TXD0 */
226+
IOCON_PinMuxSet(IOCON, 1U, 9U, port1_pin9_config);
227+
}

targets/targets.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,6 @@
744744
"FF_LPC546XX": {
745745
"inherits": ["LPC546XX"],
746746
"extra_labels_remove" : ["LPCXpresso"],
747-
"features_remove": ["LWIP"],
748747
"supported_form_factors": [""],
749748
"detect_code": ["8081"]
750749
},

0 commit comments

Comments
 (0)