17 #define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt
19 #include <linux/kernel.h>
24 #include <linux/timex.h>
33 #include <linux/i2c.h>
36 #include <linux/export.h>
38 #include <mach/hardware.h>
93 #define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x))
94 #define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00)
95 #define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04)
96 #define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08)
97 #define EP93XX_TIMER123_CONTROL_ENABLE (1 << 7)
98 #define EP93XX_TIMER123_CONTROL_MODE (1 << 6)
99 #define EP93XX_TIMER123_CONTROL_CLKSEL (1 << 3)
100 #define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c)
101 #define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20)
102 #define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24)
103 #define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28)
104 #define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c)
105 #define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60)
106 #define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64)
107 #define EP93XX_TIMER4_VALUE_HIGH_ENABLE (1 << 8)
108 #define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80)
109 #define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84)
110 #define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88)
111 #define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c)
113 #define EP93XX_TIMER123_CLOCK 508469
114 #define EP93XX_TIMER4_CLOCK 983040
116 #define TIMER1_RELOAD ((EP93XX_TIMER123_CLOCK / HZ) - 1)
117 #define TIMER4_TICKS_PER_JIFFY DIV_ROUND_CLOSEST(CLOCK_TICK_RATE, HZ)
119 static unsigned int last_jiffy_time;
137 static struct irqaction ep93xx_timer_irq = {
138 .name =
"ep93xx timer",
140 .handler = ep93xx_timer_interrupt,
143 static void __init ep93xx_timer_init(
void)
161 static unsigned long ep93xx_gettimeoffset(
void)
168 return offset + (53 * offset / 3072);
172 .init = ep93xx_timer_init,
173 .offset = ep93xx_gettimeoffset,
206 spin_unlock_irqrestore(&syscon_swlock, flags);
222 spin_unlock_irqrestore(&syscon_swlock, flags);
243 static struct resource ep93xx_gpio_resource[] = {
248 .name =
"gpio-ep93xx",
250 .num_resources =
ARRAY_SIZE(ep93xx_gpio_resource),
251 .resource = ep93xx_gpio_resource,
257 #define EP93XX_UART_MCR_OFFSET (0x0100)
260 void __iomem *base,
unsigned int mctrl)
274 .set_mctrl = ep93xx_uart_set_mctrl,
286 static struct resource ep93xx_rtc_resource[] = {
291 .name =
"ep93xx-rtc",
293 .num_resources =
ARRAY_SIZE(ep93xx_rtc_resource),
294 .resource = ep93xx_rtc_resource,
298 static struct resource ep93xx_ohci_resources[] = {
305 .name =
"ep93xx-ohci",
308 .dma_mask = &ep93xx_ohci_device.
dev.coherent_dma_mask,
311 .num_resources =
ARRAY_SIZE(ep93xx_ohci_resources),
312 .resource = ep93xx_ohci_resources,
321 static struct resource ep93xx_flash_resource = {
326 .name =
"physmap-flash",
329 .platform_data = &ep93xx_flash_data,
332 .resource = &ep93xx_flash_resource,
344 ep93xx_flash_data.width =
width;
347 ep93xx_flash_resource.
end = start + size - 1;
358 static struct resource ep93xx_eth_resource[] = {
366 .name =
"ep93xx-eth",
371 .dma_mask = &ep93xx_eth_dma_mask,
373 .num_resources =
ARRAY_SIZE(ep93xx_eth_resource),
374 .resource = ep93xx_eth_resource,
402 .platform_data = &ep93xx_i2c_data,
422 pr_warning(
"sda != EEDAT, open drain has no effect\n");
424 pr_warning(
"scl != EECLK, open drain has no effect\n");
430 ep93xx_i2c_data = *
data;
440 static struct resource ep93xx_spi_resources[] = {
448 .name =
"ep93xx-spi",
451 .platform_data = &ep93xx_spi_master_data,
453 .dma_mask = &ep93xx_spi_dma_mask,
455 .num_resources =
ARRAY_SIZE(ep93xx_spi_resources),
456 .resource = ep93xx_spi_resources,
477 ep93xx_spi_master_data = *
info;
487 .name =
"platform:grled",
490 .name =
"platform:rdled",
497 .leds = ep93xx_led_pins,
503 static struct resource ep93xx_pwm0_resource[] = {
508 .name =
"ep93xx-pwm",
510 .num_resources =
ARRAY_SIZE(ep93xx_pwm0_resource),
511 .resource = ep93xx_pwm0_resource,
514 static struct resource ep93xx_pwm1_resource[] = {
519 .name =
"ep93xx-pwm",
521 .num_resources =
ARRAY_SIZE(ep93xx_pwm1_resource),
522 .resource = ep93xx_pwm1_resource,
541 }
else if (pdev->
id == 1) {
543 dev_name(&pdev->
dev));
582 static struct resource ep93xx_fb_resource[] = {
590 .platform_data = &ep93xxfb_data,
592 .dma_mask = &ep93xx_fb_device.
dev.coherent_dma_mask,
594 .num_resources =
ARRAY_SIZE(ep93xx_fb_resource),
595 .resource = ep93xx_fb_resource,
599 #define EP93XX_RASTER_REG_BRIGHTNESS 0x20
601 static struct resource ep93xx_bl_resources[] = {
609 .num_resources =
ARRAY_SIZE(ep93xx_bl_resources),
610 .resource = ep93xx_bl_resources,
619 ep93xxfb_data = *
data;
630 static struct resource ep93xx_keypad_resource[] = {
636 .name =
"ep93xx-keypad",
639 .platform_data = &ep93xx_keypad_data,
641 .num_resources =
ARRAY_SIZE(ep93xx_keypad_resource),
642 .resource = ep93xx_keypad_resource,
651 ep93xx_keypad_data = *
data;
660 for (i = 0; i < 8; i++) {
678 for (--i; i >= 0; --
i) {
690 for (i = 0; i < 8; i++) {
704 static struct resource ep93xx_i2s_resource[] = {
709 .name =
"ep93xx-i2s",
711 .num_resources =
ARRAY_SIZE(ep93xx_i2s_resource),
712 .resource = ep93xx_i2s_resource,
716 .name =
"ep93xx-pcm-audio",
726 #define EP93XX_SYSCON_DEVCFG_I2S_MASK (EP93XX_SYSCON_DEVCFG_I2SONSSP | \
727 EP93XX_SYSCON_DEVCFG_I2SONAC97)
729 #define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \
730 EP93XX_SYSCON_I2SCLKDIV_SPOL)
763 static struct resource ep93xx_ac97_resources[] = {
769 .name =
"ep93xx-ac97",
771 .num_resources =
ARRAY_SIZE(ep93xx_ac97_resources),
772 .resource = ep93xx_ac97_resources,
789 static struct resource ep93xx_wdt_resources[] = {
794 .name =
"ep93xx-wdt",
796 .num_resources =
ARRAY_SIZE(ep93xx_wdt_resources),
797 .resource = ep93xx_wdt_resources,
803 static struct resource ep93xx_ide_resources[] = {
809 .name =
"ep93xx-ide",
812 .dma_mask = &ep93xx_ide_device.
dev.coherent_dma_mask,
815 .num_resources =
ARRAY_SIZE(ep93xx_ide_resources),
816 .resource = ep93xx_ide_resources,
835 for (i = 2; i < 8; i++) {
840 for (i = 4; i < 8; i++) {
845 for (i = 0; i < 8; i++) {
858 for (--i; i >= 0; --
i)
862 for (--i; i >= 4; --
i)
866 for (--i; i >= 2; --
i)
879 for (i = 2; i < 8; i++)
881 for (i = 4; i < 8; i++)
883 for (i = 0; i < 8; i++)