aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ubicom32/files/arch/ubicom32/mach-ip7k/board-ip7500media.c
blob: 3a51aec2a647c7328909467921fd3aa0ae0dc154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
/*
 * arch/ubicom32/mach-ip7k/board-ip7500media.c
 *   Board file for IP7500 media board.
 *
 * Supports the following configuration
 *	CPU Module:
 *		P/N 8007-0510 rev 1.0 NOPHY
 *		P/N 8007-0511 rev 1.1 NOPHY
 *			DIP Switch SW2 configuration:
 *				POS 1: on  = PCI enabled
 *				POS 2: off = TTYX => PF12
 *				POS 3: off = TTYY => PF15
 *				POS 4: unused
 *	Media Board:
 *		P/N 8007-0610 rev 1.0
 *
 *	LCD Adapter Board: (optional)
 *		P/N 8007-0920 rev 2.0
 *		P/N 8007-0921 rev 2.1
 *
 * (C) Copyright 2009, Ubicom, Inc.
 *
 * This file is part of the Ubicom32 Linux Kernel Port.
 *
 * The Ubicom32 Linux Kernel Port is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation, either version 2 of the
 * License, or (at your option) any later version.
 *
 * The Ubicom32 Linux Kernel Port is distributed in the hope that it
 * will be useful, 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 the Ubicom32 Linux Kernel Port.  If not,
 * see <http://www.gnu.org/licenses/>.
 *
 * Ubicom32 implementation derived from (with many thanks):
 *   arch/m68knommu
 *   arch/blackfin
 *   arch/parisc
 */
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>

#include <linux/input.h>

#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/i2c/pca953x.h>

#include <asm/board.h>
#include <asm/machdep.h>
#include <asm/ubicom32input_i2c.h>
#include <asm/ubicom32bl.h>
#include <asm/ubicom32lcdpower.h>
#include <asm/vdc_tio.h>

#include <asm/ubicom32sd.h>
#include <asm/sd_tio.h>
#include <asm/devtree.h>
#include <asm/audio.h>

#include <asm/ring_tio.h>

/******************************************************************************
 * SD/IO Port F (Slot 1) platform data
 */
static struct resource ip7500media_portf_sd_resources[] = {
	/*
	 * Send IRQ
	 */
	[0] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_IRQ,
	},

	/*
	 * Receive IRQ
	 */
	[1] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_IRQ,
	},

	/*
	 * Memory Mapped Registers
	 */
	[2] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_MEM,
	},
};

static struct ubicom32sd_card ip7500media_portf_sd_cards[] = {
	[0] = {
		.pin_wp		= IP7500MEDIA_IO16,
		.wp_polarity	= 1,
		.pin_pwr	= IP7500MEDIA_IO20,
		.pin_cd		= IP7500MEDIA_IO23,
	},
	[1] = {
		.pin_wp		= IP7500MEDIA_IO17,
		.wp_polarity	= 1,
		.pin_pwr	= IP7500MEDIA_IO21,
		.pin_cd		= IP7500MEDIA_IO24,
	},
};

static struct ubicom32sd_platform_data ip7500media_portf_sd_platform_data = {
	.ncards		= 2,
	.cards		= ip7500media_portf_sd_cards,
};

static struct platform_device ip7500media_portf_sd_device = {
	.name		= "ubicom32sd",
	.id		= 0,
	.resource	= ip7500media_portf_sd_resources,
	.num_resources	= ARRAY_SIZE(ip7500media_portf_sd_resources),
	.dev		= {
			.platform_data = &ip7500media_portf_sd_platform_data,
	},

};

/*
 * ip7500media_portf_sd_init
 */
static void ip7500media_portf_sd_init(void)
{
	/*
	 * Check the device tree for the sd_tio
	 */
	struct sd_tio_node *sd_node = (struct sd_tio_node *)devtree_find_node("portf_sd");
	if (!sd_node) {
		printk(KERN_INFO "PortF SDTIO not found\n");
		return;
	}

	/*
	 * Fill in the resources and platform data from devtree information
	 */
	ip7500media_portf_sd_resources[0].start = sd_node->dn.sendirq;
	ip7500media_portf_sd_resources[1].start = sd_node->dn.recvirq;
	ip7500media_portf_sd_resources[2].start = (u32_t)&(sd_node->regs);
	ip7500media_portf_sd_resources[2].end = (u32_t)&(sd_node->regs) + sizeof(sd_node->regs);

	platform_device_register(&ip7500media_portf_sd_device);
}

/******************************************************************************
 * SD/IO Port B (Slot 2) platform data
 */
static struct resource ip7500media_portb_sd_resources[] = {
	/*
	 * Send IRQ
	 */
	[0] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_IRQ,
	},

	/*
	 * Receive IRQ
	 */
	[1] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_IRQ,
	},

	/*
	 * Memory Mapped Registers
	 */
	[2] = {
		/*
		 * The init routine will query the devtree and fill this in
		 */
		.flags	= IORESOURCE_MEM,
	},
};

static struct ubicom32sd_card ip7500media_portb_sd_cards[] = {
	[0] = {
		.pin_wp		= IP7500MEDIA_IO19,
		.wp_polarity	= 1,
		.pin_pwr	= IP7500MEDIA_IO22,
		.pin_cd		= IP7500MEDIA_IO18,
	},
};

static struct ubicom32sd_platform_data ip7500media_portb_sd_platform_data = {
	.ncards		= 1,
	.cards		= ip7500media_portb_sd_cards,
};

static struct platform_device ip7500media_portb_sd_device = {
	.name		= "ubicom32sd",
	.id		= 1,
	.resource	= ip7500media_portb_sd_resources,
	.num_resources	= ARRAY_SIZE(ip7500media_portb_sd_resources),
	.dev		= {
			.platform_data = &ip7500media_portb_sd_platform_data,
	},

};

/*
 * ip7500media_portb_sd_init
 */
static void ip7500media_portb_sd_init(void)
{
	/*
	 * Check the device tree for the sd_tio
	 */
	struct sd_tio_node *sd_node = (struct sd_tio_node *)devtree_find_node("portb_sd");
	if (!sd_node) {
		printk(KERN_INFO "PortB SDTIO not found\n");
		return;
	}

	/*
	 * Fill in the resources and platform data from devtree information
	 */
	ip7500media_portb_sd_resources[0].start = sd_node->dn.sendirq;
	ip7500media_portb_sd_resources[1].start = sd_node->dn.recvirq;
	ip7500media_portb_sd_resources[2].start = (u32_t)&(sd_node->regs);
	ip7500media_portb_sd_resources[2].end = (u32_t)&(sd_node->regs) + sizeof(sd_node->regs);

	platform_device_register(&ip7500media_portb_sd_device);
}

/*
 * ip7500media_u17_setup
 *	Called by I2C to tell us that u17 is setup.
 *
 * This function is called by I2C to tell us that u17 has been setup.  All
 * devices which rely on this chip being initialized (or even present) need to
 * be initialized in this function otherwise they may get initialized too early.
 *
 * Currently the only device depending on u17 is the SDIO
 */
static int __init ip7500media_u17_setup(struct i2c_client *client, unsigned gpio, unsigned ngpio, void *context)
{
	/*
	 * Initialize the Port F/Port B SD slots (only the enabled ports will init)
	 */
	ip7500media_portf_sd_init();
	ip7500media_portb_sd_init();

	return 0;
}

/******************************************************************************
 * LCD VGH on the board at PE6
 */
static struct ubicom32lcdpower_platform_data ip7500media_lcdpower_data = {
	.vgh_gpio		= GPIO_RE_7,
	.vgh_polarity		= true,
};

static struct platform_device ip7500media_lcdpower_device = {
	.name	= "ubicom32lcdpower",
	.id	= -1,
	.dev	= {
		.platform_data = &ip7500media_lcdpower_data,
	},
};

/******************************************************************************
 * Backlight on the board PD0, hardware PWM
 */
static struct ubicom32bl_platform_data ip7500media_backlight_data = {
	.type			= UBICOM32BL_TYPE_PWM,
	.pwm_channel		= 2,
	.pwm_prescale		= 15,
	.pwm_period		= 60,
	.default_intensity	= 0x80,
};

static struct platform_device ip7500media_backlight_device = {
	.name	= "ubicom32bl",
	.id	= -1,
	.dev	= {
		.platform_data = &ip7500media_backlight_data,
	},
};

/******************************************************************************
 * Ubicom32Input on I2C, U15 MAX7310, address 0x18, 8 bits
 */
static struct ubicom32input_i2c_button ip7500media_ubicom32input_i2c_u15_buttons[] = {
	{
		.type		= EV_KEY,
		.code		= KEY_LEFT,
		.bit		= 0,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_RIGHT,
		.bit		= 1,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_UP,
		.bit		= 2,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_DOWN,
		.bit		= 3,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_ENTER,
		.bit		= 4,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_MENU,
		.bit		= 5,
		.active_low	= 1,
	},
	{
		.type		= EV_KEY,
		.code		= KEY_ESC,
		.bit		= 6,
		.active_low	= 1,
	},
};

static struct ubicom32input_i2c_platform_data ip7500media_ubicom32input_i2c_u15_platform_data = {
	.buttons	= ip7500media_ubicom32input_i2c_u15_buttons,
	.nbuttons	= ARRAY_SIZE(ip7500media_ubicom32input_i2c_u15_buttons),
	.name		= "Ubicom32 Input I2C U15",
};

/******************************************************************************
 * Additional GPIO chips
 */
static struct pca953x_platform_data ip7500media_gpio_u16_platform_data = {
	.gpio_base = IP7500MEDIA_U16_BASE,
};

static struct pca953x_platform_data ip7500media_gpio_u17_platform_data = {
	.gpio_base = IP7500MEDIA_U17_BASE,
	.setup = ip7500media_u17_setup,
};

static struct pca953x_platform_data ip7500media_gpio_u18_platform_data = {
	.gpio_base = IP7500MEDIA_U18_BASE,
};


/******************************************************************************
 * Touch controller present on LCD Adapter board
 *
 * Connected via I2C bus, interrupt on PD1
 */
#include <linux/i2c/tsc2007.h>

/*
 * ip7500media_tsc2007_exit_platform_hw
 */
static void ip7500media_tsc2007_exit_platform_hw(void)
{
	UBICOM32_IO_PORT(RD)->int_mask &= ~(1 << 11);
	UBICOM32_IO_PORT(RD)->ctl2 &= ~(0x03 << 16);
	gpio_free(GPIO_RD_1);
}

/*
 * ip7500media_tsc2007_init_platform_hw
 */
static int ip7500media_tsc2007_init_platform_hw(void)
{
	int res = gpio_request(GPIO_RD_1, "TSC2007_IRQ");
	if (res) {
		return res;
	}
	UBICOM32_IO_PORT(RD)->function = 0;
	UBICOM32_IO_PORT(RD)->int_mask = (1 << 11);
	UBICOM32_IO_PORT(RD)->ctl2 &= ~(0x03 << 16);
	UBICOM32_IO_PORT(RD)->ctl2 |= (0x02 << 16);

	return 0;
}

/*
 * ip7500media_tsc2007_clear_penirq
 */
static void ip7500media_tsc2007_clear_penirq(void)
{
	UBICOM32_IO_PORT(RD)->int_clr = (1 << 11);
}

/*
 * ip7500media_tsc2007_get_pendown_state
 */
static int ip7500media_tsc2007_get_pendown_state(void)
{
	return !gpio_get_value(GPIO_RD_1);
}

static struct tsc2007_platform_data ip7500media_tsc2007_data = {
	.model			= 2007,
	.x_plate_ohms		= 350,
	.get_pendown_state	= ip7500media_tsc2007_get_pendown_state,
	.init_platform_hw	= ip7500media_tsc2007_init_platform_hw,
	.exit_platform_hw	= ip7500media_tsc2007_exit_platform_hw,
	.clear_penirq		= ip7500media_tsc2007_clear_penirq,
};

/******************************************************************************
 * Devices on the I2C bus
 *
 * BEWARE of changing the order of things in this array as we depend on
 * certain things to be in certain places.
 */
static struct i2c_board_info __initdata ip7500media_i2c_board_info[] = {
	/*
	 * U6, CS4350 DAC, address 0x4B
	 */
	{
		.type		= "cs4350",
		.addr		= 0x4B,
	},

	/*
	 * U14, S35390A RTC, address 0x30
	 */
	{
		.type		= "s35390a",
		.addr		= 0x30,
	},

	/*
	 * U15, MAX7310 IO expander, 8 bits, address 0x18
	 *	IO0: User I/O (J16-1) (Left)	IO4: User I/O (J16-5) (Enter)
	 *	IO1: User I/O (J16-2) (Right)	IO5: User I/O (J16-6) (Menu)
	 *	IO2: User I/O (J16-3) (Up)	IO6: User I/O (J16-7) (Back)
	 *	IO3: User I/O (J16-4) (Down)	IO7: User I/O (J16-8)
	 */
	{
		.type		= "ubicom32in_max7310",
		.addr		= 0x18,
		.platform_data	= &ip7500media_ubicom32input_i2c_u15_platform_data,
	},

	/*
	 * U16, MAX7310 IO expander, 8 bits, address 0x1C
	 *	IO8 : User I/O (J16-9)		IO12: User I/O (J16-17)
	 *	IO9 : User I/O (J16-10)		IO13: User I/O (J16-18)
	 *	IO10: User I/O (J16-15)		IO14: User I/O (J16-19)
	 *	IO11: User I/O (J16-16)		IO15: User I/O (J16-20)
	 */
	{
		.type		= "max7310",
		.addr		= 0x1C,
		.platform_data	= &ip7500media_gpio_u16_platform_data,
	},

	/*
	 * U17, MAX7310 IO expander, 8 bits, address 0x1A
	 *	IO16: SDIO1A_WP			IO20: SD1A_PWREN
	 *	IO17: SDIO1B_WP			IO21: SD1B_PWREN
	 *	IO18: SDIO2_CD			IO22: SD2_PWREN
	 *	IO19: SDIO2_WP			IO23: SDIO1A_CD
	 *
	 */
	{
		.type		= "max7310",
		.addr		= 0x1A,
		.platform_data	= &ip7500media_gpio_u17_platform_data,
	},

	/*
	 * U18, MAX7310 IOB expander, 8 bits, address 0x1E
	 *	IO24: SDIO1B_CD			IO28: User I/O TP6
	 *	IO25: User I/O TP9		IO29: User I/O TP5
	 *	IO26: User I/O TP8		IO30: User I/O TP4
	 *	IO27: User I/O TP7		IO31: User I/O TP3
	 */
	{
		.type		= "max7310",
		.addr		= 0x1E,
		.platform_data	= &ip7500media_gpio_u18_platform_data,
	},
};

/*
 * Additional I2C devices to add when a LCD adapter board is present
 */
static struct i2c_board_info __initdata ip7500media_lcd_adapter_i2c_board_info[] = {
	{
		I2C_BOARD_INFO("tsc2007", 0x48),
		.irq = PORT_OTHER_INT(RD),
		.platform_data = &ip7500media_tsc2007_data,
	},
};

/*
 * I2C bus on the board, SDA PE4, SCL PE5
 */
static struct i2c_gpio_platform_data ip7500media_i2c_data = {
	.sda_pin		= GPIO_RE_4,
	.scl_pin		= GPIO_RE_5,
	.sda_is_open_drain	= 0,
	.scl_is_open_drain	= 0,
	.udelay			= 50,
};

static struct platform_device ip7500media_i2c_device = {
	.name	= "i2c-gpio",
	.id	= 0,
	.dev	= {
		.platform_data = &ip7500media_i2c_data,
	},
};

/*
 * Virtual Frame Buffer device for use with LCD Adapter
 */
static struct platform_device ip7500media_vfb_device = {
	.name	= "ubicom32vfb",
	.id	= -1,
};

/*
 * vdc_override:
 *	0: no override (auto-detect)
 *	1: force vdc usage
 *	2: force lcd adapter usage
 */
static int __initdata vdc_override = 0;

/*
 * ip7500media_set_forcevdc
 *	Called when forcevdc is present on the kernel boot line
 */
static int __init ip7500media_set_forcevdc(char *str)
{
	if (str[0] == '1') {
		vdc_override = 1;
	} else {
		vdc_override = 2;
	}
	return 1;
}

/*
 * ip7500media_video_init
 *	Called late to determine what kind of video we have on this board
 */
static int __init ip7500media_video_init(void)
{
	struct i2c_adapter *adap;
	struct i2c_msg msg[1];
	unsigned char *data;
	unsigned char checksum;
	int err;
	int i;

	if (vdc_override == 1) {
		printk(KERN_INFO "Force VDCTIO mode\n");
		goto no_adapter;
	}
	if (vdc_override == 2) {
		printk(KERN_INFO "Force LCD Adapter Board mode\n");
		return 0;
	}

	/*
	 * Check to see if there is an EEPROM out there.  If we see an
	 * EEPROM then we will assume a LCD Adapter Board (8007-092x)
	 * exists.
	 */
	data = kmalloc(256, GFP_KERNEL);
	if (!data) {
		printk(KERN_WARNING "%s: Failed to allocate memory\n", __FUNCTION__);
		return -ENOMEM;
	}

	adap = i2c_get_adapter(0);
	if (!adap) {
		printk(KERN_WARNING "%s: Failed to get i2c adapter\n", __FUNCTION__);
		kfree(data);
		return -ENODEV;
	}
	data[0] = 0;
	msg->addr = 0x50;
	msg->flags = 0;
	msg->len = 1;
	msg->buf = data;
	err = i2c_transfer(adap, msg, 1);
	if (err < 0) {
		goto no_adapter;
	}

	msg->addr = 0x50;
	msg->flags = I2C_M_RD;
	msg->len = 256;
	msg->buf = data;
	err = i2c_transfer(adap, msg, 1);
	if (err < 0) {
		goto no_adapter;
	}

	i2c_put_adapter(adap);

	/*
	 * Verify the checksum
	 */
	checksum = 0xff;
	for (i = 0; i < 255; i++) {
		checksum ^= data[i];
	}
	if (checksum != data[255]) {
		printk(KERN_WARNING "%s: Checksum mismatch\n", __FUNCTION__);
	}

	kfree(data);

	/*
	 * Bring up VFB
	 */
	platform_device_register(&ip7500media_vfb_device);

	/*
	 * Add the i2c devices on the LCD Adapter board.  (We have to use i2c_new_device
	 * since it's late in the boot process.)
	 */
	printk(KERN_INFO "%s: registering LCD Adapter board i2c resources\n", __FUNCTION__);
	for (i = 0; i < ARRAY_SIZE(ip7500media_lcd_adapter_i2c_board_info); i++) {
		i2c_new_device(adap, &ip7500media_lcd_adapter_i2c_board_info[i]);
	}

	i2c_put_adapter(adap);

	return 0;

	/*
	 * No LCD Adapter board, bring up VDC
	 */
no_adapter:
	vdc_tio_init();
	return 0;
}
late_initcall(ip7500media_video_init);
__setup("forcevdc=", ip7500media_set_forcevdc);

/*
 * ip7500media_init
 *	Called to add the devices which we have on this board
 */
static int __init ip7500media_init(void)
{
	struct platform_device *audio_dev;
	int have_ethernet = (devtree_find_node("eth_lan") != 0);

	board_init();

	ubi_gpio_init();

#ifdef CONFIG_UIO_UBICOM32RING
	ring_tio_init("decoder_ring");
#endif

	/*
	 * Register all of the devices we have on this board
	 */
	printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__);
	platform_device_register(&ip7500media_i2c_device);
	platform_device_register(&ip7500media_backlight_device);

	/*
	 * If ethernet doesn't exist then we can init the lcdpower
	 */
	if (!have_ethernet) {
		platform_device_register(&ip7500media_lcdpower_device);
	}

	/*
	 * Allocate the audio drivers.  SPDIF not supported on boards with ethernet.
	 */
	audio_dev = audio_device_alloc("snd-ubi32-cs4350", "audio", "audio-i2sout", 0);
	if (audio_dev) {
		ip7500media_i2c_board_info[0].platform_data = audio_dev;
	}

	if (!have_ethernet) {
		struct platform_device *audio_dev2;

		audio_dev2 = audio_device_alloc("snd-ubi32-generic", "audio", "audio-spdifout", 0);
		if (audio_dev2) {
			platform_device_register(audio_dev2);
		}
	}

	/*
	 * Register all of the devices which sit on the I2C bus
	 */
	printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__);
	i2c_register_board_info(0, ip7500media_i2c_board_info, ARRAY_SIZE(ip7500media_i2c_board_info));

	/*
	 * We have to initialize the SDIO after the I2C IOB gets setup.  SDIO is initialized in
	 * ip7500media_u17_setup
	 */

	printk("IP7500 Media Board\n");

	return 0;
}

arch_initcall(ip7500media_init);