Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Zynq Ultrascale-based System Board
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
DIOT Zynq Ultrascale-based System Board
Commits
1ee8766e
Commit
1ee8766e
authored
May 11, 2022
by
Adam Wujek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw/petalinux/diot-util: Add support of hard reset of fantray
Signed-off-by:
Adam Wujek
<
dev_public@wujek.eu
>
parent
8e9598da
Pipeline
#3683
passed with stage
in 40 minutes and 13 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
diot_util_fantray.c
...eta-user/recipes-apps/diot-util/files/diot_util_fantray.c
+39
-0
diot_util_gpio.c
...c/meta-user/recipes-apps/diot-util/files/diot_util_gpio.c
+7
-0
diot_util_gpio.h
...c/meta-user/recipes-apps/diot-util/files/diot_util_gpio.h
+1
-0
No files found.
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/diot_util_fantray.c
View file @
1ee8766e
...
...
@@ -24,12 +24,14 @@
#include "diot_util_i2c.h"
#include "diot_util_error.h"
#include "diot_util_fantray.h"
#include "diot_util_gpio.h"
#include "util.h"
#define FANTRAY_FW_MAX_SIZE 0x3E000
static
int
cmd_fantray_status
(
char
*
params
);
static
int
cmd_fantray_reset
(
char
*
params
);
static
int
cmd_fantray_reset_hard
(
char
*
params
);
static
int
cmd_fantray_set_fan
(
char
*
params
);
static
int
cmd_fantray_load_fw
(
char
*
params
);
...
...
@@ -37,6 +39,7 @@ static int cmd_fantray_load_fw(char *params);
struct
command_entry
commands_list_fantray
[]
=
{
{
.
cmd_name
=
"status"
,
.
cmd_func
=
cmd_fantray_status
,
.
cmd_help_string
=
"Get the status of the Fantray module
\n
"
,
.
cmd_params
=
NULL
},
{
.
cmd_name
=
"reset"
,
.
cmd_func
=
cmd_fantray_reset
,
.
cmd_help_string
=
"Reset Fantray module
\n
"
,
.
cmd_params
=
NULL
},
{
.
cmd_name
=
"reset_hard"
,
.
cmd_func
=
cmd_fantray_reset_hard
,
.
cmd_help_string
=
"Hard Reset Fantray module (using GPIO)
\n
"
,
.
cmd_params
=
NULL
},
{
.
cmd_name
=
"fan"
,
.
cmd_func
=
cmd_fantray_set_fan
,
.
cmd_help_string
=
"Set fan(s) speed for Fantray module
\n
"
,
.
cmd_params
=
"<1|2|3|all>"
},
{
.
cmd_name
=
"load_fw"
,
.
cmd_func
=
cmd_fantray_load_fw
,
.
cmd_help_string
=
"Update Fantray's firmware
\n
"
,
.
cmd_params
=
"<filename>"
},
{
.
cmd_name
=
NULL
}
...
...
@@ -155,6 +158,42 @@ static int cmd_fantray_reset(char *params)
return
rc
;
}
static
int
cmd_fantray_reset_hard
(
char
*
params
)
{
int
rc
;
int
ret
;
diot_error_clear
();
/* Unbind the Fantray from the monimod driver */
/* Ignore errors of unbind */
fantray_bind_driver
(
FANTRAY_DRIVER_PATH
"/unbind"
);
/* Reset Fantray */
ret
=
gpio_fantray_reset
(
0
);
if
(
ret
<
0
)
printf
(
"Unable to reset Fantray (ret = %d)
\n
"
,
ret
);
sleep
(
1
);
ret
=
gpio_fantray_reset
(
1
);
if
(
ret
<
0
)
printf
(
"Unable to reset Fantray (ret = %d)
\n
"
,
ret
);
/* Give the Fantray some time to start */
sleep
(
2
);
/* Bind the Fantray to the monimod driver */
rc
=
fantray_bind_driver
(
FANTRAY_DRIVER_PATH
"/bind"
);
diot_error_print
();
if
(
ret
)
{
return
-
1
;
}
return
rc
;
}
static
int
fantray_status
(
void
)
{
char
buff_hwmon
[
20
];
...
...
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/diot_util_gpio.c
View file @
1ee8766e
...
...
@@ -86,6 +86,7 @@ enum diot_gpio{
#endif
RST_N
,
PSU_ALERT
,
F_RST
,
MAX_GPIO
,
};
...
...
@@ -132,6 +133,7 @@ struct gpio_entry gpio_entries[MAX_GPIO] = {
#endif
DECLARE_GPIO_OUT
(
RST_N
,
1
),
DECLARE_GPIO_IN
(
PSU_ALERT
),
DECLARE_GPIO_OUT
(
F_RST
,
1
),
};
/* commands */
...
...
@@ -646,3 +648,8 @@ int restore_i2c(void)
return
1
;
}
int
gpio_fantray_reset
(
int
val
)
{
return
gpiod_line_set_value
(
gpio_entries
[
F_RST
].
gpio_line
,
val
);
}
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/diot_util_gpio.h
View file @
1ee8766e
...
...
@@ -27,6 +27,7 @@ int read_pb_eeprom(uint8_t *eeprom_buff, size_t eeprom_size, int slot);
int
read_fmc_eeprom
(
uint8_t
*
eeprom_buff
,
size_t
eeprom_size
);
int
psu_added_or_removed
(
int
psu
);
int
restore_i2c
(
void
);
int
gpio_fantray_reset
(
int
val
);
...
...
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