Commit eac57949 authored by Steven King's avatar Steven King Committed by Greg Ungerer

m68knommu: refactor Coldfire GPIO not to require GPIOLIB, eliminate mcf_gpio_chips.

If we're not connecting external GPIO extenders via i2c or spi or whatever, we
probably don't need GPIOLIB.  If we provide an alternate implementation of
the GPIOLIB functions to use when only on-chip GPIO is needed, we can change
ARCH_REQUIRE_GPIOLIB to ARCH_WANTS_OPTIONAL_GPIOLIB so that GPIOLIB becomes
optional.

The downside is that in the GPIOLIB=n case, we lose all error checking done by
gpiolib, ie multiply allocating the gpio, free'ing gpio etc., so that the
only checking that can be done is if we reference a gpio on an external part.
Targets that need the extra error checking can still select GPIOLIB=y.

For the case where GPIOLIB=y, we can simplify the table of gpio chips to use a
single chip, eliminating the tables of chips in the 5xxx.c files.  The
original motivation for the definition of multiple chips was to match the way
many of the Coldfire variants defined their gpio as a spare array in memory.
However, all this really gains us is some error checking when we request a
gpio, gpiolib can check that it doesn't fall in one of the holes.  If thats
important, I think we can still come up with a better way of accomplishing
that.

Also in this patch is some general cleanup and reorganizing of the gpio header
files (I'm sure I must have had a reason why I sometimes used a prefix of
mcf_gpio and other times mcfgpio but for the life of me I can't think of it
now).
Signed-off-by: default avatarSteven King <sfking@fdwdc.com>
Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
parent 14be4252
...@@ -23,7 +23,7 @@ config M68KCLASSIC ...@@ -23,7 +23,7 @@ config M68KCLASSIC
config COLDFIRE config COLDFIRE
bool "Coldfire CPU family support" bool "Coldfire CPU family support"
select GENERIC_GPIO select GENERIC_GPIO
select ARCH_REQUIRE_GPIOLIB select ARCH_WANT_OPTIONAL_GPIOLIB
select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAVE_CUSTOM_GPIO_H
select CPU_HAS_NO_BITFIELDS select CPU_HAS_NO_BITFIELDS
select CPU_HAS_NO_MULDIV64 select CPU_HAS_NO_MULDIV64
......
...@@ -17,170 +17,9 @@ ...@@ -17,170 +17,9 @@
#define coldfire_gpio_h #define coldfire_gpio_h
#include <linux/io.h> #include <linux/io.h>
#include <asm-generic/gpio.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
/*
* The Freescale Coldfire family is quite varied in how they implement GPIO.
* Some parts have 8 bit ports, some have 16bit and some have 32bit; some have
* only one port, others have multiple ports; some have a single data latch
* for both input and output, others have a separate pin data register to read
* input; some require a read-modify-write access to change an output, others
* have set and clear registers for some of the outputs; Some have all the
* GPIOs in a single control area, others have some GPIOs implemented in
* different modules.
*
* This implementation attempts accommodate the differences while presenting
* a generic interface that will optimize to as few instructions as possible.
*/
#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
defined(CONFIG_M532x) || defined(CONFIG_M54xx)
/* These parts have GPIO organized by 8 bit ports */
#define MCFGPIO_PORTTYPE u8
#define MCFGPIO_PORTSIZE 8
#define mcfgpio_read(port) __raw_readb(port)
#define mcfgpio_write(data, port) __raw_writeb(data, port)
#elif defined(CONFIG_M5307) || defined(CONFIG_M5407) || defined(CONFIG_M5272)
/* These parts have GPIO organized by 16 bit ports */
#define MCFGPIO_PORTTYPE u16
#define MCFGPIO_PORTSIZE 16
#define mcfgpio_read(port) __raw_readw(port)
#define mcfgpio_write(data, port) __raw_writew(data, port)
#elif defined(CONFIG_M5249)
/* These parts have GPIO organized by 32 bit ports */
#define MCFGPIO_PORTTYPE u32
#define MCFGPIO_PORTSIZE 32
#define mcfgpio_read(port) __raw_readl(port)
#define mcfgpio_write(data, port) __raw_writel(data, port)
#endif
#define mcfgpio_bit(gpio) (1 << ((gpio) % MCFGPIO_PORTSIZE))
#define mcfgpio_port(gpio) ((gpio) / MCFGPIO_PORTSIZE)
#if defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
defined(CONFIG_M527x) || defined(CONFIG_M528x) || defined(CONFIG_M532x)
/*
* These parts have an 'Edge' Port module (external interrupt/GPIO) which uses
* read-modify-write to change an output and a GPIO module which has separate
* set/clr registers to directly change outputs with a single write access.
*/
#if defined(CONFIG_M528x)
/*
* The 528x also has GPIOs in other modules (GPT, QADC) which use
* read-modify-write as well as those controlled by the EPORT and GPIO modules.
*/
#define MCFGPIO_SCR_START 40
#else
#define MCFGPIO_SCR_START 8
#endif
#define MCFGPIO_SETR_PORT(gpio) (MCFGPIO_SETR + \
mcfgpio_port(gpio - MCFGPIO_SCR_START))
#define MCFGPIO_CLRR_PORT(gpio) (MCFGPIO_CLRR + \
mcfgpio_port(gpio - MCFGPIO_SCR_START))
#else
#define MCFGPIO_SCR_START MCFGPIO_PIN_MAX
/* with MCFGPIO_SCR == MCFGPIO_PIN_MAX, these will be optimized away */
#define MCFGPIO_SETR_PORT(gpio) 0
#define MCFGPIO_CLRR_PORT(gpio) 0
#endif
/*
* Coldfire specific helper functions
*/
/* return the port pin data register for a gpio */
static inline u32 __mcf_gpio_ppdr(unsigned gpio)
{
#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
defined(CONFIG_M5307) || defined(CONFIG_M5407)
return MCFSIM_PADAT;
#elif defined(CONFIG_M5272)
if (gpio < 16)
return MCFSIM_PADAT;
else if (gpio < 32)
return MCFSIM_PBDAT;
else
return MCFSIM_PCDAT;
#elif defined(CONFIG_M5249)
if (gpio < 32)
return MCFSIM2_GPIOREAD;
else
return MCFSIM2_GPIO1READ;
#elif defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
defined(CONFIG_M527x) || defined(CONFIG_M528x) || defined(CONFIG_M532x)
if (gpio < 8)
return MCFEPORT_EPPDR;
#if defined(CONFIG_M528x)
else if (gpio < 16)
return MCFGPTA_GPTPORT;
else if (gpio < 24)
return MCFGPTB_GPTPORT;
else if (gpio < 32)
return MCFQADC_PORTQA;
else if (gpio < 40)
return MCFQADC_PORTQB;
#endif
else
return MCFGPIO_PPDR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
#else
return 0;
#endif
}
/* return the port output data register for a gpio */
static inline u32 __mcf_gpio_podr(unsigned gpio)
{
#if defined(CONFIG_M5206) || defined(CONFIG_M5206e) || \
defined(CONFIG_M5307) || defined(CONFIG_M5407)
return MCFSIM_PADAT;
#elif defined(CONFIG_M5272)
if (gpio < 16)
return MCFSIM_PADAT;
else if (gpio < 32)
return MCFSIM_PBDAT;
else
return MCFSIM_PCDAT;
#elif defined(CONFIG_M5249)
if (gpio < 32)
return MCFSIM2_GPIOWRITE;
else
return MCFSIM2_GPIO1WRITE;
#elif defined(CONFIG_M520x) || defined(CONFIG_M523x) || \
defined(CONFIG_M527x) || defined(CONFIG_M528x) || defined(CONFIG_M532x)
if (gpio < 8)
return MCFEPORT_EPDR;
#if defined(CONFIG_M528x)
else if (gpio < 16)
return MCFGPTA_GPTPORT;
else if (gpio < 24)
return MCFGPTB_GPTPORT;
else if (gpio < 32)
return MCFQADC_PORTQA;
else if (gpio < 40)
return MCFQADC_PORTQB;
#endif
else
return MCFGPIO_PODR + mcfgpio_port(gpio - MCFGPIO_SCR_START);
#else
return 0;
#endif
}
/* /*
* The Generic GPIO functions * The Generic GPIO functions
* *
...@@ -191,7 +30,7 @@ static inline u32 __mcf_gpio_podr(unsigned gpio) ...@@ -191,7 +30,7 @@ static inline u32 __mcf_gpio_podr(unsigned gpio)
static inline int gpio_get_value(unsigned gpio) static inline int gpio_get_value(unsigned gpio)
{ {
if (__builtin_constant_p(gpio) && gpio < MCFGPIO_PIN_MAX) if (__builtin_constant_p(gpio) && gpio < MCFGPIO_PIN_MAX)
return mcfgpio_read(__mcf_gpio_ppdr(gpio)) & mcfgpio_bit(gpio); return mcfgpio_read(__mcfgpio_ppdr(gpio)) & mcfgpio_bit(gpio);
else else
return __gpio_get_value(gpio); return __gpio_get_value(gpio);
} }
...@@ -204,12 +43,12 @@ static inline void gpio_set_value(unsigned gpio, int value) ...@@ -204,12 +43,12 @@ static inline void gpio_set_value(unsigned gpio, int value)
MCFGPIO_PORTTYPE data; MCFGPIO_PORTTYPE data;
local_irq_save(flags); local_irq_save(flags);
data = mcfgpio_read(__mcf_gpio_podr(gpio)); data = mcfgpio_read(__mcfgpio_podr(gpio));
if (value) if (value)
data |= mcfgpio_bit(gpio); data |= mcfgpio_bit(gpio);
else else
data &= ~mcfgpio_bit(gpio); data &= ~mcfgpio_bit(gpio);
mcfgpio_write(data, __mcf_gpio_podr(gpio)); mcfgpio_write(data, __mcfgpio_podr(gpio));
local_irq_restore(flags); local_irq_restore(flags);
} else { } else {
if (value) if (value)
......
This diff is collapsed.
/*
* Coldfire generic GPIO pinmux support.
*
* (C) Copyright 2009, Steven King <sfking@fdwdc.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef pinmux_h
#define pinmux_h
#define MCFPINMUX_NONE -1
extern int mcf_pinmux_request(unsigned, unsigned);
extern void mcf_pinmux_release(unsigned, unsigned);
static inline int mcf_pinmux_is_valid(unsigned pinmux)
{
return pinmux != MCFPINMUX_NONE;
}
#endif
...@@ -32,5 +32,5 @@ obj-$(CONFIG_NETtel) += nettel.o ...@@ -32,5 +32,5 @@ obj-$(CONFIG_NETtel) += nettel.o
obj-$(CONFIG_CLEOPATRA) += nettel.o obj-$(CONFIG_CLEOPATRA) += nettel.o
obj-$(CONFIG_FIREBEE) += firebee.o obj-$(CONFIG_FIREBEE) += firebee.o
obj-y += pinmux.o gpio.o obj-y += gpio.o
extra-y := head.o extra-y := head.o
...@@ -14,119 +14,161 @@ ...@@ -14,119 +14,161 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <asm/gpio.h> #include <linux/io.h>
#include <asm/pinmux.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfgpio.h> #include <asm/mcfgpio.h>
#define MCF_CHIP(chip) container_of(chip, struct mcf_gpio_chip, gpio_chip) int __mcfgpio_get_value(unsigned gpio)
{
return mcfgpio_read(__mcfgpio_ppdr(gpio)) & mcfgpio_bit(gpio);
}
EXPORT_SYMBOL(__mcfgpio_get_value);
void __mcfgpio_set_value(unsigned gpio, int value)
{
if (gpio < MCFGPIO_SCR_START) {
unsigned long flags;
MCFGPIO_PORTTYPE data;
local_irq_save(flags);
data = mcfgpio_read(__mcfgpio_podr(gpio));
if (value)
data |= mcfgpio_bit(gpio);
else
data &= ~mcfgpio_bit(gpio);
mcfgpio_write(data, __mcfgpio_podr(gpio));
local_irq_restore(flags);
} else {
if (value)
mcfgpio_write(mcfgpio_bit(gpio),
MCFGPIO_SETR_PORT(gpio));
else
mcfgpio_write(~mcfgpio_bit(gpio),
MCFGPIO_CLRR_PORT(gpio));
}
}
EXPORT_SYMBOL(__mcfgpio_set_value);
int mcf_gpio_direction_input(struct gpio_chip *chip, unsigned offset) int __mcfgpio_direction_input(unsigned gpio)
{ {
unsigned long flags; unsigned long flags;
MCFGPIO_PORTTYPE dir; MCFGPIO_PORTTYPE dir;
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip);
local_irq_save(flags); local_irq_save(flags);
dir = mcfgpio_read(mcf_chip->pddr); dir = mcfgpio_read(__mcfgpio_pddr(gpio));
dir &= ~mcfgpio_bit(chip->base + offset); dir &= ~mcfgpio_bit(gpio);
mcfgpio_write(dir, mcf_chip->pddr); mcfgpio_write(dir, __mcfgpio_pddr(gpio));
local_irq_restore(flags); local_irq_restore(flags);
return 0; return 0;
} }
EXPORT_SYMBOL(__mcfgpio_direction_input);
int mcf_gpio_get_value(struct gpio_chip *chip, unsigned offset) int __mcfgpio_direction_output(unsigned gpio, int value)
{
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip);
return mcfgpio_read(mcf_chip->ppdr) & mcfgpio_bit(chip->base + offset);
}
int mcf_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
int value)
{ {
unsigned long flags; unsigned long flags;
MCFGPIO_PORTTYPE data; MCFGPIO_PORTTYPE data;
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip);
local_irq_save(flags); local_irq_save(flags);
/* write the value to the output latch */ data = mcfgpio_read(__mcfgpio_pddr(gpio));
data = mcfgpio_read(mcf_chip->podr);
if (value) if (value)
data |= mcfgpio_bit(chip->base + offset); data |= mcfgpio_bit(gpio);
else else
data &= ~mcfgpio_bit(chip->base + offset); data &= mcfgpio_bit(gpio);
mcfgpio_write(data, mcf_chip->podr); mcfgpio_write(data, __mcfgpio_pddr(gpio));
/* now set the direction to output */ /* now set the data to output */
data = mcfgpio_read(mcf_chip->pddr); if (gpio < MCFGPIO_SCR_START) {
data |= mcfgpio_bit(chip->base + offset); data = mcfgpio_read(__mcfgpio_podr(gpio));
mcfgpio_write(data, mcf_chip->pddr); if (value)
data |= mcfgpio_bit(gpio);
else
data &= ~mcfgpio_bit(gpio);
mcfgpio_write(data, __mcfgpio_podr(gpio));
} else {
if (value)
mcfgpio_write(mcfgpio_bit(gpio),
MCFGPIO_SETR_PORT(gpio));
else
mcfgpio_write(~mcfgpio_bit(gpio),
MCFGPIO_CLRR_PORT(gpio));
}
local_irq_restore(flags); local_irq_restore(flags);
return 0;
}
EXPORT_SYMBOL(__mcfgpio_direction_output);
int __mcfgpio_request(unsigned gpio)
{
return 0; return 0;
} }
EXPORT_SYMBOL(__mcfgpio_request);
void mcf_gpio_set_value(struct gpio_chip *chip, unsigned offset, int value) void __mcfgpio_free(unsigned gpio)
{ {
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip); __mcfgpio_direction_input(gpio);
}
EXPORT_SYMBOL(__mcfgpio_free);
unsigned long flags; #ifdef CONFIG_GPIOLIB
MCFGPIO_PORTTYPE data;
local_irq_save(flags); int mcfgpio_direction_input(struct gpio_chip *chip, unsigned offset)
data = mcfgpio_read(mcf_chip->podr); {
if (value) return __mcfgpio_direction_input(offset);
data |= mcfgpio_bit(chip->base + offset);
else
data &= ~mcfgpio_bit(chip->base + offset);
mcfgpio_write(data, mcf_chip->podr);
local_irq_restore(flags);
} }
void mcf_gpio_set_value_fast(struct gpio_chip *chip, unsigned offset, int value) int mcfgpio_get_value(struct gpio_chip *chip, unsigned offset)
{ {
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip); return __mcfgpio_get_value(offset);
if (value)
mcfgpio_write(mcfgpio_bit(chip->base + offset), mcf_chip->setr);
else
mcfgpio_write(~mcfgpio_bit(chip->base + offset), mcf_chip->clrr);
} }
int mcf_gpio_request(struct gpio_chip *chip, unsigned offset) int mcfgpio_direction_output(struct gpio_chip *chip, unsigned offset, int value)
{ {
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip); return __mcfgpio_direction_output(offset, value);
return mcf_chip->gpio_to_pinmux ?
mcf_pinmux_request(mcf_chip->gpio_to_pinmux[offset], 0) : 0;
} }
void mcf_gpio_free(struct gpio_chip *chip, unsigned offset) void mcfgpio_set_value(struct gpio_chip *chip, unsigned offset, int value)
{ {
struct mcf_gpio_chip *mcf_chip = MCF_CHIP(chip); __mcfgpio_set_value(offset, value);
}
mcf_gpio_direction_input(chip, offset); int mcfgpio_request(struct gpio_chip *chip, unsigned offset)
{
return __mcfgpio_request(offset);
}
if (mcf_chip->gpio_to_pinmux) void mcfgpio_free(struct gpio_chip *chip, unsigned offset)
mcf_pinmux_release(mcf_chip->gpio_to_pinmux[offset], 0); {
__mcfgpio_free(offset);
} }
struct bus_type mcf_gpio_subsys = { struct bus_type mcfgpio_subsys = {
.name = "gpio", .name = "gpio",
.dev_name = "gpio", .dev_name = "gpio",
}; };
static int __init mcf_gpio_sysinit(void) static struct gpio_chip mcfgpio_chip = {
{ .label = "mcfgpio",
unsigned int i = 0; .request = mcfgpio_request,
.free = mcfgpio_free,
.direction_input = mcfgpio_direction_input,
.direction_output = mcfgpio_direction_output,
.get = mcfgpio_get_value,
.set = mcfgpio_set_value,
.base = 0,
.ngpio = MCFGPIO_PIN_MAX,
};
while (i < mcf_gpio_chips_size) static int __init mcfgpio_sysinit(void)
gpiochip_add((struct gpio_chip *)&mcf_gpio_chips[i++]); {
return subsys_system_register(&mcf_gpio_subsys, NULL); gpiochip_add(&mcfgpio_chip);
return subsys_system_register(&mcfgpio_subsys, NULL);
} }
core_initcall(mcf_gpio_sysinit); core_initcall(mcfgpio_sysinit);
#endif
...@@ -16,15 +16,6 @@ ...@@ -16,15 +16,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PP, 0, 8, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -19,22 +19,6 @@ ...@@ -19,22 +19,6 @@
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PIRQ, 0, 8, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPF(CS, 9, 3),
MCFGPF(FECI2C, 16, 4),
MCFGPF(QSPI, 24, 4),
MCFGPF(TIMER, 32, 4),
MCFGPF(UART, 40, 8),
MCFGPF(FECH, 48, 8),
MCFGPF(FECL, 56, 8),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -19,28 +19,6 @@ ...@@ -19,28 +19,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPF(ADDR, 13, 3),
MCFGPF(DATAH, 16, 8),
MCFGPF(DATAL, 24, 8),
MCFGPF(BUSCTL, 32, 8),
MCFGPF(BS, 40, 4),
MCFGPF(CS, 49, 7),
MCFGPF(SDRAM, 56, 6),
MCFGPF(FECI2C, 64, 4),
MCFGPF(UARTH, 72, 2),
MCFGPF(UARTL, 80, 8),
MCFGPF(QSPI, 88, 5),
MCFGPF(TIMER, 96, 8),
MCFGPF(ETPU, 104, 3),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -16,16 +16,6 @@ ...@@ -16,16 +16,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(GPIO0, 0, 32, MCFSIM2_GPIOENABLE, MCFSIM2_GPIOWRITE, MCFSIM2_GPIOREAD),
MCFGPS(GPIO1, 32, 32, MCFSIM2_GPIO1ENABLE, MCFSIM2_GPIO1WRITE, MCFSIM2_GPIO1READ),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/mcfgpio.h>
/***************************************************************************/ /***************************************************************************/
...@@ -31,16 +30,6 @@ unsigned char ledbank = 0xff; ...@@ -31,16 +30,6 @@ unsigned char ledbank = 0xff;
/***************************************************************************/ /***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PA, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
MCFGPS(PB, 16, 16, MCFSIM_PBDDR, MCFSIM_PBDAT, MCFSIM_PBDAT),
MCFGPS(Pc, 32, 16, MCFSIM_PCDDR, MCFSIM_PCDAT, MCFSIM_PCDAT),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/
static void __init m5272_uarts_init(void) static void __init m5272_uarts_init(void)
{ {
u32 v; u32 v;
......
...@@ -20,49 +20,6 @@ ...@@ -20,49 +20,6 @@
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
#if defined(CONFIG_M5271)
MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPF(ADDR, 13, 3),
MCFGPF(DATAH, 16, 8),
MCFGPF(DATAL, 24, 8),
MCFGPF(BUSCTL, 32, 8),
MCFGPF(BS, 40, 4),
MCFGPF(CS, 49, 7),
MCFGPF(SDRAM, 56, 6),
MCFGPF(FECI2C, 64, 4),
MCFGPF(UARTH, 72, 2),
MCFGPF(UARTL, 80, 8),
MCFGPF(QSPI, 88, 5),
MCFGPF(TIMER, 96, 8),
#elif defined(CONFIG_M5275)
MCFGPS(PIRQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPF(BUSCTL, 8, 8),
MCFGPF(ADDR, 21, 3),
MCFGPF(CS, 25, 7),
MCFGPF(FEC0H, 32, 8),
MCFGPF(FEC0L, 40, 8),
MCFGPF(FECI2C, 48, 6),
MCFGPF(QSPI, 56, 7),
MCFGPF(SDRAM, 64, 8),
MCFGPF(TIMERH, 72, 4),
MCFGPF(TIMERL, 80, 4),
MCFGPF(UARTL, 88, 8),
MCFGPF(FEC1H, 96, 8),
MCFGPF(FEC1L, 104, 8),
MCFGPF(BS, 114, 2),
MCFGPF(IRQ, 121, 7),
MCFGPF(USBH, 128, 1),
MCFGPF(USBL, 136, 8),
MCFGPF(UARTH, 144, 4),
#endif
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -21,37 +21,6 @@ ...@@ -21,37 +21,6 @@
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(NQ, 1, 7, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPS(TA, 8, 4, MCFGPTA_GPTDDR, MCFGPTA_GPTPORT, MCFGPTB_GPTPORT),
MCFGPS(TB, 16, 4, MCFGPTB_GPTDDR, MCFGPTB_GPTPORT, MCFGPTB_GPTPORT),
MCFGPS(QA, 24, 4, MCFQADC_DDRQA, MCFQADC_PORTQA, MCFQADC_PORTQA),
MCFGPS(QB, 32, 4, MCFQADC_DDRQB, MCFQADC_PORTQB, MCFQADC_PORTQB),
MCFGPF(A, 40, 8),
MCFGPF(B, 48, 8),
MCFGPF(C, 56, 8),
MCFGPF(D, 64, 8),
MCFGPF(E, 72, 8),
MCFGPF(F, 80, 8),
MCFGPF(G, 88, 8),
MCFGPF(H, 96, 8),
MCFGPF(J, 104, 8),
MCFGPF(DD, 112, 8),
MCFGPF(EH, 120, 8),
MCFGPF(EL, 128, 8),
MCFGPF(AS, 136, 6),
MCFGPF(QS, 144, 7),
MCFGPF(SD, 152, 6),
MCFGPF(TC, 160, 4),
MCFGPF(TD, 168, 4),
MCFGPF(UA, 176, 4),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
...@@ -74,7 +43,7 @@ static void __init m528x_uarts_init(void) ...@@ -74,7 +43,7 @@ static void __init m528x_uarts_init(void)
/* make sure PUAPAR is set for UART0 and UART1 */ /* make sure PUAPAR is set for UART0 and UART1 */
port = readb(MCF5282_GPIO_PUAPAR); port = readb(MCF5282_GPIO_PUAPAR);
port |= 0x03 | (0x03 << 2); port |= 0x03 | (0x03 << 2);
writeb(port, MCF5282_GPIO_PUAPAR); writeb(port, MCFGPIO_PUAPAR);
} }
/***************************************************************************/ /***************************************************************************/
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
#include <asm/mcfwdebug.h> #include <asm/mcfwdebug.h>
/***************************************************************************/ /***************************************************************************/
...@@ -29,14 +28,6 @@ unsigned char ledbank = 0xff; ...@@ -29,14 +28,6 @@ unsigned char ledbank = 0xff;
/***************************************************************************/ /***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PP, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/
void __init config_BSP(char *commandp, int size) void __init config_BSP(char *commandp, int size)
{ {
#if defined(CONFIG_NETtel) || \ #if defined(CONFIG_NETtel) || \
......
...@@ -26,35 +26,10 @@ ...@@ -26,35 +26,10 @@
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/mcfdma.h> #include <asm/mcfdma.h>
#include <asm/mcfgpio.h>
#include <asm/mcfwdebug.h> #include <asm/mcfwdebug.h>
/***************************************************************************/ /***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PIRQ, 0, 8, MCFEPORT_EPDDR, MCFEPORT_EPDR, MCFEPORT_EPPDR),
MCFGPF(FECH, 8, 8),
MCFGPF(FECL, 16, 8),
MCFGPF(SSI, 24, 5),
MCFGPF(BUSCTL, 32, 4),
MCFGPF(BE, 40, 4),
MCFGPF(CS, 49, 5),
MCFGPF(PWM, 58, 4),
MCFGPF(FECI2C, 64, 4),
MCFGPF(UART, 72, 8),
MCFGPF(QSPI, 80, 6),
MCFGPF(TIMER, 88, 4),
MCFGPF(LCDDATAH, 96, 2),
MCFGPF(LCDDATAM, 104, 8),
MCFGPF(LCDDATAL, 112, 8),
MCFGPF(LCDCTLH, 120, 1),
MCFGPF(LCDCTLL, 128, 8),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/
#if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
static void __init m532x_qspi_init(void) static void __init m532x_qspi_init(void)
......
...@@ -16,15 +16,6 @@ ...@@ -16,15 +16,6 @@
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include <asm/mcfgpio.h>
/***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = {
MCFGPS(PP, 0, 16, MCFSIM_PADDR, MCFSIM_PADAT, MCFSIM_PADAT),
};
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/ /***************************************************************************/
......
...@@ -21,19 +21,12 @@ ...@@ -21,19 +21,12 @@
#include <asm/m54xxsim.h> #include <asm/m54xxsim.h>
#include <asm/mcfuart.h> #include <asm/mcfuart.h>
#include <asm/m54xxgpt.h> #include <asm/m54xxgpt.h>
#include <asm/mcfgpio.h>
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#endif #endif
/***************************************************************************/ /***************************************************************************/
struct mcf_gpio_chip mcf_gpio_chips[] = { };
unsigned int mcf_gpio_chips_size = ARRAY_SIZE(mcf_gpio_chips);
/***************************************************************************/
static void __init m54xx_uarts_init(void) static void __init m54xx_uarts_init(void)
{ {
/* enable io pins */ /* enable io pins */
......
/*
* Coldfire generic GPIO pinmux support.
*
* (C) Copyright 2009, Steven King <sfking@fdwdc.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <asm/pinmux.h>
int mcf_pinmux_request(unsigned pinmux, unsigned func)
{
return 0;
}
void mcf_pinmux_release(unsigned pinmux, unsigned func)
{
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment