mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
gpio: atmel_pio4: add support for sama7g5 pio4 version with 5 banks
Add support for sama7g5 pinctrl variant, with 5 banks with a degraded 8 line only 5th bank. Based on Linux Kernel implementation. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
This commit is contained in:
parent
3a9aaefcaa
commit
e1038ac0cb
@ -173,8 +173,15 @@ int atmel_pio4_get_pio_input(u32 port, u32 pin)
|
|||||||
|
|
||||||
#if CONFIG_IS_ENABLED(DM_GPIO)
|
#if CONFIG_IS_ENABLED(DM_GPIO)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* struct atmel_pioctrl_data - Atmel PIO controller (pinmux + gpio) data struct
|
||||||
|
* @nbanks: number of PIO banks
|
||||||
|
* @last_bank_count: number of lines in the last bank (can be less than
|
||||||
|
* the rest of the banks).
|
||||||
|
*/
|
||||||
struct atmel_pioctrl_data {
|
struct atmel_pioctrl_data {
|
||||||
u32 nbanks;
|
u32 nbanks;
|
||||||
|
u32 last_bank_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct atmel_pio4_plat {
|
struct atmel_pio4_plat {
|
||||||
@ -313,6 +320,12 @@ static int atmel_pio4_probe(struct udevice *dev)
|
|||||||
NULL);
|
NULL);
|
||||||
uc_priv->gpio_count = nbanks * ATMEL_PIO_NPINS_PER_BANK;
|
uc_priv->gpio_count = nbanks * ATMEL_PIO_NPINS_PER_BANK;
|
||||||
|
|
||||||
|
/* if last bank has limited number of pins, adjust accordingly */
|
||||||
|
if (pioctrl_data->last_bank_count != ATMEL_PIO_NPINS_PER_BANK) {
|
||||||
|
uc_priv->gpio_count -= ATMEL_PIO_NPINS_PER_BANK;
|
||||||
|
uc_priv->gpio_count += pioctrl_data->last_bank_count;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,12 +335,21 @@ static int atmel_pio4_probe(struct udevice *dev)
|
|||||||
*/
|
*/
|
||||||
static const struct atmel_pioctrl_data atmel_sama5d2_pioctrl_data = {
|
static const struct atmel_pioctrl_data atmel_sama5d2_pioctrl_data = {
|
||||||
.nbanks = 4,
|
.nbanks = 4,
|
||||||
|
.last_bank_count = ATMEL_PIO_NPINS_PER_BANK,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct atmel_pioctrl_data microchip_sama7g5_pioctrl_data = {
|
||||||
|
.nbanks = 5,
|
||||||
|
.last_bank_count = 8, /* 5th bank has only 8 lines on sama7g5 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct udevice_id atmel_pio4_ids[] = {
|
static const struct udevice_id atmel_pio4_ids[] = {
|
||||||
{
|
{
|
||||||
.compatible = "atmel,sama5d2-gpio",
|
.compatible = "atmel,sama5d2-gpio",
|
||||||
.data = (ulong)&atmel_sama5d2_pioctrl_data,
|
.data = (ulong)&atmel_sama5d2_pioctrl_data,
|
||||||
|
}, {
|
||||||
|
.compatible = "microchip,sama7g5-gpio",
|
||||||
|
.data = (ulong)µchip_sama7g5_pioctrl_data,
|
||||||
},
|
},
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user