linux/arch/blackfin/mach-bf561/boards/cm_bf561.c
<<
>>
Prefs
   1/*
   2 * Copyright 2004-2009 Analog Devices Inc.
   3 *               2008-2009 Bluetechnix
   4 *               2005 National ICT Australia (NICTA)
   5 *                    Aidan Williams <aidan@nicta.com.au>
   6 *
   7 * Licensed under the GPL-2 or later.
   8 */
   9
  10#include <linux/device.h>
  11#include <linux/platform_device.h>
  12#include <linux/mtd/mtd.h>
  13#include <linux/mtd/partitions.h>
  14#include <linux/spi/spi.h>
  15#include <linux/spi/flash.h>
  16#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
  17#include <linux/usb/isp1362.h>
  18#endif
  19#include <linux/ata_platform.h>
  20#include <linux/irq.h>
  21#include <asm/dma.h>
  22#include <asm/bfin5xx_spi.h>
  23#include <asm/portmux.h>
  24#include <asm/dpmc.h>
  25#include <linux/mtd/physmap.h>
  26
  27/*
  28 * Name the Board for the /proc/cpuinfo
  29 */
  30const char bfin_board_name[] = "Bluetechnix CM BF561";
  31
  32#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
  33/* all SPI peripherals info goes here */
  34
  35#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  36static struct mtd_partition bfin_spi_flash_partitions[] = {
  37        {
  38                .name = "bootloader(spi)",
  39                .size = 0x00020000,
  40                .offset = 0,
  41                .mask_flags = MTD_CAP_ROM
  42        }, {
  43                .name = "linux kernel(spi)",
  44                .size = 0xe0000,
  45                .offset = 0x20000
  46        }, {
  47                .name = "file system(spi)",
  48                .size = 0x700000,
  49                .offset = 0x00100000,
  50        }
  51};
  52
  53static struct flash_platform_data bfin_spi_flash_data = {
  54        .name = "m25p80",
  55        .parts = bfin_spi_flash_partitions,
  56        .nr_parts = ARRAY_SIZE(bfin_spi_flash_partitions),
  57        .type = "m25p64",
  58};
  59
  60/* SPI flash chip (m25p64) */
  61static struct bfin5xx_spi_chip spi_flash_chip_info = {
  62        .enable_dma = 0,         /* use dma transfer with this chip*/
  63        .bits_per_word = 8,
  64};
  65#endif
  66
  67#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
  68/* SPI ADC chip */
  69static struct bfin5xx_spi_chip spi_adc_chip_info = {
  70        .enable_dma = 1,         /* use dma transfer with this chip*/
  71        .bits_per_word = 16,
  72};
  73#endif
  74
  75#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
  76static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
  77        .enable_dma = 0,
  78        .bits_per_word = 16,
  79};
  80#endif
  81
  82#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
  83static struct bfin5xx_spi_chip mmc_spi_chip_info = {
  84        .enable_dma = 0,
  85        .bits_per_word = 8,
  86};
  87#endif
  88
  89static struct spi_board_info bfin_spi_board_info[] __initdata = {
  90#if defined(CONFIG_MTD_M25P80) || defined(CONFIG_MTD_M25P80_MODULE)
  91        {
  92                /* the modalias must be the same as spi device driver name */
  93                .modalias = "m25p80", /* Name of spi_driver for this device */
  94                .max_speed_hz = 25000000,     /* max spi clock (SCK) speed in HZ */
  95                .bus_num = 0, /* Framework bus number */
  96                .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/
  97                .platform_data = &bfin_spi_flash_data,
  98                .controller_data = &spi_flash_chip_info,
  99                .mode = SPI_MODE_3,
 100        },
 101#endif
 102
 103#if defined(CONFIG_BFIN_SPI_ADC) || defined(CONFIG_BFIN_SPI_ADC_MODULE)
 104        {
 105                .modalias = "bfin_spi_adc", /* Name of spi_driver for this device */
 106                .max_speed_hz = 6250000,     /* max spi clock (SCK) speed in HZ */
 107                .bus_num = 0, /* Framework bus number */
 108                .chip_select = 1, /* Framework chip select. */
 109                .platform_data = NULL, /* No spi_driver specific config */
 110                .controller_data = &spi_adc_chip_info,
 111        },
 112#endif
 113
 114#if defined(CONFIG_SND_BLACKFIN_AD1836) || defined(CONFIG_SND_BLACKFIN_AD1836_MODULE)
 115        {
 116                .modalias = "ad1836",
 117                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
 118                .bus_num = 0,
 119                .chip_select = CONFIG_SND_BLACKFIN_SPI_PFBIT,
 120                .controller_data = &ad1836_spi_chip_info,
 121        },
 122#endif
 123#if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
 124        {
 125                .modalias = "mmc_spi",
 126                .max_speed_hz = 20000000,     /* max spi clock (SCK) speed in HZ */
 127                .bus_num = 0,
 128                .chip_select = 1,
 129                .controller_data = &mmc_spi_chip_info,
 130                .mode = SPI_MODE_3,
 131        },
 132#endif
 133};
 134
 135/* SPI (0) */
 136static struct resource bfin_spi0_resource[] = {
 137        [0] = {
 138                .start = SPI0_REGBASE,
 139                .end   = SPI0_REGBASE + 0xFF,
 140                .flags = IORESOURCE_MEM,
 141        },
 142        [1] = {
 143                .start = CH_SPI,
 144                .end   = CH_SPI,
 145                .flags = IORESOURCE_DMA,
 146        },
 147        [2] = {
 148                .start = IRQ_SPI,
 149                .end   = IRQ_SPI,
 150                .flags = IORESOURCE_IRQ,
 151        },
 152};
 153
 154/* SPI controller data */
 155static struct bfin5xx_spi_master bfin_spi0_info = {
 156        .num_chipselect = 8,
 157        .enable_dma = 1,  /* master has the ability to do dma transfer */
 158        .pin_req = {P_SPI0_SCK, P_SPI0_MISO, P_SPI0_MOSI, 0},
 159};
 160
 161static struct platform_device bfin_spi0_device = {
 162        .name = "bfin-spi",
 163        .id = 0, /* Bus number */
 164        .num_resources = ARRAY_SIZE(bfin_spi0_resource),
 165        .resource = bfin_spi0_resource,
 166        .dev = {
 167                .platform_data = &bfin_spi0_info, /* Passed to driver */
 168        },
 169};
 170#endif  /* spi master and devices */
 171
 172
 173#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
 174static struct platform_device hitachi_fb_device = {
 175        .name = "hitachi-tx09",
 176};
 177#endif
 178
 179
 180#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
 181#include <linux/smc91x.h>
 182
 183static struct smc91x_platdata smc91x_info = {
 184        .flags = SMC91X_USE_32BIT | SMC91X_NOWAIT,
 185        .leda = RPC_LED_100_10,
 186        .ledb = RPC_LED_TX_RX,
 187};
 188
 189static struct resource smc91x_resources[] = {
 190        {
 191                .name = "smc91x-regs",
 192                .start = 0x28000300,
 193                .end = 0x28000300 + 16,
 194                .flags = IORESOURCE_MEM,
 195        }, {
 196                .start = IRQ_PF0,
 197                .end = IRQ_PF0,
 198                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 199        },
 200};
 201static struct platform_device smc91x_device = {
 202        .name = "smc91x",
 203        .id = 0,
 204        .num_resources = ARRAY_SIZE(smc91x_resources),
 205        .resource = smc91x_resources,
 206        .dev    = {
 207                .platform_data  = &smc91x_info,
 208        },
 209};
 210#endif
 211
 212#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 213#include <linux/smsc911x.h>
 214
 215static struct resource smsc911x_resources[] = {
 216        {
 217                .name = "smsc911x-memory",
 218                .start = 0x24008000,
 219                .end = 0x24008000 + 0xFF,
 220                .flags = IORESOURCE_MEM,
 221        },
 222        {
 223                .start = IRQ_PF43,
 224                .end = IRQ_PF43,
 225                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
 226        },
 227};
 228
 229static struct smsc911x_platform_config smsc911x_config = {
 230        .flags = SMSC911X_USE_16BIT,
 231        .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
 232        .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
 233        .phy_interface = PHY_INTERFACE_MODE_MII,
 234};
 235
 236static struct platform_device smsc911x_device = {
 237        .name = "smsc911x",
 238        .id = 0,
 239        .num_resources = ARRAY_SIZE(smsc911x_resources),
 240        .resource = smsc911x_resources,
 241        .dev = {
 242                .platform_data = &smsc911x_config,
 243        },
 244};
 245#endif
 246
 247#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
 248static struct resource net2272_bfin_resources[] = {
 249        {
 250                .start = 0x24000000,
 251                .end = 0x24000000 + 0x100,
 252                .flags = IORESOURCE_MEM,
 253        }, {
 254                .start = IRQ_PF45,
 255                .end = IRQ_PF45,
 256                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 257        },
 258};
 259
 260static struct platform_device net2272_bfin_device = {
 261        .name = "net2272",
 262        .id = -1,
 263        .num_resources = ARRAY_SIZE(net2272_bfin_resources),
 264        .resource = net2272_bfin_resources,
 265};
 266#endif
 267
 268#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
 269static struct resource isp1362_hcd_resources[] = {
 270        {
 271                .start = 0x24008000,
 272                .end = 0x24008000,
 273                .flags = IORESOURCE_MEM,
 274        }, {
 275                .start = 0x24008004,
 276                .end = 0x24008004,
 277                .flags = IORESOURCE_MEM,
 278        }, {
 279                .start = IRQ_PF47,
 280                .end = IRQ_PF47,
 281                .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
 282        },
 283};
 284
 285static struct isp1362_platform_data isp1362_priv = {
 286        .sel15Kres = 1,
 287        .clknotstop = 0,
 288        .oc_enable = 0,
 289        .int_act_high = 0,
 290        .int_edge_triggered = 0,
 291        .remote_wakeup_connected = 0,
 292        .no_power_switching = 1,
 293        .power_switching_mode = 0,
 294};
 295
 296static struct platform_device isp1362_hcd_device = {
 297        .name = "isp1362-hcd",
 298        .id = 0,
 299        .dev = {
 300                .platform_data = &isp1362_priv,
 301        },
 302        .num_resources = ARRAY_SIZE(isp1362_hcd_resources),
 303        .resource = isp1362_hcd_resources,
 304};
 305#endif
 306
 307#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 308static struct resource bfin_uart_resources[] = {
 309        {
 310                .start = 0xFFC00400,
 311                .end = 0xFFC004FF,
 312                .flags = IORESOURCE_MEM,
 313        },
 314};
 315
 316static struct platform_device bfin_uart_device = {
 317        .name = "bfin-uart",
 318        .id = 1,
 319        .num_resources = ARRAY_SIZE(bfin_uart_resources),
 320        .resource = bfin_uart_resources,
 321};
 322#endif
 323
 324#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
 325#ifdef CONFIG_BFIN_SIR0
 326static struct resource bfin_sir0_resources[] = {
 327        {
 328                .start = 0xFFC00400,
 329                .end = 0xFFC004FF,
 330                .flags = IORESOURCE_MEM,
 331        },
 332        {
 333                .start = IRQ_UART0_RX,
 334                .end = IRQ_UART0_RX+1,
 335                .flags = IORESOURCE_IRQ,
 336        },
 337        {
 338                .start = CH_UART0_RX,
 339                .end = CH_UART0_RX+1,
 340                .flags = IORESOURCE_DMA,
 341        },
 342};
 343
 344static struct platform_device bfin_sir0_device = {
 345        .name = "bfin_sir",
 346        .id = 0,
 347        .num_resources = ARRAY_SIZE(bfin_sir0_resources),
 348        .resource = bfin_sir0_resources,
 349};
 350#endif
 351#endif
 352
 353#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
 354#define PATA_INT        IRQ_PF46
 355
 356static struct pata_platform_info bfin_pata_platform_data = {
 357        .ioport_shift = 2,
 358        .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED,
 359};
 360
 361static struct resource bfin_pata_resources[] = {
 362        {
 363                .start = 0x2400C000,
 364                .end = 0x2400C001F,
 365                .flags = IORESOURCE_MEM,
 366        },
 367        {
 368                .start = 0x2400D018,
 369                .end = 0x2400D01B,
 370                .flags = IORESOURCE_MEM,
 371        },
 372        {
 373                .start = PATA_INT,
 374                .end = PATA_INT,
 375                .flags = IORESOURCE_IRQ,
 376        },
 377};
 378
 379static struct platform_device bfin_pata_device = {
 380        .name = "pata_platform",
 381        .id = -1,
 382        .num_resources = ARRAY_SIZE(bfin_pata_resources),
 383        .resource = bfin_pata_resources,
 384        .dev = {
 385                .platform_data = &bfin_pata_platform_data,
 386        }
 387};
 388#endif
 389
 390#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
 391static struct mtd_partition para_partitions[] = {
 392        {
 393                .name       = "bootloader(nor)",
 394                .size       = 0x40000,
 395                .offset     = 0,
 396        }, {
 397                .name       = "linux kernel(nor)",
 398                .size       = 0x100000,
 399                .offset     = MTDPART_OFS_APPEND,
 400        }, {
 401                .name       = "file system(nor)",
 402                .size       = MTDPART_SIZ_FULL,
 403                .offset     = MTDPART_OFS_APPEND,
 404        }
 405};
 406
 407static struct physmap_flash_data para_flash_data = {
 408        .width      = 2,
 409        .parts      = para_partitions,
 410        .nr_parts   = ARRAY_SIZE(para_partitions),
 411};
 412
 413static struct resource para_flash_resource = {
 414        .start = 0x20000000,
 415        .end   = 0x207fffff,
 416        .flags = IORESOURCE_MEM,
 417};
 418
 419static struct platform_device para_flash_device = {
 420        .name          = "physmap-flash",
 421        .id            = 0,
 422        .dev = {
 423                .platform_data = &para_flash_data,
 424        },
 425        .num_resources = 1,
 426        .resource      = &para_flash_resource,
 427};
 428#endif
 429
 430static const unsigned int cclk_vlev_datasheet[] =
 431{
 432        VRPAIR(VLEV_085, 250000000),
 433        VRPAIR(VLEV_090, 300000000),
 434        VRPAIR(VLEV_095, 313000000),
 435        VRPAIR(VLEV_100, 350000000),
 436        VRPAIR(VLEV_105, 400000000),
 437        VRPAIR(VLEV_110, 444000000),
 438        VRPAIR(VLEV_115, 450000000),
 439        VRPAIR(VLEV_120, 475000000),
 440        VRPAIR(VLEV_125, 500000000),
 441        VRPAIR(VLEV_130, 600000000),
 442};
 443
 444static struct bfin_dpmc_platform_data bfin_dmpc_vreg_data = {
 445        .tuple_tab = cclk_vlev_datasheet,
 446        .tabsize = ARRAY_SIZE(cclk_vlev_datasheet),
 447        .vr_settling_time = 25 /* us */,
 448};
 449
 450static struct platform_device bfin_dpmc = {
 451        .name = "bfin dpmc",
 452        .dev = {
 453                .platform_data = &bfin_dmpc_vreg_data,
 454        },
 455};
 456
 457static struct platform_device *cm_bf561_devices[] __initdata = {
 458
 459        &bfin_dpmc,
 460
 461#if defined(CONFIG_FB_HITACHI_TX09) || defined(CONFIG_FB_HITACHI_TX09_MODULE)
 462        &hitachi_fb_device,
 463#endif
 464
 465#if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
 466        &bfin_uart_device,
 467#endif
 468
 469#if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
 470#ifdef CONFIG_BFIN_SIR0
 471        &bfin_sir0_device,
 472#endif
 473#endif
 474
 475#if defined(CONFIG_USB_ISP1362_HCD) || defined(CONFIG_USB_ISP1362_HCD_MODULE)
 476        &isp1362_hcd_device,
 477#endif
 478
 479#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
 480        &smc91x_device,
 481#endif
 482
 483#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 484        &smsc911x_device,
 485#endif
 486
 487#if defined(CONFIG_USB_NET2272) || defined(CONFIG_USB_NET2272_MODULE)
 488        &net2272_bfin_device,
 489#endif
 490
 491#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
 492        &bfin_spi0_device,
 493#endif
 494
 495#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
 496        &bfin_pata_device,
 497#endif
 498
 499#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
 500        &para_flash_device,
 501#endif
 502};
 503
 504static int __init cm_bf561_init(void)
 505{
 506        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 507        platform_add_devices(cm_bf561_devices, ARRAY_SIZE(cm_bf561_devices));
 508#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
 509        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
 510#endif
 511
 512#if defined(CONFIG_PATA_PLATFORM) || defined(CONFIG_PATA_PLATFORM_MODULE)
 513        irq_desc[PATA_INT].status |= IRQ_NOAUTOEN;
 514#endif
 515        return 0;
 516}
 517
 518arch_initcall(cm_bf561_init);
 519