summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-17 17:54:38 +0000
committerian <ian@FreeBSD.org>2014-05-17 17:54:38 +0000
commit52cdf0b123c0f95c8994717d246d5a3de75058b2 (patch)
tree5a6807627f9380bb6211c61d46af36728359e497 /sys
parent4c5f4bdec5a3a4245b1dec1d271dd22841fffc2c (diff)
downloadFreeBSD-src-52cdf0b123c0f95c8994717d246d5a3de75058b2.zip
FreeBSD-src-52cdf0b123c0f95c8994717d246d5a3de75058b2.tar.gz
MFC 263250, 263251, 263424, 263425, 263426, 263427, 263430, 263431
Use the same cache terminology as the ARM docs in comments. No functional changes. Use armv7 TLB flush code, not arm11, for cortex-a processors. Exynos/ Arndale... - Disable debugging by default. - Add display-related and clk devices to the tree - Prevent resources intersection with EHCI driver - Add display-related and clk devices to the tree - Prevent resources intersection with EHCI driver - Add driver for Display Controller. - Add support for Samsung Chromebook (ARM Cortex A15 machine). - Rename mct and ehci drivers files to match common naming.
Diffstat (limited to 'sys')
-rw-r--r--sys/arm/arm/cpufunc.c14
-rw-r--r--sys/arm/arm/cpufunc_asm_armv7.S10
-rw-r--r--sys/arm/conf/ARNDALE6
-rw-r--r--sys/arm/conf/CHROMEBOOK146
-rw-r--r--sys/arm/samsung/exynos/exynos5_common.h40
-rw-r--r--sys/arm/samsung/exynos/exynos5_ehci.c (renamed from sys/arm/samsung/exynos/ehci_exynos5.c)6
-rw-r--r--sys/arm/samsung/exynos/exynos5_fimd.c407
-rw-r--r--sys/arm/samsung/exynos/exynos5_mct.c (renamed from sys/arm/samsung/exynos/arch_timer.c)4
-rw-r--r--sys/arm/samsung/exynos/files.exynos55
-rw-r--r--sys/boot/fdt/dts/arm/exynos5250-chromebook.dts59
-rw-r--r--sys/boot/fdt/dts/arm/exynos5250.dtsi36
11 files changed, 710 insertions, 23 deletions
diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
index 3b9155f..75fa81d 100644
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -754,14 +754,18 @@ struct cpu_functions cortexa_cpufuncs = {
cpufunc_faultstatus, /* Faultstatus */
cpufunc_faultaddress, /* Faultaddress */
- /* TLB functions */
+ /*
+ * TLB functions. ARMv7 does all TLB ops based on a unified TLB model
+ * whether the hardware implements separate I+D or not, so we use the
+ * same 'ID' functions for all 3 variations.
+ */
armv7_tlb_flushID, /* tlb_flushID */
armv7_tlb_flushID_SE, /* tlb_flushID_SE */
- arm11_tlb_flushI, /* tlb_flushI */
- arm11_tlb_flushI_SE, /* tlb_flushI_SE */
- arm11_tlb_flushD, /* tlb_flushD */
- arm11_tlb_flushD_SE, /* tlb_flushD_SE */
+ armv7_tlb_flushID, /* tlb_flushI */
+ armv7_tlb_flushID_SE, /* tlb_flushI_SE */
+ armv7_tlb_flushID, /* tlb_flushD */
+ armv7_tlb_flushID_SE, /* tlb_flushD_SE */
/* Cache operations */
diff --git a/sys/arm/arm/cpufunc_asm_armv7.S b/sys/arm/arm/cpufunc_asm_armv7.S
index 2a4bb98..3599c14 100644
--- a/sys/arm/arm/cpufunc_asm_armv7.S
+++ b/sys/arm/arm/cpufunc_asm_armv7.S
@@ -84,10 +84,10 @@ END(armv7_setttb)
ENTRY(armv7_tlb_flushID)
dsb
#ifdef SMP
- mcr p15, 0, r0, c8, c3, 0 /* flush I+D tlb */
- mcr p15, 0, r0, c7, c1, 6 /* flush BTB */
+ mcr p15, 0, r0, c8, c3, 0 /* flush Unified TLB all entries Inner Shareable */
+ mcr p15, 0, r0, c7, c1, 6 /* flush BTB Inner Shareable */
#else
- mcr p15, 0, r0, c8, c7, 0 /* flush I+D tlb */
+ mcr p15, 0, r0, c8, c7, 0 /* flush Unified TLB all entries */
mcr p15, 0, r0, c7, c5, 6 /* flush BTB */
#endif
dsb
@@ -99,10 +99,10 @@ ENTRY(armv7_tlb_flushID_SE)
ldr r1, .Lpage_mask
bic r0, r0, r1
#ifdef SMP
- mcr p15, 0, r0, c8, c3, 3 /* flush D tlb single entry Inner Shareable*/
+ mcr p15, 0, r0, c8, c3, 3 /* flush Unified TLB single entry Inner Shareable */
mcr p15, 0, r0, c7, c1, 6 /* flush BTB Inner Shareable */
#else
- mcr p15, 0, r0, c8, c7, 1 /* flush D tlb single entry */
+ mcr p15, 0, r0, c8, c7, 1 /* flush Unified TLB single entry */
mcr p15, 0, r0, c7, c5, 6 /* flush BTB */
#endif
dsb
diff --git a/sys/arm/conf/ARNDALE b/sys/arm/conf/ARNDALE
index 39869e6..231bfc8 100644
--- a/sys/arm/conf/ARNDALE
+++ b/sys/arm/conf/ARNDALE
@@ -60,11 +60,11 @@ options BREAK_TO_DEBUGGER
#options VERBOSE_SYSINIT # Enable verbose sysinit messages
options KDB
options DDB # Enable the kernel debugger
-options INVARIANTS # Enable calls of extra sanity checking
-options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
+#options INVARIANTS # Enable calls of extra sanity checking
+#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
#options WITNESS # Enable checks to detect deadlocks and cycles
#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
-options DIAGNOSTIC
+#options DIAGNOSTIC
# NFS support
options NFSCL # Network Filesystem Client
diff --git a/sys/arm/conf/CHROMEBOOK b/sys/arm/conf/CHROMEBOOK
new file mode 100644
index 0000000..3a2a469
--- /dev/null
+++ b/sys/arm/conf/CHROMEBOOK
@@ -0,0 +1,146 @@
+# Kernel configuration for Samsung Chromebook (Exynos5 Dual machine).
+#
+# For more information on this file, please read the config(5) manual page,
+# and/or the handbook section on Kernel Configuration Files:
+#
+# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html
+#
+# The handbook is also available locally in /usr/share/doc/handbook
+# if you've installed the doc distribution, otherwise always see the
+# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the
+# latest information.
+#
+# An exhaustive list of options and more detailed explanations of the
+# device lines is also present in the ../../conf/NOTES and NOTES files.
+# If you are in doubt as to the purpose or necessity of a line, check first
+# in NOTES.
+#
+# $FreeBSD$
+
+ident CHROMEBOOK
+
+include "../samsung/exynos/std.exynos5"
+
+makeoptions MODULES_OVERRIDE=""
+makeoptions WITHOUT_MODULES="ahc"
+
+makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
+makeoptions WERROR="-Werror"
+
+options HZ=100
+options SCHED_4BSD # 4BSD scheduler
+options INET # InterNETworking
+options INET6 # IPv6 communications protocols
+options GEOM_PART_BSD # BSD partition scheme
+options GEOM_PART_MBR # MBR partition scheme
+options TMPFS # Efficient memory filesystem
+options FFS # Berkeley Fast Filesystem
+options SOFTUPDATES
+options UFS_ACL # Support for access control lists
+options UFS_DIRHASH # Improve performance on big directories
+options MSDOSFS # MSDOS Filesystem
+options CD9660 # ISO 9660 Filesystem
+options PROCFS # Process filesystem (requires PSEUDOFS)
+options PSEUDOFS # Pseudo-filesystem framework
+options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!]
+options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
+options KTRACE
+options SYSVSHM # SYSV-style shared memory
+options SYSVMSG # SYSV-style message queues
+options SYSVSEM # SYSV-style semaphores
+options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions
+options KBD_INSTALL_CDEV
+options PREEMPTION
+options FREEBSD_BOOT_LOADER
+options VFP # vfp/neon
+
+# Debugging
+makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols
+options BREAK_TO_DEBUGGER
+#options VERBOSE_SYSINIT # Enable verbose sysinit messages
+options KDB
+options DDB # Enable the kernel debugger
+#options INVARIANTS # Enable calls of extra sanity checking
+#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS
+#options WITNESS # Enable checks to detect deadlocks and cycles
+#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
+#options DIAGNOSTIC
+
+# NFS support
+options NFSCL # Network Filesystem Client
+options NFSLOCKD # Network Lock Manager
+options NFS_ROOT # NFS usable as /, requires NFSCLIENT
+
+# Uncomment this for NFS root
+#options NFS_ROOT # NFS usable as /, requires NFSCL
+#options BOOTP_NFSROOT
+#options BOOTP_COMPAT
+#options BOOTP
+#options BOOTP_NFSV3
+#options BOOTP_WIRED_TO=cpsw0
+
+device mmc # mmc/sd bus
+device mmcsd # mmc/sd flash cards
+device sdhci # generic sdhci
+
+options ROOTDEVNAME=\"ufs:/dev/da0\"
+
+#options SMP
+
+# Pseudo devices
+
+device loop
+device random
+device pty
+device md
+device gpio
+
+# USB support
+options USB_HOST_ALIGN=64 # Align usb buffers to cache line size.
+device usb
+options USB_DEBUG
+#options USB_REQ_DEBUG
+#options USB_VERBOSE
+#device musb
+device ehci
+#device ohci
+
+device umass
+device scbus # SCSI bus (required for SCSI)
+device da # Direct Access (disks)
+device pass
+
+# SATA
+#device ata
+#device atadisk
+#device mvs
+
+# Serial ports
+device uart
+
+# Framebuffer
+device vt
+device kbdmux
+options SC_DFLT_FONT # compile font in
+makeoptions SC_DFLT_FONT=cp437
+device ukbd
+
+# I2C (TWSI)
+#device iic
+#device iicbus
+
+# Ethernet
+device ether
+device mii
+device smsc
+device smscphy
+
+# USB ethernet support, requires miibus
+device miibus
+device axe # ASIX Electronics USB Ethernet
+device bpf # Berkeley packet filter
+
+#FDT
+options FDT
+options FDT_DTB_STATIC
+makeoptions FDT_DTS_FILE=exynos5250-chromebook.dts
diff --git a/sys/arm/samsung/exynos/exynos5_common.h b/sys/arm/samsung/exynos/exynos5_common.h
new file mode 100644
index 0000000..941d62a
--- /dev/null
+++ b/sys/arm/samsung/exynos/exynos5_common.h
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#define READ4(_sc, _reg) \
+ bus_space_read_4(_sc->bst, _sc->bsh, _reg)
+#define WRITE4(_sc, _reg, _val) \
+ bus_space_write_4(_sc->bst, _sc->bsh, _reg, _val)
+#define READ2(_sc, _reg) \
+ bus_space_read_2(_sc->bst, _sc->bsh, _reg)
+#define WRITE2(_sc, _reg, _val) \
+ bus_space_write_2(_sc->bst, _sc->bsh, _reg, _val)
+#define READ1(_sc, _reg) \
+ bus_space_read_1(_sc->bst, _sc->bsh, _reg)
+#define WRITE1(_sc, _reg, _val) \
+ bus_space_write_1(_sc->bst, _sc->bsh, _reg, _val)
diff --git a/sys/arm/samsung/exynos/ehci_exynos5.c b/sys/arm/samsung/exynos/exynos5_ehci.c
index 7022d46..dc438d5 100644
--- a/sys/arm/samsung/exynos/ehci_exynos5.c
+++ b/sys/arm/samsung/exynos/exynos5_ehci.c
@@ -61,8 +61,8 @@ __FBSDID("$FreeBSD$");
#define GPIO_MASK 0xf
#define GPIO_OUTPUT 1
#define GPIO_INPUT 0
-#define GPX3CON 0x0C60
-#define GPX3DAT 0x0C64
+#define GPX3CON 0x0
+#define GPX3DAT 0x4
#define PIN_USB 5
/* PWR control */
@@ -71,7 +71,7 @@ __FBSDID("$FreeBSD$");
#define PHY_POWER_OFF 0
/* SYSREG */
-#define EXYNOS5_SYSREG_USB2_PHY 0x230
+#define EXYNOS5_SYSREG_USB2_PHY 0x0
#define USB2_MODE_HOST 0x1
/* USB HOST */
diff --git a/sys/arm/samsung/exynos/exynos5_fimd.c b/sys/arm/samsung/exynos/exynos5_fimd.c
new file mode 100644
index 0000000..e56f477
--- /dev/null
+++ b/sys/arm/samsung/exynos/exynos5_fimd.c
@@ -0,0 +1,407 @@
+/*-
+ * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Samsung Exynos 5 Display Controller
+ * Chapter 15, Exynos 5 Dual User's Manual Public Rev 1.00
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/malloc.h>
+#include <sys/rman.h>
+#include <sys/timeet.h>
+#include <sys/timetc.h>
+#include <sys/watchdog.h>
+#include <sys/fbio.h>
+#include <sys/consio.h>
+#include <sys/eventhandler.h>
+#include <sys/gpio.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <dev/vt/vt.h>
+#include <dev/vt/colors/vt_termcolors.h>
+
+#include <arm/samsung/exynos/exynos5_common.h>
+
+#include "gpio_if.h"
+
+#include <machine/bus.h>
+#include <machine/fdt.h>
+#include <machine/cpu.h>
+#include <machine/intr.h>
+
+#include "fb_if.h"
+
+#define FIMDBYPASS_DISP1 (1 << 15)
+
+#define VIDCON0 (0x0)
+#define VIDCON0_ENVID (1 << 1)
+#define VIDCON0_ENVID_F (1 << 0)
+#define CLKVAL_F 0xb
+#define CLKVAL_F_OFFSET 6
+
+#define WINCON0 0x0020
+#define WINCON1 0x0024
+#define WINCON2 0x0028
+#define WINCON3 0x002C
+#define WINCON4 0x0030
+
+#define ENLOCAL_F (1 << 22)
+#define BPPMODE_F_RGB_16BIT_565 0x5
+#define BPPMODE_F_OFFSET 2
+#define ENWIN_F_ENABLE (1 << 0)
+#define HALF_WORD_SWAP_EN (1 << 16)
+
+#define SHADOWCON 0x0034
+#define CHANNEL0_EN (1 << 0)
+
+#define VIDOSD0A 0x0040
+#define VIDOSD0B 0x0044
+#define VIDOSD0C 0x0048
+
+#define VIDW00ADD0B0 0x00A0
+#define VIDW00ADD0B1 0x00A4
+#define VIDW00ADD0B2 0x20A0
+#define VIDW00ADD1B0 0x00D0
+#define VIDW00ADD1B1 0x00D4
+#define VIDW00ADD1B2 0x20D0
+
+#define VIDW00ADD2 0x0100
+#define VIDW01ADD2 0x0104
+#define VIDW02ADD2 0x0108
+#define VIDW03ADD2 0x010C
+#define VIDW04ADD2 0x0110
+
+#define VIDCON1 (0x04)
+#define VIDTCON0 0x0010
+#define VIDTCON1 0x0014
+#define VIDTCON2 0x0018
+#define VIDTCON3 0x001C
+
+#define VIDINTCON0 0x0130
+#define VIDINTCON1 0x0134
+
+#define VSYNC_PULSE_WIDTH_VAL 0x3
+#define VSYNC_PULSE_WIDTH_OFFSET 0
+#define V_FRONT_PORCH_VAL 0x3
+#define V_FRONT_PORCH_OFFSET 8
+#define V_BACK_PORCH_VAL 0x3
+#define V_BACK_PORCH_OFFSET 16
+
+#define HSYNC_PULSE_WIDTH_VAL 0x3
+#define HSYNC_PULSE_WIDTH_OFFSET 0
+#define H_FRONT_PORCH_VAL 0x3
+#define H_FRONT_PORCH_OFFSET 8
+#define H_BACK_PORCH_VAL 0x3
+#define H_BACK_PORCH_OFFSET 16
+
+#define HOZVAL_OFFSET 0
+#define LINEVAL_OFFSET 11
+
+#define OSD_RIGHTBOTX_F_OFFSET 11
+#define OSD_RIGHTBOTY_F_OFFSET 0
+
+#define DPCLKCON 0x27c
+#define DPCLKCON_EN (1 << 1)
+
+#define DREAD4(_sc, _reg) \
+ bus_space_read_4(_sc->bst_disp, _sc->bsh_disp, _reg)
+#define DWRITE4(_sc, _reg, _val) \
+ bus_space_write_4(_sc->bst_disp, _sc->bsh_disp, _reg, _val)
+
+struct panel_info {
+ uint32_t width;
+ uint32_t height;
+ uint32_t h_back_porch;
+ uint32_t h_pulse_width;
+ uint32_t h_front_porch;
+ uint32_t v_back_porch;
+ uint32_t v_pulse_width;
+ uint32_t v_front_porch;
+ uint32_t clk_div;
+ uint32_t backlight_pin;
+ uint32_t fixvclk;
+ uint32_t ivclk;
+ uint32_t clkval_f;
+};
+
+struct fimd_softc {
+ struct resource *res[3];
+ bus_space_tag_t bst;
+ bus_space_handle_t bsh;
+ bus_space_tag_t bst_disp;
+ bus_space_handle_t bsh_disp;
+ bus_space_tag_t bst_sysreg;
+ bus_space_handle_t bsh_sysreg;
+
+ void *ih;
+ device_t dev;
+ device_t sc_fbd; /* fbd child */
+ struct fb_info sc_info;
+ struct panel_info *panel;
+};
+
+static struct resource_spec fimd_spec[] = {
+ { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* Timer registers */
+ { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* FIMD */
+ { SYS_RES_MEMORY, 2, RF_ACTIVE }, /* DISP */
+ { -1, 0 }
+};
+
+static int
+fimd_probe(device_t dev)
+{
+
+ if (!ofw_bus_status_okay(dev))
+ return (ENXIO);
+
+ if (!ofw_bus_is_compatible(dev, "exynos,fimd"))
+ return (ENXIO);
+
+ device_set_desc(dev, "Samsung Exynos 5 Display Controller");
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+get_panel_info(struct fimd_softc *sc, struct panel_info *panel)
+{
+ phandle_t node;
+ pcell_t dts_value[3];
+ int len;
+
+ if ((node = ofw_bus_get_node(sc->dev)) == -1)
+ return (ENXIO);
+
+ /* panel size */
+ if ((len = OF_getproplen(node, "panel-size")) <= 0)
+ return (ENXIO);
+ OF_getprop(node, "panel-size", &dts_value, len);
+ panel->width = fdt32_to_cpu(dts_value[0]);
+ panel->height = fdt32_to_cpu(dts_value[1]);
+
+ /* hsync */
+ if ((len = OF_getproplen(node, "panel-hsync")) <= 0)
+ return (ENXIO);
+ OF_getprop(node, "panel-hsync", &dts_value, len);
+ panel->h_back_porch = fdt32_to_cpu(dts_value[0]);
+ panel->h_pulse_width = fdt32_to_cpu(dts_value[1]);
+ panel->h_front_porch = fdt32_to_cpu(dts_value[2]);
+
+ /* vsync */
+ if ((len = OF_getproplen(node, "panel-vsync")) <= 0)
+ return (ENXIO);
+ OF_getprop(node, "panel-vsync", &dts_value, len);
+ panel->v_back_porch = fdt32_to_cpu(dts_value[0]);
+ panel->v_pulse_width = fdt32_to_cpu(dts_value[1]);
+ panel->v_front_porch = fdt32_to_cpu(dts_value[2]);
+
+ /* clk divider */
+ if ((len = OF_getproplen(node, "panel-clk-div")) <= 0)
+ return (ENXIO);
+ OF_getprop(node, "panel-clk-div", &dts_value, len);
+ panel->clk_div = fdt32_to_cpu(dts_value[0]);
+
+ /* backlight pin */
+ if ((len = OF_getproplen(node, "panel-backlight-pin")) <= 0)
+ return (ENXIO);
+ OF_getprop(node, "panel-backlight-pin", &dts_value, len);
+ panel->backlight_pin = fdt32_to_cpu(dts_value[0]);
+
+ return (0);
+}
+
+static int
+fimd_init(struct fimd_softc *sc)
+{
+ struct panel_info *panel;
+ int reg;
+
+ panel = sc->panel;
+
+ /* fb_init */
+ reg = panel->ivclk | panel->fixvclk;
+ DWRITE4(sc,VIDCON1,reg);
+
+ reg = (VIDCON0_ENVID | VIDCON0_ENVID_F);
+ reg |= (panel->clkval_f << CLKVAL_F_OFFSET);
+ WRITE4(sc,VIDCON0,reg);
+
+ reg = (panel->v_pulse_width << VSYNC_PULSE_WIDTH_OFFSET);
+ reg |= (panel->v_front_porch << V_FRONT_PORCH_OFFSET);
+ reg |= (panel->v_back_porch << V_BACK_PORCH_OFFSET);
+ DWRITE4(sc,VIDTCON0,reg);
+
+ reg = (panel->h_pulse_width << HSYNC_PULSE_WIDTH_OFFSET);
+ reg |= (panel->h_front_porch << H_FRONT_PORCH_OFFSET);
+ reg |= (panel->h_back_porch << H_BACK_PORCH_OFFSET);
+ DWRITE4(sc,VIDTCON1,reg);
+
+ reg = ((panel->width - 1) << HOZVAL_OFFSET);
+ reg |= ((panel->height - 1) << LINEVAL_OFFSET);
+ DWRITE4(sc,VIDTCON2,reg);
+
+ WRITE4(sc,VIDW00ADD0B0, sc->sc_info.fb_pbase);
+ WRITE4(sc,VIDW00ADD1B0, sc->sc_info.fb_pbase + sc->sc_info.fb_size);
+ WRITE4(sc,VIDW00ADD2, panel->width * 2);
+
+ reg = ((panel->width - 1) << OSD_RIGHTBOTX_F_OFFSET);
+ reg |= ((panel->height - 1) << OSD_RIGHTBOTY_F_OFFSET);
+ WRITE4(sc,VIDOSD0B,reg);
+
+ reg = panel->width * panel->height;
+ WRITE4(sc,VIDOSD0C,reg);
+
+ reg = READ4(sc, SHADOWCON);
+ reg |= CHANNEL0_EN;
+ reg &= ~(1 << 5); /* disable local path for channel0 */
+ WRITE4(sc,SHADOWCON,reg);
+
+ reg = BPPMODE_F_RGB_16BIT_565 << BPPMODE_F_OFFSET;
+ reg |= ENWIN_F_ENABLE | HALF_WORD_SWAP_EN; /* Note: swap=0 when ENLOCAL==1 */
+ reg &= ~ENLOCAL_F; /* use DMA */
+ WRITE4(sc,WINCON0,reg);
+
+ /* Enable DisplayPort Clk */
+ WRITE4(sc, DPCLKCON, DPCLKCON_EN);
+
+ return (0);
+}
+
+static int
+fimd_attach(device_t dev)
+{
+ struct panel_info panel;
+ struct fimd_softc *sc;
+ device_t gpio_dev;
+ int reg;
+
+ sc = device_get_softc(dev);
+ sc->dev = dev;
+
+ if (bus_alloc_resources(dev, fimd_spec, sc->res)) {
+ device_printf(dev, "could not allocate resources\n");
+ return (ENXIO);
+ }
+
+ /* Memory interface */
+ sc->bst = rman_get_bustag(sc->res[0]);
+ sc->bsh = rman_get_bushandle(sc->res[0]);
+ sc->bst_disp = rman_get_bustag(sc->res[1]);
+ sc->bsh_disp = rman_get_bushandle(sc->res[1]);
+ sc->bst_sysreg = rman_get_bustag(sc->res[2]);
+ sc->bsh_sysreg = rman_get_bushandle(sc->res[2]);
+
+ if (get_panel_info(sc, &panel)) {
+ device_printf(dev, "Can't get panel info\n");
+ return (ENXIO);
+ }
+
+ panel.fixvclk = 0;
+ panel.ivclk = 0;
+ panel.clkval_f = 2;
+
+ sc->panel = &panel;
+
+ /* Get the GPIO device, we need this to give power to USB */
+ gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
+ if (gpio_dev == NULL) {
+ /* TODO */
+ }
+
+ reg = bus_space_read_4(sc->bst_sysreg, sc->bsh_sysreg, 0x214);
+ reg |= FIMDBYPASS_DISP1;
+ bus_space_write_4(sc->bst_sysreg, sc->bsh_sysreg, 0x214, reg);
+
+ sc->sc_info.fb_width = panel.width;
+ sc->sc_info.fb_height = panel.height;
+ sc->sc_info.fb_stride = sc->sc_info.fb_width * 2;
+ sc->sc_info.fb_bpp = sc->sc_info.fb_depth = 16;
+ sc->sc_info.fb_size = sc->sc_info.fb_height * sc->sc_info.fb_stride;
+ sc->sc_info.fb_vbase = (intptr_t)contigmalloc(sc->sc_info.fb_size,
+ M_DEVBUF, M_ZERO, 0, ~0, PAGE_SIZE, 0);
+ sc->sc_info.fb_pbase = (intptr_t)vtophys(sc->sc_info.fb_vbase);
+
+#if 0
+ printf("%dx%d [%d]\n", sc->sc_info.fb_width, sc->sc_info.fb_height,
+ sc->sc_info.fb_stride);
+ printf("pbase == 0x%08x\n", sc->sc_info.fb_pbase);
+#endif
+
+ memset((int8_t *)sc->sc_info.fb_vbase, 0x0, sc->sc_info.fb_size);
+
+ fimd_init(sc);
+
+ sc->sc_info.fb_name = device_get_nameunit(dev);
+
+ /* Ask newbus to attach framebuffer device to me. */
+ sc->sc_fbd = device_add_child(dev, "fbd", device_get_unit(dev));
+ if (sc->sc_fbd == NULL)
+ device_printf(dev, "Can't attach fbd device\n");
+
+ if (device_probe_and_attach(sc->sc_fbd) != 0) {
+ device_printf(sc->dev, "Failed to attach fbd device\n");
+ }
+
+ return (0);
+}
+
+static struct fb_info *
+fimd_fb_getinfo(device_t dev)
+{
+ struct fimd_softc *sc = device_get_softc(dev);
+
+ return (&sc->sc_info);
+}
+
+static device_method_t fimd_methods[] = {
+ DEVMETHOD(device_probe, fimd_probe),
+ DEVMETHOD(device_attach, fimd_attach),
+
+ /* Framebuffer service methods */
+ DEVMETHOD(fb_getinfo, fimd_fb_getinfo),
+ { 0, 0 }
+};
+
+static driver_t fimd_driver = {
+ "fb",
+ fimd_methods,
+ sizeof(struct fimd_softc),
+};
+
+static devclass_t fimd_devclass;
+
+DRIVER_MODULE(fb, simplebus, fimd_driver, fimd_devclass, 0, 0);
diff --git a/sys/arm/samsung/exynos/arch_timer.c b/sys/arm/samsung/exynos/exynos5_mct.c
index 9408df5..863baa8 100644
--- a/sys/arm/samsung/exynos/arch_timer.c
+++ b/sys/arm/samsung/exynos/exynos5_mct.c
@@ -129,11 +129,11 @@ static device_method_t arm_tmr_methods[] = {
};
static driver_t arm_tmr_driver = {
- "arch_timer",
+ "mct",
arm_tmr_methods,
sizeof(struct arm_tmr_softc),
};
static devclass_t arm_tmr_devclass;
-DRIVER_MODULE(arch_timer, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0);
+DRIVER_MODULE(mct, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0);
diff --git a/sys/arm/samsung/exynos/files.exynos5 b/sys/arm/samsung/exynos/files.exynos5
index c68b1ff..fc68cd3 100644
--- a/sys/arm/samsung/exynos/files.exynos5
+++ b/sys/arm/samsung/exynos/files.exynos5
@@ -13,11 +13,12 @@ arm/arm/bus_space-v6.c standard
arm/arm/gic.c standard
arm/arm/generic_timer.c standard
-arm/samsung/exynos/arch_timer.c standard
+arm/samsung/exynos/exynos5_mct.c standard
arm/samsung/exynos/exynos5_mp.c optional smp
arm/samsung/exynos/exynos5_common.c standard
arm/samsung/exynos/exynos5_machdep.c standard
arm/samsung/exynos/uart.c optional uart
-arm/samsung/exynos/ehci_exynos5.c optional ehci
+arm/samsung/exynos/exynos5_ehci.c optional ehci
+arm/samsung/exynos/exynos5_fimd.c optional vt
#dev/sdhci/sdhci_fdt.c optional sdhci
diff --git a/sys/boot/fdt/dts/arm/exynos5250-chromebook.dts b/sys/boot/fdt/dts/arm/exynos5250-chromebook.dts
new file mode 100644
index 0000000..0b9c978
--- /dev/null
+++ b/sys/boot/fdt/dts/arm/exynos5250-chromebook.dts
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2014 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/dts-v1/;
+
+/include/ "exynos5250.dtsi"
+
+/ {
+ model = "Samsung Chromebook";
+
+ memory {
+ device_type = "memory";
+ reg = < 0x40000000 0x80000000 >; /* 2G */
+ };
+
+ SOC: Exynos5@0 {
+
+ fimd0: fimd@14400000 {
+ status = "okay";
+
+ panel-size = < 1366 768 >;
+ panel-hsync = < 80 32 48 >;
+ panel-vsync = < 14 5 3 >;
+ panel-clk-div = < 17 >;
+ panel-backlight-pin = < 25 >;
+ };
+
+ };
+
+ chosen {
+ stdin = &serial2;
+ stdout = &serial2;
+ };
+};
diff --git a/sys/boot/fdt/dts/arm/exynos5250.dtsi b/sys/boot/fdt/dts/arm/exynos5250.dtsi
index 860fcd0..f679a13 100644
--- a/sys/boot/fdt/dts/arm/exynos5250.dtsi
+++ b/sys/boot/fdt/dts/arm/exynos5250.dtsi
@@ -32,7 +32,16 @@
#size-cells = <1>;
interrupt-parent = <&GIC>;
- Exynos5@0 {
+ aliases {
+ soc = &SOC;
+ serial0 = &serial0;
+ serial1 = &serial1;
+ clk0 = &clk0;
+ dp0 = &dp0;
+ fimd0 = &fimd0;
+ };
+
+ SOC: Exynos5@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "simple-bus";
@@ -48,6 +57,11 @@
#interrupt-cells = <1>;
};
+ clk0: clk@10010000 {
+ compatible = "exynos,clk";
+ reg = < 0x10020000 0x20000 >;
+ };
+
mct {
compatible = "exynos,mct";
reg = < 0x101C0000 0x1000 >;
@@ -72,8 +86,8 @@
reg = <0x12110000 0x1000>, /* EHCI */
<0x12130000 0x1000>, /* EHCI host ctrl */
<0x10040000 0x1000>, /* Power */
- <0x10050000 0x1000>, /* Sysreg */
- <0x11400000 0x1000>; /* GPIO left */
+ <0x10050230 0x10>, /* Sysreg */
+ <0x11400C60 0x10>; /* GPIO left */
interrupts = < 103 >;
interrupt-parent = <&GIC>;
};
@@ -153,5 +167,21 @@
current-speed = <115200>;
};
+ fimd0: fimd@14400000 {
+ compatible = "exynos,fimd";
+ status = "disabled";
+ reg = < 0x14400000 0x10000 >, /* fimd */
+ < 0x14420000 0x10000 >, /* disp */
+ < 0x10050000 0x220 >; /* sysreg */
+ interrupt-parent = <&GIC>;
+ };
+
+ dp0: dp@145B0000 {
+ compatible = "exynos,dp";
+ status = "disabled";
+ reg = < 0x145B0000 0x10000 >,
+ < 0x10040720 0x10 >; /* PHY */
+ interrupt-parent = <&GIC>;
+ };
};
};
OpenPOWER on IntegriCloud