arm:fix GPIO revision check on DM37XX.
The GPIO revision check assumed the major and minor revision numbers where located at same location in the register. This is not true.
This commit is contained in:
parent
274fdff60c
commit
612d8207f0
|
|
@ -379,6 +379,27 @@ omap_message_hook(message * m)
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int revision_matches(u32_t board_id,u32_t rev) {
|
||||||
|
/* figures out if the collected resition matches the one expected
|
||||||
|
* from the board */
|
||||||
|
if (BOARD_IS_BBXM(board_id)){
|
||||||
|
if(
|
||||||
|
DM37XX_GPIO_REVISION_MAJOR(rev) != 2
|
||||||
|
|| DM37XX_GPIO_REVISION_MINOR(rev) != 5
|
||||||
|
) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else if (BOARD_IS_BB(board_id)){
|
||||||
|
if (
|
||||||
|
AM335X_GPIO_REVISION_MAJOR(rev) != 0
|
||||||
|
|| AM335X_GPIO_REVISION_MINOR(rev) != 1
|
||||||
|
) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
omap_gpio_init(struct gpio_driver *gpdrv)
|
omap_gpio_init(struct gpio_driver *gpdrv)
|
||||||
{
|
{
|
||||||
|
|
@ -422,22 +443,9 @@ omap_gpio_init(struct gpio_driver *gpdrv)
|
||||||
return EPERM; /* fixme */
|
return EPERM; /* fixme */
|
||||||
}
|
}
|
||||||
|
|
||||||
revision = 0;
|
|
||||||
revision = read32(bank->base_address + regs->REVISION);
|
revision = read32(bank->base_address + regs->REVISION);
|
||||||
unsigned int expected_major = 0;
|
|
||||||
unsigned int expected_minor = 0;
|
|
||||||
if (BOARD_IS_BBXM(machine.board_id)){
|
|
||||||
expected_major = 2;
|
|
||||||
expected_minor = 5;
|
|
||||||
} else if (BOARD_IS_BB(machine.board_id)){
|
|
||||||
expected_major = 0;
|
|
||||||
expected_minor = 1;
|
|
||||||
}
|
|
||||||
/* test if we can access it */
|
/* test if we can access it */
|
||||||
if (
|
if (! revision_matches(machine.board_id,revision)) {
|
||||||
AM335X_GPIO_REVISION_MAJOR(revision) != expected_major
|
|
||||||
|| AM335X_GPIO_REVISION_MINOR(revision) != expected_minor
|
|
||||||
) {
|
|
||||||
log_warn(&log,
|
log_warn(&log,
|
||||||
"Failed to read the revision of GPIO bank %s.. disabling\n",
|
"Failed to read the revision of GPIO bank %s.. disabling\n",
|
||||||
bank->name);
|
bank->name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user