| 103 | }; |
| 104 | |
| 105 | static rt_err_t reset_simple_probe(struct rt_platform_device *pdev) |
| 106 | { |
| 107 | rt_err_t err; |
| 108 | struct rt_reset_controller *rstcer; |
| 109 | struct rt_device *dev = &pdev->parent; |
| 110 | const struct reset_simple_data *rsts_data = pdev->id->data; |
| 111 | struct reset_simple *rsts = rt_calloc(1, sizeof(*rsts)); |
| 112 | |
| 113 | if (!rsts) |
| 114 | { |
| 115 | return -RT_ENOMEM; |
| 116 | } |
| 117 | |
| 118 | rsts->mmio_base = rt_dm_dev_iomap(dev, 0); |
| 119 | |
| 120 | if (!rsts->mmio_base) |
| 121 | { |
| 122 | err = -RT_EIO; |
| 123 | goto _fail; |
| 124 | } |
| 125 | |
| 126 | rt_spin_lock_init(&rsts->lock); |
| 127 | |
| 128 | rstcer = &rsts->parent; |
| 129 | |
| 130 | rstcer->priv = rsts; |
| 131 | rstcer->ofw_node = dev->ofw_node; |
| 132 | rstcer->ops = &reset_simple_ops; |
| 133 | |
| 134 | if ((err = rt_reset_controller_register(rstcer))) |
| 135 | { |
| 136 | goto _fail; |
| 137 | } |
| 138 | |
| 139 | if (rsts_data) |
| 140 | { |
| 141 | rsts->mmio_base += rsts_data->reg_offset; |
| 142 | rsts->active_low = rsts_data->active_low; |
| 143 | rsts->status_active_low = rsts_data->status_active_low; |
| 144 | } |
| 145 | |
| 146 | return RT_EOK; |
| 147 | |
| 148 | _fail: |
| 149 | if (rsts->mmio_base) |
| 150 | { |
| 151 | rt_iounmap(rsts->mmio_base); |
| 152 | } |
| 153 | |
| 154 | rt_free(rsts); |
| 155 | |
| 156 | return err; |
| 157 | } |
| 158 | |
| 159 | static const struct reset_simple_data reset_simple_socfpga = |
| 160 | { |
nothing calls this directly
no test coverage detected