diff options
-rw-r--r-- | arch/arm/mach-mxs/mach-mx28evk.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/mach-mxs/mach-mx28evk.c b/arch/arm/mach-mxs/mach-mx28evk.c index 8e2c5975001e..e8db99fabc48 100644 --- a/arch/arm/mach-mxs/mach-mx28evk.c +++ b/arch/arm/mach-mxs/mach-mx28evk.c | |||
@@ -119,7 +119,7 @@ static void __init mx28evk_fec_reset(void) | |||
119 | gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); | 119 | gpio_set_value(MX28EVK_FEC_PHY_RESET, 1); |
120 | } | 120 | } |
121 | 121 | ||
122 | static struct fec_platform_data mx28_fec_pdata[] = { | 122 | static struct fec_platform_data mx28_fec_pdata[] __initdata = { |
123 | { | 123 | { |
124 | /* fec0 */ | 124 | /* fec0 */ |
125 | .phy = PHY_INTERFACE_MODE_RMII, | 125 | .phy = PHY_INTERFACE_MODE_RMII, |
@@ -129,12 +129,45 @@ static struct fec_platform_data mx28_fec_pdata[] = { | |||
129 | }, | 129 | }, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static int __init mx28evk_fec_get_mac(void) | ||
133 | { | ||
134 | int i; | ||
135 | u32 val; | ||
136 | const u32 *ocotp = mxs_get_ocotp(); | ||
137 | |||
138 | if (!ocotp) | ||
139 | goto error; | ||
140 | |||
141 | /* | ||
142 | * OCOTP only stores the last 4 octets for each mac address, | ||
143 | * so hard-code Freescale OUI (00:04:9f) here. | ||
144 | */ | ||
145 | for (i = 0; i < 2; i++) { | ||
146 | val = ocotp[i * 4]; | ||
147 | mx28_fec_pdata[i].mac[0] = 0x00; | ||
148 | mx28_fec_pdata[i].mac[1] = 0x04; | ||
149 | mx28_fec_pdata[i].mac[2] = 0x9f; | ||
150 | mx28_fec_pdata[i].mac[3] = (val >> 16) & 0xff; | ||
151 | mx28_fec_pdata[i].mac[4] = (val >> 8) & 0xff; | ||
152 | mx28_fec_pdata[i].mac[5] = (val >> 0) & 0xff; | ||
153 | } | ||
154 | |||
155 | return 0; | ||
156 | |||
157 | error: | ||
158 | pr_err("%s: timeout when reading fec mac from OCOTP\n", __func__); | ||
159 | return -ETIMEDOUT; | ||
160 | } | ||
161 | |||
132 | static void __init mx28evk_init(void) | 162 | static void __init mx28evk_init(void) |
133 | { | 163 | { |
134 | mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); | 164 | mxs_iomux_setup_multiple_pads(mx28evk_pads, ARRAY_SIZE(mx28evk_pads)); |
135 | 165 | ||
136 | mx28_add_duart(); | 166 | mx28_add_duart(); |
137 | 167 | ||
168 | if (mx28evk_fec_get_mac()) | ||
169 | pr_warn("%s: failed on fec mac setup\n", __func__); | ||
170 | |||
138 | mx28evk_fec_reset(); | 171 | mx28evk_fec_reset(); |
139 | mx28_add_fec(0, &mx28_fec_pdata[0]); | 172 | mx28_add_fec(0, &mx28_fec_pdata[0]); |
140 | mx28_add_fec(1, &mx28_fec_pdata[1]); | 173 | mx28_add_fec(1, &mx28_fec_pdata[1]); |