Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
ecd0a6f0
K
Kernel
项目概览
openeuler
/
Kernel
接近 2 年 前同步成功
通知
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看板
提交
ecd0a6f0
编写于
11月 28, 2012
作者:
B
Ben Hutchings
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sfc: Rename SPI stuff to show that it is Falcon-specific
Signed-off-by:
N
Ben Hutchings
<
bhutchings@solarflare.com
>
上级
964e6135
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
47 deletion
+47
-47
drivers/net/ethernet/sfc/falcon.c
drivers/net/ethernet/sfc/falcon.c
+15
-15
drivers/net/ethernet/sfc/mtd.c
drivers/net/ethernet/sfc/mtd.c
+21
-21
drivers/net/ethernet/sfc/nic.h
drivers/net/ethernet/sfc/nic.h
+2
-2
drivers/net/ethernet/sfc/spi.h
drivers/net/ethernet/sfc/spi.h
+9
-9
未找到文件。
drivers/net/ethernet/sfc/falcon.c
浏览文件 @
ecd0a6f0
...
...
@@ -434,7 +434,7 @@ static int falcon_spi_wait(struct efx_nic *efx)
}
}
int
falcon_spi_cmd
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
int
falcon_spi_cmd
(
struct
efx_nic
*
efx
,
const
struct
falcon
_spi_device
*
spi
,
unsigned
int
command
,
int
address
,
const
void
*
in
,
void
*
out
,
size_t
len
)
{
...
...
@@ -491,22 +491,22 @@ int falcon_spi_cmd(struct efx_nic *efx, const struct efx_spi_device *spi,
}
static
size_t
falcon_spi_write_limit
(
const
struct
efx
_spi_device
*
spi
,
size_t
start
)
falcon_spi_write_limit
(
const
struct
falcon
_spi_device
*
spi
,
size_t
start
)
{
return
min
(
FALCON_SPI_MAX_LEN
,
(
spi
->
block_size
-
(
start
&
(
spi
->
block_size
-
1
))));
}
static
inline
u8
efx_spi_munge_command
(
const
struct
efx
_spi_device
*
spi
,
const
u8
command
,
const
unsigned
int
address
)
falcon_spi_munge_command
(
const
struct
falcon
_spi_device
*
spi
,
const
u8
command
,
const
unsigned
int
address
)
{
return
command
|
(((
address
>>
8
)
&
spi
->
munge_address
)
<<
3
);
}
/* Wait up to 10 ms for buffered write completion */
int
falcon_spi_wait_write
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
)
falcon_spi_wait_write
(
struct
efx_nic
*
efx
,
const
struct
falcon
_spi_device
*
spi
)
{
unsigned
long
timeout
=
jiffies
+
1
+
DIV_ROUND_UP
(
HZ
,
100
);
u8
status
;
...
...
@@ -530,7 +530,7 @@ falcon_spi_wait_write(struct efx_nic *efx, const struct efx_spi_device *spi)
}
}
int
falcon_spi_read
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
int
falcon_spi_read
(
struct
efx_nic
*
efx
,
const
struct
falcon
_spi_device
*
spi
,
loff_t
start
,
size_t
len
,
size_t
*
retlen
,
u8
*
buffer
)
{
size_t
block_len
,
pos
=
0
;
...
...
@@ -540,7 +540,7 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
while
(
pos
<
len
)
{
block_len
=
min
(
len
-
pos
,
FALCON_SPI_MAX_LEN
);
command
=
efx
_spi_munge_command
(
spi
,
SPI_READ
,
start
+
pos
);
command
=
falcon
_spi_munge_command
(
spi
,
SPI_READ
,
start
+
pos
);
rc
=
falcon_spi_cmd
(
efx
,
spi
,
command
,
start
+
pos
,
NULL
,
buffer
+
pos
,
block_len
);
if
(
rc
)
...
...
@@ -561,7 +561,7 @@ int falcon_spi_read(struct efx_nic *efx, const struct efx_spi_device *spi,
}
int
falcon_spi_write
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
falcon_spi_write
(
struct
efx_nic
*
efx
,
const
struct
falcon
_spi_device
*
spi
,
loff_t
start
,
size_t
len
,
size_t
*
retlen
,
const
u8
*
buffer
)
{
u8
verify_buffer
[
FALCON_SPI_MAX_LEN
];
...
...
@@ -576,7 +576,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
block_len
=
min
(
len
-
pos
,
falcon_spi_write_limit
(
spi
,
start
+
pos
));
command
=
efx
_spi_munge_command
(
spi
,
SPI_WRITE
,
start
+
pos
);
command
=
falcon
_spi_munge_command
(
spi
,
SPI_WRITE
,
start
+
pos
);
rc
=
falcon_spi_cmd
(
efx
,
spi
,
command
,
start
+
pos
,
buffer
+
pos
,
NULL
,
block_len
);
if
(
rc
)
...
...
@@ -586,7 +586,7 @@ falcon_spi_write(struct efx_nic *efx, const struct efx_spi_device *spi,
if
(
rc
)
break
;
command
=
efx
_spi_munge_command
(
spi
,
SPI_READ
,
start
+
pos
);
command
=
falcon
_spi_munge_command
(
spi
,
SPI_READ
,
start
+
pos
);
rc
=
falcon_spi_cmd
(
efx
,
spi
,
command
,
start
+
pos
,
NULL
,
verify_buffer
,
block_len
);
if
(
memcmp
(
verify_buffer
,
buffer
+
pos
,
block_len
))
{
...
...
@@ -1481,15 +1481,15 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
{
struct
falcon_nic_data
*
nic_data
=
efx
->
nic_data
;
struct
falcon_nvconfig
*
nvconfig
;
struct
efx
_spi_device
*
spi
;
struct
falcon
_spi_device
*
spi
;
void
*
region
;
int
rc
,
magic_num
,
struct_ver
;
__le16
*
word
,
*
limit
;
u32
csum
;
if
(
efx
_spi_present
(
&
nic_data
->
spi_flash
))
if
(
falcon
_spi_present
(
&
nic_data
->
spi_flash
))
spi
=
&
nic_data
->
spi_flash
;
else
if
(
efx
_spi_present
(
&
nic_data
->
spi_eeprom
))
else
if
(
falcon
_spi_present
(
&
nic_data
->
spi_eeprom
))
spi
=
&
nic_data
->
spi_eeprom
;
else
return
-
EINVAL
;
...
...
@@ -1504,7 +1504,7 @@ falcon_read_nvram(struct efx_nic *efx, struct falcon_nvconfig *nvconfig_out)
mutex_unlock
(
&
nic_data
->
spi_lock
);
if
(
rc
)
{
netif_err
(
efx
,
hw
,
efx
->
net_dev
,
"Failed to read %s
\n
"
,
efx
_spi_present
(
&
nic_data
->
spi_flash
)
?
falcon
_spi_present
(
&
nic_data
->
spi_flash
)
?
"flash"
:
"EEPROM"
);
rc
=
-
EIO
;
goto
out
;
...
...
@@ -1849,7 +1849,7 @@ static int falcon_reset_sram(struct efx_nic *efx)
}
static
void
falcon_spi_device_init
(
struct
efx_nic
*
efx
,
struct
efx
_spi_device
*
spi_device
,
struct
falcon
_spi_device
*
spi_device
,
unsigned
int
device_id
,
u32
device_type
)
{
if
(
device_type
!=
0
)
{
...
...
drivers/net/ethernet/sfc/mtd.c
浏览文件 @
ecd0a6f0
...
...
@@ -22,7 +22,7 @@
#include "mcdi.h"
#include "mcdi_pcol.h"
#define
EFX
_SPI_VERIFY_BUF_LEN 16
#define
FALCON
_SPI_VERIFY_BUF_LEN 16
struct
efx_mtd_partition
{
struct
mtd_info
mtd
;
...
...
@@ -50,7 +50,7 @@ struct efx_mtd_ops {
struct
efx_mtd
{
struct
list_head
node
;
struct
efx_nic
*
efx
;
const
struct
efx
_spi_device
*
spi
;
const
struct
falcon
_spi_device
*
spi
;
const
char
*
name
;
const
struct
efx_mtd_ops
*
ops
;
size_t
n_parts
;
...
...
@@ -71,10 +71,10 @@ static int siena_mtd_probe(struct efx_nic *efx);
/* SPI utilities */
static
int
efx
_spi_slow_wait
(
struct
efx_mtd_partition
*
part
,
bool
uninterruptible
)
falcon
_spi_slow_wait
(
struct
efx_mtd_partition
*
part
,
bool
uninterruptible
)
{
struct
efx_mtd
*
efx_mtd
=
part
->
mtd
.
priv
;
const
struct
efx
_spi_device
*
spi
=
efx_mtd
->
spi
;
const
struct
falcon
_spi_device
*
spi
=
efx_mtd
->
spi
;
struct
efx_nic
*
efx
=
efx_mtd
->
efx
;
u8
status
;
int
rc
,
i
;
...
...
@@ -98,7 +98,7 @@ efx_spi_slow_wait(struct efx_mtd_partition *part, bool uninterruptible)
}
static
int
efx_spi_unlock
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
)
falcon_spi_unlock
(
struct
efx_nic
*
efx
,
const
struct
falcon
_spi_device
*
spi
)
{
const
u8
unlock_mask
=
(
SPI_STATUS_BP2
|
SPI_STATUS_BP1
|
SPI_STATUS_BP0
);
...
...
@@ -133,14 +133,14 @@ efx_spi_unlock(struct efx_nic *efx, const struct efx_spi_device *spi)
}
static
int
efx
_spi_erase
(
struct
efx_mtd_partition
*
part
,
loff_t
start
,
size_t
len
)
falcon
_spi_erase
(
struct
efx_mtd_partition
*
part
,
loff_t
start
,
size_t
len
)
{
struct
efx_mtd
*
efx_mtd
=
part
->
mtd
.
priv
;
const
struct
efx
_spi_device
*
spi
=
efx_mtd
->
spi
;
const
struct
falcon
_spi_device
*
spi
=
efx_mtd
->
spi
;
struct
efx_nic
*
efx
=
efx_mtd
->
efx
;
unsigned
pos
,
block_len
;
u8
empty
[
EFX
_SPI_VERIFY_BUF_LEN
];
u8
buffer
[
EFX
_SPI_VERIFY_BUF_LEN
];
u8
empty
[
FALCON
_SPI_VERIFY_BUF_LEN
];
u8
buffer
[
FALCON
_SPI_VERIFY_BUF_LEN
];
int
rc
;
if
(
len
!=
spi
->
erase_size
)
...
...
@@ -149,7 +149,7 @@ efx_spi_erase(struct efx_mtd_partition *part, loff_t start, size_t len)
if
(
spi
->
erase_command
==
0
)
return
-
EOPNOTSUPP
;
rc
=
efx
_spi_unlock
(
efx
,
spi
);
rc
=
falcon
_spi_unlock
(
efx
,
spi
);
if
(
rc
)
return
rc
;
rc
=
falcon_spi_cmd
(
efx
,
spi
,
SPI_WREN
,
-
1
,
NULL
,
NULL
,
0
);
...
...
@@ -159,7 +159,7 @@ efx_spi_erase(struct efx_mtd_partition *part, loff_t start, size_t len)
NULL
,
0
);
if
(
rc
)
return
rc
;
rc
=
efx
_spi_slow_wait
(
part
,
false
);
rc
=
falcon
_spi_slow_wait
(
part
,
false
);
/* Verify the entire region has been wiped */
memset
(
empty
,
0xff
,
sizeof
(
empty
));
...
...
@@ -319,7 +319,7 @@ static int falcon_mtd_read(struct mtd_info *mtd, loff_t start,
{
struct
efx_mtd_partition
*
part
=
to_efx_mtd_partition
(
mtd
);
struct
efx_mtd
*
efx_mtd
=
mtd
->
priv
;
const
struct
efx
_spi_device
*
spi
=
efx_mtd
->
spi
;
const
struct
falcon
_spi_device
*
spi
=
efx_mtd
->
spi
;
struct
efx_nic
*
efx
=
efx_mtd
->
efx
;
struct
falcon_nic_data
*
nic_data
=
efx
->
nic_data
;
int
rc
;
...
...
@@ -344,7 +344,7 @@ static int falcon_mtd_erase(struct mtd_info *mtd, loff_t start, size_t len)
rc
=
mutex_lock_interruptible
(
&
nic_data
->
spi_lock
);
if
(
rc
)
return
rc
;
rc
=
efx
_spi_erase
(
part
,
part
->
offset
+
start
,
len
);
rc
=
falcon
_spi_erase
(
part
,
part
->
offset
+
start
,
len
);
mutex_unlock
(
&
nic_data
->
spi_lock
);
return
rc
;
}
...
...
@@ -354,7 +354,7 @@ static int falcon_mtd_write(struct mtd_info *mtd, loff_t start,
{
struct
efx_mtd_partition
*
part
=
to_efx_mtd_partition
(
mtd
);
struct
efx_mtd
*
efx_mtd
=
mtd
->
priv
;
const
struct
efx
_spi_device
*
spi
=
efx_mtd
->
spi
;
const
struct
falcon
_spi_device
*
spi
=
efx_mtd
->
spi
;
struct
efx_nic
*
efx
=
efx_mtd
->
efx
;
struct
falcon_nic_data
*
nic_data
=
efx
->
nic_data
;
int
rc
;
...
...
@@ -377,7 +377,7 @@ static int falcon_mtd_sync(struct mtd_info *mtd)
int
rc
;
mutex_lock
(
&
nic_data
->
spi_lock
);
rc
=
efx
_spi_slow_wait
(
part
,
true
);
rc
=
falcon
_spi_slow_wait
(
part
,
true
);
mutex_unlock
(
&
nic_data
->
spi_lock
);
return
rc
;
}
...
...
@@ -392,14 +392,14 @@ static const struct efx_mtd_ops falcon_mtd_ops = {
static
int
falcon_mtd_probe
(
struct
efx_nic
*
efx
)
{
struct
falcon_nic_data
*
nic_data
=
efx
->
nic_data
;
struct
efx
_spi_device
*
spi
;
struct
falcon
_spi_device
*
spi
;
struct
efx_mtd
*
efx_mtd
;
int
rc
=
-
ENODEV
;
ASSERT_RTNL
();
spi
=
&
nic_data
->
spi_flash
;
if
(
efx
_spi_present
(
spi
)
&&
spi
->
size
>
FALCON_FLASH_BOOTCODE_START
)
{
if
(
falcon
_spi_present
(
spi
)
&&
spi
->
size
>
FALCON_FLASH_BOOTCODE_START
)
{
efx_mtd
=
kzalloc
(
sizeof
(
*
efx_mtd
)
+
sizeof
(
efx_mtd
->
part
[
0
]),
GFP_KERNEL
);
if
(
!
efx_mtd
)
...
...
@@ -425,7 +425,7 @@ static int falcon_mtd_probe(struct efx_nic *efx)
}
spi
=
&
nic_data
->
spi_eeprom
;
if
(
efx_spi_present
(
spi
)
&&
spi
->
size
>
EFX
_EEPROM_BOOTCONFIG_START
)
{
if
(
falcon_spi_present
(
spi
)
&&
spi
->
size
>
FALCON
_EEPROM_BOOTCONFIG_START
)
{
efx_mtd
=
kzalloc
(
sizeof
(
*
efx_mtd
)
+
sizeof
(
efx_mtd
->
part
[
0
]),
GFP_KERNEL
);
if
(
!
efx_mtd
)
...
...
@@ -439,10 +439,10 @@ static int falcon_mtd_probe(struct efx_nic *efx)
efx_mtd
->
part
[
0
].
mtd
.
type
=
MTD_RAM
;
efx_mtd
->
part
[
0
].
mtd
.
flags
=
MTD_CAP_RAM
;
efx_mtd
->
part
[
0
].
mtd
.
size
=
min
(
spi
->
size
,
EFX
_EEPROM_BOOTCONFIG_END
)
-
EFX
_EEPROM_BOOTCONFIG_START
;
min
(
spi
->
size
,
FALCON
_EEPROM_BOOTCONFIG_END
)
-
FALCON
_EEPROM_BOOTCONFIG_START
;
efx_mtd
->
part
[
0
].
mtd
.
erasesize
=
spi
->
erase_size
;
efx_mtd
->
part
[
0
].
offset
=
EFX
_EEPROM_BOOTCONFIG_START
;
efx_mtd
->
part
[
0
].
offset
=
FALCON
_EEPROM_BOOTCONFIG_START
;
efx_mtd
->
part
[
0
].
type_name
=
"sfc_bootconfig"
;
rc
=
efx_mtd_probe_device
(
efx
,
efx_mtd
);
...
...
drivers/net/ethernet/sfc/nic.h
浏览文件 @
ecd0a6f0
...
...
@@ -184,8 +184,8 @@ struct falcon_nic_data {
bool
stats_pending
;
struct
timer_list
stats_timer
;
u32
*
stats_dma_done
;
struct
efx
_spi_device
spi_flash
;
struct
efx
_spi_device
spi_eeprom
;
struct
falcon
_spi_device
spi_flash
;
struct
falcon
_spi_device
spi_eeprom
;
struct
mutex
spi_lock
;
struct
mutex
mdio_lock
;
bool
xmac_poll_required
;
...
...
drivers/net/ethernet/sfc/spi.h
浏览文件 @
ecd0a6f0
...
...
@@ -35,7 +35,7 @@
#define SPI_STATUS_NRDY 0x01
/* Device busy flag */
/**
* struct
efx_spi_device - an Efx
SPI (Serial Peripheral Interface) device
* struct
falcon_spi_device - a Falcon
SPI (Serial Peripheral Interface) device
* @device_id: Controller's id for the device
* @size: Size (in bytes)
* @addr_len: Number of address bytes in read/write commands
...
...
@@ -51,7 +51,7 @@
* @block_size: Write block size (in bytes).
* Write commands are limited to blocks with this size and alignment.
*/
struct
efx
_spi_device
{
struct
falcon
_spi_device
{
int
device_id
;
unsigned
int
size
;
unsigned
int
addr_len
;
...
...
@@ -61,21 +61,21 @@ struct efx_spi_device {
unsigned
int
block_size
;
};
static
inline
bool
efx_spi_present
(
const
struct
efx
_spi_device
*
spi
)
static
inline
bool
falcon_spi_present
(
const
struct
falcon
_spi_device
*
spi
)
{
return
spi
->
size
!=
0
;
}
int
falcon_spi_cmd
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
unsigned
int
command
,
const
struct
falcon
_spi_device
*
spi
,
unsigned
int
command
,
int
address
,
const
void
*
in
,
void
*
out
,
size_t
len
);
int
falcon_spi_wait_write
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
);
const
struct
falcon
_spi_device
*
spi
);
int
falcon_spi_read
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
loff_t
start
,
const
struct
falcon
_spi_device
*
spi
,
loff_t
start
,
size_t
len
,
size_t
*
retlen
,
u8
*
buffer
);
int
falcon_spi_write
(
struct
efx_nic
*
efx
,
const
struct
efx
_spi_device
*
spi
,
loff_t
start
,
const
struct
falcon
_spi_device
*
spi
,
loff_t
start
,
size_t
len
,
size_t
*
retlen
,
const
u8
*
buffer
);
/*
...
...
@@ -93,7 +93,7 @@ int falcon_spi_write(struct efx_nic *efx,
*/
#define FALCON_NVCONFIG_END 0x400U
#define FALCON_FLASH_BOOTCODE_START 0x8000U
#define
EFX
_EEPROM_BOOTCONFIG_START 0x800U
#define
EFX
_EEPROM_BOOTCONFIG_END 0x1800U
#define
FALCON
_EEPROM_BOOTCONFIG_START 0x800U
#define
FALCON
_EEPROM_BOOTCONFIG_END 0x1800U
#endif
/* EFX_SPI_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录