1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 | /*
* Platform device registration.
* Copyright (c) 2006 Michael Broughton (mbobowik@telusplanet.net)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#if defined(CONFIG_M520x)
#include <linux/if_ether.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include "fec.h"
#if defined(CONFIG_MCF_FEC_MAC1_ADDR) && \
(CONFIG_MCF_FEC_MAC1_ADDR == 0)
static unsigned char m520x_fec_mac[] = {
0x00, 0x14, 0x15, 0x00, 0x01, 0xb5,
};
#endif
static unsigned int m520x_fec_phy_id = CONFIG_MCF_FEC_PHY_ID1;
static struct platform_device m520x_fec_pdev = {
.name = "FEC",
.id = 0,
.num_resources = 17,
.resource = (struct resource[]) {
FEC_RES_MEM("CSR",
(unsigned long)(MCF_MBAR + 0x00030000),
(unsigned long)(MCF_MBAR + 0x000301ff)),
FEC_RES_MEM("MIB",
(unsigned long)(MCF_MBAR + 0x00030200),
(unsigned long)(MCF_MBAR + 0x000303ff)),
FEC_RES_MEM("MAC",
#if defined(CONFIG_MCF_FEC_MAC1)
(unsigned long)(MCF_MBAR + 0x000300E4),
(unsigned long)(MCF_MBAR + 0x000300EA)
#else
#if (CONFIG_MCF_FEC_MAC1_ADDR == 0)
(unsigned long)m520x_fec_mac,
(unsigned long)(m520x_fec_mac + ETH_ALEN - 1)
#else
(unsigned long)(CONFIG_MCF_FEC_MAC1_ADDR),
(unsigned long)(CONFIG_MCF_FEC_MAC1_ADDR + ETH_ALEN - 1)
#endif
#endif
),
FEC_RES_MEM("PHY_ID",
(unsigned long)(&m520x_fec_phy_id),
(unsigned long)(&m520x_fec_phy_id)),
FEC_RES_IRQ((64 + 36), "fec(TXF)"),
FEC_RES_IRQ((64 + 37), "fec(TXB)"),
FEC_RES_IRQ((64 + 38), "fec(UN)"),
FEC_RES_IRQ((64 + 39), "fec(RL)"),
FEC_RES_IRQ((64 + 40), "fec(RXF)"),
FEC_RES_IRQ((64 + 41), "fec(RXB)"),
FEC_RES_IRQ((64 + 42), "fec(MII)"),
FEC_RES_IRQ((64 + 43), "fec(LC)"),
FEC_RES_IRQ((64 + 44), "fec(HBERR)"),
FEC_RES_IRQ((64 + 45), "fec(GRA)"),
FEC_RES_IRQ((64 + 46), "fec(EBERR)"),
FEC_RES_IRQ((64 + 47), "fec(BABT)"),
FEC_RES_IRQ((64 + 48), "fec(BABR)"),
},
};
int fec_platform_init(void)
{
volatile unsigned char *icrp;
volatile unsigned long *imrp;
int i;
icrp = (volatile unsigned char *)(MCF_IPSBAR+MCFICM_INTC0+MCFINTC_ICR0);
for (i = 36; i < 49; i++)
icrp[i] = 0x04;
imrp = (volatile unsigned long *)(MCF_IPSBAR+MCFICM_INTC0+MCFINTC_IMRH);
*imrp &= ~0x0001FFF0;
*(volatile unsigned char *)(MCF_IPSBAR+MCF_GPIO_PAR_FEC) |= 0xf0;
*(volatile unsigned char *)(MCF_IPSBAR+MCF_GPIO_PAR_FECI2C) |= 0x0f;
return platform_device_register(&m520x_fec_pdev);
}
void fec_platform_cleanup(void)
{
platform_device_unregister(&m520x_fec_pdev);
}
#endif
|