Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a2f74a7d
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a2f74a7d
编写于
1月 06, 2013
作者:
R
Rafał Miłecki
提交者:
Artem Bityutskiy
2月 04, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mtd: bcm47xxsflash: add own struct for abstrating bus type
Signed-off-by:
N
Rafał Miłecki
<
zajec5@gmail.com
>
上级
396afe55
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
40 addition
and
13 deletion
+40
-13
drivers/mtd/devices/bcm47xxsflash.c
drivers/mtd/devices/bcm47xxsflash.c
+24
-13
drivers/mtd/devices/bcm47xxsflash.h
drivers/mtd/devices/bcm47xxsflash.h
+15
-0
include/linux/bcma/bcma_driver_chipcommon.h
include/linux/bcma/bcma_driver_chipcommon.h
+1
-0
未找到文件。
drivers/mtd/devices/bcm47xxsflash.c
浏览文件 @
a2f74a7d
...
...
@@ -5,6 +5,8 @@
#include <linux/platform_device.h>
#include <linux/bcma/bcma.h>
#include "bcm47xxsflash.h"
MODULE_LICENSE
(
"GPL"
);
MODULE_DESCRIPTION
(
"Serial flash driver for BCMA bus"
);
...
...
@@ -13,26 +15,27 @@ static const char *probes[] = { "bcm47xxpart", NULL };
static
int
bcm47xxsflash_read
(
struct
mtd_info
*
mtd
,
loff_t
from
,
size_t
len
,
size_t
*
retlen
,
u_char
*
buf
)
{
struct
bcm
a_sflash
*
sflash
=
mtd
->
priv
;
struct
bcm
47xxsflash
*
b47s
=
mtd
->
priv
;
/* Check address range */
if
((
from
+
len
)
>
mtd
->
size
)
return
-
EINVAL
;
memcpy_fromio
(
buf
,
(
void
__iomem
*
)
KSEG0ADDR
(
sflash
->
window
+
from
),
memcpy_fromio
(
buf
,
(
void
__iomem
*
)
KSEG0ADDR
(
b47s
->
window
+
from
),
len
);
return
len
;
}
static
void
bcm47xxsflash_fill_mtd
(
struct
bcma_sflash
*
sflash
,
struct
mtd_info
*
mtd
)
static
void
bcm47xxsflash_fill_mtd
(
struct
bcm47xxsflash
*
b47s
)
{
mtd
->
priv
=
sflash
;
struct
mtd_info
*
mtd
=
&
b47s
->
mtd
;
mtd
->
priv
=
b47s
;
mtd
->
name
=
"bcm47xxsflash"
;
mtd
->
owner
=
THIS_MODULE
;
mtd
->
type
=
MTD_ROM
;
mtd
->
size
=
sflash
->
size
;
mtd
->
size
=
b47s
->
size
;
mtd
->
_read
=
bcm47xxsflash_read
;
/* TODO: implement writing support and verify/change following code */
...
...
@@ -43,16 +46,23 @@ static void bcm47xxsflash_fill_mtd(struct bcma_sflash *sflash,
static
int
bcm47xxsflash_probe
(
struct
platform_device
*
pdev
)
{
struct
bcma_sflash
*
sflash
=
dev_get_platdata
(
&
pdev
->
dev
);
struct
bcm47xxsflash
*
b47s
;
int
err
;
sflash
->
mtd
=
kzalloc
(
sizeof
(
struct
mtd_info
),
GFP_KERNEL
);
if
(
!
sflash
->
mtd
)
{
b47s
=
kzalloc
(
sizeof
(
*
b47s
),
GFP_KERNEL
);
if
(
!
b47s
)
{
err
=
-
ENOMEM
;
goto
out
;
}
bcm47xxsflash_fill_mtd
(
sflash
,
sflash
->
mtd
);
sflash
->
priv
=
b47s
;
b47s
->
window
=
sflash
->
window
;
b47s
->
blocksize
=
sflash
->
blocksize
;
b47s
->
numblocks
=
sflash
->
numblocks
;
b47s
->
size
=
sflash
->
size
;
bcm47xxsflash_fill_mtd
(
b47s
);
err
=
mtd_device_parse_register
(
sflash
->
mtd
,
probes
,
NULL
,
NULL
,
0
);
err
=
mtd_device_parse_register
(
&
b47s
->
mtd
,
probes
,
NULL
,
NULL
,
0
);
if
(
err
)
{
pr_err
(
"Failed to register MTD device: %d
\n
"
,
err
);
goto
err_dev_reg
;
...
...
@@ -61,7 +71,7 @@ static int bcm47xxsflash_probe(struct platform_device *pdev)
return
0
;
err_dev_reg:
kfree
(
sflash
->
mtd
);
kfree
(
&
b47s
->
mtd
);
out:
return
err
;
}
...
...
@@ -69,9 +79,10 @@ static int bcm47xxsflash_probe(struct platform_device *pdev)
static
int
bcm47xxsflash_remove
(
struct
platform_device
*
pdev
)
{
struct
bcma_sflash
*
sflash
=
dev_get_platdata
(
&
pdev
->
dev
);
struct
bcm47xxsflash
*
b47s
=
sflash
->
priv
;
mtd_device_unregister
(
sflash
->
mtd
);
kfree
(
sflash
->
mtd
);
mtd_device_unregister
(
&
b47s
->
mtd
);
kfree
(
b47s
);
return
0
;
}
...
...
drivers/mtd/devices/bcm47xxsflash.h
0 → 100644
浏览文件 @
a2f74a7d
#ifndef __BCM47XXSFLASH_H
#define __BCM47XXSFLASH_H
#include <linux/mtd/mtd.h>
struct
bcm47xxsflash
{
u32
window
;
u32
blocksize
;
u16
numblocks
;
u32
size
;
struct
mtd_info
mtd
;
};
#endif
/* BCM47XXSFLASH */
include/linux/bcma/bcma_driver_chipcommon.h
浏览文件 @
a2f74a7d
...
...
@@ -528,6 +528,7 @@ struct bcma_sflash {
u32
size
;
struct
mtd_info
*
mtd
;
void
*
priv
;
};
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录