Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
c78ba3cf
Commit
c78ba3cf
authored
2 years ago
by
Thierry Reding
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'for-6.2/firmware' into for-6.2/clk
parents
9abf2313
b204b92b
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1546 additions
and
587 deletions
+1546
-587
drivers/firmware/tegra/bpmp-debugfs.c
drivers/firmware/tegra/bpmp-debugfs.c
+29
-33
drivers/firmware/tegra/bpmp-tegra186.c
drivers/firmware/tegra/bpmp-tegra186.c
+17
-19
drivers/firmware/tegra/bpmp-tegra210.c
drivers/firmware/tegra/bpmp-tegra210.c
+4
-3
drivers/firmware/tegra/bpmp.c
drivers/firmware/tegra/bpmp.c
+18
-15
drivers/firmware/tegra/ivc.c
drivers/firmware/tegra/ivc.c
+92
-58
drivers/thermal/tegra/tegra-bpmp-thermal.c
drivers/thermal/tegra/tegra-bpmp-thermal.c
+8
-7
include/soc/tegra/bpmp-abi.h
include/soc/tegra/bpmp-abi.h
+1357
-445
include/soc/tegra/bpmp.h
include/soc/tegra/bpmp.h
+15
-2
include/soc/tegra/ivc.h
include/soc/tegra/ivc.h
+6
-5
No files found.
drivers/firmware/tegra/bpmp-debugfs.c
View file @
c78ba3cf
...
@@ -48,13 +48,9 @@ static int seqbuf_read(struct seqbuf *seqbuf, void *buf, size_t nbyte)
...
@@ -48,13 +48,9 @@ static int seqbuf_read(struct seqbuf *seqbuf, void *buf, size_t nbyte)
return
seqbuf_status
(
seqbuf
);
return
seqbuf_status
(
seqbuf
);
}
}
static
int
seqbuf_read_u32
(
struct
seqbuf
*
seqbuf
,
u
int32_t
*
v
)
static
int
seqbuf_read_u32
(
struct
seqbuf
*
seqbuf
,
u
32
*
v
)
{
{
int
err
;
return
seqbuf_read
(
seqbuf
,
v
,
4
);
err
=
seqbuf_read
(
seqbuf
,
v
,
4
);
*
v
=
le32_to_cpu
(
*
v
);
return
err
;
}
}
static
int
seqbuf_read_str
(
struct
seqbuf
*
seqbuf
,
const
char
**
str
)
static
int
seqbuf_read_str
(
struct
seqbuf
*
seqbuf
,
const
char
**
str
)
...
@@ -109,10 +105,10 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
...
@@ -109,10 +105,10 @@ static const char *get_filename(struct tegra_bpmp *bpmp,
}
}
static
int
mrq_debug_open
(
struct
tegra_bpmp
*
bpmp
,
const
char
*
name
,
static
int
mrq_debug_open
(
struct
tegra_bpmp
*
bpmp
,
const
char
*
name
,
u
int32_t
*
fd
,
uint32_t
*
len
,
bool
write
)
u
32
*
fd
,
u32
*
len
,
bool
write
)
{
{
struct
mrq_debug_request
req
=
{
struct
mrq_debug_request
req
=
{
.
cmd
=
cpu_to_le32
(
write
?
CMD_DEBUG_OPEN_WO
:
CMD_DEBUG_OPEN_RO
)
,
.
cmd
=
write
?
CMD_DEBUG_OPEN_WO
:
CMD_DEBUG_OPEN_RO
,
};
};
struct
mrq_debug_response
resp
;
struct
mrq_debug_response
resp
;
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
...
@@ -147,10 +143,10 @@ static int mrq_debug_open(struct tegra_bpmp *bpmp, const char *name,
...
@@ -147,10 +143,10 @@ static int mrq_debug_open(struct tegra_bpmp *bpmp, const char *name,
return
0
;
return
0
;
}
}
static
int
mrq_debug_close
(
struct
tegra_bpmp
*
bpmp
,
u
int32_t
fd
)
static
int
mrq_debug_close
(
struct
tegra_bpmp
*
bpmp
,
u
32
fd
)
{
{
struct
mrq_debug_request
req
=
{
struct
mrq_debug_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUG_CLOSE
)
,
.
cmd
=
CMD_DEBUG_CLOSE
,
.
frd
=
{
.
frd
=
{
.
fd
=
fd
,
.
fd
=
fd
,
},
},
...
@@ -179,10 +175,10 @@ static int mrq_debug_close(struct tegra_bpmp *bpmp, uint32_t fd)
...
@@ -179,10 +175,10 @@ static int mrq_debug_close(struct tegra_bpmp *bpmp, uint32_t fd)
}
}
static
int
mrq_debug_read
(
struct
tegra_bpmp
*
bpmp
,
const
char
*
name
,
static
int
mrq_debug_read
(
struct
tegra_bpmp
*
bpmp
,
const
char
*
name
,
char
*
data
,
size_t
sz_data
,
u
int32_t
*
nbytes
)
char
*
data
,
size_t
sz_data
,
u
32
*
nbytes
)
{
{
struct
mrq_debug_request
req
=
{
struct
mrq_debug_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUG_READ
)
,
.
cmd
=
CMD_DEBUG_READ
,
};
};
struct
mrq_debug_response
resp
;
struct
mrq_debug_response
resp
;
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
...
@@ -196,7 +192,7 @@ static int mrq_debug_read(struct tegra_bpmp *bpmp, const char *name,
...
@@ -196,7 +192,7 @@ static int mrq_debug_read(struct tegra_bpmp *bpmp, const char *name,
.
size
=
sizeof
(
resp
),
.
size
=
sizeof
(
resp
),
},
},
};
};
u
int32_t
fd
=
0
,
len
=
0
;
u
32
fd
=
0
,
len
=
0
;
int
remaining
,
err
;
int
remaining
,
err
;
mutex_lock
(
&
bpmp_debug_lock
);
mutex_lock
(
&
bpmp_debug_lock
);
...
@@ -245,7 +241,7 @@ static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
...
@@ -245,7 +241,7 @@ static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
uint8_t
*
data
,
size_t
sz_data
)
uint8_t
*
data
,
size_t
sz_data
)
{
{
struct
mrq_debug_request
req
=
{
struct
mrq_debug_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUG_WRITE
)
.
cmd
=
CMD_DEBUG_WRITE
};
};
struct
mrq_debug_response
resp
;
struct
mrq_debug_response
resp
;
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
...
@@ -259,7 +255,7 @@ static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
...
@@ -259,7 +255,7 @@ static int mrq_debug_write(struct tegra_bpmp *bpmp, const char *name,
.
size
=
sizeof
(
resp
),
.
size
=
sizeof
(
resp
),
},
},
};
};
u
int32_t
fd
=
0
,
len
=
0
;
u
32
fd
=
0
,
len
=
0
;
size_t
remaining
;
size_t
remaining
;
int
err
;
int
err
;
...
@@ -308,7 +304,7 @@ static int bpmp_debug_show(struct seq_file *m, void *p)
...
@@ -308,7 +304,7 @@ static int bpmp_debug_show(struct seq_file *m, void *p)
char
fnamebuf
[
256
];
char
fnamebuf
[
256
];
const
char
*
filename
;
const
char
*
filename
;
struct
mrq_debug_request
req
=
{
struct
mrq_debug_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUG_READ
)
,
.
cmd
=
CMD_DEBUG_READ
,
};
};
struct
mrq_debug_response
resp
;
struct
mrq_debug_response
resp
;
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
...
@@ -322,7 +318,7 @@ static int bpmp_debug_show(struct seq_file *m, void *p)
...
@@ -322,7 +318,7 @@ static int bpmp_debug_show(struct seq_file *m, void *p)
.
size
=
sizeof
(
resp
),
.
size
=
sizeof
(
resp
),
},
},
};
};
u
int32_t
fd
=
0
,
len
=
0
;
u
32
fd
=
0
,
len
=
0
;
int
remaining
,
err
;
int
remaining
,
err
;
filename
=
get_filename
(
bpmp
,
file
,
fnamebuf
,
sizeof
(
fnamebuf
));
filename
=
get_filename
(
bpmp
,
file
,
fnamebuf
,
sizeof
(
fnamebuf
));
...
@@ -406,8 +402,8 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp,
...
@@ -406,8 +402,8 @@ static int bpmp_populate_debugfs_inband(struct tegra_bpmp *bpmp,
{
{
const
size_t
pathlen
=
SZ_256
;
const
size_t
pathlen
=
SZ_256
;
const
size_t
bufsize
=
SZ_16K
;
const
size_t
bufsize
=
SZ_16K
;
uint32_t
dsize
,
attrs
=
0
;
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
u32
dsize
,
attrs
=
0
;
struct
seqbuf
seqbuf
;
struct
seqbuf
seqbuf
;
char
*
buf
,
*
pathbuf
;
char
*
buf
,
*
pathbuf
;
const
char
*
name
;
const
char
*
name
;
...
@@ -487,12 +483,12 @@ static int mrq_debugfs_read(struct tegra_bpmp *bpmp,
...
@@ -487,12 +483,12 @@ static int mrq_debugfs_read(struct tegra_bpmp *bpmp,
size_t
*
nbytes
)
size_t
*
nbytes
)
{
{
struct
mrq_debugfs_request
req
=
{
struct
mrq_debugfs_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUGFS_READ
)
,
.
cmd
=
CMD_DEBUGFS_READ
,
.
fop
=
{
.
fop
=
{
.
fnameaddr
=
cpu_to_le32
((
uint32_t
)
name
)
,
.
fnameaddr
=
(
u32
)
name
,
.
fnamelen
=
cpu_to_le32
((
uint32_t
)
sz_name
)
,
.
fnamelen
=
(
u32
)
sz_name
,
.
dataaddr
=
cpu_to_le32
((
uint32_t
)
data
)
,
.
dataaddr
=
(
u32
)
data
,
.
datalen
=
cpu_to_le32
((
uint32_t
)
sz_data
)
,
.
datalen
=
(
u32
)
sz_data
,
},
},
};
};
struct
mrq_debugfs_response
resp
;
struct
mrq_debugfs_response
resp
;
...
@@ -525,12 +521,12 @@ static int mrq_debugfs_write(struct tegra_bpmp *bpmp,
...
@@ -525,12 +521,12 @@ static int mrq_debugfs_write(struct tegra_bpmp *bpmp,
dma_addr_t
data
,
size_t
sz_data
)
dma_addr_t
data
,
size_t
sz_data
)
{
{
const
struct
mrq_debugfs_request
req
=
{
const
struct
mrq_debugfs_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUGFS_WRITE
)
,
.
cmd
=
CMD_DEBUGFS_WRITE
,
.
fop
=
{
.
fop
=
{
.
fnameaddr
=
cpu_to_le32
((
uint32_t
)
name
)
,
.
fnameaddr
=
(
u32
)
name
,
.
fnamelen
=
cpu_to_le32
((
uint32_t
)
sz_name
)
,
.
fnamelen
=
(
u32
)
sz_name
,
.
dataaddr
=
cpu_to_le32
((
uint32_t
)
data
)
,
.
dataaddr
=
(
u32
)
data
,
.
datalen
=
cpu_to_le32
((
uint32_t
)
sz_data
)
,
.
datalen
=
(
u32
)
sz_data
,
},
},
};
};
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
...
@@ -548,10 +544,10 @@ static int mrq_debugfs_dumpdir(struct tegra_bpmp *bpmp, dma_addr_t addr,
...
@@ -548,10 +544,10 @@ static int mrq_debugfs_dumpdir(struct tegra_bpmp *bpmp, dma_addr_t addr,
size_t
size
,
size_t
*
nbytes
)
size_t
size
,
size_t
*
nbytes
)
{
{
const
struct
mrq_debugfs_request
req
=
{
const
struct
mrq_debugfs_request
req
=
{
.
cmd
=
cpu_to_le32
(
CMD_DEBUGFS_DUMPDIR
)
,
.
cmd
=
CMD_DEBUGFS_DUMPDIR
,
.
dumpdir
=
{
.
dumpdir
=
{
.
dataaddr
=
cpu_to_le32
((
uint32_t
)
addr
)
,
.
dataaddr
=
(
u32
)
addr
,
.
datalen
=
cpu_to_le32
((
uint32_t
)
size
)
,
.
datalen
=
(
u32
)
size
,
},
},
};
};
struct
mrq_debugfs_response
resp
;
struct
mrq_debugfs_response
resp
;
...
@@ -688,10 +684,10 @@ static const struct file_operations debugfs_fops = {
...
@@ -688,10 +684,10 @@ static const struct file_operations debugfs_fops = {
};
};
static
int
bpmp_populate_dir
(
struct
tegra_bpmp
*
bpmp
,
struct
seqbuf
*
seqbuf
,
static
int
bpmp_populate_dir
(
struct
tegra_bpmp
*
bpmp
,
struct
seqbuf
*
seqbuf
,
struct
dentry
*
parent
,
u
int32_t
depth
)
struct
dentry
*
parent
,
u
32
depth
)
{
{
int
err
;
int
err
;
u
int32_t
d
,
t
;
u
32
d
,
t
;
const
char
*
name
;
const
char
*
name
;
struct
dentry
*
dentry
;
struct
dentry
*
dentry
;
...
...
This diff is collapsed.
Click to expand it.
drivers/firmware/tegra/bpmp-tegra186.c
View file @
c78ba3cf
...
@@ -18,8 +18,8 @@ struct tegra186_bpmp {
...
@@ -18,8 +18,8 @@ struct tegra186_bpmp {
struct
{
struct
{
struct
gen_pool
*
pool
;
struct
gen_pool
*
pool
;
void
__iomem
*
virt
;
dma_addr_t
phys
;
dma_addr_t
phys
;
void
*
virt
;
}
tx
,
rx
;
}
tx
,
rx
;
struct
{
struct
{
...
@@ -40,31 +40,27 @@ mbox_client_to_bpmp(struct mbox_client *client)
...
@@ -40,31 +40,27 @@ mbox_client_to_bpmp(struct mbox_client *client)
static
bool
tegra186_bpmp_is_message_ready
(
struct
tegra_bpmp_channel
*
channel
)
static
bool
tegra186_bpmp_is_message_ready
(
struct
tegra_bpmp_channel
*
channel
)
{
{
void
*
frame
;
int
err
;
frame
=
tegra_ivc_read_get_next_frame
(
channel
->
ivc
);
err
=
tegra_ivc_read_get_next_frame
(
channel
->
ivc
,
&
channel
->
ib
);
if
(
IS_ERR
(
frame
)
)
{
if
(
err
)
{
channel
->
ib
=
NULL
;
iosys_map_clear
(
&
channel
->
ib
)
;
return
false
;
return
false
;
}
}
channel
->
ib
=
frame
;
return
true
;
return
true
;
}
}
static
bool
tegra186_bpmp_is_channel_free
(
struct
tegra_bpmp_channel
*
channel
)
static
bool
tegra186_bpmp_is_channel_free
(
struct
tegra_bpmp_channel
*
channel
)
{
{
void
*
frame
;
int
err
;
frame
=
tegra_ivc_write_get_next_frame
(
channel
->
ivc
);
err
=
tegra_ivc_write_get_next_frame
(
channel
->
ivc
,
&
channel
->
ob
);
if
(
IS_ERR
(
frame
)
)
{
if
(
err
)
{
channel
->
ob
=
NULL
;
iosys_map_clear
(
&
channel
->
ob
)
;
return
false
;
return
false
;
}
}
channel
->
ob
=
frame
;
return
true
;
return
true
;
}
}
...
@@ -109,6 +105,7 @@ static int tegra186_bpmp_channel_init(struct tegra_bpmp_channel *channel,
...
@@ -109,6 +105,7 @@ static int tegra186_bpmp_channel_init(struct tegra_bpmp_channel *channel,
{
{
struct
tegra186_bpmp
*
priv
=
bpmp
->
priv
;
struct
tegra186_bpmp
*
priv
=
bpmp
->
priv
;
size_t
message_size
,
queue_size
;
size_t
message_size
,
queue_size
;
struct
iosys_map
rx
,
tx
;
unsigned
int
offset
;
unsigned
int
offset
;
int
err
;
int
err
;
...
@@ -121,10 +118,11 @@ static int tegra186_bpmp_channel_init(struct tegra_bpmp_channel *channel,
...
@@ -121,10 +118,11 @@ static int tegra186_bpmp_channel_init(struct tegra_bpmp_channel *channel,
queue_size
=
tegra_ivc_total_queue_size
(
message_size
);
queue_size
=
tegra_ivc_total_queue_size
(
message_size
);
offset
=
queue_size
*
index
;
offset
=
queue_size
*
index
;
err
=
tegra_ivc_init
(
channel
->
ivc
,
NULL
,
iosys_map_set_vaddr_iomem
(
&
rx
,
priv
->
rx
.
virt
+
offset
);
priv
->
rx
.
virt
+
offset
,
priv
->
rx
.
phys
+
offset
,
iosys_map_set_vaddr_iomem
(
&
tx
,
priv
->
tx
.
virt
+
offset
);
priv
->
tx
.
virt
+
offset
,
priv
->
tx
.
phys
+
offset
,
1
,
message_size
,
tegra186_bpmp_ivc_notify
,
err
=
tegra_ivc_init
(
channel
->
ivc
,
NULL
,
&
rx
,
priv
->
rx
.
phys
+
offset
,
&
tx
,
priv
->
tx
.
phys
+
offset
,
1
,
message_size
,
tegra186_bpmp_ivc_notify
,
bpmp
);
bpmp
);
if
(
err
<
0
)
{
if
(
err
<
0
)
{
dev_err
(
bpmp
->
dev
,
"failed to setup IVC for channel %u: %d
\n
"
,
dev_err
(
bpmp
->
dev
,
"failed to setup IVC for channel %u: %d
\n
"
,
...
@@ -179,7 +177,7 @@ static int tegra186_bpmp_init(struct tegra_bpmp *bpmp)
...
@@ -179,7 +177,7 @@ static int tegra186_bpmp_init(struct tegra_bpmp *bpmp)
return
-
EPROBE_DEFER
;
return
-
EPROBE_DEFER
;
}
}
priv
->
tx
.
virt
=
gen_pool_dma_alloc
(
priv
->
tx
.
pool
,
4096
,
&
priv
->
tx
.
phys
);
priv
->
tx
.
virt
=
(
void
__iomem
*
)
gen_pool_dma_alloc
(
priv
->
tx
.
pool
,
4096
,
&
priv
->
tx
.
phys
);
if
(
!
priv
->
tx
.
virt
)
{
if
(
!
priv
->
tx
.
virt
)
{
dev_err
(
bpmp
->
dev
,
"failed to allocate from TX pool
\n
"
);
dev_err
(
bpmp
->
dev
,
"failed to allocate from TX pool
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -192,7 +190,7 @@ static int tegra186_bpmp_init(struct tegra_bpmp *bpmp)
...
@@ -192,7 +190,7 @@ static int tegra186_bpmp_init(struct tegra_bpmp *bpmp)
goto
free_tx
;
goto
free_tx
;
}
}
priv
->
rx
.
virt
=
gen_pool_dma_alloc
(
priv
->
rx
.
pool
,
4096
,
&
priv
->
rx
.
phys
);
priv
->
rx
.
virt
=
(
void
__iomem
*
)
gen_pool_dma_alloc
(
priv
->
rx
.
pool
,
4096
,
&
priv
->
rx
.
phys
);
if
(
!
priv
->
rx
.
virt
)
{
if
(
!
priv
->
rx
.
virt
)
{
dev_err
(
bpmp
->
dev
,
"failed to allocate from RX pool
\n
"
);
dev_err
(
bpmp
->
dev
,
"failed to allocate from RX pool
\n
"
);
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
...
...
This diff is collapsed.
Click to expand it.
drivers/firmware/tegra/bpmp-tegra210.c
View file @
c78ba3cf
...
@@ -137,8 +137,8 @@ static int tegra210_bpmp_channel_init(struct tegra_bpmp_channel *channel,
...
@@ -137,8 +137,8 @@ static int tegra210_bpmp_channel_init(struct tegra_bpmp_channel *channel,
unsigned
int
index
)
unsigned
int
index
)
{
{
struct
tegra210_bpmp
*
priv
=
bpmp
->
priv
;
struct
tegra210_bpmp
*
priv
=
bpmp
->
priv
;
void
__iomem
*
p
;
u32
address
;
u32
address
;
void
*
p
;
/* Retrieve channel base address from BPMP */
/* Retrieve channel base address from BPMP */
writel
(
index
<<
TRIGGER_ID_SHIFT
|
TRIGGER_CMD_GET
,
writel
(
index
<<
TRIGGER_ID_SHIFT
|
TRIGGER_CMD_GET
,
...
@@ -149,8 +149,9 @@ static int tegra210_bpmp_channel_init(struct tegra_bpmp_channel *channel,
...
@@ -149,8 +149,9 @@ static int tegra210_bpmp_channel_init(struct tegra_bpmp_channel *channel,
if
(
!
p
)
if
(
!
p
)
return
-
ENOMEM
;
return
-
ENOMEM
;
channel
->
ib
=
p
;
iosys_map_set_vaddr_iomem
(
&
channel
->
ib
,
p
);
channel
->
ob
=
p
;
iosys_map_set_vaddr_iomem
(
&
channel
->
ob
,
p
);
channel
->
index
=
index
;
channel
->
index
=
index
;
init_completion
(
&
channel
->
completion
);
init_completion
(
&
channel
->
completion
);
channel
->
bpmp
=
bpmp
;
channel
->
bpmp
=
bpmp
;
...
...
This diff is collapsed.
Click to expand it.
drivers/firmware/tegra/bpmp.c
View file @
c78ba3cf
...
@@ -201,13 +201,13 @@ static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
...
@@ -201,13 +201,13 @@ static ssize_t __tegra_bpmp_channel_read(struct tegra_bpmp_channel *channel,
int
err
;
int
err
;
if
(
data
&&
size
>
0
)
if
(
data
&&
size
>
0
)
memcpy_fromio
(
data
,
channel
->
ib
->
data
,
size
);
tegra_bpmp_mb_read
(
data
,
&
channel
->
ib
,
size
);
err
=
tegra_bpmp_ack_response
(
channel
);
err
=
tegra_bpmp_ack_response
(
channel
);
if
(
err
<
0
)
if
(
err
<
0
)
return
err
;
return
err
;
*
ret
=
channel
->
ib
->
code
;
*
ret
=
tegra_bpmp_mb_read_field
(
&
channel
->
ib
,
code
)
;
return
0
;
return
0
;
}
}
...
@@ -241,11 +241,11 @@ static ssize_t __tegra_bpmp_channel_write(struct tegra_bpmp_channel *channel,
...
@@ -241,11 +241,11 @@ static ssize_t __tegra_bpmp_channel_write(struct tegra_bpmp_channel *channel,
unsigned
int
mrq
,
unsigned
long
flags
,
unsigned
int
mrq
,
unsigned
long
flags
,
const
void
*
data
,
size_t
size
)
const
void
*
data
,
size_t
size
)
{
{
channel
->
ob
->
code
=
mrq
;
tegra_bpmp_mb_write_field
(
&
channel
->
ob
,
code
,
mrq
)
;
channel
->
ob
->
flags
=
flags
;
tegra_bpmp_mb_write_field
(
&
channel
->
ob
,
flags
,
flags
)
;
if
(
data
&&
size
>
0
)
if
(
data
&&
size
>
0
)
memcpy_toio
(
channel
->
ob
->
data
,
data
,
size
);
tegra_bpmp_mb_write
(
&
channel
->
ob
,
data
,
size
);
return
tegra_bpmp_post_request
(
channel
);
return
tegra_bpmp_post_request
(
channel
);
}
}
...
@@ -400,7 +400,7 @@ static struct tegra_bpmp_mrq *tegra_bpmp_find_mrq(struct tegra_bpmp *bpmp,
...
@@ -400,7 +400,7 @@ static struct tegra_bpmp_mrq *tegra_bpmp_find_mrq(struct tegra_bpmp *bpmp,
void
tegra_bpmp_mrq_return
(
struct
tegra_bpmp_channel
*
channel
,
int
code
,
void
tegra_bpmp_mrq_return
(
struct
tegra_bpmp_channel
*
channel
,
int
code
,
const
void
*
data
,
size_t
size
)
const
void
*
data
,
size_t
size
)
{
{
unsigned
long
flags
=
channel
->
ib
->
flags
;
unsigned
long
flags
=
tegra_bpmp_mb_read_field
(
&
channel
->
ib
,
flags
)
;
struct
tegra_bpmp
*
bpmp
=
channel
->
bpmp
;
struct
tegra_bpmp
*
bpmp
=
channel
->
bpmp
;
int
err
;
int
err
;
...
@@ -417,10 +417,10 @@ void tegra_bpmp_mrq_return(struct tegra_bpmp_channel *channel, int code,
...
@@ -417,10 +417,10 @@ void tegra_bpmp_mrq_return(struct tegra_bpmp_channel *channel, int code,
if
(
WARN_ON
(
!
tegra_bpmp_is_response_channel_free
(
channel
)))
if
(
WARN_ON
(
!
tegra_bpmp_is_response_channel_free
(
channel
)))
return
;
return
;
channel
->
ob
->
code
=
code
;
tegra_bpmp_mb_write_field
(
&
channel
->
ob
,
code
,
code
)
;
if
(
data
&&
size
>
0
)
if
(
data
&&
size
>
0
)
memcpy_toio
(
channel
->
ob
->
data
,
data
,
size
);
tegra_bpmp_mb_write
(
&
channel
->
ob
,
data
,
size
);
err
=
tegra_bpmp_post_response
(
channel
);
err
=
tegra_bpmp_post_response
(
channel
);
if
(
WARN_ON
(
err
<
0
))
if
(
WARN_ON
(
err
<
0
))
...
@@ -502,7 +502,7 @@ EXPORT_SYMBOL_GPL(tegra_bpmp_free_mrq);
...
@@ -502,7 +502,7 @@ EXPORT_SYMBOL_GPL(tegra_bpmp_free_mrq);
bool
tegra_bpmp_mrq_is_supported
(
struct
tegra_bpmp
*
bpmp
,
unsigned
int
mrq
)
bool
tegra_bpmp_mrq_is_supported
(
struct
tegra_bpmp
*
bpmp
,
unsigned
int
mrq
)
{
{
struct
mrq_query_abi_request
req
=
{
.
mrq
=
cpu_to_le32
(
mrq
)
};
struct
mrq_query_abi_request
req
=
{
.
mrq
=
mrq
};
struct
mrq_query_abi_response
resp
;
struct
mrq_query_abi_response
resp
;
struct
tegra_bpmp_message
msg
=
{
struct
tegra_bpmp_message
msg
=
{
.
mrq
=
MRQ_QUERY_ABI
,
.
mrq
=
MRQ_QUERY_ABI
,
...
@@ -529,13 +529,13 @@ static void tegra_bpmp_mrq_handle_ping(unsigned int mrq,
...
@@ -529,13 +529,13 @@ static void tegra_bpmp_mrq_handle_ping(unsigned int mrq,
struct
tegra_bpmp_channel
*
channel
,
struct
tegra_bpmp_channel
*
channel
,
void
*
data
)
void
*
data
)
{
{
struct
mrq_ping_request
*
request
;
struct
mrq_ping_request
request
;
struct
mrq_ping_response
response
;
struct
mrq_ping_response
response
;
request
=
(
struct
mrq_ping_request
*
)
channel
->
ib
->
data
;
tegra_bpmp_mb_read
(
&
request
,
&
channel
->
ib
,
sizeof
(
request
))
;
memset
(
&
response
,
0
,
sizeof
(
response
));
memset
(
&
response
,
0
,
sizeof
(
response
));
response
.
reply
=
request
->
challenge
<<
1
;
response
.
reply
=
request
.
challenge
<<
1
;
tegra_bpmp_mrq_return
(
channel
,
0
,
&
response
,
sizeof
(
response
));
tegra_bpmp_mrq_return
(
channel
,
0
,
&
response
,
sizeof
(
response
));
}
}
...
@@ -648,7 +648,7 @@ static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag,
...
@@ -648,7 +648,7 @@ static int tegra_bpmp_get_firmware_tag(struct tegra_bpmp *bpmp, char *tag,
static
void
tegra_bpmp_channel_signal
(
struct
tegra_bpmp_channel
*
channel
)
static
void
tegra_bpmp_channel_signal
(
struct
tegra_bpmp_channel
*
channel
)
{
{
unsigned
long
flags
=
channel
->
ob
->
flags
;
unsigned
long
flags
=
tegra_bpmp_mb_read_field
(
&
channel
->
ob
,
flags
)
;
if
((
flags
&
MSG_RING
)
==
0
)
if
((
flags
&
MSG_RING
)
==
0
)
return
;
return
;
...
@@ -666,8 +666,11 @@ void tegra_bpmp_handle_rx(struct tegra_bpmp *bpmp)
...
@@ -666,8 +666,11 @@ void tegra_bpmp_handle_rx(struct tegra_bpmp *bpmp)
count
=
bpmp
->
soc
->
channels
.
thread
.
count
;
count
=
bpmp
->
soc
->
channels
.
thread
.
count
;
busy
=
bpmp
->
threaded
.
busy
;
busy
=
bpmp
->
threaded
.
busy
;
if
(
tegra_bpmp_is_request_ready
(
channel
))
if
(
tegra_bpmp_is_request_ready
(
channel
))
{
tegra_bpmp_handle_mrq
(
bpmp
,
channel
->
ib
->
code
,
channel
);
unsigned
int
mrq
=
tegra_bpmp_mb_read_field
(
&
channel
->
ib
,
code
);
tegra_bpmp_handle_mrq
(
bpmp
,
mrq
,
channel
);
}
spin_lock
(
&
bpmp
->
lock
);
spin_lock
(
&
bpmp
->
lock
);
...
...
This diff is collapsed.
Click to expand it.
drivers/firmware/tegra/ivc.c
View file @
c78ba3cf
This diff is collapsed.
Click to expand it.
drivers/thermal/tegra/tegra-bpmp-thermal.c
View file @
c78ba3cf
...
@@ -106,21 +106,22 @@ static void tz_device_update_work_fn(struct work_struct *work)
...
@@ -106,21 +106,22 @@ static void tz_device_update_work_fn(struct work_struct *work)
static
void
bpmp_mrq_thermal
(
unsigned
int
mrq
,
struct
tegra_bpmp_channel
*
ch
,
static
void
bpmp_mrq_thermal
(
unsigned
int
mrq
,
struct
tegra_bpmp_channel
*
ch
,
void
*
data
)
void
*
data
)
{
{
struct
mrq_thermal_bpmp_to_host_request
*
req
;
struct
mrq_thermal_bpmp_to_host_request
req
;
struct
tegra_bpmp_thermal
*
tegra
=
data
;
struct
tegra_bpmp_thermal
*
tegra
=
data
;
size_t
offset
;
int
i
;
int
i
;
req
=
(
struct
mrq_thermal_bpmp_to_host_request
*
)
ch
->
ib
->
data
;
offset
=
offsetof
(
struct
tegra_bpmp_mb_data
,
data
);
iosys_map_memcpy_from
(
&
req
,
&
ch
->
ib
,
offset
,
sizeof
(
req
));
if
(
req
->
type
!=
CMD_THERMAL_HOST_TRIP_REACHED
)
{
if
(
req
.
type
!=
CMD_THERMAL_HOST_TRIP_REACHED
)
{
dev_err
(
tegra
->
dev
,
"%s: invalid request type: %d
\n
"
,
dev_err
(
tegra
->
dev
,
"%s: invalid request type: %d
\n
"
,
__func__
,
req
.
type
);
__func__
,
req
->
type
);
tegra_bpmp_mrq_return
(
ch
,
-
EINVAL
,
NULL
,
0
);
tegra_bpmp_mrq_return
(
ch
,
-
EINVAL
,
NULL
,
0
);
return
;
return
;
}
}
for
(
i
=
0
;
i
<
tegra
->
num_zones
;
++
i
)
{
for
(
i
=
0
;
i
<
tegra
->
num_zones
;
++
i
)
{
if
(
tegra
->
zones
[
i
]
->
idx
!=
req
->
host_trip_reached
.
zone
)
if
(
tegra
->
zones
[
i
]
->
idx
!=
req
.
host_trip_reached
.
zone
)
continue
;
continue
;
schedule_work
(
&
tegra
->
zones
[
i
]
->
tz_device_update_work
);
schedule_work
(
&
tegra
->
zones
[
i
]
->
tz_device_update_work
);
...
@@ -129,7 +130,7 @@ static void bpmp_mrq_thermal(unsigned int mrq, struct tegra_bpmp_channel *ch,
...
@@ -129,7 +130,7 @@ static void bpmp_mrq_thermal(unsigned int mrq, struct tegra_bpmp_channel *ch,
}
}
dev_err
(
tegra
->
dev
,
"%s: invalid thermal zone: %d
\n
"
,
__func__
,
dev_err
(
tegra
->
dev
,
"%s: invalid thermal zone: %d
\n
"
,
__func__
,
req
->
host_trip_reached
.
zone
);
req
.
host_trip_reached
.
zone
);
tegra_bpmp_mrq_return
(
ch
,
-
EINVAL
,
NULL
,
0
);
tegra_bpmp_mrq_return
(
ch
,
-
EINVAL
,
NULL
,
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
include/soc/tegra/bpmp-abi.h
View file @
c78ba3cf
This diff is collapsed.
Click to expand it.
include/soc/tegra/bpmp.h
View file @
c78ba3cf
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#ifndef __SOC_TEGRA_BPMP_H
#ifndef __SOC_TEGRA_BPMP_H
#define __SOC_TEGRA_BPMP_H
#define __SOC_TEGRA_BPMP_H
#include <linux/iosys-map.h>
#include <linux/mailbox_client.h>
#include <linux/mailbox_client.h>
#include <linux/pm_domain.h>
#include <linux/pm_domain.h>
#include <linux/reset-controller.h>
#include <linux/reset-controller.h>
...
@@ -36,10 +37,22 @@ struct tegra_bpmp_mb_data {
...
@@ -36,10 +37,22 @@ struct tegra_bpmp_mb_data {
u8
data
[
MSG_DATA_MIN_SZ
];
u8
data
[
MSG_DATA_MIN_SZ
];
}
__packed
;
}
__packed
;
#define tegra_bpmp_mb_read(dst, mb, size) \
iosys_map_memcpy_from(dst, mb, offsetof(struct tegra_bpmp_mb_data, data), size)
#define tegra_bpmp_mb_write(mb, src, size) \
iosys_map_memcpy_to(mb, offsetof(struct tegra_bpmp_mb_data, data), src, size)
#define tegra_bpmp_mb_read_field(mb, field) \
iosys_map_rd_field(mb, 0, struct tegra_bpmp_mb_data, field)
#define tegra_bpmp_mb_write_field(mb, field, value) \
iosys_map_wr_field(mb, 0, struct tegra_bpmp_mb_data, field, value)
struct
tegra_bpmp_channel
{
struct
tegra_bpmp_channel
{
struct
tegra_bpmp
*
bpmp
;
struct
tegra_bpmp
*
bpmp
;
struct
tegra_bpmp_mb_data
*
ib
;
struct
iosys_map
ib
;
struct
tegra_bpmp_mb_data
*
ob
;
struct
iosys_map
ob
;
struct
completion
completion
;
struct
completion
completion
;
struct
tegra_ivc
*
ivc
;
struct
tegra_ivc
*
ivc
;
unsigned
int
index
;
unsigned
int
index
;
...
...
This diff is collapsed.
Click to expand it.
include/soc/tegra/ivc.h
View file @
c78ba3cf
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <linux/device.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/iosys-map.h>
#include <linux/types.h>
#include <linux/types.h>
struct
tegra_ivc_header
;
struct
tegra_ivc_header
;
...
@@ -15,7 +16,7 @@ struct tegra_ivc {
...
@@ -15,7 +16,7 @@ struct tegra_ivc {
struct
device
*
peer
;
struct
device
*
peer
;
struct
{
struct
{
struct
tegra_ivc_header
*
channel
;
struct
iosys_map
map
;
unsigned
int
position
;
unsigned
int
position
;
dma_addr_t
phys
;
dma_addr_t
phys
;
}
rx
,
tx
;
}
rx
,
tx
;
...
@@ -36,7 +37,7 @@ struct tegra_ivc {
...
@@ -36,7 +37,7 @@ struct tegra_ivc {
*
*
* Returns a pointer to the frame, or an error encoded pointer.
* Returns a pointer to the frame, or an error encoded pointer.
*/
*/
void
*
tegra_ivc_read_get_next_frame
(
struct
tegra_ivc
*
ivc
);
int
tegra_ivc_read_get_next_frame
(
struct
tegra_ivc
*
ivc
,
struct
iosys_map
*
map
);
/**
/**
* tegra_ivc_read_advance - Advance the read queue
* tegra_ivc_read_advance - Advance the read queue
...
@@ -56,7 +57,7 @@ int tegra_ivc_read_advance(struct tegra_ivc *ivc);
...
@@ -56,7 +57,7 @@ int tegra_ivc_read_advance(struct tegra_ivc *ivc);
*
*
* Returns a pointer to the frame, or an error encoded pointer.
* Returns a pointer to the frame, or an error encoded pointer.
*/
*/
void
*
tegra_ivc_write_get_next_frame
(
struct
tegra_ivc
*
ivc
);
int
tegra_ivc_write_get_next_frame
(
struct
tegra_ivc
*
ivc
,
struct
iosys_map
*
map
);
/**
/**
* tegra_ivc_write_advance - Advance the write queue
* tegra_ivc_write_advance - Advance the write queue
...
@@ -91,8 +92,8 @@ void tegra_ivc_reset(struct tegra_ivc *ivc);
...
@@ -91,8 +92,8 @@ void tegra_ivc_reset(struct tegra_ivc *ivc);
size_t
tegra_ivc_align
(
size_t
size
);
size_t
tegra_ivc_align
(
size_t
size
);
unsigned
tegra_ivc_total_queue_size
(
unsigned
queue_size
);
unsigned
tegra_ivc_total_queue_size
(
unsigned
queue_size
);
int
tegra_ivc_init
(
struct
tegra_ivc
*
ivc
,
struct
device
*
peer
,
void
*
rx
,
int
tegra_ivc_init
(
struct
tegra_ivc
*
ivc
,
struct
device
*
peer
,
const
struct
iosys_map
*
rx
,
dma_addr_t
rx_phys
,
void
*
tx
,
dma_addr_t
tx_phys
,
dma_addr_t
rx_phys
,
const
struct
iosys_map
*
tx
,
dma_addr_t
tx_phys
,
unsigned
int
num_frames
,
size_t
frame_size
,
unsigned
int
num_frames
,
size_t
frame_size
,
void
(
*
notify
)(
struct
tegra_ivc
*
ivc
,
void
*
data
),
void
(
*
notify
)(
struct
tegra_ivc
*
ivc
,
void
*
data
),
void
*
data
);
void
*
data
);
...
...
This diff is collapsed.
Click to expand it.
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