Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / arch / arm / mach-mx3 / mach-mx31moboard.c
index 62b5e40..7a075e8 100644 (file)
  * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include <linux/delay.h>
 #include <mach/board-mx31moboard.h>
 #include <mach/common.h>
 #include <mach/hardware.h>
-#include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include <mach/ipu.h>
-#include <mach/i2c.h>
 #include <mach/mmc.h>
 #include <mach/mxc_ehci.h>
 #include <mach/mx3_camera.h>
 #include <mach/spi.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx31.h"
 #include "devices.h"
 
 static unsigned int moboard_pins[] = {
@@ -130,24 +125,36 @@ static struct platform_device mx31moboard_flash = {
 
 static int moboard_uart0_init(struct platform_device *pdev)
 {
-       gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
-       gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
-       return 0;
+       int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
+       if (ret)
+               return ret;
+
+       ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
+       if (ret)
+               gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
+
+       return ret;
+}
+
+static void moboard_uart0_exit(struct platform_device *pdev)
+{
+       gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
 }
 
-static struct imxuart_platform_data uart0_pdata = {
+static const struct imxuart_platform_data uart0_pdata __initconst = {
        .init = moboard_uart0_init,
+       .exit = moboard_uart0_exit,
 };
 
-static struct imxuart_platform_data uart4_pdata = {
+static const struct imxuart_platform_data uart4_pdata __initconst = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
-static struct imxi2c_platform_data moboard_i2c0_pdata = {
+static const struct imxi2c_platform_data moboard_i2c0_data __initconst = {
        .bitrate = 400000,
 };
 
-static struct imxi2c_platform_data moboard_i2c1_pdata = {
+static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
        .bitrate = 100000,
 };
 
@@ -156,7 +163,7 @@ static int moboard_spi1_cs[] = {
        MXC_SPI_CS(2),
 };
 
-static struct spi_imx_master moboard_spi1_master = {
+static const struct spi_imx_master moboard_spi1_pdata __initconst = {
        .chipselect     = moboard_spi1_cs,
        .num_chipselect = ARRAY_SIZE(moboard_spi1_cs),
 };
@@ -286,7 +293,7 @@ static int moboard_spi2_cs[] = {
        MXC_SPI_CS(1),
 };
 
-static struct spi_imx_master moboard_spi2_master = {
+static const struct spi_imx_master moboard_spi2_pdata __initconst = {
        .chipselect     = moboard_spi2_cs,
        .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
 };
@@ -405,7 +412,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
 static int __init moboard_usbh2_init(void)
 {
        usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
-                       USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
+                       ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
 
        return mxc_register_device(&mxc_usbh2, &usbh2_pdata);
 }
@@ -499,15 +506,14 @@ static void __init mxc_board_init(void)
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
-       mxc_register_device(&mxc_uart_device0, &uart0_pdata);
-
-       mxc_register_device(&mxc_uart_device4, &uart4_pdata);
+       imx31_add_imx_uart0(&uart0_pdata);
+       imx31_add_imx_uart4(&uart4_pdata);
 
-       mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata);
-       mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata);
+       imx31_add_imx_i2c0(&moboard_i2c0_data);
+       imx31_add_imx_i2c1(&moboard_i2c1_data);
 
-       mxc_register_device(&mxc_spi_device1, &moboard_spi1_master);
-       mxc_register_device(&mxc_spi_device2, &moboard_spi2_master);
+       imx31_add_spi_imx1(&moboard_spi1_pdata);
+       imx31_add_spi_imx2(&moboard_spi2_pdata);
 
        gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
        gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));