| 196 | } |
| 197 | |
| 198 | static int |
| 199 | a10fb_setup_debe(struct a10fb_softc *sc, const struct videomode *mode) |
| 200 | { |
| 201 | int width, height, interlace, reg; |
| 202 | clk_t clk_ahb, clk_dram, clk_debe; |
| 203 | hwreset_t rst; |
| 204 | uint32_t val; |
| 205 | int error; |
| 206 | |
| 207 | interlace = !!(mode->flags & VID_INTERLACE); |
| 208 | width = mode->hdisplay; |
| 209 | height = mode->vdisplay << interlace; |
| 210 | |
| 211 | /* Leave reset */ |
| 212 | error = hwreset_get_by_ofw_name(sc->dev, 0, "de_be", &rst); |
| 213 | if (error != 0) { |
| 214 | device_printf(sc->dev, "cannot find reset 'de_be'\n"); |
| 215 | return (error); |
| 216 | } |
| 217 | error = hwreset_deassert(rst); |
| 218 | if (error != 0) { |
| 219 | device_printf(sc->dev, "couldn't de-assert reset 'de_be'\n"); |
| 220 | return (error); |
| 221 | } |
| 222 | /* Gating AHB clock for BE */ |
| 223 | error = clk_get_by_ofw_name(sc->dev, 0, "ahb_de_be", &clk_ahb); |
| 224 | if (error != 0) { |
| 225 | device_printf(sc->dev, "cannot find clk 'ahb_de_be'\n"); |
| 226 | return (error); |
| 227 | } |
| 228 | error = clk_enable(clk_ahb); |
| 229 | if (error != 0) { |
| 230 | device_printf(sc->dev, "cannot enable clk 'ahb_de_be'\n"); |
| 231 | return (error); |
| 232 | } |
| 233 | /* Enable DRAM clock to BE */ |
| 234 | error = clk_get_by_ofw_name(sc->dev, 0, "dram_de_be", &clk_dram); |
| 235 | if (error != 0) { |
| 236 | device_printf(sc->dev, "cannot find clk 'dram_de_be'\n"); |
| 237 | return (error); |
| 238 | } |
| 239 | error = clk_enable(clk_dram); |
| 240 | if (error != 0) { |
| 241 | device_printf(sc->dev, "cannot enable clk 'dram_de_be'\n"); |
| 242 | return (error); |
| 243 | } |
| 244 | /* Set BE clock to 300MHz and enable */ |
| 245 | error = clk_get_by_ofw_name(sc->dev, 0, "de_be", &clk_debe); |
| 246 | if (error != 0) { |
| 247 | device_printf(sc->dev, "cannot find clk 'de_be'\n"); |
| 248 | return (error); |
| 249 | } |
| 250 | error = clk_set_freq(clk_debe, DEBE_FREQ, CLK_SET_ROUND_DOWN); |
| 251 | if (error != 0) { |
| 252 | device_printf(sc->dev, "cannot set 'de_be' frequency\n"); |
| 253 | return (error); |
| 254 | } |
| 255 | error = clk_enable(clk_debe); |
no test coverage detected