diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/mpc52xx_psc_spi.c | 77 | ||||
-rw-r--r-- | drivers/spi/spi_mpc83xx.c | 6 |
2 files changed, 6 insertions, 77 deletions
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index 7051e6c5edc3..253ed5682a6d 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
@@ -330,75 +330,13 @@ static void mpc52xx_psc_spi_cleanup(struct spi_device *spi) | |||
330 | 330 | ||
331 | static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) | 331 | static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) |
332 | { | 332 | { |
333 | struct mpc52xx_cdm __iomem *cdm; | ||
334 | struct mpc52xx_gpio __iomem *gpio; | ||
335 | struct mpc52xx_psc __iomem *psc = mps->psc; | 333 | struct mpc52xx_psc __iomem *psc = mps->psc; |
336 | u32 ul; | ||
337 | u32 mclken_div; | 334 | u32 mclken_div; |
338 | int ret = 0; | 335 | int ret = 0; |
339 | 336 | ||
340 | #if defined(CONFIG_PPC_MERGE) | ||
341 | cdm = mpc52xx_find_and_map("mpc5200-cdm"); | ||
342 | gpio = mpc52xx_find_and_map("mpc5200-gpio"); | ||
343 | #else | ||
344 | cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE); | ||
345 | gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); | ||
346 | #endif | ||
347 | if (!cdm || !gpio) { | ||
348 | printk(KERN_ERR "Error mapping CDM/GPIO\n"); | ||
349 | ret = -EFAULT; | ||
350 | goto unmap_regs; | ||
351 | } | ||
352 | |||
353 | /* default sysclk is 512MHz */ | 337 | /* default sysclk is 512MHz */ |
354 | mclken_div = 0x8000 | | 338 | mclken_div = (mps->sysclk ? mps->sysclk : 512000000) / MCLK; |
355 | (((mps->sysclk ? mps->sysclk : 512000000) / MCLK) & 0x1FF); | 339 | mpc52xx_set_psc_clkdiv(psc_id, mclken_div); |
356 | |||
357 | switch (psc_id) { | ||
358 | case 1: | ||
359 | ul = in_be32(&gpio->port_config); | ||
360 | ul &= 0xFFFFFFF8; | ||
361 | ul |= 0x00000006; | ||
362 | out_be32(&gpio->port_config, ul); | ||
363 | out_be16(&cdm->mclken_div_psc1, mclken_div); | ||
364 | ul = in_be32(&cdm->clk_enables); | ||
365 | ul |= 0x00000020; | ||
366 | out_be32(&cdm->clk_enables, ul); | ||
367 | break; | ||
368 | case 2: | ||
369 | ul = in_be32(&gpio->port_config); | ||
370 | ul &= 0xFFFFFF8F; | ||
371 | ul |= 0x00000060; | ||
372 | out_be32(&gpio->port_config, ul); | ||
373 | out_be16(&cdm->mclken_div_psc2, mclken_div); | ||
374 | ul = in_be32(&cdm->clk_enables); | ||
375 | ul |= 0x00000040; | ||
376 | out_be32(&cdm->clk_enables, ul); | ||
377 | break; | ||
378 | case 3: | ||
379 | ul = in_be32(&gpio->port_config); | ||
380 | ul &= 0xFFFFF0FF; | ||
381 | ul |= 0x00000600; | ||
382 | out_be32(&gpio->port_config, ul); | ||
383 | out_be16(&cdm->mclken_div_psc3, mclken_div); | ||
384 | ul = in_be32(&cdm->clk_enables); | ||
385 | ul |= 0x00000080; | ||
386 | out_be32(&cdm->clk_enables, ul); | ||
387 | break; | ||
388 | case 6: | ||
389 | ul = in_be32(&gpio->port_config); | ||
390 | ul &= 0xFF8FFFFF; | ||
391 | ul |= 0x00700000; | ||
392 | out_be32(&gpio->port_config, ul); | ||
393 | out_be16(&cdm->mclken_div_psc6, mclken_div); | ||
394 | ul = in_be32(&cdm->clk_enables); | ||
395 | ul |= 0x00000010; | ||
396 | out_be32(&cdm->clk_enables, ul); | ||
397 | break; | ||
398 | default: | ||
399 | ret = -EINVAL; | ||
400 | goto unmap_regs; | ||
401 | } | ||
402 | 340 | ||
403 | /* Reset the PSC into a known state */ | 341 | /* Reset the PSC into a known state */ |
404 | out_8(&psc->command, MPC52xx_PSC_RST_RX); | 342 | out_8(&psc->command, MPC52xx_PSC_RST_RX); |
@@ -422,12 +360,6 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps) | |||
422 | 360 | ||
423 | mps->bits_per_word = 8; | 361 | mps->bits_per_word = 8; |
424 | 362 | ||
425 | unmap_regs: | ||
426 | if (cdm) | ||
427 | iounmap(cdm); | ||
428 | if (gpio) | ||
429 | iounmap(gpio); | ||
430 | |||
431 | return ret; | 363 | return ret; |
432 | } | 364 | } |
433 | 365 | ||
@@ -623,8 +555,9 @@ static int __exit mpc52xx_psc_spi_of_remove(struct of_device *op) | |||
623 | } | 555 | } |
624 | 556 | ||
625 | static struct of_device_id mpc52xx_psc_spi_of_match[] = { | 557 | static struct of_device_id mpc52xx_psc_spi_of_match[] = { |
626 | { .type = "spi", .compatible = "mpc5200-psc-spi", }, | 558 | { .compatible = "fsl,mpc5200-psc-spi", }, |
627 | {}, | 559 | { .compatible = "mpc5200-psc-spi", }, /* old */ |
560 | {} | ||
628 | }; | 561 | }; |
629 | 562 | ||
630 | MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); | 563 | MODULE_DEVICE_TABLE(of, mpc52xx_psc_spi_of_match); |
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c index 4580b9cf625d..04f7cd9fc261 100644 --- a/drivers/spi/spi_mpc83xx.c +++ b/drivers/spi/spi_mpc83xx.c | |||
@@ -436,11 +436,7 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev) | |||
436 | mpc83xx_spi->qe_mode = pdata->qe_mode; | 436 | mpc83xx_spi->qe_mode = pdata->qe_mode; |
437 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; | 437 | mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8; |
438 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; | 438 | mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8; |
439 | 439 | mpc83xx_spi->spibrg = pdata->sysclk; | |
440 | if (mpc83xx_spi->qe_mode) | ||
441 | mpc83xx_spi->spibrg = pdata->sysclk / 2; | ||
442 | else | ||
443 | mpc83xx_spi->spibrg = pdata->sysclk; | ||
444 | 440 | ||
445 | mpc83xx_spi->rx_shift = 0; | 441 | mpc83xx_spi->rx_shift = 0; |
446 | mpc83xx_spi->tx_shift = 0; | 442 | mpc83xx_spi->tx_shift = 0; |