/* UART_DM uses four character word FIFO where as UART core * uses a character FIFO. so it's really inefficient to try * to write single character. But that's how dprintf has been * implemented. */ int uart_putc(int port, char c) { msm_boot_uart_dm_write(&c, 1); return 0; }
/** * do_uartwr - transmits a string of data * @s: string to transmit */ static int do_uartwr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { char *s = argv[2]; int port_no, port_max = IPQ_UART_MAX; uart_cfg_t *uart_tmp_cfg = gboard_param->uart_cfg; if (argc < 3) goto usage; port_no = (int)simple_strtoul(argv[1], NULL, 10); if (port_no > port_max) { printf("Invalid uart port for write: use port from 0 to %d\n", (port_max - 1)); } else { uart_tmp_cfg = uart_tmp_cfg + port_no; if (uart_tmp_cfg->base > 0) { while (*s != '\0') msm_boot_uart_dm_write(s++, 1, uart_tmp_cfg); } else { printf("This port %d is not suppported for additional uart write\n", port_no); } } return 0; usage: return CMD_RET_USAGE; }
void uart_init(void) { char *data = "Android Bootloader - UART_DM Initialized!!!\n"; msm_boot_uart_dm_init(); msm_boot_uart_dm_write(data, 44); }
/* UART_DM uses four character word FIFO where as UART core * uses a character FIFO. so it's really inefficient to try * to write single character. But that's how dprintf has been * implemented. */ int uart_putc(int port, char c) { uint32_t uart_base = port_lookup[port]; /* Don't do anything if UART is not initialized */ if (!uart_init_flag) return -1; msm_boot_uart_dm_write(uart_base, &c, 1); return 0; }
/* Defining functions that's exposed to outside world and in coformance to * existing uart implemention. These functions are being called to initialize * UART and print debug messages in bootloader. */ void uart_dm_init(uint8_t id, uint32_t gsbi_base, uint32_t uart_dm_base) { static uint8_t port = 0; char *data = "Android Bootloader - UART_DM Initialized!!!\n"; /* Configure the uart clock */ clock_config_uart_dm(id); dsb(); /* Configure GPIO to provide connectivity between UART block product ports and chip pads */ gpio_config_uart_dm(id); dsb(); /* Configure GSBI for UART_DM protocol. * I2C on 2 ports, UART (without HS flow control) on the other 2. * This is only on chips that have GSBI block */ if(gsbi_base) writel(GSBI_PROTOCOL_CODE_I2C_UART << GSBI_CTRL_REG_PROTOCOL_CODE_S, GSBI_CTRL_REG(gsbi_base)); dsb(); /* Configure clock selection register for tx and rx rates. * Selecting 115.2k for both RX and TX. */ writel(UART_DM_CLK_RX_TX_BIT_RATE, MSM_BOOT_UART_DM_CSR(uart_dm_base)); dsb(); /* Intialize UART_DM */ msm_boot_uart_dm_init(uart_dm_base); msm_boot_uart_dm_write(uart_dm_base, data, 44); ASSERT(port < ARRAY_SIZE(port_lookup)); port_lookup[port++] = uart_dm_base; /* Set UART init flag */ uart_init_flag = 1; }
/** * serial_putc - transmits a character * @c: character to transmit */ void serial_putc(char c) { uart_cfg_t *uart_tmp_cfg = gboard_param->console_uart_cfg; msm_boot_uart_dm_write(&c, 1, uart_tmp_cfg); }