uart_snps: Add early printf support

Move the allwinner early printf support to the snps driver as it
should work with all implementation.
While here add instruction for enabling it on 64bits SoCs.
This commit is contained in:
Emmanuel Vadot 2018-05-01 13:57:08 +00:00
parent 745a26b02a
commit 837db84723
2 changed files with 38 additions and 24 deletions

View File

@ -164,30 +164,6 @@ allwinner_cpu_reset(platform_t plat)
while (1);
}
/*
* To use early printf on Allwinner SoC, add to kernel config
* options SOCDEV_PA=0x01C00000
* options SOCDEV_VA=0x10000000
* options EARLY_PRINTF
* And remove the if 0
*/
#if 0
#ifdef EARLY_PRINTF
static void
allwinner_early_putc(int c)
{
volatile uint32_t * UART_STAT_REG = (uint32_t *)0x1002807C;
volatile uint32_t * UART_TX_REG = (uint32_t *)0x10028000;
const uint32_t UART_TXRDY = (1 << 2);
while ((*UART_STAT_REG & UART_TXRDY) == 0)
continue;
*UART_TX_REG = c;
}
early_putc_t *early_putc = allwinner_early_putc;
#endif /* EARLY_PRINTF */
#endif
#if defined(SOC_ALLWINNER_A10)
static platform_method_t a10_methods[] = {
PLATFORMMETHOD(platform_attach, a10_attach),

View File

@ -61,6 +61,44 @@ struct snps_softc {
#endif
};
/*
* To use early printf on 64 bits Allwinner SoC, add to kernel config
* options SOCDEV_PA=0x0
* options SOCDEV_VA=0x40000000
* options EARLY_PRINTF
*
* To use early printf on 32 bits Allwinner SoC, add to kernel config
* options SOCDEV_PA=0x01C00000
* options SOCDEV_VA=0x10000000
* options EARLY_PRINTF
*
* remove the if 0
*/
#if 0
#ifdef EARLY_PRINTF
static void
uart_snps_early_putc(int c)
{
volatile uint32_t *stat;
volatile uint32_t *tx;
#ifdef ALLWINNER_64
stat = (uint32_t *) (SOCDEV_VA + 0x1C2807C);
tx = (uint32_t *) (SOCDEV_VA + 0x1C28000);
#endif
#ifdef ALLWINNER_32
stat = (uint32_t *) (SOCDEV_VA + 0x2807C);
tx = (uint32_t *) (SOCDEV_VA + 0x28000);
#endif
while ((*stat & (1 << 2)) == 0)
continue;
*tx = c;
}
early_putc_t *early_putc = uart_snps_early_putc;
#endif /* EARLY_PRINTF */
#endif
static int
snps_uart_attach(struct uart_softc *uart_sc)
{