2006-09-26 23:59:17 -07:00
|
|
|
/*
|
|
|
|
* arch/sh/boards/renesas/r7780rp/setup.c
|
|
|
|
*
|
2007-03-11 22:38:59 -07:00
|
|
|
* Renesas Solutions Highlander Support.
|
|
|
|
*
|
2006-09-26 23:59:17 -07:00
|
|
|
* Copyright (C) 2002 Atom Create Engineering Co., Ltd.
|
2007-02-13 22:49:04 -07:00
|
|
|
* Copyright (C) 2005 - 2007 Paul Mundt
|
2006-09-26 23:59:17 -07:00
|
|
|
*
|
2007-03-11 22:38:59 -07:00
|
|
|
* This contains support for the R7780RP-1, R7780MP, and R7785RP
|
|
|
|
* Highlander modules.
|
2006-09-26 23:59:17 -07:00
|
|
|
*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
2007-02-13 22:49:04 -07:00
|
|
|
#include <linux/pata_platform.h>
|
2006-09-26 23:59:17 -07:00
|
|
|
#include <asm/machvec.h>
|
2006-10-19 00:16:18 -07:00
|
|
|
#include <asm/r7780rp.h>
|
2006-09-26 23:59:17 -07:00
|
|
|
#include <asm/clock.h>
|
2007-08-19 21:03:41 -07:00
|
|
|
#include <asm/heartbeat.h>
|
2006-09-26 23:59:17 -07:00
|
|
|
#include <asm/io.h>
|
|
|
|
|
2007-07-16 21:38:54 -07:00
|
|
|
static struct resource r8a66597_usb_host_resources[] = {
|
|
|
|
[0] = {
|
|
|
|
.name = "r8a66597_hcd",
|
|
|
|
.start = 0xA4200000,
|
|
|
|
.end = 0xA42000FF,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.name = "r8a66597_hcd",
|
2007-09-09 20:06:03 -07:00
|
|
|
.start = IRQ_EXT1, /* irq number */
|
|
|
|
.end = IRQ_EXT1,
|
2007-07-16 21:38:54 -07:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device r8a66597_usb_host_device = {
|
|
|
|
.name = "r8a66597_hcd",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.dma_mask = NULL, /* don't use dma */
|
|
|
|
.coherent_dma_mask = 0xffffffff,
|
|
|
|
},
|
|
|
|
.num_resources = ARRAY_SIZE(r8a66597_usb_host_resources),
|
|
|
|
.resource = r8a66597_usb_host_resources,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource m66592_usb_peripheral_resources[] = {
|
|
|
|
[0] = {
|
|
|
|
.name = "m66592_udc",
|
|
|
|
.start = 0xb0000000,
|
|
|
|
.end = 0xb00000FF,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
|
|
|
.name = "m66592_udc",
|
2007-09-09 20:06:03 -07:00
|
|
|
.start = IRQ_EXT4, /* irq number */
|
|
|
|
.end = IRQ_EXT4,
|
2007-07-16 21:38:54 -07:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device m66592_usb_peripheral_device = {
|
|
|
|
.name = "m66592_udc",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.dma_mask = NULL, /* don't use dma */
|
|
|
|
.coherent_dma_mask = 0xffffffff,
|
|
|
|
},
|
|
|
|
.num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
|
|
|
|
.resource = m66592_usb_peripheral_resources,
|
|
|
|
};
|
|
|
|
|
2006-12-05 18:43:44 -07:00
|
|
|
static struct resource cf_ide_resources[] = {
|
|
|
|
[0] = {
|
2007-02-13 22:49:04 -07:00
|
|
|
.start = PA_AREA5_IO + 0x1000,
|
|
|
|
.end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2006-12-05 18:43:44 -07:00
|
|
|
},
|
|
|
|
[1] = {
|
2007-02-13 22:49:04 -07:00
|
|
|
.start = PA_AREA5_IO + 0x80c,
|
|
|
|
.end = PA_AREA5_IO + 0x80c + 0x16 - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2006-12-05 18:43:44 -07:00
|
|
|
},
|
|
|
|
[2] = {
|
2007-09-09 20:06:03 -07:00
|
|
|
.start = IRQ_CF,
|
2006-12-05 18:43:44 -07:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-02-13 22:49:04 -07:00
|
|
|
static struct pata_platform_info pata_info = {
|
|
|
|
.ioport_shift = 1,
|
|
|
|
};
|
|
|
|
|
2006-12-05 18:43:44 -07:00
|
|
|
static struct platform_device cf_ide_device = {
|
|
|
|
.name = "pata_platform",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = ARRAY_SIZE(cf_ide_resources),
|
|
|
|
.resource = cf_ide_resources,
|
2007-02-13 22:49:04 -07:00
|
|
|
.dev = {
|
|
|
|
.platform_data = &pata_info,
|
|
|
|
},
|
2006-12-05 18:43:44 -07:00
|
|
|
};
|
|
|
|
|
2007-02-12 23:42:28 -07:00
|
|
|
static struct resource heartbeat_resources[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = PA_OBLED,
|
2007-08-22 23:11:44 -07:00
|
|
|
.end = PA_OBLED,
|
2007-02-12 23:42:28 -07:00
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-08-19 21:03:41 -07:00
|
|
|
#ifndef CONFIG_SH_R7785RP
|
|
|
|
static unsigned char heartbeat_bit_pos[] = { 2, 1, 0, 3, 6, 5, 4, 7 };
|
|
|
|
|
|
|
|
static struct heartbeat_data heartbeat_data = {
|
|
|
|
.bit_pos = heartbeat_bit_pos,
|
|
|
|
.nr_bits = ARRAY_SIZE(heartbeat_bit_pos),
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-02-12 23:42:28 -07:00
|
|
|
static struct platform_device heartbeat_device = {
|
|
|
|
.name = "heartbeat",
|
|
|
|
.id = -1,
|
2007-03-11 22:38:59 -07:00
|
|
|
|
|
|
|
/* R7785RP has a slightly more sensible FPGA.. */
|
|
|
|
#ifndef CONFIG_SH_R7785RP
|
2007-02-12 23:42:28 -07:00
|
|
|
.dev = {
|
2007-08-22 23:11:44 -07:00
|
|
|
.platform_data = &heartbeat_data,
|
2007-02-12 23:42:28 -07:00
|
|
|
},
|
2007-03-11 22:38:59 -07:00
|
|
|
#endif
|
2007-02-12 23:42:28 -07:00
|
|
|
.num_resources = ARRAY_SIZE(heartbeat_resources),
|
|
|
|
.resource = heartbeat_resources,
|
|
|
|
};
|
|
|
|
|
2006-09-26 23:59:17 -07:00
|
|
|
static struct platform_device *r7780rp_devices[] __initdata = {
|
2007-07-16 21:38:54 -07:00
|
|
|
&r8a66597_usb_host_device,
|
|
|
|
&m66592_usb_peripheral_device,
|
2006-12-05 18:43:44 -07:00
|
|
|
&cf_ide_device,
|
2007-02-12 23:42:28 -07:00
|
|
|
&heartbeat_device,
|
2006-09-26 23:59:17 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
static int __init r7780rp_devices_setup(void)
|
|
|
|
{
|
|
|
|
return platform_add_devices(r7780rp_devices,
|
|
|
|
ARRAY_SIZE(r7780rp_devices));
|
|
|
|
}
|
2007-03-11 22:38:59 -07:00
|
|
|
device_initcall(r7780rp_devices_setup);
|
2006-09-26 23:59:17 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Platform specific clocks
|
|
|
|
*/
|
|
|
|
static void ivdr_clk_enable(struct clk *clk)
|
|
|
|
{
|
2007-05-06 18:48:56 -07:00
|
|
|
ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
|
2006-09-26 23:59:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ivdr_clk_disable(struct clk *clk)
|
|
|
|
{
|
2007-05-06 18:48:56 -07:00
|
|
|
ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
|
2006-09-26 23:59:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct clk_ops ivdr_clk_ops = {
|
|
|
|
.enable = ivdr_clk_enable,
|
|
|
|
.disable = ivdr_clk_disable,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk ivdr_clk = {
|
|
|
|
.name = "ivdr_clk",
|
|
|
|
.ops = &ivdr_clk_ops,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct clk *r7780rp_clocks[] = {
|
|
|
|
&ivdr_clk,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void r7780rp_power_off(void)
|
|
|
|
{
|
2007-03-11 22:38:59 -07:00
|
|
|
if (mach_is_r7780mp() || mach_is_r7785rp())
|
|
|
|
ctrl_outw(0x0001, PA_POFF);
|
2006-09-26 23:59:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize the board
|
|
|
|
*/
|
2007-03-11 22:38:59 -07:00
|
|
|
static void __init highlander_setup(char **cmdline_p)
|
2006-09-26 23:59:17 -07:00
|
|
|
{
|
|
|
|
u16 ver = ctrl_inw(PA_VERREG);
|
|
|
|
int i;
|
|
|
|
|
2007-03-11 22:38:59 -07:00
|
|
|
printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
|
|
|
|
mach_is_r7780rp() ? "R7780RP-1" :
|
|
|
|
mach_is_r7780mp() ? "R7780MP" :
|
|
|
|
"R7785RP");
|
2006-09-26 23:59:17 -07:00
|
|
|
|
|
|
|
printk(KERN_INFO "Board version: %d (revision %d), "
|
|
|
|
"FPGA version: %d (revision %d)\n",
|
|
|
|
(ver >> 12) & 0xf, (ver >> 8) & 0xf,
|
|
|
|
(ver >> 4) & 0xf, ver & 0xf);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable the important clocks right away..
|
|
|
|
*/
|
|
|
|
for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
|
|
|
|
struct clk *clk = r7780rp_clocks[i];
|
|
|
|
|
|
|
|
clk_register(clk);
|
|
|
|
clk_enable(clk);
|
|
|
|
}
|
|
|
|
|
|
|
|
ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */
|
2007-03-11 22:38:59 -07:00
|
|
|
|
|
|
|
if (mach_is_r7780rp())
|
|
|
|
ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */
|
|
|
|
|
2006-12-25 02:28:33 -07:00
|
|
|
ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */
|
2006-09-26 23:59:17 -07:00
|
|
|
|
|
|
|
pm_power_off = r7780rp_power_off;
|
|
|
|
}
|
2006-09-27 02:17:31 -07:00
|
|
|
|
2007-09-09 20:06:03 -07:00
|
|
|
static unsigned char irl2irq[HL_NR_IRL];
|
|
|
|
|
|
|
|
int highlander_irq_demux(int irq)
|
|
|
|
{
|
|
|
|
if (irq >= HL_NR_IRL || !irl2irq[irq])
|
|
|
|
return irq;
|
|
|
|
|
|
|
|
return irl2irq[irq];
|
|
|
|
}
|
|
|
|
|
|
|
|
void __init highlander_init_irq(void)
|
|
|
|
{
|
|
|
|
unsigned char *ucp = NULL;
|
|
|
|
|
|
|
|
do {
|
|
|
|
#ifdef CONFIG_SH_R7780MP
|
|
|
|
ucp = highlander_init_irq_r7780mp();
|
|
|
|
if (ucp)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SH_R7785RP
|
|
|
|
ucp = highlander_init_irq_r7785rp();
|
|
|
|
if (ucp)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SH_R7780RP
|
|
|
|
highlander_init_irq_r7780rp();
|
|
|
|
ucp = irl2irq;
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
if (ucp) {
|
|
|
|
plat_irq_setup_pins(IRQ_MODE_IRL3210);
|
|
|
|
memcpy(irl2irq, ucp, HL_NR_IRL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-09-27 02:17:31 -07:00
|
|
|
/*
|
|
|
|
* The Machine Vector
|
|
|
|
*/
|
2007-05-14 23:19:34 -07:00
|
|
|
static struct sh_machine_vector mv_highlander __initmv = {
|
2007-03-11 22:38:59 -07:00
|
|
|
.mv_name = "Highlander",
|
|
|
|
.mv_setup = highlander_setup,
|
|
|
|
.mv_init_irq = highlander_init_irq,
|
2007-09-09 20:06:03 -07:00
|
|
|
.mv_irq_demux = highlander_irq_demux,
|
2006-09-27 02:17:31 -07:00
|
|
|
};
|