diff options
Diffstat (limited to 'arch/arm/boards/freescale-mx6-sabrelite/board.c')
-rw-r--r-- | arch/arm/boards/freescale-mx6-sabrelite/board.c | 123 |
1 files changed, 53 insertions, 70 deletions
diff --git a/arch/arm/boards/freescale-mx6-sabrelite/board.c b/arch/arm/boards/freescale-mx6-sabrelite/board.c index 63fa58886c..fe47743540 100644 --- a/arch/arm/boards/freescale-mx6-sabrelite/board.c +++ b/arch/arm/boards/freescale-mx6-sabrelite/board.c @@ -1,41 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: 2012 Steffen Trumtrar, Pengutronix + /* - * Copyright (C) 2012 Steffen Trumtrar, Pengutronix - * * based on arch/arm/boards/freescale-mx6-arm2/board.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. */ #include <common.h> #include <init.h> #include <environment.h> -#include <mach/imx6-regs.h> +#include <mach/imx/imx6-regs.h> #include <gpio.h> -#include <mach/bbu.h> +#include <mach/imx/bbu.h> #include <asm/armlinux.h> -#include <generated/mach-types.h> -#include <partition.h> +#include <asm/mach-types.h> +#include <of.h> +#include <deep-probe.h> #include <linux/phy.h> #include <asm/io.h> #include <asm/mmu.h> -#include <mach/generic.h> +#include <mach/imx/generic.h> #include <linux/sizes.h> #include <net.h> #include <linux/micrel_phy.h> -#include <mach/imx6.h> -#include <mach/devices-imx6.h> -#include <mach/iomux-mx6.h> +#include <mach/imx/imx6.h> +#include <mach/imx/iomux-mx6.h> #include <spi/spi.h> -#include <mach/spi.h> -#include <mach/usb.h> +#include <mach/imx/spi.h> +#include <mach/imx/usb.h> static iomux_v3_cfg_t sabrelite_enet_gpio_pads[] = { /* Ethernet */ @@ -48,18 +39,6 @@ static iomux_v3_cfg_t sabrelite_enet_gpio_pads[] = { MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24, }; -static int sabrelite_mem_init(void) -{ - if (!of_machine_is_compatible("fsl,imx6q-sabrelite") && - !of_machine_is_compatible("fsl,imx6dl-sabrelite")) - return 0; - - arm_add_mem_device("ram0", 0x10000000, SZ_1G); - - return 0; -} -mem_initcall(sabrelite_mem_init); - static int ksz9021rn_phy_fixup(struct phy_device *dev) { phy_write(dev, 0x09, 0x0f00); @@ -79,37 +58,37 @@ static int ksz9021rn_phy_fixup(struct phy_device *dev) static struct gpio fec_gpios[] = { { - .gpio = 87, + .gpio = IMX_GPIO_NR(3, 23), .flags = GPIOF_OUT_INIT_LOW, .label = "phy-rst", }, { - .gpio = 190, + .gpio = IMX_GPIO_NR(6, 30), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-addr2", }, { - .gpio = 23, + .gpio = IMX_GPIO_NR(1, 23), .flags = GPIOF_OUT_INIT_LOW, .label = "phy-led-mode", }, { /* MODE strap-in pins: advertise all capabilities */ - .gpio = 185, + .gpio = IMX_GPIO_NR(6, 25), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-adv1", }, { - .gpio = 187, + .gpio = IMX_GPIO_NR(6, 27), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-adv1", }, { - .gpio = 188, + .gpio = IMX_GPIO_NR(6, 28), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-adv1", }, { - .gpio = 189, + .gpio = IMX_GPIO_NR(6, 29), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-adv1", }, { /* Enable 125 MHz clock output */ - .gpio = 184, + .gpio = IMX_GPIO_NR(6, 24), .flags = GPIOF_OUT_INIT_HIGH, .label = "phy-125MHz", }, @@ -119,10 +98,6 @@ static int sabrelite_ksz9021rn_setup(void) { int ret; - if (!of_machine_is_compatible("fsl,imx6q-sabrelite") && - !of_machine_is_compatible("fsl,imx6dl-sabrelite")) - return 0; - mxc_iomux_v3_setup_multiple_pads(sabrelite_enet_gpio_pads, ARRAY_SIZE(sabrelite_enet_gpio_pads)); @@ -139,25 +114,31 @@ static int sabrelite_ksz9021rn_setup(void) return 0; } -/* - * Do this before the fec initializes but after our - * gpios are available. - */ -fs_initcall(sabrelite_ksz9021rn_setup); static void sabrelite_ehci_init(void) { /* hub reset */ - gpio_direction_output(204, 0); + gpio_direction_output(IMX_GPIO_NR(7, 12), 0); udelay(2000); - gpio_set_value(204, 1); + gpio_set_value(IMX_GPIO_NR(7, 12), 1); } -static int sabrelite_devices_init(void) +static int sabrelite_probe(struct device *dev) { - if (!of_machine_is_compatible("fsl,imx6q-sabrelite") && - !of_machine_is_compatible("fsl,imx6dl-sabrelite")) - return 0; + int ret; + + phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, + ksz9021rn_phy_fixup); + + barebox_set_hostname("sabrelite"); + + ret = of_devices_ensure_probed_by_property("gpio-controller"); + if (ret) + return ret; + + ret = sabrelite_ksz9021rn_setup(); + if (ret) + return ret; sabrelite_ehci_init(); @@ -168,19 +149,21 @@ static int sabrelite_devices_init(void) return 0; } -device_initcall(sabrelite_devices_init); - -static int sabrelite_coredevices_init(void) -{ - if (!of_machine_is_compatible("fsl,imx6q-sabrelite") && - !of_machine_is_compatible("fsl,imx6dl-sabrelite")) - return 0; +static const struct of_device_id sabrelite_match[] = { + { + .compatible = "fsl,imx6q-sabrelite", + }, { + .compatible = "fsl,imx6dl-sabrelite", + }, + { /* Sentinel */ }, +}; - phy_register_fixup_for_uid(PHY_ID_KSZ9021, MICREL_PHY_ID_MASK, - ksz9021rn_phy_fixup); +static struct driver sabrelite_driver = { + .name = "physom-imx6", + .probe = sabrelite_probe, + .of_compatible = sabrelite_match, +}; - barebox_set_hostname("sabrelite"); +postcore_platform_driver(sabrelite_driver); - return 0; -} -coredevice_initcall(sabrelite_coredevices_init); +BAREBOX_DEEP_PROBE_ENABLE(sabrelite_match); |