common: Drop net.h from common header
[oweals/u-boot.git] / board / freescale / mx6sabreauto / mx6sabreauto.c
index c7e3e6712daf3006fa38b980b36b853ebd3f62f4..33da3914d3edb4976a2f8ff257c6ccc2740894b9 100644 (file)
@@ -6,11 +6,14 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
@@ -18,9 +21,8 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/spi.h>
 #include <mmc.h>
-#include <fsl_esdhc.h>
+#include <fsl_esdhc_imx.h>
 #include <miiphy.h>
-#include <netdev.h>
 #include <asm/arch/sys_proto.h>
 #include <i2c.h>
 #include <input.h>
@@ -74,23 +76,6 @@ static iomux_v3_cfg_t const uart4_pads[] = {
        IOMUX_PADS(PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)),
 };
 
-static iomux_v3_cfg_t const enet_pads[] = {
-       IOMUX_PADS(PAD_KEY_COL1__ENET_MDIO              | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_KEY_COL2__ENET_MDC               | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK        | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3             | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-       IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL       | MUX_PAD_CTRL(ENET_PAD_CTRL)),
-};
 
 /* I2C2 PMIC, iPod, Tuner, Codec, Touch, HDMI EDID, MIPI CSI2 card */
 static struct i2c_pads_info mx6q_i2c_pad_info1 = {
@@ -159,44 +144,6 @@ static iomux_v3_cfg_t const port_exp[] = {
        IOMUX_PADS(PAD_SD2_DAT0__GPIO1_IO15     | MUX_PAD_CTRL(NO_PAD_CTRL)),
 };
 
-/*Define for building port exp gpio, pin starts from 0*/
-#define PORTEXP_IO_NR(chip, pin) \
-       ((chip << 5) + pin)
-
-/*Get the chip addr from a ioexp gpio*/
-#define PORTEXP_IO_TO_CHIP(gpio_nr) \
-       (gpio_nr >> 5)
-
-/*Get the pin number from a ioexp gpio*/
-#define PORTEXP_IO_TO_PIN(gpio_nr) \
-       (gpio_nr & 0x1f)
-
-static int port_exp_direction_output(unsigned gpio, int value)
-{
-       int ret;
-
-       i2c_set_bus_num(2);
-       ret = i2c_probe(PORTEXP_IO_TO_CHIP(gpio));
-       if (ret)
-               return ret;
-
-       ret = pca953x_set_dir(PORTEXP_IO_TO_CHIP(gpio),
-               (1 << PORTEXP_IO_TO_PIN(gpio)),
-               (PCA953X_DIR_OUT << PORTEXP_IO_TO_PIN(gpio)));
-
-       if (ret)
-               return ret;
-
-       ret = pca953x_set_val(PORTEXP_IO_TO_CHIP(gpio),
-               (1 << PORTEXP_IO_TO_PIN(gpio)),
-               (value << PORTEXP_IO_TO_PIN(gpio)));
-
-       if (ret)
-               return ret;
-
-       return 0;
-}
-
 #ifdef CONFIG_MTD_NOR_FLASH
 static iomux_v3_cfg_t const eimnor_pads[] = {
        IOMUX_PADS(PAD_EIM_D16__EIM_DATA16      | MUX_PAD_CTRL(WEIM_NOR_PAD_CTRL)),
@@ -295,10 +242,6 @@ static void setup_iomux_eimnor(void)
 }
 #endif
 
-static void setup_iomux_enet(void)
-{
-       SETUP_IOMUX_PADS(enet_pads);
-}
 
 static iomux_v3_cfg_t const usdhc3_pads[] = {
        IOMUX_PADS(PAD_SD3_CLK__SD3_CLK         | MUX_PAD_CTRL(USDHC_PAD_CTRL)),
@@ -320,7 +263,7 @@ static void setup_iomux_uart(void)
        SETUP_IOMUX_PADS(uart4_pads);
 }
 
-#ifdef CONFIG_FSL_ESDHC
+#ifdef CONFIG_FSL_ESDHC_IMX
 static struct fsl_esdhc_cfg usdhc_cfg[1] = {
        {USDHC3_BASE_ADDR},
 };
@@ -376,26 +319,6 @@ static void setup_gpmi_nand(void)
 }
 #endif
 
-static void setup_fec(void)
-{
-       if (is_mx6dqp()) {
-               /*
-                * select ENET MAC0 TX clock from PLL
-                */
-               imx_iomux_set_gpr_register(5, 9, 1, 1);
-               enable_fec_anatop_clock(0, ENET_125MHZ);
-       }
-
-       setup_iomux_enet();
-}
-
-int board_eth_init(bd_t *bis)
-{
-       setup_fec();
-
-       return cpu_eth_init(bis);
-}
-
 u32 get_board_rev(void)
 {
        int rev = nxp_board_rev();
@@ -681,19 +604,10 @@ int checkboard(void)
 }
 
 #ifdef CONFIG_USB_EHCI_MX6
-#define USB_HOST1_PWR     PORTEXP_IO_NR(0x32, 7)
-#define USB_OTG_PWR       PORTEXP_IO_NR(0x34, 1)
-
-iomux_v3_cfg_t const usb_otg_pads[] = {
-       IOMUX_PADS(PAD_ENET_RX_ER__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL)),
-};
-
 int board_ehci_hcd_init(int port)
 {
        switch (port) {
        case 0:
-               SETUP_IOMUX_PADS(usb_otg_pads);
-
                /*
                  * Set daisy chain for otg_pin_id on 6q.
                 *  For 6dl, this bit is reserved.
@@ -708,29 +622,6 @@ int board_ehci_hcd_init(int port)
        }
        return 0;
 }
-
-int board_ehci_power(int port, int on)
-{
-       switch (port) {
-       case 0:
-               if (on)
-                       port_exp_direction_output(USB_OTG_PWR, 1);
-               else
-                       port_exp_direction_output(USB_OTG_PWR, 0);
-               break;
-       case 1:
-               if (on)
-                       port_exp_direction_output(USB_HOST1_PWR, 1);
-               else
-                       port_exp_direction_output(USB_HOST1_PWR, 0);
-               break;
-       default:
-               printf("MXC USB port %d not yet supported\n", port);
-               return -EINVAL;
-       }
-
-       return 0;
-}
 #endif
 
 #ifdef CONFIG_SPL_BUILD