diff options
author | Jayachandran C <jayachandranc@netlogicmicro.com> | 2011-11-11 06:38:29 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2011-12-07 17:04:55 -0500 |
commit | 0c9654072a6e15aa3da9b314f0c5c01e90938268 (patch) | |
tree | 865bbcf93aac081b15bf38604384e4bf7620024b /arch/mips/netlogic/xlr/setup.c | |
parent | 99fb2f7984726ba03d5634df8e6d26eb891f1ec3 (diff) |
MIPS: Netlogic: Move code common with XLP to common/
- Move code that can be shared with XLP (irq.c, smp.c, time.c and
xlr_console.c) to arch/mips/netlogic/common
- Add asm/netlogic/haldefs.h and asm/netlogic/common.h for common and
io functions shared with XLP
- remove type 'nlm_reg_t *' and use uint64_t for mmio offsets
- Move XLR specific code in smp.c to xlr/wakeup.c
- Move XLR specific PCI code from irq.c to mips/pci/pci-xlr.c
- Provide API for pic functions called from common/irq.c
Signed-off-by: Jayachandran C <jayachandranc@netlogicmicro.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/2964/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/netlogic/xlr/setup.c')
-rw-r--r-- | arch/mips/netlogic/xlr/setup.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/mips/netlogic/xlr/setup.c b/arch/mips/netlogic/xlr/setup.c index cee25ddd0887..20c280ae7e99 100644 --- a/arch/mips/netlogic/xlr/setup.c +++ b/arch/mips/netlogic/xlr/setup.c | |||
@@ -39,26 +39,28 @@ | |||
39 | #include <asm/reboot.h> | 39 | #include <asm/reboot.h> |
40 | #include <asm/time.h> | 40 | #include <asm/time.h> |
41 | #include <asm/bootinfo.h> | 41 | #include <asm/bootinfo.h> |
42 | #include <asm/smp-ops.h> | ||
43 | 42 | ||
44 | #include <asm/netlogic/interrupt.h> | 43 | #include <asm/netlogic/interrupt.h> |
45 | #include <asm/netlogic/psb-bootinfo.h> | 44 | #include <asm/netlogic/psb-bootinfo.h> |
45 | #include <asm/netlogic/haldefs.h> | ||
46 | #include <asm/netlogic/common.h> | ||
46 | 47 | ||
47 | #include <asm/netlogic/xlr/xlr.h> | 48 | #include <asm/netlogic/xlr/xlr.h> |
48 | #include <asm/netlogic/xlr/iomap.h> | 49 | #include <asm/netlogic/xlr/iomap.h> |
49 | #include <asm/netlogic/xlr/pic.h> | 50 | #include <asm/netlogic/xlr/pic.h> |
50 | #include <asm/netlogic/xlr/gpio.h> | 51 | #include <asm/netlogic/xlr/gpio.h> |
51 | 52 | ||
52 | unsigned long netlogic_io_base = (unsigned long)(DEFAULT_NETLOGIC_IO_BASE); | 53 | uint64_t nlm_io_base = DEFAULT_NETLOGIC_IO_BASE; |
54 | uint64_t nlm_pic_base; | ||
53 | unsigned long nlm_common_ebase = 0x0; | 55 | unsigned long nlm_common_ebase = 0x0; |
54 | struct psb_info nlm_prom_info; | 56 | struct psb_info nlm_prom_info; |
55 | 57 | ||
56 | static void __init nlm_early_serial_setup(void) | 58 | static void __init nlm_early_serial_setup(void) |
57 | { | 59 | { |
58 | struct uart_port s; | 60 | struct uart_port s; |
59 | nlm_reg_t *uart_base; | 61 | unsigned long uart_base; |
60 | 62 | ||
61 | uart_base = netlogic_io_mmio(NETLOGIC_IO_UART_0_OFFSET); | 63 | uart_base = (unsigned long)nlm_mmio_base(NETLOGIC_IO_UART_0_OFFSET); |
62 | memset(&s, 0, sizeof(s)); | 64 | memset(&s, 0, sizeof(s)); |
63 | s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; | 65 | s.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; |
64 | s.iotype = UPIO_MEM32; | 66 | s.iotype = UPIO_MEM32; |
@@ -67,18 +69,18 @@ static void __init nlm_early_serial_setup(void) | |||
67 | s.uartclk = PIC_CLKS_PER_SEC; | 69 | s.uartclk = PIC_CLKS_PER_SEC; |
68 | s.serial_in = nlm_xlr_uart_in; | 70 | s.serial_in = nlm_xlr_uart_in; |
69 | s.serial_out = nlm_xlr_uart_out; | 71 | s.serial_out = nlm_xlr_uart_out; |
70 | s.mapbase = (unsigned long)uart_base; | 72 | s.mapbase = uart_base; |
71 | s.membase = (unsigned char __iomem *)uart_base; | 73 | s.membase = (unsigned char __iomem *)uart_base; |
72 | early_serial_setup(&s); | 74 | early_serial_setup(&s); |
73 | } | 75 | } |
74 | 76 | ||
75 | static void nlm_linux_exit(void) | 77 | static void nlm_linux_exit(void) |
76 | { | 78 | { |
77 | nlm_reg_t *mmio; | 79 | uint64_t gpiobase; |
78 | 80 | ||
79 | mmio = netlogic_io_mmio(NETLOGIC_IO_GPIO_OFFSET); | 81 | gpiobase = nlm_mmio_base(NETLOGIC_IO_GPIO_OFFSET); |
80 | /* trigger a chip reset by writing 1 to GPIO_SWRESET_REG */ | 82 | /* trigger a chip reset by writing 1 to GPIO_SWRESET_REG */ |
81 | netlogic_write_reg(mmio, NETLOGIC_GPIO_SWRESET_REG, 1); | 83 | nlm_write_reg(gpiobase, NETLOGIC_GPIO_SWRESET_REG, 1); |
82 | for ( ; ; ) | 84 | for ( ; ; ) |
83 | cpu_wait(); | 85 | cpu_wait(); |
84 | } | 86 | } |
@@ -96,6 +98,11 @@ const char *get_system_type(void) | |||
96 | return "Netlogic XLR/XLS Series"; | 98 | return "Netlogic XLR/XLS Series"; |
97 | } | 99 | } |
98 | 100 | ||
101 | unsigned int nlm_get_cpu_frequency(void) | ||
102 | { | ||
103 | return (unsigned int)nlm_prom_info.cpu_frequency; | ||
104 | } | ||
105 | |||
99 | void __init prom_free_prom_memory(void) | 106 | void __init prom_free_prom_memory(void) |
100 | { | 107 | { |
101 | /* Nothing yet */ | 108 | /* Nothing yet */ |
@@ -175,6 +182,7 @@ void __init prom_init(void) | |||
175 | prom_infop = (struct psb_info *)(long)(int)fw_arg3; | 182 | prom_infop = (struct psb_info *)(long)(int)fw_arg3; |
176 | 183 | ||
177 | nlm_prom_info = *prom_infop; | 184 | nlm_prom_info = *prom_infop; |
185 | nlm_pic_base = nlm_mmio_base(NETLOGIC_IO_PIC_OFFSET); | ||
178 | 186 | ||
179 | nlm_early_serial_setup(); | 187 | nlm_early_serial_setup(); |
180 | build_arcs_cmdline(argv); | 188 | build_arcs_cmdline(argv); |