1 /************************************************************************
4 * Infineon Technologies AG
5 * St. Martin Strasse 53; 81669 Muenchen; Germany
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
12 ************************************************************************/
14 #include <linux/module.h>
15 #include <linux/types.h>
16 #include <linux/kernel.h>
17 #include <linux/proc_fs.h>
18 #include <linux/init.h>
19 #include <asm/addrspace.h>
20 #include <linux/platform_device.h>
22 #include <lantiq_soc.h>
28 #define DRV_NAME "ltq_mux"
30 static void ltq_mux_port_init(const int port,
31 const struct ltq_mux_pin *pins,
36 for (i = 0; i < pin_max; i++)
37 ltq_gpio_configure(port,
45 static int ltq_mux_probe(struct platform_device *pdev)
47 struct ltq_mux_settings *mux_settings = dev_get_platdata(&pdev->dev);
49 if (mux_settings->mux_p0)
54 if (mux_settings->mux_p1)
59 if (mux_settings->mux_p2)
64 if (mux_settings->mux_p3)
69 if (mux_settings->mux_p4)
77 int ltq_mux_read_procmem(char *buf, char **start, off_t offset,
78 int count, int *eof, void *data)
90 #define PROC_PRINT(fmt, args...) \
93 c_len = snprintf(buf + len, count - len, fmt, ## args); \
96 if (c_len >= (count - len)) { \
97 len += (count - len); \
102 if (len > offset) { \
104 memmove(buf, buf + offset, len); \
113 PROC_PRINT("\nVINETIC-SVIP Multiplex Settings\n");
114 PROC_PRINT(" 3 2 1 0\n");
115 PROC_PRINT(" 10987654321098765432109876543210\n");
116 PROC_PRINT(" --------------------------------\n");
118 for (i = 0; i < ARRAY_SIZE(port_clk); i++) {
120 if (!svip_sys1_clk_is_enabled(port_clk[i]))
123 if (!svip_sys2_clk_is_enabled(port_clk[i]))
127 PROC_PRINT("P%d.%-10s", i, "DIR:");
129 for (t = 31; t != -1; t--)
130 PROC_PRINT("%d", ltq_port_get_dir(i, t) == 1 ? 1 : 0);
133 PROC_PRINT("P%d.%-10s", i, "PUEN:");
134 for (t = 31; t != -1; t--)
135 PROC_PRINT("%d", ltq_port_get_puden(i, t) == 1 ? 1 : 0);
138 PROC_PRINT("P%d.%-10s", i, "ALTSEL0:");
139 for (t = 31; t != -1; t--)
141 ltq_port_get_altsel0(i, t) == 1 ? 1 : 0);
144 PROC_PRINT("P%d.%-10s", i, "ALTSEL1:");
145 for (t = 31; t != -1; t--)
147 ltq_port_get_altsel1(i, t) == 1 ? 1 : 0);
155 } else if (len < count) {
166 static struct platform_driver ltq_mux_driver = {
167 .probe = ltq_mux_probe,
170 .owner = THIS_MODULE,
174 int __init ltq_mux_init(void)
176 int ret = platform_driver_register(<q_mux_driver);
178 printk(KERN_INFO DRV_NAME
179 ": Error registering platform driver!");
183 return create_proc_read_entry("driver/ltq_mux", 0, NULL,
184 ltq_mux_read_procmem, NULL) == NULL;
187 module_init(ltq_mux_init);