Merge branch 'dt-regressions' into omap-for-v3.13/fixes-take4
authorTony Lindgren <tony@atomide.com>
Mon, 25 Nov 2013 22:47:27 +0000 (14:47 -0800)
committerTony Lindgren <tony@atomide.com>
Mon, 25 Nov 2013 22:47:27 +0000 (14:47 -0800)
1  2 
arch/arm/mach-omap2/gpmc.c
drivers/i2c/busses/i2c-omap.c

@@@ -1341,14 -1341,6 +1341,6 @@@ static void __maybe_unused gpmc_read_ti
  
  #ifdef CONFIG_MTD_NAND
  
- static const char * const nand_ecc_opts[] = {
-       [OMAP_ECC_HAMMING_CODE_DEFAULT]         = "sw",
-       [OMAP_ECC_HAMMING_CODE_HW]              = "hw",
-       [OMAP_ECC_HAMMING_CODE_HW_ROMCODE]      = "hw-romcode",
-       [OMAP_ECC_BCH4_CODE_HW]                 = "bch4",
-       [OMAP_ECC_BCH8_CODE_HW]                 = "bch8",
- };
  static const char * const nand_xfer_types[] = {
        [NAND_OMAP_PREFETCH_POLLED]             = "prefetch-polled",
        [NAND_OMAP_POLLED]                      = "polled",
@@@ -1378,13 -1370,41 +1370,41 @@@ static int gpmc_probe_nand_child(struc
        gpmc_nand_data->cs = val;
        gpmc_nand_data->of_node = child;
  
-       if (!of_property_read_string(child, "ti,nand-ecc-opt", &s))
-               for (val = 0; val < ARRAY_SIZE(nand_ecc_opts); val++)
-                       if (!strcasecmp(s, nand_ecc_opts[val])) {
-                               gpmc_nand_data->ecc_opt = val;
-                               break;
-                       }
+       /* Detect availability of ELM module */
+       gpmc_nand_data->elm_of_node = of_parse_phandle(child, "ti,elm-id", 0);
+       if (gpmc_nand_data->elm_of_node == NULL)
+               gpmc_nand_data->elm_of_node =
+                                       of_parse_phandle(child, "elm_id", 0);
+       if (gpmc_nand_data->elm_of_node == NULL)
+               pr_warn("%s: ti,elm-id property not found\n", __func__);
+       /* select ecc-scheme for NAND */
+       if (of_property_read_string(child, "ti,nand-ecc-opt", &s)) {
+               pr_err("%s: ti,nand-ecc-opt not found\n", __func__);
+               return -ENODEV;
+       }
+       if (!strcmp(s, "ham1") || !strcmp(s, "sw") ||
+               !strcmp(s, "hw") || !strcmp(s, "hw-romcode"))
+               gpmc_nand_data->ecc_opt =
+                               OMAP_ECC_HAM1_CODE_HW;
+       else if (!strcmp(s, "bch4"))
+               if (gpmc_nand_data->elm_of_node)
+                       gpmc_nand_data->ecc_opt =
+                               OMAP_ECC_BCH4_CODE_HW;
+               else
+                       gpmc_nand_data->ecc_opt =
+                               OMAP_ECC_BCH4_CODE_HW_DETECTION_SW;
+       else if (!strcmp(s, "bch8"))
+               if (gpmc_nand_data->elm_of_node)
+                       gpmc_nand_data->ecc_opt =
+                               OMAP_ECC_BCH8_CODE_HW;
+               else
+                       gpmc_nand_data->ecc_opt =
+                               OMAP_ECC_BCH8_CODE_HW_DETECTION_SW;
+       else
+               pr_err("%s: ti,nand-ecc-opt invalid value\n", __func__);
  
+       /* select data transfer mode for NAND controller */
        if (!of_property_read_string(child, "ti,nand-xfer-type", &s))
                for (val = 0; val < ARRAY_SIZE(nand_xfer_types); val++)
                        if (!strcasecmp(s, nand_xfer_types[val])) {
@@@ -1481,22 -1501,6 +1501,22 @@@ static int gpmc_probe_generic_child(str
                return ret;
        }
  
 +      /*
 +       * For some GPMC devices we still need to rely on the bootloader
 +       * timings because the devices can be connected via FPGA. So far
 +       * the list is smc91x on the omap2 SDP boards, and 8250 on zooms.
 +       * REVISIT: Add timing support from slls644g.pdf and from the
 +       * lan91c96 manual.
 +       */
 +      if (of_device_is_compatible(child, "ns16550a") ||
 +          of_device_is_compatible(child, "smsc,lan91c94") ||
 +          of_device_is_compatible(child, "smsc,lan91c111")) {
 +              dev_warn(&pdev->dev,
 +                       "%s using bootloader timings on CS%d\n",
 +                       child->name, cs);
 +              goto no_timings;
 +      }
 +
        /*
         * FIXME: gpmc_cs_request() will map the CS to an arbitary
         * location in the gpmc address space. When booting with
        gpmc_read_timings_dt(child, &gpmc_t);
        gpmc_cs_set_timings(cs, &gpmc_t);
  
 +no_timings:
        if (of_platform_device_create(child, NULL, &pdev->dev))
                return 0;
  
@@@ -1538,6 -1541,42 +1558,6 @@@ err
        return ret;
  }
  
 -/*
 - * REVISIT: Add timing support from slls644g.pdf
 - */
 -static int gpmc_probe_8250(struct platform_device *pdev,
 -                              struct device_node *child)
 -{
 -      struct resource res;
 -      unsigned long base;
 -      int ret, cs;
 -
 -      if (of_property_read_u32(child, "reg", &cs) < 0) {
 -              dev_err(&pdev->dev, "%s has no 'reg' property\n",
 -                      child->full_name);
 -              return -ENODEV;
 -      }
 -
 -      if (of_address_to_resource(child, 0, &res) < 0) {
 -              dev_err(&pdev->dev, "%s has malformed 'reg' property\n",
 -                      child->full_name);
 -              return -ENODEV;
 -      }
 -
 -      ret = gpmc_cs_request(cs, resource_size(&res), &base);
 -      if (ret < 0) {
 -              dev_err(&pdev->dev, "cannot request GPMC CS %d\n", cs);
 -              return ret;
 -      }
 -
 -      if (of_platform_device_create(child, NULL, &pdev->dev))
 -              return 0;
 -
 -      dev_err(&pdev->dev, "failed to create gpmc child %s\n", child->name);
 -
 -      return -ENODEV;
 -}
 -
  static int gpmc_probe_dt(struct platform_device *pdev)
  {
        int ret;
                else if (of_node_cmp(child->name, "onenand") == 0)
                        ret = gpmc_probe_onenand_child(pdev, child);
                else if (of_node_cmp(child->name, "ethernet") == 0 ||
 -                       of_node_cmp(child->name, "nor") == 0)
 +                       of_node_cmp(child->name, "nor") == 0 ||
 +                       of_node_cmp(child->name, "uart") == 0)
                        ret = gpmc_probe_generic_child(pdev, child);
 -              else if (of_node_cmp(child->name, "8250") == 0)
 -                      ret = gpmc_probe_8250(pdev, child);
  
                if (WARN(ret < 0, "%s: probing gpmc child %s failed\n",
                         __func__, child->full_name))
@@@ -543,7 -543,7 +543,7 @@@ static int omap_i2c_xfer_msg(struct i2c
        w |= OMAP_I2C_BUF_RXFIF_CLR | OMAP_I2C_BUF_TXFIF_CLR;
        omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, w);
  
-       INIT_COMPLETION(dev->cmd_complete);
+       reinit_completion(&dev->cmd_complete);
        dev->cmd_err = 0;
  
        w = OMAP_I2C_CON_EN | OMAP_I2C_CON_MST | OMAP_I2C_CON_STT;
@@@ -1037,20 -1037,6 +1037,20 @@@ static const struct i2c_algorithm omap_
  };
  
  #ifdef CONFIG_OF
 +static struct omap_i2c_bus_platform_data omap2420_pdata = {
 +      .rev = OMAP_I2C_IP_VERSION_1,
 +      .flags = OMAP_I2C_FLAG_NO_FIFO |
 +                      OMAP_I2C_FLAG_SIMPLE_CLOCK |
 +                      OMAP_I2C_FLAG_16BIT_DATA_REG |
 +                      OMAP_I2C_FLAG_BUS_SHIFT_2,
 +};
 +
 +static struct omap_i2c_bus_platform_data omap2430_pdata = {
 +      .rev = OMAP_I2C_IP_VERSION_1,
 +      .flags = OMAP_I2C_FLAG_BUS_SHIFT_2 |
 +                      OMAP_I2C_FLAG_FORCE_19200_INT_CLK,
 +};
 +
  static struct omap_i2c_bus_platform_data omap3_pdata = {
        .rev = OMAP_I2C_IP_VERSION_1,
        .flags = OMAP_I2C_FLAG_BUS_SHIFT_2,
@@@ -1069,14 -1055,6 +1069,14 @@@ static const struct of_device_id omap_i
                .compatible = "ti,omap3-i2c",
                .data = &omap3_pdata,
        },
 +      {
 +              .compatible = "ti,omap2430-i2c",
 +              .data = &omap2430_pdata,
 +      },
 +      {
 +              .compatible = "ti,omap2420-i2c",
 +              .data = &omap2420_pdata,
 +      },
        { },
  };
  MODULE_DEVICE_TABLE(of, omap_i2c_of_match);