* [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override
@ 2009-05-29 22:04 Mike Frysinger
2009-06-01 4:06 ` Ben Warren
0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-05-29 22:04 UTC (permalink / raw)
To: u-boot
Some boards may want to undo some pin muxing for the EMAC (like when a
board doesn't have the RX error interrupt hooked up), but in order to do
that, we need to do portmuxing during the eth init step.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Ben Warren <biggerbadderben@gmail.com>
---
note: this is for "next", or post 2009.06
drivers/net/bfin_mac.c | 76 ++++++++++++++++++++++++------------------------
1 files changed, 38 insertions(+), 38 deletions(-)
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 12d98c2..79cb386 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -113,6 +113,44 @@ int bfin_EMAC_initialize(bd_t *bis)
miiphy_register(dev->name, bfin_miiphy_read, bfin_miiphy_write);
#endif
+ /* Set all the pins to peripheral mode */
+#ifdef CONFIG_RMII
+ /* grab RMII pins */
+# if defined(__ADSPBF51x__)
+ *pPORTF_MUX = (*pPORTF_MUX & \
+ ~(PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \
+ PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1;
+ *pPORTF_FER |= PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15;
+ *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1;
+ *pPORTG_FER |= PG0 | PG1 | PG2;
+# elif defined(__ADSPBF52x__)
+ *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2;
+ *pPORTG_FER |= PG14 | PG15;
+ *pPORTH_MUX = (*pPORTH_MUX & ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK)) | \
+ PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2;
+ *pPORTH_FER |= PH0 | PH1 | PH2 | PH3 | PH4 | PH5 | PH6 | PH7 | PH8;
+# else
+ *pPORTH_FER |= PH0 | PH1 | PH4 | PH5 | PH6 | PH8 | PH9 | PH14 | PH15;
+# endif
+#else
+ /* grab MII & RMII pins */
+# if defined(__ADSPBF51x__)
+ *pPORTF_MUX = (*pPORTF_MUX & \
+ ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \
+ PORT_x_MUX_0_FUNC_1 | PORT_x_MUX_1_FUNC_1 | PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1;
+ *pPORTF_FER |= PF0 | PF1 | PF2 | PF3 | PF4 | PF5 | PF6 | PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15;
+ *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1;
+ *pPORTG_FER |= PG0 | PG1 | PG2;
+# elif defined(__ADSPBF52x__)
+ *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2;
+ *pPORTG_FER |= PG14 | PG15;
+ *pPORTH_MUX = PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2 | PORT_x_MUX_2_FUNC_2;
+ *pPORTH_FER = -1; /* all pins */
+# else
+ *pPORTH_FER = -1; /* all pins */
+# endif
+#endif
+
return 0;
}
@@ -217,44 +255,6 @@ static int bfin_miiphy_init(struct eth_device *dev, int *opmode)
/* Enable PHY output */
*pVR_CTL |= CLKBUFOE;
- /* Set all the pins to peripheral mode */
-#ifdef CONFIG_RMII
- /* grab RMII pins */
-# if defined(__ADSPBF51x__)
- *pPORTF_MUX = (*pPORTF_MUX & \
- ~(PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \
- PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1;
- *pPORTF_FER |= PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15;
- *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1;
- *pPORTG_FER |= PG0 | PG1 | PG2;
-# elif defined(__ADSPBF52x__)
- *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2;
- *pPORTG_FER |= PG14 | PG15;
- *pPORTH_MUX = (*pPORTH_MUX & ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK)) | \
- PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2;
- *pPORTH_FER |= PH0 | PH1 | PH2 | PH3 | PH4 | PH5 | PH6 | PH7 | PH8;
-# else
- *pPORTH_FER |= PH0 | PH1 | PH4 | PH5 | PH6 | PH8 | PH9 | PH14 | PH15;
-# endif
-#else
- /* grab MII & RMII pins */
-# if defined(__ADSPBF51x__)
- *pPORTF_MUX = (*pPORTF_MUX & \
- ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK)) | \
- PORT_x_MUX_0_FUNC_1 | PORT_x_MUX_1_FUNC_1 | PORT_x_MUX_3_FUNC_1 | PORT_x_MUX_4_FUNC_1 | PORT_x_MUX_5_FUNC_1;
- *pPORTF_FER |= PF0 | PF1 | PF2 | PF3 | PF4 | PF5 | PF6 | PF8 | PF9 | PF10 | PF11 | PF12 | PF13 | PF14 | PF15;
- *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_0_MASK) | PORT_x_MUX_0_FUNC_1;
- *pPORTG_FER |= PG0 | PG1 | PG2;
-# elif defined(__ADSPBF52x__)
- *pPORTG_MUX = (*pPORTG_MUX & ~PORT_x_MUX_6_MASK) | PORT_x_MUX_6_FUNC_2;
- *pPORTG_FER |= PG14 | PG15;
- *pPORTH_MUX = PORT_x_MUX_0_FUNC_2 | PORT_x_MUX_1_FUNC_2 | PORT_x_MUX_2_FUNC_2;
- *pPORTH_FER = -1; /* all pins */
-# else
- *pPORTH_FER = -1; /* all pins */
-# endif
-#endif
-
/* Odd word alignment for Receive Frame DMA word */
/* Configure checksum support and rcve frame word alignment */
bfin_write_EMAC_SYSCTL(RXDWA | RXCKS | SET_MDCDIV(MDC_FREQ_TO_DIV(CONFIG_PHY_CLOCK_FREQ)));
--
1.6.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override
2009-05-29 22:04 [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override Mike Frysinger
@ 2009-06-01 4:06 ` Ben Warren
2009-06-11 7:30 ` Mike Frysinger
0 siblings, 1 reply; 4+ messages in thread
From: Ben Warren @ 2009-06-01 4:06 UTC (permalink / raw)
To: u-boot
Hi Mike,
Mike Frysinger wrote:
> Some boards may want to undo some pin muxing for the EMAC (like when a
> board doesn't have the RX error interrupt hooked up), but in order to do
> that, we need to do portmuxing during the eth init step.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> CC: Ben Warren <biggerbadderben@gmail.com>
> ---
Applied to net/next.
thanks,
Ben
P.S. - isn't there some way you could move this stuff to board code?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override
2009-06-01 4:06 ` Ben Warren
@ 2009-06-11 7:30 ` Mike Frysinger
2009-06-11 16:20 ` Ben Warren
0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-06-11 7:30 UTC (permalink / raw)
To: u-boot
On Monday 01 June 2009 00:06:43 Ben Warren wrote:
> Mike Frysinger wrote:
> > Some boards may want to undo some pin muxing for the EMAC (like when a
> > board doesn't have the RX error interrupt hooked up), but in order to do
> > that, we need to do portmuxing during the eth init step.
> >
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > CC: Ben Warren <biggerbadderben@gmail.com>
> > ---
>
> Applied to net/next.
please drop this, it causes subtle interaction problems with spi on some
platforms. i'll have to rethink things.
> P.S. - isn't there some way you could move this stuff to board code?
not until i put together a portmux framework
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090611/3b0d36c6/attachment.pgp
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override
2009-06-11 7:30 ` Mike Frysinger
@ 2009-06-11 16:20 ` Ben Warren
0 siblings, 0 replies; 4+ messages in thread
From: Ben Warren @ 2009-06-11 16:20 UTC (permalink / raw)
To: u-boot
Mike Frysinger wrote:
> On Monday 01 June 2009 00:06:43 Ben Warren wrote:
>
>> Mike Frysinger wrote:
>>
>>> Some boards may want to undo some pin muxing for the EMAC (like when a
>>> board doesn't have the RX error interrupt hooked up), but in order to do
>>> that, we need to do portmuxing during the eth init step.
>>>
>>> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
>>> CC: Ben Warren <biggerbadderben@gmail.com>
>>> ---
>>>
>> Applied to net/next.
>>
>
> please drop this, it causes subtle interaction problems with spi on some
> platforms. i'll have to rethink things.
>
>
Will do
cheers,
Ben
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-06-11 16:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-29 22:04 [U-Boot] [PATCH/next] Blackfin: bfin_mac: do portmuxing earlier to allow board override Mike Frysinger
2009-06-01 4:06 ` Ben Warren
2009-06-11 7:30 ` Mike Frysinger
2009-06-11 16:20 ` Ben Warren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox