Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
firefly: add roc-rk3328-cc board support
Change-Id: Idb11a95a01c828da1e4818e6b4814a448b754f6b
- Loading branch information
Showing
with
465 additions
and 0 deletions.
- +1 −0 arch/arm/dts/Makefile
- +231 −0 arch/arm/dts/rk3328-roc-cc.dts
- +11 −0 arch/arm/mach-rockchip/rk3328/Kconfig
- +15 −0 board/rockchip/roc_rk3328_cc/Kconfig
- +7 −0 board/rockchip/roc_rk3328_cc/Makefile
- +85 −0 board/rockchip/roc_rk3328_cc/roc-rk3328-cc.c
- +97 −0 configs/roc-rk3328-cc_defconfig
- +18 −0 include/configs/roc_rk3328_cc.h
| @@ -0,0 +1,231 @@ | ||
| /* | ||
| * (C) Copyright 2016 Rockchip Electronics Co., Ltd | ||
| * | ||
| * SPDX-License-Identifier: GPL-2.0+ | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
| #include "rk3328.dtsi" | ||
| #include "rk3328-sdram-ddr3-666.dtsi" | ||
|
|
||
| / { | ||
| model = "Firefly ROC-RK3328-CC"; | ||
| compatible = "firefly,roc-rk3328-cc", "rockchip,rk3328"; | ||
|
|
||
| chosen { | ||
| stdout-path = &uart2; | ||
| }; | ||
|
|
||
| vcc3v3_sdmmc: sdmmc-pwren { | ||
| compatible = "regulator-fixed"; | ||
| regulator-name = "vcc3v3"; | ||
| gpio = <&gpio0 30 GPIO_ACTIVE_HIGH>; | ||
| regulator-always-on; | ||
| regulator-boot-on; | ||
| }; | ||
|
|
||
| vcc5v0_otg: vcc5v0-otg-drv { | ||
| compatible = "regulator-fixed"; | ||
| enable-active-high; | ||
| regulator-name = "vcc5v0_otg"; | ||
| gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; | ||
| regulator-min-microvolt = <5000000>; | ||
| regulator-max-microvolt = <5000000>; | ||
| }; | ||
|
|
||
| vcc5v0_host_xhci: vcc5v0-host-xhci-drv { | ||
| status = "disabled"; //usb host xhci and usb otg use the same gpio to enable power | ||
| compatible = "regulator-fixed"; | ||
| enable-active-high; | ||
| regulator-name = "vcc5v0_host_xhci"; | ||
| gpio = <&gpio1 26 GPIO_ACTIVE_HIGH>; | ||
| regulator-min-microvolt = <5000000>; | ||
| regulator-max-microvolt = <5000000>; | ||
| }; | ||
| }; | ||
|
|
||
| &saradc { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &uart2 { | ||
| u-boot,dm-pre-reloc; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &sdmmc { | ||
| bus-width = <4>; | ||
| cap-mmc-highspeed; | ||
| cap-sd-highspeed; | ||
| card-detect-delay = <200>; | ||
| disable-wp; | ||
| num-slots = <1>; | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&sdmmc0_clk>, <&sdmmc0_cmd>, <&sdmmc0_dectn>, <&sdmmc0_bus4>; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &emmc { | ||
| u-boot,dm-pre-reloc; | ||
| bus-width = <8>; | ||
| cap-mmc-highspeed; | ||
| supports-emmc; | ||
| disable-wp; | ||
| non-removable; | ||
| num-slots = <1>; | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &u2phy { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &u2phy_otg { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &u2phy_host { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &usb_host0_ehci { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &usb_host0_ohci { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &usb20_otg { | ||
| vbus-supply = <&vcc5v0_otg>; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &usb_host0_xhci { | ||
| vbus-supply = <&vcc5v0_host_xhci>; | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| &i2c1 { | ||
| clock-frequency = <400000>; | ||
| i2c-scl-rising-time-ns = <168>; | ||
| i2c-scl-falling-time-ns = <4>; | ||
| status = "okay"; | ||
|
|
||
| rk805: pmic@18 { | ||
| compatible = "rockchip,rk805"; | ||
| status = "okay"; | ||
| reg = <0x18>; | ||
| interrupt-parent = <&gpio1>; | ||
| interrupts = <6 IRQ_TYPE_LEVEL_LOW>; | ||
| pinctrl-names = "default"; | ||
| pinctrl-0 = <&pmic_int_l>; | ||
| rockchip,system-power-controller; | ||
| wakeup-source; | ||
| gpio-controller; | ||
| #gpio-cells = <2>; | ||
| #clock-cells = <1>; | ||
| clock-output-names = "xin32k", "rk805-clkout2"; | ||
|
|
||
| pwrkey { | ||
| status = "okay"; | ||
| }; | ||
|
|
||
| regulators { | ||
| vdd_logic: DCDC_REG1 { | ||
| regulator-name = "vdd_logic"; | ||
| regulator-min-microvolt = <712500>; | ||
| regulator-max-microvolt = <1450000>; | ||
| regulator-ramp-delay = <6001>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <1000000>; | ||
| }; | ||
| }; | ||
|
|
||
| vdd_arm: DCDC_REG2 { | ||
| regulator-name = "vdd_arm"; | ||
| regulator-min-microvolt = <712500>; | ||
| regulator-max-microvolt = <1450000>; | ||
| regulator-ramp-delay = <6001>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <1000000>; | ||
| }; | ||
| }; | ||
|
|
||
| vcc_ddr: DCDC_REG3 { | ||
| regulator-name = "vcc_ddr"; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| }; | ||
| }; | ||
|
|
||
| vcc_io: DCDC_REG4 { | ||
| regulator-name = "vcc_io"; | ||
| regulator-min-microvolt = <3300000>; | ||
| regulator-max-microvolt = <3300000>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <3300000>; | ||
| }; | ||
| }; | ||
|
|
||
| vdd_18: LDO_REG1 { | ||
| regulator-name = "vdd_18"; | ||
| regulator-min-microvolt = <1800000>; | ||
| regulator-max-microvolt = <1800000>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <1800000>; | ||
| }; | ||
| }; | ||
|
|
||
| vcc_18emmc: LDO_REG2 { | ||
| regulator-name = "vcc_18emmc"; | ||
| regulator-min-microvolt = <1800000>; | ||
| regulator-max-microvolt = <1800000>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <1800000>; | ||
| }; | ||
| }; | ||
|
|
||
| vdd_10: LDO_REG3 { | ||
| regulator-name = "vdd_10"; | ||
| regulator-min-microvolt = <1000000>; | ||
| regulator-max-microvolt = <1000000>; | ||
| regulator-boot-on; | ||
| regulator-always-on; | ||
| regulator-state-mem { | ||
| regulator-on-in-suspend; | ||
| regulator-suspend-microvolt = <1000000>; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| &pinctrl { | ||
| pmic { | ||
| pmic_int_l: pmic-int-l { | ||
| rockchip,pins = | ||
| <1 RK_PD0 RK_FUNC_GPIO &pcfg_pull_up>; /* gpio1_d0 */ | ||
| }; | ||
| }; | ||
| }; | ||
|
|
| @@ -0,0 +1,15 @@ | ||
| if TARGET_ROC_RK3328_CC | ||
|
|
||
| config SYS_BOARD | ||
| default "roc_rk3328_cc" | ||
|
|
||
| config SYS_VENDOR | ||
| default "rockchip" | ||
|
|
||
| config SYS_CONFIG_NAME | ||
| default "roc_rk3328_cc" | ||
|
|
||
| config BOARD_SPECIFIC_OPTIONS # dummy | ||
| def_bool y | ||
|
|
||
| endif |
| @@ -0,0 +1,7 @@ | ||
| # | ||
| # (C) Copyright 2018 FIREFLY | ||
| # | ||
| # SPDX-License-Identifier: GPL-2.0+ | ||
| # | ||
|
|
||
| obj-y += roc-rk3328-cc.o |
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * (C) Copyright 2018 FIREFLY | ||
| * | ||
| * SPDX-License-Identifier: GPL-2.0+ | ||
| */ | ||
|
|
||
| #include <common.h> | ||
| #include <asm/arch/hardware.h> | ||
| #include <asm/arch/grf_rk3328.h> | ||
| #include <asm/armv8/mmu.h> | ||
| #include <asm/io.h> | ||
| #include <dwc3-uboot.h> | ||
| #include <power/regulator.h> | ||
| #include <usb.h> | ||
|
|
||
| DECLARE_GLOBAL_DATA_PTR; | ||
|
|
||
| int board_init(void) | ||
| { | ||
| int ret; | ||
| #define GRF_BASE 0xff100000 | ||
| struct rk3328_grf_regs * const grf = (void *)GRF_BASE; | ||
|
|
||
| /* uart2 select m1, sdcard select m1*/ | ||
| rk_clrsetreg(&grf->com_iomux, | ||
| IOMUX_SEL_UART2_MASK | IOMUX_SEL_SDMMC_MASK, | ||
| IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT | | ||
| IOMUX_SEL_SDMMC_M1 << IOMUX_SEL_SDMMC_SHIFT); | ||
|
|
||
| ret = regulators_enable_boot_on(false); | ||
| if (ret) | ||
| debug("%s: Cannot enable boot on regulator\n", __func__); | ||
|
|
||
| #define GRF_SOC_CON10 0xff100428 | ||
| rk_setreg(GRF_SOC_CON10, (BIT(1) << 16) | (0 << 1)); | ||
|
|
||
| return ret; | ||
| } | ||
|
|
||
| #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) | ||
| #include <usb.h> | ||
| #include <usb/dwc2_udc.h> | ||
|
|
||
| static struct dwc2_plat_otg_data rk3328_otg_data = { | ||
| .rx_fifo_sz = 512, | ||
| .np_tx_fifo_sz = 16, | ||
| .tx_fifo_sz = 128, | ||
| }; | ||
|
|
||
| int board_usb_init(int index, enum usb_init_type init) | ||
| { | ||
| int node; | ||
| const char *mode; | ||
| bool matched = false; | ||
| const void *blob = gd->fdt_blob; | ||
|
|
||
| /* find the usb_otg node */ | ||
| node = fdt_node_offset_by_compatible(blob, -1, | ||
| "rockchip,rk3328-usb"); | ||
|
|
||
| while (node > 0) { | ||
| mode = fdt_getprop(blob, node, "dr_mode", NULL); | ||
| if (mode && strcmp(mode, "otg") == 0) { | ||
| matched = true; | ||
| break; | ||
| } | ||
|
|
||
| node = fdt_node_offset_by_compatible(blob, node, | ||
| "rockchip,rk3328-usb"); | ||
| } | ||
| if (!matched) { | ||
| debug("Not found usb_otg device\n"); | ||
| return -ENODEV; | ||
| } | ||
|
|
||
| rk3328_otg_data.regs_otg = fdtdec_get_addr(blob, node, "reg"); | ||
|
|
||
| return dwc2_udc_probe(&rk3328_otg_data); | ||
| } | ||
|
|
||
| int board_usb_cleanup(int index, enum usb_init_type init) | ||
| { | ||
| return 0; | ||
| } | ||
| #endif |
Oops, something went wrong.