Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
907c51b2
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
907c51b2
编写于
11月 05, 2006
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] Ocelot C: Fix MAC address detection after platform_device conversion.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
d6b861c6
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
202 addition
and
180 deletion
+202
-180
arch/mips/momentum/ocelot_c/Makefile
arch/mips/momentum/ocelot_c/Makefile
+1
-1
arch/mips/momentum/ocelot_c/platform.c
arch/mips/momentum/ocelot_c/platform.c
+201
-0
arch/mips/momentum/ocelot_c/prom.c
arch/mips/momentum/ocelot_c/prom.c
+0
-58
arch/mips/momentum/ocelot_c/setup.c
arch/mips/momentum/ocelot_c/setup.c
+0
-121
未找到文件。
arch/mips/momentum/ocelot_c/Makefile
浏览文件 @
907c51b2
...
...
@@ -2,7 +2,7 @@
# Makefile for Momentum Computer's Ocelot-C and -CS boards.
#
obj-y
+=
cpci-irq.o irq.o prom.o reset.o
\
obj-y
+=
cpci-irq.o irq.o p
latform.o p
rom.o reset.o
\
setup.o uart-irq.o
obj-$(CONFIG_KGDB)
+=
dbg_io.o
arch/mips/momentum/ocelot_c/platform.c
0 → 100644
浏览文件 @
907c51b2
#include <linux/delay.h>
#include <linux/if_ether.h>
#include <linux/ioport.h>
#include <linux/mv643xx.h>
#include <linux/platform_device.h>
#include "ocelot_c_fpga.h"
#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
static
struct
resource
mv643xx_eth_shared_resources
[]
=
{
[
0
]
=
{
.
name
=
"ethernet shared base"
,
.
start
=
0xf1000000
+
MV643XX_ETH_SHARED_REGS
,
.
end
=
0xf1000000
+
MV643XX_ETH_SHARED_REGS
+
MV643XX_ETH_SHARED_REGS_SIZE
-
1
,
.
flags
=
IORESOURCE_MEM
,
},
};
static
struct
platform_device
mv643xx_eth_shared_device
=
{
.
name
=
MV643XX_ETH_SHARED_NAME
,
.
id
=
0
,
.
num_resources
=
ARRAY_SIZE
(
mv643xx_eth_shared_resources
),
.
resource
=
mv643xx_eth_shared_resources
,
};
#define MV_SRAM_BASE 0xfe000000UL
#define MV_SRAM_SIZE (256 * 1024)
#define MV_SRAM_RXRING_SIZE (MV_SRAM_SIZE / 4)
#define MV_SRAM_TXRING_SIZE (MV_SRAM_SIZE / 4)
#define MV_SRAM_BASE_ETH0 MV_SRAM_BASE
#define MV_SRAM_BASE_ETH1 (MV_SRAM_BASE + (MV_SRAM_SIZE / 2))
#define MV64x60_IRQ_ETH_0 48
#define MV64x60_IRQ_ETH_1 49
#ifdef CONFIG_MV643XX_ETH_0
static
struct
resource
mv64x60_eth0_resources
[]
=
{
[
0
]
=
{
.
name
=
"eth0 irq"
,
.
start
=
MV64x60_IRQ_ETH_0
,
.
end
=
MV64x60_IRQ_ETH_0
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
char
eth0_mac_addr
[
ETH_ALEN
];
static
struct
mv643xx_eth_platform_data
eth0_pd
=
{
.
mac_addr
=
eth0_mac_addr
,
.
tx_sram_addr
=
MV_SRAM_BASE_ETH0
,
.
tx_sram_size
=
MV_SRAM_TXRING_SIZE
,
.
tx_queue_size
=
MV_SRAM_TXRING_SIZE
/
16
,
.
rx_sram_addr
=
MV_SRAM_BASE_ETH0
+
MV_SRAM_TXRING_SIZE
,
.
rx_sram_size
=
MV_SRAM_RXRING_SIZE
,
.
rx_queue_size
=
MV_SRAM_RXRING_SIZE
/
16
,
};
static
struct
platform_device
eth0_device
=
{
.
name
=
MV643XX_ETH_NAME
,
.
id
=
0
,
.
num_resources
=
ARRAY_SIZE
(
mv64x60_eth0_resources
),
.
resource
=
mv64x60_eth0_resources
,
.
dev
=
{
.
platform_data
=
&
eth0_pd
,
},
};
#endif
/* CONFIG_MV643XX_ETH_0 */
#ifdef CONFIG_MV643XX_ETH_1
static
struct
resource
mv64x60_eth1_resources
[]
=
{
[
0
]
=
{
.
name
=
"eth1 irq"
,
.
start
=
MV64x60_IRQ_ETH_1
,
.
end
=
MV64x60_IRQ_ETH_1
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
char
eth1_mac_addr
[
ETH_ALEN
];
static
struct
mv643xx_eth_platform_data
eth1_pd
=
{
.
mac_addr
=
eth1_mac_addr
,
.
tx_sram_addr
=
MV_SRAM_BASE_ETH1
,
.
tx_sram_size
=
MV_SRAM_TXRING_SIZE
,
.
tx_queue_size
=
MV_SRAM_TXRING_SIZE
/
16
,
.
rx_sram_addr
=
MV_SRAM_BASE_ETH1
+
MV_SRAM_TXRING_SIZE
,
.
rx_sram_size
=
MV_SRAM_RXRING_SIZE
,
.
rx_queue_size
=
MV_SRAM_RXRING_SIZE
/
16
,
};
static
struct
platform_device
eth1_device
=
{
.
name
=
MV643XX_ETH_NAME
,
.
id
=
1
,
.
num_resources
=
ARRAY_SIZE
(
mv64x60_eth1_resources
),
.
resource
=
mv64x60_eth1_resources
,
.
dev
=
{
.
platform_data
=
&
eth1_pd
,
},
};
#endif
/* CONFIG_MV643XX_ETH_1 */
static
struct
platform_device
*
mv643xx_eth_pd_devs
[]
__initdata
=
{
&
mv643xx_eth_shared_device
,
#ifdef CONFIG_MV643XX_ETH_0
&
eth0_device
,
#endif
#ifdef CONFIG_MV643XX_ETH_1
&
eth1_device
,
#endif
/* The third port is not wired up on the Ocelot C */
};
static
u8
__init
exchange_bit
(
u8
val
,
u8
cs
)
{
/* place the data */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
,
EEPROM_MODE
);
udelay
(
1
);
/* turn the clock on */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
|
0x2
,
EEPROM_MODE
);
udelay
(
1
);
/* turn the clock off and read-strobe */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
|
0x10
,
EEPROM_MODE
);
/* return the data */
return
(
OCELOT_FPGA_READ
(
EEPROM_MODE
)
>>
3
)
&
0x1
;
}
static
void
__init
get_mac
(
char
dest
[
6
])
{
u8
read_opcode
[
12
]
=
{
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
int
i
,
j
;
for
(
i
=
0
;
i
<
12
;
i
++
)
exchange_bit
(
read_opcode
[
i
],
1
);
for
(
j
=
0
;
j
<
6
;
j
++
)
{
dest
[
j
]
=
0
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
dest
[
j
]
<<=
1
;
dest
[
j
]
|=
exchange_bit
(
0
,
1
);
}
}
/* turn off CS */
exchange_bit
(
0
,
0
);
}
/*
* Copy and increment ethernet MAC address by a small value.
*
* This is useful for systems where the only one MAC address is stored in
* non-volatile memory for multiple ports.
*/
static
inline
void
eth_mac_add
(
unsigned
char
*
dst
,
unsigned
char
*
src
,
unsigned
int
add
)
{
int
i
;
BUG_ON
(
add
>=
256
);
for
(
i
=
ETH_ALEN
;
i
>=
0
;
i
--
)
{
dst
[
i
]
=
src
[
i
]
+
add
;
add
=
dst
[
i
]
<
src
[
i
];
/* compute carry */
}
WARN_ON
(
add
);
}
static
int
__init
mv643xx_eth_add_pds
(
void
)
{
unsigned
char
mac
[
ETH_ALEN
];
int
ret
;
get_mac
(
mac
);
#ifdef CONFIG_MV643XX_ETH_0
eth_mac_add
(
eth1_mac_addr
,
mac
,
0
);
#endif
#ifdef CONFIG_MV643XX_ETH_1
eth_mac_add
(
eth1_mac_addr
,
mac
,
1
);
#endif
ret
=
platform_add_devices
(
mv643xx_eth_pd_devs
,
ARRAY_SIZE
(
mv643xx_eth_pd_devs
));
return
ret
;
}
device_initcall
(
mv643xx_eth_add_pds
);
#endif
/* defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) */
arch/mips/momentum/ocelot_c/prom.c
浏览文件 @
907c51b2
...
...
@@ -31,10 +31,6 @@ struct callvectors* debug_vectors;
extern
unsigned
long
marvell_base
;
extern
unsigned
int
cpu_clock
;
#ifdef CONFIG_MV643XX_ETH
extern
unsigned
char
prom_mac_addr_base
[
6
];
#endif
const
char
*
get_system_type
(
void
)
{
#ifdef CONFIG_CPU_SR71000
...
...
@@ -44,55 +40,6 @@ const char *get_system_type(void)
#endif
}
#ifdef CONFIG_MV643XX_ETH
static
void
burn_clocks
(
void
)
{
int
i
;
/* this loop should burn at least 1us -- this should be plenty */
for
(
i
=
0
;
i
<
0x10000
;
i
++
)
;
}
static
u8
exchange_bit
(
u8
val
,
u8
cs
)
{
/* place the data */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
,
EEPROM_MODE
);
burn_clocks
();
/* turn the clock on */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
|
0x2
,
EEPROM_MODE
);
burn_clocks
();
/* turn the clock off and read-strobe */
OCELOT_FPGA_WRITE
((
val
<<
2
)
|
cs
|
0x10
,
EEPROM_MODE
);
/* return the data */
return
((
OCELOT_FPGA_READ
(
EEPROM_MODE
)
>>
3
)
&
0x1
);
}
void
get_mac
(
char
dest
[
6
])
{
u8
read_opcode
[
12
]
=
{
1
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
int
i
,
j
;
for
(
i
=
0
;
i
<
12
;
i
++
)
exchange_bit
(
read_opcode
[
i
],
1
);
for
(
j
=
0
;
j
<
6
;
j
++
)
{
dest
[
j
]
=
0
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
dest
[
j
]
<<=
1
;
dest
[
j
]
|=
exchange_bit
(
0
,
1
);
}
}
/* turn off CS */
exchange_bit
(
0
,
0
);
}
#endif
#ifdef CONFIG_64BIT
unsigned
long
signext
(
unsigned
long
addr
)
...
...
@@ -226,11 +173,6 @@ void __init prom_init(void)
mips_machgroup
=
MACH_GROUP_MOMENCO
;
mips_machtype
=
MACH_MOMENCO_OCELOT_C
;
#ifdef CONFIG_MV643XX_ETH
/* get the base MAC address for on-board ethernet ports */
get_mac
(
prom_mac_addr_base
);
#endif
#ifndef CONFIG_64BIT
debug_vectors
->
printf
(
"Booting Linux kernel...
\n
"
);
#endif
...
...
arch/mips/momentum/ocelot_c/setup.c
浏览文件 @
907c51b2
...
...
@@ -50,7 +50,6 @@
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/timex.h>
#include <linux/vmalloc.h>
...
...
@@ -361,123 +360,3 @@ static int io_base_ioremap(void)
}
module_init
(
io_base_ioremap
);
#if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
static
struct
resource
mv643xx_eth_shared_resources
[]
=
{
[
0
]
=
{
.
name
=
"ethernet shared base"
,
.
start
=
0xf1000000
+
MV643XX_ETH_SHARED_REGS
,
.
end
=
0xf1000000
+
MV643XX_ETH_SHARED_REGS
+
MV643XX_ETH_SHARED_REGS_SIZE
-
1
,
.
flags
=
IORESOURCE_MEM
,
},
};
static
struct
platform_device
mv643xx_eth_shared_device
=
{
.
name
=
MV643XX_ETH_SHARED_NAME
,
.
id
=
0
,
.
num_resources
=
ARRAY_SIZE
(
mv643xx_eth_shared_resources
),
.
resource
=
mv643xx_eth_shared_resources
,
};
#define MV_SRAM_BASE 0xfe000000UL
#define MV_SRAM_SIZE (256 * 1024)
#define MV_SRAM_RXRING_SIZE (MV_SRAM_SIZE / 4)
#define MV_SRAM_TXRING_SIZE (MV_SRAM_SIZE / 4)
#define MV_SRAM_BASE_ETH0 MV_SRAM_BASE
#define MV_SRAM_BASE_ETH1 (MV_SRAM_BASE + (MV_SRAM_SIZE / 2))
#define MV64x60_IRQ_ETH_0 48
#define MV64x60_IRQ_ETH_1 49
#ifdef CONFIG_MV643XX_ETH_0
static
struct
resource
mv64x60_eth0_resources
[]
=
{
[
0
]
=
{
.
name
=
"eth0 irq"
,
.
start
=
MV64x60_IRQ_ETH_0
,
.
end
=
MV64x60_IRQ_ETH_0
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
struct
mv643xx_eth_platform_data
eth0_pd
=
{
.
tx_sram_addr
=
MV_SRAM_BASE_ETH0
,
.
tx_sram_size
=
MV_SRAM_TXRING_SIZE
,
.
tx_queue_size
=
MV_SRAM_TXRING_SIZE
/
16
,
.
rx_sram_addr
=
MV_SRAM_BASE_ETH0
+
MV_SRAM_TXRING_SIZE
,
.
rx_sram_size
=
MV_SRAM_RXRING_SIZE
,
.
rx_queue_size
=
MV_SRAM_RXRING_SIZE
/
16
,
};
static
struct
platform_device
eth0_device
=
{
.
name
=
MV643XX_ETH_NAME
,
.
id
=
0
,
.
num_resources
=
ARRAY_SIZE
(
mv64x60_eth0_resources
),
.
resource
=
mv64x60_eth0_resources
,
.
dev
=
{
.
platform_data
=
&
eth0_pd
,
},
};
#endif
/* CONFIG_MV643XX_ETH_0 */
#ifdef CONFIG_MV643XX_ETH_1
static
struct
resource
mv64x60_eth1_resources
[]
=
{
[
0
]
=
{
.
name
=
"eth1 irq"
,
.
start
=
MV64x60_IRQ_ETH_1
,
.
end
=
MV64x60_IRQ_ETH_1
,
.
flags
=
IORESOURCE_IRQ
,
},
};
static
struct
mv643xx_eth_platform_data
eth1_pd
=
{
.
tx_sram_addr
=
MV_SRAM_BASE_ETH1
,
.
tx_sram_size
=
MV_SRAM_TXRING_SIZE
,
.
tx_queue_size
=
MV_SRAM_TXRING_SIZE
/
16
,
.
rx_sram_addr
=
MV_SRAM_BASE_ETH1
+
MV_SRAM_TXRING_SIZE
,
.
rx_sram_size
=
MV_SRAM_RXRING_SIZE
,
.
rx_queue_size
=
MV_SRAM_RXRING_SIZE
/
16
,
};
static
struct
platform_device
eth1_device
=
{
.
name
=
MV643XX_ETH_NAME
,
.
id
=
1
,
.
num_resources
=
ARRAY_SIZE
(
mv64x60_eth1_resources
),
.
resource
=
mv64x60_eth1_resources
,
.
dev
=
{
.
platform_data
=
&
eth1_pd
,
},
};
#endif
/* CONFIG_MV643XX_ETH_1 */
static
struct
platform_device
*
mv643xx_eth_pd_devs
[]
__initdata
=
{
&
mv643xx_eth_shared_device
,
#ifdef CONFIG_MV643XX_ETH_0
&
eth0_device
,
#endif
#ifdef CONFIG_MV643XX_ETH_1
&
eth1_device
,
#endif
/* The third port is not wired up on the Ocelot C */
};
int
mv643xx_eth_add_pds
(
void
)
{
int
ret
;
ret
=
platform_add_devices
(
mv643xx_eth_pd_devs
,
ARRAY_SIZE
(
mv643xx_eth_pd_devs
));
return
ret
;
}
device_initcall
(
mv643xx_eth_add_pds
);
#endif
/* defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE) */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录