board: qca: arm: ipq5332: Add support to reset two NAPA ports

Change-Id: Ib98b60d0b57247598fdee41628202d68b24eec62
Signed-off-by: Ram Kumar D <quic_ramd@quicinc.com>
Signed-off-by: Timple Raj M <quic_timple@quicinc.com>
(cherry picked from commit 652bcba69b12ef8356b2c985274b58418c27f60d)
This commit is contained in:
Timple Raj M 2024-09-19 11:01:21 +05:30 committed by Saahil Tomar
parent c8acb14709
commit d9d357c78b
3 changed files with 35 additions and 12 deletions

View file

@ -172,6 +172,7 @@
qca808x_gpio = <51>;
qca808x_gpio_cnt = <1>;
napa_gpio = <22>;
napa_gpio_cnt = <1>;
qca8084_switch_enable = <1>;
mdio_gpio {

View file

@ -173,6 +173,7 @@
qca808x_gpio = <51>;
qca808x_gpio_cnt = <1>;
napa_gpio = <22>;
napa_gpio_cnt = <1>;
qca8084_switch_enable = <1>;
mdio_gpio {

View file

@ -1279,22 +1279,43 @@ void sfp_reset_init(void)
}
}
void qca8081_napa_reset(void)
int get_napa_gpio(int napa_gpio[2])
{
unsigned int *napa_gpio_base;
int node, gpio;
uint32_t cfg;
int napa_gpio_cnt = -1, node;
int res = -1;
node = fdt_path_offset(gd->fdt_blob, "/ess-switch");
if (node >= 0) {
gpio = fdtdec_get_uint(gd->fdt_blob, node , "napa_gpio", -1);
if (gpio != -1) {
napa_gpio_base =
(unsigned int *)GPIO_CONFIG_ADDR(gpio);
cfg = GPIO_OE | GPIO_DRV_8_MA | GPIO_PULL_UP;
writel(cfg, napa_gpio_base);
mdelay(100);
gpio_set_value(gpio, 0x1);
napa_gpio_cnt = fdtdec_get_uint(gd->fdt_blob, node, "napa_gpio_cnt", -1);
if (napa_gpio_cnt >= 1) {
res = fdtdec_get_int_array(gd->fdt_blob, node, "napa_gpio",
(u32 *)napa_gpio, napa_gpio_cnt);
if (res >= 0)
return napa_gpio_cnt;
}
}
return res;
}
void qca8081_napa_reset(void)
{
int napa_gpio[2] = {-1, -1}, napa_gpio_cnt, i;
unsigned int *napa_gpio_base;
uint32_t cfg;
napa_gpio_cnt = get_napa_gpio(napa_gpio);
if (napa_gpio_cnt >= 1) {
for (i = 0; i < napa_gpio_cnt; i++) {
if (napa_gpio[i] >= 0) {
napa_gpio_base =
(unsigned int *)GPIO_CONFIG_ADDR(
napa_gpio[i]);
cfg = GPIO_OE | GPIO_DRV_8_MA | GPIO_PULL_UP;
writel(cfg, napa_gpio_base);
mdelay(100);
gpio_set_value(napa_gpio[i], 0x1);
}
}
}
}