static void __init lager_add_standard_devices(void) { r8a7790_clock_init(); pinctrl_register_mappings(lager_pinctrl_map, ARRAY_SIZE(lager_pinctrl_map)); r8a7790_pinmux_init(); r8a7790_add_standard_devices(); platform_device_register_data(&platform_bus, "leds-gpio", -1, &lager_leds_pdata, sizeof(lager_leds_pdata)); platform_device_register_data(&platform_bus, "gpio-keys", -1, &lager_keys_pdata, sizeof(lager_keys_pdata)); regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, ARRAY_SIZE(fixed3v3_power_consumers), 3300000); platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, mmcif1_resources, ARRAY_SIZE(mmcif1_resources), &mmcif1_pdata, sizeof(mmcif1_pdata)); platform_device_register_resndata(&platform_bus, "r8a7790-ether", -1, ether_resources, ARRAY_SIZE(ether_resources), ðer_pdata, sizeof(ether_pdata)); lager_add_du_device(); }
static void __init ape6evm_add_standard_devices(void) { struct clk *parent; struct clk *mp; r8a73a4_clock_init(); /* MP clock parent = extal2 */ parent = clk_get(NULL, "extal2"); mp = clk_get(NULL, "mp"); BUG_ON(IS_ERR(parent) || IS_ERR(mp)); clk_set_parent(mp, parent); clk_put(parent); clk_put(mp); pinctrl_register_mappings(ape6evm_pinctrl_map, ARRAY_SIZE(ape6evm_pinctrl_map)); r8a73a4_pinmux_init(); r8a73a4_add_standard_devices(); /* LAN9220 ethernet */ gpio_request_one(270, GPIOF_OUT_INIT_HIGH, NULL); /* smsc9220 RESET */ regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); platform_device_register_resndata(NULL, "smsc911x", -1, lan9220_res, ARRAY_SIZE(lan9220_res), &lan9220_data, sizeof(lan9220_data)); regulator_register_always_on(1, "MMC0 Vcc", vcc_mmc0_consumers, ARRAY_SIZE(vcc_mmc0_consumers), 2800000); platform_device_register_resndata(NULL, "sh_mmcif", 0, mmcif0_resources, ARRAY_SIZE(mmcif0_resources), &mmcif0_pdata, sizeof(mmcif0_pdata)); platform_device_register_data(NULL, "reg-fixed-voltage", 2, &vcc_sdhi0_info, sizeof(vcc_sdhi0_info)); platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0, sdhi0_resources, ARRAY_SIZE(sdhi0_resources), &sdhi0_pdata, sizeof(sdhi0_pdata)); regulator_register_always_on(3, "SDHI1 Vcc", vcc_sdhi1_consumers, ARRAY_SIZE(vcc_sdhi1_consumers), 3300000); platform_device_register_resndata(NULL, "sh_mobile_sdhi", 1, sdhi1_resources, ARRAY_SIZE(sdhi1_resources), &sdhi1_pdata, sizeof(sdhi1_pdata)); platform_device_register_data(NULL, "gpio-keys", -1, &ape6evm_keys_pdata, sizeof(ape6evm_keys_pdata)); platform_device_register_data(NULL, "leds-gpio", -1, &ape6evm_leds_pdata, sizeof(ape6evm_leds_pdata)); }
static void __init lager_add_standard_devices(void) { int fixed_regulator_idx = 0; int gpio_regulator_idx = 0; r8a7790_clock_init(); pinctrl_register_mappings(lager_pinctrl_map, ARRAY_SIZE(lager_pinctrl_map)); r8a7790_pinmux_init(); r8a7790_add_standard_devices(); platform_device_register_data(&platform_bus, "leds-gpio", -1, &lager_leds_pdata, sizeof(lager_leds_pdata)); platform_device_register_data(&platform_bus, "gpio-keys", -1, &lager_keys_pdata, sizeof(lager_keys_pdata)); regulator_register_always_on(fixed_regulator_idx++, "fixed-3.3V", fixed3v3_power_consumers, ARRAY_SIZE(fixed3v3_power_consumers), 3300000); platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, mmcif1_resources, ARRAY_SIZE(mmcif1_resources), &mmcif1_pdata, sizeof(mmcif1_pdata)); platform_device_register_resndata(&platform_bus, "r8a7790-ether", -1, ether_resources, ARRAY_SIZE(ether_resources), ðer_pdata, sizeof(ether_pdata)); lager_add_du_device(); platform_device_register_resndata(&platform_bus, "qspi", 0, qspi_resources, ARRAY_SIZE(qspi_resources), &qspi_pdata, sizeof(qspi_pdata)); spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, &vcc_sdhi0_info, sizeof(struct fixed_voltage_config)); platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++, &vcc_sdhi2_info, sizeof(struct fixed_voltage_config)); platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, &vccq_sdhi0_info, sizeof(struct gpio_regulator_config)); platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++, &vccq_sdhi2_info, sizeof(struct gpio_regulator_config)); }
static void __init ath79_usb_register(const char *name, int id, unsigned long base, unsigned long size, int irq, const void *data, size_t data_size) { struct resource res[2]; struct platform_device *pdev; memset(res, 0, sizeof(res)); res[0].flags = IORESOURCE_MEM; res[0].start = base; res[0].end = base + size - 1; res[1].flags = IORESOURCE_IRQ; res[1].start = irq; res[1].end = irq; pdev = platform_device_register_resndata(NULL, name, id, res, ARRAY_SIZE(res), data, data_size); if (IS_ERR(pdev)) { pr_err("ath79: unable to register USB at %08lx, err=%d\n", base, (int) PTR_ERR(pdev)); return; } pdev->dev.dma_mask = &ath79_usb_dmamask; pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); }
void __init r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata) { platform_device_register_resndata(&platform_bus, "rcar_usb_phy", -1, usb_phy_resources, ARRAY_SIZE(usb_phy_resources), pdata, sizeof(*pdata)); }
void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) { platform_device_register_resndata(&platform_bus, "sh_eth", -1, ether_resources, ARRAY_SIZE(ether_resources), pdata, sizeof(*pdata)); }
int __init sa11x0_register_fixed_regulator(int n, struct fixed_voltage_config *cfg, struct regulator_consumer_supply *supplies, unsigned num_supplies, bool uses_gpio) { struct regulator_init_data *id; cfg->init_data = id = kzalloc(sizeof(*cfg->init_data), GFP_KERNEL); if (!cfg->init_data) return -ENOMEM; if (!uses_gpio) id->constraints.always_on = 1; id->constraints.name = cfg->supply_name; id->constraints.min_uV = cfg->microvolts; id->constraints.max_uV = cfg->microvolts; id->constraints.valid_modes_mask = REGULATOR_MODE_NORMAL; id->constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS; id->consumer_supplies = supplies; id->num_consumer_supplies = num_supplies; platform_device_register_resndata(NULL, "reg-fixed-voltage", n, NULL, 0, cfg, sizeof(*cfg)); return 0; }
static __init int sysfb_init(void) { struct screen_info *si = &screen_info; struct simplefb_platform_data mode; struct platform_device *pd; const char *name; bool compatible; int ret; sysfb_apply_efi_quirks(); /* try to create a simple-framebuffer device */ compatible = parse_mode(si, &mode); if (compatible) { ret = create_simplefb(si, &mode); if (!ret) return 0; } /* if the FB is incompatible, create a legacy framebuffer device */ if (si->orig_video_isVGA == VIDEO_TYPE_EFI) name = "efi-framebuffer"; else if (si->orig_video_isVGA == VIDEO_TYPE_VLFB) name = "vesa-framebuffer"; else name = "platform-framebuffer"; pd = platform_device_register_resndata(NULL, name, 0, NULL, 0, si, sizeof(*si)); return IS_ERR(pd) ? PTR_ERR(pd) : 0; }
__init int create_simplefb(const struct screen_info *si, const struct simplefb_platform_data *mode) { struct platform_device *pd; struct resource res; unsigned long len; /* don't use lfb_size as it may contain the whole VMEM instead of only * the part that is occupied by the framebuffer */ len = mode->height * mode->stride; len = PAGE_ALIGN(len); if (len > (u64)si->lfb_size << 16) { printk(KERN_WARNING "sysfb: VRAM smaller than advertised\n"); return -EINVAL; } /* setup IORESOURCE_MEM as framebuffer memory */ memset(&res, 0, sizeof(res)); res.flags = IORESOURCE_MEM | IORESOURCE_BUSY; res.name = simplefb_resname; res.start = si->lfb_base; res.end = si->lfb_base + len - 1; if (res.end <= res.start) return -EINVAL; pd = platform_device_register_resndata(NULL, "simple-framebuffer", 0, &res, 1, mode, sizeof(*mode)); if (IS_ERR(pd)) return PTR_ERR(pd); return 0; }
static void __init r8a7779_register_hpb_dmae(void) { platform_device_register_resndata(NULL, "hpb-dma-engine", -1, hpb_dmae_resources, ARRAY_SIZE(hpb_dmae_resources), &dma_platform_data, sizeof(dma_platform_data)); }
static int vm_cmdline_set(const char *device, const struct kernel_param *kp) { int err; struct resource resources[2] = {}; char *str; long long int base, size; unsigned int irq; int processed, consumed = 0; struct platform_device *pdev; /* Consume "size" part of the command line parameter */ size = memparse(device, &str); /* Get "@<base>:<irq>[:<id>]" chunks */ processed = sscanf(str, "@%lli:%u%n:%d%n", &base, &irq, &consumed, &vm_cmdline_id, &consumed); /* * sscanf() must processes at least 2 chunks; also there * must be no extra characters after the last chunk, so * str[consumed] must be '\0' */ if (processed < 2 || str[consumed]) return -EINVAL; resources[0].flags = IORESOURCE_MEM; resources[0].start = base; resources[0].end = base + size - 1; resources[1].flags = IORESOURCE_IRQ; resources[1].start = resources[1].end = irq; if (!vm_cmdline_parent_registered) { err = device_register(&vm_cmdline_parent); if (err) { pr_err("Failed to register parent device!\n"); return err; } vm_cmdline_parent_registered = 1; } pr_info("Registering device virtio-mmio.%d at 0x%llx-0x%llx, IRQ %d.\n", vm_cmdline_id, (unsigned long long)resources[0].start, (unsigned long long)resources[0].end, (int)resources[1].start); pdev = platform_device_register_resndata(&vm_cmdline_parent, "virtio-mmio", vm_cmdline_id++, resources, ARRAY_SIZE(resources), NULL, 0); if (IS_ERR(pdev)) return PTR_ERR(pdev); return 0; }
void __init r8a7779_init_irq_extpin(int irlm) { r8a7779_init_irq_extpin_dt(irlm); if (irlm) platform_device_register_resndata( NULL, "renesas_intc_irqpin", -1, irqpin0_resources, ARRAY_SIZE(irqpin0_resources), &irqpin0_platform_data, sizeof(irqpin0_platform_data)); }
static void __init lager_register_usbhs(void) { usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2"); platform_device_register_resndata(NULL, "renesas_usbhs", -1, usbhs_resources, ARRAY_SIZE(usbhs_resources), &usbhs_priv.info, sizeof(usbhs_priv.info)); }
/* * Initialize smsc911x device connected to the GPMC. Note that we * assume that pin multiplexing is done in the board-*.c file, * or in the bootloader. */ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *gpmc_cfg) { struct platform_device *pdev; unsigned long cs_mem_base; int ret; if (gpmc_cs_request(gpmc_cfg->cs, SZ_16M, &cs_mem_base) < 0) { pr_err("Failed to request GPMC mem region\n"); return; } gpmc_smsc911x_resources[0].start = cs_mem_base + 0x0; gpmc_smsc911x_resources[0].end = cs_mem_base + 0xff; if (gpio_request_one(gpmc_cfg->gpio_irq, GPIOF_IN, "smsc911x irq")) { pr_err("Failed to request IRQ GPIO%d\n", gpmc_cfg->gpio_irq); goto free1; } gpmc_smsc911x_resources[1].start = gpio_to_irq(gpmc_cfg->gpio_irq); if (gpio_is_valid(gpmc_cfg->gpio_reset)) { ret = gpio_request_one(gpmc_cfg->gpio_reset, GPIOF_OUT_INIT_HIGH, "smsc911x reset"); if (ret) { pr_err("Failed to request reset GPIO%d\n", gpmc_cfg->gpio_reset); goto free2; } gpio_set_value(gpmc_cfg->gpio_reset, 0); msleep(100); gpio_set_value(gpmc_cfg->gpio_reset, 1); } gpmc_smsc911x_config.flags = gpmc_cfg->flags ? : SMSC911X_USE_16BIT; pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id, gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources), &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config)); if (!pdev) { pr_err("Unable to register platform device\n"); gpio_free(gpmc_cfg->gpio_reset); goto free2; } return; free2: gpio_free(gpmc_cfg->gpio_irq); free1: gpmc_cs_free(gpmc_cfg->cs); pr_err("Could not initialize smsc911x device\n"); }
static void __init armadillo_box_ws1_init(void) { const struct physmap_flash_data *data; imx25_soc_init(); imx25_add_imx_pinctrl("imx25-pinctrl"); pinctrl_register_mappings(armadillo_box_ws1_pinctrl_map, ARRAY_SIZE(armadillo_box_ws1_pinctrl_map)); imx25_add_imx_uart1(&uart1_pdata); imx25_add_imx_uart2(&uart2_pdata); imx25_add_usbmisc_imx(); imx25_add_usb_phy_gen_xceiv_otg(); imx25_add_usb_phy_gen_xceiv_hs(); imx25_add_imx_usb_otg(&otg_pdata); imx25_add_imx_usb_hs(&usbh2_pdata); imx25_add_imx2_wdt(); if (machine_is_armadillo420()) data = &armadillo_box_ws1_nor_flash_pdata_16m; else data = &armadillo_box_ws1_nor_flash_pdata_32m; platform_device_register_resndata(NULL, "physmap-flash", -1, &armadillo_box_ws1_nor_flash_resource, 1, data, sizeof(*data)); imx25_named_gpio_init(); armadillo_box_ws1_fec_reset(); imx25_add_fec(&mx25_fec_pdata); armadillo_box_ws1_bp35a1_init(); imx25_add_imx_i2c0(&mx25_i2c0_data); imx25_add_imx_i2c1(&mx25_i2c1_data); i2c_register_board_info(1, armadillo_box_ws1_i2c1, ARRAY_SIZE(armadillo_box_ws1_i2c1)); platform_device_register_data(NULL, "reg-fixed-voltage", 1, &armadillo_box_ws1_esdhc1_regulator_config, sizeof(armadillo_box_ws1_esdhc1_regulator_config)); platform_device_register_data(NULL, "reg-fixed-voltage", 2, &armadillo_box_ws1_usb_regulator_config, sizeof(armadillo_box_ws1_usb_regulator_config)); imx25_add_sdhci_esdhc_imx(0, &armadillo_box_ws1_esdhc1_pdata); imx_add_gpio_keys(&armadillo_box_ws1_gpio_key_data); gpio_led_register_device(-1, &armadillo_box_ws1_led_data); }
static void __init qca955x_usb_setup(void) { struct platform_device *pdev; ath79_usb_init_resource(ath79_ehci_resources, QCA955X_EHCI0_BASE, QCA955X_EHCI_SIZE, ATH79_IP3_IRQ(0)); pdev = platform_device_register_resndata(NULL, "ehci-platform", 0, ath79_ehci_resources, ARRAY_SIZE(ath79_ehci_resources), &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); if (IS_ERR(pdev)) { pr_err("Unable to register USB %d device, err=%d\n", 0, (int) PTR_ERR(pdev)); return; } pdev->dev.dma_mask = &ath79_ehci_dmamask; pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); ath79_usb_init_resource(ath79_ehci_resources, QCA955X_EHCI1_BASE, QCA955X_EHCI_SIZE, ATH79_IP3_IRQ(1)); pdev = platform_device_register_resndata(NULL, "ehci-platform", 1, ath79_ehci_resources, ARRAY_SIZE(ath79_ehci_resources), &ath79_ehci_pdata_v2, sizeof(ath79_ehci_pdata_v2)); if (IS_ERR(pdev)) { pr_err("Unable to register USB %d device, err=%d\n", 1, (int) PTR_ERR(pdev)); return; } pdev->dev.dma_mask = &ath79_ehci_dmamask; pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); }
int __init omap_init_vrfb(void) { struct platform_device *pdev; const struct resource *res; unsigned int num_res; if (cpu_is_omap24xx()) { res = omap2_vrfb_resources; num_res = ARRAY_SIZE(omap2_vrfb_resources); } else if (cpu_is_omap34xx()) { res = omap3_vrfb_resources; num_res = ARRAY_SIZE(omap3_vrfb_resources); } else { return 0; } pdev = platform_device_register_resndata(NULL, "omapvrfb", -1, res, num_res, NULL, 0); return PTR_ERR_OR_ZERO(pdev); }
/* * Board init */ static void __init mx1ads_init(void) { imx1_soc_init(); mxc_gpio_setup_multiple_pins(mx1ads_pins, ARRAY_SIZE(mx1ads_pins), "mx1ads"); /* UART */ imx1_add_imx_uart0(&uart0_pdata); imx1_add_imx_uart1(&uart1_pdata); /* Physmap flash */ platform_device_register_resndata(NULL, "physmap-flash", 0, &flash_resource, 1, &mx1ads_flash_data, sizeof(mx1ads_flash_data)); /* I2C */ i2c_register_board_info(0, mx1ads_i2c_devices, ARRAY_SIZE(mx1ads_i2c_devices)); imx1_add_imx_i2c(&mx1ads_i2c_data); }
int __init mach_nb0916_init(void) { i2c_register_board_info(0, puv3_i2c_devices, ARRAY_SIZE(puv3_i2c_devices)); platform_device_register_simple("PKUnity-v3-I2C", -1, puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources)); platform_device_register_data(&platform_bus, "pwm-backlight", -1, &nb0916_backlight_data, sizeof(nb0916_backlight_data)); platform_device_register_data(&platform_bus, "gpio-keys", -1, &nb0916_gpio_button_data, sizeof(nb0916_gpio_button_data)); platform_device_register_resndata(&platform_bus, "physmap-flash", -1, &physmap_flash_resource, 1, &physmap_flash_data, sizeof(physmap_flash_data)); if (request_irq(gpio_to_irq(GPI_LCD_CASE_OFF), &nb0916_lcdcaseoff_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "NB0916 lcd case off", NULL) < 0) { printk(KERN_DEBUG "LCD-Case-OFF IRQ %d not available\n", gpio_to_irq(GPI_LCD_CASE_OFF)); } if (request_irq(gpio_to_irq(GPI_OTP_INT), &nb0916_overheat_handler, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, "NB0916 overheating protection", NULL) < 0) { printk(KERN_DEBUG "Overheating Protection IRQ %d not available\n", gpio_to_irq(GPI_OTP_INT)); } return 0; }
static struct platform_device *db8500_add_msp_i2s(struct device *parent, int id, resource_size_t base, int irq, struct msp_i2s_platform_data *pdata) { struct platform_device *pdev; struct resource res[] = { DEFINE_RES_MEM(base, SZ_4K), DEFINE_RES_IRQ(irq), }; pr_info("Register platform-device 'ux500-msp-i2s', id %d, irq %d\n", id, irq); pdev = platform_device_register_resndata(parent, "ux500-msp-i2s", id, res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); if (!pdev) { pr_err("Failed to register platform-device 'ux500-msp-i2s.%d'!\n", id); return NULL; } return pdev; }
void __init puv3_core_init(void) { puv3_init_pm(); puv3_ps2_init(); platform_device_register_simple("PKUnity-v3-RTC", -1, puv3_rtc_resources, ARRAY_SIZE(puv3_rtc_resources)); platform_device_register_simple("PKUnity-v3-UMAL", -1, puv3_umal_resources, ARRAY_SIZE(puv3_umal_resources)); platform_device_register_simple("PKUnity-v3-MMC", -1, puv3_mmc_resources, ARRAY_SIZE(puv3_mmc_resources)); platform_device_register_simple("PKUnity-v3-UNIGFX", -1, puv3_unigfx_resources, ARRAY_SIZE(puv3_unigfx_resources)); platform_device_register_simple("PKUnity-v3-PWM", -1, puv3_pwm_resources, ARRAY_SIZE(puv3_pwm_resources)); platform_device_register_simple("PKUnity-v3-UART", 0, puv3_uart0_resources, ARRAY_SIZE(puv3_uart0_resources)); platform_device_register_simple("PKUnity-v3-UART", 1, puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources)); platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0); platform_device_register_resndata(&platform_bus, "musb_hdrc", -1, puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources), &puv3_usb_plat, sizeof(puv3_usb_plat)); }
static void __init koelsch_add_rsnd_device(void) { struct resource rsnd_resources[] = { [RSND_GEN2_SCU] = DEFINE_RES_MEM(0xec500000, 0x1000), [RSND_GEN2_ADG] = DEFINE_RES_MEM(0xec5a0000, 0x100), [RSND_GEN2_SSIU] = DEFINE_RES_MEM(0xec540000, 0x1000), [RSND_GEN2_SSI] = DEFINE_RES_MEM(0xec541000, 0x1280), }; struct platform_device_info cardinfo = { .parent = &platform_bus, .name = "asoc-simple-card", .id = -1, .data = &rsnd_card_info, .size_data = sizeof(struct asoc_simple_card_info), .dma_mask = DMA_BIT_MASK(32), }; platform_device_register_resndata( &platform_bus, "rcar_sound", -1, rsnd_resources, ARRAY_SIZE(rsnd_resources), &rsnd_info, sizeof(rsnd_info)); platform_device_register_full(&cardinfo); } /* * This is a really crude hack to provide clkdev support to platform * devices until they get moved to DT. */ static const struct clk_name clk_names[] __initconst = { { "cmt0", NULL, "sh_cmt.0" }, { "cmt0", "fck", "sh-cmt-48-gen2.0" }, { "du0", "du.0", "rcar-du-r8a7791" }, { "du1", "du.1", "rcar-du-r8a7791" }, { "lvds0", "lvds.0", "rcar-du-r8a7791" }, { "hsusb", NULL, "usb_phy_rcar_gen2" }, { "ssi0", "ssi.0", "rcar_sound" }, { "ssi1", "ssi.1", "rcar_sound" }, { "src0", "src.0", "rcar_sound" }, { "src1", "src.1", "rcar_sound" }, { "dvc0", "dvc.0", "rcar_sound" }, { "vin0", NULL, "r8a7791-vin.0" }, { "vin1", NULL, "r8a7791-vin.1" }, { "vsps", NULL, NULL }, #if defined(CONFIG_VIDEO_RENESAS_VSP1) { "vsp1-du0", NULL, "vsp1.2" }, { "vsp1-du1", NULL, "vsp1.3" }, #else { "vsp1-du0", NULL, NULL }, { "vsp1-du1", NULL, NULL }, #endif { "vcp0", NULL, NULL }, { "vpc0", NULL, NULL }, { "tddmac", NULL, NULL }, { "fdp1", NULL, NULL }, { "fdp0", NULL, NULL }, }; /* * This is a really crude hack to work around core platform clock issues */ static const struct clk_name clk_enables[] __initconst = { { "hsusb", NULL, "renesas_usbhs" }, { "ehci", NULL, "pci-rcar-gen2.1" }, { "ssi", NULL, "rcar_sound" }, { "scu", NULL, "rcar_sound" }, { "dmal", NULL, "sh-dma-engine.0" }, { "dmah", NULL, "sh-dma-engine.1" }, { "pvrsrvkm", NULL, "pvrsrvkm" }, { "ssp_dev", NULL, "ssp_dev" }, }; #define DMAE_CHANNEL(a, b) \ { \ .offset = (a) - 0x20, \ .dmars = (a) - 0x20 + 0x40, \ .chclr_bit = (b), \ .chclr_offset = 0x80 - 0x20, \ } /* Sys-DMAC */ #define SYS_DMAC_SLAVE(_id, _bit, _addr, toffset, roffset, t, r) \ { \ .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \ .addr = _addr + toffset, \ .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \ .mid_rid = t, \ }, { \ .slave_id = SYS_DMAC_SLAVE_## _id ##_RX, \ .addr = _addr + roffset, \ .chcr = CHCR_RX(XMIT_SZ_## _bit ##BIT), \ .mid_rid = r, \ } static const struct sh_dmae_slave_config r8a7791_sys_dmac_slaves[] = { SYS_DMAC_SLAVE(SDHI0, 256, 0xee100000, 0x60, 0x2060, 0xcd, 0xce), SYS_DMAC_SLAVE(SDHI1, 256, 0xee140000, 0x30, 0x2030, 0xc1, 0xc2), SYS_DMAC_SLAVE(SDHI2, 256, 0xee160000, 0x30, 0x2030, 0xd3, 0xd4), }; static const struct sh_dmae_channel r8a7791_sys_dmac_channels[] = { DMAE_CHANNEL(0x8000, 0), DMAE_CHANNEL(0x8080, 1), DMAE_CHANNEL(0x8100, 2), DMAE_CHANNEL(0x8180, 3), DMAE_CHANNEL(0x8200, 4), DMAE_CHANNEL(0x8280, 5), DMAE_CHANNEL(0x8300, 6), DMAE_CHANNEL(0x8380, 7), DMAE_CHANNEL(0x8400, 8), DMAE_CHANNEL(0x8480, 9), DMAE_CHANNEL(0x8500, 10), DMAE_CHANNEL(0x8580, 11), DMAE_CHANNEL(0x8600, 12), DMAE_CHANNEL(0x8680, 13), DMAE_CHANNEL(0x8700, 14), }; static struct sh_dmae_pdata r8a7791_sys_dmac_platform_data = { .slave = r8a7791_sys_dmac_slaves, .slave_num = ARRAY_SIZE(r8a7791_sys_dmac_slaves), .channel = r8a7791_sys_dmac_channels, .channel_num = ARRAY_SIZE(r8a7791_sys_dmac_channels), .ts_low_shift = TS_LOW_SHIFT, .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, .ts_high_shift = TS_HI_SHIFT, .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, .ts_shift = dma_ts_shift, .ts_shift_num = ARRAY_SIZE(dma_ts_shift), .dmaor_init = DMAOR_DME, .chclr_present = 1, .chclr_bitwise = 1, .fourty_bits_addr = 1, }; static struct resource r8a7791_sys_dmac_resources[] = { /* Channel registers and DMAOR for low */ DEFINE_RES_MEM(0xe6700020, 0x8763 - 0x20), DEFINE_RES_IRQ(gic_spi(197)), DEFINE_RES_NAMED(gic_spi(200), 15, NULL, IORESOURCE_IRQ), /* Channel registers and DMAOR for high */ DEFINE_RES_MEM(0xe6720020, 0x8763 - 0x20), DEFINE_RES_IRQ(gic_spi(220)), DEFINE_RES_NAMED(gic_spi(216), 4, NULL, IORESOURCE_IRQ), DEFINE_RES_NAMED(gic_spi(308), 11, NULL, IORESOURCE_IRQ), }; #define r8a7791_register_sys_dmac(id) \ platform_device_register_resndata( \ &platform_bus, "sh-dma-engine", 2 + id, \ &r8a7791_sys_dmac_resources[id * 3], id * 1 + 3, \ &r8a7791_sys_dmac_platform_data, \ sizeof(r8a7791_sys_dmac_platform_data)) static void __init koelsch_add_dmac_prototype(void) { r8a7791_register_sys_dmac(0); r8a7791_register_sys_dmac(1); } static struct sh_mobile_sdhi_info sdhi0_info __initdata = { .dma_slave_tx = SYS_DMAC_SLAVE_SDHI0_TX, .dma_slave_rx = SYS_DMAC_SLAVE_SDHI0_RX, .dma_rx_offset = 0x2000, .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, }; static struct sh_mobile_sdhi_info sdhi1_info __initdata = { .dma_slave_tx = SYS_DMAC_SLAVE_SDHI1_TX, .dma_slave_rx = SYS_DMAC_SLAVE_SDHI1_RX, .tmio_caps = MMC_CAP_POWER_OFF_CARD, .dma_rx_offset = 0x2000, .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT, }; static struct sh_mobile_sdhi_info sdhi2_info __initdata = { .dma_slave_tx = SYS_DMAC_SLAVE_SDHI2_TX, .dma_slave_rx = SYS_DMAC_SLAVE_SDHI2_RX, .dma_rx_offset = 0x2000, .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, .tmio_caps = MMC_CAP_POWER_OFF_CARD, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, }; /* USBHS */ static const struct resource usbhs_resources[] __initconst = { DEFINE_RES_MEM(0xe6590000, 0x100), DEFINE_RES_IRQ(gic_spi(107)), }; struct usbhs_private { struct renesas_usbhs_platform_info info; struct usb_phy *phy; int id_gpio; }; #define usbhs_get_priv(pdev) \ container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info) static int usbhs_power_ctrl(struct platform_device *pdev, void __iomem *base, int enable) { struct usbhs_private *priv = usbhs_get_priv(pdev); if (!priv->phy) return -ENODEV; if (enable) { int retval = usb_phy_init(priv->phy); if (!retval) retval = usb_phy_set_suspend(priv->phy, 0); return retval; } usb_phy_set_suspend(priv->phy, 1); usb_phy_shutdown(priv->phy); return 0; } static int usbhs_hardware_init(struct platform_device *pdev) { struct usbhs_private *priv = usbhs_get_priv(pdev); struct usb_phy *phy; int ret; struct device_node *np; np = of_find_node_by_path("/gpio@e6055000"); if (np) { priv->id_gpio = of_get_gpio(np, 31); of_node_put(np); } else { pr_warn("Error: Unable to get MAX3355 ID input\n"); ret = -ENOTSUPP; goto error2; } /* Check MAX3355E ID pin */ gpio_request_one(priv->id_gpio, GPIOF_IN, NULL); if (!gpio_get_value(priv->id_gpio)) { pr_warn("Error: USB0 cable selects host mode\n"); ret = -ENOTSUPP; goto error; } phy = usb_get_phy_dev(&pdev->dev, 0); if (IS_ERR(phy)) return PTR_ERR(phy); priv->phy = phy; return 0; error: gpio_free(priv->id_gpio); error2: return ret; } static int usbhs_hardware_exit(struct platform_device *pdev) { struct usbhs_private *priv = usbhs_get_priv(pdev); if (!priv->phy) return 0; usb_put_phy(priv->phy); priv->phy = NULL; gpio_free(priv->id_gpio); return 0; } static int usbhs_get_id(struct platform_device *pdev) { return USBHS_GADGET; } static u32 koelsch_usbhs_pipe_type[] = { USB_ENDPOINT_XFER_CONTROL, USB_ENDPOINT_XFER_ISOC, USB_ENDPOINT_XFER_ISOC, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_INT, USB_ENDPOINT_XFER_INT, USB_ENDPOINT_XFER_INT, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, USB_ENDPOINT_XFER_BULK, }; static struct usbhs_private usbhs_priv __initdata = { .info = { .platform_callback = { .power_ctrl = usbhs_power_ctrl, .hardware_init = usbhs_hardware_init, .hardware_exit = usbhs_hardware_exit, .get_id = usbhs_get_id, }, .driver_param = { .buswait_bwait = 4, .pipe_type = koelsch_usbhs_pipe_type, .pipe_size = ARRAY_SIZE(koelsch_usbhs_pipe_type), }, } }; static void __init koelsch_add_usb0_gadget(void) { usb_bind_phy("renesas_usbhs", 0, "usb_phy_rcar_gen2"); platform_device_register_resndata(&platform_bus, "renesas_usbhs", -1, usbhs_resources, ARRAY_SIZE(usbhs_resources), &usbhs_priv.info, sizeof(usbhs_priv.info)); } /* Internal PCI1 */ static const struct resource pci1_resources[] __initconst = { DEFINE_RES_MEM(0xee0d0000, 0x10000), /* CFG */ DEFINE_RES_MEM(0xee0c0000, 0x10000), /* MEM */ DEFINE_RES_IRQ(gic_spi(113)), }; static void __init koelsch_add_usb1_host(void) { platform_device_register_simple("pci-rcar-gen2", 1, pci1_resources, ARRAY_SIZE(pci1_resources)); } /* USBHS PHY */ static const struct rcar_gen2_phy_platform_data usbhs_phy_pdata __initconst = { .chan0_pci = 0, /* Channel 0 is USBHS */ .chan2_pci = 1, /* Channel 2 is PCI USB host */ }; /* VIN */ static const struct resource vin_resources[] __initconst = { /* VIN0 */ DEFINE_RES_MEM(0xe6ef0000, 0x1000), DEFINE_RES_IRQ(gic_spi(188)), /* VIN1 */ DEFINE_RES_MEM(0xe6ef1000, 0x1000), DEFINE_RES_IRQ(gic_spi(189)), }; static void __init koelsch_add_vin_device(unsigned idx, struct rcar_vin_platform_data *pdata) { struct platform_device_info vin_info = { .parent = &platform_bus, .name = "r8a7791-vin", .id = idx, .res = &vin_resources[idx * 2], .num_res = 2, .dma_mask = DMA_BIT_MASK(32), .data = pdata, .size_data = sizeof(*pdata), }; BUG_ON(idx > 1); platform_device_register_full(&vin_info); } #define KOELSCH_CAMERA(idx, name, addr, pdata, flag) \ static struct i2c_board_info i2c_cam##idx##_device = { \ I2C_BOARD_INFO(name, addr), \ }; \ \ static struct rcar_vin_platform_data vin##idx##_pdata = { \ .flags = flag, \ }; \ \ static struct soc_camera_link cam##idx##_link = { \ .bus_id = idx, \ .board_info = &i2c_cam##idx##_device, \ .i2c_adapter_id = 2, \ .module_name = name, \ .priv = pdata, \ } KOELSCH_CAMERA(0, "adv7612", 0x4c, NULL, RCAR_VIN_BT709); KOELSCH_CAMERA(1, "adv7180", 0x20, NULL, RCAR_VIN_BT656); static void __init koelsch_add_camera0_device(void) { platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0, &cam0_link, sizeof(cam0_link)); koelsch_add_vin_device(0, &vin0_pdata); } static void __init koelsch_add_camera1_device(void) { platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1, &cam1_link, sizeof(cam1_link)); koelsch_add_vin_device(1, &vin1_pdata); } /* VSP1 */ #if defined(CONFIG_VIDEO_RENESAS_VSP1) static const struct vsp1_platform_data koelsch_vsps_pdata __initconst = { .features = 0, .rpf_count = 5, .uds_count = 3, .wpf_count = 4, }; static const struct vsp1_platform_data koelsch_vspd0_pdata __initconst = { .features = VSP1_HAS_LIF, .rpf_count = 4, .uds_count = 1, .wpf_count = 4, }; static const struct vsp1_platform_data koelsch_vspd1_pdata __initconst = { .features = VSP1_HAS_LIF, .rpf_count = 4, .uds_count = 1, .wpf_count = 4, }; static const struct vsp1_platform_data * const koelsch_vsp1_pdata[] __initconst = { &koelsch_vsps_pdata, &koelsch_vspd0_pdata, &koelsch_vspd1_pdata, }; static const struct resource vsp1_1_resources[] __initconst = { DEFINE_RES_MEM(0xfe928000, 0x8000), DEFINE_RES_IRQ(gic_spi(267)), }; static const struct resource vsp1_2_resources[] __initconst = { DEFINE_RES_MEM(0xfe930000, 0x8000), DEFINE_RES_IRQ(gic_spi(246)), }; static const struct resource vsp1_3_resources[] __initconst = { DEFINE_RES_MEM(0xfe938000, 0x8000), DEFINE_RES_IRQ(gic_spi(247)), }; static const struct resource * const vsp1_resources[] __initconst = { vsp1_1_resources, vsp1_2_resources, vsp1_3_resources, }; static void __init koelsch_add_vsp1_devices(void) { struct platform_device_info info = { .name = "vsp1", .size_data = sizeof(*koelsch_vsp1_pdata[0]), .num_res = 2, .dma_mask = DMA_BIT_MASK(32), }; unsigned int i; for (i = 1; i < ARRAY_SIZE(vsp1_resources); ++i) { info.id = i + 1; info.data = koelsch_vsp1_pdata[i]; info.res = vsp1_resources[i]; platform_device_register_full(&info); } } #endif static const struct resource usbhs_phy_resources[] __initconst = { DEFINE_RES_MEM(0xe6590100, 0x100), }; /* Add all available USB devices */ static void __init koelsch_add_usb_devices(void) { platform_device_register_resndata(&platform_bus, "usb_phy_rcar_gen2", -1, usbhs_phy_resources, ARRAY_SIZE(usbhs_phy_resources), &usbhs_phy_pdata, sizeof(usbhs_phy_pdata)); koelsch_add_usb0_gadget(); koelsch_add_usb1_host(); } /* MSIOF spidev */ static const struct spi_board_info spi_bus[] __initconst = { { .modalias = "spidev", .max_speed_hz = 6000000, .mode = SPI_MODE_3, .bus_num = 1, .chip_select = 0, }, { .modalias = "spidev", .max_speed_hz = 6000000, .mode = SPI_MODE_3, .bus_num = 2, .chip_select = 0, }, }; /* POWER IC */ static struct i2c_board_info poweric_i2c[] = { { I2C_BOARD_INFO("da9063", 0x58), }, }; static void koelsch_restart(char mode, const char *cmd) { struct i2c_adapter *adap; struct i2c_client *client; u8 val; int busnum = 6; adap = i2c_get_adapter(busnum); if (!adap) { pr_err("failed to get adapter i2c%d\n", busnum); return; } client = i2c_new_device(adap, &poweric_i2c[0]); if (!client) pr_err("failed to register %s to i2c%d\n", poweric_i2c[0].type, busnum); i2c_put_adapter(adap); val = i2c_smbus_read_byte_data(client, 0x13); if (val < 0) pr_err("couldn't access da9063\n"); val |= 0x02; i2c_smbus_write_byte_data(client, 0x13, val); } #define koelsch_add_msiof_device spi_register_board_info static struct of_dev_auxdata koelsch_auxdata_lookup[] __initdata = { OF_DEV_AUXDATA("renesas,sdhi-r8a7791", 0xee100000, "sdhi0", &sdhi0_info), OF_DEV_AUXDATA("renesas,sdhi-r8a7791", 0xee140000, "sdhi1", &sdhi1_info), OF_DEV_AUXDATA("renesas,sdhi-r8a7791", 0xee160000, "sdhi2", &sdhi2_info), {}, }; static void __init koelsch_add_standard_devices(void) { shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); shmobile_clk_workaround(clk_enables, ARRAY_SIZE(clk_enables), true); r8a7791_add_dt_devices(); koelsch_add_dmac_prototype(); of_platform_populate(NULL, of_default_bus_match_table, koelsch_auxdata_lookup, NULL); koelsch_add_du_device(); koelsch_add_usb_devices(); koelsch_add_rsnd_device(); koelsch_add_camera0_device(); koelsch_add_camera1_device(); #if defined(CONFIG_VIDEO_RENESAS_VSP1) koelsch_add_vsp1_devices(); #endif koelsch_add_msiof_device(spi_bus, ARRAY_SIZE(spi_bus)); } static const char * const koelsch_boards_compat_dt[] __initconst = { "renesas,koelsch", "renesas,koelsch-reference", NULL, }; DT_MACHINE_START(KOELSCH_DT, "koelsch") .smp = smp_ops(r8a7791_smp_ops), .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .init_machine = koelsch_add_standard_devices, .init_late = shmobile_init_late, .reserve = rcar_gen2_reserve, .restart = koelsch_restart, .dt_compat = koelsch_boards_compat_dt, MACHINE_END
static void __init bockw_init(void) { void __iomem *base; struct clk *clk; int i; r8a7778_clock_init(); r8a7778_init_irq_extpin(1); r8a7778_add_standard_devices(); platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1, ether_resources, ARRAY_SIZE(ether_resources), ðer_platform_data, sizeof(ether_platform_data)); platform_device_register_full(&vin0_info); /* VIN1 has a pin conflict with Ether */ if (!IS_ENABLED(CONFIG_SH_ETH)) platform_device_register_full(&vin1_info); platform_device_register_data(&platform_bus, "soc-camera-pdrv", 0, &iclink0_ml86v7667, sizeof(iclink0_ml86v7667)); platform_device_register_data(&platform_bus, "soc-camera-pdrv", 1, &iclink1_ml86v7667, sizeof(iclink1_ml86v7667)); i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices)); spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); pinctrl_register_mappings(bockw_pinctrl_map, ARRAY_SIZE(bockw_pinctrl_map)); r8a7778_pinmux_init(); platform_device_register_resndata( &platform_bus, "sh_mmcif", -1, mmc_resources, ARRAY_SIZE(mmc_resources), &sh_mmcif_plat, sizeof(struct sh_mmcif_plat_data)); platform_device_register_resndata( &platform_bus, "rcar_usb_phy", -1, usb_phy_resources, ARRAY_SIZE(usb_phy_resources), &usb_phy_platform_data, sizeof(struct rcar_phy_platform_data)); /* for SMSC */ fpga = ioremap_nocache(FPGA, SZ_1M); if (fpga) { /* * CAUTION * * IRQ0/1 is cascaded interrupt from FPGA. * it should be cared in the future * Now, it is assuming IRQ0 was used only from SMSC. */ u16 val = ioread16(fpga + IRQ0MR); val &= ~(1 << 4); /* enable SMSC911x */ iowrite16(val, fpga + IRQ0MR); regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); platform_device_register_resndata( &platform_bus, "smsc911x", -1, smsc911x_resources, ARRAY_SIZE(smsc911x_resources), &smsc911x_data, sizeof(smsc911x_data)); } /* for SDHI */ base = ioremap_nocache(PFC, 0x200); if (base) { /* * FIXME * * SDHI CD/WP pin needs pull-up */ iowrite32(ioread32(base + PUPR4) | (3 << 26), base + PUPR4); iounmap(base); platform_device_register_resndata( &platform_bus, "sh_mobile_sdhi", 0, sdhi0_resources, ARRAY_SIZE(sdhi0_resources), &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); } /* for Audio */ clk = clk_get(NULL, "audio_clk_b"); clk_set_rate(clk, 24576000); clk_put(clk); rsnd_codec_power(5, 1); /* enable ak4642 */ platform_device_register_simple( "ak4554-adc-dac", 0, NULL, 0); platform_device_register_simple( "ak4554-adc-dac", 1, NULL, 0); platform_device_register_resndata( &platform_bus, "rcar_sound", -1, rsnd_resources, ARRAY_SIZE(rsnd_resources), &rsnd_info, sizeof(rsnd_info)); for (i = 0; i < ARRAY_SIZE(rsnd_card_info); i++) { struct platform_device_info cardinfo = { .parent = &platform_bus, .name = "asoc-simple-card", .id = i, .data = &rsnd_card_info[i], .size_data = sizeof(struct asoc_simple_card_info), .dma_mask = ~0, }; platform_device_register_full(&cardinfo); } } static void __init bockw_init_late(void) { r8a7778_init_late(); ADD_USB_FUNC_DEVICE_IF_POSSIBLE(); }
/*! * Board specific initialization. */ static void __init mx6_evk_init(void) { u32 i; mxc_iomux_v3_setup_multiple_pads(mx6sl_brd_pads, ARRAY_SIZE(mx6sl_brd_pads)); elan_ts_init(); gp_reg_id = mx6sl_evk_dvfscore_data.reg_id; soc_reg_id = mx6sl_evk_dvfscore_data.soc_id; imx6q_add_imx_snvs_rtc(); imx6q_add_imx_i2c(0, &mx6_evk_i2c0_data); imx6q_add_imx_i2c(1, &mx6_evk_i2c1_data); i2c_register_board_info(0, mxc_i2c0_board_info, ARRAY_SIZE(mxc_i2c0_board_info)); /* setting sii902x address when hdmi enabled */ if (hdmi_enabled) { for (i = 0; i < ARRAY_SIZE(mxc_i2c1_board_info); i++) { if (!strcmp(mxc_i2c1_board_info[i].type, "sii902x")) { mxc_i2c1_board_info[i].addr = 0x39; break; } } } i2c_register_board_info(1, mxc_i2c1_board_info, ARRAY_SIZE(mxc_i2c1_board_info)); /* only camera on I2C3, that's why we can do so */ if (csi_enabled == 1) { mxc_register_device(&csi_v4l2_devices, NULL); imx6q_add_imx_i2c(2, &mx6_evk_i2c2_data); i2c_register_board_info(2, mxc_i2c2_board_info, ARRAY_SIZE(mxc_i2c2_board_info)); } /* SPI */ imx6q_add_ecspi(0, &mx6_evk_spi_data); spi_device_init(); mx6sl_evk_init_pfuze100(0); imx6q_add_anatop_thermal_imx(1, &mx6sl_anatop_thermal_data); mx6_evk_init_uart(); /* get enet tx reference clk from FEC_REF_CLK pad. * GPR1[14] = 0, GPR1[18:17] = 00 */ mxc_iomux_set_gpr_register(1, 14, 1, 0); mxc_iomux_set_gpr_register(1, 17, 2, 0); imx6_init_fec(fec_data); platform_device_register(&evk_vmmc_reg_devices); imx6q_add_sdhci_usdhc_imx(1, &mx6_evk_sd2_data); imx6q_add_sdhci_usdhc_imx(0, &mx6_evk_sd1_data); imx6q_add_sdhci_usdhc_imx(2, &mx6_evk_sd3_data); mx6_evk_init_usb(); imx6q_add_otp(); imx6q_add_mxc_pwm(0); imx6q_add_mxc_pwm_backlight(0, &mx6_evk_pwm_backlight_data); if (hdmi_enabled) { imx6dl_add_imx_elcdif(&hdmi_fb_data[0]); } else { imx6dl_add_imx_elcdif(&wvga_fb_data[0]); gpio_request(MX6_BRD_LCD_PWR_EN, "elcdif-power-on"); gpio_direction_output(MX6_BRD_LCD_PWR_EN, 1); mxc_register_device(&lcd_wvga_device, NULL); } imx6dl_add_imx_pxp(); imx6dl_add_imx_pxp_client(); mxc_register_device(&max17135_sensor_device, NULL); setup_spdc(); if (csi_enabled) { imx6sl_add_fsl_csi(); } else { if (!spdc_sel) imx6dl_add_imx_epdc(&epdc_data); else imx6sl_add_imx_spdc(&spdc_data); } imx6q_add_dvfs_core(&mx6sl_evk_dvfscore_data); imx6q_init_audio(); /* uart2 for bluetooth */ #ifdef SXSDMAN_BLUETOOTH_ENABLE if (uart4_enabled) uart4_init(); #else if (uart2_enabled) uart2_init(); #endif mxc_register_device(&mxc_bt_rfkill, &mxc_bt_rfkill_data); imx6q_add_viim(); imx6q_add_imx2_wdt(0, NULL); imx_add_viv_gpu(&imx6_gpu_data, &imx6q_gpu_pdata); imx6sl_add_imx_keypad(&mx6sl_evk_map_data); imx6q_add_busfreq(); imx6sl_add_dcp(); imx6sl_add_rngb(); imx6sl_add_imx_pxp_v4l2(); mxc_spdif_data.spdif_core_clk = clk_get_sys("mxc_spdif.0", NULL); clk_put(mxc_spdif_data.spdif_core_clk); imx6q_add_spdif(&mxc_spdif_data); imx6q_add_spdif_dai(); imx6q_add_spdif_audio_device(); imx6q_add_perfmon(0); imx6q_add_perfmon(1); imx6q_add_perfmon(2); /* Register charger chips */ platform_device_register(&evk_max8903_charger_1); pm_power_off = mx6_snvs_poweroff; imx6q_add_pm_imx(0, &mx6sl_evk_pm_data); if (imx_ion_data.heaps[0].size) platform_device_register_resndata(NULL, "ion-mxc", 0, NULL, 0, \ &imx_ion_data, sizeof(imx_ion_data) + sizeof(struct ion_platform_heap)); }
static void __init lager_add_rsnd_device(void) { struct platform_device_info cardinfo = { .name = "asoc-simple-card", .id = -1, .data = &rsnd_card_info, .size_data = sizeof(struct asoc_simple_card_info), .dma_mask = DMA_BIT_MASK(32), }; i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices)); platform_device_register_resndata( NULL, "rcar_sound", -1, rsnd_resources, ARRAY_SIZE(rsnd_resources), &rsnd_info, sizeof(rsnd_info)); platform_device_register_full(&cardinfo); } /* SDHI0 */ static struct sh_mobile_sdhi_info sdhi0_info __initdata = { .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, .tmio_caps2 = MMC_CAP2_NO_MULTI_READ, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, }; static struct resource sdhi0_resources[] __initdata = { DEFINE_RES_MEM(0xee100000, 0x200), DEFINE_RES_IRQ(gic_spi(165)), }; /* SDHI2 */ static struct sh_mobile_sdhi_info sdhi2_info __initdata = { .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_POWER_OFF_CARD, .tmio_caps2 = MMC_CAP2_NO_MULTI_READ, .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_WRPROTECT_DISABLE, }; static struct resource sdhi2_resources[] __initdata = { DEFINE_RES_MEM(0xee140000, 0x100), DEFINE_RES_IRQ(gic_spi(167)), }; /* Internal PCI1 */ static const struct resource pci1_resources[] __initconst = { DEFINE_RES_MEM(0xee0b0000, 0x10000), /* CFG */ DEFINE_RES_MEM(0xee0a0000, 0x10000), /* MEM */ DEFINE_RES_IRQ(gic_spi(112)), }; static const struct platform_device_info pci1_info __initconst = { .name = "pci-rcar-gen2", .id = 1, .res = pci1_resources, .num_res = ARRAY_SIZE(pci1_resources), .dma_mask = DMA_BIT_MASK(32), }; static void __init lager_add_usb1_device(void) { platform_device_register_full(&pci1_info); } /* Internal PCI2 */ static const struct resource pci2_resources[] __initconst = { DEFINE_RES_MEM(0xee0d0000, 0x10000), /* CFG */ DEFINE_RES_MEM(0xee0c0000, 0x10000), /* MEM */ DEFINE_RES_IRQ(gic_spi(113)), }; static const struct platform_device_info pci2_info __initconst = { .name = "pci-rcar-gen2", .id = 2, .res = pci2_resources, .num_res = ARRAY_SIZE(pci2_resources), .dma_mask = DMA_BIT_MASK(32), }; static void __init lager_add_usb2_device(void) { platform_device_register_full(&pci2_info); } static const struct pinctrl_map lager_pinctrl_map[] = { /* DU (CN10: ARGB0, CN13: LVDS) */ PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", "du_rgb666", "du"), PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", "du_sync_1", "du"), PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", "du_clk_out_0", "du"), /* I2C2 */ PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar.2", "pfc-r8a7790", "i2c2", "i2c2"), /* QSPI */ PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7790", "qspi_ctrl", "qspi"), PIN_MAP_MUX_GROUP_DEFAULT("qspi.0", "pfc-r8a7790", "qspi_data4", "qspi"), /* SCIF0 (CN19: DEBUG SERIAL0) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", "scif0_data", "scif0"), /* SCIF1 (CN20: DEBUG SERIAL1) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7790", "scif1_data", "scif1"), /* SDHI0 */ PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790", "sdhi0_data4", "sdhi0"), PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790", "sdhi0_ctrl", "sdhi0"), PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.0", "pfc-r8a7790", "sdhi0_cd", "sdhi0"), /* SDHI2 */ PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790", "sdhi2_data4", "sdhi2"), PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790", "sdhi2_ctrl", "sdhi2"), PIN_MAP_MUX_GROUP_DEFAULT("sh_mobile_sdhi.2", "pfc-r8a7790", "sdhi2_cd", "sdhi2"), /* SSI (CN17: sound) */ PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", "ssi0129_ctrl", "ssi"), PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", "ssi0_data", "ssi"), PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", "ssi1_data", "ssi"), PIN_MAP_MUX_GROUP_DEFAULT("rcar_sound", "pfc-r8a7790", "audio_clk_a", "audio_clk"), /* MMCIF1 */ PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790", "mmc1_data8", "mmc1"), PIN_MAP_MUX_GROUP_DEFAULT("sh_mmcif.1", "pfc-r8a7790", "mmc1_ctrl", "mmc1"), /* Ether */ PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-ether", "pfc-r8a7790", "eth_link", "eth"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-ether", "pfc-r8a7790", "eth_mdio", "eth"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-ether", "pfc-r8a7790", "eth_rmii", "eth"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-ether", "pfc-r8a7790", "intc_irq0", "intc"), /* VIN0 */ PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.0", "pfc-r8a7790", "vin0_data24", "vin0"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.0", "pfc-r8a7790", "vin0_sync", "vin0"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.0", "pfc-r8a7790", "vin0_field", "vin0"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.0", "pfc-r8a7790", "vin0_clkenb", "vin0"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.0", "pfc-r8a7790", "vin0_clk", "vin0"), /* VIN1 */ PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.1", "pfc-r8a7790", "vin1_data8", "vin1"), PIN_MAP_MUX_GROUP_DEFAULT("r8a7790-vin.1", "pfc-r8a7790", "vin1_clk", "vin1"), /* USB0 */ PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7790", "usb0_ovc_vbus", "usb0"), /* USB1 */ PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2.1", "pfc-r8a7790", "usb1", "usb1"), /* USB2 */ PIN_MAP_MUX_GROUP_DEFAULT("pci-rcar-gen2.2", "pfc-r8a7790", "usb2", "usb2"), }; static void __init lager_add_standard_devices(void) { int fixed_regulator_idx = 0; int gpio_regulator_idx = 0; r8a7790_clock_init(); pinctrl_register_mappings(lager_pinctrl_map, ARRAY_SIZE(lager_pinctrl_map)); r8a7790_pinmux_init(); r8a7790_add_standard_devices(); platform_device_register_data(NULL, "leds-gpio", -1, &lager_leds_pdata, sizeof(lager_leds_pdata)); platform_device_register_data(NULL, "gpio-keys", -1, &lager_keys_pdata, sizeof(lager_keys_pdata)); regulator_register_always_on(fixed_regulator_idx++, "fixed-3.3V", fixed3v3_power_consumers, ARRAY_SIZE(fixed3v3_power_consumers), 3300000); platform_device_register_resndata(NULL, "sh_mmcif", 1, mmcif1_resources, ARRAY_SIZE(mmcif1_resources), &mmcif1_pdata, sizeof(mmcif1_pdata)); platform_device_register_full(ðer_info); lager_add_du_device(); platform_device_register_resndata(NULL, "qspi", 0, qspi_resources, ARRAY_SIZE(qspi_resources), &qspi_pdata, sizeof(qspi_pdata)); spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++, &vcc_sdhi0_info, sizeof(struct fixed_voltage_config)); platform_device_register_data(NULL, "reg-fixed-voltage", fixed_regulator_idx++, &vcc_sdhi2_info, sizeof(struct fixed_voltage_config)); platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++, &vccq_sdhi0_info, sizeof(struct gpio_regulator_config)); platform_device_register_data(NULL, "gpio-regulator", gpio_regulator_idx++, &vccq_sdhi2_info, sizeof(struct gpio_regulator_config)); lager_add_camera1_device(); platform_device_register_full(&sata1_info); platform_device_register_resndata(NULL, "usb_phy_rcar_gen2", -1, usbhs_phy_resources, ARRAY_SIZE(usbhs_phy_resources), &usbhs_phy_pdata, sizeof(usbhs_phy_pdata)); lager_register_usbhs(); lager_add_usb1_device(); lager_add_usb2_device(); lager_add_rsnd_device(); platform_device_register_resndata(NULL, "sh_mobile_sdhi", 0, sdhi0_resources, ARRAY_SIZE(sdhi0_resources), &sdhi0_info, sizeof(struct sh_mobile_sdhi_info)); platform_device_register_resndata(NULL, "sh_mobile_sdhi", 2, sdhi2_resources, ARRAY_SIZE(sdhi2_resources), &sdhi2_info, sizeof(struct sh_mobile_sdhi_info)); } /* * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits * 14-15. We have to set them back to 01 from the default 00 value each time * the PHY is reset. It's also important because the PHY's LED0 signal is * connected to SoC's ETH_LINK signal and in the PHY's default mode it will * bounce on and off after each packet, which we apparently want to avoid. */ static int lager_ksz8041_fixup(struct phy_device *phydev) { u16 phyctrl1 = phy_read(phydev, 0x1e); phyctrl1 &= ~0xc000; phyctrl1 |= 0x4000; return phy_write(phydev, 0x1e, phyctrl1); } static void __init lager_init(void) { lager_add_standard_devices(); irq_set_irq_type(irq_pin(0), IRQ_TYPE_LEVEL_LOW); if (IS_ENABLED(CONFIG_PHYLIB)) phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup); }
/* * Perform board specific initializations */ static void __init armadillo5x0_init(void) { imx31_soc_init(); mxc_iomux_setup_multiple_pins(armadillo5x0_pins, ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); regulator_register_fixed(0, dummy_supplies, ARRAY_SIZE(dummy_supplies)); platform_add_devices(devices, ARRAY_SIZE(devices)); imx_add_gpio_keys(&armadillo5x0_button_data); imx31_add_imx_i2c1(NULL); /* Register UART */ imx31_add_imx_uart0(&uart_pdata); imx31_add_imx_uart1(&uart_pdata); /* SMSC9118 IRQ pin */ gpio_direction_input(MX31_PIN_GPIO1_0); /* Register SDHC */ imx31_add_mxc_mmc(0, &sdhc_pdata); /* Register FB */ imx31_add_ipu_core(&mx3_ipu_data); imx31_add_mx3_sdc_fb(&mx3fb_pdata); /* Register NOR Flash */ platform_device_register_resndata(NULL, "physmap-flash", -1, &armadillo5x0_nor_flash_resource, 1, &armadillo5x0_nor_flash_pdata, sizeof(armadillo5x0_nor_flash_pdata)); /* Register NAND Flash */ imx31_add_mxc_nand(&armadillo5x0_nand_board_info); /* set NAND page size to 2k if not configured via boot mode pins */ __raw_writel(__raw_readl(mx3_ccm_base + MXC_CCM_RCSR) | (1 << 30), mx3_ccm_base + MXC_CCM_RCSR); /* RTC */ /* Get RTC IRQ and register the chip */ if (gpio_request(ARMADILLO5X0_RTC_GPIO, "rtc") == 0) { if (gpio_direction_input(ARMADILLO5X0_RTC_GPIO) == 0) armadillo5x0_i2c_rtc.irq = gpio_to_irq(ARMADILLO5X0_RTC_GPIO); else gpio_free(ARMADILLO5X0_RTC_GPIO); } if (armadillo5x0_i2c_rtc.irq == 0) pr_warning("armadillo5x0_init: failed to get RTC IRQ\n"); i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); /* USB */ usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); if (usbotg_pdata.otg) imx31_add_mxc_ehci_otg(&usbotg_pdata); usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); if (usbh2_pdata.otg) imx31_add_mxc_ehci_hs(2, &usbh2_pdata); }
static int olpc_xo175_ec_probe(struct spi_device *spi) { struct olpc_xo175_ec *priv; int ret; if (olpc_ec) { dev_err(&spi->dev, "OLPC EC already registered.\n"); return -EBUSY; } priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->gpio_cmd = devm_gpiod_get(&spi->dev, "cmd", GPIOD_OUT_LOW); if (IS_ERR(priv->gpio_cmd)) { dev_err(&spi->dev, "failed to get cmd gpio: %ld\n", PTR_ERR(priv->gpio_cmd)); return PTR_ERR(priv->gpio_cmd); } priv->spi = spi; spin_lock_init(&priv->cmd_state_lock); priv->cmd_state = CMD_STATE_IDLE; init_completion(&priv->cmd_done); priv->logbuf_len = 0; /* Set up power button input device */ priv->pwrbtn = devm_input_allocate_device(&spi->dev); if (!priv->pwrbtn) return -ENOMEM; priv->pwrbtn->name = "Power Button"; priv->pwrbtn->dev.parent = &spi->dev; input_set_capability(priv->pwrbtn, EV_KEY, KEY_POWER); ret = input_register_device(priv->pwrbtn); if (ret) { dev_err(&spi->dev, "error registering input device: %d\n", ret); return ret; } spi_set_drvdata(spi, priv); priv->xfer.rx_buf = &priv->rx_buf; priv->xfer.tx_buf = &priv->tx_buf; olpc_xo175_ec_read_packet(priv); olpc_ec_driver_register(&olpc_xo175_ec_driver, priv); olpc_ec = platform_device_register_resndata(&spi->dev, "olpc-ec", -1, NULL, 0, NULL, 0); /* Enable all EC events while we're awake */ olpc_xo175_ec_set_event_mask(EC_ALL_EVENTS); if (pm_power_off == NULL) pm_power_off = olpc_xo175_ec_power_off; dev_info(&spi->dev, "OLPC XO-1.75 Embedded Controller driver\n"); return 0; }