Linux Audio

Check our new training course

Loading...
v3.15
 
  1/*
  2 * OMAP15xx specific gpio init
  3 *
  4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
  5 *
  6 * Author:
  7 *	Charulatha V <charu@ti.com>
  8 *
  9 * This program is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU General Public License as
 11 * published by the Free Software Foundation version 2.
 12 *
 13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
 14 * kind, whether express or implied; without even the implied warranty
 15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 */
 18
 19#include <linux/gpio.h>
 20#include <linux/platform_data/gpio-omap.h>
 
 
 21
 22#include <mach/irqs.h>
 23
 24#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 25#define OMAP1510_GPIO_BASE		0xFFFCE000
 26
 27/* gpio1 */
 28static struct resource omap15xx_mpu_gpio_resources[] = {
 29	{
 30		.start	= OMAP1_MPUIO_VBASE,
 31		.end	= OMAP1_MPUIO_VBASE + SZ_2K - 1,
 32		.flags	= IORESOURCE_MEM,
 33	},
 34	{
 35		.start	= INT_MPUIO,
 36		.flags	= IORESOURCE_IRQ,
 37	},
 38};
 39
 40static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
 41	.revision       = USHRT_MAX,
 42	.direction	= OMAP_MPUIO_IO_CNTL,
 43	.datain		= OMAP_MPUIO_INPUT_LATCH,
 44	.dataout	= OMAP_MPUIO_OUTPUT,
 45	.irqstatus	= OMAP_MPUIO_GPIO_INT,
 46	.irqenable	= OMAP_MPUIO_GPIO_MASKIT,
 47	.irqenable_inv	= true,
 48	.irqctrl	= OMAP_MPUIO_GPIO_INT_EDGE,
 49};
 50
 51static struct omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 52	.is_mpuio		= true,
 53	.bank_width		= 16,
 54	.bank_stride		= 1,
 55	.regs			= &omap15xx_mpuio_regs,
 56};
 57
 58static struct platform_device omap15xx_mpu_gpio = {
 59	.name           = "omap_gpio",
 60	.id             = 0,
 61	.dev            = {
 62		.platform_data = &omap15xx_mpu_gpio_config,
 63	},
 64	.num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
 65	.resource = omap15xx_mpu_gpio_resources,
 66};
 67
 68/* gpio2 */
 69static struct resource omap15xx_gpio_resources[] = {
 70	{
 71		.start	= OMAP1510_GPIO_BASE,
 72		.end	= OMAP1510_GPIO_BASE + SZ_2K - 1,
 73		.flags	= IORESOURCE_MEM,
 74	},
 75	{
 76		.start	= INT_GPIO_BANK1,
 77		.flags	= IORESOURCE_IRQ,
 78	},
 79};
 80
 81static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
 82	.revision	= USHRT_MAX,
 83	.direction	= OMAP1510_GPIO_DIR_CONTROL,
 84	.datain		= OMAP1510_GPIO_DATA_INPUT,
 85	.dataout	= OMAP1510_GPIO_DATA_OUTPUT,
 86	.irqstatus	= OMAP1510_GPIO_INT_STATUS,
 87	.irqenable	= OMAP1510_GPIO_INT_MASK,
 88	.irqenable_inv	= true,
 89	.irqctrl	= OMAP1510_GPIO_INT_CONTROL,
 90	.pinctrl	= OMAP1510_GPIO_PIN_CONTROL,
 91};
 92
 93static struct omap_gpio_platform_data omap15xx_gpio_config = {
 94	.bank_width		= 16,
 95	.regs                   = &omap15xx_gpio_regs,
 96};
 97
 98static struct platform_device omap15xx_gpio = {
 99	.name           = "omap_gpio",
100	.id             = 1,
101	.dev            = {
102		.platform_data = &omap15xx_gpio_config,
103	},
104	.num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
105	.resource = omap15xx_gpio_resources,
106};
107
108/*
109 * omap15xx_gpio_init needs to be done before
110 * machine_init functions access gpio APIs.
111 * Hence omap15xx_gpio_init is a postcore_initcall.
112 */
113static int __init omap15xx_gpio_init(void)
114{
115	if (!cpu_is_omap15xx())
116		return -EINVAL;
117
118	platform_device_register(&omap15xx_mpu_gpio);
119	platform_device_register(&omap15xx_gpio);
120
121	return 0;
122}
123postcore_initcall(omap15xx_gpio_init);
v6.8
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * OMAP15xx specific gpio init
  4 *
  5 * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
  6 *
  7 * Author:
  8 *	Charulatha V <charu@ti.com>
 
 
 
 
 
 
 
 
 
  9 */
 10
 
 11#include <linux/platform_data/gpio-omap.h>
 12#include <linux/soc/ti/omap1-soc.h>
 13#include <asm/irq.h>
 14
 15#include "irqs.h"
 16
 17#define OMAP1_MPUIO_VBASE		OMAP1_MPUIO_BASE
 18#define OMAP1510_GPIO_BASE		0xFFFCE000
 19
 20/* gpio1 */
 21static struct resource omap15xx_mpu_gpio_resources[] = {
 22	{
 23		.start	= OMAP1_MPUIO_VBASE,
 24		.end	= OMAP1_MPUIO_VBASE + SZ_2K - 1,
 25		.flags	= IORESOURCE_MEM,
 26	},
 27	{
 28		.start	= INT_MPUIO,
 29		.flags	= IORESOURCE_IRQ,
 30	},
 31};
 32
 33static struct omap_gpio_reg_offs omap15xx_mpuio_regs = {
 34	.revision       = USHRT_MAX,
 35	.direction	= OMAP_MPUIO_IO_CNTL,
 36	.datain		= OMAP_MPUIO_INPUT_LATCH,
 37	.dataout	= OMAP_MPUIO_OUTPUT,
 38	.irqstatus	= OMAP_MPUIO_GPIO_INT,
 39	.irqenable	= OMAP_MPUIO_GPIO_MASKIT,
 40	.irqenable_inv	= true,
 41	.irqctrl	= OMAP_MPUIO_GPIO_INT_EDGE,
 42};
 43
 44static struct omap_gpio_platform_data omap15xx_mpu_gpio_config = {
 45	.is_mpuio		= true,
 46	.bank_width		= 16,
 47	.bank_stride		= 1,
 48	.regs			= &omap15xx_mpuio_regs,
 49};
 50
 51static struct platform_device omap15xx_mpu_gpio = {
 52	.name           = "omap_gpio",
 53	.id             = 0,
 54	.dev            = {
 55		.platform_data = &omap15xx_mpu_gpio_config,
 56	},
 57	.num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources),
 58	.resource = omap15xx_mpu_gpio_resources,
 59};
 60
 61/* gpio2 */
 62static struct resource omap15xx_gpio_resources[] = {
 63	{
 64		.start	= OMAP1510_GPIO_BASE,
 65		.end	= OMAP1510_GPIO_BASE + SZ_2K - 1,
 66		.flags	= IORESOURCE_MEM,
 67	},
 68	{
 69		.start	= INT_GPIO_BANK1,
 70		.flags	= IORESOURCE_IRQ,
 71	},
 72};
 73
 74static struct omap_gpio_reg_offs omap15xx_gpio_regs = {
 75	.revision	= USHRT_MAX,
 76	.direction	= OMAP1510_GPIO_DIR_CONTROL,
 77	.datain		= OMAP1510_GPIO_DATA_INPUT,
 78	.dataout	= OMAP1510_GPIO_DATA_OUTPUT,
 79	.irqstatus	= OMAP1510_GPIO_INT_STATUS,
 80	.irqenable	= OMAP1510_GPIO_INT_MASK,
 81	.irqenable_inv	= true,
 82	.irqctrl	= OMAP1510_GPIO_INT_CONTROL,
 83	.pinctrl	= OMAP1510_GPIO_PIN_CONTROL,
 84};
 85
 86static struct omap_gpio_platform_data omap15xx_gpio_config = {
 87	.bank_width		= 16,
 88	.regs                   = &omap15xx_gpio_regs,
 89};
 90
 91static struct platform_device omap15xx_gpio = {
 92	.name           = "omap_gpio",
 93	.id             = 1,
 94	.dev            = {
 95		.platform_data = &omap15xx_gpio_config,
 96	},
 97	.num_resources = ARRAY_SIZE(omap15xx_gpio_resources),
 98	.resource = omap15xx_gpio_resources,
 99};
100
101/*
102 * omap15xx_gpio_init needs to be done before
103 * machine_init functions access gpio APIs.
104 * Hence omap15xx_gpio_init is a postcore_initcall.
105 */
106static int __init omap15xx_gpio_init(void)
107{
108	if (!cpu_is_omap15xx())
109		return -EINVAL;
110
111	platform_device_register(&omap15xx_mpu_gpio);
112	platform_device_register(&omap15xx_gpio);
113
114	return 0;
115}
116postcore_initcall(omap15xx_gpio_init);