summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-06-28 10:35:58 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2010-06-28 10:35:58 +0200
commit40aad62d1c2d0b49ab16d6891bbcbb3b39a56df9 (patch)
treef4b4ff7345379b62e29ff59b05c313a1ecaadbf6 /drivers
parent1a6fc8feb61c7fb27d206851baf60e3e60c2c90a (diff)
parent112d65d3d2bde37529e61d6ad3011c39a1f65589 (diff)
downloadbarebox-40aad62d1c2d0b49ab16d6891bbcbb3b39a56df9.tar.gz
barebox-40aad62d1c2d0b49ab16d6891bbcbb3b39a56df9.tar.xz
Merge remote branch 'origin/assorted-pu' into next
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/usb/asix.c12
-rw-r--r--drivers/net/usb/usbnet.c9
-rw-r--r--drivers/serial/serial_imx.c137
-rw-r--r--drivers/video/fb.c5
-rw-r--r--drivers/video/imx.c9
5 files changed, 94 insertions, 78 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index fc4146fdb..ca71b34e1 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -415,13 +415,13 @@ static int asix_rx_fixup(struct usbnet *dev, void *buf, int len)
while (len > 0) {
if ((short)(header & 0x0000ffff) != ~((short)((header & 0xffff0000) >> 16)))
- dev_err(&dev->dev, "asix_rx_fixup() Bad Header Length");
-
+ dev_err(&dev->edev.dev, "asix_rx_fixup() Bad Header Length");
+
/* get the packet length */
size = (unsigned short) (header & 0x0000ffff);
if (size > 1514) {
- dev_err(&dev->dev, "asix_rx_fixup() Bad RX Length %d", size);
+ dev_err(&dev->edev.dev, "asix_rx_fixup() Bad RX Length %d", size);
return 0;
}
@@ -440,7 +440,7 @@ static int asix_rx_fixup(struct usbnet *dev, void *buf, int len)
}
if (len < 0) {
- dev_err(&dev->dev,"asix_rx_fixup() Bad SKB Length %d", len);
+ dev_err(&dev->edev.dev,"asix_rx_fixup() Bad SKB Length %d", len);
return -1;
}
return 0;
@@ -503,13 +503,13 @@ static int ax88172_bind(struct usbnet *dev)
unsigned long gpio_bits = dev->driver_info->data;
struct asix_data *data = (struct asix_data *)&dev->data;
- dev_dbg(&dev->dev, "%s\n", __func__);
+ dev_dbg(&dev->edev.dev, "%s\n", __func__);
data->eeprom_len = AX88172_EEPROM_LEN;
ret = usbnet_get_endpoints(dev);
if (ret) {
- dev_err(&dev->dev, "can not get EPs\n");
+ dev_err(&dev->edev.dev, "can not get EPs\n");
return ret;
}
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index b0e309096..cc170f661 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -74,7 +74,7 @@ int usbnet_get_endpoints(struct usbnet *dev)
in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
dev->out = usb_sndbulkpipe (dev->udev,
out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
- dev_dbg(&dev->dev, "found endpoints: IN=%d OUT=%d\n",
+ dev_dbg(&dev->edev.dev, "found endpoints: IN=%d OUT=%d\n",
in->bEndpointAddress, out->bEndpointAddress);
return 0;
@@ -89,14 +89,14 @@ static int usbnet_send(struct eth_device *edev, void *eth_data, int data_length)
struct driver_info *info = dev->driver_info;
int len, alen, ret;
- dev_dbg(&dev->dev, "%s\n",__func__);
+ dev_dbg(&edev->dev, "%s\n",__func__);
/* some devices want funky USB-level framing, for
* win32 driver (usually) and/or hardware quirks
*/
if(info->tx_fixup) {
if(info->tx_fixup(dev, eth_data, data_length, tx_buffer, &len)) {
- dev_dbg(&dev->dev, "can't tx_fixup packet");
+ dev_dbg(&edev->dev, "can't tx_fixup packet");
return 0;
}
} else {
@@ -191,7 +191,7 @@ int usbnet_probe(struct usb_device *usbdev, const struct usb_device_id *prod)
struct driver_info *info;
int status;
- dev_dbg(&edev->dev, "%s\n", __func__);
+ dev_dbg(&usbdev->dev, "%s\n", __func__);
undev = xzalloc(sizeof (*undev));
@@ -206,6 +206,7 @@ int usbnet_probe(struct usb_device *usbdev, const struct usb_device_id *prod)
edev->recv = usbnet_recv,
edev->halt = usbnet_halt,
edev->priv = undev;
+ edev->dev = usbdev->dev; /* will be overwritten by eth_register */
info = (struct driver_info *)prod->driver_info;
undev->driver_info = info;
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 91d3b188c..801004e18 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -24,34 +24,35 @@
#include <init.h>
#include <malloc.h>
#include <notifier.h>
-
-#define URXD0(base) __REG( 0x0 +(base)) /* Receiver Register */
-#define URTX0(base) __REG( 0x40 +(base)) /* Transmitter Register */
-#define UCR1(base) __REG( 0x80 +(base)) /* Control Register 1 */
-#define UCR2(base) __REG( 0x84 +(base)) /* Control Register 2 */
-#define UCR3(base) __REG( 0x88 +(base)) /* Control Register 3 */
-#define UCR4(base) __REG( 0x8c +(base)) /* Control Register 4 */
-#define UFCR(base) __REG( 0x90 +(base)) /* FIFO Control Register */
-#define USR1(base) __REG( 0x94 +(base)) /* Status Register 1 */
-#define USR2(base) __REG( 0x98 +(base)) /* Status Register 2 */
-#define UESC(base) __REG( 0x9c +(base)) /* Escape Character Register */
-#define UTIM(base) __REG( 0xa0 +(base)) /* Escape Timer Register */
-#define UBIR(base) __REG( 0xa4 +(base)) /* BRM Incremental Register */
-#define UBMR(base) __REG( 0xa8 +(base)) /* BRM Modulator Register */
-#define UBRC(base) __REG( 0xac +(base)) /* Baud Rate Count Register */
+#include <asm/io.h>
+
+#define URXD0 0x0 /* Receiver Register */
+#define URTX0 0x40 /* Transmitter Register */
+#define UCR1 0x80 /* Control Register 1 */
+#define UCR2 0x84 /* Control Register 2 */
+#define UCR3 0x88 /* Control Register 3 */
+#define UCR4 0x8c /* Control Register 4 */
+#define UFCR 0x90 /* FIFO Control Register */
+#define USR1 0x94 /* Status Register 1 */
+#define USR2 0x98 /* Status Register 2 */
+#define UESC 0x9c /* Escape Character Register */
+#define UTIM 0xa0 /* Escape Timer Register */
+#define UBIR 0xa4 /* BRM Incremental Register */
+#define UBMR 0xa8 /* BRM Modulator Register */
+#define UBRC 0xac /* Baud Rate Count Register */
#ifdef CONFIG_ARCH_IMX1
-#define BIPR1(base) __REG( 0xb0 +(base)) /* Incremental Preset Register 1 */
-#define BIPR2(base) __REG( 0xb4 +(base)) /* Incremental Preset Register 2 */
-#define BIPR3(base) __REG( 0xb8 +(base)) /* Incremental Preset Register 3 */
-#define BIPR4(base) __REG( 0xbc +(base)) /* Incremental Preset Register 4 */
-#define BMPR1(base) __REG( 0xc0 +(base)) /* BRM Modulator Register 1 */
-#define BMPR2(base) __REG( 0xc4 +(base)) /* BRM Modulator Register 2 */
-#define BMPR3(base) __REG( 0xc8 +(base)) /* BRM Modulator Register 3 */
-#define BMPR4(base) __REG( 0xcc +(base)) /* BRM Modulator Register 4 */
-#define UTS(base) __REG( 0xd0 +(base)) /* UART Test Register */
+#define BIPR1 0xb0 /* Incremental Preset Register 1 */
+#define BIPR2 0xb4 /* Incremental Preset Register 2 */
+#define BIPR3 0xb8 /* Incremental Preset Register 3 */
+#define BIPR4 0xbc /* Incremental Preset Register 4 */
+#define BMPR1 0xc0 /* BRM Modulator Register 1 */
+#define BMPR2 0xc4 /* BRM Modulator Register 2 */
+#define BMPR3 0xc8 /* BRM Modulator Register 3 */
+#define BMPR4 0xcc /* BRM Modulator Register 4 */
+#define UTS 0xd0 /* UART Test Register */
#else
-#define ONEMS(base) __REG( 0xb0 +(base)) /* One Millisecond register */
-#define UTS(base) __REG( 0xb4 +(base)) /* UART Test Register */
+#define ONEMS 0xb0 /* One Millisecond register */
+#define UTS 0xb4 /* UART Test Register */
#endif
/* UART Control Register Bit Fields.*/
@@ -175,7 +176,7 @@ static int imx_serial_reffreq(ulong base)
{
ulong rfdiv;
- rfdiv = (UFCR(base) >> 7) & 7;
+ rfdiv = (readl(base + UFCR) >> 7) & 7;
rfdiv = rfdiv < 6 ? 6 - rfdiv : 7;
return imx_get_uartclk() / rfdiv;
@@ -190,45 +191,42 @@ static int imx_serial_init_port(struct console_device *cdev)
{
struct device_d *dev = cdev->dev;
ulong base = dev->map_base;
+ uint32_t val;
+
+ writel(UCR1_VAL, base + UCR1);
+ writel(UCR2_WS | UCR2_IRTS, base + UCR2);
+ writel(UCR3_VAL, base + UCR3);
+ writel(UCR4_VAL, base + UCR4);
+ writel(0x0000002B, base + UESC);
+ writel(0, base + UTIM);
+ writel(0, base + UBIR);
+ writel(0, base + UBMR);
+ writel(0, base + UTS);
- UCR1(base) = UCR1_VAL;
- UCR2(base) = UCR2_WS | UCR2_IRTS;
- UCR3(base) = UCR3_VAL;
- UCR4(base) = UCR4_VAL;
- UESC(base) = 0x0000002B;
- UTIM(base) = 0;
- UBIR(base) = 0;
- UBMR(base) = 0;
- UTS(base) = 0;
/* Configure FIFOs */
- UFCR(base) = 0xa81;
+ writel(0xa81, base + UFCR);
#ifdef ONEMS
- ONEMS(base) = imx_serial_reffreq(base) / 1000;
+ writel(imx_serial_reffreq(base) / 1000, base + ONEMS);
#endif
/* Enable FIFOs */
- UCR2(base) |= UCR2_SRST | UCR2_RXEN | UCR2_TXEN;
+ val = readl(base + UCR2);
+ val |= UCR2_SRST | UCR2_RXEN | UCR2_TXEN;
+ writel(val, base + UCR2);
/* Clear status flags */
- USR2(base) |= USR2_ADET |
- USR2_DTRF |
- USR2_IDLE |
- USR2_IRINT |
- USR2_WAKE |
- USR2_RTSF |
- USR2_BRCD |
- USR2_ORE |
- USR2_RDR;
+ val = readl(base + USR2);
+ val |= USR2_ADET | USR2_DTRF | USR2_IDLE | USR2_IRINT | USR2_WAKE |
+ USR2_RTSF | USR2_BRCD | USR2_ORE | USR2_RDR;
+ writel(val, base + USR2);
/* Clear status flags */
- USR1(base) |= USR1_PARITYERR |
- USR1_RTSD |
- USR1_ESCF |
- USR1_FRAMERR |
- USR1_AIRINT |
- USR1_AWAKE;
+ val = readl(base + USR2);
+ val |= USR1_PARITYERR | USR1_RTSD | USR1_ESCF | USR1_FRAMERR | USR1_AIRINT |
+ USR1_AWAKE;
+ writel(val, base + USR2);
return 0;
}
@@ -238,9 +236,9 @@ static void imx_serial_putc(struct console_device *cdev, char c)
struct device_d *dev = cdev->dev;
/* Wait for Tx FIFO not full */
- while (UTS(dev->map_base) & UTS_TXFULL);
+ while (readl(dev->map_base + UTS) & UTS_TXFULL);
- URTX0(dev->map_base) = c;
+ writel(c, dev->map_base + URTX0);
}
static int imx_serial_tstc(struct console_device *cdev)
@@ -248,7 +246,7 @@ static int imx_serial_tstc(struct console_device *cdev)
struct device_d *dev = cdev->dev;
/* If receive fifo is empty, return false */
- if (UTS(dev->map_base) & UTS_RXEMPTY)
+ if (readl(dev->map_base + UTS) & UTS_RXEMPTY)
return 0;
return 1;
}
@@ -258,9 +256,9 @@ static int imx_serial_getc(struct console_device *cdev)
struct device_d *dev = cdev->dev;
unsigned char ch;
- while (UTS(dev->map_base) & UTS_RXEMPTY);
+ while (readl(dev->map_base + UTS) & UTS_RXEMPTY);
- ch = URXD0(dev->map_base);
+ ch = readl(dev->map_base + URXD0);
return ch;
}
@@ -269,7 +267,7 @@ static void imx_serial_flush(struct console_device *cdev)
{
struct device_d *dev = cdev->dev;
- while (!(USR2(dev->map_base) & USR2_TXDC));
+ while (!(readl(dev->map_base + USR2) & USR2_TXDC));
}
static int imx_serial_setbaudrate(struct console_device *cdev, int baudrate)
@@ -277,18 +275,22 @@ static int imx_serial_setbaudrate(struct console_device *cdev, int baudrate)
struct device_d *dev = cdev->dev;
struct imx_serial_priv *priv = container_of(cdev,
struct imx_serial_priv, cdev);
+ uint32_t val;
+
ulong base = dev->map_base;
- ulong ucr1 = UCR1(base);
+ ulong ucr1 = readl(base + UCR1);
/* disable UART */
- UCR1(base) &= ~UCR1_UARTEN;
+ val = readl(base + UCR1);
+ val &= ~UCR1_UARTEN;
+ writel(val, base + UCR1);
/* Set the numerator value minus one of the BRM ratio */
- UBIR(base) = (baudrate / 100) - 1;
+ writel((baudrate / 100) - 1, base + UBIR);
/* Set the denominator value minus one of the BRM ratio */
- UBMR(base) = ((imx_serial_reffreq(base) / 1600) - 1);
+ writel((imx_serial_reffreq(base) / 1600) - 1, base + UBMR);
- UCR1(base) = ucr1;
+ writel(ucr1, base + UCR1);
priv->baudrate = baudrate;
@@ -310,6 +312,7 @@ static int imx_serial_probe(struct device_d *dev)
{
struct console_device *cdev;
struct imx_serial_priv *priv;
+ uint32_t val;
priv = malloc(sizeof(*priv));
cdev = &priv->cdev;
@@ -327,7 +330,9 @@ static int imx_serial_probe(struct device_d *dev)
imx_serial_setbaudrate(cdev, 115200);
/* Enable UART */
- UCR1(cdev->dev->map_base) |= UCR1_UARTEN;
+ val = readl(cdev->dev->map_base + UCR1);
+ val |= UCR1_UARTEN;
+ writel(val, cdev->dev->map_base + UCR1);
console_register(cdev);
priv->notify.notifier_call = imx_clocksource_clock_change;
diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index 841c3afe9..f9a425efa 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -39,6 +39,9 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
enable = simple_strtoul(val, NULL, 0);
+ if (info->enabled == !!enable)
+ return 0;
+
if (enable) {
info->fbops->fb_enable(info);
new = "1";
@@ -49,6 +52,8 @@ static int fb_enable_set(struct device_d *dev, struct param_d *param,
dev_param_set_generic(dev, param, new);
+ info->enabled = !!enable;
+
return 0;
}
diff --git a/drivers/video/imx.c b/drivers/video/imx.c
index d9ba643ac..ac518588c 100644
--- a/drivers/video/imx.c
+++ b/drivers/video/imx.c
@@ -152,6 +152,7 @@ struct imxfb_info {
struct fb_info info;
struct device_d *dev;
+ void (*enable)(int enable);
struct fb_info overlay;
};
@@ -262,12 +263,17 @@ static void imxfb_enable_controller(struct fb_info *info)
writel(readl(IMX_CCM_BASE + CCM_CGCR1) | (1 << 29),
IMX_CCM_BASE + CCM_CGCR1);
#endif
+ if (fbi->enable)
+ fbi->enable(1);
}
static void imxfb_disable_controller(struct fb_info *info)
{
struct imxfb_info *fbi = info->priv;
+ if (fbi->enable)
+ fbi->enable(0);
+
writel(0, fbi->regs + LCDC_RMCR);
#ifdef CONFIG_ARCH_IMX21
PCCR0 &= ~(PCCR0_PERCLK3_EN | PCCR0_HCLK_LCDC_EN);
@@ -546,6 +552,7 @@ static int imxfb_probe(struct device_d *dev)
fbi->pwmr = pdata->pwmr;
fbi->lscr1 = pdata->lscr1;
fbi->dmacr = pdata->dmacr;
+ fbi->enable = pdata->enable;
fbi->dev = dev;
info->priv = fbi;
info->mode = &pdata->mode->mode;
@@ -572,8 +579,6 @@ static int imxfb_probe(struct device_d *dev)
#ifdef CONFIG_IMXFB_DRIVER_VIDEO_IMX_OVERLAY
imxfb_register_overlay(fbi, pdata->framebuffer_ovl);
#endif
- imxfb_enable_controller(info);
-
return 0;
}