Index: arm/conf/BEAGLEBONE =================================================================== --- arm/conf/BEAGLEBONE (revision 252728) +++ arm/conf/BEAGLEBONE (working copy) @@ -24,7 +24,7 @@ include "../ti/am335x/std.beaglebone" -makeoptions MODULES_OVERRIDE="" +makeoptions MODULES_OVERRIDE="usb/urtwn" makeoptions WITHOUT_MODULES="ahc" options HZ=100 @@ -57,10 +57,10 @@ #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 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 @@ -69,12 +69,12 @@ options NFSLOCKD # 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 +options NFS_ROOT #NFS usable as /, requires NFSCL +options BOOTP_NFSROOT +options BOOTP_COMPAT +options BOOTP +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=cpsw0 # MMC/SD/SDIO card slot support @@ -82,7 +82,7 @@ device mmcsd # mmc/sd flash cards # Boot device is 2nd slice on MMC/SD card -options ROOTDEVNAME=\"ufs:mmcsd0s2\" +# options ROOTDEVNAME=\"ufs:mmcsd0s2\" # Console and misc device uart @@ -97,6 +97,7 @@ device iic device ti_i2c device am335x_pmic # AM335x Power Management IC (TPC65217) +device tda19988 # HDMI transmitter # GPIO device gpio @@ -123,7 +124,27 @@ device miibus device axe # ASIX Electronics USB Ethernet +device uftdi + +#device usb_template # Control of the gadget +#device usfs + +device wlan # 802.11 support +device wlan_wep # 802.11 WEP support +device wlan_ccmp # 802.11 CCMP support +device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm + +device run +device runfw +device firmware + +# Device mode support and USFS template +device usb_template # Control of the gadget +device usfs + + # Flattened Device Tree options FDT options FDT_DTB_STATIC -makeoptions FDT_DTS_FILE=beaglebone.dts +makeoptions FDT_DTS_FILE=beaglebone-black.dts Index: dev/iicbus/tda19988.c =================================================================== --- dev/iicbus/tda19988.c (revision 0) +++ dev/iicbus/tda19988.c (working copy) @@ -0,0 +1,248 @@ +/*- + * Copyright (c) 2013 Oleksandr Tymoshenko + * 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. + */ + +#include +__FBSDID("$FreeBSD: head/sys/arm/ti/am335x/tda19988.c 239281 2012-08-15 06:31:32Z gonzo $"); +/* +* NXP TDA19988 HDMI encoder +*/ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "iicbus_if.h" + +#define MAX_IIC_DATA_SIZE 2 + +#define MKREG(page, addr) (((page) << 8) | (addr)) + +#define REGPAGE(reg) (((reg) >> 8) & 0xff) +#define REGADDR(reg) ((reg) & 0xff) + +#define TDA_VERSION MKREG(0, 0x00) +#define TDA_CTRL MKREG(0, 0x01) +#define CTRL_SOFTRESET (1 << 0) +#define TDA_VERSION_MSB MKREG(0, 0x02) +#define TDA_SOFTRESET MKREG(0, 0x0a) +#define SOFTRESET_I2C (1 << 1) +#define SOFTRESET_AUDIO (1 << 0) +#define TDA_CURPAGE_ADDR 0xff + +#define TDA_CEC_ENAMODS 0xff +#define ENAMODS_RXSENS (1 << 2) +#define ENAMODS_HDMI (1 << 1) + +struct tda19988_softc { + device_t sc_dev; + uint32_t sc_addr; + uint32_t sc_cec_addr; + struct intr_config_hook enum_hook; + int sc_current_page; +}; + +static int +tda19988_set_page(device_t dev, uint8_t page) +{ + struct tda19988_softc *sc = device_get_softc(dev); + uint8_t addr = TDA_CURPAGE_ADDR; + struct iic_msg msg[] = { + { sc->sc_addr, IIC_M_WR, 1, &addr }, + { sc->sc_addr, IIC_M_WR, 1, &page }, + }; + + device_printf(dev, "set_page: %d\n", page); + sc->sc_current_page = page; + + return (iicbus_transfer(dev, msg, 2)); +} + +#if 0 +static int +tda19988_cec_read(device_t dev, uint8_t addr, uint8_t *data) +{ + struct tda19988_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_cec_addr, IIC_M_WR, 1, &addr }, + { sc->sc_cec_addr, IIC_M_RD, 1, data }, + }; + + return (iicbus_transfer(dev, msg, 2)); +} +#endif + +static int +tda19988_cec_write(device_t dev, uint8_t address, uint8_t data) +{ + struct tda19988_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_cec_addr, IIC_M_WR, 1, &address }, + { sc->sc_cec_addr, IIC_M_WR, 1, &data }, + }; + + return (iicbus_transfer(dev, msg, 2)); +} + +static int +tda19988_reg_read(device_t dev, uint8_t addr, uint8_t *data) +{ + struct tda19988_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_addr, IIC_M_WR, 1, &addr }, + { sc->sc_addr, IIC_M_RD, 1, data }, + }; + + if (sc->sc_current_page != REGPAGE(addr)) + tda19988_set_page(dev, REGPAGE(addr)); + + return (iicbus_transfer(dev, msg, 2)); +} + +static int +tda19988_reg_write(device_t dev, uint8_t address, uint8_t data) +{ + struct tda19988_softc *sc = device_get_softc(dev); + struct iic_msg msg[] = { + { sc->sc_addr, IIC_M_WR, 1, &address }, + { sc->sc_addr, IIC_M_WR, 1, &data }, + }; + + if (sc->sc_current_page != REGPAGE(address)) + tda19988_set_page(dev, REGPAGE(address)); + + return (iicbus_transfer(dev, msg, 2)); +} + +static int +tda19988_probe(device_t dev) +{ + if (!ofw_bus_is_compatible(dev, "nxp,tda19988")) + return (ENXIO); + + return (BUS_PROBE_DEFAULT); +} + +static void +tda19988_start(void *xdev) +{ + struct tda19988_softc *sc; + device_t dev = (device_t)xdev; + uint8_t data; + uint16_t version; + + sc = device_get_softc(dev); + tda19988_set_page(dev, 0); + + tda19988_cec_write(dev, TDA_CEC_ENAMODS, ENAMODS_RXSENS | ENAMODS_HDMI); + + /* Reset core */ + data = 0; + tda19988_reg_read(dev, TDA_SOFTRESET, &data); + printf("TDA_SOFTRESET = %02x\n", data); + data |= (SOFTRESET_AUDIO | SOFTRESET_I2C); + tda19988_reg_write(dev, TDA_SOFTRESET, data); + DELAY(100); + data &= ~(SOFTRESET_AUDIO | SOFTRESET_I2C); + tda19988_reg_write(dev, TDA_SOFTRESET, data); + DELAY(10000); + + #if 0 + data = 0; + tda19988_reg_read(dev, TDA_CTRL, &data); + printf("TDA_CTRL = %02x\n", data); + data |= CTRL_SOFTRESET; + tda19988_reg_write(dev, TDA_CTRL, data); + DELAY(100); + data &= ~CTRL_SOFTRESET; + tda19988_reg_write(dev, TDA_CTRL, data); + DELAY(100); + #endif + + + + data = 0x12; + version = 0; + tda19988_reg_read(dev, TDA_VERSION, &data); + version |= data; + tda19988_reg_read(dev, TDA_VERSION_MSB, &data); + version |= (data << 8); + printf("TDA version: %04x\n", version); + + config_intrhook_disestablish(&sc->enum_hook); +} + +static int +tda19988_attach(device_t dev) +{ + struct tda19988_softc *sc; + + sc = device_get_softc(dev); + + sc->sc_dev = dev; + sc->sc_addr = iicbus_get_addr(dev); + printf("SC ADDR: %08x\n", sc->sc_addr); + sc->sc_cec_addr = 0x34; /* hardcoded */ + + device_set_desc(dev, "NXP TDA19988 HDMI transmitter"); + + sc->enum_hook.ich_func = tda19988_start; + sc->enum_hook.ich_arg = dev; + + if (config_intrhook_establish(&sc->enum_hook) != 0) + return (ENOMEM); + + return (0); +} + +static device_method_t tda_methods[] = { + DEVMETHOD(device_probe, tda19988_probe), + DEVMETHOD(device_attach, tda19988_attach), + {0, 0}, +}; + +static driver_t tda_driver = { + "tda", + tda_methods, + sizeof(struct tda19988_softc), +}; + +static devclass_t tda_devclass; + +DRIVER_MODULE(tda, iicbus, tda_driver, tda_devclass, 0, 0); +MODULE_VERSION(tda, 1); +MODULE_DEPEND(tda, iicbus, 1, 1, 1); Index: conf/files =================================================================== --- conf/files (revision 252728) +++ conf/files (working copy) @@ -1449,6 +1449,7 @@ dev/iicbus/ds133x.c optional ds133x dev/iicbus/ds1374.c optional ds1374 dev/iicbus/ds1672.c optional ds1672 +dev/iicbus/tda19988.c optional tda19988 dev/iicbus/icee.c optional icee dev/iicbus/if_ic.c optional ic dev/iicbus/iic.c optional iic Index: boot/fdt/dts/beaglebone-black.dts =================================================================== --- boot/fdt/dts/beaglebone-black.dts (revision 252728) +++ boot/fdt/dts/beaglebone-black.dts (working copy) @@ -130,6 +130,37 @@ "GPMC_AD9", "ehrpwm2B", "output"; }; + lcd@4830e000 { + panel_name = "HDMI_640x480at60Hz"; + panel_width = <640>; + panel_height = <480>; + panel_hfp = <16>; + panel_hbp = <48>; + panel_hsw = <96>; + panel_vfp = <2>; + panel_vbp = <33>; + panel_vsw = <2>; + panel_pxl_clk = <25175>; + panel_invert_pxl_clk = <0>; + panel_type = <1>; /* Active or passive, compatibility */ + panel_max_bpp = <32>; /* compatibility */ + panel_min_bpp = <32>; /* compatibility */ + panel_shade = <1>; /* compatibility */ + ac_bias = <255>; + ac_bias_intrpt = <0>; + dma_burst_sz = <16>; + bpp = <32>; + fdd = <128>; + tft_alt_mode = <0>; /* compatiblity */ + stn_565_mode = <0>; /* compatibility */ + mono_8bit_mode = <0>; /* compatibilty */ + invert_line_clock = <1>; + invert_frm_clock = <1>; + sync_edge = <0>; + sync_ctrl = <1>; + raster_order = <0>; /* compatibity */ + }; + mmchs1@481D8000 { status = "okay"; }; @@ -140,6 +171,11 @@ compatible = "ti,am335x-pmic"; reg = <0x24>; }; + + tda19988@50 { + compatible = "nxp,tda19988"; + reg = <0x50>; + }; } };