Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 49 additions & 3 deletions drivers/mfd/macsmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -956,13 +956,45 @@ void apple_smc_warm_reset_put(struct apple_smc_warm_reset *wr)
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset_put);

int apple_smc_warm_reset(const struct apple_smc_warm_reset *wr, bool noirq)
bool apple_smc_warm_reset_lock(const struct apple_smc_warm_reset *wr)
{
if (!wr || !wr->smc || !wr->count)
return false;
device_lock(&wr->smc->dev);
if (!device_is_bound(&wr->smc->dev) || !platform_get_drvdata(wr->smc)) {
device_unlock(&wr->smc->dev);
return false;
}
return true;
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset_lock);

void apple_smc_warm_reset_unlock(const struct apple_smc_warm_reset *wr)
{
if (wr && wr->smc)
device_unlock(&wr->smc->dev);
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset_unlock);

bool apple_smc_warm_reset_ready(const struct apple_smc_warm_reset *wr)
{
struct apple_smc *smc = wr->smc ? platform_get_drvdata(wr->smc) : NULL;
if (!apple_smc_warm_reset_lock(wr))
return false;
apple_smc_warm_reset_unlock(wr);
return true;
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset_ready);

int apple_smc_warm_reset_locked(const struct apple_smc_warm_reset *wr, bool noirq)
{
struct apple_smc *smc;
unsigned int i;
int ret = 0;

if (!smc || !wr->count)
if (!wr || !wr->smc || !wr->count)
return -ENODEV;
smc = device_is_bound(&wr->smc->dev) ? platform_get_drvdata(wr->smc) : NULL;
if (!smc)
return -ENODEV;
for (i = 0; i < wr->count && !ret; i++) {
__be32 value = cpu_to_be32(wr->writes[2 * i]);
Expand All @@ -982,6 +1014,20 @@ int apple_smc_warm_reset(const struct apple_smc_warm_reset *wr, bool noirq)
}
return ret;
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset_locked);

int apple_smc_warm_reset(const struct apple_smc_warm_reset *wr, bool noirq)
{
int ret;

if (noirq)
return apple_smc_warm_reset_locked(wr, true);
if (!apple_smc_warm_reset_lock(wr))
return -ENODEV;
ret = apple_smc_warm_reset_locked(wr, false);
apple_smc_warm_reset_unlock(wr);
return ret;
}
EXPORT_SYMBOL_GPL(apple_smc_warm_reset);

static void apple_smc_write_mbse(struct apple_smc *smc, smc_key value)
Expand Down
15 changes: 12 additions & 3 deletions drivers/net/wireless/apple/centauri/t6050/centauri_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,14 @@ static int centauri_t6050_start_ipc_locked(struct centauri_t6050 *c,
ret = readl_poll_timeout(c->bar + 0x8000, stage, stage == 2 || stage == 3, 100, 3000000);
if (ret || stage != 2) {
ret = ret ?: -EIO;
c->boot_hw_failed = true;
goto failed;
}
ret = handshake(c->bar, &ipc->control, 0x8050, 0x8054, 0x907c);
if (ret)
if (ret) {
c->boot_hw_failed = true;
goto failed;
}
ret = memswap_handoff(c, 0, "mswc");
if (!ret)
ret = memswap_handoff(c, 2, "mswb");
Expand All @@ -423,11 +426,15 @@ static int centauri_t6050_start_ipc_locked(struct centauri_t6050 *c,
if (ret)
goto failed;
ret = cchi_init(c);
if (ret)
if (ret) {
if (ret != -ENOMEM)
c->boot_hw_failed = true;
goto failed;
}
ret = readl_poll_timeout(ipc->bar[1] + 8, stage, stage == 2 || stage == 3, 100, 2000000);
if (ret || stage != 2) {
ret = ret ?: -EIO;
c->boot_hw_failed = true;
goto failed;
}
ipc->window = buffer_alloc(c, 1, CEN_ALPHA_WINDOW_SIZE);
Expand All @@ -443,8 +450,10 @@ static int centauri_t6050_start_ipc_locked(struct centauri_t6050 *c,
writel(upper_32_bits(ipc->window->dma), ipc->bar[1] + 0x1c);
writel(CEN_ALPHA_WINDOW_SIZE, ipc->bar[1] + 0x20);
ret = handshake(ipc->bar[1], &ipc->alpha, 0xc, 0x10, 0x1028);
if (ret)
if (ret) {
c->boot_hw_failed = true;
goto failed;
}
ret = centauri_t6050_wifi_register(c);
if (ret)
return ret;
Expand Down
Loading
Loading