cxd56/alt1250: Change power on sequence

Change the power on sequence according to ALT1250 modem spec.
This commit is contained in:
SPRESENSE 2023-07-03 09:03:41 +09:00 committed by Xiang Xiao
parent a4708d217a
commit 4eb6da33c2
3 changed files with 41 additions and 10 deletions

View File

@ -74,11 +74,15 @@
# error "Select LTE SPI 4 or 5"
#endif
#define POWER_ON_WAIT_TIME (2) /* ms */
#define ACTIVE_SHUTDOWN_TIME (100) /* ms */
#define TIME_TO_STABLE_VDDIO (10) /* ms */
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
static struct spi_dev_s *alt1250_poweron(void);
static struct spi_dev_s *alt1250_poweron(bool keep_on);
static void alt1250_poweroff(void);
static bool alt1250_powerstatus(void);
static int alt1250_hibernation_mode(bool enable);
@ -196,7 +200,7 @@ static void set_spiparam(struct spi_dev_s *spidev)
*
****************************************************************************/
static struct spi_dev_s *alt1250_poweron(void)
static struct spi_dev_s *alt1250_poweron(bool keep_on)
{
struct spi_dev_s *spi;
#if defined(CONFIG_CXD56_LTE_SPI4_DMAC) || defined(CONFIG_CXD56_LTE_SPI5_DMAC)
@ -204,6 +208,38 @@ static struct spi_dev_s *alt1250_poweron(void)
dma_config_t conf;
#endif
/* Hi-Z SHUTDOWN and PowerBTN signals before power-on */
cxd56_gpio_config(ALT1250_SHUTDOWN, false);
/* power on alt1250 modem device and wait until the power is distributed */
board_alt1250_poweron();
up_mdelay(POWER_ON_WAIT_TIME);
/* If keep_on is enabled, skip setting the SHUTDOWN signal to low
* because the ALT1250 is already in the power-on state.
*/
if (!keep_on)
{
/* Drive SHUTDOWN signal low */
cxd56_gpio_write(ALT1250_SHUTDOWN, 0);
}
/* Keep the SHUTDOWN signal low for reset period */
up_mdelay(ACTIVE_SHUTDOWN_TIME);
/* Undrive SHUTDOWN signal to rise up to high by pull-up */
cxd56_gpio_write_hiz(ALT1250_SHUTDOWN);
/* Wait VDDIO on Alt1250 stable */
up_mdelay(TIME_TO_STABLE_VDDIO);
/* Initialize spi deivce */
spi = cxd56_spibus_initialize(SPI_CH);
@ -233,10 +269,6 @@ static struct spi_dev_s *alt1250_poweron(void)
}
#endif
/* power on altair modem device */
board_alt1250_poweron();
/* Input enable */
cxd56_gpio_config(ALT1250_SLAVE_REQ, true);
@ -263,7 +295,6 @@ static struct spi_dev_s *alt1250_poweron(void)
/* enable the SPI pin */
spi_pincontrol(SPI_CH, true);
set_spiparam(spi);
return spi;

View File

@ -488,7 +488,7 @@ static altmdm_state_t process_state_poweroff(uint32_t event,
altmdm_event_clear(&g_altmdm_dev.event, EVENT_POWERON);
usec2timespec(RESET_INTERVAL, &interval);
nxsig_nanosleep(&interval, NULL);
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron();
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron(false);
g_altmdm_dev.lower->set_mready(false);
g_altmdm_dev.lower->set_wakeup(false);
g_altmdm_dev.lower->irqenable(true);
@ -1534,7 +1534,7 @@ int altmdm_init(FAR struct spi_dev_s *spidev,
g_altmdm_dev.current_state = ALTMDM_STATE_SLEEP;
g_altmdm_dev.vp = VP_V4;
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron();
g_altmdm_dev.spidev = g_altmdm_dev.lower->poweron(true);
g_altmdm_dev.lower->set_mready(false);
g_altmdm_dev.lower->set_wakeup(false);
g_altmdm_dev.lower->irqenable(true);

View File

@ -307,7 +307,7 @@ struct alt_readdata_s
struct alt1250_lower_s
{
FAR struct spi_dev_s * (*poweron)(void);
FAR struct spi_dev_s * (*poweron)(bool keep_on);
void (*poweroff)(void);
bool (*powerstatus)(void);
int (*hiber_mode)(bool);