Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
ab1f5e49
Commit
ab1f5e49
authored
Aug 28, 2009
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
parents
3161e453
11ebd1bf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
53 deletions
+67
-53
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/ipw2x00/ipw2200.c
+67
-53
No files found.
drivers/net/wireless/ipw2x00/ipw2200.c
View file @
ab1f5e49
...
@@ -2874,45 +2874,27 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
...
@@ -2874,45 +2874,27 @@ static int ipw_fw_dma_add_command_block(struct ipw_priv *priv,
return
0
;
return
0
;
}
}
static
int
ipw_fw_dma_add_buffer
(
struct
ipw_priv
*
priv
,
static
int
ipw_fw_dma_add_buffer
(
struct
ipw_priv
*
priv
,
dma_addr_t
*
src_address
,
u32
src_phys
,
u32
dest_address
,
u32
length
)
int
nr
,
u32
dest_address
,
u32
len
)
{
{
u32
bytes_left
=
length
;
int
ret
,
i
;
u32
src_offset
=
0
;
u32
size
;
u32
dest_offset
=
0
;
int
status
=
0
;
IPW_DEBUG_FW
(
">>
\n
"
);
IPW_DEBUG_FW
(
">>
\n
"
);
IPW_DEBUG_FW_INFO
(
"src_phys=0x%x dest_address=0x%x length=0x%x
\n
"
,
IPW_DEBUG_FW_INFO
(
"nr=%d dest_address=0x%x len=0x%x
\n
"
,
src_phys
,
dest_address
,
length
);
nr
,
dest_address
,
len
);
while
(
bytes_left
>
CB_MAX_LENGTH
)
{
status
=
ipw_fw_dma_add_command_block
(
priv
,
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
src_phys
+
src_offset
,
size
=
min_t
(
u32
,
len
-
i
*
CB_MAX_LENGTH
,
CB_MAX_LENGTH
);
ret
=
ipw_fw_dma_add_command_block
(
priv
,
src_address
[
i
],
dest_address
+
dest_address
+
dest_offset
,
i
*
CB_MAX_LENGTH
,
size
,
CB_MAX_LENGTH
,
0
,
0
);
0
,
0
);
if
(
status
)
{
if
(
ret
)
{
IPW_DEBUG_FW_INFO
(
": Failed
\n
"
);
IPW_DEBUG_FW_INFO
(
": Failed
\n
"
);
return
-
1
;
return
-
1
;
}
else
}
else
IPW_DEBUG_FW_INFO
(
": Added new cb
\n
"
);
IPW_DEBUG_FW_INFO
(
": Added new cb
\n
"
);
src_offset
+=
CB_MAX_LENGTH
;
dest_offset
+=
CB_MAX_LENGTH
;
bytes_left
-=
CB_MAX_LENGTH
;
}
/* add the buffer tail */
if
(
bytes_left
>
0
)
{
status
=
ipw_fw_dma_add_command_block
(
priv
,
src_phys
+
src_offset
,
dest_address
+
dest_offset
,
bytes_left
,
0
,
0
);
if
(
status
)
{
IPW_DEBUG_FW_INFO
(
": Failed on the buffer tail
\n
"
);
return
-
1
;
}
else
IPW_DEBUG_FW_INFO
(
": Adding new cb - the buffer tail
\n
"
);
}
}
IPW_DEBUG_FW
(
"<<
\n
"
);
IPW_DEBUG_FW
(
"<<
\n
"
);
...
@@ -3160,59 +3142,91 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
...
@@ -3160,59 +3142,91 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len)
static
int
ipw_load_firmware
(
struct
ipw_priv
*
priv
,
u8
*
data
,
size_t
len
)
static
int
ipw_load_firmware
(
struct
ipw_priv
*
priv
,
u8
*
data
,
size_t
len
)
{
{
int
r
c
=
-
1
;
int
r
et
=
-
1
;
int
offset
=
0
;
int
offset
=
0
;
struct
fw_chunk
*
chunk
;
struct
fw_chunk
*
chunk
;
dma_addr_t
shared_phys
;
int
total_nr
=
0
;
u8
*
shared_virt
;
int
i
;
struct
pci_pool
*
pool
;
u32
*
virts
[
CB_NUMBER_OF_ELEMENTS_SMALL
];
dma_addr_t
phys
[
CB_NUMBER_OF_ELEMENTS_SMALL
];
IPW_DEBUG_TRACE
(
"<< :
\n
"
);
IPW_DEBUG_TRACE
(
"<< :
\n
"
);
shared_virt
=
pci_alloc_consistent
(
priv
->
pci_dev
,
len
,
&
shared_phys
);
if
(
!
shared_virt
)
pool
=
pci_pool_create
(
"ipw2200"
,
priv
->
pci_dev
,
CB_MAX_LENGTH
,
0
,
0
);
if
(
!
pool
)
{
IPW_ERROR
(
"pci_pool_create failed
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
memmove
(
shared_virt
,
data
,
len
);
/* Start the Dma */
/* Start the Dma */
r
c
=
ipw_fw_dma_enable
(
priv
);
r
et
=
ipw_fw_dma_enable
(
priv
);
/* the DMA is already ready this would be a bug. */
/* the DMA is already ready this would be a bug. */
BUG_ON
(
priv
->
sram_desc
.
last_cb_index
>
0
);
BUG_ON
(
priv
->
sram_desc
.
last_cb_index
>
0
);
do
{
do
{
u32
chunk_len
;
u8
*
start
;
int
size
;
int
nr
=
0
;
chunk
=
(
struct
fw_chunk
*
)(
data
+
offset
);
chunk
=
(
struct
fw_chunk
*
)(
data
+
offset
);
offset
+=
sizeof
(
struct
fw_chunk
);
offset
+=
sizeof
(
struct
fw_chunk
);
chunk_len
=
le32_to_cpu
(
chunk
->
length
);
start
=
data
+
offset
;
nr
=
(
chunk_len
+
CB_MAX_LENGTH
-
1
)
/
CB_MAX_LENGTH
;
for
(
i
=
0
;
i
<
nr
;
i
++
)
{
virts
[
total_nr
]
=
pci_pool_alloc
(
pool
,
GFP_KERNEL
,
&
phys
[
total_nr
]);
if
(
!
virts
[
total_nr
])
{
ret
=
-
ENOMEM
;
goto
out
;
}
size
=
min_t
(
u32
,
chunk_len
-
i
*
CB_MAX_LENGTH
,
CB_MAX_LENGTH
);
memcpy
(
virts
[
total_nr
],
start
,
size
);
start
+=
size
;
total_nr
++
;
/* We don't support fw chunk larger than 64*8K */
BUG_ON
(
total_nr
>
CB_NUMBER_OF_ELEMENTS_SMALL
);
}
/* build DMA packet and queue up for sending */
/* build DMA packet and queue up for sending */
/* dma to chunk->address, the chunk->length bytes from data +
/* dma to chunk->address, the chunk->length bytes from data +
* offeset*/
* offeset*/
/* Dma loading */
/* Dma loading */
r
c
=
ipw_fw_dma_add_buffer
(
priv
,
shared_phys
+
offset
,
r
et
=
ipw_fw_dma_add_buffer
(
priv
,
&
phys
[
total_nr
-
nr
]
,
le32_to_cpu
(
chunk
->
address
),
nr
,
le32_to_cpu
(
chunk
->
address
),
le32_to_cpu
(
chunk
->
length
)
);
chunk_len
);
if
(
r
c
)
{
if
(
r
et
)
{
IPW_DEBUG_INFO
(
"dmaAddBuffer Failed
\n
"
);
IPW_DEBUG_INFO
(
"dmaAddBuffer Failed
\n
"
);
goto
out
;
goto
out
;
}
}
offset
+=
le32_to_cpu
(
chunk
->
length
)
;
offset
+=
chunk_len
;
}
while
(
offset
<
len
);
}
while
(
offset
<
len
);
/* Run the DMA and wait for the answer */
/* Run the DMA and wait for the answer */
r
c
=
ipw_fw_dma_kick
(
priv
);
r
et
=
ipw_fw_dma_kick
(
priv
);
if
(
r
c
)
{
if
(
r
et
)
{
IPW_ERROR
(
"dmaKick Failed
\n
"
);
IPW_ERROR
(
"dmaKick Failed
\n
"
);
goto
out
;
goto
out
;
}
}
r
c
=
ipw_fw_dma_wait
(
priv
);
r
et
=
ipw_fw_dma_wait
(
priv
);
if
(
r
c
)
{
if
(
r
et
)
{
IPW_ERROR
(
"dmaWaitSync Failed
\n
"
);
IPW_ERROR
(
"dmaWaitSync Failed
\n
"
);
goto
out
;
goto
out
;
}
}
out:
out:
pci_free_consistent
(
priv
->
pci_dev
,
len
,
shared_virt
,
shared_phys
);
for
(
i
=
0
;
i
<
total_nr
;
i
++
)
return
rc
;
pci_pool_free
(
pool
,
virts
[
i
],
phys
[
i
]);
pci_pool_destroy
(
pool
);
return
ret
;
}
}
/* stop nic */
/* stop nic */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment