| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 | 
							- /*
 
-  * linux/arch/arm/mach-omap2/board-omap3beagle.c
 
-  *
 
-  * Copyright (C) 2008 Texas Instruments
 
-  *
 
-  * Modified from mach-omap2/board-3430sdp.c
 
-  *
 
-  * Initial code: Syed Mohammed Khasim
 
-  *
 
-  * This program is free software; you can redistribute it and/or modify
 
-  * it under the terms of the GNU General Public License version 2 as
 
-  * published by the Free Software Foundation.
 
-  */
 
- #include <linux/kernel.h>
 
- #include <linux/init.h>
 
- #include <linux/platform_device.h>
 
- #include <linux/delay.h>
 
- #include <linux/err.h>
 
- #include <linux/clk.h>
 
- #include <linux/io.h>
 
- #include <linux/leds.h>
 
- #include <linux/gpio.h>
 
- #include <linux/input.h>
 
- #include <linux/gpio_keys.h>
 
- #include <linux/opp.h>
 
- #include <linux/cpu.h>
 
- #include <linux/mtd/mtd.h>
 
- #include <linux/mtd/partitions.h>
 
- #include <linux/mtd/nand.h>
 
- #include <linux/mmc/host.h>
 
- #include <linux/regulator/machine.h>
 
- #include <linux/i2c/twl.h>
 
- #include <asm/mach-types.h>
 
- #include <asm/mach/arch.h>
 
- #include <asm/mach/map.h>
 
- #include <asm/mach/flash.h>
 
- #include <video/omapdss.h>
 
- #include <video/omap-panel-tfp410.h>
 
- #include <linux/platform_data/mtd-nand-omap2.h>
 
- #include "common.h"
 
- #include "omap_device.h"
 
- #include "gpmc.h"
 
- #include "soc.h"
 
- #include "mux.h"
 
- #include "hsmmc.h"
 
- #include "pm.h"
 
- #include "board-flash.h"
 
- #include "common-board-devices.h"
 
- #define	NAND_CS	0
 
- /*
 
-  * OMAP3 Beagle revision
 
-  * Run time detection of Beagle revision is done by reading GPIO.
 
-  * GPIO ID -
 
-  *	AXBX	= GPIO173, GPIO172, GPIO171: 1 1 1
 
-  *	C1_3	= GPIO173, GPIO172, GPIO171: 1 1 0
 
-  *	C4	= GPIO173, GPIO172, GPIO171: 1 0 1
 
-  *	XMA/XMB = GPIO173, GPIO172, GPIO171: 0 0 0
 
-  *	XMC = GPIO173, GPIO172, GPIO171: 0 1 0
 
-  */
 
- enum {
 
- 	OMAP3BEAGLE_BOARD_UNKN = 0,
 
- 	OMAP3BEAGLE_BOARD_AXBX,
 
- 	OMAP3BEAGLE_BOARD_C1_3,
 
- 	OMAP3BEAGLE_BOARD_C4,
 
- 	OMAP3BEAGLE_BOARD_XM,
 
- 	OMAP3BEAGLE_BOARD_XMC,
 
- };
 
- static u8 omap3_beagle_version;
 
- /*
 
-  * Board-specific configuration
 
-  * Defaults to BeagleBoard-xMC
 
-  */
 
- static struct {
 
- 	int mmc1_gpio_wp;
 
- 	int usb_pwr_level;
 
- 	int dvi_pd_gpio;
 
- 	int usr_button_gpio;
 
- 	int mmc_caps;
 
- } beagle_config = {
 
- 	.mmc1_gpio_wp = -EINVAL,
 
- 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
 
- 	.dvi_pd_gpio = -EINVAL,
 
- 	.usr_button_gpio = 4,
 
- 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 
- };
 
- static struct gpio omap3_beagle_rev_gpios[] __initdata = {
 
- 	{ 171, GPIOF_IN, "rev_id_0"    },
 
- 	{ 172, GPIOF_IN, "rev_id_1" },
 
- 	{ 173, GPIOF_IN, "rev_id_2"    },
 
- };
 
- static void __init omap3_beagle_init_rev(void)
 
- {
 
- 	int ret;
 
- 	u16 beagle_rev = 0;
 
- 	omap_mux_init_gpio(171, OMAP_PIN_INPUT_PULLUP);
 
- 	omap_mux_init_gpio(172, OMAP_PIN_INPUT_PULLUP);
 
- 	omap_mux_init_gpio(173, OMAP_PIN_INPUT_PULLUP);
 
- 	ret = gpio_request_array(omap3_beagle_rev_gpios,
 
- 				 ARRAY_SIZE(omap3_beagle_rev_gpios));
 
- 	if (ret < 0) {
 
- 		printk(KERN_ERR "Unable to get revision detection GPIO pins\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
 
- 		return;
 
- 	}
 
- 	beagle_rev = gpio_get_value(171) | (gpio_get_value(172) << 1)
 
- 			| (gpio_get_value(173) << 2);
 
- 	gpio_free_array(omap3_beagle_rev_gpios,
 
- 			ARRAY_SIZE(omap3_beagle_rev_gpios));
 
- 	switch (beagle_rev) {
 
- 	case 7:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
 
- 		beagle_config.mmc1_gpio_wp = 29;
 
- 		beagle_config.dvi_pd_gpio = 170;
 
- 		beagle_config.usr_button_gpio = 7;
 
- 		break;
 
- 	case 6:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
 
- 		beagle_config.mmc1_gpio_wp = 23;
 
- 		beagle_config.dvi_pd_gpio = 170;
 
- 		beagle_config.usr_button_gpio = 7;
 
- 		break;
 
- 	case 5:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
 
- 		beagle_config.mmc1_gpio_wp = 23;
 
- 		beagle_config.dvi_pd_gpio = 170;
 
- 		beagle_config.usr_button_gpio = 7;
 
- 		break;
 
- 	case 0:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: xM Ax/Bx\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_XM;
 
- 		beagle_config.usb_pwr_level = GPIOF_OUT_INIT_HIGH;
 
- 		beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA;
 
- 		break;
 
- 	case 2:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: xM C\n");
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_XMC;
 
- 		beagle_config.mmc_caps &= ~MMC_CAP_8_BIT_DATA;
 
- 		break;
 
- 	default:
 
- 		printk(KERN_INFO "OMAP3 Beagle Rev: unknown %hd\n", beagle_rev);
 
- 		omap3_beagle_version = OMAP3BEAGLE_BOARD_UNKN;
 
- 	}
 
- }
 
- static struct mtd_partition omap3beagle_nand_partitions[] = {
 
- 	/* All the partition sizes are listed in terms of NAND block size */
 
- 	{
 
- 		.name		= "X-Loader",
 
- 		.offset		= 0,
 
- 		.size		= 4 * NAND_BLOCK_SIZE,
 
- 		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
 
- 	},
 
- 	{
 
- 		.name		= "U-Boot",
 
- 		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
 
- 		.size		= 15 * NAND_BLOCK_SIZE,
 
- 		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
 
- 	},
 
- 	{
 
 
  |