gpio-syscon.c (853f0cb8603486a8ba17d5b728b52a9b4b029698) | gpio-syscon.c (58383c78425e4ee1c077253cf297b641c861c02e) |
---|---|
1/* 2 * SYSCON GPIO driver 3 * 4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 145 unchanged lines hidden (view full) --- 154 return; 155 156 ret = regmap_update_bits( 157 priv->syscon, 158 (offs / SYSCON_REG_BITS) * SYSCON_REG_SIZE, 159 BIT(offs % SYSCON_REG_BITS) | KEYSTONE_LOCK_BIT, 160 BIT(offs % SYSCON_REG_BITS) | KEYSTONE_LOCK_BIT); 161 if (ret < 0) | 1/* 2 * SYSCON GPIO driver 3 * 4 * Copyright (C) 2014 Alexander Shiyan <shc_work@mail.ru> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or --- 145 unchanged lines hidden (view full) --- 154 return; 155 156 ret = regmap_update_bits( 157 priv->syscon, 158 (offs / SYSCON_REG_BITS) * SYSCON_REG_SIZE, 159 BIT(offs % SYSCON_REG_BITS) | KEYSTONE_LOCK_BIT, 160 BIT(offs % SYSCON_REG_BITS) | KEYSTONE_LOCK_BIT); 161 if (ret < 0) |
162 dev_err(chip->dev, "gpio write failed ret(%d)\n", ret); | 162 dev_err(chip->parent, "gpio write failed ret(%d)\n", ret); |
163} 164 165static const struct syscon_gpio_data keystone_dsp_gpio = { 166 /* ARM Keystone 2 */ 167 .compatible = NULL, 168 .flags = GPIO_SYSCON_FEAT_OUT, 169 .bit_count = 28, 170 .dat_bit_offset = 4, --- 11 unchanged lines hidden (view full) --- 182 }, 183 { } 184}; 185MODULE_DEVICE_TABLE(of, syscon_gpio_ids); 186 187static int syscon_gpio_probe(struct platform_device *pdev) 188{ 189 struct device *dev = &pdev->dev; | 163} 164 165static const struct syscon_gpio_data keystone_dsp_gpio = { 166 /* ARM Keystone 2 */ 167 .compatible = NULL, 168 .flags = GPIO_SYSCON_FEAT_OUT, 169 .bit_count = 28, 170 .dat_bit_offset = 4, --- 11 unchanged lines hidden (view full) --- 182 }, 183 { } 184}; 185MODULE_DEVICE_TABLE(of, syscon_gpio_ids); 186 187static int syscon_gpio_probe(struct platform_device *pdev) 188{ 189 struct device *dev = &pdev->dev; |
190 const struct of_device_id *of_id; | 190 const struct of_device_id *of_id = of_match_device(syscon_gpio_ids, dev); |
191 struct syscon_gpio_priv *priv; 192 struct device_node *np = dev->of_node; 193 int ret; 194 | 191 struct syscon_gpio_priv *priv; 192 struct device_node *np = dev->of_node; 193 int ret; 194 |
195 of_id = of_match_device(syscon_gpio_ids, dev); 196 if (!of_id) 197 return -ENODEV; 198 | |
199 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 200 if (!priv) 201 return -ENOMEM; 202 203 priv->data = of_id->data; 204 205 if (priv->data->compatible) { 206 priv->syscon = syscon_regmap_lookup_by_compatible( --- 16 unchanged lines hidden (view full) --- 223 ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2, 224 &priv->dir_reg_offset); 225 if (ret) 226 dev_dbg(dev, "can't read the dir register offset!\n"); 227 228 priv->dir_reg_offset <<= 3; 229 } 230 | 195 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 196 if (!priv) 197 return -ENOMEM; 198 199 priv->data = of_id->data; 200 201 if (priv->data->compatible) { 202 priv->syscon = syscon_regmap_lookup_by_compatible( --- 16 unchanged lines hidden (view full) --- 219 ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2, 220 &priv->dir_reg_offset); 221 if (ret) 222 dev_dbg(dev, "can't read the dir register offset!\n"); 223 224 priv->dir_reg_offset <<= 3; 225 } 226 |
231 priv->chip.dev = dev; | 227 priv->chip.parent = dev; |
232 priv->chip.owner = THIS_MODULE; 233 priv->chip.label = dev_name(dev); 234 priv->chip.base = -1; 235 priv->chip.ngpio = priv->data->bit_count; 236 priv->chip.get = syscon_gpio_get; 237 if (priv->data->flags & GPIO_SYSCON_FEAT_IN) 238 priv->chip.direction_input = syscon_gpio_dir_in; 239 if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) { --- 30 unchanged lines hidden --- | 228 priv->chip.owner = THIS_MODULE; 229 priv->chip.label = dev_name(dev); 230 priv->chip.base = -1; 231 priv->chip.ngpio = priv->data->bit_count; 232 priv->chip.get = syscon_gpio_get; 233 if (priv->data->flags & GPIO_SYSCON_FEAT_IN) 234 priv->chip.direction_input = syscon_gpio_dir_in; 235 if (priv->data->flags & GPIO_SYSCON_FEAT_OUT) { --- 30 unchanged lines hidden --- |