tepla.c 3.3 KB
Newer Older
1
/*
2 3 4
 * Copyright 2004-2007 Analog Devices Inc.
 *                2005 National ICT Australia (NICTA)
 *                      Aidan Williams <aidan@nicta.com.au>
5
 *
6
 * Thanks to Jamey Hicks.
7
 *
8
 * Only SMSC91C1111 was registered, may do more later.
9
 *
10
 * Licensed under the GPL-2
11 12 13 14
 */

#include <linux/device.h>
#include <linux/platform_device.h>
15
#include <linux/irq.h>
16

17
const char bfin_board_name[] = "Tepla-BF561";
18 19 20 21 22 23 24 25 26

/*
 *  Driver needs to know address, irq and flag pin.
 */
static struct resource smc91x_resources[] = {
	{
		.start	= 0x2C000300,
		.end	= 0x2C000320,
		.flags	= IORESOURCE_MEM,
27
	}, {
28 29 30
		.start	= IRQ_PROG_INTB,
		.end	= IRQ_PROG_INTB,
		.flags	= IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
31
	}, {
32 33 34 35 36 37 38 39 40 41 42 43 44
		.start	= IRQ_PF7,
		.end	= IRQ_PF7,
		.flags	= IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
	},
};

static struct platform_device smc91x_device = {
	.name          = "smc91x",
	.id            = 0,
	.num_resources = ARRAY_SIZE(smc91x_resources),
	.resource      = smc91x_resources,
};

S
Steven Miao 已提交
45
#if IS_ENABLED(CONFIG_SERIAL_BFIN)
46 47 48 49 50 51 52
#ifdef CONFIG_SERIAL_BFIN_UART0
static struct resource bfin_uart0_resources[] = {
	{
		.start = BFIN_UART_THR,
		.end = BFIN_UART_GCTL+2,
		.flags = IORESOURCE_MEM,
	},
53 54 55 56 57
	{
		.start = IRQ_UART_TX,
		.end = IRQ_UART_TX,
		.flags = IORESOURCE_IRQ,
	},
58 59
	{
		.start = IRQ_UART_RX,
60
		.end = IRQ_UART_RX,
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
		.flags = IORESOURCE_IRQ,
	},
	{
		.start = IRQ_UART_ERROR,
		.end = IRQ_UART_ERROR,
		.flags = IORESOURCE_IRQ,
	},
	{
		.start = CH_UART_TX,
		.end = CH_UART_TX,
		.flags = IORESOURCE_DMA,
	},
	{
		.start = CH_UART_RX,
		.end = CH_UART_RX,
		.flags = IORESOURCE_DMA,
	},
};

80
static unsigned short bfin_uart0_peripherals[] = {
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
	P_UART0_TX, P_UART0_RX, 0
};

static struct platform_device bfin_uart0_device = {
	.name = "bfin-uart",
	.id = 0,
	.num_resources = ARRAY_SIZE(bfin_uart0_resources),
	.resource = bfin_uart0_resources,
	.dev = {
		.platform_data = &bfin_uart0_peripherals, /* Passed to driver */
	},
};
#endif
#endif

S
Steven Miao 已提交
96
#if IS_ENABLED(CONFIG_BFIN_SIR)
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
#ifdef CONFIG_BFIN_SIR0
static struct resource bfin_sir0_resources[] = {
	{
		.start = 0xFFC00400,
		.end = 0xFFC004FF,
		.flags = IORESOURCE_MEM,
	},
	{
		.start = IRQ_UART0_RX,
		.end = IRQ_UART0_RX+1,
		.flags = IORESOURCE_IRQ,
	},
	{
		.start = CH_UART0_RX,
		.end = CH_UART0_RX+1,
		.flags = IORESOURCE_DMA,
	},
};

static struct platform_device bfin_sir0_device = {
	.name = "bfin_sir",
	.id = 0,
	.num_resources = ARRAY_SIZE(bfin_sir0_resources),
	.resource = bfin_sir0_resources,
};
#endif
#endif

125 126
static struct platform_device *tepla_devices[] __initdata = {
	&smc91x_device,
127

S
Steven Miao 已提交
128
#if IS_ENABLED(CONFIG_SERIAL_BFIN)
129 130 131 132 133
#ifdef CONFIG_SERIAL_BFIN_UART0
	&bfin_uart0_device,
#endif
#endif

S
Steven Miao 已提交
134
#if IS_ENABLED(CONFIG_BFIN_SIR)
135 136 137 138
#ifdef CONFIG_BFIN_SIR0
	&bfin_sir0_device,
#endif
#endif
139 140 141 142
};

static int __init tepla_init(void)
{
143
	printk(KERN_INFO "%s(): registering device resources\n", __func__);
144 145 146 147
	return platform_add_devices(tepla_devices, ARRAY_SIZE(tepla_devices));
}

arch_initcall(tepla_init);
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162

static struct platform_device *tepla_early_devices[] __initdata = {
#if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
#ifdef CONFIG_SERIAL_BFIN_UART0
	&bfin_uart0_device,
#endif
#endif
};

void __init native_machine_early_platform_add_devices(void)
{
	printk(KERN_INFO "register early platform devices\n");
	early_platform_add_devices(tepla_early_devices,
		ARRAY_SIZE(tepla_early_devices));
}