Author: cognet Date: Sat Nov 19 00:55:46 2016 New Revision: 308819 URL: https://svnweb.freebsd.org/changeset/base/308819
Log: Don't assume we're running on a pandaboard if the pandaboard-specific code is compiled in, use FDT to detect it instead. Added: head/sys/arm/ti/omap4/pandaboard/pandaboard.h (contents, props changed) Deleted: head/sys/arm/ti/omap4/pandaboard/files.pandaboard head/sys/arm/ti/omap4/pandaboard/std.pandaboard Modified: head/sys/arm/conf/PANDABOARD head/sys/arm/ti/omap4/files.omap4 head/sys/arm/ti/omap4/pandaboard/pandaboard.c head/sys/arm/ti/usb/omap_ehci.c Modified: head/sys/arm/conf/PANDABOARD ============================================================================== --- head/sys/arm/conf/PANDABOARD Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/conf/PANDABOARD Sat Nov 19 00:55:46 2016 (r308819) @@ -28,7 +28,7 @@ ident PANDABOARD hints "PANDABOARD.hints" include "std.armv6" -include "../ti/omap4/pandaboard/std.pandaboard" +include "../ti/omap4/std.omap4" makeoptions MODULES_EXTRA=dtb/omap4 Modified: head/sys/arm/ti/omap4/files.omap4 ============================================================================== --- head/sys/arm/ti/omap4/files.omap4 Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/omap4/files.omap4 Sat Nov 19 00:55:46 2016 (r308819) @@ -14,6 +14,8 @@ arm/ti/omap4/omap4_scm_padconf.c standa arm/ti/omap4/omap4_mp.c optional smp arm/ti/omap4/omap4_wugen.c standard +arm/ti/omap4/pandaboard/pandaboard.c standard + arm/ti/twl/twl.c optional twl arm/ti/twl/twl_vreg.c optional twl twl_vreg arm/ti/twl/twl_clks.c optional twl twl_clks Modified: head/sys/arm/ti/omap4/pandaboard/pandaboard.c ============================================================================== --- head/sys/arm/ti/omap4/pandaboard/pandaboard.c Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/omap4/pandaboard/pandaboard.c Sat Nov 19 00:55:46 2016 (r308819) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include <machine/fdt.h> #include <arm/ti/omap4/omap4_reg.h> +#include <arm/ti/omap4/pandaboard/pandaboard.h> /* Registers in the SCRM that control the AUX clocks */ #define SCRM_ALTCLKSRC (0x110) @@ -111,8 +112,8 @@ __FBSDID("$FreeBSD$"); * RETURNS: * nothing. */ -static void -usb_hub_init(void) +void +pandaboard_usb_hub_init(void) { bus_space_handle_t scrm_addr, gpio1_addr, gpio2_addr, scm_addr; @@ -169,39 +170,3 @@ usb_hub_init(void) bus_space_unmap(fdtbus_bs_tag, gpio2_addr, OMAP44XX_GPIO2_SIZE); bus_space_unmap(fdtbus_bs_tag, scm_addr, OMAP44XX_SCM_PADCONF_SIZE); } - -/** - * board_init - initialises the pandaboard - * @dummy: ignored - * - * This function is called before any of the driver are initialised, which is - * annoying because it means we can't use the SCM, PRCM and GPIO modules which - * would really be useful. - * - * So we don't have: - * - any drivers - * - no interrupts - * - * What we do have: - * - virt/phys mappings from the devmap (see omap4.c) - * - - * - * - * So we are hamstrung without the useful drivers and we have to go back to - * direct register manupulation. Luckly we don't have to do to much, basically - * just setup the usb hub/ethernet. - * - */ -static void -board_init(void *dummy) -{ - /* Initialise the USB phy and hub */ - usb_hub_init(); - - /* - * XXX Board identification e.g. read out from FPGA or similar should - * go here - */ -} - -SYSINIT(board_init, SI_SUB_CPU, SI_ORDER_THIRD, board_init, NULL); Added: head/sys/arm/ti/omap4/pandaboard/pandaboard.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/ti/omap4/pandaboard/pandaboard.h Sat Nov 19 00:55:46 2016 (r308819) @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 2016 Olivier Houchard <cog...@freebsd.org> + * 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 ``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 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$ + */ + +#ifndef _PANDABOARD_H_ +#define _PANDABOARD_H_ +void pandaboard_usb_hub_init(void); +#endif /* _OMAP4_MP_H_ */ + Modified: head/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- head/sys/arm/ti/usb/omap_ehci.c Fri Nov 18 23:48:20 2016 (r308818) +++ head/sys/arm/ti/usb/omap_ehci.c Sat Nov 19 00:55:46 2016 (r308819) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include <sys/condvar.h> #include <dev/fdt/simplebus.h> +#include <dev/fdt/fdt_common.h> #include <dev/ofw/ofw_bus_subr.h> #include <dev/usb/usb.h> @@ -57,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include <arm/ti/ti_prcm.h> #include <arm/ti/usb/omap_usb.h> +#include <arm/ti/omap4/pandaboard/pandaboard.h> + /* EHCI */ #define OMAP_USBHOST_HCCAPBASE 0x0000 #define OMAP_USBHOST_HCSPARAMS 0x0004 @@ -258,6 +261,7 @@ omap_ehci_init(struct omap_ehci_softc *i static int omap_ehci_probe(device_t dev) { + phandle_t root; if (!ofw_bus_status_okay(dev)) return (ENXIO); @@ -265,6 +269,16 @@ omap_ehci_probe(device_t dev) if (!ofw_bus_is_compatible(dev, "ti,ehci-omap")) return (ENXIO); +#ifdef SOC_OMAP4 + /* + * If we're running a Pandaboard, run Pandaboard-specific + * init code. + */ + root = OF_finddevice("/"); + if (fdt_is_compatible(root, "ti,omap4-panda")) + pandaboard_usb_hub_init(); +#endif + device_set_desc(dev, OMAP_EHCI_HC_DEVSTR); return (BUS_PROBE_DEFAULT); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"