Skip to content

Commit

Permalink
ARM: OMAP: Board Apollon update, fix boot
Browse files Browse the repository at this point in the history
Update Apollon board init to initialize NAND, USB,
and LEDs. Also configure GPMC memory for smc91x Ethernet.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Kyungmin Park authored and Tony Lindgren committed Sep 20, 2007
1 parent 375e12a commit f024840
Showing 1 changed file with 90 additions and 9 deletions.
99 changes: 90 additions & 9 deletions arch/arm/mach-omap2/board-apollon.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,21 @@
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/leds.h>
#include <linux/irq.h>

#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/flash.h>

#include <asm/arch/gpio.h>
#include <asm/arch/led.h>
#include <asm/arch/mux.h>
#include <asm/arch/usb.h>
#include <asm/arch/board.h>
#include <asm/arch/common.h>
#include <asm/arch/gpmc.h>
#include "prcm-regs.h"

/* LED & Switch macros */
Expand All @@ -46,6 +50,9 @@
#define SW_UP_GPIO17 17
#define SW_DOWN_GPIO58 58

#define APOLLON_FLASH_CS 0
#define APOLLON_ETH_CS 1

static struct mtd_partition apollon_partitions[] = {
{
.name = "X-Loader + U-Boot",
Expand Down Expand Up @@ -85,10 +92,10 @@ static struct flash_platform_data apollon_flash_data = {
.nr_parts = ARRAY_SIZE(apollon_partitions),
};

static struct resource apollon_flash_resource = {
.start = APOLLON_CS0_BASE,
.end = APOLLON_CS0_BASE + SZ_128K,
.flags = IORESOURCE_MEM,
static struct resource apollon_flash_resource[] = {
[0] = {
.flags = IORESOURCE_MEM,
},
};

static struct platform_device apollon_onenand_device = {
Expand All @@ -97,14 +104,24 @@ static struct platform_device apollon_onenand_device = {
.dev = {
.platform_data = &apollon_flash_data,
},
.num_resources = ARRAY_SIZE(&apollon_flash_resource),
.resource = &apollon_flash_resource,
.num_resources = ARRAY_SIZE(apollon_flash_resource),
.resource = apollon_flash_resource,
};

static void __init apollon_flash_init(void)
{
unsigned long base;

if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, &base) < 0) {
printk(KERN_ERR "Cannot request OneNAND GPMC CS\n");
return;
}
apollon_flash_resource[0].start = base;
apollon_flash_resource[0].end = base + SZ_128K - 1;
}

static struct resource apollon_smc91x_resources[] = {
[0] = {
.start = APOLLON_ETHR_START, /* Physical */
.end = APOLLON_ETHR_START + 0xf,
.flags = IORESOURCE_MEM,
},
[1] = {
Expand All @@ -126,28 +143,72 @@ static struct platform_device apollon_lcd_device = {
.id = -1,
};

static struct omap_led_config apollon_led_config[] = {
{
.cdev = {
.name = "apollon:led0",
},
.gpio = LED0_GPIO13,
},
{
.cdev = {
.name = "apollon:led1",
},
.gpio = LED1_GPIO14,
},
{
.cdev = {
.name = "apollon:led2",
},
.gpio = LED2_GPIO15,
},
};

static struct omap_led_platform_data apollon_led_data = {
.nr_leds = ARRAY_SIZE(apollon_led_config),
.leds = apollon_led_config,
};

static struct platform_device apollon_led_device = {
.name = "omap-led",
.id = -1,
.dev = {
.platform_data = &apollon_led_data,
},
};

static struct platform_device *apollon_devices[] __initdata = {
&apollon_onenand_device,
&apollon_smc91x_device,
&apollon_lcd_device,
&apollon_led_device,
};

static inline void __init apollon_init_smc91x(void)
{
unsigned long base;

/* Make sure CS1 timings are correct */
GPMC_CONFIG1_1 = 0x00011203;
GPMC_CONFIG2_1 = 0x001f1f01;
GPMC_CONFIG3_1 = 0x00080803;
GPMC_CONFIG4_1 = 0x1c091c09;
GPMC_CONFIG5_1 = 0x041f1f1f;
GPMC_CONFIG6_1 = 0x000004c4;
GPMC_CONFIG7_1 = 0x00000f40 | (APOLLON_CS1_BASE >> 24);

if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) {
printk(KERN_ERR "Failed to request GPMC CS for smc91x\n");
return;
}
apollon_smc91x_resources[0].start = base + 0x300;
apollon_smc91x_resources[0].end = base + 0x30f;
udelay(100);

omap_cfg_reg(W4__24XX_GPIO74);
if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) {
printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
APOLLON_ETHR_GPIO_IRQ);
gpmc_cs_free(APOLLON_ETH_CS);
return;
}
omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1);
Expand Down Expand Up @@ -175,13 +236,21 @@ static struct omap_mmc_config apollon_mmc_config __initdata = {
},
};

static struct omap_usb_config apollon_usb_config __initdata = {
.register_dev = 1,
.hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */

.pins[0] = 6,
};

static struct omap_lcd_config apollon_lcd_config __initdata = {
.ctrl_name = "internal",
};

static struct omap_board_config_kernel apollon_config[] = {
{ OMAP_TAG_UART, &apollon_uart_config },
{ OMAP_TAG_MMC, &apollon_mmc_config },
{ OMAP_TAG_USB, &apollon_usb_config },
{ OMAP_TAG_LCD, &apollon_lcd_config },
};

Expand Down Expand Up @@ -250,10 +319,22 @@ static void __init apollon_sw_init(void)
return;
}

static void __init apollon_usb_init(void)
{
/* USB device */
/* DEVICE_SUSPEND */
omap_cfg_reg(P21_242X_GPIO12);
omap_request_gpio(12);
omap_set_gpio_direction(12, 0); /* OUT */
omap_set_gpio_dataout(12, 0);
}

static void __init omap_apollon_init(void)
{
apollon_led_init();
apollon_sw_init();
apollon_flash_init();
apollon_usb_init();

/* REVISIT: where's the correct place */
omap_cfg_reg(W19_24XX_SYS_NIRQ);
Expand Down

0 comments on commit f024840

Please sign in to comment.