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
120
121
122
123
124
125
126
127 | /*
* 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_M528x)
#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 m528x_fec_mac[] = {
0x00, 0xcf, 0x52, 0x82, 0xeb, 0x01,
};
#endif
static unsigned int m528x_fec_phy_id = CONFIG_MCF_FEC_PHY_ID1;
static struct platform_device m528x_fec_pdev = {
.name = "FEC",
.id = 0,
.num_resources = 17,
.resource = (struct resource[]) {
FEC_RES_MEM("CSR",
(unsigned long)(MCF_MBAR + 0x00001000),
(unsigned long)(MCF_MBAR + 0x000011ff)),
FEC_RES_MEM("MIB",
(unsigned long)(MCF_MBAR + 0x00001200),
(unsigned long)(MCF_MBAR + 0x000013ff)),
FEC_RES_MEM("MAC",
#if defined(CONFIG_MCF_FEC_MAC1)
(unsigned long)(MCF_MBAR + 0x000010E4),
(unsigned long)(MCF_MBAR + 0x000010EA)
#else
#if (CONFIG_MCF_FEC_MAC1_ADDR == 0)
(unsigned long)m528x_fec_mac,
(unsigned long)(m528x_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)(&m528x_fec_phy_id),
(unsigned long)(&m528x_fec_phy_id)),
FEC_RES_IRQ((64 + 23), "fec(TXF)"),
FEC_RES_IRQ((64 + 24), "fec(TXB)"),
FEC_RES_IRQ((64 + 25), "fec(UN)"),
FEC_RES_IRQ((64 + 26), "fec(RL)"),
FEC_RES_IRQ((64 + 27), "fec(RXF)"),
FEC_RES_IRQ((64 + 28), "fec(RXB)"),
FEC_RES_IRQ((64 + 29), "fec(MII)"),
FEC_RES_IRQ((64 + 30), "fec(LC)"),
FEC_RES_IRQ((64 + 31), "fec(HBERR)"),
FEC_RES_IRQ((64 + 32), "fec(GRA)"),
FEC_RES_IRQ((64 + 33), "fec(EBERR)"),
FEC_RES_IRQ((64 + 34), "fec(BABT)"),
FEC_RES_IRQ((64 + 35), "fec(BABR)"),
},
};
int fec_platform_init(void)
{
volatile unsigned char *icrp;
volatile unsigned long *imrp;
volatile unsigned short *gpio_paspar;
volatile unsigned char *gpio_pehlpar;
int i, ilip;
icrp = (volatile unsigned char *)(MCF_IPSBAR+MCFICM_INTC0+MCFINTC_ICR0);
for (i = 23, ilip = 0x28; i < 36; i++)
icrp[i] = ilip--;
imrp = (volatile unsigned long *)(MCF_IPSBAR+MCFICM_INTC0+MCFINTC_IMRH);
*imrp &= ~0x0000000f;
imrp = (volatile unsigned long *)(MCF_IPSBAR+MCFICM_INTC0+MCFINTC_IMRL);
*imrp &= ~0xff800001;
gpio_paspar = (volatile unsigned short *) (MCF_IPSBAR + 0x100056);
gpio_pehlpar = (volatile unsigned char *) (MCF_IPSBAR + 0x100058);
*gpio_paspar |= 0x0f00;
*gpio_pehlpar = 0xc0;
return platform_device_register(&m528x_fec_pdev);
}
void fec_platform_cleanup(void)
{
platform_device_unregister(&m528x_fec_pdev);
}
#endif
|