Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 1 | /* |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 2 | * SuperH Pin Function Controller support. |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2008 Magnus Damm |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 5 | * Copyright (C) 2009 - 2012 Paul Mundt |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 6 | * |
| 7 | * This file is subject to the terms and conditions of the GNU General Public |
| 8 | * License. See the file "COPYING" in the main directory of this archive |
| 9 | * for more details. |
| 10 | */ |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 11 | |
| 12 | #define DRV_NAME "sh-pfc" |
Laurent Pinchart | f9492fd | 2012-12-15 23:50:45 +0100 | [diff] [blame] | 13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
Paul Mundt | b72421d | 2010-10-04 03:54:56 +0900 | [diff] [blame] | 14 | |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 15 | #include <linux/bitops.h> |
Laurent Pinchart | 90efde2 | 2012-12-15 23:50:52 +0100 | [diff] [blame] | 16 | #include <linux/err.h> |
| 17 | #include <linux/errno.h> |
| 18 | #include <linux/io.h> |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 19 | #include <linux/ioport.h> |
Laurent Pinchart | 90efde2 | 2012-12-15 23:50:52 +0100 | [diff] [blame] | 20 | #include <linux/kernel.h> |
| 21 | #include <linux/module.h> |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 22 | #include <linux/pinctrl/machine.h> |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 23 | #include <linux/platform_device.h> |
Laurent Pinchart | 90efde2 | 2012-12-15 23:50:52 +0100 | [diff] [blame] | 24 | #include <linux/sh_pfc.h> |
| 25 | #include <linux/slab.h> |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 26 | |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 27 | #include "core.h" |
| 28 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 29 | static int sh_pfc_ioremap(struct sh_pfc *pfc, struct platform_device *pdev) |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 30 | { |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 31 | unsigned int num_resources; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 32 | struct resource *res; |
| 33 | int k; |
| 34 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 35 | if (pdev->num_resources) { |
| 36 | num_resources = pdev->num_resources; |
| 37 | res = pdev->resource; |
| 38 | } else { |
| 39 | num_resources = pfc->pdata->num_resources; |
| 40 | res = pfc->pdata->resource; |
| 41 | } |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 42 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 43 | if (num_resources == 0) { |
| 44 | pfc->num_windows = 0; |
| 45 | return 0; |
| 46 | } |
| 47 | |
| 48 | pfc->window = devm_kzalloc(pfc->dev, num_resources * |
Laurent Pinchart | 1724acf | 2012-12-15 23:50:48 +0100 | [diff] [blame] | 49 | sizeof(*pfc->window), GFP_NOWAIT); |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 50 | if (!pfc->window) |
Laurent Pinchart | 1724acf | 2012-12-15 23:50:48 +0100 | [diff] [blame] | 51 | return -ENOMEM; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 52 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 53 | pfc->num_windows = num_resources; |
| 54 | |
| 55 | for (k = 0; k < num_resources; k++, res++) { |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 56 | WARN_ON(resource_type(res) != IORESOURCE_MEM); |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 57 | pfc->window[k].phys = res->start; |
| 58 | pfc->window[k].size = resource_size(res); |
Laurent Pinchart | c9fa88e | 2012-12-15 23:50:49 +0100 | [diff] [blame] | 59 | pfc->window[k].virt = devm_ioremap_nocache(pfc->dev, res->start, |
| 60 | resource_size(res)); |
| 61 | if (!pfc->window[k].virt) |
Laurent Pinchart | 1724acf | 2012-12-15 23:50:48 +0100 | [diff] [blame] | 62 | return -ENOMEM; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | return 0; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 66 | } |
| 67 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 68 | static void __iomem *sh_pfc_phys_to_virt(struct sh_pfc *pfc, |
| 69 | unsigned long address) |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 70 | { |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 71 | struct sh_pfc_window *window; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 72 | int k; |
| 73 | |
| 74 | /* scan through physical windows and convert address */ |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 75 | for (k = 0; k < pfc->num_windows; k++) { |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 76 | window = pfc->window + k; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 77 | |
| 78 | if (address < window->phys) |
| 79 | continue; |
| 80 | |
| 81 | if (address >= (window->phys + window->size)) |
| 82 | continue; |
| 83 | |
| 84 | return window->virt + (address - window->phys); |
| 85 | } |
| 86 | |
| 87 | /* no windows defined, register must be 1:1 mapped virt:phys */ |
| 88 | return (void __iomem *)address; |
| 89 | } |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 90 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 91 | static int sh_pfc_enum_in_range(pinmux_enum_t enum_id, struct pinmux_range *r) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 92 | { |
| 93 | if (enum_id < r->begin) |
| 94 | return 0; |
| 95 | |
| 96 | if (enum_id > r->end) |
| 97 | return 0; |
| 98 | |
| 99 | return 1; |
| 100 | } |
| 101 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 102 | static unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg, |
| 103 | unsigned long reg_width) |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 104 | { |
| 105 | switch (reg_width) { |
| 106 | case 8: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 107 | return ioread8(mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 108 | case 16: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 109 | return ioread16(mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 110 | case 32: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 111 | return ioread32(mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 112 | } |
| 113 | |
| 114 | BUG(); |
| 115 | return 0; |
| 116 | } |
| 117 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 118 | static void sh_pfc_write_raw_reg(void __iomem *mapped_reg, |
| 119 | unsigned long reg_width, unsigned long data) |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 120 | { |
| 121 | switch (reg_width) { |
| 122 | case 8: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 123 | iowrite8(data, mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 124 | return; |
| 125 | case 16: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 126 | iowrite16(data, mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 127 | return; |
| 128 | case 32: |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 129 | iowrite32(data, mapped_reg); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 130 | return; |
| 131 | } |
| 132 | |
| 133 | BUG(); |
| 134 | } |
| 135 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 136 | int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos) |
Magnus Damm | 92554d9 | 2011-12-14 01:00:37 +0900 | [diff] [blame] | 137 | { |
| 138 | unsigned long pos; |
| 139 | |
| 140 | pos = dr->reg_width - (in_pos + 1); |
| 141 | |
| 142 | pr_debug("read_bit: addr = %lx, pos = %ld, " |
| 143 | "r_width = %ld\n", dr->reg, pos, dr->reg_width); |
| 144 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 145 | return (sh_pfc_read_raw_reg(dr->mapped_reg, dr->reg_width) >> pos) & 1; |
Magnus Damm | 92554d9 | 2011-12-14 01:00:37 +0900 | [diff] [blame] | 146 | } |
| 147 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 148 | void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, |
| 149 | unsigned long value) |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 150 | { |
| 151 | unsigned long pos; |
| 152 | |
| 153 | pos = dr->reg_width - (in_pos + 1); |
| 154 | |
Paul Mundt | ca6f2d7 | 2009-12-09 15:51:27 +0900 | [diff] [blame] | 155 | pr_debug("write_bit addr = %lx, value = %d, pos = %ld, " |
Paul Mundt | fd2cb0c | 2009-11-30 12:15:04 +0900 | [diff] [blame] | 156 | "r_width = %ld\n", |
| 157 | dr->reg, !!value, pos, dr->reg_width); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 158 | |
| 159 | if (value) |
| 160 | set_bit(pos, &dr->reg_shadow); |
| 161 | else |
| 162 | clear_bit(pos, &dr->reg_shadow); |
| 163 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 164 | sh_pfc_write_raw_reg(dr->mapped_reg, dr->reg_width, dr->reg_shadow); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 165 | } |
| 166 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 167 | static void sh_pfc_config_reg_helper(struct sh_pfc *pfc, |
| 168 | struct pinmux_cfg_reg *crp, |
| 169 | unsigned long in_pos, |
| 170 | void __iomem **mapped_regp, |
| 171 | unsigned long *maskp, |
| 172 | unsigned long *posp) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 173 | { |
Magnus Damm | f78a26f | 2011-12-14 01:01:05 +0900 | [diff] [blame] | 174 | int k; |
| 175 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 176 | *mapped_regp = sh_pfc_phys_to_virt(pfc, crp->reg); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 177 | |
Magnus Damm | f78a26f | 2011-12-14 01:01:05 +0900 | [diff] [blame] | 178 | if (crp->field_width) { |
| 179 | *maskp = (1 << crp->field_width) - 1; |
| 180 | *posp = crp->reg_width - ((in_pos + 1) * crp->field_width); |
| 181 | } else { |
| 182 | *maskp = (1 << crp->var_field_width[in_pos]) - 1; |
| 183 | *posp = crp->reg_width; |
| 184 | for (k = 0; k <= in_pos; k++) |
| 185 | *posp -= crp->var_field_width[k]; |
| 186 | } |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 187 | } |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 188 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 189 | static int sh_pfc_read_config_reg(struct sh_pfc *pfc, |
| 190 | struct pinmux_cfg_reg *crp, |
| 191 | unsigned long field) |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 192 | { |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 193 | void __iomem *mapped_reg; |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 194 | unsigned long mask, pos; |
| 195 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 196 | sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 197 | |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 198 | pr_debug("read_reg: addr = %lx, field = %ld, " |
Paul Mundt | fd2cb0c | 2009-11-30 12:15:04 +0900 | [diff] [blame] | 199 | "r_width = %ld, f_width = %ld\n", |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 200 | crp->reg, field, crp->reg_width, crp->field_width); |
| 201 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 202 | return (sh_pfc_read_raw_reg(mapped_reg, crp->reg_width) >> pos) & mask; |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 203 | } |
| 204 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 205 | static void sh_pfc_write_config_reg(struct sh_pfc *pfc, |
| 206 | struct pinmux_cfg_reg *crp, |
| 207 | unsigned long field, unsigned long value) |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 208 | { |
| 209 | void __iomem *mapped_reg; |
Magnus Damm | e499ada | 2011-12-14 01:01:14 +0900 | [diff] [blame] | 210 | unsigned long mask, pos, data; |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 211 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 212 | sh_pfc_config_reg_helper(pfc, crp, field, &mapped_reg, &mask, &pos); |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 213 | |
| 214 | pr_debug("write_reg addr = %lx, value = %ld, field = %ld, " |
| 215 | "r_width = %ld, f_width = %ld\n", |
| 216 | crp->reg, value, field, crp->reg_width, crp->field_width); |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 217 | |
| 218 | mask = ~(mask << pos); |
| 219 | value = value << pos; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 220 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 221 | data = sh_pfc_read_raw_reg(mapped_reg, crp->reg_width); |
Magnus Damm | e499ada | 2011-12-14 01:01:14 +0900 | [diff] [blame] | 222 | data &= mask; |
| 223 | data |= value; |
| 224 | |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 225 | if (pfc->pdata->unlock_reg) |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 226 | sh_pfc_write_raw_reg( |
| 227 | sh_pfc_phys_to_virt(pfc, pfc->pdata->unlock_reg), 32, |
| 228 | ~data); |
Magnus Damm | e499ada | 2011-12-14 01:01:14 +0900 | [diff] [blame] | 229 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 230 | sh_pfc_write_raw_reg(mapped_reg, crp->reg_width, data); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 231 | } |
| 232 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 233 | static int sh_pfc_setup_data_reg(struct sh_pfc *pfc, unsigned gpio) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 234 | { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 235 | struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio]; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 236 | struct pinmux_data_reg *data_reg; |
| 237 | int k, n; |
| 238 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 239 | if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->pdata->data)) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 240 | return -1; |
| 241 | |
| 242 | k = 0; |
| 243 | while (1) { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 244 | data_reg = pfc->pdata->data_regs + k; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 245 | |
| 246 | if (!data_reg->reg_width) |
| 247 | break; |
| 248 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 249 | data_reg->mapped_reg = sh_pfc_phys_to_virt(pfc, data_reg->reg); |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 250 | |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 251 | for (n = 0; n < data_reg->reg_width; n++) { |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 252 | if (data_reg->enum_ids[n] == gpiop->enum_id) { |
| 253 | gpiop->flags &= ~PINMUX_FLAG_DREG; |
| 254 | gpiop->flags |= (k << PINMUX_FLAG_DREG_SHIFT); |
| 255 | gpiop->flags &= ~PINMUX_FLAG_DBIT; |
| 256 | gpiop->flags |= (n << PINMUX_FLAG_DBIT_SHIFT); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 257 | return 0; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 258 | } |
| 259 | } |
| 260 | k++; |
| 261 | } |
| 262 | |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 263 | BUG(); |
| 264 | |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 265 | return -1; |
| 266 | } |
| 267 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 268 | static void sh_pfc_setup_data_regs(struct sh_pfc *pfc) |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 269 | { |
| 270 | struct pinmux_data_reg *drp; |
| 271 | int k; |
| 272 | |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 273 | for (k = pfc->pdata->first_gpio; k <= pfc->pdata->last_gpio; k++) |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 274 | sh_pfc_setup_data_reg(pfc, k); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 275 | |
| 276 | k = 0; |
| 277 | while (1) { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 278 | drp = pfc->pdata->data_regs + k; |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 279 | |
| 280 | if (!drp->reg_width) |
| 281 | break; |
| 282 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 283 | drp->reg_shadow = sh_pfc_read_raw_reg(drp->mapped_reg, |
| 284 | drp->reg_width); |
Magnus Damm | 3292094 | 2008-12-25 18:17:26 +0900 | [diff] [blame] | 285 | k++; |
| 286 | } |
| 287 | } |
| 288 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 289 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 290 | struct pinmux_data_reg **drp, int *bitp) |
| 291 | { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 292 | struct pinmux_gpio *gpiop = &pfc->pdata->gpios[gpio]; |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 293 | int k, n; |
| 294 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 295 | if (!sh_pfc_enum_in_range(gpiop->enum_id, &pfc->pdata->data)) |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 296 | return -1; |
| 297 | |
| 298 | k = (gpiop->flags & PINMUX_FLAG_DREG) >> PINMUX_FLAG_DREG_SHIFT; |
| 299 | n = (gpiop->flags & PINMUX_FLAG_DBIT) >> PINMUX_FLAG_DBIT_SHIFT; |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 300 | *drp = pfc->pdata->data_regs + k; |
Magnus Damm | 18801be | 2008-12-25 18:17:09 +0900 | [diff] [blame] | 301 | *bitp = n; |
| 302 | return 0; |
| 303 | } |
| 304 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 305 | static int sh_pfc_get_config_reg(struct sh_pfc *pfc, pinmux_enum_t enum_id, |
| 306 | struct pinmux_cfg_reg **crp, int *fieldp, |
| 307 | int *valuep, unsigned long **cntp) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 308 | { |
| 309 | struct pinmux_cfg_reg *config_reg; |
Magnus Damm | f78a26f | 2011-12-14 01:01:05 +0900 | [diff] [blame] | 310 | unsigned long r_width, f_width, curr_width, ncomb; |
| 311 | int k, m, n, pos, bit_pos; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 312 | |
| 313 | k = 0; |
| 314 | while (1) { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 315 | config_reg = pfc->pdata->cfg_regs + k; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 316 | |
| 317 | r_width = config_reg->reg_width; |
| 318 | f_width = config_reg->field_width; |
| 319 | |
| 320 | if (!r_width) |
| 321 | break; |
Magnus Damm | f78a26f | 2011-12-14 01:01:05 +0900 | [diff] [blame] | 322 | |
| 323 | pos = 0; |
| 324 | m = 0; |
| 325 | for (bit_pos = 0; bit_pos < r_width; bit_pos += curr_width) { |
| 326 | if (f_width) |
| 327 | curr_width = f_width; |
| 328 | else |
| 329 | curr_width = config_reg->var_field_width[m]; |
| 330 | |
| 331 | ncomb = 1 << curr_width; |
| 332 | for (n = 0; n < ncomb; n++) { |
| 333 | if (config_reg->enum_ids[pos + n] == enum_id) { |
| 334 | *crp = config_reg; |
| 335 | *fieldp = m; |
| 336 | *valuep = n; |
| 337 | *cntp = &config_reg->cnt[m]; |
| 338 | return 0; |
| 339 | } |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 340 | } |
Magnus Damm | f78a26f | 2011-12-14 01:01:05 +0900 | [diff] [blame] | 341 | pos += ncomb; |
| 342 | m++; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 343 | } |
| 344 | k++; |
| 345 | } |
| 346 | |
| 347 | return -1; |
| 348 | } |
| 349 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 350 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, |
| 351 | pinmux_enum_t *enum_idp) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 352 | { |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 353 | pinmux_enum_t enum_id = pfc->pdata->gpios[gpio].enum_id; |
| 354 | pinmux_enum_t *data = pfc->pdata->gpio_data; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 355 | int k; |
| 356 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 357 | if (!sh_pfc_enum_in_range(enum_id, &pfc->pdata->data)) { |
| 358 | if (!sh_pfc_enum_in_range(enum_id, &pfc->pdata->mark)) { |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 359 | pr_err("non data/mark enum_id for gpio %d\n", gpio); |
| 360 | return -1; |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | if (pos) { |
| 365 | *enum_idp = data[pos + 1]; |
| 366 | return pos + 1; |
| 367 | } |
| 368 | |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 369 | for (k = 0; k < pfc->pdata->gpio_data_size; k++) { |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 370 | if (data[k] == enum_id) { |
| 371 | *enum_idp = data[k + 1]; |
| 372 | return k + 1; |
| 373 | } |
| 374 | } |
| 375 | |
| 376 | pr_err("cannot locate data/mark enum_id for gpio %d\n", gpio); |
| 377 | return -1; |
| 378 | } |
| 379 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 380 | int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, |
| 381 | int cfg_mode) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 382 | { |
| 383 | struct pinmux_cfg_reg *cr = NULL; |
| 384 | pinmux_enum_t enum_id; |
| 385 | struct pinmux_range *range; |
Magnus Damm | ad4a07f | 2011-12-14 01:00:46 +0900 | [diff] [blame] | 386 | int in_range, pos, field, value; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 387 | unsigned long *cntp; |
| 388 | |
| 389 | switch (pinmux_type) { |
| 390 | |
| 391 | case PINMUX_TYPE_FUNCTION: |
| 392 | range = NULL; |
| 393 | break; |
| 394 | |
| 395 | case PINMUX_TYPE_OUTPUT: |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 396 | range = &pfc->pdata->output; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 397 | break; |
| 398 | |
| 399 | case PINMUX_TYPE_INPUT: |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 400 | range = &pfc->pdata->input; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 401 | break; |
| 402 | |
| 403 | case PINMUX_TYPE_INPUT_PULLUP: |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 404 | range = &pfc->pdata->input_pu; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 405 | break; |
| 406 | |
| 407 | case PINMUX_TYPE_INPUT_PULLDOWN: |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 408 | range = &pfc->pdata->input_pd; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 409 | break; |
| 410 | |
| 411 | default: |
| 412 | goto out_err; |
| 413 | } |
| 414 | |
| 415 | pos = 0; |
| 416 | enum_id = 0; |
Magnus Damm | ad4a07f | 2011-12-14 01:00:46 +0900 | [diff] [blame] | 417 | field = 0; |
| 418 | value = 0; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 419 | while (1) { |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 420 | pos = sh_pfc_gpio_to_enum(pfc, gpio, pos, &enum_id); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 421 | if (pos <= 0) |
| 422 | goto out_err; |
| 423 | |
| 424 | if (!enum_id) |
| 425 | break; |
| 426 | |
Magnus Damm | 50dd314 | 2010-01-19 13:52:28 +0000 | [diff] [blame] | 427 | /* first check if this is a function enum */ |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 428 | in_range = sh_pfc_enum_in_range(enum_id, &pfc->pdata->function); |
Magnus Damm | 50dd314 | 2010-01-19 13:52:28 +0000 | [diff] [blame] | 429 | if (!in_range) { |
| 430 | /* not a function enum */ |
| 431 | if (range) { |
| 432 | /* |
| 433 | * other range exists, so this pin is |
| 434 | * a regular GPIO pin that now is being |
| 435 | * bound to a specific direction. |
| 436 | * |
| 437 | * for this case we only allow function enums |
| 438 | * and the enums that match the other range. |
| 439 | */ |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 440 | in_range = sh_pfc_enum_in_range(enum_id, range); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 441 | |
Magnus Damm | 50dd314 | 2010-01-19 13:52:28 +0000 | [diff] [blame] | 442 | /* |
| 443 | * special case pass through for fixed |
| 444 | * input-only or output-only pins without |
| 445 | * function enum register association. |
| 446 | */ |
| 447 | if (in_range && enum_id == range->force) |
| 448 | continue; |
| 449 | } else { |
| 450 | /* |
| 451 | * no other range exists, so this pin |
| 452 | * must then be of the function type. |
| 453 | * |
| 454 | * allow function type pins to select |
| 455 | * any combination of function/in/out |
| 456 | * in their MARK lists. |
| 457 | */ |
| 458 | in_range = 1; |
| 459 | } |
Magnus Damm | 42eed42 | 2008-10-22 18:29:17 +0900 | [diff] [blame] | 460 | } |
| 461 | |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 462 | if (!in_range) |
| 463 | continue; |
| 464 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 465 | if (sh_pfc_get_config_reg(pfc, enum_id, &cr, |
| 466 | &field, &value, &cntp) != 0) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 467 | goto out_err; |
| 468 | |
| 469 | switch (cfg_mode) { |
| 470 | case GPIO_CFG_DRYRUN: |
Magnus Damm | 18925e1 | 2011-12-14 01:00:55 +0900 | [diff] [blame] | 471 | if (!*cntp || |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 472 | (sh_pfc_read_config_reg(pfc, cr, field) != value)) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 473 | continue; |
| 474 | break; |
| 475 | |
| 476 | case GPIO_CFG_REQ: |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 477 | sh_pfc_write_config_reg(pfc, cr, field, value); |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 478 | *cntp = *cntp + 1; |
| 479 | break; |
| 480 | |
| 481 | case GPIO_CFG_FREE: |
| 482 | *cntp = *cntp - 1; |
| 483 | break; |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | return 0; |
| 488 | out_err: |
| 489 | return -1; |
| 490 | } |
| 491 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 492 | static int sh_pfc_probe(struct platform_device *pdev) |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 493 | { |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 494 | struct sh_pfc_platform_data *pdata = pdev->dev.platform_data; |
| 495 | struct sh_pfc *pfc; |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 496 | int ret; |
Magnus Damm | 2967dab | 2008-10-08 20:41:43 +0900 | [diff] [blame] | 497 | |
Paul Mundt | 06d5631 | 2012-06-21 00:03:41 +0900 | [diff] [blame] | 498 | /* |
| 499 | * Ensure that the type encoding fits |
| 500 | */ |
| 501 | BUILD_BUG_ON(PINMUX_FLAG_TYPE > ((1 << PINMUX_FLAG_DBIT_SHIFT) - 1)); |
| 502 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 503 | if (pdata == NULL) |
| 504 | return -ENODEV; |
Magnus Damm | 0fc64cc | 2008-12-25 18:17:18 +0900 | [diff] [blame] | 505 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 506 | pfc = devm_kzalloc(&pdev->dev, sizeof(pfc), GFP_KERNEL); |
| 507 | if (pfc == NULL) |
| 508 | return -ENOMEM; |
Magnus Damm | b0e1021 | 2011-12-09 12:14:27 +0900 | [diff] [blame] | 509 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 510 | pfc->pdata = pdata; |
| 511 | pfc->dev = &pdev->dev; |
| 512 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame^] | 513 | ret = sh_pfc_ioremap(pfc, pdev); |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 514 | if (unlikely(ret < 0)) |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 515 | return ret; |
Laurent Pinchart | d4e62d0 | 2012-12-15 23:50:43 +0100 | [diff] [blame] | 516 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 517 | spin_lock_init(&pfc->lock); |
Magnus Damm | 69edbba | 2008-12-25 18:17:34 +0900 | [diff] [blame] | 518 | |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 519 | pinctrl_provide_dummies(); |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 520 | sh_pfc_setup_data_regs(pfc); |
Magnus Damm | 69edbba | 2008-12-25 18:17:34 +0900 | [diff] [blame] | 521 | |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 522 | /* |
| 523 | * Initialize pinctrl bindings first |
| 524 | */ |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 525 | ret = sh_pfc_register_pinctrl(pfc); |
Laurent Pinchart | f9492fd | 2012-12-15 23:50:45 +0100 | [diff] [blame] | 526 | if (unlikely(ret != 0)) |
Laurent Pinchart | c9fa88e | 2012-12-15 23:50:49 +0100 | [diff] [blame] | 527 | return ret; |
Magnus Damm | 69edbba | 2008-12-25 18:17:34 +0900 | [diff] [blame] | 528 | |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 529 | #ifdef CONFIG_GPIO_SH_PFC |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 530 | /* |
| 531 | * Then the GPIO chip |
| 532 | */ |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 533 | ret = sh_pfc_register_gpiochip(pfc); |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 534 | if (unlikely(ret != 0)) { |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 535 | /* |
| 536 | * If the GPIO chip fails to come up we still leave the |
| 537 | * PFC state as it is, given that there are already |
| 538 | * extant users of it that have succeeded by this point. |
| 539 | */ |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 540 | pr_notice("failed to init GPIO chip, ignoring...\n"); |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 541 | } |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 542 | #endif |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 543 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 544 | platform_set_drvdata(pdev, pfc); |
| 545 | |
| 546 | pr_info("%s support registered\n", pdata->name); |
Paul Mundt | ca5481c6 | 2012-07-10 12:08:14 +0900 | [diff] [blame] | 547 | |
Paul Mundt | b3c185a | 2012-06-20 17:29:04 +0900 | [diff] [blame] | 548 | return 0; |
Paul Mundt | b72421d | 2010-10-04 03:54:56 +0900 | [diff] [blame] | 549 | } |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 550 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 551 | static int sh_pfc_remove(struct platform_device *pdev) |
| 552 | { |
| 553 | struct sh_pfc *pfc = platform_get_drvdata(pdev); |
| 554 | |
| 555 | #ifdef CONFIG_GPIO_SH_PFC |
| 556 | sh_pfc_unregister_gpiochip(pfc); |
| 557 | #endif |
| 558 | sh_pfc_unregister_pinctrl(pfc); |
| 559 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 560 | platform_set_drvdata(pdev, NULL); |
| 561 | |
| 562 | return 0; |
| 563 | } |
| 564 | |
| 565 | static const struct platform_device_id sh_pfc_id_table[] = { |
| 566 | { "sh-pfc", 0 }, |
| 567 | { }, |
| 568 | }; |
| 569 | MODULE_DEVICE_TABLE(platform, sh_pfc_id_table); |
| 570 | |
| 571 | static struct platform_driver sh_pfc_driver = { |
| 572 | .probe = sh_pfc_probe, |
| 573 | .remove = sh_pfc_remove, |
| 574 | .id_table = sh_pfc_id_table, |
| 575 | .driver = { |
| 576 | .name = DRV_NAME, |
| 577 | .owner = THIS_MODULE, |
| 578 | }, |
| 579 | }; |
| 580 | |
| 581 | static struct platform_device sh_pfc_device = { |
| 582 | .name = DRV_NAME, |
| 583 | .id = -1, |
| 584 | }; |
| 585 | |
| 586 | int __init register_sh_pfc(struct sh_pfc_platform_data *pdata) |
| 587 | { |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 588 | sh_pfc_device.dev.platform_data = pdata; |
| 589 | |
Laurent Pinchart | 40ee6fc | 2012-12-15 23:50:54 +0100 | [diff] [blame] | 590 | return platform_device_register(&sh_pfc_device); |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 591 | } |
| 592 | |
Laurent Pinchart | 40ee6fc | 2012-12-15 23:50:54 +0100 | [diff] [blame] | 593 | static int __init sh_pfc_init(void) |
| 594 | { |
| 595 | return platform_driver_register(&sh_pfc_driver); |
| 596 | } |
| 597 | postcore_initcall(sh_pfc_init); |
| 598 | |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 599 | static void __exit sh_pfc_exit(void) |
| 600 | { |
| 601 | platform_driver_unregister(&sh_pfc_driver); |
| 602 | } |
| 603 | module_exit(sh_pfc_exit); |
| 604 | |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 605 | MODULE_AUTHOR("Magnus Damm, Paul Mundt, Laurent Pinchart"); |
| 606 | MODULE_DESCRIPTION("Pin Control and GPIO driver for SuperH pin function controller"); |
| 607 | MODULE_LICENSE("GPL v2"); |