Path: blob/master/arch/arm/mach-omap2/board-zoom-debugboard.c
10817 views
/*1* Copyright (C) 2009 Texas Instruments Inc.2* Mikkel Christensen <[email protected]>3*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License version 2 as6* published by the Free Software Foundation.7*/89#include <linux/kernel.h>10#include <linux/init.h>11#include <linux/gpio.h>12#include <linux/serial_8250.h>13#include <linux/smsc911x.h>14#include <linux/interrupt.h>1516#include <plat/gpmc.h>17#include <plat/gpmc-smsc911x.h>1819#include <mach/board-zoom.h>2021#define ZOOM_SMSC911X_CS 722#define ZOOM_SMSC911X_GPIO 15823#define ZOOM_QUADUART_CS 324#define ZOOM_QUADUART_GPIO 10225#define QUART_CLK 184320026#define DEBUG_BASE 0x0800000027#define ZOOM_ETHR_START DEBUG_BASE2829static struct omap_smsc911x_platform_data zoom_smsc911x_cfg = {30.cs = ZOOM_SMSC911X_CS,31.gpio_irq = ZOOM_SMSC911X_GPIO,32.gpio_reset = -EINVAL,33.flags = SMSC911X_USE_32BIT,34};3536static inline void __init zoom_init_smsc911x(void)37{38gpmc_smsc911x_init(&zoom_smsc911x_cfg);39}4041static struct plat_serial8250_port serial_platform_data[] = {42{43.mapbase = ZOOM_UART_BASE,44.irq = OMAP_GPIO_IRQ(102),45.flags = UPF_BOOT_AUTOCONF|UPF_IOREMAP|UPF_SHARE_IRQ,46.irqflags = IRQF_SHARED | IRQF_TRIGGER_RISING,47.iotype = UPIO_MEM,48.regshift = 1,49.uartclk = QUART_CLK,50}, {51.flags = 052}53};5455static struct platform_device zoom_debugboard_serial_device = {56.name = "serial8250",57.id = PLAT8250_DEV_PLATFORM,58.dev = {59.platform_data = serial_platform_data,60},61};6263static inline void __init zoom_init_quaduart(void)64{65int quart_cs;66unsigned long cs_mem_base;67int quart_gpio = 0;6869quart_cs = ZOOM_QUADUART_CS;7071if (gpmc_cs_request(quart_cs, SZ_1M, &cs_mem_base) < 0) {72printk(KERN_ERR "Failed to request GPMC mem"73"for Quad UART(TL16CP754C)\n");74return;75}7677quart_gpio = ZOOM_QUADUART_GPIO;7879if (gpio_request_one(quart_gpio, GPIOF_IN, "TL16CP754C GPIO") < 0)80printk(KERN_ERR "Failed to request GPIO%d for TL16CP754C\n",81quart_gpio);82}8384static inline int omap_zoom_debugboard_detect(void)85{86int debug_board_detect = 0;87int ret = 1;8889debug_board_detect = ZOOM_SMSC911X_GPIO;9091if (gpio_request_one(debug_board_detect, GPIOF_IN,92"Zoom debug board detect") < 0) {93printk(KERN_ERR "Failed to request GPIO%d for Zoom debug"94"board detect\n", debug_board_detect);95return 0;96}9798if (!gpio_get_value(debug_board_detect)) {99ret = 0;100}101gpio_free(debug_board_detect);102return ret;103}104105static struct platform_device *zoom_devices[] __initdata = {106&zoom_debugboard_serial_device,107};108109int __init zoom_debugboard_init(void)110{111if (!omap_zoom_debugboard_detect())112return 0;113114zoom_init_smsc911x();115zoom_init_quaduart();116return platform_add_devices(zoom_devices, ARRAY_SIZE(zoom_devices));117}118119120