Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112332
b: refs/heads/master
c: b0dbcf5
h: refs/heads/master
v: v3
  • Loading branch information
Russell King authored and Russell King committed Sep 7, 2008
1 parent 29e5345 commit 4332395
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 74 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8e6c81fe289e90b188203ec1db1dc2f3e992ebde
refs/heads/master: b0dbcf511c4bd10350902e79a1bdd4f5dcca66b6
20 changes: 10 additions & 10 deletions trunk/arch/arm/mach-ks8695/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int __init_or_module ks8695_gpio_interrupt(unsigned int pin, unsigned int type)

/* set pin as input */
x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
x &= ~IOPM(pin);
x &= ~IOPM_(pin);
__raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);

local_irq_restore(flags);
Expand Down Expand Up @@ -108,7 +108,7 @@ int __init_or_module gpio_direction_input(unsigned int pin)

/* set pin as input */
x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
x &= ~IOPM(pin);
x &= ~IOPM_(pin);
__raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);

local_irq_restore(flags);
Expand Down Expand Up @@ -136,14 +136,14 @@ int __init_or_module gpio_direction_output(unsigned int pin, unsigned int state)
/* set line state */
x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
if (state)
x |= IOPD(pin);
x |= (1 << pin);
else
x &= ~IOPD(pin);
x &= ~(1 << pin);
__raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);

/* set pin as output */
x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
x |= IOPM(pin);
x |= IOPM_(pin);
__raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);

local_irq_restore(flags);
Expand All @@ -168,9 +168,9 @@ void gpio_set_value(unsigned int pin, unsigned int state)
/* set output line state */
x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
if (state)
x |= IOPD(pin);
x |= (1 << pin);
else
x &= ~IOPD(pin);
x &= ~(1 << pin);
__raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);

local_irq_restore(flags);
Expand All @@ -189,7 +189,7 @@ int gpio_get_value(unsigned int pin)
return -EINVAL;

x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
return (x & IOPD(pin)) != 0;
return (x & (1 << pin)) != 0;
}
EXPORT_SYMBOL(gpio_get_value);

Expand Down Expand Up @@ -240,7 +240,7 @@ static int ks8695_gpio_show(struct seq_file *s, void *unused)
for (i = KS8695_GPIO_0; i <= KS8695_GPIO_15 ; i++) {
seq_printf(s, "%i:\t", i);

seq_printf(s, "%s\t", (mode & IOPM(i)) ? "Output" : "Input");
seq_printf(s, "%s\t", (mode & IOPM_(i)) ? "Output" : "Input");

if (i <= KS8695_GPIO_3) {
if (ctrl & enable[i]) {
Expand Down Expand Up @@ -273,7 +273,7 @@ static int ks8695_gpio_show(struct seq_file *s, void *unused)

seq_printf(s, "\t");

seq_printf(s, "%i\n", (data & IOPD(i)) ? 1 : 0);
seq_printf(s, "%i\n", (data & IOPD_(i)) ? 1 : 0);
}
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-ks8695/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
/* Platform-bus mapping */
extern struct bus_type platform_bus_type;
#define is_lbus_device(dev) (dev && dev->bus == &platform_bus_type)
#define __arch_dma_to_virt(dev, x) ({ (void *) (is_lbus_device(dev) ? \
__phys_to_virt(x) : __bus_to_virt(x)); })
#define __arch_dma_to_virt(dev, x) ({ is_lbus_device(dev) ? \
__phys_to_virt(x) : __bus_to_virt(x); })
#define __arch_virt_to_dma(dev, x) ({ is_lbus_device(dev) ? \
(dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); })
#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x))
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-ks8695/include/mach/regs-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


/* Port Mode Register */
#define IOPM(x) (1 << (x)) /* Mode for GPIO Pin x */
#define IOPM_(x) (1 << (x)) /* Mode for GPIO Pin x */

/* Port Control Register */
#define IOPC_IOTIM1EN (1 << 17) /* GPIO Pin for Timer1 Enable */
Expand All @@ -50,6 +50,6 @@
#define IOPC_TM_EDGE (6) /* Both Edge Detection */

/* Port Data Register */
#define IOPD(x) (1 << (x)) /* Signal Level of GPIO Pin x */
#define IOPD_(x) (1 << (x)) /* Signal Level of GPIO Pin x */

#endif
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-ks8695/include/mach/regs-lan.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#define KS8695_LRDLB (0x14) /* Receive Descriptor List Base Address */
#define KS8695_LMAL (0x18) /* MAC Station Address Low */
#define KS8695_LMAH (0x1c) /* MAC Station Address High */
#define KS8695_LMAAL(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
#define KS8695_LMAAH(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */
#define KS8695_LMAAL_(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
#define KS8695_LMAAH_(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */


/* DMA Transmit Control Register */
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/arm/mach-ks8695/include/mach/regs-wan.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#define KS8695_WRDLB (0x14) /* Receive Descriptor List Base Address */
#define KS8695_WMAL (0x18) /* MAC Station Address Low */
#define KS8695_WMAH (0x1c) /* MAC Station Address High */
#define KS8695_WMAAL(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
#define KS8695_WMAAH(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */
#define KS8695_WMAAL_(n) (0x80 + ((n)*8)) /* MAC Additional Station Address (0..15) Low */
#define KS8695_WMAAH_(n) (0x84 + ((n)*8)) /* MAC Additional Station Address (0..15) High */


/* DMA Transmit Control Register */
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-ks8695/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ static struct pci_ops ks8695_pci_ops = {
.write = ks8695_pci_writeconfig,
};

static struct pci_bus* __init ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
static struct pci_bus *ks8695_pci_scan_bus(int nr, struct pci_sys_data *sys)
{
return pci_scan_bus(sys->busnr, &ks8695_pci_ops, sys);
}
Expand Down
9 changes: 8 additions & 1 deletion trunk/drivers/net/smc91x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1520,7 +1520,9 @@ smc_open(struct net_device *dev)
/* Setup the default Register Modes */
lp->tcr_cur_mode = TCR_DEFAULT;
lp->rcr_cur_mode = RCR_DEFAULT;
lp->rpc_cur_mode = RPC_DEFAULT;
lp->rpc_cur_mode = RPC_DEFAULT |
lp->cfg.leda << RPC_LSXA_SHFT |
lp->cfg.ledb << RPC_LSXB_SHFT;

/*
* If we are not using a MII interface, we need to
Expand Down Expand Up @@ -2157,6 +2159,11 @@ static int smc_drv_probe(struct platform_device *pdev)
lp->cfg.flags |= (nowait) ? SMC91X_NOWAIT : 0;
}

if (!lp->cfg.leda && !lp->cfg.ledb) {
lp->cfg.leda = RPC_LSA_DEFAULT;
lp->cfg.ledb = RPC_LSB_DEFAULT;
}

ndev->dma = (unsigned char)-1;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs");
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/smc91x.h
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ smc_pxa_dma_irq(int dma, void *dummy)
#define RPC_LSB_DEFAULT RPC_LED_FD
#endif

#define RPC_DEFAULT (RPC_ANEG | (RPC_LSA_DEFAULT << RPC_LSXA_SHFT) | (RPC_LSB_DEFAULT << RPC_LSXB_SHFT) | RPC_SPEED | RPC_DPLX)
#define RPC_DEFAULT (RPC_ANEG | RPC_SPEED | RPC_DPLX)


/* Bank 0 0x0C is reserved */
Expand Down
61 changes: 9 additions & 52 deletions trunk/drivers/serial/serial_ks8695.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,44 +63,8 @@
#define UART_DUMMY_LSR_RX 0x100
#define UART_PORT_SIZE (KS8695_USR - KS8695_URRB + 4)

static inline int tx_enabled(struct uart_port *port)
{
return port->unused[0] & 1;
}

static inline int rx_enabled(struct uart_port *port)
{
return port->unused[0] & 2;
}

static inline int ms_enabled(struct uart_port *port)
{
return port->unused[0] & 4;
}

static inline void ms_enable(struct uart_port *port, int enabled)
{
if(enabled)
port->unused[0] |= 4;
else
port->unused[0] &= ~4;
}

static inline void rx_enable(struct uart_port *port, int enabled)
{
if(enabled)
port->unused[0] |= 2;
else
port->unused[0] &= ~2;
}

static inline void tx_enable(struct uart_port *port, int enabled)
{
if(enabled)
port->unused[0] |= 1;
else
port->unused[0] &= ~1;
}
#define tx_enabled(port) ((port)->unused[0])
#define rx_enabled(port) ((port)->unused[1])


#ifdef SUPPORT_SYSRQ
Expand All @@ -111,40 +75,34 @@ static void ks8695uart_stop_tx(struct uart_port *port)
{
if (tx_enabled(port)) {
disable_irq(KS8695_IRQ_UART_TX);
tx_enable(port, 0);
tx_enabled(port) = 0;
}
}

static void ks8695uart_start_tx(struct uart_port *port)
{
if (!tx_enabled(port)) {
enable_irq(KS8695_IRQ_UART_TX);
tx_enable(port, 1);
tx_enabled(port) = 1;
}
}

static void ks8695uart_stop_rx(struct uart_port *port)
{
if (rx_enabled(port)) {
disable_irq(KS8695_IRQ_UART_RX);
rx_enable(port, 0);
rx_enabled(port) = 0;
}
}

static void ks8695uart_enable_ms(struct uart_port *port)
{
if (!ms_enabled(port)) {
enable_irq(KS8695_IRQ_UART_MODEM_STATUS);
ms_enable(port,1);
}
enable_irq(KS8695_IRQ_UART_MODEM_STATUS);
}

static void ks8695uart_disable_ms(struct uart_port *port)
{
if (ms_enabled(port)) {
disable_irq(KS8695_IRQ_UART_MODEM_STATUS);
ms_enable(port,0);
}
disable_irq(KS8695_IRQ_UART_MODEM_STATUS);
}

static irqreturn_t ks8695uart_rx_chars(int irq, void *dev_id)
Expand Down Expand Up @@ -327,9 +285,8 @@ static int ks8695uart_startup(struct uart_port *port)
int retval;

set_irq_flags(KS8695_IRQ_UART_TX, IRQF_VALID | IRQF_NOAUTOEN);
tx_enable(port, 0);
rx_enable(port, 1);
ms_enable(port, 1);
tx_enabled(port) = 0;
rx_enabled(port) = 1;

/*
* Allocate the IRQ
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/smc91x.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

struct smc91x_platdata {
unsigned long flags;
unsigned char leda;
unsigned char ledb;
};

#endif /* __SMC91X_H__ */

0 comments on commit 4332395

Please sign in to comment.