Skip to content

I2c #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed

I2c #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions arch/arm/mach-bcm2708/bcm2708.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ static struct map_desc bcm2708_io_desc[] __initdata = {
.length = SZ_4K,
.type = MT_DEVICE},
#endif
{
.virtual = IO_ADDRESS(I2C0_BASE),
.pfn = __phys_to_pfn(I2C0_BASE),
.length = SZ_4K,
.type = MT_DEVICE},
{
.virtual = IO_ADDRESS(DMA_BASE),
.pfn = __phys_to_pfn(DMA_BASE),
Expand Down Expand Up @@ -304,6 +309,26 @@ static struct platform_device bcm2708_uart1_device = {
},
};

static struct resource bcm2708_i2c0_resources[] = {
{
.start = I2C0_BASE,
.end = I2C0_BASE + SZ_4K - 1,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_I2C,
.end = IRQ_I2C,
.flags = IORESOURCE_IRQ,
}
};

static struct platform_device bcm2708_i2c0_device = {
.name = "i2c-bcm2708",
.id = 0,
.resource = bcm2708_i2c0_resources,
.num_resources = ARRAY_SIZE(bcm2708_i2c0_resources),
};

static struct resource bcm2708_usb_resources[] = {
[0] = {
.start = USB_BASE,
Expand Down Expand Up @@ -491,6 +516,7 @@ void __init bcm2708_init(void)
bcm_register_device(&bcm2708_fb_device);
bcm_register_device(&bcm2708_usb_device);
bcm_register_device(&bcm2708_uart1_device);
bcm_register_device(&bcm2708_i2c0_device);
bcm_register_device(&bcm2708_powerman_device);
#ifdef CONFIG_MMC_SDHCI_BCM2708
bcm_register_device(&bcm2708_emmc_device);
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-bcm2708/bcm2708_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ static int bcm2708_gpio_probe(struct platform_device *dev)
ucb->gc.set = bcm2708_gpio_set;
ucb->gc.can_sleep = 0;

/* Hack: Set GPIOs 0/1 to ALT0 (I2C0) */
bcm2708_set_function(&ucb->gc, 0, GPIO_FSEL_ALT0);
bcm2708_set_function(&ucb->gc, 1, GPIO_FSEL_ALT0);

err = gpiochip_add(&ucb->gc);
if (err)
goto err;
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-bcm2708/include/mach/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#define GPIO_BASE (BCM2708_PERI_BASE + 0x200000) /* GPIO */
#define UART0_BASE (BCM2708_PERI_BASE + 0x201000) /* Uart 0 */
#define MMCI0_BASE (BCM2708_PERI_BASE + 0x202000) /* MMC interface */
#define I2C0_BASE (BCM2708_PERI_BASE + 0x205000)
#define UART1_BASE (BCM2708_PERI_BASE + 0x215000) /* Uart 1 */
#define EMMC_BASE (BCM2708_PERI_BASE + 0x300000) /* eMMC interface */
#define SMI_BASE (BCM2708_PERI_BASE + 0x600000) /* SMI */
Expand Down
12 changes: 12 additions & 0 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,18 @@ config I2C_EG20T
ML7213/ML7223 is companion chip for Intel Atom E6xx series.
ML7213/ML7223 is completely compatible for Intel EG20T PCH.

config I2C_BCM2708
tristate "Broadcom BCM2708 I2C controller"
depends on ARCH_BCM2708
help
If you say yes to this option, support will be included for the
BCM2708 I2C controller.

If you don't know what to do here, say N.

This support is also available as a module. If so, the module
will be called i2c-bcm2708.

comment "External I2C/SMBus adapter drivers"

config I2C_DIOLAN_U2C
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/busses/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
obj-$(CONFIG_I2C_OCTEON) += i2c-octeon.o
obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o
obj-$(CONFIG_I2C_BCM2708) += i2c-bcm2708.o

# External I2C/SMBus adapter drivers
obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
Expand Down
Loading