Skip to content

Commit

Permalink
i2c/aspeed: Rewrite driver
Browse files Browse the repository at this point in the history
Fixes from jk:

 - Set of_node of i2c bus devices, so the core code will enumerate for
   devices.
 - Rip out slave mode code
 - Simplify debugging printouts
 - Don't mask-out valid interrupt bits
 - Rework init procedure to match docs. We should enable the mode after
   the initial setup.
 - Use per-adapter device
 - It's "done", not "down".
 - Don't futz with the interrupt control register
 - Clean up interrupt definitions. Use common defs for the enable &
   status, and make the names a little more clear (TIMEOUT instead of
   TO, and ALERT instead of ALT, and make the address detection
   interrupts consistent).
 - Get rid fo xfer_mode, it could only be BYTE_XFER anyway.
 - Remove master_xfer callbacks, do_master_xfer could only have one value.
 - Remove master_xfer_len. It could only ever be 1. This allows us to
   remove xfer_len in master_xfer_done.
 - Simplify message state info
 - Rework driver state machine
 - Use separate controller & bus platform devices, use an irq controller
   for busses
 - Update for IRQ changes, fixes build failure after rebasting on 4.3.
   See d17cab4 for why I removed
   set_irq_flags.

Signed-off-by: Joel Stanley <[email protected]>
Signed-off-by: Jeremy Kerr <[email protected]>
  • Loading branch information
shenki committed Nov 16, 2015
1 parent 6f23ab4 commit 6eb496b
Show file tree
Hide file tree
Showing 5 changed files with 491 additions and 1,871 deletions.
61 changes: 33 additions & 28 deletions arch/arm/boot/dts/ast2400.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -92,74 +92,70 @@
i2c: i2c@1e78a040 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "aspeed,ast2400-i2c-common";
#interrupt-cells = <1>;

compatible = "aspeed,ast2400-i2c-controller";
reg = <0x1e78a000 0x40>;
ranges = <0 0x1e78a000 0x1000>;
interrupts = <12>;
clocks = <&clk_apb>;
clock-ranges;
interrupt-controller;

i2c0: i2c-bus@0x40 {
i2c0: i2c-bus@40 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <0>;
clock-frequency = <100000>;
status = "okay";
eeprom@50 {
compatible = "atmel,24c256";
reg = <0x50>;
pagesize = <64>;
};
rtc@68 {
compatible = "dallas,ds3231";
reg = <0x68>;
// interrupts = <GPIOF0>
};
interrupts = <0>;
interrupt-parent = <&i2c>;
};

i2c1: i2c-bus@0x80 {
i2c1: i2c-bus@80 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x80 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <1>;
clock-frequency = <100000>;
status = "okay";
interrupts = <1>;
};

i2c2: i2c-bus@0xC0 {
i2c2: i2c-bus@c0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0xC0 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <2>;
clock-frequency = <100000>;
status = "okay";
tmp423@4c {
compatible = "ti,tmp423";
reg = <0x4c>;
};
interrupts = <2>;
};

i2c3: i2c-bus@0x100 {
i2c3: i2c-bus@100 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x100 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <3>;
clock-frequency = <100000>;
status = "okay";
interrupts = <3>;
};

i2c4: i2c-bus@0x140 {
i2c4: i2c-bus@140 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x140 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <4>;
clock-frequency = <100000>;
status = "okay";
interrupts = <4>;
};

i2c5: i2c-bus@0x180 {
Expand All @@ -170,82 +166,91 @@
bus = <5>;
clock-frequency = <100000>;
status = "okay";
interrupts = <5>;
};

i2c6: i2c-bus@0x1C0 {
i2c6: i2c-bus@1c0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x1C0 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <6>;
clock-frequency = <100000>;
status = "okay";
interrupts = <6>;
};

i2c7: i2c-bus@0x300 {
i2c7: i2c-bus@300 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x300 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <7>;
clock-frequency = <100000>;
status = "okay";
interrupts = <7>;
};

i2c8: i2c-bus@0x340 {
i2c8: i2c-bus@340 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x340 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <8>;
clock-frequency = <100000>;
status = "okay";
interrupts = <8>;
};

i2c9: i2c-bus@0x380 {
i2c9: i2c-bus@380 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x380 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <9>;
clock-frequency = <100000>;
status = "disabled";
interrupts = <9>;
};

i2c10: i2c-bus@0x3C0 {
i2c10: i2c-bus@3c0 {
reg = <0x380 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <10>;
clock-frequency = <100000>;
status = "disabled";
interrupts = <10>;
};

i2c11: i2c-bus@0x400 {
i2c11: i2c-bus@400 {
reg = <0x400 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <11>;
clock-frequency = <100000>;
status = "disabled";
interrupts = <11>;
};

i2c12: i2c-bus@0x440 {
i2c12: i2c-bus@440 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x400 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <12>;
clock-frequency = <100000>;
status = "disabled";
interrupts = <12>;
};

i2c13: i2c-bus@0x480 {
i2c13: i2c-bus@480 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0x480 0x40>;
compatible = "aspeed,ast2400-i2c-bus";
bus = <13>;
clock-frequency = <100000>;
status = "disabled";
interrupts = <13>;
};

};
Expand Down
1 change: 1 addition & 0 deletions arch/arm/mach-aspeed/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ menuconfig ARCH_ASPEED
select ARCH_REQUIRE_GPIOLIB
select PINCTRL
select PINCTRL_ASPEED
select I2C_ASPEED
select PHYLIB if NETDEVICES
select MFD_SYSCON
select SRAM
Expand Down
11 changes: 11 additions & 0 deletions drivers/i2c/busses/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,17 @@ config I2C_RCAR
This driver can also be built as a module. If so, the module
will be called i2c-rcar.

config I2C_ASPEED
tristate "Aspeed AST2xxx SoC I2C Controller"
depends on ARCH_ASPEED
select I2C_SLAVE
help
If you say yes to this option, support will be included for the
Aspeed AST2xxx SoC I2C controller.

This driver can also be built as a module. If so, the module
will be called i2c-aspeed.

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 @@ -94,6 +94,7 @@ obj-$(CONFIG_I2C_XILINX) += i2c-xiic.o
obj-$(CONFIG_I2C_XLR) += i2c-xlr.o
obj-$(CONFIG_I2C_XLP9XX) += i2c-xlp9xx.o
obj-$(CONFIG_I2C_RCAR) += i2c-rcar.o
obj-$(CONFIG_I2C_ASPEED) += i2c-aspeed.o

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

0 comments on commit 6eb496b

Please sign in to comment.