aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9')
-rw-r--r--arch/mips/txx9/Kconfig2
-rw-r--r--arch/mips/txx9/generic/pci.c6
-rw-r--r--arch/mips/txx9/generic/setup.c70
-rw-r--r--arch/mips/txx9/generic/setup_tx3927.c1
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c1
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c1
-rw-r--r--arch/mips/txx9/jmr3927/setup.c11
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c32
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c1
9 files changed, 69 insertions, 56 deletions
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 8c337d60f790..42923478d45c 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -20,7 +20,7 @@ config MACH_TXX9
20 select SYS_SUPPORTS_32BIT_KERNEL 20 select SYS_SUPPORTS_32BIT_KERNEL
21 select SYS_SUPPORTS_LITTLE_ENDIAN 21 select SYS_SUPPORTS_LITTLE_ENDIAN
22 select SYS_SUPPORTS_BIG_ENDIAN 22 select SYS_SUPPORTS_BIG_ENDIAN
23 select HAVE_CLK 23 select COMMON_CLK
24 24
25config TOSHIBA_JMR3927 25config TOSHIBA_JMR3927
26 bool "Toshiba JMR-TX3927 board" 26 bool "Toshiba JMR-TX3927 board"
diff --git a/arch/mips/txx9/generic/pci.c b/arch/mips/txx9/generic/pci.c
index 1f6bc9a3036c..285d84e5c7b9 100644
--- a/arch/mips/txx9/generic/pci.c
+++ b/arch/mips/txx9/generic/pci.c
@@ -29,12 +29,8 @@ static int __init
29early_read_config_word(struct pci_controller *hose, 29early_read_config_word(struct pci_controller *hose,
30 int top_bus, int bus, int devfn, int offset, u16 *value) 30 int top_bus, int bus, int devfn, int offset, u16 *value)
31{ 31{
32 struct pci_dev fake_dev;
33 struct pci_bus fake_bus; 32 struct pci_bus fake_bus;
34 33
35 fake_dev.bus = &fake_bus;
36 fake_dev.sysdata = hose;
37 fake_dev.devfn = devfn;
38 fake_bus.number = bus; 34 fake_bus.number = bus;
39 fake_bus.sysdata = hose; 35 fake_bus.sysdata = hose;
40 fake_bus.ops = hose->pci_ops; 36 fake_bus.ops = hose->pci_ops;
@@ -45,7 +41,7 @@ early_read_config_word(struct pci_controller *hose,
45 else 41 else
46 fake_bus.parent = NULL; 42 fake_bus.parent = NULL;
47 43
48 return pci_read_config_word(&fake_dev, offset, value); 44 return pci_bus_read_config_word(&fake_bus, devfn, offset, value);
49} 45}
50 46
51int __init txx9_pci66_check(struct pci_controller *hose, int top_bus, 47int __init txx9_pci66_check(struct pci_controller *hose, int top_bus,
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index ada92db92f87..a1d98b5c8fd6 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -15,7 +15,8 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/clk.h> 18#include <linux/clk-provider.h>
19#include <linux/clkdev.h>
19#include <linux/err.h> 20#include <linux/err.h>
20#include <linux/gpio/driver.h> 21#include <linux/gpio/driver.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
@@ -83,40 +84,6 @@ int txx9_ccfg_toeon __initdata;
83int txx9_ccfg_toeon __initdata = 1; 84int txx9_ccfg_toeon __initdata = 1;
84#endif 85#endif
85 86
86/* Minimum CLK support */
87
88struct clk *clk_get(struct device *dev, const char *id)
89{
90 if (!strcmp(id, "spi-baseclk"))
91 return (struct clk *)((unsigned long)txx9_gbus_clock / 2 / 2);
92 if (!strcmp(id, "imbus_clk"))
93 return (struct clk *)((unsigned long)txx9_gbus_clock / 2);
94 return ERR_PTR(-ENOENT);
95}
96EXPORT_SYMBOL(clk_get);
97
98int clk_enable(struct clk *clk)
99{
100 return 0;
101}
102EXPORT_SYMBOL(clk_enable);
103
104void clk_disable(struct clk *clk)
105{
106}
107EXPORT_SYMBOL(clk_disable);
108
109unsigned long clk_get_rate(struct clk *clk)
110{
111 return (unsigned long)clk;
112}
113EXPORT_SYMBOL(clk_get_rate);
114
115void clk_put(struct clk *clk)
116{
117}
118EXPORT_SYMBOL(clk_put);
119
120#define BOARD_VEC(board) extern struct txx9_board_vec board; 87#define BOARD_VEC(board) extern struct txx9_board_vec board;
121#include <asm/txx9/boards.h> 88#include <asm/txx9/boards.h>
122#undef BOARD_VEC 89#undef BOARD_VEC
@@ -560,8 +527,41 @@ void __init plat_time_init(void)
560 txx9_board_vec->time_init(); 527 txx9_board_vec->time_init();
561} 528}
562 529
530static void txx9_clk_init(void)
531{
532 struct clk_hw *hw;
533 int error;
534
535 hw = clk_hw_register_fixed_rate(NULL, "gbus", NULL, 0, txx9_gbus_clock);
536 if (IS_ERR(hw)) {
537 error = PTR_ERR(hw);
538 goto fail;
539 }
540
541 hw = clk_hw_register_fixed_factor(NULL, "imbus", "gbus", 0, 1, 2);
542 error = clk_hw_register_clkdev(hw, "imbus_clk", NULL);
543 if (error)
544 goto fail;
545
546#ifdef CONFIG_CPU_TX49XX
547 if (TX4938_REV_PCODE() == 0x4938) {
548 hw = clk_hw_register_fixed_factor(NULL, "spi", "gbus", 0, 1, 4);
549 error = clk_hw_register_clkdev(hw, "spi-baseclk", NULL);
550 if (error)
551 goto fail;
552 }
553#endif
554
555 return;
556
557fail:
558 pr_err("Failed to register clocks: %d\n", error);
559}
560
563static int __init _txx9_arch_init(void) 561static int __init _txx9_arch_init(void)
564{ 562{
563 txx9_clk_init();
564
565 if (txx9_board_vec->arch_init) 565 if (txx9_board_vec->arch_init)
566 txx9_board_vec->arch_init(); 566 txx9_board_vec->arch_init();
567 return 0; 567 return 0;
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
index 110e05c3eb8f..d3b83a92cf26 100644
--- a/arch/mips/txx9/generic/setup_tx3927.c
+++ b/arch/mips/txx9/generic/setup_tx3927.c
@@ -92,7 +92,6 @@ void __init tx3927_setup(void)
92 /* PIO */ 92 /* PIO */
93 __raw_writel(0, &tx3927_pioptr->maskcpu); 93 __raw_writel(0, &tx3927_pioptr->maskcpu);
94 __raw_writel(0, &tx3927_pioptr->maskext); 94 __raw_writel(0, &tx3927_pioptr->maskext);
95 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
96 95
97 conf = read_c0_conf(); 96 conf = read_c0_conf();
98 if (conf & TX39_CONF_DCE) { 97 if (conf & TX39_CONF_DCE) {
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index a4664cb6c1e1..8d8011570b1d 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -215,7 +215,6 @@ void __init tx4927_setup(void)
215 txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL); 215 txx9_tmr_init(TX4927_TMR_REG(i) & 0xfffffffffULL);
216 216
217 /* PIO */ 217 /* PIO */
218 txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
219 __raw_writel(0, &tx4927_pioptr->maskcpu); 218 __raw_writel(0, &tx4927_pioptr->maskcpu);
220 __raw_writel(0, &tx4927_pioptr->maskext); 219 __raw_writel(0, &tx4927_pioptr->maskext);
221 220
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 58cdb2aba5e1..ba265bf1fd06 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -241,7 +241,6 @@ void __init tx4938_setup(void)
241 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); 241 txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL);
242 242
243 /* PIO */ 243 /* PIO */
244 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
245 __raw_writel(0, &tx4938_pioptr->maskcpu); 244 __raw_writel(0, &tx4938_pioptr->maskcpu);
246 __raw_writel(0, &tx4938_pioptr->maskext); 245 __raw_writel(0, &tx4938_pioptr->maskext);
247 246
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index 3206f76f300b..a455166dc6d4 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -142,8 +142,6 @@ static void __init jmr3927_board_init(void)
142 142
143 /* PIO[15:12] connected to LEDs */ 143 /* PIO[15:12] connected to LEDs */
144 __raw_writel(0x0000f000, &tx3927_pioptr->dir); 144 __raw_writel(0x0000f000, &tx3927_pioptr->dir);
145 gpio_request(11, "dipsw1");
146 gpio_request(10, "dipsw2");
147 145
148 jmr3927_pci_setup(); 146 jmr3927_pci_setup();
149 147
@@ -204,6 +202,14 @@ static void __init jmr3927_device_init(void)
204 txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL); 202 txx9_iocled_init(iocled_base, -1, 8, 1, "green", NULL);
205} 203}
206 204
205static void __init jmr3927_arch_init(void)
206{
207 txx9_gpio_init(TX3927_PIO_REG, 0, 16);
208
209 gpio_request(11, "dipsw1");
210 gpio_request(10, "dipsw2");
211}
212
207struct txx9_board_vec jmr3927_vec __initdata = { 213struct txx9_board_vec jmr3927_vec __initdata = {
208 .system = "Toshiba JMR_TX3927", 214 .system = "Toshiba JMR_TX3927",
209 .prom_init = jmr3927_prom_init, 215 .prom_init = jmr3927_prom_init,
@@ -211,6 +217,7 @@ struct txx9_board_vec jmr3927_vec __initdata = {
211 .irq_setup = jmr3927_irq_setup, 217 .irq_setup = jmr3927_irq_setup,
212 .time_init = jmr3927_time_init, 218 .time_init = jmr3927_time_init,
213 .device_init = jmr3927_device_init, 219 .device_init = jmr3927_device_init,
220 .arch_init = jmr3927_arch_init,
214#ifdef CONFIG_PCI 221#ifdef CONFIG_PCI
215 .pci_map_irq = jmr3927_pci_map_irq, 222 .pci_map_irq = jmr3927_pci_map_irq,
216#endif 223#endif
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 3c516ef625e5..f5b367e20dff 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -52,6 +52,7 @@
52#include <linux/leds.h> 52#include <linux/leds.h>
53#include <asm/io.h> 53#include <asm/io.h>
54#include <asm/reboot.h> 54#include <asm/reboot.h>
55#include <asm/txx9pio.h>
55#include <asm/txx9/generic.h> 56#include <asm/txx9/generic.h>
56#include <asm/txx9/pci.h> 57#include <asm/txx9/pci.h>
57#include <asm/txx9/rbtx4927.h> 58#include <asm/txx9/rbtx4927.h>
@@ -151,20 +152,37 @@ static void __init tx4937_pci_setup(void)
151 } 152 }
152 tx4938_setup_pcierr_irq(); 153 tx4938_setup_pcierr_irq();
153} 154}
155#else
156static inline void tx4927_pci_setup(void) {}
157static inline void tx4937_pci_setup(void) {}
158#endif /* CONFIG_PCI */
159
160static void __init rbtx4927_gpio_init(void)
161{
162 /* TX4927-SIO DTR on (PIO[15]) */
163 gpio_request(15, "sio-dtr");
164 gpio_direction_output(15, 1);
165
166 tx4927_sio_init(0, 0);
167}
154 168
155static void __init rbtx4927_arch_init(void) 169static void __init rbtx4927_arch_init(void)
156{ 170{
171 txx9_gpio_init(TX4927_PIO_REG & 0xfffffffffULL, 0, TX4927_NUM_PIO);
172
173 rbtx4927_gpio_init();
174
157 tx4927_pci_setup(); 175 tx4927_pci_setup();
158} 176}
159 177
160static void __init rbtx4937_arch_init(void) 178static void __init rbtx4937_arch_init(void)
161{ 179{
180 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
181
182 rbtx4927_gpio_init();
183
162 tx4937_pci_setup(); 184 tx4937_pci_setup();
163} 185}
164#else
165#define rbtx4927_arch_init NULL
166#define rbtx4937_arch_init NULL
167#endif /* CONFIG_PCI */
168 186
169static void toshiba_rbtx4927_restart(char *command) 187static void toshiba_rbtx4927_restart(char *command)
170{ 188{
@@ -205,12 +223,6 @@ static void __init rbtx4927_mem_setup(void)
205#else 223#else
206 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET); 224 set_io_port_base(KSEG1 + RBTX4927_ISA_IO_OFFSET);
207#endif 225#endif
208
209 /* TX4927-SIO DTR on (PIO[15]) */
210 gpio_request(15, "sio-dtr");
211 gpio_direction_output(15, 1);
212
213 tx4927_sio_init(0, 0);
214} 226}
215 227
216static void __init rbtx4927_clock_init(void) 228static void __init rbtx4927_clock_init(void)
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 54de66837103..07939ed6b22f 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -336,6 +336,7 @@ static void __init rbtx4938_mtd_init(void)
336 336
337static void __init rbtx4938_arch_init(void) 337static void __init rbtx4938_arch_init(void)
338{ 338{
339 txx9_gpio_init(TX4938_PIO_REG & 0xfffffffffULL, 0, TX4938_NUM_PIO);
339 gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL); 340 gpiochip_add_data(&rbtx4938_spi_gpio_chip, NULL);
340 rbtx4938_pci_setup(); 341 rbtx4938_pci_setup();
341 rbtx4938_spi_init(); 342 rbtx4938_spi_init();