static const char * mach_uniqueid(struct machine_t * mach) { static char uniqueid[16 + 1] = { 0 }; virtual_addr_t virt = phys_to_virt(S5P6818_ID_BASE); u32_t ecid0, ecid1; s5p6818_ip_reset(RESET_ID_ECID, 0); ecid0 = read32(virt + ID_ECID0); ecid1 = read32(virt + ID_ECID1); sprintf(uniqueid, "%02x%02x%02x%02x%02x%02x%02x%02x", (ecid0 >> 24) & 0xff, (ecid0 >> 16) & 0xff, (ecid0 >> 8) & 0xff, (ecid0 >> 0) & 0xff, (ecid1 >> 24) & 0xff, (ecid1 >> 16) & 0xff, (ecid1 >> 8) & 0xff, (ecid1 >> 0) & 0xff); return uniqueid; }
static int mach_detect(struct machine_t * mach) { /* * VIC to core, pass through GIC. */ write32(phys_to_virt(0xf0000100), 0); /* * Reset some IP modules. */ s5p6818_ip_reset(RESET_ID_TIMER, 0); s5p6818_ip_reset(RESET_ID_PWM, 0); s5p6818_ip_reset(RESET_ID_UART0, 0); s5p6818_ip_reset(RESET_ID_UART1, 0); s5p6818_ip_reset(RESET_ID_UART2, 0); s5p6818_ip_reset(RESET_ID_UART3, 0); s5p6818_ip_reset(RESET_ID_UART4, 0); s5p6818_ip_reset(RESET_ID_UART5, 0); return 1; }
static void s5p6818_uart_init(struct uart_t * uart) { struct resource_t * res = (struct resource_t *)uart->priv; struct s5p6818_uart_data_t * dat = (struct s5p6818_uart_data_t *)res->data; switch(res->id) { case 0: s5p6818_ip_reset(RESET_ID_UART0, 0); clk_enable("GATE-UART0"); gpio_set_cfg(S5P6818_GPIOD(18), 0x1); gpio_set_cfg(S5P6818_GPIOD(14), 0x1); gpio_set_direction(S5P6818_GPIOD(18), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOD(14), GPIO_DIRECTION_INPUT); break; case 1: s5p6818_ip_reset(RESET_ID_UART1, 0); clk_enable("GATE-UART1"); gpio_set_cfg(S5P6818_GPIOD(19), 0x1); gpio_set_cfg(S5P6818_GPIOD(15), 0x1); gpio_set_direction(S5P6818_GPIOD(19), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOD(15), GPIO_DIRECTION_INPUT); break; case 2: s5p6818_ip_reset(RESET_ID_UART2, 0); clk_enable("GATE-UART2"); gpio_set_cfg(S5P6818_GPIOD(20), 0x1); gpio_set_cfg(S5P6818_GPIOD(16), 0x1); gpio_set_direction(S5P6818_GPIOD(20), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOD(16), GPIO_DIRECTION_INPUT); break; case 3: s5p6818_ip_reset(RESET_ID_UART3, 0); clk_enable("GATE-UART3"); gpio_set_cfg(S5P6818_GPIOD(21), 0x1); gpio_set_cfg(S5P6818_GPIOD(17), 0x1); gpio_set_direction(S5P6818_GPIOD(21), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOD(17), GPIO_DIRECTION_INPUT); break; case 4: s5p6818_ip_reset(RESET_ID_UART4, 0); clk_enable("GATE-UART4"); gpio_set_cfg(S5P6818_GPIOB(29), 0x3); gpio_set_cfg(S5P6818_GPIOB(28), 0x3); gpio_set_direction(S5P6818_GPIOB(29), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOB(28), GPIO_DIRECTION_INPUT); break; case 5: s5p6818_ip_reset(RESET_ID_UART5, 0); clk_enable("GATE-UART5"); gpio_set_cfg(S5P6818_GPIOB(31), 0x3); gpio_set_cfg(S5P6818_GPIOB(30), 0x3); gpio_set_direction(S5P6818_GPIOB(31), GPIO_DIRECTION_OUTPUT); gpio_set_direction(S5P6818_GPIOB(30), GPIO_DIRECTION_INPUT); break; default: return; } write32(dat->regbase + UART_UCON, 0x00000005); write32(dat->regbase + UART_UFCON, 0x00000777); write32(dat->regbase + UART_UMCON, 0x00000000); s5p6818_uart_set(uart, dat->baud, dat->data, dat->parity, dat->stop); }
void s5p6818_timer_reset(void) { s5p6818_ip_reset(RESET_ID_TIMER, 0); }