Delete the ep93xx board files.
Unified · Split
| @@ -1,733 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/clock.c | |
| 4 | − * Clock control for Cirrus EP93xx chips. | |
| 5 | − * | |
| 6 | − * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt | |
| 10 | − | |
| 11 | −#include <linux/kernel.h> | |
| 12 | −#include <linux/clk.h> | |
| 13 | −#include <linux/err.h> | |
| 14 | −#include <linux/module.h> | |
| 15 | −#include <linux/string.h> | |
| 16 | −#include <linux/io.h> | |
| 17 | −#include <linux/spinlock.h> | |
| 18 | −#include <linux/clkdev.h> | |
| 19 | −#include <linux/clk-provider.h> | |
| 20 | −#include <linux/soc/cirrus/ep93xx.h> | |
| 21 | − | |
| 22 | −#include "hardware.h" | |
| 23 | − | |
| 24 | −#include <asm/div64.h> | |
| 25 | − | |
| 26 | −#include "soc.h" | |
| 27 | − | |
| 28 | −static DEFINE_SPINLOCK(clk_lock); | |
| 29 | − | |
| 30 | −static char fclk_divisors[] = { 1, 2, 4, 8, 16, 1, 1, 1 }; | |
| 31 | −static char hclk_divisors[] = { 1, 2, 4, 5, 6, 8, 16, 32 }; | |
| 32 | −static char pclk_divisors[] = { 1, 2, 4, 8 }; | |
| 33 | − | |
| 34 | −static char adc_divisors[] = { 16, 4 }; | |
| 35 | −static char sclk_divisors[] = { 2, 4 }; | |
| 36 | −static char lrclk_divisors[] = { 32, 64, 128 }; | |
| 37 | − | |
| 38 | −static const char * const mux_parents[] = { | |
| 39 | − "xtali", | |
| 40 | − "pll1", | |
| 41 | − "pll2" | |
| 42 | −}; | |
| 43 | − | |
| 44 | −/* | |
| 45 | − * PLL rate = 14.7456 MHz * (X1FBD + 1) * (X2FBD + 1) / (X2IPD + 1) / 2^PS | |
| 46 | − */ | |
| 47 | −static unsigned long calc_pll_rate(unsigned long long rate, u32 config_word) | |
| 48 | −{ | |
| 49 | − int i; | |
| 50 | − | |
| 51 | − rate *= ((config_word >> 11) & 0x1f) + 1; /* X1FBD */ | |
| 52 | − rate *= ((config_word >> 5) & 0x3f) + 1; /* X2FBD */ | |
| 53 | − do_div(rate, (config_word & 0x1f) + 1); /* X2IPD */ | |
| 54 | − for (i = 0; i < ((config_word >> 16) & 3); i++) /* PS */ | |
| 55 | − rate >>= 1; | |
| 56 | − | |
| 57 | − return (unsigned long)rate; | |
| 58 | −} | |
| 59 | − | |
| 60 | −struct clk_psc { | |
| 61 | − struct clk_hw hw; | |
| 62 | − void __iomem *reg; | |
| 63 | − u8 bit_idx; | |
| 64 | − u32 mask; | |
| 65 | − u8 shift; | |
| 66 | − u8 width; | |
| 67 | − char *div; | |
| 68 | − u8 num_div; | |
| 69 | − spinlock_t *lock; | |
| 70 | −}; | |
| 71 | − | |
| 72 | −#define to_clk_psc(_hw) container_of(_hw, struct clk_psc, hw) | |
| 73 | − | |
| 74 | −static int ep93xx_clk_is_enabled(struct clk_hw *hw) | |
| 75 | −{ | |
| 76 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 77 | − u32 val = readl(psc->reg); | |
| 78 | − | |
| 79 | − return (val & BIT(psc->bit_idx)) ? 1 : 0; | |
| 80 | −} | |
| 81 | − | |
| 82 | −static int ep93xx_clk_enable(struct clk_hw *hw) | |
| 83 | −{ | |
| 84 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 85 | − unsigned long flags = 0; | |
| 86 | − u32 val; | |
| 87 | − | |
| 88 | − if (psc->lock) | |
| 89 | − spin_lock_irqsave(psc->lock, flags); | |
| 90 | − | |
| 91 | − val = __raw_readl(psc->reg); | |
| 92 | − val |= BIT(psc->bit_idx); | |
| 93 | − | |
| 94 | − ep93xx_syscon_swlocked_write(val, psc->reg); | |
| 95 | − | |
| 96 | − if (psc->lock) | |
| 97 | − spin_unlock_irqrestore(psc->lock, flags); | |
| 98 | − | |
| 99 | − return 0; | |
| 100 | −} | |
| 101 | − | |
| 102 | −static void ep93xx_clk_disable(struct clk_hw *hw) | |
| 103 | −{ | |
| 104 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 105 | − unsigned long flags = 0; | |
| 106 | − u32 val; | |
| 107 | − | |
| 108 | − if (psc->lock) | |
| 109 | − spin_lock_irqsave(psc->lock, flags); | |
| 110 | − | |
| 111 | − val = __raw_readl(psc->reg); | |
| 112 | − val &= ~BIT(psc->bit_idx); | |
| 113 | − | |
| 114 | − ep93xx_syscon_swlocked_write(val, psc->reg); | |
| 115 | − | |
| 116 | − if (psc->lock) | |
| 117 | − spin_unlock_irqrestore(psc->lock, flags); | |
| 118 | −} | |
| 119 | − | |
| 120 | −static const struct clk_ops clk_ep93xx_gate_ops = { | |
| 121 | − .enable = ep93xx_clk_enable, | |
| 122 | − .disable = ep93xx_clk_disable, | |
| 123 | − .is_enabled = ep93xx_clk_is_enabled, | |
| 124 | −}; | |
| 125 | − | |
| 126 | −static struct clk_hw *ep93xx_clk_register_gate(const char *name, | |
| 127 | − const char *parent_name, | |
| 128 | − void __iomem *reg, | |
| 129 | − u8 bit_idx) | |
| 130 | −{ | |
| 131 | − struct clk_init_data init; | |
| 132 | − struct clk_psc *psc; | |
| 133 | − struct clk *clk; | |
| 134 | − | |
| 135 | − psc = kzalloc(sizeof(*psc), GFP_KERNEL); | |
| 136 | − if (!psc) | |
| 137 | − return ERR_PTR(-ENOMEM); | |
| 138 | − | |
| 139 | − init.name = name; | |
| 140 | − init.ops = &clk_ep93xx_gate_ops; | |
| 141 | − init.flags = CLK_SET_RATE_PARENT; | |
| 142 | − init.parent_names = (parent_name ? &parent_name : NULL); | |
| 143 | − init.num_parents = (parent_name ? 1 : 0); | |
| 144 | − | |
| 145 | − psc->reg = reg; | |
| 146 | − psc->bit_idx = bit_idx; | |
| 147 | − psc->hw.init = &init; | |
| 148 | − psc->lock = &clk_lock; | |
| 149 | − | |
| 150 | − clk = clk_register(NULL, &psc->hw); | |
| 151 | − if (IS_ERR(clk)) { | |
| 152 | − kfree(psc); | |
| 153 | − return ERR_CAST(clk); | |
| 154 | − } | |
| 155 | − | |
| 156 | − return &psc->hw; | |
| 157 | −} | |
| 158 | − | |
| 159 | −static u8 ep93xx_mux_get_parent(struct clk_hw *hw) | |
| 160 | −{ | |
| 161 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 162 | − u32 val = __raw_readl(psc->reg); | |
| 163 | − | |
| 164 | − if (!(val & EP93XX_SYSCON_CLKDIV_ESEL)) | |
| 165 | − return 0; | |
| 166 | − | |
| 167 | − if (!(val & EP93XX_SYSCON_CLKDIV_PSEL)) | |
| 168 | − return 1; | |
| 169 | − | |
| 170 | − return 2; | |
| 171 | −} | |
| 172 | − | |
| 173 | −static int ep93xx_mux_set_parent_lock(struct clk_hw *hw, u8 index) | |
| 174 | −{ | |
| 175 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 176 | − unsigned long flags = 0; | |
| 177 | − u32 val; | |
| 178 | − | |
| 179 | − if (index >= ARRAY_SIZE(mux_parents)) | |
| 180 | − return -EINVAL; | |
| 181 | − | |
| 182 | − if (psc->lock) | |
| 183 | − spin_lock_irqsave(psc->lock, flags); | |
| 184 | − | |
| 185 | − val = __raw_readl(psc->reg); | |
| 186 | − val &= ~(EP93XX_SYSCON_CLKDIV_ESEL | EP93XX_SYSCON_CLKDIV_PSEL); | |
| 187 | − | |
| 188 | − | |
| 189 | − if (index != 0) { | |
| 190 | − val |= EP93XX_SYSCON_CLKDIV_ESEL; | |
| 191 | − val |= (index - 1) ? EP93XX_SYSCON_CLKDIV_PSEL : 0; | |
| 192 | − } | |
| 193 | − | |
| 194 | − ep93xx_syscon_swlocked_write(val, psc->reg); | |
| 195 | − | |
| 196 | − if (psc->lock) | |
| 197 | − spin_unlock_irqrestore(psc->lock, flags); | |
| 198 | − | |
| 199 | − return 0; | |
| 200 | −} | |
| 201 | − | |
| 202 | −static bool is_best(unsigned long rate, unsigned long now, | |
| 203 | − unsigned long best) | |
| 204 | −{ | |
| 205 | − return abs(rate - now) < abs(rate - best); | |
| 206 | −} | |
| 207 | − | |
| 208 | −static int ep93xx_mux_determine_rate(struct clk_hw *hw, | |
| 209 | − struct clk_rate_request *req) | |
| 210 | −{ | |
| 211 | − unsigned long rate = req->rate; | |
| 212 | − struct clk *best_parent = NULL; | |
| 213 | − unsigned long __parent_rate; | |
| 214 | − unsigned long best_rate = 0, actual_rate, mclk_rate; | |
| 215 | − unsigned long best_parent_rate; | |
| 216 | − int __div = 0, __pdiv = 0; | |
| 217 | − int i; | |
| 218 | − | |
| 219 | − /* | |
| 220 | − * Try the two pll's and the external clock | |
| 221 | − * Because the valid predividers are 2, 2.5 and 3, we multiply | |
| 222 | − * all the clocks by 2 to avoid floating point math. | |
| 223 | − * | |
| 224 | − * This is based on the algorithm in the ep93xx raster guide: | |
| 225 | − * http://be-a-maverick.com/en/pubs/appNote/AN269REV1.pdf | |
| 226 | − * | |
| 227 | − */ | |
| 228 | − for (i = 0; i < ARRAY_SIZE(mux_parents); i++) { | |
| 229 | − struct clk *parent = clk_get_sys(mux_parents[i], NULL); | |
| 230 | − | |
| 231 | − __parent_rate = clk_get_rate(parent); | |
| 232 | − mclk_rate = __parent_rate * 2; | |
| 233 | − | |
| 234 | − /* Try each predivider value */ | |
| 235 | − for (__pdiv = 4; __pdiv <= 6; __pdiv++) { | |
| 236 | − __div = mclk_rate / (rate * __pdiv); | |
| 237 | − if (__div < 2 || __div > 127) | |
| 238 | − continue; | |
| 239 | − | |
| 240 | − actual_rate = mclk_rate / (__pdiv * __div); | |
| 241 | − if (is_best(rate, actual_rate, best_rate)) { | |
| 242 | − best_rate = actual_rate; | |
| 243 | − best_parent_rate = __parent_rate; | |
| 244 | − best_parent = parent; | |
| 245 | − } | |
| 246 | − } | |
| 247 | − } | |
| 248 | − | |
| 249 | − if (!best_parent) | |
| 250 | − return -EINVAL; | |
| 251 | − | |
| 252 | − req->best_parent_rate = best_parent_rate; | |
| 253 | − req->best_parent_hw = __clk_get_hw(best_parent); | |
| 254 | − req->rate = best_rate; | |
| 255 | − | |
| 256 | − return 0; | |
| 257 | −} | |
| 258 | − | |
| 259 | −static unsigned long ep93xx_ddiv_recalc_rate(struct clk_hw *hw, | |
| 260 | − unsigned long parent_rate) | |
| 261 | −{ | |
| 262 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 263 | − unsigned long rate = 0; | |
| 264 | − u32 val = __raw_readl(psc->reg); | |
| 265 | − int __pdiv = ((val >> EP93XX_SYSCON_CLKDIV_PDIV_SHIFT) & 0x03); | |
| 266 | − int __div = val & 0x7f; | |
| 267 | − | |
| 268 | − if (__div > 0) | |
| 269 | − rate = (parent_rate * 2) / ((__pdiv + 3) * __div); | |
| 270 | − | |
| 271 | − return rate; | |
| 272 | −} | |
| 273 | − | |
| 274 | −static int ep93xx_ddiv_set_rate(struct clk_hw *hw, unsigned long rate, | |
| 275 | − unsigned long parent_rate) | |
| 276 | −{ | |
| 277 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 278 | − int pdiv = 0, div = 0; | |
| 279 | − unsigned long best_rate = 0, actual_rate, mclk_rate; | |
| 280 | − int __div = 0, __pdiv = 0; | |
| 281 | − u32 val; | |
| 282 | − | |
| 283 | − mclk_rate = parent_rate * 2; | |
| 284 | − | |
| 285 | − for (__pdiv = 4; __pdiv <= 6; __pdiv++) { | |
| 286 | − __div = mclk_rate / (rate * __pdiv); | |
| 287 | − if (__div < 2 || __div > 127) | |
| 288 | − continue; | |
| 289 | − | |
| 290 | − actual_rate = mclk_rate / (__pdiv * __div); | |
| 291 | − if (is_best(rate, actual_rate, best_rate)) { | |
| 292 | − pdiv = __pdiv - 3; | |
| 293 | − div = __div; | |
| 294 | − best_rate = actual_rate; | |
| 295 | − } | |
| 296 | − } | |
| 297 | − | |
| 298 | − if (!best_rate) | |
| 299 | − return -EINVAL; | |
| 300 | − | |
| 301 | − val = __raw_readl(psc->reg); | |
| 302 | − | |
| 303 | − /* Clear old dividers */ | |
| 304 | − val &= ~0x37f; | |
| 305 | − | |
| 306 | − /* Set the new pdiv and div bits for the new clock rate */ | |
| 307 | − val |= (pdiv << EP93XX_SYSCON_CLKDIV_PDIV_SHIFT) | div; | |
| 308 | − ep93xx_syscon_swlocked_write(val, psc->reg); | |
| 309 | − | |
| 310 | − return 0; | |
| 311 | −} | |
| 312 | − | |
| 313 | −static const struct clk_ops clk_ddiv_ops = { | |
| 314 | − .enable = ep93xx_clk_enable, | |
| 315 | − .disable = ep93xx_clk_disable, | |
| 316 | − .is_enabled = ep93xx_clk_is_enabled, | |
| 317 | − .get_parent = ep93xx_mux_get_parent, | |
| 318 | − .set_parent = ep93xx_mux_set_parent_lock, | |
| 319 | − .determine_rate = ep93xx_mux_determine_rate, | |
| 320 | − .recalc_rate = ep93xx_ddiv_recalc_rate, | |
| 321 | − .set_rate = ep93xx_ddiv_set_rate, | |
| 322 | −}; | |
| 323 | − | |
| 324 | −static struct clk_hw *clk_hw_register_ddiv(const char *name, | |
| 325 | − void __iomem *reg, | |
| 326 | − u8 bit_idx) | |
| 327 | −{ | |
| 328 | − struct clk_init_data init; | |
| 329 | − struct clk_psc *psc; | |
| 330 | − struct clk *clk; | |
| 331 | − | |
| 332 | − psc = kzalloc(sizeof(*psc), GFP_KERNEL); | |
| 333 | − if (!psc) | |
| 334 | − return ERR_PTR(-ENOMEM); | |
| 335 | − | |
| 336 | − init.name = name; | |
| 337 | − init.ops = &clk_ddiv_ops; | |
| 338 | − init.flags = 0; | |
| 339 | − init.parent_names = mux_parents; | |
| 340 | − init.num_parents = ARRAY_SIZE(mux_parents); | |
| 341 | − | |
| 342 | − psc->reg = reg; | |
| 343 | − psc->bit_idx = bit_idx; | |
| 344 | − psc->lock = &clk_lock; | |
| 345 | − psc->hw.init = &init; | |
| 346 | − | |
| 347 | − clk = clk_register(NULL, &psc->hw); | |
| 348 | − if (IS_ERR(clk)) { | |
| 349 | − kfree(psc); | |
| 350 | − return ERR_CAST(clk); | |
| 351 | − } | |
| 352 | − return &psc->hw; | |
| 353 | −} | |
| 354 | − | |
| 355 | −static unsigned long ep93xx_div_recalc_rate(struct clk_hw *hw, | |
| 356 | − unsigned long parent_rate) | |
| 357 | −{ | |
| 358 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 359 | − u32 val = __raw_readl(psc->reg); | |
| 360 | − u8 index = (val & psc->mask) >> psc->shift; | |
| 361 | − | |
| 362 | − if (index >= psc->num_div) | |
| 363 | − return 0; | |
| 364 | − | |
| 365 | − return DIV_ROUND_UP_ULL(parent_rate, psc->div[index]); | |
| 366 | −} | |
| 367 | − | |
| 368 | −static long ep93xx_div_round_rate(struct clk_hw *hw, unsigned long rate, | |
| 369 | − unsigned long *parent_rate) | |
| 370 | −{ | |
| 371 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 372 | − unsigned long best = 0, now, maxdiv; | |
| 373 | − int i; | |
| 374 | − | |
| 375 | − maxdiv = psc->div[psc->num_div - 1]; | |
| 376 | − | |
| 377 | − for (i = 0; i < psc->num_div; i++) { | |
| 378 | − if ((rate * psc->div[i]) == *parent_rate) | |
| 379 | − return DIV_ROUND_UP_ULL((u64)*parent_rate, psc->div[i]); | |
| 380 | − | |
| 381 | − now = DIV_ROUND_UP_ULL((u64)*parent_rate, psc->div[i]); | |
| 382 | − | |
| 383 | − if (is_best(rate, now, best)) | |
| 384 | − best = now; | |
| 385 | − } | |
| 386 | − | |
| 387 | − if (!best) | |
| 388 | − best = DIV_ROUND_UP_ULL(*parent_rate, maxdiv); | |
| 389 | − | |
| 390 | − return best; | |
| 391 | −} | |
| 392 | − | |
| 393 | −static int ep93xx_div_set_rate(struct clk_hw *hw, unsigned long rate, | |
| 394 | − unsigned long parent_rate) | |
| 395 | −{ | |
| 396 | − struct clk_psc *psc = to_clk_psc(hw); | |
| 397 | − u32 val = __raw_readl(psc->reg) & ~psc->mask; | |
| 398 | − int i; | |
| 399 | − | |
| 400 | − for (i = 0; i < psc->num_div; i++) | |
| 401 | − if (rate == parent_rate / psc->div[i]) { | |
| 402 | − val |= i << psc->shift; | |
| 403 | − break; | |
| 404 | − } | |
| 405 | − | |
| 406 | − if (i == psc->num_div) | |
| 407 | − return -EINVAL; | |
| 408 | − | |
| 409 | − ep93xx_syscon_swlocked_write(val, psc->reg); | |
| 410 | − | |
| 411 | − return 0; | |
| 412 | −} | |
| 413 | − | |
| 414 | −static const struct clk_ops ep93xx_div_ops = { | |
| 415 | − .enable = ep93xx_clk_enable, | |
| 416 | − .disable = ep93xx_clk_disable, | |
| 417 | − .is_enabled = ep93xx_clk_is_enabled, | |
| 418 | − .recalc_rate = ep93xx_div_recalc_rate, | |
| 419 | − .round_rate = ep93xx_div_round_rate, | |
| 420 | − .set_rate = ep93xx_div_set_rate, | |
| 421 | −}; | |
| 422 | − | |
| 423 | −static struct clk_hw *clk_hw_register_div(const char *name, | |
| 424 | − const char *parent_name, | |
| 425 | − void __iomem *reg, | |
| 426 | − u8 enable_bit, | |
| 427 | − u8 shift, | |
| 428 | − u8 width, | |
| 429 | − char *clk_divisors, | |
| 430 | − u8 num_div) | |
| 431 | −{ | |
| 432 | − struct clk_init_data init; | |
| 433 | − struct clk_psc *psc; | |
| 434 | − struct clk *clk; | |
| 435 | − | |
| 436 | − psc = kzalloc(sizeof(*psc), GFP_KERNEL); | |
| 437 | − if (!psc) | |
| 438 | − return ERR_PTR(-ENOMEM); | |
| 439 | − | |
| 440 | − init.name = name; | |
| 441 | − init.ops = &ep93xx_div_ops; | |
| 442 | − init.flags = 0; | |
| 443 | − init.parent_names = (parent_name ? &parent_name : NULL); | |
| 444 | − init.num_parents = 1; | |
| 445 | − | |
| 446 | − psc->reg = reg; | |
| 447 | − psc->bit_idx = enable_bit; | |
| 448 | − psc->mask = GENMASK(shift + width - 1, shift); | |
| 449 | − psc->shift = shift; | |
| 450 | − psc->div = clk_divisors; | |
| 451 | − psc->num_div = num_div; | |
| 452 | − psc->lock = &clk_lock; | |
| 453 | − psc->hw.init = &init; | |
| 454 | − | |
| 455 | − clk = clk_register(NULL, &psc->hw); | |
| 456 | − if (IS_ERR(clk)) { | |
| 457 | − kfree(psc); | |
| 458 | − return ERR_CAST(clk); | |
| 459 | − } | |
| 460 | − return &psc->hw; | |
| 461 | −} | |
| 462 | − | |
| 463 | −struct ep93xx_gate { | |
| 464 | − unsigned int bit; | |
| 465 | − const char *dev_id; | |
| 466 | − const char *con_id; | |
| 467 | −}; | |
| 468 | − | |
| 469 | −static struct ep93xx_gate ep93xx_uarts[] = { | |
| 470 | − {EP93XX_SYSCON_DEVCFG_U1EN, "apb:uart1", NULL}, | |
| 471 | − {EP93XX_SYSCON_DEVCFG_U2EN, "apb:uart2", NULL}, | |
| 472 | − {EP93XX_SYSCON_DEVCFG_U3EN, "apb:uart3", NULL}, | |
| 473 | −}; | |
| 474 | − | |
| 475 | −static void __init ep93xx_uart_clock_init(void) | |
| 476 | −{ | |
| 477 | − unsigned int i; | |
| 478 | − struct clk_hw *hw; | |
| 479 | − u32 value; | |
| 480 | − unsigned int clk_uart_div; | |
| 481 | − | |
| 482 | − value = __raw_readl(EP93XX_SYSCON_PWRCNT); | |
| 483 | − if (value & EP93XX_SYSCON_PWRCNT_UARTBAUD) | |
| 484 | − clk_uart_div = 1; | |
| 485 | − else | |
| 486 | − clk_uart_div = 2; | |
| 487 | − | |
| 488 | − hw = clk_hw_register_fixed_factor(NULL, "uart", "xtali", 0, 1, clk_uart_div); | |
| 489 | − | |
| 490 | − /* parenting uart gate clocks to uart clock */ | |
| 491 | − for (i = 0; i < ARRAY_SIZE(ep93xx_uarts); i++) { | |
| 492 | − hw = ep93xx_clk_register_gate(ep93xx_uarts[i].dev_id, | |
| 493 | − "uart", | |
| 494 | − EP93XX_SYSCON_DEVCFG, | |
| 495 | − ep93xx_uarts[i].bit); | |
| 496 | − | |
| 497 | − clk_hw_register_clkdev(hw, NULL, ep93xx_uarts[i].dev_id); | |
| 498 | − } | |
| 499 | −} | |
| 500 | − | |
| 501 | −static struct ep93xx_gate ep93xx_dmas[] = { | |
| 502 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P0, NULL, "m2p0"}, | |
| 503 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P1, NULL, "m2p1"}, | |
| 504 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P2, NULL, "m2p2"}, | |
| 505 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P3, NULL, "m2p3"}, | |
| 506 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P4, NULL, "m2p4"}, | |
| 507 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P5, NULL, "m2p5"}, | |
| 508 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P6, NULL, "m2p6"}, | |
| 509 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P7, NULL, "m2p7"}, | |
| 510 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P8, NULL, "m2p8"}, | |
| 511 | − {EP93XX_SYSCON_PWRCNT_DMA_M2P9, NULL, "m2p9"}, | |
| 512 | − {EP93XX_SYSCON_PWRCNT_DMA_M2M0, NULL, "m2m0"}, | |
| 513 | − {EP93XX_SYSCON_PWRCNT_DMA_M2M1, NULL, "m2m1"}, | |
| 514 | −}; | |
| 515 | − | |
| 516 | −static void __init ep93xx_dma_clock_init(void) | |
| 517 | −{ | |
| 518 | − unsigned int i; | |
| 519 | − struct clk_hw *hw; | |
| 520 | − int ret; | |
| 521 | − | |
| 522 | − for (i = 0; i < ARRAY_SIZE(ep93xx_dmas); i++) { | |
| 523 | − hw = clk_hw_register_gate(NULL, ep93xx_dmas[i].con_id, | |
| 524 | − "hclk", 0, | |
| 525 | − EP93XX_SYSCON_PWRCNT, | |
| 526 | − ep93xx_dmas[i].bit, | |
| 527 | − 0, | |
| 528 | − &clk_lock); | |
| 529 | − | |
| 530 | − ret = clk_hw_register_clkdev(hw, ep93xx_dmas[i].con_id, NULL); | |
| 531 | − if (ret) | |
| 532 | − pr_err("%s: failed to register lookup %s\n", | |
| 533 | − __func__, ep93xx_dmas[i].con_id); | |
| 534 | − } | |
| 535 | −} | |
| 536 | − | |
| 537 | −static int __init ep93xx_clock_init(void) | |
| 538 | −{ | |
| 539 | − u32 value; | |
| 540 | − struct clk_hw *hw; | |
| 541 | − unsigned long clk_pll1_rate; | |
| 542 | − unsigned long clk_f_rate; | |
| 543 | − unsigned long clk_h_rate; | |
| 544 | − unsigned long clk_p_rate; | |
| 545 | − unsigned long clk_pll2_rate; | |
| 546 | − unsigned int clk_f_div; | |
| 547 | − unsigned int clk_h_div; | |
| 548 | − unsigned int clk_p_div; | |
| 549 | − unsigned int clk_usb_div; | |
| 550 | − unsigned long clk_spi_div; | |
| 551 | − | |
| 552 | − hw = clk_hw_register_fixed_rate(NULL, "xtali", NULL, 0, EP93XX_EXT_CLK_RATE); | |
| 553 | − clk_hw_register_clkdev(hw, NULL, "xtali"); | |
| 554 | − | |
| 555 | − /* Determine the bootloader configured pll1 rate */ | |
| 556 | − value = __raw_readl(EP93XX_SYSCON_CLKSET1); | |
| 557 | − if (!(value & EP93XX_SYSCON_CLKSET1_NBYP1)) | |
| 558 | − clk_pll1_rate = EP93XX_EXT_CLK_RATE; | |
| 559 | − else | |
| 560 | − clk_pll1_rate = calc_pll_rate(EP93XX_EXT_CLK_RATE, value); | |
| 561 | − | |
| 562 | − hw = clk_hw_register_fixed_rate(NULL, "pll1", "xtali", 0, clk_pll1_rate); | |
| 563 | − clk_hw_register_clkdev(hw, NULL, "pll1"); | |
| 564 | − | |
| 565 | − /* Initialize the pll1 derived clocks */ | |
| 566 | − clk_f_div = fclk_divisors[(value >> 25) & 0x7]; | |
| 567 | − clk_h_div = hclk_divisors[(value >> 20) & 0x7]; | |
| 568 | − clk_p_div = pclk_divisors[(value >> 18) & 0x3]; | |
| 569 | − | |
| 570 | − hw = clk_hw_register_fixed_factor(NULL, "fclk", "pll1", 0, 1, clk_f_div); | |
| 571 | − clk_f_rate = clk_get_rate(hw->clk); | |
| 572 | − hw = clk_hw_register_fixed_factor(NULL, "hclk", "pll1", 0, 1, clk_h_div); | |
| 573 | − clk_h_rate = clk_get_rate(hw->clk); | |
| 574 | − hw = clk_hw_register_fixed_factor(NULL, "pclk", "hclk", 0, 1, clk_p_div); | |
| 575 | − clk_p_rate = clk_get_rate(hw->clk); | |
| 576 | − | |
| 577 | − clk_hw_register_clkdev(hw, "apb_pclk", NULL); | |
| 578 | − | |
| 579 | − ep93xx_dma_clock_init(); | |
| 580 | − | |
| 581 | − /* Determine the bootloader configured pll2 rate */ | |
| 582 | − value = __raw_readl(EP93XX_SYSCON_CLKSET2); | |
| 583 | − if (!(value & EP93XX_SYSCON_CLKSET2_NBYP2)) | |
| 584 | − clk_pll2_rate = EP93XX_EXT_CLK_RATE; | |
| 585 | − else if (value & EP93XX_SYSCON_CLKSET2_PLL2_EN) | |
| 586 | − clk_pll2_rate = calc_pll_rate(EP93XX_EXT_CLK_RATE, value); | |
| 587 | − else | |
| 588 | − clk_pll2_rate = 0; | |
| 589 | − | |
| 590 | − hw = clk_hw_register_fixed_rate(NULL, "pll2", "xtali", 0, clk_pll2_rate); | |
| 591 | − clk_hw_register_clkdev(hw, NULL, "pll2"); | |
| 592 | − | |
| 593 | − /* Initialize the pll2 derived clocks */ | |
| 594 | − /* | |
| 595 | − * These four bits set the divide ratio between the PLL2 | |
| 596 | − * output and the USB clock. | |
| 597 | − * 0000 - Divide by 1 | |
| 598 | − * 0001 - Divide by 2 | |
| 599 | − * 0010 - Divide by 3 | |
| 600 | − * 0011 - Divide by 4 | |
| 601 | − * 0100 - Divide by 5 | |
| 602 | − * 0101 - Divide by 6 | |
| 603 | − * 0110 - Divide by 7 | |
| 604 | − * 0111 - Divide by 8 | |
| 605 | − * 1000 - Divide by 9 | |
| 606 | − * 1001 - Divide by 10 | |
| 607 | − * 1010 - Divide by 11 | |
| 608 | − * 1011 - Divide by 12 | |
| 609 | − * 1100 - Divide by 13 | |
| 610 | − * 1101 - Divide by 14 | |
| 611 | − * 1110 - Divide by 15 | |
| 612 | − * 1111 - Divide by 1 | |
| 613 | − * On power-on-reset these bits are reset to 0000b. | |
| 614 | − */ | |
| 615 | − clk_usb_div = (((value >> 28) & 0xf) + 1); | |
| 616 | − hw = clk_hw_register_fixed_factor(NULL, "usb_clk", "pll2", 0, 1, clk_usb_div); | |
| 617 | − hw = clk_hw_register_gate(NULL, "ohci-platform", | |
| 618 | − "usb_clk", 0, | |
| 619 | − EP93XX_SYSCON_PWRCNT, | |
| 620 | − EP93XX_SYSCON_PWRCNT_USH_EN, | |
| 621 | − 0, | |
| 622 | − &clk_lock); | |
| 623 | − clk_hw_register_clkdev(hw, NULL, "ohci-platform"); | |
| 624 | − | |
| 625 | − /* | |
| 626 | − * EP93xx SSP clock rate was doubled in version E2. For more information | |
| 627 | − * see: | |
| 628 | − * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf | |
| 629 | − */ | |
| 630 | − clk_spi_div = 1; | |
| 631 | − if (ep93xx_chip_revision() < EP93XX_CHIP_REV_E2) | |
| 632 | − clk_spi_div = 2; | |
| 633 | − hw = clk_hw_register_fixed_factor(NULL, "ep93xx-spi.0", "xtali", 0, 1, clk_spi_div); | |
| 634 | − clk_hw_register_clkdev(hw, NULL, "ep93xx-spi.0"); | |
| 635 | − | |
| 636 | − /* pwm clock */ | |
| 637 | − hw = clk_hw_register_fixed_factor(NULL, "pwm_clk", "xtali", 0, 1, 1); | |
| 638 | − clk_hw_register_clkdev(hw, "pwm_clk", NULL); | |
| 639 | − | |
| 640 | − pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n", | |
| 641 | − clk_pll1_rate / 1000000, clk_pll2_rate / 1000000); | |
| 642 | − pr_info("FCLK %ld MHz, HCLK %ld MHz, PCLK %ld MHz\n", | |
| 643 | − clk_f_rate / 1000000, clk_h_rate / 1000000, | |
| 644 | − clk_p_rate / 1000000); | |
| 645 | − | |
| 646 | − ep93xx_uart_clock_init(); | |
| 647 | − | |
| 648 | − /* touchscreen/adc clock */ | |
| 649 | − hw = clk_hw_register_div("ep93xx-adc", | |
| 650 | − "xtali", | |
| 651 | − EP93XX_SYSCON_KEYTCHCLKDIV, | |
| 652 | − EP93XX_SYSCON_KEYTCHCLKDIV_TSEN, | |
| 653 | − EP93XX_SYSCON_KEYTCHCLKDIV_ADIV, | |
| 654 | − 1, | |
| 655 | − adc_divisors, | |
| 656 | − ARRAY_SIZE(adc_divisors)); | |
| 657 | − | |
| 658 | − clk_hw_register_clkdev(hw, NULL, "ep93xx-adc"); | |
| 659 | − | |
| 660 | − /* keypad clock */ | |
| 661 | − hw = clk_hw_register_div("ep93xx-keypad", | |
| 662 | − "xtali", | |
| 663 | − EP93XX_SYSCON_KEYTCHCLKDIV, | |
| 664 | − EP93XX_SYSCON_KEYTCHCLKDIV_KEN, | |
| 665 | − EP93XX_SYSCON_KEYTCHCLKDIV_KDIV, | |
| 666 | − 1, | |
| 667 | − adc_divisors, | |
| 668 | − ARRAY_SIZE(adc_divisors)); | |
| 669 | − | |
| 670 | − clk_hw_register_clkdev(hw, NULL, "ep93xx-keypad"); | |
| 671 | − | |
| 672 | − /* On reset PDIV and VDIV is set to zero, while PDIV zero | |
| 673 | − * means clock disable, VDIV shouldn't be zero. | |
| 674 | − * So i set both dividers to minimum. | |
| 675 | − */ | |
| 676 | − /* ENA - Enable CLK divider. */ | |
| 677 | − /* PDIV - 00 - Disable clock */ | |
| 678 | − /* VDIV - at least 2 */ | |
| 679 | − /* Check and enable video clk registers */ | |
| 680 | − value = __raw_readl(EP93XX_SYSCON_VIDCLKDIV); | |
| 681 | − value |= (1 << EP93XX_SYSCON_CLKDIV_PDIV_SHIFT) | 2; | |
| 682 | − ep93xx_syscon_swlocked_write(value, EP93XX_SYSCON_VIDCLKDIV); | |
| 683 | − | |
| 684 | − /* check and enable i2s clk registers */ | |
| 685 | − value = __raw_readl(EP93XX_SYSCON_I2SCLKDIV); | |
| 686 | − value |= (1 << EP93XX_SYSCON_CLKDIV_PDIV_SHIFT) | 2; | |
| 687 | − ep93xx_syscon_swlocked_write(value, EP93XX_SYSCON_I2SCLKDIV); | |
| 688 | − | |
| 689 | − /* video clk */ | |
| 690 | − hw = clk_hw_register_ddiv("ep93xx-fb", | |
| 691 | − EP93XX_SYSCON_VIDCLKDIV, | |
| 692 | − EP93XX_SYSCON_CLKDIV_ENABLE); | |
| 693 | − | |
| 694 | − clk_hw_register_clkdev(hw, NULL, "ep93xx-fb"); | |
| 695 | − | |
| 696 | − /* i2s clk */ | |
| 697 | − hw = clk_hw_register_ddiv("mclk", | |
| 698 | − EP93XX_SYSCON_I2SCLKDIV, | |
| 699 | − EP93XX_SYSCON_CLKDIV_ENABLE); | |
| 700 | − | |
| 701 | − clk_hw_register_clkdev(hw, "mclk", "ep93xx-i2s"); | |
| 702 | − | |
| 703 | − /* i2s sclk */ | |
| 704 | −#define EP93XX_I2SCLKDIV_SDIV_SHIFT 16 | |
| 705 | −#define EP93XX_I2SCLKDIV_SDIV_WIDTH 1 | |
| 706 | − hw = clk_hw_register_div("sclk", | |
| 707 | − "mclk", | |
| 708 | − EP93XX_SYSCON_I2SCLKDIV, | |
| 709 | − EP93XX_SYSCON_I2SCLKDIV_SENA, | |
| 710 | − EP93XX_I2SCLKDIV_SDIV_SHIFT, | |
| 711 | − EP93XX_I2SCLKDIV_SDIV_WIDTH, | |
| 712 | − sclk_divisors, | |
| 713 | − ARRAY_SIZE(sclk_divisors)); | |
| 714 | − | |
| 715 | − clk_hw_register_clkdev(hw, "sclk", "ep93xx-i2s"); | |
| 716 | − | |
| 717 | − /* i2s lrclk */ | |
| 718 | −#define EP93XX_I2SCLKDIV_LRDIV32_SHIFT 17 | |
| 719 | −#define EP93XX_I2SCLKDIV_LRDIV32_WIDTH 3 | |
| 720 | − hw = clk_hw_register_div("lrclk", | |
| 721 | − "sclk", | |
| 722 | − EP93XX_SYSCON_I2SCLKDIV, | |
| 723 | − EP93XX_SYSCON_I2SCLKDIV_SENA, | |
| 724 | − EP93XX_I2SCLKDIV_LRDIV32_SHIFT, | |
| 725 | − EP93XX_I2SCLKDIV_LRDIV32_WIDTH, | |
| 726 | − lrclk_divisors, | |
| 727 | − ARRAY_SIZE(lrclk_divisors)); | |
| 728 | − | |
| 729 | − clk_hw_register_clkdev(hw, "lrclk", "ep93xx-i2s"); | |
| 730 | − | |
| 731 | − return 0; | |
| 732 | −} | |
| 733 | −postcore_initcall(ep93xx_clock_init); | |
| @@ -1,955 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/core.c | |
| 4 | − * Core routines for Cirrus EP93xx chips. | |
| 5 | − * | |
| 6 | − * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
| 7 | − * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org> | |
| 8 | − * | |
| 9 | − * Thanks go to Michael Burian and Ray Lehtiniemi for their key | |
| 10 | − * role in the ep93xx linux community. | |
| 11 | − */ | |
| 12 | − | |
| 13 | −#define pr_fmt(fmt) "ep93xx " KBUILD_MODNAME ": " fmt | |
| 14 | − | |
| 15 | −#include <linux/kernel.h> | |
| 16 | −#include <linux/init.h> | |
| 17 | −#include <linux/platform_device.h> | |
| 18 | −#include <linux/interrupt.h> | |
| 19 | −#include <linux/dma-mapping.h> | |
| 20 | −#include <linux/sys_soc.h> | |
| 21 | −#include <linux/irq.h> | |
| 22 | −#include <linux/io.h> | |
| 23 | −#include <linux/gpio.h> | |
| 24 | −#include <linux/leds.h> | |
| 25 | −#include <linux/uaccess.h> | |
| 26 | −#include <linux/termios.h> | |
| 27 | −#include <linux/amba/bus.h> | |
| 28 | −#include <linux/amba/serial.h> | |
| 29 | −#include <linux/mtd/physmap.h> | |
| 30 | −#include <linux/i2c.h> | |
| 31 | −#include <linux/gpio/machine.h> | |
| 32 | −#include <linux/spi/spi.h> | |
| 33 | −#include <linux/export.h> | |
| 34 | −#include <linux/irqchip/arm-vic.h> | |
| 35 | −#include <linux/reboot.h> | |
| 36 | −#include <linux/usb/ohci_pdriver.h> | |
| 37 | −#include <linux/random.h> | |
| 38 | −#include <linux/ioport.h> | |
| 39 | − | |
| 40 | −#include "hardware.h" | |
| 41 | −#include <linux/platform_data/video-ep93xx.h> | |
| 42 | −#include <linux/platform_data/keypad-ep93xx.h> | |
| 43 | −#include <linux/platform_data/spi-ep93xx.h> | |
| 44 | −#include <linux/soc/cirrus/ep93xx.h> | |
| 45 | − | |
| 46 | −#include "gpio-ep93xx.h" | |
| 47 | − | |
| 48 | −#include <asm/mach/arch.h> | |
| 49 | −#include <asm/mach/map.h> | |
| 50 | − | |
| 51 | −#include "soc.h" | |
| 52 | −#include "irqs.h" | |
| 53 | − | |
| 54 | −/************************************************************************* | |
| 55 | − * Static I/O mappings that are needed for all EP93xx platforms | |
| 56 | − *************************************************************************/ | |
| 57 | −static struct map_desc ep93xx_io_desc[] __initdata = { | |
| 58 | − { | |
| 59 | − .virtual = EP93XX_AHB_VIRT_BASE, | |
| 60 | − .pfn = __phys_to_pfn(EP93XX_AHB_PHYS_BASE), | |
| 61 | − .length = EP93XX_AHB_SIZE, | |
| 62 | − .type = MT_DEVICE, | |
| 63 | − }, { | |
| 64 | − .virtual = EP93XX_APB_VIRT_BASE, | |
| 65 | − .pfn = __phys_to_pfn(EP93XX_APB_PHYS_BASE), | |
| 66 | − .length = EP93XX_APB_SIZE, | |
| 67 | − .type = MT_DEVICE, | |
| 68 | − }, | |
| 69 | −}; | |
| 70 | − | |
| 71 | −void __init ep93xx_map_io(void) | |
| 72 | −{ | |
| 73 | − iotable_init(ep93xx_io_desc, ARRAY_SIZE(ep93xx_io_desc)); | |
| 74 | −} | |
| 75 | − | |
| 76 | −/************************************************************************* | |
| 77 | − * EP93xx IRQ handling | |
| 78 | − *************************************************************************/ | |
| 79 | −void __init ep93xx_init_irq(void) | |
| 80 | −{ | |
| 81 | − vic_init(EP93XX_VIC1_BASE, IRQ_EP93XX_VIC0, EP93XX_VIC1_VALID_IRQ_MASK, 0); | |
| 82 | − vic_init(EP93XX_VIC2_BASE, IRQ_EP93XX_VIC1, EP93XX_VIC2_VALID_IRQ_MASK, 0); | |
| 83 | −} | |
| 84 | − | |
| 85 | − | |
| 86 | −/************************************************************************* | |
| 87 | − * EP93xx System Controller Software Locked register handling | |
| 88 | − *************************************************************************/ | |
| 89 | − | |
| 90 | −/* | |
| 91 | − * syscon_swlock prevents anything else from writing to the syscon | |
| 92 | − * block while a software locked register is being written. | |
| 93 | − */ | |
| 94 | −static DEFINE_SPINLOCK(syscon_swlock); | |
| 95 | − | |
| 96 | −void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg) | |
| 97 | −{ | |
| 98 | − unsigned long flags; | |
| 99 | − | |
| 100 | − spin_lock_irqsave(&syscon_swlock, flags); | |
| 101 | − | |
| 102 | − __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); | |
| 103 | − __raw_writel(val, reg); | |
| 104 | − | |
| 105 | − spin_unlock_irqrestore(&syscon_swlock, flags); | |
| 106 | −} | |
| 107 | − | |
| 108 | −void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits) | |
| 109 | −{ | |
| 110 | − unsigned long flags; | |
| 111 | − unsigned int val; | |
| 112 | − | |
| 113 | − spin_lock_irqsave(&syscon_swlock, flags); | |
| 114 | − | |
| 115 | − val = __raw_readl(EP93XX_SYSCON_DEVCFG); | |
| 116 | − val &= ~clear_bits; | |
| 117 | − val |= set_bits; | |
| 118 | − __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); | |
| 119 | − __raw_writel(val, EP93XX_SYSCON_DEVCFG); | |
| 120 | − | |
| 121 | − spin_unlock_irqrestore(&syscon_swlock, flags); | |
| 122 | −} | |
| 123 | − | |
| 124 | −/** | |
| 125 | − * ep93xx_chip_revision() - returns the EP93xx chip revision | |
| 126 | − * | |
| 127 | − * See "platform.h" for more information. | |
| 128 | − */ | |
| 129 | −unsigned int ep93xx_chip_revision(void) | |
| 130 | −{ | |
| 131 | − unsigned int v; | |
| 132 | − | |
| 133 | − v = __raw_readl(EP93XX_SYSCON_SYSCFG); | |
| 134 | − v &= EP93XX_SYSCON_SYSCFG_REV_MASK; | |
| 135 | − v >>= EP93XX_SYSCON_SYSCFG_REV_SHIFT; | |
| 136 | − return v; | |
| 137 | −} | |
| 138 | −EXPORT_SYMBOL_GPL(ep93xx_chip_revision); | |
| 139 | − | |
| 140 | −/************************************************************************* | |
| 141 | − * EP93xx GPIO | |
| 142 | − *************************************************************************/ | |
| 143 | −/* port A */ | |
| 144 | −static struct resource ep93xx_a_gpio_resources[] = { | |
| 145 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE, 0x04, "data"), | |
| 146 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x10, 0x04, "dir"), | |
| 147 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x90, 0x1c, "intr"), | |
| 148 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO_AB), | |
| 149 | −}; | |
| 150 | − | |
| 151 | −static struct platform_device ep93xx_a_gpio = { | |
| 152 | − .name = "gpio-ep93xx", | |
| 153 | − .id = 0, | |
| 154 | − .num_resources = ARRAY_SIZE(ep93xx_a_gpio_resources), | |
| 155 | − .resource = ep93xx_a_gpio_resources, | |
| 156 | −}; | |
| 157 | − | |
| 158 | −/* port B */ | |
| 159 | −static struct resource ep93xx_b_gpio_resources[] = { | |
| 160 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x04, 0x04, "data"), | |
| 161 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x14, 0x04, "dir"), | |
| 162 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0xac, 0x1c, "intr"), | |
| 163 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO_AB), | |
| 164 | −}; | |
| 165 | − | |
| 166 | −static struct platform_device ep93xx_b_gpio = { | |
| 167 | − .name = "gpio-ep93xx", | |
| 168 | − .id = 1, | |
| 169 | − .num_resources = ARRAY_SIZE(ep93xx_b_gpio_resources), | |
| 170 | − .resource = ep93xx_b_gpio_resources, | |
| 171 | −}; | |
| 172 | − | |
| 173 | −/* port C */ | |
| 174 | −static struct resource ep93xx_c_gpio_resources[] = { | |
| 175 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x08, 0x04, "data"), | |
| 176 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x18, 0x04, "dir"), | |
| 177 | −}; | |
| 178 | − | |
| 179 | −static struct platform_device ep93xx_c_gpio = { | |
| 180 | − .name = "gpio-ep93xx", | |
| 181 | − .id = 2, | |
| 182 | − .num_resources = ARRAY_SIZE(ep93xx_c_gpio_resources), | |
| 183 | − .resource = ep93xx_c_gpio_resources, | |
| 184 | −}; | |
| 185 | − | |
| 186 | −/* port D */ | |
| 187 | −static struct resource ep93xx_d_gpio_resources[] = { | |
| 188 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x0c, 0x04, "data"), | |
| 189 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x1c, 0x04, "dir"), | |
| 190 | −}; | |
| 191 | − | |
| 192 | −static struct platform_device ep93xx_d_gpio = { | |
| 193 | − .name = "gpio-ep93xx", | |
| 194 | − .id = 3, | |
| 195 | − .num_resources = ARRAY_SIZE(ep93xx_d_gpio_resources), | |
| 196 | − .resource = ep93xx_d_gpio_resources, | |
| 197 | −}; | |
| 198 | − | |
| 199 | −/* port E */ | |
| 200 | −static struct resource ep93xx_e_gpio_resources[] = { | |
| 201 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x20, 0x04, "data"), | |
| 202 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x24, 0x04, "dir"), | |
| 203 | −}; | |
| 204 | − | |
| 205 | −static struct platform_device ep93xx_e_gpio = { | |
| 206 | − .name = "gpio-ep93xx", | |
| 207 | − .id = 4, | |
| 208 | − .num_resources = ARRAY_SIZE(ep93xx_e_gpio_resources), | |
| 209 | − .resource = ep93xx_e_gpio_resources, | |
| 210 | −}; | |
| 211 | − | |
| 212 | −/* port F */ | |
| 213 | −static struct resource ep93xx_f_gpio_resources[] = { | |
| 214 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x30, 0x04, "data"), | |
| 215 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x34, 0x04, "dir"), | |
| 216 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x4c, 0x1c, "intr"), | |
| 217 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO0MUX), | |
| 218 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO1MUX), | |
| 219 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO2MUX), | |
| 220 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO3MUX), | |
| 221 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO4MUX), | |
| 222 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO5MUX), | |
| 223 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO6MUX), | |
| 224 | − DEFINE_RES_IRQ(IRQ_EP93XX_GPIO7MUX), | |
| 225 | −}; | |
| 226 | − | |
| 227 | −static struct platform_device ep93xx_f_gpio = { | |
| 228 | − .name = "gpio-ep93xx", | |
| 229 | − .id = 5, | |
| 230 | − .num_resources = ARRAY_SIZE(ep93xx_f_gpio_resources), | |
| 231 | − .resource = ep93xx_f_gpio_resources, | |
| 232 | −}; | |
| 233 | − | |
| 234 | −/* port G */ | |
| 235 | −static struct resource ep93xx_g_gpio_resources[] = { | |
| 236 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x38, 0x04, "data"), | |
| 237 | − DEFINE_RES_MEM_NAMED(EP93XX_GPIO_PHYS_BASE + 0x3c, 0x04, "dir"), | |
| 238 | −}; | |
| 239 | − | |
| 240 | −static struct platform_device ep93xx_g_gpio = { | |
| 241 | − .name = "gpio-ep93xx", | |
| 242 | − .id = 6, | |
| 243 | − .num_resources = ARRAY_SIZE(ep93xx_g_gpio_resources), | |
| 244 | − .resource = ep93xx_g_gpio_resources, | |
| 245 | −}; | |
| 246 | − | |
| 247 | −static struct platform_device *ep93xx_gpio_device[] __initdata = { | |
| 248 | − &ep93xx_a_gpio, | |
| 249 | − &ep93xx_b_gpio, | |
| 250 | − &ep93xx_c_gpio, | |
| 251 | − &ep93xx_d_gpio, | |
| 252 | − &ep93xx_e_gpio, | |
| 253 | − &ep93xx_f_gpio, | |
| 254 | − &ep93xx_g_gpio, | |
| 255 | −}; | |
| 256 | − | |
| 257 | −/************************************************************************* | |
| 258 | − * EP93xx peripheral handling | |
| 259 | − *************************************************************************/ | |
| 260 | −#define EP93XX_UART_MCR_OFFSET (0x0100) | |
| 261 | − | |
| 262 | −static void ep93xx_uart_set_mctrl(struct amba_device *dev, | |
| 263 | − void __iomem *base, unsigned int mctrl) | |
| 264 | −{ | |
| 265 | − unsigned int mcr; | |
| 266 | − | |
| 267 | − mcr = 0; | |
| 268 | − if (mctrl & TIOCM_RTS) | |
| 269 | − mcr |= 2; | |
| 270 | − if (mctrl & TIOCM_DTR) | |
| 271 | − mcr |= 1; | |
| 272 | − | |
| 273 | − __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET); | |
| 274 | −} | |
| 275 | − | |
| 276 | −static struct amba_pl010_data ep93xx_uart_data = { | |
| 277 | − .set_mctrl = ep93xx_uart_set_mctrl, | |
| 278 | −}; | |
| 279 | − | |
| 280 | −static AMBA_APB_DEVICE(uart1, "apb:uart1", 0x00041010, EP93XX_UART1_PHYS_BASE, | |
| 281 | − { IRQ_EP93XX_UART1 }, &ep93xx_uart_data); | |
| 282 | − | |
| 283 | −static AMBA_APB_DEVICE(uart2, "apb:uart2", 0x00041010, EP93XX_UART2_PHYS_BASE, | |
| 284 | − { IRQ_EP93XX_UART2 }, NULL); | |
| 285 | − | |
| 286 | −static AMBA_APB_DEVICE(uart3, "apb:uart3", 0x00041010, EP93XX_UART3_PHYS_BASE, | |
| 287 | − { IRQ_EP93XX_UART3 }, &ep93xx_uart_data); | |
| 288 | − | |
| 289 | −static struct resource ep93xx_rtc_resource[] = { | |
| 290 | − DEFINE_RES_MEM(EP93XX_RTC_PHYS_BASE, 0x10c), | |
| 291 | −}; | |
| 292 | − | |
| 293 | −static struct platform_device ep93xx_rtc_device = { | |
| 294 | − .name = "ep93xx-rtc", | |
| 295 | − .id = -1, | |
| 296 | − .num_resources = ARRAY_SIZE(ep93xx_rtc_resource), | |
| 297 | − .resource = ep93xx_rtc_resource, | |
| 298 | −}; | |
| 299 | − | |
| 300 | −/************************************************************************* | |
| 301 | − * EP93xx OHCI USB Host | |
| 302 | − *************************************************************************/ | |
| 303 | − | |
| 304 | −static struct clk *ep93xx_ohci_host_clock; | |
| 305 | − | |
| 306 | −static int ep93xx_ohci_power_on(struct platform_device *pdev) | |
| 307 | −{ | |
| 308 | − if (!ep93xx_ohci_host_clock) { | |
| 309 | − ep93xx_ohci_host_clock = devm_clk_get(&pdev->dev, NULL); | |
| 310 | − if (IS_ERR(ep93xx_ohci_host_clock)) | |
| 311 | − return PTR_ERR(ep93xx_ohci_host_clock); | |
| 312 | − } | |
| 313 | − | |
| 314 | − return clk_prepare_enable(ep93xx_ohci_host_clock); | |
| 315 | −} | |
| 316 | − | |
| 317 | −static void ep93xx_ohci_power_off(struct platform_device *pdev) | |
| 318 | −{ | |
| 319 | − clk_disable(ep93xx_ohci_host_clock); | |
| 320 | −} | |
| 321 | − | |
| 322 | −static struct usb_ohci_pdata ep93xx_ohci_pdata = { | |
| 323 | − .power_on = ep93xx_ohci_power_on, | |
| 324 | − .power_off = ep93xx_ohci_power_off, | |
| 325 | − .power_suspend = ep93xx_ohci_power_off, | |
| 326 | −}; | |
| 327 | − | |
| 328 | −static struct resource ep93xx_ohci_resources[] = { | |
| 329 | − DEFINE_RES_MEM(EP93XX_USB_PHYS_BASE, 0x1000), | |
| 330 | − DEFINE_RES_IRQ(IRQ_EP93XX_USB), | |
| 331 | −}; | |
| 332 | − | |
| 333 | −static u64 ep93xx_ohci_dma_mask = DMA_BIT_MASK(32); | |
| 334 | − | |
| 335 | −static struct platform_device ep93xx_ohci_device = { | |
| 336 | − .name = "ohci-platform", | |
| 337 | − .id = -1, | |
| 338 | − .num_resources = ARRAY_SIZE(ep93xx_ohci_resources), | |
| 339 | − .resource = ep93xx_ohci_resources, | |
| 340 | − .dev = { | |
| 341 | − .dma_mask = &ep93xx_ohci_dma_mask, | |
| 342 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 343 | − .platform_data = &ep93xx_ohci_pdata, | |
| 344 | − }, | |
| 345 | −}; | |
| 346 | − | |
| 347 | −/************************************************************************* | |
| 348 | − * EP93xx physmap'ed flash | |
| 349 | − *************************************************************************/ | |
| 350 | −static struct physmap_flash_data ep93xx_flash_data; | |
| 351 | − | |
| 352 | −static struct resource ep93xx_flash_resource = { | |
| 353 | − .flags = IORESOURCE_MEM, | |
| 354 | −}; | |
| 355 | − | |
| 356 | −static struct platform_device ep93xx_flash = { | |
| 357 | − .name = "physmap-flash", | |
| 358 | − .id = 0, | |
| 359 | − .dev = { | |
| 360 | − .platform_data = &ep93xx_flash_data, | |
| 361 | − }, | |
| 362 | − .num_resources = 1, | |
| 363 | − .resource = &ep93xx_flash_resource, | |
| 364 | −}; | |
| 365 | − | |
| 366 | −/** | |
| 367 | − * ep93xx_register_flash() - Register the external flash device. | |
| 368 | − * @width: bank width in octets | |
| 369 | − * @start: resource start address | |
| 370 | − * @size: resource size | |
| 371 | − */ | |
| 372 | −void __init ep93xx_register_flash(unsigned int width, | |
| 373 | − resource_size_t start, resource_size_t size) | |
| 374 | −{ | |
| 375 | − ep93xx_flash_data.width = width; | |
| 376 | − | |
| 377 | − ep93xx_flash_resource.start = start; | |
| 378 | − ep93xx_flash_resource.end = start + size - 1; | |
| 379 | − | |
| 380 | − platform_device_register(&ep93xx_flash); | |
| 381 | −} | |
| 382 | − | |
| 383 | − | |
| 384 | −/************************************************************************* | |
| 385 | − * EP93xx ethernet peripheral handling | |
| 386 | − *************************************************************************/ | |
| 387 | −static struct ep93xx_eth_data ep93xx_eth_data; | |
| 388 | − | |
| 389 | −static struct resource ep93xx_eth_resource[] = { | |
| 390 | − DEFINE_RES_MEM(EP93XX_ETHERNET_PHYS_BASE, 0x10000), | |
| 391 | − DEFINE_RES_IRQ(IRQ_EP93XX_ETHERNET), | |
| 392 | −}; | |
| 393 | − | |
| 394 | −static u64 ep93xx_eth_dma_mask = DMA_BIT_MASK(32); | |
| 395 | − | |
| 396 | −static struct platform_device ep93xx_eth_device = { | |
| 397 | − .name = "ep93xx-eth", | |
| 398 | − .id = -1, | |
| 399 | − .dev = { | |
| 400 | − .platform_data = &ep93xx_eth_data, | |
| 401 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 402 | − .dma_mask = &ep93xx_eth_dma_mask, | |
| 403 | − }, | |
| 404 | − .num_resources = ARRAY_SIZE(ep93xx_eth_resource), | |
| 405 | − .resource = ep93xx_eth_resource, | |
| 406 | −}; | |
| 407 | − | |
| 408 | −/** | |
| 409 | − * ep93xx_register_eth - Register the built-in ethernet platform device. | |
| 410 | − * @data: platform specific ethernet configuration (__initdata) | |
| 411 | − * @copy_addr: flag indicating that the MAC address should be copied | |
| 412 | − * from the IndAd registers (as programmed by the bootloader) | |
| 413 | − */ | |
| 414 | −void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) | |
| 415 | −{ | |
| 416 | − if (copy_addr) | |
| 417 | − memcpy_fromio(data->dev_addr, EP93XX_ETHERNET_BASE + 0x50, 6); | |
| 418 | − | |
| 419 | − ep93xx_eth_data = *data; | |
| 420 | − platform_device_register(&ep93xx_eth_device); | |
| 421 | −} | |
| 422 | − | |
| 423 | − | |
| 424 | −/************************************************************************* | |
| 425 | − * EP93xx i2c peripheral handling | |
| 426 | − *************************************************************************/ | |
| 427 | − | |
| 428 | −/* All EP93xx devices use the same two GPIO pins for I2C bit-banging */ | |
| 429 | −static struct gpiod_lookup_table ep93xx_i2c_gpiod_table = { | |
| 430 | − .dev_id = "i2c-gpio.0", | |
| 431 | − .table = { | |
| 432 | − /* Use local offsets on gpiochip/port "G" */ | |
| 433 | − GPIO_LOOKUP_IDX("gpio-ep93xx.6", 1, NULL, 0, | |
| 434 | − GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | |
| 435 | − GPIO_LOOKUP_IDX("gpio-ep93xx.6", 0, NULL, 1, | |
| 436 | − GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | |
| 437 | − { } | |
| 438 | − }, | |
| 439 | −}; | |
| 440 | − | |
| 441 | −static struct platform_device ep93xx_i2c_device = { | |
| 442 | − .name = "i2c-gpio", | |
| 443 | − .id = 0, | |
| 444 | − .dev = { | |
| 445 | − .platform_data = NULL, | |
| 446 | − }, | |
| 447 | −}; | |
| 448 | − | |
| 449 | −/** | |
| 450 | − * ep93xx_register_i2c - Register the i2c platform device. | |
| 451 | − * @devices: platform specific i2c bus device information (__initdata) | |
| 452 | − * @num: the number of devices on the i2c bus | |
| 453 | − */ | |
| 454 | −void __init ep93xx_register_i2c(struct i2c_board_info *devices, int num) | |
| 455 | −{ | |
| 456 | − /* | |
| 457 | − * FIXME: this just sets the two pins as non-opendrain, as no | |
| 458 | − * platforms tries to do that anyway. Flag the applicable lines | |
| 459 | − * as open drain in the GPIO_LOOKUP above and the driver or | |
| 460 | − * gpiolib will handle open drain/open drain emulation as need | |
| 461 | − * be. Right now i2c-gpio emulates open drain which is not | |
| 462 | − * optimal. | |
| 463 | − */ | |
| 464 | − __raw_writel((0 << 1) | (0 << 0), | |
| 465 | − EP93XX_GPIO_EEDRIVE); | |
| 466 | − | |
| 467 | − i2c_register_board_info(0, devices, num); | |
| 468 | − gpiod_add_lookup_table(&ep93xx_i2c_gpiod_table); | |
| 469 | − platform_device_register(&ep93xx_i2c_device); | |
| 470 | −} | |
| 471 | − | |
| 472 | −/************************************************************************* | |
| 473 | − * EP93xx SPI peripheral handling | |
| 474 | − *************************************************************************/ | |
| 475 | −static struct ep93xx_spi_info ep93xx_spi_master_data; | |
| 476 | − | |
| 477 | −static struct resource ep93xx_spi_resources[] = { | |
| 478 | − DEFINE_RES_MEM(EP93XX_SPI_PHYS_BASE, 0x18), | |
| 479 | − DEFINE_RES_IRQ(IRQ_EP93XX_SSP), | |
| 480 | −}; | |
| 481 | − | |
| 482 | −static u64 ep93xx_spi_dma_mask = DMA_BIT_MASK(32); | |
| 483 | − | |
| 484 | −static struct platform_device ep93xx_spi_device = { | |
| 485 | − .name = "ep93xx-spi", | |
| 486 | − .id = 0, | |
| 487 | − .dev = { | |
| 488 | − .platform_data = &ep93xx_spi_master_data, | |
| 489 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 490 | − .dma_mask = &ep93xx_spi_dma_mask, | |
| 491 | − }, | |
| 492 | − .num_resources = ARRAY_SIZE(ep93xx_spi_resources), | |
| 493 | − .resource = ep93xx_spi_resources, | |
| 494 | −}; | |
| 495 | − | |
| 496 | −/** | |
| 497 | − * ep93xx_register_spi() - registers spi platform device | |
| 498 | − * @info: ep93xx board specific spi master info (__initdata) | |
| 499 | − * @devices: SPI devices to register (__initdata) | |
| 500 | − * @num: number of SPI devices to register | |
| 501 | − * | |
| 502 | − * This function registers platform device for the EP93xx SPI controller and | |
| 503 | − * also makes sure that SPI pins are muxed so that I2S is not using those pins. | |
| 504 | − */ | |
| 505 | −void __init ep93xx_register_spi(struct ep93xx_spi_info *info, | |
| 506 | − struct spi_board_info *devices, int num) | |
| 507 | −{ | |
| 508 | − /* | |
| 509 | − * When SPI is used, we need to make sure that I2S is muxed off from | |
| 510 | − * SPI pins. | |
| 511 | − */ | |
| 512 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2SONSSP); | |
| 513 | − | |
| 514 | − ep93xx_spi_master_data = *info; | |
| 515 | − spi_register_board_info(devices, num); | |
| 516 | − platform_device_register(&ep93xx_spi_device); | |
| 517 | −} | |
| 518 | − | |
| 519 | −/************************************************************************* | |
| 520 | − * EP93xx LEDs | |
| 521 | − *************************************************************************/ | |
| 522 | −static const struct gpio_led ep93xx_led_pins[] __initconst = { | |
| 523 | − { | |
| 524 | − .name = "platform:grled", | |
| 525 | − }, { | |
| 526 | − .name = "platform:rdled", | |
| 527 | − }, | |
| 528 | −}; | |
| 529 | − | |
| 530 | −static const struct gpio_led_platform_data ep93xx_led_data __initconst = { | |
| 531 | − .num_leds = ARRAY_SIZE(ep93xx_led_pins), | |
| 532 | − .leds = ep93xx_led_pins, | |
| 533 | −}; | |
| 534 | − | |
| 535 | −static struct gpiod_lookup_table ep93xx_leds_gpio_table = { | |
| 536 | − .dev_id = "leds-gpio", | |
| 537 | − .table = { | |
| 538 | − /* Use local offsets on gpiochip/port "E" */ | |
| 539 | − GPIO_LOOKUP_IDX("gpio-ep93xx.4", 0, NULL, 0, GPIO_ACTIVE_HIGH), | |
| 540 | − GPIO_LOOKUP_IDX("gpio-ep93xx.4", 1, NULL, 1, GPIO_ACTIVE_HIGH), | |
| 541 | − { } | |
| 542 | − }, | |
| 543 | −}; | |
| 544 | − | |
| 545 | −/************************************************************************* | |
| 546 | − * EP93xx pwm peripheral handling | |
| 547 | − *************************************************************************/ | |
| 548 | −static struct resource ep93xx_pwm0_resource[] = { | |
| 549 | − DEFINE_RES_MEM(EP93XX_PWM_PHYS_BASE, 0x10), | |
| 550 | −}; | |
| 551 | − | |
| 552 | −static struct platform_device ep93xx_pwm0_device = { | |
| 553 | − .name = "ep93xx-pwm", | |
| 554 | − .id = 0, | |
| 555 | − .num_resources = ARRAY_SIZE(ep93xx_pwm0_resource), | |
| 556 | − .resource = ep93xx_pwm0_resource, | |
| 557 | −}; | |
| 558 | − | |
| 559 | −static struct resource ep93xx_pwm1_resource[] = { | |
| 560 | − DEFINE_RES_MEM(EP93XX_PWM_PHYS_BASE + 0x20, 0x10), | |
| 561 | −}; | |
| 562 | − | |
| 563 | −static struct platform_device ep93xx_pwm1_device = { | |
| 564 | − .name = "ep93xx-pwm", | |
| 565 | − .id = 1, | |
| 566 | − .num_resources = ARRAY_SIZE(ep93xx_pwm1_resource), | |
| 567 | − .resource = ep93xx_pwm1_resource, | |
| 568 | −}; | |
| 569 | − | |
| 570 | −void __init ep93xx_register_pwm(int pwm0, int pwm1) | |
| 571 | −{ | |
| 572 | − if (pwm0) | |
| 573 | − platform_device_register(&ep93xx_pwm0_device); | |
| 574 | − | |
| 575 | − /* NOTE: EP9307 does not have PWMOUT1 (pin EGPIO14) */ | |
| 576 | − if (pwm1) | |
| 577 | − platform_device_register(&ep93xx_pwm1_device); | |
| 578 | −} | |
| 579 | − | |
| 580 | −/************************************************************************* | |
| 581 | − * EP93xx video peripheral handling | |
| 582 | − *************************************************************************/ | |
| 583 | −static struct ep93xxfb_mach_info ep93xxfb_data; | |
| 584 | − | |
| 585 | −static struct resource ep93xx_fb_resource[] = { | |
| 586 | − DEFINE_RES_MEM(EP93XX_RASTER_PHYS_BASE, 0x800), | |
| 587 | −}; | |
| 588 | − | |
| 589 | −static struct platform_device ep93xx_fb_device = { | |
| 590 | − .name = "ep93xx-fb", | |
| 591 | − .id = -1, | |
| 592 | − .dev = { | |
| 593 | − .platform_data = &ep93xxfb_data, | |
| 594 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 595 | − .dma_mask = &ep93xx_fb_device.dev.coherent_dma_mask, | |
| 596 | − }, | |
| 597 | − .num_resources = ARRAY_SIZE(ep93xx_fb_resource), | |
| 598 | − .resource = ep93xx_fb_resource, | |
| 599 | −}; | |
| 600 | − | |
| 601 | −/* The backlight use a single register in the framebuffer's register space */ | |
| 602 | −#define EP93XX_RASTER_REG_BRIGHTNESS 0x20 | |
| 603 | − | |
| 604 | −static struct resource ep93xx_bl_resources[] = { | |
| 605 | − DEFINE_RES_MEM(EP93XX_RASTER_PHYS_BASE + | |
| 606 | − EP93XX_RASTER_REG_BRIGHTNESS, 0x04), | |
| 607 | −}; | |
| 608 | − | |
| 609 | −static struct platform_device ep93xx_bl_device = { | |
| 610 | − .name = "ep93xx-bl", | |
| 611 | − .id = -1, | |
| 612 | − .num_resources = ARRAY_SIZE(ep93xx_bl_resources), | |
| 613 | − .resource = ep93xx_bl_resources, | |
| 614 | −}; | |
| 615 | − | |
| 616 | −/** | |
| 617 | − * ep93xx_register_fb - Register the framebuffer platform device. | |
| 618 | − * @data: platform specific framebuffer configuration (__initdata) | |
| 619 | − */ | |
| 620 | −void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data) | |
| 621 | −{ | |
| 622 | − ep93xxfb_data = *data; | |
| 623 | − platform_device_register(&ep93xx_fb_device); | |
| 624 | − platform_device_register(&ep93xx_bl_device); | |
| 625 | −} | |
| 626 | − | |
| 627 | − | |
| 628 | −/************************************************************************* | |
| 629 | − * EP93xx matrix keypad peripheral handling | |
| 630 | − *************************************************************************/ | |
| 631 | −static struct ep93xx_keypad_platform_data ep93xx_keypad_data; | |
| 632 | − | |
| 633 | −static struct resource ep93xx_keypad_resource[] = { | |
| 634 | − DEFINE_RES_MEM(EP93XX_KEY_MATRIX_PHYS_BASE, 0x0c), | |
| 635 | − DEFINE_RES_IRQ(IRQ_EP93XX_KEY), | |
| 636 | −}; | |
| 637 | − | |
| 638 | −static struct platform_device ep93xx_keypad_device = { | |
| 639 | − .name = "ep93xx-keypad", | |
| 640 | − .id = -1, | |
| 641 | − .dev = { | |
| 642 | − .platform_data = &ep93xx_keypad_data, | |
| 643 | − }, | |
| 644 | − .num_resources = ARRAY_SIZE(ep93xx_keypad_resource), | |
| 645 | − .resource = ep93xx_keypad_resource, | |
| 646 | −}; | |
| 647 | − | |
| 648 | −/** | |
| 649 | − * ep93xx_register_keypad - Register the keypad platform device. | |
| 650 | − * @data: platform specific keypad configuration (__initdata) | |
| 651 | − */ | |
| 652 | −void __init ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data) | |
| 653 | −{ | |
| 654 | − ep93xx_keypad_data = *data; | |
| 655 | − platform_device_register(&ep93xx_keypad_device); | |
| 656 | −} | |
| 657 | − | |
| 658 | −/************************************************************************* | |
| 659 | − * EP93xx I2S audio peripheral handling | |
| 660 | − *************************************************************************/ | |
| 661 | −static struct resource ep93xx_i2s_resource[] = { | |
| 662 | − DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100), | |
| 663 | − DEFINE_RES_IRQ(IRQ_EP93XX_SAI), | |
| 664 | −}; | |
| 665 | − | |
| 666 | −static struct platform_device ep93xx_i2s_device = { | |
| 667 | − .name = "ep93xx-i2s", | |
| 668 | − .id = -1, | |
| 669 | − .num_resources = ARRAY_SIZE(ep93xx_i2s_resource), | |
| 670 | − .resource = ep93xx_i2s_resource, | |
| 671 | −}; | |
| 672 | − | |
| 673 | −static struct platform_device ep93xx_pcm_device = { | |
| 674 | − .name = "ep93xx-pcm-audio", | |
| 675 | − .id = -1, | |
| 676 | −}; | |
| 677 | − | |
| 678 | −void __init ep93xx_register_i2s(void) | |
| 679 | −{ | |
| 680 | − platform_device_register(&ep93xx_i2s_device); | |
| 681 | − platform_device_register(&ep93xx_pcm_device); | |
| 682 | −} | |
| 683 | − | |
| 684 | −#define EP93XX_SYSCON_DEVCFG_I2S_MASK (EP93XX_SYSCON_DEVCFG_I2SONSSP | \ | |
| 685 | − EP93XX_SYSCON_DEVCFG_I2SONAC97) | |
| 686 | − | |
| 687 | −#define EP93XX_I2SCLKDIV_MASK (EP93XX_SYSCON_I2SCLKDIV_ORIDE | \ | |
| 688 | − EP93XX_SYSCON_I2SCLKDIV_SPOL) | |
| 689 | − | |
| 690 | −int ep93xx_i2s_acquire(void) | |
| 691 | −{ | |
| 692 | − unsigned val; | |
| 693 | − | |
| 694 | − ep93xx_devcfg_set_clear(EP93XX_SYSCON_DEVCFG_I2SONAC97, | |
| 695 | − EP93XX_SYSCON_DEVCFG_I2S_MASK); | |
| 696 | − | |
| 697 | − /* | |
| 698 | − * This is potentially racy with the clock api for i2s_mclk, sclk and | |
| 699 | − * lrclk. Since the i2s driver is the only user of those clocks we | |
| 700 | − * rely on it to prevent parallel use of this function and the | |
| 701 | − * clock api for the i2s clocks. | |
| 702 | − */ | |
| 703 | − val = __raw_readl(EP93XX_SYSCON_I2SCLKDIV); | |
| 704 | − val &= ~EP93XX_I2SCLKDIV_MASK; | |
| 705 | − val |= EP93XX_SYSCON_I2SCLKDIV_ORIDE | EP93XX_SYSCON_I2SCLKDIV_SPOL; | |
| 706 | − ep93xx_syscon_swlocked_write(val, EP93XX_SYSCON_I2SCLKDIV); | |
| 707 | − | |
| 708 | − return 0; | |
| 709 | −} | |
| 710 | −EXPORT_SYMBOL(ep93xx_i2s_acquire); | |
| 711 | − | |
| 712 | −void ep93xx_i2s_release(void) | |
| 713 | −{ | |
| 714 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2S_MASK); | |
| 715 | −} | |
| 716 | −EXPORT_SYMBOL(ep93xx_i2s_release); | |
| 717 | − | |
| 718 | −/************************************************************************* | |
| 719 | − * EP93xx AC97 audio peripheral handling | |
| 720 | − *************************************************************************/ | |
| 721 | −static struct resource ep93xx_ac97_resources[] = { | |
| 722 | − DEFINE_RES_MEM(EP93XX_AAC_PHYS_BASE, 0xac), | |
| 723 | − DEFINE_RES_IRQ(IRQ_EP93XX_AACINTR), | |
| 724 | −}; | |
| 725 | − | |
| 726 | −static struct platform_device ep93xx_ac97_device = { | |
| 727 | − .name = "ep93xx-ac97", | |
| 728 | − .id = -1, | |
| 729 | − .num_resources = ARRAY_SIZE(ep93xx_ac97_resources), | |
| 730 | − .resource = ep93xx_ac97_resources, | |
| 731 | −}; | |
| 732 | − | |
| 733 | −void __init ep93xx_register_ac97(void) | |
| 734 | −{ | |
| 735 | − /* | |
| 736 | − * Make sure that the AC97 pins are not used by I2S. | |
| 737 | − */ | |
| 738 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97); | |
| 739 | − | |
| 740 | − platform_device_register(&ep93xx_ac97_device); | |
| 741 | − platform_device_register(&ep93xx_pcm_device); | |
| 742 | −} | |
| 743 | − | |
| 744 | −/************************************************************************* | |
| 745 | − * EP93xx Watchdog | |
| 746 | − *************************************************************************/ | |
| 747 | −static struct resource ep93xx_wdt_resources[] = { | |
| 748 | − DEFINE_RES_MEM(EP93XX_WATCHDOG_PHYS_BASE, 0x08), | |
| 749 | −}; | |
| 750 | − | |
| 751 | −static struct platform_device ep93xx_wdt_device = { | |
| 752 | − .name = "ep93xx-wdt", | |
| 753 | − .id = -1, | |
| 754 | − .num_resources = ARRAY_SIZE(ep93xx_wdt_resources), | |
| 755 | − .resource = ep93xx_wdt_resources, | |
| 756 | −}; | |
| 757 | − | |
| 758 | −/************************************************************************* | |
| 759 | − * EP93xx IDE | |
| 760 | − *************************************************************************/ | |
| 761 | −static struct resource ep93xx_ide_resources[] = { | |
| 762 | − DEFINE_RES_MEM(EP93XX_IDE_PHYS_BASE, 0x38), | |
| 763 | − DEFINE_RES_IRQ(IRQ_EP93XX_EXT3), | |
| 764 | −}; | |
| 765 | − | |
| 766 | −static struct platform_device ep93xx_ide_device = { | |
| 767 | − .name = "ep93xx-ide", | |
| 768 | − .id = -1, | |
| 769 | − .dev = { | |
| 770 | − .dma_mask = &ep93xx_ide_device.dev.coherent_dma_mask, | |
| 771 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 772 | − }, | |
| 773 | − .num_resources = ARRAY_SIZE(ep93xx_ide_resources), | |
| 774 | − .resource = ep93xx_ide_resources, | |
| 775 | −}; | |
| 776 | − | |
| 777 | −void __init ep93xx_register_ide(void) | |
| 778 | −{ | |
| 779 | − platform_device_register(&ep93xx_ide_device); | |
| 780 | −} | |
| 781 | − | |
| 782 | −/************************************************************************* | |
| 783 | − * EP93xx ADC | |
| 784 | − *************************************************************************/ | |
| 785 | −static struct resource ep93xx_adc_resources[] = { | |
| 786 | − DEFINE_RES_MEM(EP93XX_ADC_PHYS_BASE, 0x28), | |
| 787 | − DEFINE_RES_IRQ(IRQ_EP93XX_TOUCH), | |
| 788 | −}; | |
| 789 | − | |
| 790 | −static struct platform_device ep93xx_adc_device = { | |
| 791 | − .name = "ep93xx-adc", | |
| 792 | − .id = -1, | |
| 793 | − .num_resources = ARRAY_SIZE(ep93xx_adc_resources), | |
| 794 | − .resource = ep93xx_adc_resources, | |
| 795 | −}; | |
| 796 | − | |
| 797 | −void __init ep93xx_register_adc(void) | |
| 798 | −{ | |
| 799 | − /* Power up ADC, deactivate Touch Screen Controller */ | |
| 800 | − ep93xx_devcfg_set_clear(EP93XX_SYSCON_DEVCFG_TIN, | |
| 801 | − EP93XX_SYSCON_DEVCFG_ADCPD); | |
| 802 | − | |
| 803 | − platform_device_register(&ep93xx_adc_device); | |
| 804 | −} | |
| 805 | − | |
| 806 | −/************************************************************************* | |
| 807 | − * EP93xx Security peripheral | |
| 808 | − *************************************************************************/ | |
| 809 | − | |
| 810 | −/* | |
| 811 | − * The Maverick Key is 256 bits of micro fuses blown at the factory during | |
| 812 | − * manufacturing to uniquely identify a part. | |
| 813 | − * | |
| 814 | − * See: http://arm.cirrus.com/forum/viewtopic.php?t=486&highlight=maverick+key | |
| 815 | − */ | |
| 816 | −#define EP93XX_SECURITY_REG(x) (EP93XX_SECURITY_BASE + (x)) | |
| 817 | −#define EP93XX_SECURITY_SECFLG EP93XX_SECURITY_REG(0x2400) | |
| 818 | −#define EP93XX_SECURITY_FUSEFLG EP93XX_SECURITY_REG(0x2410) | |
| 819 | −#define EP93XX_SECURITY_UNIQID EP93XX_SECURITY_REG(0x2440) | |
| 820 | −#define EP93XX_SECURITY_UNIQCHK EP93XX_SECURITY_REG(0x2450) | |
| 821 | −#define EP93XX_SECURITY_UNIQVAL EP93XX_SECURITY_REG(0x2460) | |
| 822 | −#define EP93XX_SECURITY_SECID1 EP93XX_SECURITY_REG(0x2500) | |
| 823 | −#define EP93XX_SECURITY_SECID2 EP93XX_SECURITY_REG(0x2504) | |
| 824 | −#define EP93XX_SECURITY_SECCHK1 EP93XX_SECURITY_REG(0x2520) | |
| 825 | −#define EP93XX_SECURITY_SECCHK2 EP93XX_SECURITY_REG(0x2524) | |
| 826 | −#define EP93XX_SECURITY_UNIQID2 EP93XX_SECURITY_REG(0x2700) | |
| 827 | −#define EP93XX_SECURITY_UNIQID3 EP93XX_SECURITY_REG(0x2704) | |
| 828 | −#define EP93XX_SECURITY_UNIQID4 EP93XX_SECURITY_REG(0x2708) | |
| 829 | −#define EP93XX_SECURITY_UNIQID5 EP93XX_SECURITY_REG(0x270c) | |
| 830 | − | |
| 831 | −static char ep93xx_soc_id[33]; | |
| 832 | − | |
| 833 | −static const char __init *ep93xx_get_soc_id(void) | |
| 834 | −{ | |
| 835 | − unsigned int id, id2, id3, id4, id5; | |
| 836 | − | |
| 837 | − if (__raw_readl(EP93XX_SECURITY_UNIQVAL) != 1) | |
| 838 | − return "bad Hamming code"; | |
| 839 | − | |
| 840 | − id = __raw_readl(EP93XX_SECURITY_UNIQID); | |
| 841 | − id2 = __raw_readl(EP93XX_SECURITY_UNIQID2); | |
| 842 | − id3 = __raw_readl(EP93XX_SECURITY_UNIQID3); | |
| 843 | − id4 = __raw_readl(EP93XX_SECURITY_UNIQID4); | |
| 844 | − id5 = __raw_readl(EP93XX_SECURITY_UNIQID5); | |
| 845 | − | |
| 846 | − if (id != id2) | |
| 847 | − return "invalid"; | |
| 848 | − | |
| 849 | − /* Toss the unique ID into the entropy pool */ | |
| 850 | − add_device_randomness(&id2, 4); | |
| 851 | − add_device_randomness(&id3, 4); | |
| 852 | − add_device_randomness(&id4, 4); | |
| 853 | − add_device_randomness(&id5, 4); | |
| 854 | − | |
| 855 | − snprintf(ep93xx_soc_id, sizeof(ep93xx_soc_id), | |
| 856 | − "%08x%08x%08x%08x", id2, id3, id4, id5); | |
| 857 | − | |
| 858 | − return ep93xx_soc_id; | |
| 859 | −} | |
| 860 | − | |
| 861 | −static const char __init *ep93xx_get_soc_rev(void) | |
| 862 | −{ | |
| 863 | − int rev = ep93xx_chip_revision(); | |
| 864 | − | |
| 865 | − switch (rev) { | |
| 866 | − case EP93XX_CHIP_REV_D0: | |
| 867 | − return "D0"; | |
| 868 | − case EP93XX_CHIP_REV_D1: | |
| 869 | − return "D1"; | |
| 870 | − case EP93XX_CHIP_REV_E0: | |
| 871 | − return "E0"; | |
| 872 | − case EP93XX_CHIP_REV_E1: | |
| 873 | − return "E1"; | |
| 874 | − case EP93XX_CHIP_REV_E2: | |
| 875 | − return "E2"; | |
| 876 | − default: | |
| 877 | − return "unknown"; | |
| 878 | − } | |
| 879 | −} | |
| 880 | − | |
| 881 | −static const char __init *ep93xx_get_machine_name(void) | |
| 882 | −{ | |
| 883 | − return kasprintf(GFP_KERNEL,"%s", machine_desc->name); | |
| 884 | −} | |
| 885 | − | |
| 886 | −static struct device __init *ep93xx_init_soc(void) | |
| 887 | −{ | |
| 888 | − struct soc_device_attribute *soc_dev_attr; | |
| 889 | − struct soc_device *soc_dev; | |
| 890 | − | |
| 891 | − soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); | |
| 892 | − if (!soc_dev_attr) | |
| 893 | − return NULL; | |
| 894 | − | |
| 895 | − soc_dev_attr->machine = ep93xx_get_machine_name(); | |
| 896 | − soc_dev_attr->family = "Cirrus Logic EP93xx"; | |
| 897 | − soc_dev_attr->revision = ep93xx_get_soc_rev(); | |
| 898 | − soc_dev_attr->soc_id = ep93xx_get_soc_id(); | |
| 899 | − | |
| 900 | − soc_dev = soc_device_register(soc_dev_attr); | |
| 901 | − if (IS_ERR(soc_dev)) { | |
| 902 | − kfree(soc_dev_attr->machine); | |
| 903 | − kfree(soc_dev_attr); | |
| 904 | − return NULL; | |
| 905 | − } | |
| 906 | − | |
| 907 | − return soc_device_to_device(soc_dev); | |
| 908 | −} | |
| 909 | − | |
| 910 | −struct device __init *ep93xx_init_devices(void) | |
| 911 | −{ | |
| 912 | − struct device *parent; | |
| 913 | − unsigned int i; | |
| 914 | − | |
| 915 | − /* Disallow access to MaverickCrunch initially */ | |
| 916 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_CPENA); | |
| 917 | − | |
| 918 | − /* Default all ports to GPIO */ | |
| 919 | − ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_KEYS | | |
| 920 | − EP93XX_SYSCON_DEVCFG_GONK | | |
| 921 | − EP93XX_SYSCON_DEVCFG_EONIDE | | |
| 922 | − EP93XX_SYSCON_DEVCFG_GONIDE | | |
| 923 | − EP93XX_SYSCON_DEVCFG_HONIDE); | |
| 924 | − | |
| 925 | − parent = ep93xx_init_soc(); | |
| 926 | − | |
| 927 | − /* Get the GPIO working early, other devices need it */ | |
| 928 | − for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_device); i++) | |
| 929 | − platform_device_register(ep93xx_gpio_device[i]); | |
| 930 | − | |
| 931 | − amba_device_register(&uart1_device, &iomem_resource); | |
| 932 | − amba_device_register(&uart2_device, &iomem_resource); | |
| 933 | − amba_device_register(&uart3_device, &iomem_resource); | |
| 934 | − | |
| 935 | − platform_device_register(&ep93xx_rtc_device); | |
| 936 | − platform_device_register(&ep93xx_ohci_device); | |
| 937 | − platform_device_register(&ep93xx_wdt_device); | |
| 938 | − | |
| 939 | − gpiod_add_lookup_table(&ep93xx_leds_gpio_table); | |
| 940 | − gpio_led_register_device(-1, &ep93xx_led_data); | |
| 941 | − | |
| 942 | − return parent; | |
| 943 | −} | |
| 944 | − | |
| 945 | −void ep93xx_restart(enum reboot_mode mode, const char *cmd) | |
| 946 | −{ | |
| 947 | − /* | |
| 948 | − * Set then clear the SWRST bit to initiate a software reset | |
| 949 | − */ | |
| 950 | − ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_SWRST); | |
| 951 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_SWRST); | |
| 952 | − | |
| 953 | − while (1) | |
| 954 | − ; | |
| 955 | −} | |
| @@ -1,114 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/dma.c | |
| 4 | − * | |
| 5 | − * Platform support code for the EP93xx dmaengine driver. | |
| 6 | − * | |
| 7 | − * Copyright (C) 2011 Mika Westerberg | |
| 8 | − * | |
| 9 | − * This work is based on the original dma-m2p implementation with | |
| 10 | − * following copyrights: | |
| 11 | − * | |
| 12 | − * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
| 13 | − * Copyright (C) 2006 Applied Data Systems | |
| 14 | − * Copyright (C) 2009 Ryan Mallon <rmallon@gmail.com> | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#include <linux/dmaengine.h> | |
| 18 | −#include <linux/dma-mapping.h> | |
| 19 | −#include <linux/init.h> | |
| 20 | −#include <linux/interrupt.h> | |
| 21 | −#include <linux/kernel.h> | |
| 22 | −#include <linux/platform_device.h> | |
| 23 | − | |
| 24 | −#include <linux/platform_data/dma-ep93xx.h> | |
| 25 | −#include "hardware.h" | |
| 26 | − | |
| 27 | −#include "soc.h" | |
| 28 | − | |
| 29 | −#define DMA_CHANNEL(_name, _base, _irq) \ | |
| 30 | − { .name = (_name), .base = (_base), .irq = (_irq) } | |
| 31 | − | |
| 32 | −/* | |
| 33 | − * DMA M2P channels. | |
| 34 | − * | |
| 35 | − * On the EP93xx chip the following peripherals my be allocated to the 10 | |
| 36 | − * Memory to Internal Peripheral (M2P) channels (5 transmit + 5 receive). | |
| 37 | − * | |
| 38 | − * I2S contains 3 Tx and 3 Rx DMA Channels | |
| 39 | − * AAC contains 3 Tx and 3 Rx DMA Channels | |
| 40 | − * UART1 contains 1 Tx and 1 Rx DMA Channels | |
| 41 | − * UART2 contains 1 Tx and 1 Rx DMA Channels | |
| 42 | − * UART3 contains 1 Tx and 1 Rx DMA Channels | |
| 43 | − * IrDA contains 1 Tx and 1 Rx DMA Channels | |
| 44 | − * | |
| 45 | − * Registers are mapped statically in ep93xx_map_io(). | |
| 46 | − */ | |
| 47 | −static struct ep93xx_dma_chan_data ep93xx_dma_m2p_channels[] = { | |
| 48 | − DMA_CHANNEL("m2p0", EP93XX_DMA_BASE + 0x0000, IRQ_EP93XX_DMAM2P0), | |
| 49 | − DMA_CHANNEL("m2p1", EP93XX_DMA_BASE + 0x0040, IRQ_EP93XX_DMAM2P1), | |
| 50 | − DMA_CHANNEL("m2p2", EP93XX_DMA_BASE + 0x0080, IRQ_EP93XX_DMAM2P2), | |
| 51 | − DMA_CHANNEL("m2p3", EP93XX_DMA_BASE + 0x00c0, IRQ_EP93XX_DMAM2P3), | |
| 52 | − DMA_CHANNEL("m2p4", EP93XX_DMA_BASE + 0x0240, IRQ_EP93XX_DMAM2P4), | |
| 53 | − DMA_CHANNEL("m2p5", EP93XX_DMA_BASE + 0x0200, IRQ_EP93XX_DMAM2P5), | |
| 54 | − DMA_CHANNEL("m2p6", EP93XX_DMA_BASE + 0x02c0, IRQ_EP93XX_DMAM2P6), | |
| 55 | − DMA_CHANNEL("m2p7", EP93XX_DMA_BASE + 0x0280, IRQ_EP93XX_DMAM2P7), | |
| 56 | − DMA_CHANNEL("m2p8", EP93XX_DMA_BASE + 0x0340, IRQ_EP93XX_DMAM2P8), | |
| 57 | − DMA_CHANNEL("m2p9", EP93XX_DMA_BASE + 0x0300, IRQ_EP93XX_DMAM2P9), | |
| 58 | −}; | |
| 59 | − | |
| 60 | −static struct ep93xx_dma_platform_data ep93xx_dma_m2p_data = { | |
| 61 | − .channels = ep93xx_dma_m2p_channels, | |
| 62 | − .num_channels = ARRAY_SIZE(ep93xx_dma_m2p_channels), | |
| 63 | −}; | |
| 64 | − | |
| 65 | −static u64 ep93xx_dma_m2p_mask = DMA_BIT_MASK(32); | |
| 66 | − | |
| 67 | −static struct platform_device ep93xx_dma_m2p_device = { | |
| 68 | − .name = "ep93xx-dma-m2p", | |
| 69 | − .id = -1, | |
| 70 | − .dev = { | |
| 71 | − .platform_data = &ep93xx_dma_m2p_data, | |
| 72 | − .dma_mask = &ep93xx_dma_m2p_mask, | |
| 73 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 74 | − }, | |
| 75 | −}; | |
| 76 | − | |
| 77 | −/* | |
| 78 | − * DMA M2M channels. | |
| 79 | − * | |
| 80 | − * There are 2 M2M channels which support memcpy/memset and in addition simple | |
| 81 | − * hardware requests from/to SSP and IDE. We do not implement an external | |
| 82 | − * hardware requests. | |
| 83 | − * | |
| 84 | − * Registers are mapped statically in ep93xx_map_io(). | |
| 85 | − */ | |
| 86 | −static struct ep93xx_dma_chan_data ep93xx_dma_m2m_channels[] = { | |
| 87 | − DMA_CHANNEL("m2m0", EP93XX_DMA_BASE + 0x0100, IRQ_EP93XX_DMAM2M0), | |
| 88 | − DMA_CHANNEL("m2m1", EP93XX_DMA_BASE + 0x0140, IRQ_EP93XX_DMAM2M1), | |
| 89 | −}; | |
| 90 | − | |
| 91 | −static struct ep93xx_dma_platform_data ep93xx_dma_m2m_data = { | |
| 92 | − .channels = ep93xx_dma_m2m_channels, | |
| 93 | − .num_channels = ARRAY_SIZE(ep93xx_dma_m2m_channels), | |
| 94 | −}; | |
| 95 | − | |
| 96 | −static u64 ep93xx_dma_m2m_mask = DMA_BIT_MASK(32); | |
| 97 | − | |
| 98 | −static struct platform_device ep93xx_dma_m2m_device = { | |
| 99 | − .name = "ep93xx-dma-m2m", | |
| 100 | − .id = -1, | |
| 101 | − .dev = { | |
| 102 | − .platform_data = &ep93xx_dma_m2m_data, | |
| 103 | − .dma_mask = &ep93xx_dma_m2m_mask, | |
| 104 | − .coherent_dma_mask = DMA_BIT_MASK(32), | |
| 105 | − }, | |
| 106 | −}; | |
| 107 | − | |
| 108 | −static int __init ep93xx_dma_init(void) | |
| 109 | −{ | |
| 110 | − platform_device_register(&ep93xx_dma_m2p_device); | |
| 111 | − platform_device_register(&ep93xx_dma_m2m_device); | |
| 112 | − return 0; | |
| 113 | −} | |
| 114 | −arch_initcall(ep93xx_dma_init); | |
| @@ -1,368 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/edb93xx.c | |
| 4 | − * Cirrus Logic EDB93xx Development Board support. | |
| 5 | − * | |
| 6 | − * EDB93XX, EDB9301, EDB9307A | |
| 7 | − * Copyright (C) 2008-2009 H Hartley Sweeten <hsweeten@visionengravers.com> | |
| 8 | − * | |
| 9 | − * EDB9302 | |
| 10 | − * Copyright (C) 2006 George Kashperko <george@chas.com.ua> | |
| 11 | − * | |
| 12 | − * EDB9302A, EDB9315, EDB9315A | |
| 13 | − * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
| 14 | − * | |
| 15 | − * EDB9307 | |
| 16 | − * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org> | |
| 17 | − * | |
| 18 | − * EDB9312 | |
| 19 | − * Copyright (C) 2006 Infosys Technologies Limited | |
| 20 | − * Toufeeq Hussain <toufeeq_hussain@infosys.com> | |
| 21 | − */ | |
| 22 | − | |
| 23 | −#include <linux/kernel.h> | |
| 24 | −#include <linux/init.h> | |
| 25 | −#include <linux/platform_device.h> | |
| 26 | −#include <linux/i2c.h> | |
| 27 | −#include <linux/spi/spi.h> | |
| 28 | −#include <linux/gpio/machine.h> | |
| 29 | − | |
| 30 | −#include <sound/cs4271.h> | |
| 31 | − | |
| 32 | −#include "hardware.h" | |
| 33 | −#include <linux/platform_data/video-ep93xx.h> | |
| 34 | −#include <linux/platform_data/spi-ep93xx.h> | |
| 35 | −#include "gpio-ep93xx.h" | |
| 36 | − | |
| 37 | −#include <asm/mach-types.h> | |
| 38 | −#include <asm/mach/arch.h> | |
| 39 | − | |
| 40 | −#include "soc.h" | |
| 41 | − | |
| 42 | −static void __init edb93xx_register_flash(void) | |
| 43 | −{ | |
| 44 | − if (machine_is_edb9307() || machine_is_edb9312() || | |
| 45 | − machine_is_edb9315()) { | |
| 46 | − ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); | |
| 47 | − } else { | |
| 48 | − ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); | |
| 49 | − } | |
| 50 | −} | |
| 51 | − | |
| 52 | −static struct ep93xx_eth_data __initdata edb93xx_eth_data = { | |
| 53 | − .phy_id = 1, | |
| 54 | −}; | |
| 55 | − | |
| 56 | − | |
| 57 | −/************************************************************************* | |
| 58 | − * EDB93xx i2c peripheral handling | |
| 59 | − *************************************************************************/ | |
| 60 | − | |
| 61 | −static struct i2c_board_info __initdata edb93xxa_i2c_board_info[] = { | |
| 62 | − { | |
| 63 | − I2C_BOARD_INFO("isl1208", 0x6f), | |
| 64 | − }, | |
| 65 | −}; | |
| 66 | − | |
| 67 | −static struct i2c_board_info __initdata edb93xx_i2c_board_info[] = { | |
| 68 | − { | |
| 69 | − I2C_BOARD_INFO("ds1337", 0x68), | |
| 70 | − }, | |
| 71 | −}; | |
| 72 | − | |
| 73 | −static void __init edb93xx_register_i2c(void) | |
| 74 | −{ | |
| 75 | − if (machine_is_edb9302a() || machine_is_edb9307a() || | |
| 76 | − machine_is_edb9315a()) { | |
| 77 | − ep93xx_register_i2c(edb93xxa_i2c_board_info, | |
| 78 | − ARRAY_SIZE(edb93xxa_i2c_board_info)); | |
| 79 | − } else if (machine_is_edb9302() || machine_is_edb9307() | |
| 80 | − || machine_is_edb9312() || machine_is_edb9315()) { | |
| 81 | − ep93xx_register_i2c(edb93xx_i2c_board_info, | |
| 82 | − ARRAY_SIZE(edb93xx_i2c_board_info)); | |
| 83 | − } | |
| 84 | −} | |
| 85 | − | |
| 86 | − | |
| 87 | −/************************************************************************* | |
| 88 | − * EDB93xx SPI peripheral handling | |
| 89 | − *************************************************************************/ | |
| 90 | −static struct cs4271_platform_data edb93xx_cs4271_data = { | |
| 91 | − /* Intentionally left blank */ | |
| 92 | −}; | |
| 93 | − | |
| 94 | −static struct spi_board_info edb93xx_spi_board_info[] __initdata = { | |
| 95 | − { | |
| 96 | − .modalias = "cs4271", | |
| 97 | − .platform_data = &edb93xx_cs4271_data, | |
| 98 | − .max_speed_hz = 6000000, | |
| 99 | − .bus_num = 0, | |
| 100 | − .chip_select = 0, | |
| 101 | − .mode = SPI_MODE_3, | |
| 102 | − }, | |
| 103 | −}; | |
| 104 | − | |
| 105 | −static struct gpiod_lookup_table edb93xx_spi_cs_gpio_table = { | |
| 106 | − .dev_id = "spi0", | |
| 107 | − .table = { | |
| 108 | − GPIO_LOOKUP("gpio-ep93xx.0", 6, "cs", GPIO_ACTIVE_LOW), | |
| 109 | − { }, | |
| 110 | − }, | |
| 111 | −}; | |
| 112 | − | |
| 113 | −static struct ep93xx_spi_info edb93xx_spi_info __initdata = { | |
| 114 | − /* Intentionally left blank */ | |
| 115 | −}; | |
| 116 | − | |
| 117 | −static struct gpiod_lookup_table edb93xx_cs4272_edb9301_gpio_table = { | |
| 118 | − .dev_id = "spi0.0", /* CS0 on SPI0 */ | |
| 119 | − .table = { | |
| 120 | − GPIO_LOOKUP("A", 1, "reset", GPIO_ACTIVE_LOW), | |
| 121 | − { }, | |
| 122 | − }, | |
| 123 | −}; | |
| 124 | − | |
| 125 | −static struct gpiod_lookup_table edb93xx_cs4272_edb9302_gpio_table = { | |
| 126 | − .dev_id = "spi0.0", /* CS0 on SPI0 */ | |
| 127 | − .table = { | |
| 128 | − GPIO_LOOKUP("H", 2, "reset", GPIO_ACTIVE_LOW), | |
| 129 | − { }, | |
| 130 | − }, | |
| 131 | −}; | |
| 132 | − | |
| 133 | −static struct gpiod_lookup_table edb93xx_cs4272_edb9315_gpio_table = { | |
| 134 | − .dev_id = "spi0.0", /* CS0 on SPI0 */ | |
| 135 | − .table = { | |
| 136 | − GPIO_LOOKUP("B", 6, "reset", GPIO_ACTIVE_LOW), | |
| 137 | − { }, | |
| 138 | − }, | |
| 139 | −}; | |
| 140 | − | |
| 141 | −static void __init edb93xx_register_spi(void) | |
| 142 | −{ | |
| 143 | − if (machine_is_edb9301() || machine_is_edb9302()) | |
| 144 | − gpiod_add_lookup_table(&edb93xx_cs4272_edb9301_gpio_table); | |
| 145 | − else if (machine_is_edb9302a() || machine_is_edb9307a()) | |
| 146 | − gpiod_add_lookup_table(&edb93xx_cs4272_edb9302_gpio_table); | |
| 147 | − else if (machine_is_edb9315a()) | |
| 148 | − gpiod_add_lookup_table(&edb93xx_cs4272_edb9315_gpio_table); | |
| 149 | − | |
| 150 | − gpiod_add_lookup_table(&edb93xx_spi_cs_gpio_table); | |
| 151 | − ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info, | |
| 152 | − ARRAY_SIZE(edb93xx_spi_board_info)); | |
| 153 | −} | |
| 154 | − | |
| 155 | − | |
| 156 | −/************************************************************************* | |
| 157 | − * EDB93xx I2S | |
| 158 | − *************************************************************************/ | |
| 159 | −static struct platform_device edb93xx_audio_device = { | |
| 160 | − .name = "edb93xx-audio", | |
| 161 | − .id = -1, | |
| 162 | −}; | |
| 163 | − | |
| 164 | −static int __init edb93xx_has_audio(void) | |
| 165 | −{ | |
| 166 | − return (machine_is_edb9301() || machine_is_edb9302() || | |
| 167 | − machine_is_edb9302a() || machine_is_edb9307a() || | |
| 168 | − machine_is_edb9315a()); | |
| 169 | −} | |
| 170 | − | |
| 171 | −static void __init edb93xx_register_i2s(void) | |
| 172 | −{ | |
| 173 | − if (edb93xx_has_audio()) { | |
| 174 | − ep93xx_register_i2s(); | |
| 175 | − platform_device_register(&edb93xx_audio_device); | |
| 176 | − } | |
| 177 | −} | |
| 178 | − | |
| 179 | − | |
| 180 | −/************************************************************************* | |
| 181 | − * EDB93xx pwm | |
| 182 | − *************************************************************************/ | |
| 183 | −static void __init edb93xx_register_pwm(void) | |
| 184 | −{ | |
| 185 | − if (machine_is_edb9301() || | |
| 186 | − machine_is_edb9302() || machine_is_edb9302a()) { | |
| 187 | − /* EP9301 and EP9302 only have pwm.1 (EGPIO14) */ | |
| 188 | − ep93xx_register_pwm(0, 1); | |
| 189 | − } else if (machine_is_edb9307() || machine_is_edb9307a()) { | |
| 190 | − /* EP9307 only has pwm.0 (PWMOUT) */ | |
| 191 | − ep93xx_register_pwm(1, 0); | |
| 192 | − } else { | |
| 193 | − /* EP9312 and EP9315 have both */ | |
| 194 | − ep93xx_register_pwm(1, 1); | |
| 195 | − } | |
| 196 | −} | |
| 197 | − | |
| 198 | − | |
| 199 | −/************************************************************************* | |
| 200 | − * EDB93xx framebuffer | |
| 201 | − *************************************************************************/ | |
| 202 | −static struct ep93xxfb_mach_info __initdata edb93xxfb_info = { | |
| 203 | − .flags = 0, | |
| 204 | −}; | |
| 205 | − | |
| 206 | −static int __init edb93xx_has_fb(void) | |
| 207 | −{ | |
| 208 | − /* These platforms have an ep93xx with video capability */ | |
| 209 | − return machine_is_edb9307() || machine_is_edb9307a() || | |
| 210 | − machine_is_edb9312() || machine_is_edb9315() || | |
| 211 | − machine_is_edb9315a(); | |
| 212 | −} | |
| 213 | − | |
| 214 | −static void __init edb93xx_register_fb(void) | |
| 215 | −{ | |
| 216 | − if (!edb93xx_has_fb()) | |
| 217 | − return; | |
| 218 | − | |
| 219 | − if (machine_is_edb9307a() || machine_is_edb9315a()) | |
| 220 | − edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN0; | |
| 221 | − else | |
| 222 | − edb93xxfb_info.flags |= EP93XXFB_USE_SDCSN3; | |
| 223 | − | |
| 224 | − ep93xx_register_fb(&edb93xxfb_info); | |
| 225 | −} | |
| 226 | − | |
| 227 | − | |
| 228 | −/************************************************************************* | |
| 229 | − * EDB93xx IDE | |
| 230 | − *************************************************************************/ | |
| 231 | −static int __init edb93xx_has_ide(void) | |
| 232 | −{ | |
| 233 | − /* | |
| 234 | − * Although EDB9312 and EDB9315 do have IDE capability, they have | |
| 235 | − * INTRQ line wired as pull-up, which makes using IDE interface | |
| 236 | − * problematic. | |
| 237 | − */ | |
| 238 | − return machine_is_edb9312() || machine_is_edb9315() || | |
| 239 | − machine_is_edb9315a(); | |
| 240 | −} | |
| 241 | − | |
| 242 | −static void __init edb93xx_register_ide(void) | |
| 243 | −{ | |
| 244 | − if (!edb93xx_has_ide()) | |
| 245 | − return; | |
| 246 | − | |
| 247 | − ep93xx_register_ide(); | |
| 248 | −} | |
| 249 | − | |
| 250 | − | |
| 251 | −static void __init edb93xx_init_machine(void) | |
| 252 | −{ | |
| 253 | − ep93xx_init_devices(); | |
| 254 | − edb93xx_register_flash(); | |
| 255 | − ep93xx_register_eth(&edb93xx_eth_data, 1); | |
| 256 | − edb93xx_register_i2c(); | |
| 257 | − edb93xx_register_spi(); | |
| 258 | − edb93xx_register_i2s(); | |
| 259 | − edb93xx_register_pwm(); | |
| 260 | − edb93xx_register_fb(); | |
| 261 | − edb93xx_register_ide(); | |
| 262 | − ep93xx_register_adc(); | |
| 263 | −} | |
| 264 | − | |
| 265 | − | |
| 266 | −#ifdef CONFIG_MACH_EDB9301 | |
| 267 | −MACHINE_START(EDB9301, "Cirrus Logic EDB9301 Evaluation Board") | |
| 268 | − /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ | |
| 269 | − .atag_offset = 0x100, | |
| 270 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 271 | − .map_io = ep93xx_map_io, | |
| 272 | − .init_irq = ep93xx_init_irq, | |
| 273 | − .init_time = ep93xx_timer_init, | |
| 274 | − .init_machine = edb93xx_init_machine, | |
| 275 | − .restart = ep93xx_restart, | |
| 276 | −MACHINE_END | |
| 277 | −#endif | |
| 278 | − | |
| 279 | −#ifdef CONFIG_MACH_EDB9302 | |
| 280 | −MACHINE_START(EDB9302, "Cirrus Logic EDB9302 Evaluation Board") | |
| 281 | − /* Maintainer: George Kashperko <george@chas.com.ua> */ | |
| 282 | − .atag_offset = 0x100, | |
| 283 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 284 | − .map_io = ep93xx_map_io, | |
| 285 | − .init_irq = ep93xx_init_irq, | |
| 286 | − .init_time = ep93xx_timer_init, | |
| 287 | − .init_machine = edb93xx_init_machine, | |
| 288 | − .restart = ep93xx_restart, | |
| 289 | −MACHINE_END | |
| 290 | −#endif | |
| 291 | − | |
| 292 | −#ifdef CONFIG_MACH_EDB9302A | |
| 293 | −MACHINE_START(EDB9302A, "Cirrus Logic EDB9302A Evaluation Board") | |
| 294 | − /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
| 295 | − .atag_offset = 0x100, | |
| 296 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 297 | − .map_io = ep93xx_map_io, | |
| 298 | − .init_irq = ep93xx_init_irq, | |
| 299 | − .init_time = ep93xx_timer_init, | |
| 300 | − .init_machine = edb93xx_init_machine, | |
| 301 | − .restart = ep93xx_restart, | |
| 302 | −MACHINE_END | |
| 303 | −#endif | |
| 304 | − | |
| 305 | −#ifdef CONFIG_MACH_EDB9307 | |
| 306 | −MACHINE_START(EDB9307, "Cirrus Logic EDB9307 Evaluation Board") | |
| 307 | − /* Maintainer: Herbert Valerio Riedel <hvr@gnu.org> */ | |
| 308 | − .atag_offset = 0x100, | |
| 309 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 310 | − .map_io = ep93xx_map_io, | |
| 311 | − .init_irq = ep93xx_init_irq, | |
| 312 | − .init_time = ep93xx_timer_init, | |
| 313 | − .init_machine = edb93xx_init_machine, | |
| 314 | − .restart = ep93xx_restart, | |
| 315 | −MACHINE_END | |
| 316 | −#endif | |
| 317 | − | |
| 318 | −#ifdef CONFIG_MACH_EDB9307A | |
| 319 | −MACHINE_START(EDB9307A, "Cirrus Logic EDB9307A Evaluation Board") | |
| 320 | − /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ | |
| 321 | − .atag_offset = 0x100, | |
| 322 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 323 | − .map_io = ep93xx_map_io, | |
| 324 | − .init_irq = ep93xx_init_irq, | |
| 325 | − .init_time = ep93xx_timer_init, | |
| 326 | − .init_machine = edb93xx_init_machine, | |
| 327 | − .restart = ep93xx_restart, | |
| 328 | −MACHINE_END | |
| 329 | −#endif | |
| 330 | − | |
| 331 | −#ifdef CONFIG_MACH_EDB9312 | |
| 332 | −MACHINE_START(EDB9312, "Cirrus Logic EDB9312 Evaluation Board") | |
| 333 | − /* Maintainer: Toufeeq Hussain <toufeeq_hussain@infosys.com> */ | |
| 334 | − .atag_offset = 0x100, | |
| 335 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 336 | − .map_io = ep93xx_map_io, | |
| 337 | − .init_irq = ep93xx_init_irq, | |
| 338 | − .init_time = ep93xx_timer_init, | |
| 339 | − .init_machine = edb93xx_init_machine, | |
| 340 | − .restart = ep93xx_restart, | |
| 341 | −MACHINE_END | |
| 342 | −#endif | |
| 343 | − | |
| 344 | −#ifdef CONFIG_MACH_EDB9315 | |
| 345 | −MACHINE_START(EDB9315, "Cirrus Logic EDB9315 Evaluation Board") | |
| 346 | − /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
| 347 | − .atag_offset = 0x100, | |
| 348 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 349 | − .map_io = ep93xx_map_io, | |
| 350 | − .init_irq = ep93xx_init_irq, | |
| 351 | − .init_time = ep93xx_timer_init, | |
| 352 | − .init_machine = edb93xx_init_machine, | |
| 353 | − .restart = ep93xx_restart, | |
| 354 | −MACHINE_END | |
| 355 | −#endif | |
| 356 | − | |
| 357 | −#ifdef CONFIG_MACH_EDB9315A | |
| 358 | −MACHINE_START(EDB9315A, "Cirrus Logic EDB9315A Evaluation Board") | |
| 359 | − /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
| 360 | − .atag_offset = 0x100, | |
| 361 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 362 | − .map_io = ep93xx_map_io, | |
| 363 | − .init_irq = ep93xx_init_irq, | |
| 364 | − .init_time = ep93xx_timer_init, | |
| 365 | − .init_machine = edb93xx_init_machine, | |
| 366 | − .restart = ep93xx_restart, | |
| 367 | −MACHINE_END | |
| 368 | −#endif | |
| @@ -1,38 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef __ASM_ARCH_EP93XX_REGS_H | |
| 3 | −#define __ASM_ARCH_EP93XX_REGS_H | |
| 4 | − | |
| 5 | −/* | |
| 6 | − * EP93xx linux memory map: | |
| 7 | − * | |
| 8 | − * virt phys size | |
| 9 | − * fe800000 5M per-platform mappings | |
| 10 | − * fed00000 80800000 2M APB | |
| 11 | − * fef00000 80000000 1M AHB | |
| 12 | − */ | |
| 13 | − | |
| 14 | −#define EP93XX_AHB_PHYS_BASE 0x80000000 | |
| 15 | −#define EP93XX_AHB_VIRT_BASE 0xfef00000 | |
| 16 | −#define EP93XX_AHB_SIZE 0x00100000 | |
| 17 | − | |
| 18 | −#define EP93XX_AHB_PHYS(x) (EP93XX_AHB_PHYS_BASE + (x)) | |
| 19 | −#define EP93XX_AHB_IOMEM(x) IOMEM(EP93XX_AHB_VIRT_BASE + (x)) | |
| 20 | − | |
| 21 | −#define EP93XX_APB_PHYS_BASE 0x80800000 | |
| 22 | −#define EP93XX_APB_VIRT_BASE 0xfed00000 | |
| 23 | −#define EP93XX_APB_SIZE 0x00200000 | |
| 24 | − | |
| 25 | −#define EP93XX_APB_PHYS(x) (EP93XX_APB_PHYS_BASE + (x)) | |
| 26 | −#define EP93XX_APB_IOMEM(x) IOMEM(EP93XX_APB_VIRT_BASE + (x)) | |
| 27 | − | |
| 28 | −/* APB UARTs */ | |
| 29 | −#define EP93XX_UART1_PHYS_BASE EP93XX_APB_PHYS(0x000c0000) | |
| 30 | −#define EP93XX_UART1_BASE EP93XX_APB_IOMEM(0x000c0000) | |
| 31 | − | |
| 32 | −#define EP93XX_UART2_PHYS_BASE EP93XX_APB_PHYS(0x000d0000) | |
| 33 | −#define EP93XX_UART2_BASE EP93XX_APB_IOMEM(0x000d0000) | |
| 34 | − | |
| 35 | −#define EP93XX_UART3_PHYS_BASE EP93XX_APB_PHYS(0x000e0000) | |
| 36 | −#define EP93XX_UART3_BASE EP93XX_APB_IOMEM(0x000e0000) | |
| 37 | − | |
| 38 | −#endif | |
| @@ -1,111 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* Include file for the EP93XX GPIO controller machine specifics */ | |
| 3 | − | |
| 4 | −#ifndef __GPIO_EP93XX_H | |
| 5 | −#define __GPIO_EP93XX_H | |
| 6 | − | |
| 7 | −#include "ep93xx-regs.h" | |
| 8 | − | |
| 9 | −#define EP93XX_GPIO_PHYS_BASE EP93XX_APB_PHYS(0x00040000) | |
| 10 | −#define EP93XX_GPIO_BASE EP93XX_APB_IOMEM(0x00040000) | |
| 11 | −#define EP93XX_GPIO_REG(x) (EP93XX_GPIO_BASE + (x)) | |
| 12 | −#define EP93XX_GPIO_F_INT_STATUS EP93XX_GPIO_REG(0x5c) | |
| 13 | −#define EP93XX_GPIO_A_INT_STATUS EP93XX_GPIO_REG(0xa0) | |
| 14 | −#define EP93XX_GPIO_B_INT_STATUS EP93XX_GPIO_REG(0xbc) | |
| 15 | −#define EP93XX_GPIO_EEDRIVE EP93XX_GPIO_REG(0xc8) | |
| 16 | − | |
| 17 | −/* GPIO port A. */ | |
| 18 | −#define EP93XX_GPIO_LINE_A(x) ((x) + 0) | |
| 19 | −#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0) | |
| 20 | −#define EP93XX_GPIO_LINE_EGPIO1 EP93XX_GPIO_LINE_A(1) | |
| 21 | −#define EP93XX_GPIO_LINE_EGPIO2 EP93XX_GPIO_LINE_A(2) | |
| 22 | −#define EP93XX_GPIO_LINE_EGPIO3 EP93XX_GPIO_LINE_A(3) | |
| 23 | −#define EP93XX_GPIO_LINE_EGPIO4 EP93XX_GPIO_LINE_A(4) | |
| 24 | −#define EP93XX_GPIO_LINE_EGPIO5 EP93XX_GPIO_LINE_A(5) | |
| 25 | −#define EP93XX_GPIO_LINE_EGPIO6 EP93XX_GPIO_LINE_A(6) | |
| 26 | −#define EP93XX_GPIO_LINE_EGPIO7 EP93XX_GPIO_LINE_A(7) | |
| 27 | − | |
| 28 | −/* GPIO port B. */ | |
| 29 | −#define EP93XX_GPIO_LINE_B(x) ((x) + 8) | |
| 30 | −#define EP93XX_GPIO_LINE_EGPIO8 EP93XX_GPIO_LINE_B(0) | |
| 31 | −#define EP93XX_GPIO_LINE_EGPIO9 EP93XX_GPIO_LINE_B(1) | |
| 32 | −#define EP93XX_GPIO_LINE_EGPIO10 EP93XX_GPIO_LINE_B(2) | |
| 33 | −#define EP93XX_GPIO_LINE_EGPIO11 EP93XX_GPIO_LINE_B(3) | |
| 34 | −#define EP93XX_GPIO_LINE_EGPIO12 EP93XX_GPIO_LINE_B(4) | |
| 35 | −#define EP93XX_GPIO_LINE_EGPIO13 EP93XX_GPIO_LINE_B(5) | |
| 36 | −#define EP93XX_GPIO_LINE_EGPIO14 EP93XX_GPIO_LINE_B(6) | |
| 37 | −#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7) | |
| 38 | − | |
| 39 | −/* GPIO port C. */ | |
| 40 | −#define EP93XX_GPIO_LINE_C(x) ((x) + 40) | |
| 41 | −#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0) | |
| 42 | −#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1) | |
| 43 | −#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2) | |
| 44 | −#define EP93XX_GPIO_LINE_ROW3 EP93XX_GPIO_LINE_C(3) | |
| 45 | −#define EP93XX_GPIO_LINE_ROW4 EP93XX_GPIO_LINE_C(4) | |
| 46 | −#define EP93XX_GPIO_LINE_ROW5 EP93XX_GPIO_LINE_C(5) | |
| 47 | −#define EP93XX_GPIO_LINE_ROW6 EP93XX_GPIO_LINE_C(6) | |
| 48 | −#define EP93XX_GPIO_LINE_ROW7 EP93XX_GPIO_LINE_C(7) | |
| 49 | − | |
| 50 | −/* GPIO port D. */ | |
| 51 | −#define EP93XX_GPIO_LINE_D(x) ((x) + 24) | |
| 52 | −#define EP93XX_GPIO_LINE_COL0 EP93XX_GPIO_LINE_D(0) | |
| 53 | −#define EP93XX_GPIO_LINE_COL1 EP93XX_GPIO_LINE_D(1) | |
| 54 | −#define EP93XX_GPIO_LINE_COL2 EP93XX_GPIO_LINE_D(2) | |
| 55 | −#define EP93XX_GPIO_LINE_COL3 EP93XX_GPIO_LINE_D(3) | |
| 56 | −#define EP93XX_GPIO_LINE_COL4 EP93XX_GPIO_LINE_D(4) | |
| 57 | −#define EP93XX_GPIO_LINE_COL5 EP93XX_GPIO_LINE_D(5) | |
| 58 | −#define EP93XX_GPIO_LINE_COL6 EP93XX_GPIO_LINE_D(6) | |
| 59 | −#define EP93XX_GPIO_LINE_COL7 EP93XX_GPIO_LINE_D(7) | |
| 60 | − | |
| 61 | −/* GPIO port E. */ | |
| 62 | −#define EP93XX_GPIO_LINE_E(x) ((x) + 32) | |
| 63 | −#define EP93XX_GPIO_LINE_GRLED EP93XX_GPIO_LINE_E(0) | |
| 64 | −#define EP93XX_GPIO_LINE_RDLED EP93XX_GPIO_LINE_E(1) | |
| 65 | −#define EP93XX_GPIO_LINE_DIORn EP93XX_GPIO_LINE_E(2) | |
| 66 | −#define EP93XX_GPIO_LINE_IDECS1n EP93XX_GPIO_LINE_E(3) | |
| 67 | −#define EP93XX_GPIO_LINE_IDECS2n EP93XX_GPIO_LINE_E(4) | |
| 68 | −#define EP93XX_GPIO_LINE_IDEDA0 EP93XX_GPIO_LINE_E(5) | |
| 69 | −#define EP93XX_GPIO_LINE_IDEDA1 EP93XX_GPIO_LINE_E(6) | |
| 70 | −#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7) | |
| 71 | − | |
| 72 | −/* GPIO port F. */ | |
| 73 | −#define EP93XX_GPIO_LINE_F(x) ((x) + 16) | |
| 74 | −#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0) | |
| 75 | −#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1) | |
| 76 | −#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2) | |
| 77 | −#define EP93XX_GPIO_LINE_MCBVD1 EP93XX_GPIO_LINE_F(3) | |
| 78 | −#define EP93XX_GPIO_LINE_MCBVD2 EP93XX_GPIO_LINE_F(4) | |
| 79 | −#define EP93XX_GPIO_LINE_VS1 EP93XX_GPIO_LINE_F(5) | |
| 80 | −#define EP93XX_GPIO_LINE_READY EP93XX_GPIO_LINE_F(6) | |
| 81 | −#define EP93XX_GPIO_LINE_VS2 EP93XX_GPIO_LINE_F(7) | |
| 82 | − | |
| 83 | −/* GPIO port G. */ | |
| 84 | −#define EP93XX_GPIO_LINE_G(x) ((x) + 48) | |
| 85 | −#define EP93XX_GPIO_LINE_EECLK EP93XX_GPIO_LINE_G(0) | |
| 86 | −#define EP93XX_GPIO_LINE_EEDAT EP93XX_GPIO_LINE_G(1) | |
| 87 | −#define EP93XX_GPIO_LINE_SLA0 EP93XX_GPIO_LINE_G(2) | |
| 88 | −#define EP93XX_GPIO_LINE_SLA1 EP93XX_GPIO_LINE_G(3) | |
| 89 | −#define EP93XX_GPIO_LINE_DD12 EP93XX_GPIO_LINE_G(4) | |
| 90 | −#define EP93XX_GPIO_LINE_DD13 EP93XX_GPIO_LINE_G(5) | |
| 91 | −#define EP93XX_GPIO_LINE_DD14 EP93XX_GPIO_LINE_G(6) | |
| 92 | −#define EP93XX_GPIO_LINE_DD15 EP93XX_GPIO_LINE_G(7) | |
| 93 | − | |
| 94 | −/* GPIO port H. */ | |
| 95 | −#define EP93XX_GPIO_LINE_H(x) ((x) + 56) | |
| 96 | −#define EP93XX_GPIO_LINE_DD0 EP93XX_GPIO_LINE_H(0) | |
| 97 | −#define EP93XX_GPIO_LINE_DD1 EP93XX_GPIO_LINE_H(1) | |
| 98 | −#define EP93XX_GPIO_LINE_DD2 EP93XX_GPIO_LINE_H(2) | |
| 99 | −#define EP93XX_GPIO_LINE_DD3 EP93XX_GPIO_LINE_H(3) | |
| 100 | −#define EP93XX_GPIO_LINE_DD4 EP93XX_GPIO_LINE_H(4) | |
| 101 | −#define EP93XX_GPIO_LINE_DD5 EP93XX_GPIO_LINE_H(5) | |
| 102 | −#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6) | |
| 103 | −#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7) | |
| 104 | − | |
| 105 | −/* maximum value for gpio line identifiers */ | |
| 106 | −#define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7) | |
| 107 | − | |
| 108 | −/* maximum value for irq capable line identifiers */ | |
| 109 | −#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) | |
| 110 | − | |
| 111 | −#endif /* __GPIO_EP93XX_H */ | |
| @@ -1,25 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/include/mach/hardware.h | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#ifndef __ASM_ARCH_HARDWARE_H | |
| 7 | −#define __ASM_ARCH_HARDWARE_H | |
| 8 | − | |
| 9 | −#include "platform.h" | |
| 10 | − | |
| 11 | −/* | |
| 12 | − * The EP93xx has two external crystal oscillators. To generate the | |
| 13 | − * required high-frequency clocks, the processor uses two phase-locked- | |
| 14 | − * loops (PLLs) to multiply the incoming external clock signal to much | |
| 15 | − * higher frequencies that are then divided down by programmable dividers | |
| 16 | − * to produce the needed clocks. The PLLs operate independently of one | |
| 17 | − * another. | |
| 18 | − */ | |
| 19 | −#define EP93XX_EXT_CLK_RATE 14745600 | |
| 20 | −#define EP93XX_EXT_RTC_RATE 32768 | |
| 21 | − | |
| 22 | −#define EP93XX_KEYTCHCLK_DIV4 (EP93XX_EXT_CLK_RATE / 4) | |
| 23 | −#define EP93XX_KEYTCHCLK_DIV16 (EP93XX_EXT_CLK_RATE / 16) | |
| 24 | − | |
| 25 | −#endif | |
| @@ -1,76 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef __ASM_ARCH_IRQS_H | |
| 3 | −#define __ASM_ARCH_IRQS_H | |
| 4 | − | |
| 5 | −#define IRQ_EP93XX_VIC0 1 | |
| 6 | − | |
| 7 | −#define IRQ_EP93XX_COMMRX (IRQ_EP93XX_VIC0 + 2) | |
| 8 | −#define IRQ_EP93XX_COMMTX (IRQ_EP93XX_VIC0 + 3) | |
| 9 | −#define IRQ_EP93XX_TIMER1 (IRQ_EP93XX_VIC0 + 4) | |
| 10 | −#define IRQ_EP93XX_TIMER2 (IRQ_EP93XX_VIC0 + 5) | |
| 11 | −#define IRQ_EP93XX_AACINTR (IRQ_EP93XX_VIC0 + 6) | |
| 12 | −#define IRQ_EP93XX_DMAM2P0 (IRQ_EP93XX_VIC0 + 7) | |
| 13 | −#define IRQ_EP93XX_DMAM2P1 (IRQ_EP93XX_VIC0 + 8) | |
| 14 | −#define IRQ_EP93XX_DMAM2P2 (IRQ_EP93XX_VIC0 + 9) | |
| 15 | −#define IRQ_EP93XX_DMAM2P3 (IRQ_EP93XX_VIC0 + 10) | |
| 16 | −#define IRQ_EP93XX_DMAM2P4 (IRQ_EP93XX_VIC0 + 11) | |
| 17 | −#define IRQ_EP93XX_DMAM2P5 (IRQ_EP93XX_VIC0 + 12) | |
| 18 | −#define IRQ_EP93XX_DMAM2P6 (IRQ_EP93XX_VIC0 + 13) | |
| 19 | −#define IRQ_EP93XX_DMAM2P7 (IRQ_EP93XX_VIC0 + 14) | |
| 20 | −#define IRQ_EP93XX_DMAM2P8 (IRQ_EP93XX_VIC0 + 15) | |
| 21 | −#define IRQ_EP93XX_DMAM2P9 (IRQ_EP93XX_VIC0 + 16) | |
| 22 | −#define IRQ_EP93XX_DMAM2M0 (IRQ_EP93XX_VIC0 + 17) | |
| 23 | −#define IRQ_EP93XX_DMAM2M1 (IRQ_EP93XX_VIC0 + 18) | |
| 24 | −#define IRQ_EP93XX_GPIO0MUX (IRQ_EP93XX_VIC0 + 19) | |
| 25 | −#define IRQ_EP93XX_GPIO1MUX (IRQ_EP93XX_VIC0 + 20) | |
| 26 | −#define IRQ_EP93XX_GPIO2MUX (IRQ_EP93XX_VIC0 + 21) | |
| 27 | −#define IRQ_EP93XX_GPIO3MUX (IRQ_EP93XX_VIC0 + 22) | |
| 28 | −#define IRQ_EP93XX_UART1RX (IRQ_EP93XX_VIC0 + 23) | |
| 29 | −#define IRQ_EP93XX_UART1TX (IRQ_EP93XX_VIC0 + 24) | |
| 30 | −#define IRQ_EP93XX_UART2RX (IRQ_EP93XX_VIC0 + 25) | |
| 31 | −#define IRQ_EP93XX_UART2TX (IRQ_EP93XX_VIC0 + 26) | |
| 32 | −#define IRQ_EP93XX_UART3RX (IRQ_EP93XX_VIC0 + 27) | |
| 33 | −#define IRQ_EP93XX_UART3TX (IRQ_EP93XX_VIC0 + 28) | |
| 34 | −#define IRQ_EP93XX_KEY (IRQ_EP93XX_VIC0 + 29) | |
| 35 | −#define IRQ_EP93XX_TOUCH (IRQ_EP93XX_VIC0 + 30) | |
| 36 | −#define EP93XX_VIC1_VALID_IRQ_MASK 0x7ffffffc | |
| 37 | − | |
| 38 | −#define IRQ_EP93XX_VIC1 (IRQ_EP93XX_VIC0 + 32) | |
| 39 | − | |
| 40 | −#define IRQ_EP93XX_EXT0 (IRQ_EP93XX_VIC1 + 0) | |
| 41 | −#define IRQ_EP93XX_EXT1 (IRQ_EP93XX_VIC1 + 1) | |
| 42 | −#define IRQ_EP93XX_EXT2 (IRQ_EP93XX_VIC1 + 2) | |
| 43 | −#define IRQ_EP93XX_64HZ (IRQ_EP93XX_VIC1 + 3) | |
| 44 | −#define IRQ_EP93XX_WATCHDOG (IRQ_EP93XX_VIC1 + 4) | |
| 45 | −#define IRQ_EP93XX_RTC (IRQ_EP93XX_VIC1 + 5) | |
| 46 | −#define IRQ_EP93XX_IRDA (IRQ_EP93XX_VIC1 + 6) | |
| 47 | −#define IRQ_EP93XX_ETHERNET (IRQ_EP93XX_VIC1 + 7) | |
| 48 | −#define IRQ_EP93XX_EXT3 (IRQ_EP93XX_VIC1 + 8) | |
| 49 | −#define IRQ_EP93XX_PROG (IRQ_EP93XX_VIC1 + 9) | |
| 50 | −#define IRQ_EP93XX_1HZ (IRQ_EP93XX_VIC1 + 10) | |
| 51 | −#define IRQ_EP93XX_VSYNC (IRQ_EP93XX_VIC1 + 11) | |
| 52 | −#define IRQ_EP93XX_VIDEO_FIFO (IRQ_EP93XX_VIC1 + 12) | |
| 53 | −#define IRQ_EP93XX_SSP1RX (IRQ_EP93XX_VIC1 + 13) | |
| 54 | −#define IRQ_EP93XX_SSP1TX (IRQ_EP93XX_VIC1 + 14) | |
| 55 | −#define IRQ_EP93XX_GPIO4MUX (IRQ_EP93XX_VIC1 + 15) | |
| 56 | −#define IRQ_EP93XX_GPIO5MUX (IRQ_EP93XX_VIC1 + 16) | |
| 57 | −#define IRQ_EP93XX_GPIO6MUX (IRQ_EP93XX_VIC1 + 17) | |
| 58 | −#define IRQ_EP93XX_GPIO7MUX (IRQ_EP93XX_VIC1 + 18) | |
| 59 | −#define IRQ_EP93XX_TIMER3 (IRQ_EP93XX_VIC1 + 19) | |
| 60 | −#define IRQ_EP93XX_UART1 (IRQ_EP93XX_VIC1 + 20) | |
| 61 | −#define IRQ_EP93XX_SSP (IRQ_EP93XX_VIC1 + 21) | |
| 62 | −#define IRQ_EP93XX_UART2 (IRQ_EP93XX_VIC1 + 22) | |
| 63 | −#define IRQ_EP93XX_UART3 (IRQ_EP93XX_VIC1 + 23) | |
| 64 | −#define IRQ_EP93XX_USB (IRQ_EP93XX_VIC1 + 24) | |
| 65 | −#define IRQ_EP93XX_ETHERNET_PME (IRQ_EP93XX_VIC1 + 25) | |
| 66 | −#define IRQ_EP93XX_DSP (IRQ_EP93XX_VIC1 + 26) | |
| 67 | −#define IRQ_EP93XX_GPIO_AB (IRQ_EP93XX_VIC1 + 27) | |
| 68 | −#define IRQ_EP93XX_SAI (IRQ_EP93XX_VIC1 + 28) | |
| 69 | −#define EP93XX_VIC2_VALID_IRQ_MASK 0x1fffffff | |
| 70 | − | |
| 71 | −#define NR_EP93XX_IRQS (IRQ_EP93XX_VIC1 + 32 + 24) | |
| 72 | − | |
| 73 | −#define EP93XX_BOARD_IRQ(x) (NR_EP93XX_IRQS + (x)) | |
| 74 | −#define EP93XX_BOARD_IRQS 32 | |
| 75 | − | |
| 76 | −#endif | |
| @@ -1,42 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/include/mach/platform.h | |
| 4 | − */ | |
| 5 | − | |
| 6 | −#ifndef __ASSEMBLY__ | |
| 7 | − | |
| 8 | −#include <linux/platform_data/eth-ep93xx.h> | |
| 9 | −#include <linux/reboot.h> | |
| 10 | − | |
| 11 | −struct device; | |
| 12 | −struct i2c_board_info; | |
| 13 | −struct spi_board_info; | |
| 14 | −struct platform_device; | |
| 15 | −struct ep93xxfb_mach_info; | |
| 16 | −struct ep93xx_keypad_platform_data; | |
| 17 | −struct ep93xx_spi_info; | |
| 18 | − | |
| 19 | −void ep93xx_map_io(void); | |
| 20 | −void ep93xx_init_irq(void); | |
| 21 | − | |
| 22 | −void ep93xx_register_flash(unsigned int width, | |
| 23 | − resource_size_t start, resource_size_t size); | |
| 24 | − | |
| 25 | −void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); | |
| 26 | −void ep93xx_register_i2c(struct i2c_board_info *devices, int num); | |
| 27 | −void ep93xx_register_spi(struct ep93xx_spi_info *info, | |
| 28 | − struct spi_board_info *devices, int num); | |
| 29 | −void ep93xx_register_fb(struct ep93xxfb_mach_info *data); | |
| 30 | −void ep93xx_register_pwm(int pwm0, int pwm1); | |
| 31 | −void ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data); | |
| 32 | −void ep93xx_register_i2s(void); | |
| 33 | −void ep93xx_register_ac97(void); | |
| 34 | −void ep93xx_register_ide(void); | |
| 35 | −void ep93xx_register_adc(void); | |
| 36 | − | |
| 37 | −struct device *ep93xx_init_devices(void); | |
| 38 | −extern void ep93xx_timer_init(void); | |
| 39 | − | |
| 40 | −void ep93xx_restart(enum reboot_mode, const char *); | |
| 41 | − | |
| 42 | −#endif | |
| @@ -1,212 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/soc.h | |
| 4 | − * | |
| 5 | − * Copyright (C) 2012 Open Kernel Labs <www.ok-labs.com> | |
| 6 | − * Copyright (C) 2012 Ryan Mallon <rmallon@gmail.com> | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#ifndef _EP93XX_SOC_H | |
| 10 | −#define _EP93XX_SOC_H | |
| 11 | − | |
| 12 | −#include "ep93xx-regs.h" | |
| 13 | −#include "irqs.h" | |
| 14 | − | |
| 15 | −/* | |
| 16 | − * EP93xx Physical Memory Map: | |
| 17 | − * | |
| 18 | − * The ASDO pin is sampled at system reset to select a synchronous or | |
| 19 | − * asynchronous boot configuration. When ASDO is "1" (i.e. pulled-up) | |
| 20 | − * the synchronous boot mode is selected. When ASDO is "0" (i.e | |
| 21 | − * pulled-down) the asynchronous boot mode is selected. | |
| 22 | − * | |
| 23 | − * In synchronous boot mode nSDCE3 is decoded starting at physical address | |
| 24 | − * 0x00000000 and nCS0 is decoded starting at 0xf0000000. For asynchronous | |
| 25 | − * boot mode they are swapped with nCS0 decoded at 0x00000000 ann nSDCE3 | |
| 26 | − * decoded at 0xf0000000. | |
| 27 | − * | |
| 28 | − * There is known errata for the EP93xx dealing with External Memory | |
| 29 | − * Configurations. Please refer to "AN273: EP93xx Silicon Rev E Design | |
| 30 | − * Guidelines" for more information. This document can be found at: | |
| 31 | − * | |
| 32 | − * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf | |
| 33 | − */ | |
| 34 | − | |
| 35 | −#define EP93XX_CS0_PHYS_BASE_ASYNC 0x00000000 /* ASDO Pin = 0 */ | |
| 36 | −#define EP93XX_SDCE3_PHYS_BASE_SYNC 0x00000000 /* ASDO Pin = 1 */ | |
| 37 | −#define EP93XX_CS1_PHYS_BASE 0x10000000 | |
| 38 | −#define EP93XX_CS2_PHYS_BASE 0x20000000 | |
| 39 | −#define EP93XX_CS3_PHYS_BASE 0x30000000 | |
| 40 | −#define EP93XX_PCMCIA_PHYS_BASE 0x40000000 | |
| 41 | −#define EP93XX_CS6_PHYS_BASE 0x60000000 | |
| 42 | −#define EP93XX_CS7_PHYS_BASE 0x70000000 | |
| 43 | −#define EP93XX_SDCE0_PHYS_BASE 0xc0000000 | |
| 44 | −#define EP93XX_SDCE1_PHYS_BASE 0xd0000000 | |
| 45 | −#define EP93XX_SDCE2_PHYS_BASE 0xe0000000 | |
| 46 | −#define EP93XX_SDCE3_PHYS_BASE_ASYNC 0xf0000000 /* ASDO Pin = 0 */ | |
| 47 | −#define EP93XX_CS0_PHYS_BASE_SYNC 0xf0000000 /* ASDO Pin = 1 */ | |
| 48 | − | |
| 49 | −/* AHB peripherals */ | |
| 50 | −#define EP93XX_DMA_BASE EP93XX_AHB_IOMEM(0x00000000) | |
| 51 | − | |
| 52 | −#define EP93XX_ETHERNET_PHYS_BASE EP93XX_AHB_PHYS(0x00010000) | |
| 53 | −#define EP93XX_ETHERNET_BASE EP93XX_AHB_IOMEM(0x00010000) | |
| 54 | − | |
| 55 | −#define EP93XX_USB_PHYS_BASE EP93XX_AHB_PHYS(0x00020000) | |
| 56 | −#define EP93XX_USB_BASE EP93XX_AHB_IOMEM(0x00020000) | |
| 57 | − | |
| 58 | −#define EP93XX_RASTER_PHYS_BASE EP93XX_AHB_PHYS(0x00030000) | |
| 59 | −#define EP93XX_RASTER_BASE EP93XX_AHB_IOMEM(0x00030000) | |
| 60 | − | |
| 61 | −#define EP93XX_GRAPHICS_ACCEL_BASE EP93XX_AHB_IOMEM(0x00040000) | |
| 62 | − | |
| 63 | −#define EP93XX_SDRAM_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00060000) | |
| 64 | − | |
| 65 | −#define EP93XX_PCMCIA_CONTROLLER_BASE EP93XX_AHB_IOMEM(0x00080000) | |
| 66 | − | |
| 67 | −#define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000) | |
| 68 | − | |
| 69 | −#define EP93XX_IDE_PHYS_BASE EP93XX_AHB_PHYS(0x000a0000) | |
| 70 | −#define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000) | |
| 71 | − | |
| 72 | −#define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000) | |
| 73 | − | |
| 74 | −#define EP93XX_VIC2_BASE EP93XX_AHB_IOMEM(0x000c0000) | |
| 75 | − | |
| 76 | −/* APB peripherals */ | |
| 77 | −#define EP93XX_TIMER_BASE EP93XX_APB_IOMEM(0x00010000) | |
| 78 | − | |
| 79 | −#define EP93XX_I2S_PHYS_BASE EP93XX_APB_PHYS(0x00020000) | |
| 80 | −#define EP93XX_I2S_BASE EP93XX_APB_IOMEM(0x00020000) | |
| 81 | − | |
| 82 | −#define EP93XX_SECURITY_BASE EP93XX_APB_IOMEM(0x00030000) | |
| 83 | − | |
| 84 | −#define EP93XX_AAC_PHYS_BASE EP93XX_APB_PHYS(0x00080000) | |
| 85 | −#define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) | |
| 86 | − | |
| 87 | −#define EP93XX_SPI_PHYS_BASE EP93XX_APB_PHYS(0x000a0000) | |
| 88 | −#define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000) | |
| 89 | − | |
| 90 | −#define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) | |
| 91 | − | |
| 92 | −#define EP93XX_KEY_MATRIX_PHYS_BASE EP93XX_APB_PHYS(0x000f0000) | |
| 93 | −#define EP93XX_KEY_MATRIX_BASE EP93XX_APB_IOMEM(0x000f0000) | |
| 94 | − | |
| 95 | −#define EP93XX_ADC_PHYS_BASE EP93XX_APB_PHYS(0x00100000) | |
| 96 | −#define EP93XX_ADC_BASE EP93XX_APB_IOMEM(0x00100000) | |
| 97 | −#define EP93XX_TOUCHSCREEN_BASE EP93XX_APB_IOMEM(0x00100000) | |
| 98 | − | |
| 99 | −#define EP93XX_PWM_PHYS_BASE EP93XX_APB_PHYS(0x00110000) | |
| 100 | −#define EP93XX_PWM_BASE EP93XX_APB_IOMEM(0x00110000) | |
| 101 | − | |
| 102 | −#define EP93XX_RTC_PHYS_BASE EP93XX_APB_PHYS(0x00120000) | |
| 103 | −#define EP93XX_RTC_BASE EP93XX_APB_IOMEM(0x00120000) | |
| 104 | − | |
| 105 | −#define EP93XX_WATCHDOG_PHYS_BASE EP93XX_APB_PHYS(0x00140000) | |
| 106 | −#define EP93XX_WATCHDOG_BASE EP93XX_APB_IOMEM(0x00140000) | |
| 107 | − | |
| 108 | −/* System controller */ | |
| 109 | −#define EP93XX_SYSCON_BASE EP93XX_APB_IOMEM(0x00130000) | |
| 110 | −#define EP93XX_SYSCON_REG(x) (EP93XX_SYSCON_BASE + (x)) | |
| 111 | −#define EP93XX_SYSCON_POWER_STATE EP93XX_SYSCON_REG(0x00) | |
| 112 | −#define EP93XX_SYSCON_PWRCNT EP93XX_SYSCON_REG(0x04) | |
| 113 | −#define EP93XX_SYSCON_PWRCNT_FIR_EN (1<<31) | |
| 114 | −#define EP93XX_SYSCON_PWRCNT_UARTBAUD (1<<29) | |
| 115 | −#define EP93XX_SYSCON_PWRCNT_USH_EN 28 | |
| 116 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2M1 27 | |
| 117 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2M0 26 | |
| 118 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P8 25 | |
| 119 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P9 24 | |
| 120 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P6 23 | |
| 121 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P7 22 | |
| 122 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P4 21 | |
| 123 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P5 20 | |
| 124 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P2 19 | |
| 125 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P3 18 | |
| 126 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P0 17 | |
| 127 | −#define EP93XX_SYSCON_PWRCNT_DMA_M2P1 16 | |
| 128 | −#define EP93XX_SYSCON_HALT EP93XX_SYSCON_REG(0x08) | |
| 129 | −#define EP93XX_SYSCON_STANDBY EP93XX_SYSCON_REG(0x0c) | |
| 130 | −#define EP93XX_SYSCON_CLKSET1 EP93XX_SYSCON_REG(0x20) | |
| 131 | −#define EP93XX_SYSCON_CLKSET1_NBYP1 (1<<23) | |
| 132 | −#define EP93XX_SYSCON_CLKSET2 EP93XX_SYSCON_REG(0x24) | |
| 133 | −#define EP93XX_SYSCON_CLKSET2_NBYP2 (1<<19) | |
| 134 | −#define EP93XX_SYSCON_CLKSET2_PLL2_EN (1<<18) | |
| 135 | −#define EP93XX_SYSCON_DEVCFG EP93XX_SYSCON_REG(0x80) | |
| 136 | −#define EP93XX_SYSCON_DEVCFG_SWRST (1<<31) | |
| 137 | −#define EP93XX_SYSCON_DEVCFG_D1ONG (1<<30) | |
| 138 | −#define EP93XX_SYSCON_DEVCFG_D0ONG (1<<29) | |
| 139 | −#define EP93XX_SYSCON_DEVCFG_IONU2 (1<<28) | |
| 140 | −#define EP93XX_SYSCON_DEVCFG_GONK (1<<27) | |
| 141 | −#define EP93XX_SYSCON_DEVCFG_TONG (1<<26) | |
| 142 | −#define EP93XX_SYSCON_DEVCFG_MONG (1<<25) | |
| 143 | −#define EP93XX_SYSCON_DEVCFG_U3EN 24 | |
| 144 | −#define EP93XX_SYSCON_DEVCFG_CPENA (1<<23) | |
| 145 | −#define EP93XX_SYSCON_DEVCFG_A2ONG (1<<22) | |
| 146 | −#define EP93XX_SYSCON_DEVCFG_A1ONG (1<<21) | |
| 147 | −#define EP93XX_SYSCON_DEVCFG_U2EN 20 | |
| 148 | −#define EP93XX_SYSCON_DEVCFG_EXVC (1<<19) | |
| 149 | −#define EP93XX_SYSCON_DEVCFG_U1EN 18 | |
| 150 | −#define EP93XX_SYSCON_DEVCFG_TIN (1<<17) | |
| 151 | −#define EP93XX_SYSCON_DEVCFG_HC3IN (1<<15) | |
| 152 | −#define EP93XX_SYSCON_DEVCFG_HC3EN (1<<14) | |
| 153 | −#define EP93XX_SYSCON_DEVCFG_HC1IN (1<<13) | |
| 154 | −#define EP93XX_SYSCON_DEVCFG_HC1EN (1<<12) | |
| 155 | −#define EP93XX_SYSCON_DEVCFG_HONIDE (1<<11) | |
| 156 | −#define EP93XX_SYSCON_DEVCFG_GONIDE (1<<10) | |
| 157 | −#define EP93XX_SYSCON_DEVCFG_PONG (1<<9) | |
| 158 | −#define EP93XX_SYSCON_DEVCFG_EONIDE (1<<8) | |
| 159 | −#define EP93XX_SYSCON_DEVCFG_I2SONSSP (1<<7) | |
| 160 | −#define EP93XX_SYSCON_DEVCFG_I2SONAC97 (1<<6) | |
| 161 | −#define EP93XX_SYSCON_DEVCFG_RASONP3 (1<<4) | |
| 162 | −#define EP93XX_SYSCON_DEVCFG_RAS (1<<3) | |
| 163 | −#define EP93XX_SYSCON_DEVCFG_ADCPD (1<<2) | |
| 164 | −#define EP93XX_SYSCON_DEVCFG_KEYS (1<<1) | |
| 165 | −#define EP93XX_SYSCON_DEVCFG_SHENA (1<<0) | |
| 166 | −#define EP93XX_SYSCON_VIDCLKDIV EP93XX_SYSCON_REG(0x84) | |
| 167 | −#define EP93XX_SYSCON_CLKDIV_ENABLE 15 | |
| 168 | −#define EP93XX_SYSCON_CLKDIV_ESEL (1<<14) | |
| 169 | −#define EP93XX_SYSCON_CLKDIV_PSEL (1<<13) | |
| 170 | −#define EP93XX_SYSCON_CLKDIV_PDIV_SHIFT 8 | |
| 171 | −#define EP93XX_SYSCON_I2SCLKDIV EP93XX_SYSCON_REG(0x8c) | |
| 172 | −#define EP93XX_SYSCON_I2SCLKDIV_SENA 31 | |
| 173 | −#define EP93XX_SYSCON_I2SCLKDIV_ORIDE (1<<29) | |
| 174 | −#define EP93XX_SYSCON_I2SCLKDIV_SPOL (1<<19) | |
| 175 | −#define EP93XX_I2SCLKDIV_SDIV (1 << 16) | |
| 176 | −#define EP93XX_I2SCLKDIV_LRDIV32 (0 << 17) | |
| 177 | −#define EP93XX_I2SCLKDIV_LRDIV64 (1 << 17) | |
| 178 | −#define EP93XX_I2SCLKDIV_LRDIV128 (2 << 17) | |
| 179 | −#define EP93XX_I2SCLKDIV_LRDIV_MASK (3 << 17) | |
| 180 | −#define EP93XX_SYSCON_KEYTCHCLKDIV EP93XX_SYSCON_REG(0x90) | |
| 181 | −#define EP93XX_SYSCON_KEYTCHCLKDIV_TSEN 31 | |
| 182 | −#define EP93XX_SYSCON_KEYTCHCLKDIV_ADIV 16 | |
| 183 | −#define EP93XX_SYSCON_KEYTCHCLKDIV_KEN 15 | |
| 184 | −#define EP93XX_SYSCON_KEYTCHCLKDIV_KDIV (1<<0) | |
| 185 | −#define EP93XX_SYSCON_SYSCFG EP93XX_SYSCON_REG(0x9c) | |
| 186 | −#define EP93XX_SYSCON_SYSCFG_REV_MASK (0xf0000000) | |
| 187 | −#define EP93XX_SYSCON_SYSCFG_REV_SHIFT (28) | |
| 188 | −#define EP93XX_SYSCON_SYSCFG_SBOOT (1<<8) | |
| 189 | −#define EP93XX_SYSCON_SYSCFG_LCSN7 (1<<7) | |
| 190 | −#define EP93XX_SYSCON_SYSCFG_LCSN6 (1<<6) | |
| 191 | −#define EP93XX_SYSCON_SYSCFG_LASDO (1<<5) | |
| 192 | −#define EP93XX_SYSCON_SYSCFG_LEEDA (1<<4) | |
| 193 | −#define EP93XX_SYSCON_SYSCFG_LEECLK (1<<3) | |
| 194 | −#define EP93XX_SYSCON_SYSCFG_LCSN2 (1<<1) | |
| 195 | −#define EP93XX_SYSCON_SYSCFG_LCSN1 (1<<0) | |
| 196 | −#define EP93XX_SYSCON_SWLOCK EP93XX_SYSCON_REG(0xc0) | |
| 197 | − | |
| 198 | −/* EP93xx System Controller software locked register write */ | |
| 199 | −void ep93xx_syscon_swlocked_write(unsigned int val, void __iomem *reg); | |
| 200 | −void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits); | |
| 201 | − | |
| 202 | −static inline void ep93xx_devcfg_set_bits(unsigned int bits) | |
| 203 | −{ | |
| 204 | − ep93xx_devcfg_set_clear(bits, 0x00); | |
| 205 | −} | |
| 206 | − | |
| 207 | −static inline void ep93xx_devcfg_clear_bits(unsigned int bits) | |
| 208 | −{ | |
| 209 | − ep93xx_devcfg_set_clear(0x00, bits); | |
| 210 | −} | |
| 211 | − | |
| 212 | −#endif /* _EP93XX_SOC_H */ | |
| @@ -1,143 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0 | |
| 2 | −#include <linux/kernel.h> | |
| 3 | −#include <linux/init.h> | |
| 4 | −#include <linux/clocksource.h> | |
| 5 | −#include <linux/clockchips.h> | |
| 6 | −#include <linux/sched_clock.h> | |
| 7 | −#include <linux/interrupt.h> | |
| 8 | −#include <linux/irq.h> | |
| 9 | −#include <linux/io.h> | |
| 10 | −#include <asm/mach/time.h> | |
| 11 | −#include "soc.h" | |
| 12 | −#include "platform.h" | |
| 13 | − | |
| 14 | −/************************************************************************* | |
| 15 | − * Timer handling for EP93xx | |
| 16 | − ************************************************************************* | |
| 17 | − * The ep93xx has four internal timers. Timers 1, 2 (both 16 bit) and | |
| 18 | − * 3 (32 bit) count down at 508 kHz, are self-reloading, and can generate | |
| 19 | − * an interrupt on underflow. Timer 4 (40 bit) counts down at 983.04 kHz, | |
| 20 | − * is free-running, and can't generate interrupts. | |
| 21 | − * | |
| 22 | − * The 508 kHz timers are ideal for use for the timer interrupt, as the | |
| 23 | − * most common values of HZ divide 508 kHz nicely. We pick the 32 bit | |
| 24 | − * timer (timer 3) to get as long sleep intervals as possible when using | |
| 25 | − * CONFIG_NO_HZ. | |
| 26 | − * | |
| 27 | − * The higher clock rate of timer 4 makes it a better choice than the | |
| 28 | − * other timers for use as clock source and for sched_clock(), providing | |
| 29 | − * a stable 40 bit time base. | |
| 30 | − ************************************************************************* | |
| 31 | − */ | |
| 32 | −#define EP93XX_TIMER_REG(x) (EP93XX_TIMER_BASE + (x)) | |
| 33 | −#define EP93XX_TIMER1_LOAD EP93XX_TIMER_REG(0x00) | |
| 34 | −#define EP93XX_TIMER1_VALUE EP93XX_TIMER_REG(0x04) | |
| 35 | −#define EP93XX_TIMER1_CONTROL EP93XX_TIMER_REG(0x08) | |
| 36 | −#define EP93XX_TIMER123_CONTROL_ENABLE (1 << 7) | |
| 37 | −#define EP93XX_TIMER123_CONTROL_MODE (1 << 6) | |
| 38 | −#define EP93XX_TIMER123_CONTROL_CLKSEL (1 << 3) | |
| 39 | −#define EP93XX_TIMER1_CLEAR EP93XX_TIMER_REG(0x0c) | |
| 40 | −#define EP93XX_TIMER2_LOAD EP93XX_TIMER_REG(0x20) | |
| 41 | −#define EP93XX_TIMER2_VALUE EP93XX_TIMER_REG(0x24) | |
| 42 | −#define EP93XX_TIMER2_CONTROL EP93XX_TIMER_REG(0x28) | |
| 43 | −#define EP93XX_TIMER2_CLEAR EP93XX_TIMER_REG(0x2c) | |
| 44 | −#define EP93XX_TIMER4_VALUE_LOW EP93XX_TIMER_REG(0x60) | |
| 45 | −#define EP93XX_TIMER4_VALUE_HIGH EP93XX_TIMER_REG(0x64) | |
| 46 | −#define EP93XX_TIMER4_VALUE_HIGH_ENABLE (1 << 8) | |
| 47 | −#define EP93XX_TIMER3_LOAD EP93XX_TIMER_REG(0x80) | |
| 48 | −#define EP93XX_TIMER3_VALUE EP93XX_TIMER_REG(0x84) | |
| 49 | −#define EP93XX_TIMER3_CONTROL EP93XX_TIMER_REG(0x88) | |
| 50 | −#define EP93XX_TIMER3_CLEAR EP93XX_TIMER_REG(0x8c) | |
| 51 | − | |
| 52 | −#define EP93XX_TIMER123_RATE 508469 | |
| 53 | −#define EP93XX_TIMER4_RATE 983040 | |
| 54 | − | |
| 55 | −static u64 notrace ep93xx_read_sched_clock(void) | |
| 56 | −{ | |
| 57 | − u64 ret; | |
| 58 | − | |
| 59 | − ret = readl(EP93XX_TIMER4_VALUE_LOW); | |
| 60 | − ret |= ((u64) (readl(EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32); | |
| 61 | − return ret; | |
| 62 | −} | |
| 63 | − | |
| 64 | −static u64 ep93xx_clocksource_read(struct clocksource *c) | |
| 65 | −{ | |
| 66 | − u64 ret; | |
| 67 | − | |
| 68 | − ret = readl(EP93XX_TIMER4_VALUE_LOW); | |
| 69 | − ret |= ((u64) (readl(EP93XX_TIMER4_VALUE_HIGH) & 0xff) << 32); | |
| 70 | − return (u64) ret; | |
| 71 | −} | |
| 72 | − | |
| 73 | −static int ep93xx_clkevt_set_next_event(unsigned long next, | |
| 74 | − struct clock_event_device *evt) | |
| 75 | −{ | |
| 76 | − /* Default mode: periodic, off, 508 kHz */ | |
| 77 | − u32 tmode = EP93XX_TIMER123_CONTROL_MODE | | |
| 78 | − EP93XX_TIMER123_CONTROL_CLKSEL; | |
| 79 | − | |
| 80 | − /* Clear timer */ | |
| 81 | − writel(tmode, EP93XX_TIMER3_CONTROL); | |
| 82 | − | |
| 83 | − /* Set next event */ | |
| 84 | − writel(next, EP93XX_TIMER3_LOAD); | |
| 85 | − writel(tmode | EP93XX_TIMER123_CONTROL_ENABLE, | |
| 86 | − EP93XX_TIMER3_CONTROL); | |
| 87 | − return 0; | |
| 88 | −} | |
| 89 | − | |
| 90 | − | |
| 91 | −static int ep93xx_clkevt_shutdown(struct clock_event_device *evt) | |
| 92 | −{ | |
| 93 | − /* Disable timer */ | |
| 94 | − writel(0, EP93XX_TIMER3_CONTROL); | |
| 95 | − | |
| 96 | − return 0; | |
| 97 | −} | |
| 98 | − | |
| 99 | −static struct clock_event_device ep93xx_clockevent = { | |
| 100 | − .name = "timer1", | |
| 101 | − .features = CLOCK_EVT_FEAT_ONESHOT, | |
| 102 | − .set_state_shutdown = ep93xx_clkevt_shutdown, | |
| 103 | − .set_state_oneshot = ep93xx_clkevt_shutdown, | |
| 104 | − .tick_resume = ep93xx_clkevt_shutdown, | |
| 105 | − .set_next_event = ep93xx_clkevt_set_next_event, | |
| 106 | − .rating = 300, | |
| 107 | −}; | |
| 108 | − | |
| 109 | −static irqreturn_t ep93xx_timer_interrupt(int irq, void *dev_id) | |
| 110 | −{ | |
| 111 | − struct clock_event_device *evt = dev_id; | |
| 112 | − | |
| 113 | − /* Writing any value clears the timer interrupt */ | |
| 114 | − writel(1, EP93XX_TIMER3_CLEAR); | |
| 115 | − | |
| 116 | − evt->event_handler(evt); | |
| 117 | − | |
| 118 | − return IRQ_HANDLED; | |
| 119 | −} | |
| 120 | − | |
| 121 | −void __init ep93xx_timer_init(void) | |
| 122 | −{ | |
| 123 | − int irq = IRQ_EP93XX_TIMER3; | |
| 124 | − unsigned long flags = IRQF_TIMER | IRQF_IRQPOLL; | |
| 125 | − | |
| 126 | − /* Enable and register clocksource and sched_clock on timer 4 */ | |
| 127 | − writel(EP93XX_TIMER4_VALUE_HIGH_ENABLE, | |
| 128 | − EP93XX_TIMER4_VALUE_HIGH); | |
| 129 | − clocksource_mmio_init(NULL, "timer4", | |
| 130 | − EP93XX_TIMER4_RATE, 200, 40, | |
| 131 | − ep93xx_clocksource_read); | |
| 132 | − sched_clock_register(ep93xx_read_sched_clock, 40, | |
| 133 | − EP93XX_TIMER4_RATE); | |
| 134 | − | |
| 135 | − /* Set up clockevent on timer 3 */ | |
| 136 | − if (request_irq(irq, ep93xx_timer_interrupt, flags, "ep93xx timer", | |
| 137 | − &ep93xx_clockevent)) | |
| 138 | − pr_err("Failed to request irq %d (ep93xx timer)\n", irq); | |
| 139 | − clockevents_config_and_register(&ep93xx_clockevent, | |
| 140 | − EP93XX_TIMER123_RATE, | |
| 141 | − 1, | |
| 142 | − 0xffffffffU); | |
| 143 | −} | |
| @@ -1,422 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/ts72xx.c | |
| 4 | − * Technologic Systems TS72xx SBC support. | |
| 5 | − * | |
| 6 | − * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org> | |
| 7 | − */ | |
| 8 | − | |
| 9 | −#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 10 | − | |
| 11 | −#include <linux/kernel.h> | |
| 12 | −#include <linux/init.h> | |
| 13 | −#include <linux/platform_device.h> | |
| 14 | −#include <linux/io.h> | |
| 15 | −#include <linux/mtd/platnand.h> | |
| 16 | −#include <linux/spi/spi.h> | |
| 17 | −#include <linux/spi/flash.h> | |
| 18 | −#include <linux/spi/mmc_spi.h> | |
| 19 | −#include <linux/mmc/host.h> | |
| 20 | −#include <linux/platform_data/spi-ep93xx.h> | |
| 21 | −#include <linux/gpio/machine.h> | |
| 22 | − | |
| 23 | −#include "gpio-ep93xx.h" | |
| 24 | −#include "hardware.h" | |
| 25 | − | |
| 26 | −#include <asm/mach-types.h> | |
| 27 | −#include <asm/mach/map.h> | |
| 28 | −#include <asm/mach/arch.h> | |
| 29 | − | |
| 30 | −#include "soc.h" | |
| 31 | −#include "ts72xx.h" | |
| 32 | − | |
| 33 | −/************************************************************************* | |
| 34 | − * IO map | |
| 35 | − *************************************************************************/ | |
| 36 | −static struct map_desc ts72xx_io_desc[] __initdata = { | |
| 37 | − { | |
| 38 | − .virtual = (unsigned long)TS72XX_MODEL_VIRT_BASE, | |
| 39 | − .pfn = __phys_to_pfn(TS72XX_MODEL_PHYS_BASE), | |
| 40 | − .length = TS72XX_MODEL_SIZE, | |
| 41 | − .type = MT_DEVICE, | |
| 42 | − }, { | |
| 43 | − .virtual = (unsigned long)TS72XX_OPTIONS_VIRT_BASE, | |
| 44 | − .pfn = __phys_to_pfn(TS72XX_OPTIONS_PHYS_BASE), | |
| 45 | − .length = TS72XX_OPTIONS_SIZE, | |
| 46 | − .type = MT_DEVICE, | |
| 47 | − }, { | |
| 48 | − .virtual = (unsigned long)TS72XX_OPTIONS2_VIRT_BASE, | |
| 49 | − .pfn = __phys_to_pfn(TS72XX_OPTIONS2_PHYS_BASE), | |
| 50 | − .length = TS72XX_OPTIONS2_SIZE, | |
| 51 | − .type = MT_DEVICE, | |
| 52 | − }, { | |
| 53 | − .virtual = (unsigned long)TS72XX_CPLDVER_VIRT_BASE, | |
| 54 | − .pfn = __phys_to_pfn(TS72XX_CPLDVER_PHYS_BASE), | |
| 55 | − .length = TS72XX_CPLDVER_SIZE, | |
| 56 | − .type = MT_DEVICE, | |
| 57 | − } | |
| 58 | −}; | |
| 59 | − | |
| 60 | −static void __init ts72xx_map_io(void) | |
| 61 | −{ | |
| 62 | − ep93xx_map_io(); | |
| 63 | − iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); | |
| 64 | −} | |
| 65 | − | |
| 66 | − | |
| 67 | −/************************************************************************* | |
| 68 | − * NAND flash | |
| 69 | − *************************************************************************/ | |
| 70 | −#define TS72XX_NAND_CONTROL_ADDR_LINE 22 /* 0xN0400000 */ | |
| 71 | −#define TS72XX_NAND_BUSY_ADDR_LINE 23 /* 0xN0800000 */ | |
| 72 | − | |
| 73 | −static void ts72xx_nand_hwcontrol(struct nand_chip *chip, | |
| 74 | − int cmd, unsigned int ctrl) | |
| 75 | −{ | |
| 76 | − if (ctrl & NAND_CTRL_CHANGE) { | |
| 77 | − void __iomem *addr = chip->legacy.IO_ADDR_R; | |
| 78 | − unsigned char bits; | |
| 79 | − | |
| 80 | − addr += (1 << TS72XX_NAND_CONTROL_ADDR_LINE); | |
| 81 | − | |
| 82 | − bits = __raw_readb(addr) & ~0x07; | |
| 83 | − bits |= (ctrl & NAND_NCE) << 2; /* bit 0 -> bit 2 */ | |
| 84 | − bits |= (ctrl & NAND_CLE); /* bit 1 -> bit 1 */ | |
| 85 | − bits |= (ctrl & NAND_ALE) >> 2; /* bit 2 -> bit 0 */ | |
| 86 | − | |
| 87 | − __raw_writeb(bits, addr); | |
| 88 | − } | |
| 89 | − | |
| 90 | − if (cmd != NAND_CMD_NONE) | |
| 91 | − __raw_writeb(cmd, chip->legacy.IO_ADDR_W); | |
| 92 | −} | |
| 93 | − | |
| 94 | −static int ts72xx_nand_device_ready(struct nand_chip *chip) | |
| 95 | −{ | |
| 96 | − void __iomem *addr = chip->legacy.IO_ADDR_R; | |
| 97 | − | |
| 98 | − addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE); | |
| 99 | − | |
| 100 | − return !!(__raw_readb(addr) & 0x20); | |
| 101 | −} | |
| 102 | − | |
| 103 | −#define TS72XX_BOOTROM_PART_SIZE (SZ_16K) | |
| 104 | −#define TS72XX_REDBOOT_PART_SIZE (SZ_2M + SZ_1M) | |
| 105 | − | |
| 106 | −static struct mtd_partition ts72xx_nand_parts[] = { | |
| 107 | − { | |
| 108 | − .name = "TS-BOOTROM", | |
| 109 | − .offset = 0, | |
| 110 | − .size = TS72XX_BOOTROM_PART_SIZE, | |
| 111 | − .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
| 112 | − }, { | |
| 113 | − .name = "Linux", | |
| 114 | − .offset = MTDPART_OFS_RETAIN, | |
| 115 | − .size = TS72XX_REDBOOT_PART_SIZE, | |
| 116 | − /* leave so much for last partition */ | |
| 117 | − }, { | |
| 118 | − .name = "RedBoot", | |
| 119 | − .offset = MTDPART_OFS_APPEND, | |
| 120 | − .size = MTDPART_SIZ_FULL, | |
| 121 | − .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
| 122 | − }, | |
| 123 | −}; | |
| 124 | − | |
| 125 | −static struct platform_nand_data ts72xx_nand_data = { | |
| 126 | − .chip = { | |
| 127 | − .nr_chips = 1, | |
| 128 | − .chip_offset = 0, | |
| 129 | − .chip_delay = 15, | |
| 130 | − }, | |
| 131 | − .ctrl = { | |
| 132 | − .cmd_ctrl = ts72xx_nand_hwcontrol, | |
| 133 | − .dev_ready = ts72xx_nand_device_ready, | |
| 134 | − }, | |
| 135 | −}; | |
| 136 | − | |
| 137 | −static struct resource ts72xx_nand_resource[] = { | |
| 138 | − { | |
| 139 | − .start = 0, /* filled in later */ | |
| 140 | − .end = 0, /* filled in later */ | |
| 141 | − .flags = IORESOURCE_MEM, | |
| 142 | − }, | |
| 143 | −}; | |
| 144 | − | |
| 145 | −static struct platform_device ts72xx_nand_flash = { | |
| 146 | − .name = "gen_nand", | |
| 147 | − .id = -1, | |
| 148 | − .dev.platform_data = &ts72xx_nand_data, | |
| 149 | − .resource = ts72xx_nand_resource, | |
| 150 | − .num_resources = ARRAY_SIZE(ts72xx_nand_resource), | |
| 151 | −}; | |
| 152 | − | |
| 153 | −static void __init ts72xx_register_flash(struct mtd_partition *parts, int n, | |
| 154 | − resource_size_t start) | |
| 155 | −{ | |
| 156 | − /* | |
| 157 | − * TS7200 has NOR flash all other TS72xx board have NAND flash. | |
| 158 | − */ | |
| 159 | − if (board_is_ts7200()) { | |
| 160 | − ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); | |
| 161 | − } else { | |
| 162 | − ts72xx_nand_resource[0].start = start; | |
| 163 | − ts72xx_nand_resource[0].end = start + SZ_16M - 1; | |
| 164 | − | |
| 165 | − ts72xx_nand_data.chip.partitions = parts; | |
| 166 | − ts72xx_nand_data.chip.nr_partitions = n; | |
| 167 | − | |
| 168 | − platform_device_register(&ts72xx_nand_flash); | |
| 169 | − } | |
| 170 | −} | |
| 171 | − | |
| 172 | −/************************************************************************* | |
| 173 | − * RTC M48T86 | |
| 174 | − *************************************************************************/ | |
| 175 | −#define TS72XX_RTC_INDEX_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x00800000) | |
| 176 | −#define TS72XX_RTC_DATA_PHYS_BASE (EP93XX_CS1_PHYS_BASE + 0x01700000) | |
| 177 | − | |
| 178 | −static struct resource ts72xx_rtc_resources[] = { | |
| 179 | − DEFINE_RES_MEM(TS72XX_RTC_INDEX_PHYS_BASE, 0x01), | |
| 180 | − DEFINE_RES_MEM(TS72XX_RTC_DATA_PHYS_BASE, 0x01), | |
| 181 | −}; | |
| 182 | − | |
| 183 | −static struct platform_device ts72xx_rtc_device = { | |
| 184 | − .name = "rtc-m48t86", | |
| 185 | − .id = -1, | |
| 186 | − .resource = ts72xx_rtc_resources, | |
| 187 | − .num_resources = ARRAY_SIZE(ts72xx_rtc_resources), | |
| 188 | −}; | |
| 189 | − | |
| 190 | −/************************************************************************* | |
| 191 | − * Watchdog (in CPLD) | |
| 192 | − *************************************************************************/ | |
| 193 | −#define TS72XX_WDT_CONTROL_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03800000) | |
| 194 | −#define TS72XX_WDT_FEED_PHYS_BASE (EP93XX_CS2_PHYS_BASE + 0x03c00000) | |
| 195 | − | |
| 196 | −static struct resource ts72xx_wdt_resources[] = { | |
| 197 | − DEFINE_RES_MEM(TS72XX_WDT_CONTROL_PHYS_BASE, 0x01), | |
| 198 | − DEFINE_RES_MEM(TS72XX_WDT_FEED_PHYS_BASE, 0x01), | |
| 199 | −}; | |
| 200 | − | |
| 201 | −static struct platform_device ts72xx_wdt_device = { | |
| 202 | − .name = "ts72xx-wdt", | |
| 203 | − .id = -1, | |
| 204 | − .resource = ts72xx_wdt_resources, | |
| 205 | − .num_resources = ARRAY_SIZE(ts72xx_wdt_resources), | |
| 206 | −}; | |
| 207 | − | |
| 208 | −/************************************************************************* | |
| 209 | − * ETH | |
| 210 | − *************************************************************************/ | |
| 211 | −static struct ep93xx_eth_data __initdata ts72xx_eth_data = { | |
| 212 | − .phy_id = 1, | |
| 213 | −}; | |
| 214 | − | |
| 215 | −/************************************************************************* | |
| 216 | − * SPI SD/MMC host | |
| 217 | − *************************************************************************/ | |
| 218 | −#define BK3_EN_SDCARD_PHYS_BASE 0x12400000 | |
| 219 | −#define BK3_EN_SDCARD_PWR 0x0 | |
| 220 | −#define BK3_DIS_SDCARD_PWR 0x0C | |
| 221 | −static void bk3_mmc_spi_setpower(struct device *dev, unsigned int vdd) | |
| 222 | −{ | |
| 223 | − void __iomem *pwr_sd = ioremap(BK3_EN_SDCARD_PHYS_BASE, SZ_4K); | |
| 224 | − | |
| 225 | − if (!pwr_sd) { | |
| 226 | − pr_err("Failed to enable SD card power!"); | |
| 227 | − return; | |
| 228 | − } | |
| 229 | − | |
| 230 | − pr_debug("%s: SD card pwr %s VDD:0x%x\n", __func__, | |
| 231 | − !!vdd ? "ON" : "OFF", vdd); | |
| 232 | − | |
| 233 | − if (!!vdd) | |
| 234 | − __raw_writeb(BK3_EN_SDCARD_PWR, pwr_sd); | |
| 235 | − else | |
| 236 | − __raw_writeb(BK3_DIS_SDCARD_PWR, pwr_sd); | |
| 237 | − | |
| 238 | − iounmap(pwr_sd); | |
| 239 | −} | |
| 240 | − | |
| 241 | −static struct mmc_spi_platform_data bk3_spi_mmc_data = { | |
| 242 | − .detect_delay = 500, | |
| 243 | − .powerup_msecs = 100, | |
| 244 | − .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | |
| 245 | − .caps = MMC_CAP_NONREMOVABLE, | |
| 246 | − .setpower = bk3_mmc_spi_setpower, | |
| 247 | −}; | |
| 248 | − | |
| 249 | −/************************************************************************* | |
| 250 | − * SPI Bus - SD card access | |
| 251 | − *************************************************************************/ | |
| 252 | −static struct spi_board_info bk3_spi_board_info[] __initdata = { | |
| 253 | − { | |
| 254 | − .modalias = "mmc_spi", | |
| 255 | − .platform_data = &bk3_spi_mmc_data, | |
| 256 | − .max_speed_hz = 7.4E6, | |
| 257 | − .bus_num = 0, | |
| 258 | − .chip_select = 0, | |
| 259 | − .mode = SPI_MODE_0, | |
| 260 | − }, | |
| 261 | −}; | |
| 262 | − | |
| 263 | −/* | |
| 264 | − * This is a stub -> the FGPIO[3] pin is not connected on the schematic | |
| 265 | − * The all work is performed automatically by !SPI_FRAME (SFRM1) and | |
| 266 | − * goes through CPLD | |
| 267 | − */ | |
| 268 | −static struct gpiod_lookup_table bk3_spi_cs_gpio_table = { | |
| 269 | − .dev_id = "spi0", | |
| 270 | − .table = { | |
| 271 | − GPIO_LOOKUP("gpio-ep93xx.5", 3, "cs", GPIO_ACTIVE_LOW), | |
| 272 | − { }, | |
| 273 | − }, | |
| 274 | −}; | |
| 275 | − | |
| 276 | −static struct ep93xx_spi_info bk3_spi_master __initdata = { | |
| 277 | − .use_dma = 1, | |
| 278 | −}; | |
| 279 | − | |
| 280 | −/************************************************************************* | |
| 281 | − * TS72XX support code | |
| 282 | − *************************************************************************/ | |
| 283 | −#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX) | |
| 284 | − | |
| 285 | −/* Relative to EP93XX_CS1_PHYS_BASE */ | |
| 286 | −#define TS73XX_FPGA_LOADER_BASE 0x03c00000 | |
| 287 | − | |
| 288 | −static struct resource ts73xx_fpga_resources[] = { | |
| 289 | − { | |
| 290 | − .start = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE, | |
| 291 | − .end = EP93XX_CS1_PHYS_BASE + TS73XX_FPGA_LOADER_BASE + 1, | |
| 292 | − .flags = IORESOURCE_MEM, | |
| 293 | − }, | |
| 294 | −}; | |
| 295 | − | |
| 296 | −static struct platform_device ts73xx_fpga_device = { | |
| 297 | − .name = "ts73xx-fpga-mgr", | |
| 298 | − .id = -1, | |
| 299 | − .resource = ts73xx_fpga_resources, | |
| 300 | − .num_resources = ARRAY_SIZE(ts73xx_fpga_resources), | |
| 301 | −}; | |
| 302 | − | |
| 303 | −#endif | |
| 304 | − | |
| 305 | −/************************************************************************* | |
| 306 | − * SPI Bus | |
| 307 | − *************************************************************************/ | |
| 308 | −static struct spi_board_info ts72xx_spi_devices[] __initdata = { | |
| 309 | − { | |
| 310 | − .modalias = "tmp122", | |
| 311 | − .max_speed_hz = 2 * 1000 * 1000, | |
| 312 | − .bus_num = 0, | |
| 313 | − .chip_select = 0, | |
| 314 | − }, | |
| 315 | −}; | |
| 316 | − | |
| 317 | −static struct gpiod_lookup_table ts72xx_spi_cs_gpio_table = { | |
| 318 | − .dev_id = "spi0", | |
| 319 | − .table = { | |
| 320 | − /* DIO_17 */ | |
| 321 | − GPIO_LOOKUP("gpio-ep93xx.5", 2, "cs", GPIO_ACTIVE_LOW), | |
| 322 | − { }, | |
| 323 | − }, | |
| 324 | −}; | |
| 325 | − | |
| 326 | −static struct ep93xx_spi_info ts72xx_spi_info __initdata = { | |
| 327 | − /* Intentionally left blank */ | |
| 328 | −}; | |
| 329 | − | |
| 330 | −static void __init ts72xx_init_machine(void) | |
| 331 | −{ | |
| 332 | − ep93xx_init_devices(); | |
| 333 | − ts72xx_register_flash(ts72xx_nand_parts, ARRAY_SIZE(ts72xx_nand_parts), | |
| 334 | − is_ts9420_installed() ? | |
| 335 | − EP93XX_CS7_PHYS_BASE : EP93XX_CS6_PHYS_BASE); | |
| 336 | − platform_device_register(&ts72xx_rtc_device); | |
| 337 | − platform_device_register(&ts72xx_wdt_device); | |
| 338 | − | |
| 339 | − ep93xx_register_eth(&ts72xx_eth_data, 1); | |
| 340 | −#if IS_ENABLED(CONFIG_FPGA_MGR_TS73XX) | |
| 341 | − if (board_is_ts7300()) | |
| 342 | − platform_device_register(&ts73xx_fpga_device); | |
| 343 | −#endif | |
| 344 | − gpiod_add_lookup_table(&ts72xx_spi_cs_gpio_table); | |
| 345 | − ep93xx_register_spi(&ts72xx_spi_info, ts72xx_spi_devices, | |
| 346 | − ARRAY_SIZE(ts72xx_spi_devices)); | |
| 347 | −} | |
| 348 | − | |
| 349 | −MACHINE_START(TS72XX, "Technologic Systems TS-72xx SBC") | |
| 350 | − /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ | |
| 351 | − .atag_offset = 0x100, | |
| 352 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 353 | − .map_io = ts72xx_map_io, | |
| 354 | − .init_irq = ep93xx_init_irq, | |
| 355 | − .init_time = ep93xx_timer_init, | |
| 356 | − .init_machine = ts72xx_init_machine, | |
| 357 | − .restart = ep93xx_restart, | |
| 358 | −MACHINE_END | |
| 359 | − | |
| 360 | −/************************************************************************* | |
| 361 | − * EP93xx I2S audio peripheral handling | |
| 362 | − *************************************************************************/ | |
| 363 | −static struct resource ep93xx_i2s_resource[] = { | |
| 364 | − DEFINE_RES_MEM(EP93XX_I2S_PHYS_BASE, 0x100), | |
| 365 | − DEFINE_RES_IRQ_NAMED(IRQ_EP93XX_SAI, "spilink i2s slave"), | |
| 366 | −}; | |
| 367 | − | |
| 368 | −static struct platform_device ep93xx_i2s_device = { | |
| 369 | − .name = "ep93xx-spilink-i2s", | |
| 370 | − .id = -1, | |
| 371 | − .num_resources = ARRAY_SIZE(ep93xx_i2s_resource), | |
| 372 | − .resource = ep93xx_i2s_resource, | |
| 373 | −}; | |
| 374 | − | |
| 375 | −/************************************************************************* | |
| 376 | − * BK3 support code | |
| 377 | − *************************************************************************/ | |
| 378 | −static struct mtd_partition bk3_nand_parts[] = { | |
| 379 | − { | |
| 380 | − .name = "System", | |
| 381 | − .offset = 0x00000000, | |
| 382 | − .size = 0x01e00000, | |
| 383 | − }, { | |
| 384 | − .name = "Data", | |
| 385 | − .offset = 0x01e00000, | |
| 386 | − .size = 0x05f20000 | |
| 387 | − }, { | |
| 388 | − .name = "RedBoot", | |
| 389 | − .offset = 0x07d20000, | |
| 390 | − .size = 0x002e0000, | |
| 391 | − .mask_flags = MTD_WRITEABLE, /* force RO */ | |
| 392 | − }, | |
| 393 | −}; | |
| 394 | − | |
| 395 | −static void __init bk3_init_machine(void) | |
| 396 | −{ | |
| 397 | − ep93xx_init_devices(); | |
| 398 | − | |
| 399 | − ts72xx_register_flash(bk3_nand_parts, ARRAY_SIZE(bk3_nand_parts), | |
| 400 | − EP93XX_CS6_PHYS_BASE); | |
| 401 | − | |
| 402 | − ep93xx_register_eth(&ts72xx_eth_data, 1); | |
| 403 | − | |
| 404 | − gpiod_add_lookup_table(&bk3_spi_cs_gpio_table); | |
| 405 | − ep93xx_register_spi(&bk3_spi_master, bk3_spi_board_info, | |
| 406 | − ARRAY_SIZE(bk3_spi_board_info)); | |
| 407 | − | |
| 408 | − /* Configure ep93xx's I2S to use AC97 pins */ | |
| 409 | − ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_I2SONAC97); | |
| 410 | − platform_device_register(&ep93xx_i2s_device); | |
| 411 | −} | |
| 412 | − | |
| 413 | −MACHINE_START(BK3, "Liebherr controller BK3.1") | |
| 414 | − /* Maintainer: Lukasz Majewski <lukma@denx.de> */ | |
| 415 | − .atag_offset = 0x100, | |
| 416 | − .nr_irqs = NR_EP93XX_IRQS, | |
| 417 | − .map_io = ts72xx_map_io, | |
| 418 | − .init_irq = ep93xx_init_irq, | |
| 419 | − .init_time = ep93xx_timer_init, | |
| 420 | − .init_machine = bk3_init_machine, | |
| 421 | − .restart = ep93xx_restart, | |
| 422 | −MACHINE_END | |
| @@ -1,94 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/include/mach/ts72xx.h | |
| 4 | − */ | |
| 5 | − | |
| 6 | −/* | |
| 7 | − * TS72xx memory map: | |
| 8 | − * | |
| 9 | − * virt phys size | |
| 10 | − * febff000 22000000 4K model number register (bits 0-2) | |
| 11 | − * febfe000 22400000 4K options register | |
| 12 | − * febfd000 22800000 4K options register #2 | |
| 13 | − * febfc000 23400000 4K CPLD version register | |
| 14 | − */ | |
| 15 | − | |
| 16 | −#ifndef __TS72XX_H_ | |
| 17 | −#define __TS72XX_H_ | |
| 18 | − | |
| 19 | −#define TS72XX_MODEL_PHYS_BASE 0x22000000 | |
| 20 | −#define TS72XX_MODEL_VIRT_BASE IOMEM(0xfebff000) | |
| 21 | −#define TS72XX_MODEL_SIZE 0x00001000 | |
| 22 | − | |
| 23 | −#define TS72XX_MODEL_TS7200 0x00 | |
| 24 | −#define TS72XX_MODEL_TS7250 0x01 | |
| 25 | −#define TS72XX_MODEL_TS7260 0x02 | |
| 26 | −#define TS72XX_MODEL_TS7300 0x03 | |
| 27 | −#define TS72XX_MODEL_TS7400 0x04 | |
| 28 | −#define TS72XX_MODEL_MASK 0x07 | |
| 29 | − | |
| 30 | − | |
| 31 | −#define TS72XX_OPTIONS_PHYS_BASE 0x22400000 | |
| 32 | −#define TS72XX_OPTIONS_VIRT_BASE IOMEM(0xfebfe000) | |
| 33 | −#define TS72XX_OPTIONS_SIZE 0x00001000 | |
| 34 | − | |
| 35 | −#define TS72XX_OPTIONS_COM2_RS485 0x02 | |
| 36 | −#define TS72XX_OPTIONS_MAX197 0x01 | |
| 37 | − | |
| 38 | − | |
| 39 | −#define TS72XX_OPTIONS2_PHYS_BASE 0x22800000 | |
| 40 | −#define TS72XX_OPTIONS2_VIRT_BASE IOMEM(0xfebfd000) | |
| 41 | −#define TS72XX_OPTIONS2_SIZE 0x00001000 | |
| 42 | − | |
| 43 | −#define TS72XX_OPTIONS2_TS9420 0x04 | |
| 44 | −#define TS72XX_OPTIONS2_TS9420_BOOT 0x02 | |
| 45 | − | |
| 46 | −#define TS72XX_CPLDVER_PHYS_BASE 0x23400000 | |
| 47 | −#define TS72XX_CPLDVER_VIRT_BASE IOMEM(0xfebfc000) | |
| 48 | −#define TS72XX_CPLDVER_SIZE 0x00001000 | |
| 49 | − | |
| 50 | −#ifndef __ASSEMBLY__ | |
| 51 | − | |
| 52 | −static inline int ts72xx_model(void) | |
| 53 | −{ | |
| 54 | − return __raw_readb(TS72XX_MODEL_VIRT_BASE) & TS72XX_MODEL_MASK; | |
| 55 | −} | |
| 56 | − | |
| 57 | −static inline int board_is_ts7200(void) | |
| 58 | −{ | |
| 59 | − return ts72xx_model() == TS72XX_MODEL_TS7200; | |
| 60 | −} | |
| 61 | − | |
| 62 | −static inline int board_is_ts7250(void) | |
| 63 | −{ | |
| 64 | − return ts72xx_model() == TS72XX_MODEL_TS7250; | |
| 65 | −} | |
| 66 | − | |
| 67 | −static inline int board_is_ts7260(void) | |
| 68 | −{ | |
| 69 | − return ts72xx_model() == TS72XX_MODEL_TS7260; | |
| 70 | −} | |
| 71 | − | |
| 72 | −static inline int board_is_ts7300(void) | |
| 73 | −{ | |
| 74 | − return ts72xx_model() == TS72XX_MODEL_TS7300; | |
| 75 | −} | |
| 76 | − | |
| 77 | −static inline int board_is_ts7400(void) | |
| 78 | −{ | |
| 79 | − return ts72xx_model() == TS72XX_MODEL_TS7400; | |
| 80 | −} | |
| 81 | − | |
| 82 | −static inline int is_max197_installed(void) | |
| 83 | −{ | |
| 84 | − return !!(__raw_readb(TS72XX_OPTIONS_VIRT_BASE) & | |
| 85 | − TS72XX_OPTIONS_MAX197); | |
| 86 | −} | |
| 87 | − | |
| 88 | −static inline int is_ts9420_installed(void) | |
| 89 | −{ | |
| 90 | − return !!(__raw_readb(TS72XX_OPTIONS2_VIRT_BASE) & | |
| 91 | − TS72XX_OPTIONS2_TS9420); | |
| 92 | −} | |
| 93 | −#endif | |
| 94 | −#endif /* __TS72XX_H_ */ | |
| @@ -1,321 +0,0 @@ | ||
| 1 | −// SPDX-License-Identifier: GPL-2.0-or-later | |
| 2 | −/* | |
| 3 | − * arch/arm/mach-ep93xx/vision_ep9307.c | |
| 4 | − * Vision Engraving Systems EP9307 SoM support. | |
| 5 | − * | |
| 6 | − * Copyright (C) 2008-2011 Vision Engraving Systems | |
| 7 | − * H Hartley Sweeten <hsweeten@visionengravers.com> | |
| 8 | − */ | |
| 9 | − | |
| 10 | −#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
| 11 | − | |
| 12 | −#include <linux/kernel.h> | |
| 13 | −#include <linux/init.h> | |
| 14 | −#include <linux/platform_device.h> | |
| 15 | −#include <linux/irq.h> | |
| 16 | −#include <linux/gpio.h> | |
| 17 | −#include <linux/gpio/machine.h> | |
| 18 | −#include <linux/fb.h> | |
| 19 | −#include <linux/io.h> | |
| 20 | −#include <linux/mtd/partitions.h> | |
| 21 | −#include <linux/i2c.h> | |
| 22 | −#include <linux/platform_data/pca953x.h> | |
| 23 | −#include <linux/spi/spi.h> | |
| 24 | −#include <linux/spi/flash.h> | |
| 25 | −#include <linux/spi/mmc_spi.h> | |
| 26 | −#include <linux/mmc/host.h> | |
| 27 | − | |
| 28 | −#include <sound/cs4271.h> | |
| 29 | − | |
| 30 | −#include "hardware.h" | |
| 31 | −#include <linux/platform_data/video-ep93xx.h> | |
| 32 | −#include <linux/platform_data/spi-ep93xx.h> | |
| 33 | −#include "gpio-ep93xx.h" | |
| 34 | − | |
| 35 | −#include <asm/mach-types.h> | |
| 36 | −#include <asm/mach/map.h> | |
| 37 | −#include <asm/mach/arch.h> | |
| 38 | − | |
| 39 | −#include "soc.h" | |
| 40 | − | |
| 41 | −/************************************************************************* | |
| 42 | − * Static I/O mappings for the FPGA | |
| 43 | − *************************************************************************/ | |
| 44 | −#define VISION_PHYS_BASE EP93XX_CS7_PHYS_BASE | |
| 45 | −#define VISION_VIRT_BASE 0xfebff000 | |
| 46 | − | |
| 47 | −static struct map_desc vision_io_desc[] __initdata = { | |
| 48 | − { | |
| 49 | − .virtual = VISION_VIRT_BASE, | |
| 50 | − .pfn = __phys_to_pfn(VISION_PHYS_BASE), | |
| 51 | − .length = SZ_4K, | |
| 52 | − .type = MT_DEVICE, | |
| 53 | − }, | |
| 54 | −}; | |
| 55 | − | |
| 56 | −static void __init vision_map_io(void) | |
| 57 | −{ | |
| 58 | − ep93xx_map_io(); | |
| 59 | − | |
| 60 | − iotable_init(vision_io_desc, ARRAY_SIZE(vision_io_desc)); | |
| 61 | −} | |
| 62 | − | |
| 63 | −/************************************************************************* | |
| 64 | − * Ethernet | |
| 65 | − *************************************************************************/ | |
| 66 | −static struct ep93xx_eth_data vision_eth_data __initdata = { | |
| 67 | − .phy_id = 1, | |
| 68 | −}; | |
| 69 | − | |
| 70 | −/************************************************************************* | |
| 71 | − * Framebuffer | |
| 72 | − *************************************************************************/ | |
| 73 | −#define VISION_LCD_ENABLE EP93XX_GPIO_LINE_EGPIO1 | |
| 74 | − | |
| 75 | −static int vision_lcd_setup(struct platform_device *pdev) | |
| 76 | −{ | |
| 77 | − int err; | |
| 78 | − | |
| 79 | − err = gpio_request_one(VISION_LCD_ENABLE, GPIOF_INIT_HIGH, | |
| 80 | − dev_name(&pdev->dev)); | |
| 81 | − if (err) | |
| 82 | − return err; | |
| 83 | − | |
| 84 | − ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_RAS | | |
| 85 | − EP93XX_SYSCON_DEVCFG_RASONP3 | | |
| 86 | − EP93XX_SYSCON_DEVCFG_EXVC); | |
| 87 | − | |
| 88 | − return 0; | |
| 89 | −} | |
| 90 | − | |
| 91 | −static void vision_lcd_teardown(struct platform_device *pdev) | |
| 92 | −{ | |
| 93 | − gpio_free(VISION_LCD_ENABLE); | |
| 94 | −} | |
| 95 | − | |
| 96 | −static void vision_lcd_blank(int blank_mode, struct fb_info *info) | |
| 97 | −{ | |
| 98 | − if (blank_mode) | |
| 99 | − gpio_set_value(VISION_LCD_ENABLE, 0); | |
| 100 | − else | |
| 101 | − gpio_set_value(VISION_LCD_ENABLE, 1); | |
| 102 | −} | |
| 103 | − | |
| 104 | −static struct ep93xxfb_mach_info ep93xxfb_info __initdata = { | |
| 105 | − .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, | |
| 106 | − .setup = vision_lcd_setup, | |
| 107 | − .teardown = vision_lcd_teardown, | |
| 108 | − .blank = vision_lcd_blank, | |
| 109 | −}; | |
| 110 | − | |
| 111 | − | |
| 112 | −/************************************************************************* | |
| 113 | − * GPIO Expanders | |
| 114 | − *************************************************************************/ | |
| 115 | −#define PCA9539_74_GPIO_BASE (EP93XX_GPIO_LINE_MAX + 1) | |
| 116 | −#define PCA9539_75_GPIO_BASE (PCA9539_74_GPIO_BASE + 16) | |
| 117 | −#define PCA9539_76_GPIO_BASE (PCA9539_75_GPIO_BASE + 16) | |
| 118 | −#define PCA9539_77_GPIO_BASE (PCA9539_76_GPIO_BASE + 16) | |
| 119 | − | |
| 120 | −static struct pca953x_platform_data pca953x_74_gpio_data = { | |
| 121 | − .gpio_base = PCA9539_74_GPIO_BASE, | |
| 122 | − .irq_base = EP93XX_BOARD_IRQ(0), | |
| 123 | −}; | |
| 124 | − | |
| 125 | −static struct pca953x_platform_data pca953x_75_gpio_data = { | |
| 126 | − .gpio_base = PCA9539_75_GPIO_BASE, | |
| 127 | − .irq_base = -1, | |
| 128 | −}; | |
| 129 | − | |
| 130 | −static struct pca953x_platform_data pca953x_76_gpio_data = { | |
| 131 | − .gpio_base = PCA9539_76_GPIO_BASE, | |
| 132 | − .irq_base = -1, | |
| 133 | −}; | |
| 134 | − | |
| 135 | −static struct pca953x_platform_data pca953x_77_gpio_data = { | |
| 136 | − .gpio_base = PCA9539_77_GPIO_BASE, | |
| 137 | − .irq_base = -1, | |
| 138 | −}; | |
| 139 | − | |
| 140 | −/************************************************************************* | |
| 141 | − * I2C Bus | |
| 142 | − *************************************************************************/ | |
| 143 | − | |
| 144 | −static struct i2c_board_info vision_i2c_info[] __initdata = { | |
| 145 | − { | |
| 146 | − I2C_BOARD_INFO("isl1208", 0x6f), | |
| 147 | − .irq = IRQ_EP93XX_EXT1, | |
| 148 | − }, { | |
| 149 | − I2C_BOARD_INFO("pca9539", 0x74), | |
| 150 | − .platform_data = &pca953x_74_gpio_data, | |
| 151 | − }, { | |
| 152 | − I2C_BOARD_INFO("pca9539", 0x75), | |
| 153 | − .platform_data = &pca953x_75_gpio_data, | |
| 154 | − }, { | |
| 155 | − I2C_BOARD_INFO("pca9539", 0x76), | |
| 156 | − .platform_data = &pca953x_76_gpio_data, | |
| 157 | − }, { | |
| 158 | − I2C_BOARD_INFO("pca9539", 0x77), | |
| 159 | − .platform_data = &pca953x_77_gpio_data, | |
| 160 | − }, | |
| 161 | −}; | |
| 162 | − | |
| 163 | −/************************************************************************* | |
| 164 | − * SPI CS4271 Audio Codec | |
| 165 | − *************************************************************************/ | |
| 166 | −static struct cs4271_platform_data vision_cs4271_data = { | |
| 167 | − /* Intentionally left blank */ | |
| 168 | −}; | |
| 169 | − | |
| 170 | −/************************************************************************* | |
| 171 | − * SPI Flash | |
| 172 | − *************************************************************************/ | |
| 173 | −static struct mtd_partition vision_spi_flash_partitions[] = { | |
| 174 | − { | |
| 175 | − .name = "SPI bootstrap", | |
| 176 | − .offset = 0, | |
| 177 | − .size = SZ_4K, | |
| 178 | − }, { | |
| 179 | − .name = "Bootstrap config", | |
| 180 | − .offset = MTDPART_OFS_APPEND, | |
| 181 | − .size = SZ_4K, | |
| 182 | − }, { | |
| 183 | − .name = "System config", | |
| 184 | − .offset = MTDPART_OFS_APPEND, | |
| 185 | − .size = MTDPART_SIZ_FULL, | |
| 186 | − }, | |
| 187 | −}; | |
| 188 | − | |
| 189 | −static struct flash_platform_data vision_spi_flash_data = { | |
| 190 | − .name = "SPI Flash", | |
| 191 | − .parts = vision_spi_flash_partitions, | |
| 192 | − .nr_parts = ARRAY_SIZE(vision_spi_flash_partitions), | |
| 193 | −}; | |
| 194 | − | |
| 195 | −/************************************************************************* | |
| 196 | − * SPI SD/MMC host | |
| 197 | − *************************************************************************/ | |
| 198 | −static struct mmc_spi_platform_data vision_spi_mmc_data = { | |
| 199 | − .detect_delay = 100, | |
| 200 | − .powerup_msecs = 100, | |
| 201 | − .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | |
| 202 | − .caps2 = MMC_CAP2_RO_ACTIVE_HIGH, | |
| 203 | −}; | |
| 204 | − | |
| 205 | −static struct gpiod_lookup_table vision_spi_mmc_gpio_table = { | |
| 206 | − .dev_id = "mmc_spi.2", /* "mmc_spi @ CS2 */ | |
| 207 | − .table = { | |
| 208 | − /* Card detect */ | |
| 209 | − GPIO_LOOKUP_IDX("gpio-ep93xx.1", 7, NULL, 0, GPIO_ACTIVE_LOW), | |
| 210 | − /* Write protect */ | |
| 211 | − GPIO_LOOKUP_IDX("gpio-ep93xx.5", 0, NULL, 1, GPIO_ACTIVE_HIGH), | |
| 212 | − { }, | |
| 213 | − }, | |
| 214 | −}; | |
| 215 | − | |
| 216 | −/************************************************************************* | |
| 217 | − * SPI Bus | |
| 218 | − *************************************************************************/ | |
| 219 | −static struct spi_board_info vision_spi_board_info[] __initdata = { | |
| 220 | − { | |
| 221 | − .modalias = "cs4271", | |
| 222 | − .platform_data = &vision_cs4271_data, | |
| 223 | − .max_speed_hz = 6000000, | |
| 224 | − .bus_num = 0, | |
| 225 | − .chip_select = 0, | |
| 226 | − .mode = SPI_MODE_3, | |
| 227 | − }, { | |
| 228 | − .modalias = "sst25l", | |
| 229 | − .platform_data = &vision_spi_flash_data, | |
| 230 | − .max_speed_hz = 20000000, | |
| 231 | − .bus_num = 0, | |
| 232 | − .chip_select = 1, | |
| 233 | − .mode = SPI_MODE_3, | |
| 234 | − }, { | |
| 235 | − .modalias = "mmc_spi", | |
| 236 | − .platform_data = &vision_spi_mmc_data, | |
| 237 | − .max_speed_hz = 20000000, | |
| 238 | − .bus_num = 0, | |
| 239 | − .chip_select = 2, | |
| 240 | − .mode = SPI_MODE_3, | |
| 241 | − }, | |
| 242 | −}; | |
| 243 | − | |
| 244 | −static struct gpiod_lookup_table vision_spi_cs4271_gpio_table = { | |
| 245 | − .dev_id = "spi0.0", /* cs4271 @ CS0 */ | |
| 246 | − .table = { | |
| 247 | − /* RESET */ | |
| 248 | − GPIO_LOOKUP_IDX("H", 2, NULL, 0, GPIO_ACTIVE_LOW), | |
| 249 | − { }, | |
| 250 | − }, | |
| 251 | −}; | |
| 252 | − | |
| 253 | −static struct gpiod_lookup_table vision_spi_cs_gpio_table = { | |
| 254 | − .dev_id = "spi0", | |
| 255 | − .table = { | |
| 256 | − GPIO_LOOKUP_IDX("gpio-ep93xx.0", 6, "cs", 0, GPIO_ACTIVE_LOW), | |
| 257 | − GPIO_LOOKUP_IDX("gpio-ep93xx.0", 7, "cs", 1, GPIO_ACTIVE_LOW), | |
| 258 | − GPIO_LOOKUP_IDX("gpio-ep93xx.6", 2, "cs", 2, GPIO_ACTIVE_LOW), | |
| 259 | − { }, | |
| 260 | − }, | |
| 261 | −}; | |
| 262 | − | |
| 263 | −static struct ep93xx_spi_info vision_spi_master __initdata = { | |
| 264 | − .use_dma = 1, | |
| 265 | −}; | |
| 266 | − | |
| 267 | −/************************************************************************* | |
| 268 | − * I2S Audio | |
| 269 | − *************************************************************************/ | |
| 270 | −static struct platform_device vision_audio_device = { | |
| 271 | − .name = "edb93xx-audio", | |
| 272 | − .id = -1, | |
| 273 | −}; | |
| 274 | − | |
| 275 | −static void __init vision_register_i2s(void) | |
| 276 | −{ | |
| 277 | − ep93xx_register_i2s(); | |
| 278 | − platform_device_register(&vision_audio_device); | |
| 279 | −} | |
| 280 | − | |
| 281 | −/************************************************************************* | |
| 282 | − * Machine Initialization | |
| 283 | − *************************************************************************/ | |
| 284 | −static void __init vision_init_machine(void) | |
| 285 | −{ | |
| 286 | − ep93xx_init_devices(); | |
| 287 | − ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_64M); | |
| 288 | − ep93xx_register_eth(&vision_eth_data, 1); | |
| 289 | − ep93xx_register_fb(&ep93xxfb_info); | |
| 290 | − ep93xx_register_pwm(1, 0); | |
| 291 | − | |
| 292 | − /* | |
| 293 | − * Request the gpio expander's interrupt gpio line now to prevent | |
| 294 | − * the kernel from doing a WARN in gpiolib:gpio_ensure_requested(). | |
| 295 | − */ | |
| 296 | − if (gpio_request_one(EP93XX_GPIO_LINE_F(7), GPIOF_DIR_IN, | |
| 297 | − "pca9539:74")) | |
| 298 | − pr_warn("cannot request interrupt gpio for pca9539:74\n"); | |
| 299 | − | |
| 300 | − vision_i2c_info[1].irq = gpio_to_irq(EP93XX_GPIO_LINE_F(7)); | |
| 301 | − | |
| 302 | − ep93xx_register_i2c(vision_i2c_info, | |
| 303 | − ARRAY_SIZE(vision_i2c_info)); | |
| 304 | − gpiod_add_lookup_table(&vision_spi_cs4271_gpio_table); | |
| 305 | − gpiod_add_lookup_table(&vision_spi_mmc_gpio_table); | |
| 306 | − gpiod_add_lookup_table(&vision_spi_cs_gpio_table); | |
| 307 | − ep93xx_register_spi(&vision_spi_master, vision_spi_board_info, | |
| 308 | − ARRAY_SIZE(vision_spi_board_info)); | |
| 309 | − vision_register_i2s(); | |
| 310 | −} | |
| 311 | − | |
| 312 | −MACHINE_START(VISION_EP9307, "Vision Engraving Systems EP9307") | |
| 313 | − /* Maintainer: H Hartley Sweeten <hsweeten@visionengravers.com> */ | |
| 314 | − .atag_offset = 0x100, | |
| 315 | − .nr_irqs = NR_EP93XX_IRQS + EP93XX_BOARD_IRQS, | |
| 316 | − .map_io = vision_map_io, | |
| 317 | − .init_irq = ep93xx_init_irq, | |
| 318 | − .init_time = ep93xx_timer_init, | |
| 319 | − .init_machine = vision_init_machine, | |
| 320 | − .restart = ep93xx_restart, | |
| 321 | −MACHINE_END | |
| @@ -1,15 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef __ASM_MACH_EP93XX_SPI_H | |
| 3 | −#define __ASM_MACH_EP93XX_SPI_H | |
| 4 | − | |
| 5 | −struct spi_device; | |
| 6 | − | |
| 7 | −/** | |
| 8 | − * struct ep93xx_spi_info - EP93xx specific SPI descriptor | |
| 9 | − * @use_dma: use DMA for the transfers | |
| 10 | − */ | |
| 11 | −struct ep93xx_spi_info { | |
| 12 | − bool use_dma; | |
| 13 | −}; | |
| 14 | − | |
| 15 | −#endif /* __ASM_MACH_EP93XX_SPI_H */ | |