Patrice Chotard | 5cc16d8 | 2017-02-21 13:37:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Board init file for STiH410-B2260 |
| 3 | * |
| 4 | * (C) Copyright 2017 Patrice Chotard <patrice.chotard@st.com> |
| 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0+ |
| 7 | */ |
| 8 | |
| 9 | #include <common.h> |
Patrice Chotard | 4e6eeea | 2017-09-05 11:04:27 +0200 | [diff] [blame^] | 10 | #include <linux/usb/otg.h> |
| 11 | #include <dwc3-sti-glue.h> |
| 12 | #include <dwc3-uboot.h> |
| 13 | #include <usb.h> |
Patrice Chotard | 5cc16d8 | 2017-02-21 13:37:12 +0100 | [diff] [blame] | 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | int dram_init(void) |
| 18 | { |
| 19 | gd->ram_size = PHYS_SDRAM_1_SIZE; |
| 20 | return 0; |
| 21 | } |
| 22 | |
Simon Glass | 76b00ac | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 23 | int dram_init_banksize(void) |
Patrice Chotard | 5cc16d8 | 2017-02-21 13:37:12 +0100 | [diff] [blame] | 24 | { |
| 25 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 26 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
Simon Glass | 76b00ac | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 27 | |
| 28 | return 0; |
Patrice Chotard | 5cc16d8 | 2017-02-21 13:37:12 +0100 | [diff] [blame] | 29 | } |
| 30 | |
Patrice Chotard | 4c4da9f | 2017-03-20 15:21:36 +0100 | [diff] [blame] | 31 | #ifndef CONFIG_SYS_DCACHE_OFF |
| 32 | void enable_caches(void) |
| 33 | { |
| 34 | /* Enable D-cache. I-cache is already enabled in start.S */ |
| 35 | dcache_enable(); |
| 36 | } |
| 37 | #endif |
| 38 | |
Patrice Chotard | 5cc16d8 | 2017-02-21 13:37:12 +0100 | [diff] [blame] | 39 | int board_init(void) |
| 40 | { |
| 41 | return 0; |
| 42 | } |
Patrice Chotard | 4e6eeea | 2017-09-05 11:04:27 +0200 | [diff] [blame^] | 43 | |
| 44 | #ifdef CONFIG_USB_DWC3 |
| 45 | static struct dwc3_device dwc3_device_data = { |
| 46 | .maximum_speed = USB_SPEED_HIGH, |
| 47 | .dr_mode = USB_DR_MODE_PERIPHERAL, |
| 48 | .index = 0, |
| 49 | }; |
| 50 | |
| 51 | int usb_gadget_handle_interrupts(int index) |
| 52 | { |
| 53 | dwc3_uboot_handle_interrupt(index); |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | int board_usb_init(int index, enum usb_init_type init) |
| 58 | { |
| 59 | int node; |
| 60 | const void *blob = gd->fdt_blob; |
| 61 | |
| 62 | /* find the snps,dwc3 node */ |
| 63 | node = fdt_node_offset_by_compatible(blob, -1, "snps,dwc3"); |
| 64 | |
| 65 | dwc3_device_data.base = fdtdec_get_addr(blob, node, "reg"); |
| 66 | |
| 67 | return dwc3_uboot_init(&dwc3_device_data); |
| 68 | } |
| 69 | |
| 70 | int board_usb_cleanup(int index, enum usb_init_type init) |
| 71 | { |
| 72 | dwc3_uboot_exit(index); |
| 73 | return 0; |
| 74 | } |
| 75 | |
| 76 | int g_dnl_board_usb_cable_connected(void) |
| 77 | { |
| 78 | return 1; |
| 79 | } |
| 80 | #endif |